diff options
Diffstat (limited to 'net/dccp/proto.c')
-rw-r--r-- | net/dccp/proto.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/net/dccp/proto.c b/net/dccp/proto.c index 9bda2868eba6..a1cfd0e9e3bc 100644 --- a/net/dccp/proto.c +++ b/net/dccp/proto.c | |||
@@ -325,12 +325,7 @@ int dccp_getsockopt(struct sock *sk, int level, int optname, | |||
325 | if (get_user(len, optlen)) | 325 | if (get_user(len, optlen)) |
326 | return -EFAULT; | 326 | return -EFAULT; |
327 | 327 | ||
328 | if (optname == DCCP_SOCKOPT_SERVICE) | 328 | if (len < sizeof(int)) |
329 | return dccp_getsockopt_service(sk, len, | ||
330 | (u32 __user *)optval, optlen); | ||
331 | |||
332 | len = min_t(unsigned int, len, sizeof(int)); | ||
333 | if (len < 0) | ||
334 | return -EINVAL; | 329 | return -EINVAL; |
335 | 330 | ||
336 | dp = dccp_sk(sk); | 331 | dp = dccp_sk(sk); |
@@ -338,7 +333,17 @@ int dccp_getsockopt(struct sock *sk, int level, int optname, | |||
338 | switch (optname) { | 333 | switch (optname) { |
339 | case DCCP_SOCKOPT_PACKET_SIZE: | 334 | case DCCP_SOCKOPT_PACKET_SIZE: |
340 | val = dp->dccps_packet_size; | 335 | val = dp->dccps_packet_size; |
336 | len = sizeof(dp->dccps_packet_size); | ||
341 | break; | 337 | break; |
338 | case DCCP_SOCKOPT_SERVICE: | ||
339 | return dccp_getsockopt_service(sk, len, | ||
340 | (u32 __user *)optval, optlen); | ||
341 | case 128 ... 191: | ||
342 | return ccid_hc_rx_getsockopt(dp->dccps_hc_rx_ccid, sk, optname, | ||
343 | len, (u32 __user *)optval, optlen); | ||
344 | case 192 ... 255: | ||
345 | return ccid_hc_tx_getsockopt(dp->dccps_hc_tx_ccid, sk, optname, | ||
346 | len, (u32 __user *)optval, optlen); | ||
342 | default: | 347 | default: |
343 | return -ENOPROTOOPT; | 348 | return -ENOPROTOOPT; |
344 | } | 349 | } |