Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3094640rwb; Mon, 15 Aug 2022 18:00:10 -0700 (PDT) X-Google-Smtp-Source: AA6agR7r2A8eAdc1TWc0rykOxqqFeKhoO/Ogkq8IwMpMQV1RRVF2IMdkaSTKp21QLRsl8wVQnd/q X-Received: by 2002:a05:6402:424d:b0:43e:95d8:eb46 with SMTP id g13-20020a056402424d00b0043e95d8eb46mr16983596edb.306.1660611610275; Mon, 15 Aug 2022 18:00:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660611610; cv=none; d=google.com; s=arc-20160816; b=mGVpGiKKJKZFqyqz1YDe20ZhO78g6wlUUG1W+/rDqgz2T94zU2IQj+WrSfmJZFhHVP Mb3Awp3/BbRsItH9+ENFp6m9se2qoc6fNdWcgZCKCzZJWnhOTX93O3rykQBU3Da09zNt PkIieIeRVkucXVIdQ6nZ8rpYJU8qzDUqm+6n5YHFofstNL2qtVFSfFxzoyCg+aT9PmEa 1m+ZJiymOjao+dmho4KCP93+bl1kkmJ0Ua4BMevxMAa5BMdU44aEzRlIS1nBYAzrPARX QFCfbozg68f2xO/Kxv4O6k0d+m93CtlASuzK63adQipEJaCA+3rwn11ki5R+cFXTHVir T6qQ== 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=YhOzS3VdUiVKKSB8VTaB04N/jFNBg3LrxL3fTU90XqU=; b=mLkMi5OMPj+xMrkgst7+ereljaJWWzg6K18Rooq1fSXoBzesqwrZTEQzx8UPn5xMAL TTzeksN5Fihrxd077Uc48zRBdBAhD/viW+zmUdp8EBOxcqRI1WlCBhcUY96coFIRK+Pb dH4c9CCFFqYJdKprhcTFvxu//zz8dzUoknlJqDYlg4VYsfaBI/vX07pt0TcqIjluZzjw DNl7q8GX2t4fJbb8EXllGfo/6mCpBe6XsWzQM6jbJicv8ISQlT+HSpmEo+aU8nmm9dNb m9k/kbrtMboR1tdCYvhd3TPxzHGkydQXRmAEQ1mRE7AKf5L8FoaAozZb68SJUiSnM+vQ eToQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=j60y1S9h; 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 dz11-20020a0564021d4b00b0043d5841a2b6si10000269edb.450.2022.08.15.17.59.38; Mon, 15 Aug 2022 18:00:10 -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=j60y1S9h; 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 S245748AbiHPAtZ (ORCPT + 99 others); Mon, 15 Aug 2022 20:49:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347029AbiHPApu (ORCPT ); Mon, 15 Aug 2022 20:45:50 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B015D477F; Mon, 15 Aug 2022 13:41:02 -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 ams.source.kernel.org (Postfix) with ESMTPS id 13B04B8114A; Mon, 15 Aug 2022 20:41:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 67BFEC433C1; Mon, 15 Aug 2022 20:40:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660596059; bh=D6XnQg1CsGu7Vx9lk0X2XQu5E8oNyv90wVb7G96iflc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j60y1S9hQGWzVmxjE/cxXoxV1Dn3ZJl5uoNjLbSmMHHUEw0Zr8QXqZwJiDMXy+p3j 0zqn+y9ziJFxPUGwA6Hm8DeDGP+Q0bjZ5VfGqqkYF6jjBmFcpkEHzI/rEmRfMFkl3t JofCCdYf8Hi/6Z3hazXrYQgluSOFjcQwB4n1BlsU= 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.19 0960/1157] net: 9p: fix refcount leak in p9_read_work() error handling Date: Mon, 15 Aug 2022 20:05:16 +0200 Message-Id: <20220815180518.042090237@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@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 007c3f45fe05..e758978b44be 100644 --- a/net/9p/trans_fd.c +++ b/net/9p/trans_fd.c @@ -343,6 +343,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