Commit 5f2f6da7 authored by Jarek Poplawski's avatar Jarek Poplawski Committed by David S. Miller

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: default avatarJarek Poplawski <jarkao2@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d3d31709
...@@ -3745,11 +3745,13 @@ static int dev_ifsioc(struct net *net, struct ifreq *ifr, unsigned int cmd) ...@@ -3745,11 +3745,13 @@ static int dev_ifsioc(struct net *net, struct ifreq *ifr, unsigned int cmd)
{ {
int err; int err;
struct net_device *dev = __dev_get_by_name(net, ifr->ifr_name); 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) if (!dev)
return -ENODEV; return -ENODEV;
ops = dev->netdev_ops;
switch (cmd) { switch (cmd) {
case SIOCSIFFLAGS: /* Set interface flags */ case SIOCSIFFLAGS: /* Set interface flags */
return dev_change_flags(dev, ifr->ifr_flags); return dev_change_flags(dev, ifr->ifr_flags);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment