This is a note to let you know that I've just added the patch titled media: dvbdev: Fix memory leak in dvb_media_device_free() 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-memory-leak-in-dvb_media_device_free.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 bf9a40ae8d722f281a2721779595d6df1c33a0bf Mon Sep 17 00:00:00 2001 From: Peilin Ye <yepeilin.cs@xxxxxxxxx> Date: Fri, 11 Dec 2020 09:30:39 +0100 Subject: media: dvbdev: Fix memory leak in dvb_media_device_free() From: Peilin Ye <yepeilin.cs@xxxxxxxxx> commit bf9a40ae8d722f281a2721779595d6df1c33a0bf upstream. dvb_media_device_free() is leaking memory. Free `dvbdev->adapter->conn` before setting it to NULL, as documented in include/media/media-device.h: "The media_entity instance itself must be freed explicitly by the driver if required." Link: https://syzkaller.appspot.com/bug?id=9bbe4b842c98f0ed05c5eed77a226e9de33bf298 Link: https://lore.kernel.org/linux-media/20201211083039.521617-1-yepeilin.cs@xxxxxxxxx Cc: stable@xxxxxxxxxxxxxxx Fixes: 0230d60e4661 ("[media] dvbdev: Add RF connector if needed") Reported-by: syzbot+7f09440acc069a0d38ac@xxxxxxxxxxxxxxxxxxxxxxxxx Signed-off-by: Peilin Ye <yepeilin.cs@xxxxxxxxx> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/media/dvb-core/dvbdev.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/media/dvb-core/dvbdev.c +++ b/drivers/media/dvb-core/dvbdev.c @@ -241,6 +241,7 @@ static void dvb_media_device_free(struct if (dvbdev->adapter->conn) { media_device_unregister_entity(dvbdev->adapter->conn); + kfree(dvbdev->adapter->conn); dvbdev->adapter->conn = NULL; kfree(dvbdev->adapter->conn_pads); dvbdev->adapter->conn_pads = NULL; Patches currently in stable-queue which might be from yepeilin.cs@xxxxxxxxx are queue-5.4/media-dvbdev-fix-memory-leak-in-dvb_media_device_free.patch