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 88CA01DE4D7; Tue, 8 Oct 2024 12:50:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728391843; cv=none; b=uDMudv/S8iUwOGoYOZzvcmg/kdtFrM4hbsOUeqeGcmNAYhKlAp3OKqsH3sL3tc4PusOFE1SUbjNJkvu4pK9hV1frUnvkX3PyLplaqmbaXUu09vxnOMatDVbDOKxyZ7cmvC34Jegl44honQ4hC6FeacNIVm0MtXbXVnpJaEmgmpE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728391843; c=relaxed/simple; bh=BA/CRZpKRoYW37RfppFQPvN2LOsf6h3ffWxJ5rKlstQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DDwbap3BPNy5ZYIlsXIeNk5mi0o4kKmNQG6TSl6mH10PrPKZJL0N3VZNbu3EzlFWsuDEH5cjcY/RLYK4259Ofo5ptKzLNa1A9VDGgY9ou9/diD7wWr1DcGjVshooIE7193Fu1tplw6j4jnE7cXVEr5ZhurcgySerAN9cIf7pcM4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Kl2w2pr9; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="Kl2w2pr9" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C5896C4CEC7; Tue, 8 Oct 2024 12:50:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1728391843; bh=BA/CRZpKRoYW37RfppFQPvN2LOsf6h3ffWxJ5rKlstQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Kl2w2pr99rTc86G/1If9AF+x6/zyynVXjdTgvEAqwlKcbzYTm5SC2O9CfgXGPIFp1 igURWjr5HrdiRO5lmh49ySKURuvfW5PUxI0zy+HoIQKaDyi1lnoewlHD5a7xR9Vn1y Q0F9S3pJBt3MO241aR1BbXkTAG1C6/6qKDC5qiJg= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Tom Chung , Rodrigo Siqueira , Roman Li , Alex Hung , Aurabindo Pillai , Harry Wentland , Hamza Mahfooz , Srinivasan Shanmugam , Alex Deucher , Sasha Levin Subject: [PATCH 6.11 209/558] drm/amd/display: Add null check for head_pipe in dcn201_acquire_free_pipe_for_layer Date: Tue, 8 Oct 2024 14:03:59 +0200 Message-ID: <20241008115710.567460059@linuxfoundation.org> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241008115702.214071228@linuxfoundation.org> References: <20241008115702.214071228@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.11-stable review patch. If anyone has any objections, please let me know. ------------------ From: Srinivasan Shanmugam [ Upstream commit f22f4754aaa47d8c59f166ba3042182859e5dff7 ] This commit addresses a potential null pointer dereference issue in the `dcn201_acquire_free_pipe_for_layer` function. The issue could occur when `head_pipe` is null. The fix adds a check to ensure `head_pipe` is not null before asserting it. If `head_pipe` is null, the function returns NULL to prevent a potential null pointer dereference. Reported by smatch: drivers/gpu/drm/amd/amdgpu/../display/dc/resource/dcn201/dcn201_resource.c:1016 dcn201_acquire_free_pipe_for_layer() error: we previously assumed 'head_pipe' could be null (see line 1010) Cc: Tom Chung Cc: Rodrigo Siqueira Cc: Roman Li Cc: Alex Hung Cc: Aurabindo Pillai Cc: Harry Wentland Cc: Hamza Mahfooz Signed-off-by: Srinivasan Shanmugam Reviewed-by: Tom Chung Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- .../gpu/drm/amd/display/dc/resource/dcn201/dcn201_resource.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/display/dc/resource/dcn201/dcn201_resource.c b/drivers/gpu/drm/amd/display/dc/resource/dcn201/dcn201_resource.c index 131d98025bd47..fc54483b91047 100644 --- a/drivers/gpu/drm/amd/display/dc/resource/dcn201/dcn201_resource.c +++ b/drivers/gpu/drm/amd/display/dc/resource/dcn201/dcn201_resource.c @@ -1007,8 +1007,10 @@ static struct pipe_ctx *dcn201_acquire_free_pipe_for_layer( struct pipe_ctx *head_pipe = resource_get_otg_master_for_stream(res_ctx, opp_head_pipe->stream); struct pipe_ctx *idle_pipe = resource_find_free_secondary_pipe_legacy(res_ctx, pool, head_pipe); - if (!head_pipe) + if (!head_pipe) { ASSERT(0); + return NULL; + } if (!idle_pipe) return NULL; -- 2.43.0