Files
linux/net
Xin Long 89cac4c647 sctp: not bind the socket in sctp_connect
commit 9b6c08878e upstream.

Now when sctp_connect() is called with a wrong sa_family, it binds
to a port but doesn't set bp->port, then sctp_get_af_specific will
return NULL and sctp_connect() returns -EINVAL.

Then if sctp_bind() is called to bind to another port, the last
port it has bound will leak due to bp->port is NULL by then.

sctp_connect() doesn't need to bind ports, as later __sctp_connect
will do it if bp->port is NULL. So remove it from sctp_connect().
While at it, remove the unnecessary sockaddr.sa_family len check
as it's already done in sctp_inet_connect.

Fixes: 644fbdeacf ("sctp: fix the issue that flags are ignored when using kernel_connect")
Reported-by: syzbot+079bf326b38072f849d9@syzkaller.appspotmail.com
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-05-15 14:56:27 +09:00
..
2015-03-02 16:43:41 -05:00
2023-05-15 12:38:05 +09:00
2023-05-15 14:29:05 +09:00
2023-05-15 13:49:35 +09:00
2016-10-20 11:23:08 -04:00
2023-05-15 12:05:35 +09:00
2018-05-16 11:39:34 +02:00
2023-05-15 11:55:21 +09:00
2023-05-15 14:29:05 +09:00
2023-05-15 10:49:15 +09:00
2016-08-17 19:36:23 -04:00