1. 05 Nov, 2015 30 commits
    • Eric Dumazet's avatar
      tcp: use correct req pointer in tcp_move_syn() calls · 49a496c9
      Eric Dumazet authored
      I mistakenly took wrong request sock pointer when calling tcp_move_syn()
      
      @req_unhash is either a copy of @req, or a NULL value for
      FastOpen connexions (as we do not expect to unhash the temporary
      request sock from ehash table)
      
      Fixes: 805c4bc0 ("tcp: fix req->saved_syn race")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Cc: Ying Cai <ycai@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      49a496c9
    • Francesco Ruggeri's avatar
      packet: race condition in packet_bind · 30f7ea1c
      Francesco Ruggeri authored
      There is a race conditions between packet_notifier and packet_bind{_spkt}.
      
      It happens if packet_notifier(NETDEV_UNREGISTER) executes between the
      time packet_bind{_spkt} takes a reference on the new netdevice and the
      time packet_do_bind sets po->ifindex.
      In this case the notification can be missed.
      If this happens during a dev_change_net_namespace this can result in the
      netdevice to be moved to the new namespace while the packet_sock in the
      old namespace still holds a reference on it. When the netdevice is later
      deleted in the new namespace the deletion hangs since the packet_sock
      is not found in the new namespace' &net->packet.sklist.
      It can be reproduced with the script below.
      
      This patch makes packet_do_bind check again for the presence of the
      netdevice in the packet_sock's namespace after the synchronize_net
      in unregister_prot_hook.
      More in general it also uses the rcu lock for the duration of the bind
      to stop dev_change_net_namespace/rollback_registered_many from
      going past the synchronize_net following unlist_netdevice, so that
      no NETDEV_UNREGISTER notifications can happen on the new netdevice
      while the bind is executing. In order to do this some code from
      packet_bind{_spkt} is consolidated into packet_do_dev.
      
      import socket, os, time, sys
      proto=7
      realDev='em1'
      vlanId=400
      if len(sys.argv) > 1:
         vlanId=int(sys.argv[1])
      dev='vlan%d' % vlanId
      
      os.system('taskset -p 0x10 %d' % os.getpid())
      
      s = socket.socket(socket.PF_PACKET, socket.SOCK_RAW, proto)
      os.system('ip link add link %s name %s type vlan id %d' %
                (realDev, dev, vlanId))
      os.system('ip netns add dummy')
      
      pid=os.fork()
      
      if pid == 0:
         # dev should be moved while packet_do_bind is in synchronize net
         os.system('taskset -p 0x20000 %d' % os.getpid())
         os.system('ip link set %s netns dummy' % dev)
         os.system('ip netns exec dummy ip link del %s' % dev)
         s.close()
         sys.exit(0)
      
      time.sleep(.004)
      try:
         s.bind(('%s' % dev, proto+1))
      except:
         print 'Could not bind socket'
         s.close()
         os.system('ip netns del dummy')
         sys.exit(0)
      
      os.waitpid(pid, 0)
      s.close()
      os.system('ip netns del dummy')
      sys.exit(0)
      Signed-off-by: default avatarFrancesco Ruggeri <fruggeri@arista.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      30f7ea1c
    • Eric Dumazet's avatar
      ipv4: use sk_fullsock() in ipv4_conntrack_defrag() · f668f5f7
      Eric Dumazet authored
      Before converting a 'socket pointer' into inet socket,
      use sk_fullsock() to detect timewait or request sockets.
      
      Fixes: ca6fb065 ("tcp: attach SYNACK messages to request sockets instead of listener")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Reported-by: default avatarDmitry Vyukov <dvyukov@google.com>
      Tested-by: default avatarDmitry Vyukov <dvyukov@google.com>
      Cc: Pablo Neira Ayuso <pablo@netfilter.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f668f5f7
    • Eric Dumazet's avatar
      tcp: fix req->saved_syn race · 805c4bc0
      Eric Dumazet authored
      For the reasons explained in commit ce105008 ("tcp/dccp: fix
      ireq->pktopts race"), we need to make sure we do not access
      req->saved_syn unless we own the request sock.
      
      This fixes races for listeners using TCP_SAVE_SYN option.
      
      Fixes: e994b2f0 ("tcp: do not lock listener to process SYN packets")
      Fixes: 079096f1 ("tcp/dccp: install syn_recv requests into ehash table")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Reported-by: default avatarYing Cai <ycai@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      805c4bc0
    • LABBE Corentin's avatar
      net: stmmac: fix double-initialization of phy_iface · 428ad1bc
      LABBE Corentin authored
      The variable phy_iface is double-initialized to itself.
      This patch remove that.
      
      Reported-by: coverity (CID 1271141)
      Signed-off-by: default avatarLABBE Corentin <clabbe.montjoie@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      428ad1bc
    • Dan Carpenter's avatar
      qlogic: qed: fix error codes in qed_resc_alloc() · 9b15acbf
      Dan Carpenter authored
      We accidentally return success instead of -ENOMEM here.
      
      Fixes: fe56b9e6 ('qed: Add module with basic common support')
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Acked-by: Yuval Mintz <Yuval.Mintz@qlogic.com
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9b15acbf
    • Vivien Didelot's avatar
      net: dsa: mv88e6xxx: isolate unbridged ports · e79a8bcb
      Vivien Didelot authored
      The DSA documentation specifies that each port must be capable of
      forwarding frames to the CPU port. The last changes on bridging support
      for the mv88e6xxx driver broke this requirement for non-bridged ports.
      
      So as for the bridged ports, reserve a few VLANs (4000+) in the switch
      to isolate ports that have not been bridged yet.
      
      By default, a port will be isolated with the CPU and DSA ports. When the
      port joins a bridge, it will leave its reserved port. When it is removed
      from a bridge, it will join its reserved VLAN again.
      
      Fixes: 5fe7f680 ("net: dsa: mv88e6xxx: fix hardware bridging")
      Reported-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarVivien Didelot <vivien.didelot@savoirfairelinux.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e79a8bcb
    • Petr Štetiar's avatar
      USB: qmi_wwan: Add quirk for Quectel EC20 Mini PCIe module · b3d8cf01
      Petr Štetiar authored
      This device has same vendor and product IDs as G2K devices, but it has
      different number of interfaces(4 vs 5) and also different interface
      layout where EC20 has QMI on interface 4 instead of 0.
      
      lsusb output:
      
      	Bus 002 Device 003: ID 05c6:9215 Qualcomm, Inc. Acer Gobi 2000
      	Device Descriptor:
      	  bLength                18
      	  bDescriptorType         1
      	  bcdUSB               2.00
      	  bDeviceClass            0 (Defined at Interface level)
      	  bDeviceSubClass         0
      	  bDeviceProtocol         0
      	  bMaxPacketSize0        64
      	  idVendor           0x05c6 Qualcomm, Inc.
      	  idProduct          0x9215 Acer Gobi 2000 Wireless Modem
      	  bcdDevice            2.32
      	  iManufacturer           1 Quectel
      	  iProduct                2 Quectel LTE Module
      	  iSerial                 0
      	  bNumConfigurations      1
      	  Configuration Descriptor:
      	    bLength                 9
      	    bDescriptorType         2
      	    wTotalLength          209
      	    bNumInterfaces          5
      	    bConfigurationValue     1
      	    iConfiguration          0
      	    bmAttributes         0xa0
      	      (Bus Powered)
      	      Remote Wakeup
      	    MaxPower              500mA
      Signed-off-by: default avatarPetr Štetiar <ynezz@true.cz>
      Acked-by: default avatarBjørn Mork <bjorn@mork.no>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b3d8cf01
    • David S. Miller's avatar
      Merge branch 'for-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth · 09627330
      David S. Miller authored
      Johan Hedberg says:
      
      ====================
      pull request: bluetooth 2015-11-05
      
      The following set of Bluetooth patches would be good to get into 4.4-rc1
      if possible:
      
       - Fix for missing LE CoC parameter validity checks
       - Fix for potential deadlock in btusb
       - Fix for issuing unsupported commands during HCI init
      
      Please let me know if there are any issues pulling. Thanks.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      09627330
    • Yang Shi's avatar
      bpf: add mod default A and X test cases · d4e4bc16
      Yang Shi authored
      When running "mod X" operation, if X is 0 the filter has to be halt.
      Add new test cases to cover A = A mod X if X is 0, and A = A mod 1.
      
      CC: Xi Wang <xi.wang@gmail.com>
      CC: Zi Shen Lim <zlim.lnx@gmail.com>
      Signed-off-by: default avatarYang Shi <yang.shi@linaro.org>
      Acked-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Acked-by: default avatarZi Shen Lim <zlim.lnx@gmail.com>
      Acked-by: default avatarXi Wang <xi.wang@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d4e4bc16
    • Arnd Bergmann's avatar
      bnxt_en: add VXLAN dependency · df761ea1
      Arnd Bergmann authored
      VXLAN may be a loadable module, and this driver cannot be built-in
      in that case, or we get a link error:
      
      drivers/built-in.o: In function `__bnxt_open_nic':
      drivers/net/ethernet/broadcom/bnxt/bnxt.c:4581: undefined reference to `vxlan_get_rx_port'
      
      This adds a Kconfig dependency that ensures that either VXLAN is
      disabled (which the driver handles correctly), or we depend on
      VXLAN itself and disallow built-in compilation when VXLAN is
      a module.
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Fixes: c0c050c5 ("bnxt_en: New Broadcom ethernet driver.")
      Acked-by: default avatarMichael Chan <mchan@broadcom.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      df761ea1
    • Jiri Pirko's avatar
      net: add forgotten IFF_L3MDEV_SLAVE define · 8f25348b
      Jiri Pirko authored
      Fixes: fee6d4c7 ("net: Add netif_is_l3_slave")
      Signed-off-by: default avatarJiri Pirko <jiri@mellanox.com>
      Acked-by: default avatarDavid Ahern <dsa@cumulusnetworks.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8f25348b
    • Sabrina Dubroca's avatar
      ipv6: clean up dev_snmp6 proc entry when we fail to initialize inet6_dev · 2a189f9e
      Sabrina Dubroca authored
      In ipv6_add_dev, when addrconf_sysctl_register fails, we do not clean up
      the dev_snmp6 entry that we have already registered for this device.
      Call snmp6_unregister_dev in this case.
      
      Fixes: a317a2f1 ("ipv6: fail early when creating netdev named all or default")
      Reported-by: default avatarDmitry Vyukov <dvyukov@google.com>
      Signed-off-by: default avatarSabrina Dubroca <sd@queasysnail.net>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2a189f9e
    • Dan Carpenter's avatar
      qlogic: qed: fix a test for MODE_MF_SI · 87aec47d
      Dan Carpenter authored
      MODE_MF_SI is 9.  We should be testing bit 9 instead of AND 0x9.
      
      Fixes: fe56b9e6 ('qed: Add module with basic common support')
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Acked-by: default avatarYuval Mintz <Yuval.Mintz@qlogic.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      87aec47d
    • Dan Carpenter's avatar
      qlogic/qed: remove bogus NULL check · 8c169c28
      Dan Carpenter authored
      We check if "p_hwfn" is NULL and then dereference it in the error
      handling code.  I read the code and it isn't NULL so let's remove the
      check.
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Acked-by: default avatarYuval Mintz <Yuval.Mintz@qlogic.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8c169c28
    • Johan Hedberg's avatar
      Bluetooth: L2CAP: Add missing checks for invalid LE DCID · 40624183
      Johan Hedberg authored
      When receiving a connect response we should make sure that the DCID is
      within the valid range and that we don't already have another channel
      allocated for the same DCID.
      Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      40624183
    • Johan Hedberg's avatar
      Bluetooth: L2CAP: Fix checked range when allocating new CID · ab0c127f
      Johan Hedberg authored
      The 'dyn_end' value is also a valid CID so it should be included in
      the range of values checked.
      Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      ab0c127f
    • Johan Hedberg's avatar
      Bluetooth: L2CAP: Fix returning correct LE CoC response codes · 8a7889cc
      Johan Hedberg authored
      The core spec defines specific response codes for situations when the
      received CID is incorrect. Add the defines for these and return them
      as appropriate from the LE Connect Request handler function.
      Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      8a7889cc
    • Marcel Holtmann's avatar
      Bluetooth: Check for supported white list before issuing commands · 2ab216a7
      Marcel Holtmann authored
      The white list commands might not be implemented if the controller does
      not actually support the white list. So check the supported commands
      first before issuing these commands. Not supporting the white list is
      the same as supporting a white list with zero size.
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
      2ab216a7
    • Kuba Pawlak's avatar
      Bluetooth: Fix possible deadlock in btusb · f6fc86f2
      Kuba Pawlak authored
      commit 8f9d02f4 introduced spinlocks
      in btusb_work. This is run in a context of a worqueue and can be interrupted
      by hardware irq. If it happens while spinlock is held, we have a deadlock.
      Solution is to use _irqsave/_resore version of locking
      
      [  466.460560] =================================
      [  466.460565] [ INFO: inconsistent lock state ]
      [  466.460572] 4.3.0-rc6+ #1 Tainted: G        W
      [  466.460576] ---------------------------------
      [  466.460582] inconsistent {IN-HARDIRQ-W} -> {HARDIRQ-ON-W} usage.
      [  466.460589] kworker/0:2/94 [HC0[0]:SC0[0]:HE1:SE1] takes:
      [  466.460595]  (&(&data->rxlock)->rlock){?.-...}, at: [<ffffffffa0526923>] btusb_work+0xa3/0x3fd [btusb]
      [  466.460621] {IN-HARDIRQ-W} state was registered at:
      [  466.460625]   [<ffffffff811021b5>] __lock_acquire+0xc45/0x1e80
      [  466.460638]   [<ffffffff811040d5>] lock_acquire+0xe5/0x1f0
      [  466.460646]   [<ffffffff8182f108>] _raw_spin_lock+0x38/0x50
      [  466.460657]   [<ffffffffa0525448>] btusb_recv_intr+0x38/0x170 [btusb]
      [  466.460668]   [<ffffffffa0525626>] btusb_intr_complete+0xa6/0x130 [btusb]
      [  466.460679]   [<ffffffff815d8f1e>] __usb_hcd_giveback_urb+0x8e/0x160
      [  466.460690]   [<ffffffff815d911f>] usb_hcd_giveback_urb+0x3f/0x120
      [  466.460698]   [<ffffffff81606e4d>] uhci_giveback_urb+0xad/0x280
      [  466.460706]   [<ffffffff81608f64>] uhci_scan_schedule.part.33+0x6b4/0xbe0
      [  466.460714]   [<ffffffff81609b50>] uhci_irq+0xd0/0x180
      [  466.460722]   [<ffffffff815d8296>] usb_hcd_irq+0x26/0x40
      [  466.460729]   [<ffffffff81117d40>] handle_irq_event_percpu+0x40/0x300
      [  466.460739]   [<ffffffff81118040>] handle_irq_event+0x40/0x60
      [  466.460746]   [<ffffffff8111af39>] handle_fasteoi_irq+0x89/0x150
      [  466.460754]   [<ffffffff8101e0f3>] handle_irq+0x73/0x120
      [  466.460763]   [<ffffffff81832f11>] do_IRQ+0x61/0x120
      [  466.460772]   [<ffffffff8183084c>] ret_from_intr+0x0/0x31
      [  466.460780]   [<ffffffff81697a77>] cpuidle_enter+0x17/0x20
      [  466.460790]   [<ffffffff810f62c2>] call_cpuidle+0x32/0x60
      [  466.460800]   [<ffffffff810f65a8>] cpu_startup_entry+0x2b8/0x3f0
      [  466.460807]   [<ffffffff818214ca>] rest_init+0x13a/0x140
      [  466.460817]   [<ffffffff81f76029>] start_kernel+0x4a3/0x4c4
      [  466.460827]   [<ffffffff81f75339>] x86_64_start_reservations+0x2a/0x2c
      [  466.460837]   [<ffffffff81f75485>] x86_64_start_kernel+0x14a/0x16d
      [  466.460846] irq event stamp: 754913
      [  466.460851] hardirqs last  enabled at (754913): [<ffffffff8182f4cc>] _raw_spin_unlock_irq+0x2c/0x40
      [  466.460861] hardirqs last disabled at (754912): [<ffffffff8182f28d>] _raw_spin_lock_irq+0x1d/0x60
      [  466.460869] softirqs last  enabled at (753024): [<ffffffff810aeaa0>] __do_softirq+0x380/0x490
      [  466.460880] softirqs last disabled at (753009): [<ffffffff810aedef>] irq_exit+0x10f/0x120
      [  466.460888]
                     other info that might help us debug this:
      [  466.460894]  Possible unsafe locking scenario:
      
      [  466.460899]        CPU0
      [  466.460903]        ----
      [  466.460907]   lock(&(&data->rxlock)->rlock);
      [  466.460915]   <Interrupt>
      [  466.460918]     lock(&(&data->rxlock)->rlock);
      [  466.460926]
                      *** DEADLOCK ***
      
      [  466.460935] 2 locks held by kworker/0:2/94:
      [  466.460939]  #0:  ("events"){.+.+.+}, at: [<ffffffff810c69bb>] process_one_work+0x16b/0x660
      [  466.460958]  #1:  ((&data->work)){+.+...}, at: [<ffffffff810c69bb>] process_one_work+0x16b/0x660
      [  466.460974]
      Signed-off-by: default avatarKuba Pawlak <kubax.t.pawlak@intel.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      f6fc86f2
    • Stefan Hajnoczi's avatar
      VSOCK: call sk->sk_data_ready() on accept() · 7362945a
      Stefan Hajnoczi authored
      When a listen socket enqueues a connection for userspace to accept(),
      the sk->sk_data_ready() callback should be invoked.  In-kernel socket
      users rely on this callback to detect when incoming connections are
      available.
      
      Currently the sk->sk_state_change() callback is invoked by
      vmci_transport.c.  This happens to work for userspace applications since
      sk->sk_state_change = sock_def_wakeup() and sk->sk_data_ready =
      sock_def_readable() both wake up the accept() waiter.  In-kernel socket
      users, on the other hand, fail to detect incoming connections.
      Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7362945a
    • Tobias Klauser's avatar
      tun_dst: Fix potential NULL dereference · f63ce5b6
      Tobias Klauser authored
      In tun_dst_unclone() the return value of skb_metadata_dst() is checked
      for being NULL after it is dereferenced. Fix this by moving the
      dereference after the NULL check.
      
      Found by the Coverity scanner (CID 1338068).
      
      Fixes: fc4099f1 ("openvswitch: Fix egress tunnel info.")
      Cc: Pravin B Shelar <pshelar@nicira.com>
      Signed-off-by: default avatarTobias Klauser <tklauser@distanz.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f63ce5b6
    • Jarod Wilson's avatar
      net/core: ensure features get disabled on new lower devs · e7868a85
      Jarod Wilson authored
      With moving netdev_sync_lower_features() after the .ndo_set_features
      calls, I neglected to verify that devices added *after* a flag had been
      disabled on an upper device were properly added with that flag disabled as
      well. This currently happens, because we exit __netdev_update_features()
      when we see dev->features == features for the upper dev. We can retain the
      optimization of leaving without calling .ndo_set_features with a bit of
      tweaking and a goto here.
      
      Fixes: fd867d51 ("net/core: generic support for disabling netdev features down stack")
      CC: "David S. Miller" <davem@davemloft.net>
      CC: Eric Dumazet <edumazet@google.com>
      CC: Jay Vosburgh <j.vosburgh@gmail.com>
      CC: Veaceslav Falico <vfalico@gmail.com>
      CC: Andy Gospodarek <gospo@cumulusnetworks.com>
      CC: Jiri Pirko <jiri@resnulli.us>
      CC: Nikolay Aleksandrov <razor@blackwall.org>
      CC: Michal Kubecek <mkubecek@suse.cz>
      CC: Alexander Duyck <alexander.duyck@gmail.com>
      CC: netdev@vger.kernel.org
      Reported-by: default avatarNikolay Aleksandrov <nikolay@cumulusnetworks.com>
      Signed-off-by: default avatarJarod Wilson <jarod@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e7868a85
    • David Ahern's avatar
      net: Fix prefsrc lookups · e1b8d903
      David Ahern authored
      A bug report (https://bugzilla.kernel.org/show_bug.cgi?id=107071) noted
      that the follwoing ip command is failing with v4.3:
      
          $ ip route add 10.248.5.0/24 dev bond0.250 table vlan_250 src 10.248.5.154
          RTNETLINK answers: Invalid argument
      
      021dd3b8 changed the lookup of the given preferred source address to
      use the table id passed in, but this assumes the local entries are in the
      given table which is not necessarily true for non-VRF use cases. When
      validating the preferred source fallback to the local table on failure.
      
      Fixes: 021dd3b8 ("net: Add routes to the table associated with the device")
      Signed-off-by: default avatarDavid Ahern <dsa@cumulusnetworks.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e1b8d903
    • WANG Cong's avatar
      ipv4: fix a potential deadlock in mcast getsockopt() path · 87e9f031
      WANG Cong authored
      Sasha reported the following lockdep warning:
      
        Possible unsafe locking scenario:
      
              CPU0                    CPU1
              ----                    ----
         lock(sk_lock-AF_INET);
                                      lock(rtnl_mutex);
                                      lock(sk_lock-AF_INET);
         lock(rtnl_mutex);
      
      This is due to that for IP_MSFILTER and MCAST_MSFILTER, we take
      rtnl lock before the socket lock in setsockopt() path, but take
      the socket lock before rtnl lock in getsockopt() path. All the
      rest optnames are setsockopt()-only.
      
      Fix this by aligning the getsockopt() path with the setsockopt()
      path, so that all mcast socket path would be locked in the same
      order.
      
      Note, IPv6 part is different where rtnl lock is not held.
      
      Fixes: 54ff9ef3 ("ipv4, ipv6: kill ip_mc_{join, leave}_group and ipv6_sock_mc_{join, drop}")
      Reported-by: default avatarSasha Levin <sasha.levin@oracle.com>
      Cc: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
      Signed-off-by: default avatarCong Wang <xiyou.wangcong@gmail.com>
      Reviewed-by: default avatarMarcelo Ricardo Leitner <marcelo.leitner@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      87e9f031
    • WANG Cong's avatar
      ipv4: disable BH when changing ip local port range · 4ee3bd4a
      WANG Cong authored
      This fixes the following lockdep warning:
      
       [ INFO: inconsistent lock state ]
       4.3.0-rc7+ #1197 Not tainted
       ---------------------------------
       inconsistent {IN-SOFTIRQ-R} -> {SOFTIRQ-ON-W} usage.
       sysctl/1019 [HC0[0]:SC0[0]:HE1:SE1] takes:
        (&(&net->ipv4.ip_local_ports.lock)->seqcount){+.+-..}, at: [<ffffffff81921de7>] ipv4_local_port_range+0xb4/0x12a
       {IN-SOFTIRQ-R} state was registered at:
         [<ffffffff810bd682>] __lock_acquire+0x2f6/0xdf0
         [<ffffffff810be6d5>] lock_acquire+0x11c/0x1a4
         [<ffffffff818e599c>] inet_get_local_port_range+0x4e/0xae
         [<ffffffff8166e8e3>] udp_flow_src_port.constprop.40+0x23/0x116
         [<ffffffff81671cb9>] vxlan_xmit_one+0x219/0xa6a
         [<ffffffff81672f75>] vxlan_xmit+0xa6b/0xaa5
         [<ffffffff817f2deb>] dev_hard_start_xmit+0x2ae/0x465
         [<ffffffff817f35ed>] __dev_queue_xmit+0x531/0x633
         [<ffffffff817f3702>] dev_queue_xmit_sk+0x13/0x15
         [<ffffffff818004a5>] neigh_resolve_output+0x12f/0x14d
         [<ffffffff81959cfa>] ip6_finish_output2+0x344/0x39f
         [<ffffffff8195bf58>] ip6_finish_output+0x88/0x8e
         [<ffffffff8195bfef>] ip6_output+0x91/0xe5
         [<ffffffff819792ae>] dst_output_sk+0x47/0x4c
         [<ffffffff81979392>] NF_HOOK_THRESH.constprop.30+0x38/0x82
         [<ffffffff8197981e>] mld_sendpack+0x189/0x266
         [<ffffffff8197b28b>] mld_ifc_timer_expire+0x1ef/0x223
         [<ffffffff810de581>] call_timer_fn+0xfb/0x28c
         [<ffffffff810ded1e>] run_timer_softirq+0x1c7/0x1f1
      
      Fixes: b8f1a556 ("udp: Add function to make source port for UDP tunnels")
      Cc: Tom Herbert <tom@herbertland.com>
      Signed-off-by: default avatarCong Wang <xiyou.wangcong@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      4ee3bd4a
    • Sergei Shtylyov's avatar
      sh_eth: merge sh_eth_free_dma_buffer() into sh_eth_ring_free() · 8e03a5e7
      Sergei Shtylyov authored
      While the ring allocation is done by a single function, sh_eth_ring_init(),
      the ring deallocation was split into two functions (almost always called
      one after the other) for no good reason. Merge  sh_eth_free_dma_buffer()
      into sh_eth_ring_free() which allows us  to save space not only on the
      direct calls  of the former function but also on the sh_eth_ring_init()'s
      simplified error path...
      Signed-off-by: default avatarSergei Shtylyov <sergei.shtylyov@cogentembedded.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8e03a5e7
    • Sergei Shtylyov's avatar
      sh_eth: kill 'ret' variable in sh_eth_ring_init() · 91d80683
      Sergei Shtylyov authored
      The 'ret' local variable in sh_eth_ring_init() serves no useful purpose as
      the only  values it gets assigned are 0 and -ENOMEM both of which could be
      returned directly...
      Signed-off-by: default avatarSergei Shtylyov <sergei.shtylyov@cogentembedded.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      91d80683
    • Markus Brunner's avatar
      drivers: net: cpsw: Add support for fixed-link PHY · 1f71e8c9
      Markus Brunner authored
      Add support for a fixed-link devicetree sub-node in case the the
      cpsw MAC is directly connected to a non-mdio PHY/device.
      Signed-off-by: default avatarMarkus Brunner <systemprogrammierung.brunner@gmail.com>
      Acked-by: default avatarMugunthan V N <mugunthanvnm@ti.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1f71e8c9
    • David S. Miller's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf · d9c7dbc1
      David S. Miller authored
      Conflicts:
      	net/netfilter/xt_TEE.c
      
      Pablo Neira Ayuso says:
      
      ====================
      Netfilter fixes for net
      
      The following patchset contains Netfilter fixes for your net tree,
      they are:
      
      1) Fix crash when TEE target is used with no --oif, from Eric Dumazet.
      
      2) Oneliner to fix a crash on the redirect traffic to localhost
         infrastructure when interface has not yet an address, from
         Munehisa Kamata.
      
      3) Oneliner not to request module all the time from nfnetlink due to
         wrong type value, from Florian Westphal.
      
      I'll make sure these patches 1 and 2 hit -stable.
      ====================
      
      The conflict in net/netfilter/xt_TEE.c was minor, a change
      to the 'oif' selection overlapping a function signature
      change for the nf_dup_ipv{4,6}() routines.
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d9c7dbc1
  2. 04 Nov, 2015 10 commits
    • Linus Torvalds's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/ide · 1b1050cd
      Linus Torvalds authored
      Pull IDE fixlet from David Miller:
       "Just a y2038 fix to the pdc202xx_new IDE driver"
      
      * git://git.kernel.org/pub/scm/linux/kernel/git/davem/ide:
        ide: pdc202xx_new: Replace timeval with ktime_t
      1b1050cd
    • Linus Torvalds's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next · b0f85fa1
      Linus Torvalds authored
      Pull networking updates from David Miller:
      
      Changes of note:
      
       1) Allow to schedule ICMP packets in IPVS, from Alex Gartrell.
      
       2) Provide FIB table ID in ipv4 route dumps just as ipv6 does, from
          David Ahern.
      
       3) Allow the user to ask for the statistics to be filtered out of
          ipv4/ipv6 address netlink dumps.  From Sowmini Varadhan.
      
       4) More work to pass the network namespace context around deep into
          various packet path APIs, starting with the netfilter hooks.  From
          Eric W Biederman.
      
       5) Add layer 2 TX/RX checksum offloading to qeth driver, from Thomas
          Richter.
      
       6) Use usec resolution for SYN/ACK RTTs in TCP, from Yuchung Cheng.
      
       7) Support Very High Throughput in wireless MESH code, from Bob
          Copeland.
      
       8) Allow setting the ageing_time in switchdev/rocker.  From Scott
          Feldman.
      
       9) Properly autoload L2TP type modules, from Stephen Hemminger.
      
      10) Fix and enable offload features by default in 8139cp driver, from
          David Woodhouse.
      
      11) Support both ipv4 and ipv6 sockets in a single vxlan device, from
          Jiri Benc.
      
      12) Fix CWND limiting of thin streams in TCP, from Bendik Rønning
          Opstad.
      
      13) Fix IPSEC flowcache overflows on large systems, from Steffen
          Klassert.
      
      14) Convert bridging to track VLANs using rhashtable entries rather than
          a bitmap.  From Nikolay Aleksandrov.
      
      15) Make TCP listener handling completely lockless, this is a major
          accomplishment.  Incoming request sockets now live in the
          established hash table just like any other socket too.
      
          From Eric Dumazet.
      
      15) Provide more bridging attributes to netlink, from Nikolay
          Aleksandrov.
      
      16) Use hash based algorithm for ipv4 multipath routing, this was very
          long overdue.  From Peter Nørlund.
      
      17) Several y2038 cures, mostly avoiding timespec.  From Arnd Bergmann.
      
      18) Allow non-root execution of EBPF programs, from Alexei Starovoitov.
      
      19) Support SO_INCOMING_CPU as setsockopt, from Eric Dumazet.  This
          influences the port binding selection logic used by SO_REUSEPORT.
      
      20) Add ipv6 support to VRF, from David Ahern.
      
      21) Add support for Mellanox Spectrum switch ASIC, from Jiri Pirko.
      
      22) Add rtl8xxxu Realtek wireless driver, from Jes Sorensen.
      
      23) Implement RACK loss recovery in TCP, from Yuchung Cheng.
      
      24) Support multipath routes in MPLS, from Roopa Prabhu.
      
      25) Fix POLLOUT notification for listening sockets in AF_UNIX, from Eric
          Dumazet.
      
      26) Add new QED Qlogic river, from Yuval Mintz, Manish Chopra, and
          Sudarsana Kalluru.
      
      27) Don't fetch timestamps on AF_UNIX sockets, from Hannes Frederic
          Sowa.
      
      28) Support ipv6 geneve tunnels, from John W Linville.
      
      29) Add flood control support to switchdev layer, from Ido Schimmel.
      
      30) Fix CHECKSUM_PARTIAL handling of potentially fragmented frames, from
          Hannes Frederic Sowa.
      
      31) Support persistent maps and progs in bpf, from Daniel Borkmann.
      
      * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (1790 commits)
        sh_eth: use DMA barriers
        switchdev: respect SKIP_EOPNOTSUPP flag in case there is no recursion
        net: sched: kill dead code in sch_choke.c
        irda: Delete an unnecessary check before the function call "irlmp_unregister_service"
        net: dsa: mv88e6xxx: include DSA ports in VLANs
        net: dsa: mv88e6xxx: disable SA learning for DSA and CPU ports
        net/core: fix for_each_netdev_feature
        vlan: Invoke driver vlan hooks only if device is present
        arcnet/com20020: add LEDS_CLASS dependency
        bpf, verifier: annotate verbose printer with __printf
        dp83640: Only wait for timestamps for packets with timestamping enabled.
        ptp: Change ptp_class to a proper bitmask
        dp83640: Prune rx timestamp list before reading from it
        dp83640: Delay scheduled work.
        dp83640: Include hash in timestamp/packet matching
        ipv6: fix tunnel error handling
        net/mlx5e: Fix LSO vlan insertion
        net/mlx5e: Re-eanble client vlan TX acceleration
        net/mlx5e: Return error in case mlx5e_set_features() fails
        net/mlx5e: Don't allow more than max supported channels
        ...
      b0f85fa1
    • Linus Torvalds's avatar
      Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 · ccc9d4a6
      Linus Torvalds authored
      Pull crypto update from Herbert Xu:
       "API:
      
         - Add support for cipher output IVs in testmgr
         - Add missing crypto_ahash_blocksize helper
         - Mark authenc and des ciphers as not allowed under FIPS.
      
      Algorithms:
      
         - Add CRC support to 842 compression
         - Add keywrap algorithm
         - A number of changes to the akcipher interface:
            + Separate functions for setting public/private keys.
            + Use SG lists.
      
      Drivers:
      
         - Add Intel SHA Extension optimised SHA1 and SHA256
         - Use dma_map_sg instead of custom functions in crypto drivers
         - Add support for STM32 RNG
         - Add support for ST RNG
         - Add Device Tree support to exynos RNG driver
         - Add support for mxs-dcp crypto device on MX6SL
         - Add xts(aes) support to caam
         - Add ctr(aes) and xts(aes) support to qat
         - A large set of fixes from Russell King for the marvell/cesa driver"
      
      * 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: (115 commits)
        crypto: asymmetric_keys - Fix unaligned access in x509_get_sig_params()
        crypto: akcipher - Don't #include crypto/public_key.h as the contents aren't used
        hwrng: exynos - Add Device Tree support
        hwrng: exynos - Fix missing configuration after suspend to RAM
        hwrng: exynos - Add timeout for waiting on init done
        dt-bindings: rng: Describe Exynos4 PRNG bindings
        crypto: marvell/cesa - use __le32 for hardware descriptors
        crypto: marvell/cesa - fix missing cpu_to_le32() in mv_cesa_dma_add_op()
        crypto: marvell/cesa - use memcpy_fromio()/memcpy_toio()
        crypto: marvell/cesa - use gfp_t for gfp flags
        crypto: marvell/cesa - use dma_addr_t for cur_dma
        crypto: marvell/cesa - use readl_relaxed()/writel_relaxed()
        crypto: caam - fix indentation of close braces
        crypto: caam - only export the state we really need to export
        crypto: caam - fix non-block aligned hash calculation
        crypto: caam - avoid needlessly saving and restoring caam_hash_ctx
        crypto: caam - print errno code when hash registration fails
        crypto: marvell/cesa - fix memory leak
        crypto: marvell/cesa - fix first-fragment handling in mv_cesa_ahash_dma_last_req()
        crypto: marvell/cesa - rearrange handling for sw padded hashes
        ...
      ccc9d4a6
    • Linus Torvalds's avatar
      Merge branch 'x86-platform-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 66ef3493
      Linus Torvalds authored
      Pull x86 platform changes from Ingo Molnar:
       "Misc updates to the Intel MID and SGI UV platforms"
      
      * 'x86-platform-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/intel-mid: Make intel_mid_ops static
        arch/x86/intel-mid: Use kmemdup rather than duplicating its implementation
        x86/platform/uv: Implement simple dump failover if kdump fails
        x86/platform/uv: Insert per_cpu accessor function on uv_hub_nmi
      66ef3493
    • Linus Torvalds's avatar
      Merge branch 'x86-mm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 639ab3eb
      Linus Torvalds authored
      Pull x86 mm changes from Ingo Molnar:
       "The main changes are: continued PAT work by Toshi Kani, plus a new
        boot time warning about insecure RWX kernel mappings, by Stephen
        Smalley.
      
        The new CONFIG_DEBUG_WX=y warning is marked default-y if
        CONFIG_DEBUG_RODATA=y is already eanbled, as a special exception, as
        these bugs are hard to notice and this check already found several
        live bugs"
      
      * 'x86-mm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/mm: Warn on W^X mappings
        x86/mm: Fix no-change case in try_preserve_large_page()
        x86/mm: Fix __split_large_page() to handle large PAT bit
        x86/mm: Fix try_preserve_large_page() to handle large PAT bit
        x86/mm: Fix gup_huge_p?d() to handle large PAT bit
        x86/mm: Fix slow_virt_to_phys() to handle large PAT bit
        x86/mm: Fix page table dump to show PAT bit
        x86/asm: Add pud_pgprot() and pmd_pgprot()
        x86/asm: Fix pud/pmd interfaces to handle large PAT bit
        x86/asm: Add pud/pmd mask interfaces to handle large PAT bit
        x86/asm: Move PUD_PAGE macros to page_types.h
        x86/vdso32: Define PGTABLE_LEVELS to 32bit VDSO
      639ab3eb
    • Linus Torvalds's avatar
      Merge branch 'x86-headers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 4302d506
      Linus Torvalds authored
      Pull x86 sigcontext header cleanups from Ingo Molnar:
       "This series reorganizes and cleans up various aspects of the main
        sigcontext UAPI headers, such as unifying the data structures and
        updating/adding lots of comments to explain all the ABI details and
        quirks.  The headers can now also be built in user-space standalone"
      
      * 'x86-headers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/headers: Clean up too long lines
        x86/headers: Remove <asm/sigcontext.h> references on the kernel side
        x86/headers: Remove direct sigcontext32.h uses
        x86/headers: Convert sigcontext_ia32 uses to sigcontext_32
        x86/headers: Unify 'struct sigcontext_ia32' and 'struct sigcontext_32'
        x86/headers: Make sigcontext pointers bit independent
        x86/headers: Move the 'struct sigcontext' definitions into the UAPI header
        x86/headers: Clean up the kernel's struct sigcontext types to be ABI-clean
        x86/headers: Convert uses of _fpstate_ia32 to _fpstate_32
        x86/headers: Unify 'struct _fpstate_ia32' and i386 struct _fpstate
        x86/headers: Unify register type definitions between 32-bit compat and i386
        x86/headers: Use ABI types consistently in sigcontext*.h
        x86/headers: Separate out legacy user-space structure definitions
        x86/headers: Clean up and better document uapi/asm/sigcontext.h
        x86/headers: Clean up uapi/asm/sigcontext32.h
        x86/headers: Fix (old) header file dependency bug in uapi/asm/sigcontext32.h
      4302d506
    • Linus Torvalds's avatar
      Merge branch 'x86-fpu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · ce4d72fa
      Linus Torvalds authored
      Pull x86 fpu changes from Ingo Molnar:
       "There are two main areas of changes:
      
         - Rework of the extended FPU state code to robustify the kernel's
           usage of cpuid provided xstate sizes - and related changes (Dave
           Hansen)"
      
         - math emulation enhancements: new modern FPU instructions support,
           with testcases, plus cleanups (Denys Vlasnko)"
      
      * 'x86-fpu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (23 commits)
        x86/fpu: Fixup uninitialized feature_name warning
        x86/fpu/math-emu: Add support for FISTTP instructions
        x86/fpu/math-emu, selftests: Add test for FISTTP instructions
        x86/fpu/math-emu: Add support for FCMOVcc insns
        x86/fpu/math-emu: Add support for F[U]COMI[P] insns
        x86/fpu/math-emu: Remove define layer for undocumented opcodes
        x86/fpu/math-emu, selftests: Add tests for FCMOV and FCOMI insns
        x86/fpu/math-emu: Remove !NO_UNDOC_CODE
        x86/fpu: Check CPU-provided sizes against struct declarations
        x86/fpu: Check to ensure increasing-offset xstate offsets
        x86/fpu: Correct and check XSAVE xstate size calculations
        x86/fpu: Add C structures for AVX-512 state components
        x86/fpu: Rework YMM definition
        x86/fpu/mpx: Rework MPX 'xstate' types
        x86/fpu: Add xfeature_enabled() helper instead of test_bit()
        x86/fpu: Remove 'xfeature_nr'
        x86/fpu: Rework XSTATE_* macros to remove magic '2'
        x86/fpu: Rename XFEATURES_NR_MAX
        x86/fpu: Rename XSAVE macros
        x86/fpu: Remove partial LWP support definitions
        ...
      ce4d72fa
    • Linus Torvalds's avatar
      Merge branch 'x86-debug-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 0f25f2c1
      Linus Torvalds authored
      Pull x86 kgdb fixlet from Ingo Molnar:
       "A single debugging related commit: compress the memory usage of a kgdb
        data structure"
      
      * 'x86-debug-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/kgdb: Replace bool_int_array[NR_CPUS] with bitmap
      0f25f2c1
    • Linus Torvalds's avatar
      Merge branch 'x86-cpu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · f323c49b
      Linus Torvalds authored
      Pull x86 cpu changes from Ingo Molnar:
       "Two changes in this cycle: a Kconfig help text enhancement, and an AMD
        CLZERO instruction capability detection and enumeration"
      
      * 'x86-cpu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/cpu: Add CLZERO detection
        x86/Kconfig/cpus: Fix/complete CPU type help texts
      f323c49b
    • Linus Torvalds's avatar
      Merge branch 'x86-cleanups-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 33d46f97
      Linus Torvalds authored
      Pull x86 cleanups from Ingo Molnar:
       "An early_printk cleanup plus deinlining enhancements"
      
      * 'x86-cleanups-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/early_printk: Set __iomem address space for IO
        x86/signal: Deinline get_sigframe, save 240 bytes
        x86: Deinline early_console_register, save 403 bytes
        x86/e820: Deinline e820_type_to_string, save 126 bytes
      33d46f97