提交 ea3aea7a 编写于 作者: P Pavel Skripkin 提交者: Yang Yingliang

net: cipso: fix warnings in netlbl_cipsov4_add_std

mainline inclusion
from mainline-v5.15-rc1
commit 8ca34a13
category: bugfix
bugzilla: 186065
CVE: NA

-------------------------------------------------

Syzbot reported warning in netlbl_cipsov4_add(). The
problem was in too big doi_def->map.std->lvl.local_size
passed to kcalloc(). Since this value comes from userpace there is
no need to warn if value is not correct.

The same problem may occur with other kcalloc() calls in
this function, so, I've added __GFP_NOWARN flag to all
kcalloc() calls there.

Reported-and-tested-by: syzbot+cdd51ee2e6b0b2e18c0d@syzkaller.appspotmail.com
Fixes: 96cb8e33 ("[NetLabel]: CIPSOv4 and Unlabeled packet integration")
Acked-by: NPaul Moore <paul@paul-moore.com>
Signed-off-by: NPavel Skripkin <paskripkin@gmail.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
Signed-off-by: NZhang Changzhong <zhangchangzhong@huawei.com>
Reviewed-by: NYue Haibing <yuehaibing@huawei.com>
Reviewed-by: NWei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 fd784d12
...@@ -198,14 +198,14 @@ static int netlbl_cipsov4_add_std(struct genl_info *info, ...@@ -198,14 +198,14 @@ static int netlbl_cipsov4_add_std(struct genl_info *info,
} }
doi_def->map.std->lvl.local = kcalloc(doi_def->map.std->lvl.local_size, doi_def->map.std->lvl.local = kcalloc(doi_def->map.std->lvl.local_size,
sizeof(u32), sizeof(u32),
GFP_KERNEL); GFP_KERNEL | __GFP_NOWARN);
if (doi_def->map.std->lvl.local == NULL) { if (doi_def->map.std->lvl.local == NULL) {
ret_val = -ENOMEM; ret_val = -ENOMEM;
goto add_std_failure; goto add_std_failure;
} }
doi_def->map.std->lvl.cipso = kcalloc(doi_def->map.std->lvl.cipso_size, doi_def->map.std->lvl.cipso = kcalloc(doi_def->map.std->lvl.cipso_size,
sizeof(u32), sizeof(u32),
GFP_KERNEL); GFP_KERNEL | __GFP_NOWARN);
if (doi_def->map.std->lvl.cipso == NULL) { if (doi_def->map.std->lvl.cipso == NULL) {
ret_val = -ENOMEM; ret_val = -ENOMEM;
goto add_std_failure; goto add_std_failure;
...@@ -273,7 +273,7 @@ static int netlbl_cipsov4_add_std(struct genl_info *info, ...@@ -273,7 +273,7 @@ static int netlbl_cipsov4_add_std(struct genl_info *info,
doi_def->map.std->cat.local = kcalloc( doi_def->map.std->cat.local = kcalloc(
doi_def->map.std->cat.local_size, doi_def->map.std->cat.local_size,
sizeof(u32), sizeof(u32),
GFP_KERNEL); GFP_KERNEL | __GFP_NOWARN);
if (doi_def->map.std->cat.local == NULL) { if (doi_def->map.std->cat.local == NULL) {
ret_val = -ENOMEM; ret_val = -ENOMEM;
goto add_std_failure; goto add_std_failure;
...@@ -281,7 +281,7 @@ static int netlbl_cipsov4_add_std(struct genl_info *info, ...@@ -281,7 +281,7 @@ static int netlbl_cipsov4_add_std(struct genl_info *info,
doi_def->map.std->cat.cipso = kcalloc( doi_def->map.std->cat.cipso = kcalloc(
doi_def->map.std->cat.cipso_size, doi_def->map.std->cat.cipso_size,
sizeof(u32), sizeof(u32),
GFP_KERNEL); GFP_KERNEL | __GFP_NOWARN);
if (doi_def->map.std->cat.cipso == NULL) { if (doi_def->map.std->cat.cipso == NULL) {
ret_val = -ENOMEM; ret_val = -ENOMEM;
goto add_std_failure; goto add_std_failure;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册