Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4229325imw; Tue, 12 Jul 2022 04:29:27 -0700 (PDT) X-Google-Smtp-Source: AGRyM1v/w+IGWv/TJ94aJzRqdm5wsSiU88WmKim8ZQW4UEbeaGAc52WA7NbvATfiyz25jf0SiQjS X-Received: by 2002:a17:902:7087:b0:16b:d978:38a4 with SMTP id z7-20020a170902708700b0016bd97838a4mr23748690plk.108.1657625366771; Tue, 12 Jul 2022 04:29:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657625366; cv=none; d=google.com; s=arc-20160816; b=Xi0syC/zMsmT2du0UVMGge096zVOpYESkIcmYG+51DUrhmPBMDSYERKyBuX6kHdV/b vJ0UQTuhiswKOZ64DY+/0sqDcOzOm1pyMgKCtVzcyLunvCmFQJiDifYnhHfp7H2xQcrK Z663Fc7/oSNCLvqKF0tPlNQuPiMpMgxEEd+UMGIUpU2wWegbUmR7Vksni1vOMEb6oP/5 L7qxJ5pTm9FCqnYyNu6Y19ovioV0dHXpzMgRhopwvJepxeLwGODOsatP+ZG6lS8aWwb+ xREGlAI+i1SXS2X3O+FrYFBnr3HUnQ6tVrvFRDp6NTSM9Yin2tpHAXq4fQyNpHK42y7i ltZA== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=LHFcdt/M7EFun7/LtZfwRF7i8tXqFEDcoXVMpTsmevI=; b=aar/eHofyEfafCStrISavaNFNuHQdGhyKTX2FiHoQ/+d0DTP5jfCO0M0TDNq+i7+89 JOOXW4usPjSwrM/X/4Lrnh3OLVo3+v+ZS1JLAVh1BxfJqxAJAIggdcm8Jpy9zGCD0o+y 9dLmko94XlkMq/1wDnOoKIz+m4V+gDVcSNgF4YadaRFl2Juxmin8gXhtc9BBVmoGRrG2 jzwM9PHEgtIH+l3y8yyaOKjy85CGwQvlnM7nFxml4SAjjZT4j1qlLckGRSyBnqNhSXnS nTk3Qy+OIY3UmiU92kh75jnm4ooipKKI3G2xgVqVUJcvXKkjBl3iyfPUNYlPD4JVkZal dCOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=CM6E0gWM; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s11-20020a170902c64b00b0016c484f4c89si6137408pls.546.2022.07.12.04.29.14; Tue, 12 Jul 2022 04:29:26 -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=@gmail.com header.s=20210112 header.b=CM6E0gWM; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232226AbiGLKoz (ORCPT + 99 others); Tue, 12 Jul 2022 06:44:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229889AbiGLKoy (ORCPT ); Tue, 12 Jul 2022 06:44:54 -0400 Received: from mail-pl1-x644.google.com (mail-pl1-x644.google.com [IPv6:2607:f8b0:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F2D9AC051; Tue, 12 Jul 2022 03:44:53 -0700 (PDT) Received: by mail-pl1-x644.google.com with SMTP id r6so4478109plg.3; Tue, 12 Jul 2022 03:44:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=LHFcdt/M7EFun7/LtZfwRF7i8tXqFEDcoXVMpTsmevI=; b=CM6E0gWMLJ5qt1wx2A0YMDp8y9kCQQgtYbH1SKHLAFqJVb63vwoe/DZn5fwC1LwOcr Y0vht9vEm5cX6CMdJSfktp7VvHZBTWyvjBZJs13dbyWLzPZzh0TIgWi4JjL01TuBUwxJ KjOk/5ujryU/QK8/g0zh2ogzWP/RIrtGFfpZ+mBKgNBXf94PbeCTDVelL/n66A/cWl+d 8OTa0f8rMJNoKL2KuvMIFuUO3/IWeBz6SH+5IQFEBfej9z3j5PvdBIh6QHflaVwSfQsr 5ApVBLrcIxJUsFf4blFPQMH6WlOz8X8Uj4Z/8Voz4Gnu+Lj04YOYZdJzBGMeY8NPtpUY Z/Ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=LHFcdt/M7EFun7/LtZfwRF7i8tXqFEDcoXVMpTsmevI=; b=NCsEQSjj+8OH2/ewFbVlKgPyjrY6vHqN4XCSynfYaCCbQ3tZAF9Zbb8wk0SU17froK K9x8ZyuTgUsK5DWYHsYyZIKtr/TbZ2zmcRw3DHJp8M+R4nZg3dCSr01MeC9ClfPAr5Kz 2d08fjIkn7MjNrgkWYgsg+dL+mchSINs1WDGzPwtwoZPOVkTFgW1ntaVF9eRa5w/w0lh VXUYiVI3IcBvJPdnIlIMouyCrdU0zJFF1UE62Rm33bftEagOic8m/LH0bLpy9v5d3YHm r3grndrg+dQxlRlCDqFlChjNz39wHyBGZaA46A7DAIKnuUHIx7Clh5OywvuqhJQU/JMR CkAQ== X-Gm-Message-State: AJIora+TlMBHbiJnPbPqfITm1ABE0mf2cLskBKIsg0+jzQxgURWOEXy1 GXy6PIkgthvMhexWRnNn8rA= X-Received: by 2002:a17:902:8345:b0:167:879c:abe8 with SMTP id z5-20020a170902834500b00167879cabe8mr22981968pln.7.1657622693149; Tue, 12 Jul 2022 03:44:53 -0700 (PDT) Received: from localhost.localdomain ([223.104.159.146]) by smtp.gmail.com with ESMTPSA id p10-20020a1709028a8a00b0016c0408932dsm6438727plo.129.2022.07.12.03.44.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Jul 2022 03:44:52 -0700 (PDT) From: Hangyu Hua To: ericvh@gmail.com, lucho@ionkov.net, asmadeus@codewreck.org, linux_oss@crudebyte.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, tomasbortoli@gmail.com Cc: v9fs-developer@lists.sourceforge.net, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Hangyu Hua Subject: [PATCH] net: 9p: fix possible refcount leak in p9_read_work() Date: Tue, 12 Jul 2022 18:44:38 +0800 Message-Id: <20220712104438.30800-1-hbh25y@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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 p9_req_put need to be called when m->rreq->rc.sdata is NULL to avoid possible refcount leak. Fixes: 728356dedeff ("9p: Add refcount to p9_req_t") Signed-off-by: Hangyu Hua --- Add p9_req_put in the "No recv fcall for tag..." error path according to Dominique's suggestion. 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 507974ce880c..090337f446d7 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->rreq); m->rreq = NULL; err = -EIO; goto error; -- 2.25.1