Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp1093888ybi; Thu, 30 May 2019 11:28:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqyzboZyP/n7zuF6GqzBX2zZApGUtZV53pr3VidBuy9OoRPPuOl76V81qrcADOda8fEB97Su X-Received: by 2002:a63:4346:: with SMTP id q67mr4832310pga.241.1559240896371; Thu, 30 May 2019 11:28:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559240896; cv=none; d=google.com; s=arc-20160816; b=YpmMTBPgPmW6NJjriTxafAyD7NWxYNioLtxsRB6wlcgFZOkHmcMutUOxWTaOVXdVWm t4hyQ80zR2luYT04RnRVf7k80knjfDpJW53puFkeZj8T1AaaH7swkjHWPB9nLkyQZ45u X4R7VtegCWZF9iSqd/I7nomZ6JJ7IGg2WTWw1hYDy1Y7t9Fp2I/4oVrCvrVtEEPyUfHE RBMs0F3EGxORAs3MqrmE5wYe2Orvr9C22hYRuZyEe6WN1xYzuN6x1AFvP1T89ANcolxk ILDKqNHCl/ljJS8OCLcy/9EvputCQdVODwjDFgYbRYtvxq9qwjfrg9lqPooXbdgQld/J itBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:from:subject:cc:to:message-id:date; bh=CpABbvkpBIbwJWYhLhBnHTqXpwbnbTg/urOJxYcWz0w=; b=J2UJSggBagp61xl/+/NSlcNzWwxV5YEelOwrxtyRljUnKRXKwyfSWx/YpR8Wqg3qTp rujHLwna6q1IUt8GAG/SGbhmIubuS/LG3DVWmQuJuGNzN0qnORLE9toJ9X38brup9Jji TJ5xHYnR5JfxA6QFpPqqoYeAXtZz8F7WKJE+LMXmWP883xX/jcaH3uPAwfEdFZmMAIZh gNDnn6YjeeFTQTYxIhRTDowIe+xksCs0cjZivxCZpQRP0CzOyGjdoSBEyyqxmw/2kasR k8mrJV3yBUhrNCqWeM3lYG5XEECET6R9N3gh67FGLRRKWA3sHAKPp3WOia6ztdeKgYtH qLMw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s11si3672176pgp.326.2019.05.30.11.28.00; Thu, 30 May 2019 11:28:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726736AbfE3S0c (ORCPT + 99 others); Thu, 30 May 2019 14:26:32 -0400 Received: from shards.monkeyblade.net ([23.128.96.9]:56736 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726649AbfE3S0b (ORCPT ); Thu, 30 May 2019 14:26:31 -0400 Received: from localhost (unknown [IPv6:2601:601:9f80:35cd::3d5]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: davem-davemloft) by shards.monkeyblade.net (Postfix) with ESMTPSA id 19E9F14D92C59; Thu, 30 May 2019 11:26:31 -0700 (PDT) Date: Thu, 30 May 2019 11:26:30 -0700 (PDT) Message-Id: <20190530.112630.476132829981439143.davem@davemloft.net> To: mkubecek@suse.cz Cc: netdev@vger.kernel.org, vivien.didelot@gmail.com, linux-kernel@vger.kernel.org, kernel@savoirfairelinux.com, linville@redhat.com, f.fainelli@gmail.com Subject: Re: [PATCH net-next] ethtool: copy reglen to userspace From: David Miller In-Reply-To: <20190530082722.GB27401@unicorn.suse.cz> References: <20190529.221744.1136074795446305909.davem@davemloft.net> <20190530064848.GA27401@unicorn.suse.cz> <20190530082722.GB27401@unicorn.suse.cz> X-Mailer: Mew version 6.8 on Emacs 26.1 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Thu, 30 May 2019 11:26:31 -0700 (PDT) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Michal Kubecek Date: Thu, 30 May 2019 10:27:22 +0200 > I believe this should be handled by ethtool_get_regs(), either by > returning an error or by only copying data up to original regs.len > passed by userspace. The former seems more correct but broken userspace > software would suddenly start to fail where it "used to work". The > latter would be closer to current behaviour but it would mean that > broken userspace software might nerver notice there is something wrong. I therefore think we need to meticulously fixup all of these adjustments of regs.len before adjusting the copy call here in generic ethtool.