From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D98CA6FA1 for ; Mon, 3 Apr 2023 14:36:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 62FE4C433D2; Mon, 3 Apr 2023 14:36:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1680532604; bh=2sqtOj+1ALMyYEPN/XCPWThb1VdY14/vc//Wws1RtxA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b1J0IvNeiw2BHtCms/nR6MKN7JovxBshalBnjGFt9J7C5NlezfQsWZ1XCpLkFU/TA NBErtf+RQVE1mhvmtbzN4bh7/2L7jnkD5Lo5vu9t4qs51Eu6hu5cRITsprgjDZ05th WzsNaB7wO4mQZbvCURWyJG+C3huhfcQHo2tLwroI= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Chia-I Wu , Felix Kuehling , Alex Deucher , Sasha Levin Subject: [PATCH 6.1 046/181] drm/amdkfd: fix a potential double free in pqm_create_queue Date: Mon, 3 Apr 2023 16:08:01 +0200 Message-Id: <20230403140416.649834844@linuxfoundation.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230403140415.090615502@linuxfoundation.org> References: <20230403140415.090615502@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Chia-I Wu [ Upstream commit b2ca5c5d416b4e72d1e9d0293fc720e2d525fd42 ] Set *q to NULL on errors, otherwise pqm_create_queue would free it again. Signed-off-by: Chia-I Wu Signed-off-by: Felix Kuehling Reviewed-by: Felix Kuehling Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c index 5137476ec18e6..4236539d9f932 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c @@ -218,8 +218,8 @@ static int init_user_queue(struct process_queue_manager *pqm, return 0; cleanup: - if (dev->shared_resources.enable_mes) - uninit_queue(*q); + uninit_queue(*q); + *q = NULL; return retval; } -- 2.39.2