diff options
author | Jarek Poplawski <jarkao2@gmail.com> | 2008-12-22 22:35:28 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-12-22 22:35:28 -0500 |
commit | 5f2f6da76c429c42d54f73807f00b8fd761a7d68 (patch) | |
tree | 20cabaf277e2e95df669c4e9ee6968067b096dc0 /net | |
parent | d3d317092b58a6df1d31a4ca90cdb9d2bd4ebffa (diff) |
net: Fix oops in dev_ifsioc()
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | 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 048cf1197872..daca72e6b37b 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) | |||
3745 | { | 3745 | { |
3746 | int err; | 3746 | int err; |
3747 | struct net_device *dev = __dev_get_by_name(net, ifr->ifr_name); | 3747 | struct net_device *dev = __dev_get_by_name(net, ifr->ifr_name); |
3748 | const struct net_device_ops *ops = dev->netdev_ops; | 3748 | const struct net_device_ops *ops; |
3749 | 3749 | ||
3750 | if (!dev) | 3750 | if (!dev) |
3751 | return -ENODEV; | 3751 | return -ENODEV; |
3752 | 3752 | ||
3753 | ops = dev->netdev_ops; | ||
3754 | |||
3753 | switch (cmd) { | 3755 | switch (cmd) { |
3754 | case SIOCSIFFLAGS: /* Set interface flags */ | 3756 | case SIOCSIFFLAGS: /* Set interface flags */ |
3755 | return dev_change_flags(dev, ifr->ifr_flags); | 3757 | return dev_change_flags(dev, ifr->ifr_flags); |