* [PATCH net v3] s390/iucv: Fix vargs handling in iucv_alloc_device()
@ 2024-08-20 15:29 Alexandra Winter
2024-08-21 9:12 ` Alexandra Winter
0 siblings, 1 reply; 2+ messages in thread
From: Alexandra Winter @ 2024-08-20 15:29 UTC (permalink / raw)
To: David Miller, Jakub Kicinski, Paolo Abeni, Eric Dumazet
Cc: netdev, linux-s390, Heiko Carstens, Vasily Gorbik,
Alexander Gordeev, Christian Borntraeger, Sven Schnelle,
Thorsten Winkler, Greg Kroah-Hartman, Przemek Kitszel,
kernel test robot
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()")
Link: https://bugzilla.suse.com/show_bug.cgi?id=1228425
Reference-ID: https://bugzilla.linux.ibm.com/show_bug.cgi?id=208008
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>
---
v2 -> v3: use "%s" (Przemek Kitszel)
Discussion of v1:
Link: https://lore.kernel.org/all/2024081326-shifter-output-cb8f@gregkh/T/#mf8ae979de8acdc01f7ede0b94af6f2e110eea209
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202408091131.ATGn6YSh-lkp@intel.com/
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(-)
diff --git a/net/iucv/iucv.c b/net/iucv/iucv.c
index 1e42e13ad24e..d3e9efab7f4b 100644
--- a/net/iucv/iucv.c
+++ b/net/iucv/iucv.c
@@ -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;
--
2.39.3 (Apple Git-146)
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net v3] s390/iucv: Fix vargs handling in iucv_alloc_device()
2024-08-20 15:29 [PATCH net v3] s390/iucv: Fix vargs handling in iucv_alloc_device() Alexandra Winter
@ 2024-08-21 9:12 ` Alexandra Winter
0 siblings, 0 replies; 2+ messages in thread
From: Alexandra Winter @ 2024-08-21 9:12 UTC (permalink / raw)
To: David Miller, Jakub Kicinski, Paolo Abeni, Eric Dumazet
Cc: netdev, linux-s390, Heiko Carstens, Vasily Gorbik,
Alexander Gordeev, Christian Borntraeger, Sven Schnelle,
Thorsten Winkler, Greg Kroah-Hartman, Przemek Kitszel,
kernel test robot
On 20.08.24 17:29, Alexandra Winter wrote:
> Reference-ID: https://bugzilla.linux.ibm.com/show_bug.cgi?id=208008
Argh, I forgot to remove our internal Reference-ID from the commit message.
Will send a v4
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-08-21 9:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-20 15:29 [PATCH net v3] s390/iucv: Fix vargs handling in iucv_alloc_device() Alexandra Winter
2024-08-21 9:12 ` Alexandra Winter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).