Skip to content

Commit

Permalink
sctp: use SCTP_FUTURE_ASSOC for SCTP_ASSOCINFO sockopt
Browse files Browse the repository at this point in the history
Check with SCTP_FUTURE_ASSOC instead in
sctp_set/getsockopt_associnfo, it's compatible with 0.

Signed-off-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Xin Long authored and David S. Miller committed Jan 30, 2019
1 parent 7adb5ed commit 8889394
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions net/sctp/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -3208,7 +3208,8 @@ static int sctp_setsockopt_associnfo(struct sock *sk, char __user *optval, unsig

asoc = sctp_id2assoc(sk, assocparams.sasoc_assoc_id);

if (!asoc && assocparams.sasoc_assoc_id && sctp_style(sk, UDP))
if (!asoc && assocparams.sasoc_assoc_id != SCTP_FUTURE_ASSOC &&
sctp_style(sk, UDP))
return -EINVAL;

/* Set the values to the specific association */
Expand Down Expand Up @@ -6357,7 +6358,8 @@ static int sctp_getsockopt_associnfo(struct sock *sk, int len,

asoc = sctp_id2assoc(sk, assocparams.sasoc_assoc_id);

if (!asoc && assocparams.sasoc_assoc_id && sctp_style(sk, UDP))
if (!asoc && assocparams.sasoc_assoc_id != SCTP_FUTURE_ASSOC &&
sctp_style(sk, UDP))
return -EINVAL;

/* Values correspoinding to the specific association */
Expand Down

0 comments on commit 8889394

Please sign in to comment.