From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B4266C433EF for ; Fri, 11 Mar 2022 07:15:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346927AbiCKHQa (ORCPT ); Fri, 11 Mar 2022 02:16:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239140AbiCKHQ0 (ORCPT ); Fri, 11 Mar 2022 02:16:26 -0500 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 793AC1AA05E; Thu, 10 Mar 2022 23:15:24 -0800 (PST) Received: by verein.lst.de (Postfix, from userid 2407) id 1B6CD68AFE; Fri, 11 Mar 2022 08:15:19 +0100 (CET) Date: Fri, 11 Mar 2022 08:15:18 +0100 From: Christoph Hellwig To: Mingbao Sun Cc: Keith Busch , Jens Axboe , Christoph Hellwig , Sagi Grimberg , Chaitanya Kulkarni , linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, Eric Dumazet , "David S . Miller" , Hideaki YOSHIFUJI , David Ahern , Jakub Kicinski , netdev@vger.kernel.org, tyler.sun@dell.com, ping.gan@dell.com, yanxiu.cai@dell.com, libin.zhang@dell.com, ao.sun@dell.com Subject: Re: [PATCH 2/3] nvme-tcp: support specifying the congestion-control Message-ID: <20220311071518.GB18222@lst.de> References: <20220311030113.73384-1-sunmingbao@tom.com> <20220311030113.73384-3-sunmingbao@tom.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220311030113.73384-3-sunmingbao@tom.com> User-Agent: Mutt/1.5.17 (2007-11-01) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 11, 2022 at 11:01:12AM +0800, Mingbao Sun wrote: > + case NVMF_OPT_TCP_CONGESTION: > + p = match_strdup(args); > + if (!p) { > + ret = -ENOMEM; > + goto out; > + } > + > + kfree(opts->tcp_congestion); > + opts->tcp_congestion = p; We'll need to check that the string is no loner than TCP_CA_NAME_MAX somewhere. > > + if (nctrl->opts->mask & NVMF_OPT_TCP_CONGESTION) { > + ret = tcp_set_congestion_control(queue->sock->sk, > + nctrl->opts->tcp_congestion, > + true, true); This needs to be called under lock_sock() protection. Maybe also add an assert to tcp_set_congestion_control to enforce that.