Skip to contentSkip to conversation

Test on mainline

syzbot syzbot 1 participant 18 messages Nov 16, 2023 – Oct 22, 2024

Subsystems (4)
lore
Share & tools
lore
author syzbot
#1 lore raw

Re: [syzbot] [PATCH] test uaf in sco_sock_timeout

For archival purposes, forwarding an incoming command email to [email protected].

For archival purposes, forwarding an incoming command email to [email protected].

***

Subject: [PATCH] test uaf in sco_sock_timeout
Author: [email protected]

#syz test https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git 8de1e7afcc1c

net/bluetooth/sco.c +5 -0
index c736186aba26..515b52e14b5f 100644
@@ -415,6 +415,8 @@ static void sco_sock_cleanup_listen(struct sock *parent)
  */
 static void sco_sock_kill(struct sock *sk)
 {
+	struct sco_conn *conn = container_of(sk, struct sco_conn, sk);
+
 	if (!sock_flag(sk, SOCK_ZAPPED) || sk->sk_socket)
 		return;
 
@@ -423,6 +425,9 @@ static void sco_sock_kill(struct sock *sk)
 	/* Kill poor orphan */
 	bt_sock_unlink(&sco_sk_list, sk);
 	sock_set_flag(sk, SOCK_DEAD);
+	sco_conn_lock(conn);
+	conn->sk = NULL;
+	sco_conn_unlock(conn);
 	sock_put(sk);
 }
 
author syzbot
#2 lore raw

Re: [syzbot] [PATCH] Test uaf in sco_sock_timeout

In reply to syzbot
For archival purposes, forwarding an incoming command email to [email protected].

For archival purposes, forwarding an incoming command email to [email protected].

***

Subject: [PATCH] Test uaf in sco_sock_timeout
Author: [email protected]

please test 8de1e7afcc1c

#syz test https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git 8de1e7afcc1c

net/bluetooth/sco.c +2 -1
index c736186aba26..c05fb9d41a63 100644
@@ -300,7 +300,8 @@ static int sco_connect(struct sock *sk)
 
 unlock:
 	hci_dev_unlock(hdev);
-	hci_dev_put(hdev);
+	if (err)
+		hci_dev_put(hdev);
 	return err;
 }
 
author syzbot
#3 lore raw

Re: [syzbot] [bluetooth?] KASAN: slab-use-after-free Write in sco_sock_timeout

In reply to syzbot
syzbot has bisected this issue to:

syzbot has bisected this issue to:

commit 9a8ec9e8ebb5a7c0cfbce2d6b4a6b67b2b78e8f3

Author: Luiz Augusto von Dentz <[email protected]>
Date:   Thu Mar 30 21:15:50 2023 +0000

Bluetooth: SCO: Fix possible circular locking dependency on sco_connect_cfm

bisection log:  https://syzkaller.appspot.com/x/bisect.txt?x=179a65d2e80000
start commit:   bee0e7762ad2 Merge tag 'for-linus-iommufd' of git://git.ke..
git tree:       upstream
final oops:     https://syzkaller.appspot.com/x/report.txt?x=145a65d2e80000
console output: https://syzkaller.appspot.com/x/log.txt?x=105a65d2e80000
kernel config:  https://syzkaller.appspot.com/x/.config?x=b50bd31249191be8
dashboard link: https://syzkaller.appspot.com/bug?extid=4c0d0c4cde787116d465
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=1504504ae80000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=14685f54e80000
Reported-by [email protected]
Fixes 9a8ec9e8ebb5 ("Bluetooth: SCO: Fix possible circular locking dependency on sco_connect_cfm")

For information about bisection process see: https://goo.gl/tpsmEJ#bisection

author syzbot
#4 lore raw

Re: [syzbot] Re: [PATCH v1] Bluetooth: SCO: Use disable_delayed_work_sync

In reply to syzbot
For archival purposes, forwarding an incoming command email to [email protected], [email protected].

For archival purposes, forwarding an incoming command email to [email protected], [email protected].

***

Subject: Re: [PATCH v1] Bluetooth: SCO: Use disable_delayed_work_sync
Author: [email protected]

#syz test

Quoted 31 lines · Luiz Augusto von Dentz

From: Luiz Augusto von Dentz <[email protected]>

This makes use of disable_delayed_work_sync instead cancel_delayed_work_sync as it not only cancel the ongoing work but also disables new submit which is disarable since the object holding the work is about to be freed.

---
 net/bluetooth/sco.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/bluetooth/sco.c +1 -2
index a5ac160c592e..f0604d7834df 100644
@@ -208,7 +208,7 @@ static void sco_conn_del(struct hci_conn *hcon, int err)
        }
 
        /* Ensure no more work items will run before freeing conn. */
-       cancel_delayed_work_sync(&conn->timeout_work);
+       disable_delayed_work_sync(&conn->timeout_work);
 
        hcon->sco_data = NULL;
        kfree(conn);
--

2.46.1

Signature · 1 line
Luiz Augusto von Dentz
author syzbot
#5 lore raw

Re: [syzbot] Re: [PATCH v2] Bluetooth: SCO: Use disable_delayed_work_sync

In reply to syzbot
For archival purposes, forwarding an incoming command email to [email protected], [email protected].

For archival purposes, forwarding an incoming command email to [email protected], [email protected].

***

Subject: Re: [PATCH v2] Bluetooth: SCO: Use disable_delayed_work_sync
Author: [email protected]

#syz test

Quoted 44 lines · Luiz Augusto von Dentz

From: Luiz Augusto von Dentz <[email protected]>

This makes use of disable_delayed_work_sync instead cancel_delayed_work_sync as it not only cancel the ongoing work but also disables new submit which is disarable since the object holding the work is about to be freed.

In addition to it remove call to sco_sock_set_timer on __sco_sock_close since at that point it is useless to set a timer as the sk will be freed there is nothing to be done in sco_sock_timeout.

Reported-by [email protected]
Fixes ba316be1b6a0 ("Bluetooth: schedule SCO timeouts with delayed_work")
---
 net/bluetooth/sco.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
net/bluetooth/sco.c +1 -3
index a5ac160c592e..8dfb53dabbd7 100644
@@ -208,7 +208,7 @@ static void sco_conn_del(struct hci_conn *hcon, int err)
        }
 
        /* Ensure no more work items will run before freeing conn. */
-       cancel_delayed_work_sync(&conn->timeout_work);
+       disable_delayed_work_sync(&conn->timeout_work);
 
        hcon->sco_data = NULL;
        kfree(conn);
@@ -444,7 +444,6 @@ static void __sco_sock_close(struct sock *sk)
        case BT_CONFIG:
                if (sco_pi(sk)->conn->hcon) {
                        sk->sk_state = BT_DISCONN;
-                       sco_sock_set_timer(sk, SCO_DISCONN_TIMEOUT);
                        sco_conn_lock(sco_pi(sk)->conn);
                        hci_conn_drop(sco_pi(sk)->conn->hcon);
                        sco_pi(sk)->conn->hcon = NULL;
--

2.46.1

Signature · 1 line
Luiz Augusto von Dentz
author syzbot
#6 lore raw

Re: [syzbot] Re: [PATCH v3] Bluetooth: SCO: Use disable_delayed_work_sync

In reply to syzbot
For archival purposes, forwarding an incoming command email to [email protected], [email protected].

For archival purposes, forwarding an incoming command email to [email protected], [email protected].

***

Subject: Re: [PATCH v3] Bluetooth: SCO: Use disable_delayed_work_sync
Author: [email protected]

#syz test

Quoted 54 lines · Luiz Augusto von Dentz

From: Luiz Augusto von Dentz <[email protected]>

This makes use of disable_delayed_work_sync instead cancel_delayed_work_sync as it not only cancel the ongoing work but also disables new submit which is disarable since the object holding the work is about to be freed.

In addition to it remove call to sco_sock_set_timer on __sco_sock_close since at that point it is useless to set a timer as the sk will be freed there is nothing to be done in sco_sock_timeout.

Reported-by [email protected]
Fixes ba316be1b6a0 ("Bluetooth: schedule SCO timeouts with delayed_work")
---
 net/bluetooth/sco.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)
net/bluetooth/sco.c +1 -13
index a5ac160c592e..2b1e66976068 100644
@@ -208,7 +208,7 @@ static void sco_conn_del(struct hci_conn *hcon, int err)
        }
 
        /* Ensure no more work items will run before freeing conn. */
-       cancel_delayed_work_sync(&conn->timeout_work);
+       disable_delayed_work_sync(&conn->timeout_work);
 
        hcon->sco_data = NULL;
        kfree(conn);
@@ -442,17 +442,6 @@ static void __sco_sock_close(struct sock *sk)
 
        case BT_CONNECTED:
        case BT_CONFIG:
-               if (sco_pi(sk)->conn->hcon) {
-                       sk->sk_state = BT_DISCONN;
-                       sco_sock_set_timer(sk, SCO_DISCONN_TIMEOUT);
-                       sco_conn_lock(sco_pi(sk)->conn);
-                       hci_conn_drop(sco_pi(sk)->conn->hcon);
-                       sco_pi(sk)->conn->hcon = NULL;
-                       sco_conn_unlock(sco_pi(sk)->conn);
-               } else
-                       sco_chan_del(sk, ECONNRESET);
-               break;
-
        case BT_CONNECT2:
        case BT_CONNECT:
        case BT_DISCONN:
--

2.46.1

Signature · 1 line
Luiz Augusto von Dentz
author syzbot
#7 lore raw

Re: [syzbot] Re: [PATCH v3] Bluetooth: SCO: Use disable_delayed_work_sync

In reply to syzbot
For archival purposes, forwarding an incoming command email to [email protected], [email protected].

For archival purposes, forwarding an incoming command email to [email protected], [email protected].

***

Subject: Re: [PATCH v3] Bluetooth: SCO: Use disable_delayed_work_sync
Author: [email protected]

#syz test

Quoted 63 lines · Luiz Augusto von Dentz

#syz test

Quoted 52 lines · Luiz Augusto von Dentz

From: Luiz Augusto von Dentz <[email protected]>

This makes use of disable_delayed_work_sync instead cancel_delayed_work_sync as it not only cancel the ongoing work but also disables new submit which is disarable since the object holding the work is about to be freed.

In addition to it remove call to sco_sock_set_timer on __sco_sock_close since at that point it is useless to set a timer as the sk will be freed there is nothing to be done in sco_sock_timeout.

Reported-by [email protected]
Fixes ba316be1b6a0 ("Bluetooth: schedule SCO timeouts with delayed_work")
---
 net/bluetooth/sco.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)
net/bluetooth/sco.c +1 -13
index a5ac160c592e..2b1e66976068 100644
@@ -208,7 +208,7 @@ static void sco_conn_del(struct hci_conn *hcon, int err)
        }
 
        /* Ensure no more work items will run before freeing conn. */
-       cancel_delayed_work_sync(&conn->timeout_work);
+       disable_delayed_work_sync(&conn->timeout_work);
 
        hcon->sco_data = NULL;
        kfree(conn);
@@ -442,17 +442,6 @@ static void __sco_sock_close(struct sock *sk)
 
        case BT_CONNECTED:
        case BT_CONFIG:
-               if (sco_pi(sk)->conn->hcon) {
-                       sk->sk_state = BT_DISCONN;
-                       sco_sock_set_timer(sk, SCO_DISCONN_TIMEOUT);
-                       sco_conn_lock(sco_pi(sk)->conn);
-                       hci_conn_drop(sco_pi(sk)->conn->hcon);
-                       sco_pi(sk)->conn->hcon = NULL;
-                       sco_conn_unlock(sco_pi(sk)->conn);
-               } else
-                       sco_chan_del(sk, ECONNRESET);
-               break;
-
        case BT_CONNECT2:
        case BT_CONNECT:
        case BT_DISCONN:
--
Quoted 2 lines

2.46.1

--
Luiz Augusto von Dentz

Signature · 1 line
Luiz Augusto von Dentz
author syzbot
#8 lore raw

Re: [syzbot] Re: [PATCH v3] Bluetooth: SCO: Use disable_delayed_work_sync

In reply to syzbot
For archival purposes, forwarding an incoming command email to [email protected], [email protected].

For archival purposes, forwarding an incoming command email to [email protected], [email protected].

***

Subject: Re: [PATCH v3] Bluetooth: SCO: Use disable_delayed_work_sync
Author: [email protected]

#syz test

Quoted 73 lines · Luiz Augusto von Dentz

#syz test

Quoted 55 lines · Luiz Augusto von Dentz

#syz test

Quoted 50 lines · Luiz Augusto von Dentz

From: Luiz Augusto von Dentz <[email protected]>

This makes use of disable_delayed_work_sync instead cancel_delayed_work_sync as it not only cancel the ongoing work but also disables new submit which is disarable since the object holding the work is about to be freed.

In addition to it remove call to sco_sock_set_timer on __sco_sock_close since at that point it is useless to set a timer as the sk will be freed there is nothing to be done in sco_sock_timeout.

Reported-by [email protected]
Fixes ba316be1b6a0 ("Bluetooth: schedule SCO timeouts with delayed_work")
---
 net/bluetooth/sco.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)
net/bluetooth/sco.c +1 -12
index a5ac160c592e..2b1e66976068 100644
@@ -208,7 +208,7 @@ static void sco_conn_del(struct hci_conn *hcon, int err)
        }
 
        /* Ensure no more work items will run before freeing conn. */
-       cancel_delayed_work_sync(&conn->timeout_work);
+       disable_delayed_work_sync(&conn->timeout_work);
 
        hcon->sco_data = NULL;
        kfree(conn);
@@ -442,17 +442,6 @@ static void __sco_sock_close(struct sock *sk)
 
        case BT_CONNECTED:
        case BT_CONFIG:
-               if (sco_pi(sk)->conn->hcon) {
-                       sk->sk_state = BT_DISCONN;
-                       sco_sock_set_timer(sk, SCO_DISCONN_TIMEOUT);
-                       sco_conn_lock(sco_pi(sk)->conn);
-                       hci_conn_drop(sco_pi(sk)->conn->hcon);
-                       sco_pi(sk)->conn->hcon = NULL;
-                       sco_conn_unlock(sco_pi(sk)->conn);
-               } else
-                       sco_chan_del(sk, ECONNRESET);
-               break;
-
        case BT_CONNECT2:
        case BT_CONNECT:
Quoted 8 lines
Quoted 4 lines
net/bluetooth/sco.c +0 -1
        case BT_DISCONN:
--

2.46.1

--
Luiz Augusto von Dentz

--
Luiz Augusto von Dentz

Signature · 1 line
Luiz Augusto von Dentz
author syzbot
#9 lore raw

Re: [syzbot] Re: [PATCH v3] Bluetooth: SCO: Use disable_delayed_work_sync

In reply to syzbot
For archival purposes, forwarding an incoming command email to [email protected], [email protected].

For archival purposes, forwarding an incoming command email to [email protected], [email protected].

***

Subject: Re: [PATCH v3] Bluetooth: SCO: Use disable_delayed_work_sync
Author: [email protected]

#syz test

Quoted 83 lines · Luiz Augusto von Dentz

#syz test

Quoted 71 lines · Luiz Augusto von Dentz

#syz test

Quoted 55 lines · Luiz Augusto von Dentz

#syz test

Quoted 50 lines · Luiz Augusto von Dentz

From: Luiz Augusto von Dentz <[email protected]>

This makes use of disable_delayed_work_sync instead cancel_delayed_work_sync as it not only cancel the ongoing work but also disables new submit which is disarable since the object holding the work is about to be freed.

In addition to it remove call to sco_sock_set_timer on __sco_sock_close since at that point it is useless to set a timer as the sk will be freed there is nothing to be done in sco_sock_timeout.

Reported-by [email protected]
Fixes ba316be1b6a0 ("Bluetooth: schedule SCO timeouts with delayed_work")
---
 net/bluetooth/sco.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)
net/bluetooth/sco.c +1 -12
index a5ac160c592e..2b1e66976068 100644
@@ -208,7 +208,7 @@ static void sco_conn_del(struct hci_conn *hcon, int err)
        }
 
        /* Ensure no more work items will run before freeing conn. */
-       cancel_delayed_work_sync(&conn->timeout_work);
+       disable_delayed_work_sync(&conn->timeout_work);
 
        hcon->sco_data = NULL;
        kfree(conn);
@@ -442,17 +442,6 @@ static void __sco_sock_close(struct sock *sk)
 
        case BT_CONNECTED:
        case BT_CONFIG:
-               if (sco_pi(sk)->conn->hcon) {
-                       sk->sk_state = BT_DISCONN;
-                       sco_sock_set_timer(sk, SCO_DISCONN_TIMEOUT);
-                       sco_conn_lock(sco_pi(sk)->conn);
-                       hci_conn_drop(sco_pi(sk)->conn->hcon);
-                       sco_pi(sk)->conn->hcon = NULL;
-                       sco_conn_unlock(sco_pi(sk)->conn);
-               } else
-                       sco_chan_del(sk, ECONNRESET);
-               break;
-
        case BT_CONNECT2:
        case BT_CONNECT:
Quoted 8 lines
Quoted 4 lines
net/bluetooth/sco.c +0 -1
        case BT_DISCONN:
--

2.46.1

--
Luiz Augusto von Dentz

Quoted 2 lines

--
Luiz Augusto von Dentz

--
Luiz Augusto von Dentz

Signature · 1 line
Luiz Augusto von Dentz
author syzbot
#10 lore raw

Re: [syzbot] Re: [PATCH v3] Bluetooth: SCO: Use disable_delayed_work_sync

In reply to syzbot
For archival purposes, forwarding an incoming command email to [email protected], [email protected].

For archival purposes, forwarding an incoming command email to [email protected], [email protected].

***

Subject: Re: [PATCH v3] Bluetooth: SCO: Use disable_delayed_work_sync
Author: [email protected]

#syz test

Quoted 93 lines · Luiz Augusto von Dentz

#syz test

Quoted 76 lines · Luiz Augusto von Dentz

#syz test

Quoted 71 lines · Luiz Augusto von Dentz

#syz test

Quoted 63 lines · Luiz Augusto von Dentz

#syz test

Quoted 52 lines · Luiz Augusto von Dentz

From: Luiz Augusto von Dentz <[email protected]>

This makes use of disable_delayed_work_sync instead cancel_delayed_work_sync as it not only cancel the ongoing work but also disables new submit which is disarable since the object holding the work is about to be freed.

In addition to it remove call to sco_sock_set_timer on __sco_sock_close since at that point it is useless to set a timer as the sk will be freed there is nothing to be done in sco_sock_timeout.

Reported-by [email protected]
Fixes ba316be1b6a0 ("Bluetooth: schedule SCO timeouts with delayed_work")
---
 net/bluetooth/sco.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)
net/bluetooth/sco.c +1 -13
index a5ac160c592e..2b1e66976068 100644
@@ -208,7 +208,7 @@ static void sco_conn_del(struct hci_conn *hcon, int err)
        }
 
        /* Ensure no more work items will run before freeing conn. */
-       cancel_delayed_work_sync(&conn->timeout_work);
+       disable_delayed_work_sync(&conn->timeout_work);
 
        hcon->sco_data = NULL;
        kfree(conn);
@@ -442,17 +442,6 @@ static void __sco_sock_close(struct sock *sk)
 
        case BT_CONNECTED:
        case BT_CONFIG:
-               if (sco_pi(sk)->conn->hcon) {
-                       sk->sk_state = BT_DISCONN;
-                       sco_sock_set_timer(sk, SCO_DISCONN_TIMEOUT);
-                       sco_conn_lock(sco_pi(sk)->conn);
-                       hci_conn_drop(sco_pi(sk)->conn->hcon);
-                       sco_pi(sk)->conn->hcon = NULL;
-                       sco_conn_unlock(sco_pi(sk)->conn);
-               } else
-                       sco_chan_del(sk, ECONNRESET);
-               break;
-
        case BT_CONNECT2:
        case BT_CONNECT:
        case BT_DISCONN:
--
Quoted 2 lines

2.46.1

--
Luiz Augusto von Dentz

Quoted 7 lines
Quoted 2 lines

--
Luiz Augusto von Dentz

--
Luiz Augusto von Dentz

--
Luiz Augusto von Dentz

Signature · 1 line
Luiz Augusto von Dentz
author syzbot
#11 lore raw

Re: [syzbot] Re: [PATCH v3] Bluetooth: SCO: Use disable_delayed_work_sync

In reply to syzbot
For archival purposes, forwarding an incoming command email to [email protected], [email protected].

For archival purposes, forwarding an incoming command email to [email protected], [email protected].

***

Subject: Re: [PATCH v3] Bluetooth: SCO: Use disable_delayed_work_sync
Author: [email protected]

#syz test

Quoted 103 lines · Luiz Augusto von Dentz

#syz test

Quoted 86 lines · Luiz Augusto von Dentz

#syz test

Quoted 81 lines · Luiz Augusto von Dentz

#syz test

Quoted 73 lines · Luiz Augusto von Dentz

#syz test

Quoted 55 lines · Luiz Augusto von Dentz

#syz test

Quoted 50 lines · Luiz Augusto von Dentz

From: Luiz Augusto von Dentz <[email protected]>

This makes use of disable_delayed_work_sync instead cancel_delayed_work_sync as it not only cancel the ongoing work but also disables new submit which is disarable since the object holding the work is about to be freed.

In addition to it remove call to sco_sock_set_timer on __sco_sock_close since at that point it is useless to set a timer as the sk will be freed there is nothing to be done in sco_sock_timeout.

Reported-by [email protected]
Fixes ba316be1b6a0 ("Bluetooth: schedule SCO timeouts with delayed_work")
---
 net/bluetooth/sco.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)
net/bluetooth/sco.c +1 -12
index a5ac160c592e..2b1e66976068 100644
@@ -208,7 +208,7 @@ static void sco_conn_del(struct hci_conn *hcon, int err)
        }
 
        /* Ensure no more work items will run before freeing conn. */
-       cancel_delayed_work_sync(&conn->timeout_work);
+       disable_delayed_work_sync(&conn->timeout_work);
 
        hcon->sco_data = NULL;
        kfree(conn);
@@ -442,17 +442,6 @@ static void __sco_sock_close(struct sock *sk)
 
        case BT_CONNECTED:
        case BT_CONFIG:
-               if (sco_pi(sk)->conn->hcon) {
-                       sk->sk_state = BT_DISCONN;
-                       sco_sock_set_timer(sk, SCO_DISCONN_TIMEOUT);
-                       sco_conn_lock(sco_pi(sk)->conn);
-                       hci_conn_drop(sco_pi(sk)->conn->hcon);
-                       sco_pi(sk)->conn->hcon = NULL;
-                       sco_conn_unlock(sco_pi(sk)->conn);
-               } else
-                       sco_chan_del(sk, ECONNRESET);
-               break;
-
        case BT_CONNECT2:
        case BT_CONNECT:
Quoted 8 lines
Quoted 4 lines
net/bluetooth/sco.c +0 -1
        case BT_DISCONN:
--

2.46.1

--
Luiz Augusto von Dentz

--
Luiz Augusto von Dentz

Quoted 7 lines
Quoted 2 lines

--
Luiz Augusto von Dentz

--
Luiz Augusto von Dentz

--
Luiz Augusto von Dentz

Signature · 1 line
Luiz Augusto von Dentz
author syzbot
#12 lore raw

Re: [syzbot] Re: [PATCH v3] Bluetooth: SCO: Use disable_delayed_work_sync

In reply to syzbot
For archival purposes, forwarding an incoming command email to [email protected], [email protected].

For archival purposes, forwarding an incoming command email to [email protected], [email protected].

***

Subject: Re: [PATCH v3] Bluetooth: SCO: Use disable_delayed_work_sync
Author: [email protected]

#syz test

Quoted 113 lines · Luiz Augusto von Dentz

#syz test

Quoted 96 lines · Luiz Augusto von Dentz

#syz test

Quoted 91 lines · Luiz Augusto von Dentz

#syz test

Quoted 83 lines · Luiz Augusto von Dentz

#syz test

Quoted 71 lines · Luiz Augusto von Dentz

#syz test

Quoted 55 lines · Luiz Augusto von Dentz

#syz test

Quoted 50 lines · Luiz Augusto von Dentz

From: Luiz Augusto von Dentz <[email protected]>

This makes use of disable_delayed_work_sync instead cancel_delayed_work_sync as it not only cancel the ongoing work but also disables new submit which is disarable since the object holding the work is about to be freed.

In addition to it remove call to sco_sock_set_timer on __sco_sock_close since at that point it is useless to set a timer as the sk will be freed there is nothing to be done in sco_sock_timeout.

Reported-by [email protected]
Fixes ba316be1b6a0 ("Bluetooth: schedule SCO timeouts with delayed_work")
---
 net/bluetooth/sco.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)
net/bluetooth/sco.c +1 -12
index a5ac160c592e..2b1e66976068 100644
@@ -208,7 +208,7 @@ static void sco_conn_del(struct hci_conn *hcon, int err)
        }
 
        /* Ensure no more work items will run before freeing conn. */
-       cancel_delayed_work_sync(&conn->timeout_work);
+       disable_delayed_work_sync(&conn->timeout_work);
 
        hcon->sco_data = NULL;
        kfree(conn);
@@ -442,17 +442,6 @@ static void __sco_sock_close(struct sock *sk)
 
        case BT_CONNECTED:
        case BT_CONFIG:
-               if (sco_pi(sk)->conn->hcon) {
-                       sk->sk_state = BT_DISCONN;
-                       sco_sock_set_timer(sk, SCO_DISCONN_TIMEOUT);
-                       sco_conn_lock(sco_pi(sk)->conn);
-                       hci_conn_drop(sco_pi(sk)->conn->hcon);
-                       sco_pi(sk)->conn->hcon = NULL;
-                       sco_conn_unlock(sco_pi(sk)->conn);
-               } else
-                       sco_chan_del(sk, ECONNRESET);
-               break;
-
        case BT_CONNECT2:
        case BT_CONNECT:
Quoted 8 lines
Quoted 4 lines
net/bluetooth/sco.c +0 -1
        case BT_DISCONN:
--

2.46.1

--
Luiz Augusto von Dentz

Quoted 2 lines

--
Luiz Augusto von Dentz

--
Luiz Augusto von Dentz

Quoted 7 lines
Quoted 2 lines

--
Luiz Augusto von Dentz

--
Luiz Augusto von Dentz

--
Luiz Augusto von Dentz

Signature · 1 line
Luiz Augusto von Dentz
author syzbot
#13 lore raw

Re: [syzbot] Re: [PATCH v3] Bluetooth: SCO: Use disable_delayed_work_sync

In reply to syzbot
For archival purposes, forwarding an incoming command email to [email protected], [email protected].

For archival purposes, forwarding an incoming command email to [email protected], [email protected].

***

Subject: Re: [PATCH v3] Bluetooth: SCO: Use disable_delayed_work_sync
Author: [email protected]

#syz test

Quoted 123 lines · Luiz Augusto von Dentz

#syz test

Quoted 106 lines · Luiz Augusto von Dentz

#syz test

Quoted 101 lines · Luiz Augusto von Dentz

#syz test

Quoted 93 lines · Luiz Augusto von Dentz

#syz test

Quoted 76 lines · Luiz Augusto von Dentz

#syz test

Quoted 71 lines · Luiz Augusto von Dentz

#syz test

Quoted 63 lines · Luiz Augusto von Dentz

#syz test

Quoted 52 lines · Luiz Augusto von Dentz

From: Luiz Augusto von Dentz <[email protected]>

This makes use of disable_delayed_work_sync instead cancel_delayed_work_sync as it not only cancel the ongoing work but also disables new submit which is disarable since the object holding the work is about to be freed.

In addition to it remove call to sco_sock_set_timer on __sco_sock_close since at that point it is useless to set a timer as the sk will be freed there is nothing to be done in sco_sock_timeout.

Reported-by [email protected]
Fixes ba316be1b6a0 ("Bluetooth: schedule SCO timeouts with delayed_work")
---
 net/bluetooth/sco.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)
net/bluetooth/sco.c +1 -13
index a5ac160c592e..2b1e66976068 100644
@@ -208,7 +208,7 @@ static void sco_conn_del(struct hci_conn *hcon, int err)
        }
 
        /* Ensure no more work items will run before freeing conn. */
-       cancel_delayed_work_sync(&conn->timeout_work);
+       disable_delayed_work_sync(&conn->timeout_work);
 
        hcon->sco_data = NULL;
        kfree(conn);
@@ -442,17 +442,6 @@ static void __sco_sock_close(struct sock *sk)
 
        case BT_CONNECTED:
        case BT_CONFIG:
-               if (sco_pi(sk)->conn->hcon) {
-                       sk->sk_state = BT_DISCONN;
-                       sco_sock_set_timer(sk, SCO_DISCONN_TIMEOUT);
-                       sco_conn_lock(sco_pi(sk)->conn);
-                       hci_conn_drop(sco_pi(sk)->conn->hcon);
-                       sco_pi(sk)->conn->hcon = NULL;
-                       sco_conn_unlock(sco_pi(sk)->conn);
-               } else
-                       sco_chan_del(sk, ECONNRESET);
-               break;
-
        case BT_CONNECT2:
        case BT_CONNECT:
        case BT_DISCONN:
--
Quoted 2 lines

2.46.1

--
Luiz Augusto von Dentz

Quoted 7 lines
Quoted 2 lines

--
Luiz Augusto von Dentz

--
Luiz Augusto von Dentz

--
Luiz Augusto von Dentz

Quoted 7 lines
Quoted 2 lines

--
Luiz Augusto von Dentz

--
Luiz Augusto von Dentz

--
Luiz Augusto von Dentz

Signature · 1 line
Luiz Augusto von Dentz
author syzbot
#14 lore raw

Re: [syzbot] Re: [PATCH v3] Bluetooth: SCO: Use disable_delayed_work_sync

In reply to syzbot
For archival purposes, forwarding an incoming command email to [email protected], [email protected].

For archival purposes, forwarding an incoming command email to [email protected], [email protected].

***

Subject: Re: [PATCH v3] Bluetooth: SCO: Use disable_delayed_work_sync
Author: [email protected]

#syz test

Quoted 133 lines · Luiz Augusto von Dentz

#syz test

Quoted 116 lines · Luiz Augusto von Dentz

#syz test

Quoted 111 lines · Luiz Augusto von Dentz

#syz test

Quoted 103 lines · Luiz Augusto von Dentz

#syz test

Quoted 86 lines · Luiz Augusto von Dentz

#syz test

Quoted 81 lines · Luiz Augusto von Dentz

#syz test

Quoted 73 lines · Luiz Augusto von Dentz

#syz test

Quoted 55 lines · Luiz Augusto von Dentz

#syz test

Quoted 50 lines · Luiz Augusto von Dentz

From: Luiz Augusto von Dentz <[email protected]>

This makes use of disable_delayed_work_sync instead cancel_delayed_work_sync as it not only cancel the ongoing work but also disables new submit which is disarable since the object holding the work is about to be freed.

In addition to it remove call to sco_sock_set_timer on __sco_sock_close since at that point it is useless to set a timer as the sk will be freed there is nothing to be done in sco_sock_timeout.

Reported-by [email protected]
Fixes ba316be1b6a0 ("Bluetooth: schedule SCO timeouts with delayed_work")
---
 net/bluetooth/sco.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)
net/bluetooth/sco.c +1 -12
index a5ac160c592e..2b1e66976068 100644
@@ -208,7 +208,7 @@ static void sco_conn_del(struct hci_conn *hcon, int err)
        }
 
        /* Ensure no more work items will run before freeing conn. */
-       cancel_delayed_work_sync(&conn->timeout_work);
+       disable_delayed_work_sync(&conn->timeout_work);
 
        hcon->sco_data = NULL;
        kfree(conn);
@@ -442,17 +442,6 @@ static void __sco_sock_close(struct sock *sk)
 
        case BT_CONNECTED:
        case BT_CONFIG:
-               if (sco_pi(sk)->conn->hcon) {
-                       sk->sk_state = BT_DISCONN;
-                       sco_sock_set_timer(sk, SCO_DISCONN_TIMEOUT);
-                       sco_conn_lock(sco_pi(sk)->conn);
-                       hci_conn_drop(sco_pi(sk)->conn->hcon);
-                       sco_pi(sk)->conn->hcon = NULL;
-                       sco_conn_unlock(sco_pi(sk)->conn);
-               } else
-                       sco_chan_del(sk, ECONNRESET);
-               break;
-
        case BT_CONNECT2:
        case BT_CONNECT:
Quoted 8 lines
Quoted 4 lines
net/bluetooth/sco.c +0 -1
        case BT_DISCONN:
--

2.46.1

--
Luiz Augusto von Dentz

--
Luiz Augusto von Dentz

Quoted 7 lines
Quoted 2 lines

--
Luiz Augusto von Dentz

--
Luiz Augusto von Dentz

--
Luiz Augusto von Dentz

Quoted 7 lines
Quoted 2 lines

--
Luiz Augusto von Dentz

--
Luiz Augusto von Dentz

--
Luiz Augusto von Dentz

Signature · 1 line
Luiz Augusto von Dentz
author syzbot
#15 lore raw

Re: [syzbot] Re: [PATCH v3] Bluetooth: SCO: Use disable_delayed_work_sync

In reply to syzbot
For archival purposes, forwarding an incoming command email to [email protected], [email protected].

For archival purposes, forwarding an incoming command email to [email protected], [email protected].

***

Subject: Re: [PATCH v3] Bluetooth: SCO: Use disable_delayed_work_sync
Author: [email protected]

#syz test

Quoted 143 lines · Luiz Augusto von Dentz

#syz test

Quoted 126 lines · Luiz Augusto von Dentz

#syz test

Quoted 121 lines · Luiz Augusto von Dentz

#syz test

Quoted 113 lines · Luiz Augusto von Dentz

#syz test

Quoted 96 lines · Luiz Augusto von Dentz

#syz test

Quoted 91 lines · Luiz Augusto von Dentz

#syz test

Quoted 83 lines · Luiz Augusto von Dentz

#syz test

Quoted 71 lines · Luiz Augusto von Dentz

#syz test

Quoted 55 lines · Luiz Augusto von Dentz

#syz test

Quoted 50 lines · Luiz Augusto von Dentz

From: Luiz Augusto von Dentz <[email protected]>

This makes use of disable_delayed_work_sync instead cancel_delayed_work_sync as it not only cancel the ongoing work but also disables new submit which is disarable since the object holding the work is about to be freed.

In addition to it remove call to sco_sock_set_timer on __sco_sock_close since at that point it is useless to set a timer as the sk will be freed there is nothing to be done in sco_sock_timeout.

Reported-by [email protected]
Fixes ba316be1b6a0 ("Bluetooth: schedule SCO timeouts with delayed_work")
---
 net/bluetooth/sco.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)
net/bluetooth/sco.c +1 -12
index a5ac160c592e..2b1e66976068 100644
@@ -208,7 +208,7 @@ static void sco_conn_del(struct hci_conn *hcon, int err)
        }
 
        /* Ensure no more work items will run before freeing conn. */
-       cancel_delayed_work_sync(&conn->timeout_work);
+       disable_delayed_work_sync(&conn->timeout_work);
 
        hcon->sco_data = NULL;
        kfree(conn);
@@ -442,17 +442,6 @@ static void __sco_sock_close(struct sock *sk)
 
        case BT_CONNECTED:
        case BT_CONFIG:
-               if (sco_pi(sk)->conn->hcon) {
-                       sk->sk_state = BT_DISCONN;
-                       sco_sock_set_timer(sk, SCO_DISCONN_TIMEOUT);
-                       sco_conn_lock(sco_pi(sk)->conn);
-                       hci_conn_drop(sco_pi(sk)->conn->hcon);
-                       sco_pi(sk)->conn->hcon = NULL;
-                       sco_conn_unlock(sco_pi(sk)->conn);
-               } else
-                       sco_chan_del(sk, ECONNRESET);
-               break;
-
        case BT_CONNECT2:
        case BT_CONNECT:
Quoted 8 lines
Quoted 4 lines
net/bluetooth/sco.c +0 -1
        case BT_DISCONN:
--

2.46.1

--
Luiz Augusto von Dentz

Quoted 2 lines

--
Luiz Augusto von Dentz

--
Luiz Augusto von Dentz

Quoted 7 lines
Quoted 2 lines

--
Luiz Augusto von Dentz

--
Luiz Augusto von Dentz

--
Luiz Augusto von Dentz

Quoted 7 lines
Quoted 2 lines

--
Luiz Augusto von Dentz

--
Luiz Augusto von Dentz

--
Luiz Augusto von Dentz

Signature · 1 line
Luiz Augusto von Dentz
author syzbot
#16 lore raw

Re: [syzbot] Re: [PATCH v3] Bluetooth: SCO: Use disable_delayed_work_sync

In reply to syzbot
For archival purposes, forwarding an incoming command email to [email protected], [email protected].

For archival purposes, forwarding an incoming command email to [email protected], [email protected].

***

Subject: Re: [PATCH v3] Bluetooth: SCO: Use disable_delayed_work_sync
Author: [email protected]

#syz test

Quoted 153 lines · Luiz Augusto von Dentz

#syz test

Quoted 136 lines · Luiz Augusto von Dentz

#syz test

Quoted 131 lines · Luiz Augusto von Dentz

#syz test

Quoted 123 lines · Luiz Augusto von Dentz

#syz test

Quoted 106 lines · Luiz Augusto von Dentz

#syz test

Quoted 101 lines · Luiz Augusto von Dentz

#syz test

Quoted 93 lines · Luiz Augusto von Dentz

#syz test

Quoted 76 lines · Luiz Augusto von Dentz

#syz test

Quoted 71 lines · Luiz Augusto von Dentz

#syz test

Quoted 63 lines · Luiz Augusto von Dentz

#syz test

Quoted 52 lines · Luiz Augusto von Dentz

From: Luiz Augusto von Dentz <[email protected]>

This makes use of disable_delayed_work_sync instead cancel_delayed_work_sync as it not only cancel the ongoing work but also disables new submit which is disarable since the object holding the work is about to be freed.

In addition to it remove call to sco_sock_set_timer on __sco_sock_close since at that point it is useless to set a timer as the sk will be freed there is nothing to be done in sco_sock_timeout.

Reported-by [email protected]
Fixes ba316be1b6a0 ("Bluetooth: schedule SCO timeouts with delayed_work")
---
 net/bluetooth/sco.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)
net/bluetooth/sco.c +1 -13
index a5ac160c592e..2b1e66976068 100644
@@ -208,7 +208,7 @@ static void sco_conn_del(struct hci_conn *hcon, int err)
        }
 
        /* Ensure no more work items will run before freeing conn. */
-       cancel_delayed_work_sync(&conn->timeout_work);
+       disable_delayed_work_sync(&conn->timeout_work);
 
        hcon->sco_data = NULL;
        kfree(conn);
@@ -442,17 +442,6 @@ static void __sco_sock_close(struct sock *sk)
 
        case BT_CONNECTED:
        case BT_CONFIG:
-               if (sco_pi(sk)->conn->hcon) {
-                       sk->sk_state = BT_DISCONN;
-                       sco_sock_set_timer(sk, SCO_DISCONN_TIMEOUT);
-                       sco_conn_lock(sco_pi(sk)->conn);
-                       hci_conn_drop(sco_pi(sk)->conn->hcon);
-                       sco_pi(sk)->conn->hcon = NULL;
-                       sco_conn_unlock(sco_pi(sk)->conn);
-               } else
-                       sco_chan_del(sk, ECONNRESET);
-               break;
-
        case BT_CONNECT2:
        case BT_CONNECT:
        case BT_DISCONN:
--
Quoted 2 lines

2.46.1

--
Luiz Augusto von Dentz

Quoted 7 lines
Quoted 2 lines

--
Luiz Augusto von Dentz

--
Luiz Augusto von Dentz

--
Luiz Augusto von Dentz

Quoted 7 lines
Quoted 2 lines

--
Luiz Augusto von Dentz

--
Luiz Augusto von Dentz

--
Luiz Augusto von Dentz

Quoted 7 lines
Quoted 2 lines

--
Luiz Augusto von Dentz

--
Luiz Augusto von Dentz

--
Luiz Augusto von Dentz

Signature · 1 line
Luiz Augusto von Dentz
author syzbot
#17 lore raw

Re: [syzbot] Re: [PATCH v3] Bluetooth: SCO: Use disable_delayed_work_sync

In reply to syzbot
For archival purposes, forwarding an incoming command email to [email protected], [email protected].

For archival purposes, forwarding an incoming command email to [email protected], [email protected].

***

Subject: Re: [PATCH v3] Bluetooth: SCO: Use disable_delayed_work_sync
Author: [email protected]

#syz test

Quoted 163 lines · Luiz Augusto von Dentz

#syz test

Quoted 146 lines · Luiz Augusto von Dentz

#syz test

Quoted 141 lines · Luiz Augusto von Dentz

#syz test

Quoted 133 lines · Luiz Augusto von Dentz

#syz test

Quoted 116 lines · Luiz Augusto von Dentz

#syz test

Quoted 111 lines · Luiz Augusto von Dentz

#syz test

Quoted 103 lines · Luiz Augusto von Dentz

#syz test

Quoted 86 lines · Luiz Augusto von Dentz

#syz test

Quoted 81 lines · Luiz Augusto von Dentz

#syz test

Quoted 73 lines · Luiz Augusto von Dentz

#syz test

Quoted 55 lines · Luiz Augusto von Dentz

#syz test

Quoted 50 lines · Luiz Augusto von Dentz

From: Luiz Augusto von Dentz <[email protected]>

This makes use of disable_delayed_work_sync instead cancel_delayed_work_sync as it not only cancel the ongoing work but also disables new submit which is disarable since the object holding the work is about to be freed.

In addition to it remove call to sco_sock_set_timer on __sco_sock_close since at that point it is useless to set a timer as the sk will be freed there is nothing to be done in sco_sock_timeout.

Reported-by [email protected]
Fixes ba316be1b6a0 ("Bluetooth: schedule SCO timeouts with delayed_work")
---
 net/bluetooth/sco.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)
net/bluetooth/sco.c +1 -12
index a5ac160c592e..2b1e66976068 100644
@@ -208,7 +208,7 @@ static void sco_conn_del(struct hci_conn *hcon, int err)
        }
 
        /* Ensure no more work items will run before freeing conn. */
-       cancel_delayed_work_sync(&conn->timeout_work);
+       disable_delayed_work_sync(&conn->timeout_work);
 
        hcon->sco_data = NULL;
        kfree(conn);
@@ -442,17 +442,6 @@ static void __sco_sock_close(struct sock *sk)
 
        case BT_CONNECTED:
        case BT_CONFIG:
-               if (sco_pi(sk)->conn->hcon) {
-                       sk->sk_state = BT_DISCONN;
-                       sco_sock_set_timer(sk, SCO_DISCONN_TIMEOUT);
-                       sco_conn_lock(sco_pi(sk)->conn);
-                       hci_conn_drop(sco_pi(sk)->conn->hcon);
-                       sco_pi(sk)->conn->hcon = NULL;
-                       sco_conn_unlock(sco_pi(sk)->conn);
-               } else
-                       sco_chan_del(sk, ECONNRESET);
-               break;
-
        case BT_CONNECT2:
        case BT_CONNECT:
Quoted 8 lines
Quoted 4 lines
net/bluetooth/sco.c +0 -1
        case BT_DISCONN:
--

2.46.1

--
Luiz Augusto von Dentz

--
Luiz Augusto von Dentz

Quoted 7 lines
Quoted 2 lines

--
Luiz Augusto von Dentz

--
Luiz Augusto von Dentz

--
Luiz Augusto von Dentz

Quoted 7 lines
Quoted 2 lines

--
Luiz Augusto von Dentz

--
Luiz Augusto von Dentz

--
Luiz Augusto von Dentz

Quoted 7 lines
Quoted 2 lines

--
Luiz Augusto von Dentz

--
Luiz Augusto von Dentz

--
Luiz Augusto von Dentz

Signature · 1 line
Luiz Augusto von Dentz