Merge branch 'master' of /usr/src/ntfs-2.6/
[firefly-linux-kernel-4.4.55.git] / fs / 9p / trans_sock.c
index 081d1c84780301e80883bb9994beaa4e2579914b..01e26f0013aced186efe40992d34996999ded2da 100644 (file)
@@ -254,7 +254,12 @@ v9fs_unix_init(struct v9fs_session_info *v9ses, const char *dev_name,
 
 static void v9fs_sock_close(struct v9fs_transport *trans)
 {
-       struct v9fs_trans_sock *ts = trans ? trans->priv : NULL;
+       struct v9fs_trans_sock *ts;
+
+       if (!trans)
+               return;
+
+       ts = trans->priv;
 
        if ((ts) && (ts->s)) {
                dprintk(DEBUG_TRANS, "closing the socket %p\n", ts->s);
@@ -264,7 +269,10 @@ static void v9fs_sock_close(struct v9fs_transport *trans)
                dprintk(DEBUG_TRANS, "socket closed\n");
        }
 
-       kfree(ts);
+       if (ts)
+               kfree(ts);
+
+       trans->priv = NULL;
 }
 
 struct v9fs_transport v9fs_trans_tcp = {