Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp892988pxf; Wed, 7 Apr 2021 14:20:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx4KJT3B8/RvfeHMkM7Vo3TdhvGpCk2phqTDD7AnxHZq6tNBlK0K24zwhQobnzi9mj16oDO X-Received: by 2002:a05:6402:1051:: with SMTP id e17mr7032938edu.42.1617830422964; Wed, 07 Apr 2021 14:20:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617830422; cv=none; d=google.com; s=arc-20160816; b=woMKmjKjG0eCNcUy3CF5SCMUc+el4VEqOIinDk9geqsNWtArF3fizHvk30ykqIbWml ++PnUt7ux07U9d8PPXwN+agDZ0k6YKkjAxWptCVFQfp2GMxi26IfuXxWq6kBqb7pUlnN x11BOOqoanDXF5SufqWxgghTf3Bv46Bt09hn4RiUhcYutgsNeiPWt0v28R63ZuHu37F4 b5cex9pHES6XYUMNFFu5DOkn+/R4agDV+DPTI/POe+fBd2FrRvlCLN99k0GJj7Z4Cra/ 96Nu/eM6MtoMBJGZwUjzVEx3NnrZdk5DHNnB9L2k/uFRqkS6rAC969OmBpel74tHN5Y8 KMoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature:dkim-filter; bh=bLQwzZC+bbhqKQBwwlTZfOUN0mKSee0/NQ+qVibG9tA=; b=awp0LhLbwQzr8Ym9GeZNCw/NhLtmhgtocp7KCr3GuXWLKqM1iC29pAM13bv5wx+NV6 d3qzV9DF057pARZSVQ0rE8ME9u+9FQnHk4pp4PGi/vE/P4B8BKLwESmffEnSr3riHftA HvqzcTZMvOzaC++OMLA9jX7BxZ8FxcFJIisCKsenpYQjN5iyZqALm9f41fHjlVyhaqeE ygNpJFWlUl2KsDvmM5z0TbE5QADON/a8QQGgy3DjlxmFVdVv2mTOeUQKLwDAhARU8JQx s8wXtsRBNUaziLMR/yeOB9cX4GC+wOuAw0NuRoMZp1IpH7dKwf3B7P8caz94cd0tKp7n o8hw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fieldses.org header.s=default header.b=BxDWI9Nj; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 8si23133525ejx.637.2021.04.07.14.19.32; Wed, 07 Apr 2021 14:20:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@fieldses.org header.s=default header.b=BxDWI9Nj; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232271AbhDGPfK (ORCPT + 99 others); Wed, 7 Apr 2021 11:35:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34358 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230248AbhDGPfJ (ORCPT ); Wed, 7 Apr 2021 11:35:09 -0400 Received: from fieldses.org (fieldses.org [IPv6:2600:3c00:e000:2f7::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 000AEC061756; Wed, 7 Apr 2021 08:34:59 -0700 (PDT) Received: by fieldses.org (Postfix, from userid 2815) id E5C6E6A45; Wed, 7 Apr 2021 11:34:58 -0400 (EDT) DKIM-Filter: OpenDKIM Filter v2.11.0 fieldses.org E5C6E6A45 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fieldses.org; s=default; t=1617809698; bh=bLQwzZC+bbhqKQBwwlTZfOUN0mKSee0/NQ+qVibG9tA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=BxDWI9NjGmn6HGVSDiAJrvOjV3elqwdY183AU2UszAVMZ8YhXiuxCvN4Y8iDUZoqG dPnrzDbm+UF74K70EuqcAwDc3WO8Dl10+HR0kH2fJ9dDvJQWpjd0A5EnhF5YGkpQRU xG8nwVkN+xrMHVh/Y8zm9kFnu5LHNpgL8PYADcx4= Date: Wed, 7 Apr 2021 11:34:58 -0400 From: "J. Bruce Fields" To: Aditya Pakki Cc: Chuck Lever , Trond Myklebust , Anna Schumaker , "David S. Miller" , Jakub Kicinski , Dave Wysochanski , linux-nfs@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] SUNRPC: Add a check for gss_release_msg Message-ID: <20210407153458.GA28924@fieldses.org> References: <20210407001658.2208535-1-pakki001@umn.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210407001658.2208535-1-pakki001@umn.edu> User-Agent: Mutt/1.5.21 (2010-09-15) Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Tue, Apr 06, 2021 at 07:16:56PM -0500, Aditya Pakki wrote: > In gss_pipe_destroy_msg(), in case of error in msg, gss_release_msg > deletes gss_msg. The patch adds a check to avoid a potential double > free. We're already dereferenced msg. Nothing has set gss_msg to NULL. It's the gss_msg->count reference count that's supposed to prevent double frees. Did you see an actual bug or warning from some tool, and if so, could you share the details? --b. > > Signed-off-by: Aditya Pakki > --- > net/sunrpc/auth_gss/auth_gss.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c > index 5f42aa5fc612..eb52eebb3923 100644 > --- a/net/sunrpc/auth_gss/auth_gss.c > +++ b/net/sunrpc/auth_gss/auth_gss.c > @@ -848,7 +848,8 @@ gss_pipe_destroy_msg(struct rpc_pipe_msg *msg) > warn_gssd(); > gss_release_msg(gss_msg); > } > - gss_release_msg(gss_msg); > + if (gss_msg) > + gss_release_msg(gss_msg); > } > > static void gss_pipe_dentry_destroy(struct dentry *dir, > -- > 2.25.1