On Sat, 24 Feb 2024 08:36:35 -0500 Sasha Levin <sashal@xxxxxxxxxx> wrote: > This is a note to let you know that I've just added the patch titled > > drm/amdgpu: Check for valid number of registers to read > > to the 5.4-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-amdgpu-check-for-valid-number-of-registers-to-re.patch > and it can be found in the queue-5.4 subdirectory. > > If you, or anyone else, feels it should not be added to the stable tree, > please let <stable@xxxxxxxxxxxxxxx> know about it. It seems you are applying again an already committed patch, see below > commit 372f39b1ccd3c61def56a711094e42342251b07e > Author: Trek <trek00@xxxxxxxx> > Date: Sat Aug 31 21:25:36 2019 +0200 > > drm/amdgpu: Check for valid number of registers to read > > [ Upstream commit 13238d4fa6764fa74dcf863d5f2227765b3753eb ] > > Do not try to allocate any amount of memory requested by the user. > Instead limit it to 128 registers. Actually the longest series of > consecutive allowed registers are 48, mmGB_TILE_MODE0-31 and > mmGB_MACROTILE_MODE0-15 (0x2644-0x2673). > > Bug: https://bugs.freedesktop.org/show_bug.cgi?id=111273 > Signed-off-by: Trek <trek00@xxxxxxxx> > Signed-off-by: Alex Deucher <alexander.deucher@xxxxxxx> > Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c > index 26a1173df9586..1f4acb4c3efb8 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c > @@ -650,6 +650,9 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file > if (info->read_mmr_reg.count > 128) > return -EINVAL; > > + if (info->read_mmr_reg.count > 128) > + return -EINVAL; > + these two lines were already applied > regs = kmalloc_array(info->read_mmr_reg.count, sizeof(*regs), GFP_KERNEL); > if (!regs) > return -ENOMEM;