diff --git a/include/net/sock.h b/include/net/sock.h
index 5a3a151bd7300455d6da16d6b34ac39a785fb4c7..ce3b5b6226838ca1d1595b519d02e6223efcb67b 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -1308,7 +1308,7 @@ static inline int sock_writeable(const struct sock *sk)
 
 static inline gfp_t gfp_any(void)
 {
-	return in_atomic() ? GFP_ATOMIC : GFP_KERNEL;
+	return in_softirq() ? GFP_ATOMIC : GFP_KERNEL;
 }
 
 static inline long sock_rcvtimeo(const struct sock *sk, int noblock)