aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn/pcbit
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2006-10-17 03:10:40 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-17 11:18:49 -0400
commit7786ce192fc4917fb9b789dd823476ff8fd6cf66 (patch)
tree3ec803c1c77ff22bfe6076ea4d90a27f888b4fad /drivers/isdn/pcbit
parent04518bfe8eac2e82b476fb2b0093527adc2bc791 (diff)
[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.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/drivers/isdn/pcbit/drv.c b/drivers/isdn/pcbit/drv.c
index 94f21486bb24..6ead5e1508b7 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)
725 725
726 if (stat_st < stat_end) 726 if (stat_st < stat_end)
727 { 727 {
728 copy_to_user(buf, statbuf + stat_st, len); 728 if (copy_to_user(buf, statbuf + stat_st, len))
729 return -EFAULT;
729 stat_st += len; 730 stat_st += len;
730 } 731 }
731 else 732 else
732 { 733 {
733 if (len > STATBUF_LEN - stat_st) 734 if (len > STATBUF_LEN - stat_st)
734 { 735 {
735 copy_to_user(buf, statbuf + stat_st, 736 if (copy_to_user(buf, statbuf + stat_st,
736 STATBUF_LEN - stat_st); 737 STATBUF_LEN - stat_st))
737 copy_to_user(buf, statbuf, 738 return -EFAULT;
738 len - (STATBUF_LEN - stat_st)); 739 if (copy_to_user(buf, statbuf,
740 len - (STATBUF_LEN - stat_st)))
741 return -EFAULT;
739 742
740 stat_st = len - (STATBUF_LEN - stat_st); 743 stat_st = len - (STATBUF_LEN - stat_st);
741 } 744 }
742 else 745 else
743 { 746 {
744 copy_to_user(buf, statbuf + stat_st, len); 747 if (copy_to_user(buf, statbuf + stat_st, len))
748 return -EFAULT;
745 749
746 stat_st += len; 750 stat_st += len;
747 751