aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/utils.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--net/core/utils.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/net/core/utils.c b/net/core/utils.c
index bf09371e19b1..2f737bf90b3f 100644
--- a/net/core/utils.c
+++ b/net/core/utils.c
@@ -370,16 +370,17 @@ bool __net_get_random_once(void *buf, int nbytes, bool *done,
struct static_key *done_key)
{
static DEFINE_SPINLOCK(lock);
+ unsigned long flags;
- spin_lock_bh(&lock);
+ spin_lock_irqsave(&lock, flags);
if (*done) {
- spin_unlock_bh(&lock);
+ spin_unlock_irqrestore(&lock, flags);
return false;
}
get_random_bytes(buf, nbytes);
*done = true;
- spin_unlock_bh(&lock);
+ spin_unlock_irqrestore(&lock, flags);
__net_random_once_disable_jump(done_key);