aboutsummaryrefslogtreecommitdiffstats
path: root/fs/9p/trans_sock.c
diff options
context:
space:
mode:
authorEric Van Hensbergen <ericvh@gmail.com>2005-09-09 16:04:28 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-09-09 16:57:58 -0400
commitcb2e87a65d6cd735eb06fa595bf90497af28c37b (patch)
treeba4a261d67eb3c4830fe307ea2b97b51f0bc6fdf /fs/9p/trans_sock.c
parentb501611a6f78558eafcf09b228abd866d4ea5d9f (diff)
[PATCH] v9fs: fix handling of malformed 9P messages
This patch attempts to do a better job of cleaning up after detecting errors on the transport. This should also improve error reporting on broken connections to servers. Signed-off-by: Latchesar Ionkov <lucho@ionkov.net> 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>
Diffstat (limited to 'fs/9p/trans_sock.c')
-rw-r--r--fs/9p/trans_sock.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/fs/9p/trans_sock.c b/fs/9p/trans_sock.c
index 081d1c847803..01e26f0013ac 100644
--- a/fs/9p/trans_sock.c
+++ b/fs/9p/trans_sock.c
@@ -254,7 +254,12 @@ v9fs_unix_init(struct v9fs_session_info *v9ses, const char *dev_name,
254 254
255static void v9fs_sock_close(struct v9fs_transport *trans) 255static void v9fs_sock_close(struct v9fs_transport *trans)
256{ 256{
257 struct v9fs_trans_sock *ts = trans ? trans->priv : NULL; 257 struct v9fs_trans_sock *ts;
258
259 if (!trans)
260 return;
261
262 ts = trans->priv;
258 263
259 if ((ts) && (ts->s)) { 264 if ((ts) && (ts->s)) {
260 dprintk(DEBUG_TRANS, "closing the socket %p\n", ts->s); 265 dprintk(DEBUG_TRANS, "closing the socket %p\n", ts->s);
@@ -264,7 +269,10 @@ static void v9fs_sock_close(struct v9fs_transport *trans)
264 dprintk(DEBUG_TRANS, "socket closed\n"); 269 dprintk(DEBUG_TRANS, "socket closed\n");
265 } 270 }
266 271
267 kfree(ts); 272 if (ts)
273 kfree(ts);
274
275 trans->priv = NULL;
268} 276}
269 277
270struct v9fs_transport v9fs_trans_tcp = { 278struct v9fs_transport v9fs_trans_tcp = {