From: Sasha Levin Date: Sun, 7 Apr 2024 12:53:28 +0000 (-0400) Subject: Fixes for 5.15 X-Git-Tag: v5.15.154~76 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9b4ab839b710b7c4f308dd10b462259a2621bbbc;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 5.15 Signed-off-by: Sasha Levin --- diff --git a/queue-5.15/drivers-net-convert-to-boolean-for-the-mac_managed_p.patch b/queue-5.15/drivers-net-convert-to-boolean-for-the-mac_managed_p.patch new file mode 100644 index 00000000000..c842385dd81 --- /dev/null +++ b/queue-5.15/drivers-net-convert-to-boolean-for-the-mac_managed_p.patch @@ -0,0 +1,70 @@ +From af106ac72aa340e5b94b27002dc2b07fb224da17 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 27 Oct 2022 21:45:02 +0300 +Subject: drivers: net: convert to boolean for the mac_managed_pm flag + +From: Denis Kirjanov + +[ Upstream commit eca485d22165695587bed02d8b9d0f7f44246c4a ] + +Signed-off-by: Dennis Kirjanov +Signed-off-by: David S. Miller +Stable-dep-of: cbc17e7802f5 ("net: fec: Set mac_managed_pm during probe") +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/freescale/fec_main.c | 2 +- + drivers/net/ethernet/realtek/r8169_main.c | 2 +- + drivers/net/usb/asix_devices.c | 4 ++-- + 3 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c +index 39875ccbaa0fc..6662c0013959e 100644 +--- a/drivers/net/ethernet/freescale/fec_main.c ++++ b/drivers/net/ethernet/freescale/fec_main.c +@@ -2132,7 +2132,7 @@ static int fec_enet_mii_probe(struct net_device *ndev) + fep->link = 0; + fep->full_duplex = 0; + +- phy_dev->mac_managed_pm = 1; ++ phy_dev->mac_managed_pm = true; + + phy_attached_info(phy_dev); + +diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c +index e7e805a152631..623286f221054 100644 +--- a/drivers/net/ethernet/realtek/r8169_main.c ++++ b/drivers/net/ethernet/realtek/r8169_main.c +@@ -5177,7 +5177,7 @@ static int r8169_mdio_register(struct rtl8169_private *tp) + return -EUNATCH; + } + +- tp->phydev->mac_managed_pm = 1; ++ tp->phydev->mac_managed_pm = true; + + phy_support_asym_pause(tp->phydev); + +diff --git a/drivers/net/usb/asix_devices.c b/drivers/net/usb/asix_devices.c +index 254637c2b1830..5a4137b2531f1 100644 +--- a/drivers/net/usb/asix_devices.c ++++ b/drivers/net/usb/asix_devices.c +@@ -694,7 +694,7 @@ static int ax88772_init_phy(struct usbnet *dev) + } + + phy_suspend(priv->phydev); +- priv->phydev->mac_managed_pm = 1; ++ priv->phydev->mac_managed_pm = true; + + phy_attached_info(priv->phydev); + +@@ -711,7 +711,7 @@ static int ax88772_init_phy(struct usbnet *dev) + return -ENODEV; + } + +- priv->phydev_int->mac_managed_pm = 1; ++ priv->phydev_int->mac_managed_pm = true; + phy_suspend(priv->phydev_int); + + return 0; +-- +2.43.0 + diff --git a/queue-5.15/i40e-enforce-software-interrupt-during-busy-poll-exi.patch b/queue-5.15/i40e-enforce-software-interrupt-during-busy-poll-exi.patch new file mode 100644 index 00000000000..56226ef3b24 --- /dev/null +++ b/queue-5.15/i40e-enforce-software-interrupt-during-busy-poll-exi.patch @@ -0,0 +1,320 @@ +From e0eba0f6b7144e8f7f4d22cff5e49dc5c0ba304d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 16 Mar 2024 12:38:29 +0100 +Subject: i40e: Enforce software interrupt during busy-poll exit + +From: Ivan Vecera + +[ Upstream commit ea558de7238bb12c3435c47f0631e9d17bf4a09f ] + +As for ice bug fixed by commit b7306b42beaf ("ice: manage interrupts +during poll exit") followed by commit 23be7075b318 ("ice: fix software +generating extra interrupts") I'm seeing the similar issue also with +i40e driver. + +In certain situation when busy-loop is enabled together with adaptive +coalescing, the driver occasionally misses that there are outstanding +descriptors to clean when exiting busy poll. + +Try to catch the remaining work by triggering a software interrupt +when exiting busy poll. No extra interrupts will be generated when +busy polling is not used. + +The issue was found when running sockperf ping-pong tcp test with +adaptive coalescing and busy poll enabled (50 as value busy_pool +and busy_read sysctl knobs) and results in huge latency spikes +with more than 100000us. + +The fix is inspired from the ice driver and do the following: +1) During napi poll exit in case of busy-poll (napo_complete_done() + returns false) this is recorded to q_vector that we were in busy + loop. +2) Extends i40e_buildreg_itr() to be able to add an enforced software + interrupt into built value +2) In i40e_update_enable_itr() enforces a software interrupt trigger + if we are exiting busy poll to catch any pending clean-ups +3) Reuses unused 3rd ITR (interrupt throttle) index and set it to + 20K interrupts per second to limit the number of these sw interrupts. + +Test results +============ +Prior: +[root@dell-per640-07 net]# sockperf ping-pong -i 10.9.9.1 --tcp -m 1000 --mps=max -t 120 +sockperf: == version #3.10-no.git == +sockperf[CLIENT] send on:sockperf: using recvfrom() to block on socket(s) + +[ 0] IP = 10.9.9.1 PORT = 11111 # TCP +sockperf: Warmup stage (sending a few dummy messages)... +sockperf: Starting test... +sockperf: Test end (interrupted by timer) +sockperf: Test ended +sockperf: [Total Run] RunTime=119.999 sec; Warm up time=400 msec; SentMessages=2438563; ReceivedMessages=2438562 +sockperf: ========= Printing statistics for Server No: 0 +sockperf: [Valid Duration] RunTime=119.549 sec; SentMessages=2429473; ReceivedMessages=2429473 +sockperf: ====> avg-latency=24.571 (std-dev=93.297, mean-ad=4.904, median-ad=1.510, siqr=1.063, cv=3.797, std-error=0.060, 99.0% ci=[24.417, 24.725]) +sockperf: # dropped messages = 0; # duplicated messages = 0; # out-of-order messages = 0 +sockperf: Summary: Latency is 24.571 usec +sockperf: Total 2429473 observations; each percentile contains 24294.73 observations +sockperf: ---> observation = 103294.331 +sockperf: ---> percentile 99.999 = 45.633 +sockperf: ---> percentile 99.990 = 37.013 +sockperf: ---> percentile 99.900 = 35.910 +sockperf: ---> percentile 99.000 = 33.390 +sockperf: ---> percentile 90.000 = 28.626 +sockperf: ---> percentile 75.000 = 27.741 +sockperf: ---> percentile 50.000 = 26.743 +sockperf: ---> percentile 25.000 = 25.614 +sockperf: ---> observation = 12.220 + +After: +[root@dell-per640-07 net]# sockperf ping-pong -i 10.9.9.1 --tcp -m 1000 --mps=max -t 120 +sockperf: == version #3.10-no.git == +sockperf[CLIENT] send on:sockperf: using recvfrom() to block on socket(s) + +[ 0] IP = 10.9.9.1 PORT = 11111 # TCP +sockperf: Warmup stage (sending a few dummy messages)... +sockperf: Starting test... +sockperf: Test end (interrupted by timer) +sockperf: Test ended +sockperf: [Total Run] RunTime=119.999 sec; Warm up time=400 msec; SentMessages=2400055; ReceivedMessages=2400054 +sockperf: ========= Printing statistics for Server No: 0 +sockperf: [Valid Duration] RunTime=119.549 sec; SentMessages=2391186; ReceivedMessages=2391186 +sockperf: ====> avg-latency=24.965 (std-dev=5.934, mean-ad=4.642, median-ad=1.485, siqr=1.067, cv=0.238, std-error=0.004, 99.0% ci=[24.955, 24.975]) +sockperf: # dropped messages = 0; # duplicated messages = 0; # out-of-order messages = 0 +sockperf: Summary: Latency is 24.965 usec +sockperf: Total 2391186 observations; each percentile contains 23911.86 observations +sockperf: ---> observation = 195.841 +sockperf: ---> percentile 99.999 = 45.026 +sockperf: ---> percentile 99.990 = 39.009 +sockperf: ---> percentile 99.900 = 35.922 +sockperf: ---> percentile 99.000 = 33.482 +sockperf: ---> percentile 90.000 = 28.902 +sockperf: ---> percentile 75.000 = 27.821 +sockperf: ---> percentile 50.000 = 26.860 +sockperf: ---> percentile 25.000 = 25.685 +sockperf: ---> observation = 12.277 + +Fixes: 0bcd952feec7 ("ethernet/intel: consolidate NAPI and NAPI exit") +Reported-by: Hugo Ferreira +Reviewed-by: Michal Schmidt +Signed-off-by: Ivan Vecera +Reviewed-by: Jesse Brandeburg +Tested-by: Pucha Himasekhar Reddy (A Contingent worker at Intel) +Signed-off-by: Tony Nguyen +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/intel/i40e/i40e.h | 1 + + drivers/net/ethernet/intel/i40e/i40e_main.c | 6 ++ + .../net/ethernet/intel/i40e/i40e_register.h | 3 + + drivers/net/ethernet/intel/i40e/i40e_txrx.c | 82 ++++++++++++++----- + drivers/net/ethernet/intel/i40e/i40e_txrx.h | 1 + + 5 files changed, 72 insertions(+), 21 deletions(-) + +diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h +index 1580f9c2a3209..a05103e2fb522 100644 +--- a/drivers/net/ethernet/intel/i40e/i40e.h ++++ b/drivers/net/ethernet/intel/i40e/i40e.h +@@ -973,6 +973,7 @@ struct i40e_q_vector { + struct rcu_head rcu; /* to avoid race with update stats on free */ + char name[I40E_INT_NAME_STR_LEN]; + bool arm_wb_state; ++ bool in_busy_poll; + int irq_num; /* IRQ assigned to this q_vector */ + } ____cacheline_internodealigned_in_smp; + +diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c +index d204c33409c68..676ea7d4192f7 100644 +--- a/drivers/net/ethernet/intel/i40e/i40e_main.c ++++ b/drivers/net/ethernet/intel/i40e/i40e_main.c +@@ -3871,6 +3871,12 @@ static void i40e_vsi_configure_msix(struct i40e_vsi *vsi) + q_vector->tx.target_itr >> 1); + q_vector->tx.current_itr = q_vector->tx.target_itr; + ++ /* Set ITR for software interrupts triggered after exiting ++ * busy-loop polling. ++ */ ++ wr32(hw, I40E_PFINT_ITRN(I40E_SW_ITR, vector - 1), ++ I40E_ITR_20K); ++ + wr32(hw, I40E_PFINT_RATEN(vector - 1), + i40e_intrl_usec_to_reg(vsi->int_rate_limit)); + +diff --git a/drivers/net/ethernet/intel/i40e/i40e_register.h b/drivers/net/ethernet/intel/i40e/i40e_register.h +index 7339003aa17cd..694cb3e45c1ec 100644 +--- a/drivers/net/ethernet/intel/i40e/i40e_register.h ++++ b/drivers/net/ethernet/intel/i40e/i40e_register.h +@@ -328,8 +328,11 @@ + #define I40E_PFINT_DYN_CTLN_ITR_INDX_SHIFT 3 + #define I40E_PFINT_DYN_CTLN_ITR_INDX_MASK I40E_MASK(0x3, I40E_PFINT_DYN_CTLN_ITR_INDX_SHIFT) + #define I40E_PFINT_DYN_CTLN_INTERVAL_SHIFT 5 ++#define I40E_PFINT_DYN_CTLN_INTERVAL_MASK I40E_MASK(0xFFF, I40E_PFINT_DYN_CTLN_INTERVAL_SHIFT) + #define I40E_PFINT_DYN_CTLN_SW_ITR_INDX_ENA_SHIFT 24 + #define I40E_PFINT_DYN_CTLN_SW_ITR_INDX_ENA_MASK I40E_MASK(0x1, I40E_PFINT_DYN_CTLN_SW_ITR_INDX_ENA_SHIFT) ++#define I40E_PFINT_DYN_CTLN_SW_ITR_INDX_SHIFT 25 ++#define I40E_PFINT_DYN_CTLN_SW_ITR_INDX_MASK I40E_MASK(0x3, I40E_PFINT_DYN_CTLN_SW_ITR_INDX_SHIFT) + #define I40E_PFINT_ICR0 0x00038780 /* Reset: CORER */ + #define I40E_PFINT_ICR0_INTEVENT_SHIFT 0 + #define I40E_PFINT_ICR0_INTEVENT_MASK I40E_MASK(0x1, I40E_PFINT_ICR0_INTEVENT_SHIFT) +diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c +index cf8c3d480a4a7..e2737875e3795 100644 +--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c ++++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c +@@ -2560,7 +2560,22 @@ static int i40e_clean_rx_irq(struct i40e_ring *rx_ring, int budget) + return failure ? budget : (int)total_rx_packets; + } + +-static inline u32 i40e_buildreg_itr(const int type, u16 itr) ++/** ++ * i40e_buildreg_itr - build a value for writing to I40E_PFINT_DYN_CTLN register ++ * @itr_idx: interrupt throttling index ++ * @interval: interrupt throttling interval value in usecs ++ * @force_swint: force software interrupt ++ * ++ * The function builds a value for I40E_PFINT_DYN_CTLN register that ++ * is used to update interrupt throttling interval for specified ITR index ++ * and optionally enforces a software interrupt. If the @itr_idx is equal ++ * to I40E_ITR_NONE then no interval change is applied and only @force_swint ++ * parameter is taken into account. If the interval change and enforced ++ * software interrupt are not requested then the built value just enables ++ * appropriate vector interrupt. ++ **/ ++static u32 i40e_buildreg_itr(enum i40e_dyn_idx itr_idx, u16 interval, ++ bool force_swint) + { + u32 val; + +@@ -2574,23 +2589,33 @@ static inline u32 i40e_buildreg_itr(const int type, u16 itr) + * an event in the PBA anyway so we need to rely on the automask + * to hold pending events for us until the interrupt is re-enabled + * +- * The itr value is reported in microseconds, and the register +- * value is recorded in 2 microsecond units. For this reason we +- * only need to shift by the interval shift - 1 instead of the +- * full value. ++ * We have to shift the given value as it is reported in microseconds ++ * and the register value is recorded in 2 microsecond units. + */ +- itr &= I40E_ITR_MASK; ++ interval >>= 1; + ++ /* 1. Enable vector interrupt ++ * 2. Update the interval for the specified ITR index ++ * (I40E_ITR_NONE in the register is used to indicate that ++ * no interval update is requested) ++ */ + val = I40E_PFINT_DYN_CTLN_INTENA_MASK | +- (type << I40E_PFINT_DYN_CTLN_ITR_INDX_SHIFT) | +- (itr << (I40E_PFINT_DYN_CTLN_INTERVAL_SHIFT - 1)); ++ FIELD_PREP(I40E_PFINT_DYN_CTLN_ITR_INDX_MASK, itr_idx) | ++ FIELD_PREP(I40E_PFINT_DYN_CTLN_INTERVAL_MASK, interval); ++ ++ /* 3. Enforce software interrupt trigger if requested ++ * (These software interrupts rate is limited by ITR2 that is ++ * set to 20K interrupts per second) ++ */ ++ if (force_swint) ++ val |= I40E_PFINT_DYN_CTLN_SWINT_TRIG_MASK | ++ I40E_PFINT_DYN_CTLN_SW_ITR_INDX_ENA_MASK | ++ FIELD_PREP(I40E_PFINT_DYN_CTLN_SW_ITR_INDX_MASK, ++ I40E_SW_ITR); + + return val; + } + +-/* a small macro to shorten up some long lines */ +-#define INTREG I40E_PFINT_DYN_CTLN +- + /* The act of updating the ITR will cause it to immediately trigger. In order + * to prevent this from throwing off adaptive update statistics we defer the + * update so that it can only happen so often. So after either Tx or Rx are +@@ -2609,8 +2634,10 @@ static inline u32 i40e_buildreg_itr(const int type, u16 itr) + static inline void i40e_update_enable_itr(struct i40e_vsi *vsi, + struct i40e_q_vector *q_vector) + { ++ enum i40e_dyn_idx itr_idx = I40E_ITR_NONE; + struct i40e_hw *hw = &vsi->back->hw; +- u32 intval; ++ u16 interval = 0; ++ u32 itr_val; + + /* If we don't have MSIX, then we only need to re-enable icr0 */ + if (!(vsi->back->flags & I40E_FLAG_MSIX_ENABLED)) { +@@ -2632,8 +2659,8 @@ static inline void i40e_update_enable_itr(struct i40e_vsi *vsi, + */ + if (q_vector->rx.target_itr < q_vector->rx.current_itr) { + /* Rx ITR needs to be reduced, this is highest priority */ +- intval = i40e_buildreg_itr(I40E_RX_ITR, +- q_vector->rx.target_itr); ++ itr_idx = I40E_RX_ITR; ++ interval = q_vector->rx.target_itr; + q_vector->rx.current_itr = q_vector->rx.target_itr; + q_vector->itr_countdown = ITR_COUNTDOWN_START; + } else if ((q_vector->tx.target_itr < q_vector->tx.current_itr) || +@@ -2642,25 +2669,36 @@ static inline void i40e_update_enable_itr(struct i40e_vsi *vsi, + /* Tx ITR needs to be reduced, this is second priority + * Tx ITR needs to be increased more than Rx, fourth priority + */ +- intval = i40e_buildreg_itr(I40E_TX_ITR, +- q_vector->tx.target_itr); ++ itr_idx = I40E_TX_ITR; ++ interval = q_vector->tx.target_itr; + q_vector->tx.current_itr = q_vector->tx.target_itr; + q_vector->itr_countdown = ITR_COUNTDOWN_START; + } else if (q_vector->rx.current_itr != q_vector->rx.target_itr) { + /* Rx ITR needs to be increased, third priority */ +- intval = i40e_buildreg_itr(I40E_RX_ITR, +- q_vector->rx.target_itr); ++ itr_idx = I40E_RX_ITR; ++ interval = q_vector->rx.target_itr; + q_vector->rx.current_itr = q_vector->rx.target_itr; + q_vector->itr_countdown = ITR_COUNTDOWN_START; + } else { + /* No ITR update, lowest priority */ +- intval = i40e_buildreg_itr(I40E_ITR_NONE, 0); + if (q_vector->itr_countdown) + q_vector->itr_countdown--; + } + +- if (!test_bit(__I40E_VSI_DOWN, vsi->state)) +- wr32(hw, INTREG(q_vector->reg_idx), intval); ++ /* Do not update interrupt control register if VSI is down */ ++ if (test_bit(__I40E_VSI_DOWN, vsi->state)) ++ return; ++ ++ /* Update ITR interval if necessary and enforce software interrupt ++ * if we are exiting busy poll. ++ */ ++ if (q_vector->in_busy_poll) { ++ itr_val = i40e_buildreg_itr(itr_idx, interval, true); ++ q_vector->in_busy_poll = false; ++ } else { ++ itr_val = i40e_buildreg_itr(itr_idx, interval, false); ++ } ++ wr32(hw, I40E_PFINT_DYN_CTLN(q_vector->reg_idx), itr_val); + } + + /** +@@ -2767,6 +2805,8 @@ int i40e_napi_poll(struct napi_struct *napi, int budget) + */ + if (likely(napi_complete_done(napi, work_done))) + i40e_update_enable_itr(vsi, q_vector); ++ else ++ q_vector->in_busy_poll = true; + + return min(work_done, budget - 1); + } +diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.h b/drivers/net/ethernet/intel/i40e/i40e_txrx.h +index a4f38ab0ecca9..054b7d1632e16 100644 +--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.h ++++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.h +@@ -67,6 +67,7 @@ enum i40e_dyn_idx { + /* these are indexes into ITRN registers */ + #define I40E_RX_ITR I40E_IDX_ITR0 + #define I40E_TX_ITR I40E_IDX_ITR1 ++#define I40E_SW_ITR I40E_IDX_ITR2 + + /* Supported RSS offloads */ + #define I40E_DEFAULT_RSS_HENA ( \ +-- +2.43.0 + diff --git a/queue-5.15/i40e-remove-_t-suffix-from-enum-type-names.patch b/queue-5.15/i40e-remove-_t-suffix-from-enum-type-names.patch new file mode 100644 index 00000000000..1205f20d57f --- /dev/null +++ b/queue-5.15/i40e-remove-_t-suffix-from-enum-type-names.patch @@ -0,0 +1,105 @@ +From 8cc081411710c750ec5c2760c955d2543110356e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 13 Nov 2023 15:10:24 -0800 +Subject: i40e: Remove _t suffix from enum type names + +From: Ivan Vecera + +[ Upstream commit addca9175e5f74cf29e8ad918c38c09b8663b5b8 ] + +Enum type names should not be suffixed by '_t'. Either to use +'typedef enum name name_t' to so plain 'name_t var' instead of +'enum name_t var'. + +Signed-off-by: Ivan Vecera +Reviewed-by: Jacob Keller +Tested-by: Pucha Himasekhar Reddy (A Contingent worker at Intel) +Signed-off-by: Tony Nguyen +Link: https://lore.kernel.org/r/20231113231047.548659-6-anthony.l.nguyen@intel.com +Signed-off-by: Jakub Kicinski +Stable-dep-of: ea558de7238b ("i40e: Enforce software interrupt during busy-poll exit") +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/intel/i40e/i40e.h | 4 ++-- + drivers/net/ethernet/intel/i40e/i40e_ptp.c | 6 +++--- + drivers/net/ethernet/intel/i40e/i40e_txrx.h | 4 ++-- + 3 files changed, 7 insertions(+), 7 deletions(-) + +diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h +index 7282dfba4122e..1580f9c2a3209 100644 +--- a/drivers/net/ethernet/intel/i40e/i40e.h ++++ b/drivers/net/ethernet/intel/i40e/i40e.h +@@ -108,7 +108,7 @@ + #define I40E_MAX_BW_INACTIVE_ACCUM 4 /* accumulate 4 credits max */ + + /* driver state flags */ +-enum i40e_state_t { ++enum i40e_state { + __I40E_TESTING, + __I40E_CONFIG_BUSY, + __I40E_CONFIG_DONE, +@@ -156,7 +156,7 @@ enum i40e_state_t { + BIT_ULL(__I40E_PF_RESET_AND_REBUILD_REQUESTED) + + /* VSI state flags */ +-enum i40e_vsi_state_t { ++enum i40e_vsi_state { + __I40E_VSI_DOWN, + __I40E_VSI_NEEDS_RESTART, + __I40E_VSI_SYNCING_FILTERS, +diff --git a/drivers/net/ethernet/intel/i40e/i40e_ptp.c b/drivers/net/ethernet/intel/i40e/i40e_ptp.c +index 09b1d5aed1c9f..38942d3f7819b 100644 +--- a/drivers/net/ethernet/intel/i40e/i40e_ptp.c ++++ b/drivers/net/ethernet/intel/i40e/i40e_ptp.c +@@ -35,7 +35,7 @@ enum i40e_ptp_pin { + GPIO_4 + }; + +-enum i40e_can_set_pins_t { ++enum i40e_can_set_pins { + CANT_DO_PINS = -1, + CAN_SET_PINS, + CAN_DO_PINS +@@ -193,7 +193,7 @@ static bool i40e_is_ptp_pin_dev(struct i40e_hw *hw) + * return CAN_DO_PINS if pins can be manipulated within a NIC or + * return CANT_DO_PINS otherwise. + **/ +-static enum i40e_can_set_pins_t i40e_can_set_pins(struct i40e_pf *pf) ++static enum i40e_can_set_pins i40e_can_set_pins(struct i40e_pf *pf) + { + if (!i40e_is_ptp_pin_dev(&pf->hw)) { + dev_warn(&pf->pdev->dev, +@@ -1089,7 +1089,7 @@ static void i40e_ptp_set_pins_hw(struct i40e_pf *pf) + static int i40e_ptp_set_pins(struct i40e_pf *pf, + struct i40e_ptp_pins_settings *pins) + { +- enum i40e_can_set_pins_t pin_caps = i40e_can_set_pins(pf); ++ enum i40e_can_set_pins pin_caps = i40e_can_set_pins(pf); + int i = 0; + + if (pin_caps == CANT_DO_PINS) +diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.h b/drivers/net/ethernet/intel/i40e/i40e_txrx.h +index f3b0b81517096..a4f38ab0ecca9 100644 +--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.h ++++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.h +@@ -57,7 +57,7 @@ static inline u16 i40e_intrl_usec_to_reg(int intrl) + * mentioning ITR_INDX, ITR_NONE cannot be used as an index 'n' into any + * register but instead is a special value meaning "don't update" ITR0/1/2. + */ +-enum i40e_dyn_idx_t { ++enum i40e_dyn_idx { + I40E_IDX_ITR0 = 0, + I40E_IDX_ITR1 = 1, + I40E_IDX_ITR2 = 2, +@@ -301,7 +301,7 @@ struct i40e_rx_queue_stats { + u64 realloc_count; + }; + +-enum i40e_ring_state_t { ++enum i40e_ring_state { + __I40E_TX_FDIR_INIT_DONE, + __I40E_TX_XPS_INIT_DONE, + __I40E_RING_STATE_NBITS /* must be last */ +-- +2.43.0 + diff --git a/queue-5.15/i40e-store-the-irq-number-in-i40e_q_vector.patch b/queue-5.15/i40e-store-the-irq-number-in-i40e_q_vector.patch new file mode 100644 index 00000000000..02544660a88 --- /dev/null +++ b/queue-5.15/i40e-store-the-irq-number-in-i40e_q_vector.patch @@ -0,0 +1,51 @@ +From e47395d4f33e355c9d27af6e770a690a214d556b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 7 Oct 2022 14:38:40 -0700 +Subject: i40e: Store the irq number in i40e_q_vector + +From: Joe Damato + +[ Upstream commit 6b85a4f39ff7177b2428d4deab1151a31754e391 ] + +Make it easy to figure out the IRQ number for a particular i40e_q_vector by +storing the assigned IRQ in the structure itself. + +Signed-off-by: Joe Damato +Acked-by: Jesse Brandeburg +Acked-by: Sridhar Samudrala +Tested-by: Gurucharan (A Contingent worker at Intel) +Signed-off-by: Tony Nguyen +Stable-dep-of: ea558de7238b ("i40e: Enforce software interrupt during busy-poll exit") +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/intel/i40e/i40e.h | 1 + + drivers/net/ethernet/intel/i40e/i40e_main.c | 1 + + 2 files changed, 2 insertions(+) + +diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h +index 453a85410634e..7282dfba4122e 100644 +--- a/drivers/net/ethernet/intel/i40e/i40e.h ++++ b/drivers/net/ethernet/intel/i40e/i40e.h +@@ -973,6 +973,7 @@ struct i40e_q_vector { + struct rcu_head rcu; /* to avoid race with update stats on free */ + char name[I40E_INT_NAME_STR_LEN]; + bool arm_wb_state; ++ int irq_num; /* IRQ assigned to this q_vector */ + } ____cacheline_internodealigned_in_smp; + + /* lan device */ +diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c +index a98b1251b561e..d204c33409c68 100644 +--- a/drivers/net/ethernet/intel/i40e/i40e_main.c ++++ b/drivers/net/ethernet/intel/i40e/i40e_main.c +@@ -4133,6 +4133,7 @@ static int i40e_vsi_request_irq_msix(struct i40e_vsi *vsi, char *basename) + } + + /* register for affinity change notifications */ ++ q_vector->irq_num = irq_num; + q_vector->affinity_notify.notify = i40e_irq_affinity_notify; + q_vector->affinity_notify.release = i40e_irq_affinity_release; + irq_set_affinity_notifier(irq_num, &q_vector->affinity_notify); +-- +2.43.0 + diff --git a/queue-5.15/net-fec-set-mac_managed_pm-during-probe.patch b/queue-5.15/net-fec-set-mac_managed_pm-during-probe.patch new file mode 100644 index 00000000000..a41d54e004b --- /dev/null +++ b/queue-5.15/net-fec-set-mac_managed_pm-during-probe.patch @@ -0,0 +1,95 @@ +From e422222374e9553bb00dc2c749b064c30ceb6805 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 28 Mar 2024 15:59:29 +0000 +Subject: net: fec: Set mac_managed_pm during probe + +From: Wei Fang + +[ Upstream commit cbc17e7802f5de37c7c262204baadfad3f7f99e5 ] + +Setting mac_managed_pm during interface up is too late. + +In situations where the link is not brought up yet and the system suspends +the regular PHY power management will run. Since the FEC ETHEREN control +bit is cleared (automatically) on suspend the controller is off in resume. +When the regular PHY power management resume path runs in this context it +will write to the MII_DATA register but nothing will be transmitted on the +MDIO bus. + +This can be observed by the following log: + + fec 5b040000.ethernet eth0: MDIO read timeout + Microchip LAN87xx T1 5b040000.ethernet-1:04: PM: dpm_run_callback(): mdio_bus_phy_resume+0x0/0xc8 returns -110 + Microchip LAN87xx T1 5b040000.ethernet-1:04: PM: failed to resume: error -110 + +The data written will however remain in the MII_DATA register. + +When the link later is set to administrative up it will trigger a call to +fec_restart() which will restore the MII_SPEED register. This triggers the +quirk explained in f166f890c8f0 ("net: ethernet: fec: Replace interrupt +driven MDIO with polled IO") causing an extra MII_EVENT. + +This extra event desynchronizes all the MDIO register reads, causing them +to complete too early. Leading all reads to read as 0 because +fec_enet_mdio_wait() returns too early. + +When a Microchip LAN8700R PHY is connected to the FEC, the 0 reads causes +the PHY to be initialized incorrectly and the PHY will not transmit any +ethernet signal in this state. It cannot be brought out of this state +without a power cycle of the PHY. + +Fixes: 557d5dc83f68 ("net: fec: use mac-managed PHY PM") +Closes: https://lore.kernel.org/netdev/1f45bdbe-eab1-4e59-8f24-add177590d27@actia.se/ +Signed-off-by: Wei Fang +[jernberg: commit message] +Signed-off-by: John Ernberg +Link: https://lore.kernel.org/r/20240328155909.59613-2-john.ernberg@actia.se +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/freescale/fec_main.c | 11 +++++++++-- + 1 file changed, 9 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c +index 6662c0013959e..972808777f308 100644 +--- a/drivers/net/ethernet/freescale/fec_main.c ++++ b/drivers/net/ethernet/freescale/fec_main.c +@@ -2132,8 +2132,6 @@ static int fec_enet_mii_probe(struct net_device *ndev) + fep->link = 0; + fep->full_duplex = 0; + +- phy_dev->mac_managed_pm = true; +- + phy_attached_info(phy_dev); + + return 0; +@@ -2145,10 +2143,12 @@ static int fec_enet_mii_init(struct platform_device *pdev) + struct net_device *ndev = platform_get_drvdata(pdev); + struct fec_enet_private *fep = netdev_priv(ndev); + bool suppress_preamble = false; ++ struct phy_device *phydev; + struct device_node *node; + int err = -ENXIO; + u32 mii_speed, holdtime; + u32 bus_freq; ++ int addr; + + /* + * The i.MX28 dual fec interfaces are not equal. +@@ -2258,6 +2258,13 @@ static int fec_enet_mii_init(struct platform_device *pdev) + goto err_out_free_mdiobus; + of_node_put(node); + ++ /* find all the PHY devices on the bus and set mac_managed_pm to true */ ++ for (addr = 0; addr < PHY_MAX_ADDR; addr++) { ++ phydev = mdiobus_get_phy(fep->mii_bus, addr); ++ if (phydev) ++ phydev->mac_managed_pm = true; ++ } ++ + mii_cnt++; + + /* save fec0 mii_bus */ +-- +2.43.0 + diff --git a/queue-5.15/net-ravb-always-process-tx-descriptor-ring.patch b/queue-5.15/net-ravb-always-process-tx-descriptor-ring.patch new file mode 100644 index 00000000000..c0708d15420 --- /dev/null +++ b/queue-5.15/net-ravb-always-process-tx-descriptor-ring.patch @@ -0,0 +1,55 @@ +From abb61791b20e128528072b0af63eb57b6df87c55 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 2 Apr 2024 15:53:04 +0100 +Subject: net: ravb: Always process TX descriptor ring + +From: Paul Barker + +[ Upstream commit 596a4254915f94c927217fe09c33a6828f33fb25 ] + +The TX queue should be serviced each time the poll function is called, +even if the full RX work budget has been consumed. This prevents +starvation of the TX queue when RX bandwidth usage is high. + +Fixes: c156633f1353 ("Renesas Ethernet AVB driver proper") +Signed-off-by: Paul Barker +Reviewed-by: Sergey Shtylyov +Link: https://lore.kernel.org/r/20240402145305.82148-1-paul.barker.ct@bp.renesas.com +Signed-off-by: Paolo Abeni +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/renesas/ravb_main.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c +index c2fa3e9e24574..eee446e500486 100644 +--- a/drivers/net/ethernet/renesas/ravb_main.c ++++ b/drivers/net/ethernet/renesas/ravb_main.c +@@ -969,12 +969,12 @@ static int ravb_poll(struct napi_struct *napi, int budget) + int q = napi - priv->napi; + int mask = BIT(q); + int quota = budget; ++ bool unmask; + + /* Processing RX Descriptor Ring */ + /* Clear RX interrupt */ + ravb_write(ndev, ~(mask | RIS0_RESERVED), RIS0); +- if (ravb_rx(ndev, "a, q)) +- goto out; ++ unmask = !ravb_rx(ndev, "a, q); + + /* Processing TX Descriptor Ring */ + spin_lock_irqsave(&priv->lock, flags); +@@ -984,6 +984,9 @@ static int ravb_poll(struct napi_struct *napi, int budget) + netif_wake_subqueue(ndev, q); + spin_unlock_irqrestore(&priv->lock, flags); + ++ if (!unmask) ++ goto out; ++ + napi_complete(napi); + + /* Re-enable RX/TX interrupts */ +-- +2.43.0 + diff --git a/queue-5.15/net-usb-asix-suspend-embedded-phy-if-external-is-use.patch b/queue-5.15/net-usb-asix-suspend-embedded-phy-if-external-is-use.patch new file mode 100644 index 00000000000..053dc90f654 --- /dev/null +++ b/queue-5.15/net-usb-asix-suspend-embedded-phy-if-external-is-use.patch @@ -0,0 +1,85 @@ +From 88cda0d3d909d42056d85253ea0dda10a18459f8 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 11 Mar 2022 09:50:14 +0100 +Subject: net: usb: asix: suspend embedded PHY if external is used + +From: Oleksij Rempel + +[ Upstream commit 4d17d43de9d186150b3289ce99d7a79fcff202f9 ] + +In case external PHY is used, we need to take care of embedded PHY. +Since there are no methods to disable this PHY from the MAC side and +keeping RMII reference clock, we need to suspend it. + +This patch will reduce electrical noise (PHY is continuing to send FLPs) +and power consumption by 0,22W. + +Signed-off-by: Oleksij Rempel +Signed-off-by: David S. Miller +Stable-dep-of: cbc17e7802f5 ("net: fec: Set mac_managed_pm during probe") +Signed-off-by: Sasha Levin +--- + drivers/net/usb/asix.h | 3 +++ + drivers/net/usb/asix_devices.c | 18 +++++++++++++++++- + 2 files changed, 20 insertions(+), 1 deletion(-) + +diff --git a/drivers/net/usb/asix.h b/drivers/net/usb/asix.h +index c126df1c13ee7..9da88e132d516 100644 +--- a/drivers/net/usb/asix.h ++++ b/drivers/net/usb/asix.h +@@ -157,6 +157,8 @@ + #define AX_EEPROM_MAGIC 0xdeadbeef + #define AX_EEPROM_LEN 0x200 + ++#define AX_EMBD_PHY_ADDR 0x10 ++ + /* This structure cannot exceed sizeof(unsigned long [5]) AKA 20 bytes */ + struct asix_data { + u8 multi_filter[AX_MCAST_FILTER_SIZE]; +@@ -181,6 +183,7 @@ struct asix_common_private { + struct asix_rx_fixup_info rx_fixup_info; + struct mii_bus *mdio; + struct phy_device *phydev; ++ struct phy_device *phydev_int; + u16 phy_addr; + char phy_name[20]; + bool embd_phy; +diff --git a/drivers/net/usb/asix_devices.c b/drivers/net/usb/asix_devices.c +index 396505396a2e4..254637c2b1830 100644 +--- a/drivers/net/usb/asix_devices.c ++++ b/drivers/net/usb/asix_devices.c +@@ -698,6 +698,22 @@ static int ax88772_init_phy(struct usbnet *dev) + + phy_attached_info(priv->phydev); + ++ if (priv->embd_phy) ++ return 0; ++ ++ /* In case main PHY is not the embedded PHY and MAC is RMII clock ++ * provider, we need to suspend embedded PHY by keeping PLL enabled ++ * (AX_SWRESET_IPPD == 0). ++ */ ++ priv->phydev_int = mdiobus_get_phy(priv->mdio, AX_EMBD_PHY_ADDR); ++ if (!priv->phydev_int) { ++ netdev_err(dev->net, "Could not find internal PHY\n"); ++ return -ENODEV; ++ } ++ ++ priv->phydev_int->mac_managed_pm = 1; ++ phy_suspend(priv->phydev_int); ++ + return 0; + } + +@@ -753,7 +769,7 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf) + return ret; + + priv->phy_addr = ret; +- priv->embd_phy = ((priv->phy_addr & 0x1f) == 0x10); ++ priv->embd_phy = ((priv->phy_addr & 0x1f) == AX_EMBD_PHY_ADDR); + + ret = asix_read_cmd(dev, AX_CMD_STATMNGSTS_REG, 0, 0, 1, &chipcode, 0); + if (ret < 0) { +-- +2.43.0 + diff --git a/queue-5.15/revert-usb-phy-generic-get-the-vbus-supply.patch b/queue-5.15/revert-usb-phy-generic-get-the-vbus-supply.patch new file mode 100644 index 00000000000..fcbfbf72d30 --- /dev/null +++ b/queue-5.15/revert-usb-phy-generic-get-the-vbus-supply.patch @@ -0,0 +1,45 @@ +From 56be60637b9db8214bf8293cd929abab31c40c42 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 14 Mar 2024 10:26:27 +0100 +Subject: Revert "usb: phy: generic: Get the vbus supply" + +From: Alexander Stein + +[ Upstream commit fdada0db0b2ae2addef4ccafe50937874dbeeebe ] + +This reverts commit 75fd6485cccef269ac9eb3b71cf56753341195ef. +This patch was applied twice by accident, causing probe failures. +Revert the accident. + +Signed-off-by: Alexander Stein +Fixes: 75fd6485ccce ("usb: phy: generic: Get the vbus supply") +Cc: stable +Reviewed-by: Sean Anderson +Link: https://lore.kernel.org/r/20240314092628.1869414-1-alexander.stein@ew.tq-group.com +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/usb/phy/phy-generic.c | 7 ------- + 1 file changed, 7 deletions(-) + +diff --git a/drivers/usb/phy/phy-generic.c b/drivers/usb/phy/phy-generic.c +index 34b9f81401871..661a229c105dd 100644 +--- a/drivers/usb/phy/phy-generic.c ++++ b/drivers/usb/phy/phy-generic.c +@@ -268,13 +268,6 @@ int usb_phy_gen_create_phy(struct device *dev, struct usb_phy_generic *nop) + return -EPROBE_DEFER; + } + +- nop->vbus_draw = devm_regulator_get_exclusive(dev, "vbus"); +- if (PTR_ERR(nop->vbus_draw) == -ENODEV) +- nop->vbus_draw = NULL; +- if (IS_ERR(nop->vbus_draw)) +- return dev_err_probe(dev, PTR_ERR(nop->vbus_draw), +- "could not get vbus regulator\n"); +- + nop->dev = dev; + nop->phy.dev = nop->dev; + nop->phy.label = "nop-xceiv"; +-- +2.43.0 + diff --git a/queue-5.15/scsi-qla2xxx-update-manufacturer-detail.patch b/queue-5.15/scsi-qla2xxx-update-manufacturer-detail.patch new file mode 100644 index 00000000000..4e95adb6882 --- /dev/null +++ b/queue-5.15/scsi-qla2xxx-update-manufacturer-detail.patch @@ -0,0 +1,39 @@ +From 6b7e433615869af6e1ed10a3e1d4623e26d45d65 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 27 Feb 2024 22:11:20 +0530 +Subject: scsi: qla2xxx: Update manufacturer detail + +From: Bikash Hazarika + +[ Upstream commit 688fa069fda6fce24d243cddfe0c7024428acb74 ] + +Update manufacturer detail from "Marvell Semiconductor, Inc." to +"Marvell". + +Cc: stable@vger.kernel.org +Signed-off-by: Bikash Hazarika +Signed-off-by: Nilesh Javali +Link: https://lore.kernel.org/r/20240227164127.36465-5-njavali@marvell.com +Reviewed-by: Himanshu Madhani +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +--- + drivers/scsi/qla2xxx/qla_def.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h +index bab890f1110a1..87ada9b447170 100644 +--- a/drivers/scsi/qla2xxx/qla_def.h ++++ b/drivers/scsi/qla2xxx/qla_def.h +@@ -78,7 +78,7 @@ typedef union { + #include "qla_nvme.h" + #define QLA2XXX_DRIVER_NAME "qla2xxx" + #define QLA2XXX_APIDEV "ql2xapidev" +-#define QLA2XXX_MANUFACTURER "Marvell Semiconductor, Inc." ++#define QLA2XXX_MANUFACTURER "Marvell" + + /* + * We have MAILBOX_REGISTER_COUNT sized arrays in a few places, +-- +2.43.0 + diff --git a/queue-5.15/scsi-qla2xxx-update-manufacturer-details.patch b/queue-5.15/scsi-qla2xxx-update-manufacturer-details.patch new file mode 100644 index 00000000000..6d07e250d8c --- /dev/null +++ b/queue-5.15/scsi-qla2xxx-update-manufacturer-details.patch @@ -0,0 +1,53 @@ +From 4eb05b0751b06d1183a3bb5b151ce6fb88188c0b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 12 Jul 2022 22:20:44 -0700 +Subject: scsi: qla2xxx: Update manufacturer details + +From: Bikash Hazarika + +[ Upstream commit 1ccad27716ecad1fd58c35e579bedb81fa5e1ad5 ] + +Update manufacturer details to indicate Marvell Semiconductors. + +Link: https://lore.kernel.org/r/20220713052045.10683-10-njavali@marvell.com +Cc: stable@vger.kernel.org +Reviewed-by: Himanshu Madhani +Signed-off-by: Bikash Hazarika +Signed-off-by: Nilesh Javali +Signed-off-by: Martin K. Petersen +Stable-dep-of: 688fa069fda6 ("scsi: qla2xxx: Update manufacturer detail") +Signed-off-by: Sasha Levin +--- + drivers/scsi/qla2xxx/qla_def.h | 2 +- + drivers/scsi/qla2xxx/qla_gs.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h +index 3c876967e8b16..bab890f1110a1 100644 +--- a/drivers/scsi/qla2xxx/qla_def.h ++++ b/drivers/scsi/qla2xxx/qla_def.h +@@ -78,7 +78,7 @@ typedef union { + #include "qla_nvme.h" + #define QLA2XXX_DRIVER_NAME "qla2xxx" + #define QLA2XXX_APIDEV "ql2xapidev" +-#define QLA2XXX_MANUFACTURER "QLogic Corporation" ++#define QLA2XXX_MANUFACTURER "Marvell Semiconductor, Inc." + + /* + * We have MAILBOX_REGISTER_COUNT sized arrays in a few places, +diff --git a/drivers/scsi/qla2xxx/qla_gs.c b/drivers/scsi/qla2xxx/qla_gs.c +index d3742a83d2fd7..b0f3bf42c3405 100644 +--- a/drivers/scsi/qla2xxx/qla_gs.c ++++ b/drivers/scsi/qla2xxx/qla_gs.c +@@ -1615,7 +1615,7 @@ qla2x00_hba_attributes(scsi_qla_host_t *vha, void *entries, + eiter->type = cpu_to_be16(FDMI_HBA_MANUFACTURER); + alen = scnprintf( + eiter->a.manufacturer, sizeof(eiter->a.manufacturer), +- "%s", "QLogic Corporation"); ++ "%s", QLA2XXX_MANUFACTURER); + alen += FDMI_ATTR_ALIGNMENT(alen); + alen += FDMI_ATTR_TYPELEN(eiter); + eiter->len = cpu_to_be16(alen); +-- +2.43.0 + diff --git a/queue-5.15/selinux-avoid-dereference-of-garbage-after-mount-fai.patch b/queue-5.15/selinux-avoid-dereference-of-garbage-after-mount-fai.patch new file mode 100644 index 00000000000..f0aac37bbde --- /dev/null +++ b/queue-5.15/selinux-avoid-dereference-of-garbage-after-mount-fai.patch @@ -0,0 +1,67 @@ +From 6d98c3c1fef632225f341c91f898f704c513a416 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 28 Mar 2024 20:16:58 +0100 +Subject: selinux: avoid dereference of garbage after mount failure +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Christian Göttsche + +[ Upstream commit 37801a36b4d68892ce807264f784d818f8d0d39b ] + +In case kern_mount() fails and returns an error pointer return in the +error branch instead of continuing and dereferencing the error pointer. + +While on it drop the never read static variable selinuxfs_mount. + +Cc: stable@vger.kernel.org +Fixes: 0619f0f5e36f ("selinux: wrap selinuxfs state") +Signed-off-by: Christian Göttsche +Signed-off-by: Paul Moore +Signed-off-by: Sasha Levin +--- + security/selinux/selinuxfs.c | 12 +++++++----- + 1 file changed, 7 insertions(+), 5 deletions(-) + +diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c +index f2f6203e0fff5..a96895d8bb6d7 100644 +--- a/security/selinux/selinuxfs.c ++++ b/security/selinux/selinuxfs.c +@@ -2208,7 +2208,6 @@ static struct file_system_type sel_fs_type = { + .kill_sb = sel_kill_sb, + }; + +-static struct vfsmount *selinuxfs_mount __ro_after_init; + struct path selinux_null __ro_after_init; + + static int __init init_sel_fs(void) +@@ -2230,18 +2229,21 @@ static int __init init_sel_fs(void) + return err; + } + +- selinux_null.mnt = selinuxfs_mount = kern_mount(&sel_fs_type); +- if (IS_ERR(selinuxfs_mount)) { ++ selinux_null.mnt = kern_mount(&sel_fs_type); ++ if (IS_ERR(selinux_null.mnt)) { + pr_err("selinuxfs: could not mount!\n"); +- err = PTR_ERR(selinuxfs_mount); +- selinuxfs_mount = NULL; ++ err = PTR_ERR(selinux_null.mnt); ++ selinux_null.mnt = NULL; ++ return err; + } ++ + selinux_null.dentry = d_hash_and_lookup(selinux_null.mnt->mnt_root, + &null_name); + if (IS_ERR(selinux_null.dentry)) { + pr_err("selinuxfs: could not lookup null!\n"); + err = PTR_ERR(selinux_null.dentry); + selinux_null.dentry = NULL; ++ return err; + } + + return err; +-- +2.43.0 + diff --git a/queue-5.15/series b/queue-5.15/series index 9bc8c4babb7..d17244b40a6 100644 --- a/queue-5.15/series +++ b/queue-5.15/series @@ -653,3 +653,15 @@ octeontx2-af-fix-issue-with-loading-coalesced-kpu-profiles.patch octeontx2-pf-check-negative-error-code-in-otx2_open.patch i40e-fix-i40e_count_filters-to-count-only-active-new-filters.patch i40e-fix-vf-may-be-used-uninitialized-in-this-function-warning.patch +scsi-qla2xxx-update-manufacturer-details.patch +scsi-qla2xxx-update-manufacturer-detail.patch +revert-usb-phy-generic-get-the-vbus-supply.patch +usb-typec-ucsi-check-for-notifications-after-init.patch +i40e-store-the-irq-number-in-i40e_q_vector.patch +i40e-remove-_t-suffix-from-enum-type-names.patch +i40e-enforce-software-interrupt-during-busy-poll-exi.patch +net-usb-asix-suspend-embedded-phy-if-external-is-use.patch +drivers-net-convert-to-boolean-for-the-mac_managed_p.patch +net-fec-set-mac_managed_pm-during-probe.patch +net-ravb-always-process-tx-descriptor-ring.patch +selinux-avoid-dereference-of-garbage-after-mount-fai.patch diff --git a/queue-5.15/usb-typec-ucsi-check-for-notifications-after-init.patch b/queue-5.15/usb-typec-ucsi-check-for-notifications-after-init.patch new file mode 100644 index 00000000000..cff3c1917da --- /dev/null +++ b/queue-5.15/usb-typec-ucsi-check-for-notifications-after-init.patch @@ -0,0 +1,70 @@ +From 40a0a3307d80bc4f10761d7a01bc3cc4a6cf4328 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 20 Mar 2024 08:39:23 +0100 +Subject: usb: typec: ucsi: Check for notifications after init + +From: Christian A. Ehrhardt + +[ Upstream commit 808a8b9e0b87bbc72bcc1f7ddfe5d04746e7ce56 ] + +The completion notification for the final SET_NOTIFICATION_ENABLE +command during initialization can include a connector change +notification. However, at the time this completion notification is +processed, the ucsi struct is not ready to handle this notification. +As a result the notification is ignored and the controller +never sends an interrupt again. + +Re-check CCI for a pending connector state change after +initialization is complete. Adjust the corresponding debug +message accordingly. + +Fixes: 71a1fa0df2a3 ("usb: typec: ucsi: Store the notification mask") +Cc: stable@vger.kernel.org +Signed-off-by: Christian A. Ehrhardt +Reviewed-by: Heikki Krogerus +Tested-by: Neil Armstrong # on SM8550-QRD +Link: https://lore.kernel.org/r/20240320073927.1641788-3-lk@c--e.de +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/usb/typec/ucsi/ucsi.c | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c +index 985e512c0e659..df7c42df9ea0d 100644 +--- a/drivers/usb/typec/ucsi/ucsi.c ++++ b/drivers/usb/typec/ucsi/ucsi.c +@@ -854,7 +854,7 @@ void ucsi_connector_change(struct ucsi *ucsi, u8 num) + struct ucsi_connector *con = &ucsi->connector[num - 1]; + + if (!(ucsi->ntfy & UCSI_ENABLE_NTFY_CONNECTOR_CHANGE)) { +- dev_dbg(ucsi->dev, "Bogus connector change event\n"); ++ dev_dbg(ucsi->dev, "Early connector change event\n"); + return; + } + +@@ -1241,6 +1241,7 @@ static int ucsi_init(struct ucsi *ucsi) + { + struct ucsi_connector *con; + u64 command, ntfy; ++ u32 cci; + int ret; + int i; + +@@ -1292,6 +1293,13 @@ static int ucsi_init(struct ucsi *ucsi) + goto err_unregister; + + ucsi->ntfy = ntfy; ++ ++ ret = ucsi->ops->read(ucsi, UCSI_CCI, &cci, sizeof(cci)); ++ if (ret) ++ return ret; ++ if (UCSI_CCI_CONNECTOR(READ_ONCE(cci))) ++ ucsi_connector_change(ucsi, cci); ++ + return 0; + + err_unregister: +-- +2.43.0 +