]> git.hungrycats.org Git - linux/commitdiff
[PATCH] janitor: skfddi copy*user fixes
authorRandy Dunlap <rddunlap@osdl.org>
Sat, 6 Sep 2003 07:34:44 +0000 (00:34 -0700)
committerLinus Torvalds <torvalds@home.osdl.org>
Sat, 6 Sep 2003 07:34:44 +0000 (00:34 -0700)
From: Daniele Bellucci <bellucda@tiscali.it>

This patch audits some copy_from/to_user in the SysKonnect FDDI device
driver.

drivers/net/skfp/skfddi.c

index 79c3a0f2b93559ec5ceec1a135e51d60ae7af380..d72e5442eaa497bc537a62b8363af2f5a5085eef 100644 (file)
@@ -56,6 +56,8 @@
  *             12-Nov-99       CG      Source code release
  *             22-Nov-99       CG      Included in kernel source.
  *             07-May-00       DM      64 bit fixes, new dma interface
+ *             31-Jul-03       DB      Audit copy_*_user in skfp_ioctl
+ *                                       Daniele Bellucci <bellucda@tiscali.it>
  *
  * Compilation options (-Dxxx):
  *              DRIVERDEBUG     print lots of messages to log file
@@ -1266,11 +1268,13 @@ static int skfp_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
        struct s_skfp_ioctl ioc;
        int status = 0;
 
-       copy_from_user(&ioc, rq->ifr_data, sizeof(struct s_skfp_ioctl));
+       if (copy_from_user(&ioc, rq->ifr_data, sizeof(struct s_skfp_ioctl)))
+               return -EFAULT;
        switch (ioc.cmd) {
        case SKFP_GET_STATS:    /* Get the driver statistics */
                ioc.len = sizeof(lp->MacStat);
-               copy_to_user(ioc.data, skfp_ctl_get_stats(dev), ioc.len);
+               status = copy_to_user(ioc.data, skfp_ctl_get_stats(dev), ioc.len)
+                               ? -EFAULT : 0;
                break;
        case SKFP_CLR_STATS:    /* Zero out the driver statistics */
                if (!capable(CAP_NET_ADMIN)) {