[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241125-work-cred-v2-26-68b9d38bb5b2@kernel.org>
Date: Mon, 25 Nov 2024 15:10:22 +0100
From: Christian Brauner <brauner@...nel.org>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Amir Goldstein <amir73il@...il.com>, Miklos Szeredi <miklos@...redi.hu>,
Al Viro <viro@...iv.linux.org.uk>, Jens Axboe <axboe@...nel.dk>,
linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
Christian Brauner <brauner@...nel.org>
Subject: [PATCH v2 26/29] dns_resolver: avoid pointless cred reference
count bump
The dns_resolver_cache creds hold a long-term reference that is stable
during the operation.
Signed-off-by: Christian Brauner <brauner@...nel.org>
---
net/dns_resolver/dns_query.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/dns_resolver/dns_query.c b/net/dns_resolver/dns_query.c
index 0b0789fe2194151102d5234aca3fc2dae9a1ed69..82b084cc1cc6349bb532d5ada555b0bcbb1cdbea 100644
--- a/net/dns_resolver/dns_query.c
+++ b/net/dns_resolver/dns_query.c
@@ -124,9 +124,9 @@ int dns_query(struct net *net,
/* make the upcall, using special credentials to prevent the use of
* add_key() to preinstall malicious redirections
*/
- saved_cred = override_creds(get_new_cred(dns_resolver_cache));
+ saved_cred = override_creds(dns_resolver_cache);
rkey = request_key_net(&key_type_dns_resolver, desc, net, options);
- put_cred(revert_creds(saved_cred));
+ revert_creds(saved_cred);
kfree(desc);
if (IS_ERR(rkey)) {
ret = PTR_ERR(rkey);
--
2.45.2
Powered by blists - more mailing lists