Both copy_to_ and _from_user return the number of bytes, that failed to reach their destination, not the 0/-EXXX values. Based on patch from Pavel Emelyanov <xemul@openvz.org> Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Acked-by: Oliver Hartkopp <oliver.hartkopp@volkswagen.de> Cc: Pavel Emelyanov <xemul@openvz.org> Cc: Wolfgang Grandegger <wg@grandegger.com> --- Hi David.OK - here is a proper patch. Actual patch is the same - I just added a proper changelog. Sam diff --git a/net/can/raw.c b/net/can/raw.c index 201cbfc..69877b8 100644 --- a/net/can/raw.c +++ b/net/can/raw.c @@ -435,15 +435,13 @@ static int raw_setsockopt(struct socket *sock, int level, int optname, if (!filter) return -ENOMEM; - err = copy_from_user(filter, optval, optlen); - if (err) { + if (copy_from_user(filter, optval, optlen)) { kfree(filter); - return err; + return -EFAULT; } } else if (count == 1) { - err = copy_from_user(&sfilter, optval, optlen); - if (err) - return err; + if (copy_from_user(&sfilter, optval, optlen)) + return -EFAULT; } lock_sock(sk); @@ -493,9 +491,8 @@ static int raw_setsockopt(struct socket *sock, int level, int optname, if (optlen != sizeof(err_mask)) return -EINVAL; - err = copy_from_user(&err_mask, optval, optlen); - if (err) - return err; + if (copy_from_user(&err_mask, optval, optlen)) + return -EFAULT; err_mask &= CAN_ERR_MASK; @@ -531,7 +528,8 @@ static int raw_setsockopt(struct socket *sock, int level, int optname, if (optlen != sizeof(ro->loopback)) return -EINVAL; - err = copy_from_user(&ro->loopback, optval, optlen); + if (copy_from_user(&ro->loopback, optval, optlen)) + return -EFAULT; break; @@ -539,7 +537,8 @@ static int raw_setsockopt(struct socket *sock, int level, int optname, if (optlen != sizeof(ro->recv_own_msgs)) return -EINVAL; - err = copy_from_user(&ro->recv_own_msgs, optval, optlen); + if (copy_from_user(&ro->recv_own_msgs, optval, optlen)) + return -EFAULT; break; diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 277cfe0..4a7327b 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -105,7 +105,7 @@ endif # Do section mismatch analysis for each module/built-in.o ifdef CONFIG_DEBUG_SECTION_MISMATCH - cmd_secanalysis = ; scripts/mod/modpost $@ + #cmd_secanalysis = ; scripts/mod/modpost $@ endif # Compile C sources (.c) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
git: | |
| Elijah Newren | Trying to use git-filter-branch to compress history by removing large, obsolete bi... |
| Raimund Bauer | [wishlist] graphical diff |
| Paolo Ciarrocchi | git --version |
| Junio C Hamano | Re: Implementing branch attributes in git config |
| Renato S. Yamane | Error -71 on device descriptor read/all |
| Luke -Jr | Re: bcm33xx port |
| Rik van Riel | [PATCH -mm 00/24] VM pageout scalability improvements (V12) |
| Willy Tarreau | Re: [Announce] [patch] Modular Scheduler Core and Completely Fair Scheduler [CFS] |
| GVG GVG | ssh_exchange_identification: Connection closed by remote host |
| qw er | OpenBSD sucks |
| Predrag Punosevac | Re: cwm keybindings misbehavior |
| Steve B | Intel Atom and D945GCLF2 |
| Jim Winstead Jr. | Re: Root Disk/Book Disk Compatibility |
| C Wayne Huling | Re: Can males come from... |
| David Willmore | Re: Intel, the Pentium and Linux |
| Al Billings | Porting MUDS |
