All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RESEND] Bluetooth: btusb: medaitek: fix double free of skb in coredump
@ 2024-04-17 23:27 sean.wang
  2024-04-17 23:57 ` [RESEND] " bluez.test.bot
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: sean.wang @ 2024-04-17 23:27 UTC (permalink / raw)
  To: luiz.dentz, marcel, johan.hedberg
  Cc: sean.wang, chris.lu, Deren.Wu, jsiuda, frankgor, abhishekpandit,
	michaelfsun, mmandlik, abhishekpandit, mcchou, shawnku,
	linux-bluetooth, linux-mediatek, linux-kernel

From: Sean Wang <sean.wang@mediatek.com>

hci_devcd_append() would free the skb on error so the caller don't
have to free it again otherwise it would cause the double free of skb.

Fixes: 0b7015132878 ("Bluetooth: btusb: mediatek: add MediaTek devcoredump support")
Reported-by : Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
 drivers/bluetooth/btmtk.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/bluetooth/btmtk.c b/drivers/bluetooth/btmtk.c
index ac8ebccd3507..812fd2a8f853 100644
--- a/drivers/bluetooth/btmtk.c
+++ b/drivers/bluetooth/btmtk.c
@@ -380,8 +380,10 @@ int btmtk_process_coredump(struct hci_dev *hdev, struct sk_buff *skb)
 	switch (data->cd_info.state) {
 	case HCI_DEVCOREDUMP_IDLE:
 		err = hci_devcd_init(hdev, MTK_COREDUMP_SIZE);
-		if (err < 0)
+		if (err < 0) {
+			kfree_skb(skb);
 			break;
+		}
 		data->cd_info.cnt = 0;
 
 		/* It is supposed coredump can be done within 5 seconds */
@@ -407,9 +409,6 @@ int btmtk_process_coredump(struct hci_dev *hdev, struct sk_buff *skb)
 		break;
 	}
 
-	if (err < 0)
-		kfree_skb(skb);
-
 	return err;
 }
 EXPORT_SYMBOL_GPL(btmtk_process_coredump);
-- 
2.25.1


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

* RE: [RESEND] Bluetooth: btusb: medaitek: fix double free of skb in coredump
  2024-04-17 23:27 [PATCH RESEND] Bluetooth: btusb: medaitek: fix double free of skb in coredump sean.wang
@ 2024-04-17 23:57 ` bluez.test.bot
  2024-04-18  9:40 ` [PATCH RESEND] " Markus Elfring
  2024-04-19 19:50 ` [PATCH RESEND] " patchwork-bot+bluetooth
  2 siblings, 0 replies; 6+ messages in thread
From: bluez.test.bot @ 2024-04-17 23:57 UTC (permalink / raw)
  To: linux-bluetooth, sean.wang

[-- Attachment #1: Type: text/plain, Size: 3335 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=845618

---Test result---

Test Summary:
CheckPatch                    PASS      0.64 seconds
GitLint                       PASS      0.29 seconds
SubjectPrefix                 PASS      0.11 seconds
BuildKernel                   PASS      29.93 seconds
CheckAllWarning               PASS      32.68 seconds
CheckSparse                   PASS      37.67 seconds
CheckSmatch                   FAIL      35.64 seconds
BuildKernel32                 PASS      28.65 seconds
TestRunnerSetup               PASS      518.27 seconds
TestRunner_l2cap-tester       PASS      19.18 seconds
TestRunner_iso-tester         FAIL      35.29 seconds
TestRunner_bnep-tester        PASS      4.93 seconds
TestRunner_mgmt-tester        FAIL      118.55 seconds
TestRunner_rfcomm-tester      PASS      7.75 seconds
TestRunner_sco-tester         PASS      15.37 seconds
TestRunner_ioctl-tester       PASS      8.25 seconds
TestRunner_mesh-tester        PASS      6.15 seconds
TestRunner_smp-tester         PASS      7.00 seconds
TestRunner_userchan-tester    PASS      5.29 seconds
IncrementalBuild              PASS      31.42 seconds

Details
##############################
Test: CheckSmatch - FAIL
Desc: Run smatch tool with source
Output:

Segmentation fault (core dumped)
make[4]: *** [scripts/Makefile.build:244: net/bluetooth/hci_core.o] Error 139
make[4]: *** Deleting file 'net/bluetooth/hci_core.o'
make[3]: *** [scripts/Makefile.build:485: net/bluetooth] Error 2
make[2]: *** [scripts/Makefile.build:485: net] Error 2
make[2]: *** Waiting for unfinished jobs....
Segmentation fault (core dumped)
make[4]: *** [scripts/Makefile.build:244: drivers/bluetooth/bcm203x.o] Error 139
make[4]: *** Deleting file 'drivers/bluetooth/bcm203x.o'
make[4]: *** Waiting for unfinished jobs....
Segmentation fault (core dumped)
make[4]: *** [scripts/Makefile.build:244: drivers/bluetooth/bpa10x.o] Error 139
make[4]: *** Deleting file 'drivers/bluetooth/bpa10x.o'
make[3]: *** [scripts/Makefile.build:485: drivers/bluetooth] Error 2
make[2]: *** [scripts/Makefile.build:485: drivers] Error 2
make[1]: *** [/github/workspace/src/src/Makefile:1919: .] Error 2
make: *** [Makefile:240: __sub-make] Error 2
##############################
Test: TestRunner_iso-tester - FAIL
Desc: Run iso-tester with test-runner
Output:
Total: 122, Passed: 120 (98.4%), Failed: 2, Not Run: 0

Failed Test Cases
ISO Connect Suspend - Success                        Failed       6.212 seconds
ISO Connect2 Suspend - Success                       Failed       4.232 seconds
##############################
Test: TestRunner_mgmt-tester - FAIL
Desc: Run mgmt-tester with test-runner
Output:
Total: 492, Passed: 486 (98.8%), Failed: 4, Not Run: 2

Failed Test Cases
LL Privacy - Add Device 5 (2 Devices to RL)          Failed       0.164 seconds
LL Privacy - Add Device 6 (RL is full)               Failed       0.194 seconds
LL Privacy - Add Device 7 (AL is full)               Failed       0.216 seconds
LL Privacy - Remove Device 4 (Disable Adv)           Timed out    1.877 seconds


---
Regards,
Linux Bluetooth


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

* Re: [PATCH RESEND] Bluetooth: btusb: medaitek: fix double free of skb in coredump
  2024-04-17 23:27 [PATCH RESEND] Bluetooth: btusb: medaitek: fix double free of skb in coredump sean.wang
  2024-04-17 23:57 ` [RESEND] " bluez.test.bot
@ 2024-04-18  9:40 ` Markus Elfring
  2024-04-19 19:42   ` Luiz Augusto von Dentz
  2024-04-19 19:50 ` [PATCH RESEND] " patchwork-bot+bluetooth
  2 siblings, 1 reply; 6+ messages in thread
From: Markus Elfring @ 2024-04-18  9:40 UTC (permalink / raw)
  To: Sean Wang, linux-bluetooth, linux-mediatek, kernel-janitors,
	Johan Hedberg, Luiz Von Dentz, Marcel Holtmann
  Cc: LKML, Sean Wang, Chris Lu, Dan Carpenter, Deren Wu,
	Abhishek Pandit-Subedi, Manish Mandlik, Miao-chen Chou,
	Michael Sun, shawnku, frankgor, jsiuda

> hci_devcd_append() would free the skb on error so the caller don't
> have to free it again otherwise it would cause the double free of skb.

I hope that a typo will be avoided in the subsystem specification
for the final commit.

Regards,
Markus

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

* Re: [PATCH RESEND] Bluetooth: btusb: medaitek: fix double free of skb in coredump
  2024-04-18  9:40 ` [PATCH RESEND] " Markus Elfring
@ 2024-04-19 19:42   ` Luiz Augusto von Dentz
  2024-04-19 19:56     ` Markus Elfring
  0 siblings, 1 reply; 6+ messages in thread
From: Luiz Augusto von Dentz @ 2024-04-19 19:42 UTC (permalink / raw)
  To: Markus Elfring
  Cc: Sean Wang, linux-bluetooth, linux-mediatek, kernel-janitors,
	Johan Hedberg, Marcel Holtmann, LKML, Sean Wang, Chris Lu,
	Dan Carpenter, Deren Wu, Abhishek Pandit-Subedi, Manish Mandlik,
	Miao-chen Chou, Michael Sun, shawnku, frankgor, jsiuda

Hi Markus,

On Thu, Apr 18, 2024 at 5:40 AM Markus Elfring <Markus.Elfring@web.de> wrote:
>
> > hci_devcd_append() would free the skb on error so the caller don't
> > have to free it again otherwise it would cause the double free of skb.
>
> I hope that a typo will be avoided in the subsystem specification
> for the final commit.

Are you talking about medaitek or is there another typo?


> Regards,
> Markus



-- 
Luiz Augusto von Dentz

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

* Re: [PATCH RESEND] Bluetooth: btusb: medaitek: fix double free of skb in coredump
  2024-04-17 23:27 [PATCH RESEND] Bluetooth: btusb: medaitek: fix double free of skb in coredump sean.wang
  2024-04-17 23:57 ` [RESEND] " bluez.test.bot
  2024-04-18  9:40 ` [PATCH RESEND] " Markus Elfring
@ 2024-04-19 19:50 ` patchwork-bot+bluetooth
  2 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+bluetooth @ 2024-04-19 19:50 UTC (permalink / raw)
  To: Sean Wang
  Cc: luiz.dentz, marcel, johan.hedberg, sean.wang, chris.lu, Deren.Wu,
	jsiuda, frankgor, abhishekpandit, michaelfsun, mmandlik,
	abhishekpandit, mcchou, shawnku, linux-bluetooth, linux-mediatek,
	linux-kernel

Hello:

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

On Wed, 17 Apr 2024 16:27:38 -0700 you wrote:
> From: Sean Wang <sean.wang@mediatek.com>
> 
> hci_devcd_append() would free the skb on error so the caller don't
> have to free it again otherwise it would cause the double free of skb.
> 
> Fixes: 0b7015132878 ("Bluetooth: btusb: mediatek: add MediaTek devcoredump support")
> Reported-by : Dan Carpenter <dan.carpenter@linaro.org>
> Signed-off-by: Sean Wang <sean.wang@mediatek.com>
> 
> [...]

Here is the summary with links:
  - [RESEND] Bluetooth: btusb: medaitek: fix double free of skb in coredump
    https://git.kernel.org/bluetooth/bluetooth-next/c/6764ab72237d

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] 6+ messages in thread

* Re: Bluetooth: btusb: medaitek: fix double free of skb in coredump
  2024-04-19 19:42   ` Luiz Augusto von Dentz
@ 2024-04-19 19:56     ` Markus Elfring
  0 siblings, 0 replies; 6+ messages in thread
From: Markus Elfring @ 2024-04-19 19:56 UTC (permalink / raw)
  To: Luiz Augusto von Dentz, Sean Wang, linux-bluetooth,
	linux-mediatek, kernel-janitors
  Cc: Johan Hedberg, Marcel Holtmann, LKML, Sean Wang, Chris Lu,
	Dan Carpenter, Deren Wu, Abhishek Pandit-Subedi, Manish Mandlik,
	Miao-chen Chou, Michael Sun, shawnku, frankgor, jsiuda

>> I hope that a typo will be avoided in the subsystem specification
>> for the final commit.
>
> Are you talking about medaitek

Yes.

Do you prefer references for mediatek here?


> or is there another typo?

Not yet.

Regards,
Markus

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

end of thread, other threads:[~2024-04-19 19:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-17 23:27 [PATCH RESEND] Bluetooth: btusb: medaitek: fix double free of skb in coredump sean.wang
2024-04-17 23:57 ` [RESEND] " bluez.test.bot
2024-04-18  9:40 ` [PATCH RESEND] " Markus Elfring
2024-04-19 19:42   ` Luiz Augusto von Dentz
2024-04-19 19:56     ` Markus Elfring
2024-04-19 19:50 ` [PATCH RESEND] " patchwork-bot+bluetooth

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.