Fix null pointer deref
cover Fix null pointer deref
From: Alexander Grund <[email protected]>
The patch
"can: sun4i_can: sun4i_can_err(): call can_change_state() even if cf is NULL" assumes the following patch which isn't applied yet to cip-4.4
Marc Kleine-Budde (1):
can: dev: make can_change_state() robust to be called with cf == NULL
drivers/net/can/dev.c | 3 +++ 1 file changed, 3 insertions(+)
Signature · 1 line
2.40.1
PATCH 1/1 can: dev: make can_change_state() robust to be called with cf == NULL
From: Marc Kleine-Budde <[email protected]>
In OOM situations where no skb can be allocated, can_change_state() may be called with cf == NULL. As this function updates the state and error statistics it's not an option to skip the call to can_change_state() in OOM situations.
This patch makes can_change_state() robust, so that it can be called with cf == NULL.
--- drivers/net/can/dev.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/can/dev.c +3 -0
@@ -341,6 +341,9 @@ void can_change_state(struct net_device *dev, struct can_frame *cf,can_update_state_error_stats (dev, new_state); priv->state = new_state; +if (!cf) +return ; +if (unlikely (new_state ==CAN_STATE_BUS_OFF )) { cf->can_id |=CAN_ERR_BUSOFF ;return ;
Signature · 1 line
2.40.1
Quoted 7 lines · CET Alexander Grund
The patch
"can:sun4i_can:sun4i_can_err(): callcan_change_state()even if cf is NULL" assumes the following patch which isn't applied yet to cip-4.4Marc Kleine-Budde (1):
can: dev: makecan_change_state()robust to be called with cf == NULL
Picked it, thanks!
CU
Uli