]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-4.14/qed-fix-iwarp-syn-packet-mac-address-validation.patch
7514ad566f72e9752c0ecb9aa0bf5093040728e3
[thirdparty/kernel/stable-queue.git] / queue-4.14 / qed-fix-iwarp-syn-packet-mac-address-validation.patch
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.
5
6 [ Upstream commit 8be3dadf04050c2907760ec1955ca1c8fbc25585 ]
7
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.
11
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>
16 ---
17 drivers/net/ethernet/qlogic/qed/qed_iwarp.c | 9 +++++++++
18 1 file changed, 9 insertions(+)
19
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,
25
26 eth_hlen = ETH_HLEN + (vlan_valid ? sizeof(u32) : 0);
27
28 + if (!ether_addr_equal(ethh->h_dest,
29 + p_hwfn->p_rdma_info->iwarp.mac_addr)) {
30 + DP_VERBOSE(p_hwfn,
31 + QED_MSG_RDMA,
32 + "Got unexpected mac %pM instead of %pM\n",
33 + ethh->h_dest, p_hwfn->p_rdma_info->iwarp.mac_addr);
34 + return -EINVAL;
35 + }
36 +
37 ether_addr_copy(remote_mac_addr, ethh->h_source);
38 ether_addr_copy(local_mac_addr, ethh->h_dest);
39
40 --
41 2.19.1
42