<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/drivers/gpu/drm/drm_atomic.c, branch v6.6.132</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v6.6.132</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v6.6.132'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2023-07-21T16:53:30+00:00</updated>
<entry>
<title>drm/atomic: Fix potential use-after-free in nonblocking commits</title>
<updated>2023-07-21T16:53:30+00:00</updated>
<author>
<name>Daniel Vetter</name>
<email>daniel.vetter@ffwll.ch</email>
</author>
<published>2023-07-21T13:58:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=4e076c73e4f6e90816b30fcd4a0d7ab365087255'/>
<id>urn:sha1:4e076c73e4f6e90816b30fcd4a0d7ab365087255</id>
<content type='text'>
This requires a bit of background.  Properly done a modeset driver's
unload/remove sequence should be

	drm_dev_unplug();
	drm_atomic_helper_shutdown();
	drm_dev_put();

The trouble is that the drm_dev_unplugged() checks are by design racy,
they do not synchronize against all outstanding ioctl.  This is because
those ioctl could block forever (both for modeset and for driver
specific ioctls), leading to deadlocks in hotunplug.  Instead the code
sections that touch the hardware need to be annotated with
drm_dev_enter/exit, to avoid accessing hardware resources after the
unload/remove has finished.

To avoid use-after-free issues all the involved userspace visible
objects are supposed to hold a reference on the underlying drm_device,
like drm_file does.

The issue now is that we missed one, the atomic modeset ioctl can be run
in a nonblocking fashion, and in that case it cannot rely on the implied
drm_device reference provided by the ioctl calling context.  This can
result in a use-after-free if an nonblocking atomic commit is carefully
raced against a driver unload.

Fix this by unconditionally grabbing a drm_device reference for any
drm_atomic_state structures.  Strictly speaking this isn't required for
blocking commits and TEST_ONLY calls, but it's the simpler approach.

Thanks to shanzhulig for the initial idea of grabbing an unconditional
reference, I just added comments, a condensed commit message and fixed a
minor potential issue in where exactly we drop the final reference.

Reported-by: shanzhulig &lt;shanzhulig@gmail.com&gt;
Suggested-by: shanzhulig &lt;shanzhulig@gmail.com&gt;
Reviewed-by: Maxime Ripard &lt;mripard@kernel.org&gt;
Cc: Maarten Lankhorst &lt;maarten.lankhorst@linux.intel.com&gt;
Cc: Thomas Zimmermann &lt;tzimmermann@suse.de&gt;
Cc: David Airlie &lt;airlied@gmail.com&gt;
Cc: stable@kernel.org
Signed-off-by: Daniel Vetter &lt;daniel.vetter@intel.com&gt;
Signed-off-by: Daniel Vetter &lt;daniel.vetter@ffwll.ch&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>drm/connector: Print connector colorspace in state debugfs</title>
<updated>2023-06-09T16:46:41+00:00</updated>
<author>
<name>Harry Wentland</name>
<email>harry.wentland@amd.com</email>
</author>
<published>2022-11-30T21:11:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=035d53e0f36da6ce49abf7bea3d9b30a075ff247'/>
<id>urn:sha1:035d53e0f36da6ce49abf7bea3d9b30a075ff247</id>
<content type='text'>
v3: Fix kerneldocs (kernel test robot)

v4: Avoid returning NULL from drm_get_colorspace_name

Signed-off-by: Harry Wentland &lt;harry.wentland@amd.com&gt;
Reviewed-by: Sebastian Wick &lt;sebastian.wick@redhat.com&gt;
Reviewed-by: Joshua Ashton &lt;joshua@froggi.es&gt;
Reviewed-by: Simon Ser &lt;contact@emersion.fr&gt;

Cc: Pekka Paalanen &lt;ppaalanen@gmail.com&gt;
Cc: Sebastian Wick &lt;sebastian.wick@redhat.com&gt;
Cc: Vitaly.Prosyak@amd.com
Cc: Uma Shankar &lt;uma.shankar@intel.com&gt;
Cc: Ville Syrjälä &lt;ville.syrjala@linux.intel.com&gt;
Cc: Joshua Ashton &lt;joshua@froggi.es&gt;
Cc: Jani Nikula &lt;jani.nikula@linux.intel.com&gt;
Cc: Simon Ser &lt;contact@emersion.fr&gt;
Cc: Melissa Wen &lt;mwen@igalia.com&gt;
Cc: dri-devel@lists.freedesktop.org
Cc: amd-gfx@lists.freedesktop.org
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
</content>
</entry>
<entry>
<title>Merge remote-tracking branch 'drm/drm-next' into msm-next</title>
<updated>2023-03-20T17:31:25+00:00</updated>
<author>
<name>Rob Clark</name>
<email>robdclark@chromium.org</email>
</author>
<published>2023-03-20T17:31:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=e752ab11dcb48353727ea26eefd740155e028865'/>
<id>urn:sha1:e752ab11dcb48353727ea26eefd740155e028865</id>
<content type='text'>
Merge drm-next into msm-next to pick up external clk and PM dependencies
for improved a6xx GPU reset sequence.

Signed-off-by: Rob Clark &lt;robdclark@chromium.org&gt;
</content>
</entry>
<entry>
<title>drm: add helper functions to retrieve old and new crtc</title>
<updated>2023-03-13T01:43:49+00:00</updated>
<author>
<name>Vinod Polimera</name>
<email>quic_vpolimer@quicinc.com</email>
</author>
<published>2023-03-02T16:33:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=7b9a9e35e45def496b0a5b3f206bb4efa712ea4a'/>
<id>urn:sha1:7b9a9e35e45def496b0a5b3f206bb4efa712ea4a</id>
<content type='text'>
Add new helper functions, drm_atomic_get_old_crtc_for_encoder
and drm_atomic_get_new_crtc_for_encoder to retrieve the
corresponding crtc for the encoder.

Signed-off-by: Sankeerth Billakanti &lt;quic_sbillaka@quicinc.com&gt;
Signed-off-by: Vinod Polimera &lt;quic_vpolimer@quicinc.com&gt;
Reviewed-by: Douglas Anderson &lt;dianders@chromium.org&gt;
Reviewed-by: Daniel Vetter &lt;daniel.vetter@ffwll.ch&gt;
Patchwork: https://patchwork.freedesktop.org/patch/524718/
Link: https://lore.kernel.org/r/1677774797-31063-2-git-send-email-quic_vpolimer@quicinc.com
Signed-off-by: Dmitry Baryshkov &lt;dmitry.baryshkov@linaro.org&gt;
</content>
</entry>
<entry>
<title>drm/connector: print max_requested_bpc in state debugfs</title>
<updated>2023-03-07T20:55:18+00:00</updated>
<author>
<name>Harry Wentland</name>
<email>harry.wentland@amd.com</email>
</author>
<published>2023-01-13T16:24:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=7d386975f6a495902e679a3a250a7456d7e54765'/>
<id>urn:sha1:7d386975f6a495902e679a3a250a7456d7e54765</id>
<content type='text'>
This is useful to understand the bpc defaults and
support of a driver.

Signed-off-by: Harry Wentland &lt;harry.wentland@amd.com&gt;
Cc: Pekka Paalanen &lt;ppaalanen@gmail.com&gt;
Cc: Sebastian Wick &lt;sebastian.wick@redhat.com&gt;
Cc: Vitaly.Prosyak@amd.com
Cc: Uma Shankar &lt;uma.shankar@intel.com&gt;
Cc: Ville Syrjälä &lt;ville.syrjala@linux.intel.com&gt;
Cc: Joshua Ashton &lt;joshua@froggi.es&gt;
Cc: Jani Nikula &lt;jani.nikula@linux.intel.com&gt;
Cc: dri-devel@lists.freedesktop.org
Cc: amd-gfx@lists.freedesktop.org
Reviewed-By: Joshua Ashton &lt;joshua@froggi.es&gt;
Link: https://patchwork.freedesktop.org/patch/msgid/20230113162428.33874-3-harry.wentland@amd.com
Signed-off-by: Alex Deucher &lt;alexander.deucher@amd.com&gt;
Cc: stable@vger.kernel.org
</content>
</entry>
<entry>
<title>drm: use new debugfs device-centered functions on DRM core files</title>
<updated>2022-12-22T17:58:21+00:00</updated>
<author>
<name>Maíra Canal</name>
<email>mcanal@igalia.com</email>
</author>
<published>2022-12-19T12:06:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=6fd80729f14e3f70d4c07ea91ac44ed5ab8dfe60'/>
<id>urn:sha1:6fd80729f14e3f70d4c07ea91ac44ed5ab8dfe60</id>
<content type='text'>
Replace the use of drm_debugfs_create_files() with the new
drm_debugfs_add_files() function in all DRM core files, centering the
debugfs files management on the drm_device instead of drm_minor.

Signed-off-by: Maíra Canal &lt;mcanal@igalia.com&gt;
Reviewed-by: Maxime Ripard &lt;maxime@cerno.tech&gt;
Reviewed-by: Melissa Wen &lt;mwen@igalia.com&gt;
Acked-by: Daniel Vetter &lt;daniel.vetter@ffwll.ch&gt;
Signed-off-by: Maíra Canal &lt;mairacanal@riseup.net&gt;
Link: https://patchwork.freedesktop.org/patch/msgid/20221219120621.15086-3-mcanal@igalia.com
</content>
</entry>
<entry>
<title>drm/atomic: Constify the old/new state accessors</title>
<updated>2022-11-28T10:46:50+00:00</updated>
<author>
<name>Maxime Ripard</name>
<email>maxime@cerno.tech</email>
</author>
<published>2022-11-23T15:25:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=2081bd8994362785b07b435bdc0c5b53d46b1205'/>
<id>urn:sha1:2081bd8994362785b07b435bdc0c5b53d46b1205</id>
<content type='text'>
The drm_atomic_get_(old|new)_*_state don't modify the passed
drm_atomic_state, so we can make it const.

Reviewed-by: Javier Martinez Canillas &lt;javierm@redhat.com&gt;
Signed-off-by: Maxime Ripard &lt;maxime@cerno.tech&gt;
Link: https://patchwork.freedesktop.org/patch/msgid/20221123-rpi-kunit-tests-v1-9-051a0bb60a16@cerno.tech
</content>
</entry>
<entry>
<title>drm: Drop drm_blend.h from drm_crtc.h</title>
<updated>2022-06-20T20:53:55+00:00</updated>
<author>
<name>Ville Syrjälä</name>
<email>ville.syrjala@linux.intel.com</email>
</author>
<published>2022-06-13T20:03:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=90bb087f66745ca48f6f5e43df99a1212d89e712'/>
<id>urn:sha1:90bb087f66745ca48f6f5e43df99a1212d89e712</id>
<content type='text'>
drm_crtc.h has no need for drm_blend.h, so don't include it.
Avoids useless rebuilds of the entire universe when
touching drm_blend.h.

Quite a few placs do currently depend on drm_blend.h without
actually including it directly. All of those need to be fixed
up.

Signed-off-by: Ville Syrjälä &lt;ville.syrjala@linux.intel.com&gt;
Link: https://patchwork.freedesktop.org/patch/msgid/20220613200317.11305-4-ville.syrjala@linux.intel.com
Acked-by: Sam Ravnborg &lt;sam@ravnborg.org&gt;
Acked-by: Jani Nikula &lt;jani.nikula@intel.com&gt;
</content>
</entry>
<entry>
<title>drm: Drop drm_framebuffer.h from drm_crtc.h</title>
<updated>2022-06-20T20:53:55+00:00</updated>
<author>
<name>Ville Syrjälä</name>
<email>ville.syrjala@linux.intel.com</email>
</author>
<published>2022-06-14T09:54:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=720cf96d8fecde29b72e1101f8a567a0ce99594f'/>
<id>urn:sha1:720cf96d8fecde29b72e1101f8a567a0ce99594f</id>
<content type='text'>
drm_crtc.h has no need for drm_frambuffer.h, so don't include it.
Avoids useless rebuilds of the entire universe when
touching drm_framebuffer.h.

Quite a few placs do currently depend on drm_framebuffer.h without
actually including it directly. All of those need to be fixed
up.

v2: Fix up msm some more
v2: Deal with ingenic and shmobile as well

Signed-off-by: Ville Syrjälä &lt;ville.syrjala@linux.intel.com&gt;
Link: https://patchwork.freedesktop.org/patch/msgid/20220614095449.29311-1-ville.syrjala@linux.intel.com
Acked-by: Sam Ravnborg &lt;sam@ravnborg.org&gt;
Acked-by: Jani Nikula &lt;jani.nikula@intel.com&gt;
</content>
</entry>
<entry>
<title>drm/atomic: Add atomic_print_state to private objects</title>
<updated>2022-03-31T08:19:45+00:00</updated>
<author>
<name>Maxime Ripard</name>
<email>maxime@cerno.tech</email>
</author>
<published>2022-03-28T12:43:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=97a1f01b3f2f734bd3982aa5639b2b54632f8f7d'/>
<id>urn:sha1:97a1f01b3f2f734bd3982aa5639b2b54632f8f7d</id>
<content type='text'>
A number of drivers (amdgpu, komeda, vc4, etc.) leverage the
drm_private_state structure, but we don't have any infrastructure to
provide debugging like we do for the other components state. Let's add
an atomic_print_state hook to be consistent.

Reviewed-by: Daniel Vetter &lt;daniel.vetter@ffwll.ch&gt;
Signed-off-by: Maxime Ripard &lt;maxime@cerno.tech&gt;
Link: https://lore.kernel.org/r/20220328124304.2309418-3-maxime@cerno.tech
</content>
</entry>
</feed>
