drm/amdgpu/vcn3: Avoid overflow on msg bound check
Subsystems (2)
PATCH 1/2 drm/amdgpu/vcn3: Avoid overflow on msg bound check
As pointed out by SDL, the previous condition may be vulnerable to overflow.
--- drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c +3 -1
@@ -1972,6 +1972,7 @@ static int vcn_v3_0_dec_msg(struct amdgpu_cs_parser *p, struct amdgpu_job *job,for (i =0 , msg = &msg[6 ]; i < num_buffers; ++i, msg +=4 ) {uint32_t offset, size, *create; +uint64_t buf_end;if (msg[0 ] !=RDECODE_MESSAGE_CREATE )continue ;
@@ -1979,7 +1980,8 @@ static int vcn_v3_0_dec_msg(struct amdgpu_cs_parser *p, struct amdgpu_job *job, offset = msg[1 ]; size = msg[2 ]; -if (size <4 || offset + size > end - addr) { +if (size <4 ||check_add_overflow (offset, size, &buf_end) || + buf_end > end - addr) {DRM_ERROR ("VCN message buffer exceeds BO bounds!\n" ); r = -EINVAL ; goto out;
Signature · 1 line
2.53.0
PATCH 2/2 drm/amdgpu/vcn4: Avoid overflow on msg bound check
As pointed out by SDL, the previous condition may be vulnerable to overflow.
--- drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c +3 -1
@@ -1889,6 +1889,7 @@ static int vcn_v4_0_dec_msg(struct amdgpu_cs_parser *p, struct amdgpu_job *job,for (i =0 , msg = &msg[6 ]; i < num_buffers; ++i, msg +=4 ) {uint32_t offset, size, *create; +uint64_t buf_end;if (msg[0 ] !=RDECODE_MESSAGE_CREATE )continue ;
@@ -1896,7 +1897,8 @@ static int vcn_v4_0_dec_msg(struct amdgpu_cs_parser *p, struct amdgpu_job *job, offset = msg[1 ]; size = msg[2 ]; -if (size <4 || offset + size > end - addr) { +if (size <4 ||check_add_overflow (offset, size, &buf_end) || + buf_end > end - addr) {DRM_ERROR ("VCN message buffer exceeds BO bounds!\n" ); r = -EINVAL ; goto out;
Signature · 1 line
2.53.0
RE: [PATCH 2/2] drm/amdgpu/vcn4: Avoid overflow on msg bound check
AMD General
The series isReviewed-by: Ruijing Dong <[email protected]>
Thanks,
Ruijing
-----Original Message-----
From: Benjamin Cheng <[email protected]>
Sent: Monday, April 13, 2026 10:21 AM
To: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; [email protected]
Cc: Wu, David <[email protected]>; Dong, Ruijing <[email protected]>; Liu, Leo <[email protected]>; Cheng, Benjamin <[email protected]>; SDL <[email protected]>
Subject: [PATCH 2/2] drm/amdgpu/vcn4: Avoid overflow on msg bound check
As pointed out by SDL, the previous condition may be vulnerable to overflow.
--- drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c +3 -1
@@ -1889,6 +1889,7 @@ static int vcn_v4_0_dec_msg(struct amdgpu_cs_parser *p, struct amdgpu_job *job,for (i =0 , msg = &msg[6 ]; i < num_buffers; ++i, msg +=4 ) {uint32_t offset, size, *create; +uint64_t buf_end;if (msg[0 ] !=RDECODE_MESSAGE_CREATE )continue ;
@@ -1896,7 +1897,8 @@ static int vcn_v4_0_dec_msg(struct amdgpu_cs_parser *p, struct amdgpu_job *job, offset = msg[1 ]; size = msg[2 ]; -if (size <4 || offset + size > end - addr) { +if (size <4 ||check_add_overflow (offset, size, &buf_end) || + buf_end > end - addr) {DRM_ERROR ("VCN message buffer exceeds BO bounds!\n" ); r = -EINVAL ; goto out;
--
2.53.0