Skip to content

Commit 9fc33ea

Browse files
digetxSteven Price
authored andcommitted
drm/panfrost: Fix shrinker list corruption by madvise IOCTL
Calling madvise IOCTL twice on BO causes memory shrinker list corruption and crashes kernel because BO is already on the list and it's added to the list again, while BO should be removed from the list before it's re-added. Fix it. Cc: stable@vger.kernel.org Fixes: 013b651 ("drm/panfrost: Add madvise and shrinker support") Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> Reviewed-by: Steven Price <steven.price@arm.com> Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com> Signed-off-by: Steven Price <steven.price@arm.com> Link: https://patchwork.freedesktop.org/patch/msgid/20220630200601.1884120-3-dmitry.osipenko@collabora.com
1 parent fb6e063 commit 9fc33ea

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/gpu/drm/panfrost/panfrost_drv.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -433,8 +433,8 @@ static int panfrost_ioctl_madvise(struct drm_device *dev, void *data,
433433

434434
if (args->retained) {
435435
if (args->madv == PANFROST_MADV_DONTNEED)
436-
list_add_tail(&bo->base.madv_list,
437-
&pfdev->shrinker_list);
436+
list_move_tail(&bo->base.madv_list,
437+
&pfdev->shrinker_list);
438438
else if (args->madv == PANFROST_MADV_WILLNEED)
439439
list_del_init(&bo->base.madv_list);
440440
}

0 commit comments

Comments
 (0)