6.11.6-rc1 review
Subsystems (4)
Greg Kroah-Hartman
maintainerPATCH 145/261 net: pse-pd: Fix out of bound for loop
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kory Maincent <[email protected]>
[ Upstream commit f2767a41959e60763949c73ee180e40c686e807e ]
Adjust the loop limit to prevent out-of-bounds access when iterating over PI structures. The loop should not reach the index pcdev->nr_lines since we allocate exactly pcdev->nr_lines number of PI structures. This fix ensures proper bounds are maintained during iterations.
Message-ID: <[email protected]>
--- drivers/net/pse-pd/pse_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/pse-pd/pse_core.c +2 -2
@@ -113,7 +113,7 @@ static void pse_release_pis(struct pse_controller_dev *pcdev) {int i; -for (i =0 ; i <= pcdev->nr_lines; i++) { +for (i =0 ; i < pcdev->nr_lines; i++) {of_node_put (pcdev->pi[i].pairset[0 ].np);of_node_put (pcdev->pi[i].pairset[1 ].np);of_node_put (pcdev->pi[i].np);
@@ -647,7 +647,7 @@ static int of_pse_match_pi(struct pse_controller_dev *pcdev, {int i; -for (i =0 ; i <= pcdev->nr_lines; i++) { +for (i =0 ; i < pcdev->nr_lines; i++) {if (pcdev->pi[i].np == np)return i; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 146/261 net/sun3_82586: fix potential memory leak in sun3_82586_send_packet()
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wang Hai <[email protected]>
[ Upstream commit 2cb3f56e827abb22c4168ad0c1bbbf401bb2f3b8 ]
The sun3_82586_send_packet() returns NETDEV_TX_OK without freeing skb in case of skb->len being too long, add dev_kfree_skb() to fix it.
Message-ID: <[email protected]>
--- drivers/net/ethernet/i825xx/sun3_82586.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/i825xx/sun3_82586.c +1 -0
@@ -1012,6 +1012,7 @@ sun3_82586_send_packet(struct sk_buff *skb, struct net_device *dev)if (skb->len >XMIT_BUFF_SIZE ) {printk ("%s: Sorry, max. framelength is %d bytes. The length of your frame is %d bytes.\n" ,dev->name,XMIT_BUFF_SIZE ,skb->len); +dev_kfree_skb (skb);return NETDEV_TX_OK ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 147/261 be2net: fix potential memory leak in be_xmit()
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wang Hai <[email protected]>
[ Upstream commit e4dd8bfe0f6a23acd305f9b892c00899089bd621 ]
The be_xmit() returns NETDEV_TX_OK without freeing skb
in case of be_xmit_enqueue() fails, add dev_kfree_skb_any() to fix it.
Message-ID: <[email protected]>
--- drivers/net/ethernet/emulex/benet/be_main.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/net/ethernet/emulex/benet/be_main.c +5 -5
@@ -1381,10 +1381,8 @@ static netdev_tx_t be_xmit(struct sk_buff *skb, struct net_device *netdev)be_get_wrb_params_from_skb (adapter, skb, &wrb_params); wrb_cnt =be_xmit_enqueue (adapter, txo, skb, &wrb_params); -if (unlikely (!wrb_cnt)) { -dev_kfree_skb_any (skb); - goto drop; - } +if (unlikely (!wrb_cnt)) + goto drop_skb;/* if os2bmc is enabled and if the pkt is destined to bmc, * enqueue the pkt a 2nd time with mgmt bit set.
@@ -1393,7 +1391,7 @@ static netdev_tx_t be_xmit(struct sk_buff *skb, struct net_device *netdev)BE_WRB_F_SET (wrb_params.features,OS2BMC ,1 ); wrb_cnt =be_xmit_enqueue (adapter, txo, skb, &wrb_params);if (unlikely (!wrb_cnt)) - goto drop; + goto drop_skb;else skb_get (skb); }
@@ -1407,6 +1405,8 @@ static netdev_tx_t be_xmit(struct sk_buff *skb, struct net_device *netdev)be_xmit_flush (adapter, txo);return NETDEV_TX_OK ; +drop_skb: +dev_kfree_skb_any (skb); drop:tx_stats (txo)->tx_drv_drops++;/* Flush the already enqueued tx requests */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 148/261 net: plip: fix break; causing plip to never transmit
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Boehm <[email protected]>
[ Upstream commit f99cf996ba5a315f8b9f13cc21dff0604a0eb749 ]
Since commit
71ae2cb30531 ("net: plip: Fix fall-through warnings for Clang")
plip was not able to send any packets, this patch replaces one unintended break; with fallthrough; which was originally missed by commit 9525d69a3667 ("net: plip: mark expected switch fall-throughs").
I have verified with a real hardware PLIP connection that everything works once again after applying this patch.
Message-ID: <[email protected]>
--- drivers/net/plip/plip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/plip/plip.c +1 -1
@@ -815,7 +815,7 @@ plip_send_packet(struct net_device *dev, struct net_local *nl,return HS_TIMEOUT ; } } -break ; + fallthrough;case PLIP_PK_LENGTH_LSB : if (plip_send(nibble_timeout, dev,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 149/261 bnxt_en: replace ptp_lock with irqsave variant
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vadim Fedorenko <[email protected]>
[ Upstream commit 4ab3e4983bcc9d9b9dd9720253cb93f44e9e657c ]
In netpoll configuration the completion processing can happen in hard irq context which will break with spin_lock_bh() for fullfilling RX timestamp in case of all packets timestamping. Replace it with spin_lock_irqsave() variant.
Message-ID: <[email protected]>
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 22 +++--- drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c | 70 +++++++++++-------- drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.h | 12 ++-- 3 files changed, 63 insertions(+), 41 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +14 -8
@@ -2257,10 +2257,11 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_cp_ring_info *cpr,if (!bnxt_get_rx_ts_p5 (bp, &ts, cmpl_ts)) {struct bnxt_ptp_cfg *ptp = bp->ptp_cfg; +unsigned long flags; -spin_lock_bh (&ptp->ptp_lock); +spin_lock_irqsave (&ptp->ptp_lock, flags); ns =timecounter_cyc2time (&ptp->tc, ts); -spin_unlock_bh (&ptp->ptp_lock); +spin_unlock_irqrestore (&ptp->ptp_lock, flags);memset (skb_hwtstamps (skb),0 ,sizeof (*skb_hwtstamps (skb)));skb_hwtstamps (skb)->hwtstamp =ns_to_ktime (ns);
@@ -2760,17 +2761,18 @@ static int bnxt_async_event_process(struct bnxt *bp,case ASYNC_EVENT_CMPL_PHC_UPDATE_EVENT_DATA1_FLAGS_PHC_RTC_UPDATE :if (BNXT_PTP_USE_RTC (bp)) {struct bnxt_ptp_cfg *ptp = bp->ptp_cfg; +unsigned long flags;u64 ns;if (!ptp) goto async_event_process_exit; -spin_lock_bh (&ptp->ptp_lock); +spin_lock_irqsave (&ptp->ptp_lock, flags);bnxt_ptp_update_current_time (bp); ns = (((u64 )BNXT_EVENT_PHC_RTC_UPDATE (data1) <<BNXT_PHC_BITS ) | ptp->current_time);bnxt_ptp_rtc_timecounter_init (ptp, ns); -spin_unlock_bh (&ptp->ptp_lock); +spin_unlock_irqrestore (&ptp->ptp_lock, flags); }break ; }
@@ -13484,9 +13486,11 @@ static void bnxt_force_fw_reset(struct bnxt *bp)return ;if (ptp) { -spin_lock_bh (&ptp->ptp_lock); +unsigned long flags; + +spin_lock_irqsave (&ptp->ptp_lock, flags);set_bit (BNXT_STATE_IN_FW_RESET , &bp->state); -spin_unlock_bh (&ptp->ptp_lock); +spin_unlock_irqrestore (&ptp->ptp_lock, flags); }else {set_bit (BNXT_STATE_IN_FW_RESET , &bp->state); }
@@ -13551,9 +13555,11 @@ void bnxt_fw_reset(struct bnxt *bp)int n =0 , tmo;if (ptp) { -spin_lock_bh (&ptp->ptp_lock); +unsigned long flags; + +spin_lock_irqsave (&ptp->ptp_lock, flags);set_bit (BNXT_STATE_IN_FW_RESET , &bp->state); -spin_unlock_bh (&ptp->ptp_lock); +spin_unlock_irqrestore (&ptp->ptp_lock, flags); }else {set_bit (BNXT_STATE_IN_FW_RESET , &bp->state); }
drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c +42 -28
225 lines not on this page · raw message
drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.h +7 -5
@@ -146,11 +146,13 @@ struct bnxt_ptp_cfg { };#if BITS_PER_LONG ==32 -#define BNXT_READ_TIME64 (ptp, dst, src) \ -do { \ - spin_lock_bh(&(ptp)->ptp_lock); \ - (dst) = (src); \ - spin_unlock_bh(&(ptp)->ptp_lock); \ +#define BNXT_READ_TIME64 (ptp, dst, src) \ +do { \ + unsigned long flags; \ + \ + spin_lock_irqsave(&(ptp)->ptp_lock, flags); \ + (dst) = (src); \ + spin_unlock_irqrestore(&(ptp)->ptp_lock, flags); \ } while (0)#else #define BNXT_READ_TIME64 (ptp, dst, src) \
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 150/261 octeon_ep: Implement helper for iterating packets in Rx queue
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aleksandr Mishin <[email protected]>
[ Upstream commit bd28df26197b2bd0913bf1b36770836481975143 ]
The common code with some packet and index manipulations is extracted and moved to newly implemented helper to make the code more readable and avoid duplication. This is a preparation for skb allocation failure handling.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Stable-dep-of: eb592008f79b ("octeon_ep: Add SKB allocation failures handling in __octep_oq_process_rx()")
--- .../net/ethernet/marvell/octeon_ep/octep_rx.c | 55 +++++++++++-------- 1 file changed, 32 insertions(+), 23 deletions(-)
drivers/net/ethernet/marvell/octeon_ep/octep_rx.c +32 -23
@@ -336,6 +336,30 @@ static int octep_oq_check_hw_for_pkts(struct octep_device *oct,return new_pkts; } +/** +* octep_oq_next_pkt() - Move to the next packet in Rx queue. +* +* @oq: Octeon Rx queue data structure. +* @buff_info: Current packet buffer info. +* @read_idx: Current packet index in the ring. +* @desc_used: Current packet descriptor number. +* +* Free the resources associated with a packet. +* Increment packet index in the ring and packet descriptor number. +*/ +static void octep_oq_next_pkt (struct octep_oq *oq, +struct octep_rx_buffer *buff_info, +u32 *read_idx,u32 *desc_used) +{ +dma_unmap_page (oq->dev, oq->desc_ring[*read_idx].buffer_ptr, +PAGE_SIZE ,DMA_FROM_DEVICE ); + buff_info->page =NULL ; + (*read_idx)++; + (*desc_used)++; +if (*read_idx == oq->max_count) + *read_idx =0 ; +} +/** * __octep_oq_process_rx() - Process hardware Rx queue and push to stack. *
@@ -367,10 +391,7 @@ static int __octep_oq_process_rx(struct octep_device *oct, desc_used =0 ;for (pkt =0 ; pkt < pkts_to_process; pkt++) { buff_info = (struct octep_rx_buffer *)&oq->buff_info[read_idx]; -dma_unmap_page (oq->dev, oq->desc_ring[read_idx].buffer_ptr, -PAGE_SIZE ,DMA_FROM_DEVICE ); resp_hw =page_address (buff_info->page); - buff_info->page =NULL ;/* Swap the length field that is in Big-Endian to CPU */ buff_info->len =be64_to_cpu (resp_hw->length);
@@ -394,36 +415,27 @@ static int __octep_oq_process_rx(struct octep_device *oct, data_offset =OCTEP_OQ_RESP_HW_SIZE ; rx_ol_flags =0 ; } + +octep_oq_next_pkt (oq, buff_info, &read_idx, &desc_used); + + skb =build_skb ((void *)resp_hw,PAGE_SIZE ); +skb_reserve (skb, data_offset); + rx_bytes += buff_info->len;if (buff_info->len <= oq->max_single_buffer_size) { - skb =build_skb ((void *)resp_hw,PAGE_SIZE ); -skb_reserve (skb, data_offset);skb_put (skb, buff_info->len); - read_idx++; - desc_used++; -if (read_idx == oq->max_count) - read_idx =0 ; }else {struct skb_shared_info *shinfo;u16 data_len; - skb =build_skb ((void *)resp_hw,PAGE_SIZE ); -skb_reserve (skb, data_offset);/* Head fragment includes response header(s); * subsequent fragments contains only data. */ skb_put (skb, oq->max_single_buffer_size); - read_idx++; - desc_used++; -if (read_idx == oq->max_count) - read_idx =0 ; - shinfo =skb_shinfo (skb); data_len = buff_info->len - oq->max_single_buffer_size;while (data_len) { -dma_unmap_page (oq->dev, oq->desc_ring[read_idx].buffer_ptr, -PAGE_SIZE ,DMA_FROM_DEVICE ); buff_info = (struct octep_rx_buffer *) &oq->buff_info[read_idx];if (data_len < oq->buffer_size) {
@@ -438,11 +450,8 @@ static int __octep_oq_process_rx(struct octep_device *oct, buff_info->page,0 , buff_info->len, buff_info->len); - buff_info->page =NULL ; - read_idx++; - desc_used++; -if (read_idx == oq->max_count) - read_idx =0 ; + +octep_oq_next_pkt (oq, buff_info, &read_idx, &desc_used); } }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 151/261 octeon_ep: Add SKB allocation failures handling in __octep_oq_process_rx()
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aleksandr Mishin <[email protected]>
[ Upstream commit eb592008f79be52ccef88cd9a5249b3fc0367278 ]
build_skb() returns NULL in case of a memory allocation failure so handle it inside __octep_oq_process_rx() to avoid NULL pointer dereference.
__octep_oq_process_rx() is called during NAPI polling by the driver. If skb allocation fails, keep on pulling packets out of the Rx DMA queue: we shouldn't break the polling immediately and thus falsely indicate to the octep_napi_poll() that the Rx pressure is going down. As there is no associated skb in this case, don't process the packets and don't push them up the network stack - they are skipped.
Helper function is implemented to unmmap/flush all the fragment buffers used by the dropped packet. 'alloc_failures' counter is incremented to mark the skb allocation error in driver statistics.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- .../net/ethernet/marvell/octeon_ep/octep_rx.c | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+)
drivers/net/ethernet/marvell/octeon_ep/octep_rx.c +27 -0
@@ -360,6 +360,27 @@ static void octep_oq_next_pkt(struct octep_oq *oq, *read_idx =0 ; } +/** +* octep_oq_drop_rx() - Free the resources associated with a packet. +* +* @oq: Octeon Rx queue data structure. +* @buff_info: Current packet buffer info. +* @read_idx: Current packet index in the ring. +* @desc_used: Current packet descriptor number. +* +*/ +static void octep_oq_drop_rx (struct octep_oq *oq, +struct octep_rx_buffer *buff_info, +u32 *read_idx,u32 *desc_used) +{ +int data_len = buff_info->len - oq->max_single_buffer_size; + +while (data_len >0 ) { +octep_oq_next_pkt (oq, buff_info, read_idx, desc_used); + data_len -= oq->buffer_size; + }; +} +/** * __octep_oq_process_rx() - Process hardware Rx queue and push to stack. *
@@ -419,6 +440,12 @@ static int __octep_oq_process_rx(struct octep_device *oct,octep_oq_next_pkt (oq, buff_info, &read_idx, &desc_used); skb =build_skb ((void *)resp_hw,PAGE_SIZE ); +if (!skb) { +octep_oq_drop_rx (oq, buff_info, + &read_idx, &desc_used); + oq->stats.alloc_failures++; +continue ; + }skb_reserve (skb, data_offset); rx_bytes += buff_info->len;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 152/261 net: dsa: mv88e6xxx: Fix error when setting port policy on mv88e6393x
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Rashleigh <[email protected]>
[ Upstream commit 12bc14949c4a7272b509af0f1022a0deeb215fd8 ]
mv88e6393x_port_set_policy doesn't correctly shift the ptr value when converting the policy format between the old and new styles, so the target register ends up with the ptr being written over the data bits.
Shift the pointer to align with the format expected by mv88e6393x_port_policy_write().
Message-ID: <[email protected]>
--- drivers/net/dsa/mv88e6xxx/port.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/dsa/mv88e6xxx/port.c +1 -0
@@ -1713,6 +1713,7 @@ int mv88e6393x_port_set_policy(struct mv88e6xxx_chip *chip, int port, ptr = shift /8 ; shift %=8 ; mask >>= ptr *8 ; + ptr <<=8 ; err =mv88e6393x_port_policy_read (chip, port, ptr, ®);if (err)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 153/261 bpf, arm64: Fix address emission with tag-based KASAN enabled
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Collingbourne <[email protected]>
[ Upstream commit a552e2ef5fd1a6c78267cd4ec5a9b49aa11bbb1c ]
When BPF_TRAMP_F_CALL_ORIG is enabled, the address of a bpf_tramp_image struct on the stack is passed during the size calculation pass and an address on the heap is passed during code generation. This may cause a heap buffer overflow if the heap address is tagged because emit_a64_mov_i64() will emit longer code than it did during the size calculation pass. The same problem could occur without tag-based KASAN if one of the 16-bit words of the stack address happened to be all-ones during the size calculation pass. Fix the problem by assuming the worst case (4 instructions) when calculating the size of the bpf_tramp_image address emission.
--- arch/arm64/net/bpf_jit_comp.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
arch/arm64/net/bpf_jit_comp.c +10 -2
@@ -2172,7 +2172,11 @@ static int prepare_trampoline(struct jit_ctx *ctx, struct bpf_tramp_image *im,emit (A64_STR64I (A64_R (20 ),A64_SP , regs_off +8 ), ctx);if (flags &BPF_TRAMP_F_CALL_ORIG ) { -emit_a64_mov_i64 (A64_R (0 ), (const u64 )im, ctx); +/* for the first pass, assume the worst case */ +if (!ctx->image) + ctx->idx +=4 ; +else +emit_a64_mov_i64 (A64_R (0 ), (const u64 )im, ctx);emit_call ((const u64 )__bpf_tramp_enter, ctx); }
@@ -2216,7 +2220,11 @@ static int prepare_trampoline(struct jit_ctx *ctx, struct bpf_tramp_image *im,if (flags &BPF_TRAMP_F_CALL_ORIG ) { im->ip_epilogue = ctx->ro_image + ctx->idx; -emit_a64_mov_i64 (A64_R (0 ), (const u64 )im, ctx); +/* for the first pass, assume the worst case */ +if (!ctx->image) + ctx->idx +=4 ; +else +emit_a64_mov_i64 (A64_R (0 ), (const u64 )im, ctx);emit_call ((const u64 )__bpf_tramp_exit, ctx); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 154/261 fsl/fman: Save device references taken in mac_probe()
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aleksandr Mishin <[email protected]>
[ Upstream commit efeddd552ec6767e4c8884caa516ac80b65f8823 ]
In mac_probe() there are calls to of_find_device_by_node() which takes references to of_dev->dev. These references are not saved and not released later on error path in mac_probe() and in mac_remove().
Add new fields into mac_device structure to save references taken for future use in mac_probe() and mac_remove().
This is a preparation for further reference leaks fix.
Stable-dep-of: 1dec67e0d9fb ("fsl/fman: Fix refcount handling of fman-related devices")
--- drivers/net/ethernet/freescale/fman/mac.c | 6 ++++-- drivers/net/ethernet/freescale/fman/mac.h | 6 +++++- 2 files changed, 9 insertions(+), 3 deletions(-)
drivers/net/ethernet/freescale/fman/mac.c +4 -2
@@ -197,6 +197,7 @@ static int mac_probe(struct platform_device *_of_dev) err = -EINVAL ; goto _return_of_node_put; } + mac_dev->fman_dev = &of_dev->dev;/* Get the FMan cell-index */ err =of_property_read_u32 (dev_node,"cell-index" , &val);
@@ -208,7 +209,7 @@ static int mac_probe(struct platform_device *_of_dev)/* cell-index 0 => FMan id 1 */ fman_id = (u8)(val +1 ); - priv->fman =fman_bind (&of_dev->dev); + priv->fman =fman_bind (mac_dev->fman_dev);if (!priv->fman) {dev_err (dev,"fman_bind(%pOF) failed\n" , dev_node); err = -ENODEV ;
@@ -284,8 +285,9 @@ static int mac_probe(struct platform_device *_of_dev) err = -EINVAL ; goto _return_of_node_put; } + mac_dev->fman_port_devs[i] = &of_dev->dev; - mac_dev->port[i] =fman_port_bind (&of_dev->dev); + mac_dev->port[i] =fman_port_bind (mac_dev->fman_port_devs[i]);if (!mac_dev->port[i]) {dev_err (dev,"dev_get_drvdata(%pOF) failed\n" , dev_node);
drivers/net/ethernet/freescale/fman/mac.h +5 -1
@@ -19,12 +19,13 @@struct fman_mac ;struct mac_priv_s ; +#define PORT_NUM 2struct mac_device {void __iomem *vaddr;struct device *dev;struct resource *res;u8 addr[ETH_ALEN ]; -struct fman_port *port[2 ]; +struct fman_port *port[PORT_NUM ];struct phylink *phylink;struct phylink_config phylink_config;phy_interface_t phy_if;
@@ -52,6 +53,9 @@ struct mac_device {struct fman_mac *fman_mac;struct mac_priv_s *priv; + +struct device *fman_dev; +struct device *fman_port_devs[PORT_NUM ]; }; static inline struct mac_device
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 155/261 fsl/fman: Fix refcount handling of fman-related devices
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aleksandr Mishin <[email protected]>
[ Upstream commit 1dec67e0d9fbb087c2ab17bf1bd17208231c3bb1 ]
In mac_probe() there are multiple calls to of_find_device_by_node(), fman_bind() and fman_port_bind() which takes references to of_dev->dev. Not all references taken by these calls are released later on error path in mac_probe() and in mac_remove() which lead to reference leaks.
Add references release.
--- drivers/net/ethernet/freescale/fman/mac.c | 62 +++++++++++++++++------ 1 file changed, 47 insertions(+), 15 deletions(-)
drivers/net/ethernet/freescale/fman/mac.c +47 -15
@@ -204,7 +204,7 @@ static int mac_probe(struct platform_device *_of_dev)if (err) {dev_err (dev,"failed to read cell-index for %pOF\n" , dev_node); err = -EINVAL ; - goto _return_of_node_put; + goto _return_dev_put; }/* cell-index 0 => FMan id 1 */ fman_id = (u8)(val +1 );
@@ -213,40 +213,51 @@ static int mac_probe(struct platform_device *_of_dev)if (!priv->fman) {dev_err (dev,"fman_bind(%pOF) failed\n" , dev_node); err = -ENODEV ; - goto _return_of_node_put; + goto _return_dev_put; } +/* Two references have been taken in of_find_device_by_node() +* and fman_bind(). Release one of them here. The second one +* will be released in mac_remove(). +*/ +put_device (mac_dev->fman_dev);of_node_put (dev_node); + dev_node =NULL ;/* Get the address of the memory mapped registers */ mac_dev->res =platform_get_mem_or_io (_of_dev,0 );if (!mac_dev->res) {dev_err (dev,"could not get registers\n" ); -return -EINVAL ; + err = -EINVAL ; + goto _return_dev_put; } err =devm_request_resource (dev,fman_get_mem_region (priv->fman), mac_dev->res);if (err) {dev_err_probe (dev, err,"could not request resource\n" ); -return err; + goto _return_dev_put; } mac_dev->vaddr =devm_ioremap (dev, mac_dev->res->start,resource_size (mac_dev->res));if (!mac_dev->vaddr) {dev_err (dev,"devm_ioremap() failed\n" ); -return -EIO ; + err = -EIO ; + goto _return_dev_put; } -if (!of_device_is_available (mac_node)) -return -ENODEV ; +if (!of_device_is_available (mac_node)) { + err = -ENODEV ; + goto _return_dev_put; + }/* Get the cell-index */ err =of_property_read_u32 (mac_node,"cell-index" , &val);if (err) {dev_err (dev,"failed to read cell-index for %pOF\n" , mac_node); -return -EINVAL ; + err = -EINVAL ; + goto _return_dev_put; } priv->cell_index = (u8 )val;
@@ -260,22 +271,26 @@ static int mac_probe(struct platform_device *_of_dev)if (unlikely (nph <0 )) {dev_err (dev,"of_count_phandle_with_args(%pOF, fsl,fman-ports) failed\n" , mac_node); -return nph; + err = nph; + goto _return_dev_put; }if (nph !=ARRAY_SIZE (mac_dev->port)) {dev_err (dev,"Not supported number of fman-ports handles of mac node %pOF from device tree\n" , mac_node); -return -EINVAL ; + err = -EINVAL ; + goto _return_dev_put; } -for (i =0 ; i <ARRAY_SIZE (mac_dev->port); i++) { +/* PORT_NUM determines the size of the port array */ +for (i =0 ; i <PORT_NUM ; i++) {/* Find the port node */ dev_node =of_parse_phandle (mac_node,"fsl,fman-ports" , i);if (!dev_node) {dev_err (dev,"of_parse_phandle(%pOF, fsl,fman-ports) failed\n" , mac_node); -return -EINVAL ; + err = -EINVAL ; + goto _return_dev_arr_put; } of_dev =of_find_device_by_node (dev_node);
@@ -283,7 +298,7 @@ static int mac_probe(struct platform_device *_of_dev)dev_err (dev,"of_find_device_by_node(%pOF) failed\n" , dev_node); err = -EINVAL ; - goto _return_of_node_put; + goto _return_dev_arr_put; } mac_dev->fman_port_devs[i] = &of_dev->dev;
@@ -292,9 +307,15 @@ static int mac_probe(struct platform_device *_of_dev)dev_err (dev,"dev_get_drvdata(%pOF) failed\n" , dev_node); err = -EINVAL ; - goto _return_of_node_put; + goto _return_dev_arr_put; } +/* Two references have been taken in of_find_device_by_node() +* and fman_port_bind(). Release one of them here. The second +* one will be released in mac_remove(). +*/ +put_device (mac_dev->fman_port_devs[i]);of_node_put (dev_node); + dev_node =NULL ; }/* Get the PHY connection type */
@@ -314,7 +335,7 @@ static int mac_probe(struct platform_device *_of_dev) err =init (mac_dev, mac_node, ¶ms);if (err <0 ) -return err; + goto _return_dev_arr_put;if (!is_zero_ether_addr (mac_dev->addr))dev_info (dev,"FMan MAC address: %pM\n" , mac_dev->addr);
@@ -329,6 +350,12 @@ static int mac_probe(struct platform_device *_of_dev)return err; +_return_dev_arr_put: +/* mac_dev is kzalloc'ed */ +for (i =0 ; i <PORT_NUM ; i++) +put_device (mac_dev->fman_port_devs[i]); +_return_dev_put: +put_device (mac_dev->fman_dev); _return_of_node_put:of_node_put (dev_node);return err;
@@ -337,6 +364,11 @@ static int mac_probe(struct platform_device *_of_dev)static void mac_remove (struct platform_device *pdev) {struct mac_device *mac_dev =platform_get_drvdata (pdev); +int i; + +for (i =0 ; i <PORT_NUM ; i++) +put_device (mac_dev->fman_port_devs[i]); +put_device (mac_dev->fman_dev);platform_device_unregister (mac_dev->priv->eth_dev); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 156/261 netfilter: xtables: fix typo causing some targets not to load on IPv6
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pablo Neira Ayuso <[email protected]>
[ Upstream commit 306ed1728e8438caed30332e1ab46b28c25fe3d8 ]
- There is no NFPROTO_IPV6 family for mark and NFLOG.
- TRACE is also missing module autoload with NFPROTO_IPV6.
This results in ip6tables failing to restore a ruleset. This issue has been reported by several users providing incomplete patches.
Very similar to Ilya Katsnelson's patch including a missing chunk in the TRACE extension.
--- net/netfilter/xt_NFLOG.c | 2 +- net/netfilter/xt_TRACE.c | 1 + net/netfilter/xt_mark.c | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-)
net/netfilter/xt_NFLOG.c +1 -1
@@ -79,7 +79,7 @@ static struct xt_target nflog_tg_reg[] __read_mostly = { { .name = "NFLOG", .revision = 0, - .family = NFPROTO_IPV4, + .family = NFPROTO_IPV6, .checkentry = nflog_tg_check, .destroy = nflog_tg_destroy, .target = nflog_tg,
net/netfilter/xt_TRACE.c +1 -0
@@ -49,6 +49,7 @@ static struct xt_target trace_tg_reg[] __read_mostly = { .target = trace_tg, .checkentry = trace_tg_check, .destroy = trace_tg_destroy, + .me = THIS_MODULE, },#endif };
net/netfilter/xt_mark.c +1 -1
@@ -62,7 +62,7 @@ static struct xt_target mark_tg_reg[] __read_mostly = { { .name = "MARK", .revision = 2, - .family = NFPROTO_IPV4, + .family = NFPROTO_IPV6, .target = mark_tg, .targetsize = sizeof(struct xt_mark_tginfo2), .me = THIS_MODULE,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 157/261 net: wwan: fix global oob in wwan_rtnl_policy
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lin Ma <[email protected]>
[ Upstream commit 47dd5447cab8ce30a847a0337d5341ae4c7476a7 ]
The variable wwan_rtnl_link_ops assign a *bigger* maxtype which leads to a global out-of-bounds read when parsing the netlink attributes. Exactly same bug cause as the oob fixed in commit b33fb5b801c6 ("net: qualcomm:
rmnet: fix global oob in rmnet_policy").
==================================================================
BUG: KASAN: global-out-of-bounds in validate_nla lib/nlattr.c:388 [inline] BUG: KASAN: global-out-of-bounds in __nla_validate_parse+0x19d7/0x29a0 lib/nlattr.c:603 Read of size 1 at addr ffffffff8b09cb60 by task syz.1.66276/323862 CPU: 0 PID: 323862 Comm: syz.1.66276 Not tainted 6.1.70 #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-1ubuntu1.1 04/01/2014 Call Trace: <TASK> __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x177/0x231 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:284 [inline] print_report+0x14f/0x750 mm/kasan/report.c:395 kasan_report+0x139/0x170 mm/kasan/report.c:495 validate_nla lib/nlattr.c:388 [inline] __nla_validate_parse+0x19d7/0x29a0 lib/nlattr.c:603 __nla_parse+0x3c/0x50 lib/nlattr.c:700 nla_parse_nested_deprecated include/net/netlink.h:1269 [inline] __rtnl_newlink net/core/rtnetlink.c:3514 [inline] rtnl_newlink+0x7bc/0x1fd0 net/core/rtnetlink.c:3623 rtnetlink_rcv_msg+0x794/0xef0 net/core/rtnetlink.c:6122 netlink_rcv_skb+0x1de/0x420 net/netlink/af_netlink.c:2508 netlink_unicast_kernel net/netlink/af_netlink.c:1326 [inline] netlink_unicast+0x74b/0x8c0 net/netlink/af_netlink.c:1352 netlink_sendmsg+0x882/0xb90 net/netlink/af_netlink.c:1874 sock_sendmsg_nosec net/socket.c:716 [inline] __sock_sendmsg net/socket.c:728 [inline] ____sys_sendmsg+0x5cc/0x8f0 net/socket.c:2499 ___sys_sendmsg+0x21c/0x290 net/socket.c:2553 __sys_sendmsg net/socket.c:2582 [inline] __do_sys_sendmsg net/socket.c:2591 [inline] __se_sys_sendmsg+0x19e/0x270 net/socket.c:2589 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x45/0x90 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7f67b19a24ad RSP: 002b:00007f67b17febb8 EFLAGS: 00000246 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 00007f67b1b45f80 RCX: 00007f67b19a24ad RDX: 0000000000000000 RSI: 0000000020005e40 RDI: 0000000000000004 RBP: 00007f67b1a1e01d R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffd2513764f R14: 00007ffd251376e0 R15: 00007f67b17fed40 </TASK> The buggy address belongs to the variable: wwan_rtnl_policy+0x20/0x40 The buggy address belongs to the physical page: page:ffffea00002c2700 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0xb09c flags: 0xfff00000001000(reserved|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000001000 ffffea00002c2708 ffffea00002c2708 0000000000000000 raw: 0000000000000000 0000000000000000 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected
page_owner info is not present (never set?)
Memory state around the buggy address:
ffffffff8b09ca00: 05 f9 f9 f9 05 f9 f9 f9 00 01 f9 f9 00 01 f9 f9
ffffffff8b09ca80: 00 00 00 05 f9 f9 f9 f9 00 00 03 f9 f9 f9 f9 f9
>ffffffff8b09cb00: 00 00 00 00 05 f9 f9 f9 00 00 00 00 f9 f9 f9 f9
^
ffffffff8b09cb80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================According to the comment of nla_parse_nested_deprecated, use correct size IFLA_WWAN_MAX here to fix this issue.
--- drivers/net/wwan/wwan_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wwan/wwan_core.c +1 -1
@@ -1038,7 +1038,7 @@ static const struct nla_policy wwan_rtnl_policy[IFLA_WWAN_MAX + 1] = {static struct rtnl_link_ops wwan_rtnl_link_ops__read_mostly = { .kind ="wwan" , - .maxtype = __IFLA_WWAN_MAX, + .maxtype =IFLA_WWAN_MAX , .alloc = wwan_rtnl_alloc, .validate = wwan_rtnl_validate, .newlink = wwan_rtnl_newlink,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 158/261 net: fix races in netdev_tx_sent_queue()/dev_watchdog()
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 95ecba62e2fd201bcdcca636f5d774f1cd4f1458 ]
Some workloads hit the infamous dev_watchdog() message:
"NETDEV WATCHDOG: eth0 (xxxx): transmit queue XX timed out"
It seems possible to hit this even for perfectly normal BQL enabled drivers:
1) Assume a TX queue was idle for more than dev->watchdog_timeo (5 seconds unless changed by the driver)
2) Assume a big packet is sent, exceeding current BQL limit.
3) Driver ndo_start_xmit() puts the packet in TX ring, and netdev_tx_sent_queue() is called.
4) QUEUE_STATE_STACK_XOFF could be set from netdev_tx_sent_queue() before txq->trans_start has been written.
5) txq->trans_start is written later, from netdev_start_xmit()
if (rc == NETDEV_TX_OK)
txq_trans_update(txq)dev_watchdog() running on another cpu could read the old txq->trans_start, and then see QUEUE_STATE_STACK_XOFF, because 5) did not happen yet.
To solve the issue, write txq->trans_start right before one XOFF bit is set :
- _QUEUE_STATE_DRV_XOFF from netif_tx_stop_queue()
- __QUEUE_STATE_STACK_XOFF from netdev_tx_sent_queue()
Quoted 1 line
From
dev_watchdog(), we have to readtxq->statebeforetxq->trans_start.
Add memory barriers to enforce correct ordering.
In the future, we could avoid writing over txq->trans_start for normal operations, and rename this field to txq->xoff_start_time.
--- include/linux/netdevice.h | 12 ++++++++++++ net/sched/sch_generic.c | 8 +++++++- 2 files changed, 19 insertions(+), 1 deletion(-)
include/linux/netdevice.h +12 -0
@@ -3336,6 +3336,12 @@ static inline void netif_tx_wake_all_queues(struct net_device *dev) static __always_inline void netif_tx_stop_queue(struct netdev_queue *dev_queue) { +/* Paired with READ_ONCE() from dev_watchdog() */ +WRITE_ONCE (dev_queue->trans_start, jiffies); + +/* This barrier is paired with smp_mb() from dev_watchdog() */ +smp_mb__before_atomic (); +/* Must be an atomic op see netif_txq_try_stop() */ set_bit (__QUEUE_STATE_DRV_XOFF, &dev_queue->state); }
@@ -3462,6 +3468,12 @@ static inline void netdev_tx_sent_queue(struct netdev_queue *dev_queue,if (likely (dql_avail (&dev_queue->dql) >=0 ))return ; +/* Paired with READ_ONCE() from dev_watchdog() */ +WRITE_ONCE (dev_queue->trans_start, jiffies); + +/* This barrier is paired with smp_mb() from dev_watchdog() */ +smp_mb__before_atomic (); +set_bit (__QUEUE_STATE_STACK_XOFF, &dev_queue->state);/*
net/sched/sch_generic.c +7 -1
@@ -512,9 +512,15 @@ static void dev_watchdog(struct timer_list *t)struct netdev_queue *txq; txq =netdev_get_tx_queue (dev, i); - trans_start =READ_ONCE (txq->trans_start);if (!netif_xmit_stopped (txq))continue ; + +/* Paired with WRITE_ONCE() + smp_mb...() in +* netdev_tx_sent_queue() and netif_tx_stop_queue(). +*/ +smp_mb (); + trans_start =READ_ONCE (txq->trans_start); +if (time_after (jiffies, trans_start + dev->watchdog_timeo)) { timedout_ms =jiffies_to_msecs (jiffies - trans_start);atomic_long_inc (&txq->trans_timeout);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 159/261 virtio_net: fix integer overflow in stats
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael S. Tsirkin <[email protected]>
[ Upstream commit d95d9a31aceb2021084bc9b94647bc5b175e05e7 ]
Static analysis on linux-next has detected the following issue in function virtnet_stats_ctx_init, in drivers/net/virtio_net.c :
if (vi->device_stats_cap & VIRTIO_NET_STATS_TYPE_CVQ) {
queue_type = VIRTNET_Q_TYPE_CQ;
ctx->bitmap[queue_type] |= VIRTIO_NET_STATS_TYPE_CVQ;
ctx->desc_num[queue_type] += ARRAY_SIZE(virtnet_stats_cvq_desc);
ctx->size[queue_type] += sizeof(struct virtio_net_stats_cvq);
}ctx->bitmap is declared as a u32 however it is being bit-wise or'd with VIRTIO_NET_STATS_TYPE_CVQ and this is defined as 1 << 32:
include/uapi/linux/virtio_net.h:#define VIRTIO_NET_STATS_TYPE_CVQ (1ULL << 32)
..and hence the bit-wise or operation won't set any bits in ctx->bitmap because 1ULL < 32 is too wide for a u32.
In fact, the field is read into a u64:
u64 offset, bitmap;
....
bitmap = ctx->bitmap[queue_type];so to fix, it is enough to make bitmap an array of u64.
--- drivers/net/virtio_net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/virtio_net.c +1 -1
@@ -4155,7 +4155,7 @@ struct virtnet_stats_ctx {u32 desc_num[3 ];/* The actual supported stat types. */ -u32 bitmap[3 ]; +u64 bitmap[3 ];/* Used to calculate the reply buffer size. */ u32 size[3 ];
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 160/261 mlxsw: spectrum_router: fix xa_store() error checking
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuan Can <[email protected]>
[ Upstream commit f7b4cf0306bbea500a613e4b618576452c1df4ba ]
It is meant to use xa_err() to extract the error encoded in the return value of xa_store().
--- drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c +3 -6
@@ -3197,7 +3197,6 @@ mlxsw_sp_nexthop_sh_counter_get(struct mlxsw_sp *mlxsw_sp, {struct mlxsw_sp_nexthop_group *nh_grp = nh->nhgi->nh_grp;struct mlxsw_sp_nexthop_counter *nhct; -void *ptr;int err; nhct =xa_load (&nh_grp->nhgi->nexthop_counters, nh->id);
@@ -3210,12 +3209,10 @@ mlxsw_sp_nexthop_sh_counter_get(struct mlxsw_sp *mlxsw_sp,if (IS_ERR (nhct))return nhct; - ptr =xa_store (&nh_grp->nhgi->nexthop_counters, nh->id, nhct, -GFP_KERNEL ); -if (IS_ERR (ptr)) { - err =PTR_ERR (ptr); + err =xa_err (xa_store (&nh_grp->nhgi->nexthop_counters, nh->id, nhct, +GFP_KERNEL )); +if (err) goto err_store; - }return nhct;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 161/261 net: usb: usbnet: fix name regression
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oliver Neukum <[email protected]>
[ Upstream commit 8a7d12d674ac6f2147c18f36d1e15f1a48060edf ]
The fix for MAC addresses broke detection of the naming convention because it gave network devices no random MAC before bind() was called. This means that the check for the local assignment bit was always negative as the address was zeroed from allocation, instead of from overwriting the MAC with a unique hardware address.
The correct check for whether bind() has altered the MAC is done with is_zero_ether_addr
--- drivers/net/usb/usbnet.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/usb/usbnet.c +2 -1
@@ -1767,7 +1767,8 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)// can rename the link if it knows better. if ((dev->driver_info->flags &FLAG_ETHER ) !=0 && ((dev->driver_info->flags &FLAG_POINTTOPOINT ) ==0 || - (net->dev_addr [0 ] &0x02 ) ==0 )) +/* somebody touched it*/ + !is_zero_ether_addr (net->dev_addr)))strscpy (net->name,"eth%d" ,sizeof (net->name));/* WLAN devices should always be named "wlan%d" */ if ((dev->driver_info->flags &FLAG_WLAN ) !=0 )
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 162/261 bpf: Preserve param->string when parsing mount options
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hou Tao <[email protected]>
[ Upstream commit 1f97c03f43fadc407de5b5cb01c07755053e1c22 ]
In bpf_parse_param(), keep the value of param->string intact so it can be freed later. Otherwise, the kmalloc area pointed to by param->string will be leaked as shown below:
unreferenced object 0xffff888118c46d20 (size 8):
comm "new_name", pid 12109, jiffies 4295580214
hex dump (first 8 bytes):
61 6e 79 00 38 c9 5c 7e any.8.\~
backtrace (crc e1b7f876):
[<00000000c6848ac7>] kmemleak_alloc+0x4b/0x80
[<00000000de9f7d00>] __kmalloc_node_track_caller_noprof+0x36e/0x4a0
[<000000003e29b886>] memdup_user+0x32/0xa0
[<0000000007248326>] strndup_user+0x46/0x60
[<0000000035b3dd29>] __x64_sys_fsconfig+0x368/0x3d0
[<0000000018657927>] x64_sys_call+0xff/0x9f0
[<00000000c0cabc95>] do_syscall_64+0x3b/0xc0
[<000000002f331597>] entry_SYSCALL_64_after_hwframe+0x4b/0x53--- kernel/bpf/inode.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
kernel/bpf/inode.c +3 -2
@@ -880,7 +880,7 @@ static int bpf_parse_param(struct fs_context *fc, struct fs_parameter *param)const struct btf_type *enum_t;const char *enum_pfx;u64 *delegate_msk, msk =0 ; -char *p; +char *p, *str;int val;/* ignore errors, fallback to hex */
@@ -911,7 +911,8 @@ static int bpf_parse_param(struct fs_context *fc, struct fs_parameter *param)return -EINVAL ; } -while ((p =strsep (¶m->string,":" ))) { + str = param->string; +while ((p =strsep (&str,":" ))) {if (strcmp (p,"any" ) ==0 ) { msk |= ~0ULL ; }else if (find_btf_enum_const (info.btf, enum_t, enum_pfx, p, &val)) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 163/261 bpf: Add MEM_WRITE attribute
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Borkmann <[email protected]>
[ Upstream commit 6fad274f06f038c29660aa53fbad14241c9fd976 ]
Add a MEM_WRITE attribute for BPF helper functions which can be used in bpf_func_proto to annotate an argument type in order to let the verifier know that the helper writes into the memory passed as an argument. In the past MEM_UNINIT has been (ab)used for this function, but the latter merely tells the verifier that the passed memory can be uninitialized.
There have been bugs with overloading the latter but aside from that there are also cases where the passed memory is read + written which currently cannot be expressed, see also 4b3786a6c539 ("bpf: Zero former ARG_PTR_TO_{LONG,INT} args in case of error").
Stable-dep-of: 8ea607330a39 ("bpf: Fix overloading of MEM_UNINIT's meaning")
--- include/linux/bpf.h | 14 +++++++++++--- kernel/bpf/helpers.c | 10 +++++----- kernel/bpf/ringbuf.c | 2 +- kernel/bpf/syscall.c | 2 +- kernel/trace/bpf_trace.c | 4 ++-- net/core/filter.c | 4 ++-- 6 files changed, 22 insertions(+), 14 deletions(-)
include/linux/bpf.h +11 -3
@@ -635,6 +635,7 @@ enum bpf_type_flag {*/ PTR_UNTRUSTED =BIT (6 +BPF_BASE_TYPE_BITS ), +/* MEM can be uninitialized. */ MEM_UNINIT = BIT(7 + BPF_BASE_TYPE_BITS),/* DYNPTR points to memory local to the bpf program. */
@@ -700,6 +701,13 @@ enum bpf_type_flag {*/ MEM_ALIGNED =BIT (17 +BPF_BASE_TYPE_BITS ), +/* MEM is being written to, often combined with MEM_UNINIT. Non-presence +* of MEM_WRITE means that MEM is only being read. MEM_WRITE without the +* MEM_UNINIT means that memory needs to be initialized since it is also +* read. +*/ +MEM_WRITE =BIT (18 +BPF_BASE_TYPE_BITS ), + __BPF_TYPE_FLAG_MAX, __BPF_TYPE_LAST_FLAG = __BPF_TYPE_FLAG_MAX - 1, };
@@ -758,10 +766,10 @@ enum bpf_arg_type {ARG_PTR_TO_SOCKET_OR_NULL =PTR_MAYBE_NULL |ARG_PTR_TO_SOCKET ,ARG_PTR_TO_STACK_OR_NULL =PTR_MAYBE_NULL |ARG_PTR_TO_STACK ,ARG_PTR_TO_BTF_ID_OR_NULL =PTR_MAYBE_NULL |ARG_PTR_TO_BTF_ID , -/* pointer to memory does not need to be initialized, helper function must fill -* all bytes or clear them in error case. +/* Pointer to memory does not need to be initialized, since helper function +* fills all bytes or clears them in error case. */ -ARG_PTR_TO_UNINIT_MEM =MEM_UNINIT |ARG_PTR_TO_MEM , +ARG_PTR_TO_UNINIT_MEM =MEM_UNINIT |MEM_WRITE |ARG_PTR_TO_MEM ,/* Pointer to valid memory of size known at compile time. */ ARG_PTR_TO_FIXED_SIZE_MEM = MEM_FIXED_SIZE | ARG_PTR_TO_MEM,
kernel/bpf/helpers.c +5 -5
@@ -111,7 +111,7 @@ const struct bpf_func_proto bpf_map_pop_elem_proto = { .gpl_only = false, .ret_type = RET_INTEGER, .arg1_type = ARG_CONST_MAP_PTR, - .arg2_type = ARG_PTR_TO_MAP_VALUE | MEM_UNINIT, + .arg2_type = ARG_PTR_TO_MAP_VALUE | MEM_UNINIT | MEM_WRITE, }; BPF_CALL_2(bpf_map_peek_elem, struct bpf_map *, map, void *, value)
@@ -124,7 +124,7 @@ const struct bpf_func_proto bpf_map_peek_elem_proto = { .gpl_only = false, .ret_type = RET_INTEGER, .arg1_type = ARG_CONST_MAP_PTR, - .arg2_type = ARG_PTR_TO_MAP_VALUE | MEM_UNINIT, + .arg2_type = ARG_PTR_TO_MAP_VALUE | MEM_UNINIT | MEM_WRITE, }; BPF_CALL_3(bpf_map_lookup_percpu_elem, struct bpf_map *, map, void *, key, u32, cpu)
@@ -539,7 +539,7 @@ const struct bpf_func_proto bpf_strtol_proto = { .arg1_type = ARG_PTR_TO_MEM | MEM_RDONLY, .arg2_type = ARG_CONST_SIZE, .arg3_type = ARG_ANYTHING, - .arg4_type = ARG_PTR_TO_FIXED_SIZE_MEM | MEM_UNINIT | MEM_ALIGNED, + .arg4_type = ARG_PTR_TO_FIXED_SIZE_MEM | MEM_UNINIT | MEM_WRITE | MEM_ALIGNED, .arg4_size = sizeof(s64), };
@@ -569,7 +569,7 @@ const struct bpf_func_proto bpf_strtoul_proto = { .arg1_type = ARG_PTR_TO_MEM | MEM_RDONLY, .arg2_type = ARG_CONST_SIZE, .arg3_type = ARG_ANYTHING, - .arg4_type = ARG_PTR_TO_FIXED_SIZE_MEM | MEM_UNINIT | MEM_ALIGNED, + .arg4_type = ARG_PTR_TO_FIXED_SIZE_MEM | MEM_UNINIT | MEM_WRITE | MEM_ALIGNED, .arg4_size = sizeof(u64), };
@@ -1745,7 +1745,7 @@ static const struct bpf_func_proto bpf_dynptr_from_mem_proto = { .arg1_type = ARG_PTR_TO_UNINIT_MEM, .arg2_type = ARG_CONST_SIZE_OR_ZERO, .arg3_type = ARG_ANYTHING, - .arg4_type = ARG_PTR_TO_DYNPTR | DYNPTR_TYPE_LOCAL | MEM_UNINIT, + .arg4_type = ARG_PTR_TO_DYNPTR | DYNPTR_TYPE_LOCAL | MEM_UNINIT | MEM_WRITE, }; BPF_CALL_5(bpf_dynptr_read, void *, dst, u32, len, const struct bpf_dynptr_kern *, src,
kernel/bpf/ringbuf.c +1 -1
@@ -632,7 +632,7 @@ const struct bpf_func_proto bpf_ringbuf_reserve_dynptr_proto = { .arg1_type = ARG_CONST_MAP_PTR, .arg2_type = ARG_ANYTHING, .arg3_type = ARG_ANYTHING, - .arg4_type = ARG_PTR_TO_DYNPTR | DYNPTR_TYPE_RINGBUF | MEM_UNINIT, + .arg4_type = ARG_PTR_TO_DYNPTR | DYNPTR_TYPE_RINGBUF | MEM_UNINIT | MEM_WRITE, }; BPF_CALL_2(bpf_ringbuf_submit_dynptr, struct bpf_dynptr_kern *, ptr, u64, flags)
kernel/bpf/syscall.c +1 -1
@@ -5973,7 +5973,7 @@ static const struct bpf_func_proto bpf_kallsyms_lookup_name_proto = { .arg1_type = ARG_PTR_TO_MEM, .arg2_type = ARG_CONST_SIZE_OR_ZERO, .arg3_type = ARG_ANYTHING, - .arg4_type = ARG_PTR_TO_FIXED_SIZE_MEM | MEM_UNINIT | MEM_ALIGNED, + .arg4_type = ARG_PTR_TO_FIXED_SIZE_MEM | MEM_UNINIT | MEM_WRITE | MEM_ALIGNED, .arg4_size = sizeof(u64), };
kernel/trace/bpf_trace.c +2 -2
@@ -1226,7 +1226,7 @@ static const struct bpf_func_proto bpf_get_func_arg_proto = { .ret_type = RET_INTEGER, .arg1_type = ARG_PTR_TO_CTX, .arg2_type = ARG_ANYTHING, - .arg3_type = ARG_PTR_TO_FIXED_SIZE_MEM | MEM_UNINIT | MEM_ALIGNED, + .arg3_type = ARG_PTR_TO_FIXED_SIZE_MEM | MEM_UNINIT | MEM_WRITE | MEM_ALIGNED, .arg3_size = sizeof(u64), };
@@ -1243,7 +1243,7 @@ static const struct bpf_func_proto bpf_get_func_ret_proto = { .func = get_func_ret, .ret_type = RET_INTEGER, .arg1_type = ARG_PTR_TO_CTX, - .arg2_type = ARG_PTR_TO_FIXED_SIZE_MEM | MEM_UNINIT | MEM_ALIGNED, + .arg2_type = ARG_PTR_TO_FIXED_SIZE_MEM | MEM_UNINIT | MEM_WRITE | MEM_ALIGNED, .arg2_size = sizeof(u64), };
net/core/filter.c +2 -2
@@ -6350,7 +6350,7 @@ static const struct bpf_func_proto bpf_skb_check_mtu_proto = { .ret_type = RET_INTEGER, .arg1_type = ARG_PTR_TO_CTX, .arg2_type = ARG_ANYTHING, - .arg3_type = ARG_PTR_TO_FIXED_SIZE_MEM | MEM_UNINIT | MEM_ALIGNED, + .arg3_type = ARG_PTR_TO_FIXED_SIZE_MEM | MEM_UNINIT | MEM_WRITE | MEM_ALIGNED, .arg3_size = sizeof(u32), .arg4_type = ARG_ANYTHING, .arg5_type = ARG_ANYTHING,
@@ -6362,7 +6362,7 @@ static const struct bpf_func_proto bpf_xdp_check_mtu_proto = { .ret_type = RET_INTEGER, .arg1_type = ARG_PTR_TO_CTX, .arg2_type = ARG_ANYTHING, - .arg3_type = ARG_PTR_TO_FIXED_SIZE_MEM | MEM_UNINIT | MEM_ALIGNED, + .arg3_type = ARG_PTR_TO_FIXED_SIZE_MEM | MEM_UNINIT | MEM_WRITE | MEM_ALIGNED, .arg3_size = sizeof(u32), .arg4_type = ARG_ANYTHING, .arg5_type = ARG_ANYTHING,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 164/261 bpf: Fix overloading of MEM_UNINITs meaning
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Borkmann <[email protected]>
[ Upstream commit 8ea607330a39184f51737c6ae706db7fdca7628e ]
Lonial reported an issue in the BPF verifier where check_mem_size_reg() has the following code:
if (!tnum_is_const(reg->var_off))
/* For unprivileged variable accesses, disable raw
* mode so that the program is required to
* initialize all the memory that the helper could
* just partially fill up.
*/
meta = NULL;This means that writes are not checked when the register containing the size of the passed buffer has not a fixed size. Through this bug, a BPF program can write to a map which is marked as read-only, for example, .rodata global maps.
The problem is that MEM_UNINIT's initial meaning that "the passed buffer to the BPF helper does not need to be initialized" which was added back in commit 435faee1aae9 ("bpf, verifier: add ARG_PTR_TO_RAW_STACK type") got overloaded over time with "the passed buffer is being written to".
The problem however is that checks such as the above which were added later via 06c1c049721a ("bpf: allow helpers access to variable memory") set meta to NULL in order force the user to always initialize the passed buffer to the helper. Due to the current double meaning of MEM_UNINIT, this bypasses verifier write checks to the memory (not boundary checks though) and only assumes the latter memory is read instead.
Fix this by reverting MEM_UNINIT back to its original meaning, and having MEM_WRITE as an annotation to BPF helpers in order to then trigger the BPF verifier checks for writing to memory.
Some notes: check_arg_pair_ok() ensures that for ARG_CONST_SIZE{,_OR_ZERO} we can access fn->arg_type[arg - 1] since it must contain a preceding ARG_PTR_TO_MEM. For check_mem_reg() the meta argument can be removed altogether since we do check both BPF_READ and BPF_WRITE. Same for the equivalent check_kfunc_mem_size_reg().
--- kernel/bpf/verifier.c | 73 +++++++++++++++++++++---------------------- 1 file changed, 35 insertions(+), 38 deletions(-)
kernel/bpf/verifier.c +35 -38
@@ -7344,7 +7344,8 @@ static int check_stack_range_initialized( }static int check_helper_mem_access (struct bpf_verifier_env *env,int regno, -int access_size,bool zero_size_allowed, +int access_size,enum bpf_access_type access_type, +bool zero_size_allowed,struct bpf_call_arg_meta *meta) {struct bpf_reg_state *regs =cur_regs (env), *reg = ®s[regno];
@@ -7356,7 +7357,7 @@ static int check_helper_mem_access(struct bpf_verifier_env *env, int regno,return check_packet_access (env, regno, reg->off, access_size, zero_size_allowed);case PTR_TO_MAP_KEY : -if (meta && meta->raw_mode) { +if (access_type ==BPF_WRITE ) {verbose (env,"R%d cannot write into %s\n" , regno,reg_type_str (env, reg->type));return -EACCES ;
@@ -7364,15 +7365,13 @@ static int check_helper_mem_access(struct bpf_verifier_env *env, int regno,return check_mem_region_access (env, regno, reg->off, access_size, reg->map_ptr->key_size, false);case PTR_TO_MAP_VALUE : -if (check_map_access_type (env, regno, reg->off, access_size, - meta && meta->raw_mode ?BPF_WRITE : -BPF_READ )) +if (check_map_access_type (env, regno, reg->off, access_size, access_type))return -EACCES ;return check_map_access (env, regno, reg->off, access_size, zero_size_allowed,ACCESS_HELPER );case PTR_TO_MEM :if (type_is_rdonly_mem (reg->type)) { -if (meta && meta->raw_mode) { +if (access_type ==BPF_WRITE ) {verbose (env,"R%d cannot write into %s\n" , regno,reg_type_str (env, reg->type));return -EACCES ;
@@ -7383,7 +7382,7 @@ static int check_helper_mem_access(struct bpf_verifier_env *env, int regno, zero_size_allowed);case PTR_TO_BUF :if (type_is_rdonly_mem (reg->type)) { -if (meta && meta->raw_mode) { +if (access_type ==BPF_WRITE ) {verbose (env,"R%d cannot write into %s\n" , regno,reg_type_str (env, reg->type));return -EACCES ;
@@ -7411,7 +7410,6 @@ static int check_helper_mem_access(struct bpf_verifier_env *env, int regno,* Dynamically check it now. */ if (!env->ops->convert_ctx_access) { -enum bpf_access_type atype = meta && meta->raw_mode ?BPF_WRITE :BPF_READ ;int offset = access_size -1 ;/* Allow zero-byte read from PTR_TO_CTX */
@@ -7419,7 +7417,7 @@ static int check_helper_mem_access(struct bpf_verifier_env *env, int regno,return zero_size_allowed ?0 : -EACCES ;return check_mem_access (env, env->insn_idx, regno, offset,BPF_B , - atype,-1 , false, false); + access_type,-1 , false, false); } fallthrough;
@@ -7444,6 +7442,7 @@ static int check_helper_mem_access(struct bpf_verifier_env *env, int regno,*/ static int check_mem_size_reg (struct bpf_verifier_env *env,struct bpf_reg_state *reg,u32 regno, +enum bpf_access_type access_type,bool zero_size_allowed,struct bpf_call_arg_meta *meta) {
@@ -7459,15 +7458,12 @@ static int check_mem_size_reg(struct bpf_verifier_env *env,*/ meta->msize_max_value = reg->umax_value; -/* The register is SCALAR_VALUE; the access check -* happens using its boundaries. +/* The register is SCALAR_VALUE; the access check happens using +* its boundaries. For unprivileged variable accesses, disable +* raw mode so that the program is required to initialize all +* the memory that the helper could just partially fill up. */ if (!tnum_is_const (reg->var_off)) -/* For unprivileged variable accesses, disable raw -* mode so that the program is required to -* initialize all the memory that the helper could -* just partially fill up. -*/ meta =NULL ;if (reg->smin_value <0 ) {
@@ -7487,9 +7483,8 @@ static int check_mem_size_reg(struct bpf_verifier_env *env, regno);return -EACCES ; } - err =check_helper_mem_access (env, regno -1 , - reg->umax_value, - zero_size_allowed, meta); + err =check_helper_mem_access (env, regno -1 , reg->umax_value, + access_type, zero_size_allowed, meta);if (!err) err =mark_chain_precision (env, regno);return err;
@@ -7500,13 +7495,11 @@ static int check_mem_reg(struct bpf_verifier_env *env, struct bpf_reg_state *reg {bool may_be_null =type_may_be_null (reg->type);struct bpf_reg_state saved_reg; -struct bpf_call_arg_meta meta;int err;if (register_is_null (reg))return 0 ; -memset (&meta,0 ,sizeof (meta));/* Assuming that the register contains a value check if the memory * access is safe. Temporarily save and restore the register's state as * the conversion shouldn't be visible to a caller.
@@ -7516,10 +7509,8 @@ static int check_mem_reg(struct bpf_verifier_env *env, struct bpf_reg_state *regmark_ptr_not_null_reg (reg); } - err =check_helper_mem_access (env, regno, mem_size, true, &meta); -/* Check access for BPF_WRITE */ - meta.raw_mode = true; - err = err ?:check_helper_mem_access (env, regno, mem_size, true, &meta); + err =check_helper_mem_access (env, regno, mem_size,BPF_READ , true,NULL ); + err = err ?:check_helper_mem_access (env, regno, mem_size,BPF_WRITE , true,NULL );if (may_be_null) *reg = saved_reg;
@@ -7545,13 +7536,12 @@ static int check_kfunc_mem_size_reg(struct bpf_verifier_env *env, struct bpf_regmark_ptr_not_null_reg (mem_reg); } - err =check_mem_size_reg (env, reg, regno, true, &meta); -/* Check access for BPF_WRITE */ - meta.raw_mode = true; - err = err ?:check_mem_size_reg (env, reg, regno, true, &meta); + err =check_mem_size_reg (env, reg, regno,BPF_READ , true, &meta); + err = err ?:check_mem_size_reg (env, reg, regno,BPF_WRITE , true, &meta);if (may_be_null) *mem_reg = saved_reg; +return err; }
@@ -8825,9 +8815,8 @@ static int check_func_arg(struct bpf_verifier_env *env, u32 arg,verbose (env,"invalid map_ptr to access map->key\n" );return -EACCES ; } - err =check_helper_mem_access (env, regno, - meta->map_ptr->key_size, false, -NULL ); + err =check_helper_mem_access (env, regno, meta->map_ptr->key_size, +BPF_READ , false,NULL );break ;case ARG_PTR_TO_MAP_VALUE :if (type_may_be_null (arg_type) &®ister_is_null (reg))
@@ -8842,9 +8831,9 @@ static int check_func_arg(struct bpf_verifier_env *env, u32 arg,return -EACCES ; } meta->raw_mode = arg_type &MEM_UNINIT ; - err =check_helper_mem_access (env, regno, - meta->map_ptr->value_size, false, - meta); + err =check_helper_mem_access (env, regno, meta->map_ptr->value_size, + arg_type &MEM_WRITE ?BPF_WRITE :BPF_READ , + false, meta);break ;case ARG_PTR_TO_PERCPU_BTF_ID :if (!reg->btf_id) {
@@ -8886,7 +8875,9 @@ static int check_func_arg(struct bpf_verifier_env *env, u32 arg,*/ meta->raw_mode = arg_type &MEM_UNINIT ;if (arg_type &MEM_FIXED_SIZE ) { - err =check_helper_mem_access (env, regno, fn->arg_size[arg], false, meta); + err =check_helper_mem_access (env, regno, fn->arg_size[arg], + arg_type &MEM_WRITE ?BPF_WRITE :BPF_READ , + false, meta);if (err)return err;if (arg_type &MEM_ALIGNED )
@@ -8894,10 +8885,16 @@ static int check_func_arg(struct bpf_verifier_env *env, u32 arg, }break ;case ARG_CONST_SIZE : - err =check_mem_size_reg (env, reg, regno, false, meta); + err =check_mem_size_reg (env, reg, regno, + fn->arg_type[arg -1 ] &MEM_WRITE ? +BPF_WRITE :BPF_READ , + false, meta);break ;case ARG_CONST_SIZE_OR_ZERO : - err =check_mem_size_reg (env, reg, regno, true, meta); + err =check_mem_size_reg (env, reg, regno, + fn->arg_type[arg -1 ] &MEM_WRITE ? +BPF_WRITE :BPF_READ , + true, meta);break ;case ARG_PTR_TO_DYNPTR : err =process_dynptr_func (env, regno, insn_idx, arg_type,0 );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 165/261 bpf: Remove MEM_UNINIT from skb/xdp MTU helpers
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Borkmann <[email protected]>
[ Upstream commit 14a3d3ef02ba53447d5112a2641aac0d10dc994f ]
We can now undo parts of 4b3786a6c539 ("bpf: Zero former ARG_PTR_TO_{LONG,INT} args in case of error") as discussed in [0].
Given the BPF helpers now have MEM_WRITE tag, the MEM_UNINIT can be cleared.
The mtu_len is an input as well as output argument, meaning, the BPF program has to set it to something. It cannot be uninitialized. Therefore, allowing uninitialized memory and zeroing it on error would be odd. It was done as an interim step in 4b3786a6c539 as the desired behavior could not have been expressed before the introduction of MEM_WRITE tag.
--- net/core/filter.c | 42 +++++++++++++++--------------------------- 1 file changed, 15 insertions(+), 27 deletions(-)
net/core/filter.c +15 -27
@@ -6263,24 +6263,16 @@ BPF_CALL_5(bpf_skb_check_mtu, struct sk_buff *, skb, {int ret =BPF_MTU_CHK_RET_FRAG_NEEDED ;struct net_device *dev = skb->dev; -int skb_len, dev_len; -int mtu =0 ; +int mtu, dev_len, skb_len; -if (unlikely (flags & ~(BPF_MTU_CHK_SEGS ))) { - ret = -EINVAL ; - goto out; - } - -if (unlikely (flags &BPF_MTU_CHK_SEGS && (len_diff || *mtu_len))) { - ret = -EINVAL ; - goto out; - } +if (unlikely (flags & ~(BPF_MTU_CHK_SEGS ))) +return -EINVAL ; +if (unlikely (flags &BPF_MTU_CHK_SEGS && (len_diff || *mtu_len))) +return -EINVAL ; dev =__dev_via_ifindex (dev, ifindex); -if (unlikely (!dev)) { - ret = -ENODEV ; - goto out; - } +if (unlikely (!dev)) +return -ENODEV ; mtu =READ_ONCE (dev->mtu); dev_len = mtu + dev->hard_header_len;
@@ -6315,19 +6307,15 @@ BPF_CALL_5(bpf_xdp_check_mtu, struct xdp_buff *, xdp,struct net_device *dev = xdp->rxq->dev;int xdp_len = xdp->data_end - xdp->data;int ret =BPF_MTU_CHK_RET_SUCCESS ; -int mtu =0 , dev_len; +int mtu, dev_len;/* XDP variant doesn't support multi-buffer segment check (yet) */ -if (unlikely (flags)) { - ret = -EINVAL ; - goto out; - } +if (unlikely (flags)) +return -EINVAL ; dev =__dev_via_ifindex (dev, ifindex); -if (unlikely (!dev)) { - ret = -ENODEV ; - goto out; - } +if (unlikely (!dev)) +return -ENODEV ; mtu =READ_ONCE (dev->mtu); dev_len = mtu + dev->hard_header_len;
@@ -6339,7 +6327,7 @@ BPF_CALL_5(bpf_xdp_check_mtu, struct xdp_buff *, xdp, xdp_len += len_diff;/* minus result pass check */ if (xdp_len > dev_len) ret =BPF_MTU_CHK_RET_FRAG_NEEDED ; -out: + *mtu_len = mtu;return ret; }
@@ -6350,7 +6338,7 @@ static const struct bpf_func_proto bpf_skb_check_mtu_proto = { .ret_type = RET_INTEGER, .arg1_type = ARG_PTR_TO_CTX, .arg2_type = ARG_ANYTHING, - .arg3_type = ARG_PTR_TO_FIXED_SIZE_MEM | MEM_UNINIT | MEM_WRITE | MEM_ALIGNED, + .arg3_type = ARG_PTR_TO_FIXED_SIZE_MEM | MEM_WRITE | MEM_ALIGNED, .arg3_size = sizeof(u32), .arg4_type = ARG_ANYTHING, .arg5_type = ARG_ANYTHING,
@@ -6362,7 +6350,7 @@ static const struct bpf_func_proto bpf_xdp_check_mtu_proto = { .ret_type = RET_INTEGER, .arg1_type = ARG_PTR_TO_CTX, .arg2_type = ARG_ANYTHING, - .arg3_type = ARG_PTR_TO_FIXED_SIZE_MEM | MEM_UNINIT | MEM_WRITE | MEM_ALIGNED, + .arg3_type = ARG_PTR_TO_FIXED_SIZE_MEM | MEM_WRITE | MEM_ALIGNED, .arg3_size = sizeof(u32), .arg4_type = ARG_ANYTHING, .arg5_type = ARG_ANYTHING,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 166/261 net/sched: act_api: deny mismatched skip_sw/skip_hw flags for actions created by classifiers
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vladimir Oltean <[email protected]>
[ Upstream commit 34d35b4edbbe890a91bec939bfd29ad92517a52b ]
tcf_action_init() has logic for checking mismatches between action and filter offload flags (skip_sw/skip_hw). AFAIU, this is intended to run on the transition between the new tc_act_bind(flags) returning true (aka now gets bound to classifier) and tc_act_bind(act->tcfa_flags) returning false (aka action was not bound to classifier before). Otherwise, the check is skipped.
For the case where an action is not standalone, but rather it was created by a classifier and is bound to it, tcf_action_init() skips the check entirely, and this means it allows mismatched flags to occur.
Taking the matchall classifier code path as an example (with mirred as an action), the reason is the following:
1 | mall_change() 2 | -> mall_replace_hw_filter() 3 | -> tcf_exts_validate_ex() 4 | -> flags |= TCA_ACT_FLAGS_BIND; 5 | -> tcf_action_init() 6 | -> tcf_action_init_1() 7 | -> a_o->init() 8 | -> tcf_mirred_init() 9 | -> tcf_idr_create_from_flags() 10 | -> tcf_idr_create() 11 | -> p->tcfa_flags = flags; 12 | -> tc_act_bind(flags)) 13 | -> tc_act_bind(act->tcfa_flags)
When invoked from tcf_exts_validate_ex() like matchall does (but other classifiers validate their extensions as well), tcf_action_init() runs in a call path where "flags" always contains TCA_ACT_FLAGS_BIND (set by line 4). So line 12 is always true, and line 13 is always true as well. No transition ever takes place, and the check is skipped.
The code was added in this form in commit c86e0209dc77 ("flow_offload:
validate flags of filter and actions"), but I'm attributing the blame even earlier in that series, to when TCA_ACT_FLAGS_SKIP_HW and TCA_ACT_FLAGS_SKIP_SW were added to the UAPI.
Following the development process of this change, the check did not always exist in this form. A change took place between v3 [1] and v4 [2], AFAIU due to review feedback that it doesn't make sense for action flags to be different than classifier flags. I think I agree with that feedback, but it was translated into code that omits enforcing this for "classic" actions created at the same time with the filters themselves.
There are 3 more important cases to discuss. First there is this command:
$ tc qdisc add dev eth0 clasct $ tc filter add dev eth0 ingress matchall skip_sw \ action mirred ingress mirror dev eth1
which should be allowed, because prior to the concept of dedicated action flags, it used to work and it used to mean the action inherited the skip_sw/skip_hw flags from the classifier. It's not a mismatch.
Then we have this command:
$ tc qdisc add dev eth0 clasct $ tc filter add dev eth0 ingress matchall skip_sw \ action mirred ingress mirror dev eth1 skip_hw
where there is a mismatch and it should be rejected.
Finally, we have:
$ tc qdisc add dev eth0 clasct $ tc filter add dev eth0 ingress matchall skip_sw \ action mirred ingress mirror dev eth1 skip_sw
where the offload flags coincide, and this should be treated the same as the first command based on inheritance, and accepted.
[1]: https://lore.kernel.org/netdev/[email protected]/
[2]: https://lore.kernel.org/netdev/[email protected]/
--- net/sched/act_api.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-)
net/sched/act_api.c +22 -1
@@ -1498,8 +1498,29 @@ int tcf_action_init(struct net *net, struct tcf_proto *tp, struct nlattr *nla,bool skip_sw =tc_skip_sw (fl_flags);bool skip_hw =tc_skip_hw (fl_flags); -if (tc_act_bind (act->tcfa_flags)) +if (tc_act_bind (act->tcfa_flags)) { +/* Action is created by classifier and is not +* standalone. Check that the user did not set +* any action flags different than the +* classifier flags, and inherit the flags from +* the classifier for the compatibility case +* where no flags were specified at all. +*/ +if ((tc_act_skip_sw (act->tcfa_flags) && !skip_sw) || + (tc_act_skip_hw (act->tcfa_flags) && !skip_hw)) { +NL_SET_ERR_MSG (extack, +"Mismatch between action and filter offload flags" ); + err = -EINVAL ; + goto err; + } +if (skip_sw) + act->tcfa_flags |=TCA_ACT_FLAGS_SKIP_SW ; +if (skip_hw) + act->tcfa_flags |=TCA_ACT_FLAGS_SKIP_HW ;continue ; + } + +/* Action is standalone */ if (skip_sw !=tc_act_skip_sw (act->tcfa_flags) || skip_hw !=tc_act_skip_hw (act->tcfa_flags)) { NL_SET_ERR_MSG(extack,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 167/261 net: sched: fix use-after-free in taprio_change()
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Antipov <[email protected]>
[ Upstream commit f504465970aebb2467da548f7c1efbbf36d0f44b ]
In 'taprio_change()', 'admin' pointer may become dangling due to sched switch / removal caused by 'advance_sched()', and critical section protected by 'q->current_entry_lock' is too small to prevent from such a scenario (which causes use-after-free detected by KASAN). Fix this by prefer 'rcu_replace_pointer()' over 'rcu_assign_pointer()' to update 'admin' immediately before an attempt to schedule freeing.
--- net/sched/sch_taprio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/sched/sch_taprio.c +2 -1
@@ -1965,7 +1965,8 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt,taprio_start_sched (sch, start, new_admin); -rcu_assign_pointer (q->admin_sched, new_admin); + admin =rcu_replace_pointer (q->admin_sched, new_admin, +lockdep_rtnl_is_held ());if (admin)call_rcu (&admin->rcu, taprio_free_sched_cb);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 168/261 net: sched: use RCU read-side critical section in taprio_dump()
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Antipov <[email protected]>
[ Upstream commit b22db8b8befe90b61c98626ca1a2fbb0505e9fe3 ]
Fix possible use-after-free in 'taprio_dump()' by adding RCU read-side critical section there. Never seen on x86 but found on a KASAN-enabled arm64 system when investigating
https://syzkaller.appspot.com/bug?extid=b65e0af58423fc8a73aa:
[T15862] BUG: KASAN: slab-use-after-free in taprio_dump+0xa0c/0xbb0
[T15862] Read of size 4 at addr ffff0000d4bb88f8 by task repro/15862
[T15862]
[T15862] CPU: 0 UID: 0 PID: 15862 Comm: repro Not tainted 6.11.0-rc1-00293-gdefaf1a2113a-dirty #2 [T15862] Hardware name: QEMU QEMU Virtual Machine, BIOS edk2-20240524-5.fc40 05/24/2024 [T15862] Call trace:
[T15862] dump_backtrace+0x20c/0x220 [T15862] show_stack+0x2c/0x40 [T15862] dump_stack_lvl+0xf8/0x174 [T15862] print_report+0x170/0x4d8 [T15862] kasan_report+0xb8/0x1d4 [T15862] __asan_report_load4_noabort+0x20/0x2c [T15862] taprio_dump+0xa0c/0xbb0 [T15862] tc_fill_qdisc+0x540/0x1020 [T15862] qdisc_notify.isra.0+0x330/0x3a0 [T15862] tc_modify_qdisc+0x7b8/0x1838 [T15862] rtnetlink_rcv_msg+0x3c8/0xc20 [T15862] netlink_rcv_skb+0x1f8/0x3d4 [T15862] rtnetlink_rcv+0x28/0x40 [T15862] netlink_unicast+0x51c/0x790 [T15862] netlink_sendmsg+0x79c/0xc20 [T15862] __sock_sendmsg+0xe0/0x1a0 [T15862] ____sys_sendmsg+0x6c0/0x840 [T15862] ___sys_sendmsg+0x1ac/0x1f0 [T15862] __sys_sendmsg+0x110/0x1d0 [T15862] __arm64_sys_sendmsg+0x74/0xb0 [T15862] invoke_syscall+0x88/0x2e0 [T15862] el0_svc_common.constprop.0+0xe4/0x2a0 [T15862] do_el0_svc+0x44/0x60 [T15862] el0_svc+0x50/0x184 [T15862] el0t_64_sync_handler+0x120/0x12c [T15862] el0t_64_sync+0x190/0x194 [T15862] [T15862] Allocated by task 15857: [T15862] kasan_save_stack+0x3c/0x70 [T15862] kasan_save_track+0x20/0x3c [T15862] kasan_save_alloc_info+0x40/0x60 [T15862] __kasan_kmalloc+0xd4/0xe0 [T15862] __kmalloc_cache_noprof+0x194/0x334 [T15862] taprio_change+0x45c/0x2fe0 [T15862] tc_modify_qdisc+0x6a8/0x1838 [T15862] rtnetlink_rcv_msg+0x3c8/0xc20 [T15862] netlink_rcv_skb+0x1f8/0x3d4 [T15862] rtnetlink_rcv+0x28/0x40 [T15862] netlink_unicast+0x51c/0x790 [T15862] netlink_sendmsg+0x79c/0xc20 [T15862] __sock_sendmsg+0xe0/0x1a0 [T15862] ____sys_sendmsg+0x6c0/0x840 [T15862] ___sys_sendmsg+0x1ac/0x1f0 [T15862] __sys_sendmsg+0x110/0x1d0 [T15862] __arm64_sys_sendmsg+0x74/0xb0 [T15862] invoke_syscall+0x88/0x2e0 [T15862] el0_svc_common.constprop.0+0xe4/0x2a0 [T15862] do_el0_svc+0x44/0x60 [T15862] el0_svc+0x50/0x184 [T15862] el0t_64_sync_handler+0x120/0x12c [T15862] el0t_64_sync+0x190/0x194 [T15862] [T15862] Freed by task 6192: [T15862] kasan_save_stack+0x3c/0x70 [T15862] kasan_save_track+0x20/0x3c [T15862] kasan_save_free_info+0x4c/0x80 [T15862] poison_slab_object+0x110/0x160 [T15862] __kasan_slab_free+0x3c/0x74 [T15862] kfree+0x134/0x3c0 [T15862] taprio_free_sched_cb+0x18c/0x220 [T15862] rcu_core+0x920/0x1b7c [T15862] rcu_core_si+0x10/0x1c [T15862] handle_softirqs+0x2e8/0xd64 [T15862] __do_softirq+0x14/0x20
--- net/sched/sch_taprio.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)
net/sched/sch_taprio.c +12 -6
@@ -2374,9 +2374,6 @@ static int taprio_dump(struct Qdisc *sch, struct sk_buff *skb)struct tc_mqprio_qopt opt = {0 };struct nlattr *nest, *sched_nest; - oper =rtnl_dereference (q->oper_sched); - admin =rtnl_dereference (q->admin_sched); -mqprio_qopt_reconstruct (dev, &opt); nest =nla_nest_start_noflag (skb,TCA_OPTIONS );
@@ -2397,18 +2394,23 @@ static int taprio_dump(struct Qdisc *sch, struct sk_buff *skb) nla_put_u32(skb, TCA_TAPRIO_ATTR_TXTIME_DELAY, q->txtime_delay)) goto options_error; +rcu_read_lock (); + + oper =rtnl_dereference (q->oper_sched); + admin =rtnl_dereference (q->admin_sched); +if (oper &&taprio_dump_tc_entries (skb, q, oper)) - goto options_error; + goto options_error_rcu;if (oper &&dump_schedule (skb, oper)) - goto options_error; + goto options_error_rcu;if (!admin) goto done; sched_nest =nla_nest_start_noflag (skb,TCA_TAPRIO_ATTR_ADMIN_SCHED );if (!sched_nest) - goto options_error; + goto options_error_rcu;if (dump_schedule (skb, admin)) goto admin_error;
@@ -2416,11 +2418,15 @@ static int taprio_dump(struct Qdisc *sch, struct sk_buff *skb)nla_nest_end (skb, sched_nest); done: +rcu_read_unlock ();return nla_nest_end (skb, nest); admin_error:nla_nest_cancel (skb, sched_nest); +options_error_rcu: +rcu_read_unlock (); + options_error:nla_nest_cancel (skb, nest);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 169/261 r8169: avoid unsolicited interrupts
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiner Kallweit <[email protected]>
[ Upstream commit 10ce0db787004875f4dba068ea952207d1d8abeb ]
It was reported that after resume from suspend a PCI error is logged and connectivity is broken. Error message is:
PCI error (cmd = 0x0407, status_errs = 0x0000)
The message seems to be a red herring as none of the error bits is set, and the PCI command register value also is normal. Exception handling for a PCI error includes a chip reset what apparently brakes connectivity here. The interrupt status bit triggering the PCI error handling isn't actually used on PCIe chip versions, so it's not clear why this bit is set by the chip. Fix this by ignoring this bit on PCIe chip versions.
--- drivers/net/ethernet/realtek/r8169_main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/realtek/r8169_main.c +3 -1
@@ -4669,7 +4669,9 @@ static irqreturn_t rtl8169_interrupt(int irq, void *dev_instance)if ((status &0xffff ) ==0xffff || !(status & tp->irq_mask))return IRQ_NONE ; -if (unlikely (status & SYSErr)) { +/* At least RTL8168fp may unexpectedly set the SYSErr bit */ +if (unlikely (status & SYSErr && + tp->mac_version <=RTL_GIGA_MAC_VER_06 )) {rtl8169_pcierr_interrupt (tp->dev); goto out; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 170/261 posix-clock: posix-clock: Fix unbalanced locking in pc_clock_settime()
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jinjie Ruan <[email protected]>
[ Upstream commit 6e62807c7fbb3c758d233018caf94dfea9c65dbd ]
If get_clock_desc() succeeds, it calls fget() for the clockid's fd, and get the clk->rwsem read lock, so the error path should release the lock to make the lock balance and fput the clockid's fd to make the refcount balance and release the fd related resource.
However the below commit left the error path locked behind resulting in unbalanced locking. Check timespec64_valid_strict() before get_clock_desc() to fix it, because the "ts" is not changed after that.
--- kernel/time/posix-clock.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
kernel/time/posix-clock.c +3 -3
@@ -310,6 +310,9 @@ static int pc_clock_settime(clockid_t id, const struct timespec64 *ts)struct posix_clock_desc cd;int err; +if (!timespec64_valid_strict (ts)) +return -EINVAL ; + err =get_clock_desc (id, &cd);if (err)return err;
@@ -319,9 +322,6 @@ static int pc_clock_settime(clockid_t id, const struct timespec64 *ts) goto out; } -if (!timespec64_valid_strict (ts)) -return -EINVAL ; -if (cd.clk->ops.clock_settime) err = cd.clk->ops.clock_settime (cd.clk, ts);else
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 171/261 Bluetooth: hci_core: Disable works on hci_unregister_dev
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luiz Augusto von Dentz <[email protected]>
[ Upstream commit 989fa5171f005ecf63440057218d8aeb1795287d ]
This make use of disable_work_* on hci_unregister_dev since the hci_dev is about to be freed new submissions are not disarable.
--- net/bluetooth/hci_core.c | 24 +++++++++++++++--------- net/bluetooth/hci_sync.c | 12 +++++++++--- 2 files changed, 24 insertions(+), 12 deletions(-)
net/bluetooth/hci_core.c +15 -9
@@ -1644,12 +1644,12 @@ void hci_adv_instances_clear(struct hci_dev *hdev)struct adv_info *adv_instance, *n;if (hdev->adv_instance_timeout) { -cancel_delayed_work (&hdev->adv_instance_expire); +disable_delayed_work (&hdev->adv_instance_expire); hdev->adv_instance_timeout =0 ; }list_for_each_entry_safe (adv_instance, n, &hdev->adv_instances, list) { -cancel_delayed_work_sync (&adv_instance->rpa_expired_cb); +disable_delayed_work_sync (&adv_instance->rpa_expired_cb);list_del (&adv_instance->list);kfree (adv_instance); }
@@ -2685,11 +2685,11 @@ void hci_unregister_dev(struct hci_dev *hdev)list_del (&hdev->list);write_unlock (&hci_dev_list_lock); -cancel_work_sync (&hdev->rx_work); -cancel_work_sync (&hdev->cmd_work); -cancel_work_sync (&hdev->tx_work); -cancel_work_sync (&hdev->power_on); -cancel_work_sync (&hdev->error_reset); +disable_work_sync (&hdev->rx_work); +disable_work_sync (&hdev->cmd_work); +disable_work_sync (&hdev->tx_work); +disable_work_sync (&hdev->power_on); +disable_work_sync (&hdev->error_reset);hci_cmd_sync_clear (hdev);
@@ -2796,8 +2796,14 @@ static void hci_cancel_cmd_sync(struct hci_dev *hdev, int err) {bt_dev_dbg (hdev,"err 0x%2.2x" , err); -cancel_delayed_work_sync (&hdev->cmd_timer); -cancel_delayed_work_sync (&hdev->ncmd_timer); +if (hci_dev_test_flag (hdev,HCI_UNREGISTER )) { +disable_delayed_work_sync (&hdev->cmd_timer); +disable_delayed_work_sync (&hdev->ncmd_timer); + }else { +cancel_delayed_work_sync (&hdev->cmd_timer); +cancel_delayed_work_sync (&hdev->ncmd_timer); + } +atomic_set (&hdev->cmd_cnt,1 );hci_cmd_sync_cancel_sync (hdev, err);
net/bluetooth/hci_sync.c +9 -3
@@ -5131,9 +5131,15 @@ int hci_dev_close_sync(struct hci_dev *hdev)bt_dev_dbg (hdev,"" ); -cancel_delayed_work (&hdev->power_off); -cancel_delayed_work (&hdev->ncmd_timer); -cancel_delayed_work (&hdev->le_scan_disable); +if (hci_dev_test_flag (hdev,HCI_UNREGISTER )) { +disable_delayed_work (&hdev->power_off); +disable_delayed_work (&hdev->ncmd_timer); +disable_delayed_work (&hdev->le_scan_disable); + }else { +cancel_delayed_work (&hdev->power_off); +cancel_delayed_work (&hdev->ncmd_timer); +cancel_delayed_work (&hdev->le_scan_disable); + }hci_cmd_sync_cancel_sync (hdev,ENODEV );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 172/261 Bluetooth: SCO: Fix UAF on sco_sock_timeout
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luiz Augusto von Dentz <[email protected]>
[ Upstream commit 1bf4470a3939c678fb822073e9ea77a0560bc6bb ]
conn->sk maybe have been unlinked/freed while waiting for sco_conn_lock so this checks if the conn->sk is still valid by checking if it part of sco_sk_list.
--- include/net/bluetooth/bluetooth.h | 1 + net/bluetooth/af_bluetooth.c | 22 ++++++++++++++++++++++ net/bluetooth/sco.c | 18 ++++++++++++------ 3 files changed, 35 insertions(+), 6 deletions(-)
include/net/bluetooth/bluetooth.h +1 -0
@@ -403,6 +403,7 @@ int bt_sock_register(int proto, const struct net_proto_family *ops);void bt_sock_unregister (int proto);void bt_sock_link (struct bt_sock_list *l,struct sock *s);void bt_sock_unlink (struct bt_sock_list *l,struct sock *s); +bool bt_sock_linked (struct bt_sock_list *l,struct sock *s);struct sock *bt_sock_alloc (struct net *net,struct socket *sock,struct proto *prot,int proto,gfp_t prio,int kern); int bt_sock_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
net/bluetooth/af_bluetooth.c +22 -0
@@ -185,6 +185,28 @@ void bt_sock_unlink(struct bt_sock_list *l, struct sock *sk) }EXPORT_SYMBOL (bt_sock_unlink); +bool bt_sock_linked (struct bt_sock_list *l,struct sock *s) +{ +struct sock *sk; + +if (!l || !s) +return false; + +read_lock (&l->lock); + +sk_for_each (sk, &l->head) { +if (s == sk) { +read_unlock (&l->lock); +return true; + } + } + +read_unlock (&l->lock); + +return false; +} +EXPORT_SYMBOL (bt_sock_linked); +void bt_accept_enqueue (struct sock *parent,struct sock *sk,bool bh) {const struct cred *old_cred;
net/bluetooth/sco.c +12 -6
@@ -76,6 +76,16 @@ struct sco_pinfo {#define SCO_CONN_TIMEOUT (HZ * 40)#define SCO_DISCONN_TIMEOUT (HZ * 2) +static struct sock *sco_sock_hold (struct sco_conn *conn) +{ +if (!conn || !bt_sock_linked (&sco_sk_list, conn->sk)) +return NULL ; + +sock_hold (conn->sk); + +return conn->sk; +} +static void sco_sock_timeout (struct work_struct *work) { struct sco_conn *conn = container_of(work, struct sco_conn,
@@ -87,9 +97,7 @@ static void sco_sock_timeout(struct work_struct *work)sco_conn_unlock (conn);return ; } - sk = conn->sk; -if (sk) -sock_hold (sk); + sk =sco_sock_hold (conn);sco_conn_unlock (conn);if (!sk)
@@ -194,9 +202,7 @@ static void sco_conn_del(struct hci_conn *hcon, int err)/* Kill socket */ sco_conn_lock (conn); - sk = conn->sk; -if (sk) -sock_hold (sk); + sk =sco_sock_hold (conn);sco_conn_unlock (conn);if (sk) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 173/261 Bluetooth: ISO: Fix UAF on iso_sock_timeout
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luiz Augusto von Dentz <[email protected]>
[ Upstream commit 246b435ad668596aa0e2bbb9d491b6413861211a ]
conn->sk maybe have been unlinked/freed while waiting for iso_conn_lock so this checks if the conn->sk is still valid by checking if it part of iso_sk_list.
--- net/bluetooth/iso.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)
net/bluetooth/iso.c +12 -6
@@ -93,6 +93,16 @@ static struct sock *iso_get_sock(bdaddr_t *src, bdaddr_t *dst,#define ISO_CONN_TIMEOUT (HZ * 40)#define ISO_DISCONN_TIMEOUT (HZ * 2) +static struct sock *iso_sock_hold (struct iso_conn *conn) +{ +if (!conn || !bt_sock_linked (&iso_sk_list, conn->sk)) +return NULL ; + +sock_hold (conn->sk); + +return conn->sk; +} +static void iso_sock_timeout (struct work_struct *work) { struct iso_conn *conn = container_of(work, struct iso_conn,
@@ -100,9 +110,7 @@ static void iso_sock_timeout(struct work_struct *work)struct sock *sk;iso_conn_lock (conn); - sk = conn->sk; -if (sk) -sock_hold (sk); + sk =iso_sock_hold (conn);iso_conn_unlock (conn);if (!sk)
@@ -209,9 +217,7 @@ static void iso_conn_del(struct hci_conn *hcon, int err)/* Kill socket */ iso_conn_lock (conn); - sk = conn->sk; -if (sk) -sock_hold (sk); + sk =iso_sock_hold (conn);iso_conn_unlock (conn);if (sk) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 174/261 bpf,perf: Fix perf_event_detach_bpf_prog error handling
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiri Olsa <[email protected]>
[ Upstream commit 0ee288e69d033850bc87abe0f9cc3ada24763d7f ]
Peter reported that perf_event_detach_bpf_prog might skip to release the bpf program for -ENOENT error from bpf_prog_array_copy.
This can't happen because bpf program is stored in perf event and is detached and released only when perf event is freed.
Let's drop the -ENOENT check and make sure the bpf program is released in any case.
--- kernel/trace/bpf_trace.c | 2 -- 1 file changed, 2 deletions(-)
kernel/trace/bpf_trace.c +0 -2
@@ -2306,8 +2306,6 @@ void perf_event_detach_bpf_prog(struct perf_event *event) old_array =bpf_event_rcu_dereference (event->tp_event->prog_array); ret =bpf_prog_array_copy (old_array, event->prog,NULL ,0 , &new_array); -if (ret == -ENOENT ) - goto unlock;if (ret <0 ) {bpf_prog_array_delete_safe (old_array, event->prog); }else {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 175/261 bpf: fix do_misc_fixups() for bpf_get_branch_snapshot()
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrii Nakryiko <[email protected]>
[ Upstream commit 9806f283140ef3e4d259b7646bd8c66026bbaac5 ]
We need goto next_insn; at the end of patching instead of continue;. It currently works by accident by making verifier re-process patched instructions.
--- kernel/bpf/verifier.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/bpf/verifier.c +1 -1
@@ -20675,7 +20675,7 @@ static int do_misc_fixups(struct bpf_verifier_env *env) delta += cnt -1 ; env->prog = prog = new_prog; insn = new_prog->insnsi + i + delta; -continue ; + goto next_insn; }/* Implement bpf_kptr_xchg inline */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 176/261 net: dsa: microchip: disable EEE for KSZ879x/KSZ877x/KSZ876x
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tim Harvey <[email protected]>
[ Upstream commit ee76eb24343bdd5450eb87572865a4d7fffd335b ]
The well-known errata regarding EEE not being functional on various KSZ switches has been refactored a few times. Recently the refactoring has excluded several switches that the errata should also apply to.
Disable EEE for additional switches with this errata and provide additional comments referring to the public errata document.
The original workaround for the errata was applied with a register write to manually disable the EEE feature in MMD 7:60 which was being applied for KSZ9477/KSZ9897/KSZ9567 switch ID's.
Then came commit 26dd2974c5b5 ("net: phy: micrel: Move KSZ9477 errata fixes to PHY driver") and commit 6068e6d7ba50 ("net: dsa: microchip:
remove KSZ9477 PHY errata handling") which moved the errata from the switch driver to the PHY driver but only for PHY_ID_KSZ9477 (PHY ID) however that PHY code was dead code because an entry was never added for PHY_ID_KSZ9477 via MODULE_DEVICE_TABLE.
This was apparently realized much later and commit 54a4e5c16382 ("net:
phy: micrel: add Microchip KSZ 9477 to the device table") added the PHY_ID_KSZ9477 to the PHY driver but as the errata was only being applied to PHY_ID_KSZ9477 it's not completely clear what switches that relates to.
Later commit 6149db4997f5 ("net: phy: micrel: fix KSZ9477 PHY issues after suspend/resume") breaks this again for all but KSZ9897 by only applying the errata for that PHY ID.
Following that this was affected with commit 08c6d8bae48c("net: phy:
Provide Module 4 KSZ9477 errata (DS80000754C)") which removes the blatant register write to MMD 7:60 and replaces it by setting phydev->eee_broken_modes = -1 so that the generic phy-c45 code disables EEE but this is only done for the KSZ9477_CHIP_ID (Switch ID).
Lastly commit 0411f73c13af ("net: dsa: microchip: disable EEE for KSZ8567/KSZ9567/KSZ9896/KSZ9897.") adds some additional switches that were missing to the errata due to the previous changes.
This commit adds an additional set of switches.
--- drivers/net/dsa/microchip/ksz_common.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-)
drivers/net/dsa/microchip/ksz_common.c +11 -10
@@ -2579,26 +2579,27 @@ static u32 ksz_get_phy_flags(struct dsa_switch *ds, int port)return MICREL_KSZ8_P1_ERRATA ;break ;case KSZ8567_CHIP_ID : +/* KSZ8567R Errata DS80000752C Module 4 */ +case KSZ8765_CHIP_ID : +case KSZ8794_CHIP_ID : +case KSZ8795_CHIP_ID : +/* KSZ879x/KSZ877x/KSZ876x Errata DS80000687C Module 2 */ case KSZ9477_CHIP_ID : +/* KSZ9477S Errata DS80000754A Module 4 */ case KSZ9567_CHIP_ID : +/* KSZ9567S Errata DS80000756A Module 4 */ case KSZ9896_CHIP_ID : +/* KSZ9896C Errata DS80000757A Module 3 */ case KSZ9897_CHIP_ID : -/* KSZ9477 Errata DS80000754C -* -* Module 4: Energy Efficient Ethernet (EEE) feature select must -* be manually disabled +/* KSZ9897R Errata DS80000758C Module 4 */ +/* Energy Efficient Ethernet (EEE) feature select must be manually disabled * The EEE feature is enabled by default, but it is not fully * operational. It must be manually disabled through register * controls. If not disabled, the PHY ports can auto-negotiate * to enable EEE, and this feature can cause link drops when * linked to another device supporting EEE. * -* The same item appears in the errata for the KSZ9567, KSZ9896, -* and KSZ9897. -* -* A similar item appears in the errata for the KSZ8567, but -* provides an alternative workaround. For now, use the simple -* workaround of disabling the EEE feature for this device too. +* The same item appears in the errata for all switches above. */ return MICREL_NO_EEE ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 177/261 net: dsa: mv88e6xxx: group cycle counter coefficients
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shenghao Yang <[email protected]>
[ Upstream commit 67af86afff74c914944374a103c04e4d9868dd15 ]
Instead of having them as individual fields in ptp_ops, wrap the coefficients in a separate struct so they can be referenced together.
--- drivers/net/dsa/mv88e6xxx/chip.h | 6 ++-- drivers/net/dsa/mv88e6xxx/ptp.c | 59 ++++++++++++++++---------------- 2 files changed, 32 insertions(+), 33 deletions(-)
drivers/net/dsa/mv88e6xxx/chip.h +2 -4
@@ -206,6 +206,7 @@ struct mv88e6xxx_gpio_ops;struct mv88e6xxx_avb_ops ;struct mv88e6xxx_ptp_ops ;struct mv88e6xxx_pcs_ops ; +struct mv88e6xxx_cc_coeffs ;struct mv88e6xxx_irq {u16 masked;
@@ -731,10 +732,7 @@ struct mv88e6xxx_ptp_ops {int arr1_sts_reg;int dep_sts_reg;u32 rx_filters; -u32 cc_shift; -u32 cc_mult; -u32 cc_mult_num; -u32 cc_mult_dem; +const struct mv88e6xxx_cc_coeffs *cc_coeffs; };struct mv88e6xxx_pcs_ops {
drivers/net/dsa/mv88e6xxx/ptp.c +30 -29
114 lines not on this page · raw message
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 178/261 net: dsa: mv88e6xxx: read cycle counter period from hardware
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shenghao Yang <[email protected]>
[ Upstream commit 7e3c18097a709e9b958e721066e5fe76e563739b ]
Instead of relying on a fixed mapping of hardware family to cycle counter frequency, pull this information from the MV88E6XXX_TAI_CLOCK_PERIOD register.
This lets us support switches whose cycle counter frequencies depend on board design.
--- drivers/net/dsa/mv88e6xxx/chip.h | 2 +- drivers/net/dsa/mv88e6xxx/ptp.c | 60 ++++++++++++++++++++++---------- 2 files changed, 43 insertions(+), 19 deletions(-)
drivers/net/dsa/mv88e6xxx/chip.h +1 -1
@@ -409,6 +409,7 @@ struct mv88e6xxx_chip {struct cyclecounter tstamp_cc;struct timecounter tstamp_tc;struct delayed_work overflow_work; +const struct mv88e6xxx_cc_coeffs *cc_coeffs;struct ptp_clock *ptp_clock;struct ptp_clock_info ptp_clock_info;
@@ -732,7 +733,6 @@ struct mv88e6xxx_ptp_ops {int arr1_sts_reg;int dep_sts_reg;u32 rx_filters; -const struct mv88e6xxx_cc_coeffs *cc_coeffs; };struct mv88e6xxx_pcs_ops {
drivers/net/dsa/mv88e6xxx/ptp.c +42 -18
124 lines not on this page · raw message
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 179/261 net: dsa: mv88e6xxx: support 4000ps cycle counter period
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shenghao Yang <[email protected]>
[ Upstream commit 3e65ede526cf4f95636dbc835598d100c7668ab3 ]
The MV88E6393X family of devices can run its cycle counter off an internal 250MHz clock instead of an external 125MHz one.
Add support for this cycle counter period by adding another set of coefficients and lowering the periodic cycle counter read interval to compensate for faster overflows at the increased frequency.
Otherwise, the PHC runs at 2x real time in userspace and cannot be synchronized.
--- drivers/net/dsa/mv88e6xxx/ptp.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-)
drivers/net/dsa/mv88e6xxx/ptp.c +20 -3
@@ -40,7 +40,7 @@ static const struct mv88e6xxx_cc_coeffs mv88e6xxx_cc_10ns_coeffs = { .cc_mult_dem = 3125ULL, }; -/* Other families: +/* Other families except MV88E6393X in internal clock mode: * Raw timestamps are in units of 8-ns clock periods. * * clkadj = scaled_ppm * 8*2^28 / (10^6 * 2^16)
@@ -55,6 +55,21 @@ static const struct mv88e6xxx_cc_coeffs mv88e6xxx_cc_8ns_coeffs = { .cc_mult_dem = 15625ULL }; +/* Family MV88E6393X using internal clock: +* Raw timestamps are in units of 4-ns clock periods. +* +* clkadj = scaled_ppm * 4*2^28 / (10^6 * 2^16) +* simplifies to +* clkadj = scaled_ppm * 2^8 / 5^6 +*/ +#define MV88E6XXX_CC_4NS_SHIFT 28 +static const struct mv88e6xxx_cc_coeffs mv88e6xxx_cc_4ns_coeffs = { + .cc_shift =MV88E6XXX_CC_4NS_SHIFT , + .cc_mult =4 <<MV88E6XXX_CC_4NS_SHIFT , + .cc_mult_num =1 <<8 , + .cc_mult_dem =15625ULL +}; +#define TAI_EVENT_WORK_INTERVAL msecs_to_jiffies(100)#define cc_to_chip (cc) container_of(cc, struct mv88e6xxx_chip, tstamp_cc)
@@ -110,6 +125,8 @@ mv88e6xxx_cc_coeff_get(struct mv88e6xxx_chip *chip) }switch (period_ps) { +case 4000 : +return &mv88e6xxx_cc_4ns_coeffs;case 8000 :return &mv88e6xxx_cc_8ns_coeffs;case 10000 :
@@ -483,10 +500,10 @@ static u64 mv88e6xxx_ptp_clock_read(const struct cyclecounter *cc)return 0 ; } -/* With a 125MHz input clock, the 32-bit timestamp counter overflows in ~34.3 +/* With a 250MHz input clock, the 32-bit timestamp counter overflows in ~17.2 * seconds; this task forces periodic reads so that we don't miss any. */ -#define MV88E6XXX_TAI_OVERFLOW_PERIOD (HZ * 16) +#define MV88E6XXX_TAI_OVERFLOW_PERIOD (HZ * 8)static void mv88e6xxx_ptp_overflow_check (struct work_struct *work) {struct delayed_work *dw =to_delayed_work (work);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 180/261 bpf: Add the missing BPF_LINK_TYPE invocation for sockmap
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hou Tao <[email protected]>
[ Upstream commit c2f803052bc7a7feb2e03befccc8e49b6ff1f5f5 ]
There is an out-of-bounds read in bpf_link_show_fdinfo() for the sockmap link fd. Fix it by adding the missing BPF_LINK_TYPE invocation for sockmap link
Also add comments for bpf_link_type to prevent missing updates in the future.
--- include/linux/bpf_types.h | 1 + include/uapi/linux/bpf.h | 3 +++ tools/include/uapi/linux/bpf.h | 3 +++ 3 files changed, 7 insertions(+)
include/linux/bpf_types.h +1 -0
@@ -146,6 +146,7 @@ BPF_LINK_TYPE(BPF_LINK_TYPE_XDP, xdp) BPF_LINK_TYPE(BPF_LINK_TYPE_NETFILTER, netfilter) BPF_LINK_TYPE(BPF_LINK_TYPE_TCX, tcx) BPF_LINK_TYPE(BPF_LINK_TYPE_NETKIT, netkit) +BPF_LINK_TYPE(BPF_LINK_TYPE_SOCKMAP, sockmap)#endif #ifdef CONFIG_PERF_EVENTS BPF_LINK_TYPE (BPF_LINK_TYPE_PERF_EVENT , perf)
include/uapi/linux/bpf.h +3 -0
@@ -1121,6 +1121,9 @@ enum bpf_attach_type {#define MAX_BPF_ATTACH_TYPE __MAX_BPF_ATTACH_TYPE +/* Add BPF_LINK_TYPE(type, name) in bpf_types.h to keep bpf_link_type_strs[] +* in sync with the definitions below. +*/ enum bpf_link_type {BPF_LINK_TYPE_UNSPEC =0 ,BPF_LINK_TYPE_RAW_TRACEPOINT =1 ,
tools/include/uapi/linux/bpf.h +3 -0
@@ -1121,6 +1121,9 @@ enum bpf_attach_type {#define MAX_BPF_ATTACH_TYPE __MAX_BPF_ATTACH_TYPE +/* Add BPF_LINK_TYPE(type, name) in bpf_types.h to keep bpf_link_type_strs[] +* in sync with the definitions below. +*/ enum bpf_link_type {BPF_LINK_TYPE_UNSPEC =0 ,BPF_LINK_TYPE_RAW_TRACEPOINT =1 ,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 181/261 ASoC: dt-bindings: davinci-mcasp: Fix interrupts property
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Miquel Raynal <[email protected]>
[ Upstream commit 17d8adc4cd5181c13c1041b197b76efc09eaf8a8 ]
My understanding of the interrupts property is that it can either be:
1/ - TX
2/ - TX
- RX
3/ - Common/combined.
There are very little chances that either:
- TX
- Common/combined
or even
- TX
- RX
- Common/combined
could be a thing.
Looking at the interrupt-names definition (which uses oneOf instead of anyOf), it makes indeed little sense to use anyOf in the interrupts definition. I believe this is just a mistake, hence let's fix it.
Stable-dep-of: 8380dbf1b9ef ("ASoC: dt-bindings: davinci-mcasp: Fix interrupt properties")
--- .../devicetree/bindings/sound/davinci-mcasp-audio.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/devicetree/bindings/sound/davinci-mcasp-audio.yaml +1 -1
@@ -102,7 +102,7 @@ properties: default: 2 interrupts: - anyOf: + oneOf: - minItems: 1 items: - description: TX interrupt
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 182/261 ASoC: dt-bindings: davinci-mcasp: Fix interrupt properties
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Miquel Raynal <[email protected]>
[ Upstream commit 8380dbf1b9ef66e3ce6c1d660fd7259637c2a929 ]
Combinations of "tx" alone, "rx" alone and "tx", "rx" together are supposedly valid (see link below), which is not the case today as "rx" alone is not accepted by the current binding.
Let's rework the two interrupt properties to expose all correct possibilities.
--- .../bindings/sound/davinci-mcasp-audio.yaml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
Documentation/devicetree/bindings/sound/davinci-mcasp-audio.yaml +9 -9
@@ -102,21 +102,21 @@ properties: default: 2 interrupts: - oneOf: - - minItems: 1 - items: - - description: TX interrupt - - description: RX interrupt - - items: - - description: common/combined interrupt + minItems: 1 + maxItems: 2 interrupt-names: oneOf: - - minItems: 1 + - description: TX interrupt + const: tx + - description: RX interrupt + const: rx + - description: TX and RX interrupts items: - const: tx - const: rx - - const: common + - description: Common/combined interrupt + const: common fck_parent: $ref: /schemas/types.yaml#/definitions/string
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 183/261 ASoC: loongson: Fix component check failed on FDT systems
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Binbin Zhou <[email protected]>
[ Upstream commit a6134e7b4d4a14e0942f113a6df1d518baa2a0a4 ]
Add missing snd_soc_dai_link.platforms assignment to avoid soc_dai_link_sanity_check() failure.
--- sound/soc/loongson/loongson_card.c | 1 + 1 file changed, 1 insertion(+)
sound/soc/loongson/loongson_card.c +1 -0
@@ -137,6 +137,7 @@ static int loongson_card_parse_of(struct loongson_card_data *data)dev_err (dev,"getting cpu dlc error (%d)\n" , ret); goto err; } + loongson_dai_links[i].platforms->of_node = loongson_dai_links[i].cpus->of_node; ret =snd_soc_of_get_dlc (codec,NULL , loongson_dai_links[i].codecs,0 );if (ret <0 ) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 184/261 ASoC: topology: Bump minimal topology ABI version
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Amadeusz Sławiński <[email protected]>
[ Upstream commit 9eb2142a2ae8c8fdfce2aaa4c110f5a6f6b0b56e ]
When v4 topology support was removed, minimal topology ABI version should have been bumped.
--- include/uapi/sound/asoc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/uapi/sound/asoc.h +1 -1
@@ -88,7 +88,7 @@/* ABI version */ #define SND_SOC_TPLG_ABI_VERSION 0x5/* current version */ -#define SND_SOC_TPLG_ABI_VERSION_MIN 0x4/* oldest version supported */ +#define SND_SOC_TPLG_ABI_VERSION_MIN 0x5/* oldest version supported */ /* Max size of TLV data */ #define SND_SOC_TPLG_TLV_SIZE 32
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 185/261 ASoC: max98388: Fix missing increment of variable slot_found
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Colin Ian King <[email protected]>
[ Upstream commit ca2803fadfd239abf155ef4a563b22a9507ee4b2 ]
The variable slot_found is being initialized to zero and inside a for-loop is being checked if it's reached MAX_NUM_CH, however, this is currently impossible since slot_found is never changed. In a previous loop a similar coding pattern is used and slot_found is being incremented. It appears the increment of slot_found is missing from the loop, so fix the code by adding in the increment.
--- sound/soc/codecs/max98388.c | 1 + 1 file changed, 1 insertion(+)
sound/soc/codecs/max98388.c +1 -0
@@ -763,6 +763,7 @@ static int max98388_dai_tdm_slot(struct snd_soc_dai *dai, addr =MAX98388_R2044_PCM_TX_CTRL1 + (cnt /8 ); bits = cnt %8 ;regmap_update_bits (max98388->regmap, addr, bits, bits); + slot_found++;if (slot_found >=MAX_NUM_CH )break ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 186/261 ASoC: rsnd: Fix probe failure on HiHope boards due to endpoint parsing
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lad Prabhakar <[email protected]>
[ Upstream commit 9b064d200aa8fee9d1d7ced05d8a617e45966715 ]
On the HiHope boards, we have a single port with a single endpoint defined as below:
....
rsnd_port: port {
rsnd_endpoint: endpoint {
remote-endpoint = <&dw_hdmi0_snd_in>;
dai-format = "i2s";
bitclock-master = <&rsnd_endpoint>;
frame-master = <&rsnd_endpoint>;
playback = <&ssi2>;
};
};....
With commit 547b02f74e4a ("ASoC: rsnd: enable multi Component support for Audio Graph Card/Card2"), support for multiple ports was added. This caused probe failures on HiHope boards, as the endpoint could not be retrieved due to incorrect device node pointers being used.
This patch fixes the issue by updating the rsnd_dai_of_node() and rsnd_dai_probe() functions to use the correct device node pointers based on the port names ('port' or 'ports'). It ensures that the endpoint is properly parsed for both single and multi-port configurations, restoring compatibility with HiHope boards.
--- sound/soc/sh/rcar/core.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
sound/soc/sh/rcar/core.c +5 -2
@@ -1298,7 +1298,9 @@ static int rsnd_dai_of_node(struct rsnd_priv *priv, int *is_graph)if (!of_node_name_eq (ports,"ports" ) && !of_node_name_eq (ports,"port" ))continue ; - priv->component_dais[i] =of_graph_get_endpoint_count (ports); + priv->component_dais[i] = +of_graph_get_endpoint_count (of_node_name_eq (ports,"ports" ) ? + ports : np); nr += priv->component_dais[i]; i++;if (i >=RSND_MAX_COMPONENT ) {
@@ -1510,7 +1512,8 @@ static int rsnd_dai_probe(struct rsnd_priv *priv)if (!of_node_name_eq (ports,"ports" ) && !of_node_name_eq (ports,"port" ))continue ; -for_each_endpoint_of_node (ports, dai_np) { +for_each_endpoint_of_node (of_node_name_eq (ports,"ports" ) ? + ports : np, dai_np) {__rsnd_dai_probe (priv, dai_np, dai_np,0 , dai_i);if (!rsnd_is_gen1 (priv) && !rsnd_is_gen2 (priv)) { rdai =rsnd_rdai_get (priv, dai_i);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 187/261 PCI: Hold rescan lock while adding devices during host probe
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bartosz Golaszewski <[email protected]>
[ Upstream commit 1d59d474e1cb7d4fdf87dfaf96f44647f13ea590 ]
Since adding the PCI power control code, we may end up with a race between the pwrctl platform device rescanning the bus and host controller probe functions. The latter need to take the rescan lock when adding devices or we may end up in an undefined state having two incompletely added devices and hit the following crash when trying to remove the device over sysfs:
Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000
Internal error: Oops: 0000000096000004 [#1] SMP
Call trace:
__pi_strlen+0x14/0x150
kernfs_find_ns+0x80/0x13c
kernfs_remove_by_name_ns+0x54/0xf0
sysfs_remove_bin_file+0x24/0x34
pci_remove_resource_files+0x3c/0x84
pci_remove_sysfs_dev_files+0x28/0x38
pci_stop_bus_device+0x8c/0xd8
pci_stop_bus_device+0x40/0xd8
pci_stop_and_remove_bus_device_locked+0x28/0x48
remove_store+0x70/0xb0
dev_attr_store+0x20/0x38
sysfs_kf_write+0x58/0x78
kernfs_fop_write_iter+0xe8/0x184
vfs_write+0x2dc/0x308
ksys_write+0x7c/0xec--- drivers/pci/probe.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/pci/probe.c +2 -0
@@ -3106,7 +3106,9 @@ int pci_host_probe(struct pci_host_bridge *bridge)list_for_each_entry (child, &bus->children, node)pcie_bus_configure_settings (child); +pci_lock_rescan_remove ();pci_bus_add_devices (bus); +pci_unlock_rescan_remove ();return 0 ; }EXPORT_SYMBOL_GPL (pci_host_probe);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 188/261 fs: pass offset and result to backing_file end_write() callback
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Amir Goldstein <[email protected]>
[ Upstream commit f03b296e8b516dbd63f57fc9056c1b0da1b9a0ff ]
This is needed for extending fuse inode size after fuse passthrough write.
Stable-dep-of: 20121d3f58f0 ("fuse: update inode size after extending passthrough write")
--- fs/backing-file.c | 8 ++++---- fs/fuse/passthrough.c | 6 +++--- fs/overlayfs/file.c | 9 +++++++-- include/linux/backing-file.h | 2 +- 4 files changed, 15 insertions(+), 10 deletions(-)
fs/backing-file.c +4 -4
@@ -80,7 +80,7 @@ struct backing_aio {refcount_t ref;struct kiocb *orig_iocb;/* used for aio completion */ -void (*end_write)(struct file *); +void (*end_write)(struct file *,loff_t ,ssize_t );struct work_struct work;long res; };
@@ -109,7 +109,7 @@ static void backing_aio_cleanup(struct backing_aio *aio, long res)struct kiocb *orig_iocb = aio->orig_iocb;if (aio->end_write) - aio->end_write (orig_iocb->ki_filp); + aio->end_write (orig_iocb->ki_filp, iocb->ki_pos, res); orig_iocb->ki_pos = iocb->ki_pos;backing_aio_put (aio);
@@ -239,7 +239,7 @@ ssize_t backing_file_write_iter(struct file *file, struct iov_iter *iter, ret =vfs_iter_write (file, iter, &iocb->ki_pos, rwf);if (ctx->end_write) - ctx->end_write (ctx->user_file); + ctx->end_write (ctx->user_file, iocb->ki_pos, ret); }else {struct backing_aio *aio;
@@ -317,7 +317,7 @@ ssize_t backing_file_splice_write(struct pipe_inode_info *pipe,revert_creds (old_cred);if (ctx->end_write) - ctx->end_write (ctx->user_file); + ctx->end_write (ctx->user_file, ppos ? *ppos :0 , ret);return ret; }
fs/fuse/passthrough.c +3 -3
@@ -18,7 +18,7 @@ static void fuse_file_accessed(struct file *file)fuse_invalidate_atime (inode); } -static void fuse_file_modified (struct file *file) +static void fuse_passthrough_end_write (struct file *file,loff_t pos,ssize_t ret) {struct inode *inode =file_inode (file);
@@ -63,7 +63,7 @@ ssize_t fuse_passthrough_write_iter(struct kiocb *iocb,struct backing_file_ctx ctx = { .cred = ff->cred, .user_file = file, - .end_write = fuse_file_modified, + .end_write = fuse_passthrough_end_write, }; pr_debug("%s: backing_file=0x%p, pos=%lld, len=%zu\n", __func__,
@@ -110,7 +110,7 @@ ssize_t fuse_passthrough_splice_write(struct pipe_inode_info *pipe,struct backing_file_ctx ctx = { .cred = ff->cred, .user_file = out, - .end_write = fuse_file_modified, + .end_write = fuse_passthrough_end_write, }; pr_debug("%s: backing_file=0x%p, pos=%lld, len=%zu, flags=0x%x\n", __func__,
fs/overlayfs/file.c +7 -2
@@ -229,6 +229,11 @@ static void ovl_file_modified(struct file *file)ovl_copyattr (file_inode (file)); } +static void ovl_file_end_write (struct file *file,loff_t pos,ssize_t ret) +{ +ovl_file_modified (file); +} +static void ovl_file_accessed (struct file *file) {struct inode *inode, *upperinode;
@@ -292,7 +297,7 @@ static ssize_t ovl_write_iter(struct kiocb *iocb, struct iov_iter *iter)struct backing_file_ctx ctx = { .cred =ovl_creds (inode->i_sb), .user_file = file, - .end_write = ovl_file_modified, + .end_write = ovl_file_end_write, };if (!iov_iter_count (iter))
@@ -362,7 +367,7 @@ static ssize_t ovl_splice_write(struct pipe_inode_info *pipe, struct file *out,struct backing_file_ctx ctx = { .cred =ovl_creds (inode->i_sb), .user_file = out, - .end_write = ovl_file_modified, + .end_write = ovl_file_end_write, };inode_lock (inode);
include/linux/backing-file.h +1 -1
@@ -16,7 +16,7 @@ struct backing_file_ctx {const struct cred *cred;struct file *user_file;void (*accessed)(struct file *); -void (*end_write)(struct file *); +void (*end_write)(struct file *,loff_t ,ssize_t ); }; struct file *backing_file_open(const struct path *user_path, int flags,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 189/261 fuse: update inode size after extending passthrough write
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Amir Goldstein <[email protected]>
[ Upstream commit 20121d3f58f06e977ca43eb6efe1fb23b1d2f6d9 ]
yangyun reported that libfuse test test_copy_file_range() copies zero bytes from a newly written file when fuse passthrough is enabled.
The reason is that extending passthrough write is not updating the fuse inode size and when vfs_copy_file_range() observes a zero size inode, it returns without calling the filesystem copy_file_range() method.
Fix this by adjusting the fuse inode size after an extending passthrough write.
This does not provide cache coherency of fuse inode attributes and backing inode attributes, but it should prevent situations where fuse inode size is too small, causing read/copy to be wrongly shortened.
--- fs/fuse/passthrough.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/fuse/passthrough.c +1 -1
@@ -22,7 +22,7 @@ static void fuse_passthrough_end_write(struct file *file, loff_t pos, ssize_t re {struct inode *inode =file_inode (file); -fuse_invalidate_attr_mask (inode,FUSE_STATX_MODSIZE ); +fuse_write_update_attr (inode, pos, ret); }ssize_t fuse_passthrough_read_iter (struct kiocb *iocb,struct iov_iter *iter)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 190/261 ASoC: fsl_micfil: Add a flag to distinguish with different volume control types
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chancel Liu <[email protected]>
[ Upstream commit da95e891dd5d5de6c5ebc010bd028a2e028de093 ]
On i.MX8MM the register of volume control has positive and negative values. It is different from other platforms like i.MX8MP and i.MX93 which only have positive values. Add a volume_sx flag to use SX_TLV volume control for this kind of platform. Use common TLV volume control for other platforms.
--- sound/soc/fsl/fsl_micfil.c | 43 +++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-)
sound/soc/fsl/fsl_micfil.c +42 -1
@@ -67,6 +67,7 @@ struct fsl_micfil_soc_data {bool imx;bool use_edma;bool use_verid; +bool volume_sx;u64 formats; };
@@ -76,6 +77,7 @@ static struct fsl_micfil_soc_data fsl_micfil_imx8mm = { .fifo_depth = 8, .dataline = 0xf, .formats = SNDRV_PCM_FMTBIT_S16_LE, + .volume_sx = true, };static struct fsl_micfil_soc_data fsl_micfil_imx8mp = {
@@ -84,6 +86,7 @@ static struct fsl_micfil_soc_data fsl_micfil_imx8mp = { .fifo_depth = 32, .dataline = 0xf, .formats = SNDRV_PCM_FMTBIT_S32_LE, + .volume_sx = false, };static struct fsl_micfil_soc_data fsl_micfil_imx93 = {
@@ -94,6 +97,7 @@ static struct fsl_micfil_soc_data fsl_micfil_imx93 = { .formats = SNDRV_PCM_FMTBIT_S32_LE, .use_edma = true, .use_verid = true, + .volume_sx = false, };static const struct of_device_id fsl_micfil_dt_ids[] = {
@@ -317,7 +321,26 @@ static int hwvad_detected(struct snd_kcontrol *kcontrol,return 0 ; } -static const struct snd_kcontrol_new fsl_micfil_snd_controls[] = { +static const struct snd_kcontrol_new fsl_micfil_volume_controls[] = { +SOC_SINGLE_TLV ("CH0 Volume" ,REG_MICFIL_OUT_CTRL , +MICFIL_OUTGAIN_CHX_SHIFT (0 ),0xF ,0 , gain_tlv), +SOC_SINGLE_TLV ("CH1 Volume" ,REG_MICFIL_OUT_CTRL , +MICFIL_OUTGAIN_CHX_SHIFT (1 ),0xF ,0 , gain_tlv), +SOC_SINGLE_TLV ("CH2 Volume" ,REG_MICFIL_OUT_CTRL , +MICFIL_OUTGAIN_CHX_SHIFT (2 ),0xF ,0 , gain_tlv), +SOC_SINGLE_TLV ("CH3 Volume" ,REG_MICFIL_OUT_CTRL , +MICFIL_OUTGAIN_CHX_SHIFT (3 ),0xF ,0 , gain_tlv), +SOC_SINGLE_TLV ("CH4 Volume" ,REG_MICFIL_OUT_CTRL , +MICFIL_OUTGAIN_CHX_SHIFT (4 ),0xF ,0 , gain_tlv), +SOC_SINGLE_TLV ("CH5 Volume" ,REG_MICFIL_OUT_CTRL , +MICFIL_OUTGAIN_CHX_SHIFT (5 ),0xF ,0 , gain_tlv), +SOC_SINGLE_TLV ("CH6 Volume" ,REG_MICFIL_OUT_CTRL , +MICFIL_OUTGAIN_CHX_SHIFT (6 ),0xF ,0 , gain_tlv), +SOC_SINGLE_TLV ("CH7 Volume" ,REG_MICFIL_OUT_CTRL , +MICFIL_OUTGAIN_CHX_SHIFT (7 ),0xF ,0 , gain_tlv), +}; + +static const struct snd_kcontrol_new fsl_micfil_volume_sx_controls[] = {SOC_SINGLE_SX_TLV ("CH0 Volume" ,REG_MICFIL_OUT_CTRL ,MICFIL_OUTGAIN_CHX_SHIFT (0 ),0x8 ,0xF , gain_tlv), SOC_SINGLE_SX_TLV("CH1 Volume", REG_MICFIL_OUT_CTRL,
@@ -334,6 +357,9 @@ static const struct snd_kcontrol_new fsl_micfil_snd_controls[] = { MICFIL_OUTGAIN_CHX_SHIFT(6), 0x8, 0xF, gain_tlv), SOC_SINGLE_SX_TLV("CH7 Volume", REG_MICFIL_OUT_CTRL, MICFIL_OUTGAIN_CHX_SHIFT(7), 0x8, 0xF, gain_tlv), +}; + +static const struct snd_kcontrol_new fsl_micfil_snd_controls[] = {SOC_ENUM_EXT ("MICFIL Quality Select" , fsl_micfil_quality_enum, micfil_quality_get, micfil_quality_set),
@@ -801,6 +827,20 @@ static int fsl_micfil_dai_probe(struct snd_soc_dai *cpu_dai)return 0 ; } +static int fsl_micfil_component_probe (struct snd_soc_component *component) +{ +struct fsl_micfil *micfil =snd_soc_component_get_drvdata (component); + +if (micfil->soc->volume_sx) +snd_soc_add_component_controls (component, fsl_micfil_volume_sx_controls, +ARRAY_SIZE (fsl_micfil_volume_sx_controls)); +else +snd_soc_add_component_controls (component, fsl_micfil_volume_controls, +ARRAY_SIZE (fsl_micfil_volume_controls)); + +return 0 ; +} +static const struct snd_soc_dai_ops fsl_micfil_dai_ops = { .probe = fsl_micfil_dai_probe, .startup = fsl_micfil_startup,
@@ -821,6 +861,7 @@ static struct snd_soc_dai_driver fsl_micfil_dai = {static const struct snd_soc_component_driver fsl_micfil_component = { .name ="fsl-micfil-dai" , + .probe = fsl_micfil_component_probe, .controls = fsl_micfil_snd_controls, .num_controls =ARRAY_SIZE (fsl_micfil_snd_controls), .legacy_dai_naming =1 ,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 191/261 ALSA: firewire-lib: Avoid division by zero in apply_constraint_to_size()
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrey Shumilin <[email protected]>
[ Upstream commit 72cafe63b35d06b5cfbaf807e90ae657907858da ]
The step variable is initialized to zero. It is changed in the loop, but if it's not changed it will remain zero. Add a variable check before the division.
The observed behavior was introduced by commit 826b5de90c0b ("ALSA: firewire-lib: fix insufficient PCM rule for period/buffer size"), and it is difficult to show that any of the interval parameters will satisfy the snd_interval_test() condition with data from the amdtp_rate_table[] table.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- sound/firewire/amdtp-stream.c | 3 +++ 1 file changed, 3 insertions(+)
sound/firewire/amdtp-stream.c +3 -0
@@ -172,6 +172,9 @@ static int apply_constraint_to_size(struct snd_pcm_hw_params *params, step =max (step, amdtp_syt_intervals[i]); } +if (step ==0 ) +return -EINVAL ; + t.min =roundup (s->min, step); t.max =rounddown (s->max, step); t.integer =1 ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 192/261 fbdev: wm8505fb: select CONFIG_FB_IOMEM_FOPS
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit 51521d2e2c35959cc70a62ccddf694965e29c950 ]
The fb_io_mmap() function is used in the file operations but not enabled in all configurations unless FB_IOMEM_FOPS gets selected:
ld.lld-20: error: undefined symbol: fb_io_mmap
referenced by wm8505fb.c drivers/video/fbdev/wm8505fb.o:(wm8505fb_ops) in archive vmlinux.a
--- drivers/video/fbdev/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/video/fbdev/Kconfig +1 -0
@@ -1374,6 +1374,7 @@ config FB_VT8500 config FB_WM8505 bool "Wondermedia WM8xxx-series frame buffer support" depends on (FB = y) && HAS_IOMEM && (ARCH_VT8500 || COMPILE_TEST) + select FB_IOMEM_FOPS select FB_SYS_FILLRECT if (!FB_WMT_GE_ROPS) select FB_SYS_COPYAREA if (!FB_WMT_GE_ROPS) select FB_SYS_IMAGEBLIT
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 193/261 powercap: dtpm_devfreq: Fix error check against dev_pm_qos_add_request()
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuan Can <[email protected]>
[ Upstream commit 5209d1b654f1db80509040cc694c7814a1b547e3 ]
The caller of the function dev_pm_qos_add_request() checks again a non zero value but dev_pm_qos_add_request() can return '1' if the request already exists. Therefore, the setup function fails while the QoS request actually did not failed.
Fix that by changing the check against a negative value like all the other callers of the function.
--- drivers/powercap/dtpm_devfreq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/powercap/dtpm_devfreq.c +1 -1
@@ -178,7 +178,7 @@ static int __dtpm_devfreq_setup(struct devfreq *devfreq, struct dtpm *parent) ret =dev_pm_qos_add_request (dev, &dtpm_devfreq->qos_req,DEV_PM_QOS_MAX_FREQUENCY ,PM_QOS_MAX_FREQUENCY_DEFAULT_VALUE ); -if (ret) { +if (ret <0 ) {pr_err ("Failed to add QoS request: %d\n" , ret); goto out_dtpm_unregister; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 194/261 nfsd: cancel nfsd_shrinker_work using sync mode in nfs4_state_shutdown_net
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yang Erkun <[email protected]>
[ Upstream commit d5ff2fb2e7167e9483846e34148e60c0c016a1f6 ]
In the normal case, when we excute echo 0 > /proc/fs/nfsd/threads, the function nfs4_state_destroy_net in nfs4_state_shutdown_net will release all resources related to the hashed nfs4_client. If the nfsd_client_shrinker is running concurrently, the expire_client function will first unhash this client and then destroy it. This can lead to the following warning. Additionally, numerous use-after-free errors may occur as well.
nfsd_client_shrinker echo 0 > /proc/fs/nfsd/threads
expire_client nfsd_shutdown_net
unhash_client ...
nfs4_state_shutdown_net
/* won't wait shrinker exit */
/* cancel_work(&nn->nfsd_shrinker_work)
* nfsd_file for this /* won't destroy unhashed client1 */
* client1 still alive nfs4_state_destroy_net*/
nfsd_file_cache_shutdown
/* trigger warning */
kmem_cache_destroy(nfsd_file_slab)
kmem_cache_destroy(nfsd_file_mark_slab) /* release nfsd_file and mark */
__destroy_client
====================================================================
BUG nfsd_file (Not tainted): Objects remaining in nfsd_file on __kmem_cache_shutdown()
--------------------------------------------------------------------
CPU: 4 UID: 0 PID: 764 Comm: sh Not tainted 6.12.0-rc3+ #1 dump_stack_lvl+0x53/0x70 slab_err+0xb0/0xf0 __kmem_cache_shutdown+0x15c/0x310 kmem_cache_destroy+0x66/0x160 nfsd_file_cache_shutdown+0xac/0x210 [nfsd] nfsd_destroy_serv+0x251/0x2a0 [nfsd] nfsd_svc+0x125/0x1e0 [nfsd] write_threads+0x16a/0x2a0 [nfsd] nfsctl_transaction_write+0x74/0xa0 [nfsd] vfs_write+0x1a5/0x6d0 ksys_write+0xc1/0x160 do_syscall_64+0x5f/0x170 entry_SYSCALL_64_after_hwframe+0x76/0x7e
====================================================================
BUG nfsd_file_mark (Tainted: G B W ): Objects remainingnfsd_file_mark on __kmem_cache_shutdown()
--------------------------------------------------------------------
dump_stack_lvl+0x53/0x70 slab_err+0xb0/0xf0 __kmem_cache_shutdown+0x15c/0x310 kmem_cache_destroy+0x66/0x160 nfsd_file_cache_shutdown+0xc8/0x210 [nfsd] nfsd_destroy_serv+0x251/0x2a0 [nfsd] nfsd_svc+0x125/0x1e0 [nfsd] write_threads+0x16a/0x2a0 [nfsd] nfsctl_transaction_write+0x74/0xa0 [nfsd] vfs_write+0x1a5/0x6d0 ksys_write+0xc1/0x160 do_syscall_64+0x5f/0x170 entry_SYSCALL_64_after_hwframe+0x76/0x7e
To resolve this issue, cancel nfsd_shrinker_work using synchronous mode in nfs4_state_shutdown_net.
--- fs/nfsd/nfs4state.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfsd/nfs4state.c +1 -1
@@ -8687,7 +8687,7 @@ nfs4_state_shutdown_net(struct net *net)struct nfsd_net *nn =net_generic (net, nfsd_net_id);shrinker_free (nn->nfsd_client_shrinker); -cancel_work (&nn->nfsd_shrinker_work); +cancel_work_sync (&nn->nfsd_shrinker_work);cancel_delayed_work_sync (&nn->laundromat_work);locks_end_grace (&nn->nfsd4_manager);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 195/261 ALSA: hda/realtek: Update default depop procedure
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kailang Yang <[email protected]>
[ Upstream commit e3ea2757c312e51bbf62ebc434a6f7df1e3a201f ]
Old procedure has a chance to meet Headphone no output.
--- sound/pci/hda/patch_realtek.c | 38 ++++++++++++++++------------------- 1 file changed, 17 insertions(+), 21 deletions(-)
sound/pci/hda/patch_realtek.c +17 -21
@@ -3857,20 +3857,18 @@ static void alc_default_init(struct hda_codec *codec) hp_pin_sense =snd_hda_jack_detect (codec, hp_pin); -if (hp_pin_sense) +if (hp_pin_sense) {msleep (2 ); -snd_hda_codec_write (codec, hp_pin,0 , -AC_VERB_SET_AMP_GAIN_MUTE ,AMP_OUT_MUTE ); - -if (hp_pin_sense) -msleep (85 ); +snd_hda_codec_write (codec, hp_pin,0 , +AC_VERB_SET_PIN_WIDGET_CONTROL ,PIN_OUT ); -snd_hda_codec_write (codec, hp_pin,0 , -AC_VERB_SET_PIN_WIDGET_CONTROL ,PIN_OUT ); +msleep (75 ); -if (hp_pin_sense) -msleep (100 ); +snd_hda_codec_write (codec, hp_pin,0 , +AC_VERB_SET_AMP_GAIN_MUTE ,AMP_OUT_UNMUTE ); +msleep (75 ); + } }static void alc_default_shutup (struct hda_codec *codec)
@@ -3886,22 +3884,20 @@ static void alc_default_shutup(struct hda_codec *codec) hp_pin_sense =snd_hda_jack_detect (codec, hp_pin); -if (hp_pin_sense) +if (hp_pin_sense) {msleep (2 ); -snd_hda_codec_write (codec, hp_pin,0 , -AC_VERB_SET_AMP_GAIN_MUTE ,AMP_OUT_MUTE ); - -if (hp_pin_sense) -msleep (85 ); - -if (!spec->no_shutup_pins)snd_hda_codec_write (codec, hp_pin,0 , -AC_VERB_SET_PIN_WIDGET_CONTROL ,0x0 ); +AC_VERB_SET_AMP_GAIN_MUTE ,AMP_OUT_MUTE ); -if (hp_pin_sense) -msleep (100 ); +msleep (75 ); +if (!spec->no_shutup_pins) +snd_hda_codec_write (codec, hp_pin,0 , +AC_VERB_SET_PIN_WIDGET_CONTROL ,0x0 ); + +msleep (75 ); + }alc_auto_setup_eapd (codec, false);alc_shutup_pins (codec); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 196/261 smb: client: Handle kstrdup failures for passwords
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Henrique Carvalho <[email protected]>
[ Upstream commit 9a5dd61151399ad5a5d69aad28ab164734c1e3bc ]
In smb3_reconfigure(), after duplicating ctx->password and ctx->password2 with kstrdup(), we need to check for allocation failures.
If ses->password allocation fails, return -ENOMEM. If ses->password2 allocation fails, free ses->password, set it to NULL, and return -ENOMEM.
--- fs/smb/client/fs_context.c | 7 +++++++ 1 file changed, 7 insertions(+)
fs/smb/client/fs_context.c +7 -0
@@ -920,8 +920,15 @@ static int smb3_reconfigure(struct fs_context *fc)else {kfree_sensitive (ses->password); ses->password =kstrdup (ctx->password,GFP_KERNEL ); +if (!ses->password) +return -ENOMEM ;kfree_sensitive (ses->password2); ses->password2 =kstrdup (ctx->password2,GFP_KERNEL ); +if (!ses->password2) { +kfree_sensitive (ses->password); + ses->password =NULL ; +return -ENOMEM ; + } }STEAL_STRING (cifs_sb, ctx, domainname);STEAL_STRING (cifs_sb, ctx, nodename);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 197/261 cifs: fix warning when destroy cifs_io_request_pool
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ye Bin <[email protected]>
[ Upstream commit 2ce1007f42b8a6a0814386cb056feb28dc6d6091 ]
There's a issue as follows:
WARNING: CPU: 1 PID: 27826 at mm/slub.c:4698 free_large_kmalloc+0xac/0xe0 RIP: 0010:free_large_kmalloc+0xac/0xe0 Call Trace: <TASK> ? __warn+0xea/0x330 mempool_destroy+0x13f/0x1d0 init_cifs+0xa50/0xff0 [cifs] do_one_initcall+0xdc/0x550 do_init_module+0x22d/0x6b0 load_module+0x4e96/0x5ff0 init_module_from_file+0xcd/0x130 idempotent_init_module+0x330/0x620 __x64_sys_finit_module+0xb3/0x110 do_syscall_64+0xc1/0x1d0 entry_SYSCALL_64_after_hwframe+0x77/0x7f
Obviously, 'cifs_io_request_pool' is not created by mempool_create(). So just use mempool_exit() to revert 'cifs_io_request_pool'.
--- fs/smb/client/cifsfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/smb/client/cifsfs.c +1 -1
@@ -1780,7 +1780,7 @@ static int cifs_init_netfs(void) nomem_subreqpool:kmem_cache_destroy (cifs_io_subrequest_cachep); nomem_subreq: -mempool_destroy (&cifs_io_request_pool); +mempool_exit (&cifs_io_request_pool); nomem_reqpool:kmem_cache_destroy (cifs_io_request_cachep); nomem_req:
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 198/261 PCI/pwrctl: Add WCN6855 support
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit 0da59840f10141988e949d8519ed9182991caf17 ]
Add support for ATH11K inside the WCN6855 package to the power sequencing PCI power control driver.
Stable-dep-of: ad783b9f8e78 ("PCI/pwrctl: Abandon QCom WCN probe on pre-pwrseq device-trees")
--- drivers/pci/pwrctl/pci-pwrctl-pwrseq.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/pci/pwrctl/pci-pwrctl-pwrseq.c +5 -0
@@ -66,6 +66,11 @@ static const struct of_device_id pci_pwrctl_pwrseq_of_match[] = { .compatible = "pci17cb,1101", .data = "wlan", }, + { +/* ATH11K in WCN6855 package. */ + .compatible = "pci17cb,1103", + .data = "wlan", + }, {/* ATH12K in WCN7850 package. */ .compatible = "pci17cb,1107",
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 199/261 PCI/pwrctl: Abandon QCom WCN probe on pre-pwrseq device-trees
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bartosz Golaszewski <[email protected]>
[ Upstream commit ad783b9f8e78572fff3b04b6caee7bea3821eea8 ]
Old device trees for some platforms already define wifi nodes for the WCN family of chips since before power sequencing was added upstream.
These nodes don't consume the regulator outputs from the PMU, and if we allow this driver to bind to one of such "incomplete" nodes, we'll see a kernel log error about the infinite probe deferral.
Extend the driver by adding a platform data struct matched against the compatible. This struct contains the pwrseq target string as well as a validation function called right after entering probe().
For Qualcomm WCN models, check the existence of the regulator supply property that indicates the DT is already using power sequencing and return -ENODEV if it's not there, indicating to the driver model that the device should not be bound to the pwrctl driver.
--- drivers/pci/pwrctl/pci-pwrctl-pwrseq.c | 55 +++++++++++++++++++++++--- 1 file changed, 50 insertions(+), 5 deletions(-)
drivers/pci/pwrctl/pci-pwrctl-pwrseq.c +50 -5
@@ -6,9 +6,9 @@#include <linux/device.h> #include <linux/mod_devicetable.h> #include <linux/module.h> -#include <linux/of.h> #include <linux/pci-pwrctl.h> #include <linux/platform_device.h> +#include <linux/property.h> #include <linux/pwrseq/consumer.h> #include <linux/slab.h> #include <linux/types.h>
@@ -18,6 +18,40 @@ struct pci_pwrctl_pwrseq_data {struct pwrseq_desc *pwrseq; }; +struct pci_pwrctl_pwrseq_pdata { +const char *target; +/* +* Called before doing anything else to perform device-specific +* verification between requesting the power sequencing handle. +*/ +int (*validate_device)(struct device *dev); +}; + +static int pci_pwrctl_pwrseq_qcm_wcn_validate_device (struct device *dev) +{ +/* +* Old device trees for some platforms already define wifi nodes for +* the WCN family of chips since before power sequencing was added +* upstream. +* +* These nodes don't consume the regulator outputs from the PMU, and +* if we allow this driver to bind to one of such "incomplete" nodes, +* we'll see a kernel log error about the indefinite probe deferral. +* +* Check the existence of the regulator supply that exists on all +* WCN models before moving forward. +*/ +if (!device_property_present (dev,"vddaon-supply" )) +return -ENODEV ; + +return 0 ; +} + +static const struct pci_pwrctl_pwrseq_pdata pci_pwrctl_pwrseq_qcom_wcn_pdata = { + .target ="wlan" , + .validate_device = pci_pwrctl_pwrseq_qcm_wcn_validate_device, +}; +static void devm_pci_pwrctl_pwrseq_power_off (void *data) {struct pwrseq_desc *pwrseq = data;
@@ -27,15 +61,26 @@ static void devm_pci_pwrctl_pwrseq_power_off(void *data)static int pci_pwrctl_pwrseq_probe (struct platform_device *pdev) { +const struct pci_pwrctl_pwrseq_pdata *pdata;struct pci_pwrctl_pwrseq_data *data;struct device *dev = &pdev->dev;int ret; + pdata =device_get_match_data (dev); +if (!pdata || !pdata->target) +return -EINVAL ; + +if (pdata->validate_device) { + ret = pdata->validate_device (dev); +if (ret) +return ret; + } + data =devm_kzalloc (dev,sizeof (*data),GFP_KERNEL );if (!data)return -ENOMEM ; - data->pwrseq =devm_pwrseq_get (dev,of_device_get_match_data (dev)); + data->pwrseq =devm_pwrseq_get (dev, pdata->target);if (IS_ERR (data->pwrseq))return dev_err_probe (dev,PTR_ERR (data->pwrseq),"Failed to get the power sequencer\n" );
@@ -64,17 +109,17 @@ static const struct of_device_id pci_pwrctl_pwrseq_of_match[] = { { /* ATH11K in QCA6390 package. */ .compatible = "pci17cb,1101", - .data = "wlan", + .data = &pci_pwrctl_pwrseq_qcom_wcn_pdata, }, { /* ATH11K in WCN6855 package. */ .compatible = "pci17cb,1103", - .data = "wlan", + .data = &pci_pwrctl_pwrseq_qcom_wcn_pdata, }, { /* ATH12K in WCN7850 package. */ .compatible = "pci17cb,1107", - .data = "wlan", + .data = &pci_pwrctl_pwrseq_qcom_wcn_pdata, }, { } };
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 200/261 cpufreq: CPPC: fix perf_to_khz/khz_to_perf conversion exception
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: liwei <[email protected]>
[ Upstream commit d93df29bdab133b85e94b3c328e7fe26a0ebd56c ]
When the nominal_freq recorded by the kernel is equal to the lowest_freq, and the frequency adjustment operation is triggered externally, there is a logic error in cppc_perf_to_khz()/cppc_khz_to_perf(), resulting in perf and khz conversion errors.
Fix this by adding a branch processing logic when nominal_freq is equal to lowest_freq.
--- drivers/acpi/cppc_acpi.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-)
drivers/acpi/cppc_acpi.c +17 -5
@@ -1916,9 +1916,15 @@ unsigned int cppc_perf_to_khz(struct cppc_perf_caps *caps, unsigned int perf)u64 mul, div;if (caps->lowest_freq && caps->nominal_freq) { - mul = caps->nominal_freq - caps->lowest_freq; +/* Avoid special case when nominal_freq is equal to lowest_freq */ +if (caps->lowest_freq == caps->nominal_freq) { + mul = caps->nominal_freq; + div = caps->nominal_perf; + }else { + mul = caps->nominal_freq - caps->lowest_freq; + div = caps->nominal_perf - caps->lowest_perf; + } mul *=KHZ_PER_MHZ ; - div = caps->nominal_perf - caps->lowest_perf; offset = caps->nominal_freq *KHZ_PER_MHZ -div64_u64 (caps->nominal_perf * mul, div); }else {
@@ -1939,11 +1945,17 @@ unsigned int cppc_khz_to_perf(struct cppc_perf_caps *caps, unsigned int freq) {s64 retval, offset =0 ;static u64 max_khz; -u64 mul, div; +u64 mul, div;if (caps->lowest_freq && caps->nominal_freq) { - mul = caps->nominal_perf - caps->lowest_perf; - div = caps->nominal_freq - caps->lowest_freq; +/* Avoid special case when nominal_freq is equal to lowest_freq */ +if (caps->lowest_freq == caps->nominal_freq) { + mul = caps->nominal_perf; + div = caps->nominal_freq; + }else { + mul = caps->nominal_perf - caps->lowest_perf; + div = caps->nominal_freq - caps->lowest_freq; + }/* * We don't need to convert to kHz for computing offset and can * directly use nominal_freq and lowest_freq as the div64_u64
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 201/261 btrfs: qgroup: set a more sane default value for subtree drop threshold
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qu Wenruo <[email protected]>
commit 5f9062a48db260fd6b53d86ecfb4d5dc59266316 upstream.
Since commit 011b46c30476 ("btrfs: skip subtree scan if it's too high to avoid low stall in btrfs_commit_transaction()"), btrfs qgroup can automatically skip large subtree scan at the cost of marking qgroup inconsistent.
It's designed to address the final performance problem of snapshot drop with qgroup enabled, but to be safe the default value is BTRFS_MAX_LEVEL, requiring a user space daemon to set a different value to make it work.
I'd say it's not a good idea to rely on user space tool to set this default value, especially when some operations (snapshot dropping) can be triggered immediately after mount, leaving a very small window to that that sysfs interface.
So instead of disabling this new feature by default, enable it with a low threshold (3), so that large subvolume tree drop at mount time won't cause huge qgroup workload.
--- fs/btrfs/disk-io.c | 2 +- fs/btrfs/qgroup.c | 2 +- fs/btrfs/qgroup.h | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-)
fs/btrfs/disk-io.c +1 -1
@@ -1960,7 +1960,7 @@ static void btrfs_init_qgroup(struct btr fs_info->qgroup_seq =1 ; fs_info->qgroup_ulist =NULL ; fs_info->qgroup_rescan_running = false; - fs_info->qgroup_drop_subtree_thres =BTRFS_MAX_LEVEL ; + fs_info->qgroup_drop_subtree_thres =BTRFS_QGROUP_DROP_SUBTREE_THRES_DEFAULT ;mutex_init (&fs_info->qgroup_rescan_lock); }
fs/btrfs/qgroup.c +1 -1
@@ -1407,7 +1407,7 @@ int btrfs_quota_disable(struct btrfs_fs_ fs_info->quota_root =NULL ; fs_info->qgroup_flags &= ~BTRFS_QGROUP_STATUS_FLAG_ON ; fs_info->qgroup_flags &= ~BTRFS_QGROUP_STATUS_FLAG_SIMPLE_MODE ; - fs_info->qgroup_drop_subtree_thres =BTRFS_MAX_LEVEL ; + fs_info->qgroup_drop_subtree_thres =BTRFS_QGROUP_DROP_SUBTREE_THRES_DEFAULT ;spin_unlock (&fs_info->qgroup_lock);btrfs_free_qgroup_config (fs_info);
fs/btrfs/qgroup.h +2 -0
@@ -121,6 +121,8 @@ struct btrfs_inode;#define BTRFS_QGROUP_RUNTIME_FLAG_CANCEL_RESCAN (1ULL << 63)#define BTRFS_QGROUP_RUNTIME_FLAG_NO_ACCOUNTING (1ULL << 62) +#define BTRFS_QGROUP_DROP_SUBTREE_THRES_DEFAULT (3) +/* * Record a dirty extent, and info qgroup to update quota on it */
Greg Kroah-Hartman
maintainerPATCH 202/261 btrfs: clear force-compress on remount when compress mount option is given
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
commit 3510e684b8f6a569c2f8b86870da116e2ffeec2d upstream.
After the migration to use fs context for processing mount options we had a slight change in the semantics for remounting a filesystem that was mounted with compress-force. Before we could clear compress-force by passing only "-o compress[=algo]" during a remount, but after that change that does not work anymore, force-compress is still present and one needs to pass "-o compress-force=no,compress[=algo]" to the mount command.
Example, when running on a kernel 6.8+:
$ mount -o compress-force=zlib:9 /dev/sdi /mnt/sdi $ mount | grep sdi /dev/sdi on /mnt/sdi type btrfs (rw,relatime,compress-force=zlib:9,discard=async,space_cache=v2,subvolid=5,subvol=/)
$ mount -o remount,compress=zlib:5 /mnt/sdi $ mount | grep sdi /dev/sdi on /mnt/sdi type btrfs (rw,relatime,compress-force=zlib:5,discard=async,space_cache=v2,subvolid=5,subvol=/)
On a 6.7 kernel (or older):
$ mount -o compress-force=zlib:9 /dev/sdi /mnt/sdi $ mount | grep sdi /dev/sdi on /mnt/sdi type btrfs (rw,relatime,compress-force=zlib:9,discard=async,space_cache=v2,subvolid=5,subvol=/)
$ mount -o remount,compress=zlib:5 /mnt/sdi $ mount | grep sdi /dev/sdi on /mnt/sdi type btrfs (rw,relatime,compress=zlib:5,discard=async,space_cache=v2,subvolid=5,subvol=/)
So update btrfs_parse_param() to clear "compress-force" when "compress" is given, providing the same semantics as kernel 6.7 and older.
--- fs/btrfs/super.c | 9 +++++++++ 1 file changed, 9 insertions(+)
fs/btrfs/super.c +9 -0
@@ -340,6 +340,15 @@ static int btrfs_parse_param(struct fs_context *fc, struct fs_parameter *param) fallthrough;case Opt_compress:case Opt_compress_type: +/* +* Provide the same semantics as older kernels that don't use fs +* context, specifying the "compress" option clears +* "force-compress" without the need to pass +* "compress-force=[no|none]" before specifying "compress". +*/ +if (opt != Opt_compress_force && opt != Opt_compress_force_type) +btrfs_clear_opt (ctx->mount_opt,FORCE_COMPRESS ); +if (opt == Opt_compress || opt == Opt_compress_force) { ctx->compress_type =BTRFS_COMPRESS_ZLIB ; ctx->compress_level =BTRFS_ZLIB_DEFAULT_LEVEL ;
Signature · 1 line
2.47.0
Greg Kroah-Hartman
maintainerPATCH 203/261 btrfs: fix passing 0 to ERR_PTR in btrfs_search_dir_index_item()
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yue Haibing <[email protected]>
commit 75f49c3dc7b7423d3734f2e4dabe3dac8d064338 upstream.
The ret may be zero in btrfs_search_dir_index_item() and should not passed to ERR_PTR(). Now btrfs_unlink_subvol() is the only caller to this, reconstructed it to check ERR_PTR(-ENOENT) while ret >= 0.
This fixes smatch warnings:
fs/btrfs/dir-item.c:353
btrfs_search_dir_index_item() warn: passing zero to 'ERR_PTR'
--- fs/btrfs/dir-item.c | 4 ++-- fs/btrfs/inode.c | 7 ++----- 2 files changed, 4 insertions(+), 7 deletions(-)
fs/btrfs/dir-item.c +2 -2
@@ -347,8 +347,8 @@ btrfs_search_dir_index_item(struct btrfsreturn di; }/* Adjust return code if the key was not found in the next leaf. */ -if (ret >0 ) - ret =0 ; +if (ret >=0 ) + ret = -ENOENT ;return ERR_PTR (ret); }
fs/btrfs/inode.c +2 -5
@@ -4339,11 +4339,8 @@ static int btrfs_unlink_subvol(struct bt*/ if (btrfs_ino (inode) ==BTRFS_EMPTY_SUBVOL_DIR_OBJECTID ) { di =btrfs_search_dir_index_item (root, path, dir_ino, &fname.disk_name); -if (IS_ERR_OR_NULL (di)) { -if (!di) - ret = -ENOENT ; -else - ret =PTR_ERR (di); +if (IS_ERR (di)) { + ret =PTR_ERR (di);btrfs_abort_transaction (trans, ret); goto out; }
Greg Kroah-Hartman
maintainerPATCH 204/261 x86/amd_nb: Add new PCI IDs for AMD family 1Ah model 60h-70h
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Richard Gong <[email protected]>
commit 0f70fdd42559b4eed8f74bf7389656a8ae3eb5c3 upstream.
Add new PCI IDs for Device 18h and Function 4 to enable the amd_atl driver on those systems.
--- arch/x86/kernel/amd_nb.c | 4 ++++ 1 file changed, 4 insertions(+)
arch/x86/kernel/amd_nb.c +4 -0
@@ -44,6 +44,8 @@#define PCI_DEVICE_ID_AMD_19H_M70H_DF_F4 0x14f4#define PCI_DEVICE_ID_AMD_19H_M78H_DF_F4 0x12fc#define PCI_DEVICE_ID_AMD_1AH_M00H_DF_F4 0x12c4 +#define PCI_DEVICE_ID_AMD_1AH_M60H_DF_F4 0x124c +#define PCI_DEVICE_ID_AMD_1AH_M70H_DF_F4 0x12bc#define PCI_DEVICE_ID_AMD_MI200_DF_F4 0x14d4#define PCI_DEVICE_ID_AMD_MI300_DF_F4 0x152c
@@ -125,6 +127,8 @@ static const struct pci_device_id amd_nb { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_19H_M78H_DF_F4) }, { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CNB17H_F4) }, { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_1AH_M00H_DF_F4) }, + { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_1AH_M60H_DF_F4) }, + { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_1AH_M70H_DF_F4) }, { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_MI200_DF_F4) }, { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_MI300_DF_F4) }, {}
Greg Kroah-Hartman
maintainerPATCH 205/261 x86/amd_nb: Add new PCI ID for AMD family 1Ah model 20h
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Richard Gong <[email protected]>
commit f8bc84b6096f1ffa67252f0f88d86e77f6bbe348 upstream.
Add new PCI ID for Device 18h and Function 4.
--- arch/x86/kernel/amd_nb.c | 2 ++ 1 file changed, 2 insertions(+)
arch/x86/kernel/amd_nb.c +2 -0
@@ -44,6 +44,7 @@#define PCI_DEVICE_ID_AMD_19H_M70H_DF_F4 0x14f4#define PCI_DEVICE_ID_AMD_19H_M78H_DF_F4 0x12fc#define PCI_DEVICE_ID_AMD_1AH_M00H_DF_F4 0x12c4 +#define PCI_DEVICE_ID_AMD_1AH_M20H_DF_F4 0x16fc#define PCI_DEVICE_ID_AMD_1AH_M60H_DF_F4 0x124c#define PCI_DEVICE_ID_AMD_1AH_M70H_DF_F4 0x12bc#define PCI_DEVICE_ID_AMD_MI200_DF_F4 0x14d4
@@ -127,6 +128,7 @@ static const struct pci_device_id amd_nb { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_19H_M78H_DF_F4) }, { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CNB17H_F4) }, { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_1AH_M00H_DF_F4) }, + { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_1AH_M20H_DF_F4) }, { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_1AH_M60H_DF_F4) }, { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_1AH_M70H_DF_F4) }, { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_MI200_DF_F4) },
Greg Kroah-Hartman
maintainerPATCH 206/261 perf/x86/rapl: Fix the energy-pkg event for AMD CPUs
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dhananjay Ugwekar <[email protected]>
commit 8d72eba1cf8cecd76a2b4c1dd7673c2dc775f514 upstream.
After commit:
63edbaa48a57 ("x86/cpu/topology: Add support for the AMD 0x80000026 leaf")
... on AMD processors that support extended CPUID leaf 0x80000026, the topology_die_cpumask() and topology_logical_die_id() macros no longer return the package cpumask and package ID, instead they return the CCD (Core Complex Die) mask and ID respectively.
This leads to the energy-pkg event scope to be modified to CCD instead of package.
So, change the PMU scope for AMD and Hygon back to package.
On a 12 CCD 1 Package AMD Zen4 Genoa machine:
Before:
$ cat /sys/devices/power/cpumask 0,8,16,24,32,40,48,56,64,72,80,88.
The expected cpumask here is supposed to be just "0", as it is a package scope event, only one CPU will be collecting the event for all the CPUs in the package.
After:
$ cat /sys/devices/power/cpumask 0
[ mingo: Cleaned up the changelog ]
--- arch/x86/events/rapl.c | 47 ++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 42 insertions(+), 5 deletions(-)
arch/x86/events/rapl.c +42 -5
@@ -103,6 +103,19 @@ static struct perf_pmu_events_attr event .event_str = str, \ }; +/* +* RAPL Package energy counter scope: +* 1. AMD/HYGON platforms have a per-PKG package energy counter +* 2. For Intel platforms +* 2.1. CLX-AP is multi-die and its RAPL MSRs are die-scope +* 2.2. Other Intel platforms are single die systems so the scope can be +* considered as either pkg-scope or die-scope, and we are considering +* them as die-scope. +*/ +#define rapl_pmu_is_pkg_scope () \ + (boot_cpu_data.x86_vendor == X86_VENDOR_AMD || \ + boot_cpu_data.x86_vendor == X86_VENDOR_HYGON) +struct rapl_pmu {raw_spinlock_t lock;int n_active;
@@ -140,9 +153,25 @@ static unsigned int rapl_cntr_mask;static u64 rapl_timer_ms;static struct perf_msr *rapl_msrs; +/* +* Helper functions to get the correct topology macros according to the +* RAPL PMU scope. +*/ +static inline unsigned int get_rapl_pmu_idx (int cpu) +{ +return rapl_pmu_is_pkg_scope () ?topology_logical_package_id (cpu) : +topology_logical_die_id (cpu); +} + +static inline const struct cpumask *get_rapl_pmu_cpumask (int cpu) +{ +return rapl_pmu_is_pkg_scope () ?topology_core_cpumask (cpu) : +topology_die_cpumask (cpu); +} +static inline struct rapl_pmu *cpu_to_rapl_pmu (unsigned int cpu) { -unsigned int rapl_pmu_idx =topology_logical_die_id (cpu); +unsigned int rapl_pmu_idx =get_rapl_pmu_idx (cpu);/* * The unsigned check also catches the '-1' return value for non
@@ -552,7 +581,7 @@ static int rapl_cpu_offline(unsigned int pmu->cpu =-1 ;/* Find a new cpu to collect rapl events */ - target =cpumask_any_but (topology_die_cpumask (cpu), cpu); + target =cpumask_any_but (get_rapl_pmu_cpumask (cpu), cpu);/* Migrate rapl events to the new target */ if (target < nr_cpu_ids) {
@@ -565,6 +594,11 @@ static int rapl_cpu_offline(unsigned intstatic int rapl_cpu_online (unsigned int cpu) { +s32 rapl_pmu_idx =get_rapl_pmu_idx (cpu); +if (rapl_pmu_idx <0 ) { +pr_err ("topology_logical_(package/die)_id() returned a negative value" ); +return -EINVAL ; + }struct rapl_pmu *pmu =cpu_to_rapl_pmu (cpu);int target;
@@ -579,14 +613,14 @@ static int rapl_cpu_online(unsigned int pmu->timer_interval =ms_to_ktime (rapl_timer_ms);rapl_hrtimer_init (pmu); - rapl_pmus->pmus[topology_logical_die_id (cpu)] = pmu; + rapl_pmus->pmus[rapl_pmu_idx] = pmu; }/* * Check if there is an online cpu in the package which collects rapl * events already. */ - target =cpumask_any_and (&rapl_cpu_mask,topology_die_cpumask (cpu)); + target =cpumask_any_and (&rapl_cpu_mask,get_rapl_pmu_cpumask (cpu));if (target < nr_cpu_ids)return 0 ;
@@ -675,7 +709,10 @@ static const struct attribute_group *rapstatic int __init init_rapl_pmus (void ) { -int nr_rapl_pmu =topology_max_packages () *topology_max_dies_per_package (); +int nr_rapl_pmu =topology_max_packages (); + +if (!rapl_pmu_is_pkg_scope ()) + nr_rapl_pmu *=topology_max_dies_per_package (); rapl_pmus =kzalloc (struct_size (rapl_pmus, pmus, nr_rapl_pmu),GFP_KERNEL );if (!rapl_pmus)
Greg Kroah-Hartman
maintainerPATCH 207/261 btrfs: reject ro->rw reconfiguration if there are hard ro requirements
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qu Wenruo <[email protected]>
commit 3c36a72c1d27de6618c1c480c793d9924640f5bb upstream.
[BUG]
Syzbot reports the following crash:
BTRFS info (device loop0 state MCS): disabling free space tree
BTRFS info (device loop0 state MCS): clearing compat-ro feature flag for FREE_SPACE_TREE (0x1) BTRFS info (device loop0 state MCS): clearing compat-ro feature flag for FREE_SPACE_TREE_VALID (0x2)
Oops: general protection fault, probably for non-canonical address 0xdffffc0000000003: 0000 [#1] PREEMPT SMP KASAN NOPTI KASAN: null-ptr-deref in range [0x0000000000000018-0x000000000000001f] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014 RIP: 0010:backup_super_roots fs/btrfs/disk-io.c:1691 [inline] RIP: 0010:write_all_supers+0x97a/0x40f0 fs/btrfs/disk-io.c:4041 Call Trace: <TASK> btrfs_commit_transaction+0x1eae/0x3740 fs/btrfs/transaction.c:2530 btrfs_delete_free_space_tree+0x383/0x730 fs/btrfs/free-space-tree.c:1312 btrfs_start_pre_rw_mount+0xf28/0x1300 fs/btrfs/disk-io.c:3012 btrfs_remount_rw fs/btrfs/super.c:1309 [inline] btrfs_reconfigure+0xae6/0x2d40 fs/btrfs/super.c:1534 btrfs_reconfigure_for_mount fs/btrfs/super.c:2020 [inline] btrfs_get_tree_subvol fs/btrfs/super.c:2079 [inline] btrfs_get_tree+0x918/0x1920 fs/btrfs/super.c:2115 vfs_get_tree+0x90/0x2b0 fs/super.c:1800 do_new_mount+0x2be/0xb40 fs/namespace.c:3472 do_mount fs/namespace.c:3812 [inline] __do_sys_mount fs/namespace.c:4020 [inline] __se_sys_mount+0x2d6/0x3c0 fs/namespace.c:3997 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f
[CAUSE]
To support mounting different subvolume with different RO/RW flags for the new mount APIs, btrfs introduced two workaround to support this feature:
- Skip mount option/feature checks if we are mounting a different subvolume
- Reconfigure the fs to RW if the initial mount is RO
Combining these two, we can have the following sequence:
- Mount the fs ro,rescue=all,clear_cache,space_cache=v1 rescue=all will mark the fs as hard read-only, so no v2 cache clearing will happen.
- Mount a subvolume rw of the same fs.
We go into btrfs_get_tree_subvol(), but fc_mount() returns EBUSY because our new fc is RW, different from the original fs.
Now we enter btrfs_reconfigure_for_mount(), which switches the RO flag first so that we can grab the existing fs_info.
Then we reconfigure the fs to RW.
- During reconfiguration, option/features check is skipped This means we will restart the v2 cache clearing, and convert back to v1 cache.
This will trigger fs writes, and since the original fs has "rescue=all" option, it skips the csum tree read.
And eventually causing NULL pointer dereference in super block writeback.
[FIX]
For reconfiguration caused by different subvolume RO/RW flags, ensure we always run btrfs_check_options() to ensure we have proper hard RO requirements met.
In fact the function btrfs_check_options() doesn't really do many complex checks, but hard RO requirement and some feature dependency checks, thus there is no special reason not to do the check for mount reconfiguration.
--- fs/btrfs/super.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
fs/btrfs/super.c +1 -2
@@ -1507,8 +1507,7 @@ static int btrfs_reconfigure(struct fs_context *fc)sync_filesystem (sb);set_bit (BTRFS_FS_STATE_REMOUNTING , &fs_info->fs_state); -if (!mount_reconfigure && - !btrfs_check_options (fs_info, &ctx->mount_opt, fc->sb_flags)) +if (!btrfs_check_options (fs_info, &ctx->mount_opt, fc->sb_flags))return -EINVAL ; ret =btrfs_check_features (fs_info, !(fc->sb_flags &SB_RDONLY ));
Signature · 1 line
2.47.0
Greg Kroah-Hartman
maintainerPATCH 208/261 btrfs: zoned: fix zone unusable accounting for freed reserved extent
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Naohiro Aota <[email protected]>
commit bf9821ba4792a0d9a2e72803ae7b4341faf3d532 upstream.
When btrfs reserves an extent and does not use it (e.g, by an error), it calls btrfs_free_reserved_extent() to free the reserved extent. In the process, it calls btrfs_add_free_space() and then it accounts the region bytes as block_group->zone_unusable.
However, it leaves the space_info->bytes_zone_unusable side not updated. As a result, ENOSPC can happen while a space_info reservation succeeded. The reservation is fine because the freed region is not added in space_info->bytes_zone_unusable, leaving that space as "free". OTOH, corresponding block group counts it as zone_unusable and its allocation pointer is not rewound, we cannot allocate an extent from that block group. That will also negate space_info's async/sync reclaim process, and cause an ENOSPC error from the extent allocation process.
Fix that by returning the space to space_info->bytes_zone_unusable. Ideally, since a bio is not submitted for this reserved region, we should return the space to free space and rewind the allocation pointer. But, it needs rework on extent allocation handling, so let it work in this way for now.
--- fs/btrfs/block-group.c | 2 ++ 1 file changed, 2 insertions(+)
fs/btrfs/block-group.c +2 -0
@@ -3819,6 +3819,8 @@ void btrfs_free_reserved_bytes(struct btspin_lock (&cache->lock);if (cache->ro) space_info->bytes_readonly += num_bytes; +else if (btrfs_is_zoned (cache->fs_info)) + space_info->bytes_zone_unusable += num_bytes; cache->reserved -= num_bytes; space_info->bytes_reserved -= num_bytes; space_info->max_extent_size =0 ;
Greg Kroah-Hartman
maintainerPATCH 209/261 btrfs: fix read corruption due to race with extent map merging
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Boris Burkov <[email protected]>
commit 7a2339058ed71f54c1e12e1b3c25aab1b1ba7943 upstream.
In debugging some corrupt squashfs files, we observed symptoms of corrupt page cache pages but correct on-disk contents. Further investigation revealed that the exact symptom was a correct page followed by an incorrect, duplicate, page. This got us thinking about extent maps.
commit ac05ca913e9f ("Btrfs: fix race between using extent maps and merging them") enforces a reference count on the primary em extent_map being merged, as that one gets modified.
However, since,
commit 3d2ac9922465 ("btrfs: introduce new members for extent_map") both 'em' and 'merge' get modified, which started modifying 'merge' and thus introduced the same race.
We were able to reproduce this by looping the affected squashfs workload in parallel on a bunch of separate btrfs-es while also dropping caches. We are still working on a simple enough reproducer to make into an fstest.
The simplest fix is to stop modifying 'merge', which is not essential, as it is dropped immediately after the merge. This behavior is simply a consequence of the order of the two extent maps being important in computing the new values. Modify merge_ondisk_extents to take prev and next by const* and also take a third merged parameter that it puts the results in. Note that this introduces the rather odd behavior of passing 'em' to merge_ondisk_extents as a const * and as a regular ptr.
--- fs/btrfs/extent_map.c | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-)
fs/btrfs/extent_map.c +16 -15
@@ -240,13 +240,19 @@ static bool mergeable_maps(const struct/* * Handle the on-disk data extents merge for @prev and @next. * +* @prev: left extent to merge +* @next: right extent to merge +* @merged: the extent we will not discard after the merge; updated with new values +* +* After this, one of the two extents is the new merged extent and the other is +* removed from the tree and likely freed. Note that @merged is one of @prev/@next +* so there is const/non-const aliasing occurring here. +* * Only touches disk_bytenr/disk_num_bytes/offset/ram_bytes. * For now only uncompressed regular extent can be merged. -* -* @prev and @next will be both updated to point to the new merged range. -* Thus one of them should be removed by the caller. */ -static void merge_ondisk_extents (struct extent_map *prev,struct extent_map *next) +static void merge_ondisk_extents (const struct extent_map *prev,const struct extent_map *next, +struct extent_map *merged) {u64 new_disk_bytenr;u64 new_disk_num_bytes;
@@ -281,15 +287,10 @@ static void merge_ondisk_extents(struct new_disk_bytenr; new_offset = prev->disk_bytenr + prev->offset - new_disk_bytenr; - prev->disk_bytenr = new_disk_bytenr; - prev->disk_num_bytes = new_disk_num_bytes; - prev->ram_bytes = new_disk_num_bytes; - prev->offset = new_offset; - - next->disk_bytenr = new_disk_bytenr; - next->disk_num_bytes = new_disk_num_bytes; - next->ram_bytes = new_disk_num_bytes; - next->offset = new_offset; + merged->disk_bytenr = new_disk_bytenr; + merged->disk_num_bytes = new_disk_num_bytes; + merged->ram_bytes = new_disk_num_bytes; + merged->offset = new_offset; } static void dump_extent_map(struct btrfs_fs_info *fs_info, const char *prefix,
@@ -358,7 +359,7 @@ static void try_merge_map(struct btrfs_i em->generation =max (em->generation, merge->generation);if (em->disk_bytenr <EXTENT_MAP_LAST_BYTE ) -merge_ondisk_extents (merge, em); +merge_ondisk_extents (merge, em, em); em->flags |=EXTENT_FLAG_MERGED ;validate_extent_map (fs_info, em);
@@ -375,7 +376,7 @@ static void try_merge_map(struct btrfs_iif (rb &&can_merge_extent_map (merge) &&mergeable_maps (em, merge)) { em->len += merge->len;if (em->disk_bytenr <EXTENT_MAP_LAST_BYTE ) -merge_ondisk_extents (em, merge); +merge_ondisk_extents (em, merge, em);validate_extent_map (fs_info, em);rb_erase (&merge->rb_node, &tree->root);RB_CLEAR_NODE (&merge->rb_node);
Greg Kroah-Hartman
maintainerPATCH 210/261 drm/amd: Guard against bad data for ATIF ACPI method
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mario Limonciello <[email protected]>
commit bf58f03931fdcf7b3c45cb76ac13244477a60f44 upstream.
If a BIOS provides bad data in response to an ATIF method call this causes a NULL pointer dereference in the caller.
``` ? show_regs (arch/x86/kernel/dumpstack.c:478 (discriminator 1)) ? __die (arch/x86/kernel/dumpstack.c:423 arch/x86/kernel/dumpstack.c:434) ? page_fault_oops (arch/x86/mm/fault.c:544 (discriminator 2) arch/x86/mm/fault.c:705 (discriminator 2)) ? do_user_addr_fault (arch/x86/mm/fault.c:440 (discriminator 1) arch/x86/mm/fault.c:1232 (discriminator 1)) ? acpi_ut_update_object_reference (drivers/acpi/acpica/utdelete.c:642) ? exc_page_fault (arch/x86/mm/fault.c:1542) ? asm_exc_page_fault (./arch/x86/include/asm/idtentry.h:623) ? amdgpu_atif_query_backlight_caps.constprop.0 (drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c:387 (discriminator 2)) amdgpu ? amdgpu_atif_query_backlight_caps.constprop.0 (drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c:386 (discriminator 1)) amdgpu ```
It has been encountered on at least one system, so guard for it.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +12 -3
@@ -147,6 +147,7 @@ static union acpi_object *amdgpu_atif_ca struct acpi_buffer *params) {acpi_status status; +union acpi_object *obj;union acpi_object atif_arg_elements[2 ];struct acpi_object_list atif_arg;struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER ,NULL };
@@ -169,16 +170,24 @@ static union acpi_object *amdgpu_atif_ca status =acpi_evaluate_object (atif->handle,NULL , &atif_arg, &buffer); + obj = (union acpi_object *)buffer.pointer; -/* Fail only if calling the method fails and ATIF is supported */ +/* Fail if calling the method fails and ATIF is supported */ if (ACPI_FAILURE (status) && status !=AE_NOT_FOUND ) {DRM_DEBUG_DRIVER ("failed to evaluate ATIF got %s\n" ,acpi_format_exception (status)); -kfree (buffer.pointer); +kfree (obj);return NULL ; } -return buffer.pointer; +if (obj->type !=ACPI_TYPE_BUFFER ) { +DRM_DEBUG_DRIVER ("bad object returned from ATIF: %d\n" , + obj->type); +kfree (obj); +return NULL ; + } + +return obj; }/**
Greg Kroah-Hartman
maintainerPATCH 211/261 ACPI: resource: Add LG 16T90SP to irq1_level_low_skip_override[]
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian Heusel <[email protected]>
commit 53f1a907d36fb3aa02a4d34073bcec25823a6c74 upstream.
The LG Gram Pro 16 2-in-1 (2024) the 16T90SP has its keybopard IRQ (1) described as ActiveLow in the DSDT, which the kernel overrides to EdgeHigh which breaks the keyboard.
Add the 16T90SP to the irq1_level_low_skip_override[] quirk table to fix this.
--- drivers/acpi/resource.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/acpi/resource.c +7 -0
@@ -538,6 +538,13 @@ static const struct dmi_system_id irq1_l DMI_MATCH(DMI_BOARD_NAME, "17U70P"), }, }, + { + /* LG Electronics 16T90SP */ + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "LG Electronics"), + DMI_MATCH(DMI_BOARD_NAME, "16T90SP"), + }, + }, { } };
Greg Kroah-Hartman
maintainerPATCH 212/261 ACPI: PRM: Find EFI_MEMORY_RUNTIME block for PRM handler and context
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Koba Ko <[email protected]>
commit 088984c8d54c0053fc4ae606981291d741c5924b upstream.
PRMT needs to find the correct type of block to translate the PA-VA mapping for EFI runtime services.
The issue arises because the PRMT is finding a block of type EFI_CONVENTIONAL_MEMORY, which is not appropriate for runtime services as described in Section 2.2.2 (Runtime Services) of the UEFI Specification [1]. Since the PRM handler is a type of runtime service, this causes an exception when the PRM handler is called.
[Firmware Bug]: Unable to handle paging request in EFI runtime service
WARNING: CPU: 22 PID: 4330 at drivers/firmware/efi/runtime-wrappers.c:341
__efi_queue_work+0x11c/0x170
Call trace:
Let PRMT find a block with EFI_MEMORY_RUNTIME for PRM handler and PRM context.
If no suitable block is found, a warning message will be printed, but the procedure continues to manage the next PRM handler.
However, if the PRM handler is actually called without proper allocation, it would result in a failure during error handling.
By using the correct memory types for runtime services, ensure that the PRM handler and the context are properly mapped in the virtual address space during runtime, preventing the paging request error.
The issue is really that only memory that has been remapped for runtime by the firmware can be used by the PRM handler, and so the region needs to have the EFI_MEMORY_RUNTIME attribute.
--- drivers/acpi/prmt.c | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-)
drivers/acpi/prmt.c +22 -5
@@ -72,17 +72,21 @@ struct prm_module_info { struct prm_handler_info handlers[] __counted_by(handler_count); }; -static u64 efi_pa_va_lookup (u64 pa) +static u64 efi_pa_va_lookup (efi_guid_t *guid,u64 pa) {efi_memory_desc_t *md;u64 pa_offset = pa & ~PAGE_MASK ;u64 page = pa &PAGE_MASK ;for_each_efi_memory_desc (md) { -if (md->phys_addr < pa && pa < md->phys_addr +PAGE_SIZE * md->num_pages) +if ((md->attribute &EFI_MEMORY_RUNTIME ) && + (md->phys_addr < pa && pa < md->phys_addr +PAGE_SIZE * md->num_pages)) {return pa_offset + md->virt_addr + page - md->phys_addr; + } } +pr_warn ("Failed to find VA for GUID: %pUL, PA: 0x%llx" , guid, pa); +return 0 ; }
@@ -148,9 +152,15 @@ acpi_parse_prmt(union acpi_subtable_head th = &tm->handlers[cur_handler];guid_copy (&th->guid, (guid_t *)handler_info->handler_guid); - th->handler_addr = (void *)efi_pa_va_lookup (handler_info->handler_address); - th->static_data_buffer_addr =efi_pa_va_lookup (handler_info->static_data_buffer_address); - th->acpi_param_buffer_addr =efi_pa_va_lookup (handler_info->acpi_param_buffer_address); + th->handler_addr = + (void *)efi_pa_va_lookup (&th->guid, handler_info->handler_address); + + th->static_data_buffer_addr = +efi_pa_va_lookup (&th->guid, handler_info->static_data_buffer_address); + + th->acpi_param_buffer_addr = +efi_pa_va_lookup (&th->guid, handler_info->acpi_param_buffer_address); + }while (++cur_handler < tm->handler_count && (handler_info =get_next_handler (handler_info)));return 0 ;
@@ -253,6 +263,13 @@ static acpi_status acpi_platformrt_spaceif (!handler || !module) goto invalid_guid; +if (!handler->handler_addr || + !handler->static_data_buffer_addr || + !handler->acpi_param_buffer_addr) { + buffer->prm_status =PRM_HANDLER_ERROR ; +return AE_OK ; + } +ACPI_COPY_NAMESEG (context.signature,"PRMC" ); context.revision =0x0 ; context.reserved =0x0 ;
Greg Kroah-Hartman
maintainerPATCH 213/261 ACPI: button: Add DMI quirk for Samsung Galaxy Book2 to fix initial lid detection issue
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shubham Panwar <[email protected]>
commit 8fa73ee44daefc884c53a25158c25a4107eb5a94 upstream.
Add a DMI quirk for Samsung Galaxy Book2 to fix an initial lid state detection issue.
The _LID device incorrectly returns the lid status as "closed" during boot, causing the system to enter a suspend loop right after booting.
The quirk ensures that the correct lid state is reported initially, preventing the system from immediately suspending after startup. It only addresses the initial lid state detection and ensures proper system behavior upon boot.
--- drivers/acpi/button.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/acpi/button.c +11 -0
@@ -130,6 +130,17 @@ static const struct dmi_system_id dmi_li }, .driver_data = (void *)(long)ACPI_BUTTON_LID_INIT_OPEN, }, + { + /* + * Samsung galaxybook2 ,initial _LID device notification returns + * lid closed. + */ + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."), + DMI_MATCH(DMI_PRODUCT_NAME, "750XED"), + }, + .driver_data = (void *)(long)ACPI_BUTTON_LID_INIT_OPEN, + }, {} };
Greg Kroah-Hartman
maintainerPATCH 214/261 nilfs2: fix kernel bug due to missing clearing of buffer delay flag
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ryusuke Konishi <[email protected]>
commit 6ed469df0bfbef3e4b44fca954a781919db9f7ab upstream.
Syzbot reported that after nilfs2 reads a corrupted file system image and degrades to read-only, the BUG_ON check for the buffer delay flag in submit_bh_wbc() may fail, causing a kernel bug.
This is because the buffer delay flag is not cleared when clearing the buffer state flags to discard a page/folio or a buffer head. So, fix this.
This became necessary when the use of nilfs2's own page clear routine was expanded. This state inconsistency does not occur if the buffer is written normally by log writing.
--- fs/nilfs2/page.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
fs/nilfs2/page.c +4 -2
@@ -77,7 +77,8 @@ void nilfs_forget_buffer(struct buffer_hconst unsigned long clear_bits = (BIT (BH_Uptodate) |BIT (BH_Dirty) |BIT (BH_Mapped) |BIT (BH_Async_Write) |BIT (BH_NILFS_Volatile) | -BIT (BH_NILFS_Checked) |BIT (BH_NILFS_Redirected)); +BIT (BH_NILFS_Checked) |BIT (BH_NILFS_Redirected) | +BIT (BH_Delay));lock_buffer (bh);set_mask_bits (&bh->b_state, clear_bits,0 );
@@ -414,7 +415,8 @@ void nilfs_clear_folio_dirty(struct foliconst unsigned long clear_bits = (BIT (BH_Uptodate) |BIT (BH_Dirty) |BIT (BH_Mapped) |BIT (BH_Async_Write) |BIT (BH_NILFS_Volatile) | -BIT (BH_NILFS_Checked) |BIT (BH_NILFS_Redirected)); +BIT (BH_NILFS_Checked) |BIT (BH_NILFS_Redirected) | +BIT (BH_Delay)); bh = head; do {
Greg Kroah-Hartman
maintainerPATCH 215/261 fs: dont try and remove empty rbtree node
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian Brauner <[email protected]>
commit 229fd15908fe1f99b1de4cde3326e62d1e892611 upstream.
When copying a namespace we won't have added the new copy into the namespace rbtree until after the copy succeeded. Calling free_mnt_ns() will try to remove the copy from the rbtree which is invalid. Simply free the namespace skeleton directly.
--- fs/namespace.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/namespace.c +3 -1
@@ -3917,7 +3917,9 @@ struct mnt_namespace *copy_mnt_ns(unsign new =copy_tree (old, old->mnt.mnt_root, copy_flags);if (IS_ERR (new)) {namespace_unlock (); -free_mnt_ns (new_ns); +ns_free_inum (&new_ns->ns); +dec_mnt_namespaces (new_ns->ucounts); +mnt_ns_release (new_ns);return ERR_CAST (new); }if (user_ns != ns->user_ns) {
Greg Kroah-Hartman
maintainerPATCH 216/261 xfs: dont fail repairs on metadata files with no attr fork
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Darrick J. Wong <[email protected]>
commit af8512c5277d17aae09be5305daa9118d2fa8881 upstream.
Fix a minor bug where we fail repairs on metadata files that do not have attr forks because xrep_metadata_inode_subtype doesn't filter ENOENT.
--- fs/xfs/scrub/repair.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
fs/xfs/scrub/repair.c +5 -3
@@ -1084,9 +1084,11 @@ xrep_metadata_inode_forks(return error;/* Make sure the attr fork looks ok before we delete it. */ - error =xrep_metadata_inode_subtype (sc,XFS_SCRUB_TYPE_BMBTA ); -if (error) -return error; +if (xfs_inode_hasattr (sc->ip)) { + error =xrep_metadata_inode_subtype (sc,XFS_SCRUB_TYPE_BMBTA ); +if (error) +return error; + }/* Clear the reflink flag since metadata never shares. */ if (xfs_is_reflink_inode (sc->ip)) {
Greg Kroah-Hartman
maintainerPATCH 217/261 openat2: explicitly return -E2BIG for (usize > PAGE_SIZE)
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aleksa Sarai <[email protected]>
commit f92f0a1b05698340836229d791b3ffecc71b265a upstream.
While we do currently return -EFAULT in this case, it seems prudent to follow the behaviour of other syscalls like clone3. It seems quite unlikely that anyone depends on this error code being EFAULT, but we can always revert this if it turns out to be an issue.
--- fs/open.c | 2 ++ 1 file changed, 2 insertions(+)
fs/open.c +2 -0
@@ -1458,6 +1458,8 @@ SYSCALL_DEFINE4(openat2, int, dfd, constif (unlikely (usize <OPEN_HOW_SIZE_VER0 ))return -EINVAL ; +if (unlikely (usize >PAGE_SIZE )) +return -E2BIG ; err =copy_struct_from_user (&tmp,sizeof (tmp), how, usize);if (err)
Greg Kroah-Hartman
maintainerPATCH 218/261 KVM: nSVM: Ignore nCR3[4:0] when loading PDPTEs from memory
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Christopherson <[email protected]>
commit f559b2e9c5c5308850544ab59396b7d53cfc67bd upstream.
Ignore nCR3[4:0] when loading PDPTEs from memory for nested SVM, as bits 4:0 of CR3 are ignored when PAE paging is used, and thus VMRUN doesn't enforce 32-byte alignment of nCR3.
In the absolute worst case scenario, failure to ignore bits 4:0 can result in an out-of-bounds read, e.g. if the target page is at the end of a memslot, and the VMM isn't using guard pages.
Per the APM:
The CR3 register points to the base address of the page-directory-pointer table. The page-directory-pointer table is aligned on a 32-byte boundary, with the low 5 address bits 4:0 assumed to be 0.
And the SDM's much more explicit:
4:0 Ignored
Note, KVM gets this right when loading PDPTRs, it's only the nSVM flow that is broken.
Message-ID: <[email protected]>
--- arch/x86/kvm/svm/nested.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
arch/x86/kvm/svm/nested.c +5 -1
@@ -63,8 +63,12 @@ static u64 nested_svm_get_tdp_pdptr(struu64 pdpte;int ret; +/* +* Note, nCR3 is "assumed" to be 32-byte aligned, i.e. the CPU ignores +* nCR3[4:0] when loading PDPTEs from memory. +*/ ret =kvm_vcpu_read_guest_page (vcpu,gpa_to_gfn (cr3), &pdpte, -offset_in_page (cr3) + index *8 ,8 ); + (cr3 &GENMASK (11 ,5 )) + index *8 ,8 );if (ret)return 0 ;return pdpte;
Greg Kroah-Hartman
maintainerPATCH 219/261 KVM: arm64: Unregister redistributor for failed vCPU creation
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oliver Upton <[email protected]>
commit ae8f8b37610269009326f4318df161206c59843e upstream.
Alex reports that syzkaller has managed to trigger a use-after-free when tearing down a VM:
BUG: KASAN: slab-use-after-free in kvm_put_kvm+0x300/0xe68 virt/kvm/kvm_main.c:5769 Read of size 8 at addr ffffff801c6890d0 by task syz.3.2219/10758 CPU: 3 UID: 0 PID: 10758 Comm: syz.3.2219 Not tainted 6.11.0-rc6-dirty #64 Hardware name: linux,dummy-virt (DT) Call trace: dump_backtrace+0x17c/0x1a8 arch/arm64/kernel/stacktrace.c:317 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:324 __dump_stack lib/dump_stack.c:93 [inline] dump_stack_lvl+0x94/0xc0 lib/dump_stack.c:119 print_report+0x144/0x7a4 mm/kasan/report.c:377 kasan_report+0xcc/0x128 mm/kasan/report.c:601 __asan_report_load8_noabort+0x20/0x2c mm/kasan/report_generic.c:381 kvm_put_kvm+0x300/0xe68 virt/kvm/kvm_main.c:5769 kvm_vm_release+0x4c/0x60 virt/kvm/kvm_main.c:1409 __fput+0x198/0x71c fs/file_table.c:422 ____fput+0x20/0x30 fs/file_table.c:450 task_work_run+0x1cc/0x23c kernel/task_work.c:228 do_notify_resume+0x144/0x1a0 include/linux/resume_user_mode.h:50 el0_svc+0x64/0x68 arch/arm64/kernel/entry-common.c:169 el0t_64_sync_handler+0x90/0xfc arch/arm64/kernel/entry-common.c:730 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:598
Upon closer inspection, it appears that we do not properly tear down the MMIO registration for a vCPU that fails creation late in the game, e.g. a vCPU w/ the same ID already exists in the VM.
It is important to consider the context of commit that introduced this bug by moving the unregistration out of __kvm_vgic_vcpu_destroy(). That change correctly sought to avoid an srcu v. config_lock inversion by breaking up the vCPU teardown into two parts, one guarded by the config_lock.
Fix the use-after-free while avoiding lock inversion by adding a special-cased unregistration to __kvm_vgic_vcpu_destroy(). This is safe because failed vCPUs are torn down outside of the config_lock.
--- arch/arm64/kvm/vgic/vgic-init.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-)
arch/arm64/kvm/vgic/vgic-init.c +21 -1
@@ -417,8 +417,28 @@ static void __kvm_vgic_vcpu_destroy(struct kvm_vcpu *vcpu)kfree (vgic_cpu->private_irqs); vgic_cpu->private_irqs =NULL ; -if (vcpu->kvm->arch.vgic.vgic_model ==KVM_DEV_TYPE_ARM_VGIC_V3 ) +if (vcpu->kvm->arch.vgic.vgic_model ==KVM_DEV_TYPE_ARM_VGIC_V3 ) { +/* +* If this vCPU is being destroyed because of a failed creation +* then unregister the redistributor to avoid leaving behind a +* dangling pointer to the vCPU struct. +* +* vCPUs that have been successfully created (i.e. added to +* kvm->vcpu_array) get unregistered in kvm_vgic_destroy(), as +* this function gets called while holding kvm->arch.config_lock +* in the VM teardown path and would otherwise introduce a lock +* inversion w.r.t. kvm->srcu. +* +* vCPUs that failed creation are torn down outside of the +* kvm->arch.config_lock and do not get unregistered in +* kvm_vgic_destroy(), meaning it is both safe and necessary to +* do so here. +*/ +if (kvm_get_vcpu_by_id (vcpu->kvm, vcpu->vcpu_id) != vcpu) +vgic_unregister_redist_iodev (vcpu); + vgic_cpu->rd_iodev.base_addr =VGIC_ADDR_UNDEF ; + } }void kvm_vgic_vcpu_destroy (struct kvm_vcpu *vcpu)
Signature · 1 line
2.47.0
Greg Kroah-Hartman
maintainerPATCH 220/261 KVM: arm64: Fix shift-out-of-bounds bug
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ilkka Koskinen <[email protected]>
commit c6c167afa090ea0451f91814e1318755a8fb8bb9 upstream.
Fix a shift-out-of-bounds bug reported by UBSAN when running VM with MTE enabled host kernel.
UBSAN: shift-out-of-bounds in arch/arm64/kvm/sys_regs.c:1988:14 shift exponent 33 is too large for 32-bit type 'int' CPU: 26 UID: 0 PID: 7629 Comm: qemu-kvm Not tainted 6.12.0-rc2 #34 Hardware name: IEI NF5280R7/Mitchell MB, BIOS 00.00. 2024-10-12 09:28:54 10/14/2024 Call trace: dump_backtrace+0xa0/0x128 show_stack+0x20/0x38 dump_stack_lvl+0x74/0x90 dump_stack+0x18/0x28 __ubsan_handle_shift_out_of_bounds+0xf8/0x1e0 reset_clidr+0x10c/0x1c8 kvm_reset_sys_regs+0x50/0x1c8 kvm_reset_vcpu+0xec/0x2b0 __kvm_vcpu_set_target+0x84/0x158 kvm_vcpu_set_target+0x138/0x168 kvm_arch_vcpu_ioctl_vcpu_init+0x40/0x2b0 kvm_arch_vcpu_ioctl+0x28c/0x4b8 kvm_vcpu_ioctl+0x4bc/0x7a8 __arm64_sys_ioctl+0xb4/0x100 invoke_syscall+0x70/0x100 el0_svc_common.constprop.0+0x48/0xf0 do_el0_svc+0x24/0x38 el0_svc+0x3c/0x158 el0t_64_sync_handler+0x120/0x130 el0t_64_sync+0x194/0x198
--- arch/arm64/kvm/sys_regs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/kvm/sys_regs.c +1 -1
@@ -1977,7 +1977,7 @@ static u64 reset_clidr(struct kvm_vcpu ** one cache line. */ if (kvm_has_mte (vcpu->kvm)) - clidr |=2 <<CLIDR_TTYPE_SHIFT (loc); + clidr |=2ULL <<CLIDR_TTYPE_SHIFT (loc);__vcpu_sys_reg (vcpu, r->reg) = clidr;
Greg Kroah-Hartman
maintainerPATCH 221/261 KVM: arm64: Dont eagerly teardown the vgic on init error
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marc Zyngier <[email protected]>
commit df5fd75ee305cb5927e0b1a0b46cc988ad8db2b1 upstream.
As there is very little ordering in the KVM API, userspace can instanciate a half-baked GIC (missing its memory map, for example) at almost any time.
This means that, with the right timing, a thread running vcpu-0 can enter the kernel without a GIC configured and get a GIC created behind its back by another thread. Amusingly, it will pick up that GIC and start messing with the data structures without the GIC having been fully initialised.
Similarly, a thread running vcpu-1 can enter the kernel, and try to init the GIC that was previously created. Since this GIC isn't properly configured (no memory map), it fails to correctly initialise.
And that's the point where we decide to teardown the GIC, freeing all its resources. Behind vcpu-0's back. Things stop pretty abruptly, with a variety of symptoms. Clearly, this isn't good, we should be a bit more careful about this.
It is obvious that this guest is not viable, as it is missing some important part of its configuration. So instead of trying to tear bits of it down, let's just mark it as *dead*. It means that any further interaction from userspace will result in -EIO. The memory will be released on the "normal" path, when userspace gives up.
--- arch/arm64/kvm/arm.c | 3 +++ arch/arm64/kvm/vgic/vgic-init.c | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-)
arch/arm64/kvm/arm.c +3 -0
@@ -996,6 +996,9 @@ static int kvm_vcpu_suspend(struct kvm_vstatic int check_vcpu_requests (struct kvm_vcpu *vcpu) {if (kvm_request_pending (vcpu)) { +if (kvm_check_request (KVM_REQ_VM_DEAD , vcpu)) +return -EIO ; +if (kvm_check_request (KVM_REQ_SLEEP , vcpu))kvm_vcpu_sleep (vcpu);
arch/arm64/kvm/vgic/vgic-init.c +3 -3
@@ -556,10 +556,10 @@ int kvm_vgic_map_resources(struct kvm *k out:mutex_unlock (&kvm->arch.config_lock); out_slots: -mutex_unlock (&kvm->slots_lock); -if (ret) -kvm_vgic_destroy (kvm); +kvm_vm_dead (kvm); + +mutex_unlock (&kvm->slots_lock);return ret; }
Greg Kroah-Hartman
maintainerPATCH 222/261 firewire: core: fix invalid port index for parent device
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Sakamoto <[email protected]>
commit f6a6780e0b9bbcf311a727afed06fee533a5e957 upstream.
In a commit 24b7f8e5cd65 ("firewire: core: use helper functions for self ID sequence"), the enumeration over self ID sequence was refactored with some helper functions with KUnit tests. These helper functions are guaranteed to work expectedly by the KUnit tests, however their application includes a mistake to assign invalid value to the index of port connected to parent device.
This bug affects the case that any extra node devices which has three or more ports are connected to 1394 OHCI controller. In the case, the path to update the tree cache could hits WARN_ON(), and gets general protection fault due to the access to invalid address computed by the invalid value.
This commit fixes the bug to assign correct port index.
--- drivers/firewire/core-topology.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/firewire/core-topology.c +1 -1
@@ -204,7 +204,7 @@ static struct fw_node *build_tree(struct fw_card *card, const u32 *sid, int self// the node->ports array where the parent node should be. Later, // when we handle the parent node, we fix up the reference. ++parent_count; - node->color = i; + node->color = port_index;break ;case PHY_PACKET_SELF_ID_PORT_STATUS_CHILD :
Signature · 1 line
2.47.0
Greg Kroah-Hartman
maintainerPATCH 223/261 x86/lam: Disable ADDRESS_MASKING in most cases
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pawan Gupta <[email protected]>
commit 3267cb6d3a174ff83d6287dcd5b0047bbd912452 upstream.
Linear Address Masking (LAM) has a weakness related to transient execution as described in the SLAM paper[1]. Unless Linear Address Space Separation (LASS) is enabled this weakness may be exploitable.
Until kernel adds support for LASS[2], only allow LAM for COMPILE_TEST, or when speculation mitigations have been disabled at compile time, otherwise keep LAM disabled.
There are no processors in market that support LAM yet, so currently nobody is affected by this issue.
[1] SLAM: https://download.vusec.net/papers/slam_sp24.pdf
[2] LASS: https://lore.kernel.org/lkml/[email protected]/
[ dhansen: update SPECULATION_MITIGATIONS -> CPU_MITIGATIONS ]
--- arch/x86/Kconfig | 1 + 1 file changed, 1 insertion(+)
arch/x86/Kconfig +1 -0
@@ -2260,6 +2260,7 @@ config RANDOMIZE_MEMORY_PHYSICAL_PADDING config ADDRESS_MASKING bool "Linear Address Masking support" depends on X86_64 + depends on COMPILE_TEST || !CPU_MITIGATIONS # wait for LASS help Linear Address Masking (LAM) modifies the checking that is applied to 64-bit linear addresses, allowing software to use of the
Greg Kroah-Hartman
maintainerPATCH 224/261 x86/sev: Ensure that RMP table fixups are reserved
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ashish Kalra <[email protected]>
commit 88a921aa3c6b006160d6a46a231b8b32227e8196 upstream.
The BIOS reserves RMP table memory via e820 reservations. This can still lead to RMP page faults during kexec if the host tries to access memory within the same 2MB region.
Commit
400fea4b9651 ("x86/sev: Add callback to apply RMP table fixups for kexec"
adjusts the e820 reservations for the RMP table so that the entire 2MB range at the start/end of the RMP table is marked reserved.
The e820 reservations are then passed to firmware via SNP_INIT where they get marked HV-Fixed.
The RMP table fixups are done after the e820 ranges have been added to memblock, allowing the fixup ranges to still be allocated and used by the system.
The problem is that this memory range is now marked reserved in the e820 tables and during SNP initialization these reserved ranges are marked as HV-Fixed. This means that the pages cannot be used by an SNP guest, only by the hypervisor.
However, the memory management subsystem does not make this distinction and can allocate one of those pages to an SNP guest. This will ultimately result in RMPUPDATE failures associated with the guest, causing it to fail to start or terminate when accessing the HV-Fixed page.
The issue is captured below with memblock=debug:
[ 0.000000] SEV-SNP: *** DEBUG: snp_probe_rmptable_info:352 - rmp_base=0x280d4800000, rmp_end=0x28357efffff ... [ 0.000000] BIOS-provided physical RAM map: ... [ 0.000000] BIOS-e820: [mem 0x00000280d4800000-0x0000028357efffff] reserved [ 0.000000] BIOS-e820: [mem 0x0000028357f00000-0x0000028357ffffff] usable ... ... [ 0.183593] memblock add: [0x0000028357f00000-0x0000028357ffffff] e820__memblock_setup+0x74/0xb0 ... [ 0.203179] MEMBLOCK configuration: [ 0.207057] memory size = 0x0000027d0d194000 reserved size = 0x0000000009ed2c00 [ 0.215299] memory.cnt = 0xb ... [ 0.311192] memory[0x9] [0x0000028357f00000-0x0000028357ffffff], 0x0000000000100000 bytes flags: 0x0 ... ... [ 0.419110] SEV-SNP: Reserving start/end of RMP table on a 2MB boundary [0x0000028357e00000] [ 0.428514] e820: update [mem 0x28357e00000-0x28357ffffff] usable ==> reserved [ 0.428517] e820: update [mem 0x28357e00000-0x28357ffffff] usable ==> reserved [ 0.428520] e820: update [mem 0x28357e00000-0x28357ffffff] usable ==> reserved ... ... [ 5.604051] MEMBLOCK configuration: [ 5.607922] memory size = 0x0000027d0d194000 reserved size = 0x0000000011faae02 [ 5.616163] memory.cnt = 0xe ... [ 5.754525] memory[0xc] [0x0000028357f00000-0x0000028357ffffff], 0x0000000000100000 bytes on node 0 flags: 0x0 ... ... [ 10.080295] Early memory node ranges[ 10.168065] ... node 0: [mem 0x0000028357f00000-0x0000028357ffffff] ... ... [ 8149.348948] SEV-SNP: RMPUPDATE failed for PFN 28357f7c, pg_level: 1, ret: 2
As shown above, the memblock allocations show 1MB after the end of the RMP as available for allocation, which is what the RMP table fixups have reserved. This memory range subsequently gets allocated as SNP guest memory, resulting in an RMPUPDATE failure.
This can potentially be fixed by not reserving the memory range in the e820 table, but that causes kexec failures when using the KEXEC_FILE_LOAD syscall.
The solution is to use memblock_reserve() to mark the memory reserved for the system, ensuring that it cannot be allocated to an SNP guest.
Since HV-Fixed memory is still readable/writable by the host, this only ends up being a problem if the memory in this range requires a page state change, which generally will only happen when allocating memory in this range to be used for running SNP guests, which is now possible with the SNP hypervisor support in kernel 6.11.
Backporter note:
Fixes tag points to a 6.9 change but as the last paragraph above explains, this whole thing can happen after 6.11 received SNP HV support, therefore backporting to 6.9 is not really necessary.
[ bp: Massage commit message. ]
--- arch/x86/virt/svm/sev.c | 2 ++ 1 file changed, 2 insertions(+)
arch/x86/virt/svm/sev.c +2 -0
@@ -173,6 +173,8 @@ static void __init __snp_fixup_e820_table820__range_update (pa,PMD_SIZE ,E820_TYPE_RAM ,E820_TYPE_RESERVED );e820__range_update_table (e820_table_kexec, pa,PMD_SIZE ,E820_TYPE_RAM ,E820_TYPE_RESERVED );e820__range_update_table (e820_table_firmware, pa,PMD_SIZE ,E820_TYPE_RAM ,E820_TYPE_RESERVED ); +if (!memblock_is_region_reserved (pa,PMD_SIZE )) +memblock_reserve (pa,PMD_SIZE ); } }
Greg Kroah-Hartman
maintainerPATCH 225/261 ALSA: hda/tas2781: select CRC32 instead of CRC32_SARWATE
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Biggers <[email protected]>
commit 86c96e7289c5758284b562ac7b5c94429f48d2d9 upstream.
Fix the kconfig option for the tas2781 HDA driver to select CRC32 rather than CRC32_SARWATE. CRC32_SARWATE is an option from the kconfig 'choice' that selects the specific CRC32 implementation. Selecting a 'choice' option seems to have no effect, but even if it did work, it would be incorrect for a random driver to override the user's choice. CRC32 is the correct option to select for crc32() to be available.
--- sound/pci/hda/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/pci/hda/Kconfig +1 -1
@@ -198,7 +198,7 @@ config SND_HDA_SCODEC_TAS2781_I2C depends on SND_SOC select SND_SOC_TAS2781_COMLIB select SND_SOC_TAS2781_FMWLIB - select CRC32_SARWATE + select CRC32 help Say Y or M here to include TAS2781 I2C HD-audio side codec support in snd-hda-intel driver, such as ALC287.
Greg Kroah-Hartman
maintainerPATCH 226/261 ALSA: hda/realtek: Add subwoofer quirk for Acer Predator G9-593
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: José Relvas <[email protected]>
commit 35fdc6e1c16099078bcbd73a6c8f1733ae7f1909 upstream.
The Acer Predator G9-593 has a 2+1 speaker system which isn't probed correctly.
This patch adds a quirk with the proper pin connections.
Note that I do not own this laptop, so I cannot guarantee that this fixes the issue.
Testing was done by other users here:
https://discussion.fedoraproject.org/t/-/118482
This model appears to have two different dev IDs...
- 0x1177 (as seen on the forum link above)
- 0x1178 (as seen on https://linux-hardware.org/?probe=127df9999f)
I don't think the audio system was changed between model revisions, so the patch applies for both IDs.
--- sound/pci/hda/patch_realtek.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
sound/pci/hda/patch_realtek.c +10 -0
@@ -7631,6 +7631,7 @@ enum {ALC286_FIXUP_ACER_AIO_HEADSET_MIC ,ALC256_FIXUP_ASUS_HEADSET_MIC ,ALC256_FIXUP_ASUS_MIC_NO_PRESENCE , +ALC255_FIXUP_PREDATOR_SUBWOOFER ,ALC299_FIXUP_PREDATOR_SPK ,ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE , ALC289_FIXUP_DELL_SPK1,
@@ -9047,6 +9048,13 @@ static const struct hda_fixup alc269_fix .chained = true, .chain_id =ALC256_FIXUP_ASUS_HEADSET_MODE }, + [ALC255_FIXUP_PREDATOR_SUBWOOFER] = { + .type = HDA_FIXUP_PINS, + .v.pins = (const struct hda_pintbl []) { + {0x17 ,0x90170151 },/* use as internal speaker (LFE) */ + {0x1b ,0x90170152 }/* use as internal speaker (back) */ + } + }, [ALC299_FIXUP_PREDATOR_SPK] = { .type = HDA_FIXUP_PINS, .v.pins = (const struct hda_pintbl []) {
@@ -10138,6 +10146,8 @@ static const struct snd_pci_quirk alc269SND_PCI_QUIRK (0x1025 ,0x110e ,"Acer Aspire ES1-432" ,ALC255_FIXUP_ACER_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x1025 ,0x1166 ,"Acer Veriton N4640G" ,ALC269_FIXUP_LIFEBOOK ),SND_PCI_QUIRK (0x1025 ,0x1167 ,"Acer Veriton N6640G" ,ALC269_FIXUP_LIFEBOOK ), +SND_PCI_QUIRK (0x1025 ,0x1177 ,"Acer Predator G9-593" ,ALC255_FIXUP_PREDATOR_SUBWOOFER ), +SND_PCI_QUIRK (0x1025 ,0x1178 ,"Acer Predator G9-593" ,ALC255_FIXUP_PREDATOR_SUBWOOFER ),SND_PCI_QUIRK (0x1025 ,0x1246 ,"Acer Predator Helios 500" ,ALC299_FIXUP_PREDATOR_SPK ),SND_PCI_QUIRK (0x1025 ,0x1247 ,"Acer vCopperbox" ,ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS ), SND_PCI_QUIRK(0x1025, 0x1248, "Acer Veriton N4660G", ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE),
Greg Kroah-Hartman
maintainerPATCH 227/261 LoongArch: Get correct cores_per_package for SMT systems
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Huacai Chen <[email protected]>
commit b7296f9d5bf99330063d4bbecc43c9b33fed0137 upstream.
In loongson_sysconf, The "core" of cores_per_node and cores_per_package stands for a logical core, which means in a SMT system it stands for a thread indeed. This information is gotten from SMBIOS Type4 Structure, so in order to get a correct cores_per_package for both SMT and non-SMT systems in parse_cpu_table() we should use SMBIOS_THREAD_PACKAGE_OFFSET instead of SMBIOS_CORE_PACKAGE_OFFSET.
--- arch/loongarch/include/asm/bootinfo.h | 4 ++++ arch/loongarch/kernel/setup.c | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-)
arch/loongarch/include/asm/bootinfo.h +4 -0
@@ -26,6 +26,10 @@ struct loongson_board_info {#define NR_WORDS DIV_ROUND_UP(NR_CPUS, BITS_PER_LONG) +/* +* The "core" of cores_per_node and cores_per_package stands for a +* logical core, which means in a SMT system it stands for a thread. +*/ struct loongson_system_configuration {int nr_cpus;int nr_nodes;
arch/loongarch/kernel/setup.c +2 -1
@@ -55,6 +55,7 @@#define SMBIOS_FREQHIGH_OFFSET 0x17#define SMBIOS_FREQLOW_MASK 0xFF#define SMBIOS_CORE_PACKAGE_OFFSET 0x23 +#define SMBIOS_THREAD_PACKAGE_OFFSET 0x25#define LOONGSON_EFI_ENABLE (1 << 3)unsigned long fw_arg0, fw_arg1, fw_arg2;
@@ -125,7 +126,7 @@ static void __init parse_cpu_table(const cpu_clock_freq = freq_temp *1000000 ; loongson_sysconf.cpuname = (void *)dmi_string_parse (dm, dmi_data[16 ]); - loongson_sysconf.cores_per_package = *(dmi_data +SMBIOS_CORE_PACKAGE_OFFSET ); + loongson_sysconf.cores_per_package = *(dmi_data +SMBIOS_THREAD_PACKAGE_OFFSET );pr_info ("CpuClock = %llu\n" , cpu_clock_freq); }
Greg Kroah-Hartman
maintainerPATCH 228/261 LoongArch: Enable IRQ if do_ale() triggered in irq-enabled context
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Huacai Chen <[email protected]>
commit 69cc6fad5df4ce652d969be69acc60e269e5eea1 upstream.
Unaligned access exception can be triggered in irq-enabled context such as user mode, in this case do_ale() may call get_user() which may cause sleep. Then we will get:
BUG: sleeping function called from invalid context at arch/loongarch/kernel/access-helper.h:7
in_atomic(): 0, irqs_disabled(): 1, non_block: 0, pid: 129, name: modprobe
preempt_count: 0, expected: 0
RCU nest depth: 0, expected: 0
CPU: 0 UID: 0 PID: 129 Comm: modprobe Tainted: G W 6.12.0-rc1+ #1723
Tainted: [W]=WARN
Stack : 9000000105e0bd48 0000000000000000 9000000003803944 9000000105e08000
9000000105e0bc70 9000000105e0bc78 0000000000000000 0000000000000000
9000000105e0bc78 0000000000000001 9000000185e0ba07 9000000105e0b890
ffffffffffffffff 9000000105e0bc78 73924b81763be05b 9000000100194500
000000000000020c 000000000000000a 0000000000000000 0000000000000003
00000000000023f0 00000000000e1401 00000000072f8000 0000007ffbb0e260
0000000000000000 0000000000000000 9000000005437650 90000000055d5000
0000000000000000 0000000000000003 0000007ffbb0e1f0 0000000000000000
0000005567b00490 0000000000000000 9000000003803964 0000007ffbb0dfec
00000000000000b0 0000000000000007 0000000000000003 0000000000071c1d
...
Call Trace:
[<9000000003803964>] show_stack+0x64/0x1a0
[<9000000004c57464>] dump_stack_lvl+0x74/0xb0
[<9000000003861ab4>] __might_resched+0x154/0x1a0
[<900000000380c96c>] emulate_load_store_insn+0x6c/0xf60
[<9000000004c58118>] do_ale+0x78/0x180
[<9000000003801bc8>] handle_ale+0x128/0x1e0So enable IRQ if unaligned access exception is triggered in irq-enabled context to fix it.
--- arch/loongarch/kernel/traps.c | 5 +++++ 1 file changed, 5 insertions(+)
arch/loongarch/kernel/traps.c +5 -0
@@ -555,6 +555,9 @@ asmlinkage void noinstr do_ale(struct pt#else unsigned int *pc; +if (regs->csr_prmd &CSR_PRMD_PIE ) +local_irq_enable (); +perf_sw_event (PERF_COUNT_SW_ALIGNMENT_FAULTS ,1 , regs, regs->csr_badvaddr);/*
@@ -579,6 +582,8 @@ sigbus:die_if_kernel ("Kernel ale access" , regs);force_sig_fault (SIGBUS ,BUS_ADRALN , (void __user *)regs->csr_badvaddr); out: +if (regs->csr_prmd &CSR_PRMD_PIE ) +local_irq_disable ();#endif irqentry_exit (regs, state); }
Greg Kroah-Hartman
maintainerPATCH 229/261 LoongArch: Make KASAN usable for variable cpu_vabits
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Huacai Chen <[email protected]>
commit 3c252263be801f937f56b4bcd8e8e2b5307c1ce5 upstream.
Currently, KASAN on LoongArch assume the CPU VA bits is 48, which is true for Loongson-3 series, but not for Loongson-2 series (only 40 or lower), this patch fix that issue and make KASAN usable for variable cpu_vabits.
Solution is very simple: Just define XRANGE_SHADOW_SHIFT which means valid address length from VA_BITS to min(cpu_vabits, VA_BITS).
--- arch/loongarch/include/asm/kasan.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/loongarch/include/asm/kasan.h +1 -1
@@ -16,7 +16,7 @@#define XRANGE_SHIFT (48)/* Valid address length */ -#define XRANGE_SHADOW_SHIFT (PGDIR_SHIFT + PAGE_SHIFT - 3) +#define XRANGE_SHADOW_SHIFT min(cpu_vabits, VA_BITS)/* Used for taking out the valid address */ #define XRANGE_SHADOW_MASK GENMASK_ULL(XRANGE_SHADOW_SHIFT - 1, 0)/* One segment whole address space size */
Greg Kroah-Hartman
maintainerPATCH 230/261 xfrm: fix one more kernel-infoleak in algo dumping
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Petr Vaganov <[email protected]>
commit 6889cd2a93e1e3606b3f6e958aa0924e836de4d2 upstream.
During fuzz testing, the following issue was discovered:
BUG: KMSAN: kernel-infoleak in _copy_to_iter+0x598/0x2a30 _copy_to_iter+0x598/0x2a30 __skb_datagram_iter+0x168/0x1060 skb_copy_datagram_iter+0x5b/0x220 netlink_recvmsg+0x362/0x1700 sock_recvmsg+0x2dc/0x390 __sys_recvfrom+0x381/0x6d0 __x64_sys_recvfrom+0x130/0x200 x64_sys_call+0x32c8/0x3cc0 do_syscall_64+0xd8/0x1c0 entry_SYSCALL_64_after_hwframe+0x79/0x81
Uninit was stored to memory at:
copy_to_user_state_extra+0xcc1/0x1e00 dump_one_state+0x28c/0x5f0 xfrm_state_walk+0x548/0x11e0 xfrm_dump_sa+0x1e0/0x840 netlink_dump+0x943/0x1c40 __netlink_dump_start+0x746/0xdb0 xfrm_user_rcv_msg+0x429/0xc00 netlink_rcv_skb+0x613/0x780 xfrm_netlink_rcv+0x77/0xc0 netlink_unicast+0xe90/0x1280 netlink_sendmsg+0x126d/0x1490 __sock_sendmsg+0x332/0x3d0 ____sys_sendmsg+0x863/0xc30 ___sys_sendmsg+0x285/0x3e0 __x64_sys_sendmsg+0x2d6/0x560 x64_sys_call+0x1316/0x3cc0 do_syscall_64+0xd8/0x1c0 entry_SYSCALL_64_after_hwframe+0x79/0x81
Uninit was created at:
__kmalloc+0x571/0xd30 attach_auth+0x106/0x3e0 xfrm_add_sa+0x2aa0/0x4230 xfrm_user_rcv_msg+0x832/0xc00 netlink_rcv_skb+0x613/0x780 xfrm_netlink_rcv+0x77/0xc0 netlink_unicast+0xe90/0x1280 netlink_sendmsg+0x126d/0x1490 __sock_sendmsg+0x332/0x3d0 ____sys_sendmsg+0x863/0xc30 ___sys_sendmsg+0x285/0x3e0 __x64_sys_sendmsg+0x2d6/0x560 x64_sys_call+0x1316/0x3cc0 do_syscall_64+0xd8/0x1c0 entry_SYSCALL_64_after_hwframe+0x79/0x81
Bytes 328-379 of 732 are uninitialized Memory access of size 732 starts at ffff88800e18e000 Data copied to user address 00007ff30f48aff0
CPU: 2 PID: 18167 Comm: syz-executor.0 Not tainted 6.8.11 #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014
Fixes copying of xfrm algorithms where some random
data of the structure fields can end up in userspace. Padding in structures may be filled with random (possibly sensitve) data and should never be given directly to user-space.
A similar issue was resolved in the commit 8222d5910dae ("xfrm: Zero padding when dumping algos and encap")
Found by Linux Verification Center (linuxtesting.org) with Syzkaller.
--- net/xfrm/xfrm_user.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/xfrm/xfrm_user.c +3 -1
@@ -1102,7 +1102,9 @@ static int copy_to_user_auth(struct xfrmif (!nla)return -EMSGSIZE ; ap =nla_data (nla); -memcpy (ap, auth,sizeof (struct xfrm_algo_auth )); +strscpy_pad (ap->alg_name, auth->alg_name,sizeof (ap->alg_name)); + ap->alg_key_len = auth->alg_key_len; + ap->alg_trunc_len = auth->alg_trunc_len;if (redact_secret && auth->alg_key_len)memset (ap->alg_key,0 , (auth->alg_key_len +7 ) /8 );else
Greg Kroah-Hartman
maintainerPATCH 231/261 hv_netvsc: Fix VF namespace also in synthetic NIC NETDEV_REGISTER event
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Haiyang Zhang <[email protected]>
commit 4c262801ea60c518b5bebc22a09f5b78b3147da2 upstream.
The existing code moves VF to the same namespace as the synthetic NIC during netvsc_register_vf(). But, if the synthetic device is moved to a new namespace after the VF registration, the VF won't be moved together.
To make the behavior more consistent, add a namespace check for synthetic NIC's NETDEV_REGISTER event (generated during its move), and move the VF if it is not in the same namespace.
--- drivers/net/hyperv/netvsc_drv.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)
drivers/net/hyperv/netvsc_drv.c +30 -0
@@ -2797,6 +2797,31 @@ static struct hv_driver netvsc_drv = { }, }; +/* Set VF's namespace same as the synthetic NIC */ +static void netvsc_event_set_vf_ns (struct net_device *ndev) +{ +struct net_device_context *ndev_ctx =netdev_priv (ndev); +struct net_device *vf_netdev; +int ret; + + vf_netdev =rtnl_dereference (ndev_ctx->vf_netdev); +if (!vf_netdev) +return ; + +if (!net_eq (dev_net (ndev),dev_net (vf_netdev))) { + ret =dev_change_net_namespace (vf_netdev,dev_net (ndev), +"eth%d" ); +if (ret) +netdev_err (vf_netdev, +"Cannot move to same namespace as %s: %d\n" , + ndev->name, ret); +else +netdev_info (vf_netdev, +"Moved VF to namespace with: %s\n" , + ndev->name); + } +} +/* * On Hyper-V, every VF interface is matched with a corresponding * synthetic interface. The synthetic interface is presented first
@@ -2809,6 +2834,11 @@ static int netvsc_netdev_event(struct nostruct net_device *event_dev =netdev_notifier_info_to_dev (ptr);int ret =0 ; +if (event_dev->netdev_ops == &device_ops && event ==NETDEV_REGISTER ) { +netvsc_event_set_vf_ns (event_dev); +return NOTIFY_DONE ; + } + ret =check_dev_is_matching_vf (event_dev);if (ret !=0 )return NOTIFY_DONE ;
Greg Kroah-Hartman
maintainerPATCH 232/261 md/raid10: fix null ptr dereference in raid10_size()
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yu Kuai <[email protected]>
commit 825711e00117fc686ab89ac36a9a7b252dc349c6 upstream.
In raid10_run() if raid10_set_queue_limits() succeed, the return value is set to zero, and if following procedures failed raid10_run() will return zero while mddev->private is still NULL, causing null ptr dereference in raid10_size().
Fix the problem by only overwrite the return value if raid10_set_queue_limits() failed.
--- drivers/md/raid10.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/md/raid10.c +5 -2
@@ -4055,9 +4055,12 @@ static int raid10_run(struct mddev *mdde }if (!mddev_is_dm (conf->mddev)) { - ret =raid10_set_queue_limits (mddev); -if (ret) +int err =raid10_set_queue_limits (mddev); + +if (err) { + ret = err; goto out_free_conf; + } }/* need to check that every block has at least one working mirror */
Greg Kroah-Hartman
maintainerPATCH 233/261 drm/bridge: Fix assignment of the of_node of the parent to aux bridge
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Abel Vesa <[email protected]>
commit 85e444a68126a631221ae32c63fce882bb18a262 upstream.
The assignment of the of_node to the aux bridge needs to mark the of_node as reused as well, otherwise resource providers like pinctrl will report a gpio as already requested by a different device when both pinconf and gpios property are present.
Fix that by using the device_set_of_node_from_dev() helper instead.
--- drivers/gpu/drm/bridge/aux-bridge.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/bridge/aux-bridge.c +2 -1
@@ -58,9 +58,10 @@ int drm_aux_bridge_register(struct devic adev->id = ret; adev->name ="aux_bridge" ; adev->dev.parent = parent; - adev->dev.of_node =of_node_get (parent->of_node); adev->dev.release = drm_aux_bridge_release; +device_set_of_node_from_dev (&adev->dev, parent); + ret =auxiliary_device_init (adev);if (ret) {ida_free (&drm_aux_bridge_ida, adev->id);
Greg Kroah-Hartman
maintainerPATCH 234/261 drm/amd/display: Disable PSR-SU on Parade 08-01 TCON too
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mario Limonciello <[email protected]>
commit ba1959f71117b27f3099ee789e0815360b4081dd upstream.
Stuart Hayhurst has found that both at bootup and fullscreen VA-API video is leading to black screens for around 1 second and kernel WARNING [1] traces when calling dmub_psr_enable() with Parade 08-01 TCON.
These symptoms all go away with PSR-SU disabled for this TCON, so disable it for now while DMUB traces [2] from the failure can be analyzed and the failure state properly root caused.
--- drivers/gpu/drm/amd/display/modules/power/power_helpers.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/display/modules/power/power_helpers.c +2 -0
@@ -841,6 +841,8 @@ bool is_psr_su_specific_panel(struct dc_ isPSRSUSupported = false; else if (dpcd_caps->sink_dev_id_str[1] == 0x08 && dpcd_caps->sink_dev_id_str[0] == 0x03) isPSRSUSupported = false; + else if (dpcd_caps->sink_dev_id_str[1] == 0x08 && dpcd_caps->sink_dev_id_str[0] == 0x01) + isPSRSUSupported = false; else if (dpcd_caps->psr_info.force_psrsu_cap == 0x1) isPSRSUSupported = true; }
Greg Kroah-Hartman
maintainerPATCH 235/261 platform/x86/intel/pmc: Fix pmc_core_iounmap to call iounmap for valid addresses
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vamsi Krishna Brahmajosyula <[email protected]>
[ Upstream commit 48771da48072823956b271dddd568492c13d8170 ]
Commit 50c6dbdfd16e ("x86/ioremap: Improve iounmap() address range checks") introduces a WARN when adrress ranges of iounmap are invalid. On Thinkpad P1 Gen 7 (Meteor Lake-P) this caused the following warning to appear:
WARNING: CPU: 7 PID: 713 at arch/x86/mm/ioremap.c:461 iounmap+0x58/0x1f0 Modules linked in: rfkill(+) snd_timer(+) fjes(+) snd soundcore intel_pmc_core(+)
int3403_thermal(+) int340x_thermal_zone intel_vsec pmt_telemetry acpi_pad pmt_class acpi_tad int3400_thermal acpi_thermal_rel joydev loop nfnetlink zram xe drm_suballoc_helper nouveau i915 mxm_wmi drm_ttm_helper gpu_sched drm_gpuvm drm_exec drm_buddy i2c_algo_bit crct10dif_pclmul crc32_pclmul ttm crc32c_intel polyval_clmulni rtsx_pci_sdmmc ucsi_acpi polyval_generic mmc_core hid_multitouch drm_display_helper ghash_clmulni_intel typec_ucsi nvme sha512_ssse3 video sha256_ssse3 nvme_core intel_vpu sha1_ssse3 rtsx_pci cec typec nvme_auth i2c_hid_acpi i2c_hid wmi pinctrl_meteorlake serio_raw ip6_tables ip_tables fuse
CPU: 7 UID: 0 PID: 713 Comm: (udev-worker) Not tainted 6.12.0-rc2iounmap+ #42 Hardware name: LENOVO 21KWCTO1WW/21KWCTO1WW, BIOS N48ET19W (1.06 ) 07/18/2024 RIP: 0010:iounmap+0x58/0x1f0 Code: 85 6a 01 00 00 48 8b 05 e6 e2 28 04 48 39 c5 72 19 eb 26 cc cc cc 48 ba 00 00 00 00 00 00 32 00 48 8d 44 02 ff 48 39 c5 72 23 <0f> 0b 48 83 c4 08 5b 5d 41 5c c3 cc cc cc cc 48 ba 00 00 00 00 00 RSP: 0018:ffff888131eff038 EFLAGS: 00010207 RAX: ffffc90000000000 RBX: 0000000000000000 RCX: ffff888e33b80000 RDX: dffffc0000000000 RSI: ffff888e33bc29c0 RDI: 0000000000000000 RBP: 0000000000000000 R08: ffff8881598a8000 R09: ffff888e2ccedc10 R10: 0000000000000003 R11: ffffffffb3367634 R12: 00000000fe000000 R13: ffff888101d0da28 R14: ffffffffc2e437e0 R15: ffff888110b03b28 FS: 00007f3c1d4b3980(0000) GS:ffff888e33b80000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00005651cfc93578 CR3: 0000000124e4c002 CR4: 0000000000f70ef0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000ffff07f0 DR7: 0000000000000400 PKRU: 55555554 Call Trace: <TASK> ? __warn.cold+0xb6/0x176 ? iounmap+0x58/0x1f0 ? report_bug+0x1f4/0x2b0 ? handle_bug+0x58/0x90 ? exc_invalid_op+0x17/0x40 ? asm_exc_invalid_op+0x1a/0x20 ? iounmap+0x58/0x1f0 pmc_core_ssram_get_pmc+0x477/0x6c0 [intel_pmc_core] ? __pfx_pmc_core_ssram_get_pmc+0x10/0x10 [intel_pmc_core] ? __pfx_do_pci_enable_device+0x10/0x10 ? pci_wait_for_pending+0x60/0x110 ? pci_enable_device_flags+0x1e3/0x2e0 ? __pfx_mtl_core_init+0x10/0x10 [intel_pmc_core] pmc_core_ssram_init+0x7f/0x110 [intel_pmc_core] mtl_core_init+0xda/0x130 [intel_pmc_core] ? __mutex_init+0xb9/0x130 pmc_core_probe+0x27e/0x10b0 [intel_pmc_core] ? _raw_spin_lock_irqsave+0x96/0xf0 ? __pfx_pmc_core_probe+0x10/0x10 [intel_pmc_core] ? __pfx_mutex_unlock+0x10/0x10 ? __pfx_mutex_lock+0x10/0x10 ? device_pm_check_callbacks+0x82/0x370 ? acpi_dev_pm_attach+0x234/0x2b0 platform_probe+0x9f/0x150 really_probe+0x1e0/0x8a0 __driver_probe_device+0x18c/0x370 ? __pfx___driver_attach+0x10/0x10 driver_probe_device+0x4a/0x120 __driver_attach+0x190/0x4a0 ? __pfx___driver_attach+0x10/0x10 bus_for_each_dev+0x103/0x180 ? __pfx_bus_for_each_dev+0x10/0x10 ? klist_add_tail+0x136/0x270 bus_add_driver+0x2fc/0x540 driver_register+0x1a5/0x360 ? __pfx_pmc_core_driver_init+0x10/0x10 [intel_pmc_core] do_one_initcall+0xa4/0x380 ? __pfx_do_one_initcall+0x10/0x10 ? kasan_unpoison+0x44/0x70 do_init_module+0x296/0x800 load_module+0x5090/0x6ce0 ? __pfx_load_module+0x10/0x10 ? ima_post_read_file+0x193/0x200 ? __pfx_ima_post_read_file+0x10/0x10 ? rw_verify_area+0x152/0x4c0 ? kernel_read_file+0x257/0x750 ? __pfx_kernel_read_file+0x10/0x10 ? __pfx_filemap_get_read_batch+0x10/0x10 ? init_module_from_file+0xd1/0x130 init_module_from_file+0xd1/0x130 ? __pfx_init_module_from_file+0x10/0x10 ? __pfx__raw_spin_lock+0x10/0x10 ? __pfx_cred_has_capability.isra.0+0x10/0x10 idempotent_init_module+0x236/0x770 ? __pfx_idempotent_init_module+0x10/0x10 ? fdget+0x58/0x3f0 ? security_capable+0x7d/0x110 __x64_sys_finit_module+0xbe/0x130 do_syscall_64+0x82/0x160 ? __pfx_filemap_read+0x10/0x10 ? __pfx___fsnotify_parent+0x10/0x10 ? vfs_read+0x3a6/0xa30 ? vfs_read+0x3a6/0xa30 ? __seccomp_filter+0x175/0xc60 ? __pfx___seccomp_filter+0x10/0x10 ? fdget_pos+0x1ce/0x500 ? syscall_exit_to_user_mode_prepare+0x149/0x170 ? syscall_exit_to_user_mode+0x10/0x210 ? do_syscall_64+0x8e/0x160 ? switch_fpu_return+0xe3/0x1f0 ? syscall_exit_to_user_mode+0x1d5/0x210 ? do_syscall_64+0x8e/0x160 ? exc_page_fault+0x76/0xf0 entry_SYSCALL_64_after_hwframe+0x76/0x7e RIP: 0033:0x7f3c1d6d155d Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 90 f3 0f 1e fa 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 83 58 0f 00 f7 d8 64 89 01 48 RSP: 002b:00007ffe6309db38 EFLAGS: 00000246 ORIG_RAX: 0000000000000139 RAX: ffffffffffffffda RBX: 0000557c212550a0 RCX: 00007f3c1d6d155d RDX: 0000000000000000 RSI: 00007f3c1cd943bd RDI: 0000000000000025 RBP: 00007ffe6309dbf0 R08: 00007f3c1d7c7b20 R09: 00007ffe6309db80 R10: 0000557c21255270 R11: 0000000000000246 R12: 00007f3c1cd943bd R13: 0000000000020000 R14: 0000557c21255c80 R15: 0000557c21255240 </TASK>
no_free_ptr(tmp_ssram) sets tmp_ssram NULL while assigning ssram. pmc_core_iounmap calls iounmap unconditionally causing the above warning to appear during boot.
Fix it by checking for a valid address before calling iounmap.
Also in the function pmc_core_ssram_get_pmc return -ENOMEM when ioremap fails similar to other instances in the file.
--- drivers/platform/x86/intel/pmc/core_ssram.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/platform/x86/intel/pmc/core_ssram.c +3 -1
@@ -29,7 +29,7 @@#define LPM_REG_COUNT 28#define LPM_MODE_OFFSET 1 -DEFINE_FREE(pmc_core_iounmap, void __iomem *, iounmap(_T)); +DEFINE_FREE(pmc_core_iounmap, void __iomem *, if (_T) iounmap(_T))static u32 pmc_core_find_guid (struct pmc_info *list,const struct pmc_reg_map *map) {
@@ -262,6 +262,8 @@ pmc_core_ssram_get_pmc(struct pmc_dev *pmcdev, int pmc_idx, u32 offset) ssram_base = ssram_pcidev->resource[0 ].start; tmp_ssram =ioremap (ssram_base,SSRAM_HDR_SIZE ); +if (!tmp_ssram) +return -ENOMEM ;if (pmc_idx !=PMC_IDX_MAIN ) {/*
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 236/261 fgraph: Fix missing unlock in register_ftrace_graph()
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Li Huafei <[email protected]>
[ Upstream commit bd3734db86e01e20dd239a40b419059a0ce9c901 ]
Use guard(mutex)() to acquire and automatically release ftrace_lock, fixing the issue of not unlocking when calling cpuhp_setup_state() fails.
Fixes smatch warning:
kernel/trace/fgraph.c:1317 register_ftrace_graph() warn: inconsistent returns '&ftrace_lock'.
--- kernel/trace/fgraph.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
kernel/trace/fgraph.c +3 -7
@@ -1252,7 +1252,7 @@ int register_ftrace_graph(struct fgraph_ops *gops)int ret =0 ;int i =-1 ; -mutex_lock (&ftrace_lock); +guard (mutex)(&ftrace_lock);if (!fgraph_initialized) { ret = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "fgraph_idle_init",
@@ -1273,10 +1273,8 @@ int register_ftrace_graph(struct fgraph_ops *gops) } i =fgraph_lru_alloc_index (); -if (i <0 ||WARN_ON_ONCE (fgraph_array[i] != &fgraph_stub)) { - ret = -ENOSPC ; - goto out; - } +if (i <0 ||WARN_ON_ONCE (fgraph_array[i] != &fgraph_stub)) +return -ENOSPC ; gops->idx = i; ftrace_graph_active++;
@@ -1313,8 +1311,6 @@ int register_ftrace_graph(struct fgraph_ops *gops) gops->saved_func =NULL ;fgraph_lru_release_index (i); } -out: -mutex_unlock (&ftrace_lock);return ret; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 237/261 fgraph: Change the name of cpuhp state to "fgraph:online"
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steven Rostedt <[email protected]>
[ Upstream commit a574e7f80e86c740e241c762923f50077b2c2a30 ]
The cpuhp state name given to cpuhp_setup_state() is "fgraph_idle_init" which doesn't really conform to the names that are used for cpu hotplug setups. Instead rename it to "fgraph:online" to be in line with other states.
--- kernel/trace/fgraph.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/trace/fgraph.c +1 -1
@@ -1255,7 +1255,7 @@ int register_ftrace_graph(struct fgraph_ops *gops)guard (mutex)(&ftrace_lock);if (!fgraph_initialized) { - ret =cpuhp_setup_state (CPUHP_AP_ONLINE_DYN ,"fgraph_idle_init" , + ret =cpuhp_setup_state (CPUHP_AP_ONLINE_DYN ,"fgraph:online" , fgraph_cpu_init,NULL );if (ret <0 ) {pr_warn ("fgraph: Error to init cpu hotplug support\n" );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 238/261 net: phy: dp83822: Fix reset pin definitions
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michel Alex <[email protected]>
commit de96f6a3003513c796bbe4e23210a446913f5c00 upstream.
This change fixes a rare issue where the PHY fails to detect a link due to incorrect reset behavior.
The SW_RESET definition was incorrectly assigned to bit 14, which is the Digital Restart bit according to the datasheet. This commit corrects SW_RESET to bit 15 and assigns DIG_RESTART to bit 14 as per the datasheet specifications.
The SW_RESET define is only used in the phy_reset function, which fully re-initializes the PHY after the reset is performed. The change in the bit definitions should not have any negative impact on the functionality of the PHY.
v2:
- added Fixes tag
- improved commit message
Message-ID: <AS1P250MB0608A798661549BF83C4B43EA9462@AS1P250MB0608.EURP250.PROD.OUTLOOK.COM>
--- drivers/net/phy/dp83822.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/phy/dp83822.c +2 -2
@@ -45,8 +45,8 @@/* Control Register 2 bits */ #define DP83822_FX_ENABLE BIT(14) -#define DP83822_HW_RESET BIT(15) -#define DP83822_SW_RESET BIT(14) +#define DP83822_SW_RESET BIT(15) +#define DP83822_DIG_RESTART BIT(14)/* PHY STS bits */ #define DP83822_PHYSTS_DUPLEX BIT(2)
Greg Kroah-Hartman
maintainerPATCH 239/261 nfsd: fix race between laundromat and free_stateid
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Olga Kornievskaia <[email protected]>
commit 8dd91e8d31febf4d9cca3ae1bb4771d33ae7ee5a upstream.
There is a race between laundromat handling of revoked delegations and a client sending free_stateid operation. Laundromat thread finds that delegation has expired and needs to be revoked so it marks the delegation stid revoked and it puts it on a reaper list but then it unlock the state lock and the actual delegation revocation happens without the lock. Once the stid is marked revoked a racing free_stateid processing thread does the following (1) it calls list_del_init() which removes it from the reaper list and (2) frees the delegation stid structure. The laundromat thread ends up not calling the revoke_delegation() function for this particular delegation but that means it will no release the lock lease that exists on the file.
Now, a new open for this file comes in and ends up finding that lease list isn't empty and calls nfsd_breaker_owns_lease() which ends up trying to derefence a freed delegation stateid. Leading to the followint use-after-free KASAN warning:
kernel: ==================================================================
kernel: BUG: KASAN: slab-use-after-free in nfsd_breaker_owns_lease+0x140/0x160 [nfsd]
kernel: Read of size 8 at addr ffff0000e73cd0c8 by task nfsd/6205
kernel:
kernel: CPU: 2 UID: 0 PID: 6205 Comm: nfsd Kdump: loaded Not tainted 6.11.0-rc7+ #9
kernel: Hardware name: Apple Inc. Apple Virtualization Generic Platform, BIOS 2069.0.0.0.0 08/03/2024
kernel: Call trace:
kernel: dump_backtrace+0x98/0x120
kernel: show_stack+0x1c/0x30
kernel: dump_stack_lvl+0x80/0xe8
kernel: print_address_description.constprop.0+0x84/0x390
kernel: print_report+0xa4/0x268
kernel: kasan_report+0xb4/0xf8
kernel: __asan_report_load8_noabort+0x1c/0x28
kernel: nfsd_breaker_owns_lease+0x140/0x160 [nfsd]
kernel: nfsd_file_do_acquire+0xb3c/0x11d0 [nfsd]
kernel: nfsd_file_acquire_opened+0x84/0x110 [nfsd]
kernel: nfs4_get_vfs_file+0x634/0x958 [nfsd]
kernel: nfsd4_process_open2+0xa40/0x1a40 [nfsd]
kernel: nfsd4_open+0xa08/0xe80 [nfsd]
kernel: nfsd4_proc_compound+0xb8c/0x2130 [nfsd]
kernel: nfsd_dispatch+0x22c/0x718 [nfsd]
kernel: svc_process_common+0x8e8/0x1960 [sunrpc]
kernel: svc_process+0x3d4/0x7e0 [sunrpc]
kernel: svc_handle_xprt+0x828/0xe10 [sunrpc]
kernel: svc_recv+0x2cc/0x6a8 [sunrpc]
kernel: nfsd+0x270/0x400 [nfsd]
kernel: kthread+0x288/0x310
kernel: ret_from_fork+0x10/0x20
This patch proposes a fixed that's based on adding 2 new additional stid's sc_status values that help coordinate between the laundromat and other operations (nfsd4_free_stateid() and nfsd4_delegreturn()).
First to make sure, that once the stid is marked revoked, it is not removed by the nfsd4_free_stateid(), the laundromat take a reference on the stateid. Then, coordinating whether the stid has been put on the cl_revoked list or we are processing FREE_STATEID and need to make sure to remove it from the list, each check that state and act accordingly. If laundromat has added to the cl_revoke list before the arrival of FREE_STATEID, then nfsd4_free_stateid() knows to remove it from the list. If nfsd4_free_stateid() finds that operations arrived before laundromat has placed it on cl_revoke list, it marks the state freed and then laundromat will no longer add it to the list.
Also, for nfsd4_delegreturn() when looking for the specified stid, we need to access stid that are marked removed or freeable, it means the laundromat has started processing it but hasn't finished and this delegreturn needs to return nfserr_deleg_revoked and not nfserr_bad_stateid. The latter will not trigger a FREE_STATEID and the lack of it will leave this stid on the cl_revoked list indefinitely.
--- fs/nfsd/nfs4state.c | 48 ++++++++++++++++++++++++++++++++++++++++-------- fs/nfsd/state.h | 2 ++ 2 files changed, 42 insertions(+), 8 deletions(-)
fs/nfsd/nfs4state.c +40 -8
@@ -1358,21 +1358,47 @@ static void destroy_delegation(struct nfdestroy_unhashed_deleg (dp); } +/** +* revoke_delegation - perform nfs4 delegation structure cleanup +* @dp: pointer to the delegation +* +* This function assumes that it's called either from the administrative +* interface (nfsd4_revoke_states()) that's revoking a specific delegation +* stateid or it's called from a laundromat thread (nfsd4_landromat()) that +* determined that this specific state has expired and needs to be revoked +* (both mark state with the appropriate stid sc_status mode). It is also +* assumed that a reference was taken on the @dp state. +* +* If this function finds that the @dp state is SC_STATUS_FREED it means +* that a FREE_STATEID operation for this stateid has been processed and +* we can proceed to removing it from recalled list. However, if @dp state +* isn't marked SC_STATUS_FREED, it means we need place it on the cl_revoked +* list and wait for the FREE_STATEID to arrive from the client. At the same +* time, we need to mark it as SC_STATUS_FREEABLE to indicate to the +* nfsd4_free_stateid() function that this stateid has already been added +* to the cl_revoked list and that nfsd4_free_stateid() is now responsible +* for removing it from the list. Inspection of where the delegation state +* in the revocation process is protected by the clp->cl_lock. +*/ static void revoke_delegation (struct nfs4_delegation *dp) {struct nfs4_client *clp = dp->dl_stid.sc_client;WARN_ON (!list_empty (&dp->dl_recall_lru)); +WARN_ON_ONCE (!(dp->dl_stid.sc_status & + (SC_STATUS_REVOKED |SC_STATUS_ADMIN_REVOKED )));trace_nfsd_stid_revoke (&dp->dl_stid); -if (dp->dl_stid.sc_status & - (SC_STATUS_REVOKED |SC_STATUS_ADMIN_REVOKED )) { -spin_lock (&clp->cl_lock); -refcount_inc (&dp->dl_stid.sc_count); -list_add (&dp->dl_recall_lru, &clp->cl_revoked); -spin_unlock (&clp->cl_lock); +spin_lock (&clp->cl_lock); +if (dp->dl_stid.sc_status &SC_STATUS_FREED ) { +list_del_init (&dp->dl_recall_lru); + goto out; } +list_add (&dp->dl_recall_lru, &clp->cl_revoked); + dp->dl_stid.sc_status |=SC_STATUS_FREEABLE ; +out: +spin_unlock (&clp->cl_lock);destroy_unhashed_deleg (dp); }
@@ -1781,6 +1807,7 @@ void nfsd4_revoke_states(struct net *netmutex_unlock (&stp->st_mutex);break ;case SC_TYPE_DELEG : +refcount_inc (&stid->sc_count); dp =delegstateid (stid);spin_lock (&state_lock); if (!unhash_delegation_locked(
@@ -6544,6 +6571,7 @@ nfs4_laundromat(struct nfsd_net *nn) dp = list_entry (pos, struct nfs4_delegation, dl_recall_lru);if (!state_expired (<, dp->dl_time))break ; +refcount_inc (&dp->dl_stid.sc_count);unhash_delegation_locked (dp,SC_STATUS_REVOKED );list_add (&dp->dl_recall_lru, &reaplist); }
@@ -7161,7 +7189,9 @@ nfsd4_free_stateid(struct svc_rqst *rqst s->sc_status |=SC_STATUS_CLOSED ;spin_unlock (&s->sc_lock); dp =delegstateid (s); -list_del_init (&dp->dl_recall_lru); +if (s->sc_status &SC_STATUS_FREEABLE ) +list_del_init (&dp->dl_recall_lru); + s->sc_status |=SC_STATUS_FREED ;spin_unlock (&cl->cl_lock);nfs4_put_stid (s); ret = nfs_ok;
@@ -7491,7 +7521,9 @@ nfsd4_delegreturn(struct svc_rqst *rqstpif ((status =fh_verify (rqstp, &cstate->current_fh,S_IFREG ,0 )))return status; - status =nfsd4_lookup_stateid (cstate, stateid,SC_TYPE_DELEG ,0 , &s, nn); + status =nfsd4_lookup_stateid (cstate, stateid,SC_TYPE_DELEG , +SC_STATUS_REVOKED |SC_STATUS_FREEABLE , + &s, nn);if (status) goto out; dp =delegstateid (s);
fs/nfsd/state.h +2 -0
@@ -113,6 +113,8 @@ struct nfs4_stid {/* For a deleg stateid kept around only to process free_stateid's: */ #define SC_STATUS_REVOKED BIT(1)#define SC_STATUS_ADMIN_REVOKED BIT(2) +#define SC_STATUS_FREEABLE BIT(3) +#define SC_STATUS_FREED BIT(4)unsigned short sc_status;struct list_head sc_cp_list;
Greg Kroah-Hartman
maintainerPATCH 240/261 block: fix sanity checks in blk_rq_map_user_bvec
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xinyu Zhang <[email protected]>
commit 2ff949441802a8d076d9013c7761f63e8ae5a9bd upstream.
blk_rq_map_user_bvec contains a check bytes + bv->bv_len > nr_iter which causes unnecessary failures in NVMe passthrough I/O, reproducible as follows:
- register a 2 page, page-aligned buffer against a ring
- use that buffer to do a 1 page io_uring NVMe passthrough read
The second (i = 1) iteration of the loop in blk_rq_map_user_bvec will then have nr_iter == 1 page, bytes == 1 page, bv->bv_len == 1 page, so the check bytes + bv->bv_len > nr_iter will succeed, causing the I/O to fail. This failure is unnecessary, as when the check succeeds, it means we've checked the entire buffer that will be used by the request - i.e. blk_rq_map_user_bvec should complete successfully. Therefore, terminate the loop early and return successfully when the check bytes + bv->bv_len
Quoted 1 line
nr_itersucceeds.
While we're at it, also remove the check that all segments in the bvec are single-page. While this seems to be true for all users of the function, it doesn't appear to be required anywhere downstream.
--- block/blk-map.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
block/blk-map.c +1 -3
@@ -600,9 +600,7 @@ static int blk_rq_map_user_bvec(struct rif (nsegs >= nr_segs || bytes >UINT_MAX - bv->bv_len) goto put_bio;if (bytes + bv->bv_len > nr_iter) - goto put_bio; -if (bv->bv_offset + bv->bv_len >PAGE_SIZE ) - goto put_bio; +break ; nsegs++; bytes += bv->bv_len;
Greg Kroah-Hartman
maintainerPATCH 241/261 drm/amd/display: temp w/a for DP Link Layer compliance
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aurabindo Pillai <[email protected]>
commit 63feb35cd26557572ad95fc062ede344bb61d9ad upstream.
[Why&How]
Disabling P-State support on full updates for DCN401 results in introducing additional communication with SMU. A UCLK hard min message to SMU takes 4 seconds to go through, which was due to DCN not allowing pstate switch, which was caused by incorrect value for TTU watermark before blanking the HUBP prior to DPG on for servicing the test request.
Fix the issue temporarily by disallowing pstate changes for compliance test while test request handler is reworked for a proper fix.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c +13 -0
@@ -44,6 +44,7 @@#include "dm_helpers.h" #include "ddc_service_types.h" +#include "clk_mgr.h" static u32 edid_extract_panel_id (struct edid *edid) {
@@ -1121,6 +1122,8 @@ bool dm_helpers_dp_handle_test_pattern_rstruct pipe_ctx *pipe_ctx =NULL ;struct amdgpu_dm_connector *aconnector = link->priv;struct drm_device *dev = aconnector->base.dev; +struct dc_state *dc_state = ctx->dc->current_state; +struct clk_mgr *clk_mgr = ctx->dc->clk_mgr;int i;for (i =0 ; i <MAX_PIPES ; i++) {
@@ -1221,6 +1224,16 @@ bool dm_helpers_dp_handle_test_pattern_r pipe_ctx->stream->test_pattern.type = test_pattern; pipe_ctx->stream->test_pattern.color_space = test_pattern_color_space; +/* Temp W/A for compliance test failure */ + dc_state->bw_ctx.bw.dcn.clk.p_state_change_support = false; + dc_state->bw_ctx.bw.dcn.clk.dramclk_khz = clk_mgr->dc_mode_softmax_enabled ? + clk_mgr->bw_params->dc_mode_softmax_memclk : clk_mgr->bw_params->max_memclk_mhz; + dc_state->bw_ctx.bw.dcn.clk.idle_dramclk_khz = dc_state->bw_ctx.bw.dcn.clk.dramclk_khz; + ctx->dc->clk_mgr->funcs->update_clocks ( + ctx->dc->clk_mgr, + dc_state, + false); + dc_link_dp_set_test_pattern( (struct dc_link *) link, test_pattern,
Greg Kroah-Hartman
maintainerPATCH 242/261 ata: libata: Set DID_TIME_OUT for commands that actually timed out
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Niklas Cassel <[email protected]>
commit 8e59a2a5459fd9840dbe2cbde85fe154b11e1727 upstream.
When ata_qc_complete() schedules a command for EH using ata_qc_schedule_eh(), blk_abort_request() will be called, which leads to req->q->mq_ops->timeout() / scsi_timeout() being called.
scsi_timeout(), if the LLDD has no abort handler (libata has no abort handler), will set host byte to DID_TIME_OUT, and then call scsi_eh_scmd_add() to add the command to EH.
Thus, when commands first enter libata's EH strategy_handler, all the commands that have been added to EH will have DID_TIME_OUT set.
Commit e5dd410acb34 ("ata: libata: Clear DID_TIME_OUT for ATA PT commands with sense data") clears this bogus DID_TIME_OUT flag for all commands that reached libata's EH strategy_handler.
libata has its own flag (AC_ERR_TIMEOUT), that it sets for commands that have not received a completion at the time of entering EH.
ata_eh_worth_retry() has no special handling for AC_ERR_TIMEOUT, so by default timed out commands will get flag ATA_QCFLAG_RETRY set, and will be retried after the port has been reset (ata_eh_link_autopsy() always triggers a port reset if any command has AC_ERR_TIMEOUT set).
For a command that has ATA_QCFLAG_RETRY set, while also having an error flag set (e.g. AC_ERR_TIMEOUT), ata_eh_finish() will not increment scmd->allowed, so the command will at most be retried scmd->allowed number of times (which by default is set to 3).
However, scsi_eh_flush_done_q() will only retry commands for which scsi_noretry_cmd() returns false.
For a command that has DID_TIME_OUT set, while also having either the FAILFAST flag set, or the command being a passthrough command, scsi_noretry_cmd() will return true. Thus, such a command will never be retried.
Thus, make sure that libata sets SCSI's DID_TIME_OUT flag for commands that actually timed out (libata's AC_ERR_TIMEOUT flag), such that timed out commands will once again not be retried if they are also a FAILFAST or passthrough command.
--- drivers/ata/libata-eh.c | 1 + 1 file changed, 1 insertion(+)
drivers/ata/libata-eh.c +1 -0
@@ -648,6 +648,7 @@ void ata_scsi_cmd_error_handler(struct S/* the scmd has an associated qc */ if (!(qc->flags &ATA_QCFLAG_EH )) {/* which hasn't failed yet, timeout */ +set_host_byte (scmd,DID_TIME_OUT ); qc->err_mask |=AC_ERR_TIMEOUT ; qc->flags |=ATA_QCFLAG_EH ; nr_timedout++;
Greg Kroah-Hartman
maintainerPATCH 243/261 ASoC: SOF: Intel: hda-loader: do not wait for HDaudio IOC
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kai Vehmanen <[email protected]>
commit 9814c1447f9cc67c9e88e0a4423de3a496078360 upstream.
Commit 9ee3f0d8c999 ("ASOC: SOF: Intel: hda-loader: only wait for HDaudio IOC for IPC4 devices") removed DMA wait for IPC3 case. Proceed and remove the wait for IPC4 devices as well.
There is no dependency to IPC version in the load logic and checking the firmware status is a sufficient check in case of errors.
The removed code also had a bug in that -ETIMEDOUT is returned without stopping the DMA transfer.
--- sound/soc/sof/intel/hda-loader.c | 17 ----------------- 1 file changed, 17 deletions(-)
sound/soc/sof/intel/hda-loader.c +0 -17
@@ -294,14 +294,9 @@ int hda_cl_copy_fw(struct snd_sof_dev *s {struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata;const struct sof_intel_dsp_desc *chip = hda->desc; -struct sof_intel_hda_stream *hda_stream; -unsigned long time_left;unsigned int reg;int ret, status; - hda_stream = container_of(hext_stream, struct sof_intel_hda_stream, - hext_stream); -dev_dbg (sdev->dev,"Code loader DMA starting\n" ); ret =hda_cl_trigger (sdev->dev, hext_stream,SNDRV_PCM_TRIGGER_START );
@@ -310,18 +305,6 @@ int hda_cl_copy_fw(struct snd_sof_dev *sreturn ret; } -if (sdev->pdata->ipc_type ==SOF_IPC_TYPE_4 ) { -/* Wait for completion of transfer */ - time_left =wait_for_completion_timeout (&hda_stream->ioc, -msecs_to_jiffies (HDA_CL_DMA_IOC_TIMEOUT_MS )); - -if (!time_left) { -dev_err (sdev->dev,"Code loader DMA did not complete\n" ); -return -ETIMEDOUT ; - } -dev_dbg (sdev->dev,"Code loader DMA done\n" ); - } -dev_dbg (sdev->dev,"waiting for FW_ENTERED status\n" ); status = snd_sof_dsp_read_poll_timeout(sdev, HDA_DSP_BAR,
Greg Kroah-Hartman
maintainerPATCH 244/261 ASoC: SOF: Intel: hda: Handle prepare without close for non-HDA DAIs
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ranjani Sridharan <[email protected]>
commit 6e38a7e098d32d128b00b42a536151de9ea1340b upstream.
When a PCM is restarted after a snd_pcm_drain/snd_pcm_drop(), the prepare callback will be invoked and the hw_params will be set again. For the HDA DAI's, the hw_params function handles this case already but not for the non-HDA DAI's. So, add the check for link_prepared to verify if the hw_params should be done again or not. Additionally, for SDW DAI's reset the PCMSyCM registers as would be done in the case of a start after a hw_free.
All: [email protected] # 6.10.x 6.11.x
--- sound/soc/sof/intel/hda-dai.c | 36 +++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-)
sound/soc/sof/intel/hda-dai.c +32 -4
@@ -370,6 +370,13 @@ static int non_hda_dai_hw_params_data(struct snd_pcm_substream *substream,return -EINVAL ; } + sdev =widget_to_sdev (w); + hext_stream = ops->get_hext_stream (sdev, cpu_dai, substream); + +/* nothing more to do if the link is already prepared */ +if (hext_stream && hext_stream->link_prepared) +return 0 ; +/* use HDaudio stream handling */ ret =hda_dai_hw_params_data (substream, params, cpu_dai, data, flags);if (ret <0 ) {
@@ -377,7 +384,6 @@ static int non_hda_dai_hw_params_data(struct snd_pcm_substream *substream,return ret; } - sdev =widget_to_sdev (w);if (sdev->dspless_mode_selected)return 0 ;
@@ -482,6 +488,31 @@ int sdw_hda_dai_hw_params(struct snd_pcm_substream *substream,int ret;int i; + ops =hda_dai_get_ops (substream, cpu_dai); +if (!ops) { +dev_err (cpu_dai->dev,"DAI widget ops not set\n" ); +return -EINVAL ; + } + + sdev =widget_to_sdev (w); + hext_stream = ops->get_hext_stream (sdev, cpu_dai, substream); + +/* nothing more to do if the link is already prepared */ +if (hext_stream && hext_stream->link_prepared) +return 0 ; + +/* +* reset the PCMSyCM registers to handle a prepare callback when the PCM is restarted +* due to xruns or after a call to snd_pcm_drain/drop() +*/ + ret =hdac_bus_eml_sdw_map_stream_ch (sof_to_bus (sdev), link_id, cpu_dai->id, +0 ,0 , substream->stream); +if (ret <0 ) { +dev_err (cpu_dai->dev,"%s: hdac_bus_eml_sdw_map_stream_ch failed %d\n" , + __func__, ret); +return ret; + } + data.dai_index = (link_id <<8 ) | cpu_dai->id; data.dai_node_id = intel_alh_id; ret =non_hda_dai_hw_params_data (substream, params, cpu_dai, &data, flags);
@@ -490,10 +521,7 @@ int sdw_hda_dai_hw_params(struct snd_pcm_substream *substream,return ret; } - ops =hda_dai_get_ops (substream, cpu_dai); - sdev =widget_to_sdev (w); hext_stream = ops->get_hext_stream (sdev, cpu_dai, substream); -if (!hext_stream)return -ENODEV ;
Signature · 1 line
2.47.0
Greg Kroah-Hartman
maintainerPATCH 245/261 ASoC: SOF: Intel: hda: Always clean up link DMA during stop
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ranjani Sridharan <[email protected]>
commit ab5593793e9088abcddce30ba8e376e31b7285fd upstream.
This is required to reset the DMA read/write pointers when the stream is prepared and restarted after a call to snd_pcm_drain()/snd_pcm_drop(). Also, now that the stream is reset during stop, do not save LLP registers in the case of STOP/suspend to avoid erroneous delay reporting.
All: [email protected] # 6.10.x 6.11.x
--- sound/soc/sof/intel/hda-dai-ops.c | 23 ++++++++++------------- sound/soc/sof/intel/hda-dai.c | 1 + 2 files changed, 11 insertions(+), 13 deletions(-)
sound/soc/sof/intel/hda-dai-ops.c +10 -13
@@ -346,20 +346,21 @@ static int hda_trigger(struct snd_sof_decase SNDRV_PCM_TRIGGER_PAUSE_RELEASE :snd_hdac_ext_stream_start (hext_stream);break ; -case SNDRV_PCM_TRIGGER_SUSPEND : -case SNDRV_PCM_TRIGGER_STOP :case SNDRV_PCM_TRIGGER_PAUSE_PUSH : -snd_hdac_ext_stream_clear (hext_stream); -/* -* Save the LLP registers in case the stream is -* restarting due PAUSE_RELEASE, or START without a pcm -* close/open since in this case the LLP register is not reset -* to 0 and the delay calculation will return with invalid -* results. +* Save the LLP registers since in case of PAUSE the LLP +* register are not reset to 0, the delay calculation will use +* the saved offsets for compensating the delay calculation. */ hext_stream->pplcllpl =readl (hext_stream->pplc_addr +AZX_REG_PPLCLLPL ); hext_stream->pplcllpu =readl (hext_stream->pplc_addr +AZX_REG_PPLCLLPU ); +snd_hdac_ext_stream_clear (hext_stream); +break ; +case SNDRV_PCM_TRIGGER_SUSPEND : +case SNDRV_PCM_TRIGGER_STOP : + hext_stream->pplcllpl =0 ; + hext_stream->pplcllpu =0 ; +snd_hdac_ext_stream_clear (hext_stream);break ;default :dev_err (sdev->dev,"unknown trigger command %d\n" , cmd);
@@ -512,7 +513,6 @@ static const struct hda_dai_widget_dma_ostatic int hda_ipc3_post_trigger (struct snd_sof_dev *sdev,struct snd_soc_dai *cpu_dai,struct snd_pcm_substream *substream,int cmd) { -struct hdac_ext_stream *hext_stream =hda_get_hext_stream (sdev, cpu_dai, substream);struct snd_soc_dapm_widget *w =snd_soc_dai_get_widget (cpu_dai, substream->stream);switch (cmd) {
@@ -527,9 +527,6 @@ static int hda_ipc3_post_trigger(structif (ret <0 )return ret; -if (cmd ==SNDRV_PCM_TRIGGER_STOP ) -return hda_link_dma_cleanup (substream, hext_stream, cpu_dai); -break ; }case SNDRV_PCM_TRIGGER_PAUSE_PUSH :
sound/soc/sof/intel/hda-dai.c +1 -0
@@ -302,6 +302,7 @@ static int __maybe_unused hda_dai_trigge }switch (cmd) { +case SNDRV_PCM_TRIGGER_STOP :case SNDRV_PCM_TRIGGER_SUSPEND : ret =hda_link_dma_cleanup (substream, hext_stream, dai);if (ret <0 ) {
Greg Kroah-Hartman
maintainerPATCH 246/261 ASoC: SOF: ipc4-topology: Do not set ALH node_id for aggregated DAIs
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ranjani Sridharan <[email protected]>
commit 9822b4c90d77e3c6555fb21c459c4a61c6a8619f upstream.
For aggregated DAIs, the node ID is set to the group_id during the DAI widget's ipc_prepare op. With the current logic, setting the dai_index for node_id in the dai_config is redundant as it will be overwritten with the group_id anyway. Removing it will also prevent any accidental clearing/resetting of the group_id for aggregated DAIs due to the dai_config calls could that happen before the allocated group_id is freed.
All: [email protected] # 6.10.x 6.11.x
--- sound/soc/sof/ipc4-topology.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
sound/soc/sof/ipc4-topology.c +13 -2
@@ -3129,9 +3129,20 @@ static int sof_ipc4_dai_config(struct snd_sof_dev *sdev, struct snd_sof_widget ** group_id during copier's ipc_prepare op. */ if (flags &SOF_DAI_CONFIG_FLAGS_HW_PARAMS ) { +struct sof_ipc4_alh_configuration_blob *blob; + + blob = (struct sof_ipc4_alh_configuration_blob *)ipc4_copier->copier_config; ipc4_copier->dai_index = data->dai_node_id; - copier_data->gtw_cfg.node_id &= ~SOF_IPC4_NODE_INDEX_MASK ; - copier_data->gtw_cfg.node_id |=SOF_IPC4_NODE_INDEX (data->dai_node_id); + +/* +* no need to set the node_id for aggregated DAI's. These will be assigned +* a group_id during widget ipc_prepare +*/ +if (blob->alh_cfg.device_count ==1 ) { + copier_data->gtw_cfg.node_id &= ~SOF_IPC4_NODE_INDEX_MASK ; + copier_data->gtw_cfg.node_id |= +SOF_IPC4_NODE_INDEX (data->dai_node_id); + } }break ;
Signature · 1 line
2.47.0
Greg Kroah-Hartman
maintainerPATCH 247/261 ASoC: dapm: avoid container_of() to get component
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Benjamin Bara <[email protected]>
commit 3fe9f5882cf71573516749b0bb687ef88f470d1d upstream.
The current implementation does not work for widgets of DAPMs without component, as snd_soc_dapm_to_component() requires it. If the widget is directly owned by the card, e.g. as it is the case for the tegra implementation, the call leads to UB. Therefore directly access the component of the widget's DAPM to be able to check if a component is available.
--- sound/soc/soc-dapm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/soc-dapm.c +2 -2
@@ -2786,10 +2786,10 @@ EXPORT_SYMBOL_GPL(snd_soc_dapm_update_daint snd_soc_dapm_widget_name_cmp (struct snd_soc_dapm_widget *widget,const char *s) { -struct snd_soc_component *component =snd_soc_dapm_to_component (widget->dapm); +struct snd_soc_component *component = widget->dapm->component;const char *wname = widget->name; -if (component->name_prefix) +if (component && component->name_prefix) wname +=strlen (component->name_prefix) +1 ;/* plus space */ return strcmp (wname, s);
Greg Kroah-Hartman
maintainerPATCH 248/261 ASoC: qcom: sc7280: Fix missing Soundwire runtime stream alloc
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
commit db7e59e6a39a4d3d54ca8197c796557e6d480b0d upstream.
Commit 15c7fab0e047 ("ASoC: qcom: Move Soundwire runtime stream alloc to soundcards") moved the allocation of Soundwire stream runtime from the Qualcomm Soundwire driver to each individual machine sound card driver, except that it forgot to update SC7280 card.
Just like for other Qualcomm sound cards using Soundwire, the card driver should allocate and release the runtime. Otherwise sound playback will result in a NULL pointer dereference or other effect of uninitialized memory accesses (which was confirmed on SDM845 having similar issue).
--- sound/soc/qcom/Kconfig | 1 + sound/soc/qcom/sc7280.c | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-)
sound/soc/qcom/Kconfig +1 -0
@@ -208,6 +208,7 @@ config SND_SOC_SC7280 tristate "SoC Machine driver for SC7280 boards" depends on I2C && SOUNDWIRE select SND_SOC_QCOM_COMMON + select SND_SOC_QCOM_SDW select SND_SOC_LPASS_SC7280 select SND_SOC_MAX98357A select SND_SOC_WCD938X_SDW
sound/soc/qcom/sc7280.c +9 -1
@@ -23,6 +23,7 @@#include "common.h" #include "lpass.h" #include "qdsp6/q6afe.h" +#include "sdw.h" #define DEFAULT_MCLK_RATE 19200000#define RT5682_PLL_FREQ (48000 * 512)
@@ -316,6 +317,7 @@ static void sc7280_snd_shutdown(struct sstruct snd_soc_card *card = rtd->card;struct sc7280_snd_data *data =snd_soc_card_get_drvdata (card);struct snd_soc_dai *cpu_dai =snd_soc_rtd_to_cpu (rtd,0 ); +struct sdw_stream_runtime *sruntime = data->sruntime[cpu_dai->id];switch (cpu_dai->id) {case MI2S_PRIMARY :
@@ -333,6 +335,9 @@ static void sc7280_snd_shutdown(struct sdefault :break ; } + + data->sruntime[cpu_dai->id] =NULL ; +sdw_release_stream (sruntime); }static int sc7280_snd_startup (struct snd_pcm_substream *substream)
@@ -347,6 +352,8 @@ static int sc7280_snd_startup(struct sndswitch (cpu_dai->id) {case MI2S_PRIMARY : ret =sc7280_rt5682_init (rtd); +if (ret) +return ret;break ;case SECONDARY_MI2S_RX : codec_dai_fmt |=SND_SOC_DAIFMT_NB_NF |SND_SOC_DAIFMT_I2S ;
@@ -360,7 +367,8 @@ static int sc7280_snd_startup(struct snddefault :break ; } -return ret; + +return qcom_snd_sdw_startup (substream); }static const struct snd_soc_ops sc7280_ops = {
Greg Kroah-Hartman
maintainerPATCH 249/261 ASoC: qcom: sdm845: add missing soundwire runtime stream alloc
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexey Klimov <[email protected]>
commit d0e806b0cc6260b59c65e606034a63145169c04c upstream.
During the migration of Soundwire runtime stream allocation from the Qualcomm Soundwire controller to SoC's soundcard drivers the sdm845 soundcard was forgotten.
At this point any playback attempt or audio daemon startup, for instance on sdm845-db845c (Qualcomm RB3 board), will result in stream pointer NULL dereference:
Unable to handle kernel NULL pointer dereference at virtual address 0000000000000020 Mem abort info: ESR = 0x0000000096000004 EC = 0x25: DABT (current EL), IL = 32 bits SET = 0, FnV = 0 EA = 0, S1PTW = 0 FSC = 0x04: level 0 translation fault Data abort info: ISV = 0, ISS = 0x00000004, ISS2 = 0x00000000 CM = 0, WnR = 0, TnD = 0, TagAccess = 0 GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0 user pgtable: 4k pages, 48-bit VAs, pgdp=0000000101ecf000 [0000000000000020] pgd=0000000000000000, p4d=0000000000000000 Internal error: Oops: 0000000096000004 [#1] PREEMPT SMP Modules linked in: ... CPU: 5 UID: 0 PID: 1198 Comm: aplay Not tainted 6.12.0-rc2-qcomlt-arm64-00059-g9d78f315a362-dirty #18 Hardware name: Thundercomm Dragonboard 845c (DT) pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : sdw_stream_add_slave+0x44/0x380 [soundwire_bus] lr : sdw_stream_add_slave+0x44/0x380 [soundwire_bus] sp : ffff80008a2035c0 x29: ffff80008a2035c0 x28: ffff80008a203978 x27: 0000000000000000 x26: 00000000000000c0 x25: 0000000000000000 x24: ffff1676025f4800 x23: ffff167600ff1cb8 x22: ffff167600ff1c98 x21: 0000000000000003 x20: ffff167607316000 x19: ffff167604e64e80 x18: 0000000000000000 x17: 0000000000000000 x16: ffffcec265074160 x15: 0000000000000000 x14: 0000000000000000 x13: 0000000000000000 x12: 0000000000000000 x11: 0000000000000000 x10: 0000000000000000 x9 : 0000000000000000 x8 : 0000000000000000 x7 : 0000000000000000 x6 : ffff167600ff1cec x5 : ffffcec22cfa2010 x4 : 0000000000000000 x3 : 0000000000000003 x2 : ffff167613f836c0 x1 : 0000000000000000 x0 : ffff16761feb60b8 Call trace: sdw_stream_add_slave+0x44/0x380 [soundwire_bus] wsa881x_hw_params+0x68/0x80 [snd_soc_wsa881x] snd_soc_dai_hw_params+0x3c/0xa4 __soc_pcm_hw_params+0x230/0x660 dpcm_be_dai_hw_params+0x1d0/0x3f8 dpcm_fe_dai_hw_params+0x98/0x268 snd_pcm_hw_params+0x124/0x460 snd_pcm_common_ioctl+0x998/0x16e8 snd_pcm_ioctl+0x34/0x58 __arm64_sys_ioctl+0xac/0xf8 invoke_syscall+0x48/0x104 el0_svc_common.constprop.0+0x40/0xe0 do_el0_svc+0x1c/0x28 el0_svc+0x34/0xe0 el0t_64_sync_handler+0x120/0x12c el0t_64_sync+0x190/0x194 Code: aa0403fb f9418400 9100e000 9400102f (f8420f22) ---[ end trace 0000000000000000 ]---
0000000000006108 <sdw_stream_add_slave>:
6108: d503233f paciasp
610c: a9b97bfd stp x29, x30, [sp, #-112]!
6110: 910003fd mov x29, sp
6114: a90153f3 stp x19, x20, [sp, #16]
6118: a9025bf5 stp x21, x22, [sp, #32]
611c: aa0103f6 mov x22, x1
6120: 2a0303f5 mov w21, w3
6124: a90363f7 stp x23, x24, [sp, #48]
6128: aa0003f8 mov x24, x0
612c: aa0203f7 mov x23, x2
6130: a9046bf9 stp x25, x26, [sp, #64]
6134: aa0403f9 mov x25, x4 <-- x4 copied to x25
6138: a90573fb stp x27, x28, [sp, #80]
613c: aa0403fb mov x27, x4
6140: f9418400 ldr x0, [x0, #776]
6144: 9100e000 add x0, x0, #0x38
6148: 94000000 bl 0 <mutex_lock>
614c: f8420f22 ldr x2, [x25, #32]! <-- offset 0x44
^^^This is 0x6108 + offset 0x44 from the beginning of sdw_stream_add_slave() where data abort happens.wsa881x_hw_params() is called with stream = NULL and passes it further in register x4 (5th argument) to sdw_stream_add_slave() without any checks. Value from x4 is copied to x25 and finally it aborts on trying to load a value from address in x25 plus offset 32 (in dec) which corresponds to master_list member in struct sdw_stream_runtime:
struct sdw_stream_runtime {
const char * name; /* 0 8 */
struct sdw_stream_params params; /* 8 12 */
enum sdw_stream_state state; /* 20 4 */
enum sdw_stream_type type; /* 24 4 */
/* XXX 4 bytes hole, try to pack */
here-> struct list_head master_list; /* 32 16 */
int m_rt_count; /* 48 4 */
/* size: 56, cachelines: 1, members: 6 */
/* sum members: 48, holes: 1, sum holes: 4 */
/* padding: 4 */
/* last cacheline: 56 bytes */Fix this by adding required calls to qcom_snd_sdw_startup() and sdw_release_stream() to startup and shutdown routines which restores the previous correct behaviour when ->set_stream() method is called to set a valid stream runtime pointer on playback startup.
Reproduced and then fix was tested on db845c RB3 board.
--- sound/soc/qcom/sdm845.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
sound/soc/qcom/sdm845.c +6 -1
@@ -15,6 +15,7 @@#include <uapi/linux/input-event-codes.h> #include "common.h" #include "qdsp6/q6afe.h" +#include "sdw.h" #include "../codecs/rt5663.h" #define DRIVER_NAME "sdm845"
@@ -416,7 +417,7 @@ static int sdm845_snd_startup(struct sndpr_err ("%s: invalid dai id 0x%x\n" , __func__, cpu_dai->id);break ; } -return 0 ; +return qcom_snd_sdw_startup (substream); }static void sdm845_snd_shutdown (struct snd_pcm_substream *substream)
@@ -425,6 +426,7 @@ static void sdm845_snd_shutdown(structstruct snd_soc_card *card = rtd->card;struct sdm845_snd_data *data =snd_soc_card_get_drvdata (card);struct snd_soc_dai *cpu_dai =snd_soc_rtd_to_cpu (rtd,0 ); +struct sdw_stream_runtime *sruntime = data->sruntime[cpu_dai->id];switch (cpu_dai->id) {case PRIMARY_MI2S_RX :
@@ -463,6 +465,9 @@ static void sdm845_snd_shutdown(structpr_err ("%s: invalid dai id 0x%x\n" , __func__, cpu_dai->id);break ; } + + data->sruntime[cpu_dai->id] =NULL ; +sdw_release_stream (sruntime); }static int sdm845_snd_prepare (struct snd_pcm_substream *substream)
Greg Kroah-Hartman
maintainerPATCH 250/261 ASoC: qcom: Fix NULL Dereference in asoc_qcom_lpass_cpu_platform_probe()
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zichen Xie <[email protected]>
commit 49da1463c9e3d2082276c3e0e2a8b65a88711cd2 upstream.
A devm_kzalloc() in asoc_qcom_lpass_cpu_platform_probe() could possibly return NULL pointer. NULL Pointer Dereference may be triggerred without addtional check.
Add a NULL check for the returned pointer.
--- sound/soc/qcom/lpass-cpu.c | 2 ++ 1 file changed, 2 insertions(+)
sound/soc/qcom/lpass-cpu.c +2 -0
@@ -1242,6 +1242,8 @@ int asoc_qcom_lpass_cpu_platform_probe(s/* Allocation for i2sctl regmap fields */ drvdata->i2sctl =devm_kzalloc (&pdev->dev,sizeof (struct lpaif_i2sctl ),GFP_KERNEL ); +if (!drvdata->i2sctl) +return -ENOMEM ;/* Initialize bitfields for dai I2SCTL register */ ret = lpass_cpu_init_i2sctl_bitfields(dev, drvdata->i2sctl,
Greg Kroah-Hartman
maintainerPATCH 251/261 Revert " fs/9p: mitigate inode collisions"
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dominique Martinet <[email protected]>
commit f69999b5f9b444a2443ca2b9e5976e78bb5b7c69 upstream.
This reverts commit d05dcfdf5e1659b2949d13060284eff3888b644e.
This is a requirement to revert commit 724a08450f74 ("fs/9p: simplify iget to remove unnecessary paths"), see that revert for details.
Message-ID: <[email protected]>
--- fs/9p/v9fs.h | 11 +++++------ fs/9p/vfs_inode.c | 37 ++++++++----------------------------- fs/9p/vfs_inode_dotl.c | 28 ++++++++-------------------- fs/9p/vfs_super.c | 2 +- 4 files changed, 22 insertions(+), 56 deletions(-)
fs/9p/v9fs.h +5 -6
@@ -179,14 +179,13 @@ extern int v9fs_vfs_rename(struct mnt_id struct inode *old_dir, struct dentry *old_dentry, struct inode *new_dir, struct dentry *new_dentry, unsigned int flags); -extern struct inode *v9fs_fid_iget (struct super_block *sb,struct p9_fid *fid, -bool new); +extern struct inode *v9fs_fid_iget (struct super_block *sb,struct p9_fid *fid);extern const struct inode_operations v9fs_dir_inode_operations_dotl;extern const struct inode_operations v9fs_file_inode_operations_dotl;extern const struct inode_operations v9fs_symlink_inode_operations_dotl;extern const struct netfs_request_ops v9fs_req_ops;extern struct inode *v9fs_fid_iget_dotl (struct super_block *sb, -struct p9_fid *fid,bool new); +struct p9_fid *fid);/* other default globals */ #define V9FS_PORT 564
@@ -225,12 +224,12 @@ static inline int v9fs_proto_dotl(struct*/ static inline struct inode *v9fs_get_inode_from_fid (struct v9fs_session_info *v9ses,struct p9_fid *fid, -struct super_block *sb,bool new) +struct super_block *sb) {if (v9fs_proto_dotl (v9ses)) -return v9fs_fid_iget_dotl (sb, fid, new); +return v9fs_fid_iget_dotl (sb, fid);else -return v9fs_fid_iget (sb, fid, new); +return v9fs_fid_iget (sb, fid); }#endif
fs/9p/vfs_inode.c +8 -29
@@ -365,8 +365,7 @@ void v9fs_evict_inode(struct inode *inodclear_inode (inode); } -struct inode * -v9fs_fid_iget (struct super_block *sb,struct p9_fid *fid,bool new) +struct inode *v9fs_fid_iget (struct super_block *sb,struct p9_fid *fid) {dev_t rdev;int retval;
@@ -378,18 +377,8 @@ v9fs_fid_iget(struct super_block *sb, st inode =iget_locked (sb,QID2INO (&fid->qid));if (unlikely (!inode))return ERR_PTR (-ENOMEM ); -if (!(inode->i_state &I_NEW )) { -if (!new) { - goto done; - }else { -p9_debug (P9_DEBUG_VFS ,"WARNING: Inode collision %ld\n" , - inode->i_ino); -iput (inode); -remove_inode_hash (inode); - inode =iget_locked (sb,QID2INO (&fid->qid)); -WARN_ON (!(inode->i_state &I_NEW )); - } - } +if (!(inode->i_state &I_NEW )) +return inode;/* * initialize the inode with the stat info
@@ -413,11 +402,11 @@ v9fs_fid_iget(struct super_block *sb, stv9fs_set_netfs_context (inode);v9fs_cache_inode_get_cookie (inode);unlock_new_inode (inode); -done:return inode; error:iget_failed (inode);return ERR_PTR (retval); + }/**
@@ -449,15 +438,8 @@ static int v9fs_at_to_dotl_flags(int fla*/ static void v9fs_dec_count (struct inode *inode) { -if (!S_ISDIR (inode->i_mode) || inode->i_nlink >2 ) { -if (inode->i_nlink) { -drop_nlink (inode); - }else { -p9_debug (P9_DEBUG_VFS , -"WARNING: unexpected i_nlink zero %d inode %ld\n" , - inode->i_nlink, inode->i_ino); - } - } +if (!S_ISDIR (inode->i_mode) || inode->i_nlink >2 ) +drop_nlink (inode); }/**
@@ -508,9 +490,6 @@ static int v9fs_remove(struct inode *dir }else v9fs_dec_count (inode); -if (inode->i_nlink <=0 )/* no more refs unhash it */ -remove_inode_hash (inode); -v9fs_invalidate_inode_attr (inode);v9fs_invalidate_inode_attr (dir);
@@ -576,7 +555,7 @@ v9fs_create(struct v9fs_session_info *v9/* * instantiate inode and assign the unopened fid to the dentry */ - inode =v9fs_get_inode_from_fid (v9ses, fid, dir->i_sb, true); + inode =v9fs_get_inode_from_fid (v9ses, fid, dir->i_sb);if (IS_ERR (inode)) { err =PTR_ERR (inode); p9_debug(P9_DEBUG_VFS,
@@ -705,7 +684,7 @@ struct dentry *v9fs_vfs_lookup(struct inelse if (IS_ERR (fid)) inode =ERR_CAST (fid);else - inode =v9fs_get_inode_from_fid (v9ses, fid, dir->i_sb, false); + inode =v9fs_get_inode_from_fid (v9ses, fid, dir->i_sb);/* * If we had a rename on the server and a parallel lookup * for the new name, then make sure we instantiate with
fs/9p/vfs_inode_dotl.c +8 -20
@@ -52,10 +52,7 @@ static kgid_t v9fs_get_fsgid_for_create(return current_fsgid (); } - - -struct inode * -v9fs_fid_iget_dotl (struct super_block *sb,struct p9_fid *fid,bool new) +struct inode *v9fs_fid_iget_dotl (struct super_block *sb,struct p9_fid *fid) {int retval;struct inode *inode;
@@ -65,18 +62,8 @@ v9fs_fid_iget_dotl(struct super_block *s inode =iget_locked (sb,QID2INO (&fid->qid));if (unlikely (!inode))return ERR_PTR (-ENOMEM ); -if (!(inode->i_state &I_NEW )) { -if (!new) { - goto done; - }else {/* deal with race condition in inode number reuse */ -p9_debug (P9_DEBUG_ERROR ,"WARNING: Inode collision %lx\n" , - inode->i_ino); -iput (inode); -remove_inode_hash (inode); - inode =iget_locked (sb,QID2INO (&fid->qid)); -WARN_ON (!(inode->i_state &I_NEW )); - } - } +if (!(inode->i_state &I_NEW )) +return inode;/* * initialize the inode with the stat info
@@ -103,11 +90,12 @@ v9fs_fid_iget_dotl(struct super_block *s goto error;unlock_new_inode (inode); -done: +return inode; error:iget_failed (inode);return ERR_PTR (retval); + }struct dotl_openflag_map {
@@ -259,7 +247,7 @@ v9fs_vfs_atomic_open_dotl(struct inode *p9_debug (P9_DEBUG_VFS ,"p9_client_walk failed %d\n" , err); goto out; } - inode =v9fs_fid_iget_dotl (dir->i_sb, fid, true); + inode =v9fs_fid_iget_dotl (dir->i_sb, fid);if (IS_ERR (inode)) { err =PTR_ERR (inode);p9_debug (P9_DEBUG_VFS ,"inode creation failed %d\n" , err);
@@ -352,7 +340,7 @@ static int v9fs_vfs_mkdir_dotl(struct mn }/* instantiate inode and assign the unopened fid to the dentry */ - inode =v9fs_fid_iget_dotl (dir->i_sb, fid, true); + inode =v9fs_fid_iget_dotl (dir->i_sb, fid);if (IS_ERR (inode)) { err =PTR_ERR (inode); p9_debug(P9_DEBUG_VFS, "inode creation failed %d\n",
@@ -788,7 +776,7 @@ v9fs_vfs_mknod_dotl(struct mnt_idmap *id err); goto error; } - inode =v9fs_fid_iget_dotl (dir->i_sb, fid, true); + inode =v9fs_fid_iget_dotl (dir->i_sb, fid);if (IS_ERR (inode)) { err =PTR_ERR (inode); p9_debug(P9_DEBUG_VFS, "inode creation failed %d\n",
fs/9p/vfs_super.c +1 -1
@@ -139,7 +139,7 @@ static struct dentry *v9fs_mount(structelse sb->s_d_op = &v9fs_dentry_operations; - inode =v9fs_get_inode_from_fid (v9ses, fid, sb, true); + inode =v9fs_get_inode_from_fid (v9ses, fid, sb);if (IS_ERR (inode)) { retval =PTR_ERR (inode); goto release_sb;
Greg Kroah-Hartman
maintainerPATCH 252/261 Revert "fs/9p: remove redundant pointer v9ses"
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dominique Martinet <[email protected]>
commit fedd06210b14febfa69e09d0721746749ea9ea20 upstream.
This reverts commit 10211b4a23cf4a3df5c11a10e5b3d371f16a906f.
This is a requirement to revert commit 724a08450f74 ("fs/9p: simplify iget to remove unnecessary paths"), see that revert for details.
Message-ID: <[email protected]>
--- fs/9p/vfs_inode_dotl.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/9p/vfs_inode_dotl.c +4 -0
@@ -297,6 +297,7 @@ static int v9fs_vfs_mkdir_dotl(struct mnt_idmap *idmap, umode_t omode) {int err; +struct v9fs_session_info *v9ses;struct p9_fid *fid =NULL , *dfid =NULL ;kgid_t gid;const unsigned char *name;
@@ -306,6 +307,7 @@ static int v9fs_vfs_mkdir_dotl(struct mnt_idmap *idmap,struct posix_acl *dacl =NULL , *pacl =NULL ;p9_debug (P9_DEBUG_VFS ,"name %pd\n" , dentry); + v9ses =v9fs_inode2v9ses (dir); omode |=S_IFDIR ;if (dir->i_mode &S_ISGID )
@@ -737,6 +739,7 @@ v9fs_vfs_mknod_dotl(struct mnt_idmap *idmap, struct inode *dir,kgid_t gid;const unsigned char *name;umode_t mode; +struct v9fs_session_info *v9ses;struct p9_fid *fid =NULL , *dfid =NULL ;struct inode *inode;struct p9_qid qid;
@@ -746,6 +749,7 @@ v9fs_vfs_mknod_dotl(struct mnt_idmap *idmap, struct inode *dir, dir->i_ino, dentry, omode, MAJOR(rdev), MINOR(rdev)); + v9ses =v9fs_inode2v9ses (dir); dfid =v9fs_parent_fid (dentry);if (IS_ERR (dfid)) { err =PTR_ERR (dfid);
Signature · 1 line
2.47.0
Greg Kroah-Hartman
maintainerPATCH 253/261 Revert "fs/9p: fix uaf in in v9fs_stat2inode_dotl"
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dominique Martinet <[email protected]>
commit 26f8dd2dde6864558782d91542f89483bd59a3c2 upstream.
This reverts commit 11763a8598f888dec631a8a903f7ada32181001f.
This is a requirement to revert commit 724a08450f74 ("fs/9p: simplify iget to remove unnecessary paths"), see that revert for details.
Message-ID: <[email protected]>
--- fs/9p/vfs_inode_dotl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/9p/vfs_inode_dotl.c +1 -1
@@ -78,11 +78,11 @@ struct inode *v9fs_fid_iget_dotl(struct super_block *sb, struct p9_fid *fid) retval =v9fs_init_inode (v9ses, inode, &fid->qid, st->st_mode,new_decode_dev (st->st_rdev)); -v9fs_stat2inode_dotl (st, inode,0 );kfree (st);if (retval) goto error; +v9fs_stat2inode_dotl (st, inode,0 );v9fs_set_netfs_context (inode);v9fs_cache_inode_get_cookie (inode); retval =v9fs_get_acl (inode, fid);
Signature · 1 line
2.47.0
Greg Kroah-Hartman
maintainerPATCH 254/261 Revert "fs/9p: simplify iget to remove unnecessary paths"
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dominique Martinet <[email protected]>
commit be2ca3825372085d669d322dccd0542a90e5b434 upstream.
This reverts commit 724a08450f74b02bd89078a596fd24857827c012.
This code simplification introduced significant regressions on servers that do not remap inode numbers when exporting multiple underlying filesystems with colliding inodes, as can be illustrated with simple tmpfs exports in qemu with remapping disabled:
``` # host side cd /tmp/linux-test mkdir m1 m2 mount -t tmpfs tmpfs m1 mount -t tmpfs tmpfs m2 mkdir m1/dir m2/dir echo foo > m1/dir/foo echo bar > m2/dir/bar # guest side # started with -virtfs local,path=/tmp/linux-test,mount_tag=tmp,security_model=mapped-file mount -t 9p -o trans=virtio,debug=1 tmp /mnt/t ls /mnt/t/m1/dir # foo ls /mnt/t/m2/dir # bar (works ok if directry isn't open) # cd to keep first dir's inode alive cd /mnt/t/m1/dir ls /mnt/t/m2/dir # foo (should be bar) ```
Other examples can be crafted with regular files with fscache enabled, in which case I/Os just happen to the wrong file leading to corruptions, or guest failing to boot with:
| VFS: Lookup of 'com.android.runtime' in 9p 9p would have caused loop
In theory, we'd want the servers to be smart enough and ensure they never send us two different files with the same 'qid.path', but while qemu has an option to remap that is recommended (and qemu prints a warning if this case happens), there are many other servers which do not (kvmtool, nfs-ganesha, probably diod...), we should at least ensure we don't cause regressions on this:
- assume servers can't be trusted and operations that should get a 'new' inode properly do so. commit d05dcfdf5e16 (" fs/9p: mitigate inode collisions") attempted to do this, but v9fs_fid_iget_dotl() was not called so some higher level of caching got in the way; this needs to be fixed properly before we can re-apply the patches.
- if we ever want to really simplify this code, we will need to add some negotiation with the server at mount time where the server could claim they handle this properly, at which point we could optimize this out. (but that might not be needed at all if we properly handle the 'new' check?)
Message-ID: <[email protected]>
--- fs/9p/v9fs.h | 31 +++++++++++++-- fs/9p/v9fs_vfs.h | 2 - fs/9p/vfs_inode.c | 98 ++++++++++++++++++++++++++++++++++++++----------- fs/9p/vfs_inode_dotl.c | 92 +++++++++++++++++++++++++++++++++++++--------- fs/9p/vfs_super.c | 2 - 5 files changed, 180 insertions(+), 45 deletions(-)
fs/9p/v9fs.h +26 -5
@@ -179,13 +179,16 @@ extern int v9fs_vfs_rename(struct mnt_id struct inode *old_dir, struct dentry *old_dentry, struct inode *new_dir, struct dentry *new_dentry, unsigned int flags); -extern struct inode *v9fs_fid_iget (struct super_block *sb,struct p9_fid *fid); +extern struct inode *v9fs_inode_from_fid (struct v9fs_session_info *v9ses, +struct p9_fid *fid, +struct super_block *sb,int new);extern const struct inode_operations v9fs_dir_inode_operations_dotl;extern const struct inode_operations v9fs_file_inode_operations_dotl;extern const struct inode_operations v9fs_symlink_inode_operations_dotl;extern const struct netfs_request_ops v9fs_req_ops; -extern struct inode *v9fs_fid_iget_dotl (struct super_block *sb, -struct p9_fid *fid); +extern struct inode *v9fs_inode_from_fid_dotl (struct v9fs_session_info *v9ses, +struct p9_fid *fid, +struct super_block *sb,int new);/* other default globals */ #define V9FS_PORT 564
@@ -227,9 +230,27 @@ v9fs_get_inode_from_fid(struct v9fs_sess struct super_block *sb) {if (v9fs_proto_dotl (v9ses)) -return v9fs_fid_iget_dotl (sb, fid); +return v9fs_inode_from_fid_dotl (v9ses, fid, sb,0 );else -return v9fs_fid_iget (sb, fid); +return v9fs_inode_from_fid (v9ses, fid, sb,0 ); +} + +/** +* v9fs_get_new_inode_from_fid - Helper routine to populate an inode by +* issuing a attribute request +* @v9ses: session information +* @fid: fid to issue attribute request for +* @sb: superblock on which to create inode +* +*/ +static inline struct inode * +v9fs_get_new_inode_from_fid (struct v9fs_session_info *v9ses,struct p9_fid *fid, +struct super_block *sb) +{ +if (v9fs_proto_dotl (v9ses)) +return v9fs_inode_from_fid_dotl (v9ses, fid, sb,1 ); +else +return v9fs_inode_from_fid (v9ses, fid, sb,1 ); }#endif
fs/9p/v9fs_vfs.h +1 -1
@@ -42,7 +42,7 @@ struct inode *v9fs_alloc_inode(struct suvoid v9fs_free_inode (struct inode *inode);void v9fs_set_netfs_context (struct inode *inode);int v9fs_init_inode (struct v9fs_session_info *v9ses, -struct inode *inode,struct p9_qid *qid,umode_t mode,dev_t rdev); +struct inode *inode,umode_t mode,dev_t rdev);void v9fs_evict_inode (struct inode *inode);#if (BITS_PER_LONG ==32 )#define QID2INO (q) ((ino_t) (((q)->path+2) ^ (((q)->path) >> 32)))
fs/9p/vfs_inode.c +77 -21
150 lines not on this page · raw message
fs/9p/vfs_inode_dotl.c +75 -17
142 lines not on this page · raw message
fs/9p/vfs_super.c +1 -1
@@ -139,7 +139,7 @@ static struct dentry *v9fs_mount(structelse sb->s_d_op = &v9fs_dentry_operations; - inode =v9fs_get_inode_from_fid (v9ses, fid, sb); + inode =v9fs_get_new_inode_from_fid (v9ses, fid, sb);if (IS_ERR (inode)) { retval =PTR_ERR (inode); goto release_sb;
Greg Kroah-Hartman
maintainerPATCH 255/261 soundwire: intel_ace2x: Send PDI stream number during prepare
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ranjani Sridharan <[email protected]>
commit c78f1e15e46ac82607eed593b22992fd08644d96 upstream.
In the case of a prepare callback after an xrun or when the PCM is restarted after a call to snd_pcm_drain/snd_pcm_drop, avoid reprogramming the SHIM registers but send the PDI stream number so that the link DMA data can be set. This is needed for the case that the DMA data is cleared when the PCM is stopped and restarted without being closed.
All: [email protected] # 6.10.x 6.11.x
--- drivers/soundwire/intel_ace2x.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-)
drivers/soundwire/intel_ace2x.c +6 -13
@@ -376,11 +376,12 @@ static int intel_hw_params(struct snd_pcm_substream *substream,static int intel_prepare (struct snd_pcm_substream *substream,struct snd_soc_dai *dai) { +struct snd_soc_pcm_runtime *rtd =snd_soc_substream_to_rtd (substream);struct sdw_cdns *cdns =snd_soc_dai_get_drvdata (dai);struct sdw_intel *sdw =cdns_to_intel (cdns);struct sdw_cdns_dai_runtime *dai_runtime; +struct snd_pcm_hw_params *hw_params;int ch, dir; -int ret =0 ; dai_runtime = cdns->dai_runtime_array[dai->id];if (!dai_runtime) {
@@ -389,12 +390,8 @@ static int intel_prepare(struct snd_pcm_substream *substream,return -EIO ; } + hw_params = &rtd->dpcm[substream->stream].hw_params;if (dai_runtime->suspended) { -struct snd_soc_pcm_runtime *rtd =snd_soc_substream_to_rtd (substream); -struct snd_pcm_hw_params *hw_params; - - hw_params = &rtd->dpcm[substream->stream].hw_params; - dai_runtime->suspended = false;/*
@@ -415,15 +412,11 @@ static int intel_prepare(struct snd_pcm_substream *substream,/* the SHIM will be configured in the callback functions */ sdw_cdns_config_stream (cdns, ch, dir, dai_runtime->pdi); - -/* Inform DSP about PDI stream number */ - ret =intel_params_stream (sdw, substream, dai, - hw_params, - sdw->instance, - dai_runtime->pdi->intel_alh_id); } -return ret; +/* Inform DSP about PDI stream number */ +return intel_params_stream (sdw, substream, dai, hw_params, sdw->instance, + dai_runtime->pdi->intel_alh_id); } static int
Signature · 1 line
2.47.0
Greg Kroah-Hartman
maintainerPATCH 256/261 x86: support user address masking instead of non-speculative conditional
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Torvalds <[email protected]>
commit 2865baf54077aa98fcdb478cefe6a42c417b9374 upstream.
The Spectre-v1 mitigations made "access_ok()" much more expensive, since it has to serialize execution with the test for a valid user address.
All the normal user copy routines avoid this by just masking the user address with a data-dependent mask instead, but the fast "unsafe_user_read()" kind of patterms that were supposed to be a fast case got slowed down.
This introduces a notion of using
src = masked_user_access_begin(src);
to do the user address sanity using a data-dependent mask instead of the more traditional conditional
if (user_read_access_begin(src, len)) {model.
This model only works for dense accesses that start at 'src' and on architectures that have a guard region that is guaranteed to fault in between the user space and the kernel space area.
With this, the user access doesn't need to be manually checked, because a bad address is guaranteed to fault (by some architecture masking
trick: on x86-64 this involves just turning an invalid user address into all ones, since we don't map the top of address space).
This only converts a couple of examples for now. Example x86-64 code generation for loading two words from user space:
stac
mov %rax,%rcx
sar $0x3f,%rcx
or %rax,%rcx
mov (%rcx),%r13
mov 0x8(%rcx),%r14
clacwhere all the error handling and -EFAULT is now purely handled out of line by the exception path.
Of course, if the micro-architecture does badly at 'clac' and 'stac', the above is still pitifully slow. But at least we did as well as we could.
--- arch/x86/include/asm/uaccess_64.h | 8 ++++++++ fs/select.c | 4 +++- include/linux/uaccess.h | 7 +++++++ lib/strncpy_from_user.c | 9 +++++++++ lib/strnlen_user.c | 9 +++++++++ 5 files changed, 36 insertions(+), 1 deletion(-)
arch/x86/include/asm/uaccess_64.h +8 -0
@@ -54,6 +54,14 @@ static inline unsigned long __untagged_a#define valid_user_address (x) ((__force long)(x) >= 0)/* +* Masking the user address is an alternative to a conditional +* user_access_begin that can avoid the fencing. This only works +* for dense accesses starting at the address. +*/ +#define mask_user_address (x) ((typeof(x))((long)(x)|((long)(x)>>63))) +#define masked_user_access_begin (x) ({ __uaccess_begin(); mask_user_address(x); }) + +/* * User pointers can have tag bits on x86-64. This scheme tolerates * arbitrary values in those bits rather then masking them off. *
fs/select.c +3 -1
@@ -780,7 +780,9 @@ static inline int get_sigset_argpack(str {// the path is hot enough for overhead of copy_from_user() to matter if (from) { -if (!user_read_access_begin (from,sizeof (*from))) +if (can_do_masked_user_access ()) + from =masked_user_access_begin (from); +else if (!user_read_access_begin (from,sizeof (*from)))return -EFAULT ;unsafe_get_user (to->p, &from->p, Efault);unsafe_get_user (to->size, &from->size, Efault);
include/linux/uaccess.h +7 -0
@@ -33,6 +33,13 @@ })#endif +#ifdef masked_user_access_begin +#define can_do_masked_user_access () 1 +#else +#define can_do_masked_user_access () 0 +#define masked_user_access_begin (src) NULL +#endif +/* * Architectures should provide two primitives (raw_copy_{to,from}_user()) * and get rid of their private instances of copy_{to,from}_user() and
lib/strncpy_from_user.c +9 -0
@@ -120,6 +120,15 @@ long strncpy_from_user(char *dst, constif (unlikely (count <=0 ))return 0 ; +if (can_do_masked_user_access ()) { +long retval; + + src =masked_user_access_begin (src); + retval =do_strncpy_from_user (dst, src, count, count); +user_read_access_end (); +return retval; + } + max_addr =TASK_SIZE_MAX ; src_addr = (unsigned long )untagged_addr (src);if (likely (src_addr < max_addr)) {
lib/strnlen_user.c +9 -0
@@ -96,6 +96,15 @@ long strnlen_user(const char __user *strif (unlikely (count <=0 ))return 0 ; +if (can_do_masked_user_access ()) { +long retval; + + str =masked_user_access_begin (str); + retval =do_strnlen_user (str, count, count); +user_read_access_end (); +return retval; + } + max_addr =TASK_SIZE_MAX ; src_addr = (unsigned long )untagged_addr (str);if (likely (src_addr < max_addr)) {
Greg Kroah-Hartman
maintainerPATCH 257/261 x86: fix whitespace in runtime-const assembler output
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Torvalds <[email protected]>
commit 4dc1f31ec3f13a065c7ae2ccdec562b0123e21bb upstream.
The x86 user pointer validation changes made me look at compiler output a lot, and the wrong indentation for the ".popsection" in the generated assembler triggered me.
--- arch/x86/include/asm/runtime-const.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/include/asm/runtime-const.h +2 -2
@@ -6,7 +6,7 @@typeof (sym) __ret; \ asm_inline("mov %1,%0\n1:\n" \ ".pushsection runtime_ptr_" #sym ",\"a\"\n\t" \ - ".long 1b - %c2 - .\n\t" \ + ".long 1b - %c2 - .\n" \ ".popsection" \ :"=r" (__ret) \ :"i" ((unsigned long)0x0123456789abcdefull), \
@@ -20,7 +20,7 @@ typeof(0u+(val)) __ret = (val); \ asm_inline("shrl $12,%k0\n1:\n" \ ".pushsection runtime_shift_" #sym ",\"a\"\n\t" \ - ".long 1b - 1 - .\n\t" \ + ".long 1b - 1 - .\n" \ ".popsection" \ :"+r" (__ret)); \ __ret; })
Greg Kroah-Hartman
maintainerPATCH 258/261 x86: fix user address masking non-canonical speculation issue
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Torvalds <[email protected]>
commit 86e6b1547b3d013bc392adf775b89318441403c2 upstream.
It turns out that AMD has a "Meltdown Lite(tm)" issue with non-canonical accesses in kernel space. And so using just the high bit to decide whether an access is in user space or kernel space ends up with the good old "leak speculative data" if you have the right gadget using the result:
CVE-2020-12965 “Transient Execution of Non-Canonical Accesses“
Now, the kernel surrounds the access with a STAC/CLAC pair, and those instructions end up serializing execution on older Zen architectures, which closes the speculation window.
But that was true only up until Zen 5, which renames the AC bit [1]. That improves performance of STAC/CLAC a lot, but also means that the speculation window is now open.
Note that this affects not just the new address masking, but also the regular valid_user_address() check used by access_ok(), and the asm version of the sign bit check in the get_user() helpers.
It does not affect put_user() or clear_user() variants, since there's no speculative result to be used in a gadget for those operations.
--- arch/x86/include/asm/uaccess_64.h | 43 +++++++++++++++++++++----------------- arch/x86/kernel/cpu/common.c | 10 ++++++++ arch/x86/kernel/vmlinux.lds.S | 1 arch/x86/lib/getuser.S | 9 ++++++- 4 files changed, 42 insertions(+), 21 deletions(-)
arch/x86/include/asm/uaccess_64.h +24 -19
@@ -12,6 +12,13 @@#include <asm/cpufeatures.h> #include <asm/page.h> #include <asm/percpu.h> +#include <asm/runtime-const.h> + +/* +* Virtual variable: there's no actual backing store for this, +* it can purely be used as 'runtime_const_ptr(USER_PTR_MAX)' +*/ +extern unsigned long USER_PTR_MAX ;#ifdef CONFIG_ADDRESS_MASKING /*
@@ -46,19 +53,24 @@ static inline unsigned long __untagged_a#endif -/* -* The virtual address space space is logically divided into a kernel -* half and a user half. When cast to a signed type, user pointers -* are positive and kernel pointers are negative. -*/ -#define valid_user_address (x) ((__force long)(x) >= 0) +#define valid_user_address (x) \ + ((__force unsigned long)(x) <= runtime_const_ptr(USER_PTR_MAX))/* * Masking the user address is an alternative to a conditional * user_access_begin that can avoid the fencing. This only works * for dense accesses starting at the address. */ -#define mask_user_address (x) ((typeof(x))((long)(x)|((long)(x)>>63))) +static inline void __user *mask_user_address (const void __user *ptr) +{ +unsigned long mask; + asm("cmp %1,%0\n\t" +"sbb %0,%0" + :"=r" (mask) + :"r" (ptr), +"0" (runtime_const_ptr (USER_PTR_MAX ))); +return (__force void __user *)(mask | (__force unsigned long )ptr); +}#define masked_user_access_begin (x) ({ __uaccess_begin(); mask_user_address(x); })/*
@@ -66,23 +78,16 @@ static inline unsigned long __untagged_a* arbitrary values in those bits rather then masking them off. * * Enforce two rules: -* 1. 'ptr' must be in the user half of the address space +* 1. 'ptr' must be in the user part of the address space * 2. 'ptr+size' must not overflow into kernel addresses * -* Note that addresses around the sign change are not valid addresses, -* and will GP-fault even with LAM enabled if the sign bit is set (see -* "CR3.LAM_SUP" that can narrow the canonicality check if we ever -* enable it, but not remove it entirely). -* -* So the "overflow into kernel addresses" does not imply some sudden -* exact boundary at the sign bit, and we can allow a lot of slop on the -* size check. +* Note that we always have at least one guard page between the +* max user address and the non-canonical gap, allowing us to +* ignore small sizes entirely. * * In fact, we could probably remove the size check entirely, since * any kernel accesses will be in increasing address order starting -* at 'ptr', and even if the end might be in kernel space, we'll -* hit the GP faults for non-canonical accesses before we ever get -* there. +* at 'ptr'. * * That's a separate optimization, for now just handle the small * constant case.
arch/x86/kernel/cpu/common.c +10 -0
@@ -69,6 +69,7 @@#include <asm/sev.h> #include <asm/tdx.h> #include <asm/posted_intr.h> +#include <asm/runtime-const.h> #include "cpu.h"
@@ -2371,6 +2372,15 @@ void __init arch_cpu_finalize_init(void)alternative_instructions ();if (IS_ENABLED (CONFIG_X86_64 )) { +unsigned long USER_PTR_MAX =TASK_SIZE_MAX -1 ; + +/* +* Enable this when LAM is gated on LASS support +if (cpu_feature_enabled(X86_FEATURE_LAM)) +USER_PTR_MAX = (1ul << 63) - PAGE_SIZE - 1; +*/ +runtime_const_init (ptr,USER_PTR_MAX ); +/* * Make sure the first 2MB area is not mapped by huge pages * There are typically fixed size MTRRs in there and overlapping
arch/x86/kernel/vmlinux.lds.S +1 -0
@@ -359,6 +359,7 @@ SECTIONS RUNTIME_CONST(shift, d_hash_shift) RUNTIME_CONST(ptr, dentry_hashtable) + RUNTIME_CONST(ptr, USER_PTR_MAX) . = ALIGN(PAGE_SIZE);
arch/x86/lib/getuser.S +7 -2
@@ -39,8 +39,13 @@ .macro check_range size:req .if IS_ENABLED(CONFIG_X86_64) - mov %rax, %rdx - sar $63, %rdx + movq $0x0123456789abcdef,%rdx + 1: + .pushsection runtime_ptr_USER_PTR_MAX,"a" + .long 1b - 8 - . + .popsection + cmp %rax, %rdx + sbb %rdx, %rdx or %rdx, %rax .else cmp $TASK_SIZE_MAX-\size+1, %eax
Greg Kroah-Hartman
maintainerPATCH 259/261 platform/x86: dell-wmi: Ignore suspend notifications
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Armin Wolf <[email protected]>
commit a7990957fa53326fe9b47f0349373ed99bb69aaa upstream.
Some machines like the Dell G15 5155 emit WMI events when suspending/resuming. Ignore those WMI events.
--- drivers/platform/x86/dell/dell-wmi-base.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/platform/x86/dell/dell-wmi-base.c +9 -0
@@ -264,6 +264,15 @@ static const struct key_entry dell_wmi_k/*Speaker Mute*/ { KE_KEY, 0x109, { KEY_MUTE} }, +/* S2Idle screen off */ + { KE_IGNORE, 0x120, { KEY_RESERVED }}, + +/* Leaving S4 or S2Idle suspend */ + { KE_IGNORE, 0x130, { KEY_RESERVED }}, + +/* Entering S2Idle suspend */ + { KE_IGNORE, 0x140, { KEY_RESERVED }}, +/* Mic mute */ { KE_KEY, 0x150, { KEY_MICMUTE } },
Greg Kroah-Hartman
maintainerPATCH 260/261 ACPI: PRM: Clean up guid type in struct prm_handler_info
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 3d1c651272cf1df8aac7d9b6d92d836d27bed50f upstream.
Clang 19 prints a warning when we pass &th->guid to efi_pa_va_lookup():
drivers/acpi/prmt.c:156:29: error: passing 1-byte aligned argument to 4-byte aligned parameter 1 of 'efi_pa_va_lookup' may result in an unaligned pointer access [-Werror,-Walign-mismatch]
156 | (void *)efi_pa_va_lookup(&th->guid, handler_info->handler_address);
| ^
The problem is that efi_pa_va_lookup() takes a efi_guid_t and &th->guid is a regular guid_t. The difference between the two types is the alignment. efi_guid_t is a typedef.
typedef guid_t efi_guid_t __aligned(__alignof__(u32));
It's possible that this a bug in Clang 19. Even though the alignment of &th->guid is not explicitly specified, it will still end up being aligned at 4 or 8 bytes.
Anyway, as Ard points out, it's cleaner to change guid to efi_guid_t type and that also makes the warning go away.
--- drivers/acpi/prmt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/prmt.c +1 -1
@@ -52,7 +52,7 @@ struct prm_context_buffer {static LIST_HEAD (prm_module_list);struct prm_handler_info { -guid_t guid; +efi_guid_t guid; efi_status_t (__efiapi *handler_addr)(u64, void *);u64 static_data_buffer_addr;u64 acpi_param_buffer_addr;
Greg Kroah-Hartman
maintainerPATCH 261/261 ASoC: qcom: Select missing common Soundwire module code on SDM845
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
commit b930d8647869802a0d430aae6b1b05c3acb24a41 upstream.
SDM845 sound card driver uses qcom_snd_sdw_startup() from the common Soundwire module, so select it to fix build failures:
ERROR: modpost: "qcom_snd_sdw_startup" [sound/soc/qcom/snd-soc-sdm845.ko] undefined!
--- sound/soc/qcom/Kconfig | 1 + 1 file changed, 1 insertion(+)
sound/soc/qcom/Kconfig +1 -0
@@ -157,6 +157,7 @@ config SND_SOC_SDM845 depends on COMMON_CLK select SND_SOC_QDSP6 select SND_SOC_QCOM_COMMON + select SND_SOC_QCOM_SDW select SND_SOC_RT5663 select SND_SOC_MAX98927 imply SND_SOC_CROS_EC_CODEC
Quoted 8 lines · On Mon, 28 Oct 2024 07:22:22 +0100 Greg Kroah-Hartman…
This is the start of the stable review cycle for the 6.11.6 release. There are 261 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, 30 Oct 2024 06:22:39 +0000. Anything received after that time might be too late.
Boot-tested under QEMU for Rust x86_64, arm64 and riscv64; built-tested for loongarch64:
Thanks!
Cheers,
Miguel
latest stable-rc tarballs missing? (was: Re: [PATCH 6.11 000/261] 6.11.6-rc1 review)
In reply to Greg Kroah-HartmanQuoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.11.6 release. There are 261 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, 30 Oct 2024 06:22:39 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.11.6-rc1.gz
I don't care much, but TWIMC: that URL gives a 404 here. Not idea if that is a issue with the local mirror or if the upload went sideways.
Ciao, Thorsten
Greg Kroah-Hartman
maintainerRe: latest stable-rc tarballs missing? (was: Re: [PATCH 6.11 000/261] 6.11.6-rc1 review)
Quoted 6 lines · Thorsten Leemhuis
Quoted 5 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.11.6 release. There are 261 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.
Quoted 8 lines
Quoted 5 lines
Responses should be made by Wed, 30 Oct 2024 06:22:39 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.11.6-rc1.gzI don't care much, but TWIMC: that URL gives a 404 here. Not idea if that is a issue with the local mirror or if the upload went sideways.
Sorry, this was my fault, new laptop and I forgot to install the perl-simple-config package that kup requires. Should now be fixed.
greg k-h
Quoted 4 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.11.6 release. There are 261 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.
The KVM vgic_init selftest has started failing on all the stables that "KVM: arm64: Don't eagerly teardown the vgic on init error" has been backported to. This also happens upstream, as discussed in the thread there:
https://lore.kernel.org/linux-arm-kernel/[email protected]/
this is a testsuite issue rather than an issue with the change itself. Other than that things look good:
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.11.6 release. There are 261 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, 30 Oct 2024 06:22:39 +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/v6.x/stable-review/patch-6.11.6-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.11.y
and the diffstat can be found below.thanks,
greg k-h
The selftests: kvm: vgic_init test failed on stable-rc linux-6.11.y, also seen on Linux next-20241023 onwards and Linus v6.12-rc5 on the Graviton4 and rk3399-rock-pi.
Test log:
---------
# selftests: kvm: vgic_init
# Random seed: 0x6b8b4567
# Running GIC_v3 tests.
# ==== Test Assertion Failure ====
# lib/kvm_util.c:727: false
# pid=2680 tid=2680 errno=5 - Input/output error
# 1 0x0000000000404eaf: __vm_mem_region_delete at kvm_util.c:727
(discriminator 5)
# 2 0x0000000000405d0f: kvm_vm_free at kvm_util.c:765 (discriminator 12) # 3 0x0000000000402d5f: vm_gic_destroy at vgic_init.c:101 # 4 (inlined by) test_vcpus_then_vgic at vgic_init.c:368 # 5 (inlined by) run_tests at vgic_init.c:720 # 6 0x0000000000401a6f: main at vgic_init.c:748 # 7 0x0000ffff8620773f: ?? ??:0 # 8 0x0000ffff86207817: ?? ??:0 # 9 0x0000000000401b6f: _start at ??:?
# KVM killed/bugged the VM, check the kernel log for clues
not ok 9 selftests: kvm: vgic_init # exit=254
Upstream discussion thread on this failures,
- https://lore.kernel.org/linux-arm-kernel/[email protected]/
Test failed log:
- https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-6.11.y/build/v6.11.4-397-g4ccf0b49d5b6/testrun/25583294/suite/kselftest-kvm/test/kvm_vgic_init/log
- https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-6.11.y/build/v6.11.4-397-g4ccf0b49d5b6/testrun/25583294/suite/kselftest-kvm/test/kvm_vgic_init/history/
## Build
* kernel: 6.11.6-rc1
* git: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
* git commit: 4ccf0b49d5b6ec739a290593658bebd035bb5f10
* git describe: v6.11.4-397-g4ccf0b49d5b6
* test details:
https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-6.11.y/build/v6.11.4-397-g4ccf0b49d5b6
## Test Regressions (compared to v6.11.4-136-g96563e3507d7)
* graviton4-metal, kselftest-kvm
- kvm_vgic_init
* rk3399-rock-pi-4b-nvhe, kselftest-kvm
- kvm_vgic_init
* rk3399-rock-pi-4b-protected, kselftest-kvm
- kvm_vgic_init
* rk3399-rock-pi-4b-vhe, kselftest-kvm
- kvm_vgic_init
## Metric Regressions (compared to v6.11.4-136-g96563e3507d7)
## Test Fixes (compared to v6.11.4-136-g96563e3507d7)
## Metric Fixes (compared to v6.11.4-136-g96563e3507d7)
## Test result summary
total: 143710, pass: 118866, fail: 1602, skip: 23242, xfail: 0
## Build Summary
* arc: 5 total, 5 passed, 0 failed
* arm: 131 total, 129 passed, 2 failed
* arm64: 43 total, 43 passed, 0 failed
* i386: 18 total, 16 passed, 2 failed
* mips: 26 total, 25 passed, 1 failed
* parisc: 4 total, 4 passed, 0 failed
* powerpc: 36 total, 35 passed, 1 failed
* riscv: 16 total, 14 passed, 2 failed
* s390: 14 total, 13 passed, 1 failed
* sh: 5 total, 5 passed, 0 failed
* sparc: 4 total, 3 passed, 1 failed
* x86_64: 35 total, 35 passed, 0 failed
## Test suites summary
* boot
* commands
* kselftest-arm64
* kselftest-breakpoints
* kselftest-capabilities
* kselftest-cgroup
* kselftest-clone3
* kselftest-core
* kselftest-cpu-hotplug
* kselftest-cpufreq
* kselftest-efivarfs
* kselftest-exec
* kselftest-filesystems
* kselftest-filesystems-binderfs
* kselftest-filesystems-epoll
* kselftest-firmware
* kselftest-fpu
* kselftest-ftrace
* kselftest-futex
* kselftest-gpio
* kselftest-intel_pstate
* kselftest-ipc
* kselftest-kcmp
* kselftest-kvm
* kselftest-livepatch
* kselftest-membarrier
* kselftest-memfd
* kselftest-mincore
* kselftest-mqueue
* kselftest-net
* kselftest-net-mptcp
* kselftest-openat2
* kselftest-ptrace
* kselftest-rseq
* kselftest-rtc
* kselftest-rust
* kselftest-seccomp
* kselftest-sigaltstack
* kselftest-size
* kselftest-tc-testing
* kselftest-timers
* kselftest-tmpfs
* kselftest-tpm2
* kselftest-user_events
* kselftest-vDSO
* kselftest-watchdog
* kselftest-x86
* kunit
* kvm-unit-tests
* libgpiod
* libhugetlbfs
* log-parser-boot
* 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-ipc
* ltp-math
* ltp-mm
* ltp-nptl
* ltp-pty
* ltp-sched
* ltp-smoke
* ltp-syscalls
* ltp-tracing
* perf
* rcutorture
--
Linaro LKFT
https://lkft.linaro.org
Hi,
Thanks for the report.
Quoted 46 lines · Naresh Kamboju
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.11.6 release. There are 261 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, 30 Oct 2024 06:22:39 +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/v6.x/stable-review/patch-6.11.6-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.11.y
and the diffstat can be found below.thanks,
greg k-h
The selftests: kvm:
vgic_inittest failed on stable-rc linux-6.11.y, also seen on Linux next-20241023 onwards and Linus v6.12-rc5 on the Graviton4 and rk3399-rock-pi.Test log:
---------
# selftests: kvm:vgic_init
# Random seed:0x6b8b4567
# RunningGIC_v3tests.
# ==== Test Assertion Failure ====
#lib/kvm_util.c:727: false
# pid=2680 tid=2680 errno=5 - Input/output error
# 10x0000000000404eaf:__vm_mem_region_deleteat kvm_util.c:727
(discriminator 5)# 2 0x0000000000405d0f: kvm_vm_free at kvm_util.c:765 (discriminator 12) # 3 0x0000000000402d5f: vm_gic_destroy at vgic_init.c:101 # 4 (inlined by) test_vcpus_then_vgic at vgic_init.c:368 # 5 (inlined by) run_tests at vgic_init.c:720 # 6 0x0000000000401a6f: main at vgic_init.c:748 # 7 0x0000ffff8620773f: ?? ??:0 # 8 0x0000ffff86207817: ?? ??:0 # 9 0x0000000000401b6f: _start at ??:?
Quoted 2 lines
# KVM killed/bugged the VM, check the kernel log for clues
not ok 9 selftests: kvm:vgic_init# exit=254
This is a known test issue currently being discussed [*], the KVM change responsible for the test failure *is* correct.
[*] https://lore.kernel.org/kvmarm/[email protected]/
Signature · 2 lines
Thanks, Oliver
Hello,
Quoted 7 lines · On Mon, 28 Oct 2024 07:22:22 +0100 Greg Kroah-Hartman…
This is the start of the stable review cycle for the 6.11.6 release. There are 261 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, 30 Oct 2024 06:22:39 +0000. Anything received after that time might be too late.
This rc kernel passes DAMON functionality test[1] on my test machine. Attaching the test results summary below. Please note that I retrieved the kernel from linux-stable-rc tree[2].
[1] https://github.com/damonitor/damon-tests/tree/next/corr
[2] 4ccf0b49d5b6 ("Linux 6.11.6-rc1")
Thanks,
SJ
[...]
---
ok 9 selftests: damon: damos_tried_regions.py
ok 10 selftests: damon: damon_nr_regions.py
ok 11 selftests: damon: reclaim.sh
ok 12 selftests: damon: lru_sort.sh
ok 13 selftests: damon: debugfs_empty_targets.sh
ok 14 selftests: damon: debugfs_huge_count_read_write.sh
ok 15 selftests: damon: debugfs_duplicate_context_creation.sh ok 16 selftests: damon: debugfs_rm_non_contexts.sh
ok 17 selftests: damon: debugfs_target_ids_read_before_terminate_race.sh ok 18 selftests: damon: debugfs_target_ids_pid_leak.sh
ok 19 selftests: damon: sysfs_update_removed_scheme_dir.sh
ok 20 selftests: damon: sysfs_update_schemes_tried_regions_hang.py ok 1 selftests: damon-tests: kunit.sh
ok 2 selftests: damon-tests: huge_count_read_write.sh
ok 3 selftests: damon-tests: buffer_overflow.sh
ok 4 selftests: damon-tests: rm_contexts.sh
ok 5 selftests: damon-tests: record_null_deref.sh
ok 6 selftests: damon-tests: dbgfs_target_ids_read_before_terminate_race.sh ok 7 selftests: damon-tests: dbgfs_target_ids_pid_leak.sh
ok 8 selftests: damon-tests: damo_tests.sh
ok 9 selftests: damon-tests: masim-record.sh
ok 10 selftests: damon-tests: build_i386.sh
ok 11 selftests: damon-tests: build_arm64.sh # SKIP
ok 12 selftests: damon-tests: build_m68k.sh # SKIP
ok 13 selftests: damon-tests: build_i386_idle_flag.sh
ok 14 selftests: damon-tests: build_i386_highpte.sh
ok 15 selftests: damon-tests: build_nomemcg.sh
[33m
[92mPASS [39m
Am 28.10.2024 um 07:22 schrieb Greg Kroah-Hartman:
Quoted 4 lines
This is the start of the stable review cycle for the 6.11.6 release. There are 261 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.
Builds, boots and works on my 2-socket Ivy Bridge Xeon E5-2697 v2 server. No dmesg oddities or regressions found.
Beste Grüße,
Peter Schneider
Signature · 8 lines
Climb the mountain not to plant your flag, but to embrace the challenge, enjoy the air and behold the view. Climb it so you can see the world, not so the world can see you. -- David McCullough Jr. OpenPGP: 0xA3828BD796CCE11A8CADE8866E3A92C92C3FF244 Download: https://www.peters-netzplatz.de/download/pschneider1968_pub.asc https://keys.mailvelope.com/pks/lookup?op=get&[email protected] https://keys.mailvelope.com/pks/lookup?op=get&[email protected]
Thanks,
Hardik
Quoted 14 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.11.6 release. There are 261 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, 30 Oct 2024 06:22:39 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.11.6-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.11.y
and the diffstat can be found below.
Quoted 5 lines
thanks,
greg k-h
-------------
Hi,
Please find the KernelCI report below :-
OVERVIEW
Builds: 24 passed, 0 failed
Boot tests: 48 passed, 0 failed
CI systems: maestro
REVISION
Commit
name:
hash: e9c8d9f95b232eef9e9293ddda9af144dc511270
Checked out from
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-6.11.y
BUILDS
No new build failures found
BOOT TESTS
No new boot failures found
See complete and up-to-date report at:
https://kcidb.kernelci.org/d/revision/revision?orgId=1&var-datasource=edquppk2ghfcwc&var-git_commit_hash=e9c8d9f95b232eef9e9293ddda9af144dc511270&var-patchset_hash=&var-origin=maestro&var-build_architecture=All&var-build_config_name=All&var-test_path=boot
Thanks,
KernelCI team
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.11.6 release. There are 261 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, 30 Oct 2024 06:22:39 +0000. Anything received after that time might be too late.
Tested on a ThinkPad E14 Gen 3 with a AMD Ryzen 5 5500U CPU and on the Steam Deck (LCD variant).
Luna Jernberg
Tested-byWorks good on my desktop
AMD Ryzen 5 5600 6-Core Processor:
https://www.inet.se/produkt/5304697/amd-ryzen-5-5600-3-5-ghz-35mb on a
https://www.gigabyte.com/Motherboard/B550-AORUS-ELITE-V2-rev-12
https://www.inet.se/produkt/1903406/gigabyte-b550-aorus-elite-v2
motherboard :)
running Arch Linux with the testing repos enabled:
https://archlinux.org/ https://archboot.com/
https://wiki.archlinux.org/title/Arch_Testing_Team
Den tis 29 okt. 2024 kl 12:37 skrev Christian Heusel <[email protected]>:
Quoted 15 lines · Greg Kroah-Hartman
Quoted 8 lines
This is the start of the stable review cycle for the 6.11.6 release. There are 261 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, 30 Oct 2024 06:22:39 +0000. Anything received after that time might be too late.
Tested-by Christian Heusel <[email protected]>Tested on a ThinkPad E14 Gen 3 with a AMD Ryzen 5 5500U CPU and on the Steam Deck (LCD variant).
Quoted 7 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.11.6 release. There are 261 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, 30 Oct 2024 06:22:39 +0000. Anything received after that time might be too late.
Hi Greg
6.11.6-rc1 compiles, boots and runs here on x86_64 (AMD Ryzen 5 PRO 4650G, Slackware64-15.0)
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.11.6 release. There are 261 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, 30 Oct 2024 06:22:39 +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/v6.x/stable-review/patch-6.11.6-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.11.y
and the diffstat can be found below.thanks,
greg k-h
Tested rc1 against the Fedora build system (aarch64, ppc64le, s390x, x86_64), and boot tested x86_64. No regressions noted.
Hi!
Quoted 4 lines
This is the start of the stable review cycle for the 6.11.6 release. There are 261 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.
CIP testing did not find any problems here:
https://gitlab.com/cip-project/cip-testing/linux-stable-rc-ci/-/tree/linux-6.11.y
6.6, 5.15 pass our testing, too:
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.15.y
Best regards,
Pavel
Signature · 2 lines
DENX Software Engineering GmbH, Managing Director: Erika Unter 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 6.11.6 release. There are 261 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, 30 Oct 2024 06:22:39 +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/v6.x/stable-review/patch-6.11.6-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.11.y
and the diffstat can be found below.thanks,
greg k-h
Built and booted successfully on RISC-V RV64 (HiFive Unmatched).