diff options
author | Xin Long <lucien.xin@gmail.com> | 2018-05-20 11:39:10 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-11-06 14:18:26 +0300 |
commit | f8b141077a9a8fd2a7f6bae447a710a6d224b44e (patch) | |
tree | 81a7ab4524d6db5fcfdaa50c93307f576dace977 /net/sctp/protocol.c | |
parent | 1d41d2fe9ea977531cbc9d9d0f48dbffaa6e3134 (diff) | |
download | linux-f8b141077a9a8fd2a7f6bae447a710a6d224b44e.tar.xz |
sctp: fix the issue that flags are ignored when using kernel_connect
commit 644fbdeacf1d3edd366e44b8ba214de9d1dd66a9 upstream.
Now sctp uses inet_dgram_connect as its proto_ops .connect, and the flags
param can't be passed into its proto .connect where this flags is really
needed.
sctp works around it by getting flags from socket file in __sctp_connect.
It works for connecting from userspace, as inherently the user sock has
socket file and it passes f_flags as the flags param into the proto_ops
.connect.
However, the sock created by sock_create_kern doesn't have a socket file,
and it passes the flags (like O_NONBLOCK) by using the flags param in
kernel_connect, which calls proto_ops .connect later.
So to fix it, this patch defines a new proto_ops .connect for sctp,
sctp_inet_connect, which calls __sctp_connect() directly with this
flags param. After this, the sctp's proto .connect can be removed.
Note that sctp_inet_connect doesn't need to do some checks that are not
needed for sctp, which makes thing better than with inet_dgram_connect.
Suggested-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Reviewed-by: Michal Kubecek <mkubecek@suse.cz>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net/sctp/protocol.c')
-rw-r--r-- | net/sctp/protocol.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c index 833283c8fe11..9cb06ca4eaba 100644 --- a/net/sctp/protocol.c +++ b/net/sctp/protocol.c @@ -1014,7 +1014,7 @@ static const struct proto_ops inet_seqpacket_ops = { .owner = THIS_MODULE, .release = inet_release, /* Needs to be wrapped... */ .bind = inet_bind, - .connect = inet_dgram_connect, + .connect = sctp_inet_connect, .socketpair = sock_no_socketpair, .accept = inet_accept, .getname = inet_getname, /* Semantics are different. */ |