Skip to content

Commit

Permalink
[PATCH] v9fs: fix fd_close
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Eric Van Hensbergen authored and Linus Torvalds committed Jan 9, 2006
1 parent 7e7f358 commit f5ef3c1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fs/9p/trans_fd.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,12 @@ static void v9fs_fd_close(struct v9fs_transport *trans)
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);

Expand Down

0 comments on commit f5ef3c1

Please sign in to comment.