mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] v9fs: fix fd_close
@ 2005-12-29 17:01 Eric Van Hensbergen
  0 siblings, 0 replies; only message in thread
From: Eric Van Hensbergen @ 2005-12-29 17:01 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel, v9fs-developer, mostrows

[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);
 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-12-29 17:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-12-29 17:01 [PATCH] v9fs: fix fd_close Eric Van Hensbergen

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®