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] usb: gadget: f_ncm: Fix MAC assignment NCM ethernet
Date: Thu, 14 Aug 2025 15:53:43 +0200	[thread overview]
Message-ID: <2025081421-proponent-tanned-4a66@gregkh> (raw)
In-Reply-To: <20250814134609.599023-1-raubcameo@gmail.com>

On Thu, Aug 14, 2025 at 09:46:09AM -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(-)

Was this sent twice?  Which one is right?

> 
> diff --git a/drivers/usb/gadget/function/f_ncm.c b/drivers/usb/gadget/function/f_ncm.c
> index 58b0dd575af3..3164e75caa3b 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;
> +	

Did you run checkpatch on this?  It should have given you an error here
:(

thanks,

greg k-h

  reply	other threads:[~2025-08-14 13:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-14 13:46 [PATCH] usb: gadget: f_ncm: Fix MAC assignment NCM ethernet raub camaioni
2025-08-14 13:53 ` Greg Kroah-Hartman [this message]
     [not found]   ` <CAAGxeQdueNdCVt87tKZat74u8op2YKmy5VaqYpkQww0HYNNnvA@mail.gmail.com>
2025-08-14 14:53     ` Greg Kroah-Hartman
  -- strict thread matches above, loose matches on Subject: below --
2025-08-14 13:16 raub camaioni
2025-08-14 13:31 ` Greg Kroah-Hartman

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=2025081421-proponent-tanned-4a66@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