diff mbox series

[net,v2] s390/iucv: Fix vargs handling in iucv_alloc_device()

Message ID 20240820084528.2396537-1-wintera@linux.ibm.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series [net,v2] s390/iucv: Fix vargs handling in iucv_alloc_device() | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag present in non-next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 7 this patch: 7
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 9 of 9 maintainers
netdev/build_clang success Errors and warnings before: 7 this patch: 7
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 7 this patch: 7
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 16 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 84 this patch: 84
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-08-20--15-00 (tests: 712)

Commit Message

Alexandra Winter Aug. 20, 2024, 8:45 a.m. UTC
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
Signed-off-by: Alexandra Winter <wintera@linux.ibm.com>
Reviewed-by: Thorsten Winkler <twinkler@linux.ibm.com>
---
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(-)

Comments

Przemek Kitszel Aug. 20, 2024, 11:51 a.m. UTC | #1
On 8/20/24 10:45, Alexandra Winter 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'
> 
> Fixes: 4452e8ef8c36 ("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>
> ---
> Discussion of v1:
> Link: https://lore.kernel.org/all/2024081326-shifter-output-cb8f@gregkh/T/#mf8ae979de8acdc01f7ede0b94af6f2e110eea209

side note: that's nice that you have continued Vasily's series as your
own v2

> 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..2e615641a4e5 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, buf);

would be good to pass "%s" as fmt to dev_set_name()

otherwise this patch is good for me, so please add my:
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>

>   	va_end(vargs);
>   	if (rc)
>   		goto out_error;
Jakub Kicinski Aug. 22, 2024, 12:34 a.m. UTC | #2
On Tue, 20 Aug 2024 13:51:06 +0200 Przemek Kitszel wrote:
> > +	rc = dev_set_name(dev, buf);  
> 
> would be good to pass "%s" as fmt to dev_set_name()

Sounds like a good idea
Greg KH Aug. 24, 2024, 3:12 a.m. UTC | #3
On Tue, Aug 20, 2024 at 10:45:28AM +0200, Alexandra Winter 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'
> 
> Fixes: 4452e8ef8c36 ("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>
> ---

Hi,

This is the friendly patch-bot of Greg Kroah-Hartman.  You have sent him
a patch that has triggered this response.  He used to manually respond
to these common problems, but in order to save his sanity (he kept
writing the same thing over and over, yet to different people), I was
created.  Hopefully you will not take offence and will fix the problem
in your patch and resubmit it so that it can be accepted into the Linux
kernel tree.

You are receiving this message because of the following common error(s)
as indicated below:

- You have marked a patch with a "Fixes:" tag for a commit that is in an
  older released kernel, yet you do not have a cc: stable line in the
  signed-off-by area at all, which means that the patch will not be
  applied to any older kernel releases.  To properly fix this, please
  follow the documented rules in the
  Documentation/process/stable-kernel-rules.rst file for how to resolve
  this.

If you wish to discuss this problem further, or you have questions about
how to resolve this issue, please feel free to respond to this email and
Greg will reply once he has dug out from the pending patches received
from other developers.

thanks,

greg k-h's patch email bot
diff mbox series

Patch

diff --git a/net/iucv/iucv.c b/net/iucv/iucv.c
index 1e42e13ad24e..2e615641a4e5 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, buf);
 	va_end(vargs);
 	if (rc)
 		goto out_error;