Skip to content

Fix netlink rcvbuf wraparound

Jason Baron netdev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v2 Latest3 patches 8 repliesIn review

Changes in v2 from the cover letter

-add Fixes:
-add sock_rcvbuf_has_space() helper
-use helper functions for udp netlink
-remove excessive parentheses

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3net: add sock_rcvbuf_has_space() helperinclude/net/sock.h+38 -00 replies
2/3udp: use __sock_rcvbuf_has_space() helpernet/ipv4/udp.c+2 -110 replies
3/3netlink: Fix wraparound of sk->sk_rmem_allocnet/netlink/af_netlink.c+21 -148 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH net-next v2 0/3] Fix netlink rcvbuf wraparound

The sk->sk_rmem_alloc field of a netlink socket can wraparound as a signed int when comparing to sk->sk_rcvbuf, when sk->sk_rcvbuf approaches INT_MAX. This can be reproduced by forcing sk->sk_rcvbuf to INT_MAX and this can exhaust all of memory.

I've added a sock_rcvbuf_has_space() helper function to generalize the fix as a similar approach has already been implemented for udp sockets.

v2:
-add Fixes:
-add sock_rcvbuf_has_space() helper
-use helper functions for udp netlink
-remove excessive parentheses

Jason Baron (3):
net: add sock_rcvbuf_has_space() helper
udp: use __sock_rcvbuf_has_space() helper
netlink: Fix wraparound of sk->sk_rmem_alloc

 include/net/sock.h       | 38 ++++++++++++++++++++++++++++++++++++++
 net/ipv4/udp.c           | 13 ++-----------
 net/netlink/af_netlink.c | 35 +++++++++++++++++++++--------------
 3 files changed, 61 insertions(+), 25 deletions(-)
Signature · 1 line
2.25.1