Messages in this thread | | | Subject | Re: [PATCH] net: caif: Don't act on notification for non-caif devices | From | Sasha Levin <> | Date | Tue, 24 Jan 2012 09:49:21 -0500 |
| |
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.
-- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |