diff options
Diffstat (limited to 'net/dccp')
-rw-r--r-- | net/dccp/proto.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/net/dccp/proto.c b/net/dccp/proto.c index b03ecf6b2bb0..f79bcef5088f 100644 --- a/net/dccp/proto.c +++ b/net/dccp/proto.c | |||
@@ -473,14 +473,9 @@ static int dccp_setsockopt_ccid(struct sock *sk, int type, | |||
473 | if (optlen < 1 || optlen > DCCP_FEAT_MAX_SP_VALS) | 473 | if (optlen < 1 || optlen > DCCP_FEAT_MAX_SP_VALS) |
474 | return -EINVAL; | 474 | return -EINVAL; |
475 | 475 | ||
476 | val = kmalloc(optlen, GFP_KERNEL); | 476 | val = memdup_user(optval, optlen); |
477 | if (val == NULL) | 477 | if (IS_ERR(val)) |
478 | return -ENOMEM; | 478 | return PTR_ERR(val); |
479 | |||
480 | if (copy_from_user(val, optval, optlen)) { | ||
481 | kfree(val); | ||
482 | return -EFAULT; | ||
483 | } | ||
484 | 479 | ||
485 | lock_sock(sk); | 480 | lock_sock(sk); |
486 | if (type == DCCP_SOCKOPT_TX_CCID || type == DCCP_SOCKOPT_CCID) | 481 | if (type == DCCP_SOCKOPT_TX_CCID || type == DCCP_SOCKOPT_CCID) |