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.mitrofa...@yadro.com>
---
  net/ndisc.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)


Reviewed-by: Daniel Schwierzeck <daniel.schwierz...@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

Reply via email to