diff options
-rw-r--r-- | net/sctp/socket.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index 174d4d35e951..b41dcbb89685 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c | |||
@@ -2530,8 +2530,32 @@ static int sctp_setsockopt_associnfo(struct sock *sk, char __user *optval, int o | |||
2530 | 2530 | ||
2531 | /* Set the values to the specific association */ | 2531 | /* Set the values to the specific association */ |
2532 | if (asoc) { | 2532 | if (asoc) { |
2533 | if (assocparams.sasoc_asocmaxrxt != 0) | 2533 | if (assocparams.sasoc_asocmaxrxt != 0) { |
2534 | __u32 path_sum = 0; | ||
2535 | int paths = 0; | ||
2536 | struct list_head *pos; | ||
2537 | struct sctp_transport *peer_addr; | ||
2538 | |||
2539 | list_for_each(pos, &asoc->peer.transport_addr_list) { | ||
2540 | peer_addr = list_entry(pos, | ||
2541 | struct sctp_transport, | ||
2542 | transports); | ||
2543 | path_sum += peer_addr->pathmaxrxt; | ||
2544 | paths++; | ||
2545 | } | ||
2546 | |||
2547 | /* Only validate asocmaxrxt if we have more then | ||
2548 | * one path/transport. We do this because path | ||
2549 | * retransmissions are only counted when we have more | ||
2550 | * then one path. | ||
2551 | */ | ||
2552 | if (paths > 1 && | ||
2553 | assocparams.sasoc_asocmaxrxt > path_sum) | ||
2554 | return -EINVAL; | ||
2555 | |||
2534 | asoc->max_retrans = assocparams.sasoc_asocmaxrxt; | 2556 | asoc->max_retrans = assocparams.sasoc_asocmaxrxt; |
2557 | } | ||
2558 | |||
2535 | if (assocparams.sasoc_cookie_life != 0) { | 2559 | if (assocparams.sasoc_cookie_life != 0) { |
2536 | asoc->cookie_life.tv_sec = | 2560 | asoc->cookie_life.tv_sec = |
2537 | assocparams.sasoc_cookie_life / 1000; | 2561 | assocparams.sasoc_cookie_life / 1000; |