All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@nvidia.com>
To: Leon Romanovsky <leon@kernel.org>
Cc: Doug Ledford <dledford@redhat.com>,
	Saeed Mahameed <saeedm@nvidia.com>, <linux-rdma@vger.kernel.org>,
	Maor Gottlieb <maorg@mellanox.com>
Subject: Re: [PATCH rdma-rc] RDMA/cm: Fix IRQ restore in ib_send_cm_sidr_rep
Date: Mon, 1 Mar 2021 14:47:51 -0400	[thread overview]
Message-ID: <20210301184751.GA745887@nvidia.com> (raw)
In-Reply-To: <20210301081844.445823-1-leon@kernel.org>

On Mon, Mar 01, 2021 at 10:18:44AM +0200, Leon Romanovsky wrote:
> From: Saeed Mahameed <saeedm@nvidia.com>
> 
> ib_send_cm_sidr_rep() {
> 	spin_lock_irqsave()
>         cm_send_sidr_rep_locked() {
>                 ...
>         	spin_lock_irq()
>                 ....
>                 spin_unlock_irq() <--- this will enable interrupts
>         }
>         spin_unlock_irqrestore()
> }
> 
> spin_unlock_irqrestore() expects interrupts to be disabled
> but the internal spin_unlock_irq() will always enable hard interrupts.
> 
> Fix this by replacing the internal spin_{lock,unlock}_irq() with
> irqsave/restore variants.
> 
> It fixes the following kernel trace:
> 
>  ------------[ cut here ]------------
>  raw_local_irq_restore() called with IRQs enabled
>  WARNING: CPU: 2 PID: 20001 at kernel/locking/irqflag-debug.c:10 warn_bogus_irq_restore+0x1d/0x20
> 
>  Call Trace:
>   _raw_spin_unlock_irqrestore+0x4e/0x50
>   ib_send_cm_sidr_rep+0x3a/0x50 [ib_cm]
>   cma_send_sidr_rep+0xa1/0x160 [rdma_cm]
>   rdma_accept+0x25e/0x350 [rdma_cm]
>   ucma_accept+0x132/0x1cc [rdma_ucm]
>   ucma_write+0xbf/0x140 [rdma_ucm]
>   vfs_write+0xc1/0x340
>   ksys_write+0xb3/0xe0
>   do_syscall_64+0x2d/0x40
>   entry_SYSCALL_64_after_hwframe+0x44/0xae
> 
> Fixes: 87c4c774cbef ("RDMA/cm: Protect access to remote_sidr_table")
> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
> Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
> ---
>  drivers/infiniband/core/cm.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)

Applied to for-rc, thanks

Jason

      reply	other threads:[~2021-03-01 18:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-01  8:18 [PATCH rdma-rc] RDMA/cm: Fix IRQ restore in ib_send_cm_sidr_rep Leon Romanovsky
2021-03-01 18:47 ` Jason Gunthorpe [this message]

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=20210301184751.GA745887@nvidia.com \
    --to=jgg@nvidia.com \
    --cc=dledford@redhat.com \
    --cc=leon@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=maorg@mellanox.com \
    --cc=saeedm@nvidia.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.