Skip to content
  1. Jul 28, 2012
    • Jiri Kosina's avatar
      tcp: perform DMA to userspace only if there is a task waiting for it · 59ea33a6
      Jiri Kosina authored
      Back in 2006, commit 1a2449a8
      
       ("[I/OAT]: TCP recv offload to I/OAT")
      added support for receive offloading to IOAT dma engine if available.
      
      The code in tcp_rcv_established() tries to perform early DMA copy if
      applicable. It however does so without checking whether the userspace
      task is actually expecting the data in the buffer.
      
      This is not a problem under normal circumstances, but there is a corner
      case where this doesn't work -- and that's when MSG_TRUNC flag to
      recvmsg() is used.
      
      If the IOAT dma engine is not used, the code properly checks whether
      there is a valid ucopy.task and the socket is owned by userspace, but
      misses the check in the dmaengine case.
      
      This problem can be observed in real trivially -- for example 'tbench' is a
      good reproducer, as it makes a heavy use of MSG_TRUNC. On systems utilizing
      IOAT, you will soon find tbench waiting indefinitely in sk_wait_data(), as they
      have been already early-copied in tcp_rcv_established() using dma engine.
      
      This patch introduces the same check we are performing in the simple
      iovec copy case to the IOAT case as well. It fixes the indefinite
      recvmsg(MSG_TRUNC) hangs.
      
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      59ea33a6
    • Jesse Gross's avatar
      Revert "openvswitch: potential NULL deref in sample()" · 60810307
      Jesse Gross authored
      This reverts commit 5b3e7e6c
      
      .
      
      The problem that the original commit was attempting to fix can
      never happen in practice because validation is done one a per-flow
      basis rather than a per-packet basis.  Adding additional checks at
      runtime is unnecessary and inconsistent with the rest of the code.
      
      CC: Dan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: default avatarJesse Gross <jesse@nicira.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      60810307
    • Eric Dumazet's avatar
      ipv4: fix TCP early demux · 505fbcf0
      Eric Dumazet authored
      commit 92101b3b
      
       (ipv4: Prepare for change of rt->rt_iif encoding.)
      invalidated TCP early demux, because rx_dst_ifindex is not properly
      initialized and checked.
      
      Also remove the use of inet_iif(skb) in favor or skb->skb_iif
      
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      505fbcf0
    • Jiri Benc's avatar
      net: fix rtnetlink IFF_PROMISC and IFF_ALLMULTI handling · b1beb681
      Jiri Benc authored
      
      
      When device flags are set using rtnetlink, IFF_PROMISC and IFF_ALLMULTI
      flags are handled specially. Function dev_change_flags sets IFF_PROMISC and
      IFF_ALLMULTI bits in dev->gflags according to the passed value but
      do_setlink passes a result of rtnl_dev_combine_flags which takes those bits
      from dev->flags.
      
      This can be easily trigerred by doing:
      
      tcpdump -i eth0 &
      ip l s up eth0
      
      ip sets IFF_UP flag in ifi_flags and ifi_change, which is combined with
      IFF_PROMISC by rtnl_dev_combine_flags, causing __dev_change_flags to set
      IFF_PROMISC in gflags.
      
      Reported-by: default avatarMax Matveev <makc@redhat.com>
      Signed-off-by: default avatarJiri Benc <jbenc@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b1beb681
    • Dan Carpenter's avatar
      USB: kaweth.c: use GFP_ATOMIC under spin_lock · e4c7f259
      Dan Carpenter authored
      
      
      The problem is that we call this with a spin lock held.  The call tree
      is:
      	kaweth_start_xmit() holds kaweth->device_lock.
      	-> kaweth_async_set_rx_mode()
      	   -> kaweth_control()
      	      -> kaweth_internal_control_msg()
      
      The kaweth_internal_control_msg() function is only called from
      kaweth_control() which used GFP_ATOMIC for its allocations.
      
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e4c7f259
    • Hangbin Liu's avatar
      tcp: Add TCP_USER_TIMEOUT negative value check · 42493570
      Hangbin Liu authored
      TCP_USER_TIMEOUT is a TCP level socket option that takes an unsigned int. But
      patch "tcp: Add TCP_USER_TIMEOUT socket option"(dca43c75
      
      ) didn't check the negative
      values. If a user assign -1 to it, the socket will set successfully and wait
      for 4294967295 miliseconds. This patch add a negative value check to avoid
      this issue.
      
      Signed-off-by: default avatarHangbin Liu <liuhangbin@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      42493570
  2. Jul 27, 2012