Linux NFS development
 help / color / mirror / Atom feed
From: marcel@linux-ng.de
To: linux-nfs@vger.kernel.org
Cc: Marcel Ritter <marcel@linux-ng.de>
Subject: [PATCH 1/3] cifs-utils/svcgssd: Fix use-after-free bug (config variables)
Date: Tue,  7 Jun 2022 10:19:07 +0200	[thread overview]
Message-ID: <20220607081909.1216287-1-marcel@linux-ng.de> (raw)

From: Marcel Ritter <marcel@linux-ng.de>

This patch fixes a bug when trying to set "principal" in /etc/nfs.conf.
Memory gets freed by conf_cleanup() before being used - moving cleanup
code resolves that.

---
 utils/gssd/svcgssd.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/utils/gssd/svcgssd.c b/utils/gssd/svcgssd.c
index 881207b3..a242b789 100644
--- a/utils/gssd/svcgssd.c
+++ b/utils/gssd/svcgssd.c
@@ -211,9 +211,6 @@ main(int argc, char *argv[])
 	rpc_verbosity = conf_get_num("svcgssd", "RPC-Verbosity", rpc_verbosity);
 	idmap_verbosity = conf_get_num("svcgssd", "IDMAP-Verbosity", idmap_verbosity);
 
-	/* We don't need the config anymore */
-	conf_cleanup();
-
 	while ((opt = getopt(argc, argv, "fivrnp:")) != -1) {
 		switch (opt) {
 			case 'f':
@@ -328,6 +325,9 @@ main(int argc, char *argv[])
 
 	daemon_ready();
 
+	/* We don't need the config anymore */
+	conf_cleanup();
+
 	nfs4_init_name_mapping(NULL); /* XXX: should only do this once */
 
 	rc = event_base_dispatch(evbase);
-- 
2.34.1


             reply	other threads:[~2022-06-07  8:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-07  8:19 marcel [this message]
2022-06-07  8:19 ` [PATCH 2/3] cifs-utils/svcgssd: Display principal if set marcel
2022-06-07  8:19 ` [PATCH 3/3] cifs-utils/svcgssd: Add (undocumented) config options to man page marcel
2022-06-27 18:57   ` Andreas Hasenack
2022-06-08 16:59 ` [PATCH 1/3] cifs-utils/svcgssd: Fix use-after-free bug (config variables) marcel
2022-06-21 13:26 ` Steve Dickson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220607081909.1216287-1-marcel@linux-ng.de \
    --to=marcel@linux-ng.de \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox