FAILED: patch "[PATCH] can: m_can: m_can_tx_handler(): fix use after free of skb" failed to apply to 5.4-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 5.4-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 2e8e79c416aae1de224c0f1860f2e3350fa171f8 Mon Sep 17 00:00:00 2001
From: Marc Kleine-Budde <[email protected]>
Date: Thu, 17 Mar 2022 08:57:35 +0100
Subject: [PATCH] can: m_can: m_can_tx_handler(): fix use after free of skb
can_put_echo_skb() will clone skb then free the skb. Move the can_put_echo_skb() for the m_can version 3.0.x directly before the start of the xmit in hardware, similar to the 3.1.x branch.
drivers/net/can/m_can/m_can.c +3 -2
@@ -1637,8 +1637,6 @@ static netdev_tx_t m_can_tx_handler(struct m_can_classdev *cdev)if (err) goto out_fail; -can_put_echo_skb (skb, dev,0 ,0 ); -if (cdev->can.ctrlmode &CAN_CTRLMODE_FD ) { cccr =m_can_read (cdev,M_CAN_CCCR ); cccr &= ~CCCR_CMR_MASK ;
@@ -1655,6 +1653,9 @@ static netdev_tx_t m_can_tx_handler(struct m_can_classdev *cdev)m_can_write (cdev,M_CAN_CCCR , cccr); }m_can_write (cdev,M_CAN_TXBTIE ,0x1 ); + +can_put_echo_skb (skb, dev,0 ,0 ); +m_can_write (cdev,M_CAN_TXBAR ,0x1 );/* End of xmit function for version 3.0.x */ }else {
Hi Greg,
Quoted 5 lines · On Fri, Apr 01, 2022 at 02:02:18PM +0200, [email protected] wrote:
The patch below does not apply to the 5.4-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
Here is the backport.
--
Regards
Sudip
From 05d0fcb7b35198251c27d5ba1f2be4debf782753 Mon Sep 17 00:00:00 2001
From: Marc Kleine-Budde <[email protected]>
Date: Thu, 17 Mar 2022 08:57:35 +0100
Subject: [PATCH] can: m_can: m_can_tx_handler(): fix use after free of skb
commit 2e8e79c416aae1de224c0f1860f2e3350fa171f8 upstream.
can_put_echo_skb() will clone skb then free the skb. Move the can_put_echo_skb() for the m_can version 3.0.x directly before the start of the xmit in hardware, similar to the 3.1.x branch.
--- drivers/net/can/m_can/m_can.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/can/m_can/m_can.c +3 -2
@@ -1443,8 +1443,6 @@ static netdev_tx_t m_can_tx_handler(struct m_can_classdev *cdev)M_CAN_FIFO_DATA (i /4 ), *(u32 *)(cf->data + i)); -can_put_echo_skb (skb, dev,0 ); -if (cdev->can.ctrlmode &CAN_CTRLMODE_FD ) { cccr =m_can_read (cdev,M_CAN_CCCR ); cccr &= ~(CCCR_CMR_MASK <<CCCR_CMR_SHIFT );
@@ -1461,6 +1459,9 @@ static netdev_tx_t m_can_tx_handler(struct m_can_classdev *cdev)m_can_write (cdev,M_CAN_CCCR , cccr); }m_can_write (cdev,M_CAN_TXBTIE ,0x1 ); + +can_put_echo_skb (skb, dev,0 ); +m_can_write (cdev,M_CAN_TXBAR ,0x1 );/* End of xmit function for version 3.0.x */ }else {
Signature · 1 line
2.30.2
Greg KH
maintainerQuoted 10 lines · Sudip Mukherjee
Hi Greg,
Quoted 5 lines · On Fri, Apr 01, 2022 at 02:02:18PM +0200, [email protected] wrote:
The patch below does not apply to the 5.4-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.Here is the backport.
all now queued up, thanks.
greg k-h