bridge: Fix VLAN reference count problem
authorIdo Schimmel <[email protected]>
Sun, 25 Feb 2018 19:59:06 +0000 (21:59 +0200)
committerDavid S. Miller <[email protected]>
Mon, 26 Feb 2018 20:15:53 +0000 (15:15 -0500)
commit0e5a82efda872c2469c210957d7d4161ef8f4391
tree81ef619461f2efd5c28b05d427b64d6b38e02bca
parent3a291aa11898bc9577c16339f108aac02ba0d109
bridge: Fix VLAN reference count problem

When a VLAN is added on a port, a reference is taken on the
corresponding master VLAN entry. If it does not already exist, then it
is created and a reference taken.

However, in the second case a reference is not really taken when
CONFIG_REFCOUNT_FULL is enabled as refcount_inc() is replaced by
refcount_inc_not_zero().

Fix this by using refcount_set() on a newly created master VLAN entry.

Fixes: 251277598596 ("net, bridge: convert net_bridge_vlan.refcnt from atomic_t to refcount_t")
Signed-off-by: Ido Schimmel <[email protected]>
Acked-by: Nikolay Aleksandrov <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
net/bridge/br_vlan.c