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(-)

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 */
-- 
2.30.2


Reply via email to