Skip to content

netlink: bridge: fix nf_bridge->physindev use after free

Pavel Tikhomirov bridge lkml netdev netfilter-devel 2 versions – Applied

Status from this message: I have applied this series to nf.git

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest4 patches 5 repliesApplied
  2. v14 patches 4 repliesSuperseded

Patches in v3 Applied

#Subject and filesSizeRepliesApplied
1/4netfilter: nfnetlink_log: use proper helper for fetching physinifnet/netfilter/nfnetlink_log.c+4 -41 reply
2/4netfilter: nf_queue: remove excess nf_bridge variablenet/netfilter/nf_queue.c+1 -31 reply
3/4netfilter: propagate net to nf_bridge_get_physindevinclude/linux/netfilter_bridge.h net/ipv4/netfilter/nf_reject_ipv4.c net/ipv6/netfilter/nf_reject_ipv6.c +4 more+16 -151 reply
4/4netfilter: bridge: replace physindev with physinif in nf_bridge_infoinclude/linux/netfilter_bridge.h include/linux/skbuff.h net/bridge/br_netfilter_hooks.c +3 more+61 -210 replies

Reviews trailers per patch

3 of 4 patches have a Reviewed-by or Acked-by.

PatchSimon Horman
1/4R-b
2/4R-b
3/4R-b
4/4

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [PATCH v3 0/4] netlink: bridge: fix nf_bridge->physindev use after free

Code processing skb from neigh->arp_queue can access its nf_bridge->physindev, which can already be freed, leading to crash.

So, as Florian suggests, we can put physinif on nf_bridge and peek into the original device with dev_get_by_index_rcu(), so that we can be sure that device is not freed under us.

This is a second attempt to fix this issue, first attempt:

"neighbour: purge nf_bridged skb from foreign device neigh"
https://lore.kernel.org/netdev/[email protected]/

v3: resend it to proper lists and recipients

Pavel Tikhomirov (4):
netfilter: nfnetlink_log: use proper helper for fetching physinif
netfilter: nf_queue: remove excess nf_bridge variable
netfilter: propagate net to nf_bridge_get_physindev
netfilter: bridge: replace physindev with physinif in nf_bridge_info

 include/linux/netfilter_bridge.h           |  6 ++--
 include/linux/skbuff.h                     |  2 +-
 net/bridge/br_netfilter_hooks.c            | 42 +++++++++++++++++-----
 net/bridge/br_netfilter_ipv6.c             | 14 +++++---
 net/ipv4/netfilter/nf_reject_ipv4.c        |  9 +++--
 net/ipv6/netfilter/nf_reject_ipv6.c        | 11 ++++--
 net/netfilter/ipset/ip_set_hash_netiface.c |  8 ++---
 net/netfilter/nf_log_syslog.c              | 13 +++----
 net/netfilter/nf_queue.c                   |  6 ++--
 net/netfilter/nfnetlink_log.c              |  8 ++---
 net/netfilter/xt_physdev.c                 |  2 +-
 11 files changed, 80 insertions(+), 41 deletions(-)
Signature · 1 line
2.43.0