The fbdev dirty callback (drm_atomic_helper_dirtyfb()) can fail with -ENOMEM when the atomic commit allocation fails under memory pressure. That is a transient runtime condition, not a driver bug: the damage is only cosmetic and the frame is redrawn on the next flush.
drm_WARN_ONCE() turns this recoverable failure into a WARN splat (and a panic with panic_on_warn), which syzbot keeps reporting: virtio-pci 0000:00:01.0: [drm] Dirty helper failed: ret=-12 WARNING: drivers/gpu/drm/drm_fbdev_shmem.c:118 at ... Keep the warning for other failures, but do not warn about -ENOMEM. The error is still propagated to the caller. Reported-by: [email protected] Closes: https://syzkaller.appspot.com/bug?extid=369ee6a6e9d0bbf14b37 Signed-off-by: xujiahao <[email protected]> --- drivers/gpu/drm/drm_fbdev_shmem.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_fbdev_shmem.c b/drivers/gpu/drm/drm_fbdev_shmem.c index 8eb05fe9b..c3fa5a663 100644 --- a/drivers/gpu/drm/drm_fbdev_shmem.c +++ b/drivers/gpu/drm/drm_fbdev_shmem.c @@ -115,7 +115,14 @@ static int drm_fbdev_shmem_helper_fb_dirty(struct drm_fb_helper *helper, if (helper->fb->funcs->dirty) { ret = helper->fb->funcs->dirty(helper->fb, NULL, 0, 0, clip, 1); - if (drm_WARN_ONCE(dev, ret, "Dirty helper failed: ret=%d\n", ret)) + /* + * An allocation failure is a transient condition under memory + * pressure, not a driver bug, so don't warn about it. The + * error itself is still propagated to the caller. + */ + drm_WARN_ONCE(dev, ret && ret != -ENOMEM, + "Dirty helper failed: ret=%d\n", ret); + if (ret) return ret; } -- 2.43.0
