Skip to content

net: bridge: vlan: fix memory leak & null pointer deref

Nikolay Aleksandrov bridge netdev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 3 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2net: bridge: vlan: fix leaks on switchdev deletion errorsnet/bridge/br_vlan.c+11 -92 replies
2/2net: bridge: vlan: avoid NULL dereference on flush errorsnet/bridge/br_vlan.c+9 -41 reply

Reviews trailers per patch

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

Read the v1 thread

Cover letter [PATCH net 0/2] net: bridge: vlan: fix memory leak & null pointer deref

Hi,
These are two issues I found while reworking the bridge vlan fast-path. I need to fix them before I can post my larger patch-sets because they will make these bugs more visible and easy to trigger.

Patch 01 fixes memory leaks on the vlan flush path (teardown). These have existed since I converted the VLAN code to use rhashtables, but are hard to hit because they require __vlan_vid_del or switch dev error to hit. It is ok to abort vlan deletion when removing a single vlan, but we must free their resources on teardown otherwise they're left dangling.

Patch 02 fixes a NULL pointer deref that is a consequence of patch 01's bug. If the vlan delete fails when removing a bridge device vlan, the error printing will try to dereference the port which is NULL.

Thanks,
Nik

Nikolay Aleksandrov (2):
net: bridge: vlan: fix leaks on switchdev deletion errors
net: bridge: vlan: avoid NULL dereference on flush errors

 net/bridge/br_vlan.c | 31 +++++++++++++++++++------------
 1 file changed, 19 insertions(+), 12 deletions(-)
Signature · 1 line
2.47.3