This is a note to let you know that I've just added the patch titled media: dvbdev: fix error logic at dvb_register_device() to the 5.4-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: media-dvbdev-fix-error-logic-at-dvb_register_device.patch and it can be found in the queue-5.4 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 1fec2ecc252301110e4149e6183fa70460d29674 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab <mchehab+huawei@xxxxxxxxxx> Date: Wed, 9 Jun 2021 14:32:29 +0200 Subject: media: dvbdev: fix error logic at dvb_register_device() From: Mauro Carvalho Chehab <mchehab+huawei@xxxxxxxxxx> commit 1fec2ecc252301110e4149e6183fa70460d29674 upstream. As reported by smatch: drivers/media/dvb-core/dvbdev.c: drivers/media/dvb-core/dvbdev.c:510 dvb_register_device() warn: '&dvbdev->list_head' not removed from list drivers/media/dvb-core/dvbdev.c: drivers/media/dvb-core/dvbdev.c:530 dvb_register_device() warn: '&dvbdev->list_head' not removed from list drivers/media/dvb-core/dvbdev.c: drivers/media/dvb-core/dvbdev.c:545 dvb_register_device() warn: '&dvbdev->list_head' not removed from list The error logic inside dvb_register_device() doesn't remove devices from the dvb_adapter_list in case of errors. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@xxxxxxxxxx> Signed-off-by: Ovidiu Panait <ovidiu.panait@xxxxxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/media/dvb-core/dvbdev.c | 3 +++ 1 file changed, 3 insertions(+) --- a/drivers/media/dvb-core/dvbdev.c +++ b/drivers/media/dvb-core/dvbdev.c @@ -511,6 +511,7 @@ int dvb_register_device(struct dvb_adapt break; if (minor == MAX_DVB_MINORS) { + list_del (&dvbdev->list_head); kfree(dvbdevfops); kfree(dvbdev); up_write(&minor_rwsem); @@ -531,6 +532,7 @@ int dvb_register_device(struct dvb_adapt __func__); dvb_media_device_free(dvbdev); + list_del (&dvbdev->list_head); kfree(dvbdevfops); kfree(dvbdev); mutex_unlock(&dvbdev_register_lock); @@ -546,6 +548,7 @@ int dvb_register_device(struct dvb_adapt pr_err("%s: failed to create device dvb%d.%s%d (%ld)\n", __func__, adap->num, dnames[type], id, PTR_ERR(clsdev)); dvb_media_device_free(dvbdev); + list_del (&dvbdev->list_head); kfree(dvbdevfops); kfree(dvbdev); return PTR_ERR(clsdev); Patches currently in stable-queue which might be from mchehab+huawei@xxxxxxxxxx are queue-5.4/media-dvbdev-fix-memleak-in-dvb_register_device.patch queue-5.4/media-dvbdev-fix-error-logic-at-dvb_register_device.patch