Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2498291imm; Mon, 28 May 2018 09:12:38 -0700 (PDT) X-Google-Smtp-Source: AB8JxZp2TQK/1+lU4cNUjDgre56LXeJPzU/5kx+kewdLxQlfdl0GLvSDmm4gcBMYhOh+naVZmwMD X-Received: by 2002:a65:550d:: with SMTP id f13-v6mr11067898pgr.324.1527523958201; Mon, 28 May 2018 09:12:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527523958; cv=none; d=google.com; s=arc-20160816; b=ctvB8Up0i/9SYkhsK3NPxVudhljobB0UeK2BQdwZg0BckvE7zV9WWo76VxB8JklAAS SSy8849W13ErmJQKEOZo5/YfIOyhI+t0TL/4Em8CYVbYf8V8RG05/TMi0sPCCbJhxXbN pypFRkEOvlgBWl81G1rvfWxU9YM9QZPz6u9kINGJlrYGeckAi1eo7Q1PKlvpIot0zF4o y+huHfYtWRSFbYK7E63VOFD3BtR5cA6ukYvdB5c/6fEA7ZzaKw5XvuvddzWLUwC+ra5Z Lpvf70iDnNcmZ7oYX6hJzEhmmqIeuQfIiL7q/ro82EKyQMKx1yAS/ms6inTkIjUPteUU CHaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=Uyv1zH5LhKCeUFh7axqqWSlvK4roxaAGF77vCzk5P9w=; b=1KiNnjfa/J6Taw7QtUjw76eXWWefZoQumY4DI0u4gPSokKqUcKAJYtH/TaKG0PhXqF Dy6Z8U+lVV7MgqxkkVYFjEcluq5IgT+GKq+CqN027ia97u9TCtWs4ZxD1/sMxW4MfA1k 2wPlKGSHklldKQ+38tk9/zO3688AwkCHV1ESR6PbhEKMw7PLG8AihzVaTu1qtAdQ8V/T 4TbUF+f0MBJcJ6bEFX4LBQ6h4eRw1c0X/bG9iUpeYbkBkjV5WnSfe+026H4R5sEYnwT5 i7M4Ico2iDX3DqYyOiUzR0ZFnKutp9QaNKkKfMXuJXv3zSWp4JALsq0wKVBreoNkYREG u6qQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=kK0u46YR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g7-v6si29432465plt.149.2018.05.28.09.12.23; Mon, 28 May 2018 09:12:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=kK0u46YR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S939713AbeE1QLu (ORCPT + 99 others); Mon, 28 May 2018 12:11:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:33518 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936495AbeE1KNl (ORCPT ); Mon, 28 May 2018 06:13:41 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (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 45CBD2088E; Mon, 28 May 2018 10:13:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527502420; bh=h0S6w70Z7ed7DqXmh9/mEreCPAJYzdAqtuZ4MjEl8Zo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kK0u46YRGBx6zKFpNpSNnIX5hLGyjsIr93w8Bx+Sh84bpZRl5795XQADinDipDdrh iViZImyGekxVQv2T71zchJKhcYcvBmrqrs1OBAo/UySg0NQru0LtbGdS68Ms6RDMkP 0ibbkYf1kyzwybPE9izS+fiMCibImzsKZWdVepWE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Richard Haines , Paul Moore , Sasha Levin Subject: [PATCH 3.18 180/185] netlabel: If PF_INET6, check sk_buff ip header version Date: Mon, 28 May 2018 12:03:41 +0200 Message-Id: <20180528100116.144929819@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180528100050.700971285@linuxfoundation.org> References: <20180528100050.700971285@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Richard Haines [ Upstream commit 213d7f94775322ba44e0bbb55ec6946e9de88cea ] When resolving a fallback label, check the sk_buff version as it is possible (e.g. SCTP) to have family = PF_INET6 while receiving ip_hdr(skb)->version = 4. Signed-off-by: Richard Haines Acked-by: Paul Moore Signed-off-by: Paul Moore Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- net/netlabel/netlabel_unlabeled.c | 10 ++++++++++ 1 file changed, 10 insertions(+) --- a/net/netlabel/netlabel_unlabeled.c +++ b/net/netlabel/netlabel_unlabeled.c @@ -1472,6 +1472,16 @@ int netlbl_unlabel_getattr(const struct iface = rcu_dereference(netlbl_unlhsh_def); if (iface == NULL || !iface->valid) goto unlabel_getattr_nolabel; + +#if IS_ENABLED(CONFIG_IPV6) + /* When resolving a fallback label, check the sk_buff version as + * it is possible (e.g. SCTP) to have family = PF_INET6 while + * receiving ip_hdr(skb)->version = 4. + */ + if (family == PF_INET6 && ip_hdr(skb)->version == 4) + family = PF_INET; +#endif /* IPv6 */ + switch (family) { case PF_INET: { struct iphdr *hdr4;