diff options
author | Muhammad Usama Anjum <musamaanjum@gmail.com> | 2021-03-24 21:07:53 +0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab+huawei@kernel.org> | 2021-04-06 11:36:58 +0300 |
commit | 0ae10a7dc8992ee682ff0b1752ff7c83d472eef1 (patch) | |
tree | 862341f7a5da9bb8f6b822a73d7aac999e88b7fe /drivers/media/usb | |
parent | 73c9a3f3b3465be8b7c71ba736c2696290a43bf8 (diff) | |
download | linux-0ae10a7dc8992ee682ff0b1752ff7c83d472eef1.tar.xz |
media: em28xx: fix memory leak
If some error occurs, URB buffers should also be freed. If they aren't
freed with the dvb here, the em28xx_dvb_fini call doesn't frees the URB
buffers as dvb is set to NULL. The function in which error occurs should
do all the cleanup for the allocations it had done.
Tested the patch with the reproducer provided by syzbot. This patch
fixes the memleak.
Reported-by: syzbot+889397c820fa56adf25d@syzkaller.appspotmail.com
Signed-off-by: Muhammad Usama Anjum <musamaanjum@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Diffstat (limited to 'drivers/media/usb')
-rw-r--r-- | drivers/media/usb/em28xx/em28xx-dvb.c | 1 |
1 files changed, 1 insertions, 0 deletions
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 @@ ret: return result; out_free: + em28xx_uninit_usb_xfer(dev, EM28XX_DIGITAL_MODE); kfree(dvb); dev->dvb = NULL; goto ret; |