summaryrefslogtreecommitdiff
path: root/net/core
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2020-05-28 08:12:11 +0300
committerDavid S. Miller <davem@davemloft.net>2020-05-28 21:11:44 +0300
commit6e43496745e75ac49d644df984d2f4ee5b5b6b4e (patch)
treeef3eeb80b015aa53a98072d925fe7900b8634a07 /net/core
parentc433594c07457d2b2e41a87014bfad9bec279abf (diff)
downloadlinux-6e43496745e75ac49d644df984d2f4ee5b5b6b4e.tar.xz
net: add sock_set_priority
Add a helper to directly set the SO_PRIORITY sockopt from kernel space without going through a fake uaccess. Signed-off-by: Christoph Hellwig <hch@lst.de> Acked-by: Sagi Grimberg <sagi@grimberg.me> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r--net/core/sock.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/net/core/sock.c b/net/core/sock.c
index f0f09524911c..ceda1a9248b3 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -729,6 +729,14 @@ void sock_no_linger(struct sock *sk)
}
EXPORT_SYMBOL(sock_no_linger);
+void sock_set_priority(struct sock *sk, u32 priority)
+{
+ lock_sock(sk);
+ sk->sk_priority = priority;
+ release_sock(sk);
+}
+EXPORT_SYMBOL(sock_set_priority);
+
/*
* This is meant for all protocols to use and covers goings on
* at the socket level. Everything here is generic.