patch-2.1.10 linux/net/netlink.c
Next file: linux/net/socket.c
Previous file: linux/net/ipx/af_ipx.c
Back to the patch index
Back to the overall index
- Lines: 36
- Date:
Thu Nov 14 18:26:16 1996
- Orig file:
v2.1.9/linux/net/netlink.c
- Orig date:
Sun Nov 10 20:12:31 1996
diff -u --recursive --new-file v2.1.9/linux/net/netlink.c linux/net/netlink.c
@@ -85,12 +85,13 @@
static long netlink_write(struct inode * inode, struct file * file,
const char * buf, unsigned long count)
{
+ int err;
unsigned int minor = MINOR(inode->i_rdev);
struct sk_buff *skb;
skb=alloc_skb(count, GFP_KERNEL);
skb->free=1;
- copy_from_user(skb_put(skb,count),buf, count);
- return (netlink_handler[minor])(skb);
+ err = copy_from_user(skb_put(skb,count),buf, count);
+ return err ? -EFAULT : (netlink_handler[minor])(skb);
}
/*
@@ -100,6 +101,7 @@
static long netlink_read(struct inode * inode, struct file * file, char * buf,
unsigned long count)
{
+ int err;
unsigned int minor = MINOR(inode->i_rdev);
struct sk_buff *skb;
cli();
@@ -121,9 +123,9 @@
sti();
if(skb->len<count)
count=skb->len;
- copy_to_user(buf,skb->data,count);
+ err = copy_to_user(buf,skb->data,count);
kfree_skb(skb, FREE_READ);
- return count;
+ return err ? -EFAULT : count;
}
static loff_t netlink_lseek(struct inode * inode, struct file * file,
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov