Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3542605pxj; Mon, 24 May 2021 09:02:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwech08bkmVyoUdUZqPCNmG8A3BkI8vahoSApB7pBA1oHZYDZrJC1Iz15Tb9HRbREHLnB34 X-Received: by 2002:a92:1909:: with SMTP id 9mr16461223ilz.229.1621872121844; Mon, 24 May 2021 09:02:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621872121; cv=none; d=google.com; s=arc-20160816; b=xVhsdxRCoSl+4qZaWX/TyvVomMsxl7FE5LHcH3n11JnCV/0LrvkBEOLBBhy5AnmKmn 6Zt3LyJYgYmikSDil1JtVO9Say26d9V1v/xi6XGgzrdtwwUiLh67C+3uXgMwFLPGnLP/ PFlOCfT7M4jFIXhJXpU2MMDifEXXK7/VuJxwS1BjdIiMXI/mih5VpA97AqMA0HIOIS0R DVw0N7DNcMRCHS5W6YjBUPcSPCQDOa2/NzhLY8EzUl9ws21TFZfEv1ECOyCm7Gi8RwjU q/+2EoGLKKAY5kHS4xzxJYa5Nm7G/byxTpoODDnknlghdVRkmCD3DzbvWTf5Xnywv1/5 sVlA== 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=nJ7n14B1eSDp3SvBjWgoUYUJGJedRo7wPviSxBPKWI4=; b=QQ6ng4pJZxiLJMxu1ku5Pm9hBZgM3zot8hXhWJ3xARq6HEk5XKOsi3fuo1EjGXhzU4 qOp7QnEmiy6q64dedQEuNeKXKp+hj3VytNCyQUVgTdFfH+TrYYiJ8btJ+J/Tp2sI7wp+ LTh0CVtJMXgQ+C5u/cx23tf5gkRcVoSfut6LQrB8D+XQ8syoO0NYQem7L5hj5DRytbK6 7wUUMFA92k4VDpzJQ8T2wX6BM3mVFRkQAJVALQG1s9o8KoLqhpGrU9HfskQkRMJB45bx ARAiUGFIWYaMxGGteCkhg+ukwPyNK6p8WnQP37qBJNwyWke3JJrAx4ijHUJ4i2IrUfhU /EGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fP2xM97S; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e11si14649460jaj.14.2021.05.24.09.01.47; Mon, 24 May 2021 09:02:01 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fP2xM97S; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236078AbhEXQBa (ORCPT + 99 others); Mon, 24 May 2021 12:01:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:38716 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234419AbhEXPwQ (ORCPT ); Mon, 24 May 2021 11:52:16 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4C290613F7; Mon, 24 May 2021 15:39:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621870742; bh=ApvW2V6KWLhOtJ8ac1/OCP6FFLc5dYX2ZjHqXelPi4A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fP2xM97S3FCKNIhZvNNd5Pfz1FftVvy2t7gM5QW26KTpuvIhhP1fXYOkWalZzeLQq njyiR7qMoG+X/b9i7MYFlIpGW9TZ6/u3RDI+E/L8DhhLMqf6ex1kmh5Rol8C1mg9zz sh2+pJcA1df4ERvKgSMh7iUOnC4YsxRly5UQ9bTQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wu Bo , Sagi Grimberg , Chaitanya Kulkarni , Christoph Hellwig , Sasha Levin Subject: [PATCH 5.10 014/104] nvmet: fix memory leak in nvmet_alloc_ctrl() Date: Mon, 24 May 2021 17:25:09 +0200 Message-Id: <20210524152333.299634693@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210524152332.844251980@linuxfoundation.org> References: <20210524152332.844251980@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Wu Bo [ Upstream commit fec356a61aa3d3a66416b4321f1279e09e0f256f ] When creating ctrl in nvmet_alloc_ctrl(), if the cntlid_min is larger than cntlid_max of the subsystem, and jumps to the "out_free_changed_ns_list" label, but the ctrl->sqs lack of be freed. Fix this by jumping to the "out_free_sqs" label. Fixes: 94a39d61f80f ("nvmet: make ctrl-id configurable") Signed-off-by: Wu Bo Reviewed-by: Sagi Grimberg Reviewed-by: Chaitanya Kulkarni Signed-off-by: Christoph Hellwig Signed-off-by: Sasha Levin --- 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 870d06cfd815..46e4f7ea34c8 100644 --- a/drivers/nvme/target/core.c +++ b/drivers/nvme/target/core.c @@ -1360,7 +1360,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, -- 2.30.2