Patch "net: ravb: Fix dma_addr_t truncation in error case" has been added to the 4.19-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    net: ravb: Fix dma_addr_t truncation in error case

to the 4.19-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     net-ravb-fix-dma_addr_t-truncation-in-error-case.patch
and it can be found in the queue-4.19 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 36e3561cec035a469d0423dbd2f3f59444f9b957
Author: Nikita Yushchenko <nikita.yoush@xxxxxxxxxxxxxxxxxx>
Date:   Sat Jan 13 10:22:21 2024 +0600

    net: ravb: Fix dma_addr_t truncation in error case
    
    [ Upstream commit e327b2372bc0f18c30433ac40be07741b59231c5 ]
    
    In ravb_start_xmit(), ravb driver uses u32 variable to store result of
    dma_map_single() call. Since ravb hardware has 32-bit address fields in
    descriptors, this works properly when mapping is successful - it is
    platform's job to provide mapping addresses that fit into hardware
    limitations.
    
    However, in failure case dma_map_single() returns DMA_MAPPING_ERROR
    constant that is 64-bit when dma_addr_t is 64-bit. Storing this constant
    in u32 leads to truncation, and further call to dma_mapping_error()
    fails to notice the error.
    
    Fix that by storing result of dma_map_single() in a dma_addr_t
    variable.
    
    Fixes: c156633f1353 ("Renesas Ethernet AVB driver proper")
    Signed-off-by: Nikita Yushchenko <nikita.yoush@xxxxxxxxxxxxxxxxxx>
    Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@xxxxxxxxxxxx>
    Reviewed-by: Sergey Shtylyov <s.shtylyov@xxxxxx>
    Reviewed-by: Florian Fainelli <florian.fainelli@xxxxxxxxxxxx>
    Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index d70c82c926ea..3cfcc9e3c35d 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -1508,7 +1508,7 @@ static netdev_tx_t ravb_start_xmit(struct sk_buff *skb, struct net_device *ndev)
 	struct ravb_tstamp_skb *ts_skb;
 	struct ravb_tx_desc *desc;
 	unsigned long flags;
-	u32 dma_addr;
+	dma_addr_t dma_addr;
 	void *buffer;
 	u32 entry;
 	u32 len;




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux