projects
/
wrapfs-5.3.y.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
33e3c91
)
usb: typec: fix use after free in typec_register_port()
author
Wen Yang
<wenyang@linux.alibaba.com>
Tue, 26 Nov 2019 14:04:52 +0000
(22:04 +0800)
committer
Greg Kroah-Hartman
<gregkh@linuxfoundation.org>
Tue, 17 Dec 2019 19:07:28 +0000
(20:07 +0100)
commit
5c388abefda0d92355714010c0199055c57ab6c7
upstream.
We can't use "port->sw" and/or "port->mux" after it has been freed.
Fixes: 23481121c81d ("usb: typec: class: Don't use port parent for getting mux handles")
Signed-off-by: Wen Yang <wenyang@linux.alibaba.com>
Cc: stable <stable@vger.kernel.org>
Cc: linux-usb@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Link:
https://lore.kernel.org/r/20191126140452.14048-1-wenyang@linux.alibaba.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/typec/class.c
patch
|
blob
|
history
diff --git
a/drivers/usb/typec/class.c
b/drivers/usb/typec/class.c
index a18285a990a88e52770e14841c36ba618ea0ed61..78fc5fa963c3288285c410cad7075372ff5bf10c 100644
(file)
--- a/
drivers/usb/typec/class.c
+++ b/
drivers/usb/typec/class.c
@@
-1604,14
+1604,16
@@
struct typec_port *typec_register_port(struct device *parent,
port->sw = typec_switch_get(&port->dev);
if (IS_ERR(port->sw)) {
+ ret = PTR_ERR(port->sw);
put_device(&port->dev);
- return ERR_
CAST(port->sw
);
+ return ERR_
PTR(ret
);
}
port->mux = typec_mux_get(&port->dev, NULL);
if (IS_ERR(port->mux)) {
+ ret = PTR_ERR(port->mux);
put_device(&port->dev);
- return ERR_
CAST(port->mux
);
+ return ERR_
PTR(ret
);
}
ret = device_add(&port->dev);