mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: shaurya <ssranevjti@gmail.com>
To: syzbot+3fc9eecaf97147282c87@syzkaller.appspotmail.com
Cc: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] [dri?] memory leak in drm_mode_atomic_ioctl
Date: Thu, 4 Dec 2025 21:27:49 +0530	[thread overview]
Message-ID: <97ac2832-8ca0-482f-a29d-6ccc63846af6@gmail.com> (raw)
In-Reply-To: <693199d7.a70a0220.2ea503.00de.GAE@google.com>

[-- Attachment #1: Type: text/plain, Size: 83 bytes --]

#syz test:
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master

[-- Attachment #2: 0001-drm-atomic-fix-memory-leak-in-prepare_signaling-erro.patch --]
[-- Type: text/x-patch, Size: 1287 bytes --]

From 54d892b20a412a204d890e4a1d0e3632ab7ec787 Mon Sep 17 00:00:00 2001
From: Shaurya Rane <ssrane_b23@ee.vjti.ac.in>
Date: Thu, 4 Dec 2025 21:10:48 +0530
Subject: [PATCH] drm/atomic: fix memory leak in prepare_signaling() error path

When prepare_signaling() creates a vblank event for an out-fence but
fails before attaching the fence (e.g., krealloc or drm_crtc_create_fence
fails), complete_signaling() only frees events with fence or file_priv
set, leaking the partially initialized event.

Add an else branch to kfree events that have neither fence nor file_priv.

Reported-by: syzbot+3fc9eecaf97147282c87@syzkaller.appspotmail.com
Signed-off-by: Shaurya Rane <ssrane_b23@ee.vjti.ac.in>
---
 drivers/gpu/drm/drm_atomic_uapi.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c
index 85dbdaa4a2e2..d3f23b640d34 100644
--- a/drivers/gpu/drm/drm_atomic_uapi.c
+++ b/drivers/gpu/drm/drm_atomic_uapi.c
@@ -1348,6 +1348,9 @@ static void complete_signaling(struct drm_device *dev,
 		if (event && (event->base.fence || event->base.file_priv)) {
 			drm_event_cancel_free(dev, &event->base);
 			crtc_state->event = NULL;
+		} else if (event) {
+			kfree(event);
+			crtc_state->event = NULL;
 		}
 	}
 
-- 
2.34.1


  reply	other threads:[~2025-12-04 15:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-04 14:25 syzbot
2025-12-04 15:57 ` shaurya [this message]
2025-12-04 16:47   ` syzbot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=97ac2832-8ca0-482f-a29d-6ccc63846af6@gmail.com \
    --to=ssranevjti@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syzbot+3fc9eecaf97147282c87@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®