1. 25 4月, 2017 24 次提交
    • A
      net: hso: fix module unloading · a23f6ce6
      Andreas Kemnade 提交于
      keep tty driver until usb driver is unregistered
      rmmod hso
      produces traces like this without that:
      
      [40261.645904] usb 2-2: new high-speed USB device number 2 using ehci-omap
      [40261.854644] usb 2-2: New USB device found, idVendor=0af0, idProduct=8800
      [40261.862609] usb 2-2: New USB device strings: Mfr=3, Product=2, SerialNumber=0
      [40261.872772] usb 2-2: Product: Globetrotter HSUPA Modem
      [40261.880279] usb 2-2: Manufacturer: Option N.V.
      [40262.021270] hso 2-2:1.5: Not our interface
      [40265.556945] hso: unloaded
      [40265.559875] usbcore: deregistering interface driver hso
      [40265.595947] Unable to handle kernel NULL pointer dereference at virtual address 00000033
      [40265.604522] pgd = ecb14000
      [40265.611877] [00000033] *pgd=00000000
      [40265.617034] Internal error: Oops: 5 [#1] PREEMPT SMP ARM
      [40265.622650] Modules linked in: hso(-) bnep bluetooth ipv6 arc4 twl4030_madc_hwmon wl18xx wlcore mac80211 cfg80211 snd_soc_simple_card snd_soc_simple_card_utils snd_soc_omap_twl4030 snd_soc_gtm601 generic_adc_battery extcon_gpio omap3_isp videobuf2_dma_contig videobuf2_memops wlcore_sdio videobuf2_v4l2 videobuf2_core ov9650 bmp280_i2c v4l2_common bmp280 bmg160_i2c bmg160_core at24 nvmem_core videodev bmc150_accel_i2c bmc150_magn_i2c media bmc150_accel_core tsc2007 bmc150_magn leds_tca6507 bno055 snd_soc_omap_mcbsp industrialio_triggered_buffer snd_soc_omap kfifo_buf snd_pcm_dmaengine gpio_twl4030 snd_soc_twl4030 twl4030_vibra twl4030_madc wwan_on_off ehci_omap pwm_bl pwm_omap_dmtimer panel_tpo_td028ttec1 encoder_opa362 connector_analog_tv omapdrm drm_kms_helper cfbfillrect syscopyarea cfbimgblt sysfillrect
      [40265.698211]  sysimgblt fb_sys_fops cfbcopyarea drm omapdss usb_f_ecm g_ether usb_f_rndis u_ether libcomposite configfs omap2430 phy_twl4030_usb musb_hdrc twl4030_charger industrialio w2sg0004 twl4030_pwrbutton bq27xxx_battery w1_bq27000 omap_hdq [last unloaded: hso]
      [40265.723175] CPU: 0 PID: 2701 Comm: rmmod Not tainted 4.11.0-rc6-letux+ #6
      [40265.730346] Hardware name: Generic OMAP36xx (Flattened Device Tree)
      [40265.736938] task: ecb81100 task.stack: ecb82000
      [40265.741729] PC is at cdev_del+0xc/0x2c
      [40265.745666] LR is at tty_unregister_device+0x40/0x50
      [40265.750915] pc : [<c027472c>]    lr : [<c04b3ecc>]    psr: 600b0113
      sp : ecb83ea8  ip : eca4f898  fp : 00000000
      [40265.763000] r10: 00000000  r9 : 00000000  r8 : 00000001
      [40265.768493] r7 : eca4f800  r6 : 00000003  r5 : 00000000  r4 : ffffffff
      [40265.775360] r3 : c1458d54  r2 : 00000000  r1 : 00000004  r0 : ffffffff
      [40265.782257] Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none
      [40265.789764] Control: 10c5387d  Table: acb14019  DAC: 00000051
      [40265.795806] Process rmmod (pid: 2701, stack limit = 0xecb82218)
      [40265.802062] Stack: (0xecb83ea8 to 0xecb84000)
      [40265.806640] 3ea0:                   ec9e8100 c04b3ecc bf737378 ed5b7c00 00000003 bf7327ec
      [40265.815277] 3ec0: eca4f800 00000000 ec9fd800 eca4f800 bf737070 bf7328bc eca4f820 c05a9a04
      [40265.823883] 3ee0: eca4f820 00000000 00000001 eca4f820 ec9fd870 bf737070 eca4f854 ec9fd8a4
      [40265.832519] 3f00: ecb82000 00000000 00000000 c04e6960 eca4f820 bf737070 bf737048 00000081
      [40265.841125] 3f20: c01071e4 c04e6a60 ecb81100 bf737070 bf737070 c04e5d94 bf737020 c05a8f88
      [40265.849731] 3f40: bf737100 00000800 7f5fa254 00000081 c01071e4 c01c4afc 00000000 006f7368
      [40265.858367] 3f60: ecb815f4 00000000 c0cac9c4 c01071e4 ecb82000 00000000 00000000 c01512f4
      [40265.866973] 3f80: ed5b3200 c01071e4 7f5fa220 7f5fa220 bea78ec9 0010711c 7f5fa220 7f5fa220
      [40265.875579] 3fa0: bea78ec9 c0107040 7f5fa220 7f5fa220 7f5fa254 00000800 dd35b800 dd35b800
      [40265.884216] 3fc0: 7f5fa220 7f5fa220 bea78ec9 00000081 bea78dcc 00000000 bea78bd8 00000000
      [40265.892822] 3fe0: b6f70521 bea78b6c 7f5dd613 b6f70526 80070030 7f5fa254 ffffffff ffffffff
      [40265.901458] [<c027472c>] (cdev_del) from [<c04b3ecc>] (tty_unregister_device+0x40/0x50)
      [40265.909942] [<c04b3ecc>] (tty_unregister_device) from [<bf7327ec>] (hso_free_interface+0x80/0x144 [hso])
      [40265.919982] [<bf7327ec>] (hso_free_interface [hso]) from [<bf7328bc>] (hso_disconnect+0xc/0x18 [hso])
      [40265.929718] [<bf7328bc>] (hso_disconnect [hso]) from [<c05a9a04>] (usb_unbind_interface+0x84/0x200)
      [40265.939239] [<c05a9a04>] (usb_unbind_interface) from [<c04e6960>] (device_release_driver_internal+0x138/0x1cc)
      [40265.949798] [<c04e6960>] (device_release_driver_internal) from [<c04e6a60>] (driver_detach+0x60/0x6c)
      [40265.959503] [<c04e6a60>] (driver_detach) from [<c04e5d94>] (bus_remove_driver+0x64/0x8c)
      [40265.968017] [<c04e5d94>] (bus_remove_driver) from [<c05a8f88>] (usb_deregister+0x5c/0xb8)
      [40265.976654] [<c05a8f88>] (usb_deregister) from [<c01c4afc>] (SyS_delete_module+0x160/0x1dc)
      [40265.985443] [<c01c4afc>] (SyS_delete_module) from [<c0107040>] (ret_fast_syscall+0x0/0x1c)
      [40265.994171] Code: c1458d54 e59f3020 e92d4010 e1a04000 (e5941034)
      [40266.016693] ---[ end trace 9d5ac43c7e41075c ]---
      Signed-off-by: NAndreas Kemnade <andreas@kemnade.info>
      Reviewed-by: NJohan Hovold <johan@kernel.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a23f6ce6
    • P
      tipc: fix socket flow control accounting error at tipc_recv_stream · 05ff8378
      Parthasarathy Bhuvaragan 提交于
      Until now in tipc_recv_stream(), we update the received
      unacknowledged bytes based on a stack variable and not based on the
      actual message size.
      If the user buffer passed at tipc_recv_stream() is smaller than the
      received skb, the size variable in stack differs from the actual
      message size in the skb. This leads to a flow control accounting
      error causing permanent congestion.
      
      In this commit, we fix this accounting error by always using the
      size of the incoming message.
      
      Fixes: 10724cc7 ("tipc: redesign connection-level flow control")
      Signed-off-by: NParthasarathy Bhuvaragan <parthasarathy.bhuvaragan@ericsson.com>
      Reviewed-by: NJon Maloy <jon.maloy@ericsson.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      05ff8378
    • P
      tipc: fix socket flow control accounting error at tipc_send_stream · 3364d61c
      Parthasarathy Bhuvaragan 提交于
      Until now in tipc_send_stream(), we return -1 when the socket
      encounters link congestion even if the socket had successfully
      sent partial data. This is incorrect as the application resends
      the same the partial data leading to data corruption at
      receiver's end.
      
      In this commit, we return the partially sent bytes as the return
      value at link congestion.
      
      Fixes: 10724cc7 ("tipc: redesign connection-level flow control")
      Signed-off-by: NParthasarathy Bhuvaragan <parthasarathy.bhuvaragan@ericsson.com>
      Reviewed-by: NJon Maloy <jon.maloy@ericsson.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      3364d61c
    • P
      ipv6: move stub initialization after ipv6 setup completion · b7d6df57
      Paolo Abeni 提交于
      The ipv6 stub pointer is currently initialized before the ipv6
      routing subsystem: a 3rd party can access and use such stub
      before the routing data is ready.
      Moreover, such pointer is not cleared in case of initialization
      error, possibly leading to dangling pointers usage.
      
      This change addresses the above moving the stub initialization
      at the end of ipv6 init code.
      
      Fixes: 5f81bd2e ("ipv6: export a stub for IPv6 symbols used by vxlan")
      Signed-off-by: NPaolo Abeni <pabeni@redhat.com>
      Acked-by: NCong Wang <xiyou.wangcong@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      b7d6df57
    • P
      team: fix memory leaks · 72ec0bc6
      Pan Bian 提交于
      In functions team_nl_send_port_list_get() and
      team_nl_send_options_get(), pointer skb keeps the return value of
      nlmsg_new(). When the call to genlmsg_put() fails, the memory is not
      freed(). This will result in memory leak bugs.
      
      Fixes: 9b00cf2d ("team: implement multipart netlink messages for options transfers")
      Signed-off-by: NPan Bian <bianpan2016@163.com>
      Acked-by: NJiri Pirko <jiri@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      72ec0bc6
    • D
      Merge tag 'linux-can-fixes-for-4.11-20170425' of... · fccb4422
      David S. Miller 提交于
      Merge tag 'linux-can-fixes-for-4.11-20170425' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can
      
      Marc Kleine-Budde says:
      
      ====================
      pull-request: can 2017-04-25
      
      this is a pull request of three patches for net/master.
      
      There are two patches by Stephane Grosjean for that add a new variant to the
      PCAN-Chip USB driver. The other patch is by Maksim Salau, which swtiches the
      memory for USB transfers from heap to stack.
      ====================
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      fccb4422
    • B
      sfc: tx ring can only have 2048 entries for all EF10 NICs · a53d26eb
      Bert Kenward 提交于
      Fixes: dd248f1b ("sfc: Add PCI ID for Solarflare 8000 series 10/40G NIC")
      Reported-by: NPatrick Talbert <ptalbert@redhat.com>
      Signed-off-by: NBert Kenward <bkenward@solarflare.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a53d26eb
    • H
      macvlan: Fix device ref leak when purging bc_queue · f6478218
      Herbert Xu 提交于
      When a parent macvlan device is destroyed we end up purging its
      broadcast queue without dropping the device reference count on
      the packet source device.  This causes the source device to linger.
      
      This patch drops that reference count.
      
      Fixes: 260916df ("macvlan: Fix potential use-after free for...")
      Reported-by: NJoe Ghalam <Joe.Ghalam@dell.com>
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      f6478218
    • R
      usb: plusb: Add support for PL-27A1 · 6f2aee0c
      Roman Spychała 提交于
      This patch adds support for the PL-27A1 by adding the appropriate
      USB ID's. This chip is used in the goobay Active USB 3.0 Data Link
      and Unitek Y-3501 cables.
      Signed-off-by: NRoman Spychała <roed@onet.eu>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      6f2aee0c
    • M
      net: can: usb: gs_usb: Fix buffer on stack · b05c73bd
      Maksim Salau 提交于
      Allocate buffers on HEAP instead of STACK for local structures
      that are to be sent using usb_control_msg().
      Signed-off-by: NMaksim Salau <maksim.salau@gmail.com>
      Cc: linux-stable <stable@vger.kernel.org> # >= v4.8
      Signed-off-by: NMarc Kleine-Budde <mkl@pengutronix.de>
      b05c73bd
    • S
      can: usb: Kconfig: Add PCAN-USB X6 device in help text · 71b61156
      Stephane Grosjean 提交于
      This patch adds a text line in the help section of the CAN_PEAK_USB
      config item describing the support of the PCAN-USB X6 adapter, which is
      already included in the Kernel since 4.9.
      Signed-off-by: NStephane Grosjean <s.grosjean@peak-system.com>
      Signed-off-by: NMarc Kleine-Budde <mkl@pengutronix.de>
      71b61156
    • S
      can: usb: Add support of PCAN-Chip USB stamp module · ea8b65b5
      Stephane Grosjean 提交于
      This patch adds the support of the PCAN-Chip USB, a stamp module for
      customer hardware designs, which communicates via USB 2.0 with the
      hardware. The integrated CAN controller supports the protocols CAN 2.0 A/B
      as well as CAN FD. The physical CAN connection is determined by external
      wiring. The Stamp module with its single-sided mounting and plated
      half-holes is suitable for automatic assembly.
      
      Note that the chip is equipped with the same logic than the PCAN-USB FD.
      Signed-off-by: NStephane Grosjean <s.grosjean@peak-system.com>
      Signed-off-by: NMarc Kleine-Budde <mkl@pengutronix.de>
      ea8b65b5
    • D
      Merge branch 'dsa-b53-58xx-fixes' · 38a98bce
      David S. Miller 提交于
      Florian Fainelli says:
      
      ====================
      net: dsa: b53: BCM58xx devices fixes
      
      This patch series contains fixes for the 58xx devices (Broadcom Northstar
      Plus), which were identified thanks to the help of Eric Anholt.
      ====================
      Tested-by: NEric Anholt <eric@anholt.net>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      38a98bce
    • F
      net: dsa: b53: Fix CPU port for 58xx devices · bfcda65c
      Florian Fainelli 提交于
      The 58xx devices (Northstar Plus) do actually have their CPU port wired
      at port 8, it was unfortunately set to port 5 (B53_CPU_PORT_25) which is
      incorrect, since that is the second possible management port.
      
      Fixes: 991a36bb ("net: dsa: b53: Add support for BCM585xx/586xx/88312 integrated switch")
      Reported-by: NEric Anholt <eric@anholt.net>
      Signed-off-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      bfcda65c
    • F
      net: dsa: b53: Implement software reset for 58xx devices · 3fb22b05
      Florian Fainelli 提交于
      Implement the correct software reset sequence for 58xx devices by
      setting all 3 reset bits and polling for the SW_RST bit to clear itself
      without a given timeout. We cannot use is58xx() here because that would
      also include the 7445/7278 Starfighter 2 which have their own driver
      doing the reset earlier on due to the HW specific integration.
      
      Fixes: 991a36bb ("net: dsa: b53: Add support for BCM585xx/586xx/88312 integrated switch")
      Signed-off-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      3fb22b05
    • F
      net: dsa: b53: Include IMP/CPU port in dumb forwarding mode · a424f0de
      Florian Fainelli 提交于
      Since Broadcom tags are not enabled in b53 (DSA_PROTO_TAG_NONE), we need
      to make sure that the IMP/CPU port is included in the forwarding
      decision.
      
      Without this change, switching between non-management ports would work,
      but not between management ports and non-management ports thus breaking
      the default state in which DSA switch are brought up.
      
      Fixes: 967dd82f ("net: dsa: b53: Add support for Broadcom RoboSwitch")
      Reported-by: NEric Anholt <eric@anholt.net>
      Signed-off-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a424f0de
    • D
      Merge tag 'mlx5-fixes-2017-04-22' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux · 38baf3a6
      David S. Miller 提交于
      Saeed Mahameed says:
      
      ====================
      Mellanox, mlx5 fixes 2017-04-22
      
      This series contains some mlx5 fixes for net.
      
      For your convenience, the series doesn't introduce any conflict with
      the ongoing net-next pull request.
      
      Please pull and let me know if there's any problem.
      
      For -stable:
      ("net/mlx5: E-Switch, Correctly deal with inline mode on ConnectX-5") kernels >= 4.10
      ("net/mlx5e: Fix ETHTOOL_GRXCLSRLALL handling") kernels >= 4.8
      ("net/mlx5e: Fix small packet threshold")       kernels >= 4.7
      ("net/mlx5: Fix driver load bad flow when having fw initializing timeout") kernels >= 4.4
      ====================
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      38baf3a6
    • D
      net: ipv6: send unsolicited NA if enabled for all interfaces · fc1f8f4f
      David Ahern 提交于
      When arp_notify is set to 1 for either a specific interface or for 'all'
      interfaces, gratuitous arp requests are sent. Since ndisc_notify is the
      ipv6 equivalent to arp_notify, it should follow the same semantics.
      Commit 4a6e3c5d ("net: ipv6: send unsolicited NA on admin up") sends
      the NA on admin up. The final piece is checking devconf_all->ndisc_notify
      in addition to the per device setting. Add it.
      
      Fixes: 5cb04436 ("ipv6: add knob to send unsolicited ND on link-layer address change")
      Signed-off-by: NDavid Ahern <dsa@cumulusnetworks.com>
      Reviewed-by: NSimon Horman <simon.horman@netronome.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      fc1f8f4f
    • D
      ravb: Double free on error in ravb_start_xmit() · 9199cb76
      Dan Carpenter 提交于
      If skb_put_padto() fails then it frees the skb.  I shifted that code
      up a bit to make my error handling a little simpler.
      
      Fixes: a0d2f206 ("Renesas Ethernet AVB PTP clock driver")
      Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
      Acked-by: NSergei Shtylyov <sergei.shtylyov@cogentembedded.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      9199cb76
    • A
      udp: disable inner UDP checksum offloads in IPsec case · b40c5f4f
      Ansis Atteka 提交于
      Otherwise, UDP checksum offloads could corrupt ESP packets by attempting
      to calculate UDP checksum when this inner UDP packet is already protected
      by IPsec.
      
      One way to reproduce this bug is to have a VM with virtio_net driver (UFO
      set to ON in the guest VM); and then encapsulate all guest's Ethernet
      frames in Geneve; and then further encrypt Geneve with IPsec.  In this
      case following symptoms are observed:
      1. If using ixgbe NIC, then it will complain with following error message:
         ixgbe 0000:01:00.1: partial checksum but l4 proto=32!
      2. Receiving IPsec stack will drop all the corrupted ESP packets and
         increase XfrmInStateProtoError counter in /proc/net/xfrm_stat.
      3. iperf UDP test from the VM with packet sizes above MTU will not work at
         all.
      4. iperf TCP test from the VM will get ridiculously low performance because.
      Signed-off-by: NAnsis Atteka <aatteka@ovn.org>
      Co-authored-by: NSteffen Klassert <steffen.klassert@secunet.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      b40c5f4f
    • J
      macsec: avoid heap overflow in skb_to_sgvec · 4d6fa57b
      Jason A. Donenfeld 提交于
      While this may appear as a humdrum one line change, it's actually quite
      important. An sk_buff stores data in three places:
      
      1. A linear chunk of allocated memory in skb->data. This is the easiest
         one to work with, but it precludes using scatterdata since the memory
         must be linear.
      2. The array skb_shinfo(skb)->frags, which is of maximum length
         MAX_SKB_FRAGS. This is nice for scattergather, since these fragments
         can point to different pages.
      3. skb_shinfo(skb)->frag_list, which is a pointer to another sk_buff,
         which in turn can have data in either (1) or (2).
      
      The first two are rather easy to deal with, since they're of a fixed
      maximum length, while the third one is not, since there can be
      potentially limitless chains of fragments. Fortunately dealing with
      frag_list is opt-in for drivers, so drivers don't actually have to deal
      with this mess. For whatever reason, macsec decided it wanted pain, and
      so it explicitly specified NETIF_F_FRAGLIST.
      
      Because dealing with (1), (2), and (3) is insane, most users of sk_buff
      doing any sort of crypto or paging operation calls a convenient function
      called skb_to_sgvec (which happens to be recursive if (3) is in use!).
      This takes a sk_buff as input, and writes into its output pointer an
      array of scattergather list items. Sometimes people like to declare a
      fixed size scattergather list on the stack; othertimes people like to
      allocate a fixed size scattergather list on the heap. However, if you're
      doing it in a fixed-size fashion, you really shouldn't be using
      NETIF_F_FRAGLIST too (unless you're also ensuring the sk_buff and its
      frag_list children arent't shared and then you check the number of
      fragments in total required.)
      
      Macsec specifically does this:
      
              size += sizeof(struct scatterlist) * (MAX_SKB_FRAGS + 1);
              tmp = kmalloc(size, GFP_ATOMIC);
              *sg = (struct scatterlist *)(tmp + sg_offset);
      	...
              sg_init_table(sg, MAX_SKB_FRAGS + 1);
              skb_to_sgvec(skb, sg, 0, skb->len);
      
      Specifying MAX_SKB_FRAGS + 1 is the right answer usually, but not if you're
      using NETIF_F_FRAGLIST, in which case the call to skb_to_sgvec will
      overflow the heap, and disaster ensues.
      Signed-off-by: NJason A. Donenfeld <Jason@zx2c4.com>
      Cc: stable@vger.kernel.org
      Cc: security@kernel.org
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      4d6fa57b
    • R
      ipv4: Avoid caching l3mdev dst on mismatched local route · b7c8487c
      Robert Shearman 提交于
      David reported that doing the following:
      
          ip li add red type vrf table 10
          ip link set dev eth1 vrf red
          ip addr add 127.0.0.1/8 dev red
          ip link set dev eth1 up
          ip li set red up
          ping -c1 -w1 -I red 127.0.0.1
          ip li del red
      
      when either policy routing IP rules are present or the local table
      lookup ip rule is before the l3mdev lookup results in a hang with
      these messages:
      
          unregister_netdevice: waiting for red to become free. Usage count = 1
      
      The problem is caused by caching the dst used for sending the packet
      out of the specified interface on a local route with a different
      nexthop interface. Thus the dst could stay around until the route in
      the table the lookup was done is deleted which may be never.
      
      Address the problem by not forcing output device to be the l3mdev in
      the flow's output interface if the lookup didn't use the l3mdev. This
      then results in the dst using the right device according to the route.
      
      Changes in v2:
       - make the dev_out passed in by __ip_route_output_key_hash correct
         instead of checking the nh dev if FLOWI_FLAG_SKIP_NH_OIF is set as
         suggested by David.
      
      Fixes: 5f02ce24 ("net: l3mdev: Allow the l3mdev to be a loopback")
      Reported-by: NDavid Ahern <dsa@cumulusnetworks.com>
      Suggested-by: NDavid Ahern <dsa@cumulusnetworks.com>
      Signed-off-by: NRobert Shearman <rshearma@brocade.com>
      Acked-by: NDavid Ahern <dsa@cumulusnetworks.com>
      Tested-by: NDavid Ahern <dsa@cumulusnetworks.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      b7c8487c
    • D
      net: tc35815: move free after the dereference · 11faa7b0
      Dan Carpenter 提交于
      We dereference "skb" to get "skb->len" so we should probably do that
      step before freeing the skb.
      
      Fixes: eea221ce ("tc35815 driver update (take 2)")
      Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      11faa7b0
    • M
      net/mlx5e: Fix race in mlx5e_sw_stats and mlx5e_vport_stats · 1510d728
      Martin KaFai Lau 提交于
      We have observed a sudden spike in rx/tx_packets and rx/tx_bytes
      reported under /proc/net/dev.  There is a race in mlx5e_update_stats()
      and some of the get-stats functions (the one that we hit is the
      mlx5e_get_stats() which is called by ndo_get_stats64()).
      
      In particular, the very first thing mlx5e_update_sw_counters()
      does is 'memset(s, 0, sizeof(*s))'.  For example, if mlx5e_get_stats()
      is unlucky at one point, rx_bytes and rx_packets could be 0.  One second
      later, a normal (and much bigger than 0) value will be reported.
      
      This patch is to use a 'struct mlx5e_sw_stats temp' to avoid
      a direct memset zero on priv->stats.sw.
      
      mlx5e_update_vport_counters() has a similar race.  Hence, addressed
      together.  However, memset zero is removed instead because
      it is not needed.
      
      I am lucky enough to catch this 0-reset in rx multicast:
      eth0: 41457665   76804   70    0    0    70          0     47085 15586634   87502    3    0    0     0       3          0
      eth0: 41459860   76815   70    0    0    70          0     47094 15588376   87516    3    0    0     0       3          0
      eth0: 41460577   76822   70    0    0    70          0         0 15589083   87521    3    0    0     0       3          0
      eth0: 41463293   76838   70    0    0    70          0     47108 15595872   87538    3    0    0     0       3          0
      eth0: 41463379   76839   70    0    0    70          0     47116 15596138   87539    3    0    0     0       3          0
      
      v2: Remove memset zero from mlx5e_update_vport_counters()
      v1: Use temp and memcpy
      
      Fixes: 9218b44d ("net/mlx5e: Statistics handling refactoring")
      Suggested-by: NEric Dumazet <eric.dumazet@gmail.com>
      Suggested-by: NSaeed Mahameed <saeedm@mellanox.com>
      Signed-off-by: NMartin KaFai Lau <kafai@fb.com>
      Acked-by: NSaeed Mahameed <saeedm@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      1510d728
  2. 23 4月, 2017 7 次提交
  3. 22 4月, 2017 9 次提交
    • L
      Merge tag 'nfsd-4.11-2' of git://linux-nfs.org/~bfields/linux · 94836ecf
      Linus Torvalds 提交于
      Pull nfsd bugfix from Bruce Fields:
       "Fix a 4.11 regression that triggers a BUG() on an attempt to use an
        unsupported NFSv4 compound op"
      
      * tag 'nfsd-4.11-2' of git://linux-nfs.org/~bfields/linux:
        nfsd: fix oops on unsupported operation
      94836ecf
    • L
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net · 057a650b
      Linus Torvalds 提交于
      Pull networking fixes from David Miller:
      
       1) Don't race in IPSEC dumps, from Yuejie Shi.
      
       2) Verify lengths properly in IPSEC reqeusts, from Herbert Xu.
      
       3) Fix out of bounds access in ipv6 segment routing code, from David
          Lebrun.
      
       4) Don't write into the header of cloned SKBs in smsc95xx driver, from
          James Hughes.
      
       5) Several other drivers have this bug too, fix them. From Eric
          Dumazet.
      
       6) Fix access to uninitialized data in TC action cookie code, from
          Wolfgang Bumiller.
      
       7) Fix double free in IPV6 segment routing, again from David Lebrun.
      
       8) Don't let userspace set the RTF_PCPU flag, oops. From David Ahern.
      
       9) Fix use after free in qrtr code, from Dan Carpenter.
      
      10) Don't double-destroy devices in ip6mr code, from Nikolay
          Aleksandrov.
      
      11) Don't pass out-of-range TX queue indices into drivers, from Tushar
          Dave.
      
      * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (30 commits)
        netpoll: Check for skb->queue_mapping
        ip6mr: fix notification device destruction
        bpf, doc: update bpf maintainers entry
        net: qrtr: potential use after free in qrtr_sendmsg()
        bpf: Fix values type used in test_maps
        net: ipv6: RTF_PCPU should not be settable from userspace
        gso: Validate assumption of frag_list segementation
        kaweth: use skb_cow_head() to deal with cloned skbs
        ch9200: use skb_cow_head() to deal with cloned skbs
        lan78xx: use skb_cow_head() to deal with cloned skbs
        sr9700: use skb_cow_head() to deal with cloned skbs
        cx82310_eth: use skb_cow_head() to deal with cloned skbs
        smsc75xx: use skb_cow_head() to deal with cloned skbs
        ipv6: sr: fix double free of skb after handling invalid SRH
        MAINTAINERS: Add "B:" field for networking.
        net sched actions: allocate act cookie early
        qed: Fix issue in populating the PFC config paramters.
        qed: Fix possible system hang in the dcbnl-getdcbx() path.
        qed: Fix sending an invalid PFC error mask to MFW.
        qed: Fix possible error in populating max_tc field.
        ...
      057a650b
    • T
      netpoll: Check for skb->queue_mapping · c70b17b7
      Tushar Dave 提交于
      Reducing real_num_tx_queues needs to be in sync with skb queue_mapping
      otherwise skbs with queue_mapping greater than real_num_tx_queues
      can be sent to the underlying driver and can result in kernel panic.
      
      One such event is running netconsole and enabling VF on the same
      device. Or running netconsole and changing number of tx queues via
      ethtool on same device.
      
      e.g.
      Unable to handle kernel NULL pointer dereference
      tsk->{mm,active_mm}->context = 0000000000001525
      tsk->{mm,active_mm}->pgd = fff800130ff9a000
                    \|/ ____ \|/
                    "@'/ .. \`@"
                    /_| \__/ |_\
                       \__U_/
      kworker/48:1(475): Oops [#1]
      CPU: 48 PID: 475 Comm: kworker/48:1 Tainted: G           OE
      4.11.0-rc3-davem-net+ #7
      Workqueue: events queue_process
      task: fff80013113299c0 task.stack: fff800131132c000
      TSTATE: 0000004480e01600 TPC: 00000000103f9e3c TNPC: 00000000103f9e40 Y:
      00000000    Tainted: G           OE
      TPC: <ixgbe_xmit_frame_ring+0x7c/0x6c0 [ixgbe]>
      g0: 0000000000000000 g1: 0000000000003fff g2: 0000000000000000 g3:
      0000000000000001
      g4: fff80013113299c0 g5: fff8001fa6808000 g6: fff800131132c000 g7:
      00000000000000c0
      o0: fff8001fa760c460 o1: fff8001311329a50 o2: fff8001fa7607504 o3:
      0000000000000003
      o4: fff8001f96e63a40 o5: fff8001311d77ec0 sp: fff800131132f0e1 ret_pc:
      000000000049ed94
      RPC: <set_next_entity+0x34/0xb80>
      l0: 0000000000000000 l1: 0000000000000800 l2: 0000000000000000 l3:
      0000000000000000
      l4: 000b2aa30e34b10d l5: 0000000000000000 l6: 0000000000000000 l7:
      fff8001fa7605028
      i0: fff80013111a8a00 i1: fff80013155a0780 i2: 0000000000000000 i3:
      0000000000000000
      i4: 0000000000000000 i5: 0000000000100000 i6: fff800131132f1a1 i7:
      00000000103fa4b0
      I7: <ixgbe_xmit_frame+0x30/0xa0 [ixgbe]>
      Call Trace:
       [00000000103fa4b0] ixgbe_xmit_frame+0x30/0xa0 [ixgbe]
       [0000000000998c74] netpoll_start_xmit+0xf4/0x200
       [0000000000998e10] queue_process+0x90/0x160
       [0000000000485fa8] process_one_work+0x188/0x480
       [0000000000486410] worker_thread+0x170/0x4c0
       [000000000048c6b8] kthread+0xd8/0x120
       [0000000000406064] ret_from_fork+0x1c/0x2c
       [0000000000000000]           (null)
      Disabling lock debugging due to kernel taint
      Caller[00000000103fa4b0]: ixgbe_xmit_frame+0x30/0xa0 [ixgbe]
      Caller[0000000000998c74]: netpoll_start_xmit+0xf4/0x200
      Caller[0000000000998e10]: queue_process+0x90/0x160
      Caller[0000000000485fa8]: process_one_work+0x188/0x480
      Caller[0000000000486410]: worker_thread+0x170/0x4c0
      Caller[000000000048c6b8]: kthread+0xd8/0x120
      Caller[0000000000406064]: ret_from_fork+0x1c/0x2c
      Caller[0000000000000000]:           (null)
      Signed-off-by: NTushar Dave <tushar.n.dave@oracle.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c70b17b7
    • N
      ip6mr: fix notification device destruction · 723b929c
      Nikolay Aleksandrov 提交于
      Andrey Konovalov reported a BUG caused by the ip6mr code which is caused
      because we call unregister_netdevice_many for a device that is already
      being destroyed. In IPv4's ipmr that has been resolved by two commits
      long time ago by introducing the "notify" parameter to the delete
      function and avoiding the unregister when called from a notifier, so
      let's do the same for ip6mr.
      
      The trace from Andrey:
      ------------[ cut here ]------------
      kernel BUG at net/core/dev.c:6813!
      invalid opcode: 0000 [#1] SMP KASAN
      Modules linked in:
      CPU: 1 PID: 1165 Comm: kworker/u4:3 Not tainted 4.11.0-rc7+ #251
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs
      01/01/2011
      Workqueue: netns cleanup_net
      task: ffff880069208000 task.stack: ffff8800692d8000
      RIP: 0010:rollback_registered_many+0x348/0xeb0 net/core/dev.c:6813
      RSP: 0018:ffff8800692de7f0 EFLAGS: 00010297
      RAX: ffff880069208000 RBX: 0000000000000002 RCX: 0000000000000001
      RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff88006af90569
      RBP: ffff8800692de9f0 R08: ffff8800692dec60 R09: 0000000000000000
      R10: 0000000000000006 R11: 0000000000000000 R12: ffff88006af90070
      R13: ffff8800692debf0 R14: dffffc0000000000 R15: ffff88006af90000
      FS:  0000000000000000(0000) GS:ffff88006cb00000(0000)
      knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 00007fe7e897d870 CR3: 00000000657e7000 CR4: 00000000000006e0
      Call Trace:
       unregister_netdevice_many.part.105+0x87/0x440 net/core/dev.c:7881
       unregister_netdevice_many+0xc8/0x120 net/core/dev.c:7880
       ip6mr_device_event+0x362/0x3f0 net/ipv6/ip6mr.c:1346
       notifier_call_chain+0x145/0x2f0 kernel/notifier.c:93
       __raw_notifier_call_chain kernel/notifier.c:394
       raw_notifier_call_chain+0x2d/0x40 kernel/notifier.c:401
       call_netdevice_notifiers_info+0x51/0x90 net/core/dev.c:1647
       call_netdevice_notifiers net/core/dev.c:1663
       rollback_registered_many+0x919/0xeb0 net/core/dev.c:6841
       unregister_netdevice_many.part.105+0x87/0x440 net/core/dev.c:7881
       unregister_netdevice_many net/core/dev.c:7880
       default_device_exit_batch+0x4fa/0x640 net/core/dev.c:8333
       ops_exit_list.isra.4+0x100/0x150 net/core/net_namespace.c:144
       cleanup_net+0x5a8/0xb40 net/core/net_namespace.c:463
       process_one_work+0xc04/0x1c10 kernel/workqueue.c:2097
       worker_thread+0x223/0x19c0 kernel/workqueue.c:2231
       kthread+0x35e/0x430 kernel/kthread.c:231
       ret_from_fork+0x31/0x40 arch/x86/entry/entry_64.S:430
      Code: 3c 32 00 0f 85 70 0b 00 00 48 b8 00 02 00 00 00 00 ad de 49 89
      47 78 e9 93 fe ff ff 49 8d 57 70 49 8d 5f 78 eb 9e e8 88 7a 14 fe <0f>
      0b 48 8b 9d 28 fe ff ff e8 7a 7a 14 fe 48 b8 00 00 00 00 00
      RIP: rollback_registered_many+0x348/0xeb0 RSP: ffff8800692de7f0
      ---[ end trace e0b29c57e9b3292c ]---
      Reported-by: NAndrey Konovalov <andreyknvl@google.com>
      Signed-off-by: NNikolay Aleksandrov <nikolay@cumulusnetworks.com>
      Tested-by: NAndrey Konovalov <andreyknvl@google.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      723b929c
    • D
      bpf, doc: update bpf maintainers entry · cdb90499
      Daniel Borkmann 提交于
      Add various related files that have been missing under
      BPF entry covering essential parts of its infrastructure
      and also add myself as co-maintainer.
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: NAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      cdb90499
    • D
      net: qrtr: potential use after free in qrtr_sendmsg() · 6f60f438
      Dan Carpenter 提交于
      If skb_pad() fails then it frees the skb so we should check for errors.
      
      Fixes: bdabad3e ("net: Add Qualcomm IPC router")
      Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      6f60f438
    • D
      bpf: Fix values type used in test_maps · 89087c45
      David Miller 提交于
      Maps of per-cpu type have their value element size adjusted to 8 if it
      is specified smaller during various map operations.
      
      This makes test_maps as a 32-bit binary fail, in fact the kernel
      writes past the end of the value's array on the user's stack.
      
      To be quite honest, I think the kernel should reject creation of a
      per-cpu map that doesn't have a value size of at least 8 if that's
      what the kernel is going to silently adjust to later.
      
      If the user passed something smaller, it is a sizeof() calcualtion
      based upon the type they will actually use (just like in this testcase
      code) in later calls to the map operations.
      
      Fixes: df570f57 ("samples/bpf: unit test for BPF_MAP_TYPE_PERCPU_ARRAY")
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Acked-by: NDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: NAlexei Starovoitov <ast@kernel.org>
      89087c45
    • D
      net: ipv6: RTF_PCPU should not be settable from userspace · 557c44be
      David Ahern 提交于
      Andrey reported a fault in the IPv6 route code:
      
      kasan: GPF could be caused by NULL-ptr deref or user memory access
      general protection fault: 0000 [#1] SMP KASAN
      Modules linked in:
      CPU: 1 PID: 4035 Comm: a.out Not tainted 4.11.0-rc7+ #250
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
      task: ffff880069809600 task.stack: ffff880062dc8000
      RIP: 0010:ip6_rt_cache_alloc+0xa6/0x560 net/ipv6/route.c:975
      RSP: 0018:ffff880062dced30 EFLAGS: 00010206
      RAX: dffffc0000000000 RBX: ffff8800670561c0 RCX: 0000000000000006
      RDX: 0000000000000003 RSI: ffff880062dcfb28 RDI: 0000000000000018
      RBP: ffff880062dced68 R08: 0000000000000001 R09: 0000000000000000
      R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
      R13: ffff880062dcfb28 R14: dffffc0000000000 R15: 0000000000000000
      FS:  00007feebe37e7c0(0000) GS:ffff88006cb00000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 00000000205a0fe4 CR3: 000000006b5c9000 CR4: 00000000000006e0
      Call Trace:
       ip6_pol_route+0x1512/0x1f20 net/ipv6/route.c:1128
       ip6_pol_route_output+0x4c/0x60 net/ipv6/route.c:1212
      ...
      
      Andrey's syzkaller program passes rtmsg.rtmsg_flags with the RTF_PCPU bit
      set. Flags passed to the kernel are blindly copied to the allocated
      rt6_info by ip6_route_info_create making a newly inserted route appear
      as though it is a per-cpu route. ip6_rt_cache_alloc sees the flag set
      and expects rt->dst.from to be set - which it is not since it is not
      really a per-cpu copy. The subsequent call to __ip6_dst_alloc then
      generates the fault.
      
      Fix by checking for the flag and failing with EINVAL.
      
      Fixes: d52d3997 ("ipv6: Create percpu rt6_info")
      Reported-by: NAndrey Konovalov <andreyknvl@google.com>
      Signed-off-by: NDavid Ahern <dsa@cumulusnetworks.com>
      Acked-by: NMartin KaFai Lau <kafai@fb.com>
      Tested-by: NAndrey Konovalov <andreyknvl@google.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      557c44be
    • I
      gso: Validate assumption of frag_list segementation · 43170c4e
      Ilan Tayari 提交于
      Commit 07b26c94 ("gso: Support partial splitting at the frag_list
      pointer") assumes that all SKBs in a frag_list (except maybe the last
      one) contain the same amount of GSO payload.
      
      This assumption is not always correct, resulting in the following
      warning message in the log:
          skb_segment: too many frags
      
      For example, mlx5 driver in Striding RQ mode creates some RX SKBs with
      one frag, and some with 2 frags.
      After GRO, the frag_list SKBs end up having different amounts of payload.
      If this frag_list SKB is then forwarded, the aforementioned assumption
      is violated.
      
      Validate the assumption, and fall back to software GSO if it not true.
      
      Change-Id: Ia03983f4a47b6534dd987d7a2aad96d54d46d212
      Fixes: 07b26c94 ("gso: Support partial splitting at the frag_list pointer")
      Signed-off-by: NIlan Tayari <ilant@mellanox.com>
      Signed-off-by: NIlya Lesokhin <ilyal@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      43170c4e