From: David Miller <davem@davemloft.net>
To: arvid.brodin@alten.se
Cc: netdev@vger.kernel.org, nicolas.dichtel@6wind.com
Subject: Re: [PATCH v2 net] net/hsr: Fix NULL pointer dereference and refcnt bugs when deleting a HSR interface.
Date: Sun, 01 Mar 2015 14:00:51 -0500 (EST) [thread overview]
Message-ID: <20150301.140051.1600529369087381519.davem@davemloft.net> (raw)
In-Reply-To: <54F0D2DB.2020302@alten.se>
From: Arvid Brodin <arvid.brodin@alten.se>
Date: Fri, 27 Feb 2015 21:26:03 +0100
> To repeat:
>
> $ sudo ip link del hsr0
> BUG: unable to handle kernel NULL pointer dereference at 0000000000000018
> IP: [<ffffffff8187f495>] hsr_del_port+0x15/0xa0
> etc...
>
> Bug description:
>
> As part of the hsr master device destruction, hsr_del_port() is called for each of
> the hsr ports. At each such call, the master device is updated regarding features
> and mtu. When the master device is freed before the slave interfaces, master will
> be NULL in hsr_del_port(), which led to a NULL pointer dereference.
>
> Additionally, dev_put() was called on the master device itself in hsr_del_port(),
> causing a refcnt error.
>
> A third bug in the same code path was that the rtnl lock was not taken before
> hsr_del_port() was called as part of hsr_dev_destroy().
>
> The reporter (Nicolas Dichtel) also said: "hsr_netdev_notify() supposes that the
> port will always be available when the notification is for an hsr interface. It's
> wrong. For example, netdev_wait_allrefs() may resend NETDEV_UNREGISTER.". As a
> precaution against this, a check for port == NULL was added in hsr_dev_notify().
>
> Reported-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
> Fixes: 51f3c605318b056a ("net/hsr: Move slave init to hsr_slave.c.")
> Signed-off-by: Arvid Brodin <arvid.brodin@alten.se>
Applied.
prev parent reply other threads:[~2015-03-01 19:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-27 20:26 [PATCH v2 net] net/hsr: Fix NULL pointer dereference and refcnt bugs when deleting a HSR interface Arvid Brodin
2015-03-01 19:00 ` David Miller [this message]
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=20150301.140051.1600529369087381519.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=arvid.brodin@alten.se \
--cc=netdev@vger.kernel.org \
--cc=nicolas.dichtel@6wind.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;
as well as URLs for NNTP newsgroup(s).