OSDN Git Service

sctp: use SCTP_FUTURE_ASSOC for SCTP_RTOINFO sockopt
authorXin Long <lucien.xin@gmail.com>
Mon, 28 Jan 2019 07:08:25 +0000 (15:08 +0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 30 Jan 2019 08:44:06 +0000 (00:44 -0800)
Check with SCTP_FUTURE_ASSOC instead in
sctp_set/getsockopt_rtoinfo, it's compatible with 0.

Signed-off-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sctp/socket.c

index 4c43b95..48d6be8 100644 (file)
@@ -3145,7 +3145,8 @@ static int sctp_setsockopt_rtoinfo(struct sock *sk, char __user *optval, unsigne
        asoc = sctp_id2assoc(sk, rtoinfo.srto_assoc_id);
 
        /* Set the values to the specific association */
-       if (!asoc && rtoinfo.srto_assoc_id && sctp_style(sk, UDP))
+       if (!asoc && rtoinfo.srto_assoc_id != SCTP_FUTURE_ASSOC &&
+           sctp_style(sk, UDP))
                return -EINVAL;
 
        rto_max = rtoinfo.srto_max;
@@ -6298,7 +6299,8 @@ static int sctp_getsockopt_rtoinfo(struct sock *sk, int len,
 
        asoc = sctp_id2assoc(sk, rtoinfo.srto_assoc_id);
 
-       if (!asoc && rtoinfo.srto_assoc_id && sctp_style(sk, UDP))
+       if (!asoc && rtoinfo.srto_assoc_id != SCTP_FUTURE_ASSOC &&
+           sctp_style(sk, UDP))
                return -EINVAL;
 
        /* Values corresponding to the specific association. */