Patch "drm/amd/display: fix array-bounds error in dc_stream_remove_writeback()" has been added to the 5.15-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    drm/amd/display: fix array-bounds error in dc_stream_remove_writeback()

to the 5.15-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     drm-amd-display-fix-array-bounds-error-in-dc_stream_.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 6d15b9c041d3eb54917da6b57815a2827730074c
Author: Hamza Mahfooz <hamza.mahfooz@xxxxxxx>
Date:   Tue Sep 27 15:01:46 2022 -0400

    drm/amd/display: fix array-bounds error in dc_stream_remove_writeback()
    
    [ Upstream commit 5d8c3e836fc224dfe633e41f7f2856753b39a905 ]
    
    Address the following error:
    drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_stream.c: In function ‘dc_stream_remove_writeback’:
    drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_stream.c:527:55: error: array subscript [0, 0] is outside array bounds of ‘struct dc_writeback_info[1]’ [-Werror=array-bounds]
      527 |                                 stream->writeback_info[j] = stream->writeback_info[i];
          |                                 ~~~~~~~~~~~~~~~~~~~~~~^~~
    In file included from ./drivers/gpu/drm/amd/amdgpu/../display/dc/dc.h:1269,
                     from ./drivers/gpu/drm/amd/amdgpu/../display/dc/inc/core_types.h:29,
                     from ./drivers/gpu/drm/amd/amdgpu/../display/dc/basics/dc_common.h:29,
                     from drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_stream.c:27:
    ./drivers/gpu/drm/amd/amdgpu/../display/dc/dc_stream.h:241:34: note: while referencing ‘writeback_info’
      241 |         struct dc_writeback_info writeback_info[MAX_DWB_PIPES];
          |
    
    Currently, we aren't checking to see if j remains within
    writeback_info[]'s bounds. So, add a check to make sure that we aren't
    overflowing the buffer.
    
    Reviewed-by: Aurabindo Pillai <aurabindo.pillai@xxxxxxx>
    Signed-off-by: Hamza Mahfooz <hamza.mahfooz@xxxxxxx>
    Signed-off-by: Alex Deucher <alexander.deucher@xxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_stream.c b/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
index f0f54f4d3d9b..1f1f3d3c8884 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
@@ -519,7 +519,7 @@ bool dc_stream_remove_writeback(struct dc *dc,
 	}
 
 	/* remove writeback info for disabled writeback pipes from stream */
-	for (i = 0, j = 0; i < stream->num_wb_info; i++) {
+	for (i = 0, j = 0; i < stream->num_wb_info && j < MAX_DWB_PIPES; i++) {
 		if (stream->writeback_info[i].wb_enabled) {
 			if (i != j)
 				/* trim the array */



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux