1. 19 12月, 2014 2 次提交
    • T
      netlink: Don't reorder loads/stores before marking mmap netlink frame as available · a18e6a18
      Thomas Graf 提交于
      Each mmap Netlink frame contains a status field which indicates
      whether the frame is unused, reserved, contains data or needs to
      be skipped. Both loads and stores may not be reordeded and must
      complete before the status field is changed and another CPU might
      pick up the frame for use. Use an smp_mb() to cover needs of both
      types of callers to netlink_set_status(), callers which have been
      reading data frame from the frame, and callers which have been
      filling or releasing and thus writing to the frame.
      
      - Example code path requiring a smp_rmb():
        memcpy(skb->data, (void *)hdr + NL_MMAP_HDRLEN, hdr->nm_len);
        netlink_set_status(hdr, NL_MMAP_STATUS_UNUSED);
      
      - Example code path requiring a smp_wmb():
        hdr->nm_uid	= from_kuid(sk_user_ns(sk), NETLINK_CB(skb).creds.uid);
        hdr->nm_gid	= from_kgid(sk_user_ns(sk), NETLINK_CB(skb).creds.gid);
        netlink_frame_flush_dcache(hdr);
        netlink_set_status(hdr, NL_MMAP_STATUS_VALID);
      
      Fixes: f9c228 ("netlink: implement memory mapped recvmsg()")
      Reported-by: NEric Dumazet <eric.dumazet@gmail.com>
      Signed-off-by: NThomas Graf <tgraf@suug.ch>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a18e6a18
    • D
      netlink: Always copy on mmap TX. · 4682a035
      David Miller 提交于
      Checking the file f_count and the nlk->mapped count is not completely
      sufficient to prevent the mmap'd area contents from changing from
      under us during netlink mmap sendmsg() operations.
      
      Be careful to sample the header's length field only once, because this
      could change from under us as well.
      
      Fixes: 5fd96123 ("netlink: implement memory mapped sendmsg()")
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Acked-by: NDaniel Borkmann <dborkman@redhat.com>
      Acked-by: NThomas Graf <tgraf@suug.ch>
      4682a035
  2. 17 12月, 2014 14 次提交
    • O
      net: Disallow providing non zero VLAN ID for NIC drivers FDB add flow · 65891fea
      Or Gerlitz 提交于
      The current implementations all use dev_uc_add_excl() and such whose API
      doesn't support vlans, so we can't make it with NICs HW for now.
      
      Fixes: f6f6424b ('net: make vid as a parameter for ndo_fdb_add/ndo_fdb_del')
      Signed-off-by: NOr Gerlitz <ogerlitz@mellanox.com>
      Reviewed-by: NJiri Pirko <jiri@resnulli.us>
      Acked-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      65891fea
    • I
      net/mlx4: Cache line CQE/EQE stride fixes · c3f2511f
      Ido Shamay 提交于
      This commit contains 2 fixes for the 128B CQE/EQE stride feaure.
      Wei found that mlx4_QUERY_HCA function marked the wrong capability
      in flags (64B CQE/EQE), when CQE/EQE stride feature was enabled.
      Also added small fix in initial CQE ownership bit assignment, when CQE
      is size is not default 32B.
      
      Fixes: 77507aa2 (net/mlx4: Enable CQE/EQE stride support)
      Signed-off-by: NWei Yang <weiyang@linux.vnet.ibm.com>
      Signed-off-by: NIdo Shamay <idos@mellanox.com>
      Signed-off-by: NAmir Vadai <amirv@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c3f2511f
    • N
      net: fec: Fix NAPI race · 94191fd6
      Nimrod Andy 提交于
      Do camera capture test on i.MX6q sabresd board, and save the capture data to
      nfs rootfs. The command is:
      gst-launch-1.0 -e imxv4l2src device=/dev/video1 num-buffers=2592000 ! tee name=t !
      queue ! imxv4l2sink sync=false t. ! queue ! vpuenc ! queue ! mux. pulsesrc num-buffers=3720937
      blocksize=4096 ! 'audio/x-raw, rate=44100, channels=2' ! queue ! imxmp3enc ! mpegaudioparse !
      queue ! mux. qtmux name=mux ! filesink location=video_recording_long.mov
      
      After about 10 hours running, there have net watchdog timeout kernel dump:
      ...
      WARNING: CPU: 0 PID: 0 at net/sched/sch_generic.c:264 dev_watchdog+0x2b4/0x2d8()
      NETDEV WATCHDOG: eth0 (fec): transmit queue 0 timed out
      CPU: 0 PID: 0 Comm: swapper/0 Not tainted 3.14.24-01051-gdb840b7 #440
      [<80014e6c>] (unwind_backtrace) from [<800118ac>] (show_stack+0x10/0x14)
      [<800118ac>] (show_stack) from [<806ae3f0>] (dump_stack+0x78/0xc0)
      [<806ae3f0>] (dump_stack) from [<8002b504>] (warn_slowpath_common+0x68/0x8c)
      [<8002b504>] (warn_slowpath_common) from [<8002b558>] (warn_slowpath_fmt+0x30/0x40)
      [<8002b558>] (warn_slowpath_fmt) from [<8055e0d4>] (dev_watchdog+0x2b4/0x2d8)
      [<8055e0d4>] (dev_watchdog) from [<800352d8>] (call_timer_fn.isra.33+0x24/0x8c)
      [<800352d8>] (call_timer_fn.isra.33) from [<800354c4>] (run_timer_softirq+0x184/0x220)
      [<800354c4>] (run_timer_softirq) from [<8002f420>] (__do_softirq+0xc0/0x22c)
      [<8002f420>] (__do_softirq) from [<8002f804>] (irq_exit+0xa8/0xf4)
      [<8002f804>] (irq_exit) from [<8000ee5c>] (handle_IRQ+0x54/0xb4)
      [<8000ee5c>] (handle_IRQ) from [<80008598>] (gic_handle_irq+0x28/0x5c)
      [<80008598>] (gic_handle_irq) from [<800123c0>] (__irq_svc+0x40/0x74)
      Exception stack(0x80d27f18 to 0x80d27f60)
      7f00:                                                       80d27f60 0000014c
      7f20: 8858c60e 0000004d 884e4540 0000004d ab7250d0 80d34348 00000000 00000000
      7f40: 00000001 00000000 00000017 80d27f60 800702a4 80476e6c 600f0013 ffffffff
      [<800123c0>] (__irq_svc) from [<80476e6c>] (cpuidle_enter_state+0x50/0xe0)
      [<80476e6c>] (cpuidle_enter_state) from [<80476fa8>] (cpuidle_idle_call+0xac/0x154)
      [<80476fa8>] (cpuidle_idle_call) from [<8000f174>] (arch_cpu_idle+0x8/0x44)
      [<8000f174>] (arch_cpu_idle) from [<80064c54>] (cpu_startup_entry+0x100/0x158)
      [<80064c54>] (cpu_startup_entry) from [<80cd8a9c>] (start_kernel+0x304/0x368)
      ---[ end trace 09ebd32fb032f86d ]---
      ...
      
      There might have a race in napi_schedule(), leaving interrupts disabled forever.
      After these patch, the case still work more than 40 hours running.
      Signed-off-by: NFugang Duan <B38611@freescale.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      94191fd6
    • D
      xen-netfront: use napi_complete() correctly to prevent Rx stalling · 6a6dc08f
      David Vrabel 提交于
      After d75b1ade (net: less interrupt
      masking in NAPI) the napi instance is removed from the per-cpu list
      prior to calling the n->poll(), and is only requeued if all of the
      budget was used.  This inadvertently broke netfront because netfront
      does not use NAPI correctly.
      
      If netfront had not used all of its budget it would do a final check
      for any Rx responses and avoid calling napi_complete() if there were
      more responses.  It would still return under budget so it would never
      be rescheduled.  The final check would also not re-enable the Rx
      interrupt.
      
      Additionally, xenvif_poll() would also call napi_complete() /after/
      enabling the interrupt.  This resulted in a race between the
      napi_complete() and the napi_schedule() in the interrupt handler.  The
      use of local_irq_save/restore() avoided by race iff the handler is
      running on the same CPU but not if it was running on a different CPU.
      
      Fix both of these by always calling napi_compete() if the budget was
      not all used, and then calling napi_schedule() if the final checks
      says there's more work.
      Signed-off-by: NDavid Vrabel <david.vrabel@citrix.com>
      Cc: Eric Dumazet <edumazet@google.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      6a6dc08f
    • T
      ip_tunnel: Add missing validation of encap type to ip_tunnel_encap_setup() · f1fb521f
      Thomas Graf 提交于
      The encap->type comes straight from Netlink. Validate it against
      max supported encap types just like ip_encap_hlen() already does.
      
      Fixes: a8c5f9 ("ip_tunnel: Ops registration for secondary encap (fou, gue)")
      Signed-off-by: NThomas Graf <tgraf@suug.ch>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      f1fb521f
    • T
      ip_tunnel: Add sanity checks to ip_tunnel_encap_add_ops() · bb1553c8
      Thomas Graf 提交于
      The symbols are exported and could be used by external modules.
      
      Fixes: a8c5f9 ("ip_tunnel: Ops registration for secondary encap (fou, gue)")
      Signed-off-by: NThomas Graf <tgraf@suug.ch>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      bb1553c8
    • D
      Merge tag 'master-2014-12-15' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless · c9f2c3d3
      David S. Miller 提交于
      John W. Linville says:
      
      ====================
      pull request: wireless 2014-12-16
      
      Please pull this batch of fixes intended for the 3.19 stream!
      
      For the Bluetooth bits, Johan says:
      
      "The patches consist of:
      
       - Coccinelle warning fix
       - hci_dev_lock/unlock fixes
       - Fixes for pending mgmt command handling
       - Fixes for properly following the force_lesc_support switch
       - Fix for a Microsoft branded Broadcom adapter
       - New device id for Atheros AR3012
       - Fix for BR/EDR Secure Connections enabling"
      
      Along with that...
      
      Brian Norris avoids leaking some kernel memory contents via printk in brcmsmac.
      
      Julia Lawall corrects some misspellings in a few drivers.
      
      Larry Finger gives us one more rtlwifi fix to correct a porting oversight.
      
      Wei Yongjun fixes a sparse warning in rtlwifi.
      
      Please let me know if there are problems!
      ====================
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c9f2c3d3
    • D
      net: Allow FIXED_PHY to be modular. · 6539c44d
      David S. Miller 提交于
      Otherwise we get things like:
      
      warning: (NET_DSA_BCM_SF2 && BCMGENET && SYSTEMPORT) selects FIXED_PHY which has unmet direct dependencies (NETDEVICES && PHYLIB=y)
      
      In order to make this work we have to rename fixed.c to fixed_phy.c
      because the regulator drivers already have a module named "fixed.o".
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      6539c44d
    • D
      Merge branch 'vnet_le' · 772801ef
      David S. Miller 提交于
      Michael S. Tsirkin says:
      
      ====================
      tun/macvtap: TUNSETIFF fixes
      
      Dan Carpenter reported the following:
      	static checker warning:
      
      		drivers/net/tun.c:1694 tun_set_iff()
      		warn: 0x17100 is larger than 16 bits
      
      	drivers/net/tun.c
      	  1692
      	  1693          tun->flags = (tun->flags & ~TUN_FEATURES) |
      	  1694                  (ifr->ifr_flags & TUN_FEATURES);
      	  1695
      
      	It's complaining because the "ifr->ifr_flags" variable is a short
      	(should it be unsigned?).  The new define:
      
      	#define IFF_VNET_LE    0x10000
      
      	doesn't fit in two bytes.  Other suspect looking code could be:
      
      		return __virtio16_to_cpu(q->flags & IFF_VNET_LE, val);
      
      And that's true: we have run out of IFF flags in tun.
      
      So let's not try to add more: add simple GET/SET ioctls
      instead. Easy to test, leads to clear semantics.
      
      Alternatively we'll have to revert the whole thing for 3.19,
      but that seems more work as this has dependencies
      in other places.
      
      While here, I noticed that macvtap was actually reading
      ifreq flags as a 32 bit field.
      Fix that up as well.
      ====================
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      772801ef
    • M
      if_tun: drop broken IFF_VNET_LE · 9c6ab193
      Michael S. Tsirkin 提交于
      Everyone should use TUNSETVNETLE/TUNGETVNETLE instead.
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      9c6ab193
    • M
      macvtap: drop broken IFF_VNET_LE · 01b07fb3
      Michael S. Tsirkin 提交于
      Use TUNSETVNETLE/TUNGETVNETLE instead.
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      01b07fb3
    • M
      tun: drop broken IFF_VNET_LE · 1cf8e410
      Michael S. Tsirkin 提交于
      Use TUNSETVNETLE/TUNGETVNETLE instead.
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      1cf8e410
    • M
      if_tun: add TUNSETVNETLE/TUNGETVNETLE · 5eea84f4
      Michael S. Tsirkin 提交于
      ifreq flags field is only 16 bit wide, so setting IFF_VNET_LE there has
      no effect:
      doesn't fit in two bytes.
      
      The tests passed apparently because they have an even number of bugs,
      all cancelling out.
      
      Luckily we didn't release a kernel with this flag, so it's
      not too late to fix this.
      
      Add TUNSETVNETLE/TUNGETVNETLE to really achieve the purpose
      of IFF_VNET_LE.
      
      This has an added benefit that if we ever want a BE flag,
      we won't have to deal with weird configurations like
      setting both LE and BE at the same time.
      
      IFF_VNET_LE will be dropped in a follow-up patch.
      Reported-by: NDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      5eea84f4
    • M
      macvtap: fix uninitialized access on TUNSETIFF · 39ec7de7
      Michael S. Tsirkin 提交于
      flags field in ifreq is only 16 bit wide, but
      we read it as a 32 bit value.
      If userspace doesn't zero-initialize unused fields,
      this will lead to failures.
      Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      39ec7de7
  3. 16 12月, 2014 23 次提交
  4. 15 12月, 2014 1 次提交
    • L
      Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security · 67e2c388
      Linus Torvalds 提交于
      Pull security layer updates from James Morris:
       "In terms of changes, there's general maintenance to the Smack,
        SELinux, and integrity code.
      
        The IMA code adds a new kconfig option, IMA_APPRAISE_SIGNED_INIT,
        which allows IMA appraisal to require signatures.  Support for reading
        keys from rootfs before init is call is also added"
      
      * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security: (23 commits)
        selinux: Remove security_ops extern
        security: smack: fix out-of-bounds access in smk_parse_smack()
        VFS: refactor vfs_read()
        ima: require signature based appraisal
        integrity: provide a hook to load keys when rootfs is ready
        ima: load x509 certificate from the kernel
        integrity: provide a function to load x509 certificate from the kernel
        integrity: define a new function integrity_read_file()
        Security: smack: replace kzalloc with kmem_cache for inode_smack
        Smack: Lock mode for the floor and hat labels
        ima: added support for new kernel cmdline parameter ima_template_fmt
        ima: allocate field pointers array on demand in template_desc_init_fields()
        ima: don't allocate a copy of template_fmt in template_desc_init_fields()
        ima: display template format in meas. list if template name length is zero
        ima: added error messages to template-related functions
        ima: use atomic bit operations to protect policy update interface
        ima: ignore empty and with whitespaces policy lines
        ima: no need to allocate entry for comment
        ima: report policy load status
        ima: use path names cache
        ...
      67e2c388