Skip to content

Commit 1020ce3

Browse files
Nikolay Aleksandrovdavem330
authored andcommitted
net: bridge: fix a null pointer dereference in br_afspec
We might call br_afspec() with p == NULL which is a valid use case if the action is on the bridge device itself, but the bridge tunnel code dereferences the p pointer without checking, so check if p is null first. Reported-by: Gustavo A. R. Silva <[email protected]> Fixes: efa5356 ("bridge: per vlan dst_metadata netlink support") Signed-off-by: Nikolay Aleksandrov <[email protected]> Acked-by: Roopa Prabhu <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 79514ef commit 1020ce3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/bridge/br_netlink.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@ static int br_afspec(struct net_bridge *br,
595595
err = 0;
596596
switch (nla_type(attr)) {
597597
case IFLA_BRIDGE_VLAN_TUNNEL_INFO:
598-
if (!(p->flags & BR_VLAN_TUNNEL))
598+
if (!p || !(p->flags & BR_VLAN_TUNNEL))
599599
return -EINVAL;
600600
err = br_parse_vlan_tunnel_info(attr, &tinfo_curr);
601601
if (err)

0 commit comments

Comments
 (0)