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 739f3e50120d..bf618d1b41fd 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c | |||
@@ -3940,32 +3940,16 @@ static int sctp_setsockopt_pr_supported(struct sock *sk, | |||
3940 | unsigned int optlen) | 3940 | unsigned int optlen) |
3941 | { | 3941 | { |
3942 | struct sctp_assoc_value params; | 3942 | struct sctp_assoc_value params; |
3943 | struct sctp_association *asoc; | ||
3944 | int retval = -EINVAL; | ||
3945 | 3943 | ||
3946 | if (optlen != sizeof(params)) | 3944 | if (optlen != sizeof(params)) |
3947 | goto out; | 3945 | return -EINVAL; |
3948 | |||
3949 | if (copy_from_user(¶ms, optval, optlen)) { | ||
3950 | retval = -EFAULT; | ||
3951 | goto out; | ||
3952 | } | ||
3953 | |||
3954 | asoc = sctp_id2assoc(sk, params.assoc_id); | ||
3955 | if (asoc) { | ||
3956 | asoc->prsctp_enable = !!params.assoc_value; | ||
3957 | } else if (!params.assoc_id) { | ||
3958 | struct sctp_sock *sp = sctp_sk(sk); | ||
3959 | 3946 | ||
3960 | sp->ep->prsctp_enable = !!params.assoc_value; | 3947 | if (copy_from_user(¶ms, optval, optlen)) |
3961 | } else { | 3948 | return -EFAULT; |
3962 | goto out; | ||
3963 | } | ||
3964 | 3949 | ||
3965 | retval = 0; | 3950 | sctp_sk(sk)->ep->prsctp_enable = !!params.assoc_value; |
3966 | 3951 | ||
3967 | out: | 3952 | return 0; |
3968 | return retval; | ||
3969 | } | 3953 | } |
3970 | 3954 | ||
3971 | static int sctp_setsockopt_default_prinfo(struct sock *sk, | 3955 | static int sctp_setsockopt_default_prinfo(struct sock *sk, |