connection: intialize pwq later
authorDaniel Mack <daniel@zonque.org>
Sat, 20 Dec 2014 02:21:41 +0000 (03:21 +0100)
committerDaniel Mack <daniel@zonque.org>
Sat, 20 Dec 2014 02:21:41 +0000 (03:21 +0100)
This way, we can get rid of clecnup pathes in error cases

Signed-off-by: Daniel Mack <daniel@zonque.org>
connection.c

index 1fcb177881b54fd8e10f19d84df1b49a42104ed2..beb7973e6de213a7ceaaaa9aa595d994f252fe57 100644 (file)
@@ -635,9 +635,6 @@ static int kdbus_conn_wait_reply(struct kdbus_conn *conn_src,
        if (WARN_ON(!reply_wait))
                return -EIO;
 
-       poll_initwait(&pwq);
-       poll_wait(ioctl_file, &conn_src->wait, &pwq.pt);
-
        /*
         * Block until the reply arrives. reply_wait is left untouched
         * by the timeout scans that might be conducted for other,
@@ -649,13 +646,10 @@ static int kdbus_conn_wait_reply(struct kdbus_conn *conn_src,
                                         KDBUS_ITEM_CANCEL_FD);
        if (!IS_ERR(cancel_fd_item)) {
                cancel_fd = fget(cancel_fd_item->fds[0]);
-               if (IS_ERR(cancel_fd)) {
-                       poll_freewait(&pwq);
+               if (IS_ERR(cancel_fd))
                        return PTR_ERR(cancel_fd);
-               }
 
                if (!cancel_fd->f_op->poll) {
-                       poll_freewait(&pwq);
                        fput(cancel_fd);
                        return -EINVAL;
                }
@@ -672,6 +666,9 @@ static int kdbus_conn_wait_reply(struct kdbus_conn *conn_src,
                sigprocmask(SIG_SETMASK, &ksigmask, &ksigsaved);
        }
 
+       poll_initwait(&pwq);
+       poll_wait(ioctl_file, &conn_src->wait, &pwq.pt);
+
        for (;;) {
                /*
                 * Any of the following conditions will stop our synchronously