1. 23 1月, 2020 9 次提交
    • H
      r8152: disable U2P3 for RTL8153B · 809a7fc6
      Hayes Wang 提交于
      Enable U2P3 may miss zero packet for bulk-in.
      Signed-off-by: NHayes Wang <hayeswang@realtek.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      809a7fc6
    • H
      r8152: get default setting of WOL before initializing · 9583a363
      Hayes Wang 提交于
      Initailization would reset runtime suspend by tp->saved_wolopts, so
      the tp->saved_wolopts should be set before initializing.
      Signed-off-by: NHayes Wang <hayeswang@realtek.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      9583a363
    • H
      r8152: reset flow control patch when linking on for RTL8153B · f99cd20e
      Hayes Wang 提交于
      When linking ON, the patch of flow control has to be reset. This
      makes sure the patch works normally.
      Signed-off-by: NHayes Wang <hayeswang@realtek.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      f99cd20e
    • H
      r8152: fix runtime resume for linking change · a3914272
      Hayes Wang 提交于
      Fix the runtime resume doesn't work normally for linking change.
      
      1. Reset the settings and status of runtime suspend.
      2. Sync the linking status.
      3. Poll the linking change.
      Signed-off-by: NHayes Wang <hayeswang@realtek.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a3914272
    • E
      gtp: make sure only SOCK_DGRAM UDP sockets are accepted · 940ba149
      Eric Dumazet 提交于
      A malicious user could use RAW sockets and fool
      GTP using them as standard SOCK_DGRAM UDP sockets.
      
      BUG: KMSAN: uninit-value in udp_tunnel_encap_enable include/net/udp_tunnel.h:174 [inline]
      BUG: KMSAN: uninit-value in setup_udp_tunnel_sock+0x45e/0x6f0 net/ipv4/udp_tunnel.c:85
      CPU: 0 PID: 11262 Comm: syz-executor613 Not tainted 5.5.0-rc5-syzkaller #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
      Call Trace:
       __dump_stack lib/dump_stack.c:77 [inline]
       dump_stack+0x1c9/0x220 lib/dump_stack.c:118
       kmsan_report+0xf7/0x1e0 mm/kmsan/kmsan_report.c:118
       __msan_warning+0x58/0xa0 mm/kmsan/kmsan_instr.c:215
       udp_tunnel_encap_enable include/net/udp_tunnel.h:174 [inline]
       setup_udp_tunnel_sock+0x45e/0x6f0 net/ipv4/udp_tunnel.c:85
       gtp_encap_enable_socket+0x37f/0x5a0 drivers/net/gtp.c:827
       gtp_encap_enable drivers/net/gtp.c:844 [inline]
       gtp_newlink+0xfb/0x1e50 drivers/net/gtp.c:666
       __rtnl_newlink net/core/rtnetlink.c:3305 [inline]
       rtnl_newlink+0x2973/0x3920 net/core/rtnetlink.c:3363
       rtnetlink_rcv_msg+0x1153/0x1570 net/core/rtnetlink.c:5424
       netlink_rcv_skb+0x451/0x650 net/netlink/af_netlink.c:2477
       rtnetlink_rcv+0x50/0x60 net/core/rtnetlink.c:5442
       netlink_unicast_kernel net/netlink/af_netlink.c:1302 [inline]
       netlink_unicast+0xf9e/0x1100 net/netlink/af_netlink.c:1328
       netlink_sendmsg+0x1248/0x14d0 net/netlink/af_netlink.c:1917
       sock_sendmsg_nosec net/socket.c:639 [inline]
       sock_sendmsg net/socket.c:659 [inline]
       ____sys_sendmsg+0x12b6/0x1350 net/socket.c:2330
       ___sys_sendmsg net/socket.c:2384 [inline]
       __sys_sendmsg+0x451/0x5f0 net/socket.c:2417
       __do_sys_sendmsg net/socket.c:2426 [inline]
       __se_sys_sendmsg+0x97/0xb0 net/socket.c:2424
       __x64_sys_sendmsg+0x4a/0x70 net/socket.c:2424
       do_syscall_64+0xb8/0x160 arch/x86/entry/common.c:296
       entry_SYSCALL_64_after_hwframe+0x44/0xa9
      RIP: 0033:0x441359
      Code: e8 ac e8 ff ff 48 83 c4 18 c3 0f 1f 80 00 00 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 eb 08 fc ff c3 66 2e 0f 1f 84 00 00 00 00
      RSP: 002b:00007fff1cd0ac28 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
      RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 0000000000441359
      RDX: 0000000000000000 RSI: 0000000020000100 RDI: 0000000000000003
      RBP: 00000000006cb018 R08: 00000000004002c8 R09: 00000000004002c8
      R10: 00000000004002c8 R11: 0000000000000246 R12: 00000000004020d0
      R13: 0000000000402160 R14: 0000000000000000 R15: 0000000000000000
      
      Uninit was created at:
       kmsan_save_stack_with_flags+0x3c/0x90 mm/kmsan/kmsan.c:144
       kmsan_internal_alloc_meta_for_pages mm/kmsan/kmsan_shadow.c:307 [inline]
       kmsan_alloc_page+0x12a/0x310 mm/kmsan/kmsan_shadow.c:336
       __alloc_pages_nodemask+0x57f2/0x5f60 mm/page_alloc.c:4800
       alloc_pages_current+0x67d/0x990 mm/mempolicy.c:2207
       alloc_pages include/linux/gfp.h:534 [inline]
       alloc_slab_page+0x111/0x12f0 mm/slub.c:1511
       allocate_slab mm/slub.c:1656 [inline]
       new_slab+0x2bc/0x1130 mm/slub.c:1722
       new_slab_objects mm/slub.c:2473 [inline]
       ___slab_alloc+0x1533/0x1f30 mm/slub.c:2624
       __slab_alloc mm/slub.c:2664 [inline]
       slab_alloc_node mm/slub.c:2738 [inline]
       slab_alloc mm/slub.c:2783 [inline]
       kmem_cache_alloc+0xb23/0xd70 mm/slub.c:2788
       sk_prot_alloc+0xf2/0x620 net/core/sock.c:1597
       sk_alloc+0xf0/0xbe0 net/core/sock.c:1657
       inet_create+0x7c7/0x1370 net/ipv4/af_inet.c:321
       __sock_create+0x8eb/0xf00 net/socket.c:1420
       sock_create net/socket.c:1471 [inline]
       __sys_socket+0x1a1/0x600 net/socket.c:1513
       __do_sys_socket net/socket.c:1522 [inline]
       __se_sys_socket+0x8d/0xb0 net/socket.c:1520
       __x64_sys_socket+0x4a/0x70 net/socket.c:1520
       do_syscall_64+0xb8/0x160 arch/x86/entry/common.c:296
       entry_SYSCALL_64_after_hwframe+0x44/0xa9
      
      Fixes: 459aa660 ("gtp: add initial driver for datapath of GPRS Tunneling Protocol (GTP-U)")
      Signed-off-by: NEric Dumazet <edumazet@google.com>
      Cc: Pablo Neira <pablo@netfilter.org>
      Reported-by: Nsyzbot <syzkaller@googlegroups.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      940ba149
    • M
      airo: Add missing CAP_NET_ADMIN check in AIROOLDIOCTL/SIOCDEVPRIVATE · 78f7a756
      Michael Ellerman 提交于
      The driver for Cisco Aironet 4500 and 4800 series cards (airo.c),
      implements AIROOLDIOCTL/SIOCDEVPRIVATE in airo_ioctl().
      
      The ioctl handler copies an aironet_ioctl struct from userspace, which
      includes a command. Some of the commands are handled in readrids(),
      where the user controlled command is converted into a driver-internal
      value called "ridcode".
      
      There are two command values, AIROGWEPKTMP and AIROGWEPKNV, which
      correspond to ridcode values of RID_WEP_TEMP and RID_WEP_PERM
      respectively. These commands both have checks that the user has
      CAP_NET_ADMIN, with the comment that "Only super-user can read WEP
      keys", otherwise they return -EPERM.
      
      However there is another command value, AIRORRID, that lets the user
      specify the ridcode value directly, with no other checks. This means
      the user can bypass the CAP_NET_ADMIN check on AIROGWEPKTMP and
      AIROGWEPKNV.
      
      Fix it by moving the CAP_NET_ADMIN check out of the command handling
      and instead do it later based on the ridcode. That way regardless of
      whether the ridcode is set via AIROGWEPKTMP or AIROGWEPKNV, or passed
      in using AIRORID, we always do the CAP_NET_ADMIN check.
      
      Found by Ilja by code inspection, not tested as I don't have the
      required hardware.
      Reported-by: NIlja Van Sprundel <ivansprundel@ioactive.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      78f7a756
    • M
      airo: Fix possible info leak in AIROOLDIOCTL/SIOCDEVPRIVATE · d6bce213
      Michael Ellerman 提交于
      The driver for Cisco Aironet 4500 and 4800 series cards (airo.c),
      implements AIROOLDIOCTL/SIOCDEVPRIVATE in airo_ioctl().
      
      The ioctl handler copies an aironet_ioctl struct from userspace, which
      includes a command and a length. Some of the commands are handled in
      readrids(), which kmalloc()'s a buffer of RIDSIZE (2048) bytes.
      
      That buffer is then passed to PC4500_readrid(), which has two cases.
      The else case does some setup and then reads up to RIDSIZE bytes from
      the hardware into the kmalloc()'ed buffer.
      
      Here len == RIDSIZE, pBuf is the kmalloc()'ed buffer:
      
      	// read the rid length field
      	bap_read(ai, pBuf, 2, BAP1);
      	// length for remaining part of rid
      	len = min(len, (int)le16_to_cpu(*(__le16*)pBuf)) - 2;
      	...
      	// read remainder of the rid
      	rc = bap_read(ai, ((__le16*)pBuf)+1, len, BAP1);
      
      PC4500_readrid() then returns to readrids() which does:
      
      	len = comp->len;
      	if (copy_to_user(comp->data, iobuf, min(len, (int)RIDSIZE))) {
      
      Where comp->len is the user controlled length field.
      
      So if the "rid length field" returned by the hardware is < 2048, and
      the user requests 2048 bytes in comp->len, we will leak the previous
      contents of the kmalloc()'ed buffer to userspace.
      
      Fix it by kzalloc()'ing the buffer.
      
      Found by Ilja by code inspection, not tested as I don't have the
      required hardware.
      Reported-by: NIlja Van Sprundel <ivansprundel@ioactive.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d6bce213
    • M
      net: Fix packet reordering caused by GRO and listified RX cooperation · c8079432
      Maxim Mikityanskiy 提交于
      Commit 323ebb61 ("net: use listified RX for handling GRO_NORMAL
      skbs") introduces batching of GRO_NORMAL packets in napi_frags_finish,
      and commit 6570bc79 ("net: core: use listified Rx for GRO_NORMAL in
      napi_gro_receive()") adds the same to napi_skb_finish. However,
      dev_gro_receive (that is called just before napi_{frags,skb}_finish) can
      also pass skbs to the networking stack: e.g., when the GRO session is
      flushed, napi_gro_complete is called, which passes pp directly to
      netif_receive_skb_internal, skipping napi->rx_list. It means that the
      packet stored in pp will be handled by the stack earlier than the
      packets that arrived before, but are still waiting in napi->rx_list. It
      leads to TCP reorderings that can be observed in the TCPOFOQueue counter
      in netstat.
      
      This commit fixes the reordering issue by making napi_gro_complete also
      use napi->rx_list, so that all packets going through GRO will keep their
      order. In order to keep napi_gro_flush working properly, gro_normal_list
      calls are moved after the flush to clear napi->rx_list.
      
      iwlwifi calls napi_gro_flush directly and does the same thing that is
      done by gro_normal_list, so the same change is applied there:
      napi_gro_flush is moved to be before the flush of napi->rx_list.
      
      A few other drivers also use napi_gro_flush (brocade/bna/bnad.c,
      cortina/gemini.c, hisilicon/hns3/hns3_enet.c). The first two also use
      napi_complete_done afterwards, which performs the gro_normal_list flush,
      so they are fine. The latter calls napi_gro_receive right after
      napi_gro_flush, so it can end up with non-empty napi->rx_list anyway.
      
      Fixes: 323ebb61 ("net: use listified RX for handling GRO_NORMAL skbs")
      Signed-off-by: NMaxim Mikityanskiy <maximmi@mellanox.com>
      Cc: Alexander Lobakin <alobakin@dlink.ru>
      Cc: Edward Cree <ecree@solarflare.com>
      Acked-by: NAlexander Lobakin <alobakin@dlink.ru>
      Acked-by: NSaeed Mahameed <saeedm@mellanox.com>
      Acked-by: NEdward Cree <ecree@solarflare.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c8079432
    • R
      can, slip: Protect tty->disc_data in write_wakeup and close with RCU · 0ace17d5
      Richard Palethorpe 提交于
      write_wakeup can happen in parallel with close/hangup where tty->disc_data
      is set to NULL and the netdevice is freed thus also freeing
      disc_data. write_wakeup accesses disc_data so we must prevent close from
      freeing the netdev while write_wakeup has a non-NULL view of
      tty->disc_data.
      
      We also need to make sure that accesses to disc_data are atomic. Which can
      all be done with RCU.
      
      This problem was found by Syzkaller on SLCAN, but the same issue is
      reproducible with the SLIP line discipline using an LTP test based on the
      Syzkaller reproducer.
      
      A fix which didn't use RCU was posted by Hillf Danton.
      
      Fixes: 661f7fda ("slip: Fix deadlock in write_wakeup")
      Fixes: a8e83b17 ("slcan: Port write_wakeup deadlock fix from slip")
      Reported-by: syzbot+017e491ae13c0068598a@syzkaller.appspotmail.com
      Signed-off-by: NRichard Palethorpe <rpalethorpe@suse.com>
      Cc: Wolfgang Grandegger <wg@grandegger.com>
      Cc: Marc Kleine-Budde <mkl@pengutronix.de>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Tyler Hall <tylerwhall@gmail.com>
      Cc: linux-can@vger.kernel.org
      Cc: netdev@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Cc: syzkaller@googlegroups.com
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      0ace17d5
  2. 21 1月, 2020 1 次提交
  3. 19 1月, 2020 2 次提交
  4. 18 1月, 2020 7 次提交
  5. 17 1月, 2020 11 次提交
  6. 16 1月, 2020 10 次提交