Skip to content

Commit 0759e55

Browse files
qsndavem330
authored andcommitted
macsec: fix negative refcnt on parent link
When creation of a macsec device fails because an identical device already exists on this link, the current code decrements the refcnt on the parent link (in ->destructor for the macsec device), but it had not been incremented yet. Move the dev_hold(parent_link) call earlier during macsec device creation. Fixes: c09440f ("macsec: introduce IEEE 802.1AE driver") Signed-off-by: Sabrina Dubroca <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 36b232c commit 0759e55

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/net/macsec.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3179,6 +3179,8 @@ static int macsec_newlink(struct net *net, struct net_device *dev,
31793179
if (err < 0)
31803180
return err;
31813181

3182+
dev_hold(real_dev);
3183+
31823184
/* need to be already registered so that ->init has run and
31833185
* the MAC addr is set
31843186
*/
@@ -3207,8 +3209,6 @@ static int macsec_newlink(struct net *net, struct net_device *dev,
32073209

32083210
macsec_generation++;
32093211

3210-
dev_hold(real_dev);
3211-
32123212
return 0;
32133213

32143214
del_dev:

0 commit comments

Comments
 (0)