From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Miller Subject: Re: [PATCH net] sctp: fix the issue that flags are ignored when using kernel_connect Date: Tue, 22 May 2018 13:40:14 -0400 (EDT) Message-ID: <20180522.134014.1038689773683362410.davem@davemloft.net> References: <4863916c3e574b0d860725466d7d4a2f445fbe5b.1526805550.git.lucien.xin@gmail.com> Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: netdev@vger.kernel.org, linux-sctp@vger.kernel.org, marcelo.leitner@gmail.com, nhorman@tuxdriver.com, mkubecek@suse.cz To: lucien.xin@gmail.com Return-path: Received: from shards.monkeyblade.net ([184.105.139.130]:45206 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751279AbeEVRlI (ORCPT ); Tue, 22 May 2018 13:41:08 -0400 In-Reply-To: <4863916c3e574b0d860725466d7d4a2f445fbe5b.1526805550.git.lucien.xin@gmail.com> Sender: netdev-owner@vger.kernel.org List-ID: From: Xin Long Date: Sun, 20 May 2018 16:39:10 +0800 > 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 > Signed-off-by: Xin Long Applied, thank you. I don't see a Fixes: tag, please give me some guidance me wrt. -stable.