summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornorly <ny-git@enpas.org>2019-01-24 03:44:04 +0100
committernorly <ny-git@enpas.org>2019-01-30 23:47:28 +0100
commit0c43d063bbf3d1e06e2ab710f62ab9d0ae7fc3df (patch)
tree02070fb19be0d379d6de8bbb6dbc74536a0b424e
parente8b36f064bc8c312a7714f200d41dd03038fc4a9 (diff)
elmcan_ldisc_ioctl(): Use elm->dev->name again
We now have proper locking, so dev->name is guaranteed to exist.
-rw-r--r--module/elmcan.c19
1 files changed, 2 insertions, 17 deletions
diff --git a/module/elmcan.c b/module/elmcan.c
index b3dc70c..6ae5297 100644
--- a/module/elmcan.c
+++ b/module/elmcan.c
@@ -81,8 +81,6 @@ struct elmcan {
struct tty_struct *tty;
struct net_device *dev;
- char ifname[IFNAMSIZ];
-
/* Per-channel lock */
spinlock_t lock;
@@ -709,18 +707,6 @@ static void elm327_parse_rxbuf(struct elmcan *elm)
* (takes elm->lock) *
************************************************************************/
-static int elmcan_netdev_init(struct net_device *dev)
-{
- struct elmcan *elm = netdev_priv(dev);
-
- /* Copy the interface name here, so the SIOCGIFNAME case in
- * elmcan_ldisc_ioctl() doesn't race against unregister_candev().
- */
- memcpy(elm->ifname, dev->name, IFNAMSIZ);
-
- return 0;
-}
-
/* Netdevice DOWN -> UP routine */
static int elmcan_netdev_open(struct net_device *dev)
{
@@ -828,7 +814,6 @@ static int elmcan_netdev_change_mtu(struct net_device *dev, int new_mtu)
}
static const struct net_device_ops elmcan_netdev_ops = {
- .ndo_init = elmcan_netdev_init,
.ndo_open = elmcan_netdev_open,
.ndo_stop = elmcan_netdev_close,
.ndo_start_xmit = elmcan_netdev_start_xmit,
@@ -1138,8 +1123,8 @@ static int elmcan_ldisc_ioctl(struct tty_struct *tty, struct file *file,
switch (cmd) {
case SIOCGIFNAME:
- tmp = strlen(elm->ifname) + 1;
- if (copy_to_user((void __user *)arg, elm->ifname, tmp)) {
+ tmp = strlen(elm->dev->name) + 1;
+ if (copy_to_user((void __user *)arg, elm->dev->name, tmp)) {
put_elm(elm);
return -EFAULT;
}