]> git.baikalelectronics.ru Git - kernel.git/commit
net: asix: add proper error handling of usb read errors
authorPavel Skripkin <paskripkin@gmail.com>
Sun, 6 Feb 2022 18:05:16 +0000 (21:05 +0300)
committerDavid S. Miller <davem@davemloft.net>
Mon, 7 Feb 2022 12:28:36 +0000 (12:28 +0000)
commit99cee21f87007eeda50e0deab6b8ad292a493baa
tree489a32cf147146a9e7853cba58300753b75fbf72
parent2cda3ecf4ab23df25125ab7c05d1bf6b91617b03
net: asix: add proper error handling of usb read errors

Syzbot once again hit uninit value in asix driver. The problem still the
same -- asix_read_cmd() reads less bytes, than was requested by caller.

Since all read requests are performed via asix_read_cmd() let's catch
usb related error there and add __must_check notation to be sure all
callers actually check return value.

So, this patch adds sanity check inside asix_read_cmd(), that simply
checks if bytes read are not less, than was requested and adds missing
error handling of asix_read_cmd() all across the driver code.

Fixes: a80da59df198 ("net: asix: Add in_pm parameter")
Reported-and-tested-by: syzbot+6ca9f7867b77c2d316ac@syzkaller.appspotmail.com
Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
Tested-by: Oleksij Rempel <o.rempel@pengutronix.de>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/usb/asix.h
drivers/net/usb/asix_common.c
drivers/net/usb/asix_devices.c