]> Pileus Git - ~andy/linux/commitdiff
sctp: fix error return code in __sctp_connect()
authorWei Yongjun <yongjun_wei@trendmicro.com.cn>
Wed, 3 Apr 2013 03:02:28 +0000 (03:02 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sun, 7 Apr 2013 21:04:17 +0000 (17:04 -0400)
Fix to return a negative error code from the error handling
case instead of 0, as returned elsewhere in this function.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Acked-by: Vlad Yasevich <vyasevich@gmail.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sctp/socket.c

index dd21ae3013d82c3eab741cdd3332cddfcedef3e5..f631c5ff4dbfd84426d140920b15650972f34646 100644 (file)
@@ -1119,9 +1119,10 @@ static int __sctp_connect(struct sock* sk,
                /* Make sure the destination port is correctly set
                 * in all addresses.
                 */
-               if (asoc && asoc->peer.port && asoc->peer.port != port)
+               if (asoc && asoc->peer.port && asoc->peer.port != port) {
+                       err = -EINVAL;
                        goto out_free;
-
+               }
 
                /* Check if there already is a matching association on the
                 * endpoint (other than the one created here).