sctp: fix error return code in __sctp_connect()
authorWei Yongjun <[email protected]>
Wed, 3 Apr 2013 03:02:28 +0000 (03:02 +0000)
committerDavid S. Miller <[email protected]>
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 <[email protected]>
Acked-by: Vlad Yasevich <[email protected]>
Acked-by: Neil Horman <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
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).