media: dvb-usb: az6027: fix null-ptr-deref in az6027_i2c_xfer()
Wei Chen reports a kernel bug as blew: general protection fault, probably for non-canonical address KASAN: null-ptr-deref in range [0x0000000000000010-0x0000000000000017] ... Call Trace: <TASK> __i2c_transfer+0x77e/0x1930 drivers/i2c/i2c-core-base.c:2109 i2c_transfer+0x1d5/0x3d0 drivers/i2c/i2c-core-base.c:2170 i2cdev_ioctl_rdwr+0x393/0x660 drivers/i2c/i2c-dev.c:297 i2cdev_ioctl+0x75d/0x9f0 drivers/i2c/i2c-dev.c:458 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:870 [inline] __se_sys_ioctl+0xfb/0x170 fs/ioctl.c:856 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0x90 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7fd834a8bded In az6027_i2c_xfer(), if msg[i].addr is 0x99, a null-ptr-deref will caused when accessing msg[i].buf. For msg[i].len is 0 and msg[i].buf is null. Fix this by checking msg[i].len in az6027_i2c_xfer(). Link: https://lore.kernel.org/lkml/CAO4mrfcPHB5aQJO=mpqV+p8mPLNg-Fok0gw8gZ=zemAfMGTzMg@mail.gmail.com/ Link: https://lore.kernel.org/linux-media/20221120065918.2160782-1-zhongbaisong@huawei.com Fixes: 76f9a820 ("V4L/DVB: AZ6027: Initial import of the driver") Reported-by:Wei Chen <harperchen1110@gmail.com> Signed-off-by:
Baisong Zhong <zhongbaisong@huawei.com> Signed-off-by:
Mauro Carvalho Chehab <mchehab@kernel.org>
Loading
-
mentioned in commit 6c01ef65
-
mentioned in commit c7e5ac73
-
mentioned in commit 4a9763d2
-
mentioned in commit a9def3e9
-
mentioned in commit 578b6761
-
mentioned in commit d9ef84a7
-
mentioned in commit 5b1ea100
-
mentioned in commit 3dd5846a
-
mentioned in commit 033b0c07
-
mentioned in commit 2a33fc57
-
mentioned in commit b49c6e5d
-
mentioned in commit 8dc5b370
-
mentioned in commit 0c02eb70
-
mentioned in commit 991c77fe
-
mentioned in commit 0143f282
-
mentioned in commit abb6fd93
-
mentioned in commit 14b94154
-
mentioned in commit 6ab7ea4e
-
mentioned in commit dfcd3c01
Please register or sign in to comment