14 Mar, 2019

2 commits

  • [ Upstream commit 85965487abc540368393a15491e6e7fcd230039d ]

    When the virtio transport device disappear, we should reset all
    connected sockets in order to inform the users.

    Signed-off-by: Stefano Garzarella
    Reviewed-by: Stefan Hajnoczi
    Signed-off-by: David S. Miller
    Signed-off-by: Sasha Levin

    Stefano Garzarella
     
  • [ Upstream commit 22b5c0b63f32568e130fa2df4ba23efce3eb495b ]

    virtio_vsock_remove() invokes the vsock_core_exit() also if there
    are opened sockets for the AF_VSOCK protocol family. In this way
    the vsock "transport" pointer is set to NULL, triggering the
    kernel panic at the first socket activity.

    This patch move the vsock_core_init()/vsock_core_exit() in the
    virtio_vsock respectively in module_init and module_exit functions,
    that cannot be invoked until there are open sockets.

    Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1609699
    Reported-by: Yan Fu
    Signed-off-by: Stefano Garzarella
    Acked-by: Stefan Hajnoczi
    Signed-off-by: David S. Miller
    Signed-off-by: Sasha Levin

    Stefano Garzarella
     

23 Feb, 2019

1 commit

  • [ Upstream commit 225d9464268599a5b4d094d02ec17808e44c7553 ]

    In the unlikely event that the kmalloc call in vmci_transport_socket_init()
    fails, we end-up calling vmci_transport_destruct() with a NULL vmci_trans()
    and oopsing.

    This change addresses the above explicitly checking for zero vmci_trans()
    at destruction time.

    Reported-by: Xiumei Mu
    Fixes: d021c344051a ("VSOCK: Introduce VM Sockets")
    Signed-off-by: Paolo Abeni
    Reviewed-by: Stefano Garzarella
    Reviewed-by: Jorgen Hansen
    Signed-off-by: David S. Miller
    Signed-off-by: Sasha Levin

    Paolo Abeni
     

10 Jan, 2019

1 commit

  • [ Upstream commit a915b982d8f5e4295f64b8dd37ce753874867e88 ]

    If a server side socket is bound to an address, but not in the listening
    state yet, incoming connection requests should receive a reset control
    packet in response. However, the function used to send the reset
    silently drops the reset packet if the sending socket isn't bound
    to a remote address (as is the case for a bound socket not yet in
    the listening state). This change fixes this by using the src
    of the incoming packet as destination for the reset packet in
    this case.

    Fixes: d021c344051a ("VSOCK: Introduce VM Sockets")
    Reviewed-by: Adit Ranadive
    Reviewed-by: Vishnu Dasa
    Signed-off-by: Jorgen Hansen
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Jorgen Hansen
     

08 Aug, 2018

1 commit

  • syzbot reported that we reinitialize an active delayed
    work in vsock_stream_connect():

    ODEBUG: init active (active state 0) object type: timer_list hint:
    delayed_work_timer_fn+0x0/0x90 kernel/workqueue.c:1414
    WARNING: CPU: 1 PID: 11518 at lib/debugobjects.c:329
    debug_print_object+0x16a/0x210 lib/debugobjects.c:326

    The pattern is apparently wrong, we should only initialize
    the dealyed work once and could repeatly schedule it. So we
    have to move out the initializations to allocation side.
    And to avoid confusion, we can split the shared dwork
    into two, instead of re-using the same one.

    Fixes: d021c344051a ("VSOCK: Introduce VM Sockets")
    Reported-by:
    Cc: Andy king
    Cc: Stefan Hajnoczi
    Cc: Jorgen Hansen
    Signed-off-by: Cong Wang
    Signed-off-by: David S. Miller

    Cong Wang
     

29 Jun, 2018

1 commit

  • The poll() changes were not well thought out, and completely
    unexplained. They also caused a huge performance regression, because
    "->poll()" was no longer a trivial file operation that just called down
    to the underlying file operations, but instead did at least two indirect
    calls.

    Indirect calls are sadly slow now with the Spectre mitigation, but the
    performance problem could at least be largely mitigated by changing the
    "->get_poll_head()" operation to just have a per-file-descriptor pointer
    to the poll head instead. That gets rid of one of the new indirections.

    But that doesn't fix the new complexity that is completely unwarranted
    for the regular case. The (undocumented) reason for the poll() changes
    was some alleged AIO poll race fixing, but we don't make the common case
    slower and more complex for some uncommon special case, so this all
    really needs way more explanations and most likely a fundamental
    redesign.

    [ This revert is a revert of about 30 different commits, not reverted
    individually because that would just be unnecessarily messy - Linus ]

    Cc: Al Viro
    Cc: Christoph Hellwig
    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

22 Jun, 2018

1 commit

  • The dst_cid and src_cid are 64 bits, therefore 64 bit accessors should be
    used, and in fact in virtio_transport_common.c only 64 bit accessors are
    used. Using 32 bit accessors for 64 bit values breaks big endian systems.

    This patch fixes a wrong use of le32_to_cpu in virtio_transport_send_pkt.

    Fixes: b9116823189e85ccf384 ("VSOCK: add loopback to virtio_transport")

    Signed-off-by: Claudio Imbrenda
    Reviewed-by: Stefan Hajnoczi
    Signed-off-by: David S. Miller

    Claudio Imbrenda
     

26 May, 2018

1 commit


17 Apr, 2018

1 commit

  • Commit c1eef220c1760762753b602c382127bfccee226d ("vsock: always call
    vsock_init_tables()") introduced a module_init() function without a
    corresponding module_exit() function.

    Modules with an init function can only be removed if they also have an
    exit function. Therefore the vsock module was considered "permanent"
    and could not be removed.

    This patch adds an empty module_exit() function so that "rmmod vsock"
    works. No explicit cleanup is required because:

    1. Transports call vsock_core_exit() upon exit and cannot be removed
    while sockets are still alive.
    2. vsock_diag.ko does not perform any action that requires cleanup by
    vsock.ko.

    Fixes: c1eef220c176 ("vsock: always call vsock_init_tables()")
    Reported-by: Xiumei Mu
    Cc: Cong Wang
    Cc: Jorgen Hansen
    Signed-off-by: Stefan Hajnoczi
    Reviewed-by: Jorgen Hansen
    Signed-off-by: David S. Miller

    Stefan Hajnoczi
     

13 Feb, 2018

1 commit

  • Changes since v1:
    Added changes in these files:
    drivers/infiniband/hw/usnic/usnic_transport.c
    drivers/staging/lustre/lnet/lnet/lib-socket.c
    drivers/target/iscsi/iscsi_target_login.c
    drivers/vhost/net.c
    fs/dlm/lowcomms.c
    fs/ocfs2/cluster/tcp.c
    security/tomoyo/network.c

    Before:
    All these functions either return a negative error indicator,
    or store length of sockaddr into "int *socklen" parameter
    and return zero on success.

    "int *socklen" parameter is awkward. For example, if caller does not
    care, it still needs to provide on-stack storage for the value
    it does not need.

    None of the many FOO_getname() functions of various protocols
    ever used old value of *socklen. They always just overwrite it.

    This change drops this parameter, and makes all these functions, on success,
    return length of sockaddr. It's always >= 0 and can be differentiated
    from an error.

    Tests in callers are changed from "if (err)" to "if (err < 0)", where needed.

    rpc_sockname() lost "int buflen" parameter, since its only use was
    to be passed to kernel_getsockname() as &buflen and subsequently
    not used in any way.

    Userspace API is not changed.

    text data bss dec hex filename
    30108430 2633624 873672 33615726 200ef6e vmlinux.before.o
    30108109 2633612 873672 33615393 200ee21 vmlinux.o

    Signed-off-by: Denys Vlasenko
    CC: David S. Miller
    CC: linux-kernel@vger.kernel.org
    CC: netdev@vger.kernel.org
    CC: linux-bluetooth@vger.kernel.org
    CC: linux-decnet-user@lists.sourceforge.net
    CC: linux-wireless@vger.kernel.org
    CC: linux-rdma@vger.kernel.org
    CC: linux-sctp@vger.kernel.org
    CC: linux-nfs@vger.kernel.org
    CC: linux-x25@vger.kernel.org
    Signed-off-by: David S. Miller

    Denys Vlasenko
     

12 Feb, 2018

1 commit

  • This is the mindless scripted replacement of kernel use of POLL*
    variables as described by Al, done by this script:

    for V in IN OUT PRI ERR RDNORM RDBAND WRNORM WRBAND HUP RDHUP NVAL MSG; do
    L=`git grep -l -w POLL$V | grep -v '^t' | grep -v /um/ | grep -v '^sa' | grep -v '/poll.h$'|grep -v '^D'`
    for f in $L; do sed -i "-es/^\([^\"]*\)\(\\)/\\1E\\2/" $f; done
    done

    with de-mangling cleanups yet to come.

    NOTE! On almost all architectures, the EPOLL* constants have the same
    values as the POLL* constants do. But they keyword here is "almost".
    For various bad reasons they aren't the same, and epoll() doesn't
    actually work quite correctly in some cases due to this on Sparc et al.

    The next patch from Al will sort out the final differences, and we
    should be all done.

    Scripted-by: Al Viro
    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

31 Jan, 2018

1 commit

  • Pull poll annotations from Al Viro:
    "This introduces a __bitwise type for POLL### bitmap, and propagates
    the annotations through the tree. Most of that stuff is as simple as
    'make ->poll() instances return __poll_t and do the same to local
    variables used to hold the future return value'.

    Some of the obvious brainos found in process are fixed (e.g. POLLIN
    misspelled as POLL_IN). At that point the amount of sparse warnings is
    low and most of them are for genuine bugs - e.g. ->poll() instance
    deciding to return -EINVAL instead of a bitmap. I hadn't touched those
    in this series - it's large enough as it is.

    Another problem it has caught was eventpoll() ABI mess; select.c and
    eventpoll.c assumed that corresponding POLL### and EPOLL### were
    equal. That's true for some, but not all of them - EPOLL### are
    arch-independent, but POLL### are not.

    The last commit in this series separates userland POLL### values from
    the (now arch-independent) kernel-side ones, converting between them
    in the few places where they are copied to/from userland. AFAICS, this
    is the least disruptive fix preserving poll(2) ABI and making epoll()
    work on all architectures.

    As it is, it's simply broken on sparc - try to give it EPOLLWRNORM and
    it will trigger only on what would've triggered EPOLLWRBAND on other
    architectures. EPOLLWRBAND and EPOLLRDHUP, OTOH, are never triggered
    at all on sparc. With this patch they should work consistently on all
    architectures"

    * 'misc.poll' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (37 commits)
    make kernel-side POLL... arch-independent
    eventpoll: no need to mask the result of epi_item_poll() again
    eventpoll: constify struct epoll_event pointers
    debugging printk in sg_poll() uses %x to print POLL... bitmap
    annotate poll(2) guts
    9p: untangle ->poll() mess
    ->si_band gets POLL... bitmap stored into a user-visible long field
    ring_buffer_poll_wait() return value used as return value of ->poll()
    the rest of drivers/*: annotate ->poll() instances
    media: annotate ->poll() instances
    fs: annotate ->poll() instances
    ipc, kernel, mm: annotate ->poll() instances
    net: annotate ->poll() instances
    apparmor: annotate ->poll() instances
    tomoyo: annotate ->poll() instances
    sound: annotate ->poll() instances
    acpi: annotate ->poll() instances
    crypto: annotate ->poll() instances
    block: annotate ->poll() instances
    x86: annotate ->poll() instances
    ...

    Linus Torvalds
     

27 Jan, 2018

1 commit

  • select(2) with wfds but no rfds must return when the socket is shut down
    by the peer. This way userspace notices socket activity and gets -EPIPE
    from the next write(2).

    Currently select(2) does not return for virtio-vsock when a SEND+RCV
    shutdown packet is received. This is because vsock_poll() only sets
    POLLOUT | POLLWRNORM for TCP_CLOSE, not the TCP_CLOSING state that the
    socket is in when the shutdown is received.

    Signed-off-by: Stefan Hajnoczi
    Signed-off-by: David S. Miller

    Stefan Hajnoczi
     

06 Dec, 2017

1 commit

  • Since commit 3b4477d2dcf2709d0be89e2a8dced3d0f4a017f2 ("VSOCK: use TCP
    state constants for sk_state") VSOCK has used TCP_* constants for
    sk_state.

    Commit b4562ca7925a3bedada87a3dd072dd5bad043288 ("hv_sock: add locking
    in the open/close/release code paths") reintroduced the SS_DISCONNECTING
    constant.

    This patch replaces the old SS_DISCONNECTING with the new TCP_CLOSING
    constant.

    CC: Dexuan Cui
    CC: Cathy Avery
    Signed-off-by: Stefan Hajnoczi
    Reviewed-by: Jorgen Hansen
    Signed-off-by: David S. Miller

    Stefan Hajnoczi
     

29 Nov, 2017

1 commit

  • A recent commit (3b4477d2dcf2) converted the sk_state to use
    TCP constants. In that change, vmci_transport_handle_detach
    was changed such that sk->sk_state was set to TCP_CLOSE before
    we test whether it is TCP_SYN_SENT. This change moves the
    sk_state change back to the original locations in that function.

    Signed-off-by: Jorgen Hansen
    Reviewed-by: Stefan Hajnoczi
    Signed-off-by: David S. Miller

    Jorgen Hansen
     

28 Nov, 2017

1 commit


26 Nov, 2017

1 commit

  • When using the host personality, VMCI will grab a mutex for any
    queue pair access. In the detach callback for the vmci vsock
    transport, we call vsock_stream_has_data while holding a spinlock,
    and vsock_stream_has_data will access a queue pair.

    To avoid this, we can simply omit calling vsock_stream_has_data
    for host side queue pairs, since the QPs are empty per default
    when the guest has detached.

    This bug affects users of VMware Workstation using kernel version
    4.4 and later.

    Testing: Ran vsock tests between guest and host, and verified that
    with this change, the host isn't calling vsock_stream_has_data
    during detach. Ran mixedTest between guest and host using both
    guest and host as server.

    v2: Rebased on top of recent change to sk_state values
    Reviewed-by: Adit Ranadive
    Reviewed-by: Aditya Sarwade
    Reviewed-by: Stefan Hajnoczi
    Signed-off-by: Jorgen Hansen
    Signed-off-by: David S. Miller

    Jorgen Hansen
     

04 Nov, 2017

1 commit


02 Nov, 2017

1 commit

  • Many source files in the tree are missing licensing information, which
    makes it harder for compliance tools to determine the correct license.

    By default all files without license information are under the default
    license of the kernel, which is GPL version 2.

    Update the files which contain no license information with the 'GPL-2.0'
    SPDX license identifier. The SPDX identifier is a legally binding
    shorthand, which can be used instead of the full boiler plate text.

    This patch is based on work done by Thomas Gleixner and Kate Stewart and
    Philippe Ombredanne.

    How this work was done:

    Patches were generated and checked against linux-4.14-rc6 for a subset of
    the use cases:
    - file had no licensing information it it.
    - file was a */uapi/* one with no licensing information in it,
    - file was a */uapi/* one with existing licensing information,

    Further patches will be generated in subsequent months to fix up cases
    where non-standard license headers were used, and references to license
    had to be inferred by heuristics based on keywords.

    The analysis to determine which SPDX License Identifier to be applied to
    a file was done in a spreadsheet of side by side results from of the
    output of two independent scanners (ScanCode & Windriver) producing SPDX
    tag:value files created by Philippe Ombredanne. Philippe prepared the
    base worksheet, and did an initial spot review of a few 1000 files.

    The 4.13 kernel was the starting point of the analysis with 60,537 files
    assessed. Kate Stewart did a file by file comparison of the scanner
    results in the spreadsheet to determine which SPDX license identifier(s)
    to be applied to the file. She confirmed any determination that was not
    immediately clear with lawyers working with the Linux Foundation.

    Criteria used to select files for SPDX license identifier tagging was:
    - Files considered eligible had to be source code files.
    - Make and config files were included as candidates if they contained >5
    lines of source
    - File already had some variant of a license header in it (even if
    Reviewed-by: Philippe Ombredanne
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

26 Oct, 2017

1 commit

  • Although CONFIG_VSOCKETS_DIAG depends on CONFIG_VSOCKETS,
    vsock_init_tables() is not always called, it is called only
    if other modules call its caller. Therefore if we only
    enable CONFIG_VSOCKETS_DIAG, it would crash kernel on uninitialized
    vsock_bind_table.

    This patch fixes it by moving vsock_init_tables() to its own
    module_init().

    Fixes: 413a4317aca7 ("VSOCK: add sock_diag interface")
    Reported-by: syzkaller bot
    Cc: Stefan Hajnoczi
    Cc: Jorgen Hansen
    Signed-off-by: Cong Wang
    Reviewed-by: Stefan Hajnoczi
    Signed-off-by: David S. Miller

    Cong Wang
     

22 Oct, 2017

1 commit

  • There were quite a few overlapping sets of changes here.

    Daniel's bug fix for off-by-ones in the new BPF branch instructions,
    along with the added allowances for "data_end > ptr + x" forms
    collided with the metadata additions.

    Along with those three changes came veritifer test cases, which in
    their final form I tried to group together properly. If I had just
    trimmed GIT's conflict tags as-is, this would have split up the
    meta tests unnecessarily.

    In the socketmap code, a set of preemption disabling changes
    overlapped with the rename of bpf_compute_data_end() to
    bpf_compute_data_pointers().

    Changes were made to the mv88e6060.c driver set addr method
    which got removed in net-next.

    The hyperv transport socket layer had a locking change in 'net'
    which overlapped with a change of socket state macro usage
    in 'net-next'.

    Signed-off-by: David S. Miller

    David S. Miller
     

21 Oct, 2017

1 commit

  • Without the patch, when hvs_open_connection() hasn't completely established
    a connection (e.g. it has changed sk->sk_state to SS_CONNECTED, but hasn't
    inserted the sock into the connected queue), vsock_stream_connect() may see
    the sk_state change and return the connection to the userspace, and next
    when the userspace closes the connection quickly, hvs_release() may not see
    the connection in the connected queue; finally hvs_open_connection()
    inserts the connection into the queue, but we won't be able to purge the
    connection for ever.

    Signed-off-by: Dexuan Cui
    Cc: K. Y. Srinivasan
    Cc: Haiyang Zhang
    Cc: Stephen Hemminger
    Cc: Vitaly Kuznetsov
    Cc: Cathy Avery
    Cc: Rolf Neugebauer
    Cc: Marcelo Cerri
    Signed-off-by: David S. Miller

    Dexuan Cui
     

06 Oct, 2017

4 commits

  • This patch adds the sock_diag interface for querying sockets from
    userspace. Tools like ss(8) and netstat(8) can use this interface to
    list open sockets.

    The userspace ABI is defined in and includes
    netlink request and response structs. The request can query sockets
    based on their sk_state (e.g. listening sockets only) and the response
    contains socket information fields including the local/remote addresses,
    inode number, etc.

    This patch does not dump VMCI pending sockets because I have only tested
    the virtio transport, which does not use pending sockets. Support can
    be added later by extending vsock_diag_dump() if needed by VMCI users.

    Signed-off-by: Stefan Hajnoczi
    Signed-off-by: David S. Miller

    Stefan Hajnoczi
     
  • There are two state fields: socket->state and sock->sk_state. The
    socket->state field uses SS_UNCONNECTED, SS_CONNECTED, etc while the
    sock->sk_state typically uses values that match TCP state constants
    (TCP_CLOSE, TCP_ESTABLISHED). AF_VSOCK does not follow this convention
    and instead uses SS_* constants for both fields.

    The sk_state field will be exposed to userspace through the vsock_diag
    interface for ss(8), netstat(8), and other programs.

    This patch switches sk_state to TCP state constants so that the meaning
    of this field is consistent with other address families. Not just
    AF_INET and AF_INET6 use the TCP constants, AF_UNIX and others do too.

    The following mapping was used to convert the code:

    SS_FREE -> TCP_CLOSE
    SS_UNCONNECTED -> TCP_CLOSE
    SS_CONNECTING -> TCP_SYN_SENT
    SS_CONNECTED -> TCP_ESTABLISHED
    SS_DISCONNECTING -> TCP_CLOSING
    VSOCK_SS_LISTEN -> TCP_LISTEN

    In __vsock_create() the sk_state initialization was dropped because
    sock_init_data() already initializes sk_state to TCP_CLOSE.

    Signed-off-by: Stefan Hajnoczi
    Signed-off-by: David S. Miller

    Stefan Hajnoczi
     
  • The vsock_diag.ko module will need to check socket table membership.

    Signed-off-by: Stefan Hajnoczi
    Signed-off-by: David S. Miller

    Stefan Hajnoczi
     
  • The socket table symbols need to be exported from vsock.ko so that the
    vsock_diag.ko module will be able to traverse sockets.

    Signed-off-by: Stefan Hajnoczi
    Signed-off-by: David S. Miller

    Stefan Hajnoczi
     

20 Sep, 2017

1 commit


29 Aug, 2017

1 commit

  • Hyper-V Sockets (hv_sock) supplies a byte-stream based communication
    mechanism between the host and the guest. It uses VMBus ringbuffer as the
    transportation layer.

    With hv_sock, applications between the host (Windows 10, Windows Server
    2016 or newer) and the guest can talk with each other using the traditional
    socket APIs.

    More info about Hyper-V Sockets is available here:

    "Make your own integration services":
    https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/user-guide/make-integration-service

    The patch implements the necessary support in Linux guest by introducing a new
    vsock transport for AF_VSOCK.

    Signed-off-by: Dexuan Cui
    Cc: K. Y. Srinivasan
    Cc: Haiyang Zhang
    Cc: Stephen Hemminger
    Cc: Andy King
    Cc: Dmitry Torokhov
    Cc: George Zhang
    Cc: Jorgen Hansen
    Cc: Reilly Grant
    Cc: Asias He
    Cc: Stefan Hajnoczi
    Cc: Vitaly Kuznetsov
    Cc: Cathy Avery
    Cc: Rolf Neugebauer
    Cc: Marcelo Cerri
    Signed-off-by: David S. Miller

    Dexuan Cui
     

21 Jun, 2017

1 commit


16 Jun, 2017

2 commits

  • 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 (skb_put, __skb_put and pskb_put) 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_put, __skb_put };
    @@
    - *(fn(SKB, LEN))
    + *(u8 *)fn(SKB, LEN)

    @@
    expression E, SKB, LEN;
    identifier fn = { skb_put, __skb_put };
    type T;
    @@
    - E = ((T *)(fn(SKB, LEN)))
    + E = fn(SKB, LEN)

    which actually doesn't cover pskb_put since there are only three
    users overall.

    A handful of stragglers were converted manually, notably a macro in
    drivers/isdn/i4l/isdn_bsdcomp.c and, oddly enough, one of the many
    instances in net/bluetooth/hci_sock.c. In the former file, I also
    had to fix one whitespace problem spatch introduced.

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

    Johannes Berg
     
  • A common pattern with skb_put() is to just want to memcpy()
    some data into the new space, introduce skb_put_data() for
    this.

    An spatch similar to the one for skb_put_zero() converts many
    of the places using it:

    @@
    identifier p, p2;
    expression len, skb, data;
    type t, t2;
    @@
    (
    -p = skb_put(skb, len);
    +p = skb_put_data(skb, data, len);
    |
    -p = (t)skb_put(skb, len);
    +p = skb_put_data(skb, data, len);
    )
    (
    p2 = (t2)p;
    -memcpy(p2, data, len);
    |
    -memcpy(p, data, len);
    )

    @@
    type t, t2;
    identifier p, p2;
    expression skb, data;
    @@
    t *p;
    ...
    (
    -p = skb_put(skb, sizeof(t));
    +p = skb_put_data(skb, data, sizeof(t));
    |
    -p = (t *)skb_put(skb, sizeof(t));
    +p = skb_put_data(skb, data, sizeof(t));
    )
    (
    p2 = (t2)p;
    -memcpy(p2, data, sizeof(*p));
    |
    -memcpy(p, data, sizeof(*p));
    )

    @@
    expression skb, len, data;
    @@
    -memcpy(skb_put(skb, len), data, len);
    +skb_put_data(skb, data, len);

    (again, manually post-processed to retain some comments)

    Reviewed-by: Stephen Hemminger
    Signed-off-by: Johannes Berg
    Signed-off-by: David S. Miller

    Johannes Berg
     

23 May, 2017

1 commit

  • As reported by Michal, vsock_stream_sendmsg() could still
    sleep at vsock_stream_has_space() after prepare_to_wait():

    vsock_stream_has_space
    vmci_transport_stream_has_space
    vmci_qpair_produce_free_space
    qp_lock
    qp_acquire_queue_mutex
    mutex_lock

    Just switch to the new wait API like we did for commit
    d9dc8b0f8b4e ("net: fix sleeping for sk_wait_event()").

    Reported-by: Michal Kubecek
    Cc: Stefan Hajnoczi
    Cc: Jorgen Hansen
    Cc: "Michael S. Tsirkin"
    Cc: Claudio Imbrenda
    Signed-off-by: Cong Wang
    Reviewed-by: Stefan Hajnoczi
    Signed-off-by: David S. Miller

    WANG Cong
     

11 May, 2017

1 commit

  • Pull virtio updates from Michael Tsirkin:
    "Fixes, cleanups, performance

    A bunch of changes to virtio, most affecting virtio net. Also ptr_ring
    batched zeroing - first of batching enhancements that seems ready."

    * tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost:
    s390/virtio: change maintainership
    tools/virtio: fix spelling mistake: "wakeus" -> "wakeups"
    virtio_net: tidy a couple debug statements
    ptr_ring: support testing different batching sizes
    ringtest: support test specific parameters
    ptr_ring: batch ring zeroing
    virtio: virtio_driver doc
    virtio_net: don't reset twice on XDP on/off
    virtio_net: fix support for small rings
    virtio_net: reduce alignment for buffers
    virtio_net: rework mergeable buffer handling
    virtio_net: allow specifying context for rx
    virtio: allow extra context per descriptor
    tools/virtio: fix build breakage
    virtio: add context flag to find vqs
    virtio: wrap find_vqs
    ringtest: fix an assert statement

    Linus Torvalds
     

03 May, 2017

1 commit


25 Apr, 2017

2 commits

  • The virtio drivers deal with struct virtio_vsock_pkt. Add
    virtio_transport_deliver_tap_pkt(pkt) for handing packets to the
    vsockmon device.

    We call virtio_transport_deliver_tap_pkt(pkt) from
    net/vmw_vsock/virtio_transport.c and drivers/vhost/vsock.c instead of
    common code. This is because the drivers may drop packets before
    handing them to common code - we still want to capture them.

    Signed-off-by: Gerard Garcia
    Signed-off-by: Stefan Hajnoczi
    Reviewed-by: Jorgen Hansen
    Signed-off-by: David S. Miller

    Gerard Garcia
     
  • Add tap functions that can be used by the vsock transports to
    deliver packets to vsockmon virtual network devices.

    Signed-off-by: Gerard Garcia
    Signed-off-by: Stefan Hajnoczi
    Reviewed-by: Jorgen Hansen
    Signed-off-by: David S. Miller

    Gerard Garcia
     

31 Mar, 2017

1 commit

  • Rather than assign the positive errno values to ret and then
    checking if it is positive and flip the sign, just return the
    errno value.

    Detected by CoverityScan, CID#986649 ("Logically Dead Code")

    Signed-off-by: Colin Ian King
    Reviewed-by: Stefan Hajnoczi
    Reviewed-by: Jorgen Hansen
    Acked-by: Michael S. Tsirkin
    Signed-off-by: David S. Miller

    Colin Ian King
     

22 Mar, 2017

3 commits