git: ef3991d70dca - main - netlink: don't store an extra pointer to so_cred
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 05 Feb 2025 00:54:39 UTC
The branch main has been updated by glebius:
URL: https://cgit.FreeBSD.org/src/commit/?id=ef3991d70dcacb419fbdc845a19ed6d646ebccd5
commit ef3991d70dcacb419fbdc845a19ed6d646ebccd5
Author: Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2025-02-05 00:36:14 +0000
Commit: Gleb Smirnoff <glebius@FreeBSD.org>
CommitDate: 2025-02-05 00:54:21 +0000
netlink: don't store an extra pointer to so_cred
---
sys/netlink/netlink_domain.c | 2 --
sys/netlink/netlink_glue.c | 4 ++--
sys/netlink/netlink_var.h | 1 -
3 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/sys/netlink/netlink_domain.c b/sys/netlink/netlink_domain.c
index e71ea1ce1e09..e06c0bf1919e 100644
--- a/sys/netlink/netlink_domain.c
+++ b/sys/netlink/netlink_domain.c
@@ -328,8 +328,6 @@ nl_attach(struct socket *so, int proto, struct thread *td)
TAILQ_INIT(&so->so_snd.nl_queue);
so->so_pcb = nlp;
nlp->nl_socket = so;
- /* Copy so_cred to avoid having socket_var.h in every header */
- nlp->nl_cred = so->so_cred;
nlp->nl_proto = proto;
nlp->nl_process_id = curproc->p_pid;
nlp->nl_linux = is_linux;
diff --git a/sys/netlink/netlink_glue.c b/sys/netlink/netlink_glue.c
index 0e8fdc0b054c..4b593fd9657b 100644
--- a/sys/netlink/netlink_glue.c
+++ b/sys/netlink/netlink_glue.c
@@ -85,13 +85,13 @@ struct rtbridge *netlink_callback_p = &ignore_cb;
bool
nlp_has_priv(struct nlpcb *nlp, int priv)
{
- return (priv_check_cred(nlp->nl_cred, priv) == 0);
+ return (priv_check_cred(nlp->nl_socket->so_cred, priv) == 0);
}
struct ucred *
nlp_get_cred(struct nlpcb *nlp)
{
- return (nlp->nl_cred);
+ return (nlp->nl_socket->so_cred);
}
uint32_t
diff --git a/sys/netlink/netlink_var.h b/sys/netlink/netlink_var.h
index 11b69eb604fe..ce10a303f9f7 100644
--- a/sys/netlink/netlink_var.h
+++ b/sys/netlink/netlink_var.h
@@ -69,7 +69,6 @@ struct nlpcb {
bool nl_need_thread_setup;
struct taskqueue *nl_taskqueue;
struct task nl_task;
- struct ucred *nl_cred; /* Copy of nl_socket->so_cred */
uint64_t nl_dropped_bytes;
uint64_t nl_dropped_messages;
CK_LIST_ENTRY(nlpcb) nl_next;