<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/drivers/gpu/drm/drm_atomic.c, branch v6.1.168</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v6.1.168</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v6.1.168'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2023-07-23T11:49:50+00:00</updated>
<entry>
<title>drm/atomic: Fix potential use-after-free in nonblocking commits</title>
<updated>2023-07-23T11:49:50+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=e4a0e09b79bd2c0895c508cdc5e0265a083cc05d'/>
<id>urn:sha1:e4a0e09b79bd2c0895c508cdc5e0265a083cc05d</id>
<content type='text'>
commit 4e076c73e4f6e90816b30fcd4a0d7ab365087255 upstream.

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;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>drm/connector: print max_requested_bpc in state debugfs</title>
<updated>2023-03-17T07:50:15+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=8d2ca666a7b415a4a063be39b20c2b99c42421cb'/>
<id>urn:sha1:8d2ca666a7b415a4a063be39b20c2b99c42421cb</id>
<content type='text'>
commit 7d386975f6a495902e679a3a250a7456d7e54765 upstream.

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
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</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>
<entry>
<title>drm/atomic: Print the state every non-blocking commit</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:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=018ad18f6ab062a198627ec1bd5fd9d797c90238'/>
<id>urn:sha1:018ad18f6ab062a198627ec1bd5fd9d797c90238</id>
<content type='text'>
The DRM_UT_STATE controls whether we're calling
drm_atomic_print_new_state() whenever a new state is committed. However,
that call is made in the drm_mode_atomic_ioctl(), whereas we have
multiple users of the drm_atomic_commit() function in the kernel
(framebuffer emulation, drm_atomic_helper_dirtyfb, etc.).

This leads to multiple states being committed but never actually
displayed even though we asked to have verbose atomic state debugging.

Let's move the call to drm_atomic_print_new_state() to
drm_atomic_commit() to make sure we don't miss any. Non-blocking commits
were never logged though, and it would create too much churn in the logs
to do so, so leave them out for now.

Signed-off-by: Maxime Ripard &lt;maxime@cerno.tech&gt;
Reviewed-by: Daniel Vetter &lt;daniel.vetter@ffwll.ch&gt;
Link: https://lore.kernel.org/r/20220328124304.2309418-2-maxime@cerno.tech
</content>
</entry>
<entry>
<title>Merge drm/drm-fixes into drm-misc-fixes</title>
<updated>2022-01-26T08:40:24+00:00</updated>
<author>
<name>Thomas Zimmermann</name>
<email>tzimmermann@suse.de</email>
</author>
<published>2022-01-26T08:40:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=48ee4835b73c48590d05a54730dc8037ebd39d3b'/>
<id>urn:sha1:48ee4835b73c48590d05a54730dc8037ebd39d3b</id>
<content type='text'>
Backmerging drm/drm-fixes into drm-misc-fixes for v5.17-rc1.

Signed-off-by: Thomas Zimmermann &lt;tzimmermann@suse.de&gt;
</content>
</entry>
<entry>
<title>drm/atomic: Add the crtc to affected crtc only if uapi.enable = true</title>
<updated>2022-01-25T05:28:22+00:00</updated>
<author>
<name>Manasi Navare</name>
<email>manasi.d.navare@intel.com</email>
</author>
<published>2021-10-04T11:59:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=5ec1cebd59300ddd26dbaa96c17c508764eef911'/>
<id>urn:sha1:5ec1cebd59300ddd26dbaa96c17c508764eef911</id>
<content type='text'>
In case of a modeset where a mode gets split across multiple CRTCs
in the driver specific implementation (bigjoiner in i915) we wrongly count
the affected CRTCs based on the drm_crtc_mask and indicate the stolen CRTC as
an affected CRTC in atomic_check_only().
This triggers a warning since affected CRTCs doent match requested CRTC.

To fix this in such bigjoiner configurations, we should only
increment affected crtcs if that CRTC is enabled in UAPI not
if it is just used internally in the driver to split the mode.

v3: Add the same uapi crtc_state-&gt;enable check in requested
crtc calc (Ville)

Cc: Ville Syrjälä &lt;ville.syrjala@linux.intel.com&gt;
Cc: Simon Ser &lt;contact@emersion.fr&gt;
Cc: Pekka Paalanen &lt;pekka.paalanen@collabora.co.uk&gt;
Cc: Daniel Stone &lt;daniels@collabora.com&gt;
Cc: Daniel Vetter &lt;daniel.vetter@intel.com&gt;
Cc: dri-devel@lists.freedesktop.org
Cc: &lt;stable@vger.kernel.org&gt; # v5.11+
Fixes: 919c2299a893 ("drm/i915: Enable bigjoiner")
Signed-off-by: Manasi Navare &lt;manasi.d.navare@intel.com&gt;
Reviewed-by: Ville Syrjälä &lt;ville.syrjala@linux.intel.com&gt;
Link: https://patchwork.freedesktop.org/patch/msgid/20211004115913.23889-1-manasi.d.navare@intel.com
</content>
</entry>
<entry>
<title>drm: get rid of DRM_DEBUG_* log calls in drm core, files drm_a*.c</title>
<updated>2021-11-26T15:45:22+00:00</updated>
<author>
<name>Claudio Suarez</name>
<email>cssk@net-c.es</email>
</author>
<published>2021-11-26T10:49:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=6e22dc35837790a84fc040f08e5094b2d5d91477'/>
<id>urn:sha1:6e22dc35837790a84fc040f08e5094b2d5d91477</id>
<content type='text'>
DRM_DEBUG_* and DRM_* log calls are deprecated.
Change them to drm_dbg_* / drm_{err,info,...} calls in drm core
files.

To avoid making a very big patch, this change is split in
smaller patches. This one includes drm_a*.c

Signed-off-by: Claudio Suarez &lt;cssk@net-c.es&gt;
Signed-off-by: Daniel Vetter &lt;daniel.vetter@ffwll.ch&gt;
Link: https://patchwork.freedesktop.org/patch/msgid/YaC7zXW119tlzfVh@gineta.localdomain
</content>
</entry>
<entry>
<title>drm: Fix typo in comments</title>
<updated>2021-08-02T08:19:43+00:00</updated>
<author>
<name>Cai Huoqing</name>
<email>caihuoqing@baidu.com</email>
</author>
<published>2021-07-30T13:27:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=0ae865ef92f1920bd2ca3fc7b6b5a9555b4641cc'/>
<id>urn:sha1:0ae865ef92f1920bd2ca3fc7b6b5a9555b4641cc</id>
<content type='text'>
fix typo for drm

v1-&gt;v2:
respin with the change "iff ==&gt; implies that"

Signed-off-by: Cai Huoqing &lt;caihuoqing@baidu.com&gt;
Signed-off-by: Daniel Vetter &lt;daniel.vetter@ffwll.ch&gt;
Link: https://patchwork.freedesktop.org/patch/msgid/20210730132729.376-1-caihuoqing@baidu.com
</content>
</entry>
</feed>
