Skip to contentSkip to conversation

s390/iucv: Fix vargs handling in iucv_alloc_device()

PATCH Applied Alexandra Winter 2 participants 2 messages Aug 21, 2024 – Aug 22, 2024

Subsystems (4)
lore
Share & tools
lore

Alexandra Winter

author maintainer
#0 lore raw

PATCH v4 1/1 s390/iucv: Fix vargs handling in iucv_alloc_device()

iucv_alloc_device() gets a format string and a varying number of arguments. This is incorrectly forwarded by calling dev_set_name() with the format string and a va_list, while dev_set_name() expects also a varying number of arguments.

Symptoms:
Corrupted iucv device names, which can result in log messages like:
sysfs: cannot create duplicate filename '/devices/iucv/hvc_iucv1827699952'

Fixes 4452e8ef8c36 ("s390/iucv: Provide iucv_alloc_device() / iucv_release_device()")

---
v3 -> v4: Remove reference to internal bugzilla
v2 -> v3: use %s (Przemek Kitszel)
Discussion of v1:

Vasily Gorbik asked me to send this version via the netdev mailing list.

---
 net/iucv/iucv.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
net/iucv/iucv.c +3 -1
index 1e42e13ad24e..d3e9efab7f4b 100644
@@ -86,13 +86,15 @@ struct device *iucv_alloc_device(const struct attribute_group **attrs,
 {
 	struct device *dev;
 	va_list vargs;
+	char buf[20];
 	int rc;
 
 	dev = kzalloc(sizeof(*dev), GFP_KERNEL);
 	if (!dev)
 		goto out_error;
 	va_start(vargs, fmt);
-	rc = dev_set_name(dev, fmt, vargs);
+	vsnprintf(buf, sizeof(buf), fmt, vargs);
+	rc = dev_set_name(dev, "%s", buf);
 	va_end(vargs);
 	if (rc)
 		goto out_error;
Signature · 1 line
2.43.0
#1 lore raw
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 10 lines · On Wed, 21 Aug 2024 11:13:37 +0200 you wrote:

iucv_alloc_device() gets a format string and a varying number of arguments. This is incorrectly forwarded by calling dev_set_name() with the format string and a va_list, while dev_set_name() expects also a varying number of arguments.

Symptoms:
Corrupted iucv device names, which can result in log messages like:
sysfs: cannot create duplicate filename '/devices/iucv/hvc_iucv1827699952'

[...]

Here is the summary with links:
- [net,v4] s390/iucv: Fix vargs handling in iucv_alloc_device()

    https://git.kernel.org/netdev/net/c/0124fb0ebf3b

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html