linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [kernel PATCH v1] Bluetooth: L2CAP: Fix use-after-free
@ 2023-05-25  0:04 Zhengping Jiang
  2023-05-25  1:18 ` [kernel,v1] " bluez.test.bot
  2023-05-26 22:50 ` [kernel PATCH v1] " patchwork-bot+bluetooth
  0 siblings, 2 replies; 3+ messages in thread
From: Zhengping Jiang @ 2023-05-25  0:04 UTC (permalink / raw)
  To: linux-bluetooth, marcel, luiz.dentz
  Cc: chromeos-bluetooth-upstreaming, Zhengping Jiang, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Johan Hedberg, Paolo Abeni,
	linux-kernel, netdev

Fix potential use-after-free in l2cap_le_command_rej.

Signed-off-by: Zhengping Jiang <jiangzp@google.com>
---

Changes in v1:
- Use l2cap_chan_hold_unless_zero to prevent adding refcnt when it is
  already 0.

 net/bluetooth/l2cap_core.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 376b523c7b26..19b0b1f7ffed 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -6361,9 +6361,14 @@ static inline int l2cap_le_command_rej(struct l2cap_conn *conn,
 	if (!chan)
 		goto done;
 
+	chan = l2cap_chan_hold_unless_zero(chan);
+	if (!chan)
+		goto done;
+
 	l2cap_chan_lock(chan);
 	l2cap_chan_del(chan, ECONNREFUSED);
 	l2cap_chan_unlock(chan);
+	l2cap_chan_put(chan);
 
 done:
 	mutex_unlock(&conn->chan_lock);
-- 
2.40.1.698.g37aff9b760-goog


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [kernel,v1] Bluetooth: L2CAP: Fix use-after-free
  2023-05-25  0:04 [kernel PATCH v1] Bluetooth: L2CAP: Fix use-after-free Zhengping Jiang
@ 2023-05-25  1:18 ` bluez.test.bot
  2023-05-26 22:50 ` [kernel PATCH v1] " patchwork-bot+bluetooth
  1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2023-05-25  1:18 UTC (permalink / raw)
  To: linux-bluetooth, jiangzp

[-- Attachment #1: Type: text/plain, Size: 1424 bytes --]

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=750826

---Test result---

Test Summary:
CheckPatch                    PASS      0.74 seconds
GitLint                       PASS      0.32 seconds
SubjectPrefix                 PASS      0.10 seconds
BuildKernel                   PASS      44.88 seconds
CheckAllWarning               PASS      48.88 seconds
CheckSparse                   PASS      54.63 seconds
CheckSmatch                   PASS      148.09 seconds
BuildKernel32                 PASS      43.21 seconds
TestRunnerSetup               PASS      614.80 seconds
TestRunner_l2cap-tester       PASS      21.90 seconds
TestRunner_iso-tester         PASS      30.25 seconds
TestRunner_bnep-tester        PASS      7.58 seconds
TestRunner_mgmt-tester        PASS      147.77 seconds
TestRunner_rfcomm-tester      PASS      12.24 seconds
TestRunner_sco-tester         PASS      11.05 seconds
TestRunner_ioctl-tester       PASS      13.02 seconds
TestRunner_mesh-tester        PASS      9.59 seconds
TestRunner_smp-tester         PASS      10.95 seconds
TestRunner_userchan-tester    PASS      8.25 seconds
IncrementalBuild              PASS      41.64 seconds



---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [kernel PATCH v1] Bluetooth: L2CAP: Fix use-after-free
  2023-05-25  0:04 [kernel PATCH v1] Bluetooth: L2CAP: Fix use-after-free Zhengping Jiang
  2023-05-25  1:18 ` [kernel,v1] " bluez.test.bot
@ 2023-05-26 22:50 ` patchwork-bot+bluetooth
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+bluetooth @ 2023-05-26 22:50 UTC (permalink / raw)
  To: Zhengping Jiang
  Cc: linux-bluetooth, marcel, luiz.dentz,
	chromeos-bluetooth-upstreaming, davem, edumazet, kuba,
	johan.hedberg, pabeni, linux-kernel, netdev

Hello:

This patch was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Wed, 24 May 2023 17:04:15 -0700 you wrote:
> Fix potential use-after-free in l2cap_le_command_rej.
> 
> Signed-off-by: Zhengping Jiang <jiangzp@google.com>
> ---
> 
> Changes in v1:
> - Use l2cap_chan_hold_unless_zero to prevent adding refcnt when it is
>   already 0.
> 
> [...]

Here is the summary with links:
  - [kernel,v1] Bluetooth: L2CAP: Fix use-after-free
    https://git.kernel.org/bluetooth/bluetooth-next/c/a088d769ef3a

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-05-26 22:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-25  0:04 [kernel PATCH v1] Bluetooth: L2CAP: Fix use-after-free Zhengping Jiang
2023-05-25  1:18 ` [kernel,v1] " bluez.test.bot
2023-05-26 22:50 ` [kernel PATCH v1] " patchwork-bot+bluetooth

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).