linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] can: usb: delete a redundant dev_kfree_skb() in ems_usb_start_xmit()
@ 2022-02-28  8:36 Hangyu Hua
  2022-02-28  8:55 ` Marc Kleine-Budde
  0 siblings, 1 reply; 6+ messages in thread
From: Hangyu Hua @ 2022-02-28  8:36 UTC (permalink / raw)
  To: wg, mkl, davem, kuba, stefan.maetje, mailhol.vincent, paskripkin
  Cc: linux-can, netdev, linux-kernel, Hangyu Hua

There is no need to call dev_kfree_skb when usb_submit_urb fails beacause
can_put_echo_skb deletes original skb and can_free_echo_skb deletes the cloned
skb.

Signed-off-by: Hangyu Hua <hbh25y@gmail.com>
---
 drivers/net/can/usb/ems_usb.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/net/can/usb/ems_usb.c b/drivers/net/can/usb/ems_usb.c
index 7bedceffdfa3..bbec3311d893 100644
--- a/drivers/net/can/usb/ems_usb.c
+++ b/drivers/net/can/usb/ems_usb.c
@@ -819,7 +819,6 @@ static netdev_tx_t ems_usb_start_xmit(struct sk_buff *skb, struct net_device *ne
 
 		usb_unanchor_urb(urb);
 		usb_free_coherent(dev->udev, size, buf, urb->transfer_dma);
-		dev_kfree_skb(skb);
 
 		atomic_dec(&dev->active_tx_urbs);
 
-- 
2.25.1


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

* Re: [PATCH] can: usb: delete a redundant dev_kfree_skb() in ems_usb_start_xmit()
  2022-02-28  8:36 [PATCH] can: usb: delete a redundant dev_kfree_skb() in ems_usb_start_xmit() Hangyu Hua
@ 2022-02-28  8:55 ` Marc Kleine-Budde
  2022-02-28 10:44   ` Hangyu Hua
  0 siblings, 1 reply; 6+ messages in thread
From: Marc Kleine-Budde @ 2022-02-28  8:55 UTC (permalink / raw)
  To: Hangyu Hua
  Cc: wg, davem, kuba, stefan.maetje, mailhol.vincent, paskripkin,
	linux-can, netdev, linux-kernel

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

On 28.02.2022 16:36:39, Hangyu Hua wrote:
> There is no need to call dev_kfree_skb when usb_submit_urb fails beacause
> can_put_echo_skb deletes original skb and can_free_echo_skb deletes the cloned
> skb.
> 
> Signed-off-by: Hangyu Hua <hbh25y@gmail.com>

Thanks for the patch. Please add a Fixes tag, that points to the commit
that introduced the problem, here it's:

Fixes: 702171adeed3 ("ems_usb: Added support for EMS CPC-USB/ARM7 CAN/USB interface")

I've adjusted the subject a bit ("can: usb: ems_usb_start_xmit(): fix
double dev_kfree_skb() in error path") and added stable on Cc.

Added patch to can/testing.

regards,
Marc

-- 
Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH] can: usb: delete a redundant dev_kfree_skb() in ems_usb_start_xmit()
  2022-02-28  8:55 ` Marc Kleine-Budde
@ 2022-02-28 10:44   ` Hangyu Hua
  2022-02-28 10:45     ` Marc Kleine-Budde
  0 siblings, 1 reply; 6+ messages in thread
From: Hangyu Hua @ 2022-02-28 10:44 UTC (permalink / raw)
  To: Marc Kleine-Budde
  Cc: wg, davem, kuba, stefan.maetje, mailhol.vincent, paskripkin,
	linux-can, netdev, linux-kernel

I get it. I'll remake a patch that matches your suggestions.

Thanks.

On 2022/2/28 16:55, Marc Kleine-Budde wrote:
> On 28.02.2022 16:36:39, Hangyu Hua wrote:
>> There is no need to call dev_kfree_skb when usb_submit_urb fails beacause
>> can_put_echo_skb deletes original skb and can_free_echo_skb deletes the cloned
>> skb.
>>
>> Signed-off-by: Hangyu Hua <hbh25y@gmail.com>
> 
> Thanks for the patch. Please add a Fixes tag, that points to the commit
> that introduced the problem, here it's:
> 
> Fixes: 702171adeed3 ("ems_usb: Added support for EMS CPC-USB/ARM7 CAN/USB interface")
> 
> I've adjusted the subject a bit ("can: usb: ems_usb_start_xmit(): fix
> double dev_kfree_skb() in error path") and added stable on Cc.
> 
> Added patch to can/testing.
> 
> regards,
> Marc
> 

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

* Re: [PATCH] can: usb: delete a redundant dev_kfree_skb() in ems_usb_start_xmit()
  2022-02-28 10:44   ` Hangyu Hua
@ 2022-02-28 10:45     ` Marc Kleine-Budde
  2022-02-28 10:47       ` Hangyu Hua
  0 siblings, 1 reply; 6+ messages in thread
From: Marc Kleine-Budde @ 2022-02-28 10:45 UTC (permalink / raw)
  To: Hangyu Hua
  Cc: wg, davem, kuba, stefan.maetje, mailhol.vincent, paskripkin,
	linux-can, netdev, linux-kernel

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

On 28.02.2022 18:44:06, Hangyu Hua wrote:
> I get it. I'll remake a patch that matches your suggestions.

Not needed, it's already applied:
> > Added patch to can/testing.

Marc

-- 
Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH] can: usb: delete a redundant dev_kfree_skb() in ems_usb_start_xmit()
  2022-02-28 10:45     ` Marc Kleine-Budde
@ 2022-02-28 10:47       ` Hangyu Hua
  2022-03-11  8:22         ` Hangyu Hua
  0 siblings, 1 reply; 6+ messages in thread
From: Hangyu Hua @ 2022-02-28 10:47 UTC (permalink / raw)
  To: Marc Kleine-Budde
  Cc: wg, davem, kuba, stefan.maetje, mailhol.vincent, paskripkin,
	linux-can, netdev, linux-kernel

All right. :)

On 2022/2/28 18:45, Marc Kleine-Budde wrote:
> On 28.02.2022 18:44:06, Hangyu Hua wrote:
>> I get it. I'll remake a patch that matches your suggestions.
> 
> Not needed, it's already applied:
>>> Added patch to can/testing.
> 
> Marc
> 

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

* Re: [PATCH] can: usb: delete a redundant dev_kfree_skb() in ems_usb_start_xmit()
  2022-02-28 10:47       ` Hangyu Hua
@ 2022-03-11  8:22         ` Hangyu Hua
  0 siblings, 0 replies; 6+ messages in thread
From: Hangyu Hua @ 2022-03-11  8:22 UTC (permalink / raw)
  To: Marc Kleine-Budde
  Cc: wg, davem, kuba, stefan.maetje, mailhol.vincent, paskripkin,
	linux-can, netdev, linux-kernel

Hi Marc,

I didn't find this("can: usb: ems_usb_start_xmit(): fix double 
dev_kfree_skb() in error path") in can/testing. Did I miss it or did you 
forget to submit it?

Anyway, i find this problem also exists in two other places. You can 
check them in:
mcba_usb:
https://lore.kernel.org/all/20220311080208.45047-1-hbh25y@gmail.com/
usb_8dev:
https://lore.kernel.org/all/20220311080614.45229-1-hbh25y@gmail.com/

Thanks,
Hangyu


On 2022/2/28 18:47, Hangyu Hua wrote:
> All right. :)
> 
> On 2022/2/28 18:45, Marc Kleine-Budde wrote:
>> On 28.02.2022 18:44:06, Hangyu Hua wrote:
>>> I get it. I'll remake a patch that matches your suggestions.
>>
>> Not needed, it's already applied:
>>>> Added patch to can/testing.
>>
>> Marc
>>

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

end of thread, other threads:[~2022-03-11  8:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-28  8:36 [PATCH] can: usb: delete a redundant dev_kfree_skb() in ems_usb_start_xmit() Hangyu Hua
2022-02-28  8:55 ` Marc Kleine-Budde
2022-02-28 10:44   ` Hangyu Hua
2022-02-28 10:45     ` Marc Kleine-Budde
2022-02-28 10:47       ` Hangyu Hua
2022-03-11  8:22         ` Hangyu Hua

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