Re: [PATCH v3 net-next] net: diag: support SOCK_DESTROY for UDP sockets

2016-08-23 Thread Eric Dumazet
On Wed, 2016-08-24 at 02:24 +0900, Lorenzo Colitti wrote: > On Wed, Aug 24, 2016 at 2:16 AM, David Ahern wrote: > >> So you'd remove the sock_put and sock_gen_put calls from tcp_abort and > >> just add one sock_gen_put in tcp_diag_destroy? That does seem simpler. > > > > untested and mangled on a

Re: [PATCH v3 net-next] net: diag: support SOCK_DESTROY for UDP sockets

2016-08-23 Thread Lorenzo Colitti
On Wed, Aug 24, 2016 at 2:16 AM, David Ahern wrote: >> So you'd remove the sock_put and sock_gen_put calls from tcp_abort and >> just add one sock_gen_put in tcp_diag_destroy? That does seem simpler. > > untested and mangled on a copy and paste but the intent is: ... > if (IS_ERR(sk)) >

Re: [PATCH v3 net-next] net: diag: support SOCK_DESTROY for UDP sockets

2016-08-23 Thread Lorenzo Colitti
On Wed, Aug 24, 2016 at 2:02 AM, David Ahern wrote: >> Looking at the code again, it seems that there's a bug in >> sock_diag_destroy. If the destroy operation does not occur (e.g., if >> sock_diag_destroy returns EPERM, or the protocol doesn't support >> destroy), then it doesn't release the refc

Re: [PATCH v3 net-next] net: diag: support SOCK_DESTROY for UDP sockets

2016-08-23 Thread David Ahern
On 8/23/16 11:13 AM, Lorenzo Colitti wrote: > On Wed, Aug 24, 2016 at 2:02 AM, David Ahern wrote: >>> Looking at the code again, it seems that there's a bug in >>> sock_diag_destroy. If the destroy operation does not occur (e.g., if >>> sock_diag_destroy returns EPERM, or the protocol doesn't supp

Re: [PATCH v3 net-next] net: diag: support SOCK_DESTROY for UDP sockets

2016-08-23 Thread David Ahern
On 8/23/16 10:37 AM, Lorenzo Colitti wrote: > On Wed, Aug 24, 2016 at 12:02 AM, David Ahern > wrote: >> +int udp_abort(struct sock *sk, int err) >> +{ >> + lock_sock(sk); >> + >> + sk->sk_err = err; >> + sk->sk_error_report(sk); >> + udp_disconnect(sk, 0); > > I notice th

Re: [PATCH v3 net-next] net: diag: support SOCK_DESTROY for UDP sockets

2016-08-23 Thread Lorenzo Colitti
On Wed, Aug 24, 2016 at 12:02 AM, David Ahern wrote: > +int udp_abort(struct sock *sk, int err) > +{ > + lock_sock(sk); > + > + sk->sk_err = err; > + sk->sk_error_report(sk); > + udp_disconnect(sk, 0); I notice that udp_disconnect does "inet->inet_daddr = 0" but doesn't to

Re: [PATCH v3 net-next] net: diag: support SOCK_DESTROY for UDP sockets

2016-08-23 Thread Eric Dumazet
CC Lorenzo Colitti On Tue, 2016-08-23 at 08:02 -0700, David Ahern wrote: > This implements SOCK_DESTROY for UDP sockets similar to what was done > for TCP with commit c1e64e298b8ca ("net: diag: Support destroying TCP > sockets.") A process with a UDP socket targeted for destroy is awakened > and

Re: [PATCH v3 net-next] net: diag: support SOCK_DESTROY for UDP sockets

2016-08-23 Thread Eric Dumazet
On Tue, 2016-08-23 at 08:02 -0700, David Ahern wrote: > This implements SOCK_DESTROY for UDP sockets similar to what was done > for TCP with commit c1e64e298b8ca ("net: diag: Support destroying TCP > sockets.") A process with a UDP socket targeted for destroy is awakened > and recvmsg fails with EC

[PATCH v3 net-next] net: diag: support SOCK_DESTROY for UDP sockets

2016-08-23 Thread David Ahern
This implements SOCK_DESTROY for UDP sockets similar to what was done for TCP with commit c1e64e298b8ca ("net: diag: Support destroying TCP sockets.") A process with a UDP socket targeted for destroy is awakened and recvmsg fails with ECONNABORTED. Signed-off-by: David Ahern --- v3 - add missing