Received: by 2002:a05:7412:8521:b0:e2:908c:2ebd with SMTP id t33csp1073314rdf; Sat, 4 Nov 2023 05:44:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHsVyCBzp3DwC+02kbPHWmEpKQz8wmFA4sT4RDonLDZoqOoXPJfUMFoh/o8Bio9ighpOQS1 X-Received: by 2002:a17:90a:6f42:b0:280:1b75:f077 with SMTP id d60-20020a17090a6f4200b002801b75f077mr17489467pjk.13.1699101851047; Sat, 04 Nov 2023 05:44:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1699101851; cv=none; d=google.com; s=arc-20160816; b=RhPZWxKARKPAe6695unBS2JL1cTpWZxCH9DeApo97BLWjmAQxtNEpxroLWwWlzAWa/ jAVnh8GnhcEWSa8w1s2eIxUNABiQ2goAq+HTsHDdVuhe7ftB09vVqpQr8Nm1+/zQyE31 OlExMh3sRvT6rkKVbAIJKiZt2V6yPq2s6BSpvPaPr9ftPfE4CzsqgJkUG8TIevHEb1VT bVKAanwJDamh60pOwgOLbYkPrGRyHol5ZTPtyZ1xlhOp/+rEYNlCKbsnE6kcEetsCJi9 4z6qunRlB6AOan0yZhlB1AIy4CwT+buIJiB9I4zmV2ToNIWzhL0o0tc5JSpNmkZUY+Vt OGCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=vbrVElpE/LRcXL9QrTPOXjtUB0U3i3Et1aitWER/TV4=; fh=bYuvYY+UAm+RKkoLNBZQ9/NmrCpqb49Mw9RYUbh+sKg=; b=HjarZjjcGgm6UkpFYuD2iCgE5ZJGvb6HpqWAXFMxqvUCnTz56CngOhAT6cIJaBcQhc g0CGG5CgzwzgtFDmVYYPHWorB2Tf1LFO48apRX8oAPDChJvEY2VMcA9ab8i5AghVTfJb aBYD/kTwz4sB79j6IEk8R055UkSPEskR2jRA3Le5wnbL67o+/h6DL63JXEtJNyd8S3le rc14vRwgek5kAfMf2axEyV6ZR8Ht5geWtJSxyqDkoliH46+2+vIv8MEHmF5ysO/r921z ZYWcKTEyXfRQ+YvChB9RNohj4/l/xJq3+CTknUIybYl15m9psxRb1XwSUYmeq245XmFK O+Nw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yy3Uh94e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id z93-20020a17090a6d6600b0027d113631f0si3613554pjj.24.2023.11.04.05.44.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Nov 2023 05:44:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yy3Uh94e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id C88998042597; Sat, 4 Nov 2023 05:44:09 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232116AbjKDMoG (ORCPT + 99 others); Sat, 4 Nov 2023 08:44:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39622 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231655AbjKDMn6 (ORCPT ); Sat, 4 Nov 2023 08:43:58 -0400 Received: from mail-lf1-x129.google.com (mail-lf1-x129.google.com [IPv6:2a00:1450:4864:20::129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F1BC1B2 for ; Sat, 4 Nov 2023 05:43:55 -0700 (PDT) Received: by mail-lf1-x129.google.com with SMTP id 2adb3069b0e04-5079f9675c6so3866973e87.2 for ; Sat, 04 Nov 2023 05:43:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699101833; x=1699706633; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=vbrVElpE/LRcXL9QrTPOXjtUB0U3i3Et1aitWER/TV4=; b=yy3Uh94eo9ISIt7N3igeFW2Yn93KkptUPRKaRqm3tc95Hckgfob3SSvrYpMf9QyCGR /ae+NOo9o1uiKrgwVONTOQBO72lMiC6bN7n66oLerfIJ2I/pwJf4PL+f1sF4ft/CzB0q /vGTbxUE/lgnK+bCgP8P6nnnbRAfQ5vUMmbvxEbiwk7Ufef3G2Y2cwbrKgDi7uFTXeWq Tl+YJTVcdLA0SJ1cmeyRz6t7l71Mut7g0W2F1R1BkYG3Mh5t6LJAOHYgL7vq+UbZzA6B RIpTv+c4wD/6J1i/g0A9G0YrT01GB6ZUz5UeMOex12P0p0QTCWR2HYVXuPqifCHvn7NV Cm+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699101833; x=1699706633; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vbrVElpE/LRcXL9QrTPOXjtUB0U3i3Et1aitWER/TV4=; b=ni/9i3PpXzZP2jHCv+AUTLo1sM1xGY1AZcTAOCDrvh8ZpNM06SWurMfgGPjzB/yYIA ACHhW8E9sUr5GakJZvTtEKV9IfzJpKi9m0HjajVkWbPObRJwhxVV/yRvinIA5wc3Tg0E t2WUAzYXFtEUyQA+PUTRVjeirrrWPt2bKTxe2FwpbBxb7zFe/2QBcTgPBYA2i/05d4cG 7tppPhviY7sqICcnlAAj1pK88Y1qd3Iniz+oQiGuwY3Rn4ExbjAX5VHt8DuzrnXkDIDZ AjXBwMpcME0no1Fo1ZG0xM/aNN4zO+3mIYYMr43mpNVQFvl1j9+BRcJl1MJn+V+oDHeo doow== X-Gm-Message-State: AOJu0YzV0ZEzoJkAzz3NO1tgYTbVBDDsZYGalYrAgxh/nK/77ZXR6IHR hdy+y6kY4GjX+ml0ARTsAs56GQ== X-Received: by 2002:a05:6512:b93:b0:4fe:347d:7c4b with SMTP id b19-20020a0565120b9300b004fe347d7c4bmr23951283lfv.7.1699101833426; Sat, 04 Nov 2023 05:43:53 -0700 (PDT) Received: from [127.0.1.1] ([85.235.12.238]) by smtp.gmail.com with ESMTPSA id u22-20020ac24c36000000b005093312f66fsm496100lfq.124.2023.11.04.05.43.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Nov 2023 05:43:52 -0700 (PDT) From: Linus Walleij Date: Sat, 04 Nov 2023 13:43:50 +0100 Subject: [PATCH net 3/4] net: ethernet: cortina: Protect against oversized frames MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20231104-gemini-largeframe-fix-v1-3-9c5513f22f33@linaro.org> References: <20231104-gemini-largeframe-fix-v1-0-9c5513f22f33@linaro.org> In-Reply-To: <20231104-gemini-largeframe-fix-v1-0-9c5513f22f33@linaro.org> To: Hans Ulli Kroll , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , =?utf-8?q?Micha=C5=82_Miros=C5=82aw?= , Vladimir Oltean Cc: linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Linus Walleij X-Mailer: b4 0.12.4 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Sat, 04 Nov 2023 05:44:10 -0700 (PDT) The max size of a transfer no matter the MTU is 64KB-1 so immediately bail out if the skb exceeds that. Fixes: 4d5ae32f5e1e ("net: ethernet: Add a driver for Gemini gigabit ethernet") Signed-off-by: Linus Walleij --- drivers/net/ethernet/cortina/gemini.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/ethernet/cortina/gemini.c b/drivers/net/ethernet/cortina/gemini.c index fd08f098850b..23723c9c0f93 100644 --- a/drivers/net/ethernet/cortina/gemini.c +++ b/drivers/net/ethernet/cortina/gemini.c @@ -1156,6 +1156,12 @@ static int gmac_map_tx_bufs(struct net_device *netdev, struct sk_buff *skb, mtu = MTU_SIZE_BIT_MASK; } + if (skb->len > 65535) { + /* The field for length is only 16 bits */ + netdev_err(netdev, "%s: frame too big, max size 65535 bytes\n", __func__); + return -EINVAL; + } + word1 = skb->len; word3 = SOF_BIT; -- 2.34.1