Repository navigation
Commit 0ff0ae6
media: em28xx: fix memory leak in em28xx_init_dev
[ Upstream commit 22be5a1 ]
In the em28xx_init_rev, if em28xx_audio_setup fails, this function fails
to deallocate the media_dev allocated in the em28xx_media_device_init.
Fix this by adding em28xx_unregister_media_device to free media_dev.
BTW, this patch is tested in my local syzkaller instance, and it can
prevent the memory leak from occurring again.
CC: Pavel Skripkin <paskripkin@gmail.com>
Fixes: 37ecc7b ("[media] em28xx: add media controller support")
Signed-off-by: Dongliang Mu <mudongliangabcd@gmail.com>
Reported-by: syzkaller <syzkaller@googlegroups.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>1 parent b441d94 commit 0ff0ae6
1 file changed
Lines changed: 12 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3575 | 3575 | | |
3576 | 3576 | | |
3577 | 3577 | | |
3578 | | - | |
3579 | | - | |
| 3578 | + | |
| 3579 | + | |
| 3580 | + | |
| 3581 | + | |
3580 | 3582 | | |
3581 | 3583 | | |
3582 | 3584 | | |
| |||
3595 | 3597 | | |
3596 | 3598 | | |
3597 | 3599 | | |
3598 | | - | |
| 3600 | + | |
3599 | 3601 | | |
3600 | 3602 | | |
3601 | 3603 | | |
| |||
3611 | 3613 | | |
3612 | 3614 | | |
3613 | 3615 | | |
3614 | | - | |
3615 | | - | |
3616 | | - | |
| 3616 | + | |
3617 | 3617 | | |
3618 | 3618 | | |
3619 | 3619 | | |
3620 | 3620 | | |
3621 | 3621 | | |
3622 | 3622 | | |
3623 | 3623 | | |
| 3624 | + | |
| 3625 | + | |
| 3626 | + | |
| 3627 | + | |
| 3628 | + | |
| 3629 | + | |
3624 | 3630 | | |
3625 | 3631 | | |
3626 | 3632 | | |
| |||
0 commit comments