mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: ericvh@gmail.com (Eric Van Hensbergen)
To: akpm@osdl.org
Cc: linux-kernel@vger.kernel.org,
	v9fs-developer@lists.sourceforge.net, mostrows@watson.ibm.com
Subject: [PATCH] v9fs: fix fd_close
Date: Thu, 29 Dec 2005 11:01:16 -0600 (CST)	[thread overview]
Message-ID: <20051229170116.765055A8033@localhost.localdomain> (raw)

[PATCH] v9fs: fix fd_close

If a 9pfs server crashes, v9fs_fd_close() is called.
Subsequently, in cleaning up by performing a umount() on the FS
that was provided by this server v9fs_fd_close() is called again, and
uses the old, freed valus of trans->priv.  This patch ensures that
trans->priv can be freed only once, otherwise this function bails early.

Signed-off-by: Michal Ostrowski <mostrows@watson.ibm.com>
Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>

---
commit db73617a4959fa8af9f72063e3bd666c70363d99
tree 3e05d73b024cdcf7462aae64e62a63849d8aa175
parent 3603bc8dc5ab33941e6378fe52ea03b7f5561109
author Eric Van Hensbergen <ericvh@ericvh.localdomain> Thu, 29 Dec 2005 10:54:06 -0600
committer Eric Van Hensbergen <ericvh@ericvh.localdomain> Thu, 29 Dec 2005 10:54:06 -0600

 fs/9p/trans_fd.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/9p/trans_fd.c b/fs/9p/trans_fd.c
index 63b58ce..b7ffb98 100644
--- a/fs/9p/trans_fd.c
+++ b/fs/9p/trans_fd.c
@@ -148,12 +148,12 @@ static void v9fs_fd_close(struct v9fs_tr
 	if (!trans)
 		return;
 
-	trans->status = Disconnected;
-	ts = trans->priv;
+	ts = xchg(&trans->priv, NULL);
 
 	if (!ts)
 		return;
 
+	trans->status = Disconnected;
 	if (ts->in_file)
 		fput(ts->in_file);
 

                 reply	other threads:[~2005-12-29 17:01 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20051229170116.765055A8033@localhost.localdomain \
    --to=ericvh@gmail.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mostrows@watson.ibm.com \
    --cc=v9fs-developer@lists.sourceforge.net \
    /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

all inboxes | Powered by JetHome®