media: flexcop-usb: fix NULL-ptr deref in flexcop_usb_transfer_init()
authorYang Yingliang <yangyingliang@huawei.com>
Tue, 24 Sep 2019 09:49:04 +0000 (06:49 -0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 31 Dec 2019 15:34:57 +0000 (16:34 +0100)
commitc8ae65bf3d83156f9671d668a2c3b2830268becb
treeeea2c6ff48ba1cf0ccfce4946b92406eb8485a30
parent5a23b8f48996459b378bc4e58fda9f94831e8319
media: flexcop-usb: fix NULL-ptr deref in flexcop_usb_transfer_init()

[ Upstream commit 649cd16c438f51d4cd777e71ca1f47f6e0c5e65d ]

If usb_set_interface() failed, iface->cur_altsetting will
not be assigned and it will be used in flexcop_usb_transfer_init()
It may lead a NULL pointer dereference.

Check usb_set_interface() return value in flexcop_usb_init()
and return failed to avoid using this NULL pointer.

Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/media/usb/b2c2/flexcop-usb.c