netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: david.lebrun@uclouvain.be
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH net] ipv6: sr: fix BUG in HMAC init when preemption is enabled
Date: Tue, 10 Jan 2017 21:00:13 -0500 (EST)	[thread overview]
Message-ID: <20170110.210013.2057547033044168090.davem@davemloft.net> (raw)
In-Reply-To: <1484055562-6414-1-git-send-email-david.lebrun@uclouvain.be>

From: David Lebrun <david.lebrun@uclouvain.be>
Date: Tue, 10 Jan 2017 14:39:22 +0100

> 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.
 ...
> This patch disable BHs in seg6_hmac_init() and seg6_hmac_exit(). BHs are
> re-enabled for the call to crypto_alloc_shash. Indeed, this function might
> call try_module_get(), which cannot be called in atomic context.
> 
> Signed-off-by: David Lebrun <david.lebrun@uclouvain.be>
 ...
> -		char *ring = kzalloc(SEG6_HMAC_RING_SIZE, GFP_KERNEL);
> +		char *ring = kzalloc(SEG6_HMAC_RING_SIZE, GFP_ATOMIC);

I agree with Eric that moving to GFP_ATOMIC in this spots is a major step
backwards, and that fixing the per-cpu access during this initializer
is a much better direction to go.

Thanks.

  parent reply	other threads:[~2017-01-11  2:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-10 13:39 [PATCH net] ipv6: sr: fix BUG in HMAC init when preemption is enabled David Lebrun
2017-01-10 18:16 ` ericnetdev dumazet
2017-01-10 18:29   ` David Miller
2017-01-10 18:31     ` ericnetdev dumazet
2017-01-11  2:00 ` David Miller [this message]
2017-01-25  1:08 ` [lkp-robot] [ipv6] 31cdaa587d: BUG:sleeping_function_called_from_invalid_context_at_kernel/locking/mutex.c kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170110.210013.2057547033044168090.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=david.lebrun@uclouvain.be \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).