diff mbox series

[net-next,04/24] sctp: use SCTP_FUTURE_ASSOC for SCTP_ASSOCINFO sockopt

Message ID 088bc37947694e4e80302b075f767a7828ea4a05.1548659198.git.lucien.xin@gmail.com
State Accepted
Delegated to: David Miller
Headers show
Series sctp: support SCTP_FUTURE/CURRENT/ALL_ASSOC | expand

Commit Message

Xin Long Jan. 28, 2019, 7:08 a.m. UTC
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>
---
 net/sctp/socket.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 48d6be8..e505e18 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -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 */
@@ -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 */