Received: by 10.223.185.116 with SMTP id b49csp2283695wrg; Thu, 22 Feb 2018 11:05:37 -0800 (PST) X-Google-Smtp-Source: AH8x225qmR2dIGSqpsnETXTIvHlP5rEWZG0OUftLOVfOtM1tprcbjK5TT0PrPLkTmt1PqCFibnd1 X-Received: by 10.99.117.24 with SMTP id q24mr6368809pgc.53.1519326337698; Thu, 22 Feb 2018 11:05:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519326337; cv=none; d=google.com; s=arc-20160816; b=ZAER8DU45dpdIgy4gF2pRHd+My+lTxEsomivOTFtXvATb8XgqUFQYMxpwy5165H1aI iGenkt1yuh+yEHPRgrqR7VYBZxzT7A0BLI4CcD1LiA9QDdNE0sk+esQy7r04WZMwBBlK gHjqgV7m7lKHVnKKXBRnxLD9icOggfqhwac+kSYOtWJKQ6fxh8mRHYYRPdIYI8L07Nfs c6bq/hexbvAg0pzqN8BeRuC7u7T9vlCP9AKSPb21WoG1LpnxwIX1+0PYBcnRU/nTRICm c9VYjAIbCJDabL4nktXonndI92uHD1K6/6R3H63TK1ab6KMYstBxsppcaPSAHrHQExVj 6IKA== 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 :arc-authentication-results; bh=8Q1tfZjBVVNf5qWkZIxbatTTLvXREHO+CBje0IXHTSM=; b=QyxXRAUlPVZa15/Pt2w2yrxPHt19RyDYuLl7MdH/7bSGDg9gKkB6NwmPmPIq5AelxC e6xus80ZxBGX1X5GjHNWA7KW7sPfevS5iSiAkP26vRv0CI1kGCkDe8jPgnfFaGomHFZD XtujYplxYnaDmHjuWMIK8wsyeHh6f50nHYVUZeg4HgPs8pkuUVgpBY4qlnzH4kncuFMV clmazs34IkIkX+TlqgSmdJwHe0vuZ9e3Yi50/pyB4Ckg0A3/nSkxoQXQjKHHgHR3HqKg Fu5mO+Q5HeJsLMdV3Xpg82xfKpnBUIQYzPCh3ngNWIeV/YfXJMiZIHqmelPiifus242b KKeA== 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 w9-v6si462708plz.12.2018.02.22.11.05.23; Thu, 22 Feb 2018 11:05:37 -0800 (PST) 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 S1751379AbeBVTEl (ORCPT + 99 others); Thu, 22 Feb 2018 14:04:41 -0500 Received: from shards.monkeyblade.net ([184.105.139.130]:50548 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751346AbeBVTEj (ORCPT ); Thu, 22 Feb 2018 14:04:39 -0500 Received: from localhost (67.110.78.66.ptr.us.xo.net [67.110.78.66]) (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 1730713F03480; Thu, 22 Feb 2018 11:04:39 -0800 (PST) Date: Thu, 22 Feb 2018 14:04:38 -0500 (EST) Message-Id: <20180222.140438.278807705225418710.davem@davemloft.net> To: Jason@zx2c4.com Cc: johannes.berg@intel.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] netlink: put module reference if dump start fails From: David Miller In-Reply-To: <20180221034159.14685-1-Jason@zx2c4.com> References: <20180221034159.14685-1-Jason@zx2c4.com> X-Mailer: Mew version 6.7 on Emacs 25.3 / Mule 6.0 (HANACHIRUSATO) 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, 22 Feb 2018 11:04:39 -0800 (PST) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "Jason A. Donenfeld" Date: Wed, 21 Feb 2018 04:41:59 +0100 > Before, if cb->start() failed, the module reference would never be put, > because cb->cb_running is intentionally false at this point. Users are > generally annoyed by this because they can no longer unload modules that > leak references. Also, it may be possible to tediously wrap a reference > counter back to zero, especially since module.c still uses atomic_inc > instead of refcount_inc. > > This patch expands the error path to simply call module_put if > cb->start() fails. > > Signed-off-by: Jason A. Donenfeld > --- > This probably should be queued up for stable. Applied and queued up for -stable.