Skip to contentSkip to conversation

patch "driver core: Fix handling of SYNC_STATE_ONLY + STATELESS device links" added to driver-core-linus

PATCH [email protected] 1 participant 1 message May 21, 2020

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

driver core: Fix handling of SYNC_STATE_ONLY + STATELESS device links

to my driver-core git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git
in the driver-core-linus branch.

The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)

The patch will hopefully also be merged in Linus's tree for the next -rc kernel release.

If you have any questions about this process, please let me know.

From 44e960490ddf868fc9135151c4a658936e771dc2 Mon Sep 17 00:00:00 2001
From: Saravana Kannan <[email protected]>
Date: Tue, 19 May 2020 21:36:26 -0700
Subject: driver core: Fix handling of SYNC_STATE_ONLY + STATELESS device links

Commit 21c27f06587d ("driver core: Fix SYNC_STATE_ONLY device link implementation") didn't completely fix STATELESS + SYNC_STATE_ONLY handling.

What looks like an optimization in that commit is actually a bug that causes an if condition to always take the else path. This prevents reordering of devices in the dpm_list when a DL_FLAG_STATELESS device link is create on top of an existing DL_FLAG_SYNC_STATE_ONLY device link.

Fixes 21c27f06587d ("driver core: Fix SYNC_STATE_ONLY device link implementation")
Cc stable <[email protected]>
---
 drivers/base/core.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/base/core.c +5 -3
index 4e0e430315d9..0cad34f1eede 100644
@@ -360,12 +360,14 @@ struct device_link *device_link_add(struct device *consumer,
 
 		if (flags & DL_FLAG_STATELESS) {
 			kref_get(&link->kref);
-			link->flags |= DL_FLAG_STATELESS;
 			if (link->flags & DL_FLAG_SYNC_STATE_ONLY &&
-			    !(link->flags & DL_FLAG_STATELESS))
+			    !(link->flags & DL_FLAG_STATELESS)) {
+				link->flags |= DL_FLAG_STATELESS;
 				goto reorder;
-			else
+			} else {
+				link->flags |= DL_FLAG_STATELESS;
 				goto out;
+			}
 		}
 
 		/*
Signature · 1 line
2.26.2