[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200519054827.GA3826326@kroah.com>
Date: Tue, 19 May 2020 07:48:27 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: Saravana Kannan <saravanak@...gle.com>
Cc: "Rafael J. Wysocki" <rafael@...nel.org>, stable@...r.kernel.org,
kernel-team@...roid.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] driver core: Fix SYNC_STATE_ONLY device link
implementation
On Mon, May 18, 2020 at 08:00:25PM -0700, Saravana Kannan wrote:
> When SYNC_STATE_ONLY support was added in commit 05ef983e0d65 ("driver
> core: Add device link support for SYNC_STATE_ONLY flag"),
> device_link_add() incorrectly skipped adding the new SYNC_STATE_ONLY
> device link to the supplier's and consumer's "device link" list.
>
> This causes multiple issues:
> - The device link is lost forever from driver core if the caller
> didn't keep track of it (caller typically isn't expected to). This is
> a memory leak.
> - The device link is also never visible to any other code path after
> device_link_add() returns.
>
> If we fix the "device link" list handling, that exposes a bunch of
> issues.
>
> 1. The device link "status" state management code rightfully doesn't
> handle the case where a DL_FLAG_MANAGED device link exists between a
> supplier and consumer, but the consumer manages to probe successfully
> before the supplier. The addition of DL_FLAG_SYNC_STATE_ONLY links break
> this assumption. This causes device_links_driver_bound() to throw a
> warning when this happens.
>
> Since DL_FLAG_SYNC_STATE_ONLY device links are mainly used for creating
> proxy device links for child device dependencies and aren't useful once
> the consumer device probes successfully, this patch just deletes
> DL_FLAG_SYNC_STATE_ONLY device links once its consumer device probes.
> This way, we avoid the warning, free up some memory and avoid
> complicating the device links "status" state management code.
>
> 2. Creating a DL_FLAG_STATELESS device link between two devices that
> already have a DL_FLAG_SYNC_STATE_ONLY device link will result in the
> DL_FLAG_STATELESS flag not getting set correctly. This patch also fixes
> this.
>
> Lastly, this patch also fixes minor whitespace issues.
>
> Cc: stable@...r.kernel.org
> Fixes: 05ef983e0d65 ("driver core: Add device link support for SYNC_STATE_ONLY flag")
> Signed-off-by: Saravana Kannan <saravanak@...gle.com>
> ---
> drivers/base/core.c | 61 +++++++++++++++++++++++++++++----------------
> 1 file changed, 39 insertions(+), 22 deletions(-)
If this is v2, what changed from v1?
That always goes below the --- line, you know this :)
v3 please?
thanks,
greg k-h
Powered by blists - more mailing lists