All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jonas Ådahl" <jadahl@redhat.com>
To: Simon Ser <contact@emersion.fr>
Cc: dri-devel@lists.freedesktop.org, stable@vger.kernel.org,
	Daniel Vetter <daniel.vetter@ffwll.ch>,
	Lyude Paul <lyude@redhat.com>
Subject: Re: [PATCH 2/2] drm/connector: send hotplug uevent on connector cleanup
Date: Mon, 17 Oct 2022 17:34:37 +0200	[thread overview]
Message-ID: <Y012DW23jc11f2ZU@redhat.com> (raw)
In-Reply-To: <20221017153150.60675-2-contact@emersion.fr>

On Mon, Oct 17, 2022 at 03:32:01PM +0000, Simon Ser wrote:
> A typical DP-MST unplug removes a KMS connector. However care must
> be taken to properly synchronize with user-space. The expected
> sequence of events is the following:
> 
> 1. The kernel notices that the DP-MST port is gone.
> 2. The kernel marks the connector as disconnected, then sends a
>    uevent to make user-space re-scan the connector list.
> 3. User-space notices the connector goes from connected to disconnected,
>    disables it.
> 4. Kernel handles the the IOCTL disabling the connector. On success,
>    the very last reference to the struct drm_connector is dropped and
>    drm_connector_cleanup() is called.
> 5. The connector is removed from the list, and a uevent is sent to tell
>    user-space that the connector disappeared.
> 
> The very last step was missing. As a result, user-space thought the
> connector still existed and could try to disable it again. Since the
> kernel no longer knows about the connector, that would end up with
> EINVAL and confused user-space.
> 
> Fix this by sending a hotplug uevent from drm_connector_cleanup().
> 
> Signed-off-by: Simon Ser <contact@emersion.fr>
> Cc: stable@vger.kernel.org
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: Lyude Paul <lyude@redhat.com>
> Cc: Jonas Ådahl <jadahl@redhat.com>

Tested-by: Jonas Ådahl <jadahl@redhat.com>


Jonas


WARNING: multiple messages have this Message-ID (diff)
From: "Jonas Ådahl" <jadahl@redhat.com>
To: Simon Ser <contact@emersion.fr>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>,
	stable@vger.kernel.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 2/2] drm/connector: send hotplug uevent on connector cleanup
Date: Mon, 17 Oct 2022 17:34:37 +0200	[thread overview]
Message-ID: <Y012DW23jc11f2ZU@redhat.com> (raw)
In-Reply-To: <20221017153150.60675-2-contact@emersion.fr>

On Mon, Oct 17, 2022 at 03:32:01PM +0000, Simon Ser wrote:
> A typical DP-MST unplug removes a KMS connector. However care must
> be taken to properly synchronize with user-space. The expected
> sequence of events is the following:
> 
> 1. The kernel notices that the DP-MST port is gone.
> 2. The kernel marks the connector as disconnected, then sends a
>    uevent to make user-space re-scan the connector list.
> 3. User-space notices the connector goes from connected to disconnected,
>    disables it.
> 4. Kernel handles the the IOCTL disabling the connector. On success,
>    the very last reference to the struct drm_connector is dropped and
>    drm_connector_cleanup() is called.
> 5. The connector is removed from the list, and a uevent is sent to tell
>    user-space that the connector disappeared.
> 
> The very last step was missing. As a result, user-space thought the
> connector still existed and could try to disable it again. Since the
> kernel no longer knows about the connector, that would end up with
> EINVAL and confused user-space.
> 
> Fix this by sending a hotplug uevent from drm_connector_cleanup().
> 
> Signed-off-by: Simon Ser <contact@emersion.fr>
> Cc: stable@vger.kernel.org
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: Lyude Paul <lyude@redhat.com>
> Cc: Jonas Ådahl <jadahl@redhat.com>

Tested-by: Jonas Ådahl <jadahl@redhat.com>


Jonas


  reply	other threads:[~2022-10-17 15:34 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-17 15:31 [PATCH 1/2] Revert "drm: hide unregistered connectors from GETCONNECTOR IOCTL" Simon Ser
2022-10-17 15:32 ` [PATCH 2/2] drm/connector: send hotplug uevent on connector cleanup Simon Ser
2022-10-17 15:32   ` Simon Ser
2022-10-17 15:34   ` Jonas Ådahl [this message]
2022-10-17 15:34     ` Jonas Ådahl
2022-10-17 19:08   ` Lyude Paul
2022-10-17 19:08     ` Lyude Paul
2022-10-18  9:24   ` Ville Syrjälä
2022-10-18  9:24     ` Ville Syrjälä
2022-10-18  9:26     ` Simon Ser
2022-10-18  9:26       ` Simon Ser
2022-10-18  9:14 ` [PATCH 1/2] Revert "drm: hide unregistered connectors from GETCONNECTOR IOCTL" Ville Syrjälä
2022-10-18  9:27   ` Jonas Ådahl
2022-10-18  9:58     ` Ville Syrjälä
2022-10-18 10:07       ` Jonas Ådahl
2022-10-18 11:06         ` Ville Syrjälä
2022-11-15  8:51 ` Jonas Ådahl
2022-11-15  8:55   ` Simon Ser
2022-11-15  9:18     ` Jonas Ådahl

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=Y012DW23jc11f2ZU@redhat.com \
    --to=jadahl@redhat.com \
    --cc=contact@emersion.fr \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=lyude@redhat.com \
    --cc=stable@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.