Received: by 2002:a05:7412:798b:b0:fc:a2b0:25d7 with SMTP id fb11csp114982rdb; Wed, 21 Feb 2024 20:02:09 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCW7SyrK5yIcIIqLLtcToC/cCNYHPMs/+Xeh9VTBnmB57Y/0a+8RoP09ZS/KfOoSMLy72H0FvlJ694BLTXlwa3c4aPxxLmcmc7aiV+ZSDw== X-Google-Smtp-Source: AGHT+IGZT39La6wad7vSTa4S39aOCU1swEkXAF++zFYdXVBT8nnl/Uoa8TfM8phZbrW7bW5GW7S+ X-Received: by 2002:a05:6a20:ce4a:b0:19e:b6da:da1b with SMTP id id10-20020a056a20ce4a00b0019eb6dada1bmr2036925pzb.4.1708574528835; Wed, 21 Feb 2024 20:02:08 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708574528; cv=pass; d=google.com; s=arc-20160816; b=hk3NPs3iXkFNenR3CGBuE9e6S+H66K0bqhqzFAVe/cDV7GDr4WaZ7DAR19baeO0Z5K bxE+OIZS8z++pEjz4AKQFIzaHTpQRhNNX8K73uyAOQTdI4y6oNY7AUgiYBxAz4rByf+8 PbNVtzgGVe8K9/gIrcle97M575awqdQmaJNTMAh1fvnePqvQY/OTcWzDBESweABO2fw2 0rokxH/7CAr6a8jTXKW2SI/uxSyzAPIdInEk2e1Iyp9EJl3brz0eHQZAziu3EdNbFHav HcaJWGxCyDUYmkC+NjQXSmHqEVC6BN1tjB2tqkw86N75Rq/zVWDNLKSV6Yi52Utgfelm zh8w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=7MhjdBIzVbtJC+qrWqwmXmRz5gU4c1bPbqnR2zTbpeE=; fh=44773Xd3sHCk86cZmNf7tSJBeIp8Xoei+QTrkLIkZOc=; b=zcitSqEixqKNogLsCSwTk310Cm/rveETo/mhypT0NU0BQstyqQtcmfnDl1XiQ/MOQ6 p3nuurv+oA/CozaOK20k8PXHfNII6igGz4opCEX5D41jezOKwFspZyqTO3ryRMZModBu uUCSEqwfOpVqKtx45wvxJwT8evVD+5UotEeWFIY1ybtfluppycshqBAHhFo0YuF+voEG aM+KsaG/5E/CVlsrItHiKuC0qtX6cN+kWwtDrojZ8E0EFryvRXVfdgLhgvbTvx+S55vU 7V372pLE6C9deFww/VfFkRc1Vh4GlC+3dzxv98V+wx7kjVpvDuv8CMEa7bM0swT7SdXE 9wug==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@windriver.com header.s=PPS06212021 header.b=UVIb7hVQ; arc=pass (i=1 spf=pass spfdomain=windriver.com dkim=pass dkdomain=windriver.com dmarc=pass fromdomain=windriver.com); spf=pass (google.com: domain of linux-kernel+bounces-75885-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75885-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=windriver.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id d7-20020a633607000000b005dc7ee3c62dsi9140421pga.236.2024.02.21.20.02.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 20:02:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-75885-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@windriver.com header.s=PPS06212021 header.b=UVIb7hVQ; arc=pass (i=1 spf=pass spfdomain=windriver.com dkim=pass dkdomain=windriver.com dmarc=pass fromdomain=windriver.com); spf=pass (google.com: domain of linux-kernel+bounces-75885-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75885-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=windriver.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id E8DB6B23616 for ; Thu, 22 Feb 2024 04:01:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DBBE71775A; Thu, 22 Feb 2024 04:01:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=windriver.com header.i=@windriver.com header.b="UVIb7hVQ" Received: from mx0b-0064b401.pphosted.com (mx0b-0064b401.pphosted.com [205.220.178.238]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2C53BFBF2; Thu, 22 Feb 2024 04:01:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.178.238 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708574479; cv=none; b=VIr3kveVb1hmE9OlexbmrDspSQzoUluTvmmVfg7E3XdvSSkYXIb/MMZJvzdx2GF6q/FBAeVUKBNI8jcgGyM3B5r2MZ5+wNbLWTnADvfGbaFst1eR/acbBbMVK2Hu7JHgo/d8tvyxU4/HDZccABRH7mlaX29GSw0EJfULCwiLEgo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708574479; c=relaxed/simple; bh=OJZtJeG9oFC0CHpkLX/+q6CW2oV5Xm1b7Y/agkt23OU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=V2ixyQBF3O18GxYOZDbO+MyaA0nip3psTNjSrso7GLqjdG/4ikjvDfnBcRejwmFIkaEEUC+TG+F/u0vrpLJQ7VONu83yJrQyWh6kPTkWT6YJRgBWKWKnoZ1rvhO2Id91WH4o7dL5Ih6OqJ6Eqmo+hpjm0EO73epZ9nEVmWW6bdE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=windriver.com; spf=pass smtp.mailfrom=windriver.com; dkim=pass (2048-bit key) header.d=windriver.com header.i=@windriver.com header.b=UVIb7hVQ; arc=none smtp.client-ip=205.220.178.238 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=windriver.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=windriver.com Received: from pps.filterd (m0250812.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 41M2JpOs008937; Thu, 22 Feb 2024 04:00:52 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=windriver.com; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= PPS06212021; bh=7MhjdBIzVbtJC+qrWqwmXmRz5gU4c1bPbqnR2zTbpeE=; b= UVIb7hVQI1QU1gxPmSCLwsc1C1zChrc3VTuPstp5OAIdDxWofg4iV4BTbMeK1SDK mweU9Q0EWco3IgGMecMXSIadmzwq5xUkkU6nG2KZvYVn9J9ne6/BA7I376RGFYds Z0w+xk55+AHLQ9Y1D8evNwCzidBDersq4SyeGEdxM1OlxRjiZ4fJ/DbugC+mb1q+ SUpuHVX7Wqik0AZjSggAy0Qd5xnctCZpu6YLuyF8YD5fLckSqOfMHMGITIduno+Q x5Jb/MQJdNmhodVGPJqgCr2VcVLMFuzLh+YnaQmlh1T00vp9o6cIBOXnjEznOpva SqmI8Dk9uUm7BELKXRkHlQ== Received: from ala-exchng02.corp.ad.wrs.com (ala-exchng02.wrs.com [147.11.82.254]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3wd218hjn1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Thu, 22 Feb 2024 04:00:51 +0000 (GMT) Received: from ala-exchng01.corp.ad.wrs.com (147.11.82.252) by ALA-EXCHNG02.corp.ad.wrs.com (147.11.82.254) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Wed, 21 Feb 2024 20:00:50 -0800 Received: from pek-lpd-ccm6.wrs.com (147.11.136.210) by ala-exchng01.corp.ad.wrs.com (147.11.82.252) with Microsoft SMTP Server id 15.1.2507.35 via Frontend Transport; Wed, 21 Feb 2024 20:00:47 -0800 From: Lizhi Xu To: CC: , , , , , , , , , Subject: [PATCH net-next] net/mpls: fix WARNING in mpls_gso_segment Date: Thu, 22 Feb 2024 12:00:45 +0800 Message-ID: <20240222040046.2568269-1-lizhi.xu@windriver.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <00000000000043b1310611e388aa@google.com> References: <00000000000043b1310611e388aa@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: yxP3AvRov-tsgP_uT6gijPle0aFETzCU X-Proofpoint-ORIG-GUID: yxP3AvRov-tsgP_uT6gijPle0aFETzCU X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-22_01,2024-02-21_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=922 mlxscore=0 priorityscore=1501 suspectscore=0 impostorscore=0 clxscore=1011 bulkscore=0 malwarescore=0 adultscore=0 spamscore=0 lowpriorityscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2402120000 definitions=main-2402220028 When the network header pointer is greater than the inner network header, the difference between the two can cause mpls_hlen overflow. Reported-and-tested-by: syzbot+99d15fcdb0132a1e1a82@syzkaller.appspotmail.com Signed-off-by: Lizhi Xu --- net/mpls/mpls_gso.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/mpls/mpls_gso.c b/net/mpls/mpls_gso.c index 533d082f0701..2ab24b2fd90f 100644 --- a/net/mpls/mpls_gso.c +++ b/net/mpls/mpls_gso.c @@ -25,11 +25,11 @@ static struct sk_buff *mpls_gso_segment(struct sk_buff *skb, netdev_features_t mpls_features; u16 mac_len = skb->mac_len; __be16 mpls_protocol; - unsigned int mpls_hlen; + int mpls_hlen; skb_reset_network_header(skb); mpls_hlen = skb_inner_network_header(skb) - skb_network_header(skb); - if (unlikely(!mpls_hlen || mpls_hlen % MPLS_HLEN)) + if (unlikely(mpls_hlen <= 0 || mpls_hlen % MPLS_HLEN)) goto out; if (unlikely(!pskb_may_pull(skb, mpls_hlen))) goto out; -- 2.43.0