[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20210327150916.31848-1-paskripkin@gmail.com>
Date: Sat, 27 Mar 2021 18:09:16 +0300
From: Pavel Skripkin <paskripkin@...il.com>
To: mchehab@...nel.org, andy.shevchenko@...il.com
Cc: linux-media@...r.kernel.org, linux-kernel@...r.kernel.org,
Pavel Skripkin <paskripkin@...il.com>,
syzbot+889397c820fa56adf25d@...kaller.appspotmail.com
Subject: [PATCH v2] media: usb: fix memory leak in em28xx_dvb_init
syzbot reported memory leak in em28xx_dvb_init()[1]
The problem was in wrong error handling after em28xx_alloc_urbs()[2] call.
In case of error allocated urbs must be freed
backtrace:
[<ffffffff8304c141>] kmalloc_array.constprop.0+0x41/0x60 include/linux/slab.h:594
[<ffffffff8304dba2>] kcalloc include/linux/slab.h:623 [inline]
[<ffffffff8304dba2>] em28xx_alloc_urbs+0x102/0x550 drivers/media/usb/em28xx/em28xx-core.c:930 [2]
[<ffffffff84279fa7>] em28xx_dvb_init drivers/media/usb/em28xx/em28xx-dvb.c:1517 [inline] [1]
Reported-by: syzbot+889397c820fa56adf25d@...kaller.appspotmail.com
Signed-off-by: Pavel Skripkin <paskripkin@...il.com>
---
drivers/media/usb/em28xx/em28xx-dvb.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/media/usb/em28xx/em28xx-dvb.c b/drivers/media/usb/em28xx/em28xx-dvb.c
index 526424279637..471bd74667e3 100644
--- a/drivers/media/usb/em28xx/em28xx-dvb.c
+++ b/drivers/media/usb/em28xx/em28xx-dvb.c
@@ -2010,6 +2010,7 @@ static int em28xx_dvb_init(struct em28xx *dev)
return result;
out_free:
+ em28xx_uninit_usb_xfer(dev, EM28XX_DIGITAL_MODE);
kfree(dvb);
dev->dvb = NULL;
goto ret;
--
2.30.2
Powered by blists - more mailing lists