1 From 82ccecbbb3c37571b1e4f0a222879c3ad31fded8 Mon Sep 17 00:00:00 2001
2 From: Michal Kalderon <michal.kalderon@marvell.com>
3 Date: Mon, 18 Feb 2019 15:24:03 +0200
4 Subject: qed: Fix iWARP syn packet mac address validation.
6 [ Upstream commit 8be3dadf04050c2907760ec1955ca1c8fbc25585 ]
8 The ll2 forwards all syn packets to the driver without validating the mac
9 address. Add validation check in the driver's iWARP listener flow and drop
10 the packet if it isn't intended for the device.
12 Signed-off-by: Ariel Elior <ariel.elior@marvell.com>
13 Signed-off-by: Michal Kalderon <michal.kalderon@marvell.com>
14 Signed-off-by: David S. Miller <davem@davemloft.net>
15 Signed-off-by: Sasha Levin <sashal@kernel.org>
17 drivers/net/ethernet/qlogic/qed/qed_iwarp.c | 9 +++++++++
18 1 file changed, 9 insertions(+)
20 diff --git a/drivers/net/ethernet/qlogic/qed/qed_iwarp.c b/drivers/net/ethernet/qlogic/qed/qed_iwarp.c
21 index eb666877d1aa..bb09f5a9846f 100644
22 --- a/drivers/net/ethernet/qlogic/qed/qed_iwarp.c
23 +++ b/drivers/net/ethernet/qlogic/qed/qed_iwarp.c
24 @@ -1651,6 +1651,15 @@ qed_iwarp_parse_rx_pkt(struct qed_hwfn *p_hwfn,
26 eth_hlen = ETH_HLEN + (vlan_valid ? sizeof(u32) : 0);
28 + if (!ether_addr_equal(ethh->h_dest,
29 + p_hwfn->p_rdma_info->iwarp.mac_addr)) {
32 + "Got unexpected mac %pM instead of %pM\n",
33 + ethh->h_dest, p_hwfn->p_rdma_info->iwarp.mac_addr);
37 ether_addr_copy(remote_mac_addr, ethh->h_source);
38 ether_addr_copy(local_mac_addr, ethh->h_dest);