* [PATCH v1] Bluetooth: Optimize devcoredump API hci_devcd_init()
@ 2023-04-11 11:49 Zijun Hu
2023-04-11 12:41 ` [v1] " bluez.test.bot
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Zijun Hu @ 2023-04-11 11:49 UTC (permalink / raw)
To: marcel, johan.hedberg, luiz.dentz
Cc: davem, edumazet, kuba, pabeni, linux-kernel, linux-bluetooth,
netdev, quic_zijuhu, abhishekpandit
API hci_devcd_init() stores u32 type to memory without specific byte
order, let us store with little endian in order to be loaded and
parsed by devcoredump core rightly.
Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
---
net/bluetooth/coredump.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/net/bluetooth/coredump.c b/net/bluetooth/coredump.c
index 08fa98505454..d2d2624ec708 100644
--- a/net/bluetooth/coredump.c
+++ b/net/bluetooth/coredump.c
@@ -5,6 +5,7 @@
#include <linux/devcoredump.h>
+#include <asm/unaligned.h>
#include <net/bluetooth/bluetooth.h>
#include <net/bluetooth/hci_core.h>
@@ -180,25 +181,25 @@ static int hci_devcd_prepare(struct hci_dev *hdev, u32 dump_size)
static void hci_devcd_handle_pkt_init(struct hci_dev *hdev, struct sk_buff *skb)
{
- u32 *dump_size;
+ u32 dump_size;
if (hdev->dump.state != HCI_DEVCOREDUMP_IDLE) {
DBG_UNEXPECTED_STATE();
return;
}
- if (skb->len != sizeof(*dump_size)) {
+ if (skb->len != sizeof(dump_size)) {
bt_dev_dbg(hdev, "Invalid dump init pkt");
return;
}
- dump_size = skb_pull_data(skb, sizeof(*dump_size));
- if (!*dump_size) {
+ dump_size = get_unaligned_le32(skb_pull_data(skb, 4));
+ if (!dump_size) {
bt_dev_err(hdev, "Zero size dump init pkt");
return;
}
- if (hci_devcd_prepare(hdev, *dump_size)) {
+ if (hci_devcd_prepare(hdev, dump_size)) {
bt_dev_err(hdev, "Failed to prepare for dump");
return;
}
@@ -441,7 +442,7 @@ int hci_devcd_init(struct hci_dev *hdev, u32 dump_size)
return -ENOMEM;
hci_dmp_cb(skb)->pkt_type = HCI_DEVCOREDUMP_PKT_INIT;
- skb_put_data(skb, &dump_size, sizeof(dump_size));
+ put_unaligned_le32(dump_size, skb_put(skb, 4));
skb_queue_tail(&hdev->dump.dump_q, skb);
queue_work(hdev->workqueue, &hdev->dump.dump_rx);
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
^ permalink raw reply related [flat|nested] 7+ messages in thread
* RE: [v1] Bluetooth: Optimize devcoredump API hci_devcd_init()
2023-04-11 11:49 [PATCH v1] Bluetooth: Optimize devcoredump API hci_devcd_init() Zijun Hu
@ 2023-04-11 12:41 ` bluez.test.bot
2023-04-14 21:03 ` [PATCH v1] " Luiz Augusto von Dentz
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: bluez.test.bot @ 2023-04-11 12:41 UTC (permalink / raw)
To: linux-bluetooth, quic_zijuhu
[-- Attachment #1: Type: text/plain, Size: 1420 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=738746
---Test result---
Test Summary:
CheckPatch PASS 0.69 seconds
GitLint PASS 0.35 seconds
SubjectPrefix PASS 0.13 seconds
BuildKernel PASS 32.61 seconds
CheckAllWarning PASS 35.87 seconds
CheckSparse PASS 40.72 seconds
CheckSmatch PASS 111.13 seconds
BuildKernel32 PASS 31.55 seconds
TestRunnerSetup PASS 448.09 seconds
TestRunner_l2cap-tester PASS 16.55 seconds
TestRunner_iso-tester PASS 16.25 seconds
TestRunner_bnep-tester PASS 5.26 seconds
TestRunner_mgmt-tester PASS 111.33 seconds
TestRunner_rfcomm-tester PASS 8.35 seconds
TestRunner_sco-tester PASS 7.69 seconds
TestRunner_ioctl-tester PASS 8.95 seconds
TestRunner_mesh-tester PASS 6.70 seconds
TestRunner_smp-tester PASS 7.61 seconds
TestRunner_userchan-tester PASS 5.46 seconds
IncrementalBuild PASS 28.56 seconds
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v1] Bluetooth: Optimize devcoredump API hci_devcd_init()
2023-04-11 11:49 [PATCH v1] Bluetooth: Optimize devcoredump API hci_devcd_init() Zijun Hu
2023-04-11 12:41 ` [v1] " bluez.test.bot
@ 2023-04-14 21:03 ` Luiz Augusto von Dentz
2023-04-17 9:39 ` [PATCH v2] Bluetooth: Devcoredump: Fix storing u32 without specifying byte order issue Zijun Hu
2023-04-17 18:30 ` [PATCH v1] Bluetooth: Optimize devcoredump API hci_devcd_init() patchwork-bot+bluetooth
3 siblings, 0 replies; 7+ messages in thread
From: Luiz Augusto von Dentz @ 2023-04-14 21:03 UTC (permalink / raw)
To: Zijun Hu
Cc: marcel, johan.hedberg, davem, edumazet, kuba, pabeni,
linux-kernel, linux-bluetooth, netdev, abhishekpandit
Hi Zijun,
On Tue, Apr 11, 2023 at 4:49 AM Zijun Hu <quic_zijuhu@quicinc.com> wrote:
>
> API hci_devcd_init() stores u32 type to memory without specific byte
> order, let us store with little endian in order to be loaded and
> parsed by devcoredump core rightly.
This looks like a fix if devcoredump expects little endian, so I'd
suggest rephrasing to state it in the subject line, also add the Fixes
tag for the commit that introduces this problem.
> Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
> ---
> net/bluetooth/coredump.c | 13 +++++++------
> 1 file changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/net/bluetooth/coredump.c b/net/bluetooth/coredump.c
> index 08fa98505454..d2d2624ec708 100644
> --- a/net/bluetooth/coredump.c
> +++ b/net/bluetooth/coredump.c
> @@ -5,6 +5,7 @@
>
> #include <linux/devcoredump.h>
>
> +#include <asm/unaligned.h>
> #include <net/bluetooth/bluetooth.h>
> #include <net/bluetooth/hci_core.h>
>
> @@ -180,25 +181,25 @@ static int hci_devcd_prepare(struct hci_dev *hdev, u32 dump_size)
>
> static void hci_devcd_handle_pkt_init(struct hci_dev *hdev, struct sk_buff *skb)
> {
> - u32 *dump_size;
> + u32 dump_size;
>
> if (hdev->dump.state != HCI_DEVCOREDUMP_IDLE) {
> DBG_UNEXPECTED_STATE();
> return;
> }
>
> - if (skb->len != sizeof(*dump_size)) {
> + if (skb->len != sizeof(dump_size)) {
> bt_dev_dbg(hdev, "Invalid dump init pkt");
> return;
> }
>
> - dump_size = skb_pull_data(skb, sizeof(*dump_size));
> - if (!*dump_size) {
> + dump_size = get_unaligned_le32(skb_pull_data(skb, 4));
> + if (!dump_size) {
> bt_dev_err(hdev, "Zero size dump init pkt");
> return;
> }
>
> - if (hci_devcd_prepare(hdev, *dump_size)) {
> + if (hci_devcd_prepare(hdev, dump_size)) {
> bt_dev_err(hdev, "Failed to prepare for dump");
> return;
> }
> @@ -441,7 +442,7 @@ int hci_devcd_init(struct hci_dev *hdev, u32 dump_size)
> return -ENOMEM;
>
> hci_dmp_cb(skb)->pkt_type = HCI_DEVCOREDUMP_PKT_INIT;
> - skb_put_data(skb, &dump_size, sizeof(dump_size));
> + put_unaligned_le32(dump_size, skb_put(skb, 4));
>
> skb_queue_tail(&hdev->dump.dump_q, skb);
> queue_work(hdev->workqueue, &hdev->dump.dump_rx);
> --
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
>
--
Luiz Augusto von Dentz
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2] Bluetooth: Devcoredump: Fix storing u32 without specifying byte order issue
2023-04-11 11:49 [PATCH v1] Bluetooth: Optimize devcoredump API hci_devcd_init() Zijun Hu
2023-04-11 12:41 ` [v1] " bluez.test.bot
2023-04-14 21:03 ` [PATCH v1] " Luiz Augusto von Dentz
@ 2023-04-17 9:39 ` Zijun Hu
2023-04-17 10:34 ` [v2] " bluez.test.bot
2023-04-17 18:30 ` [PATCH v2] " patchwork-bot+bluetooth
2023-04-17 18:30 ` [PATCH v1] Bluetooth: Optimize devcoredump API hci_devcd_init() patchwork-bot+bluetooth
3 siblings, 2 replies; 7+ messages in thread
From: Zijun Hu @ 2023-04-17 9:39 UTC (permalink / raw)
To: marcel, johan.hedberg, luiz.dentz
Cc: davem, edumazet, kuba, pabeni, linux-kernel, linux-bluetooth,
netdev, quic_zijuhu, abhishekpandit
API hci_devcd_init() stores its u32 type parameter @dump_size into
skb, but it does not specify which byte order is used to store the
integer, let us take little endian to store and parse the integer.
Fixes: f5cc609d09d4 ("Bluetooth: Add support for hci devcoredump")
Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
---
net/bluetooth/coredump.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/net/bluetooth/coredump.c b/net/bluetooth/coredump.c
index 08fa98505454..d2d2624ec708 100644
--- a/net/bluetooth/coredump.c
+++ b/net/bluetooth/coredump.c
@@ -5,6 +5,7 @@
#include <linux/devcoredump.h>
+#include <asm/unaligned.h>
#include <net/bluetooth/bluetooth.h>
#include <net/bluetooth/hci_core.h>
@@ -180,25 +181,25 @@ static int hci_devcd_prepare(struct hci_dev *hdev, u32 dump_size)
static void hci_devcd_handle_pkt_init(struct hci_dev *hdev, struct sk_buff *skb)
{
- u32 *dump_size;
+ u32 dump_size;
if (hdev->dump.state != HCI_DEVCOREDUMP_IDLE) {
DBG_UNEXPECTED_STATE();
return;
}
- if (skb->len != sizeof(*dump_size)) {
+ if (skb->len != sizeof(dump_size)) {
bt_dev_dbg(hdev, "Invalid dump init pkt");
return;
}
- dump_size = skb_pull_data(skb, sizeof(*dump_size));
- if (!*dump_size) {
+ dump_size = get_unaligned_le32(skb_pull_data(skb, 4));
+ if (!dump_size) {
bt_dev_err(hdev, "Zero size dump init pkt");
return;
}
- if (hci_devcd_prepare(hdev, *dump_size)) {
+ if (hci_devcd_prepare(hdev, dump_size)) {
bt_dev_err(hdev, "Failed to prepare for dump");
return;
}
@@ -441,7 +442,7 @@ int hci_devcd_init(struct hci_dev *hdev, u32 dump_size)
return -ENOMEM;
hci_dmp_cb(skb)->pkt_type = HCI_DEVCOREDUMP_PKT_INIT;
- skb_put_data(skb, &dump_size, sizeof(dump_size));
+ put_unaligned_le32(dump_size, skb_put(skb, 4));
skb_queue_tail(&hdev->dump.dump_q, skb);
queue_work(hdev->workqueue, &hdev->dump.dump_rx);
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
^ permalink raw reply related [flat|nested] 7+ messages in thread
* RE: [v2] Bluetooth: Devcoredump: Fix storing u32 without specifying byte order issue
2023-04-17 9:39 ` [PATCH v2] Bluetooth: Devcoredump: Fix storing u32 without specifying byte order issue Zijun Hu
@ 2023-04-17 10:34 ` bluez.test.bot
2023-04-17 18:30 ` [PATCH v2] " patchwork-bot+bluetooth
1 sibling, 0 replies; 7+ messages in thread
From: bluez.test.bot @ 2023-04-17 10:34 UTC (permalink / raw)
To: linux-bluetooth, quic_zijuhu
[-- Attachment #1: Type: text/plain, Size: 1420 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=740420
---Test result---
Test Summary:
CheckPatch PASS 0.71 seconds
GitLint PASS 0.34 seconds
SubjectPrefix PASS 0.13 seconds
BuildKernel PASS 31.81 seconds
CheckAllWarning PASS 34.90 seconds
CheckSparse PASS 40.02 seconds
CheckSmatch PASS 109.25 seconds
BuildKernel32 PASS 31.11 seconds
TestRunnerSetup PASS 440.77 seconds
TestRunner_l2cap-tester PASS 16.90 seconds
TestRunner_iso-tester PASS 20.85 seconds
TestRunner_bnep-tester PASS 5.56 seconds
TestRunner_mgmt-tester PASS 114.94 seconds
TestRunner_rfcomm-tester PASS 8.84 seconds
TestRunner_sco-tester PASS 8.21 seconds
TestRunner_ioctl-tester PASS 9.58 seconds
TestRunner_mesh-tester PASS 6.94 seconds
TestRunner_smp-tester PASS 8.07 seconds
TestRunner_userchan-tester PASS 5.81 seconds
IncrementalBuild PASS 29.67 seconds
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v1] Bluetooth: Optimize devcoredump API hci_devcd_init()
2023-04-11 11:49 [PATCH v1] Bluetooth: Optimize devcoredump API hci_devcd_init() Zijun Hu
` (2 preceding siblings ...)
2023-04-17 9:39 ` [PATCH v2] Bluetooth: Devcoredump: Fix storing u32 without specifying byte order issue Zijun Hu
@ 2023-04-17 18:30 ` patchwork-bot+bluetooth
3 siblings, 0 replies; 7+ messages in thread
From: patchwork-bot+bluetooth @ 2023-04-17 18:30 UTC (permalink / raw)
To: Zijun Hu
Cc: marcel, johan.hedberg, luiz.dentz, davem, edumazet, kuba, pabeni,
linux-kernel, linux-bluetooth, netdev, abhishekpandit
Hello:
This patch was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:
On Tue, 11 Apr 2023 19:49:38 +0800 you wrote:
> API hci_devcd_init() stores u32 type to memory without specific byte
> order, let us store with little endian in order to be loaded and
> parsed by devcoredump core rightly.
>
> Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
> ---
> net/bluetooth/coredump.c | 13 +++++++------
> 1 file changed, 7 insertions(+), 6 deletions(-)
Here is the summary with links:
- [v1] Bluetooth: Optimize devcoredump API hci_devcd_init()
https://git.kernel.org/bluetooth/bluetooth-next/c/61cad9af36db
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] 7+ messages in thread
* Re: [PATCH v2] Bluetooth: Devcoredump: Fix storing u32 without specifying byte order issue
2023-04-17 9:39 ` [PATCH v2] Bluetooth: Devcoredump: Fix storing u32 without specifying byte order issue Zijun Hu
2023-04-17 10:34 ` [v2] " bluez.test.bot
@ 2023-04-17 18:30 ` patchwork-bot+bluetooth
1 sibling, 0 replies; 7+ messages in thread
From: patchwork-bot+bluetooth @ 2023-04-17 18:30 UTC (permalink / raw)
To: Zijun Hu
Cc: marcel, johan.hedberg, luiz.dentz, davem, edumazet, kuba, pabeni,
linux-kernel, linux-bluetooth, netdev, abhishekpandit
Hello:
This patch was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:
On Mon, 17 Apr 2023 17:39:59 +0800 you wrote:
> API hci_devcd_init() stores its u32 type parameter @dump_size into
> skb, but it does not specify which byte order is used to store the
> integer, let us take little endian to store and parse the integer.
>
> Fixes: f5cc609d09d4 ("Bluetooth: Add support for hci devcoredump")
> Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
>
> [...]
Here is the summary with links:
- [v2] Bluetooth: Devcoredump: Fix storing u32 without specifying byte order issue
https://git.kernel.org/bluetooth/bluetooth-next/c/61cad9af36db
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] 7+ messages in thread
end of thread, other threads:[~2023-04-17 18:31 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-11 11:49 [PATCH v1] Bluetooth: Optimize devcoredump API hci_devcd_init() Zijun Hu
2023-04-11 12:41 ` [v1] " bluez.test.bot
2023-04-14 21:03 ` [PATCH v1] " Luiz Augusto von Dentz
2023-04-17 9:39 ` [PATCH v2] Bluetooth: Devcoredump: Fix storing u32 without specifying byte order issue Zijun Hu
2023-04-17 10:34 ` [v2] " bluez.test.bot
2023-04-17 18:30 ` [PATCH v2] " patchwork-bot+bluetooth
2023-04-17 18:30 ` [PATCH v1] Bluetooth: Optimize devcoredump API hci_devcd_init() 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).