5.4.301-rc1 review
Subsystems (4)
Greg Kroah-Hartman
maintainerPATCH 157/224 media: pci: ivtv: Add missing check after DMA map
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Fourier <[email protected]>
[ Upstream commit 1069a4fe637d0e3e4c163e3f8df9be306cc299b4 ]
The DMA map functions can fail and should be tested for errors. If the mapping fails, free blanking_ptr and set it to 0. As 0 is a valid DMA address, use blanking_ptr to test if the DMA address is set.
--- drivers/media/pci/ivtv/ivtv-irq.c | 2 +- drivers/media/pci/ivtv/ivtv-yuv.c | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-)
drivers/media/pci/ivtv/ivtv-irq.c +1 -1
@@ -351,7 +351,7 @@ void ivtv_dma_stream_dec_prepare(struct/* Insert buffer block for YUV if needed */ if (s->type ==IVTV_DEC_STREAM_TYPE_YUV && f->offset_y) { -if (yi->blanking_dmaptr) { +if (yi->blanking_ptr) { s->sg_pending[idx].src = yi->blanking_dmaptr; s->sg_pending[idx].dst = offset; s->sg_pending[idx].size =720 *16 ;
drivers/media/pci/ivtv/ivtv-yuv.c +7 -1
@@ -125,7 +125,7 @@ static int ivtv_yuv_prep_user_dma(structivtv_udma_fill_sg_array (dma, y_buffer_offset, uv_buffer_offset, y_size);/* If we've offset the y plane, ensure top area is blanked */ -if (f->offset_y && yi->blanking_dmaptr) { +if (f->offset_y && yi->blanking_ptr) { dma->SGarray[dma->SG_length].size =cpu_to_le32 (720 *16 ); dma->SGarray[dma->SG_length].src =cpu_to_le32 (yi->blanking_dmaptr); dma->SGarray[dma->SG_length].dst =cpu_to_le32 (IVTV_DECODER_OFFSET + yuv_offset[frame]);
@@ -929,6 +929,12 @@ static void ivtv_yuv_init(struct ivtv *i yi->blanking_dmaptr =dma_map_single (&itv->pdev->dev, yi->blanking_ptr,720 *16 ,DMA_TO_DEVICE ); +if (dma_mapping_error (&itv->pdev->dev, yi->blanking_dmaptr)) { +kfree (yi->blanking_ptr); + yi->blanking_ptr =NULL ; + yi->blanking_dmaptr =0 ; +IVTV_DEBUG_WARN ("Failed to dma_map yuv blanking buffer\n" ); + } }else { yi->blanking_dmaptr =0 ;IVTV_DEBUG_WARN ("Failed to allocate yuv blanking buffer\n" );
Greg Kroah-Hartman
maintainerPATCH 158/224 net: dl2k: switch from pci_ to dma_ API
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christophe JAILLET <[email protected]>
[ Upstream commit b49db89e9697ddfa7fbe7387e176072ee2feb2db ]
The wrappers in include/linux/pci-dma-compat.h should go away.
The patch has been generated with the coccinelle script below and has been hand modified to replace GFP_ with a correct flag.
It has been compile tested.
When memory is allocated in 'rio_probe1()' GFP_KERNEL can be used because it is a probe function and no lock is taken in the between.
@@
@@
- PCI_DMA_BIDIRECTIONAL
+ DMA_BIDIRECTIONAL
@@
@@
- PCI_DMA_TODEVICE
+ DMA_TO_DEVICE
@@
@@
- PCI_DMA_FROMDEVICE
+ DMA_FROM_DEVICE
@@
@@
- PCI_DMA_NONE
+ DMA_NONE
@@
expression e1, e2, e3;
@@
- pci_alloc_consistent(e1, e2, e3)
+ dma_alloc_coherent(&e1->dev, e2, e3, GFP_)
@@
expression e1, e2, e3;
@@
- pci_zalloc_consistent(e1, e2, e3)
+ dma_alloc_coherent(&e1->dev, e2, e3, GFP_)
@@
expression e1, e2, e3, e4;
@@
- pci_free_consistent(e1, e2, e3, e4)
+ dma_free_coherent(&e1->dev, e2, e3, e4)
@@
expression e1, e2, e3, e4;
@@
- pci_map_single(e1, e2, e3, e4)
+ dma_map_single(&e1->dev, e2, e3, e4)
@@
expression e1, e2, e3, e4;
@@
- pci_unmap_single(e1, e2, e3, e4)
+ dma_unmap_single(&e1->dev, e2, e3, e4)
@@
expression e1, e2, e3, e4, e5;
@@
- pci_map_page(e1, e2, e3, e4, e5)
+ dma_map_page(&e1->dev, e2, e3, e4, e5)
@@
expression e1, e2, e3, e4;
@@
- pci_unmap_page(e1, e2, e3, e4)
+ dma_unmap_page(&e1->dev, e2, e3, e4)
@@
expression e1, e2, e3, e4;
@@
- pci_map_sg(e1, e2, e3, e4)
+ dma_map_sg(&e1->dev, e2, e3, e4)
@@
expression e1, e2, e3, e4;
@@
- pci_unmap_sg(e1, e2, e3, e4)
+ dma_unmap_sg(&e1->dev, e2, e3, e4)
@@
expression e1, e2, e3, e4;
@@
- pci_dma_sync_single_for_cpu(e1, e2, e3, e4)
+ dma_sync_single_for_cpu(&e1->dev, e2, e3, e4)
@@
expression e1, e2, e3, e4;
@@
- pci_dma_sync_single_for_device(e1, e2, e3, e4)
+ dma_sync_single_for_device(&e1->dev, e2, e3, e4)
@@
expression e1, e2, e3, e4;
@@
- pci_dma_sync_sg_for_cpu(e1, e2, e3, e4)
+ dma_sync_sg_for_cpu(&e1->dev, e2, e3, e4)
@@
expression e1, e2, e3, e4;
@@
- pci_dma_sync_sg_for_device(e1, e2, e3, e4)
+ dma_sync_sg_for_device(&e1->dev, e2, e3, e4)
@@
expression e1, e2;
@@
- pci_dma_mapping_error(e1, e2)
+ dma_mapping_error(&e1->dev, e2)
@@
expression e1, e2;
@@
- pci_set_dma_mask(e1, e2)
+ dma_set_mask(&e1->dev, e2)
@@
expression e1, e2;
@@
- pci_set_consistent_dma_mask(e1, e2)
+ dma_set_coherent_mask(&e1->dev, e2)
Stable-dep-of: 65946eac6d88 ("net: dlink: handle dma_map_single() failure properly")
--- drivers/net/ethernet/dlink/dl2k.c | 80 ++++++++++++++++--------------- 1 file changed, 41 insertions(+), 39 deletions(-)
drivers/net/ethernet/dlink/dl2k.c +41 -39
@@ -233,13 +233,15 @@ rio_probe1 (struct pci_dev *pdev, const struct pci_device_id *ent)pci_set_drvdata (pdev, dev); - ring_space =pci_alloc_consistent (pdev,TX_TOTAL_SIZE , &ring_dma); + ring_space =dma_alloc_coherent (&pdev->dev,TX_TOTAL_SIZE , &ring_dma, +GFP_KERNEL );if (!ring_space) goto err_out_iounmap; np->tx_ring = ring_space; np->tx_ring_dma = ring_dma; - ring_space =pci_alloc_consistent (pdev,RX_TOTAL_SIZE , &ring_dma); + ring_space =dma_alloc_coherent (&pdev->dev,RX_TOTAL_SIZE , &ring_dma, +GFP_KERNEL );if (!ring_space) goto err_out_unmap_tx; np->rx_ring = ring_space;
@@ -290,9 +292,11 @@ rio_probe1 (struct pci_dev *pdev, const struct pci_device_id *ent)return 0 ; err_out_unmap_rx: -pci_free_consistent (pdev,RX_TOTAL_SIZE , np->rx_ring, np->rx_ring_dma); +dma_free_coherent (&pdev->dev,RX_TOTAL_SIZE , np->rx_ring, + np->rx_ring_dma); err_out_unmap_tx: -pci_free_consistent (pdev,TX_TOTAL_SIZE , np->tx_ring, np->tx_ring_dma); +dma_free_coherent (&pdev->dev,TX_TOTAL_SIZE , np->tx_ring, + np->tx_ring_dma); err_out_iounmap:#ifdef MEM_MAPPING pci_iounmap (pdev, np->ioaddr);
@@ -446,8 +450,9 @@ static void free_list(struct net_device *dev)for (i =0 ; i <RX_RING_SIZE ; i++) { skb = np->rx_skbuff[i];if (skb) { -pci_unmap_single (np->pdev,desc_to_dma (&np->rx_ring[i]), - skb->len,PCI_DMA_FROMDEVICE ); +dma_unmap_single (&np->pdev->dev, +desc_to_dma (&np->rx_ring[i]), + skb->len,DMA_FROM_DEVICE );dev_kfree_skb (skb); np->rx_skbuff[i] =NULL ; }
@@ -457,8 +462,9 @@ static void free_list(struct net_device *dev)for (i =0 ; i <TX_RING_SIZE ; i++) { skb = np->tx_skbuff[i];if (skb) { -pci_unmap_single (np->pdev,desc_to_dma (&np->tx_ring[i]), - skb->len,PCI_DMA_TODEVICE ); +dma_unmap_single (&np->pdev->dev, +desc_to_dma (&np->tx_ring[i]), + skb->len,DMA_TO_DEVICE );dev_kfree_skb (skb); np->tx_skbuff[i] =NULL ; }
@@ -515,9 +521,8 @@ static int alloc_list(struct net_device *dev) sizeof(struct netdev_desc));/* Rubicon now supports 40 bits of addressing space. */ np->rx_ring[i].fraginfo = -cpu_to_le64 (pci_map_single ( - np->pdev, skb->data, np->rx_buf_sz, -PCI_DMA_FROMDEVICE )); +cpu_to_le64 (dma_map_single (&np->pdev->dev, skb->data, + np->rx_buf_sz,DMA_FROM_DEVICE )); np->rx_ring[i].fraginfo |=cpu_to_le64 ((u64 )np->rx_buf_sz <<48 ); }
@@ -683,9 +688,8 @@ rio_timer (struct timer_list *t) } np->rx_skbuff[entry] = skb; np->rx_ring[entry].fraginfo = -cpu_to_le64 (pci_map_single - (np->pdev, skb->data, np->rx_buf_sz, -PCI_DMA_FROMDEVICE )); +cpu_to_le64 (dma_map_single (&np->pdev->dev, skb->data, + np->rx_buf_sz,DMA_FROM_DEVICE )); } np->rx_ring[entry].fraginfo |=cpu_to_le64 ((u64 )np->rx_buf_sz <<48 );
@@ -739,9 +743,8 @@ start_xmit (struct sk_buff *skb, struct net_device *dev) ((u64 )np->vlan <<32 ) | ((u64 )skb->priority <<45 ); } - txdesc->fraginfo =cpu_to_le64 (pci_map_single (np->pdev, skb->data, - skb->len, -PCI_DMA_TODEVICE )); + txdesc->fraginfo =cpu_to_le64 (dma_map_single (&np->pdev->dev, skb->data, + skb->len,DMA_TO_DEVICE )); txdesc->fraginfo |=cpu_to_le64 ((u64 )skb->len <<48 );/* DL2K bug: DMA fails to get next descriptor ptr in 10Mbps mode
@@ -838,9 +841,9 @@ rio_free_tx (struct net_device *dev, int irq)if (!(np->tx_ring[entry].status &cpu_to_le64 (TFDDone)))break ; skb = np->tx_skbuff[entry]; -pci_unmap_single (np->pdev, -desc_to_dma (&np->tx_ring[entry]), - skb->len,PCI_DMA_TODEVICE ); +dma_unmap_single (&np->pdev->dev, +desc_to_dma (&np->tx_ring[entry]), skb->len, +DMA_TO_DEVICE );if (irq)dev_consume_skb_irq (skb);else
@@ -965,25 +968,25 @@ receive_packet (struct net_device *dev)/* Small skbuffs for short packets */ if (pkt_len > copy_thresh) { -pci_unmap_single (np->pdev, -desc_to_dma (desc), - np->rx_buf_sz, -PCI_DMA_FROMDEVICE ); +dma_unmap_single (&np->pdev->dev, +desc_to_dma (desc), + np->rx_buf_sz, +DMA_FROM_DEVICE );skb_put (skb = np->rx_skbuff[entry], pkt_len); np->rx_skbuff[entry] =NULL ; }else if ((skb =netdev_alloc_skb_ip_align (dev, pkt_len))) { -pci_dma_sync_single_for_cpu (np->pdev, -desc_to_dma (desc), - np->rx_buf_sz, -PCI_DMA_FROMDEVICE ); +dma_sync_single_for_cpu (&np->pdev->dev, +desc_to_dma (desc), + np->rx_buf_sz, +DMA_FROM_DEVICE );skb_copy_to_linear_data (skb, np->rx_skbuff[entry]->data, pkt_len);skb_put (skb, pkt_len); -pci_dma_sync_single_for_device (np->pdev, -desc_to_dma (desc), - np->rx_buf_sz, -PCI_DMA_FROMDEVICE ); +dma_sync_single_for_device (&np->pdev->dev, +desc_to_dma (desc), + np->rx_buf_sz, +DMA_FROM_DEVICE ); } skb->protocol =eth_type_trans (skb, dev);#if 0
@@ -1016,9 +1019,8 @@ receive_packet (struct net_device *dev) } np->rx_skbuff[entry] = skb; np->rx_ring[entry].fraginfo = -cpu_to_le64 (pci_map_single - (np->pdev, skb->data, np->rx_buf_sz, -PCI_DMA_FROMDEVICE )); +cpu_to_le64 (dma_map_single (&np->pdev->dev, skb->data, + np->rx_buf_sz,DMA_FROM_DEVICE )); } np->rx_ring[entry].fraginfo |=cpu_to_le64 ((u64 )np->rx_buf_sz <<48 );
@@ -1818,10 +1820,10 @@ rio_remove1 (struct pci_dev *pdev)struct netdev_private *np =netdev_priv (dev);unregister_netdev (dev); -pci_free_consistent (pdev,RX_TOTAL_SIZE , np->rx_ring, - np->rx_ring_dma); -pci_free_consistent (pdev,TX_TOTAL_SIZE , np->tx_ring, - np->tx_ring_dma); +dma_free_coherent (&pdev->dev,RX_TOTAL_SIZE , np->rx_ring, + np->rx_ring_dma); +dma_free_coherent (&pdev->dev,TX_TOTAL_SIZE , np->tx_ring, + np->tx_ring_dma);#ifdef MEM_MAPPING pci_iounmap (pdev, np->ioaddr);#endif
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 159/224 net: dlink: handle dma_map_single() failure properly
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yeounsu Moon <[email protected]>
[ Upstream commit 65946eac6d888d50ae527c4e5c237dbe5cc3a2f2 ]
There is no error handling for dma_map_single() failures.
Add error handling by checking dma_mapping_error() and freeing the skb using dev_kfree_skb() (process context) when it fails.
Tested-on: D-Link DGE-550T Rev-A3
--- drivers/net/ethernet/dlink/dl2k.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-)
drivers/net/ethernet/dlink/dl2k.c +16 -7
@@ -508,25 +508,34 @@ static int alloc_list(struct net_device *dev)for (i =0 ; i <RX_RING_SIZE ; i++) {/* Allocated fixed size of skbuff */ struct sk_buff *skb; +dma_addr_t addr; skb =netdev_alloc_skb_ip_align (dev, np->rx_buf_sz); np->rx_skbuff[i] = skb; -if (!skb) { -free_list (dev); -return -ENOMEM ; - } +if (!skb) + goto err_free_list; + + addr =dma_map_single (&np->pdev->dev, skb->data, + np->rx_buf_sz,DMA_FROM_DEVICE ); +if (dma_mapping_error (&np->pdev->dev, addr)) + goto err_kfree_skb; np->rx_ring[i].next_desc =cpu_to_le64 (np->rx_ring_dma + ((i +1 ) %RX_RING_SIZE ) *sizeof (struct netdev_desc ));/* Rubicon now supports 40 bits of addressing space. */ - np->rx_ring[i].fraginfo = -cpu_to_le64 (dma_map_single (&np->pdev->dev, skb->data, - np->rx_buf_sz,DMA_FROM_DEVICE )); + np->rx_ring[i].fraginfo =cpu_to_le64 (addr); np->rx_ring[i].fraginfo |=cpu_to_le64 ((u64 )np->rx_buf_sz <<48 ); }return 0 ; + +err_kfree_skb: +dev_kfree_skb (np->rx_skbuff[i]); + np->rx_skbuff[i] =NULL ; +err_free_list: +free_list (dev); +return -ENOMEM ; }static void rio_hw_init (struct net_device *dev)
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 160/224 net/ip6_tunnel: Prevent perpetual tunnel growth
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Safonov <[email protected]>
[ Upstream commit 21f4d45eba0b2dcae5dbc9e5e0ad08735c993f16 ]
Similarly to ipv4 tunnel, ipv6 version updates dev->needed_headroom, too. While ipv4 tunnel headroom adjustment growth was limited in commit 5ae1e9922bbd ("net: ip_tunnel: prevent perpetual headroom growth"), ipv6 tunnel yet increases the headroom without any ceiling.
Reflect ipv4 tunnel headroom adjustment limit on ipv6 version.
Credits to Francesco Ruggeri, who was originally debugging this issue and wrote local Arista-specific patch and a reproducer.
--- include/net/ip_tunnels.h | 15 +++++++++++++++ net/ipv4/ip_tunnel.c | 14 -------------- net/ipv6/ip6_tunnel.c | 3 +-- 3 files changed, 16 insertions(+), 16 deletions(-)
include/net/ip_tunnels.h +15 -0
@@ -454,6 +454,21 @@ void iptunnel_xmit(struct sock *sk, struct rtable *rt, struct sk_buff *skb,struct metadata_dst *iptunnel_metadata_reply (struct metadata_dst *md,gfp_t flags); +static inline void ip_tunnel_adj_headroom (struct net_device *dev, +unsigned int headroom) +{ +/* we must cap headroom to some upperlimit, else pskb_expand_head +* will overflow header offsets in skb_headers_offset_update(). +*/ +const unsigned int max_allowed =512 ; + +if (headroom > max_allowed) + headroom = max_allowed; + +if (headroom >READ_ONCE (dev->needed_headroom)) +WRITE_ONCE (dev->needed_headroom, headroom); +} +int iptunnel_handle_offloads (struct sk_buff *skb,int gso_type_mask);static inline int iptunnel_pull_offloads (struct sk_buff *skb)
net/ipv4/ip_tunnel.c +0 -14
@@ -560,20 +560,6 @@ static int tnl_update_pmtu(struct net_device *dev, struct sk_buff *skb,return 0 ; } -static void ip_tunnel_adj_headroom (struct net_device *dev,unsigned int headroom) -{ -/* we must cap headroom to some upperlimit, else pskb_expand_head -* will overflow header offsets in skb_headers_offset_update(). -*/ -static const unsigned int max_allowed =512 ; - -if (headroom > max_allowed) - headroom = max_allowed; - -if (headroom >READ_ONCE (dev->needed_headroom)) -WRITE_ONCE (dev->needed_headroom, headroom); -} -void ip_md_tunnel_xmit (struct sk_buff *skb,struct net_device *dev,u8 proto,int tunnel_hlen) {
net/ipv6/ip6_tunnel.c +1 -2
@@ -1201,8 +1201,7 @@ int ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev, __u8 dsfield,*/ max_headroom =LL_RESERVED_SPACE (dst->dev) +sizeof (struct ipv6hdr ) + dst->header_len + t->hlen; -if (max_headroom >READ_ONCE (dev->needed_headroom)) -WRITE_ONCE (dev->needed_headroom, max_headroom); +ip_tunnel_adj_headroom (dev, max_headroom); err =ip6_tnl_encap (skb, t, &proto, fl6);if (err)
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 161/224 amd-xgbe: Avoid spurious link down messages during interface toggle
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Raju Rangoju <[email protected]>
[ Upstream commit 2616222e423398bb374ffcb5d23dea4ba2c3e524 ]
During interface toggle operations (ifdown/ifup), the driver currently resets the local helper variable 'phy_link' to -1. This causes the link state machine to incorrectly interpret the state as a link change event, resulting in spurious "Link is down" messages being logged when the interface is brought back up.
Preserve the phy_link state across interface toggles to avoid treating the -1 sentinel value as a legitimate link state transition.
--- drivers/net/ethernet/amd/xgbe/xgbe-drv.c | 1 - drivers/net/ethernet/amd/xgbe/xgbe-mdio.c | 1 + 2 files changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/amd/xgbe/xgbe-drv.c +0 -1
@@ -1247,7 +1247,6 @@ static void xgbe_free_rx_data(struct xgbe_prv_data *pdata)static int xgbe_phy_reset (struct xgbe_prv_data *pdata) { - pdata->phy_link =-1 ; pdata->phy_speed =SPEED_UNKNOWN ;return pdata->phy_if.phy_reset (pdata);
drivers/net/ethernet/amd/xgbe/xgbe-mdio.c +1 -0
@@ -1637,6 +1637,7 @@ static int xgbe_phy_init(struct xgbe_prv_data *pdata) pdata->phy.duplex =DUPLEX_FULL ; } + pdata->phy_link =0 ; pdata->phy.link =0 ; pdata->phy.pause_autoneg = pdata->pause_autoneg;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 162/224 tcp: fix tcp_tso_should_defer() vs large RTT
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 295ce1eb36ae47dc862d6c8a1012618a25516208 ]
Neal reported that using neper tcp_stream with TCP_TX_DELAY set to 50ms would often lead to flows stuck in a small cwnd mode, regardless of the congestion control.
While tcp_stream sets TCP_TX_DELAY too late after the connect(), it highlighted two kernel bugs.
The following heuristic in tcp_tso_should_defer() seems wrong for large RTT:
delta = tp->tcp_clock_cache - head->tstamp;
/* If next ACK is likely to come too late (half srtt), do not defer */ if ((s64)(delta - (u64)NSEC_PER_USEC * (tp->srtt_us >> 4)) < 0)
goto send_now;
If next ACK is expected to come in more than 1 ms, we should not defer because we prefer a smooth ACK clocking.
While blamed commit was a step in the good direction, it was not generic enough.
Another patch fixing TCP_TX_DELAY for established flows will be proposed when net-next reopens.
--- net/ipv4/tcp_output.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-)
net/ipv4/tcp_output.c +15 -4
@@ -1952,7 +1952,8 @@ static bool tcp_tso_should_defer(struct sock *sk, struct sk_buff *skb, u32 max_segs) {const struct inet_connection_sock *icsk =inet_csk (sk); -u32 send_win, cong_win, limit, in_flight; +u32 send_win, cong_win, limit, in_flight, threshold; +u64 srtt_in_ns, expected_ack, how_far_is_the_ack;struct tcp_sock *tp =tcp_sk (sk);struct sk_buff *head;int win_divisor;
@@ -2014,9 +2015,19 @@ static bool tcp_tso_should_defer(struct sock *sk, struct sk_buff *skb, head =tcp_rtx_queue_head (sk);if (!head) goto send_now; - delta = tp->tcp_clock_cache - head->tstamp; -/* If next ACK is likely to come too late (half srtt), do not defer */ -if ((s64)(delta - (u64 )NSEC_PER_USEC * (tp->srtt_us >>4 )) <0 ) + + srtt_in_ns = (u64)(NSEC_PER_USEC >>3 ) * tp->srtt_us; +/* When is the ACK expected ? */ + expected_ack = head->tstamp + srtt_in_ns; +/* How far from now is the ACK expected ? */ + how_far_is_the_ack = expected_ack - tp->tcp_clock_cache; + +/* If next ACK is likely to come too late, +* ie in more than min(1ms, half srtt), do not defer. +*/ + threshold =min (srtt_in_ns >>1 ,NSEC_PER_MSEC ); + +if ((s64)(how_far_is_the_ack - threshold) >0 ) goto send_now;/* Ok, it looks like it is advisable to defer.
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 163/224 tg3: prevent use of uninitialized remote_adv and local_adv variables
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexey Simakov <[email protected]>
[ Upstream commit 0c3f2e62815a43628e748b1e4ad97a1c46cce703 ]
Some execution paths that jump to the fiber_setup_done label could leave the remote_adv and local_adv variables uninitialized and then use it.
Initialize this variables at the point of definition to avoid this.
--- drivers/net/ethernet/broadcom/tg3.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/net/ethernet/broadcom/tg3.c +1 -4
@@ -5827,7 +5827,7 @@ static int tg3_setup_fiber_mii_phy(struct tg3 *tp, bool force_reset)u32 current_speed =SPEED_UNKNOWN ;u8 current_duplex =DUPLEX_UNKNOWN ;bool current_link_up = false; -u32 local_adv, remote_adv, sgsr; +u32 local_adv =0 , remote_adv =0 , sgsr; if ((tg3_asic_rev(tp) == ASIC_REV_5719 || tg3_asic_rev(tp) == ASIC_REV_5720) &&
@@ -5968,9 +5968,6 @@ static int tg3_setup_fiber_mii_phy(struct tg3 *tp, bool force_reset)else current_duplex =DUPLEX_HALF ; - local_adv =0 ; - remote_adv =0 ; -if (bmcr &BMCR_ANENABLE ) {u32 common;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 164/224 tls: always set record_type in tls_process_cmsg
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sabrina Dubroca <[email protected]>
[ Upstream commit b6fe4c29bb51cf239ecf48eacf72b924565cb619 ]
When userspace wants to send a non-DATA record (via the TLS_SET_RECORD_TYPE cmsg), we need to send any pending data from a previous MSG_MORE send() as a separate DATA record. If that DATA record is encrypted asynchronously, tls_handle_open_record will return -EINPROGRESS. This is currently treated as an error by tls_process_cmsg, and it will skip setting record_type to the correct value, but the caller (tls_sw_sendmsg_locked) handles that return value correctly and proceeds with sending the new message with an incorrect record_type (DATA instead of whatever was requested in the cmsg).
Always set record_type before handling the open record. If tls_handle_open_record returns an error, record_type will be ignored. If it succeeds, whether with synchronous crypto (returning 0) or asynchronous (returning -EINPROGRESS), the caller will proceed correctly.
--- net/tls/tls_main.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
net/tls/tls_main.c +2 -5
@@ -181,12 +181,9 @@ int tls_proccess_cmsg(struct sock *sk, struct msghdr *msg,if (msg->msg_flags &MSG_MORE )return -EINVAL ; - rc =tls_handle_open_record (sk, msg->msg_flags); -if (rc) -return rc; - *record_type = *(unsigned char *)CMSG_DATA (cmsg); - rc =0 ; + + rc =tls_handle_open_record (sk, msg->msg_flags);break ;default :return -EINVAL ;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 165/224 tls: dont rely on tx_work during send()
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sabrina Dubroca <[email protected]>
[ Upstream commit 7f846c65ca11e63d2409868ff039081f80e42ae4 ]
With async crypto, we rely on tx_work to actually transmit records once encryption completes. But while send() is running, both the tx_lock and socket lock are held, so tx_work_handler cannot process the queue of encrypted records, and simply reschedules itself. During a large send(), this could last a long time, and use a lot of memory.
Transmit any pending encrypted records before restarting the main loop of tls_sw_sendmsg_locked.
--- net/tls/tls_sw.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
net/tls/tls_sw.c +13 -0
@@ -1052,6 +1052,13 @@ int tls_sw_sendmsg(struct sock *sk, struct msghdr *msg, size_t size)else if (ret != -EAGAIN ) goto send_end; } + +/* Transmit if any encryptions have completed */ +if (test_and_clear_bit (BIT_TX_SCHEDULED , &ctx->tx_bitmask)) { +cancel_delayed_work (&ctx->tx_work.work); +tls_tx_records (sk, msg->msg_flags); + } +continue ; rollback_iter: copied -= try_to_copy;
@@ -1106,6 +1113,12 @@ int tls_sw_sendmsg(struct sock *sk, struct msghdr *msg, size_t size) goto send_end; } } + +/* Transmit if any encryptions have completed */ +if (test_and_clear_bit (BIT_TX_SCHEDULED , &ctx->tx_bitmask)) { +cancel_delayed_work (&ctx->tx_work.work); +tls_tx_records (sk, msg->msg_flags); + } }continue ;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 166/224 sched: Make newidle_balance() static again
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen Yu <[email protected]>
[ Upstream commit d91cecc156620ec75d94c55369509c807c3d07e6 ]
After Commit 6e2df0581f56 ("sched: Fix pick_next_task() vs 'change' pattern race"), there is no need to expose newidle_balance() as it is only used within fair.c file. Change this function back to static again.
No functional change.
Stable-dep-of: 17e3e88ed0b6 ("sched/fair: Fix pelt lost idle time detection")
--- kernel/sched/fair.c | 6 ++++-- kernel/sched/sched.h | 4 ---- 2 files changed, 4 insertions(+), 6 deletions(-)
kernel/sched/fair.c +4 -2
@@ -3690,6 +3690,8 @@ static inline unsigned long cfs_rq_load_avg(struct cfs_rq *cfs_rq)return cfs_rq->avg.load_avg; } +static int newidle_balance (struct rq *this_rq,struct rq_flags *rf); +static inline unsigned long task_util (struct task_struct *p) {return READ_ONCE (p->se.avg.util_avg);
@@ -3849,7 +3851,7 @@ attach_entity_load_avg(struct cfs_rq *cfs_rq, struct sched_entity *se, int flagsstatic inline void detach_entity_load_avg (struct cfs_rq *cfs_rq,struct sched_entity *se) {} -static inline int idle_balance (struct rq *rq,struct rq_flags *rf) +static inline int newidle_balance (struct rq *rq,struct rq_flags *rf) {return 0 ; }
@@ -9898,7 +9900,7 @@ static inline void nohz_newidle_balance(struct rq *this_rq) { }* idle_balance is called by schedule() if this_cpu is about to become * idle. Attempts to pull tasks from other CPUs. */ -int newidle_balance (struct rq *this_rq,struct rq_flags *rf) +static int newidle_balance (struct rq *this_rq,struct rq_flags *rf) {unsigned long next_balance = jiffies +HZ ;int this_cpu = this_rq->cpu;
kernel/sched/sched.h +0 -4
@@ -1464,14 +1464,10 @@ static inline void unregister_sched_domain_sysctl(void) }#endif -extern int newidle_balance (struct rq *this_rq,struct rq_flags *rf); -#else static inline void sched_ttwu_pending (void ) { } -static inline int newidle_balance (struct rq *this_rq,struct rq_flags *rf) {return 0 ; } -#endif /* CONFIG_SMP */ #include "stats.h"
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 167/224 sched/fair: Trivial correction of the newidle_balance() comment
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Barry Song <[email protected]>
[ Upstream commit 5b78f2dc315354c05300795064f587366a02c6ff ]
idle_balance() has been renamed to newidle_balance(). To differentiate with nohz_idle_balance, it seems refining the comment will be helpful for the readers of the code.
Stable-dep-of: 17e3e88ed0b6 ("sched/fair: Fix pelt lost idle time detection")
--- kernel/sched/fair.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/fair.c +1 -1
@@ -9897,7 +9897,7 @@ static inline void nohz_newidle_balance(struct rq *this_rq) { }#endif /* CONFIG_NO_HZ_COMMON */ /* -* idle_balance is called by schedule() if this_cpu is about to become +* newidle_balance is called by schedule() if this_cpu is about to become * idle. Attempts to pull tasks from other CPUs. */ static int newidle_balance (struct rq *this_rq,struct rq_flags *rf)
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 168/224 sched/balancing: Rename newidle_balance() => sched_balance_newidle()
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ingo Molnar <[email protected]>
[ Upstream commit 7d058285cd77cc1411c91efd1b1673530bb1bee8 ]
Standardize scheduler load-balancing function names on the sched_balance_() prefix.
Stable-dep-of: 17e3e88ed0b6 ("sched/fair: Fix pelt lost idle time detection")
--- kernel/sched/fair.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
kernel/sched/fair.c +8 -8
@@ -3690,7 +3690,7 @@ static inline unsigned long cfs_rq_load_avg(struct cfs_rq *cfs_rq)return cfs_rq->avg.load_avg; } -static int newidle_balance (struct rq *this_rq,struct rq_flags *rf); +static int sched_balance_newidle (struct rq *this_rq,struct rq_flags *rf);static inline unsigned long task_util (struct task_struct *p) {
@@ -3851,7 +3851,7 @@ attach_entity_load_avg(struct cfs_rq *cfs_rq, struct sched_entity *se, int flagsstatic inline void detach_entity_load_avg (struct cfs_rq *cfs_rq,struct sched_entity *se) {} -static inline int newidle_balance (struct rq *rq,struct rq_flags *rf) +static inline int sched_balance_newidle (struct rq *rq,struct rq_flags *rf) {return 0 ; }
@@ -6690,7 +6690,7 @@ balance_fair(struct rq *rq, struct task_struct *prev, struct rq_flags *rf)if (rq->nr_running)return 1 ; - return newidle_balance(rq, rf) != 0; + return sched_balance_newidle(rq, rf) != 0; }#endif /* CONFIG_SMP */
@@ -6981,10 +6981,10 @@ done: __maybe_unused;if (!rf)return NULL ; - new_tasks =newidle_balance (rq, rf); + new_tasks =sched_balance_newidle (rq, rf);/* -* Because newidle_balance() releases (and re-acquires) rq->lock, it is +* Because sched_balance_newidle() releases (and re-acquires) rq->lock, it is * possible for any higher priority task to appear. In that case we * must re-start the pick_next_entity() loop. */
@@ -9182,7 +9182,7 @@ static int load_balance(int this_cpu, struct rq *this_rq, ld_moved =0 ;/* -* newidle_balance() disregards balance intervals, so we could +* sched_balance_newidle() disregards balance intervals, so we could * repeatedly reach this code, which would lead to balance_interval * skyrocketting in a short amount of time. Skip the balance_interval * increase logic to avoid that.
@@ -9897,10 +9897,10 @@ static inline void nohz_newidle_balance(struct rq *this_rq) { }#endif /* CONFIG_NO_HZ_COMMON */ /* -* newidle_balance is called by schedule() if this_cpu is about to become +* sched_balance_newidle is called by schedule() if this_cpu is about to become * idle. Attempts to pull tasks from other CPUs. */ -static int newidle_balance (struct rq *this_rq,struct rq_flags *rf) +static int sched_balance_newidle (struct rq *this_rq,struct rq_flags *rf) {unsigned long next_balance = jiffies +HZ ;int this_cpu = this_rq->cpu;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 169/224 sched/fair: Fix pelt lost idle time detection
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vincent Guittot <[email protected]>
[ Upstream commit 17e3e88ed0b6318fde0d1c14df1a804711cab1b5 ]
The check for some lost idle pelt time should be always done when pick_next_task_fair() fails to pick a task and not only when we call it from the fair fast-path.
The case happens when the last running task on rq is a RT or DL task. When the latter goes to sleep and the /Sum of util_sum of the rq is at the max value, we don't account the lost of idle time whereas we should.
--- kernel/sched/fair.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-)
kernel/sched/fair.c +13 -13
@@ -6978,21 +6978,21 @@ done: __maybe_unused;return p; idle: -if (!rf) -return NULL ; - - new_tasks =sched_balance_newidle (rq, rf); +if (rf) { + new_tasks =sched_balance_newidle (rq, rf); -/* -* Because sched_balance_newidle() releases (and re-acquires) rq->lock, it is -* possible for any higher priority task to appear. In that case we -* must re-start the pick_next_entity() loop. -*/ -if (new_tasks <0 ) -return RETRY_TASK ; +/* +* Because sched_balance_newidle() releases (and re-acquires) +* rq->lock, it is possible for any higher priority task to +* appear. In that case we must re-start the pick_next_entity() +* loop. +*/ +if (new_tasks <0 ) +return RETRY_TASK ; -if (new_tasks >0 ) - goto again; +if (new_tasks >0 ) + goto again; + }/* * rq is about to be idle, check if we need to update the
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 170/224 ALSA: firewire: amdtp-stream: fix enum kernel-doc warnings
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Randy Dunlap <[email protected]>
[ Upstream commit d41f68dff783d181a8fd462e612bda0fbab7f735 ]
Fix spelling of CIP_NO_HEADER to prevent a kernel-doc warning.
Warning: amdtp-stream.h:57 Enum value 'CIP_NO_HEADER' not described in enum 'cip_flags'
Warning: amdtp-stream.h:57 Excess enum value '%CIP_NO_HEADERS' description in 'cip_flags'
--- sound/firewire/amdtp-stream.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/firewire/amdtp-stream.h +1 -1
@@ -32,7 +32,7 @@* allows 5 times as large as IEC 61883-6 defines. * @CIP_HEADER_WITHOUT_EOH: Only for in-stream. CIP Header doesn't include * valid EOH. -* @CIP_NO_HEADERS: a lack of headers in packets +* @CIP_NO_HEADER: a lack of headers in packets * @CIP_UNALIGHED_DBC: Only for in-stream. The value of dbc is not alighed to * the value of current SYT_INTERVAL; e.g. initial value is not zero. */
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 171/224 hfsplus: fix slab-out-of-bounds read in hfsplus_strcasecmp()
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Viacheslav Dubeyko <[email protected]>
commit 42520df65bf67189541a425f7d36b0b3e7bd7844 upstream.
The hfsplus_strcasecmp() logic can trigger the issue:
[ 117.317703][ T9855] ================================================================== [ 117.318353][ T9855] BUG: KASAN: slab-out-of-bounds in hfsplus_strcasecmp+0x1bc/0x490 [ 117.318991][ T9855] Read of size 2 at addr ffff88802160f40c by task repro/9855 [ 117.319577][ T9855] [ 117.319773][ T9855] CPU: 0 UID: 0 PID: 9855 Comm: repro Not tainted 6.17.0-rc6 #33 PREEMPT(full) [ 117.319780][ T9855] Hardware name: QEMU Ubuntu 24.04 PC (i440FX + PIIX, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 [ 117.319783][ T9855] Call Trace: [ 117.319785][ T9855] <TASK> [ 117.319788][ T9855] dump_stack_lvl+0x1c1/0x2a0 [ 117.319795][ T9855] ? __virt_addr_valid+0x1c8/0x5c0 [ 117.319803][ T9855] ? __pfx_dump_stack_lvl+0x10/0x10 [ 117.319808][ T9855] ? rcu_is_watching+0x15/0xb0 [ 117.319816][ T9855] ? lock_release+0x4b/0x3e0 [ 117.319821][ T9855] ? __kasan_check_byte+0x12/0x40 [ 117.319828][ T9855] ? __virt_addr_valid+0x1c8/0x5c0 [ 117.319835][ T9855] ? __virt_addr_valid+0x4a5/0x5c0 [ 117.319842][ T9855] print_report+0x17e/0x7e0 [ 117.319848][ T9855] ? __virt_addr_valid+0x1c8/0x5c0 [ 117.319855][ T9855] ? __virt_addr_valid+0x4a5/0x5c0 [ 117.319862][ T9855] ? __phys_addr+0xd3/0x180 [ 117.319869][ T9855] ? hfsplus_strcasecmp+0x1bc/0x490 [ 117.319876][ T9855] kasan_report+0x147/0x180 [ 117.319882][ T9855] ? hfsplus_strcasecmp+0x1bc/0x490 [ 117.319891][ T9855] hfsplus_strcasecmp+0x1bc/0x490 [ 117.319900][ T9855] ? __pfx_hfsplus_cat_case_cmp_key+0x10/0x10 [ 117.319906][ T9855] hfs_find_rec_by_key+0xa9/0x1e0 [ 117.319913][ T9855] __hfsplus_brec_find+0x18e/0x470 [ 117.319920][ T9855] ? __pfx_hfsplus_bnode_find+0x10/0x10 [ 117.319926][ T9855] ? __pfx_hfs_find_rec_by_key+0x10/0x10 [ 117.319933][ T9855] ? __pfx___hfsplus_brec_find+0x10/0x10 [ 117.319942][ T9855] hfsplus_brec_find+0x28f/0x510 [ 117.319949][ T9855] ? __pfx_hfs_find_rec_by_key+0x10/0x10 [ 117.319956][ T9855] ? __pfx_hfsplus_brec_find+0x10/0x10 [ 117.319963][ T9855] ? __kmalloc_noprof+0x2a9/0x510 [ 117.319969][ T9855] ? hfsplus_find_init+0x8c/0x1d0 [ 117.319976][ T9855] hfsplus_brec_read+0x2b/0x120 [ 117.319983][ T9855] hfsplus_lookup+0x2aa/0x890 [ 117.319990][ T9855] ? __pfx_hfsplus_lookup+0x10/0x10 [ 117.320003][ T9855] ? d_alloc_parallel+0x2f0/0x15e0 [ 117.320008][ T9855] ? __lock_acquire+0xaec/0xd80 [ 117.320013][ T9855] ? __pfx_d_alloc_parallel+0x10/0x10 [ 117.320019][ T9855] ? __raw_spin_lock_init+0x45/0x100 [ 117.320026][ T9855] ? __init_waitqueue_head+0xa9/0x150 [ 117.320034][ T9855] __lookup_slow+0x297/0x3d0 [ 117.320039][ T9855] ? __pfx___lookup_slow+0x10/0x10 [ 117.320045][ T9855] ? down_read+0x1ad/0x2e0 [ 117.320055][ T9855] lookup_slow+0x53/0x70 [ 117.320065][ T9855] walk_component+0x2f0/0x430 [ 117.320073][ T9855] path_lookupat+0x169/0x440 [ 117.320081][ T9855] filename_lookup+0x212/0x590 [ 117.320089][ T9855] ? __pfx_filename_lookup+0x10/0x10 [ 117.320098][ T9855] ? strncpy_from_user+0x150/0x290 [ 117.320105][ T9855] ? getname_flags+0x1e5/0x540 [ 117.320112][ T9855] user_path_at+0x3a/0x60 [ 117.320117][ T9855] __x64_sys_umount+0xee/0x160 [ 117.320123][ T9855] ? __pfx___x64_sys_umount+0x10/0x10 [ 117.320129][ T9855] ? do_syscall_64+0xb7/0x3a0 [ 117.320135][ T9855] ? entry_SYSCALL_64_after_hwframe+0x77/0x7f [ 117.320141][ T9855] ? entry_SYSCALL_64_after_hwframe+0x77/0x7f [ 117.320145][ T9855] do_syscall_64+0xf3/0x3a0 [ 117.320150][ T9855] ? exc_page_fault+0x9f/0xf0 [ 117.320154][ T9855] entry_SYSCALL_64_after_hwframe+0x77/0x7f [ 117.320158][ T9855] RIP: 0033:0x7f7dd7908b07 [ 117.320163][ T9855] Code: 23 0d 00 f7 d8 64 89 01 48 83 c8 ff c3 66 0f 1f 44 00 00 31 f6 e9 09 00 00 00 66 0f 1f 84 00 00 08 [ 117.320167][ T9855] RSP: 002b:00007ffd5ebd9698 EFLAGS: 00000202 ORIG_RAX: 00000000000000a6 [ 117.320172][ T9855] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f7dd7908b07 [ 117.320176][ T9855] RDX: 0000000000000009 RSI: 0000000000000009 RDI: 00007ffd5ebd9740 [ 117.320179][ T9855] RBP: 00007ffd5ebda780 R08: 0000000000000005 R09: 00007ffd5ebd9530 [ 117.320181][ T9855] R10: 00007f7dd799bfc0 R11: 0000000000000202 R12: 000055e2008b32d0 [ 117.320184][ T9855] R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 [ 117.320189][ T9855] </TASK> [ 117.320190][ T9855] [ 117.351311][ T9855] Allocated by task 9855: [ 117.351683][ T9855] kasan_save_track+0x3e/0x80 [ 117.352093][ T9855] __kasan_kmalloc+0x8d/0xa0 [ 117.352490][ T9855] __kmalloc_noprof+0x288/0x510 [ 117.352914][ T9855] hfsplus_find_init+0x8c/0x1d0 [ 117.353342][ T9855] hfsplus_lookup+0x19c/0x890 [ 117.353747][ T9855] __lookup_slow+0x297/0x3d0 [ 117.354148][ T9855] lookup_slow+0x53/0x70 [ 117.354514][ T9855] walk_component+0x2f0/0x430 [ 117.354921][ T9855] path_lookupat+0x169/0x440 [ 117.355325][ T9855] filename_lookup+0x212/0x590 [ 117.355740][ T9855] user_path_at+0x3a/0x60 [ 117.356115][ T9855] __x64_sys_umount+0xee/0x160 [ 117.356529][ T9855] do_syscall_64+0xf3/0x3a0 [ 117.356920][ T9855] entry_SYSCALL_64_after_hwframe+0x77/0x7f [ 117.357429][ T9855] [ 117.357636][ T9855] The buggy address belongs to the object at ffff88802160f000 [ 117.357636][ T9855] which belongs to the cache kmalloc-2k of size 2048 [ 117.358827][ T9855] The buggy address is located 0 bytes to the right of [ 117.358827][ T9855] allocated 1036-byte region [ffff88802160f000, ffff88802160f40c) [ 117.360061][ T9855] [ 117.360266][ T9855] The buggy address belongs to the physical page: [ 117.360813][ T9855] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x21608 [ 117.361562][ T9855] head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 [ 117.362285][ T9855] flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff) [ 117.362929][ T9855] page_type: f5(slab) [ 117.363282][ T9855] raw: 00fff00000000040 ffff88801a842f00 ffffea0000932000 dead000000000002 [ 117.364015][ T9855] raw: 0000000000000000 0000000080080008 00000000f5000000 0000000000000000 [ 117.364750][ T9855] head: 00fff00000000040 ffff88801a842f00 ffffea0000932000 dead000000000002 [ 117.365491][ T9855] head: 0000000000000000 0000000080080008 00000000f5000000 0000000000000000 [ 117.366232][ T9855] head: 00fff00000000003 ffffea0000858201 00000000ffffffff 00000000ffffffff [ 117.366968][ T9855] head: ffffffffffffffff 0000000000000000 00000000ffffffff 0000000000000008 [ 117.367711][ T9855] page dumped because: kasan: bad access detected [ 117.368259][ T9855] page_owner tracks the page as allocated [ 117.368745][ T9855] page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN1 [ 117.370541][ T9855] post_alloc_hook+0x240/0x2a0 [ 117.370954][ T9855] get_page_from_freelist+0x2101/0x21e0 [ 117.371435][ T9855] __alloc_frozen_pages_noprof+0x274/0x380 [ 117.371935][ T9855] alloc_pages_mpol+0x241/0x4b0 [ 117.372360][ T9855] allocate_slab+0x8d/0x380 [ 117.372752][ T9855] ___slab_alloc+0xbe3/0x1400 [ 117.373159][ T9855] __kmalloc_cache_noprof+0x296/0x3d0 [ 117.373621][ T9855] nexthop_net_init+0x75/0x100 [ 117.374038][ T9855] ops_init+0x35c/0x5c0 [ 117.374400][ T9855] setup_net+0x10c/0x320 [ 117.374768][ T9855] copy_net_ns+0x31b/0x4d0 [ 117.375156][ T9855] create_new_namespaces+0x3f3/0x720 [ 117.375613][ T9855] unshare_nsproxy_namespaces+0x11c/0x170 [ 117.376094][ T9855] ksys_unshare+0x4ca/0x8d0 [ 117.376477][ T9855] __x64_sys_unshare+0x38/0x50 [ 117.376879][ T9855] do_syscall_64+0xf3/0x3a0 [ 117.377265][ T9855] page last free pid 9110 tgid 9110 stack trace: [ 117.377795][ T9855] __free_frozen_pages+0xbeb/0xd50 [ 117.378229][ T9855] __put_partials+0x152/0x1a0 [ 117.378625][ T9855] put_cpu_partial+0x17c/0x250 [ 117.379026][ T9855] __slab_free+0x2d4/0x3c0 [ 117.379404][ T9855] qlist_free_all+0x97/0x140 [ 117.379790][ T9855] kasan_quarantine_reduce+0x148/0x160 [ 117.380250][ T9855] __kasan_slab_alloc+0x22/0x80 [ 117.380662][ T9855] __kmalloc_noprof+0x232/0x510 [ 117.381074][ T9855] tomoyo_supervisor+0xc0a/0x1360 [ 117.381498][ T9855] tomoyo_env_perm+0x149/0x1e0 [ 117.381903][ T9855] tomoyo_find_next_domain+0x15ad/0x1b90 [ 117.382378][ T9855] tomoyo_bprm_check_security+0x11c/0x180 [ 117.382859][ T9855] security_bprm_check+0x89/0x280 [ 117.383289][ T9855] bprm_execve+0x8f1/0x14a0 [ 117.383673][ T9855] do_execveat_common+0x528/0x6b0 [ 117.384103][ T9855] __x64_sys_execve+0x94/0xb0 [ 117.384500][ T9855] [ 117.384706][ T9855] Memory state around the buggy address: [ 117.385179][ T9855] ffff88802160f300: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [ 117.385854][ T9855] ffff88802160f380: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [ 117.386534][ T9855] >ffff88802160f400: 00 04 fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ 117.387204][ T9855] ^ [ 117.387566][ T9855] ffff88802160f480: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ 117.388243][ T9855] ffff88802160f500: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ 117.388918][ T9855] ==================================================================
The issue takes place if the length field of struct hfsplus_unistr is bigger than HFSPLUS_MAX_STRLEN. The patch simply checks the length of comparing strings. And if the strings' length is bigger than HFSPLUS_MAX_STRLEN, then it is corrected to this value.
v2
The string length correction has been added for hfsplus_strcmp().
--- fs/hfsplus/unicode.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
fs/hfsplus/unicode.c +24 -0
@@ -40,6 +40,18 @@ int hfsplus_strcasecmp(const struct hfsp p1 = s1->unicode; p2 = s2->unicode; +if (len1 >HFSPLUS_MAX_STRLEN ) { + len1 =HFSPLUS_MAX_STRLEN ; +pr_err ("invalid length %u has been corrected to %d\n" , +be16_to_cpu (s1->length), len1); + } + +if (len2 >HFSPLUS_MAX_STRLEN ) { + len2 =HFSPLUS_MAX_STRLEN ; +pr_err ("invalid length %u has been corrected to %d\n" , +be16_to_cpu (s2->length), len2); + } +while (1 ) { c1 = c2 =0 ;
@@ -74,6 +86,18 @@ int hfsplus_strcmp(const struct hfsplus_ p1 = s1->unicode; p2 = s2->unicode; +if (len1 >HFSPLUS_MAX_STRLEN ) { + len1 =HFSPLUS_MAX_STRLEN ; +pr_err ("invalid length %u has been corrected to %d\n" , +be16_to_cpu (s1->length), len1); + } + +if (len2 >HFSPLUS_MAX_STRLEN ) { + len2 =HFSPLUS_MAX_STRLEN ; +pr_err ("invalid length %u has been corrected to %d\n" , +be16_to_cpu (s2->length), len2); + } +for (len =min (len1, len2); len >0 ; len--) { c1 =be16_to_cpu (*p1); c2 =be16_to_cpu (*p2);
Greg Kroah-Hartman
maintainerPATCH 172/224 exec: Fix incorrect type for ret
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xichao Zhao <[email protected]>
[ Upstream commit 5e088248375d171b80c643051e77ade6b97bc386 ]
In the setup_arg_pages(), ret is declared as an unsigned long. The ret might take a negative value. Therefore, its type should be changed to int.
--- fs/exec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/exec.c +1 -1
@@ -701,7 +701,7 @@ int setup_arg_pages(struct linux_binprm *bprm,unsigned long stack_top, int executable_stack) { -unsigned long ret; + int ret;unsigned long stack_shift;struct mm_struct *mm = current->mm;struct vm_area_struct *vma = bprm->vma;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 173/224 hfs: clear offset and space out of valid records in b-tree node
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Viacheslav Dubeyko <[email protected]>
[ Upstream commit 18b07c44f245beb03588b00b212b38fce9af7cc9 ]
Currently, hfs_brec_remove() executes moving records towards the location of deleted record and it updates offsets of moved records. However, the hfs_brec_remove() logic ignores the "mess" of b-tree node's free space and it doesn't touch the offsets out of records number. Potentially, it could confuse fsck or driver logic or to be a reason of potential corruption cases.
This patch reworks the logic of hfs_brec_remove() by means of clearing freed space of b-tree node after the records moving. And it clear the last offset that keeping old location of free space because now the offset before this one is keeping the actual offset to the free space after the record deletion.
--- fs/hfs/brec.c | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-)
fs/hfs/brec.c +23 -4
@@ -179,6 +179,7 @@ int hfs_brec_remove(struct hfs_find_data *fd)struct hfs_btree *tree;struct hfs_bnode *node, *parent;int end_off, rec_off, data_off, size; +int src, dst, len; tree = fd->tree; node = fd->bnode;
@@ -208,10 +209,14 @@ int hfs_brec_remove(struct hfs_find_data *fd) }hfs_bnode_write_u16 (node, offsetof(struct hfs_bnode_desc , num_recs), node->num_recs); -if (rec_off == end_off) - goto skip; size = fd->keylength + fd->entrylength; +if (rec_off == end_off) { + src = fd->keyoffset; +hfs_bnode_clear (node, src, size); + goto skip; + } + do { data_off = hfs_bnode_read_u16(node, rec_off); hfs_bnode_write_u16(node, rec_off + 2, data_off - size);
@@ -219,9 +224,23 @@ int hfs_brec_remove(struct hfs_find_data *fd) }while (rec_off >= end_off);/* fill hole */ -hfs_bnode_move (node, fd->keyoffset, fd->keyoffset + size, - data_off - fd->keyoffset - size); + dst = fd->keyoffset; + src = fd->keyoffset + size; + len = data_off - src; + +hfs_bnode_move (node, dst, src, len); + + src = dst + len; + len = data_off - src; + +hfs_bnode_clear (node, src, len); + skip: +/* +* Remove the obsolete offset to free space. +*/ +hfs_bnode_write_u16 (node, end_off,0 ); +hfs_bnode_dump (node);if (!fd->record)hfs_brec_update_parent (fd);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 174/224 hfs: make proper initalization of struct hfs_find_data
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Viacheslav Dubeyko <[email protected]>
[ Upstream commit c62663a986acee7c4485c1fa9de5fc40194b6290 ]
Potenatially, __hfs_ext_read_extent() could operate by not initialized values of fd->key after hfs_brec_find() call:
static inline int __hfs_ext_read_extent(struct hfs_find_data *fd, struct hfs_extent *extent,
u32 cnid, u32 block, u8 type)
{
int res;
hfs_ext_build_key(fd->search_key, cnid, block, type);
fd->key->ext.FNum = 0;
res = hfs_brec_find(fd);
if (res && res != -ENOENT)
return res;
if (fd->key->ext.FNum != fd->search_key->ext.FNum ||
fd->key->ext.FkType != fd->search_key->ext.FkType)
return -ENOENT;
if (fd->entrylength != sizeof(hfs_extent_rec))
return -EIO;
hfs_bnode_read(fd->bnode, extent, fd->entryoffset, sizeof(hfs_extent_rec));
return 0;
}This patch changes kmalloc() on kzalloc() in hfs_find_init() and intializes fd->record, fd->keyoffset, fd->keylength, fd->entryoffset, fd->entrylength for the case if hfs_brec_find() has been found nothing in the b-tree node.
--- fs/hfs/bfind.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
fs/hfs/bfind.c +7 -1
@@ -18,7 +18,7 @@ int hfs_find_init(struct hfs_btree *tree, struct hfs_find_data *fd) fd->tree = tree; fd->bnode =NULL ; - ptr =kmalloc (tree->max_key_len *2 +4 ,GFP_KERNEL ); + ptr =kzalloc (tree->max_key_len *2 +4 ,GFP_KERNEL );if (!ptr)return -ENOMEM ; fd->search_key = ptr;
@@ -112,6 +112,12 @@ int hfs_brec_find(struct hfs_find_data *fd)__be32 data;int height, res; + fd->record =-1 ; + fd->keyoffset =-1 ; + fd->keylength =-1 ; + fd->entryoffset =-1 ; + fd->entrylength =-1 ; + tree = fd->tree;if (fd->bnode)hfs_bnode_put (fd->bnode);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 175/224 hfsplus: fix KMSAN uninit-value issue in __hfsplus_ext_cache_extent()
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Viacheslav Dubeyko <[email protected]>
[ Upstream commit 4840ceadef4290c56cc422f0fc697655f3cbf070 ]
The syzbot reported issue in __hfsplus_ext_cache_extent():
[ 70.194323][ T9350] BUG: KMSAN: uninit-value in __hfsplus_ext_cache_extent+0x7d0/0x990 [ 70.195022][ T9350] __hfsplus_ext_cache_extent+0x7d0/0x990 [ 70.195530][ T9350] hfsplus_file_extend+0x74f/0x1cf0 [ 70.195998][ T9350] hfsplus_get_block+0xe16/0x17b0 [ 70.196458][ T9350] __block_write_begin_int+0x962/0x2ce0 [ 70.196959][ T9350] cont_write_begin+0x1000/0x1950 [ 70.197416][ T9350] hfsplus_write_begin+0x85/0x130 [ 70.197873][ T9350] generic_perform_write+0x3e8/0x1060 [ 70.198374][ T9350] __generic_file_write_iter+0x215/0x460 [ 70.198892][ T9350] generic_file_write_iter+0x109/0x5e0 [ 70.199393][ T9350] vfs_write+0xb0f/0x14e0 [ 70.199771][ T9350] ksys_write+0x23e/0x490 [ 70.200149][ T9350] __x64_sys_write+0x97/0xf0 [ 70.200570][ T9350] x64_sys_call+0x3015/0x3cf0 [ 70.201065][ T9350] do_syscall_64+0xd9/0x1d0 [ 70.201506][ T9350] entry_SYSCALL_64_after_hwframe+0x77/0x7f [ 70.202054][ T9350] [ 70.202279][ T9350] Uninit was created at: [ 70.202693][ T9350] __kmalloc_noprof+0x621/0xf80 [ 70.203149][ T9350] hfsplus_find_init+0x8d/0x1d0 [ 70.203602][ T9350] hfsplus_file_extend+0x6ca/0x1cf0 [ 70.204087][ T9350] hfsplus_get_block+0xe16/0x17b0 [ 70.204561][ T9350] __block_write_begin_int+0x962/0x2ce0 [ 70.205074][ T9350] cont_write_begin+0x1000/0x1950 [ 70.205547][ T9350] hfsplus_write_begin+0x85/0x130 [ 70.206017][ T9350] generic_perform_write+0x3e8/0x1060 [ 70.206519][ T9350] __generic_file_write_iter+0x215/0x460 [ 70.207042][ T9350] generic_file_write_iter+0x109/0x5e0 [ 70.207552][ T9350] vfs_write+0xb0f/0x14e0 [ 70.207961][ T9350] ksys_write+0x23e/0x490 [ 70.208375][ T9350] __x64_sys_write+0x97/0xf0 [ 70.208810][ T9350] x64_sys_call+0x3015/0x3cf0 [ 70.209255][ T9350] do_syscall_64+0xd9/0x1d0 [ 70.209680][ T9350] entry_SYSCALL_64_after_hwframe+0x77/0x7f [ 70.210230][ T9350] [ 70.210454][ T9350] CPU: 2 UID: 0 PID: 9350 Comm: repro Not tainted 6.12.0-rc5 #5 [ 70.211174][ T9350] Hardware name: QEMU Ubuntu 24.04 PC (i440FX + PIIX, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 [ 70.212115][ T9350] ===================================================== [ 70.212734][ T9350] Disabling lock debugging due to kernel taint [ 70.213284][ T9350] Kernel panic - not syncing: kmsan.panic set ... [ 70.213858][ T9350] CPU: 2 UID: 0 PID: 9350 Comm: repro Tainted: G B 6.12.0-rc5 #5 [ 70.214679][ T9350] Tainted: [B]=BAD_PAGE [ 70.215057][ T9350] Hardware name: QEMU Ubuntu 24.04 PC (i440FX + PIIX, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 [ 70.215999][ T9350] Call Trace: [ 70.216309][ T9350] <TASK> [ 70.216585][ T9350] dump_stack_lvl+0x1fd/0x2b0 [ 70.217025][ T9350] dump_stack+0x1e/0x30 [ 70.217421][ T9350] panic+0x502/0xca0 [ 70.217803][ T9350] ? kmsan_get_metadata+0x13e/0x1c0
[ 70.218294][ Message fromT sy9350] kmsan_report+0x296/slogd@syzkaller 0x2aat Aug 18 22:11:058 ... kernel :[ 70.213284][ T9350] Kernel panic - not syncing: kmsan.panic [ 70.220179][ T9350] ? kmsan_get_metadata+0x13e/0x1c0 set ... [ 70.221254][ T9350] ? __msan_warning+0x96/0x120 [ 70.222066][ T9350] ? __hfsplus_ext_cache_extent+0x7d0/0x990 [ 70.223023][ T9350] ? hfsplus_file_extend+0x74f/0x1cf0 [ 70.224120][ T9350] ? hfsplus_get_block+0xe16/0x17b0 [ 70.224946][ T9350] ? __block_write_begin_int+0x962/0x2ce0 [ 70.225756][ T9350] ? cont_write_begin+0x1000/0x1950 [ 70.226337][ T9350] ? hfsplus_write_begin+0x85/0x130 [ 70.226852][ T9350] ? generic_perform_write+0x3e8/0x1060 [ 70.227405][ T9350] ? __generic_file_write_iter+0x215/0x460 [ 70.227979][ T9350] ? generic_file_write_iter+0x109/0x5e0 [ 70.228540][ T9350] ? vfs_write+0xb0f/0x14e0 [ 70.228997][ T9350] ? ksys_write+0x23e/0x490 [ 70.229458][ T9350] ? __x64_sys_write+0x97/0xf0 [ 70.229939][ T9350] ? x64_sys_call+0x3015/0x3cf0 [ 70.230432][ T9350] ? do_syscall_64+0xd9/0x1d0 [ 70.230941][ T9350] ? entry_SYSCALL_64_after_hwframe+0x77/0x7f [ 70.231926][ T9350] ? kmsan_get_metadata+0x13e/0x1c0 [ 70.232738][ T9350] ? kmsan_internal_set_shadow_origin+0x77/0x110 [ 70.233711][ T9350] ? kmsan_get_metadata+0x13e/0x1c0 [ 70.234516][ T9350] ? kmsan_get_shadow_origin_ptr+0x4a/0xb0 [ 70.235398][ T9350] ? __msan_metadata_ptr_for_load_4+0x24/0x40 [ 70.236323][ T9350] ? hfsplus_brec_find+0x218/0x9f0 [ 70.237090][ T9350] ? __pfx_hfs_find_rec_by_key+0x10/0x10 [ 70.237938][ T9350] ? __msan_instrument_asm_store+0xbf/0xf0 [ 70.238827][ T9350] ? __msan_metadata_ptr_for_store_4+0x27/0x40 [ 70.239772][ T9350] ? __hfsplus_ext_write_extent+0x536/0x620 [ 70.240666][ T9350] ? kmsan_get_metadata+0x13e/0x1c0 [ 70.241175][ T9350] __msan_warning+0x96/0x120 [ 70.241645][ T9350] __hfsplus_ext_cache_extent+0x7d0/0x990 [ 70.242223][ T9350] hfsplus_file_extend+0x74f/0x1cf0 [ 70.242748][ T9350] hfsplus_get_block+0xe16/0x17b0 [ 70.243255][ T9350] ? kmsan_internal_set_shadow_origin+0x77/0x110 [ 70.243878][ T9350] ? kmsan_get_metadata+0x13e/0x1c0 [ 70.244400][ T9350] ? kmsan_get_shadow_origin_ptr+0x4a/0xb0 [ 70.244967][ T9350] __block_write_begin_int+0x962/0x2ce0 [ 70.245531][ T9350] ? __pfx_hfsplus_get_block+0x10/0x10 [ 70.246079][ T9350] cont_write_begin+0x1000/0x1950 [ 70.246598][ T9350] hfsplus_write_begin+0x85/0x130 [ 70.247105][ T9350] ? __pfx_hfsplus_get_block+0x10/0x10 [ 70.247650][ T9350] ? __pfx_hfsplus_write_begin+0x10/0x10 [ 70.248211][ T9350] generic_perform_write+0x3e8/0x1060 [ 70.248752][ T9350] __generic_file_write_iter+0x215/0x460 [ 70.249314][ T9350] generic_file_write_iter+0x109/0x5e0 [ 70.249856][ T9350] ? kmsan_internal_set_shadow_origin+0x77/0x110 [ 70.250487][ T9350] vfs_write+0xb0f/0x14e0 [ 70.250930][ T9350] ? __pfx_generic_file_write_iter+0x10/0x10 [ 70.251530][ T9350] ksys_write+0x23e/0x490 [ 70.251974][ T9350] __x64_sys_write+0x97/0xf0 [ 70.252450][ T9350] x64_sys_call+0x3015/0x3cf0 [ 70.252924][ T9350] do_syscall_64+0xd9/0x1d0 [ 70.253384][ T9350] ? irqentry_exit+0x16/0x60 [ 70.253844][ T9350] entry_SYSCALL_64_after_hwframe+0x77/0x7f [ 70.254430][ T9350] RIP: 0033:0x7f7a92adffc9 [ 70.254873][ T9350] Code: 00 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 48 [ 70.256674][ T9350] RSP: 002b:00007fff0bca3188 EFLAGS: 00000202 ORIG_RAX: 0000000000000001 [ 70.257485][ T9350] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f7a92adffc9 [ 70.258246][ T9350] RDX: 000000000208e24b RSI: 0000000020000100 RDI: 0000000000000004 [ 70.258998][ T9350] RBP: 00007fff0bca31a0 R08: 00007fff0bca31a0 R09: 00007fff0bca31a0 [ 70.259769][ T9350] R10: 0000000000000000 R11: 0000000000000202 R12: 000055e0d75f8250 [ 70.260520][ T9350] R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 [ 70.261286][ T9350] </TASK> [ 70.262026][ T9350] Kernel Offset: disabled
(gdb) l *__hfsplus_ext_cache_extent+0x7d00xffffffff8318aef0 is in __hfsplus_ext_cache_extent (fs/hfsplus/extents.c:168).
163 fd->key->ext.cnid = 0;
164 res = hfs_brec_find(fd, hfs_find_rec_by_key);
165 if (res && res != -ENOENT)
166 return res;
167 if (fd->key->ext.cnid != fd->search_key->ext.cnid ||
168 fd->key->ext.fork_type != fd->search_key->ext.fork_type)
169 return -ENOENT;
170 if (fd->entrylength != sizeof(hfsplus_extent_rec))
171 return -EIO;
172 hfs_bnode_read(fd->bnode, extent, fd->entryoffset,
The __hfsplus_ext_cache_extent() calls __hfsplus_ext_read_extent():
res = __hfsplus_ext_read_extent(fd, hip->cached_extents, inode->i_ino,
block, HFSPLUS_IS_RSRC(inode) ? HFSPLUS_TYPE_RSRC : HFSPLUS_TYPE_DATA);
And if inode->i_ino could be equal to zero or any non-available CNID, then hfs_brec_find() could not find the record in the tree. As a result, fd->key could be compared with fd->search_key. But hfsplus_find_init() uses kmalloc() for fd->key and fd->search_key allocation:
int hfs_find_init(struct hfs_btree *tree, struct hfs_find_data *fd) {
<skipped>
ptr = kmalloc(tree->max_key_len * 2 + 4, GFP_KERNEL);
if (!ptr)
return -ENOMEM;
fd->search_key = ptr;
fd->key = ptr + tree->max_key_len + 2;<skipped>
}
Finally, fd->key is still not initialized if hfs_brec_find() has found nothing.
This patch changes kmalloc() on kzalloc() in hfs_find_init() and intializes fd->record, fd->keyoffset, fd->keylength, fd->entryoffset, fd->entrylength for the case if hfs_brec_find() has been found nothing in the b-tree node.
--- fs/hfsplus/bfind.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
fs/hfsplus/bfind.c +7 -1
@@ -18,7 +18,7 @@ int hfs_find_init(struct hfs_btree *tree, struct hfs_find_data *fd) fd->tree = tree; fd->bnode =NULL ; - ptr =kmalloc (tree->max_key_len *2 +4 ,GFP_KERNEL ); + ptr =kzalloc (tree->max_key_len *2 +4 ,GFP_KERNEL );if (!ptr)return -ENOMEM ; fd->search_key = ptr;
@@ -158,6 +158,12 @@ int hfs_brec_find(struct hfs_find_data *fd, search_strategy_t do_key_compare)__be32 data;int height, res; + fd->record =-1 ; + fd->keyoffset =-1 ; + fd->keylength =-1 ; + fd->entryoffset =-1 ; + fd->entrylength =-1 ; + tree = fd->tree;if (fd->bnode)hfs_bnode_put (fd->bnode);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 176/224 hfs: validate record offset in hfsplus_bmap_alloc
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yang Chenzhi <[email protected]>
[ Upstream commit 738d5a51864ed8d7a68600b8c0c63fe6fe5c4f20 ]
hfsplus_bmap_alloc can trigger a crash if a
record offset or length is larger than node_size
[ 15.264282] BUG: KASAN: slab-out-of-bounds in hfsplus_bmap_alloc+0x887/0x8b0 [ 15.265192] Read of size 8 at addr ffff8881085ca188 by task test/183 [ 15.265949] [ 15.266163] CPU: 0 UID: 0 PID: 183 Comm: test Not tainted 6.17.0-rc2-gc17b750b3ad9 #14 PREEMPT(voluntary) [ 15.266165] Hardware name: QEMU Ubuntu 24.04 PC (i440FX + PIIX, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 [ 15.266167] Call Trace: [ 15.266168] <TASK> [ 15.266169] dump_stack_lvl+0x53/0x70 [ 15.266173] print_report+0xd0/0x660 [ 15.266181] kasan_report+0xce/0x100 [ 15.266185] hfsplus_bmap_alloc+0x887/0x8b0 [ 15.266208] hfs_btree_inc_height.isra.0+0xd5/0x7c0 [ 15.266217] hfsplus_brec_insert+0x870/0xb00 [ 15.266222] __hfsplus_ext_write_extent+0x428/0x570 [ 15.266225] __hfsplus_ext_cache_extent+0x5e/0x910 [ 15.266227] hfsplus_ext_read_extent+0x1b2/0x200 [ 15.266233] hfsplus_file_extend+0x5a7/0x1000 [ 15.266237] hfsplus_get_block+0x12b/0x8c0 [ 15.266238] __block_write_begin_int+0x36b/0x12c0 [ 15.266251] block_write_begin+0x77/0x110 [ 15.266252] cont_write_begin+0x428/0x720 [ 15.266259] hfsplus_write_begin+0x51/0x100 [ 15.266262] cont_write_begin+0x272/0x720 [ 15.266270] hfsplus_write_begin+0x51/0x100 [ 15.266274] generic_perform_write+0x321/0x750 [ 15.266285] generic_file_write_iter+0xc3/0x310 [ 15.266289] __kernel_write_iter+0x2fd/0x800 [ 15.266296] dump_user_range+0x2ea/0x910 [ 15.266301] elf_core_dump+0x2a94/0x2ed0 [ 15.266320] vfs_coredump+0x1d85/0x45e0 [ 15.266349] get_signal+0x12e3/0x1990 [ 15.266357] arch_do_signal_or_restart+0x89/0x580 [ 15.266362] irqentry_exit_to_user_mode+0xab/0x110 [ 15.266364] asm_exc_page_fault+0x26/0x30 [ 15.266366] RIP: 0033:0x41bd35 [ 15.266367] Code: bc d1 f3 0f 7f 27 f3 0f 7f 6f 10 f3 0f 7f 77 20 f3 0f 7f 7f 30 49 83 c0 0f 49 29 d0 48 8d 7c 17 31 e9 9f 0b 00 00 66 0f ef c0 <f3> 0f 6f 0e f3 0f 6f 56 10 66 0f 74 c1 66 0f d7 d0 49 83 f8f [ 15.266369] RSP: 002b:00007ffc9e62d078 EFLAGS: 00010283 [ 15.266371] RAX: 00007ffc9e62d100 RBX: 0000000000000000 RCX: 0000000000000000 [ 15.266372] RDX: 00000000000000e0 RSI: 0000000000000000 RDI: 00007ffc9e62d100 [ 15.266373] RBP: 0000400000000040 R08: 00000000000000e0 R09: 0000000000000000 [ 15.266374] R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 [ 15.266375] R13: 0000000000000000 R14: 0000000000000000 R15: 0000400000000000 [ 15.266376] </TASK>
When calling hfsplus_bmap_alloc to allocate a free node, this function first retrieves the bitmap from header node and map node using node->page together with the offset and length from hfs_brec_lenoff
``` len = hfs_brec_lenoff(node, 2, &off16); off = off16; off += node->page_offset; pagep = node->page + (off >> PAGE_SHIFT); data = kmap_local_page(*pagep); ```
However, if the retrieved offset or length is invalid(i.e. exceeds node_size), the code may end up accessing pages outside the allocated range for this node.
This patch adds proper validation of both offset and length before use, preventing out-of-bounds page access. Move is_bnode_offset_valid and check_and_correct_requested_length to hfsplus_fs.h, as they may be required by other functions.
--- fs/hfsplus/bnode.c | 41 ---------------------------------------- fs/hfsplus/btree.c | 6 ++++++ fs/hfsplus/hfsplus_fs.h | 42 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+), 41 deletions(-)
fs/hfsplus/bnode.c +0 -41
@@ -18,47 +18,6 @@#include "hfsplus_fs.h" #include "hfsplus_raw.h" -static inline -bool is_bnode_offset_valid (struct hfs_bnode *node,int off) -{ -bool is_valid = off < node->tree->node_size; - -if (!is_valid) { -pr_err ("requested invalid offset: " -"NODE: id %u, type %#x, height %u, " -"node_size %u, offset %d\n" , - node->this, node->type, node->height, - node->tree->node_size, off); - } - -return is_valid; -} - -static inline -int check_and_correct_requested_length (struct hfs_bnode *node,int off,int len) -{ -unsigned int node_size; - -if (!is_bnode_offset_valid (node, off)) -return 0 ; - - node_size = node->tree->node_size; - -if ((off + len) > node_size) { -int new_len = (int )node_size - off; - -pr_err ("requested length has been corrected: " -"NODE: id %u, type %#x, height %u, " -"node_size %u, offset %d, " -"requested_len %d, corrected_len %d\n" , - node->this, node->type, node->height, - node->tree->node_size, off, len, new_len); - -return new_len; - } - -return len; -}/* Copy a specified range of bytes from the raw data of a node */ void hfs_bnode_read (struct hfs_bnode *node,void *buf,int off,int len)
fs/hfsplus/btree.c +6 -0
@@ -392,6 +392,12 @@ struct hfs_bnode *hfs_bmap_alloc(struct hfs_btree *tree) len =hfs_brec_lenoff (node,2 , &off16); off = off16; +if (!is_bnode_offset_valid (node, off)) { +hfs_bnode_put (node); +return ERR_PTR (-EIO ); + } + len =check_and_correct_requested_length (node, off, len); + off += node->page_offset; pagep = node->page + (off >>PAGE_SHIFT ); data =kmap (*pagep);
fs/hfsplus/hfsplus_fs.h +42 -0
48 lines not on this page · raw message
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 177/224 hfsplus: fix KMSAN uninit-value issue in hfsplus_delete_cat()
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Viacheslav Dubeyko <[email protected]>
[ Upstream commit 9b3d15a758910bb98ba8feb4109d99cc67450ee4 ]
The syzbot reported issue in hfsplus_delete_cat():
[ 70.682285][ T9333] ===================================================== [ 70.682943][ T9333] BUG: KMSAN: uninit-value in hfsplus_subfolders_dec+0x1d7/0x220 [ 70.683640][ T9333] hfsplus_subfolders_dec+0x1d7/0x220 [ 70.684141][ T9333] hfsplus_delete_cat+0x105d/0x12b0 [ 70.684621][ T9333] hfsplus_rmdir+0x13d/0x310 [ 70.685048][ T9333] vfs_rmdir+0x5ba/0x810 [ 70.685447][ T9333] do_rmdir+0x964/0xea0 [ 70.685833][ T9333] __x64_sys_rmdir+0x71/0xb0 [ 70.686260][ T9333] x64_sys_call+0xcd8/0x3cf0 [ 70.686695][ T9333] do_syscall_64+0xd9/0x1d0 [ 70.687119][ T9333] entry_SYSCALL_64_after_hwframe+0x77/0x7f [ 70.687646][ T9333] [ 70.687856][ T9333] Uninit was stored to memory at: [ 70.688311][ T9333] hfsplus_subfolders_inc+0x1c2/0x1d0 [ 70.688779][ T9333] hfsplus_create_cat+0x148e/0x1800 [ 70.689231][ T9333] hfsplus_mknod+0x27f/0x600 [ 70.689730][ T9333] hfsplus_mkdir+0x5a/0x70 [ 70.690146][ T9333] vfs_mkdir+0x483/0x7a0 [ 70.690545][ T9333] do_mkdirat+0x3f2/0xd30 [ 70.690944][ T9333] __x64_sys_mkdir+0x9a/0xf0 [ 70.691380][ T9333] x64_sys_call+0x2f89/0x3cf0 [ 70.691816][ T9333] do_syscall_64+0xd9/0x1d0 [ 70.692229][ T9333] entry_SYSCALL_64_after_hwframe+0x77/0x7f [ 70.692773][ T9333] [ 70.692990][ T9333] Uninit was stored to memory at: [ 70.693469][ T9333] hfsplus_subfolders_inc+0x1c2/0x1d0 [ 70.693960][ T9333] hfsplus_create_cat+0x148e/0x1800 [ 70.694438][ T9333] hfsplus_fill_super+0x21c1/0x2700 [ 70.694911][ T9333] mount_bdev+0x37b/0x530 [ 70.695320][ T9333] hfsplus_mount+0x4d/0x60 [ 70.695729][ T9333] legacy_get_tree+0x113/0x2c0 [ 70.696167][ T9333] vfs_get_tree+0xb3/0x5c0 [ 70.696588][ T9333] do_new_mount+0x73e/0x1630 [ 70.697013][ T9333] path_mount+0x6e3/0x1eb0 [ 70.697425][ T9333] __se_sys_mount+0x733/0x830 [ 70.697857][ T9333] __x64_sys_mount+0xe4/0x150 [ 70.698269][ T9333] x64_sys_call+0x2691/0x3cf0 [ 70.698704][ T9333] do_syscall_64+0xd9/0x1d0 [ 70.699117][ T9333] entry_SYSCALL_64_after_hwframe+0x77/0x7f [ 70.699730][ T9333] [ 70.699946][ T9333] Uninit was created at: [ 70.700378][ T9333] __alloc_pages_noprof+0x714/0xe60 [ 70.700843][ T9333] alloc_pages_mpol_noprof+0x2a2/0x9b0 [ 70.701331][ T9333] alloc_pages_noprof+0xf8/0x1f0 [ 70.701774][ T9333] allocate_slab+0x30e/0x1390 [ 70.702194][ T9333] ___slab_alloc+0x1049/0x33a0 [ 70.702635][ T9333] kmem_cache_alloc_lru_noprof+0x5ce/0xb20 [ 70.703153][ T9333] hfsplus_alloc_inode+0x5a/0xd0 [ 70.703598][ T9333] alloc_inode+0x82/0x490 [ 70.703984][ T9333] iget_locked+0x22e/0x1320 [ 70.704428][ T9333] hfsplus_iget+0x5c/0xba0 [ 70.704827][ T9333] hfsplus_btree_open+0x135/0x1dd0 [ 70.705291][ T9333] hfsplus_fill_super+0x1132/0x2700 [ 70.705776][ T9333] mount_bdev+0x37b/0x530 [ 70.706171][ T9333] hfsplus_mount+0x4d/0x60 [ 70.706579][ T9333] legacy_get_tree+0x113/0x2c0 [ 70.707019][ T9333] vfs_get_tree+0xb3/0x5c0 [ 70.707444][ T9333] do_new_mount+0x73e/0x1630 [ 70.707865][ T9333] path_mount+0x6e3/0x1eb0 [ 70.708270][ T9333] __se_sys_mount+0x733/0x830 [ 70.708711][ T9333] __x64_sys_mount+0xe4/0x150 [ 70.709158][ T9333] x64_sys_call+0x2691/0x3cf0 [ 70.709630][ T9333] do_syscall_64+0xd9/0x1d0 [ 70.710053][ T9333] entry_SYSCALL_64_after_hwframe+0x77/0x7f [ 70.710611][ T9333] [ 70.710842][ T9333] CPU: 3 UID: 0 PID: 9333 Comm: repro Not tainted 6.12.0-rc6-dirty #17 [ 70.711568][ T9333] Hardware name: QEMU Ubuntu 24.04 PC (i440FX + PIIX, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 [ 70.712490][ T9333] ===================================================== [ 70.713085][ T9333] Disabling lock debugging due to kernel taint [ 70.713618][ T9333] Kernel panic - not syncing: kmsan.panic set ... [ 70.714159][ T9333] CPU: 3 UID: 0 PID: 9333 Comm: repro Tainted: G B 6.12.0-rc6-dirty #17 [ 70.715007][ T9333] Tainted: [B]=BAD_PAGE [ 70.715365][ T9333] Hardware name: QEMU Ubuntu 24.04 PC (i440FX + PIIX, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 [ 70.716311][ T9333] Call Trace: [ 70.716621][ T9333] <TASK> [ 70.716899][ T9333] dump_stack_lvl+0x1fd/0x2b0 [ 70.717350][ T9333] dump_stack+0x1e/0x30 [ 70.717743][ T9333] panic+0x502/0xca0 [ 70.718116][ T9333] ? kmsan_get_metadata+0x13e/0x1c0 [ 70.718611][ T9333] kmsan_report+0x296/0x2a0 [ 70.719038][ T9333] ? __msan_metadata_ptr_for_load_4+0x24/0x40 [ 70.719859][ T9333] ? __msan_warning+0x96/0x120 [ 70.720345][ T9333] ? hfsplus_subfolders_dec+0x1d7/0x220 [ 70.720881][ T9333] ? hfsplus_delete_cat+0x105d/0x12b0 [ 70.721412][ T9333] ? hfsplus_rmdir+0x13d/0x310 [ 70.721880][ T9333] ? vfs_rmdir+0x5ba/0x810 [ 70.722458][ T9333] ? do_rmdir+0x964/0xea0 [ 70.722883][ T9333] ? __x64_sys_rmdir+0x71/0xb0 [ 70.723397][ T9333] ? x64_sys_call+0xcd8/0x3cf0 [ 70.723915][ T9333] ? do_syscall_64+0xd9/0x1d0 [ 70.724454][ T9333] ? entry_SYSCALL_64_after_hwframe+0x77/0x7f [ 70.725110][ T9333] ? vprintk_emit+0xd1f/0xe60 [ 70.725616][ T9333] ? vprintk_default+0x3f/0x50 [ 70.726175][ T9333] ? vprintk+0xce/0xd0 [ 70.726628][ T9333] ? _printk+0x17e/0x1b0 [ 70.727129][ T9333] ? __msan_metadata_ptr_for_load_4+0x24/0x40 [ 70.727739][ T9333] ? kmsan_get_metadata+0x13e/0x1c0 [ 70.728324][ T9333] __msan_warning+0x96/0x120 [ 70.728854][ T9333] hfsplus_subfolders_dec+0x1d7/0x220 [ 70.729479][ T9333] hfsplus_delete_cat+0x105d/0x12b0 [ 70.729984][ T9333] ? kmsan_get_shadow_origin_ptr+0x4a/0xb0 [ 70.730646][ T9333] ? __msan_metadata_ptr_for_load_4+0x24/0x40 [ 70.731296][ T9333] ? kmsan_get_metadata+0x13e/0x1c0 [ 70.731863][ T9333] hfsplus_rmdir+0x13d/0x310 [ 70.732390][ T9333] ? __pfx_hfsplus_rmdir+0x10/0x10 [ 70.732919][ T9333] vfs_rmdir+0x5ba/0x810 [ 70.733416][ T9333] ? kmsan_get_shadow_origin_ptr+0x4a/0xb0 [ 70.734044][ T9333] do_rmdir+0x964/0xea0 [ 70.734537][ T9333] __x64_sys_rmdir+0x71/0xb0 [ 70.735032][ T9333] x64_sys_call+0xcd8/0x3cf0 [ 70.735579][ T9333] do_syscall_64+0xd9/0x1d0 [ 70.736092][ T9333] ? irqentry_exit+0x16/0x60 [ 70.736637][ T9333] entry_SYSCALL_64_after_hwframe+0x77/0x7f [ 70.737269][ T9333] RIP: 0033:0x7fa9424eafc9 [ 70.737775][ T9333] Code: 00 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 48 [ 70.739844][ T9333] RSP: 002b:00007fff099cd8d8 EFLAGS: 00000202 ORIG_RAX: 0000000000000054 [ 70.740760][ T9333] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007fa9424eafc9 [ 70.741642][ T9333] RDX: 006c6f72746e6f63 RSI: 000000000000000a RDI: 0000000020000100 [ 70.742543][ T9333] RBP: 00007fff099cd8e0 R08: 00007fff099cd910 R09: 00007fff099cd910 [ 70.743376][ T9333] R10: 0000000000000000 R11: 0000000000000202 R12: 0000565430642260 [ 70.744247][ T9333] R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 [ 70.745082][ T9333] </TASK>
The main reason of the issue that struct hfsplus_inode_info has not been properly initialized for the case of root folder. In the case of root folder, hfsplus_fill_super() calls the hfsplus_iget() that implements only partial initialization of struct hfsplus_inode_info and subfolders field is not initialized by hfsplus_iget() logic.
This patch implements complete initialization of struct hfsplus_inode_info in the hfsplus_iget() logic with the goal to prevent likewise issues for the case of root folder.
--- fs/hfsplus/super.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-)
fs/hfsplus/super.c +18 -5
@@ -67,13 +67,26 @@ struct inode *hfsplus_iget(struct super_block *sb, unsigned long ino)if (!(inode->i_state &I_NEW ))return inode; -INIT_LIST_HEAD (&HFSPLUS_I (inode)->open_dir_list); -spin_lock_init (&HFSPLUS_I (inode)->open_dir_lock); -mutex_init (&HFSPLUS_I (inode)->extents_lock); -HFSPLUS_I (inode)->flags =0 ; +atomic_set (&HFSPLUS_I (inode)->opencnt,0 ); +HFSPLUS_I (inode)->first_blocks =0 ; +HFSPLUS_I (inode)->clump_blocks =0 ; +HFSPLUS_I (inode)->alloc_blocks =0 ; +HFSPLUS_I (inode)->cached_start =U32_MAX ; +HFSPLUS_I (inode)->cached_blocks =0 ; +memset (HFSPLUS_I (inode)->first_extents,0 ,sizeof (hfsplus_extent_rec)); +memset (HFSPLUS_I (inode)->cached_extents,0 ,sizeof (hfsplus_extent_rec));HFSPLUS_I (inode)->extent_state =0 ; +mutex_init (&HFSPLUS_I (inode)->extents_lock);HFSPLUS_I (inode)->rsrc_inode =NULL ; -atomic_set (&HFSPLUS_I (inode)->opencnt,0 ); +HFSPLUS_I (inode)->create_date =0 ; +HFSPLUS_I (inode)->linkid =0 ; +HFSPLUS_I (inode)->flags =0 ; +HFSPLUS_I (inode)->fs_blocks =0 ; +HFSPLUS_I (inode)->userflags =0 ; +HFSPLUS_I (inode)->subfolders =0 ; +INIT_LIST_HEAD (&HFSPLUS_I (inode)->open_dir_list); +spin_lock_init (&HFSPLUS_I (inode)->open_dir_lock); +HFSPLUS_I (inode)->phys_size =0 ;if (inode->i_ino >=HFSPLUS_FIRSTUSER_CNID || inode->i_ino ==HFSPLUS_ROOT_CNID ) {
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 178/224 dlm: check for defined force value in dlm_lockspace_release
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Aring <[email protected]>
[ Upstream commit 6af515c9f3ccec3eb8a262ca86bef2c499d07951 ]
Force values over 3 are undefined, so don't treat them as 3.
--- fs/dlm/lockspace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/dlm/lockspace.c +1 -1
@@ -793,7 +793,7 @@ static int release_lockspace(struct dlm_ls *ls, int force)dlm_device_deregister (ls); -if (force <3 &&dlm_user_daemon_available ()) +if (force !=3 &&dlm_user_daemon_available ())do_uevent (ls,0 );dlm_recoverd_stop (ls);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 179/224 hfs: fix KMSAN uninit-value issue in hfs_find_set_zero_bits()
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Viacheslav Dubeyko <[email protected]>
[ Upstream commit 2048ec5b98dbdfe0b929d2e42dc7a54c389c53dd ]
The syzbot reported issue in hfs_find_set_zero_bits():
=====================================================
BUG: KMSAN: uninit-value in hfs_find_set_zero_bits+0x74d/0xb60 fs/hfs/bitmap.c:45 hfs_find_set_zero_bits+0x74d/0xb60 fs/hfs/bitmap.c:45 hfs_vbm_search_free+0x13c/0x5b0 fs/hfs/bitmap.c:151 hfs_extend_file+0x6a5/0x1b00 fs/hfs/extent.c:408 hfs_get_block+0x435/0x1150 fs/hfs/extent.c:353 __block_write_begin_int+0xa76/0x3030 fs/buffer.c:2151 block_write_begin fs/buffer.c:2262 [inline] cont_write_begin+0x10e1/0x1bc0 fs/buffer.c:2601 hfs_write_begin+0x85/0x130 fs/hfs/inode.c:52 cont_expand_zero fs/buffer.c:2528 [inline] cont_write_begin+0x35a/0x1bc0 fs/buffer.c:2591 hfs_write_begin+0x85/0x130 fs/hfs/inode.c:52 hfs_file_truncate+0x1d6/0xe60 fs/hfs/extent.c:494 hfs_inode_setattr+0x964/0xaa0 fs/hfs/inode.c:654 notify_change+0x1993/0x1aa0 fs/attr.c:552 do_truncate+0x28f/0x310 fs/open.c:68 do_ftruncate+0x698/0x730 fs/open.c:195 do_sys_ftruncate fs/open.c:210 [inline] __do_sys_ftruncate fs/open.c:215 [inline] __se_sys_ftruncate fs/open.c:213 [inline] __x64_sys_ftruncate+0x11b/0x250 fs/open.c:213 x64_sys_call+0xfe3/0x3db0 arch/x86/include/generated/asm/syscalls_64.h:78 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xd9/0x210 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f
Uninit was created at:
slab_post_alloc_hook mm/slub.c:4154 [inline] slab_alloc_node mm/slub.c:4197 [inline] __kmalloc_cache_noprof+0x7f7/0xed0 mm/slub.c:4354 kmalloc_noprof include/linux/slab.h:905 [inline] hfs_mdb_get+0x1cc8/0x2a90 fs/hfs/mdb.c:175 hfs_fill_super+0x3d0/0xb80 fs/hfs/super.c:337 get_tree_bdev_flags+0x6e3/0x920 fs/super.c:1681 get_tree_bdev+0x38/0x50 fs/super.c:1704 hfs_get_tree+0x35/0x40 fs/hfs/super.c:388 vfs_get_tree+0xb0/0x5c0 fs/super.c:1804 do_new_mount+0x738/0x1610 fs/namespace.c:3902 path_mount+0x6db/0x1e90 fs/namespace.c:4226 do_mount fs/namespace.c:4239 [inline] __do_sys_mount fs/namespace.c:4450 [inline] __se_sys_mount+0x6eb/0x7d0 fs/namespace.c:4427 __x64_sys_mount+0xe4/0x150 fs/namespace.c:4427 x64_sys_call+0xfa7/0x3db0 arch/x86/include/generated/asm/syscalls_64.h:166 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xd9/0x210 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f CPU: 1 UID: 0 PID: 12609 Comm: syz.1.2692 Not tainted 6.16.0-syzkaller #0 PREEMPT(none) Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/2025 =====================================================
The HFS_SB(sb)->bitmap buffer is allocated in hfs_mdb_get():
HFS_SB(sb)->bitmap = kmalloc(8192, GFP_KERNEL);
Finally, it can trigger the reported issue because kmalloc() doesn't clear the allocated memory. If allocated memory contains only zeros, then everything will work pretty fine.
But if the allocated memory contains the "garbage", then it can affect the bitmap operations and it triggers the reported issue.
This patch simply exchanges the kmalloc() on kzalloc() with the goal to guarantee the correctness of bitmap operations. Because, newly created allocation bitmap should have all available blocks free. Potentially, initialization bitmap's read operation could not fill the whole allocated memory and "garbage" in the not initialized memory will be the reason of volume coruptions and file system driver bugs.
--- fs/hfs/mdb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/hfs/mdb.c +1 -1
@@ -166,7 +166,7 @@ int hfs_mdb_get(struct super_block *sb)pr_warn ("continuing without an alternate MDB\n" ); } -HFS_SB (sb)->bitmap =kmalloc (8192 ,GFP_KERNEL ); +HFS_SB (sb)->bitmap =kzalloc (8192 ,GFP_KERNEL );if (!HFS_SB (sb)->bitmap) goto out;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 180/224 hfsplus: return EIO when type of hidden directory mismatch in hfsplus_fill_super()
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yangtao Li <[email protected]>
[ Upstream commit 9282bc905f0949fab8cf86c0f620ca988761254c ]
If Catalog File contains corrupted record for the case of hidden directory's type, regard it as I/O error instead of Invalid argument.
--- fs/hfsplus/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/hfsplus/super.c +1 -1
@@ -539,7 +539,7 @@ static int hfsplus_fill_super(struct super_block *sb, void *data, int silent)if (!hfs_brec_read (&fd, &entry,sizeof (entry))) {hfs_find_exit (&fd);if (entry.type !=cpu_to_be16 (HFSPLUS_FOLDER )) { - err = -EINVAL ; + err = -EIO ; goto out_put_root; } inode =hfsplus_iget (sb,be32_to_cpu (entry.folder.id));
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 181/224 m68k: bitops: Fix find_*_bit() signatures
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
[ Upstream commit 6d5674090543b89aac0c177d67e5fb32ddc53804 ]
The function signatures of the m68k-optimized implementations of the find_{first,next}_{,zero_}bit() helpers do not match the generic variants.
Fix this by changing all non-pointer inputs and outputs to "unsigned long", and updating a few local variables.
--- arch/m68k/include/asm/bitops.h | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-)
arch/m68k/include/asm/bitops.h +14 -11
@@ -314,12 +314,12 @@ static inline int bfchg_mem_test_and_change_bit(int nr,#include <asm-generic/bitops/ffz.h> #else -static inline int find_first_zero_bit (const unsigned long *vaddr, -unsigned size) +static inline unsigned long find_first_zero_bit (const unsigned long *vaddr, +unsigned long size) {const unsigned long *p = vaddr; -int res =32 ; -unsigned int words; +unsigned long res =32 ; +unsigned long words;unsigned long num;if (!size)
@@ -340,8 +340,9 @@ static inline int find_first_zero_bit(const unsigned long *vaddr, }#define find_first_zero_bit find_first_zero_bit -static inline int find_next_zero_bit (const unsigned long *vaddr,int size, -int offset) +static inline unsigned long find_next_zero_bit (const unsigned long *vaddr, +unsigned long size, +unsigned long offset) {const unsigned long *p = vaddr + (offset >>5 );int bit = offset &31UL , res;
@@ -370,11 +371,12 @@ static inline int find_next_zero_bit(const unsigned long *vaddr, int size, }#define find_next_zero_bit find_next_zero_bit -static inline int find_first_bit (const unsigned long *vaddr,unsigned size) +static inline unsigned long find_first_bit (const unsigned long *vaddr, +unsigned long size) {const unsigned long *p = vaddr; -int res =32 ; -unsigned int words; +unsigned long res =32 ; +unsigned long words;unsigned long num;if (!size)
@@ -395,8 +397,9 @@ static inline int find_first_bit(const unsigned long *vaddr, unsigned size) }#define find_first_bit find_first_bit -static inline int find_next_bit (const unsigned long *vaddr,int size, -int offset) +static inline unsigned long find_next_bit (const unsigned long *vaddr, +unsigned long size, +unsigned long offset) {const unsigned long *p = vaddr + (offset >>5 );int bit = offset &31UL , res;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 182/224 net: rtnetlink: remove redundant assignment to variable err
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Colin Ian King <[email protected]>
[ Upstream commit 7d3118016787b5c05da94b3bcdb96c9d6ff82c44 ]
The variable err is being initializeed with a value that is never read and it is being updated later with a new value. The initialization is redundant and can be removed.
Addresses-Coverity: ("Unused value")
Stable-dep-of: bf29555f5bdc ("rtnetlink: Allow deleting FDB entries in user namespace")
--- net/core/rtnetlink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/rtnetlink.c +1 -1
@@ -3823,8 +3823,8 @@ static int rtnl_fdb_del(struct sk_buff *skb, struct nlmsghdr *nlh,struct ndmsg *ndm;struct nlattr *tb[NDA_MAX +1 ];struct net_device *dev; -int err = -EINVAL ;__u8 *addr; +int err;u16 vid;if (!netlink_capable (skb,CAP_NET_ADMIN ))
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 183/224 net: rtnetlink: add msg kind names
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nikolay Aleksandrov <[email protected]>
[ Upstream commit 12dc5c2cb7b269c5a1c6d02844f40bfce942a7a6 ]
Add rtnl kind names instead of using raw values. We'll need to check for DEL kind later to validate bulk flag support.
Stable-dep-of: bf29555f5bdc ("rtnetlink: Allow deleting FDB entries in user namespace")
--- include/net/rtnetlink.h | 7 +++++++ net/core/rtnetlink.c | 6 +++--- 2 files changed, 10 insertions(+), 3 deletions(-)
include/net/rtnetlink.h +7 -0
@@ -13,6 +13,13 @@ enum rtnl_link_flags { RTNL_FLAG_DOIT_UNLOCKED = 1, }; +enum rtnl_kinds { +RTNL_KIND_NEW , +RTNL_KIND_DEL , +RTNL_KIND_GET , +RTNL_KIND_SET +}; +void rtnl_register (int protocol,int msgtype,rtnl_doit_func ,rtnl_dumpit_func ,unsigned int flags); int rtnl_register_module(struct module *owner, int protocol, int msgtype,
net/core/rtnetlink.c +3 -3
@@ -5193,11 +5193,11 @@ static int rtnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, {struct net *net =sock_net (skb->sk);struct rtnl_link *link; +enum rtnl_kinds kind;struct module *owner;int err = -EOPNOTSUPP ;rtnl_doit_func doit;unsigned int flags; -int kind;int family;int type;
@@ -5214,11 +5214,11 @@ static int rtnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, family = ((struct rtgenmsg *)nlmsg_data (nlh))->rtgen_family; kind = type&3 ; -if (kind !=2 && !netlink_net_capable (skb,CAP_NET_ADMIN )) +if (kind !=RTNL_KIND_GET && !netlink_net_capable (skb,CAP_NET_ADMIN ))return -EPERM ;rcu_read_lock (); -if (kind ==2 && nlh->nlmsg_flags&NLM_F_DUMP ) { +if (kind ==RTNL_KIND_GET && (nlh->nlmsg_flags &NLM_F_DUMP )) {struct sock *rtnl;rtnl_dumpit_func dumpit;u16 min_dump_alloc =0 ;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 184/224 net: rtnetlink: add helper to extract msg types kind
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nikolay Aleksandrov <[email protected]>
[ Upstream commit 2e9ea3e30f696fd438319c07836422bb0bbb4608 ]
Add a helper which extracts the msg type's kind using the kind mask (0x3).
Stable-dep-of: bf29555f5bdc ("rtnetlink: Allow deleting FDB entries in user namespace")
--- include/net/rtnetlink.h | 6 ++++++ net/core/rtnetlink.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-)
include/net/rtnetlink.h +6 -0
@@ -19,6 +19,12 @@ enum rtnl_kinds {RTNL_KIND_GET , RTNL_KIND_SET }; +#define RTNL_KIND_MASK 0x3 + +static inline enum rtnl_kinds rtnl_msgtype_kind (int msgtype) +{ +return msgtype &RTNL_KIND_MASK ; +}void rtnl_register (int protocol,int msgtype,rtnl_doit_func ,rtnl_dumpit_func ,unsigned int flags);
net/core/rtnetlink.c +1 -1
@@ -5212,7 +5212,7 @@ static int rtnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh,return 0 ; family = ((struct rtgenmsg *)nlmsg_data (nlh))->rtgen_family; - kind = type&3 ; + kind =rtnl_msgtype_kind (type);if (kind !=RTNL_KIND_GET && !netlink_net_capable (skb,CAP_NET_ADMIN ))return -EPERM ;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 185/224 net: rtnetlink: use BIT for flag values
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nikolay Aleksandrov <[email protected]>
[ Upstream commit 0569e31f1bc2f50613ba4c219f3ecc0d1174d841 ]
Use BIT to define flag values.
Stable-dep-of: bf29555f5bdc ("rtnetlink: Allow deleting FDB entries in user namespace")
--- include/net/rtnetlink.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/net/rtnetlink.h +1 -1
@@ -10,7 +10,7 @@ typedef int (*rtnl_doit_func)(struct sk_buff *, struct nlmsghdr *,typedef int (*rtnl_dumpit_func )(struct sk_buff *,struct netlink_callback *);enum rtnl_link_flags { -RTNL_FLAG_DOIT_UNLOCKED =1 , +RTNL_FLAG_DOIT_UNLOCKED =BIT (0 ), };enum rtnl_kinds {
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 186/224 net: netlink: add NLM_F_BULK delete request modifier
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nikolay Aleksandrov <[email protected]>
[ Upstream commit 545528d788556c724eeb5400757f828ef27782a8 ]
Add a new delete request modifier called NLM_F_BULK which, when supported, would cause the request to delete multiple objects. The flag is a convenient way to signal that a multiple delete operation is requested which can be gradually added to different delete requests. In order to make sure older kernels will error out if the operation is not supported instead of doing something unintended we have to break a required condition when implementing support for this flag, f.e. for neighbors we will omit the mandatory mac address attribute. Initially it will be used to add flush with filtering support for bridge fdbs, but it also opens the door to add similar support to others.
Stable-dep-of: bf29555f5bdc ("rtnetlink: Allow deleting FDB entries in user namespace")
--- include/uapi/linux/netlink.h | 1 + 1 file changed, 1 insertion(+)
include/uapi/linux/netlink.h +1 -0
@@ -72,6 +72,7 @@ struct nlmsghdr {/* Modifiers to DELETE request */ #define NLM_F_NONREC 0x100/* Do not delete recursively */ +#define NLM_F_BULK 0x200/* Delete multiple objects */ /* Flags for ACK message */ #define NLM_F_CAPPED 0x100/* request was capped */
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 187/224 net: rtnetlink: add bulk delete support flag
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nikolay Aleksandrov <[email protected]>
[ Upstream commit a6cec0bcd34264be8887791594be793b3f12719f ]
Add a new rtnl flag (RTNL_FLAG_BULK_DEL_SUPPORTED) which is used to verify that the delete operation allows bulk object deletion. Also emit a warning if anyone tries to set it for non-delete kind.
Stable-dep-of: bf29555f5bdc ("rtnetlink: Allow deleting FDB entries in user namespace")
--- include/net/rtnetlink.h | 3 ++- net/core/rtnetlink.c | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-)
include/net/rtnetlink.h +2 -1
@@ -10,7 +10,8 @@ typedef int (*rtnl_doit_func)(struct sk_buff *, struct nlmsghdr *,typedef int (*rtnl_dumpit_func )(struct sk_buff *,struct netlink_callback *);enum rtnl_link_flags { -RTNL_FLAG_DOIT_UNLOCKED =BIT (0 ), +RTNL_FLAG_DOIT_UNLOCKED =BIT (0 ), +RTNL_FLAG_BULK_DEL_SUPPORTED =BIT (1 ), };enum rtnl_kinds {
net/core/rtnetlink.c +8 -0
@@ -214,6 +214,8 @@ static int rtnl_register_internal(struct module *owner,if (dumpit) link->dumpit = dumpit; +WARN_ON (rtnl_msgtype_kind (msgtype) !=RTNL_KIND_DEL && + (flags &RTNL_FLAG_BULK_DEL_SUPPORTED )); link->flags |= flags;/* publish protocol:msgtype */
@@ -5274,6 +5276,12 @@ static int rtnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, } flags = link->flags; +if (kind ==RTNL_KIND_DEL && (nlh->nlmsg_flags &NLM_F_BULK ) && + !(flags &RTNL_FLAG_BULK_DEL_SUPPORTED )) { +NL_SET_ERR_MSG (extack,"Bulk delete is not supported" ); + goto err_unlock; + } +if (flags &RTNL_FLAG_DOIT_UNLOCKED ) { doit = link->doit;rcu_read_unlock ();
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 188/224 net: add ndo_fdb_del_bulk
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nikolay Aleksandrov <[email protected]>
[ Upstream commit 1306d5362a591493a2d07f685ed2cc480dcda320 ]
Add a new netdev op called ndo_fdb_del_bulk, it will be later used for driver-specific bulk delete implementation dispatched from rtnetlink. The first user will be the bridge, we need it to signal to rtnetlink from the driver that we support bulk delete operation (NLM_F_BULK).
Stable-dep-of: bf29555f5bdc ("rtnetlink: Allow deleting FDB entries in user namespace")
--- include/linux/netdevice.h | 9 +++++++++ 1 file changed, 9 insertions(+)
include/linux/netdevice.h +9 -0
@@ -1158,6 +1158,10 @@ struct tlsdev_ops;* struct net_device *dev, * const unsigned char *addr, u16 vid) * Deletes the FDB entry from dev coresponding to addr. +* int (*ndo_fdb_del_bulk)(struct ndmsg *ndm, struct nlattr *tb[], +* struct net_device *dev, +* u16 vid, +* struct netlink_ext_ack *extack); * int (*ndo_fdb_dump)(struct sk_buff *skb, struct netlink_callback *cb, * struct net_device *dev, struct net_device *filter_dev, * int *idx)
@@ -1396,6 +1400,11 @@ struct net_device_ops {struct net_device *dev, const unsigned char *addr, u16 vid); +int (*ndo_fdb_del_bulk)(struct ndmsg *ndm, +struct nlattr *tb[], +struct net_device *dev, +u16 vid, +struct netlink_ext_ack *extack); int (*ndo_fdb_dump)(struct sk_buff *skb, struct netlink_callback *cb, struct net_device *dev,
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 189/224 net: rtnetlink: add NLM_F_BULK support to rtnl_fdb_del
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nikolay Aleksandrov <[email protected]>
[ Upstream commit 9e83425993f38bb89e0ea07849ba0039a748e85b ]
When NLM_F_BULK is specified in a fdb del message we need to handle it differently. First since this is a new call we can strictly validate the passed attributes, at first only ifindex and vlan are allowed as these will be the initially supported filter attributes, any other attribute is rejected. The mac address is no longer mandatory, but we use it to error out in older kernels because it cannot be specified with bulk request (the attribute is not allowed) and then we have to dispatch the call to ndo_fdb_del_bulk if the device supports it. The del bulk callback can do further validation of the attributes if necessary.
Stable-dep-of: bf29555f5bdc ("rtnetlink: Allow deleting FDB entries in user namespace")
--- net/core/rtnetlink.c | 67 +++++++++++++++++++++++++++++++------------- 1 file changed, 48 insertions(+), 19 deletions(-)
net/core/rtnetlink.c +48 -19
@@ -3818,22 +3818,34 @@ int ndo_dflt_fdb_del(struct ndmsg *ndm, }EXPORT_SYMBOL (ndo_dflt_fdb_del); +static const struct nla_policy fdb_del_bulk_policy[NDA_MAX +1 ] = { + [NDA_VLAN ] = { .type =NLA_U16 }, + [NDA_IFINDEX ] =NLA_POLICY_MIN (NLA_S32 ,1 ), +}; +static int rtnl_fdb_del (struct sk_buff *skb,struct nlmsghdr *nlh,struct netlink_ext_ack *extack) { +bool del_bulk = !!(nlh->nlmsg_flags &NLM_F_BULK );struct net *net =sock_net (skb->sk); +const struct net_device_ops *ops;struct ndmsg *ndm;struct nlattr *tb[NDA_MAX +1 ];struct net_device *dev; -__u8 *addr; +__u8 *addr =NULL ;int err;u16 vid;if (!netlink_capable (skb,CAP_NET_ADMIN ))return -EPERM ; - err =nlmsg_parse_deprecated (nlh,sizeof (*ndm), tb,NDA_MAX ,NULL , - extack); +if (!del_bulk) { + err =nlmsg_parse_deprecated (nlh,sizeof (*ndm), tb,NDA_MAX , +NULL , extack); + }else { + err =nlmsg_parse (nlh,sizeof (*ndm), tb,NDA_MAX , + fdb_del_bulk_policy, extack); + }if (err <0 )return err;
@@ -3849,9 +3861,12 @@ static int rtnl_fdb_del(struct sk_buff *skb, struct nlmsghdr *nlh,return -ENODEV ; } -if (!tb[NDA_LLADDR ] ||nla_len (tb[NDA_LLADDR ]) !=ETH_ALEN ) { -NL_SET_ERR_MSG (extack,"invalid address" ); -return -EINVAL ; +if (!del_bulk) { +if (!tb[NDA_LLADDR ] ||nla_len (tb[NDA_LLADDR ]) !=ETH_ALEN ) { +NL_SET_ERR_MSG (extack,"invalid address" ); +return -EINVAL ; + } + addr =nla_data (tb[NDA_LLADDR ]); }if (dev->type !=ARPHRD_ETHER ) {
@@ -3859,8 +3874,6 @@ static int rtnl_fdb_del(struct sk_buff *skb, struct nlmsghdr *nlh,return -EINVAL ; } - addr =nla_data (tb[NDA_LLADDR ]); - err =fdb_vid_parse (tb[NDA_VLAN ], &vid, extack);if (err)return err;
@@ -3871,10 +3884,16 @@ static int rtnl_fdb_del(struct sk_buff *skb, struct nlmsghdr *nlh,if ((!ndm->ndm_flags || ndm->ndm_flags &NTF_MASTER ) &&netif_is_bridge_port (dev)) {struct net_device *br_dev =netdev_master_upper_dev_get (dev); -const struct net_device_ops *ops = br_dev->netdev_ops; -if (ops->ndo_fdb_del) - err = ops->ndo_fdb_del (ndm, tb, dev, addr, vid); + ops = br_dev->netdev_ops; +if (!del_bulk) { +if (ops->ndo_fdb_del) + err = ops->ndo_fdb_del (ndm, tb, dev, addr, vid); + }else { +if (ops->ndo_fdb_del_bulk) + err = ops->ndo_fdb_del_bulk (ndm, tb, dev, vid, + extack); + }if (err) goto out;
@@ -3884,15 +3903,24 @@ static int rtnl_fdb_del(struct sk_buff *skb, struct nlmsghdr *nlh,/* Embedded bridge, macvlan, and any other device support */ if (ndm->ndm_flags &NTF_SELF ) { -if (dev->netdev_ops->ndo_fdb_del) - err = dev->netdev_ops->ndo_fdb_del (ndm, tb, dev, addr, - vid); -else - err =ndo_dflt_fdb_del (ndm, tb, dev, addr, vid); + ops = dev->netdev_ops; +if (!del_bulk) { +if (ops->ndo_fdb_del) + err = ops->ndo_fdb_del (ndm, tb, dev, addr, vid); +else + err =ndo_dflt_fdb_del (ndm, tb, dev, addr, vid); + }else { +/* in case err was cleared by NTF_MASTER call */ + err = -EOPNOTSUPP ; +if (ops->ndo_fdb_del_bulk) + err = ops->ndo_fdb_del_bulk (ndm, tb, dev, vid, + extack); + }if (!err) { -rtnl_fdb_notify (dev, addr, vid,RTM_DELNEIGH , - ndm->ndm_state); +if (!del_bulk) +rtnl_fdb_notify (dev, addr, vid,RTM_DELNEIGH , + ndm->ndm_state); ndm->ndm_flags &= ~NTF_SELF ; } }
@@ -5407,7 +5435,8 @@ void __init rtnetlink_init(void)rtnl_register (PF_UNSPEC ,RTM_GETNETCONF ,NULL , rtnl_dump_all,0 );rtnl_register (PF_BRIDGE ,RTM_NEWNEIGH , rtnl_fdb_add,NULL ,0 ); -rtnl_register (PF_BRIDGE ,RTM_DELNEIGH , rtnl_fdb_del,NULL ,0 ); +rtnl_register (PF_BRIDGE ,RTM_DELNEIGH , rtnl_fdb_del,NULL , +RTNL_FLAG_BULK_DEL_SUPPORTED );rtnl_register (PF_BRIDGE ,RTM_GETNEIGH , rtnl_fdb_get, rtnl_fdb_dump,0 );rtnl_register (PF_BRIDGE ,RTM_GETLINK ,NULL , rtnl_bridge_getlink,0 );
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 190/224 rtnetlink: Allow deleting FDB entries in user namespace
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Wiesböck <[email protected]>
[ Upstream commit bf29555f5bdc017bac22ca66fcb6c9f46ec8788f ]
Creating FDB entries is possible from a non-initial user namespace when having CAP_NET_ADMIN, yet, when deleting FDB entries, processes receive an EPERM because the capability is always checked against the initial user namespace. This restricts the FDB management from unprivileged containers.
Drop the netlink_capable check in rtnl_fdb_del as it was originally dropped in c5c351088ae7 and reintroduced in 1690be63a27b without intention.
This patch was tested using a container on GyroidOS, where it was possible to delete FDB entries from an unprivileged user namespace and private network namespace.
--- net/core/rtnetlink.c | 3 --- 1 file changed, 3 deletions(-)
net/core/rtnetlink.c +0 -3
@@ -3836,9 +3836,6 @@ static int rtnl_fdb_del(struct sk_buff *skb, struct nlmsghdr *nlh,int err;u16 vid; -if (!netlink_capable (skb,CAP_NET_ADMIN )) -return -EPERM ; -if (!del_bulk) { err =nlmsg_parse_deprecated (nlh,sizeof (*ndm), tb,NDA_MAX ,NULL , extack);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 191/224 net: enetc: correct the value of ENETC_RXB_TRUESIZE
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wei Fang <[email protected]>
[ Upstream commit e59bc32df2e989f034623a580e30a2a72af33b3f ]
The ENETC RX ring uses the page halves flipping mechanism, each page is split into two halves for the RX ring to use. And ENETC_RXB_TRUESIZE is defined to 2048 to indicate the size of half a page. However, the page size is configurable, for ARM64 platform, PAGE_SIZE is default to 4K, but it could be configured to 16K or 64K.
When PAGE_SIZE is set to 16K or 64K, ENETC_RXB_TRUESIZE is not correct, and the RX ring will always use the first half of the page. This is not consistent with the description in the relevant kernel doc and commit messages.
This issue is invisible in most cases, but if users want to increase PAGE_SIZE to receive a Jumbo frame with a single buffer for some use cases, it will not work as expected, because the buffer size of each RX BD is fixed to 2048 bytes.
Based on the above two points, we expect to correct ENETC_RXB_TRUESIZE to (PAGE_SIZE >> 1), as described in the comment.
--- drivers/net/ethernet/freescale/enetc/enetc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/freescale/enetc/enetc.h +1 -1
@@ -27,7 +27,7 @@ struct enetc_tx_swbd { };#define ENETC_RX_MAXFRM_SIZE ENETC_MAC_MAXFRM_SIZE -#define ENETC_RXB_TRUESIZE 2048/* PAGE_SIZE >> 1 */ +#define ENETC_RXB_TRUESIZE (PAGE_SIZE >> 1)#define ENETC_RXB_PAD NET_SKB_PAD/* add extra space if needed */ #define ENETC_RXB_DMA_SIZE \ (SKB_WITH_OVERHEAD(ENETC_RXB_TRUESIZE) - ENETC_RXB_PAD)
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 192/224 arm64, mm: avoid always making PTE dirty in pte_mkwrite()
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Huang Ying <[email protected]>
[ Upstream commit 143937ca51cc6ae2fccc61a1cb916abb24cd34f5 ]
Current pte_mkwrite_novma() makes PTE dirty unconditionally. This may mark some pages that are never written dirty wrongly. For example, do_swap_page() may map the exclusive pages with writable and clean PTEs if the VMA is writable and the page fault is for read access. However, current pte_mkwrite_novma() implementation always dirties the PTE. This may cause unnecessary disk writing if the pages are never written before being reclaimed.
So, change pte_mkwrite_novma() to clear the PTE_RDONLY bit only if the PTE_DIRTY bit is set to make it possible to make the PTE writable and clean.
The current behavior was introduced in commit 73e86cb03cf2 ("arm64:
Move PTE_RDONLY bit handling out of set_pte_at()"). Before that, pte_mkwrite() only sets the PTE_WRITE bit, while set_pte_at() only clears the PTE_RDONLY bit if both the PTE_WRITE and the PTE_DIRTY bits are set.
To test the performance impact of the patch, on an arm64 server machine, run 16 redis-server processes on socket 1 and 16 memtier_benchmark processes on socket 0 with mostly get transactions (that is, redis-server will mostly read memory only). The memory footprint of redis-server is larger than the available memory, so swap out/in will be triggered. Test results show that the patch can avoid most swapping out because the pages are mostly clean. And the benchmark throughput improves ~23.9% in the test.
--- arch/arm64/include/asm/pgtable.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm64/include/asm/pgtable.h +2 -1
@@ -145,7 +145,8 @@ static inline pte_t set_pte_bit(pte_t pte, pgprot_t prot)static inline pte_t pte_mkwrite (pte_t pte) { pte =set_pte_bit (pte,__pgprot (PTE_WRITE )); - pte =clear_pte_bit (pte,__pgprot (PTE_RDONLY )); +if (pte_sw_dirty (pte)) + pte =clear_pte_bit (pte,__pgprot (PTE_RDONLY ));return pte; }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 193/224 sctp: avoid NULL dereference when chunk data buffer is missing
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexey Simakov <[email protected]>
[ Upstream commit 441f0647f7673e0e64d4910ef61a5fb8f16bfb82 ]
chunk->skb pointer is dereferenced in the if-block where it's supposed to be NULL only.
chunk->skb can only be NULL if chunk->head_skb is not. Check for frag_list instead and do it just before replacing chunk->skb. We're sure that otherwise chunk->skb is non-NULL because of outer if() condition.
--- net/sctp/inqueue.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
net/sctp/inqueue.c +7 -6
@@ -163,13 +163,14 @@ struct sctp_chunk *sctp_inq_pop(struct sctp_inq *queue) chunk->head_skb = chunk->skb;/* skbs with "cover letter" */ -if (chunk->head_skb && chunk->skb->data_len == chunk->skb->len) +if (chunk->head_skb && chunk->skb->data_len == chunk->skb->len) { +if (WARN_ON (!skb_shinfo (chunk->skb)->frag_list)) { +__SCTP_INC_STATS (dev_net (chunk->skb->dev), +SCTP_MIB_IN_PKT_DISCARDS ); +sctp_chunk_free (chunk); + goto next_chunk; + } chunk->skb =skb_shinfo (chunk->skb)->frag_list; - -if (WARN_ON (!chunk->skb)) { -__SCTP_INC_STATS (dev_net (chunk->skb->dev),SCTP_MIB_IN_PKT_DISCARDS ); -sctp_chunk_free (chunk); - goto next_chunk; } }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 194/224 net: bonding: fix possible peer notify event loss or dup issue
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tonghao Zhang <[email protected]>
commit 10843e1492e474c02b91314963161731fa92af91 upstream.
If the send_peer_notif counter and the peer event notify are not synchronized. It may cause problems such as the loss or dup of peer notify event.
Before this patch:
- If should_notify_peers is true and the lock for send_peer_notif-- fails, peer event may be sent again in next mii_monitor loop, because should_notify_peers is still true.
- If should_notify_peers is true and the lock for send_peer_notif-- succeeded, but the lock for peer event fails, the peer event will be lost.
This patch locks the RTNL for send_peer_notif, events, and commit simultaneously.
--- drivers/net/bonding/bond_main.c | 40 ++++++++++++++++++---------------------- 1 file changed, 18 insertions(+), 22 deletions(-)
drivers/net/bonding/bond_main.c +18 -22
@@ -2331,7 +2331,7 @@ static void bond_mii_monitor(struct work { struct bonding *bond = container_of(work, struct bonding, mii_work.work); -bool should_notify_peers = false; +bool should_notify_peers;bool commit;unsigned long delay;struct slave *slave;
@@ -2343,30 +2343,33 @@ static void bond_mii_monitor(struct work goto re_arm;rcu_read_lock (); + should_notify_peers =bond_should_notify_peers (bond); commit = !!bond_miimon_inspect (bond); -if (bond->send_peer_notif) { -rcu_read_unlock (); -if (rtnl_trylock ()) { - bond->send_peer_notif--; -rtnl_unlock (); - } - }else { -rcu_read_unlock (); - } -if (commit) { +rcu_read_unlock (); + +if (commit || bond->send_peer_notif) {/* Race avoidance with bond_close cancel of workqueue */ if (!rtnl_trylock ()) { delay =1 ; - should_notify_peers = false; goto re_arm; } -bond_for_each_slave (bond, slave, iter) { -bond_commit_link_state (slave,BOND_SLAVE_NOTIFY_LATER ); +if (commit) { +bond_for_each_slave (bond, slave, iter) { +bond_commit_link_state (slave, +BOND_SLAVE_NOTIFY_LATER ); + } +bond_miimon_commit (bond); + } + +if (bond->send_peer_notif) { + bond->send_peer_notif--; +if (should_notify_peers) +call_netdevice_notifiers (NETDEV_NOTIFY_PEERS , + bond->dev); } -bond_miimon_commit (bond);rtnl_unlock ();/* might sleep, hold no other locks */ }
@@ -2374,13 +2377,6 @@ static void bond_mii_monitor(struct work re_arm:if (bond->params.miimon)queue_delayed_work (bond->wq, &bond->mii_work, delay); - -if (should_notify_peers) { -if (!rtnl_trylock ()) -return ; -call_netdevice_notifiers (NETDEV_NOTIFY_PEERS , bond->dev); -rtnl_unlock (); - } }static int bond_upper_dev_walk (struct net_device *upper,void *data)
Greg Kroah-Hartman
maintainerPATCH 195/224 Revert "cpuidle: menu: Avoid discarding useful information"
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rafael J. Wysocki <[email protected]>
commit 10fad4012234a7dea621ae17c0c9486824f645a0 upstream.
It is reported that commit 85975daeaa4d ("cpuidle: menu: Avoid discarding useful information") led to a performance regression on Intel Jasper Lake systems because it reduced the time spent by CPUs in idle state C7 which is correlated to the maximum frequency the CPUs can get to because of an average running power limit [1].
Before that commit, get_typical_interval() would have returned UINT_MAX whenever it had been unable to make a high-confidence prediction which had led to selecting the deepest available idle state too often and both power and performance had been inadequate as a result of that on some systems. However, this had not been a problem on systems with relatively aggressive average running power limits, like the Jasper Lake systems in question, because on those systems it was compensated by the ability to run CPUs faster.
It was addressed by causing get_typical_interval() to return a number based on the recent idle duration information available to it even if it could not make a high-confidence prediction, but that clearly did not take the possible correlation between idle power and available CPU capacity into account.
For this reason, revert most of the changes made by commit 85975daeaa4d, except for one cosmetic cleanup, and add a comment explaining the rationale for returning UINT_MAX from get_typical_interval() when it is unable to make a high-confidence prediction.
--- drivers/cpuidle/governors/menu.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-)
drivers/cpuidle/governors/menu.c +9 -12
@@ -258,20 +258,17 @@ again:* * This can deal with workloads that have long pauses interspersed * with sporadic activity with a bunch of short pauses. +* +* However, if the number of remaining samples is too small to exclude +* any more outliers, allow the deepest available idle state to be +* selected because there are systems where the time spent by CPUs in +* deep idle states is correlated to the maximum frequency the CPUs +* can get to. On those systems, shallow idle states should be avoided +* unless there is a clear indication that the given CPU is most likley +* going to be woken up shortly. */ -if (divisor *4 <=INTERVALS *3 ) { -/* -* If there are sufficiently many data points still under -* consideration after the outliers have been eliminated, -* returning without a prediction would be a mistake because it -* is likely that the next interval will not exceed the current -* maximum, so return the latter in that case. -*/ -if (divisor >=INTERVALS /2 ) -return max; - +if (divisor *4 <=INTERVALS *3 )return UINT_MAX ; - } thresh = max -1 ; goto again;
Greg Kroah-Hartman
maintainerPATCH 196/224 MIPS: Malta: Fix keyboard resource preventing i8042 driver from registering
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maciej W. Rozycki <[email protected]>
commit bf5570590a981d0659d0808d2d4bcda21b27a2a5 upstream.
MIPS Malta platform code registers the PCI southbridge legacy port I/O PS/2 keyboard range as a standard resource marked as busy. It prevents the i8042 driver from registering as it fails to claim the resource in a call to i8042_platform_init(). Consequently PS/2 keyboard and mouse devices cannot be used with this platform.
Fix the issue by removing the busy marker from the standard reservation, making the driver register successfully:
serio: i8042 KBD port at 0x60,0x64 irq 1
serio: i8042 AUX port at 0x60,0x64 irq 12
and the resource show up as expected among the legacy devices:
00000000-00ffffff : MSC PCI I/O
00000000-0000001f : dma1
00000020-00000021 : pic1
00000040-0000005f : timer
00000060-0000006f : keyboard
00000060-0000006f : i8042
00000070-00000077 : rtc0
00000080-0000008f : dma page reg
000000a0-000000a1 : pic2
000000c0-000000df : dma2
[...]If the i8042 driver has not been configured, then the standard resource will remain there preventing any conflicting dynamic assignment of this PCI port I/O address range.
--- arch/mips/mti-malta/malta-setup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/mti-malta/malta-setup.c +1 -1
@@ -48,7 +48,7 @@ static struct resource standard_io_resou .name = "keyboard", .start = 0x60, .end = 0x6f, - .flags =IORESOURCE_IO |IORESOURCE_BUSY + .flags =IORESOURCE_IO }, { .name = "dma page reg",
Greg Kroah-Hartman
maintainerPATCH 197/224 ocfs2: clear extent cache after moving/defragmenting extents
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Deepanshu Kartikey <[email protected]>
commit 78a63493f8e352296dbc7cb7b3f4973105e8679e upstream.
The extent map cache can become stale when extents are moved or defragmented, causing subsequent operations to see outdated extent flags. This triggers a BUG_ON in ocfs2_refcount_cal_cow_clusters().
The problem occurs when:
1. copy_file_range() creates a reflinked extent with OCFS2_EXT_REFCOUNTED
2. ioctl(FITRIM) triggers ocfs2_move_extents()
3. __ocfs2_move_extents_range() reads and caches the extent (flags=0x2)
4. ocfs2_move_extent()/ocfs2_defrag_extent() calls __ocfs2_move_extent() which clears OCFS2_EXT_REFCOUNTED flag on disk (flags=0x0)
5. The extent map cache is not invalidated after the move
6. Later write() operations read stale cached flags (0x2) but disk has updated flags (0x0), causing a mismatch
7. BUG_ON(!(rec->e_flags & OCFS2_EXT_REFCOUNTED)) triggers
Fix by clearing the extent map cache after each extent move/defrag operation in __ocfs2_move_extents_range(). This ensures subsequent operations read fresh extent data from disk.
--- fs/ocfs2/move_extents.c | 5 +++++ 1 file changed, 5 insertions(+)
fs/ocfs2/move_extents.c +5 -0
@@ -870,6 +870,11 @@ static int __ocfs2_move_extents_range(stmlog_errno (ret); goto out; } +/* +* Invalidate extent cache after moving/defragging to prevent +* stale cached data with outdated extent flags. +*/ +ocfs2_extent_map_trunc (inode, cpos); context->clusters_moved += alloc_size; next:
Greg Kroah-Hartman
maintainerPATCH 198/224 net: usb: rtl8150: Fix frame padding
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Pecio <[email protected]>
commit 75cea9860aa6b2350d90a8d78fed114d27c7eca2 upstream.
TX frames aren't padded and unknown memory is sent into the ether.
Theoretically, it isn't even guaranteed that the extra memory exists and can be sent out, which could cause further problems. In practice, I found that plenty of tailroom exists in the skb itself (in my test with ping at least) and skb_padto() easily succeeds, so use it here.
In the event of -ENOMEM drop the frame like other drivers do.
The use of one more padding byte instead of a USB zero-length packet is retained to avoid regression. I have a dodgy Etron xHCI controller which doesn't seem to support sending ZLPs at all.
--- drivers/net/usb/rtl8150.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/net/usb/rtl8150.c +9 -2
@@ -705,9 +705,16 @@ static netdev_tx_t rtl8150_start_xmit(strtl8150_t *dev =netdev_priv (netdev);int count, res; +/* pad the frame and ensure terminating USB packet, datasheet 9.2.3 */ + count =max (skb->len,ETH_ZLEN ); +if (count %64 ==0 ) + count++; +if (skb_padto (skb, count)) { + netdev->stats.tx_dropped++; +return NETDEV_TX_OK ; + } +netif_stop_queue (netdev); - count = (skb->len <60 ) ?60 : skb->len; - count = (count &0x3f ) ? count : count +1 ; dev->tx_skb = skb;usb_fill_bulk_urb (dev->tx_urb, dev->udev,usb_sndbulkpipe (dev->udev,2 ), skb->data, count, write_bulk_callback, dev);
Greg Kroah-Hartman
maintainerPATCH 199/224 net: ravb: Ensure memory write completes before ringing TX doorbell
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lad Prabhakar <[email protected]>
commit 706136c5723626fcde8dd8f598a4dcd251e24927 upstream.
Add a final dma_wmb() barrier before triggering the transmit request (TCCR_TSRQ) to ensure all descriptor and buffer writes are visible to the DMA engine.
According to the hardware manual, a read-back operation is required before writing to the doorbell register to guarantee completion of previous writes. Instead of performing a dummy read, a dma_wmb() is used to both enforce the same ordering semantics on the CPU side and also to ensure completion of writes.
--- drivers/net/ethernet/renesas/ravb_main.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/net/ethernet/renesas/ravb_main.c +8 -0
@@ -1602,6 +1602,14 @@ static netdev_tx_t ravb_start_xmit(struc }else { desc->die_dt =DT_FSINGLE ; } + +/* Before ringing the doorbell we need to make sure that the latest +* writes have been committed to memory, otherwise it could delay +* things until the doorbell is rang again. +* This is in replacement of the read operation mentioned in the HW +* manuals. +*/ +dma_wmb ();ravb_modify (ndev,TCCR ,TCCR_TSRQ0 << q,TCCR_TSRQ0 << q); priv->cur_tx[q] += num_tx_desc;
Greg Kroah-Hartman
maintainerPATCH 200/224 USB: serial: option: add UNISOC UIS7720
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Renjun Wang <[email protected]>
commit 71c07570b918f000de5d0f7f1bf17a2887e303b5 upstream.
Add support for UNISOC (Spreadtrum) UIS7720 (A7720) module.
T: Bus=05 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 5 Spd=480 MxCh= 0 D: Ver= 2.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=1782 ProdID=4064 Rev=04.04 S: Manufacturer=Unisoc-phone S: Product=Unisoc-phone S: SerialNumber=0123456789ABCDEF C: #Ifs= 9 Cfg#= 1 Atr=c0 MxPwr=500mA I: If#= 0 Alt= 0 #EPs= 1 Cls=e0(wlcon) Sub=01 Prot=03 Driver=rndis_host E: Ad=82(I) Atr=03(Int.) MxPS= 8 Ivl=32ms I: If#= 1 Alt= 0 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=rndis_host E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 6 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 7 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=07(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 8 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=(none) E: Ad=08(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=89(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
0&1: RNDIS, 2: LOG, 3: DIAG, 4&5: AT Ports, 6&7: AT2 Ports, 8: ADB
--- drivers/usb/serial/option.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/serial/option.c +2 -0
@@ -617,6 +617,7 @@ static void option_instat_callback(struc#define UNISOC_VENDOR_ID 0x1782/* TOZED LT70-C based on UNISOC SL8563 uses UNISOC's vendor ID */ #define TOZED_PRODUCT_LT70C 0x4055 +#define UNISOC_PRODUCT_UIS7720 0x4064/* Luat Air72*U series based on UNISOC UIS8910 uses UNISOC's vendor ID */ #define LUAT_PRODUCT_AIR720U 0x4e00
@@ -2466,6 +2467,7 @@ static const struct usb_device_id option { USB_DEVICE_AND_INTERFACE_INFO(SIERRA_VENDOR_ID, SIERRA_PRODUCT_EM9291, 0xff, 0xff, 0x30) }, { USB_DEVICE_AND_INTERFACE_INFO(SIERRA_VENDOR_ID, SIERRA_PRODUCT_EM9291, 0xff, 0xff, 0x40) }, { USB_DEVICE_AND_INTERFACE_INFO(UNISOC_VENDOR_ID, TOZED_PRODUCT_LT70C, 0xff, 0, 0) }, + { USB_DEVICE_AND_INTERFACE_INFO(UNISOC_VENDOR_ID, UNISOC_PRODUCT_UIS7720, 0xff, 0, 0) }, { USB_DEVICE_AND_INTERFACE_INFO(UNISOC_VENDOR_ID, LUAT_PRODUCT_AIR720U, 0xff, 0, 0) }, { USB_DEVICE_INTERFACE_CLASS(0x1bbb, 0x0530, 0xff), /* TCL IK512 MBIM */ .driver_info = NCTRL(1) },
Greg Kroah-Hartman
maintainerPATCH 201/224 USB: serial: option: add Quectel RG255C
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Reinhard Speyerer <[email protected]>
commit 89205c60c0fc96b73567a2e9fe27ee3f59d01193 upstream.
Add support for Quectel RG255C devices to complement commit 5c964c8a97c1 ("net: usb: qmi_wwan: add Quectel RG255C").
The composition is DM / NMEA / AT / QMI.
T: Bus=01 Lev=02 Prnt=99 Port=01 Cnt=02 Dev#=110 Spd=480 MxCh= 0 D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=2c7c ProdID=0316 Rev= 5.15 S: Manufacturer=Quectel S: Product=RG255C-GL S: SerialNumber=xxxxxxxx C:* #Ifs= 4 Cfg#= 1 Atr=a0 MxPwr=500mA I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=84(I) Atr=03(Int.) MxPS= 10 Ivl=32ms E: Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=50 Driver=qmi_wwan E: Ad=86(I) Atr=03(Int.) MxPS= 8 Ivl=32ms E: Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
--- drivers/usb/serial/option.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/usb/serial/option.c +4 -0
@@ -273,6 +273,7 @@ static void option_instat_callback(struc#define QUECTEL_PRODUCT_EM05CN 0x0312#define QUECTEL_PRODUCT_EM05G_GR 0x0313#define QUECTEL_PRODUCT_EM05G_RS 0x0314 +#define QUECTEL_PRODUCT_RG255C 0x0316#define QUECTEL_PRODUCT_EM12 0x0512#define QUECTEL_PRODUCT_RM500Q 0x0800#define QUECTEL_PRODUCT_RM520N 0x0801
@@ -1271,6 +1272,9 @@ static const struct usb_device_id option { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RM500K, 0xff, 0x00, 0x00) }, { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RG650V, 0xff, 0xff, 0x30) }, { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RG650V, 0xff, 0, 0) }, + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RG255C, 0xff, 0xff, 0x30) }, + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RG255C, 0xff, 0, 0) }, + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RG255C, 0xff, 0xff, 0x40) }, { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6001) }, { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CMU_300) },
Greg Kroah-Hartman
maintainerPATCH 202/224 USB: serial: option: add Telit FN920C04 ECM compositions
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: LI Qingwu <[email protected]>
commit 622865c73ae30f254abdf182f4b66cccbe3e0f10 upstream.
Add support for the Telit Cinterion FN920C04 module when operating in ECM (Ethernet Control Model) mode. The following USB product IDs are used by the module when AT#USBCFG is set to 3 or 7.
0x10A3: ECM + tty (NMEA) + tty (DUN) [+ tty (DIAG)]
T: Bus=01 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#= 3 Spd=480 MxCh= 0 D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=1bc7 ProdID=10a3 Rev= 5.15 S: Manufacturer=Telit Cinterion S: Product=FN920 S: SerialNumber=76e7cb38 C:* #Ifs= 5 Cfg#= 1 Atr=e0 MxPwr=500mA I:* If#= 0 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=06 Prot=00 Driver=cdc_ether E: Ad=82(I) Atr=03(Int.) MxPS= 16 Ivl=32ms I: If#= 1 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_ether I:* If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_ether E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=60 Driver=option E: Ad=84(I) Atr=03(Int.) MxPS= 10 Ivl=32ms E: Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=86(I) Atr=03(Int.) MxPS= 10 Ivl=32ms E: Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
0x10A8: ECM + tty (DUN) + tty (AUX) [+ tty (DIAG)]
T: Bus=03 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#= 3 Spd=480 MxCh= 0 D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=1bc7 ProdID=10a8 Rev= 5.15 S: Manufacturer=Telit Cinterion S: Product=FN920 S: SerialNumber=76e7cb38 C:* #Ifs= 5 Cfg#= 1 Atr=e0 MxPwr=500mA I:* If#= 0 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=06 Prot=00 Driver=cdc_ether E: Ad=82(I) Atr=03(Int.) MxPS= 16 Ivl=32ms I: If#= 1 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_ether I:* If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_ether E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=84(I) Atr=03(Int.) MxPS= 10 Ivl=32ms E: Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=86(I) Atr=03(Int.) MxPS= 10 Ivl=32ms E: Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
Adding these IDs allows the option driver to automatically create the corresponding /dev/ttyUSB* ports under ECM mode.
Tested with FN920C04 under ECM configuration (USBCFG=3 and 7).
--- drivers/usb/serial/option.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/usb/serial/option.c +4 -0
@@ -1403,10 +1403,14 @@ static const struct usb_device_id option .driver_info = RSVD(0) | NCTRL(3) }, { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x10a2, 0xff), /* Telit FN920C04 (MBIM) */ .driver_info = NCTRL(4) }, + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x10a3, 0xff), /* Telit FN920C04 (ECM) */ + .driver_info = NCTRL(4) }, { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x10a4, 0xff), /* Telit FN20C04 (rmnet) */ .driver_info = RSVD(0) | NCTRL(3) }, { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x10a7, 0xff), /* Telit FN920C04 (MBIM) */ .driver_info = NCTRL(4) }, + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x10a8, 0xff), /* Telit FN920C04 (ECM) */ + .driver_info = NCTRL(4) }, { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x10a9, 0xff), /* Telit FN20C04 (rmnet) */ .driver_info = RSVD(0) | NCTRL(2) | RSVD(3) | RSVD(4) }, { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x10aa, 0xff), /* Telit FN920C04 (MBIM) */
Greg Kroah-Hartman
maintainerPATCH 203/224 usb/core/quirks: Add Huawei ME906S to wakeup quirk
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tim Guttzeit <[email protected]>
commit dfc2cf4dcaa03601cd4ca0f7def88b2630fca6ab upstream.
The list of Huawei LTE modules needing the quirk fixing spurious wakeups was missing the IDs of the Huawei ME906S module, therefore suspend did not work.
--- drivers/usb/core/quirks.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/core/quirks.c +2 -0
@@ -462,6 +462,8 @@ static const struct usb_device_id usb_qu/* Huawei 4G LTE module */ { USB_DEVICE(0x12d1, 0x15bb), .driver_info = USB_QUIRK_DISCONNECT_SUSPEND }, + { USB_DEVICE(0x12d1, 0x15c1), .driver_info = + USB_QUIRK_DISCONNECT_SUSPEND }, { USB_DEVICE(0x12d1, 0x15c3), .driver_info = USB_QUIRK_DISCONNECT_SUSPEND },
Greg Kroah-Hartman
maintainerPATCH 204/224 xhci: dbc: enable back DbC in resume if it was enabled before suspend
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mathias Nyman <[email protected]>
commit 2bbd38fcd29670e46c0fdb9cd0e90507a8a1bf6a upstream.
DbC is currently only enabled back if it's in configured state during suspend.
If system is suspended after DbC is enabled, but before the device is properly enumerated by the host, then DbC would not be enabled back in resume.
Always enable DbC back in resume if it's suspended in enabled, connected, or configured state
--- drivers/usb/host/xhci-dbgcap.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/usb/host/xhci-dbgcap.c +8 -1
@@ -975,8 +975,15 @@ int xhci_dbc_suspend(struct xhci_hcd *xhif (!dbc)return 0 ; -if (dbc->state ==DS_CONFIGURED ) +switch (dbc->state) { +case DS_ENABLED : +case DS_CONNECTED : +case DS_CONFIGURED : dbc->resume_required =1 ; +break ; +default : +break ; + }xhci_dbc_stop (xhci);
Greg Kroah-Hartman
maintainerPATCH 205/224 binder: remove "invalid inc weak" check
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alice Ryhl <[email protected]>
commit d90eeb8ecd227c204ab6c34a17b372bd950b7aa2 upstream.
There are no scenarios where a weak increment is invalid on binder_node. The only possible case where it could be invalid is if the kernel delivers BR_DECREFS to the process that owns the node, and then increments the weak refcount again, effectively "reviving" a dead node.
However, that is not possible: when the BR_DECREFS command is delivered, the kernel removes and frees the binder_node. The fact that you were able to call binder_inc_node_nilocked() implies that the node is not yet destroyed, which implies that BR_DECREFS has not been delivered to userspace, so incrementing the weak refcount is valid.
Note that it's currently possible to trigger this condition if the owner calls BINDER_THREAD_EXIT while node->has_weak_ref is true. This causes BC_INCREFS on binder_ref instances to fail when they should not.
--- drivers/android/binder.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-)
drivers/android/binder.c +1 -10
@@ -1208,17 +1208,8 @@ static int binder_inc_node_nilocked(stru }else {if (!internal) node->local_weak_refs++; -if (!node->has_weak_ref &&list_empty (&node->work.entry)) { -if (target_list ==NULL ) { -pr_err ("invalid inc weak node for %d\n" , - node->debug_id); -return -EINVAL ; - } -/* -* See comment above -*/ +if (!node->has_weak_ref && target_list &&list_empty (&node->work.entry))binder_enqueue_work_ilocked (&node->work, target_list); - } }return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 206/224 comedi: fix divide-by-zero in comedi_buf_munge()
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Deepanshu Kartikey <[email protected]>
commit 87b318ba81dda2ee7b603f4f6c55e78ec3e95974 upstream.
The comedi_buf_munge() function performs a modulo operation async->munge_chan %= async->cmd.chanlist_len without first checking if chanlist_len is zero. If a user program submits a command with chanlist_len set to zero, this causes a divide-by-zero error when the device processes data in the interrupt handler path.
Add a check for zero chanlist_len at the beginning of the function, similar to the existing checks for !map and CMDF_RAWDATA flag. When chanlist_len is zero, update munge_count and return early, indicating the data was handled without munging.
This prevents potential kernel panics from malformed user commands.
--- drivers/staging/comedi/comedi_buf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/comedi/comedi_buf.c +1 -1
@@ -369,7 +369,7 @@ static unsigned int comedi_buf_munge(strunsigned int count =0 ;const unsigned int num_sample_bytes =comedi_bytes_per_sample (s); -if (!s->munge || (async->cmd.flags &CMDF_RAWDATA )) { +if (!s->munge || (async->cmd.flags &CMDF_RAWDATA ) || async->cmd.chanlist_len ==0 ) { async->munge_count += num_bytes; count = num_bytes; }else {
Greg Kroah-Hartman
maintainerPATCH 207/224 arm64: cputype: Add Neoverse-V3AE definitions
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Rutland <[email protected]>
commit 3bbf004c4808e2c3241e5c1ad6cc102f38a03c39 upstream.
Add cputype definitions for Neoverse-V3AE. These will be used for errata detection in subsequent patches.
These values can be found in the Neoverse-V3AE TRM:
https://developer.arm.com/documentation/SDEN-2615521/9-0/
... in section A.6.1 ("MIDR_EL1, Main ID Register").
--- arch/arm64/include/asm/cputype.h | 2 ++ 1 file changed, 2 insertions(+)
arch/arm64/include/asm/cputype.h +2 -0
@@ -87,6 +87,7 @@#define ARM_CPU_PART_NEOVERSE_V2 0xD4F#define ARM_CPU_PART_CORTEX_A720 0xD81#define ARM_CPU_PART_CORTEX_X4 0xD82 +#define ARM_CPU_PART_NEOVERSE_V3AE 0xD83#define ARM_CPU_PART_NEOVERSE_V3 0xD84#define ARM_CPU_PART_CORTEX_X925 0xD85#define ARM_CPU_PART_CORTEX_A725 0xD87
@@ -139,6 +140,7 @@#define MIDR_NEOVERSE_V2 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_NEOVERSE_V2)#define MIDR_CORTEX_A720 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A720)#define MIDR_CORTEX_X4 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_X4) +#define MIDR_NEOVERSE_V3AE MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_NEOVERSE_V3AE)#define MIDR_NEOVERSE_V3 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_NEOVERSE_V3)#define MIDR_CORTEX_X925 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_X925)#define MIDR_CORTEX_A725 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A725)
Greg Kroah-Hartman
maintainerPATCH 208/224 arm64: errata: Apply workarounds for Neoverse-V3AE
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Rutland <[email protected]>
commit 0c33aa1804d101c11ba1992504f17a42233f0e11 upstream.
Neoverse-V3AE is also affected by erratum #3312417, as described in its Software Developer Errata Notice (SDEN) document:
Neoverse V3AE (MP172) SDEN v9.0, erratum 3312417
https://developer.arm.com/documentation/SDEN-2615521/9-0/
Enable the workaround for Neoverse-V3AE, and document this.
--- Documentation/arm64/silicon-errata.rst | 2 ++ arch/arm64/Kconfig | 1 + arch/arm64/kernel/cpu_errata.c | 1 + 3 files changed, 4 insertions(+)
Documentation/arm64/silicon-errata.rst +2 -0
@@ -134,6 +134,8 @@ stable kernels. +----------------+-----------------+-----------------+-----------------------------+ | ARM | Neoverse-V3 | #3312417 | ARM64_ERRATUM_3194386 | +----------------+-----------------+-----------------+-----------------------------+ +| ARM | Neoverse-V3AE | #3312417 | ARM64_ERRATUM_3194386 | ++----------------+-----------------+-----------------+-----------------------------+ | ARM | MMU-500 | #841119,826419 | N/A | +----------------+-----------------+-----------------+-----------------------------+ +----------------+-----------------+-----------------+-----------------------------+
arch/arm64/Kconfig +1 -0
@@ -617,6 +617,7 @@ config ARM64_ERRATUM_3194386 * ARM Neoverse-V1 erratum 3324341 * ARM Neoverse V2 erratum 3324336 * ARM Neoverse-V3 erratum 3312417 + * ARM Neoverse-V3AE erratum 3312417 On affected cores "MSR SSBS, #0" instructions may not affect subsequent speculative instructions, which may permit unexepected
arch/arm64/kernel/cpu_errata.c +1 -0
@@ -863,6 +863,7 @@ static const struct midr_range erratum_sMIDR_ALL_VERSIONS (MIDR_NEOVERSE_V1 ),MIDR_ALL_VERSIONS (MIDR_NEOVERSE_V2 ),MIDR_ALL_VERSIONS (MIDR_NEOVERSE_V3 ), + MIDR_ALL_VERSIONS(MIDR_NEOVERSE_V3AE), {} };#endif
Greg Kroah-Hartman
maintainerPATCH 209/224 memory: samsung: exynos-srom: Correct alignment
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
[ Upstream commit 90de1c75d8acd83e9a699b93153307a1e411ef3a ]
Align indentation with open parenthesis (or fix existing alignment).
Stable-dep-of: 6744085079e7 ("memory: samsung: exynos-srom: Fix of_iomap leak in exynos_srom_probe")
--- drivers/memory/samsung/exynos-srom.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)
drivers/memory/samsung/exynos-srom.c +11 -11
@@ -47,9 +47,9 @@ struct exynos_srom {struct exynos_srom_reg_dump *reg_offset; }; -static struct exynos_srom_reg_dump *exynos_srom_alloc_reg_dump ( -const unsigned long *rdump, -unsigned long nr_rdump) +static struct exynos_srom_reg_dump * +exynos_srom_alloc_reg_dump (const unsigned long *rdump, +unsigned long nr_rdump) {struct exynos_srom_reg_dump *rd;unsigned int i;
@@ -116,7 +116,7 @@ static int exynos_srom_probe(struct plat } srom =devm_kzalloc (&pdev->dev, -sizeof (struct exynos_srom ),GFP_KERNEL ); +sizeof (struct exynos_srom ),GFP_KERNEL );if (!srom)return -ENOMEM ;
@@ -130,7 +130,7 @@ static int exynos_srom_probe(struct platplatform_set_drvdata (pdev, srom); srom->reg_offset =exynos_srom_alloc_reg_dump (exynos_srom_offsets, -ARRAY_SIZE (exynos_srom_offsets)); +ARRAY_SIZE (exynos_srom_offsets));if (!srom->reg_offset) {iounmap (srom->reg_base);return -ENOMEM ;
@@ -157,16 +157,16 @@ static int exynos_srom_probe(struct plat#ifdef CONFIG_PM_SLEEP static void exynos_srom_save (void __iomem *base, -struct exynos_srom_reg_dump *rd, -unsigned int num_regs) +struct exynos_srom_reg_dump *rd, +unsigned int num_regs) {for (; num_regs >0 ; --num_regs, ++rd) rd->value =readl (base + rd->offset); }static void exynos_srom_restore (void __iomem *base, -const struct exynos_srom_reg_dump *rd, -unsigned int num_regs) +const struct exynos_srom_reg_dump *rd, +unsigned int num_regs) {for (; num_regs >0 ; --num_regs, ++rd)writel (rd->value, base + rd->offset);
@@ -177,7 +177,7 @@ static int exynos_srom_suspend(struct destruct exynos_srom *srom =dev_get_drvdata (dev);exynos_srom_save (srom->reg_base, srom->reg_offset, -ARRAY_SIZE (exynos_srom_offsets)); +ARRAY_SIZE (exynos_srom_offsets));return 0 ; }
@@ -186,7 +186,7 @@ static int exynos_srom_resume(struct devstruct exynos_srom *srom =dev_get_drvdata (dev);exynos_srom_restore (srom->reg_base, srom->reg_offset, -ARRAY_SIZE (exynos_srom_offsets)); +ARRAY_SIZE (exynos_srom_offsets)); return 0; }#endif
Greg Kroah-Hartman
maintainerPATCH 210/224 memory: samsung: exynos-srom: Fix of_iomap leak in exynos_srom_probe
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhen Ni <[email protected]>
[ Upstream commit 6744085079e785dae5f7a2239456135407c58b25 ]
The of_platform_populate() call at the end of the function has a possible failure path, causing a resource leak.
Replace of_iomap() with devm_platform_ioremap_resource() to ensure automatic cleanup of srom->reg_base.
This issue was detected by smatch static analysis:drivers/memory/samsung/exynos-srom.c:155 exynos_srom_probe()warn:
'srom->reg_base' from of_iomap() not released on lines: 155.
--- drivers/memory/samsung/exynos-srom.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/memory/samsung/exynos-srom.c +4 -6
@@ -121,20 +121,18 @@ static int exynos_srom_probe(struct platreturn -ENOMEM ; srom->dev = dev; - srom->reg_base =of_iomap (np,0 ); -if (!srom->reg_base) { + srom->reg_base =devm_platform_ioremap_resource (pdev,0 ); +if (IS_ERR (srom->reg_base)) {dev_err (&pdev->dev,"iomap of exynos srom controller failed\n" ); -return -ENOMEM ; +return PTR_ERR (srom->reg_base); }platform_set_drvdata (pdev, srom); srom->reg_offset =exynos_srom_alloc_reg_dump (exynos_srom_offsets,ARRAY_SIZE (exynos_srom_offsets)); -if (!srom->reg_offset) { -iounmap (srom->reg_base); +if (!srom->reg_offset)return -ENOMEM ; - }for_each_child_of_node (np, child) {if (exynos_srom_configure_bank (srom, child)) {
Greg Kroah-Hartman
maintainerPATCH 211/224 spi: cadence-quadspi: Flush posted register writes before INDAC access
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pratyush Yadav <[email protected]>
[ Upstream commit 29e0b471ccbd674d20d4bbddea1a51e7105212c5 ]
cqspi_indirect_read_execute() and cqspi_indirect_write_execute() first set the enable bit on APB region and then start reading/writing to the AHB region. On TI K3 SoCs these regions lie on different endpoints. This means that the order of the two operations is not guaranteed, and they might be reordered at the interconnect level.
It is possible for the AHB write to be executed before the APB write to enable the indirect controller, causing the transaction to be invalid and the write erroring out. Read back the APB region write before accessing the AHB region to make sure the write got flushed and the race condition is eliminated.
Message-ID: <[email protected]>
--- drivers/mtd/spi-nor/cadence-quadspi.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/mtd/spi-nor/cadence-quadspi.c +3 -0
@@ -523,6 +523,7 @@ static int cqspi_indirect_read_execute(sreinit_completion (&cqspi->transfer_complete);writel (CQSPI_REG_INDIRECTRD_START_MASK , reg_base +CQSPI_REG_INDIRECTRD ); +readl (reg_base +CQSPI_REG_INDIRECTRD );/* Flush posted write. */ while (remaining > 0) { if (!wait_for_completion_timeout(&cqspi->transfer_complete,
@@ -633,6 +634,8 @@ static int cqspi_indirect_write_execute(reinit_completion (&cqspi->transfer_complete);writel (CQSPI_REG_INDIRECTWR_START_MASK , reg_base +CQSPI_REG_INDIRECTWR ); +readl (reg_base +CQSPI_REG_INDIRECTWR );/* Flush posted write. */ +/* * As per 66AK2G02 TRM SPRUHY8F section 11.15.5.3 Indirect Access * Controller programming sequence, couple of cycles of
Greg Kroah-Hartman
maintainerPATCH 212/224 spi: cadence-quadspi: Flush posted register writes before DAC access
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pratyush Yadav <[email protected]>
[ Upstream commit 1ad55767e77a853c98752ed1e33b68049a243bd7 ]
cqspi_read_setup() and cqspi_write_setup() program the address width as the last step in the setup. This is likely to be immediately followed by a DAC region read/write. On TI K3 SoCs the DAC region is on a different endpoint from the register region. This means that the order of the two operations is not guaranteed, and they might be reordered at the interconnect level. It is possible that the DAC read/write goes through before the address width update goes through. In this situation if the previous command used a different address width the OSPI command is sent with the wrong number of address bytes, resulting in an invalid command and undefined behavior.
Read back the size register to make sure the write gets flushed before accessing the DAC region.
Message-ID: <[email protected]>
--- drivers/mtd/spi-nor/cadence-quadspi.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/mtd/spi-nor/cadence-quadspi.c +2 -0
@@ -496,6 +496,7 @@ static int cqspi_read_setup(struct spi_n reg &= ~CQSPI_REG_SIZE_ADDRESS_MASK ; reg |= (nor->addr_width -1 );writel (reg, reg_base +CQSPI_REG_SIZE ); +readl (reg_base +CQSPI_REG_SIZE );/* Flush posted write. */ return 0 ; }
@@ -609,6 +610,7 @@ static int cqspi_write_setup(struct spi_ reg &= ~CQSPI_REG_SIZE_ADDRESS_MASK ; reg |= (nor->addr_width -1 );writel (reg, reg_base +CQSPI_REG_SIZE ); +readl (reg_base +CQSPI_REG_SIZE );/* Flush posted write. */ return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 213/224 ext4: avoid potential buffer over-read in parse_apply_sb_mount_options()
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Theodore Ts'o <[email protected]>
[ Upstream commit 8ecb790ea8c3fc69e77bace57f14cf0d7c177bd8 ]
Unlike other strings in the ext4 superblock, we rely on tune2fs to make sure s_mount_opts is NUL terminated. Harden parse_apply_sb_mount_options() by treating s_mount_opts as a potential __nonstring.
Message-ID: <[email protected]>
--- fs/ext4/super.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
fs/ext4/super.c +4 -6
@@ -3882,18 +3882,16 @@ static int ext4_fill_super(struct super_ }if (sbi->s_es->s_mount_opts[0 ]) { -char *s_mount_opts =kstrndup (sbi->s_es->s_mount_opts, -sizeof (sbi->s_es->s_mount_opts), -GFP_KERNEL ); -if (!s_mount_opts) - goto failed_mount; +char s_mount_opts[65 ]; + +strscpy_pad (s_mount_opts, sbi->s_es->s_mount_opts, +sizeof (s_mount_opts));if (!parse_options (s_mount_opts, sb, &journal_devnum, &journal_ioprio,0 )) {ext4_msg (sb,KERN_WARNING ,"failed to parse options in superblock: %s" , s_mount_opts); } -kfree (s_mount_opts); } sbi->s_def_mount_opt = sbi->s_mount_opt; if (!parse_options((char *) data, sb, &journal_devnum,
Greg Kroah-Hartman
maintainerPATCH 214/224 drm/amdgpu: use atomic functions with memory barriers for vm fault info
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gui-Dong Han <[email protected]>
[ Upstream commit 6df8e84aa6b5b1812cc2cacd6b3f5ccbb18cda2b ]
The atomic variable vm_fault_info_updated is used to synchronize access to adev->gmc.vm_fault_info between the interrupt handler and get_vm_fault_info().
The default atomic functions like atomic_set() and atomic_read() do not provide memory barriers. This allows for CPU instruction reordering, meaning the memory accesses to vm_fault_info and the vm_fault_info_updated flag are not guaranteed to occur in the intended order. This creates a race condition that can lead to inconsistent or stale data being used.
The previous implementation, which used an explicit mb(), was incomplete and inefficient. It failed to account for all potential CPU reorderings, such as the access of vm_fault_info being reordered before the atomic_read of the flag. This approach is also more verbose and less performant than using the proper atomic functions with acquire/release semantics.
Fix this by switching to atomic_set_release() and atomic_read_acquire(). These functions provide the necessary acquire and release semantics, which act as memory barriers to ensure the correct order of operations. It is also more efficient and idiomatic than using explicit full memory barriers.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 5 ++--- drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c | 7 +++---- drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c | 7 +++---- 3 files changed, 8 insertions(+), 11 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +2 -3
@@ -1572,10 +1572,9 @@ int amdgpu_amdkfd_gpuvm_get_vm_fault_infstruct amdgpu_device *adev; adev = (struct amdgpu_device *)kgd; -if (atomic_read (&adev->gmc.vm_fault_info_updated) ==1 ) { +if (atomic_read_acquire (&adev->gmc.vm_fault_info_updated) ==1 ) { *mem = *adev->gmc.vm_fault_info; -mb (); -atomic_set (&adev->gmc.vm_fault_info_updated,0 ); +atomic_set_release (&adev->gmc.vm_fault_info_updated,0 ); }return 0 ; }
drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c +3 -4
@@ -1042,7 +1042,7 @@ static int gmc_v7_0_sw_init(void *handle GFP_KERNEL);if (!adev->gmc.vm_fault_info)return -ENOMEM ; -atomic_set (&adev->gmc.vm_fault_info_updated,0 ); +atomic_set_release (&adev->gmc.vm_fault_info_updated,0 );return 0 ; }
@@ -1272,7 +1272,7 @@ static int gmc_v7_0_process_interrupt(st vmid =REG_GET_FIELD (status,VM_CONTEXT1_PROTECTION_FAULT_STATUS ,VMID );if (amdgpu_amdkfd_is_kfd_vmid (adev, vmid) - && !atomic_read (&adev->gmc.vm_fault_info_updated)) { + && !atomic_read_acquire (&adev->gmc.vm_fault_info_updated)) {struct kfd_vm_fault_info *info = adev->gmc.vm_fault_info; u32 protections = REG_GET_FIELD(status, VM_CONTEXT1_PROTECTION_FAULT_STATUS,
@@ -1288,8 +1288,7 @@ static int gmc_v7_0_process_interrupt(st info->prot_read = protections &0x8 ? true : false; info->prot_write = protections &0x10 ? true : false; info->prot_exec = protections &0x20 ? true : false; -mb (); -atomic_set (&adev->gmc.vm_fault_info_updated,1 ); +atomic_set_release (&adev->gmc.vm_fault_info_updated,1 ); }return 0 ;
drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c +3 -4
@@ -1175,7 +1175,7 @@ static int gmc_v8_0_sw_init(void *handle GFP_KERNEL);if (!adev->gmc.vm_fault_info)return -ENOMEM ; -atomic_set (&adev->gmc.vm_fault_info_updated,0 ); +atomic_set_release (&adev->gmc.vm_fault_info_updated,0 );return 0 ; }
@@ -1464,7 +1464,7 @@ static int gmc_v8_0_process_interrupt(st vmid =REG_GET_FIELD (status,VM_CONTEXT1_PROTECTION_FAULT_STATUS ,VMID );if (amdgpu_amdkfd_is_kfd_vmid (adev, vmid) - && !atomic_read (&adev->gmc.vm_fault_info_updated)) { + && !atomic_read_acquire (&adev->gmc.vm_fault_info_updated)) {struct kfd_vm_fault_info *info = adev->gmc.vm_fault_info; u32 protections = REG_GET_FIELD(status, VM_CONTEXT1_PROTECTION_FAULT_STATUS,
@@ -1480,8 +1480,7 @@ static int gmc_v8_0_process_interrupt(st info->prot_read = protections &0x8 ? true : false; info->prot_write = protections &0x10 ? true : false; info->prot_exec = protections &0x20 ? true : false; -mb (); -atomic_set (&adev->gmc.vm_fault_info_updated,1 ); +atomic_set_release (&adev->gmc.vm_fault_info_updated,1 ); }return 0 ;
Greg Kroah-Hartman
maintainerPATCH 215/224 ext4: detect invalid INLINE_DATA + EXTENTS flag combination
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Deepanshu Kartikey <[email protected]>
[ Upstream commit 1d3ad183943b38eec2acf72a0ae98e635dc8456b ]
syzbot reported a BUG_ON in ext4_es_cache_extent() when opening a verity file on a corrupted ext4 filesystem mounted without a journal.
The issue is that the filesystem has an inode with both the INLINE_DATA and EXTENTS flags set:
EXT4-fs error (device loop0): ext4_cache_extents:545: inode #15:
comm syz.0.17: corrupted extent tree: lblk 0 < prev 66
Investigation revealed that the inode has both flags set:
DEBUG: inode 15 - flag=1, i_inline_off=164, has_inline=1, extents_flag=1
This is an invalid combination since an inode should have either:
- INLINE_DATA: data stored directly in the inode
- EXTENTS: data stored in extent-mapped blocks
Having both flags causes ext4_has_inline_data() to return true, skipping extent tree validation in __ext4_iget(). The unvalidated out-of-order extents then trigger a BUG_ON in ext4_es_cache_extent() due to integer underflow when calculating hole sizes.
Fix this by detecting this invalid flag combination early in ext4_iget() and rejecting the corrupted inode.
Message-ID: <[email protected]>
--- fs/ext4/inode.c | 8 ++++++++ 1 file changed, 8 insertions(+)
fs/ext4/inode.c +8 -0
@@ -5077,6 +5077,14 @@ struct inode *__ext4_iget(struct super_b } ei->i_flags =le32_to_cpu (raw_inode->i_flags);ext4_set_inode_flags (inode); +/* Detect invalid flag combination - can't have both inline data and extents */ +if (ext4_test_inode_flag (inode,EXT4_INODE_INLINE_DATA ) && +ext4_test_inode_flag (inode,EXT4_INODE_EXTENTS )) { +ext4_error_inode (inode, function, line,0 , +"inode has both inline data and extents flags" ); + ret = -EFSCORRUPTED ; + goto bad_inode; + } inode->i_blocks =ext4_inode_blocks (raw_inode, ei); ei->i_file_acl =le32_to_cpu (raw_inode->i_file_acl_lo);if (ext4_has_feature_64bit (sb))
Greg Kroah-Hartman
maintainerPATCH 216/224 jbd2: ensure that all ongoing I/O complete before freeing blocks
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhang Yi <[email protected]>
[ Upstream commit 3c652c3a71de1d30d72dc82c3bead8deb48eb749 ]
When releasing file system metadata blocks in jbd2_journal_forget(), if this buffer has not yet been checkpointed, it may have already been written back, currently be in the process of being written back, or has not yet written back. jbd2_journal_forget() calls jbd2_journal_try_remove_checkpoint() to check the buffer's status and add it to the current transaction if it has not been written back. This buffer can only be reallocated after the transaction is committed.
jbd2_journal_try_remove_checkpoint() attempts to lock the buffer and check its dirty status while holding the buffer lock. If the buffer has already been written back, everything proceeds normally. However, there are two issues. First, the function returns immediately if the buffer is locked by the write-back process. It does not wait for the write-back to complete. Consequently, until the current transaction is committed and the block is reallocated, there is no guarantee that the I/O will complete. This means that ongoing I/O could write stale metadata to the newly allocated block, potentially corrupting data. Second, the function unlocks the buffer as soon as it detects that the buffer is still dirty. If a concurrent write-back occurs immediately after this unlocking and before clear_buffer_dirty() is called in jbd2_journal_forget(), data corruption can theoretically still occur.
Although these two issues are unlikely to occur in practice since the undergoing metadata writeback I/O does not take this long to complete, it's better to explicitly ensure that all ongoing I/O operations are completed.
Message-ID: <[email protected]>
--- fs/jbd2/transaction.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
fs/jbd2/transaction.c +9 -4
@@ -1550,6 +1550,7 @@ int jbd2_journal_forget (handle_t *handlint drop_reserve =0 ;int err =0 ;int was_modified =0 ; +int wait_for_writeback =0 ;if (is_handle_aborted (handle))return -EROFS ;
@@ -1675,18 +1676,22 @@ int jbd2_journal_forget (handle_t *handl }/* -* The buffer is still not written to disk, we should -* attach this buffer to current transaction so that the -* buffer can be checkpointed only after the current -* transaction commits. +* The buffer has not yet been written to disk. We should +* either clear the buffer or ensure that the ongoing I/O +* is completed, and attach this buffer to current +* transaction so that the buffer can be checkpointed only +* after the current transaction commits. */ clear_buffer_dirty (bh); + wait_for_writeback =1 ;__jbd2_journal_file_buffer (jh, transaction, BJ_Forget);spin_unlock (&journal->j_list_lock); }jbd_unlock_bh_state (bh);__brelse (bh); +if (wait_for_writeback) +wait_on_buffer (bh); drop:if (drop_reserve) {/* no need to reserve log space for this block -bzzz */
Greg Kroah-Hartman
maintainerPATCH 217/224 vfs: Dont leak disconnected dentries on umount
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jan Kara <[email protected]>
[ Upstream commit 56094ad3eaa21e6621396cc33811d8f72847a834 ]
When user calls open_by_handle_at() on some inode that is not cached, we will create disconnected dentry for it. If such dentry is a directory, exportfs_decode_fh_raw() will then try to connect this dentry to the dentry tree through reconnect_path(). It may happen for various reasons (such as corrupted fs or race with rename) that the call to lookup_one_unlocked() in reconnect_one() will fail to find the dentry we are trying to reconnect and instead create a new dentry under the parent. Now this dentry will not be marked as disconnected although the parent still may well be disconnected (at least in case this inconsistency happened because the fs is corrupted and .. doesn't point to the real parent directory). This creates inconsistency in disconnected flags but AFAICS it was mostly harmless. At least until commit f1ee616214cb ("VFS: don't keep disconnected dentries on d_anon") which removed adding of most disconnected dentries to sb->s_anon list. Thus after this commit cleanup of disconnected dentries implicitely relies on the fact that dput() will immediately reclaim such dentries. However when some leaf dentry isn't marked as disconnected, as in the scenario described above, the reclaim doesn't happen and the dentries are "leaked". Memory reclaim can eventually reclaim them but otherwise they stay in memory and if umount comes first, we hit infamous "Busy inodes after unmount" bug. Make sure all dentries created under a disconnected parent are marked as disconnected as well.
--- fs/dcache.c | 2 ++ 1 file changed, 2 insertions(+)
fs/dcache.c +2 -0
@@ -1782,6 +1782,8 @@ struct dentry *d_alloc(struct dentry * p__dget_dlock (parent); dentry->d_parent = parent;list_add (&dentry->d_child, &parent->d_subdirs); +if (parent->d_flags &DCACHE_DISCONNECTED ) + dentry->d_flags |=DCACHE_DISCONNECTED ;spin_unlock (&parent->d_lock);return dentry;
Greg Kroah-Hartman
maintainerPATCH 218/224 NFSD: Define a proc_layoutcommit for the FlexFiles layout type
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chuck Lever <[email protected]>
[ Upstream commit 4b47a8601b71ad98833b447d465592d847b4dc77 ]
Avoid a crash if a pNFS client should happen to send a LAYOUTCOMMIT operation on a FlexFiles layout.
--- fs/nfsd/flexfilelayout.c | 8 ++++++++ 1 file changed, 8 insertions(+)
fs/nfsd/flexfilelayout.c +8 -0
@@ -124,6 +124,13 @@ nfsd4_ff_proc_getdeviceinfo(struct superreturn 0 ; } +static __be32 +nfsd4_ff_proc_layoutcommit (struct inode *inode, +struct nfsd4_layoutcommit *lcp) +{ +return nfs_ok; +} +const struct nfsd4_layout_ops ff_layout_ops = { .notify_types =NOTIFY_DEVICEID4_DELETE |NOTIFY_DEVICEID4_CHANGE ,
@@ -132,4 +139,5 @@ const struct nfsd4_layout_ops ff_layout_ .encode_getdeviceinfo = nfsd4_ff_encode_getdeviceinfo, .proc_layoutget = nfsd4_ff_proc_layoutget, .encode_layoutget = nfsd4_ff_encode_layoutget, + .proc_layoutcommit = nfsd4_ff_proc_layoutcommit, };
Greg Kroah-Hartman
maintainerPATCH 219/224 KEYS: trusted_tpm1: Compare HMAC values in constant time
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Biggers <[email protected]>
[ Upstream commit eed0e3d305530066b4fc5370107cff8ef1a0d229 ]
To prevent timing attacks, HMAC value comparison needs to be constant time. Replace the memcmp() with the correct function, crypto_memneq().
[For the Fixes commit I used the commit that introduced the memcmp(). It predates the introduction of crypto_memneq(), but it was still a bug at the time even though a helper function didn't exist yet.]
--- security/keys/trusted.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
security/keys/trusted.c +4 -3
@@ -9,6 +9,7 @@*/ #include <crypto/hash_info.h> +#include <crypto/algapi.h> #include <linux/uaccess.h> #include <linux/module.h> #include <linux/init.h>
@@ -248,7 +249,7 @@ int TSS_checkhmac1(unsigned char *bufferif (ret <0 ) goto out; -if (memcmp (testhmac, authdata,SHA1_DIGEST_SIZE )) +if (crypto_memneq (testhmac, authdata,SHA1_DIGEST_SIZE )) ret = -EINVAL ; out:kzfree (sdesc);
@@ -341,7 +342,7 @@ static int TSS_checkhmac2(unsigned char TPM_NONCE_SIZE, ononce, 1, continueflag1, 0, 0);if (ret <0 ) goto out; -if (memcmp (testhmac1, authdata1,SHA1_DIGEST_SIZE )) { +if (crypto_memneq (testhmac1, authdata1,SHA1_DIGEST_SIZE )) { ret = -EINVAL ; goto out; }
@@ -350,7 +351,7 @@ static int TSS_checkhmac2(unsigned char TPM_NONCE_SIZE, ononce, 1, continueflag2, 0, 0);if (ret <0 ) goto out; -if (memcmp (testhmac2, authdata2,SHA1_DIGEST_SIZE )) +if (crypto_memneq (testhmac2, authdata2,SHA1_DIGEST_SIZE )) ret = -EINVAL ; out:kzfree (sdesc);
Greg Kroah-Hartman
maintainerPATCH 220/224 padata: Reset next CPU when reorder sequence wraps around
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xiao Liang <[email protected]>
[ Upstream commit 501302d5cee0d8e8ec2c4a5919c37e0df9abc99b ]
When seq_nr wraps around, the next reorder job with seq 0 is hashed to the first CPU in padata_do_serial(). Correspondingly, need reset pd->cpu to the first one when pd->processed wraps around. Otherwise, if the number of used CPUs is not a power of 2, padata_find_next() will be checking a wrong list, hence deadlock.
--- kernel/padata.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
kernel/padata.c +5 -1
@@ -204,7 +204,11 @@ static struct padata_priv *padata_find_nlist_del_init (&padata->list);atomic_dec (&pd->reorder_objects); ++pd->processed; - pd->cpu =cpumask_next_wrap (cpu, pd->cpumask.pcpu,-1 , false); +/* When sequence wraps around, reset to the first CPU. */ +if (unlikely (pd->processed ==0 )) + pd->cpu =cpumask_first (pd->cpumask.pcpu); +else + pd->cpu =cpumask_next_wrap (cpu, pd->cpumask.pcpu,-1 , false); }spin_unlock (&reorder->lock);
Greg Kroah-Hartman
maintainerPATCH 221/224 NFSD: Minor cleanup in layoutcommit processing
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sergey Bashirov <[email protected]>
[ Upstream commit 274365a51d88658fb51cca637ba579034e90a799 ]
Remove dprintk in nfsd4_layoutcommit. These are not needed in day to day usage, and the information is also available in Wireshark when capturing NFS traffic.
Stable-dep-of: d68886bae76a ("NFSD: Fix last write offset handling in layoutcommit")
--- fs/nfsd/nfs4proc.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-)
fs/nfsd/nfs4proc.c +3 -9
@@ -1717,18 +1717,12 @@ nfsd4_layoutcommit(struct svc_rqst *rqst inode =d_inode (current_fh->fh_dentry); nfserr = nfserr_inval; -if (new_size <= seg->offset) { -dprintk ("pnfsd: last write before layout segment\n" ); +if (new_size <= seg->offset) goto out; - } -if (new_size > seg->offset + seg->length) { -dprintk ("pnfsd: last write beyond layout segment\n" ); +if (new_size > seg->offset + seg->length) goto out; - } -if (!lcp->lc_newoffset && new_size >i_size_read (inode)) { -dprintk ("pnfsd: layoutcommit beyond EOF\n" ); +if (!lcp->lc_newoffset && new_size >i_size_read (inode)) goto out; - } nfserr = nfsd4_preprocess_layout_stateid(rqstp, cstate, &lcp->lc_sid, false, lcp->lc_layout_type,
Greg Kroah-Hartman
maintainerPATCH 222/224 NFSD: Fix last write offset handling in layoutcommit
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sergey Bashirov <[email protected]>
[ Upstream commit d68886bae76a4b9b3484d23e5b7df086f940fa38 ]
The data type of loca_last_write_offset is newoffset4 and is switched on a boolean value, no_newoffset, that indicates if a previous write occurred or not. If no_newoffset is FALSE, an offset is not given. This means that client does not try to update the file size. Thus, server should not try to calculate new file size and check if it fits into the segment range. See RFC 8881, section 12.5.4.2.
Sometimes the current incorrect logic may cause clients to hang when trying to sync an inode. If layoutcommit fails, the client marks the inode as dirty again.
--- fs/nfsd/blocklayout.c | 5 ++--- fs/nfsd/nfs4proc.c | 30 +++++++++++++++--------------- 2 files changed, 17 insertions(+), 18 deletions(-)
fs/nfsd/blocklayout.c +2 -3
@@ -120,7 +120,6 @@ static __be32 nfsd4_block_commit_blocks(struct inode *inode, struct nfsd4_layoutcommit *lcp, struct iomap *iomaps, int nr_iomaps) { - loff_t new_size = lcp->lc_last_wr + 1; struct iattr iattr = { .ia_valid = 0 };int error;
@@ -130,9 +129,9 @@ nfsd4_block_commit_blocks(struct inode * iattr.ia_valid |=ATTR_ATIME |ATTR_CTIME |ATTR_MTIME ; iattr.ia_atime = iattr.ia_ctime = iattr.ia_mtime = lcp->lc_mtime; -if (new_size >i_size_read (inode)) { +if (lcp->lc_size_chg) { iattr.ia_valid |=ATTR_SIZE ; - iattr.ia_size = new_size; + iattr.ia_size = lcp->lc_newsize; } error = inode->i_sb->s_export_op->commit_blocks(inode, iomaps,
fs/nfsd/nfs4proc.c +15 -15
@@ -1701,7 +1701,6 @@ nfsd4_layoutcommit(struct svc_rqst *rqstconst struct nfsd4_layout_seg *seg = &lcp->lc_seg;struct svc_fh *current_fh = &cstate->current_fh;const struct nfsd4_layout_ops *ops; -loff_t new_size = lcp->lc_last_wr +1 ;struct inode *inode;struct nfs4_layout_stateid *ls;__be32 nfserr;
@@ -1716,13 +1715,21 @@ nfsd4_layoutcommit(struct svc_rqst *rqst goto out; inode =d_inode (current_fh->fh_dentry); - nfserr = nfserr_inval; -if (new_size <= seg->offset) - goto out; -if (new_size > seg->offset + seg->length) - goto out; -if (!lcp->lc_newoffset && new_size >i_size_read (inode)) - goto out; + lcp->lc_size_chg = false; +if (lcp->lc_newoffset) { +loff_t new_size = lcp->lc_last_wr +1 ; + + nfserr = nfserr_inval; +if (new_size <= seg->offset) + goto out; +if (new_size > seg->offset + seg->length) + goto out; + +if (new_size >i_size_read (inode)) { + lcp->lc_size_chg = true; + lcp->lc_newsize = new_size; + } + } nfserr = nfsd4_preprocess_layout_stateid(rqstp, cstate, &lcp->lc_sid, false, lcp->lc_layout_type,
@@ -1738,13 +1745,6 @@ nfsd4_layoutcommit(struct svc_rqst *rqst/* LAYOUTCOMMIT does not require any serialization */ mutex_unlock (&ls->ls_mutex); -if (new_size >i_size_read (inode)) { - lcp->lc_size_chg =1 ; - lcp->lc_newsize = new_size; - }else { - lcp->lc_size_chg =0 ; - } - nfserr = ops->proc_layoutcommit (inode, lcp);nfs4_put_stid (&ls->ls_stid); out:
Greg Kroah-Hartman
maintainerPATCH 223/224 media: s5p-mfc: remove an unused/uninitialized variable
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit 7fa37ba25a1dfc084e24ea9acc14bf1fad8af14c ]
The s5p_mfc_cmd_args structure in the v6 driver is never used, not initialized to anything other than zero, but as of clang-21 this causes a warning:
drivers/media/platform/samsung/s5p-mfc/s5p_mfc_cmd_v6.c:45:7: error: variable 'h2r_args' is uninitialized when passed as a const pointer argument here [-Werror,-Wuninitialized-const-pointer]
45 | &h2r_args);
| ^~~~~~~~
Just remove this for simplicity. Since the function is also called through a callback, this does require adding a trivial wrapper with the correct prototype.
--- drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v6.c | 35 ++++++++---------------- 1 file changed, 13 insertions(+), 22 deletions(-)
drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v6.c +13 -22
@@ -14,8 +14,7 @@#include "s5p_mfc_opr.h" #include "s5p_mfc_cmd_v6.h" -static int s5p_mfc_cmd_host2risc_v6 (struct s5p_mfc_dev *dev,int cmd, -struct s5p_mfc_cmd_args *args) +static int s5p_mfc_cmd_host2risc_v6 (struct s5p_mfc_dev *dev,int cmd) {mfc_debug (2 ,"Issue the command: %d\n" , cmd);
@@ -31,7 +30,6 @@ static int s5p_mfc_cmd_host2risc_v6(strustatic int s5p_mfc_sys_init_cmd_v6 (struct s5p_mfc_dev *dev) { -struct s5p_mfc_cmd_args h2r_args;struct s5p_mfc_buf_size_v6 *buf_size = dev->variant->buf_size->priv;int ret;
@@ -41,33 +39,23 @@ static int s5p_mfc_sys_init_cmd_v6(strucmfc_write (dev, dev->ctx_buf.dma,S5P_FIMV_CONTEXT_MEM_ADDR_V6 );mfc_write (dev, buf_size->dev_ctx,S5P_FIMV_CONTEXT_MEM_SIZE_V6 ); -return s5p_mfc_cmd_host2risc_v6 (dev,S5P_FIMV_H2R_CMD_SYS_INIT_V6 , - &h2r_args); +return s5p_mfc_cmd_host2risc_v6 (dev,S5P_FIMV_H2R_CMD_SYS_INIT_V6 ); }static int s5p_mfc_sleep_cmd_v6 (struct s5p_mfc_dev *dev) { -struct s5p_mfc_cmd_args h2r_args; - -memset (&h2r_args,0 ,sizeof (struct s5p_mfc_cmd_args )); -return s5p_mfc_cmd_host2risc_v6 (dev,S5P_FIMV_H2R_CMD_SLEEP_V6 , - &h2r_args); +return s5p_mfc_cmd_host2risc_v6 (dev,S5P_FIMV_H2R_CMD_SLEEP_V6 ); }static int s5p_mfc_wakeup_cmd_v6 (struct s5p_mfc_dev *dev) { -struct s5p_mfc_cmd_args h2r_args; - -memset (&h2r_args,0 ,sizeof (struct s5p_mfc_cmd_args )); -return s5p_mfc_cmd_host2risc_v6 (dev,S5P_FIMV_H2R_CMD_WAKEUP_V6 , - &h2r_args); +return s5p_mfc_cmd_host2risc_v6 (dev,S5P_FIMV_H2R_CMD_WAKEUP_V6 ); }/* Open a new instance and get its number */ static int s5p_mfc_open_inst_cmd_v6 (struct s5p_mfc_ctx *ctx) {struct s5p_mfc_dev *dev = ctx->dev; -struct s5p_mfc_cmd_args h2r_args;int codec_type;mfc_debug (2 ,"Requested codec mode: %d\n" , ctx->codec_mode);
@@ -129,23 +117,20 @@ static int s5p_mfc_open_inst_cmd_v6(strumfc_write (dev, ctx->ctx.size,S5P_FIMV_CONTEXT_MEM_SIZE_V6 );mfc_write (dev,0 ,S5P_FIMV_D_CRC_CTRL_V6 );/* no crc */ -return s5p_mfc_cmd_host2risc_v6 (dev,S5P_FIMV_H2R_CMD_OPEN_INSTANCE_V6 , - &h2r_args); +return s5p_mfc_cmd_host2risc_v6 (dev,S5P_FIMV_H2R_CMD_OPEN_INSTANCE_V6 ); }/* Close instance */ static int s5p_mfc_close_inst_cmd_v6 (struct s5p_mfc_ctx *ctx) {struct s5p_mfc_dev *dev = ctx->dev; -struct s5p_mfc_cmd_args h2r_args;int ret =0 ; dev->curr_ctx = ctx->num;if (ctx->state !=MFCINST_FREE ) {mfc_write (dev, ctx->inst_no,S5P_FIMV_INSTANCE_ID_V6 ); ret =s5p_mfc_cmd_host2risc_v6 (dev, -S5P_FIMV_H2R_CMD_CLOSE_INSTANCE_V6 , - &h2r_args); +S5P_FIMV_H2R_CMD_CLOSE_INSTANCE_V6 ); }else { ret = -EINVAL ; }
@@ -153,9 +138,15 @@ static int s5p_mfc_close_inst_cmd_v6(strreturn ret; } +static int s5p_mfc_cmd_host2risc_v6_args (struct s5p_mfc_dev *dev,int cmd, +struct s5p_mfc_cmd_args *ignored) +{ +return s5p_mfc_cmd_host2risc_v6 (dev, cmd); +} +/* Initialize cmd function pointers for MFC v6 */ static struct s5p_mfc_hw_cmds s5p_mfc_cmds_v6 = { - .cmd_host2risc = s5p_mfc_cmd_host2risc_v6, + .cmd_host2risc = s5p_mfc_cmd_host2risc_v6_args, .sys_init_cmd = s5p_mfc_sys_init_cmd_v6, .sleep_cmd = s5p_mfc_sleep_cmd_v6, .wakeup_cmd = s5p_mfc_wakeup_cmd_v6,
Greg Kroah-Hartman
maintainerPATCH 224/224 net: rtnetlink: fix module reference count leak issue in rtnetlink_rcv_msg
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhengchao Shao <[email protected]>
commit 5b22f62724a0a09e00d301abf5b57b0c12be8a16 upstream.
When bulk delete command is received in the rtnetlink_rcv_msg function, if bulk delete is not supported, module_put is not called to release the reference counting. As a result, module reference count is leaked.
--- net/core/rtnetlink.c | 1 + 1 file changed, 1 insertion(+)
net/core/rtnetlink.c +1 -0
@@ -5304,6 +5304,7 @@ static int rtnetlink_rcv_msg(struct sk_bif (kind ==RTNL_KIND_DEL && (nlh->nlmsg_flags &NLM_F_BULK ) && !(flags &RTNL_FLAG_BULK_DEL_SUPPORTED )) {NL_SET_ERR_MSG (extack,"Bulk delete is not supported" ); +module_put (owner); goto err_unlock; }
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.4.301 release. There are 224 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 29 Oct 2025 18:34:15 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.4.301-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.4.y
and the diffstat can be found below.thanks,
greg k-h
On ARCH_BRCMSTB using 32-bit and 64-bit ARM kernels, build tested on BMIPS_GENERIC:
There is a new warning showing up with b27e16c9e625465fe9ea9955bd8ab095498de9e3 ("tcp: fix tcp_tso_should_defer() vs large RTT") , but since 5.4 does not have the full minmax backports this is expected:
In file included from ./include/linux/list.h:9,
from ./include/net/tcp.h:19,
from net/ipv4/tcp_output.c:40:net/ipv4/tcp_output.c: In function 'tcp_tso_should_defer':./include/linux/kernel.h:843:43: warning: comparison of distinct pointer types lacks a cast
843 | (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
| ^~./include/linux/kernel.h:857:18: note: in expansion of macro '__typecheck'
857 | (__typecheck(x, y) && __no_side_effects(x, y))
| ^~~~~~~~~~~
./include/linux/kernel.h:867:31: note: in expansion of macro '__safe_cmp'
867 | __builtin_choose_expr(__safe_cmp(x, y), \
| ^~~~~~~~~~
./include/linux/kernel.h:876:25: note: in expansion of macro '__careful_cmp'
876 | #define min(x, y) __careful_cmp(x, y, <)
| ^~~~~~~~~~~~~net/ipv4/tcp_output.c:2028:21: note: in expansion of macro 'min'
2028 | threshold = min(srtt_in_ns >> 1, NSEC_PER_MSEC);
| ^~~
I don't think this should hold off the release though.
Signature · 1 line
Florian
Hi!
Quoted 4 lines
This is the start of the stable review cycle for the 5.4.301 release. There are 224 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
6.6, 5.4 pass our testing, so risc-v compilation problem seems to be 5.10 and 5.15 only.
https://gitlab.com/cip-project/cip-testing/linux-stable-rc-ci/-/tree/linux-6.6.y
https://gitlab.com/cip-project/cip-testing/linux-stable-rc-ci/-/tree/linux-5.4.y
Best regards,
Pavel
Signature · 2 lines
In cooperation with DENX Software Engineering GmbH, HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.4.301 release. There are 224 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 29 Oct 2025 18:34:15 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.4.301-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.4.y
and the diffstat can be found below.thanks,
greg k-h
All tests passing for Tegra ...
Test results for stable-v5.4:
10 builds: 10 pass, 0 fail
24 boots: 24 pass, 0 fail
54 tests: 54 pass, 0 failLinux version: 5.4.301-rc1-g4e89a6191515
Boards tested: tegra124-jetson-tk1, tegra186-p2771-0000,
tegra194-p2972-0000, tegra20-ventana,
tegra210-p2371-2180, tegra210-p3450-0000,
tegra30-cardhu-a04Jon
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.4.301 release. There are 224 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 29 Oct 2025 18:34:15 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.4.301-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.4.y
and the diffstat can be found below.thanks,
greg k-h
Results from Linaro’s test farm.
No regressions on arm64, arm, x86_64, and i386.
## Build
* kernel: 5.4.300-rc1
* git: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
* git commit: e1a2ff52265e4d85abb275e2930b92c821a3dd19
* git describe: v5.4.299-82-ge1a2ff52265e
* test details:
https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-5.4.y/build/v5.4.299-82-ge1a2ff52265e
## Test Regressions (compared to v5.4.297-70-gf858bf548429)
## Metric Regressions (compared to v5.4.297-70-gf858bf548429)
## Test Fixes (compared to v5.4.297-70-gf858bf548429)
## Metric Fixes (compared to v5.4.297-70-gf858bf548429)
## Test result summary
total: 43391, pass: 32354, fail: 2994, skip: 7851, xfail: 192
## Build Summary
* arc: 5 total, 5 passed, 0 failed
* arm: 133 total, 133 passed, 0 failed
* arm64: 33 total, 31 passed, 2 failed
* i386: 20 total, 14 passed, 6 failed
* mips: 25 total, 25 passed, 0 failed
* parisc: 3 total, 0 passed, 3 failed
* powerpc: 26 total, 26 passed, 0 failed
* riscv: 9 total, 3 passed, 6 failed
* s390: 6 total, 6 passed, 0 failed
* sh: 10 total, 10 passed, 0 failed
* sparc: 6 total, 6 passed, 0 failed
* x86_64: 29 total, 29 passed, 0 failed
## Test suites summary
* boot
* kselftest-arm64
* kselftest-breakpoints
* kselftest-capabilities
* kselftest-clone3
* kselftest-core
* kselftest-cpu-hotplug
* kselftest-exec
* kselftest-fpu
* kselftest-futex
* kselftest-intel_pstate
* kselftest-kcmp
* kselftest-membarrier
* kselftest-mincore
* kselftest-mqueue
* kselftest-openat2
* kselftest-ptrace
* kselftest-rseq
* kselftest-rtc
* kselftest-sigaltstack
* kselftest-size
* kselftest-timers
* kselftest-tmpfs
* kselftest-tpm2
* kselftest-user_events
* kselftest-vDSO
* kselftest-x86
* kunit
* lava
* libhugetlbfs
* log-parser-boot
* log-parser-build-clang
* log-parser-build-gcc
* log-parser-test
* ltp-capability
* ltp-commands
* ltp-containers
* ltp-controllers
* ltp-cpuhotplug
* ltp-crypto
* ltp-cve
* ltp-dio
* ltp-fcntl-locktests
* ltp-fs
* ltp-fs_bind
* ltp-fs_perms_simple
* ltp-hugetlb
* ltp-math
* ltp-mm
* ltp-nptl
* ltp-pty
* ltp-sched
* ltp-smoke
* ltp-syscalls
* ltp-tracing
* rcutorture
--
Linaro LKFT
https://lkft.linaro.org
# Librecast Test Results
Build and boots without error. No network tests run.
020/020 [ OK ] liblcrq
010/010 [ OK ] libmld
120/120 [ OK ] liblibrecast
CPU/kernel: Linux auntie 5.4.301-rc1-00225-g4e89a6191515 #124 SMP Tue Oct 28 13:44:03 -00 2025 x86_64 AMD Ryzen 9 9950X 16-Core Processor AuthenticAMD GNU/Linux
Re: [External] : [PATCH 5.4 000/224] 5.4.301-rc1 review
In reply to Greg Kroah-HartmanHi Greg,
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.4.301 release. There are 224 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 29 Oct 2025 18:34:15 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://urldefense.com/v3/__https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.4.301-rc1.gz__;!!ACWV5N9M2RV99hQ! NE7mCUe86dFjW5qDD5v2HZqN4VGLlPFhjP5yjZzxIl1E1aWheWUGJSZYLDzHSwCOOocva- zhvQlIsjzrcl4HtHPREg$ or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.4.y
and the diffstat can be found below.thanks,
greg k-h
No problems seen on x86_64 and aarch64 with our testing.
Thanks,
Alok
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.4.301 release. There are 224 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 29 Oct 2025 18:34:15 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.4.301-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.4.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.4.301 release. There are 224 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 29 Oct 2025 18:34:15 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.4.301-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.4.y
and the diffstat can be found below.thanks,
greg k-h
Results from Linaro’s test farm.
No regressions on arm64, arm, x86_64, and i386.
NOTE:
As others reported the following build warnings noticed 5.4.301-rc1.
## Build log
In file included from include/linux/list.h:9,
from include/net/tcp.h:19,
from net/ipv4/tcp_output.c:40:net/ipv4/tcp_output.c: In function 'tcp_tso_should_defer':include/linux/kernel.h:843:43: warning: comparison of distinct pointer types lacks a cast
843 | (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
| ^~
## Build
* kernel: 5.4.301-rc1
* git: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
* git commit: 4e89a6191515a2237a64d19f93bb359dc7f5f573
* git describe: v5.4.300-225-g4e89a6191515
* test details:
https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-5.4.y/build/v5.4.300-225-g4e89a6191515
## Test Regressions (compared to v5.4.299-82-ge1a2ff52265e)
## Metric Regressions (compared to v5.4.299-82-ge1a2ff52265e)
## Test Fixes (compared to v5.4.299-82-ge1a2ff52265e)
## Metric Fixes (compared to v5.4.299-82-ge1a2ff52265e)
## Test result summary
total: 39799, pass: 30266, fail: 2455, skip: 6960, xfail: 118
## Build Summary
* arc: 5 total, 5 passed, 0 failed
* arm: 131 total, 131 passed, 0 failed
* arm64: 31 total, 29 passed, 2 failed
* i386: 18 total, 13 passed, 5 failed
* mips: 25 total, 25 passed, 0 failed
* parisc: 3 total, 0 passed, 3 failed
* powerpc: 26 total, 26 passed, 0 failed
* riscv: 9 total, 3 passed, 6 failed
* s390: 6 total, 6 passed, 0 failed
* sh: 10 total, 10 passed, 0 failed
* sparc: 6 total, 6 passed, 0 failed
* x86_64: 27 total, 27 passed, 0 failed
## Test suites summary
* boot
* kselftest-arm64
* kselftest-breakpoints
* kselftest-capabilities
* kselftest-clone3
* kselftest-core
* kselftest-cpu-hotplug
* kselftest-exec
* kselftest-fpu
* kselftest-futex
* kselftest-intel_pstate
* kselftest-kcmp
* kselftest-livepatch
* kselftest-membarrier
* kselftest-mincore
* kselftest-mqueue
* kselftest-openat2
* kselftest-ptrace
* kselftest-rseq
* kselftest-rtc
* kselftest-sigaltstack
* kselftest-size
* kselftest-timers
* kselftest-tmpfs
* kselftest-tpm2
* kselftest-user_events
* kselftest-vDSO
* kselftest-x86
* kunit
* lava
* libhugetlbfs
* log-parser-boot
* log-parser-build-clang
* log-parser-build-gcc
* log-parser-test
* ltp-capability
* ltp-commands
* ltp-containers
* ltp-controllers
* ltp-crypto
* ltp-cve
* ltp-dio
* ltp-fcntl-locktests
* ltp-fs
* ltp-fs_bind
* ltp-fs_perms_simple
* ltp-hugetlb
* ltp-math
* ltp-mm
* ltp-nptl
* ltp-pty
* ltp-sched
* ltp-smoke
* ltp-syscalls
* ltp-tracing
* perf
* rcutorture
--
Linaro LKFT
https://lkft.linaro.org