mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
can: skb: make CAN skb allocation failure paths IRQ-safe
The CAN skb allocation helpers are used from hardware interrupt receive
handlers. If can_skb_ext_add() fails, they release the newly allocated skb
with kfree_skb(), which is not safe in hardware interrupt context.
Use dev_kfree_skb_any() for the allocation failure paths in
alloc_can_skb(), alloc_canfd_skb(), and alloc_canxl_skb().
Fixes: 96ea3a1e2d ("can: add CAN skb extension infrastructure")
Signed-off-by: Cunhao Lu <1579567540@qq.com>
Link: https://patch.msgid.link/tencent_C825C17D442F801351CE2FBC4984064B4605@qq.com
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
This commit is contained in:
parent
d743071964
commit
d4b616a381
|
|
@ -228,7 +228,7 @@ struct sk_buff *alloc_can_skb(struct net_device *dev, struct can_frame **cf)
|
|||
|
||||
csx = can_skb_ext_add(skb);
|
||||
if (!csx) {
|
||||
kfree_skb(skb);
|
||||
dev_kfree_skb_any(skb);
|
||||
goto out_error_cc;
|
||||
}
|
||||
|
||||
|
|
@ -259,7 +259,7 @@ struct sk_buff *alloc_canfd_skb(struct net_device *dev,
|
|||
|
||||
csx = can_skb_ext_add(skb);
|
||||
if (!csx) {
|
||||
kfree_skb(skb);
|
||||
dev_kfree_skb_any(skb);
|
||||
goto out_error_fd;
|
||||
}
|
||||
|
||||
|
|
@ -297,7 +297,7 @@ struct sk_buff *alloc_canxl_skb(struct net_device *dev,
|
|||
|
||||
csx = can_skb_ext_add(skb);
|
||||
if (!csx) {
|
||||
kfree_skb(skb);
|
||||
dev_kfree_skb_any(skb);
|
||||
goto out_error_xl;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user