From: Luben Tuikov <ltuikov89@gmail.com>
To: Jonathan Cavitt <jonathan.cavitt@intel.com>,
dri-devel@lists.freedesktop.org
Cc: saurabhg.gupta@intel.com, alex.zuo@intel.com,
linux-kernel@vger.kernel.org, maarten.lankhorst@linux.intel.com,
mripard@kernel.org, tzimmerman@suse.de, airlied@gmail.com,
simona@ffwll.ch
Subject: Re: [PATCH] drm/auth: Only drm_drop_master if it exists
Date: Fri, 17 Apr 2026 00:14:10 -0400 [thread overview]
Message-ID: <7a3eac3d-d44b-48db-af68-c5f0087a8ac2@gmail.com> (raw)
In-Reply-To: <20260416210047.3904106-1-jonathan.cavitt@intel.com>
[-- Attachment #1.1.1: Type: text/plain, Size: 1614 bytes --]
On 2026-04-16 17:00, Jonathan Cavitt wrote:
> It is possible that both dev->master and file_priv->master are NULL when
> passed to drm_master_release, which would result in dev being passed to
> drm_drop_master (as NULL == NULL here). This would result in a NULL
> pointer dereference when passing dev->master to drm_master_put in
> drm_drop_master.
>
> Only call drm_drop_master if dev->master exists. Also, make sure the
> original calling requirement is maintained (dev->master ==
> file_priv->master).
>
> This fixes a static analysis issue.
>
> Signed-off-by: Jonathan Cavitt <jonathan.cavitt@intel.com>
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Maxime Ripard <mripard@kernel.org>
> Cc: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: David Airlie <airlied@gmail.com>
> Cc: Simona Vetter <simona@ffwll.ch>
> ---
> drivers/gpu/drm/drm_auth.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/drm_auth.c b/drivers/gpu/drm/drm_auth.c
> index e17bb0f1f9e0..e5013b870ba0 100644
> --- a/drivers/gpu/drm/drm_auth.c
> +++ b/drivers/gpu/drm/drm_auth.c
> @@ -347,7 +347,7 @@ void drm_master_release(struct drm_file *file_priv)
> if (!drm_is_current_master_locked(file_priv))
> goto out;
>
> - if (dev->master == file_priv->master)
> + if (dev->master && dev->master == file_priv->master)
> drm_drop_master(dev, file_priv);
> out:
> if (drm_core_check_feature(dev, DRIVER_MODESET) && file_priv->is_master) {
This is a good catch.
Acked-by: Luben Tuikov <ltuikov89@gmail.com>
--
Regards,
Luben
[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 677 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]
next prev parent reply other threads:[~2026-04-17 4:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-16 21:00 Jonathan Cavitt
2026-04-17 4:14 ` Luben Tuikov [this message]
2026-04-22 19:13 ` Dmitry Baryshkov
2026-04-22 19:51 ` Cavitt, Jonathan
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=7a3eac3d-d44b-48db-af68-c5f0087a8ac2@gmail.com \
--to=ltuikov89@gmail.com \
--cc=airlied@gmail.com \
--cc=alex.zuo@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=jonathan.cavitt@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=saurabhg.gupta@intel.com \
--cc=simona@ffwll.ch \
--cc=tzimmerman@suse.de \
/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