mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-02 09:36:42 +07:00
sctp: use SCTP_FUTURE_ASSOC for SCTP_PR_SUPPORTED sockopt
Check with SCTP_FUTURE_ASSOC instead in sctp_set/getsockopt_pr_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>
This commit is contained in:
parent
8add543e36
commit
fb19560508
@ -3965,6 +3965,7 @@ static int sctp_setsockopt_pr_supported(struct sock *sk,
|
|||||||
unsigned int optlen)
|
unsigned int optlen)
|
||||||
{
|
{
|
||||||
struct sctp_assoc_value params;
|
struct sctp_assoc_value params;
|
||||||
|
struct sctp_association *asoc;
|
||||||
|
|
||||||
if (optlen != sizeof(params))
|
if (optlen != sizeof(params))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@ -3972,6 +3973,11 @@ static int sctp_setsockopt_pr_supported(struct sock *sk,
|
|||||||
if (copy_from_user(¶ms, optval, optlen))
|
if (copy_from_user(¶ms, optval, optlen))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
|
asoc = sctp_id2assoc(sk, params.assoc_id);
|
||||||
|
if (!asoc && params.assoc_id != SCTP_FUTURE_ASSOC &&
|
||||||
|
sctp_style(sk, UDP))
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
sctp_sk(sk)->ep->prsctp_enable = !!params.assoc_value;
|
sctp_sk(sk)->ep->prsctp_enable = !!params.assoc_value;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -7084,17 +7090,15 @@ static int sctp_getsockopt_pr_supported(struct sock *sk, int len,
|
|||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
asoc = sctp_id2assoc(sk, params.assoc_id);
|
asoc = sctp_id2assoc(sk, params.assoc_id);
|
||||||
if (asoc) {
|
if (!asoc && params.assoc_id != SCTP_FUTURE_ASSOC &&
|
||||||
params.assoc_value = asoc->prsctp_enable;
|
sctp_style(sk, UDP)) {
|
||||||
} else if (!params.assoc_id) {
|
|
||||||
struct sctp_sock *sp = sctp_sk(sk);
|
|
||||||
|
|
||||||
params.assoc_value = sp->ep->prsctp_enable;
|
|
||||||
} else {
|
|
||||||
retval = -EINVAL;
|
retval = -EINVAL;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
params.assoc_value = asoc ? asoc->prsctp_enable
|
||||||
|
: sctp_sk(sk)->ep->prsctp_enable;
|
||||||
|
|
||||||
if (put_user(len, optlen))
|
if (put_user(len, optlen))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user