linux-cifs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tom Talpey <tom@talpey.com>
To: Steve French <smfrench@gmail.com>, Long Li <longli@microsoft.com>
Cc: CIFS <linux-cifs@vger.kernel.org>, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [SMBDIRECT][PATCH] missing rc checks while waiting for SMB3 over RDMA events
Date: Tue, 22 Jun 2021 11:18:42 -0400	[thread overview]
Message-ID: <1241844c-c9ab-2055-a363-80db63a4dd22@talpey.com> (raw)
In-Reply-To: <CAH2r5msOSLaZT42-jFMjJrB1YiYTZBzdM18ieqQY2v=YwXzcrA@mail.gmail.com>

On 6/21/2021 5:32 PM, Steve French wrote:
>      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")
>     Signed-off-by: Steve French <stfrench@microsoft.com>
> 
> diff --git a/fs/cifs/smbdirect.c b/fs/cifs/smbdirect.c
> index 10dfe5006792..ae07732f750f 100644
> --- a/fs/cifs/smbdirect.c
> +++ b/fs/cifs/smbdirect.c
> @@ -572,8 +572,11 @@ 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));
> +       /* -ERESTARTSYS, returned when interrupted, is the only rc mentioned */

Suggest the same comment text as the one below, this one seems uncertain.

> +       if (rc < 0)
> +               goto out;
>          rc = info->ri_rc;
>          if (rc) {
>                  log_rdma_event(ERR, "rdma_resolve_addr() completed %i\n", rc);
> @@ -586,8 +589,10 @@ 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));
> +       if (rc < 0)  /* e.g. if interrupted and returns -ERESTARTSYS */

delete "and"?

> +               goto out

Missing a semicolon.     ^^^

>          rc = info->ri_rc;
>          if (rc) {
>                  log_rdma_event(ERR, "rdma_resolve_route() completed %i\n", rc);
> 
> 

One meta-comment. There's no message logged for these ERESTARTSYS cases.
That might be confusing in the log, if they lead to failure.

Reviewed-By: Tom Talpey <tom@talpey.com>

Tom.

  parent reply	other threads:[~2021-06-22 15:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-21 21:32 [SMBDIRECT][PATCH] missing rc checks while waiting for SMB3 over RDMA events Steve French
2021-06-22  6:49 ` Long Li
2021-06-22 15:18 ` Tom Talpey [this message]
2021-06-22 17:09   ` Steve French

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1241844c-c9ab-2055-a363-80db63a4dd22@talpey.com \
    --to=tom@talpey.com \
    --cc=linux-cifs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=longli@microsoft.com \
    --cc=smfrench@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).