aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/bpf/sockmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/bpf/sockmap.c')
-rw-r--r--kernel/bpf/sockmap.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/kernel/bpf/sockmap.c b/kernel/bpf/sockmap.c
index 48c33417d13c..a927e89dad6e 100644
--- a/kernel/bpf/sockmap.c
+++ b/kernel/bpf/sockmap.c
@@ -521,8 +521,8 @@ static struct smap_psock *smap_init_psock(struct sock *sock,
521static struct bpf_map *sock_map_alloc(union bpf_attr *attr) 521static struct bpf_map *sock_map_alloc(union bpf_attr *attr)
522{ 522{
523 struct bpf_stab *stab; 523 struct bpf_stab *stab;
524 int err = -EINVAL;
525 u64 cost; 524 u64 cost;
525 int err;
526 526
527 if (!capable(CAP_NET_ADMIN)) 527 if (!capable(CAP_NET_ADMIN))
528 return ERR_PTR(-EPERM); 528 return ERR_PTR(-EPERM);
@@ -547,6 +547,7 @@ static struct bpf_map *sock_map_alloc(union bpf_attr *attr)
547 547
548 /* make sure page count doesn't overflow */ 548 /* make sure page count doesn't overflow */
549 cost = (u64) stab->map.max_entries * sizeof(struct sock *); 549 cost = (u64) stab->map.max_entries * sizeof(struct sock *);
550 err = -EINVAL;
550 if (cost >= U32_MAX - PAGE_SIZE) 551 if (cost >= U32_MAX - PAGE_SIZE)
551 goto free_stab; 552 goto free_stab;
552 553