media: drivers/media/usb: fix memory leak in zr364xx_probe
authorPavel Skripkin <paskripkin@gmail.com>
Mon, 1 Mar 2021 20:38:26 +0000 (21:38 +0100)
committerSasha Levin <sashal@kernel.org>
Thu, 26 Aug 2021 12:35:34 +0000 (08:35 -0400)
commitff2fc9e4aaa6551f5b4a4ba0a3a7ea89771694ac
tree438b4b49c3b11529578ed171513632221669b83d
parent56320b1ad4d0c6a67ab42198c40b9f43a0ed8756
media: drivers/media/usb: fix memory leak in zr364xx_probe

[ Upstream commit 9c39be40c0155c43343f53e3a439290c0fec5542 ]

syzbot reported memory leak in zr364xx_probe()[1].
The problem was in invalid error handling order.
All error conditions rigth after v4l2_ctrl_handler_init()
must call v4l2_ctrl_handler_free().

Reported-by: syzbot+efe9aefc31ae1e6f7675@syzkaller.appspotmail.com
Signed-off-by: Pavel Skripkin <paskripkin@gmail.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>
drivers/media/usb/zr364xx/zr364xx.c