[PATCH] net: ipv6: Fix link-partner MAC address assignment
Vyacheslav Mitrofanov V
v.v.mitrofanov at yadro.com
Wed Dec 7 12:25:14 CET 2022
On Tue, 2022-12-06 at 13:22 +0100, Daniel Schwierzeck wrote:
> «Внимание! Данное письмо от внешнего адресата!»
>
> 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
>
This patch is not appropriate!net_nd_packet_mac is just a pointer,
moreover there is no memory allocation. It has just keep a pointer to
neigh_eth_addr.
So the solution must be sth. like net_nd_packet_mac = neigh_eth_addr;
More information about the U-Boot
mailing list