Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2404119rwd; Fri, 2 Jun 2023 08:59:28 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4owTAILo5OES/GZiN3eJkmITGJFoePw/OxbiQ5NMX1bA8cmKmarxIEi0ircxwPB66No05b X-Received: by 2002:a05:6a00:8d6:b0:64d:5f9c:7b75 with SMTP id s22-20020a056a0008d600b0064d5f9c7b75mr11635640pfu.16.1685721568637; Fri, 02 Jun 2023 08:59:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685721568; cv=none; d=google.com; s=arc-20160816; b=sHAqwB9YcBim8W0nNvvVlv9fWbH1qEbUPFcbV8Pi9U5uGXOygzzkssQlv47SsIRsDs 5mxmDnUvs0vKV+zJODmbEJsuvWgTKYigU7GllvFynQVsDNwHYckMO3Jc7Otr9EXyNt1t lU7XnQlLbveXmkjkxqlpkwO+betfPzn7mzBCfXlEYjbIr1Xne6l6qjudo4lPboRurcME WUJ0G6zf8Zmp0JfPoivA15kw1CV9QV+1vE51WwN0yxEXNwsRxLwXZ3nMIMYLpfhJ8kYK KHgavJ8PqYw02TEFN+nuksXuLPRQnQRXJAgir6uMA9ECy2fsRAq/7p9eqP5yj4tB0Xkq JnCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=4s8x5vVE/Cay1BwiwX0ciNJuUa4uFZj6eThK63GoGsM=; b=pXDR/oMh9EX7QQBHLlmecOgQZ3S351LdxuPQdh9YfAoWMeLtb2NDu4zNyF9VI2Lo8m M8j4DHjogoi24RAzYUTNb6x5KlGbtIaDhhlBk2QDrTip1t2kSmSdGsi11YWLJ1Y9dvQB sSxtkLGf826nuyS6RXslpQDTB6og2+GZSWe/BFRsSsm3T39Hj5VsOW2efaBiJZRWjZQz CV0lZYu3Po8vvDpex/i0I3R5kpFCJpSrj5E4oDIRqyyiXnF1PZMkI5+LI+2fj2i+fa8v wUYaZcuAeeIv5p0X8uORZD9cJrqHFNCLvBsc81PR3oOhPtgtXuR7Ygg+XG2KqU0BVvFl ypQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=OBXdg6pT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s37-20020a63ff65000000b005139e0d2b5csi1145092pgk.487.2023.06.02.08.59.16; Fri, 02 Jun 2023 08:59:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=OBXdg6pT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236565AbjFBPi3 (ORCPT + 99 others); Fri, 2 Jun 2023 11:38:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236639AbjFBPiZ (ORCPT ); Fri, 2 Jun 2023 11:38:25 -0400 Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1B1B10E0; Fri, 2 Jun 2023 08:37:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=4s8x5vVE/Cay1BwiwX0ciNJuUa4uFZj6eThK63GoGsM=; b=OBXdg6pT2cvgUDIqntv8wb8CKo POcPsQZvD0rAOTSsqppoQofHNt/77/9bKwEqHgqEBrRNsLJ9EifmOPsMe3j/cWNFtvgWB1YxbfPGu 2TXUowdHNf2bTCia0mdlFbUlcmhkdCIt/aGXVXZy12WPsWEBSEyk072HRy9QS0n3Glsg=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1q56q7-00Egjo-TY; Fri, 02 Jun 2023 17:37:19 +0200 Date: Fri, 2 Jun 2023 17:37:19 +0200 From: Andrew Lunn To: Ding Hui Cc: Alexander H Duyck , davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, pengdonglin@sangfor.com.cn, huangcun@sangfor.com.cn Subject: Re: [PATCH net-next] net: ethtool: Fix out-of-bounds copy to user Message-ID: <6e28cea9-d615-449d-9c68-aa155efc8444@lunn.ch> References: <20230601112839.13799-1-dinghui@sangfor.com.cn> <135a45b2c388fbaf9db4620cb01b95230709b9ac.camel@gmail.com> <6110cf9f-c10e-4b9b-934d-8d202b7f5794@lunn.ch> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > Also, RTNL should be held during the time both calls are made into the > > driver. So nothing from userspace should be able to get in the middle > > of these calls to change the number of queues. > > > > The RTNL lock is already be held during every each ioctl in dev_ethtool(). > > rtnl_lock(); > rc = __dev_ethtool(net, ifr, useraddr, ethcmd, state); > rtnl_unlock(); Yes, exactly. So the kernel should be safe from buffer overruns. Userspace will not get more than it asked for. It might get less, and it could be different to the previous calls. But i'm not aware of anything which says anything about the consistency between different invocations of ethtool -S. Andrew