[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20201211083039.521617-1-yepeilin.cs@gmail.com>
Date: Fri, 11 Dec 2020 03:30:39 -0500
From: Peilin Ye <yepeilin.cs@...il.com>
To: Mauro Carvalho Chehab <mchehab@...nel.org>
Cc: Laurent Pinchart <laurent.pinchart@...asonboard.com>,
Sean Young <sean@...s.org>, Brad Love <brad@...tdimension.cc>,
Wolfram Sang <wsa+renesas@...g-engineering.com>,
linux-media@...r.kernel.org, linux-kernel@...r.kernel.org,
Peilin Ye <yepeilin.cs@...il.com>
Subject: [PATCH] media: dvbdev: Fix memory leak in dvb_media_device_free()
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."
Cc: stable@...r.kernel.org
Fixes: 0230d60e4661 ("[media] dvbdev: Add RF connector if needed")
Reported-by: syzbot+7f09440acc069a0d38ac@...kaller.appspotmail.com
Link: https://syzkaller.appspot.com/bug?id=9bbe4b842c98f0ed05c5eed77a226e9de33bf298
Signed-off-by: Peilin Ye <yepeilin.cs@...il.com>
---
drivers/media/dvb-core/dvbdev.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/media/dvb-core/dvbdev.c b/drivers/media/dvb-core/dvbdev.c
index 959fa2820259..ec9ebff28552 100644
--- 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 dvb_device *dvbdev)
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;
--
2.25.1
Powered by blists - more mailing lists