This is a note to let you know that I've just added the patch titled media: dvbdev: Fix memleak in dvb_register_device to the 5.10-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-memleak-in-dvb_register_device.patch and it can be found in the queue-5.10 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From stable-owner@xxxxxxxxxxxxxxx Mon Jun 12 15:40:18 2023 From: ovidiu.panait@xxxxxxxxxxxxx Date: Mon, 12 Jun 2023 16:39:05 +0300 Subject: media: dvbdev: Fix memleak in dvb_register_device To: stable@xxxxxxxxxxxxxxx Cc: Dinghao Liu <dinghao.liu@xxxxxxxxxx>, Sean Young <sean@xxxxxxxx>, Mauro Carvalho Chehab <mchehab+huawei@xxxxxxxxxx>, Ovidiu Panait <ovidiu.panait@xxxxxxxxxxxxx> Message-ID: <20230612133907.2999114-1-ovidiu.panait@xxxxxxxxxxxxx> From: Dinghao Liu <dinghao.liu@xxxxxxxxxx> commit 167faadfcf9339088910e9e85a1b711fcbbef8e9 upstream. When device_create() fails, dvbdev and dvbdevfops should be freed just like when dvb_register_media_device() fails. Signed-off-by: Dinghao Liu <dinghao.liu@xxxxxxxxxx> Signed-off-by: Sean Young <sean@xxxxxxxx> 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 @@ -545,6 +545,9 @@ int dvb_register_device(struct dvb_adapt if (IS_ERR(clsdev)) { 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); + kfree(dvbdevfops); + kfree(dvbdev); return PTR_ERR(clsdev); } dprintk("DVB: register adapter%d/%s%d @ minor: %i (0x%02x)\n", Patches currently in stable-queue which might be from stable-owner@xxxxxxxxxxxxxxx are queue-5.10/media-dvb-core-fix-use-after-free-due-to-race-at-dvb_register_device.patch queue-5.10/media-dvbdev-fix-memleak-in-dvb_register_device.patch queue-5.10/media-dvbdev-fix-error-logic-at-dvb_register_device.patch