1. 15 May, 2014 2 commits
    • Vince Bridgers's avatar
      Altera TSE: Fix sparse errors and warnings · 89830580
      Vince Bridgers authored
      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: default avatarVince Bridgers <vbridgers2013@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      89830580
    • Cong Wang's avatar
      rtnetlink: wait for unregistering devices in rtnl_link_unregister() · 200b916f
      Cong Wang authored
      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: default avatarCong Wang <xiyou.wangcong@gmail.com>
      Signed-off-by: default avatarCong Wang <cwang@twopensource.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      200b916f
  2. 14 May, 2014 6 commits
    • Heiko Carstens's avatar
      net: filter: s390: fix JIT address randomization · e84d2f8d
      Heiko Carstens authored
      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: default avatarAlexei Starovoitov <ast@plumgrid.com>
      Cc: <stable@vger.kernel.org> # v3.11+
      Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e84d2f8d
    • Ursula Braun's avatar
      af_iucv: wrong mapping of sent and confirmed skbs · f5738e2e
      Ursula Braun authored
      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: default avatarUrsula Braun <ursula.braun@de.ibm.com>
      Signed-off-by: default avatarFrank Blaschka <frank.blaschka@de.ibm.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f5738e2e
    • Kalesh AP's avatar
      be2net: enable interrupts in EEH resume · 03a58baa
      Kalesh AP authored
      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: default avatarKalesh AP <kalesh.purayil@emulex.com>
      Signed-off-by: default avatarSathya Perla <sathya.perla@emulex.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      03a58baa
    • Neil Horman's avatar
      jme: Fix unmap loop counting error: · c4b16068
      Neil Horman authored
      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: default avatarNeil 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: default avatarDavid S. Miller <davem@davemloft.net>
      c4b16068
    • Hannes Frederic Sowa's avatar
      ipv6: fix calculation of option len in ip6_append_data · 3a1cebe7
      Hannes Frederic Sowa authored
      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: default avatarAlexey Preobrazhensky <preobr@google.com>
      Signed-off-by: default avatarHannes Frederic Sowa <hannes@stressinduktion.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3a1cebe7
    • Hannes Frederic Sowa's avatar
      net: avoid dependency of net_get_random_once on nop patching · 3d440522
      Hannes Frederic Sowa authored
      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: default avatarTuomas Räsänen <tuomasjjrasanen@tjjr.fi>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarHannes Frederic Sowa <hannes@stressinduktion.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3d440522
  3. 13 May, 2014 4 commits
    • Alexei Starovoitov's avatar
      net: filter: x86: fix JIT address randomization · 773cd38f
      Alexei Starovoitov authored
      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: default avatarAlexei Starovoitov <ast@plumgrid.com>
      Acked-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      773cd38f
    • David S. Miller's avatar
      Merge tag 'batman-adv-fix-for-davem' of git://git.open-mesh.org/linux-merge · 6262971a
      David S. Miller authored
      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
    • Duan Jiong's avatar
      neigh: set nud_state to NUD_INCOMPLETE when probing router reachability · 2176d5d4
      Duan Jiong authored
      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: default avatarDuan Jiong <duanj.fnst@cn.fujitsu.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2176d5d4
    • Susant Sahani's avatar
      ip6_tunnel: fix potential NULL pointer dereference · c8965932
      Susant Sahani authored
      The function ip6_tnl_validate assumes that the rtnl
      attribute IFLA_IPTUN_PROTO always be filled . If this
      attribute is not filled by  the userspace application
      kernel get crashed with NULL pointer dereference. This
      patch fixes the potential kernel crash when
      IFLA_IPTUN_PROTO is missing .
      Signed-off-by: default avatarSusant Sahani <susant@redhat.com>
      Acked-by: default avatarThomas Graf <tgraf@suug.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c8965932
  4. 12 May, 2014 3 commits
  5. 11 May, 2014 1 commit
  6. 10 May, 2014 3 commits
  7. 09 May, 2014 15 commits
  8. 08 May, 2014 1 commit
  9. 07 May, 2014 5 commits