Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@ziepe.ca>
To: Bernard Metzler <BMT@zurich.ibm.com>
Cc: "leon@kernel.org" <leon@kernel.org>,
	"linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>
Subject: Re: [syzbot] [rdma?] possible deadlock in siw_create_listen (2)
Date: Fri, 4 Oct 2024 22:20:37 -0300	[thread overview]
Message-ID: <20241005012037.GL2456194@ziepe.ca> (raw)
In-Reply-To: <BN8PR15MB2513A03800D7E2AE03C63B0699722@BN8PR15MB2513.namprd15.prod.outlook.com>

On Fri, Oct 04, 2024 at 04:10:31PM +0000, Bernard Metzler wrote:

> Could one please help me to understand this situation?
> cma.c:5354
> 
>         mutex_lock(&lock);
>         list_add_tail(&cma_dev->list, &dev_list);
>         list_for_each_entry(id_priv, &listen_any_list, listen_any_item) {
>                 ret = cma_listen_on_dev(id_priv, cma_dev, &to_destroy);
>                 if (ret)
>                         goto free_listen;
>         }               
>         mutex_unlock(&lock);
> 
> siw_cm.c:1776
> 	sock_set_reuseaddr(s->sk);
>
> ...which calls lock_sock(sk) on a feshly created socket.

I think this is a smc bug, and lockdep is getting confused about what
to report due to all the different locks.

smc_setsockopt() eventually in ip_setsockopt() does:

	mutex_lock(&smc->clcsock_release_lock);

	if (needs_rtnl)
		rtnl_lock();
	sockopt_lock_sock(sk);
	mutex_unlock(&smc->clcsock_release_lock);


smc_sendmsg() does

	lock_sock(sk);
	mutex_lock(&smc->clcsock_release_lock);

Which is classic deadlock locking.

That the CMA gets involved here seems like wrong reporting because
syzkaller put those lock chains into it.

I guess this is a dup of 

https://lore.kernel.org/netdev/00000000000093078f0622583e6e@google.com/T/

Or at least that should be fixed before looking at this

Jason

  reply	other threads:[~2024-10-05  1:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-26 13:34 [syzbot] [rdma?] possible deadlock in siw_create_listen (2) syzbot
2024-10-04 16:10 ` Bernard Metzler
2024-10-05  1:20   ` Jason Gunthorpe [this message]
2024-10-05 17:34     ` Bernard Metzler

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=20241005012037.GL2456194@ziepe.ca \
    --to=jgg@ziepe.ca \
    --cc=BMT@zurich.ibm.com \
    --cc=leon@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    /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