Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1875976pxk; Tue, 1 Sep 2020 09:47:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxqalNU97Jz7oPDxFrYn0ifIZZTWmkmfdEwxDwo6lduMu2bw2v2C0/Wdx9JKnmjyeulcJqc X-Received: by 2002:a17:906:a141:: with SMTP id bu1mr2281155ejb.303.1598978867850; Tue, 01 Sep 2020 09:47:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598978867; cv=none; d=google.com; s=arc-20160816; b=oDLRBF7tKHYB6RzbVlhrpH32GWuufwbR9Sxz2Xg6gND3vjt1oNMcm6cBQPUU8D47z4 q6YNTMCn5iexNmF/BQE8TPOi58SjpTsg7OzOx+3vay1oGfztTY7HaEQdpUdogLNfD49s tqIorq3/SnLBQmZSi3LNleVbZr3pU8lIM6SvbfH/AJyfiCzdeAb4iYqaAAIp9euBuhJs ot60Y5gSIr52pKq407R0tshc3PVqvenerBQjgCn8Y9KnWOCrIL5BTNb9qK8sne5vU2uF iywc0fJ6xj41vlOkefKhDmkshxExtwhaoQsf1QBhnbt7KaiFp08r4ggvzv6Kpp/3uTs1 tkvg== 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=NpCp64yb0W+tgBPaRIHMlu3Uk88xE47G+7jFIEsCY+c=; b=YWgeIYgD1KhflOa/CdGTup7yzKJ8q6C8OVFBLhWyOGWKuOSzlS0Ge+r7iJ8uGW4oKD TCVUNDQKmKZnoohzm7kEU//kq90/B5MOhHObBSeeq7Tu/4dgvnCG3/ci/cQ0YbKjnwwL kHCy6WvwceH/+Ts5vO8V5NBqhxvL8W3DYTCqKuCPEUOdj9q2dgT4uIE0dWCZOT/Mhg5f mRXu1T50bHfHgVGUmSoX3wqGwCE5bN1Sa1XcAz40MHakecUqJiow/nGkD7suK69OkSjW wGWM02saBpoL46kIKZjltmhtjgbvhdzPvjYnGI+zqEjmzgJ/CTK+BciPFYpCWapn9TBW nhOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=BBb3FBS8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a15si882925edr.470.2020.09.01.09.47.24; Tue, 01 Sep 2020 09:47:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=BBb3FBS8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730337AbgIAQos (ORCPT + 99 others); Tue, 1 Sep 2020 12:44:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:54844 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730222AbgIAP1i (ORCPT ); Tue, 1 Sep 2020 11:27:38 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 661F120FC3; Tue, 1 Sep 2020 15:27:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598974058; bh=8Pg61fIioWlYYBGV+A7wRbD4ccpCCWwaJ8odDb87t7M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BBb3FBS8UbjoahDN+lZL0Acv850KVZ3lfXV09MXCOW5sXhAs5Qfp0hB8a9o7/A0mQ 2Z5AKoc8JjGzHKeAiBDAtoRuJ8qKYTAIaxvRqIvmEzwXX/baZHaApwkJ/XdmrC61DC bKOSm7kSPapmrzesNN6ZNhHoDojTXwj1bCe0s7lM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaohe Lin , "David S. Miller" Subject: [PATCH 5.4 004/214] net: Fix potential wrong skb->protocol in skb_vlan_untag() Date: Tue, 1 Sep 2020 17:08:04 +0200 Message-Id: <20200901150953.166700919@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200901150952.963606936@linuxfoundation.org> References: <20200901150952.963606936@linuxfoundation.org> User-Agent: quilt/0.66 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 From: Miaohe Lin [ Upstream commit 55eff0eb7460c3d50716ed9eccf22257b046ca92 ] We may access the two bytes after vlan_hdr in vlan_set_encap_proto(). So we should pull VLAN_HLEN + sizeof(unsigned short) in skb_vlan_untag() or we may access the wrong data. Fixes: 0d5501c1c828 ("net: Always untag vlan-tagged traffic on input.") Signed-off-by: Miaohe Lin Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/core/skbuff.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -5317,8 +5317,8 @@ struct sk_buff *skb_vlan_untag(struct sk skb = skb_share_check(skb, GFP_ATOMIC); if (unlikely(!skb)) goto err_free; - - if (unlikely(!pskb_may_pull(skb, VLAN_HLEN))) + /* We may access the two bytes after vlan_hdr in vlan_set_encap_proto(). */ + if (unlikely(!pskb_may_pull(skb, VLAN_HLEN + sizeof(unsigned short)))) goto err_free; vhdr = (struct vlan_hdr *)skb->data;