Received: by 2002:ac2:464d:0:0:0:0:0 with SMTP id s13csp2001205lfo; Sat, 28 May 2022 13:23:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwipm9ftblIzzRT/RcA2E+RHNtU8molr3YTmVX0ElIH0xtBgEAgWp60ANyOvq9CcopS3xuB X-Received: by 2002:a17:90a:d505:b0:1df:7d0e:a03c with SMTP id t5-20020a17090ad50500b001df7d0ea03cmr15049358pju.170.1653769381692; Sat, 28 May 2022 13:23:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653769381; cv=none; d=google.com; s=arc-20160816; b=bRElaUL4MDFuMMc/IvfPOTS3rgp41K1zI57JbKinn5NdH97B7e2+MVPY+F0DwsofhT G3PRoPQCG8SZ5x7FYCYk2dKt0wx31X5MgzksK8YSwRv/9k1eRZdvEe9e6snQzcLdMLdt XoSwcNHCAz4Hg0ZJJrukcZXXZMixGKe1wEpu+5RI9haqfqbfLgUiuX/mumEz0RkTS39v HADvW68nqM8ybQEbGZZ4wBSqgRYpvf8pXZlDbmsmim76MhJqPHTlnf2xa+DJNjdVVemv 4meqiOiKaxJK+SYLH+Q+IO0Uy2S7cSX1lrevLt3MMSDtrSYlz4dQkLUisrEQunyicBBM b2oQ== 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=b2P3QH6vt+McJy25fKhf43Jb4cDyVE2JY2bcEA7mzQo=; b=o+VQI/l/+OTXo/DU+2qU5TH/R7cRQ52H3mPVhFt2TL58NulPkxOHX9ZKj2oFLoC4hp qeNRVxJnB2w9Tqf6d0nyYRIJyMczEgOaW+Cw1EFIG2pqz/1iAEMw8LmbeplC7Ahux3Z/ xMWe5s8+qo1efekx7yyct89mBBx8f1xveeguXcDlI+KlLU1bcr/gfY6msRct+aUjV9BK USIihOlz+ci6nJBkRyGC8+9mr1iEhgK1UTW8FU49KQS5S625coBvndT6r1T2kW3vrNyc fXUEG6189G73iK7KX3xFjFzA1sC3pkK+egImSAxhvIniYgxxd4e4EXLRcx8frz/86Hhg 7p4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=WDptdQL7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id z2-20020a6553c2000000b003f6298dd4e0si10680154pgr.355.2022.05.28.13.23.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 May 2022 13:23:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=WDptdQL7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A301855351; Sat, 28 May 2022 12:30:08 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240904AbiEZBjQ (ORCPT + 99 others); Wed, 25 May 2022 21:39:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229458AbiEZBjN (ORCPT ); Wed, 25 May 2022 21:39:13 -0400 Received: from mail-m974.mail.163.com (mail-m974.mail.163.com [123.126.97.4]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 62C049D4FD; Wed, 25 May 2022 18:39:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=b2P3Q H6vt+McJy25fKhf43Jb4cDyVE2JY2bcEA7mzQo=; b=WDptdQL78j+RaS/nAHlYX 1Ce4aKhc4cNCcl5AxJK1AkEFLoy6YFb8SUGN9FUqFWukOvX2K+qSVayAHKuGitqX DHE9c9TyX+fYi6o1XcqZGm/kb/MR8YwojTjisk5yHeYHPRJXQBRWwEVwVe8SGfIG Xq94AeLZ77Q7yb0HmOMjoM= Received: from localhost.localdomain (unknown [123.112.69.106]) by smtp4 (Coremail) with SMTP id HNxpCgD3__Mh2o5ig+JFEQ--.3894S4; Thu, 26 May 2022 09:38:46 +0800 (CST) From: Jianglei Nie To: bootc@bootc.net, martin.petersen@oracle.com Cc: linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, linux1394-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, Jianglei Nie Subject: [PATCH] scsi: target: sbp: Fix memory leak in sbp_management_request_logout() Date: Thu, 26 May 2022 09:38:39 +0800 Message-Id: <20220526013839.471987-1-niejianglei2021@163.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: HNxpCgD3__Mh2o5ig+JFEQ--.3894S4 X-Coremail-Antispam: 1Uf129KBjvdXoW7GFykCw47GF4DtF18KrWUXFb_yoWfWrgEkw srW34xurn5Ww4kKF4jkw15CrWavF4kZF1ayF4ktFWakrW7Wr1xXr1q9F93A3srCr48JrnY kFsIvr1Uu3y5ujkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7xRibAwPUUUUU== X-Originating-IP: [123.112.69.106] X-CM-SenderInfo: xqlhyxxdqjzvrlsqjii6rwjhhfrp/1tbiMgQMjFWBzm5eRwABsa X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 When req->node_addr != login->sess->node_id, sbp_management_request _logout() returns without releasing the login, which may lead to a potential memory leak. We can fix it by calling sbp_login_release() before the function returns. Signed-off-by: Jianglei Nie --- drivers/target/sbp/sbp_target.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/target/sbp/sbp_target.c b/drivers/target/sbp/sbp_target.c index 504670994fb4..76f3ec58a24b 100644 --- a/drivers/target/sbp/sbp_target.c +++ b/drivers/target/sbp/sbp_target.c @@ -575,6 +575,7 @@ static void sbp_management_request_logout( req->status.status = cpu_to_be32( STATUS_BLOCK_RESP(STATUS_RESP_REQUEST_COMPLETE) | STATUS_BLOCK_SBP_STATUS(SBP_STATUS_ACCESS_DENIED)); + sbp_login_release(login, true); return; } -- 2.25.1