Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp4882003imm; Tue, 19 Jun 2018 01:10:59 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKu0xHPKsHZT5piTYDAyrwjcLR9x5r5m3ZYwGIJSMQ4RlsTxD2imxjObyoXnBsFwVLIeNWg X-Received: by 2002:a17:902:28e4:: with SMTP id f91-v6mr17951477plb.146.1529395859950; Tue, 19 Jun 2018 01:10:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529395859; cv=none; d=google.com; s=arc-20160816; b=Uk1RQiwthJaa6bOlV5NIcYHAH+NECgLhtUDfK9ZhQLXATZEixbXaAtDHf1Km2kR+KF LsE2F8qKkWomtvERG+Lw0scVKRG/JcC0OhdTnomlFq2Q47+uyUG52KBYDxOHzkJ0vrhf 6mlqP1NEPeu8h5I+w8qkq0s316lgldFenrNJV1ZC7mPJ1AmnSrCyBzm+lU6H6v7RiUtg jDBjCdzNXmPqaWEopgvkJpX/iqo9VzVTzQM9Z9+1cn/o2GMvtVxumfriGdVVI0OTIJoa 9Pm8+Sim45uVJRkpdDH0p1DrJheW7eSDxEO8Jiviqe6M7OL5c8BWMR8FyoDHGdbRwfXv 6YJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=3YkDhKEBzTshdtLOhB5/fwizErr/VQd6Wx9EMZFNHQo=; b=aItJ+FpffEuSRmKZyZy55SUUVb7VZmGgCTwX/opqlvYlJ7nc+jpiRuPsAuNMZYzzkz 82O14sxihkeNSx4nJNMPCVv3wzzZBDnRL4t9dc0tefG2B03jWqksx049oAeTxEszYuYs rdqPKKsF088BJZcruFsMEPohKFQKd/3aFB3hgq2j1mNIJdhZ2RmEQBJDDxLTt0K0TBdt fOkGoP6cgRQDFT8P3RzTUbesA1ahRSN57o8GXHMyJc6DsLBi3zHpSNn+KgZs0/7FyNlH VG5ggDXO1RhrHSzMhJHZyBcFZmf8DjNBVH4J8UmAm1f0tcMHXgfDUAJ2DY7IPUvyqwOp 77MA== 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 w89-v6si16942338pfi.88.2018.06.19.01.10.45; Tue, 19 Jun 2018 01:10:59 -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 S937390AbeFSIJ7 (ORCPT + 99 others); Tue, 19 Jun 2018 04:09:59 -0400 Received: from 178.115.242.59.static.drei.at ([178.115.242.59]:33697 "EHLO mail.osadl.at" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1756374AbeFSIJ5 (ORCPT ); Tue, 19 Jun 2018 04:09:57 -0400 Received: by mail.osadl.at (Postfix, from userid 1001) id AD6C25C2144; Tue, 19 Jun 2018 08:08:34 +0000 (UTC) Date: Tue, 19 Jun 2018 08:08:34 +0000 From: Nicholas Mc Guire To: Geert Uytterhoeven Cc: Dan Carpenter , Nicholas Mc Guire , Greg KH , driverdevel , natechancellor@gmail.com, Linux Kernel Mailing List , Geert Uytterhoeven Subject: Re: [PATCH] staging: board: drop refcount in success case Message-ID: <20180619080834.GA31882@osadl.at> References: <1529347999-9316-1-git-send-email-hofrat@osadl.org> <20180619073709.schatjhjoitfc3fs@mwanda> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 19, 2018 at 09:51:44AM +0200, Geert Uytterhoeven wrote: > On Tue, Jun 19, 2018 at 9:37 AM Dan Carpenter wrote: > > On Mon, Jun 18, 2018 at 08:53:19PM +0200, Nicholas Mc Guire wrote: > > > The call to of_find_compatible_node() returns irqc_node with refcount > > > incremented thus it must be explicitly decremented here after it was > > > checked for non-NULL. > > > > > > Signed-off-by: Nicholas Mc Guire > > > Fixes: commit 72ee8626eeb1 ("staging: board: Add support for translating hwirq to virq numbers") > > > --- > > > > > > Problem located with an experimental coccinelle script > > > > > > Patch was compile-tested with: x86_64_defconfig + STAGING=y, STAGING_BOARD=y > > > > > > Patch is against 4.18-rc1 (localversion-next is next-20180618) > > > > > > drivers/staging/board/board.c | 1 + > > > 1 file changed, 1 insertion(+) > > > > > > diff --git a/drivers/staging/board/board.c b/drivers/staging/board/board.c > > > index cb6feb3..8ee48e5 100644 > > > --- a/drivers/staging/board/board.c > > > +++ b/drivers/staging/board/board.c > > > @@ -64,12 +64,13 @@ int __init board_staging_gic_setup_xlate(const char *gic_match, > > > irqc_node = of_find_compatible_node(NULL, NULL, gic_match); > > > > > > WARN_ON(!irqc_node); > > > if (!irqc_node) > > > return -ENOENT; > > > > > > + of_node_put(irqc_node); > > > > I don't feel like this is the right thing... We should keep the > > reference until we're done with it. Which apparently is never? > > Indeed. The reference must not be released in this function, as it's stored in > a global variable, and used later. yup - I had simply interpreted this incorrectly as checking only and overlooked that this was a global variable. > > As all users are __init, it could be released when the init section is freeed, > in theory, but there's no callback for that. > > Hence: > NAKed-by: Geert Uytterhoeven > thanks for the clarification - sorry for the noise. thx hofrat