lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251204093224.1431-1-vulab@iscas.ac.cn>
Date: Thu,  4 Dec 2025 17:32:24 +0800
From: Haotian Zhang <vulab@...as.ac.cn>
To: andreas.noever@...il.com,
	westeri@...nel.org,
	YehezkelShB@...il.com
Cc: linux-usb@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	Haotian Zhang <vulab@...as.ac.cn>
Subject: [PATCH] thunderbolt: Return -ENOTSUPP when cm_ops callbacks are missing

Several tb_domain* helpers return -EPERM when the corresponding cm_ops
callback is NULL. A NULL callback indicates the operation is not
supported by the connection manager, not a permission denial.

Switch these sites to return -ENOTSUPP when the cm_ops callback is
absent: disapprove_switch, approve_switch, approve_switch_key,
challenge_switch_key, and disconnect_pcie_paths.

Fixes: e6b245ccd524 ("thunderbolt: Add support for host and device NVM firmware upgrade")
Fixes: f67cf491175a ("thunderbolt: Add support for Internal Connection Manager (ICM)")
Fixes: 3da88be24997 ("thunderbolt: Add support for de-authorizing devices")
Signed-off-by: Haotian Zhang <vulab@...as.ac.cn>
---
 drivers/thunderbolt/domain.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/thunderbolt/domain.c b/drivers/thunderbolt/domain.c
index 83defc915d33..2e88a821ef08 100644
--- a/drivers/thunderbolt/domain.c
+++ b/drivers/thunderbolt/domain.c
@@ -635,7 +635,7 @@ int tb_domain_runtime_resume(struct tb *tb)
 int tb_domain_disapprove_switch(struct tb *tb, struct tb_switch *sw)
 {
 	if (!tb->cm_ops->disapprove_switch)
-		return -EPERM;
+		return -ENOTSUPP;
 
 	return tb->cm_ops->disapprove_switch(tb, sw);
 }
@@ -656,7 +656,7 @@ int tb_domain_approve_switch(struct tb *tb, struct tb_switch *sw)
 	struct tb_switch *parent_sw;
 
 	if (!tb->cm_ops->approve_switch)
-		return -EPERM;
+		return -ENOTSUPP;
 
 	/* The parent switch must be authorized before this one */
 	parent_sw = tb_to_switch(sw->dev.parent);
@@ -683,7 +683,7 @@ int tb_domain_approve_switch_key(struct tb *tb, struct tb_switch *sw)
 	int ret;
 
 	if (!tb->cm_ops->approve_switch || !tb->cm_ops->add_switch_key)
-		return -EPERM;
+		return -ENOTSUPP;
 
 	/* The parent switch must be authorized before this one */
 	parent_sw = tb_to_switch(sw->dev.parent);
@@ -718,7 +718,7 @@ int tb_domain_challenge_switch_key(struct tb *tb, struct tb_switch *sw)
 	int ret;
 
 	if (!tb->cm_ops->approve_switch || !tb->cm_ops->challenge_switch_key)
-		return -EPERM;
+		return -ENOTSUPP;
 
 	/* The parent switch must be authorized before this one */
 	parent_sw = tb_to_switch(sw->dev.parent);
@@ -753,7 +753,7 @@ int tb_domain_challenge_switch_key(struct tb *tb, struct tb_switch *sw)
 int tb_domain_disconnect_pcie_paths(struct tb *tb)
 {
 	if (!tb->cm_ops->disconnect_pcie_paths)
-		return -EPERM;
+		return -ENOTSUPP;
 
 	return tb->cm_ops->disconnect_pcie_paths(tb);
 }
-- 
2.25.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ