Skip to content

Commit af872b6

Browse files
committed
Merge tag 'ieee802154-for-net-2022-01-05' of git://git.kernel.org/pub/scm/linux/kernel/git/sschmidt/wpan
Stefan Schmidt says: ==================== pull-request: ieee802154 for net 2022-01-05 Below I have a last minute fix for the atusb driver. Pavel fixes a KASAN uninit report for the driver. This version is the minimal impact fix to ease backporting. A bigger rework of the driver to avoid potential similar problems is ongoing and will come through net-next when ready. * tag 'ieee802154-for-net-2022-01-05' of git://git.kernel.org/pub/scm/linux/kernel/git/sschmidt/wpan: ieee802154: atusb: fix uninit value in atusb_set_extended_addr ==================== Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents b3c8e0d + 754e438 commit af872b6

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

drivers/net/ieee802154/atusb.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,9 @@ static int atusb_control_msg(struct atusb *atusb, unsigned int pipe,
9393

9494
ret = usb_control_msg(usb_dev, pipe, request, requesttype,
9595
value, index, data, size, timeout);
96-
if (ret < 0) {
96+
if (ret < size) {
97+
ret = ret < 0 ? ret : -ENODATA;
98+
9799
atusb->err = ret;
98100
dev_err(&usb_dev->dev,
99101
"%s: req 0x%02x val 0x%x idx 0x%x, error %d\n",
@@ -861,9 +863,9 @@ static int atusb_get_and_show_build(struct atusb *atusb)
861863
if (!build)
862864
return -ENOMEM;
863865

864-
ret = atusb_control_msg(atusb, usb_rcvctrlpipe(usb_dev, 0),
865-
ATUSB_BUILD, ATUSB_REQ_FROM_DEV, 0, 0,
866-
build, ATUSB_BUILD_SIZE, 1000);
866+
/* We cannot call atusb_control_msg() here, since this request may read various length data */
867+
ret = usb_control_msg(atusb->usb_dev, usb_rcvctrlpipe(usb_dev, 0), ATUSB_BUILD,
868+
ATUSB_REQ_FROM_DEV, 0, 0, build, ATUSB_BUILD_SIZE, 1000);
867869
if (ret >= 0) {
868870
build[ret] = 0;
869871
dev_info(&usb_dev->dev, "Firmware: build %s\n", build);

0 commit comments

Comments
 (0)