From: Sasha Levin <levinsasha928@gmail.com>
To: "Sjur Brændeland" <sjurbren@gmail.com>
Cc: davem@davemloft.net, davej@redhat.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] net: caif: Don't act on notification for non-caif devices
Date: Tue, 24 Jan 2012 09:49:21 -0500 [thread overview]
Message-ID: <1327416561.32498.10.camel@lappy> (raw)
In-Reply-To: <CAJK669acbPLTxTDrk_uqdB2FmewcSA+HF0qEFADgT8YdfNMcpQ@mail.gmail.com>
On Tue, 2012-01-24 at 11:52 +0100, Sjur Brændeland wrote:
>
> Nack, we have to handle other device types than just ARPHDR_CAIF after
> introducing
> CAIF over USB/NCM. I'd rather fix this in netns by removing the BUG_ON
> and return
> NULL. How about this instead:
[snip]
I think that doing it this way is wrong for two reasons:
1. The code in net/ assumes net_generic is a trivial dereference and doesn't check that it's not NULL. This means that if anything goes wrong there you'll have a more dangerous NULL deref instead of a BUG().
2. You'll need to add other device to that if() statement anyway, as it currently looks like this:
cfg = get_cfcnfg(dev_net(dev));
caifdevs = caif_device_list(dev_net(dev));
if (!cfg || !caifdevs)
return 0;
caifd = caif_get(dev);
if (caifd == NULL && dev->type != ARPHRD_CAIF)
return 0;
What my patch did was simply move the type check to above the net_generic call, it didn't add any new checks - which according to what you said, you'll need to do anyway.
--
Sasha.
next prev parent reply other threads:[~2012-01-24 12:49 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-24 7:30 [PATCH] net: caif: Don't act on notification for non-caif devices Sasha Levin
2012-01-24 10:52 ` Sjur Brændeland
2012-01-24 14:49 ` Sasha Levin [this message]
2012-01-24 15:06 ` Sjur Brændeland
2012-01-24 15:23 ` Sasha Levin
2012-01-24 22:27 ` [PATCH net] caif: Fix crash due to uninitialized net name-space Sjur Brændeland
2012-01-24 22:44 ` David Miller
2012-01-25 16:13 ` Sasha Levin
2012-01-25 20:33 ` Sjur Brændeland
2012-01-26 6:14 ` Eric Dumazet
2012-01-26 10:41 ` [PATCH] netns: fix net_alloc_generic() Eric Dumazet
2012-01-26 10:44 ` Pavel Emelyanov
2012-01-26 10:51 ` Eric Dumazet
2012-01-26 22:57 ` Eric W. Biederman
2012-01-26 23:07 ` David Miller
2012-01-26 23:57 ` Eric W. Biederman
2012-01-27 0:02 ` [PATCH 1/2] netns: Fail conspicously if someone uses net_generic at an inappropriate time Eric W. Biederman
2012-01-27 0:04 ` [PATCH 2/2] net caif: Register properly as a pernet subsystem Eric W. Biederman
2012-01-27 13:24 ` Sasha Levin
2012-01-27 14:48 ` Sjur BRENDELAND
2012-01-28 2:07 ` David Miller
2012-01-28 2:07 ` [PATCH 1/2] netns: Fail conspicously if someone uses net_generic at an inappropriate time David Miller
2012-01-27 6:09 ` [PATCH] netns: fix net_alloc_generic() Eric Dumazet
2012-01-27 6:54 ` Eric W. Biederman
2012-01-27 7:07 ` Eric Dumazet
2012-01-26 14:40 ` Sasha Levin
2012-01-26 18: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=1327416561.32498.10.camel@lappy \
--to=levinsasha928@gmail.com \
--cc=davej@redhat.com \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=sjurbren@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.