mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-10 10:39:26 +00:00
sctp: not allow to set asoc prsctp_enable by sockopt
[ Upstream commitcc3ccf26f0
] As rfc7496#section4.5 says about SCTP_PR_SUPPORTED: This socket option allows the enabling or disabling of the negotiation of PR-SCTP support for future associations. For existing associations, it allows one to query whether or not PR-SCTP support was negotiated on a particular association. It means only sctp sock's prsctp_enable can be set. Note that for the limitation of SCTP_{CURRENT|ALL}_ASSOC, we will add it when introducing SCTP_{FUTURE|CURRENT|ALL}_ASSOC for linux sctp in another patchset. v1->v2: - drop the params.assoc_id check as Neil suggested. Fixes:28aa4c26fc
("sctp: add SCTP_PR_SUPPORTED on sctp sockopt") Reported-by: Ying Xu <yinxu@redhat.com> Signed-off-by: Xin Long <lucien.xin@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
a21a82a9a3
commit
7e86081c98
1 changed files with 5 additions and 21 deletions
|
@ -3958,32 +3958,16 @@ static int sctp_setsockopt_pr_supported(struct sock *sk,
|
|||
unsigned int optlen)
|
||||
{
|
||||
struct sctp_assoc_value params;
|
||||
struct sctp_association *asoc;
|
||||
int retval = -EINVAL;
|
||||
|
||||
if (optlen != sizeof(params))
|
||||
goto out;
|
||||
return -EINVAL;
|
||||
|
||||
if (copy_from_user(¶ms, optval, optlen)) {
|
||||
retval = -EFAULT;
|
||||
goto out;
|
||||
}
|
||||
if (copy_from_user(¶ms, optval, optlen))
|
||||
return -EFAULT;
|
||||
|
||||
asoc = sctp_id2assoc(sk, params.assoc_id);
|
||||
if (asoc) {
|
||||
asoc->prsctp_enable = !!params.assoc_value;
|
||||
} else if (!params.assoc_id) {
|
||||
struct sctp_sock *sp = sctp_sk(sk);
|
||||
sctp_sk(sk)->ep->prsctp_enable = !!params.assoc_value;
|
||||
|
||||
sp->ep->prsctp_enable = !!params.assoc_value;
|
||||
} else {
|
||||
goto out;
|
||||
}
|
||||
|
||||
retval = 0;
|
||||
|
||||
out:
|
||||
return retval;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int sctp_setsockopt_default_prinfo(struct sock *sk,
|
||||
|
|
Loading…
Reference in a new issue