* [PATCH] net: qrtr: Update packets cloning when broadcasting
@ 2024-09-16 17:08 Youssef Samir
2024-09-17 14:59 ` Chris Lew
2024-09-24 9:02 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 5+ messages in thread
From: Youssef Samir @ 2024-09-16 17:08 UTC (permalink / raw)
To: mani, davem, edumazet, kuba, pabeni, andersson, quic_clew
Cc: quic_jhugo, linux-arm-msm, netdev, linux-kernel, Carl Vanderlip
When broadcasting data to multiple nodes via MHI, using skb_clone()
causes all nodes to receive the same header data. This can result in
packets being discarded by endpoints, leading to lost data.
This issue occurs when a socket is closed, and a QRTR_TYPE_DEL_CLIENT
packet is broadcasted. All nodes receive the same destination node ID,
causing the node connected to the client to discard the packet and
remain unaware of the client's deletion.
Replace skb_clone() with pskb_copy(), to create a separate copy of
the header for each sk_buff.
Fixes: bdabad3e363d ("net: Add Qualcomm IPC router")
Signed-off-by: Youssef Samir <quic_yabdulra@quicinc.com>
Reviewed-by: Jeffery Hugo <quic_jhugo@quicinc.com>
Reviewed-by: Carl Vanderlip <quic_carlv@quicinc.com>
---
net/qrtr/af_qrtr.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/qrtr/af_qrtr.c b/net/qrtr/af_qrtr.c
index 41ece61eb57a..00c51cf693f3 100644
--- a/net/qrtr/af_qrtr.c
+++ b/net/qrtr/af_qrtr.c
@@ -884,7 +884,7 @@ static int qrtr_bcast_enqueue(struct qrtr_node *node, struct sk_buff *skb,
mutex_lock(&qrtr_node_lock);
list_for_each_entry(node, &qrtr_all_nodes, item) {
- skbn = skb_clone(skb, GFP_KERNEL);
+ skbn = pskb_copy(skb, GFP_KERNEL);
if (!skbn)
break;
skb_set_owner_w(skbn, skb->sk);
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] net: qrtr: Update packets cloning when broadcasting
2024-09-16 17:08 [PATCH] net: qrtr: Update packets cloning when broadcasting Youssef Samir
@ 2024-09-17 14:59 ` Chris Lew
2024-09-17 17:25 ` Youssef Samir
2024-09-24 9:02 ` patchwork-bot+netdevbpf
1 sibling, 1 reply; 5+ messages in thread
From: Chris Lew @ 2024-09-17 14:59 UTC (permalink / raw)
To: Youssef Samir, mani, davem, edumazet, kuba, pabeni, andersson
Cc: quic_jhugo, linux-arm-msm, netdev, linux-kernel, Carl Vanderlip
Hi Youssef,
On 9/16/2024 10:08 AM, Youssef Samir wrote:
> When broadcasting data to multiple nodes via MHI, using skb_clone()
> causes all nodes to receive the same header data. This can result in
> packets being discarded by endpoints, leading to lost data.
>
> This issue occurs when a socket is closed, and a QRTR_TYPE_DEL_CLIENT
> packet is broadcasted. All nodes receive the same destination node ID,
> causing the node connected to the client to discard the packet and
> remain unaware of the client's deletion.
>
I guess this never happens for the SMD/RPMSG transport because the skb
is consumed within the context of qrtr_node_enqueue where as MHI queues
the skb to be transmitted later.
Does the duplicate destination node ID match the last node in the
qrtr_all_nodes list?
> Replace skb_clone() with pskb_copy(), to create a separate copy of
> the header for each sk_buff.
>
> Fixes: bdabad3e363d ("net: Add Qualcomm IPC router")
> Signed-off-by: Youssef Samir <quic_yabdulra@quicinc.com>
> Reviewed-by: Jeffery Hugo <quic_jhugo@quicinc.com>
> Reviewed-by: Carl Vanderlip <quic_carlv@quicinc.com>
> ---
> net/qrtr/af_qrtr.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/qrtr/af_qrtr.c b/net/qrtr/af_qrtr.c
> index 41ece61eb57a..00c51cf693f3 100644
> --- a/net/qrtr/af_qrtr.c
> +++ b/net/qrtr/af_qrtr.c
> @@ -884,7 +884,7 @@ static int qrtr_bcast_enqueue(struct qrtr_node *node, struct sk_buff *skb,
>
> mutex_lock(&qrtr_node_lock);
> list_for_each_entry(node, &qrtr_all_nodes, item) {
> - skbn = skb_clone(skb, GFP_KERNEL);
> + skbn = pskb_copy(skb, GFP_KERNEL);
> if (!skbn)
> break;
> skb_set_owner_w(skbn, skb->sk);
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] net: qrtr: Update packets cloning when broadcasting
2024-09-17 14:59 ` Chris Lew
@ 2024-09-17 17:25 ` Youssef Samir
2024-09-19 13:35 ` Chris Lew
0 siblings, 1 reply; 5+ messages in thread
From: Youssef Samir @ 2024-09-17 17:25 UTC (permalink / raw)
To: Chris Lew, mani, davem, edumazet, kuba, pabeni, andersson
Cc: quic_jhugo, linux-arm-msm, netdev, linux-kernel, Carl Vanderlip
Hi Chris,
On 9/17/2024 3:59 PM, Chris Lew wrote:
> Hi Youssef,
>
> On 9/16/2024 10:08 AM, Youssef Samir wrote:
>> When broadcasting data to multiple nodes via MHI, using skb_clone()
>> causes all nodes to receive the same header data. This can result in
>> packets being discarded by endpoints, leading to lost data.
>>
>> This issue occurs when a socket is closed, and a QRTR_TYPE_DEL_CLIENT
>> packet is broadcasted. All nodes receive the same destination node ID,
>> causing the node connected to the client to discard the packet and
>> remain unaware of the client's deletion.
>>
>
> I guess this never happens for the SMD/RPMSG transport because the skb is consumed within the context of qrtr_node_enqueue where as MHI queues the skb to be transmitted later.
>
> Does the duplicate destination node ID match the last node in the qrtr_all_nodes list?
Yes, it always matches the last node in the qrtr_all_nodes list.
>
>
>> Replace skb_clone() with pskb_copy(), to create a separate copy of
>> the header for each sk_buff.
>>
>> Fixes: bdabad3e363d ("net: Add Qualcomm IPC router")
>> Signed-off-by: Youssef Samir <quic_yabdulra@quicinc.com>
>> Reviewed-by: Jeffery Hugo <quic_jhugo@quicinc.com>
>> Reviewed-by: Carl Vanderlip <quic_carlv@quicinc.com>
>> ---
>> net/qrtr/af_qrtr.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/net/qrtr/af_qrtr.c b/net/qrtr/af_qrtr.c
>> index 41ece61eb57a..00c51cf693f3 100644
>> --- a/net/qrtr/af_qrtr.c
>> +++ b/net/qrtr/af_qrtr.c
>> @@ -884,7 +884,7 @@ static int qrtr_bcast_enqueue(struct qrtr_node *node, struct sk_buff *skb,
>> mutex_lock(&qrtr_node_lock);
>> list_for_each_entry(node, &qrtr_all_nodes, item) {
>> - skbn = skb_clone(skb, GFP_KERNEL);
>> + skbn = pskb_copy(skb, GFP_KERNEL);
>> if (!skbn)
>> break;
>> skb_set_owner_w(skbn, skb->sk);
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] net: qrtr: Update packets cloning when broadcasting
2024-09-17 17:25 ` Youssef Samir
@ 2024-09-19 13:35 ` Chris Lew
0 siblings, 0 replies; 5+ messages in thread
From: Chris Lew @ 2024-09-19 13:35 UTC (permalink / raw)
To: Youssef Samir, mani, davem, edumazet, kuba, pabeni, andersson
Cc: quic_jhugo, linux-arm-msm, netdev, linux-kernel, Carl Vanderlip
On 9/17/2024 10:25 AM, Youssef Samir wrote:
> Hi Chris,
>
> On 9/17/2024 3:59 PM, Chris Lew wrote:
>> Hi Youssef,
>>
>> On 9/16/2024 10:08 AM, Youssef Samir wrote:
>>> When broadcasting data to multiple nodes via MHI, using skb_clone()
>>> causes all nodes to receive the same header data. This can result in
>>> packets being discarded by endpoints, leading to lost data.
>>>
>>> This issue occurs when a socket is closed, and a QRTR_TYPE_DEL_CLIENT
>>> packet is broadcasted. All nodes receive the same destination node ID,
>>> causing the node connected to the client to discard the packet and
>>> remain unaware of the client's deletion.
>>>
>>
>> I guess this never happens for the SMD/RPMSG transport because the skb is consumed within the context of qrtr_node_enqueue where as MHI queues the skb to be transmitted later.
>>
>> Does the duplicate destination node ID match the last node in the qrtr_all_nodes list?
>
> Yes, it always matches the last node in the qrtr_all_nodes list.
>
Thanks for the confirmation, we haven't seen this before since most of
our platforms usually only use one MHI qrtr node.
Reviewed-by: Chris Lew <quic_clew@quicinc.com>
>>
>>
>>> Replace skb_clone() with pskb_copy(), to create a separate copy of
>>> the header for each sk_buff.
>>>
>>> Fixes: bdabad3e363d ("net: Add Qualcomm IPC router")
>>> Signed-off-by: Youssef Samir <quic_yabdulra@quicinc.com>
>>> Reviewed-by: Jeffery Hugo <quic_jhugo@quicinc.com>
>>> Reviewed-by: Carl Vanderlip <quic_carlv@quicinc.com>
>>> ---
>>> net/qrtr/af_qrtr.c | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/net/qrtr/af_qrtr.c b/net/qrtr/af_qrtr.c
>>> index 41ece61eb57a..00c51cf693f3 100644
>>> --- a/net/qrtr/af_qrtr.c
>>> +++ b/net/qrtr/af_qrtr.c
>>> @@ -884,7 +884,7 @@ static int qrtr_bcast_enqueue(struct qrtr_node *node, struct sk_buff *skb,
>>> mutex_lock(&qrtr_node_lock);
>>> list_for_each_entry(node, &qrtr_all_nodes, item) {
>>> - skbn = skb_clone(skb, GFP_KERNEL);
>>> + skbn = pskb_copy(skb, GFP_KERNEL);
>>> if (!skbn)
>>> break;
>>> skb_set_owner_w(skbn, skb->sk);
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] net: qrtr: Update packets cloning when broadcasting
2024-09-16 17:08 [PATCH] net: qrtr: Update packets cloning when broadcasting Youssef Samir
2024-09-17 14:59 ` Chris Lew
@ 2024-09-24 9:02 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-09-24 9:02 UTC (permalink / raw)
To: Youssef Samir
Cc: mani, davem, edumazet, kuba, pabeni, andersson, quic_clew,
quic_jhugo, linux-arm-msm, netdev, linux-kernel, quic_carlv
Hello:
This patch was applied to netdev/net.git (main)
by Paolo Abeni <pabeni@redhat.com>:
On Mon, 16 Sep 2024 19:08:58 +0200 you wrote:
> When broadcasting data to multiple nodes via MHI, using skb_clone()
> causes all nodes to receive the same header data. This can result in
> packets being discarded by endpoints, leading to lost data.
>
> This issue occurs when a socket is closed, and a QRTR_TYPE_DEL_CLIENT
> packet is broadcasted. All nodes receive the same destination node ID,
> causing the node connected to the client to discard the packet and
> remain unaware of the client's deletion.
>
> [...]
Here is the summary with links:
- net: qrtr: Update packets cloning when broadcasting
https://git.kernel.org/netdev/net/c/f011b313e8eb
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] 5+ messages in thread
end of thread, other threads:[~2024-09-24 9:02 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-16 17:08 [PATCH] net: qrtr: Update packets cloning when broadcasting Youssef Samir
2024-09-17 14:59 ` Chris Lew
2024-09-17 17:25 ` Youssef Samir
2024-09-19 13:35 ` Chris Lew
2024-09-24 9:02 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox