Skip to content

Commit 0124fb0

Browse files
SandyWinterkuba-moo
authored andcommitted
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: 4452e8e ("s390/iucv: Provide iucv_alloc_device() / iucv_release_device()") Link: https://bugzilla.suse.com/show_bug.cgi?id=1228425 Signed-off-by: Alexandra Winter <[email protected]> Reviewed-by: Thorsten Winkler <[email protected]> Reviewed-by: Przemek Kitszel <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 57fb677 commit 0124fb0

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

net/iucv/iucv.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,15 @@ struct device *iucv_alloc_device(const struct attribute_group **attrs,
8686
{
8787
struct device *dev;
8888
va_list vargs;
89+
char buf[20];
8990
int rc;
9091

9192
dev = kzalloc(sizeof(*dev), GFP_KERNEL);
9293
if (!dev)
9394
goto out_error;
9495
va_start(vargs, fmt);
95-
rc = dev_set_name(dev, fmt, vargs);
96+
vsnprintf(buf, sizeof(buf), fmt, vargs);
97+
rc = dev_set_name(dev, "%s", buf);
9698
va_end(vargs);
9799
if (rc)
98100
goto out_error;

0 commit comments

Comments
 (0)