All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: sched: fix warning in tcindex_alloc_perfect_hash
@ 2021-06-25 20:23 Pavel Skripkin
  2021-06-27 18:22 ` Cong Wang
  2021-06-28 20:10 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Pavel Skripkin @ 2021-06-25 20:23 UTC (permalink / raw)
  To: jhs, xiyou.wangcong, jiri, davem
  Cc: netdev, linux-kernel, Pavel Skripkin, syzbot+1071ad60cd7df39fdadb

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: b9a24bb76bf6 ("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>
---
 net/sched/cls_tcindex.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/sched/cls_tcindex.c b/net/sched/cls_tcindex.c
index c4007b9cd16d..5b274534264c 100644
--- a/net/sched/cls_tcindex.c
+++ b/net/sched/cls_tcindex.c
@@ -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;
 
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] net: sched: fix warning in tcindex_alloc_perfect_hash
  2021-06-25 20:23 [PATCH] net: sched: fix warning in tcindex_alloc_perfect_hash Pavel Skripkin
@ 2021-06-27 18:22 ` Cong Wang
  2021-06-28 20:10 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Cong Wang @ 2021-06-27 18:22 UTC (permalink / raw)
  To: Pavel Skripkin
  Cc: Jamal Hadi Salim, Jiri Pirko, David Miller,
	Linux Kernel Network Developers, LKML,
	syzbot+1071ad60cd7df39fdadb

On Fri, Jun 25, 2021 at 1:23 PM Pavel Skripkin <paskripkin@gmail.com> wrote:
>
> 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: b9a24bb76bf6 ("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>

Looks reasonable.

Acked-by: Cong Wang <cong.wang@bytedance.com>

Thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] net: sched: fix warning in tcindex_alloc_perfect_hash
  2021-06-25 20:23 [PATCH] net: sched: fix warning in tcindex_alloc_perfect_hash Pavel Skripkin
  2021-06-27 18:22 ` Cong Wang
@ 2021-06-28 20:10 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-06-28 20:10 UTC (permalink / raw)
  To: Pavel Skripkin
  Cc: jhs, xiyou.wangcong, jiri, davem, netdev, linux-kernel,
	syzbot+1071ad60cd7df39fdadb

Hello:

This patch was applied to netdev/net.git (refs/heads/master):

On Fri, 25 Jun 2021 23:23:48 +0300 you wrote:
> 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: b9a24bb76bf6 ("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>
> 
> [...]

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



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-06-28 20:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-25 20:23 [PATCH] net: sched: fix warning in tcindex_alloc_perfect_hash Pavel Skripkin
2021-06-27 18:22 ` Cong Wang
2021-06-28 20:10 ` patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.