Skip to contentSkip to conversation

usb: typec: fix bug in typec_register_port call

PATCH Heikki Krogerus 2 participants 4 messages Mar 19, 2019 – Mar 28, 2019 1 message not in the archive Stable branch

lore
Share & tools
lore

Heikki Krogerus

author Acked-by
#1 lore raw
In reply to a message not in the archive
Quoted 11 lines · On Fri, Mar 15, 2019 at 03:43:21PM -0700, [email protected] wrote:

From: Anil Kumar <[email protected]>

typec_register_port function used variable port->id without initializing it. This patch fixes the issue by using the local instance for the error case

Issue is not observed in the mainline tree (5.x)

Fixes bdecb33af34f ("usb: typec: API for controlling USB Type-C Multiplexers")

You have the tag, but I don't see [email protected] on your CC line? I'm adding it there now. The patch is otherwise OK.

Quoted 19 lines
---
 drivers/usb/typec/class.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/typec/class.c +1 -1
index e61dffb..5a442e4 100644
@@ -1611,7 +1611,7 @@ struct typec_port *typec_register_port(struct device *parent,
 	typec_switch_put(port->sw);
 
 err_switch:
-	ida_simple_remove(&typec_index_ida, port->id);
+	ida_simple_remove(&typec_index_ida, id);
 	kfree(port);
 
 	return ERR_PTR(ret);
Signature · 1 line
2.7.4

thanks,

Signature · 1 line
heikki
maintainer
#2 lore raw
Quoted 8 lines · Heikki Krogerus
Quoted 7 lines · On Fri, Mar 15, 2019 at 03:43:21PM -0700, [email protected] wrote:

From: Anil Kumar <[email protected]>

typec_register_port function used variable port->id without initializing it. This patch fixes the issue by using the local instance for the error case

Issue is not observed in the mainline tree (5.x)

Why is this not observed there? What patch fixed this? Why can we not backport that fix?

thanks,

greg k-h

#3 lore raw
Quoted 4 lines · Greg KH
Quoted 3 lines · Heikki Krogerus
Quoted 2 lines · On Fri, Mar 15, 2019 at 03:43:21PM -0700, [email protected] wrote:

From: Anil Kumar <[email protected]>

Quoted 8 lines
Quoted 5 lines
Quoted 5 lines

typec_register_port function used variable port->id without initializing it. This patch fixes the issue by using the local instance for the error case

Issue is not observed in the mainline tree (5.x)

Why is this not observed there? What patch fixed this? Why can we not backport that fix?

Commit 23481121c81d (accidentally) fixes the problem, but you can't backport that alone. You would need at least the following five patches with it (23481121c81d is the second last):

148b0aa78e4e ("platform: x86: intel_cht_int33fe: Remove the old connections for the muxes") 23481121c81d ("usb: typec: class: Don't use port parent for getting mux handles") 495965a1002a ("platform: x86: intel_cht_int33fe: Add connections for the USB Type-C port") 78d2b54b134e ("platform: x86: intel_cht_int33fe: Add connection for the DP alt mode") 140a4ec4addd ("platform: x86: intel_cht_int33fe: Register all connections at once") cd7753d37138 ("drivers: base: Helpers for adding device connection descriptions")

thanks,

Signature · 1 line
heikki
#4 lore raw
Quoted 18 lines · Heikki Krogerus
Quoted 4 lines · Greg KH
Quoted 3 lines · Heikki Krogerus
Quoted 2 lines · On Fri, Mar 15, 2019 at 03:43:21PM -0700, [email protected] wrote:

From: Anil Kumar <[email protected]>

Quoted 8 lines
Quoted 5 lines
Quoted 5 lines

typec_register_port function used variable port->id without initializing it. This patch fixes the issue by using the local instance for the error case

Issue is not observed in the mainline tree (5.x)

Why is this not observed there? What patch fixed this? Why can we not backport that fix?

Commit 23481121c81d (accidentally) fixes the problem, but you can't backport that alone. You would need at least the following five patches with it (23481121c81d is the second last):

Quoted 6 lines

148b0aa78e4e ("platform: x86: intel_cht_int33fe: Remove the old connections for the muxes") 23481121c81d ("usb: typec: class: Don't use port parent for getting mux handles") 495965a1002a ("platform: x86: intel_cht_int33fe: Add connections for the USB Type-C port") 78d2b54b134e ("platform: x86: intel_cht_int33fe: Add connection for the DP alt mode") 140a4ec4addd ("platform: x86: intel_cht_int33fe: Register all connections at once") cd7753d37138 ("drivers: base: Helpers for adding device connection descriptions")

I've now tested these on top of v4.19.x, and I'm confident that these are all the prerequisites that are needed. I'll send the original patch to [email protected] ml.

thanks,

Signature · 1 line
heikki