1. 16 5月, 2014 8 次提交
    • Z
      xen-netback: Fix grant ref resolution in RX path · 58375744
      Zoltan Kiss 提交于
      The original series for reintroducing grant mapping for netback had a patch [1]
      to handle receiving of packets from an another VIF. Grant copy on the receiving
      side needs the grant ref of the page to set up the op.
      The original patch assumed (wrongly) that the frags array haven't changed. In
      the case reported by Sander, the sending guest sent a packet where the linear
      buffer and the first frag were under PKT_PROT_LEN (=128) bytes.
      xenvif_tx_submit() then pulled up the linear area to 128 bytes, and ditched the
      first frag. The receiving side had an off-by-one problem when gathered the grant
      refs.
      This patch fixes that by checking whether the actual frag's page pointer is the
      same as the page in the original frag list. It can handle any kind of changes on
      the original frags array, like:
      - removing granted frags from the array at any point
      - adding local pages to the frags list anywhere
      - reordering the frags
      It's optimized to the most common case, when there is 1:1 relation between the
      frags and the list, plus works optimal when frags are removed from the end or
      the beginning.
      
      [1]: 3e2234: xen-netback: Handle foreign mapped pages on the guest RX path
      Reported-by: NSander Eikelenboom <linux@eikelenboom.it>
      Signed-off-by: NZoltan Kiss <zoltan.kiss@citrix.com>
      Acked-by: NIan Campbell <ian.campbell@citrix.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      58375744
    • D
      ipv6: update Destination Cache entries when gateway turn into host · be7a010d
      Duan Jiong 提交于
      RFC 4861 states in 7.2.5:
      
      	The IsRouter flag in the cache entry MUST be set based on the
               Router flag in the received advertisement.  In those cases
               where the IsRouter flag changes from TRUE to FALSE as a result
               of this update, the node MUST remove that router from the
               Default Router List and update the Destination Cache entries
               for all destinations using that neighbor as a router as
               specified in Section 7.3.3.  This is needed to detect when a
               node that is used as a router stops forwarding packets due to
               being configured as a host.
      
      Currently, when dealing with NA Message which IsRouter flag changes from
      TRUE to FALSE, the kernel only removes router from the Default Router List,
      and don't update the Destination Cache entries.
      
      Now in order to update those Destination Cache entries, i introduce
      function rt6_clean_tohost().
      Signed-off-by: NDuan Jiong <duanj.fnst@cn.fujitsu.com>
      Acked-by: NHannes Frederic Sowa <hannes@stressinduktion.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      be7a010d
    • D
      Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec · f895f0cf
      David S. Miller 提交于
      Conflicts:
      	net/ipv4/ip_vti.c
      
      Steffen Klassert says:
      
      ====================
      pull request (net): ipsec 2014-05-15
      
      This pull request has a merge conflict in net/ipv4/ip_vti.c
      between commit 8d89dcdf ("vti: don't allow to add the same
      tunnel twice") and commit a3245236  ("vti4:Don't count header
      length twice"). It can be solved like it is done in linux-next.
      
      1) Fix a ipv6 xfrm output crash when a packet is rerouted
         by netfilter to not use IPsec.
      
      2) vti4 counts some header lengths twice leading to an incorrect
         device mtu. Fix this by counting these headers only once.
      
      3) We don't catch the case if an unsupported protocol is submitted
         to the xfrm protocol handlers, this can lead to NULL pointer
         dereferences. Fix this by adding the appropriate checks.
      
      4) vti6 may unregister pernet ops twice on init errors.
         Fix this by removing one of the calls to do it only once.
         From Mathias Krause.
      
      5) Set the vti tunnel mark before doing a lookup in the error
         handlers. Otherwise we don't find the correct xfrm state.
      ====================
      
      The conflict in ip_vti.c was simple, 'net' had a commit
      removing a line from vti_tunnel_init() and this tree
      being merged had a commit adding a line to the same
      location.
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      f895f0cf
    • G
      net: phy: Don't call phy_resume if phy_init_hw failed · b394745d
      Guenter Roeck 提交于
      After the call to phy_init_hw failed in phy_attach_direct, phy_detach is called
      to detach the phy device from its network device. If the attached driver is a
      generic phy driver, this also detaches the driver. Subsequently phy_resume
      is called, which assumes without checking that a driver is attached to the
      device. This will result in a crash such as
      
      Unable to handle kernel paging request for data at address 0xffffffffffffff90
      Faulting instruction address: 0xc0000000003a0e18
      Oops: Kernel access of bad area, sig: 11 [#1]
      ...
      NIP [c0000000003a0e18] .phy_attach_direct+0x68/0x17c
      LR [c0000000003a0e6c] .phy_attach_direct+0xbc/0x17c
      Call Trace:
      [c0000003fc0475d0] [c0000000003a0e6c] .phy_attach_direct+0xbc/0x17c (unreliable)
      [c0000003fc047670] [c0000000003a0ff8] .phy_connect_direct+0x28/0x98
      [c0000003fc047700] [c0000000003f0074] .of_phy_connect+0x4c/0xa4
      
      Only call phy_resume if phy_init_hw was successful.
      Signed-off-by: NGuenter Roeck <linux@roeck-us.net>
      Acked-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      b394745d
    • D
      Merge branch 'altera_tse' · 48f0459f
      David S. Miller 提交于
      Vince Bridgers says:
      
      ====================
      Altera TSE: Fix Sparse errors and misc issues
      
      This is version 2 of a patch series to correct sparse errors, cppcheck
      warnings, and workaound a multicast filtering issue in the Altera TSE
      Ethernet driver. Multicast filtering is not working as expected, so if
      present in the hardware will not be used and promiscuous mode enabled
      instead. This workaround will be replaced with a working solution when
      completely debugged, integrated and tested.
      
      Version 2 is different from the first submission by breaking out the
      workaround as a seperate patch and addressing a few structure instance
      declarations by making them const per review comments.
      
      If you find this patch acceptable, please consider this for inclusion into
      the Altera TSE driver source code.
      ====================
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      48f0459f
    • V
      Altera TSE: Disable Multicast filtering to workaround problem · d91e5c02
      Vince Bridgers 提交于
      This patch disables multicast hash filtering if present in the hardware
      and uses promiscuous mode instead until the problem with multicast
      filtering has been debugged, integrated and tested.
      Signed-off-by: NVince Bridgers <vbridgers2013@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d91e5c02
    • V
      Altera TSE: Fix sparse errors and warnings · 89830580
      Vince Bridgers 提交于
      This patch fixes the many sparse errors and warnings contained in the
      initial submission of the Altera Triple Speed Ethernet driver, and a
      few minor cppcheck warnings. Changes are tested on ARM and NIOS2
      example designs, and compile tested against multiple architectures.
      Typical issues addressed were as follows:
      
      altera_tse_ethtool.c:136:19: warning: incorrect type in argument
          1 (different address spaces)
      altera_tse_ethtool.c:136:19:    expected void const volatile
          [noderef] <asn:2>*addr
      altera_tse_ethtool.c:136:19:    got unsigned int *<noident>
      ...
      altera_sgdma.c:129:31: warning: cast removes address space of
          expression
      Signed-off-by: NVince Bridgers <vbridgers2013@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      89830580
    • C
      rtnetlink: wait for unregistering devices in rtnl_link_unregister() · 200b916f
      Cong Wang 提交于
      From: Cong Wang <cwang@twopensource.com>
      
      commit 50624c93 (net: Delay default_device_exit_batch until no
      devices are unregistering) introduced rtnl_lock_unregistering() for
      default_device_exit_batch(). Same race could happen we when rmmod a driver
      which calls rtnl_link_unregister() as we call dev->destructor without rtnl
      lock.
      
      For long term, I think we should clean up the mess of netdev_run_todo()
      and net namespce exit code.
      
      Cc: Eric W. Biederman <ebiederm@xmission.com>
      Cc: David S. Miller <davem@davemloft.net>
      Signed-off-by: NCong Wang <xiyou.wangcong@gmail.com>
      Signed-off-by: NCong Wang <cwang@twopensource.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      200b916f
  2. 15 5月, 2014 4 次提交
    • H
      net: filter: s390: fix JIT address randomization · e84d2f8d
      Heiko Carstens 提交于
      This is the s390 variant of Alexei's JIT bug fix.
      (patch description below stolen from Alexei's patch)
      
      bpf_alloc_binary() adds 128 bytes of room to JITed program image
      and rounds it up to the nearest page size. If image size is close
      to page size (like 4000), it is rounded to two pages:
      round_up(4000 + 4 + 128) == 8192
      then 'hole' is computed as 8192 - (4000 + 4) = 4188
      If prandom_u32() % hole selects a number >= PAGE_SIZE - sizeof(*header)
      then kernel will crash during bpf_jit_free():
      
      kernel BUG at arch/x86/mm/pageattr.c:887!
      Call Trace:
       [<ffffffff81037285>] change_page_attr_set_clr+0x135/0x460
       [<ffffffff81694cc0>] ? _raw_spin_unlock_irq+0x30/0x50
       [<ffffffff810378ff>] set_memory_rw+0x2f/0x40
       [<ffffffffa01a0d8d>] bpf_jit_free_deferred+0x2d/0x60
       [<ffffffff8106bf98>] process_one_work+0x1d8/0x6a0
       [<ffffffff8106bf38>] ? process_one_work+0x178/0x6a0
       [<ffffffff8106c90c>] worker_thread+0x11c/0x370
      
      since bpf_jit_free() does:
        unsigned long addr = (unsigned long)fp->bpf_func & PAGE_MASK;
        struct bpf_binary_header *header = (void *)addr;
      to compute start address of 'bpf_binary_header'
      and header->pages will pass junk to:
        set_memory_rw(addr, header->pages);
      
      Fix it by making sure that &header->image[prandom_u32() % hole] and &header
      are in the same page.
      
      Fixes: aa2d2c73 ("s390/bpf,jit: address randomize and write protect jit code")
      Reported-by: NAlexei Starovoitov <ast@plumgrid.com>
      Cc: <stable@vger.kernel.org> # v3.11+
      Signed-off-by: NHeiko Carstens <heiko.carstens@de.ibm.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      e84d2f8d
    • U
      af_iucv: wrong mapping of sent and confirmed skbs · f5738e2e
      Ursula Braun 提交于
      When sending data through IUCV a MESSAGE COMPLETE interrupt
      signals that sent data memory can be freed or reused again.
      With commit f9c41a62
      "af_iucv: fix recvmsg by replacing skb_pull() function" the
      MESSAGE COMPLETE callback iucv_callback_txdone() identifies
      the wrong skb as being confirmed, which leads to data corruption.
      This patch fixes the skb mapping logic in iucv_callback_txdone().
      Signed-off-by: NUrsula Braun <ursula.braun@de.ibm.com>
      Signed-off-by: NFrank Blaschka <frank.blaschka@de.ibm.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      f5738e2e
    • K
      be2net: enable interrupts in EEH resume · 03a58baa
      Kalesh AP 提交于
      On some BE3 FW versions, after a HW reset, interrupts will remain disabled
      for each function. So, explicitly enable the interrupts in the eeh_resume
      handler, else after an eeh recovery interrupts wouldn't work.
      Signed-off-by: NKalesh AP <kalesh.purayil@emulex.com>
      Signed-off-by: NSathya Perla <sathya.perla@emulex.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      03a58baa
    • N
      jme: Fix unmap loop counting error: · c4b16068
      Neil Horman 提交于
      In my recent fix (76a691d0: fix dma unmap warning), Ben Hutchings noted that my
      loop count was incorrect.  Where j started at startidx, it should have started
      at zero, and gone on for count entries, not to endidx.  Additionally, a DMA
      resource exhaustion should drop the frame and (for now), return
      NETDEV_TX_OK, not NETEV_TX_BUSY.  This patch fixes both of those issues:
      Signed-off-by: NNeil Horman <nhorman@tuxdriver.com>
      CC: Ben Hutchings <ben@decadent.org.uk>
      CC: "David S. Miller" <davem@davemloft.net>
      CC: Guo-Fu Tseng <cooldavid@cooldavid.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c4b16068
  3. 14 5月, 2014 5 次提交
    • H
      ipv6: fix calculation of option len in ip6_append_data · 3a1cebe7
      Hannes Frederic Sowa 提交于
      tot_len does specify the size of struct ipv6_txoptions. We need opt_flen +
      opt_nflen to calculate the overall length of additional ipv6 extensions.
      
      I found this while auditing the ipv6 output path for a memory corruption
      reported by Alexey Preobrazhensky while he fuzzed an instrumented
      AddressSanitizer kernel with trinity. This may or may not be the cause
      of the original bug.
      
      Fixes: 4df98e76 ("ipv6: pmtudisc setting not respected with UFO/CORK")
      Reported-by: NAlexey Preobrazhensky <preobr@google.com>
      Signed-off-by: NHannes Frederic Sowa <hannes@stressinduktion.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      3a1cebe7
    • H
      net: avoid dependency of net_get_random_once on nop patching · 3d440522
      Hannes Frederic Sowa 提交于
      net_get_random_once depends on the static keys infrastructure to patch up
      the branch to the slow path during boot. This was realized by abusing the
      static keys api and defining a new initializer to not enable the call
      site while still indicating that the branch point should get patched
      up. This was needed to have the fast path considered likely by gcc.
      
      The static key initialization during boot up normally walks through all
      the registered keys and either patches in ideal nops or enables the jump
      site but omitted that step on x86 if ideal nops where already placed at
      static_key branch points. Thus net_get_random_once branches not always
      became active.
      
      This patch switches net_get_random_once to the ordinary static_key
      api and thus places the kernel fast path in the - by gcc considered -
      unlikely path.  Microbenchmarks on Intel and AMD x86-64 showed that
      the unlikely path actually beats the likely path in terms of cycle cost
      and that different nop patterns did not make much difference, thus this
      switch should not be noticeable.
      
      Fixes: a48e4292 ("net: introduce new macro net_get_random_once")
      Reported-by: NTuomas Räsänen <tuomasjjrasanen@tjjr.fi>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NHannes Frederic Sowa <hannes@stressinduktion.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      3d440522
    • A
      net: filter: x86: fix JIT address randomization · 773cd38f
      Alexei Starovoitov 提交于
      bpf_alloc_binary() adds 128 bytes of room to JITed program image
      and rounds it up to the nearest page size. If image size is close
      to page size (like 4000), it is rounded to two pages:
      round_up(4000 + 4 + 128) == 8192
      then 'hole' is computed as 8192 - (4000 + 4) = 4188
      If prandom_u32() % hole selects a number >= PAGE_SIZE - sizeof(*header)
      then kernel will crash during bpf_jit_free():
      
      kernel BUG at arch/x86/mm/pageattr.c:887!
      Call Trace:
       [<ffffffff81037285>] change_page_attr_set_clr+0x135/0x460
       [<ffffffff81694cc0>] ? _raw_spin_unlock_irq+0x30/0x50
       [<ffffffff810378ff>] set_memory_rw+0x2f/0x40
       [<ffffffffa01a0d8d>] bpf_jit_free_deferred+0x2d/0x60
       [<ffffffff8106bf98>] process_one_work+0x1d8/0x6a0
       [<ffffffff8106bf38>] ? process_one_work+0x178/0x6a0
       [<ffffffff8106c90c>] worker_thread+0x11c/0x370
      
      since bpf_jit_free() does:
        unsigned long addr = (unsigned long)fp->bpf_func & PAGE_MASK;
        struct bpf_binary_header *header = (void *)addr;
      to compute start address of 'bpf_binary_header'
      and header->pages will pass junk to:
        set_memory_rw(addr, header->pages);
      
      Fix it by making sure that &header->image[prandom_u32() % hole] and &header
      are in the same page
      
      Fixes: 314beb9b ("x86: bpf_jit_comp: secure bpf jit against spraying attacks")
      Signed-off-by: NAlexei Starovoitov <ast@plumgrid.com>
      Acked-by: NEric Dumazet <edumazet@google.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      773cd38f
    • D
      Merge tag 'batman-adv-fix-for-davem' of git://git.open-mesh.org/linux-merge · 6262971a
      David S. Miller 提交于
      Included changes:
      - properly release neigh_ifinfo in batadv_iv_ogm_process_per_outif()
      - properly release orig_ifinfo->router when freeing orig_ifinfo
      - properly release neigh_node objects during periodic check
      - properly release neigh_info objects when the related hard_iface
        is free'd
      
      These changes are all very important because they fix some
      reference counting imbalances that lead to the
      impossibility of releasing the netdev object used by
      batman-adv on shutdown.
      The consequence is that such object cannot be destroyed by
      the networking stack (the refcounter does not reach zero)
      thus bringing the system in hanging state during a normal
      reboot operation or a network reconfiguration.
      6262971a
    • D
      neigh: set nud_state to NUD_INCOMPLETE when probing router reachability · 2176d5d4
      Duan Jiong 提交于
      Since commit 7e980569("ipv6: router reachability probing"), a router falls
      into NUD_FAILED will be probed.
      
      Now if function rt6_select() selects a router which neighbour state is NUD_FAILED,
      and at the same time function rt6_probe() changes the neighbour state to NUD_PROBE,
      then function dst_neigh_output() can directly send packets, but actually the
      neighbour still is unreachable. If we set nud_state to NUD_INCOMPLETE instead
      NUD_PROBE, packets will not be sent out until the neihbour is reachable.
      
      In addition, because the route should be probes with a single NS, so we must
      set neigh->probes to neigh_max_probes(), then the neigh timer timeout and function
      neigh_timer_handler() will not send other NS Messages.
      Signed-off-by: NDuan Jiong <duanj.fnst@cn.fujitsu.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      2176d5d4
  4. 13 5月, 2014 3 次提交
  5. 12 5月, 2014 3 次提交
  6. 11 5月, 2014 1 次提交
  7. 10 5月, 2014 14 次提交
  8. 09 5月, 2014 2 次提交