thunderbolt: Fix memory leak if ida_simple_get() fails in enumerate_services()
Subsystems (2)
PATCH 1/3 thunderbolt: Fix memory leak if ida_simple_get() fails in enumerate_services()
The svc->key field is not released as it should be if ida_simple_get() fails so fix that.
--- drivers/thunderbolt/xdomain.c | 1 + 1 file changed, 1 insertion(+)
drivers/thunderbolt/xdomain.c +1 -0
@@ -881,6 +881,7 @@ static void enumerate_services(struct tb_xdomain *xd) id =ida_simple_get (&xd->service_ids,0 ,0 ,GFP_KERNEL );if (id <0 ) { +kfree (svc->key);kfree (svc);break ; }
Signature · 1 line
2.28.0
PATCH 2/3 thunderbolt: Add uaccess dependency to debugfs interface
From: Casey Bowman <[email protected]>
Some calls in the debugfs interface are made to the linux/uaccess.h header, but the header is not referenced. So, for x86_64 architectures, this dependency seems to be pulled in elsewhere, which leads to a successful compilation. However, on arm/arm64 architectures, it was found to error out on implicit declarations.
This change fixes the implicit declaration error by adding the linux/uaccess.h header.
--- drivers/thunderbolt/debugfs.c | 1 + 1 file changed, 1 insertion(+)
drivers/thunderbolt/debugfs.c +1 -0
@@ -9,6 +9,7 @@#include <linux/debugfs.h> #include <linux/pm_runtime.h> +#include <linux/uaccess.h> #include "tb.h"
Signature · 1 line
2.28.0
PATCH 3/3 thunderbolt: Only configure USB4 wake for lane 0 adapters
In reply to Mika WesterbergOnly USB4 lane 0 adapter has the USB4 port capability for wakes so only program wakes on such adapters.
--- drivers/thunderbolt/usb4.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/thunderbolt/usb4.c +4 -0
@@ -421,8 +421,12 @@ int usb4_switch_set_wake(struct tb_switch *sw, unsigned int flags)* upstream USB4 port. */ tb_switch_for_each_port (sw, port) { +if (!tb_port_is_null (port)) +continue ;if (!route &&tb_is_upstream_port (port))continue ; +if (!port->cap_usb4) +continue ; ret =tb_port_read (port, &val,TB_CFG_PORT , port->cap_usb4 +PORT_CS_19 ,1 );
Signature · 1 line
2.28.0
Quoted 6 lines · Mika Westerberg
The
svc->keyfield is not released as it should be ifida_simple_get()fails so fix that.Fixes 9aabb68568b4 ("thunderbolt: Fix to check return value of ida_simple_get")Signed-off-by Mika Westerberg <[email protected]>
This and the other 2 patches applied to thunderbolt.git/fixes.