]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
smbdirect: missing rc checks while waiting for rdma events
authorSteve French <stfrench@microsoft.com>
Mon, 21 Jun 2021 21:25:20 +0000 (16:25 -0500)
committerSteve French <stfrench@microsoft.com>
Tue, 22 Jun 2021 17:08:32 +0000 (12:08 -0500)
There were two places where we weren't checking for error
(e.g. ERESTARTSYS) while waiting for rdma resolution.

Addresses-Coverity: 1462165 ("Unchecked return value")
Reviewed-by: Tom Talpey <tom@talpey.com>
Reviewed-by: Long Li <longli@microsoft.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/cifs/smbdirect.c

index 10dfe50067920b96924ea8fc4892ac2b2efc7fda..31ef64eb7fbb98dfe88ba71fd143a8cafafc0a12 100644 (file)
@@ -572,8 +572,13 @@ static struct rdma_cm_id *smbd_create_id(
                log_rdma_event(ERR, "rdma_resolve_addr() failed %i\n", rc);
                goto out;
        }
-       wait_for_completion_interruptible_timeout(
+       rc = wait_for_completion_interruptible_timeout(
                &info->ri_done, msecs_to_jiffies(RDMA_RESOLVE_TIMEOUT));
+       /* e.g. if interrupted returns -ERESTARTSYS */
+       if (rc < 0) {
+               log_rdma_event(ERR, "rdma_resolve_addr timeout rc: %i\n", rc);
+               goto out;
+       }
        rc = info->ri_rc;
        if (rc) {
                log_rdma_event(ERR, "rdma_resolve_addr() completed %i\n", rc);
@@ -586,8 +591,13 @@ static struct rdma_cm_id *smbd_create_id(
                log_rdma_event(ERR, "rdma_resolve_route() failed %i\n", rc);
                goto out;
        }
-       wait_for_completion_interruptible_timeout(
+       rc = wait_for_completion_interruptible_timeout(
                &info->ri_done, msecs_to_jiffies(RDMA_RESOLVE_TIMEOUT));
+       /* e.g. if interrupted returns -ERESTARTSYS */
+       if (rc < 0)  {
+               log_rdma_event(ERR, "rdma_resolve_addr timeout rc: %i\n", rc);
+               goto out;
+       }
        rc = info->ri_rc;
        if (rc) {
                log_rdma_event(ERR, "rdma_resolve_route() completed %i\n", rc);