| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * slip.c This module implements the SLIP protocol for kernel-based |
|---|
| 3 | 4 | * devices like TTY. It interfaces between a raw TTY, and the |
|---|
| .. | .. |
|---|
| 79 | 80 | #include <linux/rtnetlink.h> |
|---|
| 80 | 81 | #include <linux/if_arp.h> |
|---|
| 81 | 82 | #include <linux/if_slip.h> |
|---|
| 82 | | -#include <linux/compat.h> |
|---|
| 83 | 83 | #include <linux/delay.h> |
|---|
| 84 | 84 | #include <linux/init.h> |
|---|
| 85 | 85 | #include <linux/slab.h> |
|---|
| .. | .. |
|---|
| 456 | 456 | |
|---|
| 457 | 457 | rcu_read_lock(); |
|---|
| 458 | 458 | sl = rcu_dereference(tty->disc_data); |
|---|
| 459 | | - if (!sl) |
|---|
| 460 | | - goto out; |
|---|
| 461 | | - |
|---|
| 462 | | - schedule_work(&sl->tx_work); |
|---|
| 463 | | -out: |
|---|
| 459 | + if (sl) |
|---|
| 460 | + schedule_work(&sl->tx_work); |
|---|
| 464 | 461 | rcu_read_unlock(); |
|---|
| 465 | 462 | } |
|---|
| 466 | 463 | |
|---|
| 467 | | -static void sl_tx_timeout(struct net_device *dev) |
|---|
| 464 | +static void sl_tx_timeout(struct net_device *dev, unsigned int txqueue) |
|---|
| 468 | 465 | { |
|---|
| 469 | 466 | struct slip *sl = netdev_priv(dev); |
|---|
| 470 | 467 | |
|---|
| 471 | 468 | spin_lock(&sl->lock); |
|---|
| 472 | 469 | |
|---|
| 473 | 470 | if (netif_queue_stopped(dev)) { |
|---|
| 474 | | - if (!netif_running(dev)) |
|---|
| 471 | + if (!netif_running(dev) || !sl->tty) |
|---|
| 475 | 472 | goto out; |
|---|
| 476 | 473 | |
|---|
| 477 | 474 | /* May be we must check transmitter timeout here ? |
|---|
| .. | .. |
|---|
| 1180 | 1177 | } |
|---|
| 1181 | 1178 | } |
|---|
| 1182 | 1179 | |
|---|
| 1183 | | -#ifdef CONFIG_COMPAT |
|---|
| 1184 | | -static long slip_compat_ioctl(struct tty_struct *tty, struct file *file, |
|---|
| 1185 | | - unsigned int cmd, unsigned long arg) |
|---|
| 1186 | | -{ |
|---|
| 1187 | | - switch (cmd) { |
|---|
| 1188 | | - case SIOCGIFNAME: |
|---|
| 1189 | | - case SIOCGIFENCAP: |
|---|
| 1190 | | - case SIOCSIFENCAP: |
|---|
| 1191 | | - case SIOCSIFHWADDR: |
|---|
| 1192 | | - case SIOCSKEEPALIVE: |
|---|
| 1193 | | - case SIOCGKEEPALIVE: |
|---|
| 1194 | | - case SIOCSOUTFILL: |
|---|
| 1195 | | - case SIOCGOUTFILL: |
|---|
| 1196 | | - return slip_ioctl(tty, file, cmd, |
|---|
| 1197 | | - (unsigned long)compat_ptr(arg)); |
|---|
| 1198 | | - } |
|---|
| 1199 | | - |
|---|
| 1200 | | - return -ENOIOCTLCMD; |
|---|
| 1201 | | -} |
|---|
| 1202 | | -#endif |
|---|
| 1203 | | - |
|---|
| 1204 | 1180 | /* VSV changes start here */ |
|---|
| 1205 | 1181 | #ifdef CONFIG_SLIP_SMART |
|---|
| 1206 | 1182 | /* function do_ioctl called from net/core/dev.c |
|---|
| .. | .. |
|---|
| 1293 | 1269 | .close = slip_close, |
|---|
| 1294 | 1270 | .hangup = slip_hangup, |
|---|
| 1295 | 1271 | .ioctl = slip_ioctl, |
|---|
| 1296 | | -#ifdef CONFIG_COMPAT |
|---|
| 1297 | | - .compat_ioctl = slip_compat_ioctl, |
|---|
| 1298 | | -#endif |
|---|
| 1299 | 1272 | .receive_buf = slip_receive_buf, |
|---|
| 1300 | 1273 | .write_wakeup = slip_write_wakeup, |
|---|
| 1301 | 1274 | }; |
|---|