diff mbox

[net] ipv6: sr: fix BUG in HMAC init when preemption is enabled

Message ID CAHTyZGxoCV=fUjbUq2r5vtH2rDqGScrf=ty2HYOL8KLhdf4R4w@mail.gmail.com
State RFC, archived
Delegated to: David Miller
Headers show

Commit Message

Eric Dumazet Jan. 10, 2017, 6:16 p.m. UTC
2017-01-10 5:39 GMT-08:00 David Lebrun <david.lebrun@uclouvain.be>:
> When CONFIG_PREEMPT=y, CONFIG_IPV6=m and CONFIG_SEG6_HMAC=y,
> seg6_hmac_init() is called during the initialization of the ipv6 module.
> This causes a subsequent call to smp_processor_id() with preemption
> enabled, resulting in the following trace.

I disagree with  your fix.  Keeping GFP_KERNEL for all these per cpu
allocations is needed.

What about the simpler :

Rationale : we only need to get the size of the allocation, we do not
care of migration here, all cpus having the same allocation.

Another issue with this is code is that in case of an allocation
error, no cleanup is performed to free prior allocations.

Comments

David Miller Jan. 10, 2017, 6:29 p.m. UTC | #1
From: ericnetdev dumazet <erdnetdev@gmail.com>

Oh noez, do we have an imposter? :-)
Eric Dumazet Jan. 10, 2017, 6:31 p.m. UTC | #2
2017-01-10 10:29 GMT-08:00 David Miller <davem@davemloft.net>:
> From: ericnetdev dumazet <erdnetdev@gmail.com>
>
> Oh noez, do we have an imposter? :-)

My normal gmail account seems to have a huge lag , or maybe this is
the IMAP access only.

;)
diff mbox

Patch

diff --git a/net/ipv6/seg6_hmac.c b/net/ipv6/seg6_hmac.c
index ef1c8a46e7aceee45b2044d4b4338dc3aed88807..b31d682816503129e12d3eae5b70a8cbce8525a7
100644
--- a/net/ipv6/seg6_hmac.c
+++ b/net/ipv6/seg6_hmac.c
@@ -400,7 +400,7 @@  static int seg6_hmac_init_algo(void)
                        *p_tfm = tfm;
                }

-               p_tfm = this_cpu_ptr(algo->tfms);
+               p_tfm = __this_cpu_ptr(algo->tfms);
                tfm = *p_tfm;

                shsize = sizeof(*shash) + crypto_shash_descsize(tfm);