[PATCH] net: ipv6: Fix link-partner MAC address assignment

Daniel Schwierzeck daniel.schwierzeck at gmail.com
Tue Dec 6 13:22:00 CET 2022



On 12/6/22 08:08, Viacheslav Mitrofanov wrote:
> MAC address of a link-partner is not saved for future use because of
> bad condition of if statement. Moreover it can potentially cause to
> NULL-pointer dereference.
> 
> Signed-off-by: Viacheslav Mitrofanov <v.v.mitrofanov at yadro.com>
> ---
>   net/ndisc.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 

Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck at gmail.com>

> diff --git a/net/ndisc.c b/net/ndisc.c
> index 3c0eeeaea3..56fc6390bc 100644
> --- a/net/ndisc.c
> +++ b/net/ndisc.c
> @@ -264,7 +264,7 @@ int ndisc_receive(struct ethernet_hdr *et, struct ip6_hdr *ip6, int len)
>   			ndisc_extract_enetaddr(ndisc, neigh_eth_addr);
>   
>   			/* save address for later use */
> -			if (!net_nd_packet_mac)
> +			if (net_nd_packet_mac)
>   				memcpy(net_nd_packet_mac, neigh_eth_addr, 7);
>   
>   			/* modify header, and transmit it */

-- 
- Daniel


More information about the U-Boot mailing list