diff options
author | Xin Long <lucien.xin@gmail.com> | 2019-01-28 08:08:31 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-01-30 09:44:07 +0100 |
commit | acce7f3b8d4f360d879762a81d4084f6ee1e3869 (patch) | |
tree | bc3416a5945000dd2ef8f600eb8c5055b6169b16 /net/sctp/socket.c | |
parent | sctp: use SCTP_FUTURE_ASSOC for SCTP_PR_SUPPORTED sockopt (diff) | |
download | linux-acce7f3b8d4f360d879762a81d4084f6ee1e3869.tar.xz linux-acce7f3b8d4f360d879762a81d4084f6ee1e3869.zip |
sctp: use SCTP_FUTURE_ASSOC for SCTP_RECONFIG_SUPPORTED sockopt
Check with SCTP_FUTURE_ASSOC instead in
sctp_set/getsockopt_reconfig_supported, it's compatible with 0.
It also adjusts some code to keep a same check form as other functions.
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to '')
-rw-r--r-- | net/sctp/socket.c | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index 9e2b15318942..e5487a1140f9 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c @@ -4041,15 +4041,14 @@ static int sctp_setsockopt_reconfig_supported(struct sock *sk, } asoc = sctp_id2assoc(sk, params.assoc_id); - if (asoc) { - asoc->reconf_enable = !!params.assoc_value; - } else if (!params.assoc_id) { - struct sctp_sock *sp = sctp_sk(sk); - - sp->ep->reconf_enable = !!params.assoc_value; - } else { + if (!asoc && params.assoc_id != SCTP_FUTURE_ASSOC && + sctp_style(sk, UDP)) goto out; - } + + if (asoc) + asoc->reconf_enable = !!params.assoc_value; + else + sctp_sk(sk)->ep->reconf_enable = !!params.assoc_value; retval = 0; @@ -7295,17 +7294,15 @@ static int sctp_getsockopt_reconfig_supported(struct sock *sk, int len, goto out; asoc = sctp_id2assoc(sk, params.assoc_id); - if (asoc) { - params.assoc_value = asoc->reconf_enable; - } else if (!params.assoc_id) { - struct sctp_sock *sp = sctp_sk(sk); - - params.assoc_value = sp->ep->reconf_enable; - } else { + if (!asoc && params.assoc_id != SCTP_FUTURE_ASSOC && + sctp_style(sk, UDP)) { retval = -EINVAL; goto out; } + params.assoc_value = asoc ? asoc->reconf_enable + : sctp_sk(sk)->ep->reconf_enable; + if (put_user(len, optlen)) goto out; |