Cong Wang <xiyou.wangcong@xxxxxxxxx> wrote: > The hashtable size could be controlled by user, so use flags > GFP_USER | __GFP_NOWARN to avoid OOM warning triggered by user-space. > > Also add __GFP_NORETRY to avoid retrying, as this is just a > best effort and the failure is already handled gracefully. > > Reported-and-tested-by: syzbot+adf6c6c2be1c3a718121@xxxxxxxxxxxxxxxxxxxxxxxxx > Cc: Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx> > Cc: Jozsef Kadlecsik <kadlec@xxxxxxxxxxxxx> > Cc: Florian Westphal <fw@xxxxxxxxx> > Signed-off-by: Cong Wang <xiyou.wangcong@xxxxxxxxx> > --- > net/netfilter/xt_hashlimit.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/net/netfilter/xt_hashlimit.c b/net/netfilter/xt_hashlimit.c > index bccd47cd7190..5d9943b37c42 100644 > --- a/net/netfilter/xt_hashlimit.c > +++ b/net/netfilter/xt_hashlimit.c > @@ -293,8 +293,8 @@ static int htable_create(struct net *net, struct hashlimit_cfg3 *cfg, > if (size < 16) > size = 16; > } > - /* FIXME: don't use vmalloc() here or anywhere else -HW */ > - hinfo = vmalloc(struct_size(hinfo, hash, size)); > + hinfo = __vmalloc(struct_size(hinfo, hash, size), > + GFP_USER | __GFP_NOWARN | __GFP_NORETRY, PAGE_KERNEL); Sorry for not noticing this earlier: should that be GFP_KERNEL_ACCOUNT instead of GFP_USER?