From: Maxime Ripard <mripard@kernel.org>
To: Lyude Paul <lyude@redhat.com>
Cc: Thomas Zimmermann <tzimmermann@suse.de>,
dri-devel@lists.freedesktop.org, stable@vger.kernel.org,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
David Airlie <airlied@gmail.com>,
Simona Vetter <simona@ffwll.ch>,
Sean Paul <seanpaul@chromium.org>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] drm/atomic_helper: Add missing NULL check for drm_plane_helper_funcs.atomic_update
Date: Mon, 21 Oct 2024 15:30:38 +0200 [thread overview]
Message-ID: <20241021-airborne-proud-lynx-e1186d@houat> (raw)
In-Reply-To: <2f012eeab0c1cb37422d9790843ffbbc5eda0131.camel@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 2592 bytes --]
Hi,
On Mon, Sep 30, 2024 at 03:45:13PM -0400, Lyude Paul wrote:
> On Mon, 2024-09-30 at 09:06 +0200, Thomas Zimmermann wrote:
> > Hi
> >
> > Am 30.09.24 um 09:01 schrieb Maxime Ripard:
> > > Hi,
> > >
> > > On Fri, Sep 27, 2024 at 04:46:16PM GMT, Lyude Paul wrote:
> > > > Something I discovered while writing rvkms since some versions of the
> > > > driver didn't have a filled out atomic_update function - we mention that
> > > > this callback is "optional", but we don't actually check whether it's NULL
> > > > or not before calling it. As a result, we'll segfault if it's not filled
> > > > in.
> > > >
> > > > rvkms rvkms.0: [drm:drm_atomic_helper_commit_modeset_disables] modeset on [ENCODER:36:Virtual-36]
> > > > BUG: kernel NULL pointer dereference, address: 0000000000000000
> > > > PGD 0 P4D 0
> > > > Oops: Oops: 0010 [#1] PREEMPT SMP NOPTI
> > > > Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS edk2-20240813-1.fc40 08/13/2024
> > > > RIP: 0010:0x0
> > > >
> > > > So, let's fix that.
> > > >
> > > > Signed-off-by: Lyude Paul <lyude@redhat.com>
> > > > Fixes: c2fcd274bce5 ("drm: Add atomic/plane helpers")
> > > > Cc: dri-devel@lists.freedesktop.org
> > > > Cc: <stable@vger.kernel.org> # v3.19+
> > > So we had kind of a similar argument with drm_connector_init early this
> > > year, but I do agree we shouldn't fault if we're missing a callback.
> > >
> > > I do wonder how we can implement a plane without atomic_update though?
> > > Do we have drivers in such a case?
> >
> > That would likely be an output with an entirely static display. Hard to
> > imaging, I think.
> >
> > >
> > > If not, a better solution would be to make it mandatory and check it
> > > when registering.
> >
> > Although I r-b'ed the patch already, I'd also prefer this solution.
>
> Gotcha, FWIW the reason I went with this patch:
> * atomic_update is actually documented as being optional in the kernel docs,
> so we'd want to remove that if we make it mandatory
Sure, that makes total sense :)
> * rvkms currently doesn't have an atomic_update. We will likely have one
> whenever I get a chance to actually add CRC and/or writeback connector
> supports - but for the time being all we do is register a KMS device with
> vblank support.
WIP drivers can provide an empty implementation. And even if actually
didn't need it for $REASONS, I'd argue that an empty implementation (and
a comment) makes that explicit instead of making the reader guess why
it's not needed.
Maxime
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 273 bytes --]
prev parent reply other threads:[~2024-10-21 13:30 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-27 20:46 Lyude Paul
2024-09-30 6:26 ` Thomas Zimmermann
2024-09-30 7:01 ` Maxime Ripard
2024-09-30 7:06 ` Thomas Zimmermann
2024-09-30 19:45 ` Lyude Paul
2024-10-21 13:30 ` Maxime Ripard [this message]
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=20241021-airborne-proud-lynx-e1186d@houat \
--to=mripard@kernel.org \
--cc=airlied@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lyude@redhat.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=seanpaul@chromium.org \
--cc=simona@ffwll.ch \
--cc=stable@vger.kernel.org \
--cc=tzimmermann@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
all inboxes | Powered by JetHome®