Skip to content

Commit

Permalink
s390/iucv: Fix vargs handling in iucv_alloc_device()
Browse files Browse the repository at this point in the history
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 <wintera@linux.ibm.com>
Reviewed-by: Thorsten Winkler <twinkler@linux.ibm.com>
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Link: https://patch.msgid.link/20240821091337.3627068-1-wintera@linux.ibm.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Alexandra Winter authored and Jakub Kicinski committed Aug 22, 2024
1 parent 57fb677 commit 0124fb0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion net/iucv/iucv.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 0124fb0

Please sign in to comment.