From: Wang Chen <wangchen@cn.fujitsu.com>
To: julia@diku.dk
Cc: Jarek Poplawski <jarkao2@gmail.com>,
David Miller <davem@davemloft.net>,
netdev@vger.kernel.org
Subject: Re: [PATCH] net: Fix oops in dev_ifsioc()
Date: Fri, 19 Dec 2008 16:02:51 +0800 [thread overview]
Message-ID: <494B552B.1010602@cn.fujitsu.com> (raw)
In-Reply-To: <20081219070431.GA7189@ff.dom.local>
Jarek Poplawski said the following on 2008-12-19 15:04:
> A command like this: "brctl addif br1 eth1" issued as a user gave me
> an oops when bridge module wasn't loaded. It's caused by using a dev
> pointer before checking for NULL.
>
> Signed-off-by: Jarek Poplawski <jarkao2@gmail.com>
> ---
>
> net/core/dev.c | 4 +++-
> 1 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 048cf11..daca72e 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -3745,11 +3745,13 @@ static int dev_ifsioc(struct net *net, struct ifreq *ifr, unsigned int cmd)
> {
> int err;
> struct net_device *dev = __dev_get_by_name(net, ifr->ifr_name);
> - const struct net_device_ops *ops = dev->netdev_ops;
> + const struct net_device_ops *ops;
>
> if (!dev)
> return -ENODEV;
>
> + ops = dev->netdev_ops;
> +
> switch (cmd) {
> case SIOCSIFFLAGS: /* Set interface flags */
> return dev_change_flags(dev, ifr->ifr_flags);
Subject will be changed, sorry.
Seems Julia is doing "Move a dereference below a NULL test" check,
but why the coccinelle missed this one?
next prev parent reply other threads:[~2008-12-19 8:03 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-19 7:04 [PATCH] net: Fix oops in dev_ifsioc() Jarek Poplawski
2008-12-19 8:02 ` Wang Chen [this message]
2008-12-19 8:11 ` Jarek Poplawski
2008-12-19 8:14 ` Wang Chen
2008-12-19 8:33 ` Julia Lawall
2008-12-23 3:35 ` 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=494B552B.1010602@cn.fujitsu.com \
--to=wangchen@cn.fujitsu.com \
--cc=davem@davemloft.net \
--cc=jarkao2@gmail.com \
--cc=julia@diku.dk \
--cc=netdev@vger.kernel.org \
/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).