aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSabrina Dubroca <sd@queasysnail.net>2016-07-29 09:37:55 -0400
committerDavid S. Miller <davem@davemloft.net>2016-07-31 00:11:08 -0400
commit0759e552bce7257db542e203a01a9ef8843c751e (patch)
tree93c36c2d45305788c3c869bd9d636dbaaa3a70f7
parent36b232c880c99fc03e135198c7c08d3d4b4f83ab (diff)
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: c09440f7dcb3 ("macsec: introduce IEEE 802.1AE driver") Signed-off-by: Sabrina Dubroca <sd@queasysnail.net> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/macsec.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/net/macsec.c b/drivers/net/macsec.c
index 7f5c5e0f9cf9..d13e6e15d7b5 100644
--- a/drivers/net/macsec.c
+++ b/drivers/net/macsec.c
@@ -3179,6 +3179,8 @@ static int macsec_newlink(struct net *net, struct net_device *dev,
3179 if (err < 0) 3179 if (err < 0)
3180 return err; 3180 return err;
3181 3181
3182 dev_hold(real_dev);
3183
3182 /* need to be already registered so that ->init has run and 3184 /* need to be already registered so that ->init has run and
3183 * the MAC addr is set 3185 * the MAC addr is set
3184 */ 3186 */
@@ -3207,8 +3209,6 @@ static int macsec_newlink(struct net *net, struct net_device *dev,
3207 3209
3208 macsec_generation++; 3210 macsec_generation++;
3209 3211
3210 dev_hold(real_dev);
3211
3212 return 0; 3212 return 0;
3213 3213
3214del_dev: 3214del_dev: