Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp125813imm; Tue, 10 Jul 2018 22:49:51 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeDqyGr4f30SLG39nq9Ao8DF293c4YfoKKroBHYsmT0CemyQL9DlJqVHdnJ908bIcbFDqOk X-Received: by 2002:a62:828a:: with SMTP id w132-v6mr15867192pfd.121.1531288191210; Tue, 10 Jul 2018 22:49:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531288191; cv=none; d=google.com; s=arc-20160816; b=eJu08rLKnH5Bw7V39wpFef3eGPnBQ8wEbhXtwNQq2STAoqSNVpfTsjTDpz2QBszNYx hjxiUDG3t0Lc5xyweiQvvuQqm0KkLRxcJoWKhI3PfQ1+o3DxuhtpGFIIvuWuUKshN3+B pxRyoIIli4xcIltTe1B9b89Xgvqc440AJQIQRrHczbcukGpqRHqRmh1v/CcjBBBbU3Zs zc5MMqpTCR4JMcZyTNJ6wmqNKlVAVjZg/ngBUXRf0BPtedEN8ZyecsSHbOGuBhtsTIo0 Ov1RM4kfjR25ZvBUwZiqAMMIS0zUPuZGfPnNRLWRNf4jPOcdAjSkbQ8yKavIc0ugf2Yt QcWA== 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=rYN/cEe63NheToHZuZoLOTrqB2dnOZzZ27oZTosU5Ms=; b=maSOmjYtsimVOo8MTaIWRsE2X0+4u1RbZfgPSZA7mAwQb3jfTrhMFilmTg9VGFJfDs dG/ttbdlU4lT0BmXHZ5wZA2OkOlv0QzQGu64hlpht4sk1jjYjlFcbjls7UIocczfLs4d RHYlZryQD6Pq7HG6iLEJ4xUMGSGCa0uoMEv7/e73VKHQUEiwgituxaxwC2l63FRrU1WC 0fxol4yTNk5YiZUlZIxLX5U9ddrESa0Qos4NrpGrJgwdXUVgenZJvmk4qca70Trm9Sz9 Ig7IkRadoux88D6+oRaJ/PHzm3ReRLiyCwomKi3miuvpGOPIp4trX/diOr6eVm3VSDsQ os2A== 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 z15-v6si18119308pgs.570.2018.07.10.22.49.35; Tue, 10 Jul 2018 22:49:51 -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 S1726505AbeGKFuc (ORCPT + 99 others); Wed, 11 Jul 2018 01:50:32 -0400 Received: from nautica.notk.org ([91.121.71.147]:55094 "EHLO nautica.notk.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725906AbeGKFuc (ORCPT ); Wed, 11 Jul 2018 01:50:32 -0400 Received: by nautica.notk.org (Postfix, from userid 1001) id AF7FBC009; Wed, 11 Jul 2018 07:47:55 +0200 (CEST) Date: Wed, 11 Jul 2018 14:47:40 +0900 From: Dominique Martinet To: "akpm@linux-foundation.org" Cc: piaojun , ericvh@gmail.com, rminnich@sandia.gov, lucho@ionkov.net, v9fs-developer@lists.sourceforge.net, Linux Kernel Mailing List Subject: Re: [V9fs-developer] [PATCH] net/9p/client.c: put refcount of trans_mod in error case in parse_opts() Message-ID: <20180711054740.GA932@nautica> References: <5B3F39A0.2030509@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <5B3F39A0.2030509@huawei.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Andrew, there seem to be some renew of interest in 9P lately, so if you'd like I can take care of rounding these up and prepare a pull request for 4.19 (as we're already well into 4.18 release cycle, I believe most of the patches can wait) This patch however I consider important enough to take for 4.18 so could you please grab it for now? I've gathered the Review tags and added my own, feel free to change my Reviewed-and-tested-by tag to Signed-off-by if it seems more appropriate as I'm actively pushing for this patch. piaojun wrote on Fri, Jul 06, 2018: > >From my test, the second mount will fail after umounting successfully. > The reason is that we put refcount of trans_mod in the correct case rather > than the error case in parse_opts() at last. That will cause the refcount > decrease to -1, and when we try to get trans_mod again in > try_module_get(), we could only increase refcount to 0 which will cause > failure as follows: > parse_opts > v9fs_get_trans_by_name > try_module_get : return NULL to caller which cause error > > So we should put refcount of trans_mod in error case. > > Fixes: 9421c3e64137ec ("net/9p/client.c: fix potential refcnt problem of trans module") > > Signed-off-by: Jun Piao Reviewed-by: Yiwen Jiang Reviewed-by: Greg Kurz Reviewed-and-tested-by: Dominique Martinet > --- > net/9p/client.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/net/9p/client.c b/net/9p/client.c > index 18c5271..5c13431 100644 > --- a/net/9p/client.c > +++ b/net/9p/client.c > @@ -225,7 +225,8 @@ static int parse_opts(char *opts, struct p9_client *clnt) > } > > free_and_return: > - v9fs_put_trans(clnt->trans_mod); > + if (ret) > + v9fs_put_trans(clnt->trans_mod); > kfree(tmp_options); > return ret; > } Thanks, -- Dominique Martinet