patch-2.1.10 linux/net/ipv4/packet.c
Next file: linux/net/ipv4/rarp.c
Previous file: linux/net/ipv4/ipmr.c
Back to the patch index
Back to the overall index
- Lines: 63
- Date:
Thu Nov 14 18:26:17 1996
- Orig file:
v2.1.9/linux/net/ipv4/packet.c
- Orig date:
Sun Nov 10 20:12:29 1996
diff -u --recursive --new-file v2.1.9/linux/net/ipv4/packet.c linux/net/ipv4/packet.c
@@ -120,7 +120,8 @@
struct device *dev;
struct sockaddr_pkt *saddr=(struct sockaddr_pkt *)msg->msg_name;
unsigned short proto=0;
-
+ int err;
+
/*
* Check the flags.
*/
@@ -180,18 +181,33 @@
skb->sk = sk;
skb->free = 1;
- memcpy_fromiovec(skb_put(skb,len), msg->msg_iov, len);
- skb->arp = 1; /* No ARP needs doing on this (complete) frame */
+ err = memcpy_fromiovec(skb_put(skb,len), msg->msg_iov, len);
+ skb->arp = 1; /* No ARP needs doing on this (complete) frame */
skb->protocol = proto;
/*
* Now send it
*/
- if (dev->flags & IFF_UP)
- dev_queue_xmit(skb, dev, sk->priority);
+ if (err)
+ {
+ err = -EFAULT;
+ }
else
+ {
+ if (!(dev->flags & IFF_UP))
+ {
+ err = -ENODEV;
+ }
+ }
+
+ if (err)
+ {
kfree_skb(skb, FREE_WRITE);
+ return err;
+ }
+
+ dev_queue_xmit(skb, dev, sk->priority);
return(len);
}
@@ -436,7 +452,13 @@
copied = min(len, skb->len);
- memcpy_toiovec(msg->msg_iov, skb->data, copied); /* We can't use skb_copy_datagram here */
+ /* We can't use skb_copy_datagram here */
+ err = memcpy_toiovec(msg->msg_iov, skb->data, copied);
+ if (err)
+ {
+ return -EFAULT;
+ }
+
sk->stamp=skb->stamp;
/*
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov