ax88172a: fix ax88172a_unbind() failures
authorGeorge Kennedy <george.kennedy@oracle.com>
Wed, 15 Jul 2020 13:59:31 +0000 (09:59 -0400)
committerJakub Kicinski <kuba@kernel.org>
Thu, 16 Jul 2020 01:26:29 +0000 (18:26 -0700)
If ax88172a_unbind() fails, make sure that the return code is
less than zero so that cleanup is done properly and avoid UAF.

Fixes: a9a51bd727d1 ("ax88172a: fix information leak on short answers")
Signed-off-by: George Kennedy <george.kennedy@oracle.com>
Reported-by: syzbot+4cd84f527bf4a10fc9c1@syzkaller.appspotmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/usb/ax88172a.c

index 4e514f5d7c6c7c2a2af2cbb3e214c902bc8c7302..fd3a04d98dc14b4a2786a23bd40f2f4b3845dcbe 100644 (file)
@@ -187,6 +187,7 @@ static int ax88172a_bind(struct usbnet *dev, struct usb_interface *intf)
        ret = asix_read_cmd(dev, AX_CMD_READ_NODE_ID, 0, 0, ETH_ALEN, buf, 0);
        if (ret < ETH_ALEN) {
                netdev_err(dev->net, "Failed to read MAC address: %d\n", ret);
+               ret = -EIO;
                goto free;
        }
        memcpy(dev->net->dev_addr, buf, ETH_ALEN);