]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
ax88172a: fix ax88172a_unbind() failures
authorGeorge Kennedy <george.kennedy@oracle.com>
Wed, 15 Jul 2020 13:59:31 +0000 (09:59 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 29 Jul 2020 05:42:53 +0000 (07:42 +0200)
[ Upstream commit c28d9a285668c799eeae2f7f93e929a6028a4d6d ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/usb/ax88172a.c

index 914cac55a7ae702b5a3a4dc7178effdac1d0eedb..909755ef71ac3edfd60ff9c76b8e0ed5089c1d70 100644 (file)
@@ -210,6 +210,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);