diff options
author | Jeff Garzik <jeff@garzik.org> | 2006-10-17 00:10:40 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-17 08:18:49 -0700 |
commit | 7786ce192fc4917fb9b789dd823476ff8fd6cf66 (patch) | |
tree | 3ec803c1c77ff22bfe6076ea4d90a27f888b4fad /drivers/isdn/pcbit | |
parent | 04518bfe8eac2e82b476fb2b0093527adc2bc791 (diff) | |
download | kernel_samsung_smdk4412-7786ce192fc4917fb9b789dd823476ff8fd6cf66.zip kernel_samsung_smdk4412-7786ce192fc4917fb9b789dd823476ff8fd6cf66.tar.gz kernel_samsung_smdk4412-7786ce192fc4917fb9b789dd823476ff8fd6cf66.tar.bz2 |
[PATCH] ISDN: check for userspace copy faults
Most of the ISDN ->readstat() implementations needed to check
copy_to_user() and put_user() return values.
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Cc: Karsten Keil <kkeil@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/isdn/pcbit')
-rw-r--r-- | drivers/isdn/pcbit/drv.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/drivers/isdn/pcbit/drv.c b/drivers/isdn/pcbit/drv.c index 94f2148..6ead5e1 100644 --- a/drivers/isdn/pcbit/drv.c +++ b/drivers/isdn/pcbit/drv.c @@ -725,23 +725,27 @@ static int pcbit_stat(u_char __user *buf, int len, int driver, int channel) if (stat_st < stat_end) { - copy_to_user(buf, statbuf + stat_st, len); + if (copy_to_user(buf, statbuf + stat_st, len)) + return -EFAULT; stat_st += len; } else { if (len > STATBUF_LEN - stat_st) { - copy_to_user(buf, statbuf + stat_st, - STATBUF_LEN - stat_st); - copy_to_user(buf, statbuf, - len - (STATBUF_LEN - stat_st)); + if (copy_to_user(buf, statbuf + stat_st, + STATBUF_LEN - stat_st)) + return -EFAULT; + if (copy_to_user(buf, statbuf, + len - (STATBUF_LEN - stat_st))) + return -EFAULT; stat_st = len - (STATBUF_LEN - stat_st); } else { - copy_to_user(buf, statbuf + stat_st, len); + if (copy_to_user(buf, statbuf + stat_st, len)) + return -EFAULT; stat_st += len; |