Linux USB
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: raub camaioni <raubcameo@gmail.com>
Cc: linux-usb@vger.kernel.org
Subject: Re: [PATCH v3] usb: gadget: f_ncm: Fix MAC assignment NCM ethernet
Date: Thu, 14 Aug 2025 18:02:58 +0200	[thread overview]
Message-ID: <2025081445-amends-bonehead-4a3d@gregkh> (raw)
In-Reply-To: <20250814155051.621614-1-raubcameo@gmail.com>

On Thu, Aug 14, 2025 at 11:50:51AM -0400, raub camaioni wrote:
> This fix is already present in f_ecm.c and was never
> propagated to f_ncm.c
> 
> When creating multiple NCM ethernet devices
> on a composite usb gadget device
> each MAC address on the HOST side will be identical.
> Having the same MAC on different network interfaces is bad.
> 
> This fix updates the MAC address inside the
> ncm_strings_defs global during the ncm_bind call.
> This ensures each device has a unique MAC.
> In f_ecm.c ecm_string_defs is updated in the same way.
> 
> The defunct MAC assignment in ncm_alloc has been removed.
> 
> Signed-off-by: raub camaioni <raubcameo@gmail.com>
> ---
>  drivers/usb/gadget/function/f_ncm.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/gadget/function/f_ncm.c b/drivers/usb/gadget/function/f_ncm.c
> index 58b0dd575af3..186fbb9d0a3d 100644
> --- a/drivers/usb/gadget/function/f_ncm.c
> +++ b/drivers/usb/gadget/function/f_ncm.c
> @@ -1463,6 +1463,8 @@ static int ncm_bind(struct usb_configuration *c, struct usb_function *f)
>  
>  	ncm_opts->bound = true;
>  
> +	ncm_string_defs[1].s = ecm->ethaddr;
> +
>  	us = usb_gstrings_attach(cdev, ncm_strings,
>  				 ARRAY_SIZE(ncm_string_defs));
>  	if (IS_ERR(us)) {
> @@ -1771,7 +1773,6 @@ static struct usb_function *ncm_alloc(struct usb_function_instance *fi)
>  		mutex_unlock(&opts->lock);
>  		return ERR_PTR(-EINVAL);
>  	}
> -	ncm_string_defs[STRING_MAC_IDX].s = ncm->ethaddr;
>  
>  	spin_lock_init(&ncm->lock);
>  	ncm_reset_values(ncm);
> -- 
> 2.34.1
> 

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:

- This looks like a new version of a previously submitted patch, but you
  did not list below the --- line any changes from the previous version.
  Please read the section entitled "The canonical patch format" in the
  kernel file, Documentation/process/submitting-patches.rst for what
  needs to be done here to properly describe 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

  reply	other threads:[~2025-08-14 16:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-14 15:50 [PATCH v3] usb: gadget: f_ncm: Fix MAC assignment NCM ethernet raub camaioni
2025-08-14 16:02 ` Greg Kroah-Hartman [this message]
  -- strict thread matches above, loose matches on Subject: below --
2025-08-14 17:08 raub camaioni
2025-08-15  3:26 ` kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2025081445-amends-bonehead-4a3d@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=raubcameo@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox