From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 171FD3BA22B for ; Fri, 27 Mar 2026 06:38:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774593504; cv=none; b=p9wwiPUlbHOV+DQILTNx7NElltz8mLBV1Wl/9GVhzm1ZksnWzqEr9dY6Dg1+swdvxeNyL5o6qzKuhR09RzFN61EX1XZnfhEG9K7ETov3BS7Iu+AnVxUUCoBLBcnm7Hv/3F8E/Sbk8JLfSKm6X+kwPVclAr6v3KruJQvJJP6j1dU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774593504; c=relaxed/simple; bh=0PQ0R9rAwmS9xKjuhJFascJ1dmFx6hqwZe5aHDfzhHM=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=NGZDqOOphLU4ExAiko4efOifBN4WtRv6X8eFtrqoI56I/sNDl0ugRTy6ZWdAYgc2eu+Ax/tdy7YikgceXZ4m2XDt2GWCYYaGqJ+w2iusAhp7VljrwoxOS3iKSHNADg9QzhehrAoqwDOAqF0tEwoSwrOthx2EaqAzzZ4oaOKLsQQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=blackwall.org; spf=none smtp.mailfrom=blackwall.org; dkim=pass (2048-bit key) header.d=blackwall.org header.i=@blackwall.org header.b=DZDT/DL5; arc=none smtp.client-ip=209.85.128.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=blackwall.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=blackwall.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=blackwall.org header.i=@blackwall.org header.b="DZDT/DL5" Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-4852a9c6309so15493685e9.0 for ; Thu, 26 Mar 2026 23:38:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=blackwall.org; s=google; t=1774593492; x=1775198292; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=vy83C5FxtN9GPfanScbX328M9aV0PE+NWeES6DorSXA=; b=DZDT/DL5MVXz72Mq71vLbsBp21neVUZWFQNS4K3IuvJ1iKl5v2oFaSukD9a09BWSS+ BRvnmiALiu48GD9Gh8nrPvBQ7e7hGmSgHUXBkewfiNmH/vgk8v0JvFFFrgn25h9SKXuF e/T0C+/aJCM3SXuc7zvzYuLA9Wf0O6YClFBnfOMHonK/sLUDbEcC+2hzbLXaG6Sduu8i yzR9vdH9b7wVcNmq95UcXfuA6oRRsCFMduY6k2eCJRKIrl5xiwU0Iggw7VTuqI4C+xAw jGm3oi5b1Ew9lv59rXPWJbtPyXb8m5/cLZelRD8xKq2BMLq9aRk7WngXWmHXuVXtZtBY fj6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774593492; x=1775198292; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=vy83C5FxtN9GPfanScbX328M9aV0PE+NWeES6DorSXA=; b=KZh9vbnnwQ03cc2bb8ratU5rM6vQuc+znrcutaDjsXSHVTmK+Cx7KGOL8OqMwQe+IM oxrT+oomIVXHGSBw5Qcl90q9BiUduGz7LHfabtwVv9YIpPzO71GQ8NAV0BmONXCwsX4P I9+T3FUvQd+BzzvWSD64YvgFN+Phvp4OwOxVRXqxhQyj7JklzGBRENULdIhhdzVq3DfZ FXPEGBW/cPH+QYQd1v+uKh9khWmZ7qldoIg1Lct7YieApOWUhearr3OWhHs4yxqCWT0W YaocUO0eVUIPN2OG6TVNGUQTr/0840GrIGk+hmfZ/uLXp3a3tAYJKd5nfJxBS6+S6Eei hp+Q== X-Forwarded-Encrypted: i=1; AJvYcCUVms1PyygP11HITqMShZF+3GkBUg/kT7rpz+Zw80y/+VSNwtuVV6xhTRSwPS09U95JtcH/DCSVltl12pQ=@vger.kernel.org X-Gm-Message-State: AOJu0YwIbTgrV6VpxLmLb4+wmlBdhdmEpDCzl7oX+YFxcYoZy+xzEtr4 8LhAdSrNlImJc7XVODWbFPNO8HhVsbBLT17mzVUUQVpIIkwzDxgs+hK0VT9iwjwbINo= X-Gm-Gg: ATEYQzw6BtQDNta7aOHiCpFb/OTZK+i0qK0go2lJORku9fSDyFJkNzV1wKeZ+pch9N4 RzvCIKXabdKStbgKX9Hm/EZrc3Ai5id0QZM6BwmAp0aFrt1s/W3XNYaJ4HiuG8O26lttepywIVO cKbVQsh+0H/jqqOLtzfmKhnf1FsGMdNJdmA8JO4MRimLc6YlNeEop09DqY3knBddlxotV+c3uK6 1Y95KGPrCiI7LgJ3gwRVpB/qaz9/bxivGigH/HWASy8KEJYMahYDrT2ckQF30FsrIHmLFQ8JSmy qKnpg2roG0l5l8OACs++QC03nupSAC5NuaMFDErvwBH9mhhBn7xs3wUmie4l9W+9+edt/T9DOOs auMy2apLCIG/oCcMyL0l7+jHC18IqkbuId5pmhpehodxRqcnH636Hvbj1rl/KL0d9vr+UPRZJ4l d9QcYjYLgCbE5DxmzFZa3Nc+mP8Dh+ukFix/fYdCYoECM/wYQtBOiI5w== X-Received: by 2002:a05:600c:8b77:b0:486:ffa3:584 with SMTP id 5b1f17b1804b1-48727f17035mr17478945e9.15.1774593492578; Thu, 26 Mar 2026 23:38:12 -0700 (PDT) Received: from [192.168.0.161] (78-154-15-142.ip.btc-net.bg. [78.154.15.142]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-487270fd880sm12607495e9.8.2026.03.26.23.38.11 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 26 Mar 2026 23:38:12 -0700 (PDT) Message-ID: <8414c7c5-5400-46b4-a470-fade0ff4faee@blackwall.org> Date: Fri, 27 Mar 2026 08:38:10 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH net 3/3] vxlan: validate ND option lengths in vxlan_na_create To: Yang Yang , davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, idosch@nvidia.com Cc: andrew+netdev@lunn.ch, horms@kernel.org, florian.fainelli@broadcom.com, roopa@cumulusnetworks.com, dlstevens@us.ibm.com, nb@tipi-net.de, netdev@vger.kernel.org, bridge@lists.linux.dev, linux-kernel@vger.kernel.org, yifanwucs@gmail.com, tomapufckgml@gmail.com, tanyuan98@outlook.com, bird@lzu.edu.cn References: <20260326034441.2037420-1-n05ec@lzu.edu.cn> <20260326034441.2037420-4-n05ec@lzu.edu.cn> Content-Language: en-US From: Nikolay Aleksandrov In-Reply-To: <20260326034441.2037420-4-n05ec@lzu.edu.cn> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 26/03/2026 05:44, Yang Yang wrote: > vxlan_na_create() walks ND options according to option-provided > lengths. A malformed option can make the parser advance beyond the > computed option span or use a too-short source LLADDR option payload. > > Validate option lengths against the remaining NS option area before > advancing, and only read source LLADDR when the option is large enough > for an Ethernet address. > > Fixes: 4b29dba9c085 ("vxlan: fix nonfunctional neigh_reduce()") > Cc: stable@vger.kernel.org > Reported-by: Yifan Wu > Reported-by: Juefei Pu > Tested-by: Ao Zhou > Co-developed-by: Yuan Tan > Signed-off-by: Yuan Tan > Suggested-by: Xin Liu > Signed-off-by: Yang Yang > --- > drivers/net/vxlan/vxlan_core.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/vxlan/vxlan_core.c b/drivers/net/vxlan/vxlan_core.c > index 17c941aac32db..a94ac82a61364 100644 > --- a/drivers/net/vxlan/vxlan_core.c > +++ b/drivers/net/vxlan/vxlan_core.c > @@ -1965,12 +1965,14 @@ static struct sk_buff *vxlan_na_create(struct sk_buff *request, > ns_olen = request->len - skb_network_offset(request) - > sizeof(struct ipv6hdr) - sizeof(*ns); > for (i = 0; i < ns_olen-1; i += (ns->opt[i+1]<<3)) { > - if (!ns->opt[i + 1]) { > + if (!ns->opt[i + 1] || i + (ns->opt[i + 1] << 3) > ns_olen) { > kfree_skb(reply); > return NULL; > } > if (ns->opt[i] == ND_OPT_SOURCE_LL_ADDR) { > - daddr = ns->opt + i + sizeof(struct nd_opt_hdr); > + if ((ns->opt[i + 1] << 3) >= > + sizeof(struct nd_opt_hdr) + ETH_ALEN) > + daddr = ns->opt + i + sizeof(struct nd_opt_hdr); > break; > } > } Acked-by: Nikolay Aleksandrov