Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2678392pxj; Mon, 31 May 2021 08:04:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJziFafapMnPdfVFbQb242Q533yaDcKvr2UFYWqhIJ2McY19r0EcP8nD41WrA696sIwPzRjA X-Received: by 2002:a17:907:9047:: with SMTP id az7mr11157359ejc.4.1622473489104; Mon, 31 May 2021 08:04:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622473489; cv=none; d=google.com; s=arc-20160816; b=LCMx90b2aGvUgrKK4DO4Tt6NhV7OR6adumiVNEwpkBc9CWJEsHS/Clt79QzRt8pQRY K7iFvKnhcD3ViD4ENnWHltqg4LPnNyFC/stLmbG1vO02ZyhDD1+/45u33h5QlM6xLoKd Baxl6hi9FvH7QjSNGWW2lS/U/fWLGk2faaYHLloLZWipN9jMWiXQbregNbZlhsT3Y81N sBbgL45EFgUjejs+jhso/y8dJbNk43+XvkbcSJD+kcB2/WFPxtaWfPLr86K1B4cCIZYU PFIqmndYBDqzA6ltkRofwOvZc2g0s9wFSgNdYLvyga2oGhRHMgCQsnDXfOxriNQerjse iDpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=MRYQbsETdA2ZOu2L6R8JOCN1YU0IMTfS/YnEH4MpZCo=; b=hyUJdCRfZawSUQba2560wtkd0MJ6LPMghNaK9NeoMbER2TqgNTnym6UxGNxcuPFL5c Vyfa1hERtLH1MMTZXHj/SeObNMYN+kXBqvai3jlsacPvPzAqyxBf1KKYAMslXXY2yXfY MjTgpZGWt1CNTpB0WMqicthJtfB/2eQ5KvoIg+nDbf6xh7tWEsgnULlNDuw4JSvJ0m9/ TNEkp6hU9RphIjlLp+JlP8EjwalZvjoQbk8LbYxxiI2s3b6ZHQ7PNi9s5Zs4nLD12jif +41ruTE5kNu+Yt41NVtZkZbkE3Sr08DSrKSOUe6xcdm1yVjEth7P8HNkKNxZnfm8H9JR L/yA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=F3GPl+0m; 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=pass (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 hs26si11348629ejc.307.2021.05.31.08.04.26; Mon, 31 May 2021 08:04:49 -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=@linuxfoundation.org header.s=korg header.b=F3GPl+0m; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234578AbhEaPEm (ORCPT + 99 others); Mon, 31 May 2021 11:04:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:40228 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231995AbhEaOHf (ORCPT ); Mon, 31 May 2021 10:07:35 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id F30C561407; Mon, 31 May 2021 13:39:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622468361; bh=5yKAetD6fBSFYX8g+Wb/K3Pxi1ZrMI3kph2aD+o7LMo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F3GPl+0mbfhOyodiGximl6im61AweW3aU83dAP0d8X9eT+Jo4BSTS/B5HRzsUkypj WzuPCwh7IxbeX6LdBfuG0bQSqxlkFpIk6QbQCIlJ2XVUnAlp/o6dPd3ElWD+bWFFcK 0OXnDIgSUxBGxwj9blKghAi8TcmYj5cxVvJ3ElBQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Taehee Yoo , "David S. Miller" , Sasha Levin Subject: [PATCH 5.10 214/252] mld: fix panic in mld_newpack() Date: Mon, 31 May 2021 15:14:39 +0200 Message-Id: <20210531130705.287398057@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130657.971257589@linuxfoundation.org> References: <20210531130657.971257589@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Taehee Yoo [ Upstream commit 020ef930b826d21c5446fdc9db80fd72a791bc21 ] mld_newpack() doesn't allow to allocate high order page, only order-0 allocation is allowed. If headroom size is too large, a kernel panic could occur in skb_put(). Test commands: ip netns del A ip netns del B ip netns add A ip netns add B ip link add veth0 type veth peer name veth1 ip link set veth0 netns A ip link set veth1 netns B ip netns exec A ip link set lo up ip netns exec A ip link set veth0 up ip netns exec A ip -6 a a 2001:db8:0::1/64 dev veth0 ip netns exec B ip link set lo up ip netns exec B ip link set veth1 up ip netns exec B ip -6 a a 2001:db8:0::2/64 dev veth1 for i in {1..99} do let A=$i-1 ip netns exec A ip link add ip6gre$i type ip6gre \ local 2001:db8:$A::1 remote 2001:db8:$A::2 encaplimit 100 ip netns exec A ip -6 a a 2001:db8:$i::1/64 dev ip6gre$i ip netns exec A ip link set ip6gre$i up ip netns exec B ip link add ip6gre$i type ip6gre \ local 2001:db8:$A::2 remote 2001:db8:$A::1 encaplimit 100 ip netns exec B ip -6 a a 2001:db8:$i::2/64 dev ip6gre$i ip netns exec B ip link set ip6gre$i up done Splat looks like: kernel BUG at net/core/skbuff.c:110! invalid opcode: 0000 [#1] SMP DEBUG_PAGEALLOC KASAN PTI CPU: 0 PID: 7 Comm: kworker/0:1 Not tainted 5.12.0+ #891 Workqueue: ipv6_addrconf addrconf_dad_work RIP: 0010:skb_panic+0x15d/0x15f Code: 92 fe 4c 8b 4c 24 10 53 8b 4d 70 45 89 e0 48 c7 c7 00 ae 79 83 41 57 41 56 41 55 48 8b 54 24 a6 26 f9 ff <0f> 0b 48 8b 6c 24 20 89 34 24 e8 4a 4e 92 fe 8b 34 24 48 c7 c1 20 RSP: 0018:ffff88810091f820 EFLAGS: 00010282 RAX: 0000000000000089 RBX: ffff8881086e9000 RCX: 0000000000000000 RDX: 0000000000000089 RSI: 0000000000000008 RDI: ffffed1020123efb RBP: ffff888005f6eac0 R08: ffffed1022fc0031 R09: ffffed1022fc0031 R10: ffff888117e00187 R11: ffffed1022fc0030 R12: 0000000000000028 R13: ffff888008284eb0 R14: 0000000000000ed8 R15: 0000000000000ec0 FS: 0000000000000000(0000) GS:ffff888117c00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f8b801c5640 CR3: 0000000033c2c006 CR4: 00000000003706f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: ? ip6_mc_hdr.isra.26.constprop.46+0x12a/0x600 ? ip6_mc_hdr.isra.26.constprop.46+0x12a/0x600 skb_put.cold.104+0x22/0x22 ip6_mc_hdr.isra.26.constprop.46+0x12a/0x600 ? rcu_read_lock_sched_held+0x91/0xc0 mld_newpack+0x398/0x8f0 ? ip6_mc_hdr.isra.26.constprop.46+0x600/0x600 ? lock_contended+0xc40/0xc40 add_grhead.isra.33+0x280/0x380 add_grec+0x5ca/0xff0 ? mld_sendpack+0xf40/0xf40 ? lock_downgrade+0x690/0x690 mld_send_initial_cr.part.34+0xb9/0x180 ipv6_mc_dad_complete+0x15d/0x1b0 addrconf_dad_completed+0x8d2/0xbb0 ? lock_downgrade+0x690/0x690 ? addrconf_rs_timer+0x660/0x660 ? addrconf_dad_work+0x73c/0x10e0 addrconf_dad_work+0x73c/0x10e0 Allowing high order page allocation could fix this problem. Fixes: 72e09ad107e7 ("ipv6: avoid high order allocations") Signed-off-by: Taehee Yoo Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/ipv6/mcast.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c index 8cd2782a31e4..9fb5077f8e9a 100644 --- a/net/ipv6/mcast.c +++ b/net/ipv6/mcast.c @@ -1601,10 +1601,7 @@ static struct sk_buff *mld_newpack(struct inet6_dev *idev, unsigned int mtu) IPV6_TLV_PADN, 0 }; /* we assume size > sizeof(ra) here */ - /* limit our allocations to order-0 page */ - size = min_t(int, size, SKB_MAX_ORDER(0, 0)); skb = sock_alloc_send_skb(sk, size, 1, &err); - if (!skb) return NULL; -- 2.30.2