public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: rpearsonhpe@gmail.com, linux-rdma@vger.kernel.org
Subject: Re: [bug report] RDMA/rxe: Protect QP state with qp->state_lock
Date: Thu, 4 May 2023 11:07:31 +0300	[thread overview]
Message-ID: <20230504080731.GT525452@unreal> (raw)
In-Reply-To: <27773078-40ce-414f-8b97-781954da9f25@kili.mountain>

On Thu, May 04, 2023 at 10:28:59AM +0300, Dan Carpenter wrote:
> Hello Bob Pearson,
> 
> The patch f605f26ea196: "RDMA/rxe: Protect QP state with
> qp->state_lock" from Apr 4, 2023, leads to the following Smatch
> static checker warning:
> 
> 	drivers/infiniband/sw/rxe/rxe_qp.c:716 rxe_qp_to_attr()
> 	error: double unlocked '&qp->state_lock' (orig line 713)
> 
> drivers/infiniband/sw/rxe/rxe_qp.c
>     705         rxe_av_to_attr(&qp->pri_av, &attr->ah_attr);
>     706         rxe_av_to_attr(&qp->alt_av, &attr->alt_ah_attr);
>     707 
>     708         /* Applications that get this state typically spin on it.
>     709          * Yield the processor
>     710          */
>     711         spin_lock_bh(&qp->state_lock);
>     712         if (qp->attr.sq_draining) {
>     713                 spin_unlock_bh(&qp->state_lock);
>                              ^^^^^^
> Unlock
> 
>     714                 cond_resched();
>     715         }

Arguably, lines 708-716 should be deleted.

Thanks

> --> 716         spin_unlock_bh(&qp->state_lock);
>                      ^^^^^^
> Double unlock
> 
>     717 
>     718         return 0;
>     719 }
> 
> regards,
> dan carpenter

  reply	other threads:[~2023-05-04  8:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-04  7:28 [bug report] RDMA/rxe: Protect QP state with qp->state_lock Dan Carpenter
2023-05-04  8:07 ` Leon Romanovsky [this message]
2023-05-15 17:48   ` Bob Pearson

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=20230504080731.GT525452@unreal \
    --to=leon@kernel.org \
    --cc=dan.carpenter@linaro.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=rpearsonhpe@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