1. 21 Apr, 2021 3 commits
    • Michael Walle's avatar
      net: phy: at803x: fix probe error if copper page is selected · 8f7e8762
      Michael Walle authored
      The commit c329e5af ("net: phy: at803x: select correct page on
      config init") selects the copper page during probe. This fails if the
      copper page was already selected. In this case, the value of the copper
      page (which is 1) is propagated through phy_restore_page() and is
      finally returned for at803x_probe(). Fix it, by just using the
      at803x_page_write() directly.
      
      Also in case of an error, the regulator is not disabled and leads to a
      WARN_ON() when the probe fails. This couldn't happen before, because
      at803x_parse_dt() was the last call in at803x_probe(). It is hard to
      see, that the parse_dt() actually enables the regulator. Thus move the
      regulator_enable() to the probe function and undo it in case of an
      error.
      
      Fixes: c329e5af ("net: phy: at803x: select correct page on config init")
      Signed-off-by: default avatarMichael Walle <michael@walle.cc>
      Reviewed-by: default avatarDavid Bauer <mail@david-bauer.net>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8f7e8762
    • Colin Ian King's avatar
      net: mana: remove redundant initialization of variable err · 55cdc26a
      Colin Ian King authored
      The variable err is being initialized with a value that is
      never read and it is being updated later with a new value.  The
      initialization is redundant and can be removed
      
      Addresses-Coverity: ("Unused value")
      Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      55cdc26a
    • Eric Dumazet's avatar
      virtio-net: fix use-after-free in page_to_skb() · af39c8f7
      Eric Dumazet authored
      KASAN/syzbot had 4 reports, one of them being:
      
      BUG: KASAN: slab-out-of-bounds in memcpy include/linux/fortify-string.h:191 [inline]
      BUG: KASAN: slab-out-of-bounds in page_to_skb+0x5cf/0xb70 drivers/net/virtio_net.c:480
      Read of size 12 at addr ffff888014a5f800 by task systemd-udevd/8445
      
      CPU: 0 PID: 8445 Comm: systemd-udevd Not tainted 5.12.0-rc8-next-20210419-syzkaller #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
      Call Trace:
       <IRQ>
       __dump_stack lib/dump_stack.c:79 [inline]
       dump_stack+0x141/0x1d7 lib/dump_stack.c:120
       print_address_description.constprop.0.cold+0x5b/0x2f8 mm/kasan/report.c:233
       __kasan_report mm/kasan/report.c:419 [inline]
       kasan_report.cold+0x7c/0xd8 mm/kasan/report.c:436
       check_region_inline mm/kasan/generic.c:180 [inline]
       kasan_check_range+0x13d/0x180 mm/kasan/generic.c:186
       memcpy+0x20/0x60 mm/kasan/shadow.c:65
       memcpy include/linux/fortify-string.h:191 [inline]
       page_to_skb+0x5cf/0xb70 drivers/net/virtio_net.c:480
       receive_mergeable drivers/net/virtio_net.c:1009 [inline]
       receive_buf+0x2bc0/0x6250 drivers/net/virtio_net.c:1119
       virtnet_receive drivers/net/virtio_net.c:1411 [inline]
       virtnet_poll+0x568/0x10b0 drivers/net/virtio_net.c:1516
       __napi_poll+0xaf/0x440 net/core/dev.c:6962
       napi_poll net/core/dev.c:7029 [inline]
       net_rx_action+0x801/0xb40 net/core/dev.c:7116
       __do_softirq+0x29b/0x9fe kernel/softirq.c:559
       invoke_softirq kernel/softirq.c:433 [inline]
       __irq_exit_rcu+0x136/0x200 kernel/softirq.c:637
       irq_exit_rcu+0x5/0x20 kernel/softirq.c:649
       common_interrupt+0xa4/0xd0 arch/x86/kernel/irq.c:240
      
      Fixes: fb32856b ("virtio-net: page_to_skb() use build_skb when there's sufficient tailroom")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Reported-by: default avatarsyzbot <syzkaller@googlegroups.com>
      Reported-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Reported-by: default avatarMat Martineau <mathew.j.martineau@linux.intel.com>
      Cc: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
      Cc: Jason Wang <jasowang@redhat.com>
      Cc: "Michael S. Tsirkin" <mst@redhat.com>
      Cc: virtualization@lists.linux-foundation.org
      Acked-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      af39c8f7
  2. 20 Apr, 2021 37 commits