net: sched: fix warning in tcindex_alloc_perfect_hash
Subsystems (3)
PATCH 1/1 net: sched: fix warning in tcindex_alloc_perfect_hash
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
--- net/sched/cls_tcindex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/sched/cls_tcindex.c +1 -1
@@ -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 ;
Signature · 1 line
2.32.0
Quoted 9 lines · Pavel Skripkin
Syzbot reported warning in
tcindex_alloc_perfect_hash. The problem was in too bigcp->hash, which triggers warning in kmalloc. Sincecp->hashcomes from userspace, there is no need to warn if value is not correctFixes b9a24bb76bf6 ("net_sched: properly handle failure case of tcf_exts_init()")Reported-and-tested-by [email protected]Signed-off-by Pavel Skripkin <[email protected]>
Looks reasonable.
Thanks.
This patch was applied to netdev/net.git (refs/heads/master):
Hello:
This patch was applied to netdev/net.git (refs/heads/master):
Quoted 10 lines · On Fri, 25 Jun 2021 23:23:48 +0300 you wrote:
Syzbot reported warning in
tcindex_alloc_perfect_hash. The problem was in too bigcp->hash, which triggers warning in kmalloc. Sincecp->hashcomes from userspace, there is no need to warn if value is not correctFixes b9a24bb76bf6 ("net_sched: properly handle failure case of tcf_exts_init()")Reported-and-tested-by [email protected]Signed-off-by Pavel Skripkin <[email protected]>[...]
Here is the summary with links:
- net: sched: fix warning in tcindex_alloc_perfect_hash
https://git.kernel.org/netdev/net/c/3f2db250099f
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html