20 Jan, 2017

1 commit

  • commit dc5367bcc556e97555fc94a32cd1aadbebdff47e upstream.

    With commit e53743994e21
    ("af_iucv: use paged SKBs for big outbound messages"),
    we transmit paged skbs for both of AF_IUCV's transport modes
    (IUCV or HiperSockets).
    The qeth driver for Layer 3 HiperSockets currently doesn't
    support NETIF_F_SG, so these skbs would just be linearized again
    by the stack.
    Avoid that overhead by using paged skbs only for IUCV transport.

    cc stable, since this also circumvents a significant skb leak when
    sending large messages (where the skb then needs to be linearized).

    Signed-off-by: Julian Wiedmann
    Signed-off-by: Ursula Braun
    Fixes: e53743994e21 ("af_iucv: use paged SKBs for big outbound messages")
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Julian Wiedmann
     

30 Jul, 2016

1 commit

  • Pull security subsystem updates from James Morris:
    "Highlights:

    - TPM core and driver updates/fixes
    - IPv6 security labeling (CALIPSO)
    - Lots of Apparmor fixes
    - Seccomp: remove 2-phase API, close hole where ptrace can change
    syscall #"

    * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security: (156 commits)
    apparmor: fix SECURITY_APPARMOR_HASH_DEFAULT parameter handling
    tpm: Add TPM 2.0 support to the Nuvoton i2c driver (NPCT6xx family)
    tpm: Factor out common startup code
    tpm: use devm_add_action_or_reset
    tpm2_i2c_nuvoton: add irq validity check
    tpm: read burstcount from TPM_STS in one 32-bit transaction
    tpm: fix byte-order for the value read by tpm2_get_tpm_pt
    tpm_tis_core: convert max timeouts from msec to jiffies
    apparmor: fix arg_size computation for when setprocattr is null terminated
    apparmor: fix oops, validate buffer size in apparmor_setprocattr()
    apparmor: do not expose kernel stack
    apparmor: fix module parameters can be changed after policy is locked
    apparmor: fix oops in profile_unpack() when policy_db is not present
    apparmor: don't check for vmalloc_addr if kvzalloc() failed
    apparmor: add missing id bounds check on dfa verification
    apparmor: allow SYS_CAP_RESOURCE to be sufficient to prlimit another task
    apparmor: use list_next_entry instead of list_entry_next
    apparmor: fix refcount race when finding a child profile
    apparmor: fix ref count leak when profile sha1 hash is read
    apparmor: check that xindex is in trans_table bounds
    ...

    Linus Torvalds
     

16 Jun, 2016

3 commits


07 Jun, 2016

1 commit


20 Jan, 2016

1 commit


15 Dec, 2015

2 commits

  • When the linear buffer of the received sk_buff is shorter than
    the header, use skb_linearize(). sk_buffs with short linear buffer
    happen on the sending side under high traffic, and some kernel
    configurations, when allocated buffer starts just before page
    boundary, and IUCV transport has to send it as two separate QDIO
    buffer elements, with fist element shorter than the header.

    Signed-off-by: Eugene Crosser
    Signed-off-by: Ursula Braun
    Signed-off-by: David S. Miller

    Eugene Crosser
     
  • Initialize storage for the future IUCV header that will be included
    in the transmitted packet. Some of the header fields are unused with
    HiperSockets transport, and will contain data left from some other
    functions.

    Signed-off-by: Eugene Crosser
    Signed-off-by: Ursula Braun
    Reviewed-by: Thomas Richter
    Signed-off-by: David S. Miller

    Eugene Crosser
     

04 Dec, 2015

1 commit


02 Dec, 2015

1 commit

  • This patch is a cleanup to make following patch easier to
    review.

    Goal is to move SOCK_ASYNC_NOSPACE and SOCK_ASYNC_WAITDATA
    from (struct socket)->flags to a (struct socket_wq)->flags
    to benefit from RCU protection in sock_wake_async()

    To ease backports, we rename both constants.

    Two new helpers, sk_set_bit(int nr, struct sock *sk)
    and sk_clear_bit(int net, struct sock *sk) are added so that
    following patch can change their implementation.

    Signed-off-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Eric Dumazet
     

01 Dec, 2015

1 commit

  • The memory barrier in the helper wq_has_sleeper is needed by just
    about every user of waitqueue_active. This patch generalises it
    by making it take a wait_queue_head_t directly. The existing
    helper is renamed to skwq_has_sleeper.

    Signed-off-by: Herbert Xu
    Signed-off-by: David S. Miller

    Herbert Xu
     

22 Sep, 2015

1 commit

  • The iucv code uses arrays as arguments. Even though this does not
    really cause a problem, it could be misleading, since the compiler
    turns array arguments into just a pointer argument. To be more
    precise this patch changes the array arguments into pointers.

    Signed-off-by: Ursula Braun
    Signed-off-by: David S. Miller

    Ursula Braun
     

11 May, 2015

1 commit


03 Apr, 2015

1 commit

  • Conflicts:
    drivers/net/usb/asix_common.c
    drivers/net/usb/sr9800.c
    drivers/net/usb/usbnet.c
    include/linux/usb/usbnet.h
    net/ipv4/tcp_ipv4.c
    net/ipv6/tcp_ipv6.c

    The TCP conflicts were overlapping changes. In 'net' we added a
    READ_ONCE() to the socket cached RX route read, whilst in 'net-next'
    Eric Dumazet touched the surrounding code dealing with how mini
    sockets are handled.

    With USB, it's a case of the same bug fix first going into net-next
    and then I cherry picked it back into net.

    Signed-off-by: David S. Miller

    David S. Miller
     

01 Apr, 2015

1 commit

  • When sending over AF_IUCV socket, errno was incorrectly set to
    ENOMEM even when other values where appropriate, notably EAGAIN.
    With this patch, error indicator returned by sock_alloc_send_skb()
    is passed to the caller, rather than being overwritten with ENOMEM.

    Signed-off-by: Eugene Crosser
    Signed-off-by: Ursula Braun
    Signed-off-by: David S. Miller

    Eugene Crosser
     

03 Mar, 2015

1 commit

  • After TIPC doesn't depend on iocb argument in its internal
    implementations of sendmsg() and recvmsg() hooks defined in proto
    structure, no any user is using iocb argument in them at all now.
    Then we can drop the redundant iocb argument completely from kinds of
    implementations of both sendmsg() and recvmsg() in the entire
    networking stack.

    Cc: Christoph Hellwig
    Suggested-by: Al Viro
    Signed-off-by: Ying Xue
    Signed-off-by: David S. Miller

    Ying Xue
     

11 Dec, 2014

1 commit


24 Nov, 2014

1 commit


06 Nov, 2014

1 commit

  • This encapsulates all of the skb_copy_datagram_iovec() callers
    with call argument signature "skb, offset, msghdr->msg_iov, length".

    When we move to iov_iters in the networking, the iov_iter object will
    sit in the msghdr.

    Having a helper like this means there will be less places to touch
    during that transformation.

    Based upon descriptions and patch from Al Viro.

    Signed-off-by: David S. Miller

    David S. Miller
     

22 Jul, 2014

1 commit

  • An af_iucv stress test showed -EPIPE results for sendmsg()
    calls. They are caused by quiescing a path even though it has
    been already severed by peer. For IUCV transport shutdown()
    consists of 2 steps:
    (1) sending the shutdown message to peer
    (2) quiescing the iucv path
    If the iucv path between these 2 steps is severed due to peer
    closing the path, the quiesce step is no longer needed.

    Signed-off-by: Ursula Braun
    Signed-off-by: Frank Blaschka
    Reported-by: Philipp Hachtmann
    Signed-off-by: David S. Miller

    Ursula Braun
     

16 Jul, 2014

1 commit


31 May, 2014

2 commits

  • In case of transport HIPER a sock struct is allocated for an incoming
    connect request. If the backlog queue is full this socket is not
    needed, but is left in the list of af_iucv sockets. Final socket
    release posts console message "Attempt to release alive iucv socket".
    This patch makes sure the new created socket is cleaned up correctly
    if the backlog queue is full.

    Signed-off-by: Ursula Braun
    Signed-off-by: Frank Blaschka
    Reported-by: Philipp Hachtmann
    Signed-off-by: David S. Miller

    Ursula Braun
     
  • If a socket is bound to an address using before calling connect
    it is usual to leave it to the network system to choose an appropriate
    outgoing application name respective port address.
    af_iucv on VM uses a counter and uses simple numbers as unique identifiers.
    This behaviour was missing when af_iucv is used with HiperSockets.

    This patch contains a simple approach to harmonize af_iucv's behaviour.

    Signed-off-by: Philipp Hachtmann
    Signed-off-by: Frank Blaschka
    Signed-off-by: David S. Miller

    Philipp Hachtmann
     

15 May, 2014

1 commit

  • When sending data through IUCV a MESSAGE COMPLETE interrupt
    signals that sent data memory can be freed or reused again.
    With commit f9c41a62bba3f3f7ef3541b2a025e3371bcbba97
    "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: Ursula Braun
    Signed-off-by: Frank Blaschka
    Cc:
    Signed-off-by: David S. Miller

    Ursula Braun
     

12 Apr, 2014

1 commit

  • Several spots in the kernel perform a sequence like:

    skb_queue_tail(&sk->s_receive_queue, skb);
    sk->sk_data_ready(sk, skb->len);

    But at the moment we place the SKB onto the socket receive queue it
    can be consumed and freed up. So this skb->len access is potentially
    to freed up memory.

    Furthermore, the skb->len can be modified by the consumer so it is
    possible that the value isn't accurate.

    And finally, no actual implementation of this callback actually uses
    the length argument. And since nobody actually cared about it's
    value, lots of call sites pass arbitrary values in such as '0' and
    even '1'.

    So just remove the length argument from the callback, that way there
    is no confusion whatsoever and all of these use-after-free cases get
    fixed as a side effect.

    Based upon a patch by Eric Dumazet and his suggestion to audit this
    issue tree-wide.

    Signed-off-by: David S. Miller

    David S. Miller
     

20 Mar, 2014

1 commit

  • Commit f9c41a62bba3f3f7ef3541b2a025e3371bcbba97 introduced
    a problem for SOCK_STREAM sockets, when only part of the
    incoming iucv message is received by user space. In this
    case the remaining data of the iucv message is lost.
    This patch makes sure an incompletely received iucv message
    is queued back to the receive queue.

    Signed-off-by: Ursula Braun
    Signed-off-by: Frank Blaschka
    Reported-by: Hendrik Brueckner
    Signed-off-by: David S. Miller

    Ursula Braun
     

21 Nov, 2013

1 commit


29 May, 2013

1 commit

  • So far, only net_device * could be passed along with netdevice notifier
    event. This patch provides a possibility to pass custom structure
    able to provide info that event listener needs to know.

    Signed-off-by: Jiri Pirko

    v2->v3: fix typo on simeth
    shortened dev_getter
    shortened notifier_info struct name
    v1->v2: fix notifier_call parameter in call_netdevice_notifier()
    Signed-off-by: David S. Miller

    Jiri Pirko
     

23 Apr, 2013

1 commit

  • Conflicts:
    drivers/net/ethernet/emulex/benet/be_main.c
    drivers/net/ethernet/intel/igb/igb_main.c
    drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
    include/net/scm.h
    net/batman-adv/routing.c
    net/ipv4/tcp_input.c

    The e{uid,gid} --> {uid,gid} credentials fix conflicted with the
    cleanup in net-next to now pass cred structs around.

    The be2net driver had a bug fix in 'net' that overlapped with the VLAN
    interface changes by Patrick McHardy in net-next.

    An IGB conflict existed because in 'net' the build_skb() support was
    reverted, and in 'net-next' there was a comment style fix within that
    code.

    Several batman-adv conflicts were resolved by making sure that all
    calls to batadv_is_my_mac() are changed to have a new bat_priv first
    argument.

    Eric Dumazet's TS ECR fix in TCP in 'net' conflicted with the F-RTO
    rewrite in 'net-next', mostly overlapping changes.

    Thanks to Stephen Rothwell and Antonio Quartulli for help with several
    of these merge resolutions.

    Signed-off-by: David S. Miller

    David S. Miller
     

09 Apr, 2013

1 commit

  • When receiving data messages, the "BUG_ON(skb->len < skb->data_len)" in
    the skb_pull() function triggers a kernel panic.

    Replace the skb_pull logic by a per skb offset as advised by
    Eric Dumazet.

    Signed-off-by: Ursula Braun
    Signed-off-by: Frank Blaschka
    Reviewed-by: Hendrik Brueckner
    Acked-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Ursula Braun
     

08 Apr, 2013

2 commits

  • Conflicts:
    drivers/nfc/microread/mei.c
    net/netfilter/nfnetlink_queue_core.c

    Pull in 'net' to get Eric Biederman's AF_UNIX fix, upon which
    some cleanups are going to go on-top.

    Signed-off-by: David S. Miller

    David S. Miller
     
  • The current code does not fill the msg_name member in case it is set.
    It also does not set the msg_namelen member to 0 and therefore makes
    net/socket.c leak the local, uninitialized sockaddr_storage variable
    to userland -- 128 bytes of kernel stack memory.

    Fix that by simply setting msg_namelen to 0 as obviously nobody cared
    about iucv_sock_recvmsg() not filling the msg_name in case it was set.

    Cc: Ursula Braun
    Signed-off-by: Mathias Krause
    Signed-off-by: David S. Miller

    Mathias Krause
     

03 Apr, 2013

1 commit

  • Commit 7d4c04fc170087119727119074e72445f2bb192b ("net: add option to enable
    error queue packets waking select") has an issue due to operator precedence
    causing the bit-wise OR to bind to the sock_flags call instead of the result of
    the terniary conditional. This fixes the *_poll functions to work properly. The
    old code results in "mask |= POLLPRI" instead of what was intended, which is to
    only include POLLPRI when the socket option is enabled.

    Signed-off-by: Jacob Keller
    Signed-off-by: David S. Miller

    Jacob Keller
     

01 Apr, 2013

1 commit

  • Currently, when a socket receives something on the error queue it only wakes up
    the socket on select if it is in the "read" list, that is the socket has
    something to read. It is useful also to wake the socket if it is in the error
    list, which would enable software to wait on error queue packets without waking
    up for regular data on the socket. The main use case is for receiving
    timestamped transmit packets which return the timestamp to the socket via the
    error queue. This enables an application to select on the socket for the error
    queue only instead of for the regular traffic.

    -v2-
    * Added the SO_SELECT_ERR_QUEUE socket option to every architechture specific file
    * Modified every socket poll function that checks error queue

    Signed-off-by: Jacob Keller
    Cc: Jeffrey Kirsher
    Cc: Richard Cochran
    Cc: Matthew Vick
    Signed-off-by: David S. Miller

    Keller, Jacob E
     

28 Feb, 2013

1 commit

  • I'm not sure why, but the hlist for each entry iterators were conceived

    list_for_each_entry(pos, head, member)

    The hlist ones were greedy and wanted an extra parameter:

    hlist_for_each_entry(tpos, pos, head, member)

    Why did they need an extra pos parameter? I'm not quite sure. Not only
    they don't really need it, it also prevents the iterator from looking
    exactly like the list iterator, which is unfortunate.

    Besides the semantic patch, there was some manual work required:

    - Fix up the actual hlist iterators in linux/list.h
    - Fix up the declaration of other iterators based on the hlist ones.
    - A very small amount of places were using the 'node' parameter, this
    was modified to use 'obj->member' instead.
    - Coccinelle didn't handle the hlist_for_each_entry_safe iterator
    properly, so those had to be fixed up manually.

    The semantic patch which is mostly the work of Peter Senna Tschudin is here:

    @@
    iterator name hlist_for_each_entry, hlist_for_each_entry_continue, hlist_for_each_entry_from, hlist_for_each_entry_rcu, hlist_for_each_entry_rcu_bh, hlist_for_each_entry_continue_rcu_bh, for_each_busy_worker, ax25_uid_for_each, ax25_for_each, inet_bind_bucket_for_each, sctp_for_each_hentry, sk_for_each, sk_for_each_rcu, sk_for_each_from, sk_for_each_safe, sk_for_each_bound, hlist_for_each_entry_safe, hlist_for_each_entry_continue_rcu, nr_neigh_for_each, nr_neigh_for_each_safe, nr_node_for_each, nr_node_for_each_safe, for_each_gfn_indirect_valid_sp, for_each_gfn_sp, for_each_host;

    type T;
    expression a,c,d,e;
    identifier b;
    statement S;
    @@

    -T b;

    [akpm@linux-foundation.org: drop bogus change from net/ipv4/raw.c]
    [akpm@linux-foundation.org: drop bogus hunk from net/ipv6/raw.c]
    [akpm@linux-foundation.org: checkpatch fixes]
    [akpm@linux-foundation.org: fix warnings]
    [akpm@linux-foudnation.org: redo intrusive kvm changes]
    Tested-by: Peter Senna Tschudin
    Acked-by: Paul E. McKenney
    Signed-off-by: Sasha Levin
    Cc: Wu Fengguang
    Cc: Marcelo Tosatti
    Cc: Gleb Natapov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Sasha Levin
     

16 Jun, 2012

1 commit

  • Orphaning skb in dev_hard_start_xmit() makes bonding behavior
    unfriendly for applications sending big UDP bursts : Once packets
    pass the bonding device and come to real device, they might hit a full
    qdisc and be dropped. Without orphaning, the sender is automatically
    throttled because sk->sk_wmemalloc reaches sk->sk_sndbuf (assuming
    sk_sndbuf is not too big)

    We could try to defer the orphaning adding another test in
    dev_hard_start_xmit(), but all this seems of little gain,
    now that BQL tends to make packets more likely to be parked
    in Qdisc queues instead of NIC TX ring, in cases where performance
    matters.

    Reverts commits :
    fc6055a5ba31 net: Introduce skb_orphan_try()
    87fd308cfc6b net: skb_tx_hash() fix relative to skb_orphan_try()
    and removes SKBTX_DRV_NEEDS_SK_REF flag

    Reported-and-bisected-by: Jean-Michel Hautbois
    Signed-off-by: Eric Dumazet
    Tested-by: Oliver Hartkopp
    Acked-by: Oliver Hartkopp
    Signed-off-by: David S. Miller

    Eric Dumazet
     

08 Mar, 2012

2 commits

  • AF_IUCV sockets offer a shutdown function. This patch makes sure
    shutdown works for HS transport as well.

    Signed-off-by: Ursula Braun
    Signed-off-by: Frank Blaschka
    Signed-off-by: David S. Miller

    Ursula Braun
     
  • In case of transport through HiperSockets the underlying network
    interface may switch to DOWN state or the underlying network device
    may recover. In both cases the socket must change to IUCV_DISCONN
    state. If the interface goes down, af_iucv has a chance to notify
    its connection peer in addition.

    Signed-off-by: Ursula Braun
    Signed-off-by: Frank Blaschka
    Signed-off-by: David S. Miller

    Ursula Braun
     

09 Feb, 2012

1 commit

  • For HS transport the maximum message size depends on the MTU-size
    of the HS-device bound to the AF_IUCV socket. This patch adds a
    getsockopt option MSGSIZE returning the maximum message size that
    can be handled for this AF_IUCV socket.

    Signed-off-by: Ursula Braun
    Signed-off-by: Frank Blaschka
    Signed-off-by: David S. Miller

    Ursula Braun