From: Dan Carpenter <dan.carpenter@oracle.com>
To: "David S. Miller" <davem@davemloft.net>,
Sabrina Dubroca <sd@queasysnail.net>
Cc: David Ahern <dsahern@gmail.com>,
David Windsor <dwindsor@gmail.com>,
Elena Reshetova <elena.reshetova@intel.com>,
"Jason A. Donenfeld" <Jason@zx2c4.com>,
Matthias Schiffer <mschiffer@universe-factory.net>,
Johannes Berg <johannes.berg@intel.com>,
Felix Walter <felix.walter@cloudandheat.com>,
Girish Moodalbail <girish.moodalbail@oracle.com>,
netdev@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [PATCH] macsec: missing dev_put() on error in macsec_newlink()
Date: Wed, 21 Mar 2018 11:09:01 +0300 [thread overview]
Message-ID: <20180321080900.GA9826@mwanda> (raw)
We moved the dev_hold(real_dev); call earlier in the function but forgot
to update the error paths.
Fixes: 0759e552bce7 ("macsec: fix negative refcnt on parent link")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/net/macsec.c b/drivers/net/macsec.c
index 7de88b33d5b9..9cbb0c8a896a 100644
--- a/drivers/net/macsec.c
+++ b/drivers/net/macsec.c
@@ -3277,7 +3277,7 @@ static int macsec_newlink(struct net *net, struct net_device *dev,
err = netdev_upper_dev_link(real_dev, dev, extack);
if (err < 0)
- goto unregister;
+ goto put_dev;
/* need to be already registered so that ->init has run and
* the MAC addr is set
@@ -3316,7 +3316,8 @@ static int macsec_newlink(struct net *net, struct net_device *dev,
macsec_del_dev(macsec);
unlink:
netdev_upper_dev_unlink(real_dev, dev);
-unregister:
+put_dev:
+ dev_put(real_dev);
unregister_netdevice(dev);
return err;
}
next reply other threads:[~2018-03-21 8:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-21 8:09 Dan Carpenter [this message]
2018-03-22 18:31 ` [PATCH] macsec: missing dev_put() on error in macsec_newlink() David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180321080900.GA9826@mwanda \
--to=dan.carpenter@oracle.com \
--cc=Jason@zx2c4.com \
--cc=davem@davemloft.net \
--cc=dsahern@gmail.com \
--cc=dwindsor@gmail.com \
--cc=elena.reshetova@intel.com \
--cc=felix.walter@cloudandheat.com \
--cc=girish.moodalbail@oracle.com \
--cc=johannes.berg@intel.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=mschiffer@universe-factory.net \
--cc=netdev@vger.kernel.org \
--cc=sd@queasysnail.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox