Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3034986ybb; Sun, 22 Mar 2020 13:44:30 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsBTkqd83fU0+D35yYvWmbV8SVoGCQRhmydiKCCkDDpaPcL5rB10GJtEOM+dDUJLVmQy5EK X-Received: by 2002:aca:724f:: with SMTP id p76mr14191921oic.112.1584909869932; Sun, 22 Mar 2020 13:44:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584909869; cv=none; d=google.com; s=arc-20160816; b=sR99U9UJLtWyCuHuoqTyI/K8pjSspPGay8zn+dF+bhVho3WUk8IdkBujz7Ja/do2SL /3tggno4j/qM7h/PWjFTDkdoS79BR3xg2nN069MeiOLZRBg3FNc8U4QvkFljI8EbDHFR TvUHja37Whm6LbDU3AC4MEdaiWOXPtcSjzU3OBkIbduMeljrKtbu9xP1eeXOZMnXZ7Bh oDq9zsGLreejGQrcAgZjcCfPWqE8Nt5wUsF/gLBk66EobxCUX5ij4WwWyN38KkKx80nq F9aDvH03WmwmzBEFDm2tCkOF3aqt9Yg9OKqw84isw3QrsKaBW9PBWIVD/QWeIsH3mMnq 57og== 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:message-id:subject:cc:to:from:date :dkim-signature; bh=N5czMVt7Ut6iJF66omlUYGv+UnFTF+tsR5nzSofFveU=; b=rwfCAc9ds5BAwi2e8DozY1wKxdjENy9tApanwR9Z2ooZrmxf9SbT0WFndUhoZ5PTrZ o5JshXHbulip+UkB6hBDZJSMQEZrGl01+lZsaKq6uCy6srZrEANFYHb79yCAj2geKvgy USH2ol/e3p8IHVh+JZNga61Z/AK1086n1Urfwo0uYHB3gldYB2EMSTB9lZdkndIKVVop k2aXBDwPjgz64+p3HG3PClntqa6Kut5/leJQYcx6YGPhCizWcPsp0TS2IReVYgexYvZ9 T9rSCOt5V56ldZ5+CMWS4ApWskW+U3OeMN+2cgHqETSj9VTOVcU8m140OKx4z0WafXE9 NlVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Fjyxfmz6; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t23si2073345oic.174.2020.03.22.13.44.17; Sun, 22 Mar 2020 13:44:29 -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; dkim=pass header.i=@kernel.org header.s=default header.b=Fjyxfmz6; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726872AbgCVUn7 (ORCPT + 99 others); Sun, 22 Mar 2020 16:43:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:57530 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726623AbgCVUn6 (ORCPT ); Sun, 22 Mar 2020 16:43:58 -0400 Received: from kicinski-fedora-PC1C0HJN (c-67-180-217-166.hsd1.ca.comcast.net [67.180.217.166]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1DDCD20722; Sun, 22 Mar 2020 20:43:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1584909838; bh=7uuqlv+KI6oHqzf5REliAD4qvrHfNNTC3/A5CRNxtlE=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Fjyxfmz64rth8we0JsUiekHM4GD0DLhWUaRV6MU4r5Vox8tMT+WoX4/vooS5/mCIO xu8pnawqRACqxCLyz4ivT+u7DOR6e+2BhQq3AuFzJwL0RVAk6ovIwqh14tU6Fl59PC lEQgMVqL6/4h8UWPI7nZr3y9JSDMgQKLBKin7Cc4= Date: Sun, 22 Mar 2020 13:43:56 -0700 From: Jakub Kicinski To: Michal Kubecek Cc: "David S. Miller" , netdev@vger.kernel.org, Andrew Lunn , linux-kernel@vger.kernel.org Subject: Re: [PATCH net] ethtool: fix reference leak in some *_SET handlers Message-ID: <20200322134356.55f7d9b8@kicinski-fedora-PC1C0HJN> In-Reply-To: <20200322201551.E11BAE0FD3@unicorn.suse.cz> References: <20200322201551.E11BAE0FD3@unicorn.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 22 Mar 2020 21:15:51 +0100 (CET) Michal Kubecek wrote: > Andrew noticed that some handlers for *_SET commands leak a netdev > reference if required ethtool_ops callbacks do not exist. A simple > reproducer would be e.g. > > ip link add veth1 type veth peer name veth2 > ethtool -s veth1 wol g > ip link del veth1 > > Make sure dev_put() is called when ethtool_ops check fails. Fixes: e54d04e3afea ("ethtool: set message mask with DEBUG_SET request") Fixes: a53f3d41e4d3 ("ethtool: set link settings with LINKINFO_SET request") Fixes: bfbcfe2032e7 ("ethtool: set link modes related data with LINKMODES_SET request") Fixes: 8d425b19b305 ("ethtool: set wake-on-lan settings with WOL_SET request") > Reported-by: Andrew Lunn > Signed-off-by: Michal Kubecek Reviewed-by: Jakub Kicinski