Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2924053rwb; Mon, 15 Aug 2022 14:08:59 -0700 (PDT) X-Google-Smtp-Source: AA6agR4bmJDYdp+CIchylI2iMJ7gqMF6FM2BpYJuESblY9KhdfLpP0DhC0lfIhIqZB8l/BQYiSoX X-Received: by 2002:a17:906:9be1:b0:730:957f:34a3 with SMTP id de33-20020a1709069be100b00730957f34a3mr11477998ejc.47.1660597739556; Mon, 15 Aug 2022 14:08:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660597739; cv=none; d=google.com; s=arc-20160816; b=QgOAtLiIA8hYi2q9PXA6osmyTNUR9xnNEs3mTZ5z/hikqba7H51AFEeebv0r7pkcL5 COxyNJbLEvVATAud7VbGYyaYLa3CtEzSFvWPkT3LFryQ5C1AupIkBRG40Nf2UQB57aUo gAdq+aU6TseS41oBkDrwycgVl3x9RFNYbuWJc8RCw85uG5gkhoj9YLnEKjfJ8uwNJLz6 Gpn1zNVUvGONYMMkQxf7i08r1T08Y+aZf4UX6hmzOawpk2oUloGKL4NJLhwvQPJ4w0cr Wk9By+BJPgqCKhHgsRCG9nR90yPiiulKQ/7tL8OrdxgwYhq7kDEt1QjhqtgSCtBaR1jx rjXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=eDDDkTQLSY5v1ngNWOFXrevyw7UK4FMrM1MzOUEt2hY=; b=J8sS7GpHGqjJonbp5Ipcg2at/jBx7cv17TK57OaDi1uB7UJqDEK+yvQp2uabT5/QY0 N8fxs5egsAore604j78pxfqD1P11vvpfHLljcOZuTzLMyt8MEvV9B+FhcrwyZOonTjML JbkbKmOxZ4HDO3zde8W3HAVEHQYQSdtDsYa8fyZeyQJVWyOkFQQUSq0TJomahXW22OsU 0htcF/skRWspNp5EvjetyE3hgm1nruO+rl241QjlfvZLbn6V2qRsOYslMnt06I+Z0l0N KxG/uZjZ7W6f+NgEZ27dMsCTL4mwtBUqLdSmPMi/ZABdTVcqZk1OVtJlieYzpxgRmkPs WKOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=TgjQQcCV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j17-20020a05640211d100b0043d72da65f8si10577573edw.245.2022.08.15.14.08.34; Mon, 15 Aug 2022 14:08:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=TgjQQcCV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245143AbiHOThE (ORCPT + 99 others); Mon, 15 Aug 2022 15:37:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344471AbiHOTba (ORCPT ); Mon, 15 Aug 2022 15:31:30 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB93961107; Mon, 15 Aug 2022 11:44:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 18E53611E6; Mon, 15 Aug 2022 18:44:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 06438C433D7; Mon, 15 Aug 2022 18:44:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589079; bh=BE+qFjw6qKenTUdK2eHcBqM74EQDU1O2m42p5rJePb0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TgjQQcCVsLvueZOEpMlvioDUYxAg42wrH5vD1Nq/xbIb3FkJ6GHNFt7QfUN9wWjBg 9h+UXQ66+Nn7LvrocxrUGuAiQN3dzmUJkDbUCJghTmLj/PYvMzEapnCnLFDu3O1vz9 rJ8S7yLp9M6eAfVJ0PZi2wwD52wRTlvrgzBILNZY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hangyu Hua , Dominique Martinet , Sasha Levin Subject: [PATCH 5.15 607/779] net: 9p: fix refcount leak in p9_read_work() error handling Date: Mon, 15 Aug 2022 20:04:11 +0200 Message-Id: <20220815180403.298006742@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hangyu Hua [ Upstream commit 4ac7573e1f9333073fa8d303acc941c9b7ab7f61 ] p9_req_put need to be called when m->rreq->rc.sdata is NULL to avoid temporary refcount leak. Link: https://lkml.kernel.org/r/20220712104438.30800-1-hbh25y@gmail.com Fixes: 728356dedeff ("9p: Add refcount to p9_req_t") Signed-off-by: Hangyu Hua [Dominique: commit wording adjustments, p9_req_put argument fixes for rebase] Signed-off-by: Dominique Martinet Signed-off-by: Sasha Levin --- net/9p/trans_fd.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/9p/trans_fd.c b/net/9p/trans_fd.c index c55c8a608bc7..6fe3719c1fc6 100644 --- a/net/9p/trans_fd.c +++ b/net/9p/trans_fd.c @@ -345,6 +345,7 @@ static void p9_read_work(struct work_struct *work) p9_debug(P9_DEBUG_ERROR, "No recv fcall for tag %d (req %p), disconnecting!\n", m->rc.tag, m->rreq); + p9_req_put(m->client, m->rreq); m->rreq = NULL; err = -EIO; goto error; -- 2.35.1