6.6.140-rc1 review
Subsystems (4)
Greg Kroah-Hartman
maintainerPATCH 420/474 xfrm: ah: account for ESN high bits in async callbacks
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Bommarito <[email protected]>
[ Upstream commit ec54093e6a8f87e800bb6aa15eb7fc1e33faa524 ]
AH allocates its temporary auth/ICV layout differently when ESN is enabled:
the async ahash setup appends a 4-byte seqhi slot before the ICV or auth_data area, but the async completion callbacks still reconstruct the temporary layout as if seqhi were absent.
With an async AH implementation selected, that makes AH copy or compare the wrong bytes on both the IPv4 and IPv6 paths. In UML repro on IPv4 AH with ESN and forced async hmac(sha1), ping fails with 100% packet loss, and the callback logs show the pre-fix drift:
ah4 output_done: esn=1 err=0 icv_off=20 expected_off=24
ah4 input_done: esn=1 auth_off=20 expected_auth_off=24 icv_off=32 expected_icv_off=36
Reconstruct the callback-side layout the same way the setup path built it by skipping the ESN seqhi slot before locating the saved auth_data or ICV. Per RFC 4302, the ESN high-order 32 bits participate in the AH ICV computation, so the async callbacks must account for the seqhi slot.
Post-fix, the same IPv4 AH+ESN+forced-async-hmac(sha1) UML repro shows the corrected offset (ah4 output_done: esn=1 err=0 icv_off=24 expected_off=24) and ping succeeds; net/ipv4/ah4.o and net/ipv6/ah6.o build clean at W=1. IPv6 AH+ESN was not exercised at runtime, and the change has not been tested against a real async hardware AH engine.
--- net/ipv4/ah4.c | 14 ++++++++++++-- net/ipv6/ah6.c | 14 ++++++++++++-- 2 files changed, 24 insertions(+), 4 deletions(-)
net/ipv4/ah4.c +12 -2
@@ -124,9 +124,14 @@ static void ah_output_done(void *data, istruct iphdr *top_iph =ip_hdr (skb);struct ip_auth_hdr *ah =ip_auth_hdr (skb);int ihl =ip_hdrlen (skb); +int seqhi_len =0 ; +__be32 *seqhi; +if (x->props.flags &XFRM_STATE_ESN ) + seqhi_len =sizeof (*seqhi); iph =AH_SKB_CB (skb)->tmp; - icv =ah_tmp_icv (iph, ihl); + seqhi = (__be32 *)((char *)iph + ihl); + icv =ah_tmp_icv (seqhi, seqhi_len);memcpy (ah->auth_data, icv, ahp->icv_trunc_len); top_iph->tos = iph->tos;
@@ -270,12 +275,17 @@ static void ah_input_done(void *data, instruct ip_auth_hdr *ah =ip_auth_hdr (skb);int ihl =ip_hdrlen (skb);int ah_hlen = (ah->hdrlen +2 ) <<2 ; +int seqhi_len =0 ; +__be32 *seqhi;if (err) goto out; +if (x->props.flags &XFRM_STATE_ESN ) + seqhi_len =sizeof (*seqhi); work_iph =AH_SKB_CB (skb)->tmp; - auth_data =ah_tmp_auth (work_iph, ihl); + seqhi = (__be32 *)((char *)work_iph + ihl); + auth_data =ah_tmp_auth (seqhi, seqhi_len); icv =ah_tmp_icv (auth_data, ahp->icv_trunc_len); err =crypto_memneq (icv, auth_data, ahp->icv_trunc_len) ? -EBADMSG :0 ;
net/ipv6/ah6.c +12 -2
@@ -317,14 +317,19 @@ static void ah6_output_done(void *data,struct ipv6hdr *top_iph =ipv6_hdr (skb);struct ip_auth_hdr *ah =ip_auth_hdr (skb);struct tmp_ext *iph_ext; +int seqhi_len =0 ; +__be32 *seqhi; extlen =skb_network_header_len (skb) -sizeof (struct ipv6hdr );if (extlen) extlen +=sizeof (*iph_ext); +if (x->props.flags &XFRM_STATE_ESN ) + seqhi_len =sizeof (*seqhi); iph_base =AH_SKB_CB (skb)->tmp; iph_ext =ah_tmp_ext (iph_base); - icv =ah_tmp_icv (iph_ext, extlen); + seqhi = (__be32 *)((char *)iph_ext + extlen); + icv =ah_tmp_icv (seqhi, seqhi_len);memcpy (ah->auth_data, icv, ahp->icv_trunc_len);memcpy (top_iph, iph_base,IPV6HDR_BASELEN );
@@ -471,13 +476,18 @@ static void ah6_input_done(void *data, istruct ip_auth_hdr *ah =ip_auth_hdr (skb);int hdr_len =skb_network_header_len (skb);int ah_hlen =ipv6_authlen (ah); +int seqhi_len =0 ; +__be32 *seqhi;if (err) goto out; +if (x->props.flags &XFRM_STATE_ESN ) + seqhi_len =sizeof (*seqhi); work_iph =AH_SKB_CB (skb)->tmp; auth_data =ah_tmp_auth (work_iph, hdr_len); - icv =ah_tmp_icv (auth_data, ahp->icv_trunc_len); + seqhi = (__be32 *)(auth_data + ahp->icv_trunc_len); + icv =ah_tmp_icv (seqhi, seqhi_len); err =crypto_memneq (icv, auth_data, ahp->icv_trunc_len) ? -EBADMSG :0 ;if (err)
Greg Kroah-Hartman
maintainerPATCH 421/474 xfrm: defensively unhash xfrm_state lists in __xfrm_state_delete
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Kosiorek <[email protected]>
[ Upstream commit 14acf9652e5690de3c7486c6db5fb8dafd0a32a3 ]
KASAN reproduces a slab-use-after-free in __xfrm_state_delete()'s hlist_del_rcu calls under syzkaller load on linux-6.12.y stable (reproduced on 6.12.47, also reachable via the same code path on torvalds/master and on the ipsec tree). Nine unique signatures cluster in the xfrm_state lifecycle, the load-bearing one being:
BUG: KASAN: slab-use-after-free in __hlist_del include/linux/list.h:990 [inline] BUG: KASAN: slab-use-after-free in hlist_del_rcu include/linux/rculist.h:516 [inline] BUG: KASAN: slab-use-after-free in __xfrm_state_delete net/xfrm/xfrm_state.c Write of size 8 at addr ffff8881198bcb70 by task kworker/u8:9/435 Workqueue: netns cleanup_net Call Trace: __hlist_del / hlist_del_rcu __xfrm_state_delete xfrm_state_delete xfrm_state_flush xfrm_state_fini ops_exit_list cleanup_net
The other observed signatures hit the same slab object from __xfrm_state_lookup, xfrm_alloc_spi, __xfrm_state_insert and an OOB write variant of __xfrm_state_delete, all on the byseq/byspi hash chains.
__xfrm_state_delete() guards its byseq and byspi unhashes with value-based predicates:
if (x->km.seq) hlist_del_rcu(&x->byseq); if (x->id.spi) hlist_del_rcu(&x->byspi);
while everywhere else in the file (e.g. state_cache, state_cache_input) the safer hlist_unhashed() check is used. xfrm_alloc_spi() sets x->id.spi = newspi inside xfrm_state_lock and then immediately inserts into byspi, but a path that observes x->id.spi != 0 outside of xfrm_state_lock can still skip-or-hit the byspi unhash inconsistently with whether x is actually on the list. The same holds for x->km.seq versus byseq, and the bydst/bysrc unhashes have no predicate at all, so a second __xfrm_state_delete() on the same object writes through LIST_POISON pprev.
The defensive change here:
- Use hlist_del_init_rcu() instead of hlist_del_rcu() on bydst, bysrc, byseq and byspi so a second deletion is a no-op rather than a write through LIST_POISON pprev. The byseq/byspi nodes are already initialised in xfrm_state_alloc().
- Test hlist_unhashed() rather than the value predicate for byseq/byspi, so the unhash decision tracks list state rather than mutable scalar fields.
Empirical verification: applied this patch on top of v6.12.47, rebuilt, and re-ran the same syzkaller harness for 1h16m on a previously-crashy configuration that produced ~100 hits each of slab-use-after-free Read in xfrm_alloc_spi / Read in __xfrm_state_lookup / Write in __xfrm_state_delete. After the patch, 7.1M execs across 32 VMs at ~1550 exec/sec produced zero xfrm_state UAF/OOB hits. /proc/slabinfo confirms the xfrm_state slab is actively allocated and freed during the run (~143 KiB resident), so the fuzzer is still exercising those code paths -- they just no longer crash.
Reproduction:
- Linux 6.12.47 x86_64 + KASAN_GENERIC + KASAN_INLINE + KCOV
- syzkaller @ 746545b8b1e4c3a128db8652b340d3df90ce61db
- 32 QEMU/KVM VMs x 2 vCPU on AWS c5.metal bare metal
- 9 unique signatures collected in ~9h, all within xfrm_state lifecycle
--- net/xfrm/xfrm_state.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
net/xfrm/xfrm_state.c +6 -6
@@ -752,12 +752,12 @@ int __xfrm_state_delete(struct xfrm_stat x->km.state =XFRM_STATE_DEAD ;spin_lock (&net->xfrm.xfrm_state_lock);list_del (&x->km.all); -hlist_del_rcu (&x->bydst); -hlist_del_rcu (&x->bysrc); -if (x->km.seq) -hlist_del_rcu (&x->byseq); -if (x->id.spi) -hlist_del_rcu (&x->byspi); +hlist_del_init_rcu (&x->bydst); +hlist_del_init_rcu (&x->bysrc); +if (!hlist_unhashed (&x->byseq)) +hlist_del_init_rcu (&x->byseq); +if (!hlist_unhashed (&x->byspi)) +hlist_del_init_rcu (&x->byspi); net->xfrm.state_num--;spin_unlock (&net->xfrm.xfrm_state_lock);
Greg Kroah-Hartman
maintainerPATCH 422/474 Bluetooth: hci_conn: fix potential UAF in create_big_sync
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Carlier <[email protected]>
[ Upstream commit 0beddb0c380bed5f5b8e61ddbe14635bb73d0b41 ]
Add hci_conn_valid() check in create_big_sync() to detect stale connections before proceeding with BIG creation. Handle the resulting -ECANCELED in create_big_complete() and re-validate the connection under hci_dev_lock() before dereferencing, matching the pattern used by create_le_conn_complete() and create_pa_complete().
Keep the hci_conn object alive across the async boundary by taking a reference via hci_conn_get() when queueing create_big_sync(), and dropping it in the completion callback. The refcount and the lock are complementary: the refcount keeps the object allocated, while hci_dev_lock() serializes hci_conn_hash_del()'s list_del_rcu() on hdev->conn_hash, as required by hci_conn_del().
hci_conn_put() is called outside hci_dev_unlock() so the final put (which resolves to kfree() via bt_link_release) does not run under hdev->lock, though the release path would be safe either way.
Without this, create_big_complete() would unconditionally dereference the conn pointer on error, causing a use-after-free via hci_connect_cfm() and hci_conn_del().
--- net/bluetooth/hci_conn.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-)
net/bluetooth/hci_conn.c +18 -1
@@ -2014,6 +2014,9 @@ static int create_big_sync(struct hci_deu32 flags =0 ;int err; +if (!hci_conn_valid (hdev, conn)) +return -ECANCELED ; +if (qos->bcast.out.phy ==0x02 ) flags |=MGMT_ADV_FLAG_SEC_2M ;
@@ -2125,11 +2128,24 @@ static void create_big_complete(struct hbt_dev_dbg (hdev,"conn %p" , conn); +if (err == -ECANCELED ) + goto done; + +hci_dev_lock (hdev); + +if (!hci_conn_valid (hdev, conn)) + goto unlock; +if (err) {bt_dev_err (hdev,"Unable to create BIG: %d" , err);hci_connect_cfm (conn, err);hci_conn_del (conn); } + +unlock: +hci_dev_unlock (hdev); +done: +hci_conn_put (conn); } struct hci_conn *hci_bind_bis(struct hci_dev *hdev, bdaddr_t *dst,
@@ -2230,10 +2246,11 @@ struct hci_conn *hci_connect_bis(struct BT_BOUND, &data);/* Queue start periodic advertising and create BIG */ - err =hci_cmd_sync_queue (hdev, create_big_sync, conn, + err =hci_cmd_sync_queue (hdev, create_big_sync,hci_conn_get (conn), create_big_complete);if (err <0 ) {hci_conn_drop (conn); +hci_conn_put (conn);return ERR_PTR (err); }
Greg Kroah-Hartman
maintainerPATCH 423/474 spi: synquacer: switch to use modern name
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yang Yingliang <[email protected]>
[ Upstream commit 3524d1b727a66712f02f92807219a3650e5cf910 ]
Change legacy name master to modern name host or controller.
No functional changed.
Stable-dep-of: 75d849c3452e ("spi: syncuacer: fix controller deregistration")
--- drivers/spi/spi-synquacer.c | 84 ++++++++++++++++++++++---------------------- 1 file changed, 42 insertions(+), 42 deletions(-)
drivers/spi/spi-synquacer.c +42 -42
@@ -225,11 +225,11 @@ static int write_fifo(struct synquacer_sreturn 0 ; } -static int synquacer_spi_config (struct spi_master *master, +static int synquacer_spi_config (struct spi_controller *host,struct spi_device *spi,struct spi_transfer *xfer) { -struct synquacer_spi *sspi =spi_master_get_devdata (master); +struct synquacer_spi *sspi =spi_controller_get_devdata (host);unsigned int speed, mode, bpw, cs, bus_width, transfer_mode;u32 rate, val, div;
@@ -263,7 +263,7 @@ static int synquacer_spi_config(struct s } sspi->transfer_mode = transfer_mode; - rate = master->max_speed_hz; + rate = host->max_speed_hz; div =DIV_ROUND_UP (rate, speed);if (div >254 ) {
@@ -350,11 +350,11 @@ static int synquacer_spi_config(struct sreturn 0 ; } -static int synquacer_spi_transfer_one (struct spi_master *master, +static int synquacer_spi_transfer_one (struct spi_controller *host,struct spi_device *spi,struct spi_transfer *xfer) { -struct synquacer_spi *sspi =spi_master_get_devdata (master); +struct synquacer_spi *sspi =spi_controller_get_devdata (host);int ret;int status =0 ;u32 words;
@@ -378,7 +378,7 @@ static int synquacer_spi_transfer_one(stif (bpw ==8 && !(xfer->len %4 ) && !(spi->mode &SPI_LSB_FIRST )) xfer->bits_per_word =32 ; - ret =synquacer_spi_config (master, spi, xfer); + ret =synquacer_spi_config (host, spi, xfer);/* restore */ xfer->bits_per_word = bpw;
@@ -482,7 +482,7 @@ static int synquacer_spi_transfer_one(ststatic void synquacer_spi_set_cs (struct spi_device *spi,bool enable) { -struct synquacer_spi *sspi =spi_master_get_devdata (spi->master); +struct synquacer_spi *sspi =spi_controller_get_devdata (spi->controller);u32 val; val =readl (sspi->regs +SYNQUACER_HSSPI_REG_DMSTART );
@@ -517,11 +517,11 @@ static int synquacer_spi_wait_status_updreturn -EBUSY ; } -static int synquacer_spi_enable (struct spi_master *master) +static int synquacer_spi_enable (struct spi_controller *host) {u32 val;int status; -struct synquacer_spi *sspi =spi_master_get_devdata (master); +struct synquacer_spi *sspi =spi_controller_get_devdata (host);/* Disable module */ writel (0 , sspi->regs +SYNQUACER_HSSPI_REG_MCTRL );
@@ -601,18 +601,18 @@ static irqreturn_t sq_spi_tx_handler(intstatic int synquacer_spi_probe (struct platform_device *pdev) {struct device_node *np = pdev->dev.of_node; -struct spi_master *master; +struct spi_controller *host;struct synquacer_spi *sspi;int ret;int rx_irq, tx_irq; - master =spi_alloc_master (&pdev->dev,sizeof (*sspi)); -if (!master) + host =spi_alloc_host (&pdev->dev,sizeof (*sspi)); +if (!host)return -ENOMEM ; -platform_set_drvdata (pdev, master); +platform_set_drvdata (pdev, host); - sspi =spi_master_get_devdata (master); + sspi =spi_controller_get_devdata (host); sspi->dev = &pdev->dev;init_completion (&sspi->transfer_done);
@@ -625,7 +625,7 @@ static int synquacer_spi_probe(struct pl sspi->clk_src_type =SYNQUACER_HSSPI_CLOCK_SRC_IHCLK ;/* Default */ device_property_read_u32 (&pdev->dev,"socionext,ihclk-rate" , - &master->max_speed_hz);/* for ACPI */ + &host->max_speed_hz);/* for ACPI */ if (dev_of_node (&pdev->dev)) { if (device_property_match_string(&pdev->dev,
@@ -655,21 +655,21 @@ static int synquacer_spi_probe(struct pl goto put_spi; } - master->max_speed_hz =clk_get_rate (sspi->clk); + host->max_speed_hz =clk_get_rate (sspi->clk); } -if (!master->max_speed_hz) { +if (!host->max_speed_hz) {dev_err (&pdev->dev,"missing clock source\n" ); ret = -EINVAL ; goto disable_clk; } - master->min_speed_hz = master->max_speed_hz /254 ; + host->min_speed_hz = host->max_speed_hz /254 ; sspi->aces =device_property_read_bool (&pdev->dev,"socionext,set-aces" ); sspi->rtm =device_property_read_bool (&pdev->dev,"socionext,use-rtm" ); - master->num_chipselect =SYNQUACER_HSSPI_NUM_CHIP_SELECT ; + host->num_chipselect =SYNQUACER_HSSPI_NUM_CHIP_SELECT ; rx_irq =platform_get_irq (pdev,0 );if (rx_irq <=0 ) {
@@ -699,27 +699,27 @@ static int synquacer_spi_probe(struct pl goto disable_clk; } - master->dev.of_node = np; - master->dev.fwnode = pdev->dev.fwnode; - master->auto_runtime_pm = true; - master->bus_num = pdev->id; - - master->mode_bits =SPI_CPOL |SPI_CPHA |SPI_TX_DUAL |SPI_RX_DUAL | -SPI_TX_QUAD |SPI_RX_QUAD ; - master->bits_per_word_mask =SPI_BPW_MASK (32 ) |SPI_BPW_MASK (24 ) | -SPI_BPW_MASK (16 ) |SPI_BPW_MASK (8 ); + host->dev.of_node = np; + host->dev.fwnode = pdev->dev.fwnode; + host->auto_runtime_pm = true; + host->bus_num = pdev->id; + + host->mode_bits =SPI_CPOL |SPI_CPHA |SPI_TX_DUAL |SPI_RX_DUAL | +SPI_TX_QUAD |SPI_RX_QUAD ; + host->bits_per_word_mask =SPI_BPW_MASK (32 ) |SPI_BPW_MASK (24 ) | +SPI_BPW_MASK (16 ) |SPI_BPW_MASK (8 ); - master->set_cs = synquacer_spi_set_cs; - master->transfer_one = synquacer_spi_transfer_one; + host->set_cs = synquacer_spi_set_cs; + host->transfer_one = synquacer_spi_transfer_one; - ret =synquacer_spi_enable (master); + ret =synquacer_spi_enable (host);if (ret) goto disable_clk;pm_runtime_set_active (sspi->dev);pm_runtime_enable (sspi->dev); - ret =devm_spi_register_master (sspi->dev, master); + ret =devm_spi_register_controller (sspi->dev, host);if (ret) goto disable_pm;
@@ -730,15 +730,15 @@ disable_pm: disable_clk:clk_disable_unprepare (sspi->clk); put_spi: -spi_master_put (master); +spi_controller_put (host);return ret; }static void synquacer_spi_remove (struct platform_device *pdev) { -struct spi_master *master =platform_get_drvdata (pdev); -struct synquacer_spi *sspi =spi_master_get_devdata (master); +struct spi_controller *host =platform_get_drvdata (pdev); +struct synquacer_spi *sspi =spi_controller_get_devdata (host);pm_runtime_disable (sspi->dev);
@@ -747,11 +747,11 @@ static void synquacer_spi_remove(structstatic int __maybe_unused synquacer_spi_suspend (struct device *dev) { -struct spi_master *master =dev_get_drvdata (dev); -struct synquacer_spi *sspi =spi_master_get_devdata (master); +struct spi_controller *host =dev_get_drvdata (dev); +struct synquacer_spi *sspi =spi_controller_get_devdata (host);int ret; - ret =spi_master_suspend (master); + ret =spi_controller_suspend (host);if (ret)return ret;
@@ -763,8 +763,8 @@ static int __maybe_unused synquacer_spi_static int __maybe_unused synquacer_spi_resume (struct device *dev) { -struct spi_master *master =dev_get_drvdata (dev); -struct synquacer_spi *sspi =spi_master_get_devdata (master); +struct spi_controller *host =dev_get_drvdata (dev); +struct synquacer_spi *sspi =spi_controller_get_devdata (host);int ret;if (!pm_runtime_suspended (dev)) {
@@ -778,7 +778,7 @@ static int __maybe_unused synquacer_spi_return ret; } - ret =synquacer_spi_enable (master); + ret =synquacer_spi_enable (host);if (ret) {clk_disable_unprepare (sspi->clk);dev_err (dev,"failed to enable spi (%d)\n" , ret);
@@ -786,7 +786,7 @@ static int __maybe_unused synquacer_spi_ } } - ret =spi_master_resume (master); + ret =spi_controller_resume (host);if (ret <0 )clk_disable_unprepare (sspi->clk);
Greg Kroah-Hartman
maintainerPATCH 424/474 spi: syncuacer: fix controller deregistration
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
[ Upstream commit 75d849c3452e9611de031db45b3149ba9a99035f ]
Make sure to deregister the controller before disabling underlying resources like clocks during driver unbind.
--- drivers/spi/spi-synquacer.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/spi/spi-synquacer.c +7 -1
@@ -719,7 +719,7 @@ static int synquacer_spi_probe(struct plpm_runtime_set_active (sspi->dev);pm_runtime_enable (sspi->dev); - ret =devm_spi_register_controller (sspi->dev, host); + ret =spi_register_controller (host);if (ret) goto disable_pm;
@@ -740,9 +740,15 @@ static void synquacer_spi_remove(structstruct spi_controller *host =platform_get_drvdata (pdev);struct synquacer_spi *sspi =spi_controller_get_devdata (host); +spi_controller_get (host); + +spi_unregister_controller (host); +pm_runtime_disable (sspi->dev);clk_disable_unprepare (sspi->clk); + +spi_controller_put (host); }static int __maybe_unused synquacer_spi_suspend (struct device *dev)
Greg Kroah-Hartman
maintainerPATCH 425/474 spi: sun4i: switch to use modern name
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yang Yingliang <[email protected]>
[ Upstream commit 6d232cc8a7e59af0c083319827541966a68817a0 ]
Change legacy name master to modern name host or controller.
No functional changed.
Stable-dep-of: 42108a2f03e0 ("spi: sun4i: fix controller deregistration")
--- drivers/spi/spi-sun4i.c | 72 ++++++++++++++++++++++++------------------------ 1 file changed, 36 insertions(+), 36 deletions(-)
drivers/spi/spi-sun4i.c +36 -36
@@ -75,7 +75,7 @@#define SUN4I_FIFO_STA_TF_CNT_BITS 16struct sun4i_spi { -struct spi_master *master; +struct spi_controller *host;void __iomem *base_addr;struct clk *hclk;struct clk *mclk;
@@ -161,7 +161,7 @@ static inline void sun4i_spi_fill_fifo(sstatic void sun4i_spi_set_cs (struct spi_device *spi,bool enable) { -struct sun4i_spi *sspi =spi_master_get_devdata (spi->master); +struct sun4i_spi *sspi =spi_controller_get_devdata (spi->controller);u32 reg; reg =sun4i_spi_read (sspi,SUN4I_CTL_REG );
@@ -201,11 +201,11 @@ static size_t sun4i_spi_max_transfer_sizreturn SUN4I_MAX_XFER_SIZE -1 ; } -static int sun4i_spi_transfer_one (struct spi_master *master, +static int sun4i_spi_transfer_one (struct spi_controller *host,struct spi_device *spi,struct spi_transfer *tfr) { -struct sun4i_spi *sspi =spi_master_get_devdata (master); +struct sun4i_spi *sspi =spi_controller_get_devdata (host);unsigned int mclk_rate, div, timeout;unsigned int start, end, tx_time;unsigned int tx_len =0 ;
@@ -334,7 +334,7 @@ static int sun4i_spi_transfer_one(struct msecs_to_jiffies(tx_time)); end = jiffies;if (!timeout) { -dev_warn (&master->dev, +dev_warn (&host->dev,"%s: timeout transferring %u bytes@%iHz for %i(%i)ms" ,dev_name (&spi->dev), tfr->len, tfr->speed_hz,jiffies_to_msecs (end - start), tx_time);
@@ -389,8 +389,8 @@ static irqreturn_t sun4i_spi_handler(intstatic int sun4i_spi_runtime_resume (struct device *dev) { -struct spi_master *master =dev_get_drvdata (dev); -struct sun4i_spi *sspi =spi_master_get_devdata (master); +struct spi_controller *host =dev_get_drvdata (dev); +struct sun4i_spi *sspi =spi_controller_get_devdata (host);int ret; ret =clk_prepare_enable (sspi->hclk);
@@ -418,8 +418,8 @@ out:static int sun4i_spi_runtime_suspend (struct device *dev) { -struct spi_master *master =dev_get_drvdata (dev); -struct sun4i_spi *sspi =spi_master_get_devdata (master); +struct spi_controller *host =dev_get_drvdata (dev); +struct sun4i_spi *sspi =spi_controller_get_devdata (host);clk_disable_unprepare (sspi->mclk);clk_disable_unprepare (sspi->hclk);
@@ -429,62 +429,62 @@ static int sun4i_spi_runtime_suspend(strstatic int sun4i_spi_probe (struct platform_device *pdev) { -struct spi_master *master; +struct spi_controller *host;struct sun4i_spi *sspi;int ret =0 , irq; - master =spi_alloc_master (&pdev->dev,sizeof (struct sun4i_spi )); -if (!master) { -dev_err (&pdev->dev,"Unable to allocate SPI Master\n" ); + host =spi_alloc_host (&pdev->dev,sizeof (struct sun4i_spi )); +if (!host) { +dev_err (&pdev->dev,"Unable to allocate SPI Host\n" );return -ENOMEM ; } -platform_set_drvdata (pdev, master); - sspi =spi_master_get_devdata (master); +platform_set_drvdata (pdev, host); + sspi =spi_controller_get_devdata (host); sspi->base_addr =devm_platform_ioremap_resource (pdev,0 );if (IS_ERR (sspi->base_addr)) { ret =PTR_ERR (sspi->base_addr); - goto err_free_master; + goto err_free_host; } irq =platform_get_irq (pdev,0 );if (irq <0 ) { ret = -ENXIO ; - goto err_free_master; + goto err_free_host; } ret =devm_request_irq (&pdev->dev, irq, sun4i_spi_handler,0 ,"sun4i-spi" , sspi);if (ret) {dev_err (&pdev->dev,"Cannot request IRQ\n" ); - goto err_free_master; + goto err_free_host; } - sspi->master = master; - master->max_speed_hz =100 *1000 *1000 ; - master->min_speed_hz =3 *1000 ; - master->set_cs = sun4i_spi_set_cs; - master->transfer_one = sun4i_spi_transfer_one; - master->num_chipselect =4 ; - master->mode_bits =SPI_CPOL |SPI_CPHA |SPI_CS_HIGH |SPI_LSB_FIRST ; - master->bits_per_word_mask =SPI_BPW_MASK (8 ); - master->dev.of_node = pdev->dev.of_node; - master->auto_runtime_pm = true; - master->max_transfer_size = sun4i_spi_max_transfer_size; + sspi->host = host; + host->max_speed_hz =100 *1000 *1000 ; + host->min_speed_hz =3 *1000 ; + host->set_cs = sun4i_spi_set_cs; + host->transfer_one = sun4i_spi_transfer_one; + host->num_chipselect =4 ; + host->mode_bits =SPI_CPOL |SPI_CPHA |SPI_CS_HIGH |SPI_LSB_FIRST ; + host->bits_per_word_mask =SPI_BPW_MASK (8 ); + host->dev.of_node = pdev->dev.of_node; + host->auto_runtime_pm = true; + host->max_transfer_size = sun4i_spi_max_transfer_size; sspi->hclk =devm_clk_get (&pdev->dev,"ahb" );if (IS_ERR (sspi->hclk)) {dev_err (&pdev->dev,"Unable to acquire AHB clock\n" ); ret =PTR_ERR (sspi->hclk); - goto err_free_master; + goto err_free_host; } sspi->mclk =devm_clk_get (&pdev->dev,"mod" );if (IS_ERR (sspi->mclk)) {dev_err (&pdev->dev,"Unable to acquire module clock\n" ); ret =PTR_ERR (sspi->mclk); - goto err_free_master; + goto err_free_host; }init_completion (&sspi->done);
@@ -496,16 +496,16 @@ static int sun4i_spi_probe(struct platfo ret =sun4i_spi_runtime_resume (&pdev->dev);if (ret) {dev_err (&pdev->dev,"Couldn't resume the device\n" ); - goto err_free_master; + goto err_free_host; }pm_runtime_set_active (&pdev->dev);pm_runtime_enable (&pdev->dev);pm_runtime_idle (&pdev->dev); - ret =devm_spi_register_master (&pdev->dev, master); + ret =devm_spi_register_controller (&pdev->dev, host);if (ret) { -dev_err (&pdev->dev,"cannot register SPI master\n" ); +dev_err (&pdev->dev,"cannot register SPI host\n" ); goto err_pm_disable; }
@@ -514,8 +514,8 @@ static int sun4i_spi_probe(struct platfo err_pm_disable:pm_runtime_disable (&pdev->dev);sun4i_spi_runtime_suspend (&pdev->dev); -err_free_master: -spi_master_put (master); +err_free_host: +spi_controller_put (host);return ret; }
Greg Kroah-Hartman
maintainerPATCH 426/474 spi: sun4i: fix controller deregistration
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
[ Upstream commit 42108a2f03e0fdeabe9d02d085bdb058baa1189f ]
Make sure to deregister the controller before disabling underlying resources like clocks during driver unbind.
--- drivers/spi/spi-sun4i.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/spi/spi-sun4i.c +9 -1
@@ -503,7 +503,7 @@ static int sun4i_spi_probe(struct platfopm_runtime_enable (&pdev->dev);pm_runtime_idle (&pdev->dev); - ret =devm_spi_register_controller (&pdev->dev, host); + ret =spi_register_controller (host);if (ret) {dev_err (&pdev->dev,"cannot register SPI host\n" ); goto err_pm_disable;
@@ -521,7 +521,15 @@ err_free_host:static void sun4i_spi_remove (struct platform_device *pdev) { +struct spi_controller *host =platform_get_drvdata (pdev); + +spi_controller_get (host); + +spi_unregister_controller (host); +pm_runtime_force_suspend (&pdev->dev); + +spi_controller_put (host); }static const struct of_device_id sun4i_spi_match[] = {
Greg Kroah-Hartman
maintainerPATCH 427/474 spi: spi-ti-qspi: Convert to platform remove callback returning void
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Uwe Kleine-König <[email protected]>
[ Upstream commit 2f2802d1a59d79a3d00cb429841db502c2bbc3df ]
The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new(), which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove().
Add an error message to the error path that returned an error before to replace the core's error message with more information. Apart from the different wording of the error message, this patch doesn't introduce a semantic difference.
Stable-dep-of: 0c18a1bacbb1 ("spi: ti-qspi: fix controller deregistration")
--- drivers/spi/spi-ti-qspi.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/spi/spi-ti-qspi.c +7 -6
@@ -907,21 +907,22 @@ free_master:return ret; } -static int ti_qspi_remove (struct platform_device *pdev) +static void ti_qspi_remove (struct platform_device *pdev) {struct ti_qspi *qspi =platform_get_drvdata (pdev);int rc; rc =spi_master_suspend (qspi->master); -if (rc) -return rc; +if (rc) { +dev_alert (&pdev->dev,"spi_master_suspend() failed (%pe)\n" , +ERR_PTR (rc)); +return ; + }pm_runtime_put_sync (&pdev->dev);pm_runtime_disable (&pdev->dev);ti_qspi_dma_cleanup (qspi); - -return 0 ; }static const struct dev_pm_ops ti_qspi_pm_ops = {
@@ -930,7 +931,7 @@ static const struct dev_pm_ops ti_qspi_pstatic struct platform_driver ti_qspi_driver = { .probe = ti_qspi_probe, - .remove = ti_qspi_remove, + .remove_new = ti_qspi_remove, .driver = { .name ="ti-qspi" , .pm = &ti_qspi_pm_ops,
Greg Kroah-Hartman
maintainerPATCH 428/474 spi: spi-ti-qspi: switch to use modern name
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yang Yingliang <[email protected]>
[ Upstream commit 9d93c8d97b4cdb5edddb4c5530881c90eecb7e44 ]
Change legacy name master to modern name host or controller.
No functional changed.
Stable-dep-of: 0c18a1bacbb1 ("spi: ti-qspi: fix controller deregistration")
--- drivers/spi/spi-ti-qspi.c | 88 +++++++++++++++++++++++----------------------- 1 file changed, 44 insertions(+), 44 deletions(-)
drivers/spi/spi-ti-qspi.c +44 -44
@@ -40,7 +40,7 @@ struct ti_qspi {/* list synchronization */ struct mutex list_lock; -struct spi_master *master; +struct spi_controller *host;void __iomem *base;void __iomem *mmap_base;size_t mmap_size;
@@ -137,20 +137,20 @@ static inline void ti_qspi_write(structstatic int ti_qspi_setup (struct spi_device *spi) { -struct ti_qspi *qspi =spi_master_get_devdata (spi->master); +struct ti_qspi *qspi =spi_controller_get_devdata (spi->controller);int ret; -if (spi->master->busy) { -dev_dbg (qspi->dev,"master busy doing other transfers\n" ); +if (spi->controller->busy) { +dev_dbg (qspi->dev,"host busy doing other transfers\n" );return -EBUSY ; } -if (!qspi->master->max_speed_hz) { +if (!qspi->host->max_speed_hz) {dev_err (qspi->dev,"spi max frequency not defined\n" );return -EINVAL ; } - spi->max_speed_hz =min (spi->max_speed_hz, qspi->master->max_speed_hz); + spi->max_speed_hz =min (spi->max_speed_hz, qspi->host->max_speed_hz); ret =pm_runtime_resume_and_get (qspi->dev);if (ret <0 ) {
@@ -526,7 +526,7 @@ static int ti_qspi_dma_xfer_sg(struct tistatic void ti_qspi_enable_memory_map (struct spi_device *spi) { -struct ti_qspi *qspi =spi_master_get_devdata (spi->master); +struct ti_qspi *qspi =spi_controller_get_devdata (spi->controller);ti_qspi_write (qspi,MM_SWITCH ,QSPI_SPI_SWITCH_REG );if (qspi->ctrl_base) {
@@ -540,7 +540,7 @@ static void ti_qspi_enable_memory_map(ststatic void ti_qspi_disable_memory_map (struct spi_device *spi) { -struct ti_qspi *qspi =spi_master_get_devdata (spi->master); +struct ti_qspi *qspi =spi_controller_get_devdata (spi->controller);ti_qspi_write (qspi,0 ,QSPI_SPI_SWITCH_REG );if (qspi->ctrl_base)
@@ -554,7 +554,7 @@ static void ti_qspi_setup_mmap_read(stru u8 data_nbits, u8 addr_width, u8 dummy_bytes) { - struct ti_qspi *qspi = spi_master_get_devdata(spi->master); + struct ti_qspi *qspi = spi_controller_get_devdata(spi->controller);u32 memval = opcode;switch (data_nbits) {
@@ -576,7 +576,7 @@ static void ti_qspi_setup_mmap_read(strustatic int ti_qspi_adjust_op_size (struct spi_mem *mem,struct spi_mem_op *op) { -struct ti_qspi *qspi =spi_controller_get_devdata (mem->spi->master); +struct ti_qspi *qspi =spi_controller_get_devdata (mem->spi->controller);size_t max_len;if (op->data.dir ==SPI_MEM_DATA_IN ) {
@@ -606,7 +606,7 @@ static int ti_qspi_adjust_op_size(structstatic int ti_qspi_exec_mem_op (struct spi_mem *mem,const struct spi_mem_op *op) { -struct ti_qspi *qspi =spi_master_get_devdata (mem->spi->master); +struct ti_qspi *qspi =spi_controller_get_devdata (mem->spi->controller);u32 from =0 ;int ret =0 ;
@@ -633,10 +633,10 @@ static int ti_qspi_exec_mem_op(struct spstruct sg_table sgt;if (virt_addr_valid (op->data.buf.in) && - !spi_controller_dma_map_mem_op_data (mem->spi->master, op, + !spi_controller_dma_map_mem_op_data (mem->spi->controller, op, &sgt)) { ret =ti_qspi_dma_xfer_sg (qspi, sgt, from); -spi_controller_dma_unmap_mem_op_data (mem->spi->master, +spi_controller_dma_unmap_mem_op_data (mem->spi->controller, op, &sgt); }else { ret = ti_qspi_dma_bounce_buffer(qspi, from,
@@ -658,10 +658,10 @@ static const struct spi_controller_mem_o .adjust_op_size = ti_qspi_adjust_op_size, }; -static int ti_qspi_start_transfer_one (struct spi_master *master, +static int ti_qspi_start_transfer_one (struct spi_controller *host,struct spi_message *m) { -struct ti_qspi *qspi =spi_master_get_devdata (master); +struct ti_qspi *qspi =spi_controller_get_devdata (host);struct spi_device *spi = m->spi;struct spi_transfer *t;int status =0 , ret;
@@ -720,7 +720,7 @@ static int ti_qspi_start_transfer_one(stti_qspi_write (qspi, qspi->cmd |QSPI_INVAL ,QSPI_SPI_CMD_REG ); m->status = status; -spi_finalize_current_message (master); +spi_finalize_current_message (host);return status; }
@@ -756,33 +756,33 @@ MODULE_DEVICE_TABLE(of, ti_qspi_match);static int ti_qspi_probe (struct platform_device *pdev) {struct ti_qspi *qspi; -struct spi_master *master; +struct spi_controller *host;struct resource *r, *res_mmap;struct device_node *np = pdev->dev.of_node;u32 max_freq;int ret =0 , num_cs, irq;dma_cap_mask_t mask; - master =spi_alloc_master (&pdev->dev,sizeof (*qspi)); -if (!master) + host =spi_alloc_host (&pdev->dev,sizeof (*qspi)); +if (!host)return -ENOMEM ; - master->mode_bits =SPI_CPOL |SPI_CPHA |SPI_RX_DUAL |SPI_RX_QUAD ; + host->mode_bits =SPI_CPOL |SPI_CPHA |SPI_RX_DUAL |SPI_RX_QUAD ; - master->flags =SPI_CONTROLLER_HALF_DUPLEX ; - master->setup = ti_qspi_setup; - master->auto_runtime_pm = true; - master->transfer_one_message = ti_qspi_start_transfer_one; - master->dev.of_node = pdev->dev.of_node; - master->bits_per_word_mask =SPI_BPW_MASK (32 ) |SPI_BPW_MASK (16 ) | -SPI_BPW_MASK (8 ); - master->mem_ops = &ti_qspi_mem_ops; + host->flags =SPI_CONTROLLER_HALF_DUPLEX ; + host->setup = ti_qspi_setup; + host->auto_runtime_pm = true; + host->transfer_one_message = ti_qspi_start_transfer_one; + host->dev.of_node = pdev->dev.of_node; + host->bits_per_word_mask =SPI_BPW_MASK (32 ) |SPI_BPW_MASK (16 ) | +SPI_BPW_MASK (8 ); + host->mem_ops = &ti_qspi_mem_ops;if (!of_property_read_u32 (np,"num-cs" , &num_cs)) - master->num_chipselect = num_cs; + host->num_chipselect = num_cs; - qspi =spi_master_get_devdata (master); - qspi->master = master; + qspi =spi_controller_get_devdata (host); + qspi->host = host; qspi->dev = &pdev->dev;platform_set_drvdata (pdev, qspi);
@@ -792,7 +792,7 @@ static int ti_qspi_probe(struct platformif (r ==NULL ) {dev_err (&pdev->dev,"missing platform data\n" ); ret = -ENODEV ; - goto free_master; + goto free_host; } }
@@ -812,7 +812,7 @@ static int ti_qspi_probe(struct platform irq =platform_get_irq (pdev,0 );if (irq <0 ) { ret = irq; - goto free_master; + goto free_host; }mutex_init (&qspi->list_lock);
@@ -820,7 +820,7 @@ static int ti_qspi_probe(struct platform qspi->base =devm_ioremap_resource (&pdev->dev, r);if (IS_ERR (qspi->base)) { ret =PTR_ERR (qspi->base); - goto free_master; + goto free_host; }
@@ -830,7 +830,7 @@ static int ti_qspi_probe(struct platform "syscon-chipselects");if (IS_ERR (qspi->ctrl_base)) { ret =PTR_ERR (qspi->ctrl_base); - goto free_master; + goto free_host; } ret = of_property_read_u32_index(np, "syscon-chipselects",
@@ -838,7 +838,7 @@ static int ti_qspi_probe(struct platformif (ret) {dev_err (&pdev->dev,"couldn't get ctrl_mod reg index\n" ); - goto free_master; + goto free_host; } }
@@ -853,7 +853,7 @@ static int ti_qspi_probe(struct platformpm_runtime_enable (&pdev->dev);if (!of_property_read_u32 (np,"spi-max-frequency" , &max_freq)) - master->max_speed_hz = max_freq; + host->max_speed_hz = max_freq;dma_cap_zero (mask);dma_cap_set (DMA_MEMCPY , mask);
@@ -876,7 +876,7 @@ static int ti_qspi_probe(struct platformdma_release_channel (qspi->rx_chan); goto no_dma; } - master->dma_rx = qspi->rx_chan; + host->dma_rx = qspi->rx_chan;init_completion (&qspi->transfer_complete);if (res_mmap) qspi->mmap_phys_base = (dma_addr_t )res_mmap->start;
@@ -889,21 +889,21 @@ no_dma:"mmap failed with error %ld using PIO mode\n" , PTR_ERR(qspi->mmap_base)); qspi->mmap_base =NULL ; - master->mem_ops =NULL ; + host->mem_ops =NULL ; } } qspi->mmap_enabled = false; qspi->current_cs =-1 ; - ret =devm_spi_register_master (&pdev->dev, master); + ret =devm_spi_register_controller (&pdev->dev, host);if (!ret)return 0 ;ti_qspi_dma_cleanup (qspi);pm_runtime_disable (&pdev->dev); -free_master: -spi_master_put (master); +free_host: +spi_controller_put (host);return ret; }
@@ -912,9 +912,9 @@ static void ti_qspi_remove(struct platfostruct ti_qspi *qspi =platform_get_drvdata (pdev);int rc; - rc =spi_master_suspend (qspi->master); + rc =spi_controller_suspend (qspi->host);if (rc) { -dev_alert (&pdev->dev,"spi_master_suspend() failed (%pe)\n" , +dev_alert (&pdev->dev,"spi_controller_suspend() failed (%pe)\n" ,ERR_PTR (rc));return ; }
Greg Kroah-Hartman
maintainerPATCH 429/474 spi: ti-qspi: fix controller deregistration
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
[ Upstream commit 0c18a1bacbb1d8b8aa34d3d004a2cb8226c8b1ea ]
Make sure to deregister the controller before disabling underlying resources like clocks during driver unbind.
Note that the controller is suspended before disabling and releasing resources since commit 3ac066e2227c ("spi: spi-ti-qspi: Suspend the queue before removing the device") which avoids issues like unclocked accesses but prevents SPI device drivers from doing I/O during deregistration.
--- drivers/spi/spi-ti-qspi.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
drivers/spi/spi-ti-qspi.c +6 -8
@@ -895,7 +895,7 @@ no_dma: qspi->mmap_enabled = false; qspi->current_cs =-1 ; - ret =devm_spi_register_controller (&pdev->dev, host); + ret =spi_register_controller (host);if (!ret)return 0 ;
@@ -910,19 +910,17 @@ free_host:static void ti_qspi_remove (struct platform_device *pdev) {struct ti_qspi *qspi =platform_get_drvdata (pdev); -int rc; - rc =spi_controller_suspend (qspi->host); -if (rc) { -dev_alert (&pdev->dev,"spi_controller_suspend() failed (%pe)\n" , -ERR_PTR (rc)); -return ; - } +spi_controller_get (qspi->host); + +spi_unregister_controller (qspi->host);pm_runtime_put_sync (&pdev->dev);pm_runtime_disable (&pdev->dev);ti_qspi_dma_cleanup (qspi); + +spi_controller_put (qspi->host); }static const struct dev_pm_ops ti_qspi_pm_ops = {
Greg Kroah-Hartman
maintainerPATCH 430/474 spi: zynq-qspi: switch to use modern name
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yang Yingliang <[email protected]>
[ Upstream commit 178ebb0c505b0a35edb4fb2a0e23a1f29e1db14d ]
Change legacy name master/slave to modern name host/target or controller.
No functional changed.
Stable-dep-of: c9c012706c9f ("spi: zynq-qspi: fix controller deregistration")
--- drivers/spi/spi-zynq-qspi.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-)
drivers/spi/spi-zynq-qspi.c +14 -14
@@ -54,10 +54,10 @@#define ZYNQ_QSPI_CONFIG_MSTREN_MASK BIT(0)/* Master Mode */ /* -* QSPI Configuration Register - Baud rate and slave select +* QSPI Configuration Register - Baud rate and target select * * These are the values used in the calculation of baud rate divisor and -* setting the slave select. +* setting the target select. */ #define ZYNQ_QSPI_CONFIG_BAUD_DIV_MAX GENMASK(2, 0)/* Baud rate maximum */ #define ZYNQ_QSPI_CONFIG_BAUD_DIV_SHIFT 3/* Baud rate divisor shift */
@@ -164,14 +164,14 @@ static inline void zynq_qspi_write(struc* * The default settings of the QSPI controller's configurable parameters on * reset are -* - Master mode +* - Host mode * - Baud rate divisor is set to 2 * - Tx threshold set to 1l Rx threshold set to 32 * - Flash memory interface mode enabled * - Size of the word to be transferred as 8 bit * This function performs the following actions * - Disable and clear all the interrupts -* - Enable manual slave select +* - Enable manual target select * - Enable manual start * - Deselect all the chip select lines * - Set the size of the word to be transferred as 32 bit
@@ -289,7 +289,7 @@ static void zynq_qspi_txfifo_op(struct z*/ static void zynq_qspi_chipselect (struct spi_device *spi,bool assert) { -struct spi_controller *ctlr = spi->master; +struct spi_controller *ctlr = spi->controller;struct zynq_qspi *xqspi =spi_controller_get_devdata (ctlr);u32 config_reg;
@@ -377,7 +377,7 @@ static int zynq_qspi_config_op(struct zy*/ static int zynq_qspi_setup_op (struct spi_device *spi) { -struct spi_controller *ctlr = spi->master; +struct spi_controller *ctlr = spi->controller;struct zynq_qspi *qspi =spi_controller_get_devdata (ctlr);int ret;
@@ -534,7 +534,7 @@ static irqreturn_t zynq_qspi_irq(int irqstatic int zynq_qspi_exec_mem_op (struct spi_mem *mem,const struct spi_mem_op *op) { -struct zynq_qspi *xqspi =spi_controller_get_devdata (mem->spi->master); +struct zynq_qspi *xqspi =spi_controller_get_devdata (mem->spi->controller);int err =0 , i;u8 *tmpbuf;
@@ -646,7 +646,7 @@ static int zynq_qspi_probe(struct platfostruct zynq_qspi *xqspi;u32 num_cs; - ctlr =spi_alloc_master (&pdev->dev,sizeof (*xqspi)); + ctlr =spi_alloc_host (&pdev->dev,sizeof (*xqspi));if (!ctlr)return -ENOMEM ;
@@ -656,14 +656,14 @@ static int zynq_qspi_probe(struct platfo xqspi->regs =devm_platform_ioremap_resource (pdev,0 );if (IS_ERR (xqspi->regs)) { ret =PTR_ERR (xqspi->regs); - goto remove_master; + goto remove_ctlr; } xqspi->pclk =devm_clk_get (&pdev->dev,"pclk" );if (IS_ERR (xqspi->pclk)) {dev_err (&pdev->dev,"pclk clock not found.\n" ); ret =PTR_ERR (xqspi->pclk); - goto remove_master; + goto remove_ctlr; }init_completion (&xqspi->data_completion);
@@ -672,13 +672,13 @@ static int zynq_qspi_probe(struct platfoif (IS_ERR (xqspi->refclk)) {dev_err (&pdev->dev,"ref_clk clock not found.\n" ); ret =PTR_ERR (xqspi->refclk); - goto remove_master; + goto remove_ctlr; } ret =clk_prepare_enable (xqspi->pclk);if (ret) {dev_err (&pdev->dev,"Unable to enable APB clock.\n" ); - goto remove_master; + goto remove_ctlr; } ret =clk_prepare_enable (xqspi->refclk);
@@ -724,7 +724,7 @@ static int zynq_qspi_probe(struct platfo ret =devm_spi_register_controller (&pdev->dev, ctlr);if (ret) { -dev_err (&pdev->dev,"spi_register_master failed\n" ); +dev_err (&pdev->dev,"devm_spi_register_controller failed\n" ); goto clk_dis_all; }
@@ -734,7 +734,7 @@ clk_dis_all:clk_disable_unprepare (xqspi->refclk); clk_dis_pclk:clk_disable_unprepare (xqspi->pclk); -remove_master: +remove_ctlr:spi_controller_put (ctlr);return ret;
Greg Kroah-Hartman
maintainerPATCH 431/474 spi: zynq-qspi: Simplify clock handling with devm_clk_get_enabled()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pei Xiao <[email protected]>
[ Upstream commit 1f8fd9490e3184e9a2394df2e682901a1d57ce71 ]
Replace devm_clk_get() followed by clk_prepare_enable() with devm_clk_get_enabled() for both "pclk" and "ref_clk". This removes the need for explicit clock enable and disable calls, as the managed API automatically disables the clocks on device removal or probe failure.
Remove the now-unnecessary clk_disable_unprepare() calls from the probe error paths and the remove callback. Simplify error handling by jumping directly to the remove_ctlr label.
Stable-dep-of: c9c012706c9f ("spi: zynq-qspi: fix controller deregistration")
--- drivers/spi/spi-zynq-qspi.c | 42 ++++++------------------------------------ 1 file changed, 6 insertions(+), 36 deletions(-)
drivers/spi/spi-zynq-qspi.c +6 -36
@@ -379,21 +379,10 @@ static int zynq_qspi_setup_op(struct spi {struct spi_controller *ctlr = spi->controller;struct zynq_qspi *qspi =spi_controller_get_devdata (ctlr); -int ret;if (ctlr->busy)return -EBUSY ; - ret =clk_enable (qspi->refclk); -if (ret) -return ret; - - ret =clk_enable (qspi->pclk); -if (ret) { -clk_disable (qspi->refclk); -return ret; - } -zynq_qspi_write (qspi,ZYNQ_QSPI_ENABLE_OFFSET ,ZYNQ_QSPI_ENABLE_ENABLE_MASK );
@@ -659,7 +648,7 @@ static int zynq_qspi_probe(struct platfo goto remove_ctlr; } - xqspi->pclk =devm_clk_get (&pdev->dev,"pclk" ); + xqspi->pclk =devm_clk_get_enabled (&pdev->dev,"pclk" );if (IS_ERR (xqspi->pclk)) {dev_err (&pdev->dev,"pclk clock not found.\n" ); ret =PTR_ERR (xqspi->pclk);
@@ -668,36 +657,24 @@ static int zynq_qspi_probe(struct platfoinit_completion (&xqspi->data_completion); - xqspi->refclk =devm_clk_get (&pdev->dev,"ref_clk" ); + xqspi->refclk =devm_clk_get_enabled (&pdev->dev,"ref_clk" );if (IS_ERR (xqspi->refclk)) {dev_err (&pdev->dev,"ref_clk clock not found.\n" ); ret =PTR_ERR (xqspi->refclk); goto remove_ctlr; } - ret =clk_prepare_enable (xqspi->pclk); -if (ret) { -dev_err (&pdev->dev,"Unable to enable APB clock.\n" ); - goto remove_ctlr; - } - - ret =clk_prepare_enable (xqspi->refclk); -if (ret) { -dev_err (&pdev->dev,"Unable to enable device clock.\n" ); - goto clk_dis_pclk; - } - xqspi->irq =platform_get_irq (pdev,0 );if (xqspi->irq <0 ) { ret = xqspi->irq; - goto clk_dis_all; + goto remove_ctlr; } ret =devm_request_irq (&pdev->dev, xqspi->irq, zynq_qspi_irq,0 , pdev->name, xqspi);if (ret !=0 ) { ret = -ENXIO ;dev_err (&pdev->dev,"request_irq failed\n" ); - goto clk_dis_all; + goto remove_ctlr; } ret = of_property_read_u32(np, "num-cs",
@@ -707,7 +684,7 @@ static int zynq_qspi_probe(struct platfo }else if (num_cs >ZYNQ_QSPI_MAX_NUM_CS ) { ret = -EINVAL ;dev_err (&pdev->dev,"only 2 chip selects are available\n" ); - goto clk_dis_all; + goto remove_ctlr; }else { ctlr->num_chipselect = num_cs; }
@@ -725,15 +702,11 @@ static int zynq_qspi_probe(struct platfo ret =devm_spi_register_controller (&pdev->dev, ctlr);if (ret) {dev_err (&pdev->dev,"devm_spi_register_controller failed\n" ); - goto clk_dis_all; + goto remove_ctlr; }return ret; -clk_dis_all: -clk_disable_unprepare (xqspi->refclk); -clk_dis_pclk: -clk_disable_unprepare (xqspi->pclk); remove_ctlr:spi_controller_put (ctlr);
@@ -755,9 +728,6 @@ static void zynq_qspi_remove(struct platstruct zynq_qspi *xqspi =platform_get_drvdata (pdev);zynq_qspi_write (xqspi,ZYNQ_QSPI_ENABLE_OFFSET ,0 ); - -clk_disable_unprepare (xqspi->refclk); -clk_disable_unprepare (xqspi->pclk); }static const struct of_device_id zynq_qspi_of_match[] = {
Greg Kroah-Hartman
maintainerPATCH 432/474 spi: zynq-qspi: fix controller deregistration
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
[ Upstream commit c9c012706c9fa8ca6d129a9161caf92ab625a3fd ]
Make sure to deregister the controller before disabling it during driver unbind.
Note that clocks were also disabled before the recent commit 1f8fd9490e31 ("spi: zynq-qspi: Simplify clock handling with devm_clk_get_enabled()").
--- drivers/spi/spi-zynq-qspi.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/spi/spi-zynq-qspi.c +11 -4
@@ -641,7 +641,7 @@ static int zynq_qspi_probe(struct platfo xqspi =spi_controller_get_devdata (ctlr); xqspi->dev = dev; -platform_set_drvdata (pdev, xqspi); +platform_set_drvdata (pdev, ctlr); xqspi->regs =devm_platform_ioremap_resource (pdev,0 );if (IS_ERR (xqspi->regs)) { ret =PTR_ERR (xqspi->regs);
@@ -699,9 +699,9 @@ static int zynq_qspi_probe(struct platfo/* QSPI controller initializations */ zynq_qspi_init_hw (xqspi, ctlr->num_chipselect); - ret =devm_spi_register_controller (&pdev->dev, ctlr); + ret =spi_register_controller (ctlr);if (ret) { -dev_err (&pdev->dev,"devm_spi_register_controller failed\n" ); +dev_err (&pdev->dev,"failed to register controller\n" ); goto remove_ctlr; }
@@ -725,9 +725,16 @@ remove_ctlr:*/ static void zynq_qspi_remove (struct platform_device *pdev) { -struct zynq_qspi *xqspi =platform_get_drvdata (pdev); +struct spi_controller *ctlr =platform_get_drvdata (pdev); +struct zynq_qspi *xqspi =spi_controller_get_devdata (ctlr); + +spi_controller_get (ctlr); + +spi_unregister_controller (ctlr);zynq_qspi_write (xqspi,ZYNQ_QSPI_ENABLE_OFFSET ,0 ); + +spi_controller_put (ctlr); }static const struct of_device_id zynq_qspi_of_match[] = {
Greg Kroah-Hartman
maintainerPATCH 433/474 spi: sun6i: switch to use modern name
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yang Yingliang <[email protected]>
[ Upstream commit 9f55bb79893a9dc75982372bee1307bdce48976b ]
Change legacy name master to modern name host or controller.
No functional changed.
Stable-dep-of: d874a1c33aee ("spi: sun6i: fix controller deregistration")
--- drivers/spi/spi-sun6i.c | 148 ++++++++++++++++++++++++------------------------ 1 file changed, 74 insertions(+), 74 deletions(-)
drivers/spi/spi-sun6i.c +74 -74
@@ -97,7 +97,7 @@ struct sun6i_spi_cfg { };struct sun6i_spi { -struct spi_master *master; +struct spi_controller *host;void __iomem *base_addr;dma_addr_t dma_addr_rx;dma_addr_t dma_addr_tx;
@@ -181,7 +181,7 @@ static inline void sun6i_spi_fill_fifo(sstatic void sun6i_spi_set_cs (struct spi_device *spi,bool enable) { -struct sun6i_spi *sspi =spi_master_get_devdata (spi->master); +struct sun6i_spi *sspi =spi_controller_get_devdata (spi->controller);u32 reg; reg =sun6i_spi_read (sspi,SUN6I_TFR_CTL_REG );
@@ -212,7 +212,7 @@ static int sun6i_spi_prepare_dma(struct struct spi_transfer *tfr) {struct dma_async_tx_descriptor *rxdesc, *txdesc; -struct spi_master *master = sspi->master; +struct spi_controller *host = sspi->host; rxdesc =NULL ;if (tfr->rx_buf) {
@@ -223,9 +223,9 @@ static int sun6i_spi_prepare_dma(struct .src_maxburst = 8, }; -dmaengine_slave_config (master->dma_rx, &rxconf); +dmaengine_slave_config (host->dma_rx, &rxconf); - rxdesc = dmaengine_prep_slave_sg(master->dma_rx, + rxdesc = dmaengine_prep_slave_sg(host->dma_rx, tfr->rx_sg.sgl, tfr->rx_sg.nents, DMA_DEV_TO_MEM,
@@ -245,38 +245,38 @@ static int sun6i_spi_prepare_dma(struct .dst_maxburst = 8, }; -dmaengine_slave_config (master->dma_tx, &txconf); +dmaengine_slave_config (host->dma_tx, &txconf); - txdesc =dmaengine_prep_slave_sg (master->dma_tx, + txdesc =dmaengine_prep_slave_sg (host->dma_tx, tfr->tx_sg.sgl, tfr->tx_sg.nents,DMA_MEM_TO_DEV ,DMA_PREP_INTERRUPT );if (!txdesc) {if (rxdesc) -dmaengine_terminate_sync (master->dma_rx); +dmaengine_terminate_sync (host->dma_rx);return -EINVAL ; } }if (tfr->rx_buf) {dmaengine_submit (rxdesc); -dma_async_issue_pending (master->dma_rx); +dma_async_issue_pending (host->dma_rx); }if (tfr->tx_buf) {dmaengine_submit (txdesc); -dma_async_issue_pending (master->dma_tx); +dma_async_issue_pending (host->dma_tx); }return 0 ; } -static int sun6i_spi_transfer_one (struct spi_master *master, +static int sun6i_spi_transfer_one (struct spi_controller *host,struct spi_device *spi,struct spi_transfer *tfr) { -struct sun6i_spi *sspi =spi_master_get_devdata (master); +struct sun6i_spi *sspi =spi_controller_get_devdata (host);unsigned int div, div_cdr1, div_cdr2, timeout;unsigned int start, end, tx_time;unsigned int trig_level;
@@ -293,7 +293,7 @@ static int sun6i_spi_transfer_one(struct sspi->tx_buf = tfr->tx_buf; sspi->rx_buf = tfr->rx_buf; sspi->len = tfr->len; - use_dma = master->can_dma ? master->can_dma (master, spi, tfr) : false; + use_dma = host->can_dma ? host->can_dma (host, spi, tfr) : false;/* Clear pending interrupts */ sun6i_spi_write (sspi,SUN6I_INT_STA_REG , ~0 );
@@ -463,7 +463,7 @@ static int sun6i_spi_transfer_one(struct }else { ret =sun6i_spi_prepare_dma (sspi, tfr);if (ret) { -dev_warn (&master->dev, +dev_warn (&host->dev,"%s: prepare DMA failed, ret=%d" ,dev_name (&spi->dev), ret);return ret;
@@ -486,7 +486,7 @@ static int sun6i_spi_transfer_one(struct reg =sun6i_spi_read (sspi,SUN6I_TFR_CTL_REG );sun6i_spi_write (sspi,SUN6I_TFR_CTL_REG , reg |SUN6I_TFR_CTL_XCH ); - tx_time =spi_controller_xfer_timeout (master, tfr); + tx_time =spi_controller_xfer_timeout (host, tfr); start = jiffies; timeout =wait_for_completion_timeout (&sspi->done,msecs_to_jiffies (tx_time));
@@ -502,13 +502,13 @@ static int sun6i_spi_transfer_one(struct timeout =wait_for_completion_timeout (&sspi->dma_rx_done, timeout);if (!timeout) -dev_warn (&master->dev,"RX DMA timeout\n" ); +dev_warn (&host->dev,"RX DMA timeout\n" ); } } end = jiffies;if (!timeout) { -dev_warn (&master->dev, +dev_warn (&host->dev,"%s: timeout transferring %u bytes@%iHz for %i(%i)ms" ,dev_name (&spi->dev), tfr->len, tfr->speed_hz,jiffies_to_msecs (end - start), tx_time);
@@ -518,8 +518,8 @@ static int sun6i_spi_transfer_one(structsun6i_spi_write (sspi,SUN6I_INT_CTL_REG ,0 );if (ret && use_dma) { -dmaengine_terminate_sync (master->dma_rx); -dmaengine_terminate_sync (master->dma_tx); +dmaengine_terminate_sync (host->dma_rx); +dmaengine_terminate_sync (host->dma_tx); }return ret;
@@ -564,8 +564,8 @@ static irqreturn_t sun6i_spi_handler(intstatic int sun6i_spi_runtime_resume (struct device *dev) { -struct spi_master *master =dev_get_drvdata (dev); -struct sun6i_spi *sspi =spi_master_get_devdata (master); +struct spi_controller *host =dev_get_drvdata (dev); +struct sun6i_spi *sspi =spi_controller_get_devdata (host);int ret; ret =clk_prepare_enable (sspi->hclk);
@@ -601,8 +601,8 @@ out:static int sun6i_spi_runtime_suspend (struct device *dev) { -struct spi_master *master =dev_get_drvdata (dev); -struct sun6i_spi *sspi =spi_master_get_devdata (master); +struct spi_controller *host =dev_get_drvdata (dev); +struct sun6i_spi *sspi =spi_controller_get_devdata (host);reset_control_assert (sspi->rstc);clk_disable_unprepare (sspi->mclk);
@@ -611,11 +611,11 @@ static int sun6i_spi_runtime_suspend(strreturn 0 ; } -static bool sun6i_spi_can_dma (struct spi_master *master, +static bool sun6i_spi_can_dma (struct spi_controller *host,struct spi_device *spi,struct spi_transfer *xfer) { -struct sun6i_spi *sspi =spi_master_get_devdata (master); +struct sun6i_spi *sspi =spi_controller_get_devdata (host);/* * If the number of spi words to transfer is less or equal than
@@ -627,67 +627,67 @@ static bool sun6i_spi_can_dma(struct spistatic int sun6i_spi_probe (struct platform_device *pdev) { -struct spi_master *master; +struct spi_controller *host;struct sun6i_spi *sspi;struct resource *mem;int ret =0 , irq; - master =spi_alloc_master (&pdev->dev,sizeof (struct sun6i_spi )); -if (!master) { -dev_err (&pdev->dev,"Unable to allocate SPI Master\n" ); + host =spi_alloc_host (&pdev->dev,sizeof (struct sun6i_spi )); +if (!host) { +dev_err (&pdev->dev,"Unable to allocate SPI Host\n" );return -ENOMEM ; } -platform_set_drvdata (pdev, master); - sspi =spi_master_get_devdata (master); +platform_set_drvdata (pdev, host); + sspi =spi_controller_get_devdata (host); sspi->base_addr =devm_platform_get_and_ioremap_resource (pdev,0 , &mem);if (IS_ERR (sspi->base_addr)) { ret =PTR_ERR (sspi->base_addr); - goto err_free_master; + goto err_free_host; } irq =platform_get_irq (pdev,0 );if (irq <0 ) { ret = -ENXIO ; - goto err_free_master; + goto err_free_host; } ret =devm_request_irq (&pdev->dev, irq, sun6i_spi_handler,0 ,"sun6i-spi" , sspi);if (ret) {dev_err (&pdev->dev,"Cannot request IRQ\n" ); - goto err_free_master; + goto err_free_host; } - sspi->master = master; + sspi->host = host; sspi->cfg =of_device_get_match_data (&pdev->dev); - master->max_speed_hz =100 *1000 *1000 ; - master->min_speed_hz =3 *1000 ; - master->use_gpio_descriptors = true; - master->set_cs = sun6i_spi_set_cs; - master->transfer_one = sun6i_spi_transfer_one; - master->num_chipselect =4 ; - master->mode_bits =SPI_CPOL |SPI_CPHA |SPI_CS_HIGH |SPI_LSB_FIRST | - sspi->cfg->mode_bits; - master->bits_per_word_mask =SPI_BPW_MASK (8 ); - master->dev.of_node = pdev->dev.of_node; - master->auto_runtime_pm = true; - master->max_transfer_size = sun6i_spi_max_transfer_size; + host->max_speed_hz =100 *1000 *1000 ; + host->min_speed_hz =3 *1000 ; + host->use_gpio_descriptors = true; + host->set_cs = sun6i_spi_set_cs; + host->transfer_one = sun6i_spi_transfer_one; + host->num_chipselect =4 ; + host->mode_bits =SPI_CPOL |SPI_CPHA |SPI_CS_HIGH |SPI_LSB_FIRST | + sspi->cfg->mode_bits; + host->bits_per_word_mask =SPI_BPW_MASK (8 ); + host->dev.of_node = pdev->dev.of_node; + host->auto_runtime_pm = true; + host->max_transfer_size = sun6i_spi_max_transfer_size; sspi->hclk =devm_clk_get (&pdev->dev,"ahb" );if (IS_ERR (sspi->hclk)) {dev_err (&pdev->dev,"Unable to acquire AHB clock\n" ); ret =PTR_ERR (sspi->hclk); - goto err_free_master; + goto err_free_host; } sspi->mclk =devm_clk_get (&pdev->dev,"mod" );if (IS_ERR (sspi->mclk)) {dev_err (&pdev->dev,"Unable to acquire module clock\n" ); ret =PTR_ERR (sspi->mclk); - goto err_free_master; + goto err_free_host; }init_completion (&sspi->done);
@@ -697,34 +697,34 @@ static int sun6i_spi_probe(struct platfoif (IS_ERR (sspi->rstc)) {dev_err (&pdev->dev,"Couldn't get reset controller\n" ); ret =PTR_ERR (sspi->rstc); - goto err_free_master; + goto err_free_host; } - master->dma_tx =dma_request_chan (&pdev->dev,"tx" ); -if (IS_ERR (master->dma_tx)) { + host->dma_tx =dma_request_chan (&pdev->dev,"tx" ); +if (IS_ERR (host->dma_tx)) {/* Check tx to see if we need defer probing driver */ -if (PTR_ERR (master->dma_tx) == -EPROBE_DEFER ) { +if (PTR_ERR (host->dma_tx) == -EPROBE_DEFER ) { ret = -EPROBE_DEFER ; - goto err_free_master; + goto err_free_host; }dev_warn (&pdev->dev,"Failed to request TX DMA channel\n" ); - master->dma_tx =NULL ; + host->dma_tx =NULL ; } - master->dma_rx =dma_request_chan (&pdev->dev,"rx" ); -if (IS_ERR (master->dma_rx)) { -if (PTR_ERR (master->dma_rx) == -EPROBE_DEFER ) { + host->dma_rx =dma_request_chan (&pdev->dev,"rx" ); +if (IS_ERR (host->dma_rx)) { +if (PTR_ERR (host->dma_rx) == -EPROBE_DEFER ) { ret = -EPROBE_DEFER ; goto err_free_dma_tx; }dev_warn (&pdev->dev,"Failed to request RX DMA channel\n" ); - master->dma_rx =NULL ; + host->dma_rx =NULL ; } -if (master->dma_tx && master->dma_rx) { +if (host->dma_tx && host->dma_rx) { sspi->dma_addr_tx = mem->start +SUN6I_TXDATA_REG ; sspi->dma_addr_rx = mem->start +SUN6I_RXDATA_REG ; - master->can_dma = sun6i_spi_can_dma; + host->can_dma = sun6i_spi_can_dma; }/*
@@ -742,9 +742,9 @@ static int sun6i_spi_probe(struct platfopm_runtime_set_active (&pdev->dev);pm_runtime_enable (&pdev->dev); - ret =devm_spi_register_master (&pdev->dev, master); + ret =devm_spi_register_controller (&pdev->dev, host);if (ret) { -dev_err (&pdev->dev,"cannot register SPI master\n" ); +dev_err (&pdev->dev,"cannot register SPI host\n" ); goto err_pm_disable; }
@@ -754,26 +754,26 @@ err_pm_disable:pm_runtime_disable (&pdev->dev);sun6i_spi_runtime_suspend (&pdev->dev); err_free_dma_rx: -if (master->dma_rx) -dma_release_channel (master->dma_rx); +if (host->dma_rx) +dma_release_channel (host->dma_rx); err_free_dma_tx: -if (master->dma_tx) -dma_release_channel (master->dma_tx); -err_free_master: -spi_master_put (master); +if (host->dma_tx) +dma_release_channel (host->dma_tx); +err_free_host: +spi_controller_put (host);return ret; }static void sun6i_spi_remove (struct platform_device *pdev) { -struct spi_master *master =platform_get_drvdata (pdev); +struct spi_controller *host =platform_get_drvdata (pdev);pm_runtime_force_suspend (&pdev->dev); -if (master->dma_tx) -dma_release_channel (master->dma_tx); -if (master->dma_rx) -dma_release_channel (master->dma_rx); +if (host->dma_tx) +dma_release_channel (host->dma_tx); +if (host->dma_rx) +dma_release_channel (host->dma_rx); }static const struct sun6i_spi_cfg sun6i_a31_spi_cfg = {
Greg Kroah-Hartman
maintainerPATCH 434/474 spi: sun6i: fix controller deregistration
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
[ Upstream commit d874a1c33aee0d88fb4ba2f8aeadaa9f1965209a ]
Make sure to deregister the controller before disabling underlying resources like clocks during driver unbind.
--- drivers/spi/spi-sun6i.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/spi/spi-sun6i.c +7 -1
@@ -742,7 +742,7 @@ static int sun6i_spi_probe(struct platfopm_runtime_set_active (&pdev->dev);pm_runtime_enable (&pdev->dev); - ret =devm_spi_register_controller (&pdev->dev, host); + ret =spi_register_controller (host);if (ret) {dev_err (&pdev->dev,"cannot register SPI host\n" ); goto err_pm_disable;
@@ -768,12 +768,18 @@ static void sun6i_spi_remove(struct plat {struct spi_controller *host =platform_get_drvdata (pdev); +spi_controller_get (host); + +spi_unregister_controller (host); +pm_runtime_force_suspend (&pdev->dev);if (host->dma_tx)dma_release_channel (host->dma_tx);if (host->dma_rx)dma_release_channel (host->dma_rx); + +spi_controller_put (host); }static const struct sun6i_spi_cfg sun6i_a31_spi_cfg = {
Greg Kroah-Hartman
maintainerPATCH 435/474 spi: tegra114: fix controller deregistration
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
[ Upstream commit 9c9c27ff2058142d8f800de3186d6864184958de ]
Make sure to deregister the controller before disabling underlying resources like clocks during driver unbind.
--- drivers/spi/spi-tegra114.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/spi/spi-tegra114.c +7 -1
@@ -1416,7 +1416,7 @@ static int tegra_spi_probe(struct platfo } master->dev.of_node = pdev->dev.of_node; - ret =devm_spi_register_master (&pdev->dev, master); + ret =spi_register_master (master);if (ret <0 ) {dev_err (&pdev->dev,"can not register to master err %d\n" , ret); goto exit_free_irq;
@@ -1442,6 +1442,10 @@ static void tegra_spi_remove(struct platstruct spi_master *master =platform_get_drvdata (pdev);struct tegra_spi_data *tspi =spi_master_get_devdata (master); +spi_master_get (master); + +spi_unregister_master (master); +free_irq (tspi->irq, tspi);if (tspi->tx_dma_chan)
@@ -1453,6 +1457,8 @@ static void tegra_spi_remove(struct platpm_runtime_disable (&pdev->dev);if (!pm_runtime_status_suspended (&pdev->dev))tegra_spi_runtime_suspend (&pdev->dev); + +spi_master_put (master); }#ifdef CONFIG_PM_SLEEP
Greg Kroah-Hartman
maintainerPATCH 436/474 spi: tegra20-sflash: fix controller deregistration
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
[ Upstream commit ad7310e983327f939dd6c4e801eab13238992572 ]
Make sure to deregister the controller before disabling underlying resources like clocks during driver unbind.
--- drivers/spi/spi-tegra20-sflash.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/spi/spi-tegra20-sflash.c +7 -1
@@ -506,7 +506,7 @@ static int tegra_sflash_probe(struct plapm_runtime_put (&pdev->dev); master->dev.of_node = pdev->dev.of_node; - ret =devm_spi_register_master (&pdev->dev, master); + ret =spi_register_master (master);if (ret <0 ) {dev_err (&pdev->dev,"can not register to master err %d\n" , ret); goto exit_pm_disable;
@@ -529,11 +529,17 @@ static void tegra_sflash_remove(struct pstruct spi_master *master =platform_get_drvdata (pdev);struct tegra_sflash_data *tsd =spi_master_get_devdata (master); +spi_master_get (master); + +spi_unregister_master (master); +free_irq (tsd->irq, tsd);pm_runtime_disable (&pdev->dev);if (!pm_runtime_status_suspended (&pdev->dev))tegra_sflash_runtime_suspend (&pdev->dev); + +spi_master_put (master); }#ifdef CONFIG_PM_SLEEP
Greg Kroah-Hartman
maintainerPATCH 437/474 spi: uniphier: switch to use modern name
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yang Yingliang <[email protected]>
[ Upstream commit 4c2ee0991013ca8a32bb093a017d460204790112 ]
Change legacy name master to modern name host or controller.
No functional changed.
Stable-dep-of: 0245435f7772 ("spi: uniphier: fix controller deregistration")
--- drivers/spi/spi-uniphier.c | 198 ++++++++++++++++++++++----------------------- 1 file changed, 99 insertions(+), 99 deletions(-)
drivers/spi/spi-uniphier.c +99 -99
@@ -26,7 +26,7 @@ struct uniphier_spi_priv {void __iomem *base;dma_addr_t base_dma_addr;struct clk *clk; -struct spi_master *master; +struct spi_controller *host;struct completion xfer_done;int error;
@@ -127,7 +127,7 @@ static inline void uniphier_spi_irq_disastatic void uniphier_spi_set_mode (struct spi_device *spi) { -struct uniphier_spi_priv *priv =spi_master_get_devdata (spi->master); +struct uniphier_spi_priv *priv =spi_controller_get_devdata (spi->controller);u32 val1, val2;/*
@@ -180,7 +180,7 @@ static void uniphier_spi_set_mode(structstatic void uniphier_spi_set_transfer_size (struct spi_device *spi,int size) { -struct uniphier_spi_priv *priv =spi_master_get_devdata (spi->master); +struct uniphier_spi_priv *priv =spi_controller_get_devdata (spi->controller);u32 val; val =readl (priv->base +SSI_TXWDS );
@@ -198,7 +198,7 @@ static void uniphier_spi_set_transfer_sistatic void uniphier_spi_set_baudrate (struct spi_device *spi,unsigned int speed) { -struct uniphier_spi_priv *priv =spi_master_get_devdata (spi->master); +struct uniphier_spi_priv *priv =spi_controller_get_devdata (spi->controller);u32 val, ckdiv;/*
@@ -217,7 +217,7 @@ static void uniphier_spi_set_baudrate(ststatic void uniphier_spi_setup_transfer (struct spi_device *spi,struct spi_transfer *t) { -struct uniphier_spi_priv *priv =spi_master_get_devdata (spi->master); +struct uniphier_spi_priv *priv =spi_controller_get_devdata (spi->controller);u32 val; priv->error =0 ;
@@ -333,7 +333,7 @@ static void uniphier_spi_fill_tx_fifo(ststatic void uniphier_spi_set_cs (struct spi_device *spi,bool enable) { -struct uniphier_spi_priv *priv =spi_master_get_devdata (spi->master); +struct uniphier_spi_priv *priv =spi_controller_get_devdata (spi->controller);u32 val; val =readl (priv->base +SSI_FPS );
@@ -346,16 +346,16 @@ static void uniphier_spi_set_cs(struct swritel (val, priv->base +SSI_FPS ); } -static bool uniphier_spi_can_dma (struct spi_master *master, +static bool uniphier_spi_can_dma (struct spi_controller *host,struct spi_device *spi,struct spi_transfer *t) { -struct uniphier_spi_priv *priv =spi_master_get_devdata (master); +struct uniphier_spi_priv *priv =spi_controller_get_devdata (host);unsigned int bpw =bytes_per_word (priv->bits_per_word); -if ((!master->dma_tx && !master->dma_rx) - || (!master->dma_tx && t->tx_buf) - || (!master->dma_rx && t->rx_buf)) +if ((!host->dma_tx && !host->dma_rx) + || (!host->dma_tx && t->tx_buf) + || (!host->dma_rx && t->rx_buf))return false;return DIV_ROUND_UP (t->len, bpw) >SSI_FIFO_DEPTH ;
@@ -363,33 +363,33 @@ static bool uniphier_spi_can_dma(structstatic void uniphier_spi_dma_rxcb (void *data) { -struct spi_master *master = data; -struct uniphier_spi_priv *priv =spi_master_get_devdata (master); +struct spi_controller *host = data; +struct uniphier_spi_priv *priv =spi_controller_get_devdata (host);int state =atomic_fetch_andnot (SSI_DMA_RX_BUSY , &priv->dma_busy);uniphier_spi_irq_disable (priv,SSI_IE_RXRE );if (!(state &SSI_DMA_TX_BUSY )) -spi_finalize_current_transfer (master); +spi_finalize_current_transfer (host); }static void uniphier_spi_dma_txcb (void *data) { -struct spi_master *master = data; -struct uniphier_spi_priv *priv =spi_master_get_devdata (master); +struct spi_controller *host = data; +struct uniphier_spi_priv *priv =spi_controller_get_devdata (host);int state =atomic_fetch_andnot (SSI_DMA_TX_BUSY , &priv->dma_busy);uniphier_spi_irq_disable (priv,SSI_IE_TXRE );if (!(state &SSI_DMA_RX_BUSY )) -spi_finalize_current_transfer (master); +spi_finalize_current_transfer (host); } -static int uniphier_spi_transfer_one_dma (struct spi_master *master, +static int uniphier_spi_transfer_one_dma (struct spi_controller *host,struct spi_device *spi,struct spi_transfer *t) { -struct uniphier_spi_priv *priv =spi_master_get_devdata (master); +struct uniphier_spi_priv *priv =spi_controller_get_devdata (host);struct dma_async_tx_descriptor *rxdesc =NULL , *txdesc =NULL ;int buswidth;
@@ -412,23 +412,23 @@ static int uniphier_spi_transfer_one_dma .src_maxburst = SSI_FIFO_BURST_NUM, }; -dmaengine_slave_config (master->dma_rx, &rxconf); +dmaengine_slave_config (host->dma_rx, &rxconf); rxdesc =dmaengine_prep_slave_sg ( - master->dma_rx, + host->dma_rx, t->rx_sg.sgl, t->rx_sg.nents,DMA_DEV_TO_MEM ,DMA_PREP_INTERRUPT |DMA_CTRL_ACK );if (!rxdesc) goto out_err_prep; rxdesc->callback = uniphier_spi_dma_rxcb; - rxdesc->callback_param = master; + rxdesc->callback_param = host;uniphier_spi_irq_enable (priv,SSI_IE_RXRE );atomic_or (SSI_DMA_RX_BUSY , &priv->dma_busy);dmaengine_submit (rxdesc); -dma_async_issue_pending (master->dma_rx); +dma_async_issue_pending (host->dma_rx); }if (priv->tx_buf) {
@@ -439,23 +439,23 @@ static int uniphier_spi_transfer_one_dma .dst_maxburst = SSI_FIFO_BURST_NUM, }; -dmaengine_slave_config (master->dma_tx, &txconf); +dmaengine_slave_config (host->dma_tx, &txconf); txdesc =dmaengine_prep_slave_sg ( - master->dma_tx, + host->dma_tx, t->tx_sg.sgl, t->tx_sg.nents,DMA_MEM_TO_DEV ,DMA_PREP_INTERRUPT |DMA_CTRL_ACK );if (!txdesc) goto out_err_prep; txdesc->callback = uniphier_spi_dma_txcb; - txdesc->callback_param = master; + txdesc->callback_param = host;uniphier_spi_irq_enable (priv,SSI_IE_TXRE );atomic_or (SSI_DMA_TX_BUSY , &priv->dma_busy);dmaengine_submit (txdesc); -dma_async_issue_pending (master->dma_tx); +dma_async_issue_pending (host->dma_tx); }/* signal that we need to wait for completion */
@@ -463,17 +463,17 @@ static int uniphier_spi_transfer_one_dma out_err_prep:if (rxdesc) -dmaengine_terminate_sync (master->dma_rx); +dmaengine_terminate_sync (host->dma_rx);return -EINVAL ; } -static int uniphier_spi_transfer_one_irq (struct spi_master *master, +static int uniphier_spi_transfer_one_irq (struct spi_controller *host,struct spi_device *spi,struct spi_transfer *t) { -struct uniphier_spi_priv *priv =spi_master_get_devdata (master); -struct device *dev = master->dev.parent; +struct uniphier_spi_priv *priv =spi_controller_get_devdata (host); +struct device *dev = host->dev.parent;unsigned long time_left;reinit_completion (&priv->xfer_done);
@@ -495,11 +495,11 @@ static int uniphier_spi_transfer_one_irqreturn priv->error; } -static int uniphier_spi_transfer_one_poll (struct spi_master *master, +static int uniphier_spi_transfer_one_poll (struct spi_controller *host,struct spi_device *spi,struct spi_transfer *t) { -struct uniphier_spi_priv *priv =spi_master_get_devdata (master); +struct uniphier_spi_priv *priv =spi_controller_get_devdata (host);int loop =SSI_POLL_TIMEOUT_US *10 ;while (priv->tx_bytes) {
@@ -520,14 +520,14 @@ static int uniphier_spi_transfer_one_polreturn 0 ; irq_transfer: -return uniphier_spi_transfer_one_irq (master, spi, t); +return uniphier_spi_transfer_one_irq (host, spi, t); } -static int uniphier_spi_transfer_one (struct spi_master *master, +static int uniphier_spi_transfer_one (struct spi_controller *host,struct spi_device *spi,struct spi_transfer *t) { -struct uniphier_spi_priv *priv =spi_master_get_devdata (master); +struct uniphier_spi_priv *priv =spi_controller_get_devdata (host);unsigned long threshold;bool use_dma;
@@ -537,9 +537,9 @@ static int uniphier_spi_transfer_one(struniphier_spi_setup_transfer (spi, t); - use_dma = master->can_dma ? master->can_dma (master, spi, t) : false; + use_dma = host->can_dma ? host->can_dma (host, spi, t) : false;if (use_dma) -return uniphier_spi_transfer_one_dma (master, spi, t); +return uniphier_spi_transfer_one_dma (host, spi, t);/* * If the transfer operation will take longer than
@@ -548,33 +548,33 @@ static int uniphier_spi_transfer_one(str threshold =DIV_ROUND_UP (SSI_POLL_TIMEOUT_US * priv->speed_hz,USEC_PER_SEC *BITS_PER_BYTE );if (t->len > threshold) -return uniphier_spi_transfer_one_irq (master, spi, t); +return uniphier_spi_transfer_one_irq (host, spi, t);else -return uniphier_spi_transfer_one_poll (master, spi, t); +return uniphier_spi_transfer_one_poll (host, spi, t); } -static int uniphier_spi_prepare_transfer_hardware (struct spi_master *master) +static int uniphier_spi_prepare_transfer_hardware (struct spi_controller *host) { -struct uniphier_spi_priv *priv =spi_master_get_devdata (master); +struct uniphier_spi_priv *priv =spi_controller_get_devdata (host);writel (SSI_CTL_EN , priv->base +SSI_CTL );return 0 ; } -static int uniphier_spi_unprepare_transfer_hardware (struct spi_master *master) +static int uniphier_spi_unprepare_transfer_hardware (struct spi_controller *host) { -struct uniphier_spi_priv *priv =spi_master_get_devdata (master); +struct uniphier_spi_priv *priv =spi_controller_get_devdata (host);writel (0 , priv->base +SSI_CTL );return 0 ; } -static void uniphier_spi_handle_err (struct spi_master *master, +static void uniphier_spi_handle_err (struct spi_controller *host,struct spi_message *msg) { -struct uniphier_spi_priv *priv =spi_master_get_devdata (master); +struct uniphier_spi_priv *priv =spi_controller_get_devdata (host);u32 val;/* stop running spi transfer */
@@ -587,12 +587,12 @@ static void uniphier_spi_handle_err(struuniphier_spi_irq_disable (priv,SSI_IE_ALL_MASK );if (atomic_read (&priv->dma_busy) &SSI_DMA_TX_BUSY ) { -dmaengine_terminate_async (master->dma_tx); +dmaengine_terminate_async (host->dma_tx);atomic_andnot (SSI_DMA_TX_BUSY , &priv->dma_busy); }if (atomic_read (&priv->dma_busy) &SSI_DMA_RX_BUSY ) { -dmaengine_terminate_async (master->dma_rx); +dmaengine_terminate_async (host->dma_rx);atomic_andnot (SSI_DMA_RX_BUSY , &priv->dma_busy); } }
@@ -641,7 +641,7 @@ done:static int uniphier_spi_probe (struct platform_device *pdev) {struct uniphier_spi_priv *priv; -struct spi_master *master; +struct spi_controller *host;struct resource *res;struct dma_slave_caps caps;u32 dma_tx_burst =0 , dma_rx_burst =0 ;
@@ -649,20 +649,20 @@ static int uniphier_spi_probe(struct plaint irq;int ret; - master =spi_alloc_master (&pdev->dev,sizeof (*priv)); -if (!master) + host =spi_alloc_host (&pdev->dev,sizeof (*priv)); +if (!host)return -ENOMEM ; -platform_set_drvdata (pdev, master); +platform_set_drvdata (pdev, host); - priv =spi_master_get_devdata (master); - priv->master = master; + priv =spi_controller_get_devdata (host); + priv->host = host; priv->is_save_param = false; priv->base =devm_platform_get_and_ioremap_resource (pdev,0 , &res);if (IS_ERR (priv->base)) { ret =PTR_ERR (priv->base); - goto out_master_put; + goto out_host_put; } priv->base_dma_addr = res->start;
@@ -670,12 +670,12 @@ static int uniphier_spi_probe(struct plaif (IS_ERR (priv->clk)) {dev_err (&pdev->dev,"failed to get clock\n" ); ret =PTR_ERR (priv->clk); - goto out_master_put; + goto out_host_put; } ret =clk_prepare_enable (priv->clk);if (ret) - goto out_master_put; + goto out_host_put; irq =platform_get_irq (pdev,0 );if (irq <0 ) {
@@ -694,35 +694,35 @@ static int uniphier_spi_probe(struct pla clk_rate =clk_get_rate (priv->clk); - master->max_speed_hz =DIV_ROUND_UP (clk_rate,SSI_MIN_CLK_DIVIDER ); - master->min_speed_hz =DIV_ROUND_UP (clk_rate,SSI_MAX_CLK_DIVIDER ); - master->mode_bits =SPI_CPOL |SPI_CPHA |SPI_CS_HIGH |SPI_LSB_FIRST ; - master->dev.of_node = pdev->dev.of_node; - master->bus_num = pdev->id; - master->bits_per_word_mask =SPI_BPW_RANGE_MASK (1 ,32 ); - - master->set_cs = uniphier_spi_set_cs; - master->transfer_one = uniphier_spi_transfer_one; - master->prepare_transfer_hardware + host->max_speed_hz =DIV_ROUND_UP (clk_rate,SSI_MIN_CLK_DIVIDER ); + host->min_speed_hz =DIV_ROUND_UP (clk_rate,SSI_MAX_CLK_DIVIDER ); + host->mode_bits =SPI_CPOL |SPI_CPHA |SPI_CS_HIGH |SPI_LSB_FIRST ; + host->dev.of_node = pdev->dev.of_node; + host->bus_num = pdev->id; + host->bits_per_word_mask =SPI_BPW_RANGE_MASK (1 ,32 ); + + host->set_cs = uniphier_spi_set_cs; + host->transfer_one = uniphier_spi_transfer_one; + host->prepare_transfer_hardware = uniphier_spi_prepare_transfer_hardware; - master->unprepare_transfer_hardware + host->unprepare_transfer_hardware = uniphier_spi_unprepare_transfer_hardware; - master->handle_err = uniphier_spi_handle_err; - master->can_dma = uniphier_spi_can_dma; + host->handle_err = uniphier_spi_handle_err; + host->can_dma = uniphier_spi_can_dma; - master->num_chipselect =1 ; - master->flags =SPI_CONTROLLER_MUST_RX |SPI_CONTROLLER_MUST_TX ; + host->num_chipselect =1 ; + host->flags =SPI_CONTROLLER_MUST_RX |SPI_CONTROLLER_MUST_TX ; - master->dma_tx =dma_request_chan (&pdev->dev,"tx" ); -if (IS_ERR_OR_NULL (master->dma_tx)) { -if (PTR_ERR (master->dma_tx) == -EPROBE_DEFER ) { + host->dma_tx =dma_request_chan (&pdev->dev,"tx" ); +if (IS_ERR_OR_NULL (host->dma_tx)) { +if (PTR_ERR (host->dma_tx) == -EPROBE_DEFER ) { ret = -EPROBE_DEFER ; goto out_disable_clk; } - master->dma_tx =NULL ; + host->dma_tx =NULL ; dma_tx_burst =INT_MAX ; }else { - ret =dma_get_slave_caps (master->dma_tx, &caps); + ret =dma_get_slave_caps (host->dma_tx, &caps);if (ret) {dev_err (&pdev->dev,"failed to get TX DMA capacities: %d\n" , ret);
@@ -731,16 +731,16 @@ static int uniphier_spi_probe(struct pla dma_tx_burst = caps.max_burst; } - master->dma_rx =dma_request_chan (&pdev->dev,"rx" ); -if (IS_ERR_OR_NULL (master->dma_rx)) { -if (PTR_ERR (master->dma_rx) == -EPROBE_DEFER ) { + host->dma_rx =dma_request_chan (&pdev->dev,"rx" ); +if (IS_ERR_OR_NULL (host->dma_rx)) { +if (PTR_ERR (host->dma_rx) == -EPROBE_DEFER ) { ret = -EPROBE_DEFER ; goto out_release_dma; } - master->dma_rx =NULL ; + host->dma_rx =NULL ; dma_rx_burst =INT_MAX ; }else { - ret =dma_get_slave_caps (master->dma_rx, &caps); + ret =dma_get_slave_caps (host->dma_rx, &caps);if (ret) {dev_err (&pdev->dev,"failed to get RX DMA capacities: %d\n" , ret);
@@ -749,41 +749,41 @@ static int uniphier_spi_probe(struct pla dma_rx_burst = caps.max_burst; } - master->max_dma_len =min (dma_tx_burst, dma_rx_burst); + host->max_dma_len =min (dma_tx_burst, dma_rx_burst); - ret =devm_spi_register_master (&pdev->dev, master); + ret =devm_spi_register_controller (&pdev->dev, host);if (ret) goto out_release_dma;return 0 ; out_release_dma: -if (!IS_ERR_OR_NULL (master->dma_rx)) { -dma_release_channel (master->dma_rx); - master->dma_rx =NULL ; - } -if (!IS_ERR_OR_NULL (master->dma_tx)) { -dma_release_channel (master->dma_tx); - master->dma_tx =NULL ; +if (!IS_ERR_OR_NULL (host->dma_rx)) { +dma_release_channel (host->dma_rx); + host->dma_rx =NULL ; + } +if (!IS_ERR_OR_NULL (host->dma_tx)) { +dma_release_channel (host->dma_tx); + host->dma_tx =NULL ; } out_disable_clk:clk_disable_unprepare (priv->clk); -out_master_put: -spi_master_put (master); +out_host_put: +spi_controller_put (host);return ret; }static void uniphier_spi_remove (struct platform_device *pdev) { -struct spi_master *master =platform_get_drvdata (pdev); -struct uniphier_spi_priv *priv =spi_master_get_devdata (master); +struct spi_controller *host =platform_get_drvdata (pdev); +struct uniphier_spi_priv *priv =spi_controller_get_devdata (host); -if (master->dma_tx) -dma_release_channel (master->dma_tx); -if (master->dma_rx) -dma_release_channel (master->dma_rx); +if (host->dma_tx) +dma_release_channel (host->dma_tx); +if (host->dma_rx) +dma_release_channel (host->dma_rx);clk_disable_unprepare (priv->clk); }
Greg Kroah-Hartman
maintainerPATCH 438/474 spi: uniphier: Simplify clock handling with devm_clk_get_enabled()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pei Xiao <[email protected]>
[ Upstream commit fdca270f8f87cae2eb5b619234b9dd11a863ce6b ]
Replace devm_clk_get() followed by clk_prepare_enable() with devm_clk_get_enabled() for the clock. This removes the need for explicit clock enable and disable calls, as the managed API automatically handles clock disabling on device removal or probe failure.
Remove the now-unnecessary clk_disable_unprepare() calls from the probe error path and the remove callback. Adjust error labels accordingly.
Stable-dep-of: 0245435f7772 ("spi: uniphier: fix controller deregistration")
--- drivers/spi/spi-uniphier.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-)
drivers/spi/spi-uniphier.c +4 -14
@@ -666,28 +666,24 @@ static int uniphier_spi_probe(struct pla } priv->base_dma_addr = res->start; - priv->clk =devm_clk_get (&pdev->dev,NULL ); + priv->clk =devm_clk_get_enabled (&pdev->dev,NULL );if (IS_ERR (priv->clk)) {dev_err (&pdev->dev,"failed to get clock\n" ); ret =PTR_ERR (priv->clk); goto out_host_put; } - ret =clk_prepare_enable (priv->clk); -if (ret) - goto out_host_put; - irq =platform_get_irq (pdev,0 );if (irq <0 ) { ret = irq; - goto out_disable_clk; + goto out_host_put; } ret =devm_request_irq (&pdev->dev, irq, uniphier_spi_handler,0 ,"uniphier-spi" , priv);if (ret) {dev_err (&pdev->dev,"failed to request IRQ\n" ); - goto out_disable_clk; + goto out_host_put; }init_completion (&priv->xfer_done);
@@ -717,7 +713,7 @@ static int uniphier_spi_probe(struct plaif (IS_ERR_OR_NULL (host->dma_tx)) {if (PTR_ERR (host->dma_tx) == -EPROBE_DEFER ) { ret = -EPROBE_DEFER ; - goto out_disable_clk; + goto out_host_put; } host->dma_tx =NULL ; dma_tx_burst =INT_MAX ;
@@ -767,9 +763,6 @@ out_release_dma: host->dma_tx =NULL ; } -out_disable_clk: -clk_disable_unprepare (priv->clk); - out_host_put:spi_controller_put (host);return ret;
@@ -778,14 +771,11 @@ out_host_put:static void uniphier_spi_remove (struct platform_device *pdev) {struct spi_controller *host =platform_get_drvdata (pdev); -struct uniphier_spi_priv *priv =spi_controller_get_devdata (host);if (host->dma_tx)dma_release_channel (host->dma_tx);if (host->dma_rx)dma_release_channel (host->dma_rx); - -clk_disable_unprepare (priv->clk); }static const struct of_device_id uniphier_spi_match[] = {
Greg Kroah-Hartman
maintainerPATCH 439/474 spi: uniphier: fix controller deregistration
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
[ Upstream commit 0245435f777264ac45945ed2f325dd095a41d1af ]
Make sure to deregister the controller before releasing underlying resources like DMA during driver unbind.
Note that clocks were also disabled before the recent commit fdca270f8f87 ("spi: uniphier: Simplify clock handling with devm_clk_get_enabled()").
--- drivers/spi/spi-uniphier.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/spi/spi-uniphier.c +7 -1
@@ -747,7 +747,7 @@ static int uniphier_spi_probe(struct pla host->max_dma_len =min (dma_tx_burst, dma_rx_burst); - ret =devm_spi_register_controller (&pdev->dev, host); + ret =spi_register_controller (host);if (ret) goto out_release_dma;
@@ -772,10 +772,16 @@ static void uniphier_spi_remove(struct p {struct spi_controller *host =platform_get_drvdata (pdev); +spi_controller_get (host); + +spi_unregister_controller (host); +if (host->dma_tx)dma_release_channel (host->dma_tx);if (host->dma_rx)dma_release_channel (host->dma_rx); + +spi_controller_put (host); }static const struct of_device_id uniphier_spi_match[] = {
Greg Kroah-Hartman
maintainerPATCH 440/474 mm/hugetlb_cma: round up per_node before logging it
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sang-Heon Jeon <[email protected]>
[ Upstream commit 8f5ce56b76303c55b78a87af996e2e0f8535f979 ]
When the user requests a total hugetlb CMA size without per-node specification, hugetlb_cma_reserve() computes per_node from hugetlb_cma_size and the number of nodes that have memory
per_node = DIV_ROUND_UP(hugetlb_cma_size,
nodes_weight(hugetlb_bootmem_nodes));
The reservation loop later computes
size = round_up(min(per_node, hugetlb_cma_size - reserved),
PAGE_SIZE << order);
So the actually reserved per_node size is multiple of (PAGE_SIZE << order), but the logged per_node is not rounded up, so it may be smaller than the actual reserved size.
For example, as the existing comment describes, if a 3 GB area is requested on a machine with 4 NUMA nodes that have memory, 1 GB is allocated on the first three nodes, but the printed log is
hugetlb_cma: reserve 3072 MiB, up to 768 MiB per node
Round per_node up to (PAGE_SIZE << order) before logging so that the printed log always matches the actual reserved size. No functional change to the actual reservation size, as the following case analysis shows
1. remaining (hugetlb_cma_size - reserved) >= rounded per_node
- AS-IS: min() picks unrounded per_node;
round_up() returns rounded per_node
- TO-BE: min() picks rounded per_node;
round_up() returns rounded per_node (no-op)
2. remaining < unrounded per_node
- AS-IS: min() picks remaining;
round_up() returns round_up(remaining)
- TO-BE: min() picks remaining;
round_up() returns round_up(remaining)
3. unrounded per_node <= remaining < rounded per_node
- AS-IS: min() picks unrounded per_node;
round_up() returns rounded per_node
- TO-BE: min() picks remaining;
round_up() returns round_up(remaining) equals rounded per_node
--- mm/hugetlb.c | 1 + 1 file changed, 1 insertion(+)
mm/hugetlb.c +1 -0
@@ -7493,6 +7493,7 @@ void __init hugetlb_cma_reserve(int orde* let's allocate 1 GB on first three nodes and ignore the last one. */ per_node =DIV_ROUND_UP (hugetlb_cma_size, nr_online_nodes); + per_node =round_up (per_node,PAGE_SIZE << order);pr_info ("hugetlb_cma: reserve %lu MiB, up to %lu MiB per node\n" , hugetlb_cma_size /SZ_1M , per_node /SZ_1M ); }
Greg Kroah-Hartman
maintainerPATCH 441/474 spi: microchip-core-qspi: Use helper function devm_clk_get_enabled()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Li Zetao <[email protected]>
[ Upstream commit e922f3fff21445117e9196bd8e940ad8e15ca8c7 ]
Since commit 7ef9651e9792 ("clk: Provide new devm_clk helpers for prepared and enabled clocks"), devm_clk_get() and clk_prepare_enable() can now be replaced by devm_clk_get_enabled() when driver enables (and possibly prepares) the clocks for the whole lifetime of the device. Moreover, it is no longer necessary to unprepare and disable the clocks explicitly.
Stable-dep-of: e6464140d439 ("spi: microchip-core-qspi: fix controller deregistration")
--- drivers/spi/spi-microchip-core-qspi.c | 29 +++++++---------------------- 1 file changed, 7 insertions(+), 22 deletions(-)
drivers/spi/spi-microchip-core-qspi.c +7 -22
@@ -519,30 +519,23 @@ static int mchp_coreqspi_probe(struct plreturn dev_err_probe (&pdev->dev,PTR_ERR (qspi->regs),"failed to map registers\n" ); - qspi->clk =devm_clk_get (&pdev->dev,NULL ); + qspi->clk =devm_clk_get_enabled (&pdev->dev,NULL );if (IS_ERR (qspi->clk))return dev_err_probe (&pdev->dev,PTR_ERR (qspi->clk),"could not get clock\n" ); - ret =clk_prepare_enable (qspi->clk); -if (ret) -return dev_err_probe (&pdev->dev, ret, -"failed to enable clock\n" ); -init_completion (&qspi->data_completion);mutex_init (&qspi->op_lock); qspi->irq =platform_get_irq (pdev,0 ); -if (qspi->irq <0 ) { - ret = qspi->irq; - goto out; - } +if (qspi->irq <0 ) +return qspi->irq; ret =devm_request_irq (&pdev->dev, qspi->irq, mchp_coreqspi_isr,IRQF_SHARED , pdev->name, qspi);if (ret) {dev_err (&pdev->dev,"request_irq failed %d\n" , ret); - goto out; +return ret; } ctlr->bits_per_word_mask =SPI_BPW_MASK (8 );
@@ -553,18 +546,11 @@ static int mchp_coreqspi_probe(struct pl ctlr->dev.of_node = np; ret =devm_spi_register_controller (&pdev->dev, ctlr); -if (ret) { -dev_err_probe (&pdev->dev, ret, -"spi_register_controller failed\n" ); - goto out; - } +if (ret) +return dev_err_probe (&pdev->dev, ret, +"spi_register_controller failed\n" );return 0 ; - -out: -clk_disable_unprepare (qspi->clk); - -return ret; }static void mchp_coreqspi_remove (struct platform_device *pdev)
@@ -575,7 +561,6 @@ static void mchp_coreqspi_remove(structmchp_coreqspi_disable_ints (qspi); control &= ~CONTROL_ENABLE ;writel_relaxed (control, qspi->regs +REG_CONTROL ); -clk_disable_unprepare (qspi->clk); }static const struct of_device_id mchp_coreqspi_of_match[] = {
Greg Kroah-Hartman
maintainerPATCH 442/474 spi: microchip-core-qspi: fix controller deregistration
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
[ Upstream commit e6464140d439f2d42f072eb422a5b1fec470c5a6 ]
Make sure to deregister the controller before disabling underlying resources like interrupts during driver unbind.
--- drivers/spi/spi-microchip-core-qspi.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/spi/spi-microchip-core-qspi.c +8 -4
@@ -512,7 +512,7 @@ static int mchp_coreqspi_probe(struct pl "unable to allocate master for QSPI controller\n"); qspi =spi_controller_get_devdata (ctlr); -platform_set_drvdata (pdev, qspi); +platform_set_drvdata (pdev, ctlr); qspi->regs =devm_platform_ioremap_resource (pdev,0 );if (IS_ERR (qspi->regs))
@@ -545,7 +545,7 @@ static int mchp_coreqspi_probe(struct plSPI_TX_DUAL |SPI_TX_QUAD ; ctlr->dev.of_node = np; - ret =devm_spi_register_controller (&pdev->dev, ctlr); + ret =spi_register_controller (ctlr);if (ret)return dev_err_probe (&pdev->dev, ret,"spi_register_controller failed\n" );
@@ -555,9 +555,13 @@ static int mchp_coreqspi_probe(struct plstatic void mchp_coreqspi_remove (struct platform_device *pdev) { -struct mchp_coreqspi *qspi =platform_get_drvdata (pdev); -u32 control =readl_relaxed (qspi->regs +REG_CONTROL ); +struct spi_controller *ctlr =platform_get_drvdata (pdev); +struct mchp_coreqspi *qspi =spi_controller_get_devdata (ctlr); +u32 control; +spi_unregister_controller (ctlr); + + control =readl_relaxed (qspi->regs +REG_CONTROL );mchp_coreqspi_disable_ints (qspi); control &= ~CONTROL_ENABLE ;writel_relaxed (control, qspi->regs +REG_CONTROL );
Greg Kroah-Hartman
maintainerPATCH 443/474 fbcon: Avoid OOB font access if console rotation fails
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Zimmermann <[email protected]>
[ Upstream commit e4ef723d8975a2694cc90733a6b888a5e2841842 ]
Clear the font buffer if the reallocation during console rotation fails in fbcon_rotate_font(). The putcs implementations for the rotated buffer will return early in this case. See [1] for an example.
Currently, fbcon_rotate_font() keeps the old buffer, which is too small for the rotated font. Printing to the rotated console with a high-enough character code will overflow the font buffer.
v2:
- fix typos in commit message
--- drivers/video/fbdev/core/fbcon_rotate.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/video/fbdev/core/fbcon_rotate.c +4 -1
@@ -46,6 +46,10 @@ static int fbcon_rotate_font(struct fb_i info->fbops->fb_sync (info);if (ops->fd_size < d_cellsize * len) { +kfree (ops->fontbuffer); + ops->fontbuffer =NULL ; + ops->fd_size =0 ; + dst =kmalloc_array (len, d_cellsize,GFP_KERNEL );if (dst ==NULL ) {
@@ -54,7 +58,6 @@ static int fbcon_rotate_font(struct fb_i } ops->fd_size = d_cellsize * len; -kfree (ops->fontbuffer); ops->fontbuffer = dst; }
Greg Kroah-Hartman
maintainerPATCH 444/474 rxrpc: Fix conn-level packet handling to unshare RESPONSE packets
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Howells <[email protected]>
[ Upstream commit 24481a7f573305706054c59e275371f8d0fe919f ]
The security operations that verify the RESPONSE packets decrypt bits of it in place - however, the sk_buff may be shared with a packet sniffer, which would lead to the sniffer seeing an apparently corrupt packet (actually decrypted).
Fix this by handing a copy of the packet off to the specific security handler if the packet was cloned.
--- net/rxrpc/conn_event.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-)
net/rxrpc/conn_event.c +28 -1
@@ -226,6 +226,33 @@ static void rxrpc_call_is_secure(structrxrpc_notify_socket (call); } +static int rxrpc_verify_response (struct rxrpc_connection *conn, +struct sk_buff *skb) +{ +int ret; + +if (skb_cloned (skb)) { +/* Copy the packet if shared so that we can do in-place +* decryption. +*/ +struct sk_buff *nskb =skb_copy (skb,GFP_NOFS ); + +if (nskb) { +rxrpc_new_skb (nskb, rxrpc_skb_new_unshared); + ret = conn->security->verify_response (conn, nskb); +rxrpc_free_skb (nskb, rxrpc_skb_put_response_copy); + }else { +/* OOM - Drop the packet. */ +rxrpc_see_skb (skb, rxrpc_skb_see_unshare_nomem); + ret = -ENOMEM ; + } + }else { + ret = conn->security->verify_response (conn, skb); + } + +return ret; +} +/* * connection-level Rx packet processor */
@@ -253,7 +280,7 @@ static int rxrpc_process_event(struct rx }spin_unlock (&conn->state_lock); - ret = conn->security->verify_response (conn, skb); + ret =rxrpc_verify_response (conn, skb);if (ret <0 )return ret;
Greg Kroah-Hartman
maintainerPATCH 445/474 Bluetooth: L2CAP: Fix null-ptr-deref in l2cap_sock_get_sndtimeo_cb()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Siwei Zhang <[email protected]>
commit 78a88d43dab8d23aeef934ed8ce34d40e6b3d613 upstream.
Add the same NULL guard already present inl2cap_sock_resume_cb() and l2cap_sock_ready_cb().
--- net/bluetooth/l2cap_sock.c | 3 +++ 1 file changed, 3 insertions(+)
net/bluetooth/l2cap_sock.c +3 -0
@@ -1731,6 +1731,9 @@ static long l2cap_sock_get_sndtimeo_cb(s {struct sock *sk = chan->data; +if (!sk) +return 0 ; +return sk->sk_sndtimeo; }
Greg Kroah-Hartman
maintainerPATCH 446/474 bonding: fix use-after-free due to enslave fail after slave array update
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nikolay Aleksandrov <[email protected]>
commit e9acda52fd2ee0cdca332f996da7a95c5fd25294 upstream.
Fix a use-after-free which happens due to enslave failure after the new slave has been added to the array. Since the new slave can be used for Tx immediately, we can use it after it has been freed by the enslave error cleanup path which frees the allocated slave memory. Slave update array is supposed to be called last when further enslave failures are not expected. Move it after xdp setup to avoid any problems.
It is very easy to reproduce the problem with a simple xdp_pass prog:
ip l add bond1 type bond mode balance-xor
ip l set bond1 up
ip l set dev bond1 xdp object xdp_pass.o sec xdp_pass
ip l add dumdum type dummy
Then run in parallel:
while :; do ip l set dumdum master bond1 1>/dev/null 2>&1; done; mausezahn bond1 -a own -b rand -A rand -B 1.1.1.1 -c 0 -t tcp "dp=1-1023, flags=syn"
The crash happens almost immediately:
[ 605.602850] Oops: general protection fault, probably for non-canonical address 0xe0e6fc2460000137: 0000 [#1] SMP KASAN NOPTI [ 605.602916] KASAN: maybe wild-memory-access in range [0x07380123000009b8-0x07380123000009bf] [ 605.602946] CPU: 0 UID: 0 PID: 2445 Comm: mausezahn Kdump: loaded Tainted: G B 6.19.0-rc6+ #21 PREEMPT(voluntary) [ 605.602979] Tainted: [B]=BAD_PAGE [ 605.602998] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 [ 605.603032] RIP: 0010:netdev_core_pick_tx+0xcd/0x210 [ 605.603063] Code: 48 89 fa 48 c1 ea 03 80 3c 02 00 0f 85 3e 01 00 00 48 b8 00 00 00 00 00 fc ff df 4c 8b 6b 08 49 8d 7d 30 48 89 fa 48 c1 ea 03 <80> 3c 02 00 0f 85 25 01 00 00 49 8b 45 30 4c 89 e2 48 89 ee 48 89 [ 605.603111] RSP: 0018:ffff88817b9af348 EFLAGS: 00010213 [ 605.603145] RAX: dffffc0000000000 RBX: ffff88817d28b420 RCX: 0000000000000000 [ 605.603172] RDX: 00e7002460000137 RSI: 0000000000000008 RDI: 07380123000009be [ 605.603199] RBP: ffff88817b541a00 R08: 0000000000000001 R09: fffffbfff3ed8c0c [ 605.603226] R10: ffffffff9f6c6067 R11: 0000000000000001 R12: 0000000000000000 [ 605.603253] R13: 073801230000098e R14: ffff88817d28b448 R15: ffff88817b541a84 [ 605.603286] FS: 00007f6570ef67c0(0000) GS:ffff888221dfa000(0000) knlGS:0000000000000000 [ 605.603319] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 605.603343] CR2: 00007f65712fae40 CR3: 000000011371b000 CR4: 0000000000350ef0 [ 605.603373] Call Trace: [ 605.603392] <TASK> [ 605.603410] __dev_queue_xmit+0x448/0x32a0 [ 605.603434] ? __pfx_vprintk_emit+0x10/0x10 [ 605.603461] ? __pfx_vprintk_emit+0x10/0x10 [ 605.603484] ? __pfx___dev_queue_xmit+0x10/0x10 [ 605.603507] ? bond_start_xmit+0xbfb/0xc20 [bonding] [ 605.603546] ? _printk+0xcb/0x100 [ 605.603566] ? __pfx__printk+0x10/0x10 [ 605.603589] ? bond_start_xmit+0xbfb/0xc20 [bonding] [ 605.603627] ? add_taint+0x5e/0x70 [ 605.603648] ? add_taint+0x2a/0x70 [ 605.603670] ? end_report.cold+0x51/0x75 [ 605.603693] ? bond_start_xmit+0xbfb/0xc20 [bonding] [ 605.603731] bond_start_xmit+0x623/0xc20 [bonding]
--- drivers/net/bonding/bond_main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/bonding/bond_main.c +3 -3
@@ -2309,9 +2309,6 @@ skip_mac_set:unblock_netpoll_tx (); } -if (bond_mode_can_use_xmit_hash (bond)) -bond_update_slave_arr (bond,NULL ); -if (!slave_dev->netdev_ops->ndo_bpf || !slave_dev->netdev_ops->ndo_xdp_xmit) {if (bond->xdp_prog) {
@@ -2345,6 +2342,9 @@ skip_mac_set:bpf_prog_inc (bond->xdp_prog); } +if (bond_mode_can_use_xmit_hash (bond)) +bond_update_slave_arr (bond,NULL ); +bond_xdp_set_features (bond_dev); slave_info(bond_dev, slave_dev, "Enslaving as %s interface with %s link\n",
Greg Kroah-Hartman
maintainerPATCH 447/474 mm/damon/core: disallow time-quota setting zero esz
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: SeongJae Park <[email protected]>
commit 8bbde987c2b84f80da0853f739f0a920386f8b99 upstream.
When the throughput of a DAMOS scheme is very slow, DAMOS time quota can make the effective size quota smaller than damon_ctx->min_region_sz. In the case, damos_apply_scheme() will skip applying the action, because the action is tried at region level, which requires >=min_region_sz size. That is, the quota is effectively exceeded for the quota charge window.
Because no action will be applied, the total_charged_sz and total_charged_ns are also not updated. damos_set_effective_quota() will try to update the effective size quota before starting the next charge window. However, because the total_charged_sz and total_charged_ns have not updated, the throughput and effective size quota are also not changed. Since effective size quota can only be decreased, other effective size quota update factors including DAMOS quota goals and size quota cannot make any change, either.
As a result, the scheme is unexpectedly deactivated until the user notices and mitigates the situation. The users can mitigate this situation by changing the time quota online or re-install the scheme. While the mitigation is somewhat straightforward, finding the situation would be challenging, because DAMON is not providing good observabilities for that. Even if such observability is provided, doing the additional monitoring and the mitigation is somewhat cumbersome and not aligned to the intention of the time quota. The time quota was intended to help reduce the user's administration overhead.
Fix the problem by setting time quota-modified effective size quota be at least min_region_sz always.
The issue was discovered [1] by sashiko.
--- mm/damon/core.c | 1 + 1 file changed, 1 insertion(+)
mm/damon/core.c +1 -0
@@ -1026,6 +1026,7 @@ static void damos_set_effective_quota(stelse throughput =PAGE_SIZE *1024 ; esz = throughput * quota->ms; + esz =max (DAMON_MIN_REGION , esz);if (quota->sz && quota->sz < esz) esz = quota->sz;
Greg Kroah-Hartman
maintainerPATCH 448/474 rxrpc: Also unshare DATA/RESPONSE packets when paged frags are present
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hyunwoo Kim <[email protected]>
commit aa54b1d27fe0c2b78e664a34fd0fdf7cd1960d71 upstream.
The DATA-packet handler in rxrpc_input_call_event() and the RESPONSE handler in rxrpc_verify_response() copy the skb to a linear one before calling into the security ops only when skb_cloned() is true. An skb that is not cloned but still carries externally-owned paged fragments (e.g. SKBFL_SHARED_FRAG set by splice() into a UDP socket via __ip_append_data, or a chained skb_has_frag_list()) falls through to the in-place decryption path, which binds the frag pages directly into the AEAD/skcipher SGL via skb_to_sgvec().
Extend the gate to also unshare when skb_has_frag_list() or skb_has_shared_frag() is true. This catches the splice-loopback vector and other externally-shared frag sources while preserving the zero-copy fast path for skbs whose frags are kernel-private (e.g. NIC page_pool RX, GRO). The OOM/trace handling already in place is reused.
--- net/rxrpc/call_event.c | 4 +++- net/rxrpc/conn_event.c | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-)
net/rxrpc/call_event.c +3 -1
@@ -461,7 +461,9 @@ bool rxrpc_input_call_event(struct rxrpcif (sp->hdr.type ==RXRPC_PACKET_TYPE_DATA && sp->hdr.securityIndex !=0 && -skb_cloned (skb)) { + (skb_cloned (skb) || +skb_has_frag_list (skb) || +skb_has_shared_frag (skb))) {/* Unshare the packet so that it can be modified by * in-place decryption. */
net/rxrpc/conn_event.c +2 -1
@@ -231,7 +231,8 @@ static int rxrpc_verify_response(struct {int ret; -if (skb_cloned (skb)) { +if (skb_cloned (skb) ||skb_has_frag_list (skb) || +skb_has_shared_frag (skb)) {/* Copy the packet if shared so that we can do in-place * decryption. */
Greg Kroah-Hartman
maintainerPATCH 449/474 mm/damon/core: implement damon_kdamond_pid()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: SeongJae Park <[email protected]>
commit 4262c53236977de3ceaa3bf2aefdf772c9b874dd upstream.
Patch series "mm/damon: hide kdamond and kdamond_lock from API callers".
'kdamond' and 'kdamond_lock' fields initially exposed to DAMON API callers for flexible synchronization and use cases. As DAMON API became somewhat complicated compared to the early days, Keeping those exposed could only encourage the API callers to invent more creative but complicated and difficult-to-debug use cases.
Fortunately DAMON API callers didn't invent that many creative use cases. There exist only two use cases of 'kdamond' and 'kdamond_lock'. Finding whether the kdamond is actively running, and getting the pid of the kdamond. For the first use case, a dedicated API function, namely 'damon_is_running()' is provided, and all DAMON API callers are using the function for the use case. Hence only the second use case is where the fields are directly being used by DAMON API callers.
To prevent future invention of complicated and erroneous use cases of the fields, hide the fields from the API callers. For that, provide new dedicated DAMON API functions for the remaining use case, namely damon_kdamond_pid(), migrate DAMON API callers to use the new function, and mark the fields as private fields.
This patch (of 5):
'kdamond' and 'kdamond_lock' are directly being used by DAMON API callers for getting the pid of the corresponding kdamond. To discourage invention of creative but complicated and erroneous new usages of the fields that require careful synchronization, implement a new API function that can simply be used without the manual synchronizations.
--- include/linux/damon.h | 1 + mm/damon/core.c | 17 +++++++++++++++++ 2 files changed, 18 insertions(+)
include/linux/damon.h +1 -0
@@ -677,6 +677,7 @@ static inline unsigned int damon_max_nr_int damon_start (struct damon_ctx **ctxs,int nr_ctxs,bool exclusive);int damon_stop (struct damon_ctx **ctxs,int nr_ctxs); +int damon_kdamond_pid (struct damon_ctx *ctx);int damon_set_region_biggest_system_ram_default (struct damon_target *t,unsigned long *start,unsigned long *end);
mm/damon/core.c +17 -0
@@ -762,6 +762,23 @@ int damon_stop(struct damon_ctx **ctxs,return err; } +/** +* damon_kdamond_pid() - Return pid of a given DAMON context's worker thread. +* @ctx: The DAMON context of the question. +* +* Return: pid if @ctx is running, negative error code otherwise. +*/ +int damon_kdamond_pid (struct damon_ctx *ctx) +{ +int pid = -EINVAL ; + +mutex_lock (&ctx->kdamond_lock); +if (ctx->kdamond) + pid = ctx->kdamond->pid; +mutex_unlock (&ctx->kdamond_lock); +return pid; +} +/* * Reset the aggregated monitoring results ('nr_accesses' of each region). */
Greg Kroah-Hartman
maintainerPATCH 450/474 mm/damon/lru_sort: detect and use fresh enabled and kdamond_pid values
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: SeongJae Park <[email protected]>
commit b98b7ff6025ae82570d4915e083f0cbd8d48b3cf upstream.
DAMON_LRU_SORT updates 'enabled' and 'kdamond_pid' parameter values, which represents the running status of its kdamond, when the user explicitly requests start/stop of the kdamond. The kdamond can, however, be stopped in events other than the explicit user request in the following three events.
1. ctx->regions_score_histogram allocation failure at beginning of the execution,
2. damon_commit_ctx() failure due to invalid user input, and
3. damon_commit_ctx() failure due to its internal allocation failures.
Hence, if the kdamond is stopped by the above three events, the values of the status parameters can be stale. Users could show the stale values and be confused. This is already bad, but the real consequence is worse. DAMON_LRU_SORT avoids unnecessary damon_start() and damon_stop() calls based on the 'enabled' parameter value. And the update of 'enabled' parameter value depends on the damon_start() and damon_stop() call results. Hence, once the kdamond has stopped by the unintentional events, the user cannot restart the kdamond before the system reboot. For example, the issue can be reproduced via below steps.
# cd /sys/module/damon_lru_sort/parameters
#
# # start DAMON_LRU_SORT
# echo Y > enabled
# ps -ef | grep kdamond
root 806 2 0 17:53 ? 00:00:00 [kdamond.0]
root 808 803 0 17:53 pts/4 00:00:00 grep kdamond
#
# # commit wrong input to stop kdamond withou explicit stop request
# echo 3 > addr_unit
# echo Y > commit_inputs
bash: echo: write error: Invalid argument
#
# # confirm kdamond is stopped
# ps -ef | grep kdamond
root 811 803 0 17:53 pts/4 00:00:00 grep kdamond
#
# # users casn now show stable status
# cat enabled
Y
# cat kdamond_pid
806
#
# # even after fixing the wrong parameter,
# # kdamond cannot be restarted.
# echo 1 > addr_unit
# echo Y > enabled
# ps -ef | grep kdamond
root 815 803 0 17:54 pts/4 00:00:00 grep kdamondThe problem will only rarely happen in real and common setups for the following reasons. The allocation failures are unlikely in such setups since those allocations are arguably too small to fail. Also sane users on real production environments may not commit wrong input parameters. But once it happens, the consequence is quite bad. And the bug is a bug.
The issue stems from the fact that there are multiple events that can change the status, and following all the events is challenging. Dynamically detect and use the fresh status for the parameters when those are requested.
(port parts of 42b7491af14c ("mm/damon/core: introduce damon_call()") and d2b5be741a50 ("mm/damon/sysfs: use DAMON core API damon_is_running()") for damon_is_running() dependency)
--- include/linux/damon.h | 1 mm/damon/core.c | 16 +++++++++ mm/damon/lru_sort.c | 88 +++++++++++++++++++++++++++++++------------------- 3 files changed, 73 insertions(+), 32 deletions(-)
include/linux/damon.h +1 -0
@@ -677,6 +677,7 @@ static inline unsigned int damon_max_nr_int damon_start (struct damon_ctx **ctxs,int nr_ctxs,bool exclusive);int damon_stop (struct damon_ctx **ctxs,int nr_ctxs); +bool damon_is_running (struct damon_ctx *ctx);int damon_kdamond_pid (struct damon_ctx *ctx); int damon_set_region_biggest_system_ram_default(struct damon_target *t,
mm/damon/core.c +16 -0
@@ -763,6 +763,22 @@ int damon_stop(struct damon_ctx **ctxs, }/** +* damon_is_running() - Returns if a given DAMON context is running. +* @ctx: The DAMON context to see if running. +* +* Return: true if @ctx is running, false otherwise. +*/ +bool damon_is_running (struct damon_ctx *ctx) +{ +bool running; + +mutex_lock (&ctx->kdamond_lock); + running = ctx->kdamond !=NULL ; +mutex_unlock (&ctx->kdamond_lock); +return running; +} + +/** * damon_kdamond_pid() - Return pid of a given DAMON context's worker thread. * @ctx: The DAMON context of the question. *
mm/damon/lru_sort.c +56 -32
131 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 451/474 usb: typec: tcpm: reset internal port states on soft reset AMS
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Amit Sunil Dhamne <[email protected]>
commit 2909f0d4994fb4306bf116df5ccee797791fce2c upstream.
Reset internal port states (such as vdm_sm_running and explicit_contract) on soft reset AMS as the port needs to negotiate a new contract. The consequence of leaving the states in as-is cond are as follows:
* port is in SRC power role and an explicit contract is negotiated with the port partner (in sink role)
* port partner sends a Soft Reset AMS while VDM State Machine is running
* port accepts the Soft Reset request and the port advertises src caps
* port partner sends a Request message but since the explicit_contract and vdm_sm_running are true from previous negotiation, the port ends up sending Soft Reset instead of Accept msg.
Stub Log:
[ 203.653942] AMS DISCOVER_IDENTITY start [ 203.653947] PD TX, header: 0x176f [ 203.655901] PD TX complete, status: 0 [ 203.657470] PD RX, header: 0x124f [1] [ 203.657477] Rx VDM cmd 0xff008081 type 2 cmd 1 len 1 [ 203.657482] AMS DISCOVER_IDENTITY finished [ 203.657484] cc:=4 [ 204.155698] PD RX, header: 0x144f [1] [ 204.155718] Rx VDM cmd 0xeeee8001 type 0 cmd 1 len 1 [ 204.155741] PD TX, header: 0x196f [ 204.157622] PD TX complete, status: 0 [ 204.160060] PD RX, header: 0x4d [1] [ 204.160066] state change SRC_READY -> SOFT_RESET [rev2 SOFT_RESET_AMS] [ 204.160076] PD TX, header: 0x163 [ 204.162486] PD TX complete, status: 0 [ 204.162832] AMS SOFT_RESET_AMS finished [ 204.162840] cc:=4 [ 204.162891] AMS POWER_NEGOTIATION start [ 204.162896] state change SOFT_RESET -> AMS_START [rev2 POWER_NEGOTIATION] [ 204.162908] state change AMS_START -> SRC_SEND_CAPABILITIES [rev2 POWER_NEGOTIATION] [ 204.162913] PD TX, header: 0x1361 [ 204.165529] PD TX complete, status: 0 [ 204.165571] pending state change SRC_SEND_CAPABILITIES -> SRC_SEND_CAPABILITIES_TIMEOUT @ 60 ms [rev2 POWER_NEGOTIATION] [ 204.166996] PD RX, header: 0x1242 [1] [ 204.167009] state change SRC_SEND_CAPABILITIES -> SRC_SOFT_RESET_WAIT_SNK_TX [rev2 POWER_NEGOTIATION] [ 204.167019] AMS POWER_NEGOTIATION finished [ 204.167020] cc:=4 [ 204.167083] AMS SOFT_RESET_AMS start [ 204.167086] state change SRC_SOFT_RESET_WAIT_SNK_TX -> SOFT_RESET_SEND [rev2 SOFT_RESET_AMS] [ 204.167092] PD TX, header: 0x16d [ 204.168824] PD TX complete, status: 0 [ 204.168854] pending state change SOFT_RESET_SEND -> HARD_RESET_SEND @ 60 ms [rev2 SOFT_RESET_AMS] [ 204.171876] PD RX, header: 0x43 [1] [ 204.171879] AMS SOFT_RESET_AMS finished
This causes COMMON.PROC.PD.11.2 check failure for TEST.PD.VDM.SRC.2_Rev2Src test on the PD compliance tester.
--- drivers/usb/typec/tcpm/tcpm.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/typec/tcpm/tcpm.c +2 -0
@@ -4610,6 +4610,8 @@ static void run_state_machine(struct tcpusb_power_delivery_unregister_capabilities (port->partner_source_caps); port->partner_source_caps =NULL ;tcpm_pd_send_control (port,PD_CTRL_ACCEPT ); + port->vdm_sm_running = false; + port->explicit_contract = false;tcpm_ams_finish (port);if (port->pwr_role ==TYPEC_SOURCE ) { port->upcoming_state =SRC_SEND_CAPABILITIES ;
Greg Kroah-Hartman
maintainerPATCH 452/474 mm/damon/reclaim: detect and use fresh enabled and kdamond_pid values
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: SeongJae Park <[email protected]>
commit 64a140afa5ed1c6f5ba6d451512cbdbbab1ba339 upstream.
Patch series "mm/damon/modules: detect and use fresh status", v3.
DAMON modules including DAMON_RECLAIM, DAMON_LRU_SORT and DAMON_STAT commonly expose the kdamond running status via their parameters. Under certain scenarios including wrong user inputs and memory allocation failures, those parameter values can be stale. It can confuse users. For DAMON_RECLAIM and DAMON_LRU_SORT, it even makes the kdamond unable to be restarted before the system reboot.
The problem comes from the fact that there are multiple events for the status changes and it is difficult to follow up all the scenarios. Fix the issue by detecting and using the status on demand, instead of using a cached status that is difficult to be updated.
Patches 1-3 fix the bugs in DAMON_RECLAIM, DAMON_LRU_SORT and DAMON_STAT in the order.
This patch (of 3):
DAMON_RECLAIM updates 'enabled' and 'kdamond_pid' parameter values, which represents the running status of its kdamond, when the user explicitly requests start/stop of the kdamond. The kdamond can, however, be stopped in events other than the explicit user request in the following three events.
1. ctx->regions_score_histogram allocation failure at beginning of the execution,
2. damon_commit_ctx() failure due to invalid user input, and
3. damon_commit_ctx() failure due to its internal allocation failures.
Hence, if the kdamond is stopped by the above three events, the values of the status parameters can be stale. Users could show the stale values and be confused. This is already bad, but the real consequence is worse. DAMON_RECLAIM avoids unnecessary damon_start() and damon_stop() calls based on the 'enabled' parameter value. And the update of 'enabled' parameter value depends on the damon_start() and damon_stop() call results. Hence, once the kdamond has stopped by the unintentional events, the user cannot restart the kdamond before the system reboot. For example, the issue can be reproduced via below steps.
# cd /sys/module/damon_reclaim/parameters
#
# # start DAMON_RECLAIM
# echo Y > enabled
# ps -ef | grep kdamond
root 806 2 0 17:53 ? 00:00:00 [kdamond.0]
root 808 803 0 17:53 pts/4 00:00:00 grep kdamond
#
# # commit wrong input to stop kdamond withou explicit stop request
# echo 3 > addr_unit
# echo Y > commit_inputs
bash: echo: write error: Invalid argument
#
# # confirm kdamond is stopped
# ps -ef | grep kdamond
root 811 803 0 17:53 pts/4 00:00:00 grep kdamond
#
# # users casn now show stable status
# cat enabled
Y
# cat kdamond_pid
806
#
# # even after fixing the wrong parameter,
# # kdamond cannot be restarted.
# echo 1 > addr_unit
# echo Y > enabled
# ps -ef | grep kdamond
root 815 803 0 17:54 pts/4 00:00:00 grep kdamondThe problem will only rarely happen in real and common setups for the following reasons. The allocation failures are unlikely in such setups since those allocations are arguably too small to fail. Also sane users on real production environments may not commit wrong input parameters. But once it happens, the consequence is quite bad. And the bug is a bug.
The issue stems from the fact that there are multiple events that can change the status, and following all the events is challenging. Dynamically detect and use the fresh status for the parameters when those are requested.
--- mm/damon/reclaim.c | 88 +++++++++++++++++++++++++++++++++-------------------- 1 file changed, 56 insertions(+), 32 deletions(-)
mm/damon/reclaim.c +56 -32
@@ -107,15 +107,6 @@ module_param(monitor_region_end, ulong,static bool skip_anon__read_mostly ;module_param (skip_anon, bool,0600 ); -/* -* PID of the DAMON thread -* -* If DAMON_RECLAIM is enabled, this becomes the PID of the worker thread. -* Else, -1. -*/ -static int kdamond_pid__read_mostly =-1 ; -module_param (kdamond_pid, int,0400 ); -static struct damos_stat damon_reclaim_stat;DEFINE_DAMON_MODULES_DAMOS_STATS_PARAMS (damon_reclaim_stat, reclaim_tried_regions, reclaimed_regions, quota_exceeds);
@@ -203,60 +194,93 @@ static int damon_reclaim_turn(bool on) {int err; -if (!on) { - err =damon_stop (&ctx,1 ); -if (!err) - kdamond_pid =-1 ; -return err; - } +if (!on) +return damon_stop (&ctx,1 ); err =damon_reclaim_apply_parameters ();if (err)return err; - err =damon_start (&ctx,1 , true); -if (err) -return err; - kdamond_pid = ctx->kdamond->pid; -return 0 ; +return damon_start (&ctx,1 , true); +} + +static bool damon_reclaim_enabled (void ) +{ +if (!ctx) +return false; +return damon_is_running (ctx); }static int damon_reclaim_enabled_store (const char *val,const struct kernel_param *kp) { -bool is_enabled = enabled; -bool enable;int err; - err =kstrtobool (val, &enable); + err =kstrtobool (val, &enabled);if (err)return err; -if (is_enabled == enable) +if (damon_reclaim_enabled () == enabled)return 0 ;/* Called before init function. The function will handle this. */ if (!ctx) - goto set_param_out; +return 0 ; - err =damon_reclaim_turn (enable); -if (err) -return err; +return damon_reclaim_turn (enabled); +} -set_param_out: - enabled = enable; -return err; +static int damon_reclaim_enabled_load (char *buffer, +const struct kernel_param *kp) +{ +return sprintf (buffer,"%c\n" ,damon_reclaim_enabled () ?'Y' :'N' ); }static const struct kernel_param_ops enabled_param_ops = { .set = damon_reclaim_enabled_store, - .get = param_get_bool, + .get = damon_reclaim_enabled_load, };module_param_cb (enabled, &enabled_param_ops, &enabled,0600 );MODULE_PARM_DESC (enabled,"Enable or disable DAMON_RECLAIM (default: disabled)" ); +static int damon_reclaim_kdamond_pid_store (const char *val, +const struct kernel_param *kp) +{ +/* +* kdamond_pid is read-only, but kernel command line could write it. +* Do nothing here. +*/ +return 0 ; +} + +static int damon_reclaim_kdamond_pid_load (char *buffer, +const struct kernel_param *kp) +{ +int kdamond_pid =-1 ; + +if (ctx) { + kdamond_pid =damon_kdamond_pid (ctx); +if (kdamond_pid <0 ) + kdamond_pid =-1 ; + } +return sprintf (buffer,"%d\n" , kdamond_pid); +} + +static const struct kernel_param_ops kdamond_pid_param_ops = { + .set = damon_reclaim_kdamond_pid_store, + .get = damon_reclaim_kdamond_pid_load, +}; + +/* +* PID of the DAMON thread +* +* If DAMON_RECLAIM is enabled, this becomes the PID of the worker thread. +* Else, -1. +*/ +module_param_cb (kdamond_pid, &kdamond_pid_param_ops,NULL ,0400 ); +static int damon_reclaim_handle_commit_inputs (void ) {int err;
Greg Kroah-Hartman
maintainerPATCH 453/474 ksmbd: fix use-after-free in __ksmbd_close_fd() via durable scavenger
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namjae Jeon <[email protected]>
commit 235e32320a470fcd3998fb3774f2290a0eb302a1 upstream.
When a durable file handle survives session disconnect (TCP close without SMB2_LOGOFF), session_fd_check() sets fp->conn = NULL to preserve the handle for later reconnection. However, it did not clean up the byte-range locks on fp->lock_list.
Later, when the durable scavenger thread times out and calls __ksmbd_close_fd(NULL, fp), the lock cleanup loop did:
spin_lock(&fp->conn->llist_lock);
This caused a slab use-after-free because fp->conn was NULL and the original connection object had already been freed by ksmbd_tcp_disconnect().
The root cause is asymmetric cleanup: lock entries (smb_lock->clist) were left dangling on the freed conn->lock_list while fp->conn was nulled out.
To fix this issue properly, we need to handle the lifetime of smb_lock->clist across three paths:
- Safely skip clist deletion when list is empty and fp->conn is NULL.
- Remove the lock from the old connection's lock_list in session_fd_check()
- Re-add the lock to the new connection's lock_list in ksmbd_reopen_durable_fd().
--- fs/smb/server/vfs_cache.c | 40 ++++++++++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 10 deletions(-)
fs/smb/server/vfs_cache.c +30 -10
@@ -356,9 +356,11 @@ static void __ksmbd_close_fd(struct ksmb* there are not accesses to fp->lock_list. */ list_for_each_entry_safe (smb_lock, tmp_lock, &fp->lock_list, flist) { -spin_lock (&fp->conn->llist_lock); -list_del (&smb_lock->clist); -spin_unlock (&fp->conn->llist_lock); +if (!list_empty (&smb_lock->clist) && fp->conn) { +spin_lock (&fp->conn->llist_lock); +list_del (&smb_lock->clist); +spin_unlock (&fp->conn->llist_lock); + }list_del (&smb_lock->flist);locks_free_lock (smb_lock->fl);
@@ -755,6 +757,7 @@ static bool session_fd_check(struct ksmbstruct ksmbd_inode *ci;struct oplock_info *op;struct ksmbd_conn *conn; +struct ksmbd_lock *smb_lock, *tmp_lock;if (!is_reconnectable (fp))return false;
@@ -771,6 +774,12 @@ static bool session_fd_check(struct ksmb }up_write (&ci->m_lock); +list_for_each_entry_safe (smb_lock, tmp_lock, &fp->lock_list, flist) { +spin_lock (&fp->conn->llist_lock); +list_del_init (&smb_lock->clist); +spin_unlock (&fp->conn->llist_lock); + } + fp->conn =NULL ; fp->tcon =NULL ; fp->volatile_id =KSMBD_NO_FID ;
@@ -844,6 +853,9 @@ int ksmbd_reopen_durable_fd(struct ksmbd {struct ksmbd_inode *ci;struct oplock_info *op; +struct ksmbd_conn *conn = work->conn; +struct ksmbd_lock *smb_lock; +unsigned int old_f_state;if (!fp->is_durable || fp->conn || fp->tcon) {pr_err ("Invalid durable fd [%p:%p]\n" , fp->conn, fp->tcon);
@@ -855,9 +867,23 @@ int ksmbd_reopen_durable_fd(struct ksmbdreturn -EBADF ; } - fp->conn = work->conn; + old_f_state = fp->f_state; + fp->f_state =FP_NEW ; +__open_id (&work->sess->file_table, fp,OPEN_ID_TYPE_VOLATILE_ID ); +if (!has_file_id (fp->volatile_id)) { + fp->f_state = old_f_state; +return -EBADF ; + } + + fp->conn = conn; fp->tcon = work->tcon; +list_for_each_entry (smb_lock, &fp->lock_list, flist) { +spin_lock (&conn->llist_lock); +list_add_tail (&smb_lock->clist, &conn->lock_list); +spin_unlock (&conn->llist_lock); + } + ci = fp->f_ci;down_write (&ci->m_lock);list_for_each_entry_rcu (op, &ci->m_op_list, op_entry) {
@@ -868,12 +894,6 @@ int ksmbd_reopen_durable_fd(struct ksmbd }up_write (&ci->m_lock); -__open_id (&work->sess->file_table, fp,OPEN_ID_TYPE_VOLATILE_ID ); -if (!has_file_id (fp->volatile_id)) { - fp->conn =NULL ; - fp->tcon =NULL ; -return -EBADF ; - }return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 454/474 mtd: spi-nor: sst: Factor out common write operation to `sst_nor_write_data()`
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bence Csókás <[email protected]>
commit 18bcb4aa54eab75dce41e5c176a1c2bff94f0f79 upstream.
Writing to the Flash in sst_nor_write() is a 3-step process:
first an optional one-byte write to get 2-byte-aligned, then the bulk of the data is written out in vendor-specific 2-byte writes. Finally, if there's a byte left over, another one-byte write. This was implemented 3 times in the body of sst_nor_write(). To reduce code duplication, factor out these sub-steps to their own function.
--- drivers/mtd/spi-nor/sst.c | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-)
drivers/mtd/spi-nor/sst.c +19 -20
@@ -123,6 +123,21 @@ static const struct flash_info sst_nor_p .fixups = &sst26vf_nor_fixups }, }; +static int sst_nor_write_data (struct spi_nor *nor,loff_t to,size_t len, +const u_char *buf) +{ +u8 op = (len ==1 ) ?SPINOR_OP_BP :SPINOR_OP_AAI_WP ; +int ret; + + nor->program_opcode = op; + ret =spi_nor_write_data (nor, to,1 , buf); +if (ret <0 ) +return ret; +WARN (ret != len,"While writing %zu byte written %i bytes\n" , len, ret); + +return spi_nor_wait_till_ready (nor); +} +static int sst_nor_write (struct mtd_info *mtd,loff_t to,size_t len,size_t *retlen,const u_char *buf) {
@@ -144,16 +159,10 @@ static int sst_nor_write(struct mtd_info/* Start write from odd address. */ if (to %2 ) { - nor->program_opcode =SPINOR_OP_BP ; -/* write one byte. */ - ret =spi_nor_write_data (nor, to,1 , buf); + ret =sst_nor_write_data (nor, to,1 , buf);if (ret <0 ) goto out; -WARN (ret !=1 ,"While writing 1 byte written %i bytes\n" , ret); - ret =spi_nor_wait_till_ready (nor); -if (ret) - goto out; to++; actual++;
@@ -161,16 +170,11 @@ static int sst_nor_write(struct mtd_info/* Write out most of the data here. */ for (; actual < len -1 ; actual +=2 ) { - nor->program_opcode =SPINOR_OP_AAI_WP ; -/* write two bytes. */ - ret =spi_nor_write_data (nor, to,2 , buf + actual); + ret =sst_nor_write_data (nor, to,2 , buf + actual);if (ret <0 ) goto out; -WARN (ret !=2 ,"While writing 2 bytes written %i bytes\n" , ret); - ret =spi_nor_wait_till_ready (nor); -if (ret) - goto out; + to +=2 ; nor->sst_write_second = true; }
@@ -190,14 +194,9 @@ static int sst_nor_write(struct mtd_infoif (ret) goto out; - nor->program_opcode =SPINOR_OP_BP ; - ret =spi_nor_write_data (nor, to,1 , buf + actual); + ret =sst_nor_write_data (nor, to,1 , buf + actual);if (ret <0 ) goto out; -WARN (ret !=1 ,"While writing 1 byte written %i bytes\n" , ret); - ret =spi_nor_wait_till_ready (nor); -if (ret) - goto out; actual +=1 ;
Greg Kroah-Hartman
maintainerPATCH 455/474 mtd: spi-nor: sst: Fix write enable before AAI sequence
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sanjaikumar V S <[email protected]>
commit a0f64241d3566a49c0a9b33ba7ae458ae22003a9 upstream.
When writing to SST flash starting at an odd address, a single byte is first programmed using the byte program (BP) command. After this operation completes, the flash hardware automatically clears the Write Enable Latch (WEL) bit.
If an AAI (Auto Address Increment) word program sequence follows, it requires WEL to be set. Without re-enabling writes, the AAI sequence fails.
Add spi_nor_write_enable() after the odd-address byte program when more data needs to be written. Use a local boolean for clarity.
--- drivers/mtd/spi-nor/sst.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/mtd/spi-nor/sst.c +13 -0
@@ -159,6 +159,8 @@ static int sst_nor_write(struct mtd_info/* Start write from odd address. */ if (to %2 ) { +bool needs_write_enable = (len >1 ); +/* write one byte. */ ret =sst_nor_write_data (nor, to,1 , buf);if (ret <0 )
@@ -166,6 +168,17 @@ static int sst_nor_write(struct mtd_info to++; actual++; + +/* +* Byte program clears the write enable latch. If more +* data needs to be written using the AAI sequence, +* re-enable writes. +*/ +if (needs_write_enable) { + ret =spi_nor_write_enable (nor); +if (ret) + goto out; + } }/* Write out most of the data here. */
Greg Kroah-Hartman
maintainerPATCH 456/474 pwm: imx-tpm: Count the number of enabled channels in probe
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Viorel Suman (OSS) <[email protected]>
commit 3962c24f2d14e8a7f8a23f56b7ce320523947342 upstream.
On a soft reset TPM PWM IP may preserve its internal state from previous runtime, therefore on a subsequent OS boot and driver probe "enable_count" value and TPM PWM IP internal channels "enabled" states may get unaligned. In consequence on a suspend/resume cycle the call "if (--tpm->enable_count == 0)" may lead to "enable_count" overflow the system being blocked from entering suspend due to:
if (tpm->enable_count > 0)
return -EBUSY;
Fix the problem by counting the enabled channels in probe function.
--- drivers/pwm/pwm-imx-tpm.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/pwm/pwm-imx-tpm.c +8 -0
@@ -350,6 +350,7 @@ static int pwm_imx_tpm_probe(struct plat {struct imx_tpm_pwm_chip *tpm;int ret; +unsigned int i;u32 val; tpm =devm_kzalloc (&pdev->dev,sizeof (*tpm),GFP_KERNEL );
@@ -383,6 +384,13 @@ static int pwm_imx_tpm_probe(struct platmutex_init (&tpm->lock); +/* count the enabled channels */ +for (i =0 ; i < tpm->chip.npwm; ++i) { + val =readl (tpm->base +PWM_IMX_TPM_CnSC (i)); +if (FIELD_GET (PWM_IMX_TPM_CnSC_ELS, val)) + ++tpm->enable_count; + } + ret =pwmchip_add (&tpm->chip);if (ret) {dev_err (&pdev->dev,"failed to add PWM chip: %d\n" , ret);
Greg Kroah-Hartman
maintainerPATCH 457/474 batman-adv: stop tp_meter sessions during mesh teardown
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiexun Wang <[email protected]>
commit 3d3cf6a7314aca4df0a6dde28ce784a2a30d0166 upstream.
TP meter sessions remain linked on bat_priv->tp_list after the netlink request has already finished. When the mesh interface is removed, batadv_mesh_free() currently tears down the mesh without first draining these sessions.
A running sender thread or a late incoming tp_meter packet can then keep processing against a mesh instance which is already shutting down. Synchronize tp_meter with the mesh lifetime by stopping all active sessions from batadv_mesh_free() and waiting for sender threads to exit before teardown continues.
--- net/batman-adv/main.c | 1 net/batman-adv/tp_meter.c | 94 +++++++++++++++++++++++++++++++++++++--------- net/batman-adv/tp_meter.h | 1 net/batman-adv/types.h | 4 + 4 files changed, 82 insertions(+), 18 deletions(-)
net/batman-adv/main.c +1 -0
@@ -262,6 +262,7 @@ void batadv_mesh_free(struct net_deviceatomic_set (&bat_priv->mesh_state,BATADV_MESH_DEACTIVATING );batadv_purge_outstanding_packets (bat_priv,NULL ); +batadv_tp_stop_all (bat_priv);batadv_gw_node_free (bat_priv);
net/batman-adv/tp_meter.c +76 -18
145 lines not on this page · raw message
net/batman-adv/tp_meter.h +1 -0
@@ -17,6 +17,7 @@ void batadv_tp_start(struct batadv_priv u32 test_length, u32 *cookie);void batadv_tp_stop (struct batadv_priv *bat_priv,const u8 *dst,u8 return_value); +void batadv_tp_stop_all (struct batadv_priv *bat_priv);void batadv_tp_meter_recv (struct batadv_priv *bat_priv,struct sk_buff *skb);#endif /* _NET_BATMAN_ADV_TP_METER_H_ */
net/batman-adv/types.h +4 -0
@@ -14,6 +14,7 @@#include <linux/average.h> #include <linux/bitops.h> #include <linux/compiler.h> +#include <linux/completion.h> #include <linux/if.h> #include <linux/if_ether.h> #include <linux/kref.h>
@@ -1396,6 +1397,9 @@ struct batadv_tp_vars {/** @finish_work: work item for the finishing procedure */ struct delayed_work finish_work; +/** @finished: completion signaled when a sender thread exits */ +struct completion finished; +/** @test_length: test length in milliseconds */ u32 test_length;
Greg Kroah-Hartman
maintainerPATCH 458/474 batman-adv: tp_meter: fix tp_num leak on kmalloc failure
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sven Eckelmann <[email protected]>
commit ce425dd05d0fe7594930a0fb103634f35ac47bb6 upstream.
When batadv_tp_start() or batadv_tp_init_recv() fail to allocate a new tp_vars object, the previously incremented bat_priv->tp_num counter is never decremented. This causes tp_num to drift upward on each allocation failure. Since only BATADV_TP_MAX_NUM sessions can be started and the count is never reduced for these failed allocations, it causes to an exhaustion of throughput meter sessions. In worst case, no new throughput meter session can be started until the mesh interface is removed.
The error handling must decrement tp_num releasing the lock and aborting the creation of an throughput meter session
--- net/batman-adv/tp_meter.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
net/batman-adv/tp_meter.c +4 -1
@@ -969,6 +969,7 @@ void batadv_tp_start(struct batadv_priv *bat_priv, const u8 *dst, tp_vars =kmalloc (sizeof (*tp_vars),GFP_ATOMIC );if (!tp_vars) { +atomic_dec (&bat_priv->tp_num);spin_unlock_bh (&bat_priv->tp_list_lock); batadv_dbg(BATADV_DBG_TP_METER, bat_priv, "Meter: %s cannot allocate list elements\n",
@@ -1344,8 +1345,10 @@ batadv_tp_init_recv(struct batadv_priv *bat_priv, } tp_vars =kmalloc (sizeof (*tp_vars),GFP_ATOMIC ); -if (!tp_vars) +if (!tp_vars) { +atomic_dec (&bat_priv->tp_num); goto out_unlock; + }ether_addr_copy (tp_vars->other_end, icmp->orig); tp_vars->role =BATADV_TP_RECEIVER ;
Signature · 1 line
2.47.3
Greg Kroah-Hartman
maintainerPATCH 459/474 btrfs: fix btrfs_ioctl_space_info() slot_count TOCTOU which can lead to info-leak
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yochai Eisenrich <[email protected]>
[ Upstream commit 973e57c726c1f8e77259d1c8e519519f1e9aea77 ]
btrfs_ioctl_space_info() has a TOCTOU race between two passes over the block group RAID type lists. The first pass counts entries to determine the allocation size, then the second pass fills the buffer. The groups_sem rwlock is released between passes, allowing concurrent block group removal to reduce the entry count.
When the second pass fills fewer entries than the first pass counted, copy_to_user() copies the full alloc_size bytes including trailing uninitialized kmalloc bytes to userspace.
Fix by copying only total_spaces entries (the actually-filled count from the second pass) instead of alloc_size bytes, and switch to kzalloc so any future copy size mismatch cannot leak heap data.
--- fs/btrfs/ioctl.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
fs/btrfs/ioctl.c +3 -2
@@ -3087,7 +3087,7 @@ static long btrfs_ioctl_space_info(struct btrfs_fs_info *fs_info,return -ENOMEM ; space_args.total_spaces =0 ; - dest =kmalloc (alloc_size,GFP_KERNEL ); + dest =kzalloc (alloc_size,GFP_KERNEL );if (!dest)return -ENOMEM ; dest_orig = dest;
@@ -3143,7 +3143,8 @@ static long btrfs_ioctl_space_info(struct btrfs_fs_info *fs_info, user_dest = (struct btrfs_ioctl_space_info __user *) (arg +sizeof (struct btrfs_ioctl_space_args )); -if (copy_to_user (user_dest, dest_orig, alloc_size)) +if (copy_to_user (user_dest, dest_orig, + space_args.total_spaces *sizeof (*dest_orig))) ret = -EFAULT ;kfree (dest_orig);
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 460/474 tracing/probes: Limit size of event probe to 3K
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steven Rostedt <[email protected]>
[ Upstream commit b2aa3b4d64e460ac606f386c24e7d8a873ce6f1a ]
There currently isn't a max limit an event probe can be. One could make an event greater than PAGE_SIZE, which makes the event useless because if it's bigger than the max event that can be recorded into the ring buffer, then it will never be recorded.
A event probe should never need to be greater than 3K, so make that the max size. As long as the max is less than the max that can be recorded onto the ring buffer, it should be fine.
--- kernel/trace/trace_probe.c | 6 ++++++ kernel/trace/trace_probe.h | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-)
kernel/trace/trace_probe.c +6 -0
@@ -1366,6 +1366,12 @@ static int traceprobe_parse_probe_arg_body(const char *argv, ssize_t *size, parg->offset = *size; *size += parg->type->size * (parg->count ?:1 ); +if (*size >MAX_PROBE_EVENT_SIZE ) { + ret = -E2BIG ; +trace_probe_log_err (ctx->offset,EVENT_TOO_BIG ); + goto fail; + } +if (parg->count) { len =strlen (parg->type->fmttype) +6 ; parg->fmt =kmalloc (len,GFP_KERNEL );
kernel/trace/trace_probe.h +3 -1
@@ -35,6 +35,7 @@#define MAX_ARG_NAME_LEN 32#define MAX_BTF_ARGS_LEN 128#define MAX_STRING_SIZE PATH_MAX +#define MAX_PROBE_EVENT_SIZE 3072/* Reserved field names */ #define FIELD_STRING_IP "__probe_ip"
@@ -546,7 +547,8 @@ extern int traceprobe_define_arg_fields(struct trace_event_call *event_call,C (NO_BTF_FIELD ,"This field is not found." ), \C (BAD_BTF_TID ,"Failed to get BTF type info." ),\C (BAD_TYPE4STR ,"This type does not fit for string." ),\ -C (NEED_STRING_TYPE ,"$comm and immediate-string only accepts string type" ), +C (NEED_STRING_TYPE ,"$comm and immediate-string only accepts string type" ),\ +C (EVENT_TOO_BIG ,"Event too big (too many fields?)" ), #undef C #define C(a, b) TP_ERR_##a
Signature · 1 line
2.53.0
Greg Kroah-Hartman
maintainerPATCH 461/474 usb: dwc3: Move GUID programming after PHY initialization
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Selvarasu Ganesan <[email protected]>
[ Upstream commit aad35f9c926ec220b0742af1ada45666ae667956 ]
The Linux Version Code is currently written to the GUID register before PHY initialization. Certain PHY implementations (such as Synopsys eUSB PHY performing link_sw_reset) clear the GUID register to its default value during initialization, causing the kernel version information to be lost.
Move the GUID register programming to occur after PHY initialization completes to ensure the Linux version information persists.
--- drivers/usb/dwc3/core.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/usb/dwc3/core.c +6 -6
@@ -1240,12 +1240,6 @@ static int dwc3_core_init(struct dwc3 *d hw_mode =DWC3_GHWPARAMS0_MODE (dwc->hwparams.hwparams0); -/* -* Write Linux Version Code to our GUID register so it's easy to figure -* out which kernel version a bug was found. -*/ -dwc3_writel (dwc->regs,DWC3_GUID ,LINUX_VERSION_CODE ); - ret =dwc3_phy_setup (dwc);if (ret)return ret;
@@ -1277,6 +1271,12 @@ static int dwc3_core_init(struct dwc3 *dif (ret) goto err_exit_phy; +/* +* Write Linux Version Code to our GUID register so it's easy to figure +* out which kernel version a bug was found. +*/ +dwc3_writel (dwc->regs,DWC3_GUID ,LINUX_VERSION_CODE ); +dwc3_core_setup_global_control (dwc);dwc3_core_num_eps (dwc);
Greg Kroah-Hartman
maintainerPATCH 462/474 ceph: only d_add() negative dentries when they are unhashed
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Max Kellermann <[email protected]>
[ Upstream commit 803447f93d75ab6e40c85e6d12b5630d281d70d6 ]
Ceph can call d_add(dentry, NULL) on a negative dentry that is already present in the primary dcache hash.
In the current VFS that is not safe. d_add() goes through __d_add() to __d_rehash(), which unconditionally reinserts dentry->d_hash into the hlist_bl bucket. If the dentry is already hashed, reinserting the same node can corrupt the bucket, including creating a self-loop. Once that happens, __d_lookup() can spin forever in the hlist_bl walk, typically looping only on the d_name.hash mismatch check and eventually triggering RCU stall reports like this one:
rcu: INFO: rcu_sched self-detected stall on CPU rcu: 87-....: (2100 ticks this GP) idle=3a4c/1/0x4000000000000000 softirq=25003319/25003319 fqs=829 rcu: (t=2101 jiffies g=79058445 q=698988 ncpus=192) CPU: 87 UID: 2952868916 PID: 3933303 Comm: php-cgi8.3 Not tainted 6.18.17-i1-amd #950 NONE Hardware name: Dell Inc. PowerEdge R7615/0G9DHV, BIOS 1.6.6 09/22/2023 RIP: 0010:__d_lookup+0x46/0xb0 Code: c1 e8 07 48 8d 04 c2 48 8b 00 49 89 fc 49 89 f5 48 89 c3 48 83 e3 fe 48 83 f8 01 77 0f eb 2d 0f 1f 44 00 00 48 8b 1b 48 85 db <74> 20 39 6b 18 75 f3 48 8d 7b 78 e8 ba 85 d0 00 4c 39 63 10 74 1f RSP: 0018:ff745a70c8253898 EFLAGS: 00000282 RAX: ff26e470054cb208 RBX: ff26e470054cb208 RCX: 000000006e958966 RDX: ff26e48267340000 RSI: ff745a70c82539b0 RDI: ff26e458f74655c0 RBP: 000000006e958966 R08: 0000000000000180 R09: 9cd08d909b919a89 R10: ff26e458f74655c0 R11: 0000000000000000 R12: ff26e458f74655c0 R13: ff745a70c82539b0 R14: d0d0d0d0d0d0d0d0 R15: 2f2f2f2f2f2f2f2f FS: 00007f5770896980(0000) GS:ff26e482c5d88000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f5764de50c0 CR3: 000000a72abb5001 CR4: 0000000000771ef0 PKRU: 55555554 Call Trace: <TASK> lookup_fast+0x9f/0x100 walk_component+0x1f/0x150 link_path_walk+0x20e/0x3d0 path_lookupat+0x68/0x180 filename_lookup+0xdc/0x1e0 vfs_statx+0x6c/0x140 vfs_fstatat+0x67/0xa0 __do_sys_newfstatat+0x24/0x60 do_syscall_64+0x6a/0x230 entry_SYSCALL_64_after_hwframe+0x76/0x7e
This is reachable with reused cached negative dentries. A Ceph lookup or atomic_open can be handed a negative dentry that is already hashed, and fs/ceph/dir.c then hits one of two paths that incorrectly assume "negative" also means "unhashed":
- ceph_finish_lookup():
MDS reply is -ENOENT with no trace
-> d_add(dentry, NULL)
- ceph_lookup():
local ENOENT fast path for a complete directory with shared caps -> d_add(dentry, NULL)
Both paths can therefore re-add an already-hashed negative dentry.
Ceph already uses the correct pattern elsewhere: ceph_fill_trace() only calls d_add(dn, NULL) for a negative null-dentry reply when d_unhashed(dn) is true.
Fix both fs/ceph/dir.c sites the same way: only call d_add() for a negative dentry when it is actually unhashed. If the negative dentry is already hashed, leave it in place and reuse it as-is.
This preserves the existing behavior for unhashed dentries while avoiding d_hash list corruption for reused hashed negatives.
--- fs/ceph/dir.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
fs/ceph/dir.c +4 -2
@@ -745,7 +745,8 @@ struct dentry *ceph_finish_lookup(structd_drop (dentry); err = -ENOENT ; }else { -d_add (dentry,NULL ); +if (d_unhashed (dentry)) +d_add (dentry,NULL ); } } }
@@ -813,7 +814,8 @@ static struct dentry *ceph_lookup(struct__ceph_touch_fmode (ci, mdsc,CEPH_FILE_MODE_RD );spin_unlock (&ci->i_ceph_lock);dout (" dir %p complete, -ENOENT\n" , dir); -d_add (dentry,NULL ); +if (d_unhashed (dentry)) +d_add (dentry,NULL ); di->lease_shared_gen =atomic_read (&ci->i_shared_gen);return NULL ; }
Greg Kroah-Hartman
maintainerPATCH 463/474 KVM: arm64: Wake-up from WFI when iqrchip is in userspace
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marc Zyngier <[email protected]>
commit 4ce98bf0865c349e7026ad9c14f48da264920953 upstream
It appears that there is nothing in the wake-up path that evaluates whether the in-kernel interrupts are pending unless we have a vgic.
This means that the userspace irqchip support has been broken for about four years, and nobody noticed. It was also broken before as we wouldn't wake-up on a PMU interrupt, but hey, who cares...
It is probably time to remove the feature altogether, because it was a terrible idea 10 years ago, and it still is.
--- arch/arm64/kvm/arm.c | 5 +++++ 1 file changed, 5 insertions(+)
arch/arm64/kvm/arm.c +5 -0
@@ -557,6 +557,11 @@ int kvm_arch_vcpu_ioctl_set_mpstate(struint kvm_arch_vcpu_runnable (struct kvm_vcpu *v) {bool irq_lines = *vcpu_hcr (v) & (HCR_VI |HCR_VF ); + + irq_lines |= (!irqchip_in_kernel (v->kvm) && + (kvm_timer_should_notify_user (v) || +kvm_pmu_should_notify_user (v))); +return ((irq_lines ||kvm_vgic_vcpu_pending_irq (v)) && !kvm_arm_vcpu_stopped (v) && !v->arch.pause); }
Greg Kroah-Hartman
maintainerPATCH 464/474 vsock: fix buffer size clamping order
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Norbert Szetei <[email protected]>
commit d114bfdc9b76bf93b881e195b7ec957c14227bab upstream.
In vsock_update_buffer_size(), the buffer size was being clamped to the maximum first, and then to the minimum. If a user sets a minimum buffer size larger than the maximum, the minimum check overrides the maximum check, inverting the constraint.
This breaks the intended socket memory boundaries by allowing the vsk->buffer_size to grow beyond the configured vsk->buffer_max_size.
Fix this by checking the minimum first, and then the maximum. This ensures the buffer size never exceeds the buffer_max_size.
--- net/vmw_vsock/af_vsock.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
net/vmw_vsock/af_vsock.c +3 -3
@@ -1728,12 +1728,12 @@ static void vsock_update_buffer_size(strconst struct vsock_transport *transport, u64 val) { - if (val > vsk->buffer_max_size) - val = vsk->buffer_max_size; - if (val < vsk->buffer_min_size) val = vsk->buffer_min_size; +if (val > vsk->buffer_max_size) + val = vsk->buffer_max_size; +if (val != vsk->buffer_size && transport && transport->notify_buffer_size) transport->notify_buffer_size (vsk, &val);
Greg Kroah-Hartman
maintainerPATCH 465/474 vsock/virtio: fix accept queue count leak on transport mismatch
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dudu Lu <[email protected]>
commit 52bcb57a4e8a0865a76c587c2451906342ae1b2d upstream.
virtio_transport_recv_listen() calls sk_acceptq_added() before vsock_assign_transport(). If vsock_assign_transport() fails or selects a different transport, the error path returns without calling sk_acceptq_removed(), permanently incrementing sk_ack_backlog.
After approximately backlog+1 such failures, sk_acceptq_is_full() returns true, causing the listener to reject all new connections.
Fix by moving sk_acceptq_added() to after the transport validation, matching the pattern used by vmci_transport and hyperv_transport.
--- net/vmw_vsock/virtio_transport_common.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
net/vmw_vsock/virtio_transport_common.c +1 -2
@@ -1353,8 +1353,6 @@ virtio_transport_recv_listen(struct sockreturn -ENOMEM ; } -sk_acceptq_added (sk); -lock_sock_nested (child,SINGLE_DEPTH_NESTING ); child->sk_state =TCP_ESTABLISHED ;
@@ -1376,6 +1374,7 @@ virtio_transport_recv_listen(struct sockreturn ret; } +sk_acceptq_added (sk);if (virtio_transport_space_update (child, skb)) child->sk_write_space (child);
Greg Kroah-Hartman
maintainerPATCH 466/474 vsock/virtio: fix length and offset in tap skb for split packets
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefano Garzarella <[email protected]>
commit 5f344d809e015fba3709e5219428c00b8ac5d7df upstream.
virtio_transport_build_skb() builds a new skb to be delivered to the vsockmon tap device. To build the new skb, it uses the original skb data length as payload length, but as the comment notes, the original packet stored in the skb may have been split in multiple packets, so we need to use the length in the header, which is correctly updated before the packet is delivered to the tap, and the offset for the data.
This was also similar to what we did before commit 71dc9ec9ac7d ("virtio/vsock: replace virtio_vsock_pkt with sk_buff") where we probably missed something during the skb conversion.
Also update the comment above, which was left stale by the skb conversion and still mentioned a buffer pointer that no longer exists.
[LL: Fixed conflict since this tree does not use the offset added by commit
0df7cd3c13e4 ("vsock/virtio/vhost: read data from non-linear skb")]
--- net/vmw_vsock/virtio_transport_common.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
net/vmw_vsock/virtio_transport_common.c +4 -4
@@ -122,12 +122,12 @@ static struct sk_buff *virtio_transport_size_t payload_len;void *payload_buf; -/* A packet could be split to fit the RX buffer, so we can retrieve -* the payload length from the header and the buffer pointer taking -* care of the offset in the original packet. +/* A packet could be split to fit the RX buffer, so we use +* the payload length from the header, which has been updated +* by the sender to reflect the fragment size. */ pkt_hdr =virtio_vsock_hdr (pkt); - payload_len = pkt->len; + payload_len =le32_to_cpu (pkt_hdr->len); payload_buf = pkt->data; skb = alloc_skb(sizeof(*hdr) + sizeof(*pkt_hdr) + payload_len,
Greg Kroah-Hartman
maintainerPATCH 467/474 vsock/virtio: fix potential unbounded skb queue
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
commit 059b7dbd20a6f0c539a45ddff1573cb8946685b5 upstream.
virtio_transport_inc_rx_pkt() checks vvs->rx_bytes + len > vvs->buf_alloc.
virtio_transport_recv_enqueue() skips coalescing for packets with VIRTIO_VSOCK_SEQ_EOM.
If fed with packets with len == 0 and VIRTIO_VSOCK_SEQ_EOM, a very large number of packets can be queued because vvs->rx_bytes stays at 0.
Fix this by estimating the skb metadata size:
(Number of skbs in the queue) * SKB_TRUESIZE(0)
[LL: Fixed conflict since this tree does not use buf_used added by commit
45ca7e9f0730 ("vsock/virtio: fix rx_bytes accounting for stream sockets")]
--- net/vmw_vsock/virtio_transport_common.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/vmw_vsock/virtio_transport_common.c +3 -1
@@ -283,7 +283,9 @@ static int virtio_transport_send_pkt_infstatic bool virtio_transport_inc_rx_pkt (struct virtio_vsock_sock *vvs,u32 len) { -if (vvs->rx_bytes + len > vvs->buf_alloc) +u64 skb_overhead = (skb_queue_len (&vvs->rx_queue) +1 ) *SKB_TRUESIZE (0 ); + +if (skb_overhead + vvs->rx_bytes + len > vvs->buf_alloc)return false; vvs->rx_bytes += len;
Greg Kroah-Hartman
maintainerPATCH 468/474 drm/amdgpu/vcn3: Avoid overflow on msg bound check
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Benjamin Cheng <[email protected]>
commit e6e9faba8100628990cccd13f0f044a648c303cf upstream.
As pointed out by SDL, the previous condition may be vulnerable to overflow.
--- drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c +3 -1
@@ -1852,6 +1852,7 @@ static int vcn_v3_0_dec_msg(struct amdgpfor (i =0 , msg = &msg[6 ]; i < num_buffers; ++i, msg +=4 ) {uint32_t offset, size, *create; +uint64_t buf_end;if (msg[0 ] !=RDECODE_MESSAGE_CREATE )continue ;
@@ -1859,7 +1860,8 @@ static int vcn_v3_0_dec_msg(struct amdgp offset = msg[1 ]; size = msg[2 ]; -if (size <4 || offset + size > end - addr) { +if (size <4 ||check_add_overflow (offset, size, &buf_end) || + buf_end > end - addr) {DRM_ERROR ("VCN message buffer exceeds BO bounds!\n" ); r = -EINVAL ; goto out;
Greg Kroah-Hartman
maintainerPATCH 469/474 drm/amdgpu/vcn4: Avoid overflow on msg bound check
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Benjamin Cheng <[email protected]>
commit 65bce27ea6192320448c30267ffc17ffa094e713 upstream.
As pointed out by SDL, the previous condition may be vulnerable to overflow.
--- drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c +3 -1
@@ -1731,6 +1731,7 @@ static int vcn_v4_0_dec_msg(struct amdgpfor (i =0 , msg = &msg[6 ]; i < num_buffers; ++i, msg +=4 ) {uint32_t offset, size, *create; +uint64_t buf_end;if (msg[0 ] !=RDECODE_MESSAGE_CREATE )continue ;
@@ -1738,7 +1739,8 @@ static int vcn_v4_0_dec_msg(struct amdgp offset = msg[1 ]; size = msg[2 ]; -if (size <4 || offset + size > end - addr) { +if (size <4 ||check_add_overflow (offset, size, &buf_end) || + buf_end > end - addr) {DRM_ERROR ("VCN message buffer exceeds BO bounds!\n" ); r = -EINVAL ; goto out;
Greg Kroah-Hartman
maintainerPATCH 470/474 mtd: spi-nor: sst: Fix SST write failure
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Amit Kumar Mahapatra <[email protected]>
commit 539bd20352832b9244238a055eb169ccf1c41ff6 upstream.
'commit 18bcb4aa54ea ("mtd: spi-nor: sst: Factor out common write operation to sst_nor_write_data()")' introduced a bug where only one byte of data is written, regardless of the number of bytes passed to sst_nor_write_data(), causing a kernel crash during the write operation. Ensure the correct number of bytes are written as passed to sst_nor_write_data().
Call trace: [ 57.400180] ------------[ cut here ]------------ [ 57.404842] While writing 2 byte written 1 bytes [ 57.409493] WARNING: CPU: 0 PID: 737 at drivers/mtd/spi-nor/sst.c:187 sst_nor_write_data+0x6c/0x74 [ 57.418464] Modules linked in: [ 57.421517] CPU: 0 UID: 0 PID: 737 Comm: mtd_debug Not tainted 6.12.0-g5ad04afd91f9 #30 [ 57.429517] Hardware name: Xilinx Versal A2197 Processor board revA - x-prc-02 revA (DT) [ 57.437600] pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--) [ 57.444557] pc : sst_nor_write_data+0x6c/0x74 [ 57.448911] lr : sst_nor_write_data+0x6c/0x74 [ 57.453264] sp : ffff80008232bb40 [ 57.456570] x29: ffff80008232bb40 x28: 0000000000010000 x27: 0000000000000001 [ 57.463708] x26: 000000000000ffff x25: 0000000000000000 x24: 0000000000000000 [ 57.470843] x23: 0000000000010000 x22: ffff80008232bbf0 x21: ffff000816230000 [ 57.477978] x20: ffff0008056c0080 x19: 0000000000000002 x18: 0000000000000006 [ 57.485112] x17: 0000000000000000 x16: 0000000000000000 x15: ffff80008232b580 [ 57.492246] x14: 0000000000000000 x13: ffff8000816d1530 x12: 00000000000004a4 [ 57.499380] x11: 000000000000018c x10: ffff8000816fd530 x9 : ffff8000816d1530 [ 57.506515] x8 : 00000000fffff7ff x7 : ffff8000816fd530 x6 : 0000000000000001 [ 57.513649] x5 : 0000000000000000 x4 : 0000000000000000 x3 : 0000000000000000 [ 57.520782] x2 : 0000000000000000 x1 : 0000000000000000 x0 : ffff0008049b0000 [ 57.527916] Call trace: [ 57.530354] sst_nor_write_data+0x6c/0x74 [ 57.534361] sst_nor_write+0xb4/0x18c [ 57.538019] mtd_write_oob_std+0x7c/0x88 [ 57.541941] mtd_write_oob+0x70/0xbc [ 57.545511] mtd_write+0x68/0xa8 [ 57.548733] mtdchar_write+0x10c/0x290 [ 57.552477] vfs_write+0xb4/0x3a8 [ 57.555791] ksys_write+0x74/0x10c [ 57.559189] __arm64_sys_write+0x1c/0x28 [ 57.563109] invoke_syscall+0x54/0x11c [ 57.566856] el0_svc_common.constprop.0+0xc0/0xe0 [ 57.571557] do_el0_svc+0x1c/0x28 [ 57.574868] el0_svc+0x30/0xcc [ 57.577921] el0t_64_sync_handler+0x120/0x12c [ 57.582276] el0t_64_sync+0x190/0x194 [ 57.585933] ---[ end trace 0000000000000000 ]---
--- drivers/mtd/spi-nor/sst.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/spi-nor/sst.c +1 -1
@@ -130,7 +130,7 @@ static int sst_nor_write_data(struct spiint ret; nor->program_opcode = op; - ret =spi_nor_write_data (nor, to,1 , buf); + ret =spi_nor_write_data (nor, to, len, buf);if (ret <0 )return ret;WARN (ret != len,"While writing %zu byte written %i bytes\n" , len, ret);
Greg Kroah-Hartman
maintainerPATCH 471/474 Bluetooth: MGMT: Fix memory leak in set_ssp_complete
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jianpeng Chang <[email protected]>
commit 1b9c17fd0a7fdcbe69ec5d6fe8e50bc5ed7f01f2 upstream.
Fix memory leak in set_ssp_complete() where mgmt_pending_cmd structures are not freed after being removed from the pending list.
Commit 302a1f674c00 ("Bluetooth: MGMT: Fix possible UAFs") replaced mgmt_pending_foreach() calls with individual command handling but missed adding mgmt_pending_free() calls in both error and success paths of set_ssp_complete(). Other completion functions like set_le_complete() were fixed correctly in the same commit.
This causes a memory leak of the mgmt_pending_cmd structure and its associated parameter data for each SSP command that completes.
Add the missing mgmt_pending_free(cmd) calls in both code paths to fix the memory leak. Also fix the same issue in set_advertising_complete().
--- net/bluetooth/mgmt.c | 3 +++ 1 file changed, 3 insertions(+)
net/bluetooth/mgmt.c +3 -0
@@ -1937,6 +1937,7 @@ static void set_ssp_complete(struct hci_ }mgmt_cmd_status (cmd->sk, cmd->hdev->id, cmd->opcode, mgmt_err); +mgmt_pending_free (cmd);return ; }
@@ -1955,6 +1956,7 @@ static void set_ssp_complete(struct hci_sock_put (match.sk);hci_update_eir_sync (hdev); +mgmt_pending_free (cmd); }static int set_ssp_sync (struct hci_dev *hdev,void *data)
@@ -6452,6 +6454,7 @@ static void set_advertising_complete(strhci_dev_clear_flag (hdev,HCI_ADVERTISING );settings_rsp (cmd, &match); +mgmt_pending_free (cmd);new_settings (hdev, match.sk);
Greg Kroah-Hartman
maintainerPATCH 472/474 crypto: nx - fix context leak in nx842_crypto_free_ctx
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thorsten Blum <[email protected]>
commit 344e6a4f7ff4756b9b3f75e0eb7eaec297e35540 upstream.
Since the scomp conversion, nx842_crypto_alloc_ctx() allocates the context separately, but nx842_crypto_free_ctx() never releases it. Add the missing kfree(ctx) to nx842_crypto_free_ctx(), and reuse nx842_crypto_free_ctx() in the allocation error path.
--- drivers/crypto/nx/nx-842.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/crypto/nx/nx-842.c +2 -4
@@ -115,10 +115,7 @@ void *nx842_crypto_alloc_ctx(struct nx84 ctx->sbounce = (u8 *)__get_free_pages (GFP_KERNEL ,BOUNCE_BUFFER_ORDER ); ctx->dbounce = (u8 *)__get_free_pages (GFP_KERNEL ,BOUNCE_BUFFER_ORDER );if (!ctx->wmem || !ctx->sbounce || !ctx->dbounce) { -kfree (ctx->wmem); -free_pages ((unsigned long )ctx->sbounce,BOUNCE_BUFFER_ORDER ); -free_pages ((unsigned long )ctx->dbounce,BOUNCE_BUFFER_ORDER ); -kfree (ctx); +nx842_crypto_free_ctx (ctx);return ERR_PTR (-ENOMEM ); }
@@ -133,6 +130,7 @@ void nx842_crypto_free_ctx(void *p)kfree (ctx->wmem);free_pages ((unsigned long )ctx->sbounce,BOUNCE_BUFFER_ORDER );free_pages ((unsigned long )ctx->dbounce,BOUNCE_BUFFER_ORDER ); +kfree (ctx); }EXPORT_SYMBOL_GPL (nx842_crypto_free_ctx);
Greg Kroah-Hartman
maintainerPATCH 473/474 Bluetooth: MGMT: Fix dangling pointer on mgmt_add_adv_patterns_monitor_complete
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luiz Augusto von Dentz <[email protected]>
commit 5f5fa4cd35f707344f65ce9e225b6528691dbbaa upstream.
This fixes the condition checking so mgmt_pending_valid is executed whenever status != -ECANCELED otherwise calling mgmt_pending_free(cmd) would kfree(cmd) without unlinking it from the list first, leaving a dangling pointer. Any subsequent list traversal (e.g., mgmt_pending_foreach during __mgmt_power_off, or another mgmt_pending_valid call) would dereference freed memory.
--- net/bluetooth/mgmt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/bluetooth/mgmt.c +1 -1
@@ -5332,7 +5332,7 @@ static void mgmt_add_adv_patterns_monito* hci_adv_monitors_clear is about to be called which will take care of * freeing the adv_monitor instances. */ -if (status == -ECANCELED && !mgmt_pending_valid (hdev, cmd)) +if (status == -ECANCELED || !mgmt_pending_valid (hdev, cmd))return ; monitor = cmd->user_data;
Greg Kroah-Hartman
maintainerPATCH 474/474 smb: client: use kzalloc to zero-initialize security descriptor buffer
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bjoern Doebel <[email protected]>
commit 5e489c6c47a2ac15edbaca153b9348e42c1eacab upstream.
Commit 62e7dd0a39c2d ("smb: common: change the data type of num_aces to le16") split struct smb_acl's __le32 num_aces field into __le16 num_aces and __le16 reserved. The reserved field corresponds to Sbz2 in the MS-DTYP ACL wire format, which must be zero [1].
When building an ACL descriptor in build_sec_desc(), we are using a kmalloc()'ed descriptor buffer and writing the fields explicitly using le16() writes now. This never writes to the 2 byte reserved field, leaving it as uninitialized heap data.
When the reserved field happens to contain non-zero slab garbage, Samba rejects the security descriptor with "ndr_pull_security_descriptor
failed: Range Error", causing chmod to fail with EINVAL.
Change kmalloc() to kzalloc() to ensure the entire buffer is zero-initialized.
--- fs/smb/client/cifsacl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/smb/client/cifsacl.c +1 -1
@@ -1766,7 +1766,7 @@ id_mode_to_cifs_acl(struct inode *inode,* descriptor parameters, and security descriptor itself */ nsecdesclen =max_t (u32, nsecdesclen,DEFAULT_SEC_DESC_LEN ); - pnntsd =kmalloc (nsecdesclen,GFP_KERNEL ); + pnntsd =kzalloc (nsecdesclen,GFP_KERNEL );if (!pnntsd) {kfree (pntsd);cifs_put_tlink (tlink);
Build tested in our x86,arm64,loongarch,riscv config successfully without error.
BRs
Wentao Guan
Log:
Linux version 6.6.140-rc1-arm64-desktop-hwe-g7a0265922ac4-dirty (guanwentao@uos-PC) (aarch64-linux-gnu-gcc-12 (Deepin 12.3.0-17deepin8) 12.3.0, GNU ld (GNU Binutils for Deepin) 2.41) # SMP PREEMPT
Linux version 6.6.140-rc1-arm64-desktop-hwe-g7a0265922ac4-dirty (guanwentao@uos-PC) (aarch64-linux-gnu-gcc-12 (Deepin 12.3.0-17deepin8) 12.3.0, GNU ld (GNU Binutils for Deepin) 2.41) #25.01.01.23 SMP PREEMPT Sat May 16 02:47:56 CST 2026 Linux version 6.6.140-rc1-loong64-desktop-hwe-g7a0265922ac4-dirty (guanwentao@uos-PC) (loongarch64-linux-gnu-gcc-12 (Deepin 12.3.0-17deepin8) 12.3.0, GNU ld (GNU Binutils for Deepin) 2.41) # SMP PREEMPT Linux version 6.6.140-rc1-loong64-desktop-hwe-g7a0265922ac4-dirty (guanwentao@uos-PC) (loongarch64-linux-gnu-gcc-12 (Deepin 12.3.0-17deepin8) 12.3.0, GNU ld (GNU Binutils for Deepin) 2.41) #25.01.01.23 SMP PREEMPT Sat May 16 03:02:51 CST 2026 Linux version 6.6.140-rc1-riscv64-desktop-hwe+ (guanwentao@uos-PC) (riscv64-linux-gnu-gcc-12 (Deepin 12.3.0-17deepin8) 12.3.0, GNU ld (GNU Binutils for Deepin) 2.41) # SMP
Linux version 6.6.140-rc1-riscv64-desktop-hwe+ (guanwentao@uos-PC) (riscv64-linux-gnu-gcc-12 (Deepin 12.3.0-17deepin8) 12.3.0, GNU ld (GNU Binutils for Deepin) 2.41) #25.01.01.23 SMP Sat May 16 03:17:21 CST 2026 Linux version 6.6.140-rc1-amd64-desktop-hwe-g7a0265922ac4-dirty (guanwentao@uos-PC) (gcc (Deepin 12.3.0-17deepin15) 12.3.0, GNU ld (GNU Binutils for Deepin) 2.41) # SMP PREEMPT_DYNAMIC
Linux version 6.6.140-rc1-amd64-desktop-hwe-g7a0265922ac4-dirty (guanwentao@uos-PC) (gcc (Deepin 12.3.0-17deepin15) 12.3.0, GNU ld (GNU Binutils for Deepin) 2.41) #25.01.01.23 SMP PREEMPT_DYNAMIC Sat May 16 02:31:39 CST 2026
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.6.140 release. There are 474 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 Sun, 17 May 2026 15:46:37 +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.6.140-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.6.y
and the diffstat can be found below.thanks,
greg k-h
On ARCH_BRCMSTB using 32-bit and 64-bit ARM kernels, build tested on BMIPS_GENERIC:
Signature · 1 line
Florian
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.6.140 release. There are 474 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 Sun, 17 May 2026 15:46:37 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.6.140-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.6.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
Am 15.05.2026 um 17:41 schrieb Greg Kroah-Hartman:
Quoted 4 lines
This is the start of the stable review cycle for the 6.6.140 release. There are 474 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]
Quoted 8 lines · On Fri, 15 May 2026 17:41:49 +0200 Greg Kroah-Hartman…
This is the start of the stable review cycle for the 6.6.140 release. There are 474 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 Sun, 17 May 2026 15:46:37 +0000. Anything received after that time might be too late.
Boot-tested under QEMU for Rust x86_64:
Thanks!
Cheers,
Miguel
Quoted 4 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.6.140 release. There are 474 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.
Hi!
Quoted 4 lines
This is the start of the stable review cycle for the 6.6.140 release. There are 474 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.6.y
Best regards,
Pavel
# Librecast Test Results
020/020 [ OK ] liblcrq
010/010 [ OK ] libmld
120/120 [ OK ] liblibrecast
CPU/kernel: Linux auntie 6.6.140-rc1-g7a0265922ac4 #1 SMP PREEMPT_DYNAMIC Sat May 16 09:14:33 -00 2026 x86_64 AMD Ryzen 9 9950X 16-Core Processor AuthenticAMD GNU/Linux
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.6.140 release. There are 474 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 Sun, 17 May 2026 15:46:37 +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.6.140-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.6.y
and the diffstat can be found below.thanks,
greg k-h
Built and booted successfully on RISC-V RV64 (HiFive Unmatched).
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.6.140 release. There are 474 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 Sun, 17 May 2026 15:46:37 +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.6.140-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.6.y
and the diffstat can be found below.thanks,
greg k-h
Tested on an amd64 laptop (Lenovo ThinkPad T14 Gen 1). Working well, no regressions observed.
Signature · 1 line
-Barry K. Nathan <[email protected]>
Hi!
Quoted 4 lines
This is the start of the stable review cycle for the 6.6.140 release. There are 474 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.6.y
Best regards,
Pavel
Build tested in our x86,arm64,loongarch config successfully without error.
Failed in riscv config,
you can revert af7b502c916a4950d697b67f5e39c19cfeb5da4b to build ok.
BRs
Wentao Guan
Log:arch/riscv/net/bpf_jit_comp64.c: In function ‘arch_prepare_bpf_trampoline’:arch/riscv/net/bpf_jit_comp64.c:1064:9: error: implicit declaration of function ‘bpf_flush_icache’ [-Werror=implicit-function-declaration]
1064 | bpf_flush_icache(ctx.insns, ctx.insns + ctx.ninsns);
| ^~~~~~~~~~~~~~~~cc1: some warnings being treated as errors