patch-1.3.13 linux/drivers/net/ppp.c

Next file: linux/drivers/scsi/ChangeLog
Previous file: linux/drivers/char/psaux.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v1.3.12/linux/drivers/net/ppp.c linux/drivers/net/ppp.c
@@ -1268,6 +1268,12 @@
         } else goto wait;
       }
 
+      i = verify_area (VERIFY_WRITE,buf,nr);
+      if (i != 0) {
+	ppp->us_rbuff_lock = 0;
+	return i;
+      }
+
       /* reset the time of the last read operation */
       ppp->ddinfo.nip_rjiffies = jiffies;
 
@@ -1309,6 +1315,12 @@
     current->timeout = 0;
     PRINTKN (3,(KERN_DEBUG "ppp_read: sleeping\n"));
     interruptible_sleep_on (&ppp->read_wait);
+
+    /* Ensure that the ppp device is still attached. */
+    ppp = ppp_find(tty);
+    if (!ppp || ppp->magic != PPP_MAGIC || !ppp->inuse)
+      return 0;
+      
     if (current->signal & ~current->blocked)
       return -EINTR;
   } while (1);
@@ -1360,6 +1372,10 @@
     nr = ppp->mtu;
   }
 
+  i = verify_area (VERIFY_READ,buf,nr);
+  if (i != 0)
+    return i;
+
   if (ppp_debug >= 3)
     ppp_print_buffer ("write frame", buf, nr, USER_DS);
 
@@ -1369,6 +1385,12 @@
     current->timeout = 0;
     PRINTKN (3,(KERN_DEBUG "ppp_write: sleeping\n"));
     interruptible_sleep_on(&ppp->write_wait);
+
+    /* Ensure that the ppp device is still attached. */
+    ppp = ppp_find(tty);
+    if (!ppp || ppp->magic != PPP_MAGIC || !ppp->inuse)
+      return 0;
+
     if (current->signal & ~current->blocked)
       return -EINTR;
   }

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov with Sam's (original) version
of this