diff options
Diffstat (limited to 'net/sctp/socket.c')
-rw-r--r-- | net/sctp/socket.c | 26 |
1 files changed, 5 insertions, 21 deletions
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index e16c090e89f0..1fb2cad94597 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c | |||
@@ -3951,32 +3951,16 @@ static int sctp_setsockopt_pr_supported(struct sock *sk, | |||
3951 | unsigned int optlen) | 3951 | unsigned int optlen) |
3952 | { | 3952 | { |
3953 | struct sctp_assoc_value params; | 3953 | struct sctp_assoc_value params; |
3954 | struct sctp_association *asoc; | ||
3955 | int retval = -EINVAL; | ||
3956 | 3954 | ||
3957 | if (optlen != sizeof(params)) | 3955 | if (optlen != sizeof(params)) |
3958 | goto out; | 3956 | return -EINVAL; |
3959 | |||
3960 | if (copy_from_user(¶ms, optval, optlen)) { | ||
3961 | retval = -EFAULT; | ||
3962 | goto out; | ||
3963 | } | ||
3964 | |||
3965 | asoc = sctp_id2assoc(sk, params.assoc_id); | ||
3966 | if (asoc) { | ||
3967 | asoc->prsctp_enable = !!params.assoc_value; | ||
3968 | } else if (!params.assoc_id) { | ||
3969 | struct sctp_sock *sp = sctp_sk(sk); | ||
3970 | 3957 | ||
3971 | sp->ep->prsctp_enable = !!params.assoc_value; | 3958 | if (copy_from_user(¶ms, optval, optlen)) |
3972 | } else { | 3959 | return -EFAULT; |
3973 | goto out; | ||
3974 | } | ||
3975 | 3960 | ||
3976 | retval = 0; | 3961 | sctp_sk(sk)->ep->prsctp_enable = !!params.assoc_value; |
3977 | 3962 | ||
3978 | out: | 3963 | return 0; |
3979 | return retval; | ||
3980 | } | 3964 | } |
3981 | 3965 | ||
3982 | static int sctp_setsockopt_default_prinfo(struct sock *sk, | 3966 | static int sctp_setsockopt_default_prinfo(struct sock *sk, |