[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZHd1mPanIsBORpLE@corigine.com>
Date: Wed, 31 May 2023 18:28:08 +0200
From: Simon Horman <simon.horman@...igine.com>
To: Ying Hsu <yinghsu@...omium.org>
Cc: linux-bluetooth@...r.kernel.org,
chromeos-bluetooth-upstreaming@...omium.org,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Johan Hedberg <johan.hedberg@...il.com>,
Luiz Augusto von Dentz <luiz.dentz@...il.com>,
Marcel Holtmann <marcel@...tmann.org>,
Paolo Abeni <pabeni@...hat.com>, linux-kernel@...r.kernel.org,
netdev@...r.kernel.org
Subject: Re: [PATCH v5] Bluetooth: Fix l2cap_disconnect_req deadlock
On Wed, May 31, 2023 at 03:44:56AM +0000, Ying Hsu wrote:
> L2CAP assumes that the locks conn->chan_lock and chan->lock are
> acquired in the order conn->chan_lock, chan->lock to avoid
> potential deadlock.
> For example, l2sock_shutdown acquires these locks in the order:
> mutex_lock(&conn->chan_lock)
> l2cap_chan_lock(chan)
>
> However, l2cap_disconnect_req acquires chan->lock in
> l2cap_get_chan_by_scid first and then acquires conn->chan_lock
> before calling l2cap_chan_del. This means that these locks are
> acquired in unexpected order, which leads to potential deadlock:
> l2cap_chan_lock(c)
> mutex_lock(&conn->chan_lock)
>
> This patch releases chan->lock before acquiring the conn_chan_lock
> to avoid the potential deadlock.
>
> Fixes: ("a2a9339e1c9d Bluetooth: L2CAP: Fix use-after-free in l2cap_disconnect_{req,rsp}")
nit: this should be
Fixes: a2a9339e1c9d ("Bluetooth: L2CAP: Fix use-after-free in l2cap_disconnect_{req,rsp}")
...
Powered by blists - more mailing lists