diff options
Diffstat (limited to 'net/core/dev_ioctl.c')
| -rw-r--r-- | net/core/dev_ioctl.c | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/net/core/dev_ioctl.c b/net/core/dev_ioctl.c index 6cc0481faade..5b7d0e1d0664 100644 --- a/net/core/dev_ioctl.c +++ b/net/core/dev_ioctl.c | |||
| @@ -19,9 +19,8 @@ | |||
| 19 | 19 | ||
| 20 | static int dev_ifname(struct net *net, struct ifreq __user *arg) | 20 | static int dev_ifname(struct net *net, struct ifreq __user *arg) |
| 21 | { | 21 | { |
| 22 | struct net_device *dev; | ||
| 23 | struct ifreq ifr; | 22 | struct ifreq ifr; |
| 24 | unsigned seq; | 23 | int error; |
| 25 | 24 | ||
| 26 | /* | 25 | /* |
| 27 | * Fetch the caller's info block. | 26 | * Fetch the caller's info block. |
| @@ -30,19 +29,9 @@ static int dev_ifname(struct net *net, struct ifreq __user *arg) | |||
| 30 | if (copy_from_user(&ifr, arg, sizeof(struct ifreq))) | 29 | if (copy_from_user(&ifr, arg, sizeof(struct ifreq))) |
| 31 | return -EFAULT; | 30 | return -EFAULT; |
| 32 | 31 | ||
| 33 | retry: | 32 | error = netdev_get_name(net, ifr.ifr_name, ifr.ifr_ifindex); |
| 34 | seq = read_seqcount_begin(&devnet_rename_seq); | 33 | if (error) |
| 35 | rcu_read_lock(); | 34 | return error; |
| 36 | dev = dev_get_by_index_rcu(net, ifr.ifr_ifindex); | ||
| 37 | if (!dev) { | ||
| 38 | rcu_read_unlock(); | ||
| 39 | return -ENODEV; | ||
| 40 | } | ||
| 41 | |||
| 42 | strcpy(ifr.ifr_name, dev->name); | ||
| 43 | rcu_read_unlock(); | ||
| 44 | if (read_seqcount_retry(&devnet_rename_seq, seq)) | ||
| 45 | goto retry; | ||
| 46 | 35 | ||
| 47 | if (copy_to_user(arg, &ifr, sizeof(struct ifreq))) | 36 | if (copy_to_user(arg, &ifr, sizeof(struct ifreq))) |
| 48 | return -EFAULT; | 37 | return -EFAULT; |
