From: Tushar Dave Date: Wed, 12 Sep 2018 20:15:29 +0000 (+0200) Subject: bpf: use __GFP_COMP while allocating page X-Git-Tag: v4.18.15~44 X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4dc76c13f297228e1c70eaf412093061335ee3a2;p=linux bpf: use __GFP_COMP while allocating page [ Upstream commit 4c3d795cb012a378855543a775408fba1ccff6f2 ] Helper bpg_msg_pull_data() can allocate multiple pages while linearizing multiple scatterlist elements into one shared page. However, if the shared page has size > PAGE_SIZE, using copy_page_to_iter() causes below warning. e.g. [ 6367.019832] WARNING: CPU: 2 PID: 7410 at lib/iov_iter.c:825 page_copy_sane.part.8+0x0/0x8 To avoid above warning, use __GFP_COMP while allocating multiple contiguous pages. Fixes: 015632bb30da ("bpf: sk_msg program helper bpf_sk_msg_pull_data") Signed-off-by: Tushar Dave Signed-off-by: Daniel Borkmann Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- diff --git a/net/core/filter.c b/net/core/filter.c index 963ee2e88861..0b2bd7d3220f 100644 --- a/net/core/filter.c +++ b/net/core/filter.c @@ -2334,7 +2334,8 @@ BPF_CALL_4(bpf_msg_pull_data, if (unlikely(bytes_sg_total > copy)) return -EINVAL; - page = alloc_pages(__GFP_NOWARN | GFP_ATOMIC, get_order(copy)); + page = alloc_pages(__GFP_NOWARN | GFP_ATOMIC | __GFP_COMP, + get_order(copy)); if (unlikely(!page)) return -ENOMEM; p = page_address(page);