search for: sock_put

Displaying 20 results from an estimated 104 matches for "sock_put".

2015 Oct 21
1
[PATCH] VSOCK: sock_put wasn't safe to call in interrupt context
In the vsock vmci_transport driver, sock_put wasn't safe to call in interrupt context, since that may call the vsock destructor which in turn calls several functions that should only be called from process context. This change defers the callling of these functions to a worker thread. All these functions were deallocation of resources re...
2015 Oct 21
1
[PATCH] VSOCK: sock_put wasn't safe to call in interrupt context
In the vsock vmci_transport driver, sock_put wasn't safe to call in interrupt context, since that may call the vsock destructor which in turn calls several functions that should only be called from process context. This change defers the callling of these functions to a worker thread. All these functions were deallocation of resources re...
2009 Apr 16
1
[1/2] tun: Only free a netdev when all tun descriptors are closed
...n_get(tfile); > > - > if (tun) { > - DBG(KERN_INFO "%s: tun_chr_close\n", tun->dev->name); > - > - rtnl_lock(); > - __tun_detach(tun); > - > /* If desireable, unregister the netdevice. */ > - if (!(tun->flags & TUN_PERSIST)) { > - sock_put(tun->sk); > - unregister_netdevice(tun->dev); > - } > + if (!(tun->flags & TUN_PERSIST)) > + unregister_netdev(tun->dev); > + else > + tun_put(tun); > + } else > + tun = tfile->tun; > > - rtnl_unlock(); > + if (tun) { > + DBG(KERN...
2009 Apr 16
1
[1/2] tun: Only free a netdev when all tun descriptors are closed
...n_get(tfile); > > - > if (tun) { > - DBG(KERN_INFO "%s: tun_chr_close\n", tun->dev->name); > - > - rtnl_lock(); > - __tun_detach(tun); > - > /* If desireable, unregister the netdevice. */ > - if (!(tun->flags & TUN_PERSIST)) { > - sock_put(tun->sk); > - unregister_netdevice(tun->dev); > - } > + if (!(tun->flags & TUN_PERSIST)) > + unregister_netdev(tun->dev); > + else > + tun_put(tun); > + } else > + tun = tfile->tun; > > - rtnl_unlock(); > + if (tun) { > + DBG(KERN...
2023 Jun 01
0
[PATCH net] virtio/vsock: fix sock refcnt bug on owner set failure
On Wed, May 31, 2023 at 07:47:32PM +0000, Bobby Eshleman wrote: >Previous to setting the owner the socket is found via >vsock_find_connected_socket(), which returns sk after a call to >sock_hold(). > >If setting the owner fails, then sock_put() needs to be called. > >Fixes: f9d2b1e146e0 ("virtio/vsock: fix leaks due to missing skb owner") >Signed-off-by: Bobby Eshleman <bobby.eshleman at bytedance.com> >--- > net/vmw_vsock/virtio_transport_common.c | 1 + > 1 file changed, 1 insertion(+) > >diff --...
2016 Dec 08
2
[PATCH v3 4/4] vsock: cancel packets when failing to connect
...k); sk = sk_vsock(vsk); @@ -1115,8 +1124,11 @@ static void vsock_connect_timeout(struct work_struct *work) sk->sk_state = SS_UNCONNECTED; sk->sk_err = ETIMEDOUT; sk->sk_error_report(sk); + cancel = 1; } release_sock(sk); + if (cancel) + vsock_transport_cancel_pkt(vsk); sock_put(sk); } @@ -1223,11 +1235,13 @@ static int vsock_stream_connect(struct socket *sock, struct sockaddr *addr, err = sock_intr_errno(timeout); sk->sk_state = SS_UNCONNECTED; sock->state = SS_UNCONNECTED; + vsock_transport_cancel_pkt(vsk); goto out_wait; } else if (timeout ==...
2016 Dec 08
2
[PATCH v3 4/4] vsock: cancel packets when failing to connect
...k); sk = sk_vsock(vsk); @@ -1115,8 +1124,11 @@ static void vsock_connect_timeout(struct work_struct *work) sk->sk_state = SS_UNCONNECTED; sk->sk_err = ETIMEDOUT; sk->sk_error_report(sk); + cancel = 1; } release_sock(sk); + if (cancel) + vsock_transport_cancel_pkt(vsk); sock_put(sk); } @@ -1223,11 +1235,13 @@ static int vsock_stream_connect(struct socket *sock, struct sockaddr *addr, err = sock_intr_errno(timeout); sk->sk_state = SS_UNCONNECTED; sock->state = SS_UNCONNECTED; + vsock_transport_cancel_pkt(vsk); goto out_wait; } else if (timeout ==...
2016 Jun 17
0
[PATCH net-next V2] tun: introduce tx skb ring
...static void __tun_detach(struct tun_file *tfile, bool clean) > tun->dev->reg_state == NETREG_REGISTERED) > unregister_netdevice(tun->dev); > } > + if (tun && tun->flags & IFF_TX_ARRAY) > + skb_array_cleanup(&tfile->tx_array); > sock_put(&tfile->sk); > } > } > @@ -596,12 +608,12 @@ static void tun_detach_all(struct net_device *dev) > for (i = 0; i < n; i++) { > tfile = rtnl_dereference(tun->tfiles[i]); > /* Drop read queue */ > - tun_queue_purge(tfile); > + tun_queue_purge(tun, tfil...
2016 Jun 15
7
[PATCH net-next V2] tun: introduce tx skb ring
...ue(tfile); @@ -560,6 +570,8 @@ static void __tun_detach(struct tun_file *tfile, bool clean) tun->dev->reg_state == NETREG_REGISTERED) unregister_netdevice(tun->dev); } + if (tun && tun->flags & IFF_TX_ARRAY) + skb_array_cleanup(&tfile->tx_array); sock_put(&tfile->sk); } } @@ -596,12 +608,12 @@ static void tun_detach_all(struct net_device *dev) for (i = 0; i < n; i++) { tfile = rtnl_dereference(tun->tfiles[i]); /* Drop read queue */ - tun_queue_purge(tfile); + tun_queue_purge(tun, tfile); sock_put(&tfile->sk); }...
2016 Jun 15
7
[PATCH net-next V2] tun: introduce tx skb ring
...ue(tfile); @@ -560,6 +570,8 @@ static void __tun_detach(struct tun_file *tfile, bool clean) tun->dev->reg_state == NETREG_REGISTERED) unregister_netdevice(tun->dev); } + if (tun && tun->flags & IFF_TX_ARRAY) + skb_array_cleanup(&tfile->tx_array); sock_put(&tfile->sk); } } @@ -596,12 +608,12 @@ static void tun_detach_all(struct net_device *dev) for (i = 0; i < n; i++) { tfile = rtnl_dereference(tun->tfiles[i]); /* Drop read queue */ - tun_queue_purge(tfile); + tun_queue_purge(tun, tfile); sock_put(&tfile->sk); }...
2013 Jan 25
4
[PATCH 0/1] VM Sockets for Linux upstreaming
From: Andy King <acking at vmware.com> ** Introduce VM Sockets *** In an effort to improve the out-of-the-box experience with Linux kernels for VMware users, VMware is working on readying the VM Sockets (VSOCK, formerly VMCI Sockets) (vmw_vsock) kernel module for inclusion in the Linux kernel. The purpose of this post is to acquire feedback on the vmw_vsock kernel module. Unlike previous
2013 Jan 25
4
[PATCH 0/1] VM Sockets for Linux upstreaming
From: Andy King <acking at vmware.com> ** Introduce VM Sockets *** In an effort to improve the out-of-the-box experience with Linux kernels for VMware users, VMware is working on readying the VM Sockets (VSOCK, formerly VMCI Sockets) (vmw_vsock) kernel module for inclusion in the Linux kernel. The purpose of this post is to acquire feedback on the vmw_vsock kernel module. Unlike previous
2013 Jun 27
1
[RFC 2/5] VSOCK: Introduce virtio-vsock-common.ko
...gt;len = pkt->hdr.len; > + pkt->off = 0; > + > + size = sizeof(*pkt) + pkt->len; > + /* Attach the packet to the socket's receive queue as an sk_buff. */ > + skb = alloc_skb(size, GFP_ATOMIC); > + if (!skb) > + goto out; > + > + /* sk_receive_skb() will do a sock_put(), so hold here. */ > + sock_hold(sk); > + skb_put(skb, size); > + memcpy(skb->data, pkt, sizeof(*pkt)); > + memcpy(skb->data + sizeof(*pkt), pkt->buf, pkt->len); > + > + sk_receive_skb(sk, skb, 0); > +out: > + virtio_transport_free_pkt(pkt); > +} > + >...
2013 Jun 27
1
[RFC 2/5] VSOCK: Introduce virtio-vsock-common.ko
...gt;len = pkt->hdr.len; > + pkt->off = 0; > + > + size = sizeof(*pkt) + pkt->len; > + /* Attach the packet to the socket's receive queue as an sk_buff. */ > + skb = alloc_skb(size, GFP_ATOMIC); > + if (!skb) > + goto out; > + > + /* sk_receive_skb() will do a sock_put(), so hold here. */ > + sock_hold(sk); > + skb_put(skb, size); > + memcpy(skb->data, pkt, sizeof(*pkt)); > + memcpy(skb->data + sizeof(*pkt), pkt->buf, pkt->len); > + > + sk_receive_skb(sk, skb, 0); > +out: > + virtio_transport_free_pkt(pkt); > +} > + >...
2019 Oct 23
0
[PATCH net-next 11/14] vsock: add multi-transports support
...eturn -EINVAL; @@ -1911,7 +1978,17 @@ static int vsock_create(struct net *net, struct socket *sock, if (!sk) return -ENOMEM; - vsock_insert_unbound(vsock_sk(sk)); + vsk = vsock_sk(sk); + + if (sock->type == SOCK_DGRAM) { + ret = vsock_assign_transport(vsk, NULL); + if (ret < 0) { + sock_put(sk); + return ret; + } + } + + vsock_insert_unbound(vsk); return 0; } @@ -1926,11 +2003,20 @@ static long vsock_dev_do_ioctl(struct file *filp, unsigned int cmd, void __user *ptr) { u32 __user *p = ptr; + u32 cid = VMADDR_CID_ANY; int retval = 0; switch (cmd) { case IO...
2019 Sep 27
0
[RFC PATCH 10/13] vsock: add multi-transports support
...turn -ENOMEM; - vsock_insert_unbound(vsock_sk(sk)); + vsk = vsock_sk(sk); + + /* RFC-TODO: for dgram we still support only one transport, and + * we assign it during the sock creation. + */ + if (sock->type == SOCK_DGRAM) { + ret = vsock_assign_transport(vsk, NULL); + if (ret < 0) { + sock_put(sk); + return ret; + } + } + + vsock_insert_unbound(vsk); return 0; } @@ -1912,11 +1985,20 @@ static long vsock_dev_do_ioctl(struct file *filp, unsigned int cmd, void __user *ptr) { u32 __user *p = ptr; + u32 cid = VMADDR_CID_ANY; int retval = 0; switch (cmd) { case IO...
2013 Jan 08
7
[PATCH 0/6] VSOCK for Linux upstreaming
* * * This series of VSOCK linux upstreaming patches include latest udpate from VMware to address Greg's and all other's code review comments. Summary of changes: - Rebase our linux kernel tree from v3.5 to v3.7. - Fix all checkpatch warnings and errors. Fix some checkpatch with -strict errors. This addresses Greg's comment: On 15 Nov 2012
2013 Jan 08
7
[PATCH 0/6] VSOCK for Linux upstreaming
* * * This series of VSOCK linux upstreaming patches include latest udpate from VMware to address Greg's and all other's code review comments. Summary of changes: - Rebase our linux kernel tree from v3.5 to v3.7. - Fix all checkpatch warnings and errors. Fix some checkpatch with -strict errors. This addresses Greg's comment: On 15 Nov 2012
2013 Jun 27
0
[RFC 2/5] VSOCK: Introduce virtio-vsock-common.ko
...ize_t size; + + vsk = vsock_sk(sk); + + pkt->len = pkt->hdr.len; + pkt->off = 0; + + size = sizeof(*pkt) + pkt->len; + /* Attach the packet to the socket's receive queue as an sk_buff. */ + skb = alloc_skb(size, GFP_ATOMIC); + if (!skb) + goto out; + + /* sk_receive_skb() will do a sock_put(), so hold here. */ + sock_hold(sk); + skb_put(skb, size); + memcpy(skb->data, pkt, sizeof(*pkt)); + memcpy(skb->data + sizeof(*pkt), pkt->buf, pkt->len); + + sk_receive_skb(sk, skb, 0); +out: + virtio_transport_free_pkt(pkt); +} + +int +virtio_transport_dgram_dequeue(struct kiocb *kioc...
2015 Dec 09
1
[PATCH v2] Revert "Merge branch 'vsock-virtio'"
...ost_add_used(vq, head, pkt->len); /* TODO should this be sizeof(pkt->hdr) + pkt->len? */ - added = true; - - virtio_transport_dec_tx_pkt(pkt); - vsock->total_tx_buf -= pkt->len; - - sk = sk_vsock(pkt->trans->vsk); - /* Release refcnt taken in vhost_transport_send_pkt */ - sock_put(sk); - - virtio_transport_free_pkt(pkt); - } - if (added) - vhost_signal(&vsock->dev, vq); - mutex_unlock(&vq->mutex); - - if (added) - wake_up(&vsock->queue_wait); -} - -static void vhost_transport_send_pkt_work(struct vhost_work *work) -{ - struct vhost_virtqueue *vq; - st...