summaryrefslogtreecommitdiff
path: root/backport-include/net/sock.h
diff options
context:
space:
mode:
authorDominik Sliwa <dominik.sliwa@toradex.com>2017-12-22 12:07:34 +0000
committerDominik Sliwa <dominik.sliwa@toradex.com>2017-12-22 16:46:44 +0100
commit198e79f0e8f0b24c1e36ab6032d348f40de20262 (patch)
treed8dd6411978560fd0b6832761b085ac431253389 /backport-include/net/sock.h
parentc8beff5117bd4614be26bf28e97b885e8af42a67 (diff)
Signed-off-by: Dominik Sliwa <dominik.sliwa@toradex.com>
Diffstat (limited to 'backport-include/net/sock.h')
-rw-r--r--backport-include/net/sock.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/backport-include/net/sock.h b/backport-include/net/sock.h
index 89191f3..ea3c474 100644
--- a/backport-include/net/sock.h
+++ b/backport-include/net/sock.h
@@ -63,4 +63,14 @@ static inline void sk_clear_bit(int nr, struct sock *sk)
}
#endif /* < 4.5 */
+#if LINUX_VERSION_IS_LESS(4,7,0)
+/* no reclassification while locks are held */
+static inline bool sock_allow_reclassification(const struct sock *csk)
+{
+ struct sock *sk = (struct sock *)csk;
+
+ return !sk->sk_lock.owned && !spin_is_locked(&sk->sk_lock.slock);
+}
+#endif /* < 4.7 */
+
#endif /* __BACKPORT_NET_SOCK_H */