diff mbox series

can: usb: delete a redundant dev_kfree_skb() in ems_usb_start_xmit()

Message ID 20220228083639.38183-1-hbh25y@gmail.com (mailing list archive)
State Awaiting Upstream
Delegated to: Netdev Maintainers
Headers show
Series can: usb: delete a redundant dev_kfree_skb() in ems_usb_start_xmit() | expand

Checks

Context Check Description
netdev/tree_selection success Series ignored based on subject

Commit Message

Hangyu Hua Feb. 28, 2022, 8:36 a.m. UTC
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(-)

Comments

Marc Kleine-Budde Feb. 28, 2022, 8:55 a.m. UTC | #1
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
Hangyu Hua Feb. 28, 2022, 10:44 a.m. UTC | #2
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
>
Marc Kleine-Budde Feb. 28, 2022, 10:45 a.m. UTC | #3
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
Hangyu Hua Feb. 28, 2022, 10:47 a.m. UTC | #4
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
>
Hangyu Hua March 11, 2022, 8:22 a.m. UTC | #5
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
>>
diff mbox series

Patch

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