Repository navigation
Commit 9b6c088
sctp: not bind the socket in sctp_connect
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: 644fbde ("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>1 parent 8ec3ede commit 9b6c088
1 file changed
Lines changed: 3 additions & 21 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4816 | 4816 | | |
4817 | 4817 | | |
4818 | 4818 | | |
4819 | | - | |
4820 | 4819 | | |
4821 | | - | |
| 4820 | + | |
4822 | 4821 | | |
4823 | 4822 | | |
4824 | | - | |
4825 | 4823 | | |
4826 | 4824 | | |
4827 | 4825 | | |
4828 | | - | |
4829 | | - | |
4830 | | - | |
4831 | | - | |
4832 | | - | |
4833 | | - | |
4834 | | - | |
4835 | | - | |
4836 | | - | |
4837 | 4826 | | |
4838 | | - | |
4839 | | - | |
4840 | | - | |
4841 | | - | |
4842 | | - | |
4843 | | - | |
4844 | | - | |
4845 | | - | |
| 4827 | + | |
| 4828 | + | |
4846 | 4829 | | |
4847 | | - | |
4848 | 4830 | | |
4849 | 4831 | | |
4850 | 4832 | | |
| |||
0 commit comments