Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp3230390imc; Wed, 13 Mar 2019 12:12:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqxPRHR6K8wARXgCMO8dxB8leE/Pr0Zzhqzyq7hDAM3waGbrBkQqBhQpdc4+4DVNQL2iEPi1 X-Received: by 2002:a17:902:2848:: with SMTP id e66mr47522313plb.181.1552504344244; Wed, 13 Mar 2019 12:12:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552504344; cv=none; d=google.com; s=arc-20160816; b=FHO2B2vaLzhSnzOfV+8oFneWvpvOMWCKm2LaNXoup1hiBZxC8qL/JW9GlgBu20bk36 rN03l152NNSsXpPctRsBBZURyLHoke4jBbdUI8aJfKEAzHV//PdF26yZVsnLEWCaoKtQ nsXkFCh9ZRhzmFX1mj0xRegx0Xpll+Rbghj3nO4m8nQ+qYAStyTJI+Z71NXxCadz3qO7 Kmy+EReWVY9FpZVHCMyv2PsixRODNIGTUqIZ8XshwB/lEeHzFN72bhEUmZldF1Js535I 1GqNRFTk0Kqi2Rc7FE5FIRnN+tNDDoIgb8bVkLE3fpYNB/YY1sI/RRf74LCwl6pcqApc gYAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=gqHi105eyP7AykrlaIfCBqS1pJnGEdlHrJdActvNJGk=; b=kyr0JZbWDecIjKYlQ0KcmbmGfOOkJXq7IjdNQ8eoYTmW8DMgbrDET6nXBVJNyjo0pA tbxDYnb01vuvk1FLFByg/I0E5qHGOy5eFmmB0S9hynpXoGo6V5yEm5rKtMZyx/nFbhwT CdgEYeE7F2w6AGUbBpFJB+DuCa+CSgO9ZwHG8zFDZyx0XeI0AAbt19LtLMvN6krANqch K7YSDJwagZGBpK0GN6eRKXV9N/Y7Qzkv5v55D3zOcC1/nqpNbUPuujUGVbOGjyvV+3ej VtRT0/ezN/3kkWM+IAOI2vH6S9r/SwZUZ8dHB+NrG8gvZbtd4sQr21nK68Q4R4jDtPKX g4NQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=vtff2rsk; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 14si7271797pgl.479.2019.03.13.12.12.08; Wed, 13 Mar 2019 12:12:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=vtff2rsk; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727417AbfCMTLS (ORCPT + 99 others); Wed, 13 Mar 2019 15:11:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:41850 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727402AbfCMTLQ (ORCPT ); Wed, 13 Mar 2019 15:11:16 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 16CE1213A2; Wed, 13 Mar 2019 19:11:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1552504275; bh=jOesVgG9LOquKRssXDsa7JihSLd9aRaZ6ewrFCLN8kk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vtff2rskYmcqP213SBJt7a4m7B31t4T3j43bYgQI8dD8Vseo5HH7eeXWOZG+5Cj3M 0PwtiDlDfLNr+sB7095KgHQojnvTEEjuGW7yLiFx5kWVa6KByTPUuI1HIIpjplj/nw R3GnKCuO4jsiu6f8eMI0gNRx95Xx+ojyBM+jH+xk= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Michal Kalderon , Ariel Elior , "David S . Miller" , Sasha Levin , netdev@vger.kernel.org Subject: [PATCH AUTOSEL 4.20 26/60] qed: Fix iWARP syn packet mac address validation. Date: Wed, 13 Mar 2019 15:09:47 -0400 Message-Id: <20190313191021.158171-26-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190313191021.158171-1-sashal@kernel.org> References: <20190313191021.158171-1-sashal@kernel.org> MIME-Version: 1.0 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Michal Kalderon [ Upstream commit 8be3dadf04050c2907760ec1955ca1c8fbc25585 ] The ll2 forwards all syn packets to the driver without validating the mac address. Add validation check in the driver's iWARP listener flow and drop the packet if it isn't intended for the device. Signed-off-by: Ariel Elior Signed-off-by: Michal Kalderon Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/qlogic/qed/qed_iwarp.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/net/ethernet/qlogic/qed/qed_iwarp.c b/drivers/net/ethernet/qlogic/qed/qed_iwarp.c index e84fb01b91fd..ded556b7bab5 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_iwarp.c +++ b/drivers/net/ethernet/qlogic/qed/qed_iwarp.c @@ -1688,6 +1688,15 @@ qed_iwarp_parse_rx_pkt(struct qed_hwfn *p_hwfn, eth_hlen = ETH_HLEN + (vlan_valid ? sizeof(u32) : 0); + if (!ether_addr_equal(ethh->h_dest, + p_hwfn->p_rdma_info->iwarp.mac_addr)) { + DP_VERBOSE(p_hwfn, + QED_MSG_RDMA, + "Got unexpected mac %pM instead of %pM\n", + ethh->h_dest, p_hwfn->p_rdma_info->iwarp.mac_addr); + return -EINVAL; + } + ether_addr_copy(remote_mac_addr, ethh->h_source); ether_addr_copy(local_mac_addr, ethh->h_dest); -- 2.19.1