ceph: plug msg leak in con_fault
authorSage Weil <sage@newdream.net>
Mon, 14 Dec 2009 22:30:34 +0000 (14:30 -0800)
committerSage Weil <sage@newdream.net>
Tue, 22 Dec 2009 00:39:49 +0000 (16:39 -0800)
Signed-off-by: Sage Weil <sage@newdream.net>
fs/ceph/messenger.c

index 96fd556..98519bd 100644 (file)
@@ -1434,8 +1434,9 @@ no_data:
  */
 static void process_message(struct ceph_connection *con)
 {
-       struct ceph_msg *msg = con->in_msg;
+       struct ceph_msg *msg;
 
+       msg = con->in_msg;
        con->in_msg = NULL;
 
        /* if first message, set peer_name */
@@ -1810,7 +1811,11 @@ static void ceph_fault(struct ceph_connection *con)
        clear_bit(BUSY, &con->state);  /* to avoid an improbable race */
 
        con_close_socket(con);
-       con->in_msg = NULL;
+
+       if (con->in_msg) {
+               ceph_msg_put(con->in_msg);
+               con->in_msg = NULL;
+       }
 
        /* If there are no messages in the queue, place the connection
         * in a STANDBY state (i.e., don't try to reconnect just yet). */