]> git.baikalelectronics.ru Git - kernel.git/commit
udp: fix rx queue len reported by diag and proc interface
authorPaolo Abeni <pabeni@redhat.com>
Fri, 8 Jun 2018 09:35:40 +0000 (11:35 +0200)
committerDavid S. Miller <davem@davemloft.net>
Fri, 8 Jun 2018 23:55:15 +0000 (19:55 -0400)
commitde40262b1b134414db891ece93b67d012057480d
treeacc594ed296987e67d25703d1317772239dd3132
parent6685103a5f1a1848cbb5c7a0ea11f77b57a85adb
udp: fix rx queue len reported by diag and proc interface

After commit 09aa8dd9d87c ("udp: add batching to udp_rmem_release()")
the sk_rmem_alloc field does not measure exactly anymore the
receive queue length, because we batch the rmem release. The issue
is really apparent only after commit 4dc61cc8f2a7 ("udp: do rmem bulk
free even if the rx sk queue is empty"): the user space can easily
check for an empty socket with not-0 queue length reported by the 'ss'
tool or the procfs interface.

We need to use a custom UDP helper to report the correct queue length,
taking into account the forward allocation deficit.

Reported-by: trevor.francis@46labs.com
Fixes: 09aa8dd9d87c ("UDP: add batching to udp_rmem_release()")
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/transp_v6.h
include/net/udp.h
net/ipv4/udp.c
net/ipv4/udp_diag.c
net/ipv6/datagram.c
net/ipv6/udp.c