From patchwork Thu Feb 22 04:00:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lizhi Xu X-Patchwork-Id: 204560 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:aa16:b0:108:e6aa:91d0 with SMTP id by22csp19525dyb; Wed, 21 Feb 2024 20:01:44 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVRaOoRXy795hX8ZjNTrXZAsas3h+uYBJ6VKL9HeM/wOmhtquhwIaK7l/JfAyN51Cn/0y/alTbXxHHsnWENzOJ1Z57xlQ== X-Google-Smtp-Source: AGHT+IH5+acnyjr6bIe93Y/+qonkAPh8JKmBQooWTgWDt+3RN1lBk3d6mDjdEypN3e6YFQ2j2SxJ X-Received: by 2002:a62:5fc6:0:b0:6e4:68c5:440d with SMTP id t189-20020a625fc6000000b006e468c5440dmr1957633pfb.1.1708574504271; Wed, 21 Feb 2024 20:01:44 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708574504; cv=pass; d=google.com; s=arc-20160816; b=vwm45nX7gxxcouZca5exkMlJBZJL0nxKVQ5yEoQ/TZWjJqPhN8ve5kBURh6QjBDC0w z11RLHcvvrWfyoLerZlWeLuWjzFBsvDP9Nbpbq1e53LidClh6TLrVwyOAtdN2BT+nnHh 5rTP1frE3fBKDIzfptn1mjx6yxCmO8As8rkSnMqo3TSqr8Qme0lDlAhjr1MdkicrYjyR pkkbwTljtsE4ryApguiU5qPqhjWAXRhoKj5QBezmoknn/+2jwXY0s5TcJT7pnI3xbEFS mQ9DrvoHRVg+Bdh5zAIUl+sJ/v9qQWM4KKNscGKVhE7vB22veCXUNb4Z1XunciOAwO0t SlTQ== 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-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75885-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=windriver.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id by41-20020a056a0205a900b005dc893fcd81si9920290pgb.29.2024.02.21.20.01.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 20:01:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-75885-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; 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-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75885-ouuuleilei=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 568B52842B3 for ; Thu, 22 Feb 2024 04:01:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9FB4F179AC; Thu, 22 Feb 2024 04:01:21 +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 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791570219387616595 X-GMAIL-MSGID: 1791570219387616595 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;