lkml.org 
[lkml]   [2005]   [Dec]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH] v9fs: fix fd_close
Date
From
[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);

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-12-29 18:03    [W:0.028 / U:0.340 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site