From: Eric Dumazet <eric.dumazet@gmail.com>
To: Tom Parkin <tom.parkin@gmail.com>, David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Subject: Re: BUG: NULL pointer dereference in netif_carrier_off
Date: Thu, 10 Jan 2013 10:32:45 -0800 [thread overview]
Message-ID: <1357842765.27446.2396.camel@edumazet-glaptop> (raw)
In-Reply-To: <1357840590.27446.2331.camel@edumazet-glaptop>
From: Eric Dumazet <edumazet@google.com>
On Thu, 2013-01-10 at 09:56 -0800, Eric Dumazet wrote:
>
> Hi Tom, thanks for the report, I'll take a look.
Oh well, fix seems straightforward...
Thanks !
[PATCH net-next] veth: fix a NULL deref in netif_carrier_off
In commit d0e2c55e7c94 (veth: avoid a NULL deref in veth_stats_one)
we now clear the peer pointers in veth_dellink()
veth_close() must therefore make sure the peer pointer is set.
Reported-by: Tom Parkin <tom.parkin@gmail.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
---
drivers/net/veth.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index 0f71a4f..e1da42a 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -206,9 +206,11 @@ static int veth_open(struct net_device *dev)
static int veth_close(struct net_device *dev)
{
struct veth_priv *priv = netdev_priv(dev);
+ struct net_device *peer = rtnl_dereference(priv->peer);
netif_carrier_off(dev);
- netif_carrier_off(rtnl_dereference(priv->peer));
+ if (peer)
+ netif_carrier_off(peer);
return 0;
}
next prev parent reply other threads:[~2013-01-10 18:32 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-10 17:50 BUG: NULL pointer dereference in netif_carrier_off Tom Parkin
2013-01-10 17:56 ` Eric Dumazet
2013-01-10 18:32 ` Eric Dumazet [this message]
2013-01-10 22:37 ` 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=1357842765.27446.2396.camel@edumazet-glaptop \
--to=eric.dumazet@gmail.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=tom.parkin@gmail.com \
/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