]> git.baikalelectronics.ru Git - kernel.git/commit
net: let skb_orphan_partial wake-up waiters.
authorPaolo Abeni <pabeni@redhat.com>
Tue, 30 Mar 2021 16:43:54 +0000 (18:43 +0200)
committerDavid S. Miller <davem@davemloft.net>
Tue, 30 Mar 2021 20:57:28 +0000 (13:57 -0700)
commitab2a16c6cefdf9f04200600b259a9b5cd7c3ae64
tree6bf5372364c7c76a17132f6df8b55ad2b1afdd9d
parentd20a010d389df21588911c820fda27065e0734a0
net: let skb_orphan_partial wake-up waiters.

Currently the mentioned helper can end-up freeing the socket wmem
without waking-up any processes waiting for more write memory.

If the partially orphaned skb is attached to an UDP (or raw) socket,
the lack of wake-up can hang the user-space.

Even for TCP sockets not calling the sk destructor could have bad
effects on TSQ.

Address the issue using skb_orphan to release the sk wmem before
setting the new sock_efree destructor. Additionally bundle the
whole ownership update in a new helper, so that later other
potential users could avoid duplicate code.

v1 -> v2:
 - use skb_orphan() instead of sort of open coding it (Eric)
 - provide an helper for the ownership change (Eric)

Fixes: 56724f72dfdb ("netem: fix skb_orphan_partial()")
Suggested-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/sock.h
net/core/sock.c