aboutsummaryrefslogtreecommitdiffstats
path: root/net/can/raw.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-04-28 12:44:11 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-28 12:44:11 -0400
commit77a50df2b14c8d3ee3c58c21c4a0e0157570df09 (patch)
tree0e324a712e5e768c8353b0b5ba6ddc31095479f0 /net/can/raw.c
parent96fffeb4b413a4f8f65bb627d59b7dfc97ea0b39 (diff)
parent358c12953b88c5a06a57c33eb27c753b2e7934d1 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: iwlwifi: Allow building iwl3945 without iwl4965. wireless: Fix compile error with wifi & leds tcp: Fix slab corruption with ipv6 and tcp6fuzz ipv4/ipv6 compat: Fix SSM applications on 64bit kernels. [IPSEC]: Use digest_null directly for auth sunrpc: fix missing kernel-doc can: Fix copy_from_user() results interpretation Revert "ipv6: Fix typo in net/ipv6/Kconfig" tipc: endianness annotations ipv6: result of csum_fold() is already 16bit, no need to cast [XFRM] AUDIT: Fix flowlabel text format ambibuity.
Diffstat (limited to 'net/can/raw.c')
-rw-r--r--net/can/raw.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/net/can/raw.c b/net/can/raw.c
index 201cbfc6b9ec..69877b8e7e9c 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,
435 if (!filter) 435 if (!filter)
436 return -ENOMEM; 436 return -ENOMEM;
437 437
438 err = copy_from_user(filter, optval, optlen); 438 if (copy_from_user(filter, optval, optlen)) {
439 if (err) {
440 kfree(filter); 439 kfree(filter);
441 return err; 440 return -EFAULT;
442 } 441 }
443 } else if (count == 1) { 442 } else if (count == 1) {
444 err = copy_from_user(&sfilter, optval, optlen); 443 if (copy_from_user(&sfilter, optval, optlen))
445 if (err) 444 return -EFAULT;
446 return err;
447 } 445 }
448 446
449 lock_sock(sk); 447 lock_sock(sk);
@@ -493,9 +491,8 @@ static int raw_setsockopt(struct socket *sock, int level, int optname,
493 if (optlen != sizeof(err_mask)) 491 if (optlen != sizeof(err_mask))
494 return -EINVAL; 492 return -EINVAL;
495 493
496 err = copy_from_user(&err_mask, optval, optlen); 494 if (copy_from_user(&err_mask, optval, optlen))
497 if (err) 495 return -EFAULT;
498 return err;
499 496
500 err_mask &= CAN_ERR_MASK; 497 err_mask &= CAN_ERR_MASK;
501 498
@@ -531,7 +528,8 @@ static int raw_setsockopt(struct socket *sock, int level, int optname,
531 if (optlen != sizeof(ro->loopback)) 528 if (optlen != sizeof(ro->loopback))
532 return -EINVAL; 529 return -EINVAL;
533 530
534 err = copy_from_user(&ro->loopback, optval, optlen); 531 if (copy_from_user(&ro->loopback, optval, optlen))
532 return -EFAULT;
535 533
536 break; 534 break;
537 535
@@ -539,7 +537,8 @@ static int raw_setsockopt(struct socket *sock, int level, int optname,
539 if (optlen != sizeof(ro->recv_own_msgs)) 537 if (optlen != sizeof(ro->recv_own_msgs))
540 return -EINVAL; 538 return -EINVAL;
541 539
542 err = copy_from_user(&ro->recv_own_msgs, optval, optlen); 540 if (copy_from_user(&ro->recv_own_msgs, optval, optlen))
541 return -EFAULT;
543 542
544 break; 543 break;
545 544