Skip to content

Commit fd3d393

Browse files
pskrgagKelsey Skunberg
authored andcommitted
net: cipso: fix warnings in netlbl_cipsov4_add_std
BugLink: https://bugs.launchpad.net/bugs/1946024 [ Upstream commit 8ca34a1 ] 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: 96cb8e3 ("[NetLabel]: CIPSOv4 and Unlabeled packet integration") Acked-by: Paul Moore <paul@paul-moore.com> Signed-off-by: Pavel Skripkin <paskripkin@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Kamal Mostafa <kamal@canonical.com> Signed-off-by: Kelsey Skunberg <kelsey.skunberg@canonical.com>
1 parent 43c79f2 commit fd3d393

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

net/netlabel/netlabel_cipso_v4.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,14 +187,14 @@ static int netlbl_cipsov4_add_std(struct genl_info *info,
187187
}
188188
doi_def->map.std->lvl.local = kcalloc(doi_def->map.std->lvl.local_size,
189189
sizeof(u32),
190-
GFP_KERNEL);
190+
GFP_KERNEL | __GFP_NOWARN);
191191
if (doi_def->map.std->lvl.local == NULL) {
192192
ret_val = -ENOMEM;
193193
goto add_std_failure;
194194
}
195195
doi_def->map.std->lvl.cipso = kcalloc(doi_def->map.std->lvl.cipso_size,
196196
sizeof(u32),
197-
GFP_KERNEL);
197+
GFP_KERNEL | __GFP_NOWARN);
198198
if (doi_def->map.std->lvl.cipso == NULL) {
199199
ret_val = -ENOMEM;
200200
goto add_std_failure;
@@ -263,15 +263,15 @@ static int netlbl_cipsov4_add_std(struct genl_info *info,
263263
doi_def->map.std->cat.local = kcalloc(
264264
doi_def->map.std->cat.local_size,
265265
sizeof(u32),
266-
GFP_KERNEL);
266+
GFP_KERNEL | __GFP_NOWARN);
267267
if (doi_def->map.std->cat.local == NULL) {
268268
ret_val = -ENOMEM;
269269
goto add_std_failure;
270270
}
271271
doi_def->map.std->cat.cipso = kcalloc(
272272
doi_def->map.std->cat.cipso_size,
273273
sizeof(u32),
274-
GFP_KERNEL);
274+
GFP_KERNEL | __GFP_NOWARN);
275275
if (doi_def->map.std->cat.cipso == NULL) {
276276
ret_val = -ENOMEM;
277277
goto add_std_failure;

0 commit comments

Comments
 (0)