Skip to contentSkip to conversation

Return error to userspace in __sctp_connect when inconsistent ports are used

PATCH New Michele Baldessari 1 participant 1 message Apr 4, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Return error to userspace in __sctp_connect when inconsistent ports are used

Hi Vlad,

just as we similarly do in sctp_do_bind() we should return EINVAL when sctp_connectx is called with multiple addresses but different ports.

Issue first mentioned with patch in sourceforge #3323780

regards,
Michele

---
 net/sctp/socket.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
net/sctp/socket.c +4 -2
index 626e4ed..553d54a 100644
@@ -1110,10 +1110,12 @@ static int __sctp_connect(struct sock* sk,
 			goto out_free;
 
 		/* Make sure the destination port is correctly set
-		 * in all addresses.
+		 * in all addresses and return EINVAL otherwise
 		 */
-		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
Signature · 1 line
1.7.9.3