2017-01-10 5:39 GMT-08:00 David Lebrun <david.leb...@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.

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);

Reply via email to