]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
net: usb: pegasus: fix improper read if get_registers() fail
authorDenis Kirjanov <kda@linux-powerpc.org>
Tue, 30 Jul 2019 13:13:57 +0000 (15:13 +0200)
committerDavid S. Miller <davem@davemloft.net>
Thu, 1 Aug 2019 22:18:27 +0000 (18:18 -0400)
get_registers() may fail with -ENOMEM and in this
case we can read a garbage from the status variable tmp.

Reported-by: syzbot+3499a83b2d062ae409d4@syzkaller.appspotmail.com
Signed-off-by: Denis Kirjanov <kda@linux-powerpc.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/usb/pegasus.c

index 6d25dea5ad4b2a956c7c0e4772e64c100c5bd5b1..f7d117d80cfbb81b7fad2e22dd13900290030dc9 100644 (file)
@@ -282,7 +282,7 @@ static void mdio_write(struct net_device *dev, int phy_id, int loc, int val)
 static int read_eprom_word(pegasus_t *pegasus, __u8 index, __u16 *retdata)
 {
        int i;
-       __u8 tmp;
+       __u8 tmp = 0;
        __le16 retdatai;
        int ret;