5.4.300-rc1 review
Subsystems (2)
Greg Kroah-Hartman
maintainerPATCH 1/81 usb: hub: Fix flushing of delayed work used for post resume purposes
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mathias Nyman <[email protected]>
commit 9bd9c8026341f75f25c53104eb7e656e357ca1a2 upstream.
Delayed work that prevents USB3 hubs from runtime-suspending too early needed to be flushed in hub_quiesce() to resolve issues detected on QC SC8280XP CRD board during suspend resume testing.
This flushing did however trigger new issues on Raspberry Pi 3B+, which doesn't have USB3 ports, and doesn't queue any post resume delayed work.
The flushed 'hub->init_work' item is used for several purposes, and is originally initialized with a 'NULL' work function. The work function is also changed on the fly, which may contribute to the issue.
Solve this by creating a dedicated delayed work item for post resume work, and flush that delayed work in hub_quiesce()
--- drivers/usb/core/hub.c | 21 ++++++++------------- drivers/usb/core/hub.h | 1 + 2 files changed, 9 insertions(+), 13 deletions(-)
drivers/usb/core/hub.c +8 -13
@@ -1030,12 +1030,11 @@ int usb_remove_device(struct usb_deviceenum hub_activation_type {HUB_INIT ,HUB_INIT2 ,HUB_INIT3 ,/* INITs must come first */ -HUB_POST_RESET ,HUB_RESUME ,HUB_RESET_RESUME ,HUB_POST_RESUME , +HUB_POST_RESET ,HUB_RESUME ,HUB_RESET_RESUME , };static void hub_init_func2 (struct work_struct *ws);static void hub_init_func3 (struct work_struct *ws); -static void hub_post_resume (struct work_struct *ws);static void hub_activate (struct usb_hub *hub,enum hub_activation_type type) {
@@ -1059,12 +1058,6 @@ static void hub_activate(struct usb_hub goto init3; } -if (type ==HUB_POST_RESUME ) { -usb_autopm_put_interface_async (to_usb_interface (hub->intfdev)); -kref_put (&hub->kref, hub_release); -return ; - } -kref_get (&hub->kref);/* The superspeed hub except for root hub has to use Hub Depth
@@ -1318,8 +1311,8 @@ static void hub_activate(struct usb_hubusb_autopm_get_interface_no_resume (to_usb_interface (hub->intfdev)); -INIT_DELAYED_WORK (&hub->init_work, hub_post_resume); -queue_delayed_work (system_power_efficient_wq, &hub->init_work, +queue_delayed_work (system_power_efficient_wq, + &hub->post_resume_work,msecs_to_jiffies (USB_SS_PORT_U0_WAKE_TIME ));return ; }
@@ -1344,9 +1337,10 @@ static void hub_init_func3(struct work_sstatic void hub_post_resume (struct work_struct *ws) { - struct usb_hub *hub = container_of(ws, struct usb_hub, init_work.work); + struct usb_hub *hub = container_of(ws, struct usb_hub, post_resume_work.work); -hub_activate (hub,HUB_POST_RESUME ); +usb_autopm_put_interface_async (to_usb_interface (hub->intfdev)); +kref_put (&hub->kref, hub_release); }enum hub_quiescing_type {
@@ -1374,7 +1368,7 @@ static void hub_quiesce(struct usb_hub */* Stop hub_wq and related activity */ del_timer_sync (&hub->irq_urb_retry); -flush_delayed_work (&hub->init_work); +flush_delayed_work (&hub->post_resume_work);usb_kill_urb (hub->urb);if (hub->has_indicators)cancel_delayed_work_sync (&hub->leds);
@@ -1921,6 +1915,7 @@ static int hub_probe(struct usb_interfac hub->hdev = hdev;INIT_DELAYED_WORK (&hub->leds, led_work);INIT_DELAYED_WORK (&hub->init_work,NULL ); +INIT_DELAYED_WORK (&hub->post_resume_work, hub_post_resume);INIT_WORK (&hub->events, hub_event);spin_lock_init (&hub->irq_urb_lock);timer_setup (&hub->irq_urb_retry, hub_retry_irq_urb,0 );
drivers/usb/core/hub.h +1 -0
@@ -69,6 +69,7 @@ struct usb_hub {u8 indicator[USB_MAXCHILDREN ];struct delayed_work leds;struct delayed_work init_work; +struct delayed_work post_resume_work;struct work_struct events;spinlock_t irq_urb_lock;struct timer_list irq_urb_retry;
Greg Kroah-Hartman
maintainerPATCH 10/81 mm/khugepaged: fix the address passed to notifier on testing young
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wei Yang <[email protected]>
commit 394bfac1c7f7b701c2c93834c5761b9c9ceeebcf upstream.
Commit 8ee53820edfd ("thp: mmu_notifier_test_young") introduced mmu_notifier_test_young(), but we are passing the wrong address. In xxx_scan_pmd(), the actual iteration address is "_address" not "address". We seem to misuse the variable on the very beginning.
Change it to the right one.
--- mm/khugepaged.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/khugepaged.c +1 -1
@@ -1227,7 +1227,7 @@ static int khugepaged_scan_pmd(struct mm }if (pte_young (pteval) ||page_is_young (page) ||PageReferenced (page) || -mmu_notifier_test_young (vma->vm_mm, address)) +mmu_notifier_test_young (vma->vm_mm, _address)) referenced++; }if (writable) {
Greg Kroah-Hartman
maintainerPATCH 11/81 mtd: rawnand: stm32_fmc2: avoid overlapping mappings on ECC buffer
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christophe Kerello <[email protected]>
[ Upstream commit 513c40e59d5a414ab763a9c84797534b5e8c208d ]
Avoid below overlapping mappings by using a contiguous non-cacheable buffer.
[ 4.077708] DMA-API: stm32_fmc2_nfc 48810000.nand-controller: cacheline tracking EEXIST, overlapping mappings aren't supported [ 4.089103] WARNING: CPU: 1 PID: 44 at kernel/dma/debug.c:568 add_dma_entry+0x23c/0x300 [ 4.097071] Modules linked in: [ 4.100101] CPU: 1 PID: 44 Comm: kworker/u4:2 Not tainted 6.1.82 #1 [ 4.106346] Hardware name: STMicroelectronics STM32MP257F VALID1 SNOR / MB1704 (LPDDR4 Power discrete) + MB1703 + MB1708 (SNOR MB1730) (DT) [ 4.118824] Workqueue: events_unbound deferred_probe_work_func [ 4.124674] pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--) [ 4.131624] pc : add_dma_entry+0x23c/0x300 [ 4.135658] lr : add_dma_entry+0x23c/0x300 [ 4.139792] sp : ffff800009dbb490 [ 4.143016] x29: ffff800009dbb4a0 x28: 0000000004008022 x27: ffff8000098a6000 [ 4.150174] x26: 0000000000000000 x25: ffff8000099e7000 x24: ffff8000099e7de8 [ 4.157231] x23: 00000000ffffffff x22: 0000000000000000 x21: ffff8000098a6a20 [ 4.164388] x20: ffff000080964180 x19: ffff800009819ba0 x18: 0000000000000006 [ 4.171545] x17: 6361727420656e69 x16: 6c6568636163203a x15: 72656c6c6f72746e [ 4.178602] x14: 6f632d646e616e2e x13: ffff800009832f58 x12: 00000000000004ec [ 4.185759] x11: 00000000000001a4 x10: ffff80000988af58 x9 : ffff800009832f58 [ 4.192916] x8 : 00000000ffffefff x7 : ffff80000988af58 x6 : 80000000fffff000 [ 4.199972] x5 : 000000000000bff4 x4 : 0000000000000000 x3 : 0000000000000000 [ 4.207128] x2 : 0000000000000000 x1 : 0000000000000000 x0 : ffff0000812d2c40 [ 4.214185] Call trace: [ 4.216605] add_dma_entry+0x23c/0x300 [ 4.220338] debug_dma_map_sg+0x198/0x350 [ 4.224373] __dma_map_sg_attrs+0xa0/0x110 [ 4.228411] dma_map_sg_attrs+0x10/0x2c [ 4.232247] stm32_fmc2_nfc_xfer.isra.0+0x1c8/0x3fc [ 4.237088] stm32_fmc2_nfc_seq_read_page+0xc8/0x174 [ 4.242127] nand_read_oob+0x1d4/0x8e0 [ 4.245861] mtd_read_oob_std+0x58/0x84 [ 4.249596] mtd_read_oob+0x90/0x150 [ 4.253231] mtd_read+0x68/0xac
--- drivers/mtd/nand/raw/stm32_fmc2_nand.c | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-)
drivers/mtd/nand/raw/stm32_fmc2_nand.c +9 -18
@@ -266,6 +266,7 @@ struct stm32_fmc2_nfc {struct sg_table dma_data_sg;struct sg_table dma_ecc_sg;u8 *ecc_buf; +dma_addr_t dma_ecc_addr;int dma_ecc_len;struct completion complete;
@@ -942,24 +943,19 @@ static int stm32_fmc2_xfer(struct nand_cif (!write_data && !raw) {/* Configure DMA ECC status */ - p = fmc2->ecc_buf;for_each_sg (fmc2->dma_ecc_sg.sgl, sg, eccsteps, s) { -sg_set_buf (sg, p, fmc2->dma_ecc_len); - p += fmc2->dma_ecc_len; +sg_dma_address (sg) = fmc2->dma_ecc_addr + + s * fmc2->dma_ecc_len; +sg_dma_len (sg) = fmc2->dma_ecc_len; } - ret =dma_map_sg (fmc2->dev, fmc2->dma_ecc_sg.sgl, - eccsteps, dma_data_dir); -if (ret <0 ) - goto err_unmap_data; - desc_ecc =dmaengine_prep_slave_sg (fmc2->dma_ecc_ch, fmc2->dma_ecc_sg.sgl, eccsteps, dma_transfer_dir,DMA_PREP_INTERRUPT );if (!desc_ecc) { ret = -ENOMEM ; - goto err_unmap_ecc; + goto err_unmap_data; }reinit_completion (&fmc2->dma_ecc_complete);
@@ -967,7 +963,7 @@ static int stm32_fmc2_xfer(struct nand_c desc_ecc->callback_param = &fmc2->dma_ecc_complete; ret =dma_submit_error (dmaengine_submit (desc_ecc));if (ret) - goto err_unmap_ecc; + goto err_unmap_data;dma_async_issue_pending (fmc2->dma_ecc_ch); }
@@ -988,7 +984,7 @@ static int stm32_fmc2_xfer(struct nand_cif (!write_data && !raw)dmaengine_terminate_all (fmc2->dma_ecc_ch); ret = -ETIMEDOUT ; - goto err_unmap_ecc; + goto err_unmap_data; }/* Wait DMA data transfer completion */
@@ -1009,11 +1005,6 @@ static int stm32_fmc2_xfer(struct nand_c } } -err_unmap_ecc: -if (!write_data && !raw) -dma_unmap_sg (fmc2->dev, fmc2->dma_ecc_sg.sgl, - eccsteps, dma_data_dir); - err_unmap_data:dma_unmap_sg (fmc2->dev, fmc2->dma_data_sg.sgl, eccsteps, dma_data_dir);
@@ -1637,8 +1628,8 @@ static int stm32_fmc2_dma_setup(struct sreturn ret;/* Allocate a buffer to store ECC status registers */ - fmc2->ecc_buf =devm_kzalloc (fmc2->dev,FMC2_MAX_ECC_BUF_LEN , -GFP_KERNEL ); + fmc2->ecc_buf =dmam_alloc_coherent (fmc2->dev,FMC2_MAX_ECC_BUF_LEN , + &fmc2->dma_ecc_addr,GFP_KERNEL );if (!fmc2->ecc_buf)return -ENOMEM ;
Greg Kroah-Hartman
maintainerPATCH 12/81 mtd: nand: raw: atmel: Fix comment in timings preparation
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Dahl <[email protected]>
[ Upstream commit 1c60e027ffdebd36f4da766d9c9abbd1ea4dd8f9 ]
Looks like a copy'n'paste mistake introduced when initially adding the dynamic timings feature with commit f9ce2eddf176 ("mtd: nand: atmel: Add ->setup_data_interface() hooks"). The context around this and especially the code itself suggests 'read' is meant instead of write.
Stable-dep-of: fd779eac2d65 ("mtd: nand: raw: atmel: Respect tAR, tCLR in read setup timing")
--- drivers/mtd/nand/raw/atmel/nand-controller.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/nand/raw/atmel/nand-controller.c +1 -1
@@ -1312,7 +1312,7 @@ static int atmel_smc_nand_prepare_smcconreturn ret;/* -* The write cycle timing is directly matching tWC, but is also +* The read cycle timing is directly matching tRC, but is also * dependent on the setup and hold timings we calculated earlier, * which gives: *
Greg Kroah-Hartman
maintainerPATCH 13/81 mtd: nand: raw: atmel: Respect tAR, tCLR in read setup timing
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Sverdlin <[email protected]>
[ Upstream commit fd779eac2d659668be4d3dbdac0710afd5d6db12 ]
Having setup time 0 violates tAR, tCLR of some chips, for instance TOSHIBA TC58NVG2S3ETAI0 cannot be detected successfully (first ID byte being read duplicated, i.e. 98 98 dc 90 15 76 14 03 instead of 98 dc 90 15 76 ...).
Atmel Application Notes postulated 1 cycle NRD_SETUP without explanation [1], but it looks more appropriate to just calculate setup time properly.
--- drivers/mtd/nand/raw/atmel/nand-controller.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
drivers/mtd/nand/raw/atmel/nand-controller.c +13 -3
@@ -1312,13 +1312,23 @@ static int atmel_smc_nand_prepare_smcconreturn ret;/* +* Read setup timing depends on the operation done on the NAND: +* +* NRD_SETUP = max(tAR, tCLR) +*/ + timeps =max (conf->timings.sdr.tAR_min, conf->timings.sdr.tCLR_min); + ncycles =DIV_ROUND_UP (timeps, mckperiodps); + totalcycles += ncycles; + ret =atmel_smc_cs_conf_set_setup (smcconf,ATMEL_SMC_NRD_SHIFT , ncycles); +if (ret) +return ret; + +/* * The read cycle timing is directly matching tRC, but is also * dependent on the setup and hold timings we calculated earlier, * which gives: * -* NRD_CYCLE = max(tRC, NRD_PULSE + NRD_HOLD) -* -* NRD_SETUP is always 0. +* NRD_CYCLE = max(tRC, NRD_SETUP + NRD_PULSE + NRD_HOLD) */ ncycles =DIV_ROUND_UP (conf->timings.sdr.tRC_min, mckperiodps); ncycles =max (totalcycles, ncycles);
Greg Kroah-Hartman
maintainerPATCH 14/81 tty: hvc_console: Call hvc_kick in hvc_write unconditionally
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fabian Vogt <[email protected]>
commit cfd956dcb101aa3d25bac321fae923323a47c607 upstream.
After hvc_write completes, call hvc_kick also in the case the output buffer has been drained, to ensure tty_wakeup gets called.
This fixes that functions which wait for a drained buffer got stuck occasionally.
--- drivers/tty/hvc/hvc_console.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/tty/hvc/hvc_console.c +3 -3
@@ -543,10 +543,10 @@ static int hvc_write(struct tty_struct * }/* -* Racy, but harmless, kick thread if there is still pending data. +* Kick thread to flush if there's still pending data +* or to wakeup the write queue. */ -if (hp->n_outbuf) -hvc_kick (); +hvc_kick ();return written; }
Greg Kroah-Hartman
maintainerPATCH 15/81 USB: serial: option: add Telit Cinterion FN990A w/audio compositions
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fabio Porcedda <[email protected]>
commit cba70aff623b104085ab5613fedd21f6ea19095a upstream.
Add the following Telit Cinterion FN990A w/audio compositions:
0x1077: tty (diag) + adb + rmnet + audio + tty (AT/NMEA) + tty (AT) + tty (AT) + tty (AT)
T: Bus=01 Lev=01 Prnt=01 Port=09 Cnt=01 Dev#= 8 Spd=480 MxCh= 0 D: Ver= 2.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=1bc7 ProdID=1077 Rev=05.04 S: Manufacturer=Telit Wireless Solutions S: Product=FN990 S: SerialNumber=67e04c35 C: #Ifs=10 Cfg#= 1 Atr=e0 MxPwr=500mA I: If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=(none) E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=50 Driver=qmi_wwan E: Ad=0f(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=83(I) Atr=03(Int.) MxPS= 8 Ivl=32ms E: Ad=8e(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 3 Alt= 0 #EPs= 0 Cls=01(audio) Sub=01 Prot=20 Driver=snd-usb-audio I: If#= 4 Alt= 1 #EPs= 1 Cls=01(audio) Sub=02 Prot=20 Driver=snd-usb-audio E: Ad=03(O) Atr=0d(Isoc) MxPS= 68 Ivl=1ms I: If#= 5 Alt= 1 #EPs= 1 Cls=01(audio) Sub=02 Prot=20 Driver=snd-usb-audio E: Ad=84(I) Atr=0d(Isoc) MxPS= 68 Ivl=1ms I: If#= 6 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=60 Driver=option E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=86(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 7 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=88(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 8 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=89(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=8a(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 9 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=07(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=8b(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=8c(I) Atr=03(Int.) MxPS= 10 Ivl=32ms
0x1078: tty (diag) + adb + MBIM + audio + tty (AT/NMEA) + tty (AT) + tty (AT) + tty (AT)
T: Bus=01 Lev=01 Prnt=01 Port=09 Cnt=01 Dev#= 21 Spd=480 MxCh= 0 D: Ver= 2.10 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs= 1 P: Vendor=1bc7 ProdID=1078 Rev=05.04 S: Manufacturer=Telit Wireless Solutions S: Product=FN990 S: SerialNumber=67e04c35 C: #Ifs=11 Cfg#= 1 Atr=e0 MxPwr=500mA I: If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=(none) E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#=10 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=07(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=8b(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=8c(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 2 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0e Prot=00 Driver=cdc_mbim E: Ad=83(I) Atr=03(Int.) MxPS= 64 Ivl=32ms I: If#= 3 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim E: Ad=0f(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=8e(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 4 Alt= 0 #EPs= 0 Cls=01(audio) Sub=01 Prot=20 Driver=snd-usb-audio I: If#= 5 Alt= 0 #EPs= 0 Cls=01(audio) Sub=02 Prot=20 Driver=snd-usb-audio I: If#= 6 Alt= 1 #EPs= 1 Cls=01(audio) Sub=02 Prot=20 Driver=snd-usb-audio E: Ad=84(I) Atr=0d(Isoc) MxPS= 68 Ivl=1ms I: If#= 7 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=60 Driver=option E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=86(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 8 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=88(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 9 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=89(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=8a(I) Atr=03(Int.) MxPS= 10 Ivl=32ms
0x1079: RNDIS + tty (diag) + adb + audio + tty (AT/NMEA) + tty (AT) + tty (AT) + tty (AT)
T: Bus=01 Lev=01 Prnt=01 Port=09 Cnt=01 Dev#= 23 Spd=480 MxCh= 0 D: Ver= 2.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=1bc7 ProdID=1079 Rev=05.04 S: Manufacturer=Telit Wireless Solutions S: Product=FN990 S: SerialNumber=67e04c35 C: #Ifs=11 Cfg#= 1 Atr=e0 MxPwr=500mA I: If#= 0 Alt= 0 #EPs= 1 Cls=ef(misc ) Sub=04 Prot=01 Driver=rndis_host E: Ad=81(I) Atr=03(Int.) MxPS= 8 Ivl=32ms I: If#= 1 Alt= 0 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=rndis_host E: Ad=0f(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=8e(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#=10 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=07(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=8b(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=8c(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=(none) E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 4 Alt= 0 #EPs= 0 Cls=01(audio) Sub=01 Prot=20 Driver=snd-usb-audio I: If#= 5 Alt= 0 #EPs= 0 Cls=01(audio) Sub=02 Prot=20 Driver=snd-usb-audio I: If#= 6 Alt= 1 #EPs= 1 Cls=01(audio) Sub=02 Prot=20 Driver=snd-usb-audio E: Ad=84(I) Atr=0d(Isoc) MxPS= 68 Ivl=1ms I: If#= 7 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=60 Driver=option E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=86(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 8 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=88(I) Atr=03(Int.) MxPS= 10 Ivl=32ms I: If#= 9 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=89(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=8a(I) Atr=03(Int.) MxPS= 10 Ivl=32ms
--- drivers/usb/serial/option.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/usb/serial/option.c +6 -0
@@ -1369,6 +1369,12 @@ static const struct usb_device_id option .driver_info = NCTRL(0) | RSVD(1) }, { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1075, 0xff), /* Telit FN990A (PCIe) */ .driver_info = RSVD(0) }, + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1077, 0xff), /* Telit FN990A (rmnet + audio) */ + .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) }, + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1078, 0xff), /* Telit FN990A (MBIM + audio) */ + .driver_info = NCTRL(0) | RSVD(1) }, + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1079, 0xff), /* Telit FN990A (RNDIS + audio) */ + .driver_info = NCTRL(2) | RSVD(3) }, { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1080, 0xff), /* Telit FE990A (rmnet) */ .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) }, { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1081, 0xff), /* Telit FE990A (MBIM) */
Greg Kroah-Hartman
maintainerPATCH 16/81 USB: serial: option: add Telit Cinterion LE910C4-WWX new compositions
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fabio Porcedda <[email protected]>
commit a5a261bea9bf8444300d1067b4a73bedee5b5227 upstream.
Add the following Telit Cinterion LE910C4-WWX new compositions:
0x1034: tty (AT) + tty (AT) + rmnet
T: Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 8 Spd=480 MxCh= 0 D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=1bc7 ProdID=1034 Rev=00.00 S: Manufacturer=Telit S: Product=LE910C4-WWX S: SerialNumber=93f617e7 C: #Ifs= 3 Cfg#= 1 Atr=e0 MxPwr=500mA I: If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=81(I) Atr=03(Int.) MxPS= 64 Ivl=2ms E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=fe Prot=ff Driver=option E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=83(I) Atr=03(Int.) MxPS= 64 Ivl=2ms E: Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=85(I) Atr=03(Int.) MxPS= 64 Ivl=2ms E: Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
0x1036: tty (AT) + tty (AT)
T: Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 10 Spd=480 MxCh= 0 D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=1bc7 ProdID=1036 Rev=00.00 S: Manufacturer=Telit S: Product=LE910C4-WWX S: SerialNumber=93f617e7 C: #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=500mA I: If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=81(I) Atr=03(Int.) MxPS= 64 Ivl=2ms E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=fe Prot=ff Driver=option E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=83(I) Atr=03(Int.) MxPS= 64 Ivl=2ms E: Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
0x1037: tty (diag) + tty (Telit custom) + tty (AT) + tty (AT) + rmnet
T: Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 15 Spd=480 MxCh= 0 D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=1bc7 ProdID=1037 Rev=00.00 S: Manufacturer=Telit S: Product=LE910C4-WWX S: SerialNumber=93f617e7 C: #Ifs= 5 Cfg#= 1 Atr=e0 MxPwr=500mA I: If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=83(I) Atr=03(Int.) MxPS= 64 Ivl=2ms E: Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=fe Prot=ff Driver=option E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=85(I) Atr=03(Int.) MxPS= 64 Ivl=2ms E: Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan E: Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=87(I) Atr=03(Int.) MxPS= 64 Ivl=2ms E: Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
0x1038: tty (Telit custom) + tty (AT) + tty (AT) + rmnet
T: Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 9 Spd=480 MxCh= 0 D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=1bc7 ProdID=1038 Rev=00.00 S: Manufacturer=Telit S: Product=LE910C4-WWX S: SerialNumber=93f617e7 C: #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr=500mA I: If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=82(I) Atr=03(Int.) MxPS= 64 Ivl=2ms E: Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=fe Prot=ff Driver=option E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=84(I) Atr=03(Int.) MxPS= 64 Ivl=2ms E: Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=86(I) Atr=03(Int.) MxPS= 64 Ivl=2ms E: Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
0x103b: tty (diag) + tty (Telit custom) + tty (AT) + tty (AT)
T: Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 10 Spd=480 MxCh= 0 D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=1bc7 ProdID=103b Rev=00.00 S: Manufacturer=Telit S: Product=LE910C4-WWX S: SerialNumber=93f617e7 C: #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr=500mA I: If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=83(I) Atr=03(Int.) MxPS= 64 Ivl=2ms E: Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=fe Prot=ff Driver=option E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=85(I) Atr=03(Int.) MxPS= 64 Ivl=2ms E: Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
0x103c: tty (Telit custom) + tty (AT) + tty (AT)
T: Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 11 Spd=480 MxCh= 0 D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=1bc7 ProdID=103c Rev=00.00 S: Manufacturer=Telit S: Product=LE910C4-WWX S: SerialNumber=93f617e7 C: #Ifs= 3 Cfg#= 1 Atr=e0 MxPwr=500mA I: If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=82(I) Atr=03(Int.) MxPS= 64 Ivl=2ms E: Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms I: If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=fe Prot=ff Driver=option E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=84(I) Atr=03(Int.) MxPS= 64 Ivl=2ms E: Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
--- drivers/usb/serial/option.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/usb/serial/option.c +11 -0
@@ -1322,7 +1322,18 @@ static const struct usb_device_id option .driver_info = NCTRL(0) | RSVD(3) }, { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1033, 0xff), /* Telit LE910C1-EUX (ECM) */ .driver_info = NCTRL(0) }, + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1034, 0xff), /* Telit LE910C4-WWX (rmnet) */ + .driver_info = RSVD(2) }, { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1035, 0xff) }, /* Telit LE910C4-WWX (ECM) */ + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1036, 0xff) }, /* Telit LE910C4-WWX */ + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1037, 0xff), /* Telit LE910C4-WWX (rmnet) */ + .driver_info = NCTRL(0) | NCTRL(1) | RSVD(4) }, + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1038, 0xff), /* Telit LE910C4-WWX (rmnet) */ + .driver_info = NCTRL(0) | RSVD(3) }, + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x103b, 0xff), /* Telit LE910C4-WWX */ + .driver_info = NCTRL(0) | NCTRL(1) }, + { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x103c, 0xff), /* Telit LE910C4-WWX */ + .driver_info = NCTRL(0) }, { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE922_USBCFG0), .driver_info = RSVD(0) | RSVD(1) | NCTRL(2) | RSVD(3) }, { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE922_USBCFG1),
Greg Kroah-Hartman
maintainerPATCH 17/81 net: fec: Fix possible NPD in fec_enet_phy_reset_after_clk_enable()
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Wahren <[email protected]>
[ Upstream commit 03e79de4608bdd48ad6eec272e196124cefaf798 ]
The function of_phy_find_device may return NULL, so we need to take care before dereferencing phy_dev.
--- drivers/net/ethernet/freescale/fec_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/freescale/fec_main.c +2 -1
@@ -2018,7 +2018,8 @@ static void fec_enet_phy_reset_after_clk_enable(struct net_device *ndev)*/ phy_dev =of_phy_find_device (fep->phy_node);phy_reset_after_clk_enable (phy_dev); -put_device (&phy_dev->mdio.dev); +if (phy_dev) +put_device (&phy_dev->mdio.dev); } }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 18/81 igb: fix link test skipping when interface is admin down
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kohei Enju <[email protected]>
[ Upstream commit d709f178abca22a4d3642513df29afe4323a594b ]
The igb driver incorrectly skips the link test when the network interface is admin down (if_running == false), causing the test to always report PASS regardless of the actual physical link state.
This behavior is inconsistent with other drivers (e.g. i40e, ice, ixgbe, etc.) which correctly test the physical link state regardless of admin state.
Remove the if_running check to ensure link test always reflects the physical link state.
--- drivers/net/ethernet/intel/igb/igb_ethtool.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/net/ethernet/intel/igb/igb_ethtool.c +1 -4
@@ -2070,11 +2070,8 @@ static void igb_diag_test(struct net_device *netdev, }else {dev_info (&adapter->pdev->dev,"online testing starting\n" ); -/* PHY is powered down when interface is down */ -if (if_running &&igb_link_test (adapter, &data[TEST_LINK ])) +if (igb_link_test (adapter, &data[TEST_LINK ])) eth_test->flags |=ETH_TEST_FL_FAILED ; -else - data[TEST_LINK ] =0 ;/* Online tests aren't run; pass by default */ data[TEST_REG ] =0 ;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 19/81 genirq/affinity: Add irq_update_affinity_desc()
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: John Garry <[email protected]>
[ Upstream commit 1d3aec89286254487df7641c30f1b14ad1d127a5 ]
Add a function to allow the affinity of an interrupt be switched to managed, such that interrupts allocated for platform devices may be managed.
This new interface has certain limitations, and attempts to use it in the following circumstances will fail:
- For when the kernel is configured for generic IRQ reservation mode (in config GENERIC_IRQ_RESERVATION_MODE). The reason being that it could conflict with managed vs. non-managed interrupt accounting.
- The interrupt is already started, which should not be the case during init
- The interrupt is already configured as managed, which means double init
Stable-dep-of: 915470e1b44e ("i40e: fix IRQ freeing in i40e_vsi_request_irq_msix error path")
--- include/linux/interrupt.h | 8 +++++ kernel/irq/manage.c | 70 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 78 insertions(+)
include/linux/interrupt.h +8 -0
@@ -341,6 +341,8 @@ extern int irq_can_set_affinity(unsigned int irq);extern int irq_select_affinity (unsigned int irq);extern int irq_set_affinity_hint (unsigned int irq,const struct cpumask *m); +extern int irq_update_affinity_desc (unsigned int irq, +struct irq_affinity_desc *affinity);extern int irq_set_affinity_notifier (unsigned int irq,struct irq_affinity_notify *notify);
@@ -376,6 +378,12 @@ static inline int irq_set_affinity_hint(unsigned int irq,return -EINVAL ; } +static inline int irq_update_affinity_desc (unsigned int irq, +struct irq_affinity_desc *affinity) +{ +return -EINVAL ; +} +static inline int irq_set_affinity_notifier (unsigned int irq,struct irq_affinity_notify *notify) {
kernel/irq/manage.c +70 -0
76 lines not on this page · raw message
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 2/81 net: Fix null-ptr-deref by sock_lock_init_class_and_name() and rmmod.
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <[email protected]>
commit 0bb2f7a1ad1f11d861f58e5ee5051c8974ff9569 upstream.
When I ran the repro [0] and waited a few seconds, I observed two LOCKDEP splats: a warning immediately followed by a null-ptr-deref. [1]
Reproduction Steps:
1) Mount CIFS
2) Add an iptables rule to drop incoming FIN packets for CIFS
3) Unmount CIFS
4) Unload the CIFS module
5) Remove the iptables rule
At step 3), the CIFS module calls sock_release() for the underlying TCP socket, and it returns quickly. However, the socket remains in FIN_WAIT_1 because incoming FIN packets are dropped.
At this point, the module's refcnt is 0 while the socket is still alive, so the following rmmod command succeeds.
# ss -tan State Recv-Q Send-Q Local Address:Port Peer Address:Port FIN-WAIT-1 0 477 10.0.2.15:51062 10.0.0.137:445
# lsmod | grep cifs cifs 1159168 0
This highlights a discrepancy between the lifetime of the CIFS module and the underlying TCP socket. Even after CIFS calls sock_release() and it returns, the TCP socket does not die immediately in order to close the connection gracefully.
While this is generally fine, it causes an issue with LOCKDEP because CIFS assigns a different lock class to the TCP socket's sk->sk_lock using sock_lock_init_class_and_name().
Once an incoming packet is processed for the socket or a timer fires, sk->sk_lock is acquired.
Then, LOCKDEP checks the lock context in check_wait_context(), where hlock_class() is called to retrieve the lock class. However, since the module has already been unloaded, hlock_class() logs a warning and returns NULL, triggering the null-ptr-deref.
If LOCKDEP is enabled, we must ensure that a module calling sock_lock_init_class_and_name() (CIFS, NFS, etc) cannot be unloaded while such a socket is still alive to prevent this issue.
Let's hold the module reference in sock_lock_init_class_and_name() and release it when the socket is freed in sk_prot_free().
Note that sock_lock_init() clears sk->sk_owner for svc_create_socket() that calls sock_lock_init_class_and_name() for a listening socket, which clones a socket by sk_clone_lock() without GFP_ZERO.
[0]:
CIFS_SERVER="10.0.0.137" CIFS_PATH="//${CIFS_SERVER}/Users/Administrator/Desktop/CIFS_TEST" DEV="enp0s3"
CRED="/root/WindowsCredential.txt"
MNT=$(mktemp -d /tmp/XXXXXX)
mount -t cifs ${CIFS_PATH} ${MNT} -o vers=3.0,credentials=${CRED},cache=none,echo_interval=1
iptables -A INPUT -s ${CIFS_SERVER} -j DROP
for i in $(seq 10);
do
umount ${MNT}
rmmod cifs
sleep 1done
rm -r ${MNT}
iptables -D INPUT -s ${CIFS_SERVER} -j DROP
[1]:DEBUG_LOCKS_WARN_ON(1)
WARNING: CPU: 10 PID: 0 at kernel/locking/lockdep.c:234 hlock_class (kernel/locking/lockdep.c:234 kernel/locking/lockdep.c:223) Modules linked in: cifs_arc4 nls_ucs2_utils cifs_md4 [last unloaded: cifs] CPU: 10 UID: 0 PID: 0 Comm: swapper/10 Not tainted 6.14.0 #36 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org 04/01/2014 RIP: 0010:hlock_class (kernel/locking/lockdep.c:234 kernel/locking/lockdep.c:223) ... Call Trace: <IRQ> __lock_acquire (kernel/locking/lockdep.c:4853 kernel/locking/lockdep.c:5178) lock_acquire (kernel/locking/lockdep.c:469 kernel/locking/lockdep.c:5853 kernel/locking/lockdep.c:5816) _raw_spin_lock_nested (kernel/locking/spinlock.c:379) tcp_v4_rcv (./include/linux/skbuff.h:1678 ./include/net/tcp.h:2547 net/ipv4/tcp_ipv4.c:2350)
...
BUG: kernel NULL pointer dereference, address: 00000000000000c4 PF: supervisor read access in kernel mode PF: error_code(0x0000) - not-present page PGD 0 Oops: Oops: 0000 [#1] PREEMPT SMP NOPTI CPU: 10 UID: 0 PID: 0 Comm: swapper/10 Tainted: G W 6.14.0 #36 Tainted: [W]=WARN Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org 04/01/2014 RIP: 0010:__lock_acquire (kernel/locking/lockdep.c:4852 kernel/locking/lockdep.c:5178) Code: 15 41 09 c7 41 8b 44 24 20 25 ff 1f 00 00 41 09 c7 8b 84 24 a0 00 00 00 45 89 7c 24 20 41 89 44 24 24 e8 e1 bc ff ff 4c 89 e7 <44> 0f b6 b8 c4 00 00 00 e8 d1 bc ff ff 0f b6 80 c5 00 00 00 88 44 RSP: 0018:ffa0000000468a10 EFLAGS: 00010046 RAX: 0000000000000000 RBX: ff1100010091cc38 RCX: 0000000000000027 RDX: ff1100081f09ca48 RSI: 0000000000000001 RDI: ff1100010091cc88 RBP: ff1100010091c200 R08: ff1100083fe6e228 R09: 00000000ffffbfff R10: ff1100081eca0000 R11: ff1100083fe10dc0 R12: ff1100010091cc88 R13: 0000000000000001 R14: 0000000000000000 R15: 00000000000424b1 FS: 0000000000000000(0000) GS:ff1100081f080000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00000000000000c4 CR3: 0000000002c4a003 CR4: 0000000000771ef0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe07f0 DR7: 0000000000000400 PKRU: 55555554 Call Trace: <IRQ> lock_acquire (kernel/locking/lockdep.c:469 kernel/locking/lockdep.c:5853 kernel/locking/lockdep.c:5816) _raw_spin_lock_nested (kernel/locking/spinlock.c:379) tcp_v4_rcv (./include/linux/skbuff.h:1678 ./include/net/tcp.h:2547 net/ipv4/tcp_ipv4.c:2350) ip_protocol_deliver_rcu (net/ipv4/ip_input.c:205 (discriminator 1)) ip_local_deliver_finish (./include/linux/rcupdate.h:878 net/ipv4/ip_input.c:234) ip_sublist_rcv_finish (net/ipv4/ip_input.c:576) ip_list_rcv_finish (net/ipv4/ip_input.c:628) ip_list_rcv (net/ipv4/ip_input.c:670) __netif_receive_skb_list_core (net/core/dev.c:5939 net/core/dev.c:5986) netif_receive_skb_list_internal (net/core/dev.c:6040 net/core/dev.c:6129) napi_complete_done (./include/linux/list.h:37 ./include/net/gro.h:519 ./include/net/gro.h:514 net/core/dev.c:6496) e1000_clean (drivers/net/ethernet/intel/e1000/e1000_main.c:3815) __napi_poll.constprop.0 (net/core/dev.c:7191) net_rx_action (net/core/dev.c:7262 net/core/dev.c:7382) handle_softirqs (kernel/softirq.c:561) __irq_exit_rcu (kernel/softirq.c:596 kernel/softirq.c:435 kernel/softirq.c:662) irq_exit_rcu (kernel/softirq.c:680) common_interrupt (arch/x86/kernel/irq.c:280 (discriminator 14)) </IRQ> <TASK> asm_common_interrupt (./arch/x86/include/asm/idtentry.h:693) RIP: 0010:default_idle (./arch/x86/include/asm/irqflags.h:37 ./arch/x86/include/asm/irqflags.h:92 arch/x86/kernel/process.c:744) Code: 4c 01 c7 4c 29 c2 e9 72 ff ff ff 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 f3 0f 1e fa eb 07 0f 00 2d c3 2b 15 00 fb f4 <fa> c3 cc cc cc cc 66 66 2e 0f 1f 84 00 00 00 00 00 90 90 90 90 90 RSP: 0018:ffa00000000ffee8 EFLAGS: 00000202 RAX: 000000000000640b RBX: ff1100010091c200 RCX: 0000000000061aa4 RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffffffff812f30c5 RBP: 000000000000000a R08: 0000000000000001 R09: 0000000000000000 R10: 0000000000000001 R11: 0000000000000002 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 ? do_idle (kernel/sched/idle.c:186 kernel/sched/idle.c:325) default_idle_call (./include/linux/cpuidle.h:143 kernel/sched/idle.c:118) do_idle (kernel/sched/idle.c:186 kernel/sched/idle.c:325) cpu_startup_entry (kernel/sched/idle.c:422 (discriminator 1)) start_secondary (arch/x86/kernel/smpboot.c:315) common_startup_64 (arch/x86/kernel/head_64.S:421) </TASK> Modules linked in: cifs_arc4 nls_ucs2_utils cifs_md4 [last unloaded: cifs]
CR2: 00000000000000c4
--- include/net/sock.h | 40 ++++++++++++++++++++++++++++++++++++++-- net/core/sock.c | 5 +++++ 2 files changed, 43 insertions(+), 2 deletions(-)
include/net/sock.h +38 -2
@@ -321,6 +321,8 @@ struct bpf_sk_storage;* @sk_clockid: clockid used by time-based scheduling (SO_TXTIME) * @sk_txtime_deadline_mode: set deadline mode for SO_TXTIME * @sk_txtime_unused: unused txtime flags +* @sk_owner: reference to the real owner of the socket that calls +* sock_lock_init_class_and_name(). */ struct sock {/*
@@ -515,6 +517,10 @@ struct sock {struct bpf_sk_storage __rcu *sk_bpf_storage;#endif struct rcu_head sk_rcu; + +#if IS_ENABLED (CONFIG_PROVE_LOCKING ) &&IS_ENABLED (CONFIG_MODULES ) +struct module *sk_owner; +#endif };enum sk_pacing {
@@ -1525,6 +1531,35 @@ static inline void sock_release_ownershi } } +#if IS_ENABLED (CONFIG_PROVE_LOCKING ) &&IS_ENABLED (CONFIG_MODULES ) +static inline void sk_owner_set (struct sock *sk,struct module *owner) +{ +__module_get (owner); + sk->sk_owner = owner; +} + +static inline void sk_owner_clear (struct sock *sk) +{ + sk->sk_owner =NULL ; +} + +static inline void sk_owner_put (struct sock *sk) +{ +module_put (sk->sk_owner); +} +#else +static inline void sk_owner_set (struct sock *sk,struct module *owner) +{ +} + +static inline void sk_owner_clear (struct sock *sk) +{ +} + +static inline void sk_owner_put (struct sock *sk) +{ +} +#endif /* * Macro so as to not evaluate some arguments when * lockdep is not enabled.
@@ -1534,13 +1569,14 @@ static inline void sock_release_ownershi*/ #define sock_lock_init_class_and_name (sk, sname, skey, name, key) \ do { \ + sk_owner_set(sk, THIS_MODULE); \ sk->sk_lock.owned = 0; \ init_waitqueue_head(&sk->sk_lock.wq); \ spin_lock_init(&(sk)->sk_lock.slock); \ debug_check_no_locks_freed((void *)&(sk)->sk_lock, \ - sizeof((sk)->sk_lock)); \ + sizeof((sk)->sk_lock)); \ lockdep_set_class_and_name(&(sk)->sk_lock.slock, \ - (skey), (sname)); \ + (skey), (sname)); \ lockdep_init_map(&(sk)->sk_lock.dep_map, (name), (key), 0); \ } while (0)
net/core/sock.c +5 -0
@@ -1567,6 +1567,8 @@ lenout:*/ static inline void sock_lock_init (struct sock *sk) { +sk_owner_clear (sk); +if (sk->sk_kern_sock) sock_lock_init_class_and_name( sk,
@@ -1652,6 +1654,9 @@ static void sk_prot_free(struct proto *pcgroup_sk_free (&sk->sk_cgrp_data);mem_cgroup_sk_free (sk);security_sk_free (sk); + +sk_owner_put (sk); +if (slab !=NULL )kmem_cache_free (slab, sk);else
Greg Kroah-Hartman
maintainerPATCH 20/81 genirq: Export affinity setter for modules
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Gleixner <[email protected]>
[ Upstream commit 4d80d6ca5d77fde9880da8466e5b64f250e5bf82 ]
Perf modules abuse irq_set_affinity_hint() to set the affinity of system PMU interrupts just because irq_set_affinity() was not exported.
The fact that irq_set_affinity_hint() actually sets the affinity is a non-documented side effect and the name is clearly saying it's a hint.
To clean this up, export the real affinity setter.
Stable-dep-of: 915470e1b44e ("i40e: fix IRQ freeing in i40e_vsi_request_irq_msix error path")
--- include/linux/interrupt.h | 35 ++--------------------------------- kernel/irq/manage.c | 33 ++++++++++++++++++++++++++++++++- 2 files changed, 34 insertions(+), 34 deletions(-)
include/linux/interrupt.h +2 -33
@@ -303,39 +303,8 @@ struct irq_affinity_desc {extern cpumask_var_t irq_default_affinity; -/* Internal implementation. Use the helpers below */ -extern int __irq_set_affinity (unsigned int irq,const struct cpumask *cpumask, -bool force); - -/** -* irq_set_affinity - Set the irq affinity of a given irq -* @irq: Interrupt to set affinity -* @cpumask: cpumask -* -* Fails if cpumask does not contain an online CPU -*/ -static inline int -irq_set_affinity (unsigned int irq,const struct cpumask *cpumask) -{ -return __irq_set_affinity (irq, cpumask, false); -} - -/** -* irq_force_affinity - Force the irq affinity of a given irq -* @irq: Interrupt to set affinity -* @cpumask: cpumask -* -* Same as irq_set_affinity, but without checking the mask against -* online cpus. -* -* Solely for low level cpu hotplug code, where we need to make per -* cpu interrupts affine before the cpu becomes online. -*/ -static inline int -irq_force_affinity (unsigned int irq,const struct cpumask *cpumask) -{ -return __irq_set_affinity (irq, cpumask, true); -} +extern int irq_set_affinity (unsigned int irq,const struct cpumask *cpumask); +extern int irq_force_affinity (unsigned int irq,const struct cpumask *cpumask);extern int irq_can_set_affinity (unsigned int irq);extern int irq_select_affinity (unsigned int irq);
kernel/irq/manage.c +32 -1
@@ -402,7 +402,8 @@ int irq_update_affinity_desc(unsigned int irq,return ret; } -int __irq_set_affinity (unsigned int irq,const struct cpumask *mask,bool force) +static int __irq_set_affinity (unsigned int irq,const struct cpumask *mask, +bool force) {struct irq_desc *desc =irq_to_desc (irq);unsigned long flags;
@@ -417,6 +418,36 @@ int __irq_set_affinity(unsigned int irq, const struct cpumask *mask, bool force)return ret; } +/** +* irq_set_affinity - Set the irq affinity of a given irq +* @irq: Interrupt to set affinity +* @cpumask: cpumask +* +* Fails if cpumask does not contain an online CPU +*/ +int irq_set_affinity (unsigned int irq,const struct cpumask *cpumask) +{ +return __irq_set_affinity (irq, cpumask, false); +} +EXPORT_SYMBOL_GPL (irq_set_affinity); + +/** +* irq_force_affinity - Force the irq affinity of a given irq +* @irq: Interrupt to set affinity +* @cpumask: cpumask +* +* Same as irq_set_affinity, but without checking the mask against +* online cpus. +* +* Solely for low level cpu hotplug code, where we need to make per +* cpu interrupts affine before the cpu becomes online. +*/ +int irq_force_affinity (unsigned int irq,const struct cpumask *cpumask) +{ +return __irq_set_affinity (irq, cpumask, true); +} +EXPORT_SYMBOL_GPL (irq_force_affinity); +int irq_set_affinity_hint (unsigned int irq,const struct cpumask *m) {unsigned long flags;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 21/81 genirq: Provide new interfaces for affinity hints
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Gleixner <[email protected]>
[ Upstream commit 65c7cdedeb3026fabcc967a7aae2f755ad4d0783 ]
The discussion about removing the side effect of irq_set_affinity_hint() of actually applying the cpumask (if not NULL) as affinity to the interrupt, unearthed a few unpleasantries:
1) The modular perf drivers rely on the current behaviour for the very wrong reasons.
2) While none of the other drivers prevents user space from changing the affinity, a cursorily inspection shows that there are at least expectations in some drivers.
#1 needs to be cleaned up anyway, so that's not a problem
#2 might result in subtle regressions especially when irqbalanced (which
nowadays ignores the affinity hint) is disabled.
Provide new interfaces:
irq_update_affinity_hint() - Only sets the affinity hint pointer irq_set_affinity_and_hint() - Set the pointer and apply the affinity to
the interrupt
Make irq_set_affinity_hint() a wrapper around irq_apply_affinity_hint() and document it to be phased out.
Stable-dep-of: 915470e1b44e ("i40e: fix IRQ freeing in i40e_vsi_request_irq_msix error path")
--- include/linux/interrupt.h | 53 ++++++++++++++++++++++++++++++++++++++- kernel/irq/manage.c | 8 +++--- 2 files changed, 56 insertions(+), 5 deletions(-)
include/linux/interrupt.h +52 -1
@@ -309,7 +309,46 @@ extern int irq_force_affinity(unsigned int irq, const struct cpumask *cpumask);extern int irq_can_set_affinity (unsigned int irq);extern int irq_select_affinity (unsigned int irq); -extern int irq_set_affinity_hint (unsigned int irq,const struct cpumask *m); +extern int __irq_apply_affinity_hint (unsigned int irq,const struct cpumask *m, +bool setaffinity); + +/** +* irq_update_affinity_hint - Update the affinity hint +* @irq: Interrupt to update +* @m: cpumask pointer (NULL to clear the hint) +* +* Updates the affinity hint, but does not change the affinity of the interrupt. +*/ +static inline int +irq_update_affinity_hint (unsigned int irq,const struct cpumask *m) +{ +return __irq_apply_affinity_hint (irq, m, false); +} + +/** +* irq_set_affinity_and_hint - Update the affinity hint and apply the provided +* cpumask to the interrupt +* @irq: Interrupt to update +* @m: cpumask pointer (NULL to clear the hint) +* +* Updates the affinity hint and if @m is not NULL it applies it as the +* affinity of that interrupt. +*/ +static inline int +irq_set_affinity_and_hint (unsigned int irq,const struct cpumask *m) +{ +return __irq_apply_affinity_hint (irq, m, true); +} + +/* +* Deprecated. Use irq_update_affinity_hint() or irq_set_affinity_and_hint() +* instead. +*/ +static inline int irq_set_affinity_hint (unsigned int irq,const struct cpumask *m) +{ +return irq_set_affinity_and_hint (irq, m); +} +extern int irq_update_affinity_desc (unsigned int irq,struct irq_affinity_desc *affinity);
@@ -341,6 +380,18 @@ static inline int irq_can_set_affinity(unsigned int irq)static inline int irq_select_affinity (unsigned int irq) {return 0 ; } +static inline int irq_update_affinity_hint (unsigned int irq, +const struct cpumask *m) +{ +return -EINVAL ; +} + +static inline int irq_set_affinity_and_hint (unsigned int irq, +const struct cpumask *m) +{ +return -EINVAL ; +} +static inline int irq_set_affinity_hint (unsigned int irq,const struct cpumask *m) {
kernel/irq/manage.c +4 -4
@@ -448,7 +448,8 @@ int irq_force_affinity(unsigned int irq, const struct cpumask *cpumask) }EXPORT_SYMBOL_GPL (irq_force_affinity); -int irq_set_affinity_hint (unsigned int irq,const struct cpumask *m) +int __irq_apply_affinity_hint (unsigned int irq,const struct cpumask *m, +bool setaffinity) {unsigned long flags;struct irq_desc *desc =irq_get_desc_lock (irq, &flags,IRQ_GET_DESC_CHECK_GLOBAL );
@@ -457,12 +458,11 @@ int irq_set_affinity_hint(unsigned int irq, const struct cpumask *m)return -EINVAL ; desc->affinity_hint = m;irq_put_desc_unlock (desc, flags); -/* set the initial affinity to prevent every interrupt being on CPU0 */ -if (m) +if (m && setaffinity)__irq_set_affinity (irq, m, false);return 0 ; } -EXPORT_SYMBOL_GPL (irq_set_affinity_hint); +EXPORT_SYMBOL_GPL (__irq_apply_affinity_hint);static void irq_affinity_notify (struct work_struct *work) {
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 22/81 i40e: Use irq_update_affinity_hint()
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nitesh Narayan Lal <[email protected]>
[ Upstream commit d34c54d1739c2cdf2e4437b74e6da269147f4987 ]
The driver uses irq_set_affinity_hint() for two purposes:
- To set the affinity_hint which is consumed by the userspace for distributing the interrupts
- To apply an affinity that it provides for the i40e interrupts
The latter is done to ensure that all the interrupts are evenly spread across all available CPUs. However, since commit a0c9259dc4e1 ("irq/matrix:
Spread interrupts on allocation") the spreading of interrupts is dynamically performed at the time of allocation. Hence, there is no need for the drivers to enforce their own affinity for the spreading of interrupts.
Also, irq_set_affinity_hint() applying the provided cpumask as an affinity for the interrupt is an undocumented side effect. To remove this side effect irq_set_affinity_hint() has been marked as deprecated and new interfaces have been introduced. Hence, replace the irq_set_affinity_hint() with the new interface irq_update_affinity_hint() that only sets the pointer for the affinity_hint.
Stable-dep-of: 915470e1b44e ("i40e: fix IRQ freeing in i40e_vsi_request_irq_msix error path")
--- drivers/net/ethernet/intel/i40e/i40e_main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +4 -4
@@ -3882,10 +3882,10 @@ static int i40e_vsi_request_irq_msix(struct i40e_vsi *vsi, char *basename)* * get_cpu_mask returns a static constant mask with * a permanent lifetime so it's ok to pass to -* irq_set_affinity_hint without making a copy. +* irq_update_affinity_hint without making a copy. */ cpu =cpumask_local_spread (q_vector->v_idx,-1 ); -irq_set_affinity_hint (irq_num,get_cpu_mask (cpu)); +irq_update_affinity_hint (irq_num,get_cpu_mask (cpu)); } vsi->irqs_ready = true;
@@ -3896,7 +3896,7 @@ static int i40e_vsi_request_irq_msix(struct i40e_vsi *vsi, char *basename) vector--; irq_num = pf->msix_entries[base + vector].vector;irq_set_affinity_notifier (irq_num,NULL ); -irq_set_affinity_hint (irq_num,NULL ); +irq_update_affinity_hint (irq_num,NULL );free_irq (irq_num, &vsi->q_vectors[vector]); }return err;
@@ -4714,7 +4714,7 @@ static void i40e_vsi_free_irq(struct i40e_vsi *vsi)/* clear the affinity notifier in the IRQ descriptor */ irq_set_affinity_notifier (irq_num,NULL );/* remove our suggested affinity mask for this IRQ */ -irq_set_affinity_hint (irq_num,NULL ); +irq_update_affinity_hint (irq_num,NULL );synchronize_irq (irq_num);free_irq (irq_num, vsi->q_vectors[i]);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 23/81 i40e: fix IRQ freeing in i40e_vsi_request_irq_msix error path
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Schmidt <[email protected]>
[ Upstream commit 915470e1b44e71d1dd07ee067276f003c3521ee3 ]
If request_irq() in i40e_vsi_request_irq_msix() fails in an iteration later than the first, the error path wants to free the IRQs requested so far. However, it uses the wrong dev_id argument for free_irq(), so it does not free the IRQs correctly and instead triggers the warning:
Trying to free already-free IRQ 173
WARNING: CPU: 25 PID: 1091 at kernel/irq/manage.c:1829 __free_irq+0x192/0x2c0 Modules linked in: i40e(+) [...] CPU: 25 UID: 0 PID: 1091 Comm: NetworkManager Not tainted 6.17.0-rc1+ #1 PREEMPT(lazy) Hardware name: [...] RIP: 0010:__free_irq+0x192/0x2c0 [...] Call Trace: <TASK> free_irq+0x32/0x70 i40e_vsi_request_irq_msix.cold+0x63/0x8b [i40e] i40e_vsi_request_irq+0x79/0x80 [i40e] i40e_vsi_open+0x21f/0x2f0 [i40e] i40e_open+0x63/0x130 [i40e] __dev_open+0xfc/0x210 __dev_change_flags+0x1fc/0x240 netif_change_flags+0x27/0x70 do_setlink.isra.0+0x341/0xc70 rtnl_newlink+0x468/0x860 rtnetlink_rcv_msg+0x375/0x450 netlink_rcv_skb+0x5c/0x110 netlink_unicast+0x288/0x3c0 netlink_sendmsg+0x20d/0x430 ____sys_sendmsg+0x3a2/0x3d0 ___sys_sendmsg+0x99/0xe0 __sys_sendmsg+0x8a/0xf0 do_syscall_64+0x82/0x2c0 entry_SYSCALL_64_after_hwframe+0x76/0x7e [...] </TASK> ---[ end trace 0000000000000000 ]---
Use the same dev_id for free_irq() as for request_irq().
I tested this with inserting code to fail intentionally.
--- drivers/net/ethernet/intel/i40e/i40e_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +1 -1
@@ -3897,7 +3897,7 @@ static int i40e_vsi_request_irq_msix(struct i40e_vsi *vsi, char *basename) irq_num = pf->msix_entries[base + vector].vector;irq_set_affinity_notifier (irq_num,NULL );irq_update_affinity_hint (irq_num,NULL ); -free_irq (irq_num, &vsi->q_vectors[vector]); +free_irq (irq_num, vsi->q_vectors[vector]); }return err; }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 24/81 can: j1939: j1939_sk_bind(): call j1939_priv_put() immediately when j1939_local_ecu_get() failed
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tetsuo Handa <[email protected]>
[ Upstream commit f214744c8a27c3c1da6b538c232da22cd027530e ]
Commit 25fe97cb7620 ("can: j1939: move j1939_priv_put() into sk_destruct callback") expects that a call to j1939_priv_put() can be unconditionally delayed until j1939_sk_sock_destruct() is called. But a refcount leak will happen when j1939_sk_bind() is called again after j1939_local_ecu_get()
from previous j1939_sk_bind() call returned an error. We need to callj1939_priv_put() before j1939_sk_bind() returns an error.
--- net/can/j1939/socket.c | 3 +++ 1 file changed, 3 insertions(+)
net/can/j1939/socket.c +3 -0
@@ -520,6 +520,9 @@ static int j1939_sk_bind(struct socket *sock, struct sockaddr *uaddr, int len) ret =j1939_local_ecu_get (priv, jsk->addr.src_name, jsk->addr.sa);if (ret) {j1939_netdev_stop (priv); + jsk->priv =NULL ; +synchronize_rcu (); +j1939_priv_put (priv); goto out_release_sock; }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 3/81 NFSv4: Dont clear capabilities that wont be reset
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
[ Upstream commit 31f1a960ad1a14def94fa0b8c25d62b4c032813f ]
Don't clear the capabilities that are not going to get reset by the call to _nfs4_server_capabilities().
--- fs/nfs/nfs4proc.c | 1 - 1 file changed, 1 deletion(-)
fs/nfs/nfs4proc.c +0 -1
@@ -3885,7 +3885,6 @@ int nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *fhandle) };int err; -nfs_server_set_init_caps (server); do { err = nfs4_handle_exception(server, _nfs4_server_capabilities(server, fhandle),
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 4/81 tcp_bpf: Call sk_msg_free() when tcp_bpf_send_verdict() fails to allocate psock->cork.
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <[email protected]>
[ Upstream commit a3967baad4d533dc254c31e0d221e51c8d223d58 ]
syzbot reported the splat below. [0]
The repro does the following:
1. Load a sk_msg prog that calls bpf_msg_cork_bytes(msg, cork_bytes)
2. Attach the prog to a SOCKMAP
3. Add a socket to the SOCKMAP
4. Activate fault injection
5. Send data less than cork_bytes
At 5., the data is carried over to the next sendmsg() as it is smaller than the cork_bytes specified by bpf_msg_cork_bytes().
Then, tcp_bpf_send_verdict() tries to allocate psock->cork to hold the data, but this fails silently due to fault injection + __GFP_NOWARN.
If the allocation fails, we need to revert the sk->sk_forward_alloc change done by sk_msg_alloc().
Let's call sk_msg_free() when tcp_bpf_send_verdict fails to allocate psock->cork.
The "*copied" also needs to be updated such that a proper error can be returned to the caller, sendmsg. It fails to allocate psock->cork. Nothing has been corked so far, so this patch simply sets "*copied" to 0.
[0]:
WARNING: net/ipv4/af_inet.c:156 at inet_sock_destruct+0x623/0x730 net/ipv4/af_inet.c:156, CPU#1: syz-executor/5983 Modules linked in: CPU: 1 UID: 0 PID: 5983 Comm: syz-executor Not tainted syzkaller #0 PREEMPT(full) Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/2025 RIP: 0010:inet_sock_destruct+0x623/0x730 net/ipv4/af_inet.c:156 Code: 0f 0b 90 e9 62 fe ff ff e8 7a db b5 f7 90 0f 0b 90 e9 95 fe ff ff e8 6c db b5 f7 90 0f 0b 90 e9 bb fe ff ff e8 5e db b5 f7 90 <0f> 0b 90 e9 e1 fe ff ff 89 f9 80 e1 07 80 c1 03 38 c1 0f 8c 9f fc RSP: 0018:ffffc90000a08b48 EFLAGS: 00010246 RAX: ffffffff8a09d0b2 RBX: dffffc0000000000 RCX: ffff888024a23c80 RDX: 0000000000000100 RSI: 0000000000000fff RDI: 0000000000000000 RBP: 0000000000000fff R08: ffff88807e07c627 R09: 1ffff1100fc0f8c4 R10: dffffc0000000000 R11: ffffed100fc0f8c5 R12: ffff88807e07c380 R13: dffffc0000000000 R14: ffff88807e07c60c R15: 1ffff1100fc0f872 FS: 00005555604c4500(0000) GS:ffff888125af1000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00005555604df5c8 CR3: 0000000032b06000 CR4: 00000000003526f0 Call Trace: <IRQ> __sk_destruct+0x86/0x660 net/core/sock.c:2339 rcu_do_batch kernel/rcu/tree.c:2605 [inline] rcu_core+0xca8/0x1770 kernel/rcu/tree.c:2861 handle_softirqs+0x286/0x870 kernel/softirq.c:579 __do_softirq kernel/softirq.c:613 [inline] invoke_softirq kernel/softirq.c:453 [inline] __irq_exit_rcu+0xca/0x1f0 kernel/softirq.c:680 irq_exit_rcu+0x9/0x30 kernel/softirq.c:696 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1052 [inline] sysvec_apic_timer_interrupt+0xa6/0xc0 arch/x86/kernel/apic/apic.c:1052 </IRQ>
--- net/ipv4/tcp_bpf.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
net/ipv4/tcp_bpf.c +4 -1
@@ -336,8 +336,11 @@ static int tcp_bpf_send_verdict(struct sock *sk, struct sk_psock *psock,if (!psock->cork) { psock->cork =kzalloc (sizeof (*psock->cork),GFP_ATOMIC | __GFP_NOWARN); -if (!psock->cork) +if (!psock->cork) { +sk_msg_free (sk, msg); + *copied =0 ;return -ENOMEM ; + } }memcpy (psock->cork, msg,sizeof (*msg));return 0 ;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 5/81 EDAC/altera: Delete an inappropriate dma_free_coherent() call
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Salah Triki <[email protected]>
commit ff2a66d21fd2364ed9396d151115eec59612b200 upstream.
dma_free_coherent() must only be called if the corresponding dma_alloc_coherent() call has succeeded. Calling it when the allocation fails leads to undefined behavior.
Delete the wrong call.
[ bp: Massage commit message. ]
--- drivers/edac/altera_edac.c | 1 - 1 file changed, 1 deletion(-)
drivers/edac/altera_edac.c +0 -1
@@ -125,7 +125,6 @@ static ssize_t altr_sdr_mc_err_inject_wr ptemp =dma_alloc_coherent (mci->pdev,16 , &dma_handle,GFP_KERNEL );if (!ptemp) { -dma_free_coherent (mci->pdev,16 , ptemp, dma_handle);edac_printk (KERN_ERR ,EDAC_MC ,"Inject: Buffer Allocation error\n" );return -ENOMEM ;
Greg Kroah-Hartman
maintainerPATCH 6/81 ocfs2: fix recursive semaphore deadlock in fiemap call
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Tinguely <[email protected]>
commit 04100f775c2ea501927f508f17ad824ad1f23c8d upstream.
syzbot detected a OCFS2 hang due to a recursive semaphore on a FS_IOC_FIEMAP of the extent list on a specially crafted mmap file.
context_switch kernel/sched/core.c:5357 [inline] __schedule+0x1798/0x4cc0 kernel/sched/core.c:6961 __schedule_loop kernel/sched/core.c:7043 [inline] schedule+0x165/0x360 kernel/sched/core.c:7058 schedule_preempt_disabled+0x13/0x30 kernel/sched/core.c:7115 rwsem_down_write_slowpath+0x872/0xfe0 kernel/locking/rwsem.c:1185 __down_write_common kernel/locking/rwsem.c:1317 [inline] __down_write kernel/locking/rwsem.c:1326 [inline] down_write+0x1ab/0x1f0 kernel/locking/rwsem.c:1591 ocfs2_page_mkwrite+0x2ff/0xc40 fs/ocfs2/mmap.c:142 do_page_mkwrite+0x14d/0x310 mm/memory.c:3361 wp_page_shared mm/memory.c:3762 [inline] do_wp_page+0x268d/0x5800 mm/memory.c:3981 handle_pte_fault mm/memory.c:6068 [inline] __handle_mm_fault+0x1033/0x5440 mm/memory.c:6195 handle_mm_fault+0x40a/0x8e0 mm/memory.c:6364 do_user_addr_fault+0x764/0x1390 arch/x86/mm/fault.c:1387 handle_page_fault arch/x86/mm/fault.c:1476 [inline] exc_page_fault+0x76/0xf0 arch/x86/mm/fault.c:1532 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:623 RIP: 0010:copy_user_generic arch/x86/include/asm/uaccess_64.h:126 [inline] RIP: 0010:raw_copy_to_user arch/x86/include/asm/uaccess_64.h:147 [inline] RIP: 0010:_inline_copy_to_user include/linux/uaccess.h:197 [inline] RIP: 0010:_copy_to_user+0x85/0xb0 lib/usercopy.c:26 Code: e8 00 bc f7 fc 4d 39 fc 72 3d 4d 39 ec 77 38 e8 91 b9 f7 fc 4c 89
f7 89 de e8 47 25 5b fd 0f 01 cb 4c 89 ff 48 89 d9 4c 89 f6 <f3> a4 0f 1f 00 48 89 cb 0f 01 ca 48 89 d8 5b 41 5c 41 5d 41 5e 41
RSP: 0018:ffffc9000403f950 EFLAGS: 00050256
RAX: ffffffff84c7f101 RBX: 0000000000000038 RCX: 0000000000000038
RDX: 0000000000000000 RSI: ffffc9000403f9e0 RDI: 0000200000000060
RBP: ffffc9000403fa90 R08: ffffc9000403fa17 R09: 1ffff92000807f42
R10: dffffc0000000000 R11: fffff52000807f43 R12: 0000200000000098
R13: 00007ffffffff000 R14: ffffc9000403f9e0 R15: 0000200000000060
copy_to_user include/linux/uaccess.h:225 [inline] fiemap_fill_next_extent+0x1c0/0x390 fs/ioctl.c:145 ocfs2_fiemap+0x888/0xc90 fs/ocfs2/extent_map.c:806 ioctl_fiemap fs/ioctl.c:220 [inline] do_vfs_ioctl+0x1173/0x1430 fs/ioctl.c:532 __do_sys_ioctl fs/ioctl.c:596 [inline] __se_sys_ioctl+0x82/0x170 fs/ioctl.c:584 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f5f13850fd9 RSP: 002b:00007ffe3b3518b8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 0000200000000000 RCX: 00007f5f13850fd9 RDX: 0000200000000040 RSI: 00000000c020660b RDI: 0000000000000004 RBP: 6165627472616568 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00007ffe3b3518f0 R13: 00007ffe3b351b18 R14: 431bde82d7b634db R15: 00007f5f1389a03b
ocfs2_fiemap() takes a read lock of the ip_alloc_sem semaphore (since v2.6.22-527-g7307de80510a) and calls fiemap_fill_next_extent() to read the extent list of this running mmap executable. The user supplied buffer to hold the fiemap information page faults calling ocfs2_page_mkwrite() which will take a write lock (since v2.6.27-38-g00dc417fa3e7) of the same semaphore. This recursive semaphore will hold filesystem locks and causes a hang of the fileystem.
The ip_alloc_sem protects the inode extent list and size. Release the read semphore before calling fiemap_fill_next_extent() in ocfs2_fiemap() and ocfs2_fiemap_inline(). This does an unnecessary semaphore lock/unlock on the last extent but simplifies the error path.
--- fs/ocfs2/extent_map.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
fs/ocfs2/extent_map.c +9 -1
@@ -698,6 +698,8 @@ out:* it not only handles the fiemap for inlined files, but also deals * with the fast symlink, cause they have no difference for extent * mapping per se. +* +* Must be called with ip_alloc_sem semaphore held. */ static int ocfs2_fiemap_inline(struct inode *inode, struct buffer_head *di_bh, struct fiemap_extent_info *fieinfo,
@@ -709,6 +711,7 @@ static int ocfs2_fiemap_inline(struct inu64 phys;u32 flags =FIEMAP_EXTENT_DATA_INLINE |FIEMAP_EXTENT_LAST ;struct ocfs2_inode_info *oi =OCFS2_I (inode); +lockdep_assert_held_read (&oi->ip_alloc_sem); di = (struct ocfs2_dinode *)di_bh->b_data;if (ocfs2_inode_is_fast_symlink (inode))
@@ -724,8 +727,11 @@ static int ocfs2_fiemap_inline(struct in phys += offsetof(struct ocfs2_dinode , id2.i_data.id_data); +/* Release the ip_alloc_sem to prevent deadlock on page fault */ +up_read (&OCFS2_I (inode)->ip_alloc_sem); ret =fiemap_fill_next_extent (fieinfo,0 , phys, id_count, flags); +down_read (&OCFS2_I (inode)->ip_alloc_sem);if (ret <0 )return ret; }
@@ -796,9 +802,11 @@ int ocfs2_fiemap(struct inode *inode, st len_bytes = (u64 )le16_to_cpu (rec.e_leaf_clusters) << osb->s_clustersize_bits; phys_bytes =le64_to_cpu (rec.e_blkno) << osb->sb->s_blocksize_bits; virt_bytes = (u64 )le32_to_cpu (rec.e_cpos) << osb->s_clustersize_bits; - +/* Release the ip_alloc_sem to prevent deadlock on page fault */ +up_read (&OCFS2_I (inode)->ip_alloc_sem); ret =fiemap_fill_next_extent (fieinfo, virt_bytes, phys_bytes, len_bytes, fe_flags); +down_read (&OCFS2_I (inode)->ip_alloc_sem);if (ret)break ;
Greg Kroah-Hartman
maintainerPATCH 7/81 mtd: rawnand: stm32_fmc2: fix ECC overwrite
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christophe Kerello <[email protected]>
commit 811c0da4542df3c065f6cb843ced68780e27bb44 upstream.
In case OOB write is requested during a data write, ECC is currently lost. Avoid this issue by only writing in the free spare area. This issue has been seen with a YAFFS2 file system.
--- drivers/mtd/nand/raw/stm32_fmc2_nand.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)
drivers/mtd/nand/raw/stm32_fmc2_nand.c +15 -3
@@ -1037,9 +1037,21 @@ static int stm32_fmc2_sequencer_write(st/* Write oob */ if (oob_required) { - ret =nand_change_write_column_op (chip, mtd->writesize, - chip->oob_poi, mtd->oobsize, - false); +unsigned int offset_in_page = mtd->writesize; +const void *buf = chip->oob_poi; +unsigned int len = mtd->oobsize; + +if (!raw) { +struct mtd_oob_region oob_free; + +mtd_ooblayout_free (mtd,0 , &oob_free); + offset_in_page += oob_free.offset; + buf += oob_free.offset; + len = oob_free.length; + } + + ret =nand_change_write_column_op (chip, offset_in_page, + buf, len, false);if (ret)return ret; }
Greg Kroah-Hartman
maintainerPATCH 8/81 fuse: check if copy_file_range() returns larger than requested size
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Miklos Szeredi <[email protected]>
commit e5203209b3935041dac541bc5b37efb44220cc0b upstream.
Just like write(), copy_file_range() should check if the return value is less or equal to the requested number of bytes.
--- fs/fuse/file.c | 3 +++ 1 file changed, 3 insertions(+)
fs/fuse/file.c +3 -0
@@ -3365,6 +3365,9 @@ static ssize_t __fuse_copy_file_range(st fc->no_copy_file_range =1 ; err = -EOPNOTSUPP ; } +if (!err && outarg.size > len) + err = -EIO ; +if (err) goto out;
Greg Kroah-Hartman
maintainerPATCH 9/81 fuse: prevent overflow in copy_file_range return value
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Miklos Szeredi <[email protected]>
commit 1e08938c3694f707bb165535df352ac97a8c75c9 upstream.
The FUSE protocol uses struct fuse_write_out to convey the return value of copy_file_range, which is restricted to uint32_t. But the COPY_FILE_RANGE interface supports a 64-bit size copies.
Currently the number of bytes copied is silently truncated to 32-bit, which may result in poor performance or even failure to copy in case of truncation to zero.
--- fs/fuse/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/fuse/file.c +1 -1
@@ -3299,7 +3299,7 @@ static ssize_t __fuse_copy_file_range(st .nodeid_out = ff_out->nodeid, .fh_out = ff_out->fh, .off_out = pos_out, - .len = len, + .len = min_t(size_t, len, UINT_MAX & PAGE_MASK), .flags = flags };struct fuse_write_out outarg;
Greg Kroah-Hartman
maintainercover 5.4.300-rc1 review
This is the start of the stable review cycle for the 5.4.300 release. There are 81 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 Thu, 02 Oct 2025 14:37:59 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.4.300-rc1.gz
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.4.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 5.4.300-rc1
Jinjiang Tu <[email protected]>
mm/hugetlb: fix folio is still mapped when deleted
Lukasz Czapnik <[email protected]>
i40e: add mask to apply valid bits for itr_idx
Lukasz Czapnik <[email protected]>
i40e: fix validation of VF state in get resources
Lukasz Czapnik <[email protected]>
i40e: fix idx validation in config queues msg
Lukasz Czapnik <[email protected]>
i40e: add validation for ring_len param
Justin Bronder <[email protected]>
i40e: increase max descriptors for XL710
David Hildenbrand <[email protected]>
mm/migrate_device: don't add folio to be freed to LRU in migrate_device_finalize()
Thomas Zimmermann <[email protected]>
fbcon: Fix OOB access in font allocation
Samasth Norway Ananda <[email protected]>
fbcon: fix integer overflow in fbcon_do_set_font
Lukasz Czapnik <[email protected]>
i40e: add max boundary check for VF filters
Lukasz Czapnik <[email protected]>
i40e: fix input validation logic for action_meta
Lukasz Czapnik <[email protected]>
i40e: fix idx validation in i40e_validate_queue_map
Zabelin Nikita <[email protected]>
drm/gma500: Fix null dereference in hdmi teardown
Stéphane Grosjean <[email protected]>
can: peak_usb: fix shift-out-of-bounds issue
Vincent Mailhol <[email protected]>
can: mcba_usb: populate ndo_change_mtu() to prevent buffer overflow
Vincent Mailhol <[email protected]>
can: sun4i_can: populate ndo_change_mtu() to prevent buffer overflow
Vincent Mailhol <[email protected]>
can: hi311x: populate ndo_change_mtu() to prevent buffer overflow
Geert Uytterhoeven <[email protected]>
can: rcar_can: rcar_can_resume(): fix s2ram with PSCI
Or Har-Toov <[email protected]>
IB/mlx5: Fix obj_type mismatch for SRQ event subscriptions
Jiayi Li <[email protected]>
usb: core: Add 0x prefix to quirks debug output
Takashi Iwai <[email protected]>
ALSA: usb-audio: Fix build with CONFIG_INPUT=n
Chen Ni <[email protected]>
ALSA: usb-audio: Convert comma to semicolon
Cristian Ciocaltea <[email protected]>
ALSA: usb-audio: Add mixer quirk for Sony DualSense PS5
Cristian Ciocaltea <[email protected]>
ALSA: usb-audio: Remove unneeded wmb() in mixer_quirks
Cristian Ciocaltea <[email protected]>
ALSA: usb-audio: Simplify NULL comparison in mixer_quirks
Cristian Ciocaltea <[email protected]>
ALSA: usb-audio: Avoid multiple assignments in mixer_quirks
Cristian Ciocaltea <[email protected]>
ALSA: usb-audio: Fix block comments in mixer_quirks
Maciej S. Szmigiero <[email protected]>
KVM: SVM: Sync TPR from LAPIC into VMCB::V_TPR even if AVIC is active
Hans de Goede <[email protected]>
net: rfkill: gpio: Fix crash due to dereferencering uninitialized pointer
Philipp Zabel <[email protected]>
net: rfkill: gpio: add DT support
Hugo Villeneuve <[email protected]>
serial: sc16is7xx: fix bug in flow control levels init
Alan Stern <[email protected]>
USB: gadget: dummy-hcd: Fix locking bug in RT-enabled kernels
Jakob Koschel <[email protected]>
usb: gadget: dummy_hcd: remove usage of list iterator past the loop body
Colin Ian King <[email protected]>
ASoC: SOF: Intel: hda-stream: Fix incorrect variable used in error message
Charles Keepax <[email protected]>
ASoC: wm8974: Correct PLL rate rounding
Charles Keepax <[email protected]>
ASoC: wm8940: Correct typo in control name
Håkon Bugge <[email protected]>
rds: ib: Increment i_fastreg_wrs before bailing out
Thomas Fourier <[email protected]>
mmc: mvsdio: Fix dma_unmap_sg() nents value
H. Nikolaus Schaller <[email protected]>
power: supply: bq27xxx: restrict no-battery detection to bq27000
H. Nikolaus Schaller <[email protected]>
power: supply: bq27xxx: fix error return in case of no bq27000 hdq battery
Nathan Chancellor <[email protected]>
nilfs2: fix CFI failure when accessing /sys/fs/nilfs2/features/*
Duoming Zhou <[email protected]>
cnic: Fix use-after-free bugs in cnic_delete_task
Alexey Nepomnyashih <[email protected]>
net: liquidio: fix overflow in octeon_init_instr_queue()
Tariq Toukan <[email protected]>
Revert "net/mlx5e: Update and set Xon/Xoff upon port speed set"
Kuniyuki Iwashima <[email protected]>
tcp: Clear tcp_sk(sk)->fastopen_rsk in tcp_disconnect().
Maciej Fijalkowski <[email protected]>
i40e: remove redundant memory barrier when cleaning Tx descs
Yeounsu Moon <[email protected]>
net: natsemi: fix rx_dropped double accounting on netif_rx() failure
Chen Ridong <[email protected]>
cgroup: split cgroup_destroy_wq into 3 workqueues
Geert Uytterhoeven <[email protected]>
pcmcia: omap_cf: Mark driver struct with __refdata to prevent section mismatch
Liao Yuanhong <[email protected]>
wifi: mac80211: fix incorrect type for ret
Takashi Sakamoto <[email protected]>
ALSA: firewire-motu: drop EPOLLOUT from poll return values as write is not supported
Miaohe Lin <[email protected]>
mm/memory-failure: fix VM_BUG_ON_PAGE(PagePoisoned(page)) when unpoison memory
Bjorn Andersson <[email protected]>
soc: qcom: mdt_loader: Deal with zero e_shentsize
Johan Hovold <[email protected]>
phy: ti-pipe3: fix device leak at unbind
Stephan Gerhold <[email protected]>
dmaengine: qcom: bam_dma: Fix DT error handling for num-channels/ees
Anders Roxell <[email protected]>
dmaengine: ti: edma: Fix memory allocation size for queue_priority_map
Tetsuo Handa <[email protected]>
can: j1939: j1939_local_ecu_get(): undo increment when j1939_local_ecu_get() fails
Tetsuo Handa <[email protected]>
can: j1939: j1939_sk_bind(): call j1939_priv_put() immediately when j1939_local_ecu_get() failed
Michal Schmidt <[email protected]>
i40e: fix IRQ freeing in i40e_vsi_request_irq_msix error path
Nitesh Narayan Lal <[email protected]>
i40e: Use irq_update_affinity_hint()
Thomas Gleixner <[email protected]>
genirq: Provide new interfaces for affinity hints
Thomas Gleixner <[email protected]>
genirq: Export affinity setter for modules
John Garry <[email protected]>
genirq/affinity: Add irq_update_affinity_desc()
Kohei Enju <[email protected]>
igb: fix link test skipping when interface is admin down
Stefan Wahren <[email protected]>
net: fec: Fix possible NPD in fec_enet_phy_reset_after_clk_enable()
Fabio Porcedda <[email protected]>
USB: serial: option: add Telit Cinterion LE910C4-WWX new compositions
Fabio Porcedda <[email protected]>
USB: serial: option: add Telit Cinterion FN990A w/audio compositions
Fabian Vogt <[email protected]>
tty: hvc_console: Call hvc_kick in hvc_write unconditionally
Alexander Sverdlin <[email protected]>
mtd: nand: raw: atmel: Respect tAR, tCLR in read setup timing
Alexander Dahl <[email protected]>
mtd: nand: raw: atmel: Fix comment in timings preparation
Christophe Kerello <[email protected]>
mtd: rawnand: stm32_fmc2: avoid overlapping mappings on ECC buffer
Wei Yang <[email protected]>
mm/khugepaged: fix the address passed to notifier on testing young
Miklos Szeredi <[email protected]>
fuse: prevent overflow in copy_file_range return value
Miklos Szeredi <[email protected]>
fuse: check if copy_file_range() returns larger than requested size
Christophe Kerello <[email protected]>
mtd: rawnand: stm32_fmc2: fix ECC overwrite
Mark Tinguely <[email protected]>
ocfs2: fix recursive semaphore deadlock in fiemap call
Salah Triki <[email protected]>
EDAC/altera: Delete an inappropriate dma_free_coherent() call
Kuniyuki Iwashima <[email protected]>
tcp_bpf: Call sk_msg_free() when tcp_bpf_send_verdict() fails to allocate psock->cork.
Trond Myklebust <[email protected]>
NFSv4: Don't clear capabilities that won't be reset
Kuniyuki Iwashima <[email protected]>
net: Fix null-ptr-deref by sock_lock_init_class_and_name() and rmmod.
Mathias Nyman <[email protected]>
usb: hub: Fix flushing of delayed work used for post resume purposes
-------------
Diffstat:
Makefile | 4 +- arch/x86/kvm/svm.c | 3 +- drivers/dma/qcom/bam_dma.c | 8 +- drivers/dma/ti/edma.c | 4 +- drivers/edac/altera_edac.c | 1 - drivers/gpu/drm/gma500/oaktrail_hdmi.c | 2 +- drivers/infiniband/hw/mlx5/devx.c | 1 + drivers/mmc/host/mvsdio.c | 2 +- drivers/mtd/nand/raw/atmel/nand-controller.c | 18 +- drivers/mtd/nand/raw/stm32_fmc2_nand.c | 45 ++-- drivers/net/can/rcar/rcar_can.c | 8 +- drivers/net/can/spi/hi311x.c | 1 + drivers/net/can/sun4i_can.c | 1 + drivers/net/can/usb/mcba_usb.c | 1 + drivers/net/can/usb/peak_usb/pcan_usb_core.c | 2 +- drivers/net/ethernet/broadcom/cnic.c | 3 +- .../net/ethernet/cavium/liquidio/request_manager.c | 2 +- drivers/net/ethernet/freescale/fec_main.c | 3 +- drivers/net/ethernet/intel/i40e/i40e.h | 1 + drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 25 +- drivers/net/ethernet/intel/i40e/i40e_main.c | 10 +- drivers/net/ethernet/intel/i40e/i40e_txrx.c | 3 - drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 46 +++- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h | 3 +- drivers/net/ethernet/intel/igb/igb_ethtool.c | 5 +- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 2 - drivers/net/ethernet/natsemi/ns83820.c | 13 +- drivers/pcmcia/omap_cf.c | 8 +- drivers/phy/ti/phy-ti-pipe3.c | 13 + drivers/power/supply/bq27xxx_battery.c | 4 +- drivers/soc/qcom/mdt_loader.c | 12 +- drivers/tty/hvc/hvc_console.c | 6 +- drivers/tty/serial/sc16is7xx.c | 13 +- drivers/usb/core/hub.c | 21 +- drivers/usb/core/hub.h | 1 + drivers/usb/core/quirks.c | 2 +- drivers/usb/gadget/udc/dummy_hcd.c | 25 +- drivers/usb/serial/option.c | 17 ++ drivers/video/fbdev/core/fbcon.c | 13 +- fs/fuse/file.c | 5 +- fs/hugetlbfs/inode.c | 14 +- fs/nfs/nfs4proc.c | 1 - fs/nilfs2/sysfs.c | 4 +- fs/nilfs2/sysfs.h | 8 +- fs/ocfs2/extent_map.c | 10 +- include/linux/interrupt.h | 96 ++++--- include/net/sock.h | 40 ++- kernel/cgroup/cgroup.c | 43 +++- kernel/irq/manage.c | 111 +++++++- mm/khugepaged.c | 2 +- mm/memory-failure.c | 7 +- mm/migrate.c | 12 +- net/can/j1939/bus.c | 5 +- net/can/j1939/socket.c | 3 + net/core/sock.c | 5 + net/ipv4/tcp.c | 5 + net/ipv4/tcp_bpf.c | 5 +- net/mac80211/driver-ops.h | 2 +- net/rds/ib_frmr.c | 20 +- net/rfkill/rfkill-gpio.c | 22 +- sound/firewire/motu/motu-hwdep.c | 2 +- sound/soc/codecs/wm8940.c | 2 +- sound/soc/codecs/wm8974.c | 8 +- sound/soc/sof/intel/hda-stream.c | 2 +- sound/usb/mixer_quirks.c | 279 ++++++++++++++++++++- 65 files changed, 829 insertions(+), 236 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 26/81 dmaengine: ti: edma: Fix memory allocation size for queue_priority_map
5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anders Roxell <[email protected]>
[ Upstream commit e63419dbf2ceb083c1651852209c7f048089ac0f ]
Fix a critical memory allocation bug in edma_setup_from_hw() where queue_priority_map was allocated with insufficient memory. The code declared queue_priority_map as s8 (*)[2] (pointer to array of 2 s8), but allocated memory using sizeof(s8) instead of the correct size.
This caused out-of-bounds memory writes when accessing:
queue_priority_map[i][0] = i; queue_priority_map[i][1] = i;
The bug manifested as kernel crashes with "Oops - undefined instruction" on ARM platforms (BeagleBoard-X15) during EDMA driver probe, as the memory corruption triggered kernel hardening features on Clang.
Change the allocation to use sizeof(*queue_priority_map) which automatically gets the correct size for the 2D array structure.
--- drivers/dma/ti/edma.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/dma/ti/edma.c +2 -2
@@ -2029,8 +2029,8 @@ static int edma_setup_from_hw(struct device *dev, struct edma_soc_info *pdata,* priority. So Q0 is the highest priority queue and the last queue has * the lowest priority. */ - queue_priority_map =devm_kcalloc (dev, ecc->num_tc +1 ,sizeof (s8), -GFP_KERNEL ); + queue_priority_map =devm_kcalloc (dev, ecc->num_tc +1 , +sizeof (*queue_priority_map),GFP_KERNEL );if (!queue_priority_map)return -ENOMEM ;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 35/81 net: natsemi: fix `rx_dropped` double accounting on `netif_rx()` failure
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yeounsu Moon <[email protected]>
[ Upstream commit 93ab4881a4e2b9657bdce4b8940073bfb4ed5eab ]
netif_rx() already increments rx_dropped core stat when it fails. The driver was also updating ndev->stats.rx_dropped in the same path. Since both are reported together via ip -s -s command, this resulted in drops being counted twice in user-visible stats.
Keep the driver update on if (unlikely(!skb)), but skip it after netif_rx() errors.
--- drivers/net/ethernet/natsemi/ns83820.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
drivers/net/ethernet/natsemi/ns83820.c +6 -7
@@ -818,7 +818,7 @@ static void rx_irq(struct net_device *ndev)struct ns83820 *dev =PRIV (ndev);struct rx_info *info = &dev->rx_info;unsigned next_rx; -int rx_rc, len; +int len;u32 cmdsts;__le32 *desc;unsigned long flags;
@@ -879,8 +879,10 @@ static void rx_irq(struct net_device *ndev)if (likely (CMDSTS_OK & cmdsts)) {#endif skb_put (skb, len); -if (unlikely (!skb)) +if (unlikely (!skb)) { + ndev->stats.rx_dropped++; goto netdev_mangle_me_harder_failed; + }if (cmdsts &CMDSTS_DEST_MULTI ) ndev->stats.multicast++; ndev->stats.rx_packets++;
@@ -899,15 +901,12 @@ static void rx_irq(struct net_device *ndev) __vlan_hwaccel_put_tag(skb, htons(ETH_P_IPV6), tag); }#endif - rx_rc =netif_rx (skb); -if (NET_RX_DROP == rx_rc) { -netdev_mangle_me_harder_failed: - ndev->stats.rx_dropped++; - } +netif_rx (skb); }else {dev_kfree_skb_irq (skb); } +netdev_mangle_me_harder_failed: nr++; next_rx = info->next_rx; desc = info->descs + (DESC_SIZE * next_rx);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 36/81 i40e: remove redundant memory barrier when cleaning Tx descs
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maciej Fijalkowski <[email protected]>
[ Upstream commit e37084a26070c546ae7961ee135bbfb15fbe13fd ]
i40e has a feature which writes to memory location last descriptor successfully sent. Memory barrier in i40e_clean_tx_irq() was used to avoid forward-reading descriptor fields in case DD bit was not set. Having mentioned feature in place implies that such situation will not happen as we know in advance how many descriptors HW has dealt with.
Besides, this barrier placement was wrong. Idea is to have this protection *after* reading DD bit from HW descriptor, not before. Digging through git history showed me that indeed barrier was before DD bit check, anyways the commit introducing i40e_get_head() should have wiped it out altogether.
Also, there was one commit doing s/read_barrier_depends/smp_rmb when get head feature was already in place, but it was only theoretical based on ixgbe experiences, which is different in these terms as that driver has to read DD bit from HW descriptor.
--- drivers/net/ethernet/intel/i40e/i40e_txrx.c | 3 --- 1 file changed, 3 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_txrx.c +0 -3
@@ -794,9 +794,6 @@ static bool i40e_clean_tx_irq(struct i40e_vsi *vsi,if (!eop_desc)break ; -/* prevent any other reads prior to eop_desc */ -smp_rmb (); -i40e_trace (clean_tx_irq, tx_ring, tx_desc, tx_buf);/* we have caught up to head, no work left to do */ if (tx_head == tx_desc)
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 37/81 tcp: Clear tcp_sk(sk)->fastopen_rsk in tcp_disconnect().
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <[email protected]>
[ Upstream commit 45c8a6cc2bcd780e634a6ba8e46bffbdf1fc5c01 ]
syzbot reported the splat below where a socket had tcp_sk(sk)->fastopen_rsk in the TCP_ESTABLISHED state. [0]
syzbot reused the server-side TCP Fast Open socket as a new client before the TFO socket completes 3WHS:
1. accept()
2. connect(AF_UNSPEC)
3. connect() to another destination
As of accept(), sk->sk_state is TCP_SYN_RECV, and tcp_disconnect() changes it to TCP_CLOSE and makes connect() possible, which restarts timers.
Since tcp_disconnect() forgot to clear tcp_sk(sk)->fastopen_rsk, the retransmit timer triggered the warning and the intended packet was not retransmitted.
Let's call reqsk_fastopen_remove() in tcp_disconnect().
[0]:
WARNING: CPU: 2 PID: 0 at net/ipv4/tcp_timer.c:542 tcp_retransmit_timer (net/ipv4/tcp_timer.c:542 (discriminator 7)) Modules linked in: CPU: 2 UID: 0 PID: 0 Comm: swapper/2 Not tainted 6.17.0-rc5-g201825fb4278 #62 PREEMPT(voluntary) Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 RIP: 0010:tcp_retransmit_timer (net/ipv4/tcp_timer.c:542 (discriminator 7)) Code: 41 55 41 54 55 53 48 8b af b8 08 00 00 48 89 fb 48 85 ed 0f 84 55 01 00 00 0f b6 47 12 3c 03 74 0c 0f b6 47 12 3c 04 74 04 90 <0f> 0b 90 48 8b 85 c0 00 00 00 48 89 ef 48 8b 40 30 e8 6a 4f 06 3e RSP: 0018:ffffc900002f8d40 EFLAGS: 00010293 RAX: 0000000000000002 RBX: ffff888106911400 RCX: 0000000000000017 RDX: 0000000002517619 RSI: ffffffff83764080 RDI: ffff888106911400 RBP: ffff888106d5c000 R08: 0000000000000001 R09: ffffc900002f8de8 R10: 00000000000000c2 R11: ffffc900002f8ff8 R12: ffff888106911540 R13: ffff888106911480 R14: ffff888106911840 R15: ffffc900002f8de0 FS: 0000000000000000(0000) GS:ffff88907b768000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f8044d69d90 CR3: 0000000002c30003 CR4: 0000000000370ef0 Call Trace: <IRQ> tcp_write_timer (net/ipv4/tcp_timer.c:738) call_timer_fn (kernel/time/timer.c:1747) __run_timers (kernel/time/timer.c:1799 kernel/time/timer.c:2372) timer_expire_remote (kernel/time/timer.c:2385 kernel/time/timer.c:2376 kernel/time/timer.c:2135) tmigr_handle_remote_up (kernel/time/timer_migration.c:944 kernel/time/timer_migration.c:1035) __walk_groups.isra.0 (kernel/time/timer_migration.c:533 (discriminator 1)) tmigr_handle_remote (kernel/time/timer_migration.c:1096) handle_softirqs (./arch/x86/include/asm/jump_label.h:36 ./include/trace/events/irq.h:142 kernel/softirq.c:580) irq_exit_rcu (kernel/softirq.c:614 kernel/softirq.c:453 kernel/softirq.c:680 kernel/softirq.c:696) sysvec_apic_timer_interrupt (arch/x86/kernel/apic/apic.c:1050 (discriminator 35) arch/x86/kernel/apic/apic.c:1050 (discriminator 35)) </IRQ>
--- net/ipv4/tcp.c | 5 +++++ 1 file changed, 5 insertions(+)
net/ipv4/tcp.c +5 -0
@@ -2593,6 +2593,7 @@ int tcp_disconnect(struct sock *sk, int flags)struct inet_connection_sock *icsk =inet_csk (sk);struct tcp_sock *tp =tcp_sk (sk);int old_state = sk->sk_state; +struct request_sock *req;u32 seq;/* Deny disconnect if other threads are blocked in sk_wait_event()
@@ -2711,6 +2712,10 @@ int tcp_disconnect(struct sock *sk, int flags)/* Clean up fastopen related fields */ + req =rcu_dereference_protected (tp->fastopen_rsk, +lockdep_sock_is_held (sk)); +if (req) +reqsk_fastopen_remove (sk, req, false);tcp_free_fastopen_req (tp); inet->defer_connect =0 ; tp->fastopen_client_fail =0 ;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 38/81 Revert "net/mlx5e: Update and set Xon/Xoff upon port speed set"
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tariq Toukan <[email protected]>
[ Upstream commit 3fbfe251cc9f6d391944282cdb9bcf0bd02e01f8 ]
This reverts commit d24341740fe48add8a227a753e68b6eedf4b385a. It causes errors when trying to configure QoS, as well as loss of L2 connectivity (on multi-host devices).
--- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 2 -- 1 file changed, 2 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +0 -2
@@ -141,8 +141,6 @@ void mlx5e_update_carrier(struct mlx5e_priv *priv)if (port_state ==VPORT_STATE_UP ) {netdev_info (priv->netdev,"Link up\n" );netif_carrier_on (priv->netdev); -mlx5e_port_manual_buffer_config (priv,0 , priv->netdev->mtu, -NULL ,NULL ,NULL ); }else {netdev_info (priv->netdev,"Link down\n" );netif_carrier_off (priv->netdev);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 39/81 net: liquidio: fix overflow in octeon_init_instr_queue()
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexey Nepomnyashih <[email protected]>
[ Upstream commit cca7b1cfd7b8a0eff2a3510c5e0f10efe8fa3758 ]
The expression (conf->instr_type == 64) << iq_no can overflow because iq_no may be as high as 64 (CN23XX_MAX_RINGS_PER_PF). Casting the operand to u64 ensures correct 64-bit arithmetic.
--- drivers/net/ethernet/cavium/liquidio/request_manager.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/cavium/liquidio/request_manager.c +1 -1
@@ -139,7 +139,7 @@ int octeon_init_instr_queue(struct octeon_device *oct, oct->io_qmask.iq |=BIT_ULL (iq_no);/* Set the 32B/64B mode for each input queue */ - oct->io_qmask.iq64B |= ((conf->instr_type ==64 ) << iq_no); + oct->io_qmask.iq64B |= ((u64)(conf->instr_type ==64 ) << iq_no); iq->iqcmd_64B = (conf->instr_type ==64 ); oct->fn_list.setup_iq_regs (oct, iq_no);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 40/81 cnic: Fix use-after-free bugs in cnic_delete_task
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Duoming Zhou <[email protected]>
[ Upstream commit cfa7d9b1e3a8604afc84e9e51d789c29574fb216 ]
The original code uses cancel_delayed_work() in cnic_cm_stop_bnx2x_hw(), which does not guarantee that the delayed work item 'delete_task' has fully completed if it was already running. Additionally, the delayed work item is cyclic, the flush_workqueue() in cnic_cm_stop_bnx2x_hw() only blocks and waits for work items that were already queued to the workqueue prior to its invocation. Any work items submitted after flush_workqueue() is called are not included in the set of tasks that the flush operation awaits. This means that after the cyclic work items have finished executing, a delayed work item may still exist in the workqueue. This leads to use-after-free scenarios where the cnic_dev is deallocated by cnic_free_dev(), while delete_task remains active and attempt to dereference cnic_dev in cnic_delete_task().
A typical race condition is illustrated below:
CPU 0 (cleanup) | CPU 1 (delayed work callback)
cnic_netdev_event() |
cnic_stop_hw() | cnic_delete_task()
cnic_cm_stop_bnx2x_hw() | ...
cancel_delayed_work() | /* the queue_delayed_work()
flush_workqueue() | executes after flush_workqueue()*/
| queue_delayed_work()
cnic_free_dev(dev)//free | cnic_delete_task() //new instance
| dev = cp->dev; //useReplace cancel_delayed_work() with cancel_delayed_work_sync() to ensure that the cyclic delayed work item is properly canceled and that any ongoing execution of the work item completes before the cnic_dev is deallocated. Furthermore, since cancel_delayed_work_sync() uses __flush_work(work, true) to synchronously wait for any currently executing instance of the work item to finish, the flush_workqueue() becomes redundant and should be removed.
This bug was identified through static analysis. To reproduce the issue and validate the fix, I simulated the cnic PCI device in QEMU and introduced intentional delays — such as inserting calls to ssleep() within the cnic_delete_task() function — to increase the likelihood of triggering the bug.
--- drivers/net/ethernet/broadcom/cnic.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/ethernet/broadcom/cnic.c +1 -2
@@ -4224,8 +4224,7 @@ static void cnic_cm_stop_bnx2x_hw(struct cnic_dev *dev)cnic_bnx2x_delete_wait (dev,0 ); -cancel_delayed_work (&cp->delete_task); -flush_workqueue (cnic_wq); +cancel_delayed_work_sync (&cp->delete_task);if (atomic_read (&cp->iscsi_conn) !=0 ) netdev_warn(dev->netdev, "%d iSCSI connections not destroyed\n",
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 41/81 nilfs2: fix CFI failure when accessing /sys/fs/nilfs2/features/*
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nathan Chancellor <[email protected]>
commit 025e87f8ea2ae3a28bf1fe2b052bfa412c27ed4a upstream.
When accessing one of the files under /sys/fs/nilfs2/features when CONFIG_CFI_CLANG is enabled, there is a CFI violation:
CFI failure at kobj_attr_show+0x59/0x80 (target: nilfs_feature_revision_show+0x0/0x30; expected type: 0xfc392c4d)
...
Call Trace: <TASK> sysfs_kf_seq_show+0x2a6/0x390 ? __cfi_kobj_attr_show+0x10/0x10 kernfs_seq_show+0x104/0x15b seq_read_iter+0x580/0xe2b ...
When the kobject of the kset for /sys/fs/nilfs2 is initialized, its ktype is set to kset_ktype, which has a ->sysfs_ops of kobj_sysfs_ops. When nilfs_feature_attr_group is added to that kobject via sysfs_create_group(), the kernfs_ops of each files is sysfs_file_kfops_rw, which will call sysfs_kf_seq_show() when ->seq_show() is called. sysfs_kf_seq_show() in turn calls kobj_attr_show() through ->sysfs_ops->show(). kobj_attr_show() casts the provided attribute out to a 'struct kobj_attribute' via container_of() and calls ->show(), resulting in the CFI violation since neither nilfs_feature_revision_show() nor nilfs_feature_README_show() match the prototype of ->show() in 'struct kobj_attribute'.
Resolve the CFI violation by adjusting the second parameter in nilfs_feature_{revision,README}_show() from 'struct attribute' to 'struct kobj_attribute' to match the expected prototype.
--- fs/nilfs2/sysfs.c | 4 ++-- fs/nilfs2/sysfs.h | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-)
fs/nilfs2/sysfs.c +2 -2
@@ -1081,7 +1081,7 @@ void nilfs_sysfs_delete_device_group(str************************************************************************/ static ssize_t nilfs_feature_revision_show (struct kobject *kobj, -struct attribute *attr,char *buf) +struct kobj_attribute *attr,char *buf) {return sysfs_emit (buf,"%d.%d\n" ,NILFS_CURRENT_REV ,NILFS_MINOR_REV );
@@ -1093,7 +1093,7 @@ static const char features_readme_str[]"(1) revision\n\tshow current revision of NILFS file system driver.\n" ;static ssize_t nilfs_feature_README_show (struct kobject *kobj, -struct attribute *attr, +struct kobj_attribute *attr,char *buf) {return sysfs_emit (buf, features_readme_str);
fs/nilfs2/sysfs.h +4 -4
@@ -50,16 +50,16 @@ struct nilfs_sysfs_dev_subgroups {struct completion sg_segments_kobj_unregister; }; -#define NILFS_COMMON_ATTR_STRUCT (name) \ +#define NILFS_KOBJ_ATTR_STRUCT (name) \ struct nilfs_##name##_attr { \ struct attribute attr; \ - ssize_t (*show)(struct kobject *, struct attribute *, \ + ssize_t (*show)(struct kobject *, struct kobj_attribute *, \ char *); \ - ssize_t (*store)(struct kobject *, struct attribute *, \ + ssize_t (*store)(struct kobject *, struct kobj_attribute *, \ const char *, size_t); \ } -NILFS_COMMON_ATTR_STRUCT (feature); +NILFS_KOBJ_ATTR_STRUCT (feature);#define NILFS_DEV_ATTR_STRUCT (name) \ struct nilfs_##name##_attr { \
Greg Kroah-Hartman
maintainerPATCH 42/81 power: supply: bq27xxx: fix error return in case of no bq27000 hdq battery
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: H. Nikolaus Schaller <[email protected]>
commit 2c334d038466ac509468fbe06905a32d202117db upstream.
Since commit
commit f16d9fb6cf03 ("power: supply: bq27xxx: Retrieve again when busy")
the console log of some devices with hdq enabled but no bq27000 battery (like e.g. the Pandaboard) is flooded with messages like:
[ 34.247833] power_supply bq27000-battery: driver failed to report 'status' property: -1
as soon as user-space is finding a /sys entry and trying to read the "status" property.
It turns out that the offending commit changes the logic to now return the value of cache.flags if it is <0. This is likely under the assumption that it is an error number. In normal errors from bq27xxx_read() this is indeed the case.
But there is special code to detect if no bq27000 is installed or accessible through hdq/1wire and wants to report this. In that case, the cache.flags are set historically by
commit 3dd843e1c26a ("bq27000: report missing device better.")to constant -1 which did make reading properties return -ENODEV. So everything appeared to be fine before the return value was passed upwards.
Now the -1 is returned as -EPERM instead of -ENODEV, triggering the error condition in power_supply_format_property() which then floods the console log.
So we change the detection of missing bq27000 battery to simply set
cache.flags = -ENODEV
instead of -1.
--- drivers/power/supply/bq27xxx_battery.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/supply/bq27xxx_battery.c +1 -1
@@ -1553,7 +1553,7 @@ static void bq27xxx_battery_update_unloc cache.flags =bq27xxx_read (di,BQ27XXX_REG_FLAGS , has_singe_flag);if ((cache.flags &0xff ) ==0xff ) - cache.flags =-1 ;/* read error */ + cache.flags = -ENODEV ;/* read error */ if (cache.flags >=0 ) { cache.temperature =bq27xxx_battery_read_temperature (di);if (has_ci_flag && (cache.flags &BQ27000_FLAG_CI )) {
Greg Kroah-Hartman
maintainerPATCH 43/81 power: supply: bq27xxx: restrict no-battery detection to bq27000
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: H. Nikolaus Schaller <[email protected]>
commit 1e451977e1703b6db072719b37cd1b8e250b9cc9 upstream.
There are fuel gauges in the bq27xxx series (e.g. bq27z561) which may in some cases report 0xff as the value of BQ27XXX_REG_FLAGS that should not be interpreted as "no battery" like for a disconnected battery with some built in bq27000 chip.
So restrict the no-battery detection originally introduced by
commit 3dd843e1c26a ("bq27000: report missing device better.")to the bq27000.
There is no need to backport further because this was hidden before
commit f16d9fb6cf03 ("power: supply: bq27xxx: Retrieve again when busy")
--- drivers/power/supply/bq27xxx_battery.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/power/supply/bq27xxx_battery.c +2 -2
@@ -1552,8 +1552,8 @@ static void bq27xxx_battery_update_unlocbool has_singe_flag = di->opts &BQ27XXX_O_ZERO ; cache.flags =bq27xxx_read (di,BQ27XXX_REG_FLAGS , has_singe_flag); -if ((cache.flags &0xff ) ==0xff ) - cache.flags = -ENODEV ;/* read error */ +if (di->chip ==BQ27000 && (cache.flags &0xff ) ==0xff ) + cache.flags = -ENODEV ;/* bq27000 hdq read error */ if (cache.flags >=0 ) { cache.temperature =bq27xxx_battery_read_temperature (di);if (has_ci_flag && (cache.flags &BQ27000_FLAG_CI )) {
Greg Kroah-Hartman
maintainerPATCH 44/81 mmc: mvsdio: Fix dma_unmap_sg() nents value
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Fourier <[email protected]>
commit 8ab2f1c35669bff7d7ed1bb16bf5cc989b3e2e17 upstream.
The dma_unmap_sg() functions should be called with the same nents as the dma_map_sg(), not the value the map function returned.
--- drivers/mmc/host/mvsdio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/host/mvsdio.c +1 -1
@@ -292,7 +292,7 @@ static u32 mvsd_finish_data(struct mvsd_ host->pio_ptr =NULL ; host->pio_size =0 ; }else { -dma_unmap_sg (mmc_dev (host->mmc), data->sg, host->sg_frags, +dma_unmap_sg (mmc_dev (host->mmc), data->sg, data->sg_len,mmc_get_dma_dir (data)); }
Greg Kroah-Hartman
maintainerPATCH 27/81 dmaengine: qcom: bam_dma: Fix DT error handling for num-channels/ees
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stephan Gerhold <[email protected]>
commit 5068b5254812433e841a40886e695633148d362d upstream.
When we don't have a clock specified in the device tree, we have no way to ensure the BAM is on. This is often the case for remotely-controlled or remotely-powered BAM instances. In this case, we need to read num-channels from the DT to have all the necessary information to complete probing.
However, at the moment invalid device trees without clock and without num-channels still continue probing, because the error handling is missing return statements. The driver will then later try to read the number of channels from the registers. This is unsafe, because it relies on boot firmware and lucky timing to succeed. Unfortunately, the lack of proper error handling here has been abused for several Qualcomm SoCs upstream, causing early boot crashes in several situations [1, 2].
Avoid these early crashes by erroring out when any of the required DT properties are missing. Note that this will break some of the existing DTs upstream (mainly BAM instances related to the crypto engine). However, clearly these DTs have never been tested properly, since the error in the kernel log was just ignored. It's safer to disable the crypto engine for these broken DTBs.
[1]: https://lore.kernel.org/r/[email protected]/
[2]: https://lore.kernel.org/r/[email protected]/
--- drivers/dma/qcom/bam_dma.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/dma/qcom/bam_dma.c +6 -2
@@ -1266,13 +1266,17 @@ static int bam_dma_probe(struct platformif (bdev->controlled_remotely) { ret =of_property_read_u32 (pdev->dev.of_node,"num-channels" , &bdev->num_channels); -if (ret) +if (ret) {dev_err (bdev->dev,"num-channels unspecified in dt\n" ); +return ret; + } ret =of_property_read_u32 (pdev->dev.of_node,"qcom,num-ees" , &bdev->num_ees); -if (ret) +if (ret) {dev_err (bdev->dev,"num-ees unspecified in dt\n" ); +return ret; + } } bdev->bamclk =devm_clk_get (bdev->dev,"bam_clk" );
Greg Kroah-Hartman
maintainerPATCH 45/81 rds: ib: Increment i_fastreg_wrs before bailing out
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Håkon Bugge <[email protected]>
commit 4351ca3fcb3ffecf12631b4996bf085a2dad0db6 upstream.
We need to increment i_fastreg_wrs before we bail out from rds_ib_post_reg_frmr().
We have a fixed budget of how many FRWR operations that can be outstanding using the dedicated QP used for memory registrations and de-registrations. This budget is enforced by the atomic_t i_fastreg_wrs. If we bail out early in rds_ib_post_reg_frmr(), we will "leak" the possibility of posting an FRWR operation, and if that accumulates, no FRWR operation can be carried out.
--- net/rds/ib_frmr.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-)
net/rds/ib_frmr.c +12 -8
@@ -133,12 +133,15 @@ static int rds_ib_post_reg_frmr(struct r ret =ib_map_mr_sg_zbva (frmr->mr, ibmr->sg, ibmr->sg_dma_len, &off,PAGE_SIZE ); -if (unlikely (ret != ibmr->sg_dma_len)) -return ret <0 ? ret : -EINVAL ; +if (unlikely (ret != ibmr->sg_dma_len)) { + ret = ret <0 ? ret : -EINVAL ; + goto out_inc; + } -if (cmpxchg (&frmr->fr_state, -FRMR_IS_FREE ,FRMR_IS_INUSE ) !=FRMR_IS_FREE ) -return -EBUSY ; +if (cmpxchg (&frmr->fr_state,FRMR_IS_FREE ,FRMR_IS_INUSE ) !=FRMR_IS_FREE ) { + ret = -EBUSY ; + goto out_inc; + }atomic_inc (&ibmr->ic->i_fastreg_inuse_count);
@@ -166,11 +169,10 @@ static int rds_ib_post_reg_frmr(struct r/* Failure here can be because of -ENOMEM as well */ rds_transition_frwr_state (ibmr,FRMR_IS_INUSE ,FRMR_IS_STALE ); -atomic_inc (&ibmr->ic->i_fastreg_wrs);if (printk_ratelimit ())pr_warn ("RDS/IB: %s returned error(%d)\n" , __func__, ret); - goto out; + goto out_inc; }/* Wait for the registration to complete in order to prevent an invalid
@@ -179,8 +181,10 @@ static int rds_ib_post_reg_frmr(struct r*/ wait_event (frmr->fr_reg_done, !frmr->fr_reg); -out: +return ret; +out_inc: +atomic_inc (&ibmr->ic->i_fastreg_wrs);return ret; }
Greg Kroah-Hartman
maintainerPATCH 46/81 ASoC: wm8940: Correct typo in control name
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Charles Keepax <[email protected]>
[ Upstream commit b4799520dcd6fe1e14495cecbbe9975d847cd482 ]
--- sound/soc/codecs/wm8940.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/wm8940.c +1 -1
@@ -218,7 +218,7 @@ static const struct snd_kcontrol_new wm8940_snd_controls[] = {SOC_SINGLE_TLV ("Digital Capture Volume" ,WM8940_ADCVOL ,0 ,255 ,0 , wm8940_adc_tlv),SOC_ENUM ("Mic Bias Level" , wm8940_mic_bias_level_enum), -SOC_SINGLE_TLV ("Capture Boost Volue" ,WM8940_ADCBOOST , +SOC_SINGLE_TLV ("Capture Boost Volume" ,WM8940_ADCBOOST ,8 ,1 ,0 , wm8940_capture_boost_vol_tlv),SOC_SINGLE_TLV ("Speaker Playback Volume" ,WM8940_SPKVOL , 0, 63, 0, wm8940_spk_vol_tlv),
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 47/81 ASoC: wm8974: Correct PLL rate rounding
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Charles Keepax <[email protected]>
[ Upstream commit 9b17d3724df55ecc2bc67978822585f2b023be48 ]
Using a single value of 22500000 for both 48000Hz and 44100Hz audio will sometimes result in returning wrong dividers due to rounding. Update the code to use the actual value for both.
--- sound/soc/codecs/wm8974.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
sound/soc/codecs/wm8974.c +6 -2
@@ -427,10 +427,14 @@ static int wm8974_update_clocks(struct snd_soc_dai *dai) fs256 =256 * priv->fs; f =wm8974_get_mclkdiv (priv->mclk, fs256, &mclkdiv); -if (f != priv->mclk) {/* The PLL performs best around 90MHz */ - fpll =wm8974_get_mclkdiv (22500000 , fs256, &mclkdiv); +if (fs256 %8000 ) + f =22579200 ; +else + f =24576000 ; + + fpll =wm8974_get_mclkdiv (f, fs256, &mclkdiv); }wm8974_set_dai_pll (dai,0 ,0 , priv->mclk, fpll);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 48/81 ASoC: SOF: Intel: hda-stream: Fix incorrect variable used in error message
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Colin Ian King <[email protected]>
[ Upstream commit 35fc531a59694f24a2456569cf7d1a9c6436841c ]
The dev_err message is reporting an error about capture streams however it is using the incorrect variable num_playback instead of num_capture. Fix this by using the correct variable num_capture.
--- sound/soc/sof/intel/hda-stream.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/sof/intel/hda-stream.c +1 -1
@@ -655,7 +655,7 @@ int hda_dsp_stream_init(struct snd_sof_dev *sdev)if (num_capture >=SOF_HDA_CAPTURE_STREAMS ) {dev_err (sdev->dev,"error: too many capture streams %d\n" , - num_playback); + num_capture);return -EINVAL ; }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 49/81 usb: gadget: dummy_hcd: remove usage of list iterator past the loop body
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakob Koschel <[email protected]>
[ Upstream commit 7975f080d3557725160a878b1a64339043ba3d91 ]
To move the list iterator variable into the list_for_each_entry_*() macro in the future it should be avoided to use the list iterator variable after the loop body.
To *never* use the list iterator variable after the loop it was concluded to use a separate iterator variable [1].
Stable-dep-of: 8d63c83d8eb9 ("USB: gadget: dummy-hcd: Fix locking bug in RT-enabled kernels")
--- drivers/usb/gadget/udc/dummy_hcd.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)
drivers/usb/gadget/udc/dummy_hcd.c +9 -8
@@ -748,7 +748,7 @@ static int dummy_dequeue(struct usb_ep *struct dummy *dum;int retval = -EINVAL ;unsigned long flags; -struct dummy_request *req =NULL ; +struct dummy_request *req =NULL , *iter;if (!_ep || !_req)return retval;
@@ -760,13 +760,14 @@ static int dummy_dequeue(struct usb_ep *local_irq_save (flags);spin_lock (&dum->lock); -list_for_each_entry (req, &ep->queue, queue) { -if (&req->req == _req) { -list_del_init (&req->queue); - _req->status = -ECONNRESET ; - retval =0 ; -break ; - } +list_for_each_entry (iter, &ep->queue, queue) { +if (&iter->req != _req) +continue ; +list_del_init (&iter->queue); + _req->status = -ECONNRESET ; + req = iter; + retval =0 ; +break ; }spin_unlock (&dum->lock);
Greg Kroah-Hartman
maintainerPATCH 50/81 USB: gadget: dummy-hcd: Fix locking bug in RT-enabled kernels
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alan Stern <[email protected]>
[ Upstream commit 8d63c83d8eb922f6c316320f50c82fa88d099bea ]
Yunseong Kim and the syzbot fuzzer both reported a problem in RT-enabled kernels caused by the way dummy-hcd mixes interrupt management and spin-locking. The pattern was:
local_irq_save(flags); spin_lock(&dum->lock); ... spin_unlock(&dum->lock); ... // calls usb_gadget_giveback_request() local_irq_restore(flags);
The code was written this way because usb_gadget_giveback_request() needs to be called with interrupts disabled and the private lock not held.
While this pattern works fine in non-RT kernels, it's not good when RT is enabled. RT kernels handle spinlocks much like mutexes; in particular, spin_lock() may sleep. But sleeping is not allowed while local interrupts are disabled.
To fix the problem, rewrite the code to conform to the pattern used elsewhere in dummy-hcd and other UDC drivers:
spin_lock_irqsave(&dum->lock, flags); ... spin_unlock(&dum->lock); usb_gadget_giveback_request(...); spin_lock(&dum->lock); ... spin_unlock_irqrestore(&dum->lock, flags);
This approach satisfies the RT requirements.
--- drivers/usb/gadget/udc/dummy_hcd.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/usb/gadget/udc/dummy_hcd.c +4 -4
@@ -758,8 +758,7 @@ static int dummy_dequeue(struct usb_ep *if (!dum->driver)return -ESHUTDOWN ; -local_irq_save (flags); -spin_lock (&dum->lock); +spin_lock_irqsave (&dum->lock, flags);list_for_each_entry (iter, &ep->queue, queue) {if (&iter->req != _req)continue ;
@@ -769,15 +768,16 @@ static int dummy_dequeue(struct usb_ep * retval =0 ;break ; } -spin_unlock (&dum->lock);if (retval ==0 ) {dev_dbg (udc_dev (dum),"dequeued req %p from %s, len %d buf %p\n" , req, _ep->name, _req->length, _req->buf); +spin_unlock (&dum->lock);usb_gadget_giveback_request (_ep, _req); +spin_lock (&dum->lock); } -local_irq_restore (flags); +spin_unlock_irqrestore (&dum->lock, flags);return retval; }
Greg Kroah-Hartman
maintainerPATCH 51/81 serial: sc16is7xx: fix bug in flow control levels init
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hugo Villeneuve <[email protected]>
[ Upstream commit 535fd4c98452c87537a40610abba45daf5761ec6 ]
When trying to set MCR[2], XON1 is incorrectly accessed instead. And when writing to the TCR register to configure flow control levels, we are incorrectly writing to the MSR register. The default value of $00 is then used for TCR, which means that selectable trigger levels in FCR are used in place of TCR.
TCR/TLR access requires EFR[4] (enable enhanced functions) and MCR[2] to be set. EFR[4] is already set in probe().
MCR access requires LCR[7] to be zero.
Since LCR is set to $BF when trying to set MCR[2], XON1 is incorrectly accessed instead because MCR shares the same address space as XON1.
Since MCR[2] is unmodified and still zero, when writing to TCR we are in fact writing to MSR because TCR/TLR registers share the same address space as MSR/SPR.
Fix by first removing useless reconfiguration of EFR[4] (enable enhanced functions), as it is already enabled in sc16is7xx_probe() since commit 43c51bb573aa ("sc16is7xx: make sure device is in suspend once probed"). Now LCR is $00, which means that MCR access is enabled.
Also remove regcache_cache_bypass() calls since we no longer access the enhanced registers set, and TCR is already declared as volatile (in fact by declaring MSR as volatile, which shares the same address).
Finally disable access to TCR/TLR registers after modifying them by clearing MCR[2].
Note: the comment about "... and internal clock div" is wrong and can be
ignored/removed as access to internal clock div registers (DLL/DLH) is permitted only when LCR[7] is logic 1, not when enhanced features is enabled. And DLL/DLH access is not needed in sc16is7xx_startup().
--- drivers/tty/serial/sc16is7xx.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-)
drivers/tty/serial/sc16is7xx.c +2 -11
@@ -1032,16 +1032,6 @@ static int sc16is7xx_startup(struct uartsc16is7xx_port_write (port,SC16IS7XX_FCR_REG ,SC16IS7XX_FCR_FIFO_BIT ); -/* Enable EFR */ -sc16is7xx_port_write (port,SC16IS7XX_LCR_REG , -SC16IS7XX_LCR_CONF_MODE_B ); - -regcache_cache_bypass (s->regmap, true); - -/* Enable write access to enhanced features and internal clock div */ -sc16is7xx_port_write (port,SC16IS7XX_EFR_REG , -SC16IS7XX_EFR_ENABLE_BIT ); -/* Enable TCR/TLR */ sc16is7xx_port_update(port, SC16IS7XX_MCR_REG, SC16IS7XX_MCR_TCRTLR_BIT,
@@ -1053,7 +1043,8 @@ static int sc16is7xx_startup(struct uartSC16IS7XX_TCR_RX_RESUME (24 ) | SC16IS7XX_TCR_RX_HALT(48)); -regcache_cache_bypass (s->regmap, false); +/* Disable TCR/TLR access */ +sc16is7xx_port_update (port,SC16IS7XX_MCR_REG ,SC16IS7XX_MCR_TCRTLR_BIT ,0 );/* Now, initialize the UART */ sc16is7xx_port_write (port,SC16IS7XX_LCR_REG ,SC16IS7XX_LCR_WORD_LEN_8 );
Greg Kroah-Hartman
maintainerPATCH 52/81 net: rfkill: gpio: add DT support
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Philipp Zabel <[email protected]>
[ Upstream commit d64c732dfc9edcd57feb693c23162117737e426b ]
Allow probing rfkill-gpio via device tree. This hooks up the already existing support that was started in commit 262c91ee5e52 ("net:
rfkill: gpio: prepare for DT and ACPI support") via the "rfkill-gpio" compatible, with the "name" and "type" properties renamed to "label" and "radio-type", respectively, in the device tree case.
Stable-dep-of: b6f56a44e4c1 ("net: rfkill: gpio: Fix crash due to dereferencering uninitialized pointer")
--- net/rfkill/rfkill-gpio.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-)
net/rfkill/rfkill-gpio.c +18 -2
@@ -79,6 +79,8 @@ static int rfkill_gpio_probe(struct plat {struct rfkill_gpio_data *rfkill;struct gpio_desc *gpio; +const char *name_property; +const char *type_property;const char *type_name;int ret;
@@ -86,8 +88,15 @@ static int rfkill_gpio_probe(struct platif (!rfkill)return -ENOMEM ; -device_property_read_string (&pdev->dev,"name" , &rfkill->name); -device_property_read_string (&pdev->dev,"type" , &type_name); +if (dev_of_node (&pdev->dev)) { + name_property ="label" ; + type_property ="radio-type" ; + }else { + name_property ="name" ; + type_property ="type" ; + } +device_property_read_string (&pdev->dev, name_property, &rfkill->name); +device_property_read_string (&pdev->dev, type_property, &type_name);if (!rfkill->name) rfkill->name =dev_name (&pdev->dev);
@@ -169,12 +178,19 @@ static const struct acpi_device_id rfkilMODULE_DEVICE_TABLE (acpi, rfkill_acpi_match);#endif +static const struct of_device_id rfkill_of_match[]__maybe_unused = { + { .compatible ="rfkill-gpio" , }, + { }, +}; +MODULE_DEVICE_TABLE (of, rfkill_of_match); +static struct platform_driver rfkill_gpio_driver = { .probe = rfkill_gpio_probe, .remove = rfkill_gpio_remove, .driver = { .name ="rfkill_gpio" , .acpi_match_table =ACPI_PTR (rfkill_acpi_match), + .of_match_table =of_match_ptr (rfkill_of_match), }, };
Greg Kroah-Hartman
maintainerPATCH 53/81 net: rfkill: gpio: Fix crash due to dereferencering uninitialized pointer
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
[ Upstream commit b6f56a44e4c1014b08859dcf04ed246500e310e5 ]
Since commit 7d5e9737efda ("net: rfkill: gpio: get the name and type from device property") rfkill_find_type() gets called with the possibly uninitialized "const char *type_name;" local variable.
On x86 systems when rfkill-gpio binds to a "BCM4752" or "LNV4752" acpi_device, the rfkill->type is set based on the ACPI acpi_device_id:
rfkill->type = (unsigned)id->driver_data;
and there is no "type" property so device_property_read_string() will fail and leave type_name uninitialized, leading to a potential crash.
rfkill_find_type() does accept a NULL pointer, fix the potential crash by initializing type_name to NULL.
Note likely sofar this has not been caught because:
1. Not many x86 machines actually have a "BCM4752"/"LNV4752" acpi_device
2. The stack happened to contain NULL where type_name is stored
--- net/rfkill/rfkill-gpio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/rfkill/rfkill-gpio.c +2 -2
@@ -78,10 +78,10 @@ static int rfkill_gpio_acpi_probe(structstatic int rfkill_gpio_probe (struct platform_device *pdev) {struct rfkill_gpio_data *rfkill; -struct gpio_desc *gpio; +const char *type_name =NULL ;const char *name_property;const char *type_property; -const char *type_name; +struct gpio_desc *gpio;int ret; rfkill =devm_kzalloc (&pdev->dev,sizeof (*rfkill),GFP_KERNEL );
Greg Kroah-Hartman
maintainerPATCH 54/81 KVM: SVM: Sync TPR from LAPIC into VMCB::V_TPR even if AVIC is active
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Maciej S. Szmigiero" <[email protected]>
[ Upstream commit d02e48830e3fce9701265f6c5a58d9bdaf906a76 ]
Commit 3bbf3565f48c ("svm: Do not intercept CR8 when enable AVIC") inhibited pre-VMRUN sync of TPR from LAPIC into VMCB::V_TPR in sync_lapic_to_cr8() when AVIC is active.
AVIC does automatically sync between these two fields, however it does so only on explicit guest writes to one of these fields, not on a bare VMRUN.
This meant that when AVIC is enabled host changes to TPR in the LAPIC state might not get automatically copied into the V_TPR field of VMCB.
This is especially true when it is the userspace setting LAPIC state via KVM_SET_LAPIC ioctl() since userspace does not have access to the guest VMCB.
Practice shows that it is the V_TPR that is actually used by the AVIC to decide whether to issue pending interrupts to the CPU (not TPR in TASKPRI), so any leftover value in V_TPR will cause serious interrupt delivery issues in the guest when AVIC is enabled.
Fix this issue by doing pre-VMRUN TPR sync from LAPIC into VMCB::V_TPR even when AVIC is enabled.
--- arch/x86/kvm/svm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arch/x86/kvm/svm.c +1 -2
@@ -5580,8 +5580,7 @@ static inline void sync_lapic_to_cr8(strstruct vcpu_svm *svm =to_svm (vcpu);u64 cr8; -if (svm_nested_virtualize_tpr (vcpu) || -kvm_vcpu_apicv_active (vcpu)) +if (svm_nested_virtualize_tpr (vcpu))return ; cr8 =kvm_get_cr8 (vcpu);
Greg Kroah-Hartman
maintainerPATCH 28/81 phy: ti-pipe3: fix device leak at unbind
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit e19bcea99749ce8e8f1d359f68ae03210694ad56 upstream.
Make sure to drop the reference to the control device taken by of_find_device_by_node() during probe when the driver is unbound.
--- drivers/phy/ti/phy-ti-pipe3.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/phy/ti/phy-ti-pipe3.c +13 -0
@@ -667,12 +667,20 @@ static int ti_pipe3_get_clk(struct ti_pireturn 0 ; } +static void ti_pipe3_put_device (void *_dev) +{ +struct device *dev = _dev; + +put_device (dev); +} +static int ti_pipe3_get_sysctrl (struct ti_pipe3 *phy) {struct device *dev = phy->dev;struct device_node *node = dev->of_node;struct device_node *control_node;struct platform_device *control_pdev; +int ret; phy->phy_power_syscon =syscon_regmap_lookup_by_phandle (node,"syscon-phy-power" );
@@ -703,6 +711,11 @@ static int ti_pipe3_get_sysctrl(struct t } phy->control_dev = &control_pdev->dev; + + ret =devm_add_action_or_reset (dev, ti_pipe3_put_device, + phy->control_dev); +if (ret) +return ret; }if (phy->mode ==PIPE3_MODE_PCIE ) {
Greg Kroah-Hartman
maintainerPATCH 55/81 ALSA: usb-audio: Fix block comments in mixer_quirks
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cristian Ciocaltea <[email protected]>
[ Upstream commit 231225d8a20f8668b4fd6601d54a2fac0e0ab7a5 ]
Address a couple of comment formatting issues indicated by checkpatch.pl:
WARNING: Block comments use a trailing */ on a separate line
--- sound/usb/mixer_quirks.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
sound/usb/mixer_quirks.c +4 -2
@@ -75,7 +75,8 @@ static int snd_create_std_mono_ctl_offset(struct usb_mixer_interface *mixer, cval->idx_off = idx_off;/* get_min_max() is called only for integer volumes later, -* so provide a short-cut for booleans */ +* so provide a short-cut for booleans +*/ cval->min =0 ; cval->max =1 ; cval->res =0 ;
@@ -2502,7 +2503,8 @@ static void snd_dragonfly_quirk_db_scale(struct usb_mixer_interface *mixer, struct snd_kcontrol *kctl) {/* Approximation using 10 ranges based on output measurement on hw v1.2. -* This seems close to the cubic mapping e.g. alsamixer uses. */ +* This seems close to the cubic mapping e.g. alsamixer uses. +*/ static const DECLARE_TLV_DB_RANGE(scale,0 ,1 ,TLV_DB_MINMAX_ITEM (-5300 ,-4970 ), 2, 5, TLV_DB_MINMAX_ITEM(-4710, -4160),
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 56/81 ALSA: usb-audio: Avoid multiple assignments in mixer_quirks
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cristian Ciocaltea <[email protected]>
[ Upstream commit 03ddd3bdb94df3edb1f2408b57cfb00b3d92a208 ]
Handle report from checkpatch.pl:
CHECK: multiple assignments should be avoided
--- sound/usb/mixer_quirks.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
sound/usb/mixer_quirks.c +2 -1
@@ -1592,7 +1592,8 @@ static int snd_microii_spdif_default_put(struct snd_kcontrol *kcontrol,unsigned int pval, pval_old;int err; - pval = pval_old = kcontrol->private_value; + pval = kcontrol->private_value; + pval_old = pval; pval &=0xfffff0f0 ; pval |= (ucontrol->value.iec958.status[1 ] &0x0f ) <<8 ; pval |= (ucontrol->value.iec958.status[0 ] &0x0f );
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 57/81 ALSA: usb-audio: Simplify NULL comparison in mixer_quirks
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cristian Ciocaltea <[email protected]>
[ Upstream commit f2d6d660e8fd5f4467e80743f82119201e67fa9c ]
Handle report from checkpatch.pl:
CHECK: Comparison to NULL could be written "t->name"
--- sound/usb/mixer_quirks.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/usb/mixer_quirks.c +1 -1
@@ -125,7 +125,7 @@ static int snd_create_std_mono_table(struct usb_mixer_interface *mixer, {int err; -while (t->name !=NULL ) { +while (t->name) { err =snd_create_std_mono_ctl (mixer, t->unitid, t->control, t->cmask, t->val_type, t->name, t->tlv_callback);if (err <0 )
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 58/81 ALSA: usb-audio: Remove unneeded wmb() in mixer_quirks
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cristian Ciocaltea <[email protected]>
[ Upstream commit 9cea7425595697802e8d55a322a251999554b8b1 ]
Adding a memory barrier before wake_up() in snd_usb_soundblaster_remote_complete() is supposed to ensure the write to mixer->rc_code is visible in wait_event_interruptible() from snd_usb_sbrc_hwdep_read().
However, this is not really necessary, since wake_up() is just a wrapper over __wake_up() which already executes a full memory barrier before accessing the state of the task to be waken up.
Drop the redundant call to wmb() and implicitly fix the checkpatch complaint:
WARNING: memory barrier without comment
--- sound/usb/mixer_quirks.c | 1 - 1 file changed, 1 deletion(-)
sound/usb/mixer_quirks.c +0 -1
@@ -207,7 +207,6 @@ static void snd_usb_soundblaster_remote_complete(struct urb *urb)if (code == rc->mute_code)snd_usb_mixer_notify_id (mixer, rc->mute_mixer_id); mixer->rc_code = code; -wmb ();wake_up (&mixer->rc_waitq); }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 29/81 soc: qcom: mdt_loader: Deal with zero e_shentsize
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bjorn Andersson <[email protected]>
commit 25daf9af0ac1bf12490b723b5efaf8dcc85980bc upstream.
Firmware that doesn't provide section headers leave both e_shentsize and e_shnum 0, which obvious isn't compatible with the newly introduced stricter checks.
Make the section-related checks conditional on either of these values being non-zero.
--- drivers/soc/qcom/mdt_loader.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/soc/qcom/mdt_loader.c +7 -5
@@ -39,12 +39,14 @@ static bool mdt_header_valid(const strucif (phend > fw->size)return false; -if (ehdr->e_shentsize !=sizeof (struct elf32_shdr )) -return false; +if (ehdr->e_shentsize || ehdr->e_shnum) { +if (ehdr->e_shentsize !=sizeof (struct elf32_shdr )) +return false; - shend =size_add (size_mul (sizeof (struct elf32_shdr ), ehdr->e_shnum), ehdr->e_shoff); -if (shend > fw->size) -return false; + shend =size_add (size_mul (sizeof (struct elf32_shdr ), ehdr->e_shnum), ehdr->e_shoff); +if (shend > fw->size) +return false; + }return true; }
Greg Kroah-Hartman
maintainerPATCH 30/81 mm/memory-failure: fix VM_BUG_ON_PAGE(PagePoisoned(page)) when unpoison memory
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Miaohe Lin <[email protected]>
[ Upstream commit d613f53c83ec47089c4e25859d5e8e0359f6f8da ]
When I did memory failure tests, below panic occurs:
page dumped because: VM_BUG_ON_PAGE(PagePoisoned(page)) kernel BUG at include/linux/page-flags.h:616! Oops: invalid opcode: 0000 [#1] PREEMPT SMP NOPTI CPU: 3 PID: 720 Comm: bash Not tainted 6.10.0-rc1-00195-g148743902568 #40 RIP: 0010:unpoison_memory+0x2f3/0x590 RSP: 0018:ffffa57fc8787d60 EFLAGS: 00000246 RAX: 0000000000000037 RBX: 0000000000000009 RCX: ffff9be25fcdc9c8 RDX: 0000000000000000 RSI: 0000000000000027 RDI: ffff9be25fcdc9c0 RBP: 0000000000300000 R08: ffffffffb4956f88 R09: 0000000000009ffb R10: 0000000000000284 R11: ffffffffb4926fa0 R12: ffffe6b00c000000 R13: ffff9bdb453dfd00 R14: 0000000000000000 R15: fffffffffffffffe FS: 00007f08f04e4740(0000) GS:ffff9be25fcc0000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000564787a30410 CR3: 000000010d4e2000 CR4: 00000000000006f0 Call Trace: <TASK> unpoison_memory+0x2f3/0x590 simple_attr_write_xsigned.constprop.0.isra.0+0xb3/0x110 debugfs_attr_write+0x42/0x60 full_proxy_write+0x5b/0x80 vfs_write+0xd5/0x540 ksys_write+0x64/0xe0 do_syscall_64+0xb9/0x1d0 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f08f0314887 RSP: 002b:00007ffece710078 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 0000000000000009 RCX: 00007f08f0314887 RDX: 0000000000000009 RSI: 0000564787a30410 RDI: 0000000000000001 RBP: 0000564787a30410 R08: 000000000000fefe R09: 000000007fffffff R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000009 R13: 00007f08f041b780 R14: 00007f08f0417600 R15: 00007f08f0416a00 </TASK> Modules linked in: hwpoison_inject ---[ end trace 0000000000000000 ]--- RIP: 0010:unpoison_memory+0x2f3/0x590 RSP: 0018:ffffa57fc8787d60 EFLAGS: 00000246 RAX: 0000000000000037 RBX: 0000000000000009 RCX: ffff9be25fcdc9c8 RDX: 0000000000000000 RSI: 0000000000000027 RDI: ffff9be25fcdc9c0 RBP: 0000000000300000 R08: ffffffffb4956f88 R09: 0000000000009ffb R10: 0000000000000284 R11: ffffffffb4926fa0 R12: ffffe6b00c000000 R13: ffff9bdb453dfd00 R14: 0000000000000000 R15: fffffffffffffffe FS: 00007f08f04e4740(0000) GS:ffff9be25fcc0000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000564787a30410 CR3: 000000010d4e2000 CR4: 00000000000006f0 Kernel panic - not syncing: Fatal exception Kernel Offset: 0x31c00000 from 0xffffffff81000000 (relocation range: 0xffffffff80000000-0xffffffffbfffffff) ---[ end Kernel panic - not syncing: Fatal exception ]---
The root cause is that unpoison_memory() tries to check the PG_HWPoison flags of an uninitialized page. So VM_BUG_ON_PAGE(PagePoisoned(page)) is triggered. This can be reproduced by below steps:
1.Offline memory block:
echo offline > /sys/devices/system/memory/memory12/state
2.Get offlined memory pfn:
page-types -b n -rlN
3.Write pfn to unpoison-pfn
echo <pfn> > /sys/kernel/debug/hwpoison/unpoison-pfn
This scenario can be identified by pfn_to_online_page() returning NULL. And ZONE_DEVICE pages are never expected, so we can simply fail if pfn_to_online_page() == NULL to fix the bug.
--- mm/memory-failure.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
mm/memory-failure.c +3 -4
@@ -1543,10 +1543,9 @@ int unpoison_memory(unsigned long pfn) static DEFINE_RATELIMIT_STATE(unpoison_rs, DEFAULT_RATELIMIT_INTERVAL, DEFAULT_RATELIMIT_BURST); -if (!pfn_valid (pfn)) -return -ENXIO ; - - p =pfn_to_page (pfn); + p =pfn_to_online_page (pfn); +if (!p) +return -EIO ; page =compound_head (p);if (!PageHWPoison (p)) {
Greg Kroah-Hartman
maintainerPATCH 31/81 ALSA: firewire-motu: drop EPOLLOUT from poll return values as write is not supported
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Sakamoto <[email protected]>
[ Upstream commit aea3493246c474bc917d124d6fb627663ab6bef0 ]
The ALSA HwDep character device of the firewire-motu driver incorrectly returns EPOLLOUT in poll(2), even though the driver implements no operation for write(2). This misleads userspace applications to believe write() is allowed, potentially resulting in unnecessarily wakeups.
This issue dates back to the driver's initial code added by a commit 71c3797779d3 ("ALSA: firewire-motu: add hwdep interface"), and persisted when POLLOUT was updated to EPOLLOUT by a commit a9a08845e9ac ('vfs: do bulk POLL* -> EPOLL* replacement("").').
This commit fixes the bug.
--- sound/firewire/motu/motu-hwdep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/firewire/motu/motu-hwdep.c +1 -1
@@ -73,7 +73,7 @@ static __poll_t hwdep_poll(struct snd_hwdep *hwdep, struct file *file, events =0 ;spin_unlock_irq (&motu->lock); -return events |EPOLLOUT ; +return events; }static int hwdep_get_info (struct snd_motu *motu,void __user *arg)
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 32/81 wifi: mac80211: fix incorrect type for ret
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Liao Yuanhong <[email protected]>
[ Upstream commit a33b375ab5b3a9897a0ab76be8258d9f6b748628 ]
The variable ret is declared as a u32 type, but it is assigned a value of -EOPNOTSUPP. Since unsigned types cannot correctly represent negative values, the type of ret should be changed to int.
--- net/mac80211/driver-ops.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/mac80211/driver-ops.h +1 -1
@@ -1237,7 +1237,7 @@ drv_get_ftm_responder_stats(struct ieee80211_local *local,struct ieee80211_sub_if_data *sdata, struct cfg80211_ftm_responder_stats *ftm_stats) { - u32 ret = -EOPNOTSUPP; + int ret = -EOPNOTSUPP; if (local->ops->get_ftm_responder_stats) ret = local->ops->get_ftm_responder_stats(&local->hw,
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 33/81 pcmcia: omap_cf: Mark driver struct with __refdata to prevent section mismatch
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
[ Upstream commit d1dfcdd30140c031ae091868fb5bed084132bca1 ]
As described in the added code comment, a reference to .exit.text is ok for drivers registered via platform_driver_probe(). Make this explicit to prevent the following section mismatch warning
WARNING: modpost: drivers/pcmcia/omap_cf: section mismatch in reference: omap_cf_driver+0x4 (section: .data) -> omap_cf_remove (section: .exit.text)
that triggers on an omap1_defconfig + CONFIG_OMAP_CF=m build.
--- drivers/pcmcia/omap_cf.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/pcmcia/omap_cf.c +7 -1
@@ -327,7 +327,13 @@ static int __exit omap_cf_remove(struct platform_device *pdev)return 0 ; } -static struct platform_driver omap_cf_driver = { +/* +* omap_cf_remove() lives in .exit.text. For drivers registered via +* platform_driver_probe() this is ok because they cannot get unbound at +* runtime. So mark the driver struct with __refdata to prevent modpost +* triggering a section mismatch warning. +*/ +static struct platform_driver omap_cf_driver__refdata = { .driver = { .name = (char *) driver_name, },
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 34/81 cgroup: split cgroup_destroy_wq into 3 workqueues
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen Ridong <[email protected]>
[ Upstream commit 79f919a89c9d06816dbdbbd168fa41d27411a7f9 ]
A hung task can occur during [1] LTP cgroup testing when repeatedly mounting/unmounting perf_event and net_prio controllers with systemd.unified_cgroup_hierarchy=1. The hang manifests in cgroup_lock_and_drain_offline() during root destruction.
Related case:cgroup_fj_function_perf_event cgroup_fj_function.sh perf_event cgroup_fj_function_net_prio cgroup_fj_function.sh net_prio
Call Trace: cgroup_lock_and_drain_offline+0x14c/0x1e8 cgroup_destroy_root+0x3c/0x2c0 css_free_rwork_fn+0x248/0x338 process_one_work+0x16c/0x3b8 worker_thread+0x22c/0x3b0 kthread+0xec/0x100 ret_from_fork+0x10/0x20
Root Cause:
CPU0 CPU1
mount perf_event umount net_prio
cgroup1_get_tree cgroup_kill_sb
rebind_subsystems // root destruction enqueues
// cgroup_destroy_wq
// kill all perf_event css
// one perf_event css A is dying
// css A offline enqueues cgroup_destroy_wq
// root destruction will be executed first
css_free_rwork_fn
cgroup_destroy_root
cgroup_lock_and_drain_offline
// some perf descendants are dying
// cgroup_destroy_wq max_active = 1
// waiting for css A to dieProblem scenario:
1. CPU0 mounts perf_event (rebind_subsystems)
2. CPU1 unmounts net_prio (cgroup_kill_sb), queuing root destruction work
3. A dying perf_event CSS gets queued for offline after root destruction
4. Root destruction waits for offline completion, but offline work is blocked behind root destruction in cgroup_destroy_wq (max_active=1)
Solution:
Split cgroup_destroy_wq into three dedicated workqueues:cgroup_offline_wq – Handles CSS offline operations cgroup_release_wq – Manages resource release cgroup_free_wq – Performs final memory deallocation
This separation eliminates blocking in the CSS free path while waiting for offline operations to complete.
[1] https://github.com/linux-test-project/ltp/blob/master/runtest/controllers
--- kernel/cgroup/cgroup.c | 43 +++++++++++++++++++++++++++++++++++------- 1 file changed, 36 insertions(+), 7 deletions(-)
kernel/cgroup/cgroup.c +36 -7
@@ -114,8 +114,31 @@ DEFINE_PERCPU_RWSEM(cgroup_threadgroup_rwsem);* of concurrent destructions. Use a separate workqueue so that cgroup * destruction work items don't end up filling up max_active of system_wq * which may lead to deadlock. +* +* A cgroup destruction should enqueue work sequentially to: +* cgroup_offline_wq: use for css offline work +* cgroup_release_wq: use for css release work +* cgroup_free_wq: use for free work +* +* Rationale for using separate workqueues: +* The cgroup root free work may depend on completion of other css offline +* operations. If all tasks were enqueued to a single workqueue, this could +* create a deadlock scenario where: +* - Free work waits for other css offline work to complete. +* - But other css offline work is queued after free work in the same queue. +* +* Example deadlock scenario with single workqueue (cgroup_destroy_wq): +* 1. umount net_prio +* 2. net_prio root destruction enqueues work to cgroup_destroy_wq (CPUx) +* 3. perf_event CSS A offline enqueues work to same cgroup_destroy_wq (CPUx) +* 4. net_prio cgroup_destroy_root->cgroup_lock_and_drain_offline. +* 5. net_prio root destruction blocks waiting for perf_event CSS A offline, +* which can never complete as it's behind in the same queue and +* workqueue's max_active is 1. */ -static struct workqueue_struct *cgroup_destroy_wq; +static struct workqueue_struct *cgroup_offline_wq; +static struct workqueue_struct *cgroup_release_wq; +static struct workqueue_struct *cgroup_free_wq;/* generate an array of cgroup subsystem pointers */ #define SUBSYS (_x) [_x ## _cgrp_id] = &_x ## _cgrp_subsys,
@@ -5233,7 +5256,7 @@ static void css_release_work_fn(struct work_struct *work)mutex_unlock (&cgroup_mutex);INIT_RCU_WORK (&css->destroy_rwork, css_free_rwork_fn); -queue_rcu_work (cgroup_destroy_wq, &css->destroy_rwork); +queue_rcu_work (cgroup_free_wq, &css->destroy_rwork); }static void css_release (struct percpu_ref *ref)
@@ -5242,7 +5265,7 @@ static void css_release(struct percpu_ref *ref) container_of(ref, struct cgroup_subsys_state, refcnt);INIT_WORK (&css->destroy_work, css_release_work_fn); -queue_work (cgroup_destroy_wq, &css->destroy_work); +queue_work (cgroup_release_wq, &css->destroy_work); } static void init_and_link_css(struct cgroup_subsys_state *css,
@@ -5373,7 +5396,7 @@ static struct cgroup_subsys_state *css_create(struct cgroup *cgrp, err_free_css:list_del_rcu (&css->rstat_css_node);INIT_RCU_WORK (&css->destroy_rwork, css_free_rwork_fn); -queue_rcu_work (cgroup_destroy_wq, &css->destroy_rwork); +queue_rcu_work (cgroup_free_wq, &css->destroy_rwork);return ERR_PTR (err); }
@@ -5626,7 +5649,7 @@ static void css_killed_ref_fn(struct percpu_ref *ref)if (atomic_dec_and_test (&css->online_cnt)) {INIT_WORK (&css->destroy_work, css_killed_work_fn); -queue_work (cgroup_destroy_wq, &css->destroy_work); +queue_work (cgroup_offline_wq, &css->destroy_work); } }
@@ -6002,8 +6025,14 @@ static int __init cgroup_wq_init(void)* We would prefer to do this in cgroup_init() above, but that * is called before init_workqueues(): so leave this until after. */ - cgroup_destroy_wq =alloc_workqueue ("cgroup_destroy" ,0 ,1 ); -BUG_ON (!cgroup_destroy_wq); + cgroup_offline_wq =alloc_workqueue ("cgroup_offline" ,0 ,1 ); +BUG_ON (!cgroup_offline_wq); + + cgroup_release_wq =alloc_workqueue ("cgroup_release" ,0 ,1 ); +BUG_ON (!cgroup_release_wq); + + cgroup_free_wq =alloc_workqueue ("cgroup_free" ,0 ,1 ); +BUG_ON (!cgroup_free_wq);return 0 ; }core_initcall (cgroup_wq_init);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 25/81 can: j1939: j1939_local_ecu_get(): undo increment when j1939_local_ecu_get() fails
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tetsuo Handa <[email protected]>
[ Upstream commit 06e02da29f6f1a45fc07bd60c7eaf172dc21e334 ]
Since j1939_sk_bind() and j1939_sk_release() call j1939_local_ecu_put() when J1939_SOCK_BOUND was already set, but the error handling path for j1939_sk_bind() will not set J1939_SOCK_BOUND when j1939_local_ecu_get() fails, j1939_local_ecu_get() needs to undo priv->ents[sa].nusers++ when j1939_local_ecu_get() returns an error.
--- net/can/j1939/bus.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
net/can/j1939/bus.c +4 -1
@@ -290,8 +290,11 @@ int j1939_local_ecu_get(struct j1939_priv *priv, name_t name, u8 sa)if (!ecu) ecu =j1939_ecu_create_locked (priv, name); err =PTR_ERR_OR_ZERO (ecu); -if (err) +if (err) { +if (j1939_address_is_unicast (sa)) + priv->ents[sa].nusers--; goto done; + } ecu->nusers++;/* TODO: do we care if ecu->addr != sa? */
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 60/81 ALSA: usb-audio: Convert comma to semicolon
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen Ni <[email protected]>
[ Upstream commit 9ca30a1b007d5fefb5752428f852a2d8d7219c1c ]
Replace comma between expressions with semicolons.
Using a ',' in place of a ';' can have unintended side effects. Although that is not the case here, it is seems best to use ';' unless ',' is intended.
Found by inspection.
No functional change intended.
Compile tested only.
--- sound/usb/mixer_quirks.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
sound/usb/mixer_quirks.c +3 -3
@@ -757,9 +757,9 @@ static int snd_dualsense_jack_create(struct usb_mixer_interface *mixer, mei->ih.event = snd_dualsense_ih_event; mei->ih.match = snd_dualsense_ih_match; - mei->ih.connect = snd_dualsense_ih_connect, - mei->ih.disconnect = snd_dualsense_ih_disconnect, - mei->ih.start = snd_dualsense_ih_start, + mei->ih.connect = snd_dualsense_ih_connect; + mei->ih.disconnect = snd_dualsense_ih_disconnect; + mei->ih.start = snd_dualsense_ih_start; mei->ih.name = name; mei->ih.id_table = mei->id_table;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 69/81 drm/gma500: Fix null dereference in hdmi teardown
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zabelin Nikita <[email protected]>
[ Upstream commit 352e66900cde63f3dadb142364d3c35170bbaaff ]
pci_set_drvdata sets the value of pdev->driver_data to NULL, after which the driver_data obtained from the same dev is dereferenced in oaktrail_hdmi_i2c_exit, and the i2c_dev is extracted from it. To prevent this, swap these calls.
Found by Linux Verification Center (linuxtesting.org) with Svacer.
--- drivers/gpu/drm/gma500/oaktrail_hdmi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/gma500/oaktrail_hdmi.c +1 -1
@@ -741,8 +741,8 @@ void oaktrail_hdmi_teardown(struct drm_device *dev)if (hdmi_dev) { pdev = hdmi_dev->dev; -pci_set_drvdata (pdev,NULL );oaktrail_hdmi_i2c_exit (pdev); +pci_set_drvdata (pdev,NULL );iounmap (hdmi_dev->regs);kfree (hdmi_dev);pci_dev_put (pdev);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 70/81 i40e: fix idx validation in i40e_validate_queue_map
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lukasz Czapnik <[email protected]>
commit aa68d3c3ac8d1dcec40d52ae27e39f6d32207009 upstream.
Ensure idx is within range of active/initialized TCs when iterating over vf->ch[idx] in i40e_validate_queue_map().
--- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +4 -2
@@ -2376,8 +2376,10 @@ static int i40e_validate_queue_map(strucu16 vsi_queue_id, queue_id;for_each_set_bit (vsi_queue_id, &queuemap,I40E_MAX_VSI_QP ) { -if (vf->adq_enabled) { - vsi_id = vf->ch[vsi_queue_id /I40E_MAX_VF_VSI ].vsi_id; +u16 idx = vsi_queue_id /I40E_MAX_VF_VSI ; + +if (vf->adq_enabled && idx < vf->num_tc) { + vsi_id = vf->ch[idx].vsi_id; queue_id = (vsi_queue_id %I40E_DEFAULT_QUEUES_PER_VF ); }else { queue_id = vsi_queue_id;
Greg Kroah-Hartman
maintainerPATCH 71/81 i40e: fix input validation logic for action_meta
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lukasz Czapnik <[email protected]>
commit 9739d5830497812b0bdeaee356ddefbe60830b88 upstream.
Fix condition to check 'greater or equal' to prevent OOB dereference.
--- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +1 -1
@@ -3367,7 +3367,7 @@ static int i40e_validate_cloud_filter(st/* action_meta is TC number here to which the filter is applied */ if (!tc_filter->action_meta || - tc_filter->action_meta > vf->num_tc) { + tc_filter->action_meta >= vf->num_tc) {dev_info (&pf->pdev->dev,"VF %d: Invalid TC number %u\n" , vf->vf_id, tc_filter->action_meta); goto err;
Greg Kroah-Hartman
maintainerPATCH 72/81 i40e: add max boundary check for VF filters
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lukasz Czapnik <[email protected]>
commit cb79fa7118c150c3c76a327894bb2eb878c02619 upstream.
There is no check for max filters that VF can request. Add it.
--- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +10 -0
@@ -3665,6 +3665,8 @@ err: aq_ret); } +#define I40E_MAX_VF_CLOUD_FILTER 0xFF00 +/** * i40e_vc_add_cloud_filter * @vf: pointer to the VF info
@@ -3704,6 +3706,14 @@ static int i40e_vc_add_cloud_filter(stru goto err_out; } +if (vf->num_cloud_filters >=I40E_MAX_VF_CLOUD_FILTER ) { +dev_warn (&pf->pdev->dev, +"VF %d: Max number of filters reached, can't apply cloud filter\n" , + vf->vf_id); + aq_ret = -ENOSPC ; + goto err_out; + } + cfilter =kzalloc (sizeof (*cfilter),GFP_KERNEL );if (!cfilter)return -ENOMEM ;
Greg Kroah-Hartman
maintainerPATCH 73/81 fbcon: fix integer overflow in fbcon_do_set_font
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Samasth Norway Ananda <[email protected]>
commit 1a194e6c8e1ee745e914b0b7f50fa86c89ed13fe upstream.
Fix integer overflow vulnerabilities in fbcon_do_set_font() where font size calculations could overflow when handling user-controlled font parameters.
The vulnerabilities occur when:
1. CALC_FONTSZ(h, pitch, charcount) performs h * pith * charcount multiplication with user-controlled values that can overflow.
2. FONT_EXTRA_WORDS * sizeof(int) + size addition can also overflow
3. This results in smaller allocations than expected, leading to buffer overflows during font data copying.
Add explicit overflow checking using check_mul_overflow() and check_add_overflow() kernel helpers to safety validate all size calculations before allocation.
--- drivers/video/fbdev/core/fbcon.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/video/fbdev/core/fbcon.c +9 -2
@@ -2509,9 +2509,16 @@ static int fbcon_set_font(struct vc_dataif (fbcon_invalid_charcount (info, charcount))return -EINVAL ; - size =CALC_FONTSZ (h, pitch, charcount); +/* Check for integer overflow in font size calculation */ +if (check_mul_overflow (h, pitch, &size) || +check_mul_overflow (size, charcount, &size)) +return -EINVAL ; + +/* Check for overflow in allocation size calculation */ +if (check_add_overflow (FONT_EXTRA_WORDS *sizeof (int ), size, &size)) +return -EINVAL ; - new_data =kmalloc (FONT_EXTRA_WORDS *sizeof (int ) + size,GFP_USER ); + new_data =kmalloc (size,GFP_USER );if (!new_data)return -ENOMEM ;
Greg Kroah-Hartman
maintainerPATCH 74/81 fbcon: Fix OOB access in font allocation
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Zimmermann <[email protected]>
commit 9b2f5ef00e852f8e8902a4d4f73aeedc60220c12 upstream.
Commit 1a194e6c8e1e ("fbcon: fix integer overflow in fbcon_do_set_font") introduced an out-of-bounds access by storing data and allocation sizes in the same variable. Restore the old size calculation and use the new variable 'alloc_size' for the allocation.
--- drivers/video/fbdev/core/fbcon.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/video/fbdev/core/fbcon.c +3 -3
@@ -2482,7 +2482,7 @@ static int fbcon_set_font(struct vc_dataunsigned charcount = font->charcount;int w = font->width;int h = font->height; -int size; +int size, alloc_size;int i, csum;u8 *new_data, *data = font->data;int pitch =PITCH (font->width);
@@ -2515,10 +2515,10 @@ static int fbcon_set_font(struct vc_datareturn -EINVAL ;/* Check for overflow in allocation size calculation */ -if (check_add_overflow (FONT_EXTRA_WORDS *sizeof (int ), size, &size)) +if (check_add_overflow (FONT_EXTRA_WORDS *sizeof (int ), size, &alloc_size))return -EINVAL ; - new_data =kmalloc (size,GFP_USER ); + new_data =kmalloc (alloc_size,GFP_USER );if (!new_data)return -ENOMEM ;
Greg Kroah-Hartman
maintainerPATCH 75/81 mm/migrate_device: dont add folio to be freed to LRU in migrate_device_finalize()
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Hildenbrand <[email protected]>
commit 41cddf83d8b00f29fd105e7a0777366edc69a5cf upstream.
If migration succeeded, we called folio_migrate_flags()->mem_cgroup_migrate() to migrate the memcg from the old to the new folio. This will set memcg_data of the old folio to 0.
Similarly, if migration failed, memcg_data of the dst folio is left unset.
If we call folio_putback_lru() on such folios (memcg_data == 0), we will add the folio to be freed to the LRU, making memcg code unhappy. Running the hmm selftests:
# ./hmm-tests ... # RUN hmm.hmm_device_private.migrate ... [ 102.078007][T14893] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x7ff27d200 pfn:0x13cc00 [ 102.079974][T14893] anon flags: 0x17ff00000020018(uptodate|dirty|swapbacked|node=0|zone=2|lastcpupid=0x7ff) [ 102.082037][T14893] raw: 017ff00000020018 dead000000000100 dead000000000122 ffff8881353896c9 [ 102.083687][T14893] raw: 00000007ff27d200 0000000000000000 00000001ffffffff 0000000000000000 [ 102.085331][T14893] page dumped because: VM_WARN_ON_ONCE_FOLIO(!memcg && !mem_cgroup_disabled()) [ 102.087230][T14893] ------------[ cut here ]------------ [ 102.088279][T14893] WARNING: CPU: 0 PID: 14893 at ./include/linux/memcontrol.h:726 folio_lruvec_lock_irqsave+0x10e/0x170 [ 102.090478][T14893] Modules linked in: [ 102.091244][T14893] CPU: 0 UID: 0 PID: 14893 Comm: hmm-tests Not tainted 6.13.0-09623-g6c216bc522fd #151 [ 102.093089][T14893] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-2.fc40 04/01/2014 [ 102.094848][T14893] RIP: 0010:folio_lruvec_lock_irqsave+0x10e/0x170 [ 102.096104][T14893] Code: ... [ 102.099908][T14893] RSP: 0018:ffffc900236c37b0 EFLAGS: 00010293 [ 102.101152][T14893] RAX: 0000000000000000 RBX: ffffea0004f30000 RCX: ffffffff8183f426 [ 102.102684][T14893] RDX: ffff8881063cb880 RSI: ffffffff81b8117f RDI: ffff8881063cb880 [ 102.104227][T14893] RBP: 0000000000000000 R08: 0000000000000005 R09: 0000000000000000 [ 102.105757][T14893] R10: 0000000000000001 R11: 0000000000000002 R12: ffffc900236c37d8 [ 102.107296][T14893] R13: ffff888277a2bcb0 R14: 000000000000001f R15: 0000000000000000 [ 102.108830][T14893] FS: 00007ff27dbdd740(0000) GS:ffff888277a00000(0000) knlGS:0000000000000000 [ 102.110643][T14893] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 102.111924][T14893] CR2: 00007ff27d400000 CR3: 000000010866e000 CR4: 0000000000750ef0 [ 102.113478][T14893] PKRU: 55555554 [ 102.114172][T14893] Call Trace: [ 102.114805][T14893] <TASK> [ 102.115397][T14893] ? folio_lruvec_lock_irqsave+0x10e/0x170 [ 102.116547][T14893] ? __warn.cold+0x110/0x210 [ 102.117461][T14893] ? folio_lruvec_lock_irqsave+0x10e/0x170 [ 102.118667][T14893] ? report_bug+0x1b9/0x320 [ 102.119571][T14893] ? handle_bug+0x54/0x90 [ 102.120494][T14893] ? exc_invalid_op+0x17/0x50 [ 102.121433][T14893] ? asm_exc_invalid_op+0x1a/0x20 [ 102.122435][T14893] ? __wake_up_klogd.part.0+0x76/0xd0 [ 102.123506][T14893] ? dump_page+0x4f/0x60 [ 102.124352][T14893] ? folio_lruvec_lock_irqsave+0x10e/0x170 [ 102.125500][T14893] folio_batch_move_lru+0xd4/0x200 [ 102.126577][T14893] ? __pfx_lru_add+0x10/0x10 [ 102.127505][T14893] __folio_batch_add_and_move+0x391/0x720 [ 102.128633][T14893] ? __pfx_lru_add+0x10/0x10 [ 102.129550][T14893] folio_putback_lru+0x16/0x80 [ 102.130564][T14893] migrate_device_finalize+0x9b/0x530 [ 102.131640][T14893] dmirror_migrate_to_device.constprop.0+0x7c5/0xad0 [ 102.133047][T14893] dmirror_fops_unlocked_ioctl+0x89b/0xc80
Likely, nothing else goes wrong: putting the last folio reference will remove the folio from the LRU again. So besides memcg complaining, adding the folio to be freed to the LRU is just an unnecessary step.
The new flow resembles what we have in migrate_folio_move(): add the dst to the lru, remove migration ptes, unlock and unref dst.
--- mm/migrate.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
mm/migrate.c +4 -8
@@ -2967,21 +2967,17 @@ void migrate_vma_finalize(struct migrate newpage = page; } +if (!is_zone_device_page (newpage)) +lru_cache_add (newpage);remove_migration_ptes (page, newpage, false);unlock_page (page); migrate->cpages--; -if (is_zone_device_page (page)) -put_page (page); -else -putback_lru_page (page); +put_page (page);if (newpage != page) {unlock_page (newpage); -if (is_zone_device_page (newpage)) -put_page (newpage); -else -putback_lru_page (newpage); +put_page (newpage); } } }
Greg Kroah-Hartman
maintainerPATCH 76/81 i40e: increase max descriptors for XL710
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Justin Bronder <[email protected]>
[ Upstream commit aa6908ca3bd1e713fd6cd8d7193a008f060bf7d9 ]
In Tables 8-12 and 8-22 in the X710/XXV710/XL710 datasheet, the QLEN description states that the maximum size of the descriptor queue is 8k minus 32, or 8160.
Stable-dep-of: 55d225670def ("i40e: add validation for ring_len param")
--- drivers/net/ethernet/intel/i40e/i40e.h | 1 + drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 25 +++++++++++++++++++------ 2 files changed, 20 insertions(+), 6 deletions(-)
drivers/net/ethernet/intel/i40e/i40e.h +1 -0
@@ -48,6 +48,7 @@#define I40E_MAX_VEB 16#define I40E_MAX_NUM_DESCRIPTORS 4096 +#define I40E_MAX_NUM_DESCRIPTORS_XL710 8160#define I40E_MAX_CSR_SPACE (4 * 1024 * 1024 - 64 * 1024)#define I40E_DEFAULT_NUM_DESCRIPTORS 512#define I40E_REQ_DESCRIPTOR_MULTIPLE 32
drivers/net/ethernet/intel/i40e/i40e_ethtool.c +19 -6
@@ -1914,6 +1914,18 @@ static void i40e_get_drvinfo(struct net_ drvinfo->n_priv_flags +=I40E_GL_PRIV_FLAGS_STR_LEN ; } +static u32 i40e_get_max_num_descriptors (struct i40e_pf *pf) +{ +struct i40e_hw *hw = &pf->hw; + +switch (hw->mac.type) { +case I40E_MAC_XL710 : +return I40E_MAX_NUM_DESCRIPTORS_XL710 ; +default : +return I40E_MAX_NUM_DESCRIPTORS ; + } +} +static void i40e_get_ringparam (struct net_device *netdev,struct ethtool_ringparam *ring) {
@@ -1921,8 +1933,8 @@ static void i40e_get_ringparam(struct nestruct i40e_pf *pf = np->vsi->back;struct i40e_vsi *vsi = pf->vsi[pf->lan_vsi]; - ring->rx_max_pending =I40E_MAX_NUM_DESCRIPTORS ; - ring->tx_max_pending =I40E_MAX_NUM_DESCRIPTORS ; + ring->rx_max_pending =i40e_get_max_num_descriptors (pf); + ring->tx_max_pending =i40e_get_max_num_descriptors (pf); ring->rx_mini_max_pending =0 ; ring->rx_jumbo_max_pending =0 ; ring->rx_pending = vsi->rx_rings[0 ]->count;
@@ -1945,12 +1957,12 @@ static bool i40e_active_tx_ring_index(ststatic int i40e_set_ringparam (struct net_device *netdev,struct ethtool_ringparam *ring) { +u32 new_rx_count, new_tx_count, max_num_descriptors;struct i40e_ring *tx_rings =NULL , *rx_rings =NULL ;struct i40e_netdev_priv *np =netdev_priv (netdev);struct i40e_hw *hw = &np->vsi->back->hw;struct i40e_vsi *vsi = np->vsi;struct i40e_pf *pf = vsi->back; -u32 new_rx_count, new_tx_count;u16 tx_alloc_queue_pairs;int timeout =50 ;int i, err =0 ;
@@ -1958,14 +1970,15 @@ static int i40e_set_ringparam(struct netif ((ring->rx_mini_pending) || (ring->rx_jumbo_pending))return -EINVAL ; -if (ring->tx_pending >I40E_MAX_NUM_DESCRIPTORS || + max_num_descriptors =i40e_get_max_num_descriptors (pf); +if (ring->tx_pending > max_num_descriptors || ring->tx_pending <I40E_MIN_NUM_DESCRIPTORS || - ring->rx_pending >I40E_MAX_NUM_DESCRIPTORS || + ring->rx_pending > max_num_descriptors || ring->rx_pending <I40E_MIN_NUM_DESCRIPTORS ) {netdev_info (netdev,"Descriptors requested (Tx: %d / Rx: %d) out of range [%d-%d]\n" , ring->tx_pending, ring->rx_pending, -I40E_MIN_NUM_DESCRIPTORS ,I40E_MAX_NUM_DESCRIPTORS ); +I40E_MIN_NUM_DESCRIPTORS , max_num_descriptors);return -EINVAL ; }
Greg Kroah-Hartman
maintainerPATCH 77/81 i40e: add validation for ring_len param
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lukasz Czapnik <[email protected]>
[ Upstream commit 55d225670def06b01af2e7a5e0446fbe946289e8 ]
The ring_len parameter provided by the virtual function (VF) is assigned directly to the hardware memory context (HMC) without any validation.
To address this, introduce an upper boundary check for both Tx and Rx queue lengths. The maximum number of descriptors supported by the hardware is 8k-32.
Additionally, enforce alignment constraints: Tx rings must be a multiple of 8, and Rx rings must be a multiple of 32.
--- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +14 -0
@@ -600,6 +600,13 @@ static int i40e_config_vsi_tx_queue(stru/* only set the required fields */ tx_ctx.base = info->dma_ring_addr /128 ; + +/* ring_len has to be multiple of 8 */ +if (!IS_ALIGNED (info->ring_len,8 ) || + info->ring_len >I40E_MAX_NUM_DESCRIPTORS_XL710 ) { + ret = -EINVAL ; + goto error_context; + } tx_ctx.qlen = info->ring_len; tx_ctx.rdylist =le16_to_cpu (vsi->info.qs_handle[0 ]); tx_ctx.rdylist_act =0 ;
@@ -665,6 +672,13 @@ static int i40e_config_vsi_rx_queue(stru/* only set the required fields */ rx_ctx.base = info->dma_ring_addr /128 ; + +/* ring_len has to be multiple of 32 */ +if (!IS_ALIGNED (info->ring_len,32 ) || + info->ring_len >I40E_MAX_NUM_DESCRIPTORS_XL710 ) { + ret = -EINVAL ; + goto error_param; + } rx_ctx.qlen = info->ring_len;if (info->splithdr_enabled) {
Greg Kroah-Hartman
maintainerPATCH 78/81 i40e: fix idx validation in config queues msg
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lukasz Czapnik <[email protected]>
[ Upstream commit f1ad24c5abe1eaef69158bac1405a74b3c365115 ]
Ensure idx is within range of active/initialized TCs when iterating over vf->ch[idx] in i40e_vc_config_queues_msg().
--- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +2 -2
@@ -2320,7 +2320,7 @@ static int i40e_vc_config_queues_msg(str }if (vf->adq_enabled) { -if (idx >=ARRAY_SIZE (vf->ch)) { +if (idx >= vf->num_tc) { aq_ret =I40E_ERR_NO_AVAILABLE_VSI ; goto error_param; }
@@ -2341,7 +2341,7 @@ static int i40e_vc_config_queues_msg(str* to its appropriate VSIs based on TC mapping */ if (vf->adq_enabled) { -if (idx >=ARRAY_SIZE (vf->ch)) { +if (idx >= vf->num_tc) { aq_ret =I40E_ERR_NO_AVAILABLE_VSI ; goto error_param; }
Greg Kroah-Hartman
maintainerPATCH 61/81 ALSA: usb-audio: Fix build with CONFIG_INPUT=n
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
[ Upstream commit d0630a0b80c08530857146e3bf183a7d6b743847 ]
The recent addition of DualSense mixer quirk relies on the input device handle, and the build can fail if CONFIG_INPUT isn't set. Put (rather ugly) workarounds to wrap with IS_REACHABLE() for avoiding the build error.
--- sound/usb/mixer_quirks.c | 4 ++++ 1 file changed, 4 insertions(+)
sound/usb/mixer_quirks.c +4 -0
@@ -527,6 +527,7 @@ static int snd_emu0204_controls_create(struct usb_mixer_interface *mixer) &snd_emu0204_control, NULL); } +#if IS_REACHABLE (CONFIG_INPUT )/* * Sony DualSense controller (PS5) jack detection *
@@ -783,6 +784,7 @@ static int snd_dualsense_controls_create(struct usb_mixer_interface *mixer) return snd_dualsense_jack_create(mixer, "Headset Mic Jack", false); } +#endif /* IS_REACHABLE(CONFIG_INPUT) */ /* ASUS Xonar U1 / U3 controls */
@@ -2639,10 +2641,12 @@ int snd_usb_mixer_apply_create_quirk(struct usb_mixer_interface *mixer) err =snd_emu0204_controls_create (mixer);break ; +#if IS_REACHABLE (CONFIG_INPUT )case USB_ID (0x054c ,0x0ce6 ):/* Sony DualSense controller (PS5) */ case USB_ID (0x054c ,0x0df2 ):/* Sony DualSense Edge controller (PS5) */ err =snd_dualsense_controls_create (mixer);break ; +#endif /* IS_REACHABLE(CONFIG_INPUT) */ case USB_ID (0x0763 ,0x2030 ):/* M-Audio Fast Track C400 */ case USB_ID (0x0763 ,0x2031 ):/* M-Audio Fast Track C400 */
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 79/81 i40e: fix validation of VF state in get resources
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lukasz Czapnik <[email protected]>
[ Upstream commit 877b7e6ffc23766448236e8732254534c518ba42 ]
VF state I40E_VF_STATE_ACTIVE is not the only state in which VF is actually active so it should not be used to determine if a VF is allowed to obtain resources.
Use I40E_VF_STATE_RESOURCES_LOADED that is set only in i40e_vc_get_vf_resources_msg() and cleared during reset.
--- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 7 ++++++- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h | 3 ++- 2 files changed, 8 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +6 -1
@@ -1389,6 +1389,7 @@ static void i40e_trigger_vf_reset(struct* functions that may still be running at this point. */ clear_bit (I40E_VF_STATE_INIT , &vf->vf_states); +clear_bit (I40E_VF_STATE_RESOURCES_LOADED , &vf->vf_states);/* In the case of a VFLR, the HW has already reset the VF and we * just need to clean up, so don't hit the VFRTRIG register.
@@ -2062,7 +2063,10 @@ static int i40e_vc_get_vf_resources_msg(size_t len =0 ;int ret; -if (!i40e_sync_vf_state (vf,I40E_VF_STATE_INIT )) { +i40e_sync_vf_state (vf,I40E_VF_STATE_INIT ); + +if (!test_bit (I40E_VF_STATE_INIT , &vf->vf_states) || +test_bit (I40E_VF_STATE_RESOURCES_LOADED , &vf->vf_states)) { aq_ret =I40E_ERR_PARAM ; goto err; }
@@ -2158,6 +2162,7 @@ static int i40e_vc_get_vf_resources_msg( vf->default_lan_addr.addr); }set_bit (I40E_VF_STATE_ACTIVE , &vf->vf_states); +set_bit (I40E_VF_STATE_RESOURCES_LOADED , &vf->vf_states); err:/* send the response back to the VF */
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h +2 -1
@@ -41,7 +41,8 @@ enum i40e_vf_states {I40E_VF_STATE_MC_PROMISC ,I40E_VF_STATE_UC_PROMISC ,I40E_VF_STATE_PRE_ENABLE , - I40E_VF_STATE_RESETTING +I40E_VF_STATE_RESETTING , + I40E_VF_STATE_RESOURCES_LOADED, };/* VF capabilities */
Greg Kroah-Hartman
maintainerPATCH 80/81 i40e: add mask to apply valid bits for itr_idx
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lukasz Czapnik <[email protected]>
[ Upstream commit eac04428abe9f9cb203ffae4600791ea1d24eb18 ]
The ITR index (itr_idx) is only 2 bits wide. When constructing the register value for QINT_RQCTL, all fields are ORed together. Without masking, higher bits from itr_idx may overwrite adjacent fields in the register.
Apply I40E_QINT_RQCTL_ITR_INDX_MASK to ensure only the intended bits are set.
--- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +2 -1
@@ -1,6 +1,7 @@// SPDX-License-Identifier: GPL-2.0 /* Copyright(c) 2013 - 2018 Intel Corporation. */ +#include <linux/bitfield.h> #include "i40e.h" /*********************notification routines***********************/
@@ -393,7 +394,7 @@ static void i40e_config_irq_link_list(st (qtype <<I40E_QINT_RQCTL_NEXTQ_TYPE_SHIFT ) | (pf_queue_id <<I40E_QINT_RQCTL_NEXTQ_INDX_SHIFT ) |BIT (I40E_QINT_RQCTL_CAUSE_ENA_SHIFT ) | - (itr_idx <<I40E_QINT_RQCTL_ITR_INDX_SHIFT ); +FIELD_PREP (I40E_QINT_RQCTL_ITR_INDX_MASK , itr_idx);wr32 (hw, reg_idx, reg); }
Greg Kroah-Hartman
maintainerPATCH 81/81 mm/hugetlb: fix folio is still mapped when deleted
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jinjiang Tu <[email protected]>
[ Upstream commit 7b7387650dcf2881fd8bb55bcf3c8bd6c9542dd7 ]
Migration may be raced with fallocating hole. remove_inode_single_folio will unmap the folio if the folio is still mapped. However, it's called without folio lock. If the folio is migrated and the mapped pte has been converted to migration entry, folio_mapped() returns false, and won't unmap it. Due to extra refcount held by remove_inode_single_folio, migration fails, restores migration entry to normal pte, and the folio is mapped again. As a result, we triggered BUG in filemap_unaccount_folio.
The log is as follows:
BUG: Bad page cache in process hugetlb pfn:156c00 page: refcount:515 mapcount:0 mapping:0000000099fef6e1 index:0x0 pfn:0x156c00 head: order:9 mapcount:1 entire_mapcount:1 nr_pages_mapped:0 pincount:0 aops:hugetlbfs_aops ino:dcc dentry name(?):"my_hugepage_file" flags: 0x17ffffc00000c1(locked|waiters|head|node=0|zone=2|lastcpupid=0x1fffff) page_type: f4(hugetlb) page dumped because: still mapped when deleted CPU: 1 UID: 0 PID: 395 Comm: hugetlb Not tainted 6.17.0-rc5-00044-g7aac71907bde-dirty #484 NONE Hardware name: QEMU Ubuntu 24.04 PC (i440FX + PIIX, 1996), BIOS 0.0.0 02/06/2015 Call Trace: <TASK> dump_stack_lvl+0x4f/0x70 filemap_unaccount_folio+0xc4/0x1c0 __filemap_remove_folio+0x38/0x1c0 filemap_remove_folio+0x41/0xd0 remove_inode_hugepages+0x142/0x250 hugetlbfs_fallocate+0x471/0x5a0 vfs_fallocate+0x149/0x380
Hold folio lock before checking if the folio is mapped to avold race with migration.
--- fs/hugetlbfs/inode.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
fs/hugetlbfs/inode.c +6 -8
@@ -502,13 +502,13 @@ static void remove_inode_hugepages(struc/* * If page is mapped, it was faulted in after being -* unmapped in caller. Unmap (again) now after taking -* the fault mutex. The mutex will prevent faults -* until we finish removing the page. -* -* This race can only happen in the hole punch case. -* Getting here in a truncate operation is a bug. +* unmapped in caller or hugetlb_vmdelete_list() skips +* unmapping it due to fail to grab lock. Unmap (again) +* while holding the fault mutex. The mutex will prevent +* faults until we finish removing the page. Hold page +* lock to guarantee no concurrent migration. */ +lock_page (page);if (unlikely (page_mapped (page))) {BUG_ON (truncate_op);
@@ -518,8 +518,6 @@ static void remove_inode_hugepages(struc (index + 1) * pages_per_huge_page(h));i_mmap_unlock_write (mapping); } - -lock_page (page);/* * We must free the huge page and remove from page * cache (remove_huge_page) BEFORE removing the
Greg Kroah-Hartman
maintainerPATCH 62/81 usb: core: Add 0x prefix to quirks debug output
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiayi Li <[email protected]>
[ Upstream commit 47c428fce0b41b15ab321d8ede871f780ccd038f ]
Use "0x%x" format for quirks debug print to clarify it's a hexadecimal value. Improves readability and consistency with other hex outputs.
--- drivers/usb/core/quirks.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/core/quirks.c +1 -1
@@ -728,7 +728,7 @@ void usb_detect_quirks(struct usb_device *udev) udev->quirks ^=usb_detect_dynamic_quirks (udev);if (udev->quirks) -dev_dbg (&udev->dev,"USB quirks for this device: %x\n" , +dev_dbg (&udev->dev,"USB quirks for this device: 0x%x\n" , udev->quirks);#ifdef CONFIG_USB_DEFAULT_PERSIST
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 63/81 IB/mlx5: Fix obj_type mismatch for SRQ event subscriptions
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Or Har-Toov <[email protected]>
[ Upstream commit 85fe9f565d2d5af95ac2bbaa5082b8ce62b039f5 ]
Fix a bug where the driver's event subscription logic for SRQ-related events incorrectly sets obj_type for RMP objects.
When subscribing to SRQ events, get_legacy_obj_type() did not handle the MLX5_CMD_OP_CREATE_RMP case, which caused obj_type to be 0 (default).
This led to a mismatch between the obj_type used during subscription
(0) and the value used during notification (1, taken from the event's type field). As a result, event mapping for SRQ objects could fail and event notification would not be delivered correctly.
This fix adds handling for MLX5_CMD_OP_CREATE_RMP in get_legacy_obj_type, returning MLX5_EVENT_QUEUE_TYPE_RQ so obj_type is consistent between subscription and notification.
--- drivers/infiniband/hw/mlx5/devx.c | 1 + 1 file changed, 1 insertion(+)
drivers/infiniband/hw/mlx5/devx.c +1 -0
@@ -245,6 +245,7 @@ static u16 get_legacy_obj_type(u16 opcode) {switch (opcode) {case MLX5_CMD_OP_CREATE_RQ : +case MLX5_CMD_OP_CREATE_RMP :return MLX5_EVENT_QUEUE_TYPE_RQ ;case MLX5_CMD_OP_CREATE_QP :return MLX5_EVENT_QUEUE_TYPE_QP ;
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 64/81 can: rcar_can: rcar_can_resume(): fix s2ram with PSCI
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
[ Upstream commit 5c793afa07da6d2d4595f6c73a2a543a471bb055 ]
On R-Car Gen3 using PSCI, s2ram powers down the SoC. After resume, the CAN interface no longer works, until it is brought down and up again.
Fix this by calling rcar_can_start() from the PM resume callback, to fully initialize the controller instead of just restarting it.
--- drivers/net/can/rcar/rcar_can.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/net/can/rcar/rcar_can.c +1 -7
@@ -869,7 +869,6 @@ static int __maybe_unused rcar_can_resume(struct device *dev) {struct net_device *ndev =dev_get_drvdata (dev);struct rcar_can_priv *priv =netdev_priv (ndev); -u16 ctlr;int err;if (!netif_running (ndev))
@@ -881,12 +880,7 @@ static int __maybe_unused rcar_can_resume(struct device *dev)return err; } - ctlr =readw (&priv->regs->ctlr); - ctlr &= ~RCAR_CAN_CTLR_SLPM ; -writew (ctlr, &priv->regs->ctlr); - ctlr &= ~RCAR_CAN_CTLR_CANM ; -writew (ctlr, &priv->regs->ctlr); - priv->can.state =CAN_STATE_ERROR_ACTIVE ; +rcar_can_start (ndev);netif_device_attach (ndev);netif_start_queue (ndev);
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 65/81 can: hi311x: populate ndo_change_mtu() to prevent buffer overflow
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vincent Mailhol <[email protected]>
[ Upstream commit ac1c7656fa717f29fac3ea073af63f0b9919ec9a ]
Sending an PF_PACKET allows to bypass the CAN framework logic and to directly reach the xmit() function of a CAN driver. The only check which is performed by the PF_PACKET framework is to make sure that skb->len fits the interface's MTU.
Unfortunately, because the sun4i_can driver does not populate its net_device_ops->ndo_change_mtu(), it is possible for an attacker to configure an invalid MTU by doing, for example:
$ ip link set can0 mtu 9999
After doing so, the attacker could open a PF_PACKET socket using the ETH_P_CANXL protocol:
socket(PF_PACKET, SOCK_RAW, htons(ETH_P_CANXL))
to inject a malicious CAN XL frames. For example:
struct canxl_frame frame = {
.flags = 0xff,
.len = 2048,
};The CAN drivers' xmit() function are calling can_dev_dropped_skb() to check that the skb is valid, unfortunately under above conditions, the malicious packet is able to go through can_dev_dropped_skb() checks:
1. the skb->protocol is set to ETH_P_CANXL which is valid (the function does not check the actual device capabilities).
2. the length is a valid CAN XL length.
And so, hi3110_hard_start_xmit() receives a CAN XL frame which it is not able to correctly handle and will thus misinterpret it as a CAN frame. The driver will consume frame->len as-is with no further checks.
This can result in a buffer overflow later on in hi3110_hw_tx() on this line:
memcpy(buf + HI3110_FIFO_EXT_DATA_OFF, frame->data, frame->len);
Here, frame->len corresponds to the flags field of the CAN XL frame. In our previous example, we set canxl_frame->flags to 0xff. Because the maximum expected length is 8, a buffer overflow of 247 bytes occurs!
Populate net_device_ops->ndo_change_mtu() to ensure that the interface's MTU can not be set to anything bigger than CAN_MTU. By fixing the root cause, this prevents the buffer overflow.
--- drivers/net/can/spi/hi311x.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/can/spi/hi311x.c +1 -0
@@ -807,6 +807,7 @@ static const struct net_device_ops hi3110_netdev_ops = { .ndo_open = hi3110_open, .ndo_stop = hi3110_stop, .ndo_start_xmit = hi3110_hard_start_xmit, + .ndo_change_mtu = can_change_mtu, };static const struct of_device_id hi3110_of_match[] = {
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 66/81 can: sun4i_can: populate ndo_change_mtu() to prevent buffer overflow
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vincent Mailhol <[email protected]>
[ Upstream commit 61da0bd4102c459823fbe6b8b43b01fb6ace4a22 ]
Sending an PF_PACKET allows to bypass the CAN framework logic and to directly reach the xmit() function of a CAN driver. The only check which is performed by the PF_PACKET framework is to make sure that skb->len fits the interface's MTU.
Unfortunately, because the sun4i_can driver does not populate its net_device_ops->ndo_change_mtu(), it is possible for an attacker to configure an invalid MTU by doing, for example:
$ ip link set can0 mtu 9999
After doing so, the attacker could open a PF_PACKET socket using the ETH_P_CANXL protocol:
socket(PF_PACKET, SOCK_RAW, htons(ETH_P_CANXL))
to inject a malicious CAN XL frames. For example:
struct canxl_frame frame = {
.flags = 0xff,
.len = 2048,
};The CAN drivers' xmit() function are calling can_dev_dropped_skb() to check that the skb is valid, unfortunately under above conditions, the malicious packet is able to go through can_dev_dropped_skb() checks:
1. the skb->protocol is set to ETH_P_CANXL which is valid (the function does not check the actual device capabilities).
2. the length is a valid CAN XL length.
And so, sun4ican_start_xmit() receives a CAN XL frame which it is not able to correctly handle and will thus misinterpret it as a CAN frame.
This can result in a buffer overflow. The driver will consume cf->len as-is with no further checks on this line:
dlc = cf->len;
Here, cf->len corresponds to the flags field of the CAN XL frame. In our previous example, we set canxl_frame->flags to 0xff. Because the maximum expected length is 8, a buffer overflow of 247 bytes occurs a couple line below when doing:
for (i = 0; i < dlc; i++) writel(cf->data[i], priv->base + (dreg + i * 4));
Populate net_device_ops->ndo_change_mtu() to ensure that the interface's MTU can not be set to anything bigger than CAN_MTU. By fixing the root cause, this prevents the buffer overflow.
--- drivers/net/can/sun4i_can.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/can/sun4i_can.c +1 -0
@@ -752,6 +752,7 @@ static const struct net_device_ops sun4ican_netdev_ops = { .ndo_open = sun4ican_open, .ndo_stop = sun4ican_close, .ndo_start_xmit = sun4ican_start_xmit, + .ndo_change_mtu = can_change_mtu, };static const struct of_device_id sun4ican_of_match[] = {
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 67/81 can: mcba_usb: populate ndo_change_mtu() to prevent buffer overflow
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vincent Mailhol <[email protected]>
[ Upstream commit 17c8d794527f01def0d1c8b7dc2d7b8d34fed0e6 ]
Sending an PF_PACKET allows to bypass the CAN framework logic and to directly reach the xmit() function of a CAN driver. The only check which is performed by the PF_PACKET framework is to make sure that skb->len fits the interface's MTU.
Unfortunately, because the mcba_usb driver does not populate its net_device_ops->ndo_change_mtu(), it is possible for an attacker to configure an invalid MTU by doing, for example:
$ ip link set can0 mtu 9999
After doing so, the attacker could open a PF_PACKET socket using the ETH_P_CANXL protocol:
socket(PF_PACKET, SOCK_RAW, htons(ETH_P_CANXL))
to inject a malicious CAN XL frames. For example:
struct canxl_frame frame = {
.flags = 0xff,
.len = 2048,
};The CAN drivers' xmit() function are calling can_dev_dropped_skb() to check that the skb is valid, unfortunately under above conditions, the malicious packet is able to go through can_dev_dropped_skb() checks:
1. the skb->protocol is set to ETH_P_CANXL which is valid (the function does not check the actual device capabilities).
2. the length is a valid CAN XL length.
And so, mcba_usb_start_xmit() receives a CAN XL frame which it is not able to correctly handle and will thus misinterpret it as a CAN frame.
This can result in a buffer overflow. The driver will consume cf->len as-is with no further checks on these lines:
usb_msg.dlc = cf->len; memcpy(usb_msg.data, cf->data, usb_msg.dlc);
Here, cf->len corresponds to the flags field of the CAN XL frame. In our previous example, we set canxl_frame->flags to 0xff. Because the maximum expected length is 8, a buffer overflow of 247 bytes occurs!
Populate net_device_ops->ndo_change_mtu() to ensure that the interface's MTU can not be set to anything bigger than CAN_MTU. By fixing the root cause, this prevents the buffer overflow.
--- drivers/net/can/usb/mcba_usb.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/can/usb/mcba_usb.c +1 -0
@@ -769,6 +769,7 @@ static const struct net_device_ops mcba_netdev_ops = { .ndo_open = mcba_usb_open, .ndo_stop = mcba_usb_close, .ndo_start_xmit = mcba_usb_start_xmit, + .ndo_change_mtu = can_change_mtu, };/* Microchip CANBUS has hardcoded bittiming values by default.
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 68/81 can: peak_usb: fix shift-out-of-bounds issue
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stéphane Grosjean <[email protected]>
[ Upstream commit c443be70aaee42c2d1d251e0329e0a69dd96ae54 ]
Explicitly uses a 64-bit constant when the number of bits used for its shifting is 32 (which is the case for PC CAN FD interfaces supported by this driver).
--- drivers/net/can/usb/peak_usb/pcan_usb_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/can/usb/peak_usb/pcan_usb_core.c +1 -1
@@ -84,7 +84,7 @@ void peak_usb_update_ts_now(struct peak_time_ref *time_ref, u32 ts_now)u32 delta_ts = time_ref->ts_dev_2 - time_ref->ts_dev_1;if (time_ref->ts_dev_2 < time_ref->ts_dev_1) - delta_ts &= (1 << time_ref->adapter->ts_used_bits) -1 ; + delta_ts &= (1ULL << time_ref->adapter->ts_used_bits) -1 ; time_ref->ts_total += delta_ts; }
Signature · 1 line
2.51.0
Greg Kroah-Hartman
maintainerPATCH 59/81 ALSA: usb-audio: Add mixer quirk for Sony DualSense PS5
In reply to Greg Kroah-Hartman5.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cristian Ciocaltea <[email protected]>
[ Upstream commit 79d561c4ec0497669f19a9550cfb74812f60938b ]
The Sony DualSense wireless controller (PS5) features an internal mono speaker, but it also provides a 3.5mm jack socket for headphone output and headset microphone input.
Since this is a UAC1 device, it doesn't advertise any jack detection capability. However, the controller is able to report HP & MIC insert events via HID, i.e. through a dedicated input device managed by the hid-playstation driver.
Add a quirk to create the jack controls for headphone and headset mic, respectively, and setup an input handler for each of them in order to intercept the related hotplug events.
--- sound/usb/mixer_quirks.c | 263 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 263 insertions(+)
sound/usb/mixer_quirks.c +263 -0
@@ -16,6 +16,7 @@#include <linux/hid.h> #include <linux/init.h> +#include <linux/input.h> #include <linux/math64.h> #include <linux/slab.h> #include <linux/usb.h>
@@ -526,6 +527,263 @@ static int snd_emu0204_controls_create(struct usb_mixer_interface *mixer) &snd_emu0204_control, NULL); } +/* +* Sony DualSense controller (PS5) jack detection +* +* Since this is an UAC 1 device, it doesn't support jack detection. +* However, the controller hid-playstation driver reports HP & MIC +* insert events through a dedicated input device. +*/ + +#define SND_DUALSENSE_JACK_OUT_TERM_ID 3 +#define SND_DUALSENSE_JACK_IN_TERM_ID 4 + +struct dualsense_mixer_elem_info { +struct usb_mixer_elem_info info; +struct input_handler ih; +struct input_device_id id_table[2 ]; +bool connected; +}; + +static void snd_dualsense_ih_event (struct input_handle *handle, +unsigned int type,unsigned int code, +int value) +{ +struct dualsense_mixer_elem_info *mei; +struct usb_mixer_elem_list *me; + +if (type !=EV_SW ) +return ; + + mei = container_of(handle->handler, struct dualsense_mixer_elem_info, ih); + me = &mei->info.head; + +if ((me->id ==SND_DUALSENSE_JACK_OUT_TERM_ID && code ==SW_HEADPHONE_INSERT ) || + (me->id ==SND_DUALSENSE_JACK_IN_TERM_ID && code ==SW_MICROPHONE_INSERT )) { + mei->connected = !!value; +snd_ctl_notify (me->mixer->chip->card,SNDRV_CTL_EVENT_MASK_VALUE , + &me->kctl->id); + } +} + +static bool snd_dualsense_ih_match (struct input_handler *handler, +struct input_dev *dev) +{ +struct dualsense_mixer_elem_info *mei; +struct usb_device *snd_dev; +char *input_dev_path, *usb_dev_path; +size_t usb_dev_path_len; +bool match = false; + + mei = container_of(handler, struct dualsense_mixer_elem_info, ih); + snd_dev = mei->info.head.mixer->chip->dev; + + input_dev_path =kobject_get_path (&dev->dev.kobj,GFP_KERNEL ); +if (!input_dev_path) { +dev_warn (&snd_dev->dev,"Failed to get input dev path\n" ); +return false; + } + + usb_dev_path =kobject_get_path (&snd_dev->dev.kobj,GFP_KERNEL ); +if (!usb_dev_path) { +dev_warn (&snd_dev->dev,"Failed to get USB dev path\n" ); + goto free_paths; + } + +/* +* Ensure the VID:PID matched input device supposedly owned by the +* hid-playstation driver belongs to the actual hardware handled by +* the current USB audio device, which implies input_dev_path being +* a subpath of usb_dev_path. +* +* This verification is necessary when there is more than one identical +* controller attached to the host system. +*/ + usb_dev_path_len =strlen (usb_dev_path); +if (usb_dev_path_len >=strlen (input_dev_path)) + goto free_paths; + + usb_dev_path[usb_dev_path_len] ='/' ; + match = !memcmp (input_dev_path, usb_dev_path, usb_dev_path_len +1 ); + +free_paths: +kfree (input_dev_path); +kfree (usb_dev_path); + +return match; +} + +static int snd_dualsense_ih_connect (struct input_handler *handler, +struct input_dev *dev, +const struct input_device_id *id) +{ +struct input_handle *handle; +int err; + + handle =kzalloc (sizeof (*handle),GFP_KERNEL ); +if (!handle) +return -ENOMEM ; + + handle->dev = dev; + handle->handler = handler; + handle->name = handler->name; + + err =input_register_handle (handle); +if (err) + goto err_free; + + err =input_open_device (handle); +if (err) + goto err_unregister; + +return 0 ; + +err_unregister: +input_unregister_handle (handle); +err_free: +kfree (handle); +return err; +} + +static void snd_dualsense_ih_disconnect (struct input_handle *handle) +{ +input_close_device (handle); +input_unregister_handle (handle); +kfree (handle); +} + +static void snd_dualsense_ih_start (struct input_handle *handle) +{ +struct dualsense_mixer_elem_info *mei; +struct usb_mixer_elem_list *me; +int status =-1 ; + + mei = container_of(handle->handler, struct dualsense_mixer_elem_info, ih); + me = &mei->info.head; + +if (me->id ==SND_DUALSENSE_JACK_OUT_TERM_ID && +test_bit (SW_HEADPHONE_INSERT , handle->dev->swbit)) + status =test_bit (SW_HEADPHONE_INSERT , handle->dev->sw); +else if (me->id ==SND_DUALSENSE_JACK_IN_TERM_ID && +test_bit (SW_MICROPHONE_INSERT , handle->dev->swbit)) + status =test_bit (SW_MICROPHONE_INSERT , handle->dev->sw); + +if (status >=0 ) { + mei->connected = !!status; +snd_ctl_notify (me->mixer->chip->card,SNDRV_CTL_EVENT_MASK_VALUE , + &me->kctl->id); + } +} + +static int snd_dualsense_jack_get (struct snd_kcontrol *kctl, +struct snd_ctl_elem_value *ucontrol) +{ +struct dualsense_mixer_elem_info *mei =snd_kcontrol_chip (kctl); + + ucontrol->value.integer.value[0 ] = mei->connected; + +return 0 ; +} + +static const struct snd_kcontrol_new snd_dualsense_jack_control = { + .iface =SNDRV_CTL_ELEM_IFACE_CARD , + .access =SNDRV_CTL_ELEM_ACCESS_READ , + .info = snd_ctl_boolean_mono_info, + .get = snd_dualsense_jack_get, +}; + +static int snd_dualsense_resume_jack (struct usb_mixer_elem_list *list) +{ +snd_ctl_notify (list->mixer->chip->card,SNDRV_CTL_EVENT_MASK_VALUE , + &list->kctl->id); +return 0 ; +} + +static void snd_dualsense_mixer_elem_free (struct snd_kcontrol *kctl) +{ +struct dualsense_mixer_elem_info *mei =snd_kcontrol_chip (kctl); + +if (mei->ih.event) +input_unregister_handler (&mei->ih); + +snd_usb_mixer_elem_free (kctl); +} + +static int snd_dualsense_jack_create (struct usb_mixer_interface *mixer, +const char *name,bool is_output) +{ +struct dualsense_mixer_elem_info *mei; +struct input_device_id *idev_id; +struct snd_kcontrol *kctl; +int err; + + mei =kzalloc (sizeof (*mei),GFP_KERNEL ); +if (!mei) +return -ENOMEM ; + +snd_usb_mixer_elem_init_std (&mei->info.head, mixer, + is_output ?SND_DUALSENSE_JACK_OUT_TERM_ID : +SND_DUALSENSE_JACK_IN_TERM_ID ); + + mei->info.head.resume = snd_dualsense_resume_jack; + mei->info.val_type =USB_MIXER_BOOLEAN ; + mei->info.channels =1 ; + mei->info.min =0 ; + mei->info.max =1 ; + + kctl =snd_ctl_new1 (&snd_dualsense_jack_control, mei); +if (!kctl) { +kfree (mei); +return -ENOMEM ; + } + +strscpy (kctl->id.name, name,sizeof (kctl->id.name)); + kctl->private_free = snd_dualsense_mixer_elem_free; + + err =snd_usb_mixer_add_control (&mei->info.head, kctl); +if (err) +return err; + + idev_id = &mei->id_table[0 ]; + idev_id->flags =INPUT_DEVICE_ID_MATCH_VENDOR |INPUT_DEVICE_ID_MATCH_PRODUCT | +INPUT_DEVICE_ID_MATCH_EVBIT |INPUT_DEVICE_ID_MATCH_SWBIT ; + idev_id->vendor =USB_ID_VENDOR (mixer->chip->usb_id); + idev_id->product =USB_ID_PRODUCT (mixer->chip->usb_id); + idev_id->evbit[BIT_WORD (EV_SW )] =BIT_MASK (EV_SW ); +if (is_output) + idev_id->swbit[BIT_WORD (SW_HEADPHONE_INSERT )] =BIT_MASK (SW_HEADPHONE_INSERT ); +else + idev_id->swbit[BIT_WORD (SW_MICROPHONE_INSERT )] =BIT_MASK (SW_MICROPHONE_INSERT ); + + mei->ih.event = snd_dualsense_ih_event; + mei->ih.match = snd_dualsense_ih_match; + mei->ih.connect = snd_dualsense_ih_connect, + mei->ih.disconnect = snd_dualsense_ih_disconnect, + mei->ih.start = snd_dualsense_ih_start, + mei->ih.name = name; + mei->ih.id_table = mei->id_table; + + err =input_register_handler (&mei->ih); +if (err) { +dev_warn (&mixer->chip->dev->dev, +"Could not register input handler: %d\n" , err); + mei->ih.event =NULL ; + } + +return 0 ; +} + +static int snd_dualsense_controls_create (struct usb_mixer_interface *mixer) +{ +int err; + + err =snd_dualsense_jack_create (mixer,"Headphone Jack" , true); +if (err <0 ) +return err; + +return snd_dualsense_jack_create (mixer,"Headset Mic Jack" , false); +} +/* ASUS Xonar U1 / U3 controls */ static int snd_xonar_u1_switch_get(struct snd_kcontrol *kcontrol,
@@ -2381,6 +2639,11 @@ int snd_usb_mixer_apply_create_quirk(struct usb_mixer_interface *mixer) err =snd_emu0204_controls_create (mixer);break ; +case USB_ID (0x054c ,0x0ce6 ):/* Sony DualSense controller (PS5) */ +case USB_ID (0x054c ,0x0df2 ):/* Sony DualSense Edge controller (PS5) */ + err =snd_dualsense_controls_create (mixer); +break ; +case USB_ID (0x0763 ,0x2030 ):/* M-Audio Fast Track C400 */ case USB_ID (0x0763 ,0x2031 ):/* M-Audio Fast Track C400 */ err =snd_c400_create_mixer (mixer);
Signature · 1 line
2.51.0
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.4.300 release. There are 81 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 Thu, 02 Oct 2025 14:37:59 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.4.300-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.4.y
and the diffstat can be found below.thanks,
greg k-h
On ARCH_BRCMSTB using 32-bit and 64-bit ARM kernels, build tested on BMIPS_GENERIC:
Signature · 1 line
Florian
Build and boots without error. No network tests run.
CPU/kernel: Linux auntie 5.4.300-rc1-00082-ge1a2ff52265e #97 SMP Tue Sep 30 16:08:47 -00 2025 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 5.4.300 release. There are 81 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 Thu, 02 Oct 2025 14:37:59 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.4.300-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.4.y
and the diffstat can be found below.thanks,
greg k-h
All tests passing for Tegra ...
Test results for stable-v5.4:
10 builds: 10 pass, 0 fail
24 boots: 24 pass, 0 fail
54 tests: 54 pass, 0 failLinux version: 5.4.300-rc1-ge1a2ff52265e
Boards tested: tegra124-jetson-tk1, tegra186-p2771-0000,
tegra194-p2972-0000, tegra20-ventana,
tegra210-p2371-2180, tegra210-p3450-0000,
tegra30-cardhu-a04Jon
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.4.300 release. There are 81 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 Thu, 02 Oct 2025 14:37:59 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.4.300-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.4.y
and the diffstat can be found below.thanks,
greg k-h
Results from Linaro’s test farm.
No regressions on arm64, arm, x86_64, and i386.
## Build
* kernel: 5.4.300-rc1
* git: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
* git commit: e1a2ff52265e4d85abb275e2930b92c821a3dd19
* git describe: v5.4.299-82-ge1a2ff52265e
* test details:
https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-5.4.y/build/v5.4.299-82-ge1a2ff52265e
## Test Regressions (compared to v5.4.297-70-gf858bf548429)
## Metric Regressions (compared to v5.4.297-70-gf858bf548429)
## Test Fixes (compared to v5.4.297-70-gf858bf548429)
## Metric Fixes (compared to v5.4.297-70-gf858bf548429)
## Test result summary
total: 39813, pass: 29726, fail: 2683, skip: 7251, xfail: 153
## Build Summary
* arc: 5 total, 5 passed, 0 failed
* arm: 133 total, 133 passed, 0 failed
* arm64: 33 total, 31 passed, 2 failed
* i386: 20 total, 14 passed, 6 failed
* mips: 25 total, 25 passed, 0 failed
* parisc: 3 total, 0 passed, 3 failed
* powerpc: 26 total, 26 passed, 0 failed
* riscv: 9 total, 3 passed, 6 failed
* s390: 6 total, 6 passed, 0 failed
* sh: 10 total, 10 passed, 0 failed
* sparc: 6 total, 6 passed, 0 failed
* x86_64: 29 total, 29 passed, 0 failed
## Test suites summary
* boot
* kselftest-arm64
* kselftest-breakpoints
* kselftest-capabilities
* kselftest-clone3
* kselftest-core
* kselftest-cpu-hotplug
* kselftest-exec
* kselftest-fpu
* kselftest-futex
* kselftest-intel_pstate
* kselftest-kcmp
* kselftest-membarrier
* kselftest-mincore
* kselftest-mqueue
* kselftest-openat2
* kselftest-ptrace
* kselftest-rseq
* kselftest-rtc
* kselftest-sigaltstack
* kselftest-size
* kselftest-timers
* kselftest-tmpfs
* kselftest-tpm2
* kselftest-user_events
* kselftest-vDSO
* kselftest-x86
* kunit
* lava
* libhugetlbfs
* log-parser-boot
* log-parser-build-clang
* log-parser-build-gcc
* log-parser-test
* ltp-capability
* ltp-commands
* ltp-containers
* ltp-controllers
* ltp-cpuhotplug
* ltp-crypto
* ltp-cve
* ltp-dio
* ltp-fcntl-locktests
* ltp-fs
* ltp-fs_bind
* ltp-fs_perms_simple
* ltp-hugetlb
* ltp-math
* ltp-mm
* ltp-nptl
* ltp-pty
* ltp-sched
* ltp-smoke
* ltp-syscalls
* ltp-tracing
* rcutorture
--
Linaro LKFT
https://lkft.linaro.org
Re: [External] : [PATCH 5.4 00/81] 5.4.300-rc1 review
In reply to Greg Kroah-HartmanHi Greg,
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.4.300 release. There are 81 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 Thu, 02 Oct 2025 14:37:59 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://urldefense.com/v3/__https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.4.300-rc1.gz__;!!ACWV5N9M2RV99hQ! Kym8XMoYTNEV2epsa9VYcCZjGb1C8XhipnQKz9ZdKeVEV1OcYCEdMIZhKBqZFTXO5pwrmQdbGfoOBWtW8qD_KQ4LIg$ or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.4.y
and the diffstat can be found below.thanks,
greg k-h
No problems were observed on x86_64 and aarch64 during our testing.
Thanks,
Alok
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.4.300 release. There are 81 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 Thu, 02 Oct 2025 14:37:59 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.4.300-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.4.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah