Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1716093pxj; Wed, 19 May 2021 12:11:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyhsye4ZA7G9DTXObUFT07QZBLR+ItCPEws58Vky7mCUqbgljlPDs/V2XvXOMwUX0+3eqz1 X-Received: by 2002:a05:6e02:d:: with SMTP id h13mr579669ilr.112.1621451501759; Wed, 19 May 2021 12:11:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621451501; cv=none; d=google.com; s=arc-20160816; b=IT7D3Xs0unDdf++7CMTc7cL79C7KVVIOXYcHw2kLSZP5cVSlaW5kb2YwghvRhB8TmA bgEOPqdBKMp9nda0wJyaKRxpXDrvPZQEnbZco6RHnwSYIf/sOPYLXynTPNp9qMuzFDFr vtF1Jvnr5tXsy8CppAwOfOz8KnH7tQLYcKweXhNcAF28llydMvz2zBOSPoC7K/Ic/eYM GHUUwvE9pFXzoJy8L1If7A8pJoRSlglurytjgPPIcrVcnwz97wWenxT85wW+mrpm8DIu RcKU/Qj7Ze/nWcYyGo/uBy2IKcASW1a3oibJW7u4Fi+ZUQGMr7ZnKkjC2Y5PahfDqrgZ svng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=2G47Sfhz8LgDvpBLctH/CnX9qNhgpEUQPmqPsKIYV2k=; b=nDFmXNxtVEtxZ1g+6tk/hDkaOPoIF6VmV3kebtL0jxhbU9+m4xjW2d3/ZMRk0rRrW/ isMcT/VC69iYCACkqPwR2Imzen6T9J33JGQNslTpboHmX0eY28AjbguVVKmzIRMKxBwe b7W8AMXiQ0UAuHnq1zCAhQbUxE1KnYSw0wrGijqE+Vb6XkPEs+jrcOsfvIwfgDk2ZZPg 3KqqZOfMB6x+r+gaDVyMMBRFLSg9CmPRwo1Ki96p6JaHE7h5hnLmHbqA+fmLM+04dUsw qywm+mLbzxtI2zDXcgLpkNv/1yi85AoBC2aC3x91xJl/mjEWmH0AD1wsU55mxSTSvMfs 9nMQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z2si189862jat.35.2021.05.19.12.11.27; Wed, 19 May 2021 12:11:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353284AbhESEgo (ORCPT + 99 others); Wed, 19 May 2021 00:36:44 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:3413 "EHLO szxga07-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243821AbhESEgk (ORCPT ); Wed, 19 May 2021 00:36:40 -0400 Received: from dggems703-chm.china.huawei.com (unknown [172.30.72.58]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4FlKjF3HFHzCswC; Wed, 19 May 2021 12:32:33 +0800 (CST) Received: from dggpeml500019.china.huawei.com (7.185.36.137) by dggems703-chm.china.huawei.com (10.3.19.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Wed, 19 May 2021 12:35:19 +0800 Received: from huawei.com (10.175.124.27) by dggpeml500019.china.huawei.com (7.185.36.137) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Wed, 19 May 2021 12:35:19 +0800 From: Wu Bo To: , , , , , , CC: , Subject: [PATCH 1/2] nvmet: Fix memory leak in nvmet_alloc_ctrl() Date: Wed, 19 May 2021 13:01:09 +0800 Message-ID: <1621400470-593256-2-git-send-email-wubo40@huawei.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1621400470-593256-1-git-send-email-wubo40@huawei.com> References: <1621400470-593256-1-git-send-email-wubo40@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpeml500019.china.huawei.com (7.185.36.137) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Wu Bo When creating ctrl in nvmet_alloc_ctrl(), if the cntlid_min is large than cntlid_max of the subsystem, and jumps to "out_free_changed_ns_list" label, but the ctrl->sqs lack of be freed. So to fix this issuse modify jumps to "out_free_sqs" label. Fixes: 94a39d61f80f ("nvmet: make ctrl-id configurable") Fixes: 6d65aeab7bf6e ("nvmet: remove unused ctrl->cqs") Signed-off-by: Wu Bo Reviewed-by: Sagi Grimberg Reviewed-by: Chaitanya Kulkarni --- drivers/nvme/target/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c index 25cc2ee..1853db3 100644 --- a/drivers/nvme/target/core.c +++ b/drivers/nvme/target/core.c @@ -1372,7 +1372,7 @@ u16 nvmet_alloc_ctrl(const char *subsysnqn, const char *hostnqn, goto out_free_changed_ns_list; if (subsys->cntlid_min > subsys->cntlid_max) - goto out_free_changed_ns_list; + goto out_free_sqs; ret = ida_simple_get(&cntlid_ida, subsys->cntlid_min, subsys->cntlid_max, -- 1.8.3.1