Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2472282imj; Mon, 18 Feb 2019 06:37:03 -0800 (PST) X-Google-Smtp-Source: AHgI3IbAfxdWu22RPGaZMGkNHRyjzRx5N0zSMhtt8lLul8ooRI6IThDDr5ME8kBdTyT1vAHMhcCV X-Received: by 2002:a17:902:7202:: with SMTP id ba2mr25285212plb.147.1550500622958; Mon, 18 Feb 2019 06:37:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550500622; cv=none; d=google.com; s=arc-20160816; b=EmS2UULRdy3a8fSGf+lBs+nm91oxcsOCCl3XS9zDTyEeVB5lSm5gGqYsmk6J6EyG0i oukN9ZhA7pbolSiu+I+OAFKiT6ZaievQNoHdytvSEAd8YxkTsj6/9U2rkgDcs5t8BWSq +Umv/1/LoOVNaj6KCp7FN4LPT4PcCMPC3kCIgZTtHf37h9flgetquaMbZvvuqpLChgqP KLGLQOYPMNQNNME6lHyXHj3ihmYzLwZUC7cBAsEXzrBT2GWRLn0qKPz8/35A84/dDpXZ nDhtmp2i/D5ZGkW0zv17roO8uGhWB1J3q5ph/gVsLjW+Q4mF5R1ggJndLamqijnt2haS xFtQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Xhu3ervaM1Q445dyfpwXcwPLs9Hr265wuK/GIYjv+Wk=; b=v6dC21uC6kcujlZEO66OHJOEuJjy+Vvd5UMGg2CJ8WTuT4SGVDLKVpj8Jg/LZ9Y7Q7 YRcaIYf5/rbOlclgmo2eEcSheOR1Pa4Zi5ZW0AS4ViAj1O70HFHU6rM/XEqkhPnyuUyB czL2Fv7eG2JGKv/yshvjU5L9zeY3KFXecXxqEyULUCpuZJC669LvbcuHUPaGBB4z13Pn ksp5p9YHzHsve1B/zeYy/1haiStTbxTbU2eUzrsg/e3PF1UtwwMCXeiclolqYYO0cRrW MK8CL6pAlgTTN3I//AvWZPB9JxBLb1XDAXoahQXqv2g8DI5lxE95kCMDWhsZoATA+BWB PlCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=zIamtyFH; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g5si13461378plo.108.2019.02.18.06.36.47; Mon, 18 Feb 2019 06:37:02 -0800 (PST) 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=zIamtyFH; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387639AbfBRNz6 (ORCPT + 99 others); Mon, 18 Feb 2019 08:55:58 -0500 Received: from mail.kernel.org ([198.145.29.99]:36028 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387627AbfBRNzz (ORCPT ); Mon, 18 Feb 2019 08:55:55 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 45BFD20842; Mon, 18 Feb 2019 13:55:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1550498154; bh=LMZSKr/B1Pugzg0aQKVy53+oDWVKVom40ZCqLVl+o9g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zIamtyFHJQIsHv4OQrFRz1xcBJzYbrgoA4TI54Hj9oqy9kWx9RZjUKVHbL5muIzp4 eeFXDgzDG1juc3GxSzAI7Y8XjAfY5LCknxQvPNh72iNsdkpk3t4E0abSSbvIs5MTeH kM6+wxWT7VmHVidG8i1hq1a1xBYzcsNC22W8VrJU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Axtens , Eric Dumazet , "David S. Miller" , Jack Wang , Sasha Levin Subject: [PATCH 4.14 23/62] bnx2x: disable GSO where gso_size is too big for hardware Date: Mon, 18 Feb 2019 14:43:29 +0100 Message-Id: <20190218133507.952903511@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190218133505.801423074@linuxfoundation.org> References: <20190218133505.801423074@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ commit 8914a595110a6eca69a5e275b323f5d09e18f4f9 upstream If a bnx2x card is passed a GSO packet with a gso_size larger than ~9700 bytes, it will cause a firmware error that will bring the card down: bnx2x: [bnx2x_attn_int_deasserted3:4323(enP24p1s0f0)]MC assert! bnx2x: [bnx2x_mc_assert:720(enP24p1s0f0)]XSTORM_ASSERT_LIST_INDEX 0x2 bnx2x: [bnx2x_mc_assert:736(enP24p1s0f0)]XSTORM_ASSERT_INDEX 0x0 = 0x00000000 0x25e43e47 0x00463e01 0x00010052 bnx2x: [bnx2x_mc_assert:750(enP24p1s0f0)]Chip Revision: everest3, FW Version: 7_13_1 ... (dump of values continues) ... Detect when the mac length of a GSO packet is greater than the maximum packet size (9700 bytes) and disable GSO. Signed-off-by: Daniel Axtens Reviewed-by: Eric Dumazet Signed-off-by: David S. Miller [jwang: cherry pick for CVE-2018-1000026] Signed-off-by: Jack Wang Signed-off-by: Sasha Levin --- .../net/ethernet/broadcom/bnx2x/bnx2x_main.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c index 022b06e770d1..41ac9a2bc153 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c @@ -12978,6 +12978,24 @@ static netdev_features_t bnx2x_features_check(struct sk_buff *skb, struct net_device *dev, netdev_features_t features) { + /* + * A skb with gso_size + header length > 9700 will cause a + * firmware panic. Drop GSO support. + * + * Eventually the upper layer should not pass these packets down. + * + * For speed, if the gso_size is <= 9000, assume there will + * not be 700 bytes of headers and pass it through. Only do a + * full (slow) validation if the gso_size is > 9000. + * + * (Due to the way SKB_BY_FRAGS works this will also do a full + * validation in that case.) + */ + if (unlikely(skb_is_gso(skb) && + (skb_shinfo(skb)->gso_size > 9000) && + !skb_gso_validate_mac_len(skb, 9700))) + features &= ~NETIF_F_GSO_MASK; + features = vlan_features_check(skb, features); return vxlan_features_check(skb, features); } -- 2.19.1