Skip to content

Commit

Permalink
toa: fixed #1012 allocating 'toa_ip6_sk_lock.lock' before using it
Browse files Browse the repository at this point in the history
  • Loading branch information
weida committed Jan 22, 2025
1 parent 7144011 commit e05dc4b
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions kmod/toa/toa.c
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,12 @@ init_toa_ip6(void)
{
int i;

toa_ip6_sk_lock.lock = alloc_percpu(spinlock_t);
if (toa_ip6_sk_lock.lock == NULL) {
TOA_INFO("fail to alloc per cpu ip6's destruct lock\n");
return -ENOMEM;
}

for_each_possible_cpu(i) {
spinlock_t *lock;

Expand All @@ -251,11 +257,6 @@ init_toa_ip6(void)
spin_lock_init(&__toa_ip6_list_tab[i].lock);
}

toa_ip6_sk_lock.lock = alloc_percpu(spinlock_t);
if (toa_ip6_sk_lock.lock == NULL) {
TOA_INFO("fail to alloc per cpu ip6's destruct lock\n");
return -ENOMEM;
}

return 0;
}
Expand Down

0 comments on commit e05dc4b

Please sign in to comment.