Skip to content

Commit

Permalink
net: sched: fix warning in tcindex_alloc_perfect_hash
Browse files Browse the repository at this point in the history
[ Upstream commit 3f2db25 ]

Syzbot reported warning in tcindex_alloc_perfect_hash. The problem
was in too big cp->hash, which triggers warning in kmalloc. Since
cp->hash comes from userspace, there is no need to warn if value
is not correct

Fixes: b9a24bb ("net_sched: properly handle failure case of tcf_exts_init()")
Reported-and-tested-by: syzbot+1071ad60cd7df39fdadb@syzkaller.appspotmail.com
Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
Acked-by: Cong Wang <cong.wang@bytedance.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
pskrgag authored and gregkh committed Jul 14, 2021
1 parent 9a6fc76 commit 3013495
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/sched/cls_tcindex.c
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ static int tcindex_alloc_perfect_hash(struct net *net, struct tcindex_data *cp)
int i, err = 0;

cp->perfect = kcalloc(cp->hash, sizeof(struct tcindex_filter_result),
GFP_KERNEL);
GFP_KERNEL | __GFP_NOWARN);
if (!cp->perfect)
return -ENOMEM;

Expand Down

0 comments on commit 3013495

Please sign in to comment.