01 Apr, 2018

1 commit

  • [ Upstream commit fa6a91e9b907231d2e38ea5ed89c537b3525df3d ]

    Free memory by calling put_device(), if afiucv_iucv_init is not
    successful.

    Signed-off-by: Arvind Yadav
    Reviewed-by: Cornelia Huck
    Signed-off-by: Ursula Braun
    Signed-off-by: Julian Wiedmann
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Arvind Yadav
     

03 Jul, 2017

1 commit


25 Jun, 2017

2 commits

  • Verify that the caller-provided sockaddr structure is large enough to
    contain the sa_family field, before accessing it in bind() and connect()
    handlers of the AF_IUCV socket. Since neither syscall enforces a minimum
    size of the corresponding memory region, very short sockaddrs (zero or
    one byte long) result in operating on uninitialized memory while
    referencing .sa_family.

    Fixes: 52a82e23b9f2 ("af_iucv: Validate socket address length in iucv_sock_bind()")
    Signed-off-by: Mateusz Jurczyk
    [jwi: removed unneeded null-check for addr]
    Signed-off-by: Julian Wiedmann
    Signed-off-by: David S. Miller

    Mateusz Jurczyk
     
  • Use proper endianness conversion for an skb protocol assignment. Given
    that IUCV is only available on big endian systems (s390), this simply
    avoids an endianness warning reported by sparse.

    Signed-off-by: Hans Wippel
    Reviewed-by: Julian Wiedmann
    Reviewed-by: Ursula Braun
    Signed-off-by: Julian Wiedmann
    Signed-off-by: David S. Miller

    Hans Wippel
     

16 Jun, 2017

1 commit

  • It seems like a historic accident that these return unsigned char *,
    and in many places that means casts are required, more often than not.

    Make these functions return void * and remove all the casts across
    the tree, adding a (u8 *) cast only where the unsigned char pointer
    was used directly, all done with the following spatch:

    @@
    expression SKB, LEN;
    typedef u8;
    identifier fn = { skb_push, __skb_push, skb_push_rcsum };
    @@
    - *(fn(SKB, LEN))
    + *(u8 *)fn(SKB, LEN)

    @@
    expression E, SKB, LEN;
    identifier fn = { skb_push, __skb_push, skb_push_rcsum };
    type T;
    @@
    - E = ((T *)(fn(SKB, LEN)))
    + E = fn(SKB, LEN)

    @@
    expression SKB, LEN;
    identifier fn = { skb_push, __skb_push, skb_push_rcsum };
    @@
    - fn(SKB, LEN)[0]
    + *(u8 *)fn(SKB, LEN)

    Note that the last part there converts from push(...)[0] to the
    more idiomatic *(u8 *)push(...).

    Signed-off-by: Johannes Berg
    Signed-off-by: David S. Miller

    Johannes Berg
     

10 Mar, 2017

1 commit

  • Lockdep issues a circular dependency warning when AFS issues an operation
    through AF_RXRPC from a context in which the VFS/VM holds the mmap_sem.

    The theory lockdep comes up with is as follows:

    (1) If the pagefault handler decides it needs to read pages from AFS, it
    calls AFS with mmap_sem held and AFS begins an AF_RXRPC call, but
    creating a call requires the socket lock:

    mmap_sem must be taken before sk_lock-AF_RXRPC

    (2) afs_open_socket() opens an AF_RXRPC socket and binds it. rxrpc_bind()
    binds the underlying UDP socket whilst holding its socket lock.
    inet_bind() takes its own socket lock:

    sk_lock-AF_RXRPC must be taken before sk_lock-AF_INET

    (3) Reading from a TCP socket into a userspace buffer might cause a fault
    and thus cause the kernel to take the mmap_sem, but the TCP socket is
    locked whilst doing this:

    sk_lock-AF_INET must be taken before mmap_sem

    However, lockdep's theory is wrong in this instance because it deals only
    with lock classes and not individual locks. The AF_INET lock in (2) isn't
    really equivalent to the AF_INET lock in (3) as the former deals with a
    socket entirely internal to the kernel that never sees userspace. This is
    a limitation in the design of lockdep.

    Fix the general case by:

    (1) Double up all the locking keys used in sockets so that one set are
    used if the socket is created by userspace and the other set is used
    if the socket is created by the kernel.

    (2) Store the kern parameter passed to sk_alloc() in a variable in the
    sock struct (sk_kern_sock). This informs sock_lock_init(),
    sock_init_data() and sk_clone_lock() as to the lock keys to be used.

    Note that the child created by sk_clone_lock() inherits the parent's
    kern setting.

    (3) Add a 'kern' parameter to ->accept() that is analogous to the one
    passed in to ->create() that distinguishes whether kernel_accept() or
    sys_accept4() was the caller and can be passed to sk_alloc().

    Note that a lot of accept functions merely dequeue an already
    allocated socket. I haven't touched these as the new socket already
    exists before we get the parameter.

    Note also that there are a couple of places where I've made the accepted
    socket unconditionally kernel-based:

    irda_accept()
    rds_rcp_accept_one()
    tcp_accept_from_sock()

    because they follow a sock_create_kern() and accept off of that.

    Whilst creating this, I noticed that lustre and ocfs don't create sockets
    through sock_create_kern() and thus they aren't marked as for-kernel,
    though they appear to be internal. I wonder if these should do that so
    that they use the new set of lock keys.

    Signed-off-by: David Howells
    Signed-off-by: David S. Miller

    David Howells
     

02 Mar, 2017

1 commit


11 Jan, 2017

1 commit

  • 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
    Cc: # v4.8+
    Fixes: e53743994e21 ("af_iucv: use paged SKBs for big outbound messages")
    Signed-off-by: David S. Miller

    Julian Wiedmann
     

13 Dec, 2016

1 commit

  • Pull smp hotplug updates from Thomas Gleixner:
    "This is the final round of converting the notifier mess to the state
    machine. The removal of the notifiers and the related infrastructure
    will happen around rc1, as there are conversions outstanding in other
    trees.

    The whole exercise removed about 2000 lines of code in total and in
    course of the conversion several dozen bugs got fixed. The new
    mechanism allows to test almost every hotplug step standalone, so
    usage sites can exercise all transitions extensively.

    There is more room for improvement, like integrating all the
    pointlessly different architecture mechanisms of synchronizing,
    setting cpus online etc into the core code"

    * 'smp-hotplug-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (60 commits)
    tracing/rb: Init the CPU mask on allocation
    soc/fsl/qbman: Convert to hotplug state machine
    soc/fsl/qbman: Convert to hotplug state machine
    zram: Convert to hotplug state machine
    KVM/PPC/Book3S HV: Convert to hotplug state machine
    arm64/cpuinfo: Convert to hotplug state machine
    arm64/cpuinfo: Make hotplug notifier symmetric
    mm/compaction: Convert to hotplug state machine
    iommu/vt-d: Convert to hotplug state machine
    mm/zswap: Convert pool to hotplug state machine
    mm/zswap: Convert dst-mem to hotplug state machine
    mm/zsmalloc: Convert to hotplug state machine
    mm/vmstat: Convert to hotplug state machine
    mm/vmstat: Avoid on each online CPU loops
    mm/vmstat: Drop get_online_cpus() from init_cpu_node_state/vmstat_cpu_dead()
    tracing/rb: Convert to hotplug state machine
    oprofile/nmi timer: Convert to hotplug state machine
    net/iucv: Use explicit clean up labels in iucv_init()
    x86/pci/amd-bus: Convert to hotplug state machine
    x86/oprofile/nmi: Convert to hotplug state machine
    ...

    Linus Torvalds
     

29 Nov, 2016

1 commit

  • Ursula suggested to use explicit labels for clean up in the error path
    instead of one `out_free' label, which handles multiple exits, introduced
    in commit 38b482929e8f ("net/iucv: Convert to hotplug state machine").

    Suggested-by: Ursula Braun
    Signed-off-by: Sebastian Andrzej Siewior
    Cc: linux-s390@vger.kernel.org
    Cc: netdev@vger.kernel.org
    Cc: rt@linutronix.de
    Cc: "David S. Miller"
    Link: http://lkml.kernel.org/r/20161124161013.dukr42y2nwscosk6@linutronix.de
    Signed-off-by: Thomas Gleixner

    Sebastian Andrzej Siewior
     

23 Nov, 2016

1 commit

  • Install the callbacks via the state machine and let the core invoke the
    callbacks on the already online CPUs. The smp function calls in the
    online/downprep callbacks are not required as the callback is guaranteed to
    be invoked on the upcoming/outgoing cpu.

    Signed-off-by: Sebastian Andrzej Siewior
    Cc: "David S. Miller"
    Cc: linux-s390@vger.kernel.org
    Cc: netdev@vger.kernel.org
    Cc: Ursula Braun
    Cc: rt@linuxtronix.de
    Link: http://lkml.kernel.org/r/20161117183541.8588-13-bigeasy@linutronix.de
    Signed-off-by: Thomas Gleixner

    Sebastian Andrzej Siewior
     

12 Oct, 2016

2 commits

  • A packet filter might be installed for instance with setsockopt
    SO_ATTACH_FILTER. af_iucv currently queues skbs rejected by filter
    into the backlog queue. This does not make sense, since packets
    rejected by filter can be dropped immediately. This patch adds
    separate sk_filter return code checking, and dropping of packets
    if applicable.

    Signed-off-by: Ursula Braun
    Reported-by: Daniel Borkmann
    Signed-off-by: David S. Miller

    Ursula Braun
     
  • If a socket program has shut down the socket for sending, it can still
    receive an undetermined number of packets. The AF_IUCV protocol for
    HIPER transport requires sending of a WIN flag from time to time
    from the receiver to the sender, otherwise the peer cannot continue
    sending. That means sending of control flags must still work, even
    though the AF_IUCV socket is shutdown for sending data.
    sock_alloc_send_skb() returns with error EPIPE, if socket sk_shutdown
    is SEND_SHUTDOWN. Thus this patch temporarily removes the send
    shutdown attribute from the socket to enable transfer of control
    flags.

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

    Ursula Braun
     

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
     

28 Jul, 2016

1 commit

  • Pull networking updates from David Miller:

    1) Unified UDP encapsulation offload methods for drivers, from
    Alexander Duyck.

    2) Make DSA binding more sane, from Andrew Lunn.

    3) Support QCA9888 chips in ath10k, from Anilkumar Kolli.

    4) Several workqueue usage cleanups, from Bhaktipriya Shridhar.

    5) Add XDP (eXpress Data Path), essentially running BPF programs on RX
    packets as soon as the device sees them, with the option to mirror
    the packet on TX via the same interface. From Brenden Blanco and
    others.

    6) Allow qdisc/class stats dumps to run lockless, from Eric Dumazet.

    7) Add VLAN support to b53 and bcm_sf2, from Florian Fainelli.

    8) Simplify netlink conntrack entry layout, from Florian Westphal.

    9) Add ipv4 forwarding support to mlxsw spectrum driver, from Ido
    Schimmel, Yotam Gigi, and Jiri Pirko.

    10) Add SKB array infrastructure and convert tun and macvtap over to it.
    From Michael S Tsirkin and Jason Wang.

    11) Support qdisc packet injection in pktgen, from John Fastabend.

    12) Add neighbour monitoring framework to TIPC, from Jon Paul Maloy.

    13) Add NV congestion control support to TCP, from Lawrence Brakmo.

    14) Add GSO support to SCTP, from Marcelo Ricardo Leitner.

    15) Allow GRO and RPS to function on macsec devices, from Paolo Abeni.

    16) Support MPLS over IPV4, from Simon Horman.

    * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (1622 commits)
    xgene: Fix build warning with ACPI disabled.
    be2net: perform temperature query in adapter regardless of its interface state
    l2tp: Correctly return -EBADF from pppol2tp_getname.
    net/mlx5_core/health: Remove deprecated create_singlethread_workqueue
    net: ipmr/ip6mr: update lastuse on entry change
    macsec: ensure rx_sa is set when validation is disabled
    tipc: dump monitor attributes
    tipc: add a function to get the bearer name
    tipc: get monitor threshold for the cluster
    tipc: make cluster size threshold for monitoring configurable
    tipc: introduce constants for tipc address validation
    net: neigh: disallow transition to NUD_STALE if lladdr is unchanged in neigh_update()
    MAINTAINERS: xgene: Add driver and documentation path
    Documentation: dtb: xgene: Add MDIO node
    dtb: xgene: Add MDIO node
    drivers: net: xgene: ethtool: Use phy_ethtool_gset and sset
    drivers: net: xgene: Use exported functions
    drivers: net: xgene: Enable MDIO driver
    drivers: net: xgene: Add backward compatibility
    drivers: net: phy: xgene: Add MDIO driver
    ...

    Linus Torvalds
     

28 Jun, 2016

1 commit


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
     

11 Sep, 2014

1 commit


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