Re: [PATCH] net: only use ethaddrs registered with device node on that device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Nov 07, 2018 at 09:22:15PM +0100, Lucas Stach wrote:
> If an ethaddr is registered with a device node the ethid is set
> to 0 via the struct initialization. Now if a device without a node
> (for eaxample a USB network adapter) with ethid 0 looks up the
> ethaddr it will wrongly get that address assigned, as the ethid
> matches.
> 
> Avoid this by setting the ethid to something that no device will
> ever use when the addr is registered via a device node.
> 
> Signed-off-by: Lucas Stach <l.stach@xxxxxxxxxxxxxx>
> ---
>  net/eth.c | 1 +
>  1 file changed, 1 insertion(+)

Applied, thanks

Sascha

> 
> diff --git a/net/eth.c b/net/eth.c
> index 9dc44119528e..badd18343349 100644
> --- a/net/eth.c
> +++ b/net/eth.c
> @@ -150,6 +150,7 @@ void of_eth_register_ethaddr(struct device_node *node, const char *ethaddr)
>  
>  	addr = xzalloc(sizeof(*addr));
>  	addr->node = node;
> +	addr->ethid = -1;
>  	memcpy(addr->ethaddr, ethaddr, ETH_ALEN);
>  	list_add_tail(&addr->list, &ethaddr_list);
>  }
> -- 
> 2.19.1
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@xxxxxxxxxxxxxxxxxxx
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux