]> git.proxmox.com Git - mirror_ubuntu-jammy-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)
committerStefan Bader <stefan.bader@canonical.com>
Wed, 27 Apr 2022 09:57:34 +0000 (11:57 +0200)
commit0a3562e7048c98faa132afc71439d783f817582f
treec963899b58587362ec35a891eaf3a6ecc9f903a7
parente83c4ec82c5c69aeb13c16cb2f29a14a185e428e
net: asix: add proper error handling of usb read errors

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit 920a9fa27e7805499cfe78491b36fed2322c02ec ]

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: d9fe64e51114 ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit b96a7265f763b37ff3138b9ca8122a950f13b00e)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
drivers/net/usb/asix.h
drivers/net/usb/asix_common.c
drivers/net/usb/asix_devices.c