dmaengine: fsl-qdma: check dma_set_mask return value
Subsystems (15)
Sasha Levin
maintainerPATCH 1/63 dmaengine: fsl-qdma: check dma_set_mask return value
From: Robin Gong <[email protected]>
[ Upstream commit f0c07993af0acf5545d5c1445798846565f4f147 ]
For fix below warning reported by static code analysis tool like Coverity from Synopsys:
Addresses-Coverity-ID: 12285639 ("Unchecked return value")
--- drivers/dma/fsl-qdma.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/dma/fsl-qdma.c +5 -1
@@ -1184,7 +1184,11 @@ static int fsl_qdma_probe(struct platform_device *pdev) fsl_qdma->dma_dev.device_synchronize = fsl_qdma_synchronize; fsl_qdma->dma_dev.device_terminate_all = fsl_qdma_terminate_all; -dma_set_mask (&pdev->dev,DMA_BIT_MASK (40 )); + ret =dma_set_mask (&pdev->dev,DMA_BIT_MASK (40 )); +if (ret) { +dev_err (&pdev->dev,"dma_set_mask failure.\n" ); +return ret; + }platform_set_drvdata (pdev, fsl_qdma);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 2/63 srcu: Fix broken node geometry after early ssp init
From: Frederic Weisbecker <[email protected]>
[ Upstream commit b5befe842e6612cf894cf4a199924ee872d8b7d8 ]
An srcu_struct structure that is initialized before rcu_init_geometry() will have its srcu_node hierarchy based on CONFIG_NR_CPUS. Once rcu_init_geometry() is called, this hierarchy is compressed as needed for the actual maximum number of CPUs for this system.
Later on, that srcu_struct structure is confused, sometimes referring to its initial CONFIG_NR_CPUS-based hierarchy, and sometimes instead to the new num_possible_cpus() hierarchy. For example, each of its ->mynode fields continues to reference the original leaf rcu_node structures, some of which might no longer exist. On the other hand, srcu_for_each_node_breadth_first() traverses to the new node hierarchy.
There are at least two bad possible outcomes to this:
1) a) A callback enqueued early on an srcu_data structure (call it
*sdp) is recorded pending on sdp->mynode->srcu_data_have_cbs in
srcu_funnel_gp_start() with sdp->mynode pointing to a deep leaf
(say 3 levels). b) The grace period ends after rcu_init_geometry() shrinks the nodes level to a single one. srcu_gp_end() walks through the new srcu_node hierarchy without ever reaching the old leaves so the callback is never executed.
This is easily reproduced on an 8 CPUs machine with CONFIG_NR_CPUS >= 32 and "rcupdate.rcu_self_test=1". The srcu_barrier() after early tests verification never completes and the boot hangs:
[ 5413.141029] INFO: task swapper/0:1 blocked for more than 4915 seconds. [ 5413.147564] Not tainted 5.12.0-rc4+ #28 [ 5413.151927] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. [ 5413.159753] task:swapper/0 state:D stack: 0 pid: 1 ppid: 0 flags:0x00004000 [ 5413.168099] Call Trace: [ 5413.170555] __schedule+0x36c/0x930 [ 5413.174057] ? wait_for_completion+0x88/0x110 [ 5413.178423] schedule+0x46/0xf0 [ 5413.181575] schedule_timeout+0x284/0x380 [ 5413.185591] ? wait_for_completion+0x88/0x110 [ 5413.189957] ? mark_held_locks+0x61/0x80 [ 5413.193882] ? mark_held_locks+0x61/0x80 [ 5413.197809] ? _raw_spin_unlock_irq+0x24/0x50 [ 5413.202173] ? wait_for_completion+0x88/0x110 [ 5413.206535] wait_for_completion+0xb4/0x110 [ 5413.210724] ? srcu_torture_stats_print+0x110/0x110 [ 5413.215610] srcu_barrier+0x187/0x200 [ 5413.219277] ? rcu_tasks_verify_self_tests+0x50/0x50 [ 5413.224244] ? rdinit_setup+0x2b/0x2b [ 5413.227907] rcu_verify_early_boot_tests+0x2d/0x40 [ 5413.232700] do_one_initcall+0x63/0x310 [ 5413.236541] ? rdinit_setup+0x2b/0x2b [ 5413.240207] ? rcu_read_lock_sched_held+0x52/0x80 [ 5413.244912] kernel_init_freeable+0x253/0x28f [ 5413.249273] ? rest_init+0x250/0x250 [ 5413.252846] kernel_init+0xa/0x110 [ 5413.256257] ret_from_fork+0x22/0x30
2) An srcu_struct structure that is initialized before rcu_init_geometry() and used afterward will always have stale rdp->mynode references, resulting in callbacks to be missed in srcu_gp_end(), just like in the previous scenario.
This commit therefore causes init_srcu_struct_nodes to initialize the geometry, if needed. This ensures that the srcu_node hierarchy is properly built and distributed from the get-go.
--- kernel/rcu/rcu.h | 2 ++ kernel/rcu/srcutree.c | 3 +++ kernel/rcu/tree.c | 16 +++++++++++++++- 3 files changed, 20 insertions(+), 1 deletion(-)
kernel/rcu/rcu.h +2 -0
@@ -316,6 +316,8 @@ static inline void rcu_init_levelspread(int *levelspread, const int *levelcnt) } } +extern void rcu_init_geometry (void ); +/* Returns a pointer to the first leaf rcu_node structure. */ #define rcu_first_leaf_node () (rcu_state.level[rcu_num_lvls - 1])
kernel/rcu/srcutree.c +3 -0
@@ -90,6 +90,9 @@ static void init_srcu_struct_nodes(struct srcu_struct *ssp, bool is_static)struct srcu_node *snp;struct srcu_node *snp_first; +/* Initialize geometry if it has not already been initialized. */ +rcu_init_geometry (); +/* Work out the overall tree geometry. */ ssp->level[0 ] = &ssp->node[0 ];for (i =1 ; i < rcu_num_lvls; i++)
kernel/rcu/tree.c +15 -1
@@ -3425,11 +3425,25 @@ static void __init rcu_init_one(void)* replace the definitions in tree.h because those are needed to size * the ->node array in the rcu_state structure. */ -static void __init rcu_init_geometry (void ) +void rcu_init_geometry (void ) {ulong d;int i; +static unsigned long old_nr_cpu_ids;int rcu_capacity[RCU_NUM_LVLS ]; +static bool initialized; + +if (initialized) { +/* +* Warn if setup_nr_cpu_ids() had not yet been invoked, +* unless nr_cpus_ids == NR_CPUS, in which case who cares? +*/ +WARN_ON_ONCE (old_nr_cpu_ids != nr_cpu_ids); +return ; + } + + old_nr_cpu_ids = nr_cpu_ids; + initialized = true;/* * Initialize any unspecified boot parameters.
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 3/63 tty: serial: fsl_lpuart: fix the potential risk of division or modulo by zero
In reply to Sasha LevinFrom: Sherry Sun <[email protected]>
[ Upstream commit fcb10ee27fb91b25b68d7745db9817ecea9f1038 ]
We should be very careful about the register values that will be used for division or modulo operations, althrough the possibility that the UARTBAUD register value is zero is very low, but we had better to deal with the "bad data" of hardware in advance to avoid division or modulo by zero leading to undefined kernel behavior.
--- drivers/tty/serial/fsl_lpuart.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/tty/serial/fsl_lpuart.c +3 -0
@@ -2253,6 +2253,9 @@ lpuart32_console_get_options(struct lpuart_port *sport, int *baud, bd =lpuart32_read (&sport->port,UARTBAUD ); bd &=UARTBAUD_SBR_MASK ; +if (!bd) +return ; + sbr = bd; uartclk =lpuart_get_baud_clk_rate (sport);/*
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 4/63 serial: 8250: of: Check for CONFIG_SERIAL_8250_BCM7271
In reply to Sasha LevinFrom: Jim Quinlan <[email protected]>
[ Upstream commit f5b08386dee439c7a9e60ce0a4a4a705f3a60dff ]
Our SoC's have always had a NS16650A UART core and older SoC's would have a compatible string of: 'compatible = ""ns16550a"' and use the 8250_of driver. Our newer SoC's have added enhancements to the base core to add support for DMA and accurate high speed baud rates and use this newer 8250_bcm7271 driver. The Device Tree node for our enhanced UARTs has a compatible string of: 'compatible = "brcm,bcm7271-uart", "ns16550a"''. With both drivers running and the link order setup so that the 8250_bcm7217 driver is initialized before the 8250_of driver, we should bind the 8250_bcm7271 driver to the enhanced UART, or for upstream kernels that don't have the 8250_bcm7271 driver, we bind to the 8250_of driver.
The problem is that when both the 8250_of and 8250_bcm7271 drivers were running, occasionally the 8250_of driver would be bound to the enhanced UART instead of the 8250_bcm7271 driver. This was happening because we use SCMI based clocks which come up late in initialization and cause probe DEFER's when the two drivers get their clocks.
Occasionally the SCMI clock would become ready between the 8250_bcm7271 probe and the 8250_of probe and the 8250_of driver would be bound. To fix this we decided to config only our 8250_bcm7271 driver and added "ns16665a0" to the compatible string so the driver would work on our older system.
This commit has of_platform_serial_probe() check specifically for the "brcm,bcm7271-uart" and whether its companion driver is enabled. If it is the case, and the clock provider is not ready, we want to make sure that when the 8250_bcm7271.c driver returns EPROBE_DEFER, we are not getting the UART registered via 8250_of.c.
--- drivers/tty/serial/8250/8250_of.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/tty/serial/8250/8250_of.c +4 -0
@@ -213,6 +213,10 @@ static int of_platform_serial_probe(struct platform_device *ofdev)u32 tx_threshold;int ret; +if (IS_ENABLED (CONFIG_SERIAL_8250_BCM7271 ) && +of_device_is_compatible (ofdev->dev.of_node,"brcm,bcm7271-uart" )) +return -ENODEV ; + port_type = (unsigned long )of_device_get_match_data (&ofdev->dev);if (port_type ==PORT_UNKNOWN )return -EINVAL ;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 5/63 misc/libmasm/module: Fix two use after free in ibmasm_init_one
In reply to Sasha LevinFrom: Lv Yunlong <[email protected]>
[ Upstream commit 7272b591c4cb9327c43443f67b8fbae7657dd9ae ]
In ibmasm_init_one, it calls ibmasm_init_remote_input_dev(). Inside ibmasm_init_remote_input_dev, mouse_dev and keybd_dev are allocated by input_allocate_device(), and assigned to sp->remote.mouse_dev and sp->remote.keybd_dev respectively.
In the err_free_devices error branch of ibmasm_init_one, mouse_dev and keybd_dev are freed by input_free_device(), and return error. Then the execution runs into error_send_message error branch of ibmasm_init_one, where ibmasm_free_remote_input_dev(sp) is called to unregister the freed sp->remote.mouse_dev and sp->remote.keybd_dev.
My patch add a "error_init_remote" label to handle the error of ibmasm_init_remote_input_dev(), to avoid the uaf bugs.
--- drivers/misc/ibmasm/module.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/misc/ibmasm/module.c +3 -2
@@ -111,7 +111,7 @@ static int ibmasm_init_one(struct pci_dev *pdev, const struct pci_device_id *id) result =ibmasm_init_remote_input_dev (sp);if (result) {dev_err (sp->dev,"Failed to initialize remote queue\n" ); - goto error_send_message; + goto error_init_remote; } result =ibmasm_send_driver_vpd (sp);
@@ -131,8 +131,9 @@ static int ibmasm_init_one(struct pci_dev *pdev, const struct pci_device_id *id)return 0 ; error_send_message: -disable_sp_interrupts (sp->base_address);ibmasm_free_remote_input_dev (sp); +error_init_remote: +disable_sp_interrupts (sp->base_address);free_irq (sp->irq, (void *)sp); error_request_irq:iounmap (sp->base_address);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 6/63 misc: alcor_pci: fix null-ptr-deref when there is no PCI bridge
In reply to Sasha LevinFrom: Tong Zhang <[email protected]>
[ Upstream commit 3ce3e45cc333da707d4d6eb433574b990bcc26f5 ]
There is an issue with the ASPM(optional) capability checking function. A device might be attached to root complex directly, in this case, bus->self(bridge) will be NULL, thus priv->parent_pdev is NULL. Since alcor_pci_init_check_aspm(priv->parent_pdev) checks the PCI link's ASPM capability and populate parent_cap_off, which will be used later by alcor_pci_aspm_ctrl() to dynamically turn on/off device, what we can do here is to avoid checking the capability if we are on the root complex. This will make pdev_cap_off 0 and alcor_pci_aspm_ctrl() will simply return when bring called, effectively disable ASPM for the device.
[ 1.246492] BUG: kernel NULL pointer dereference, address: 00000000000000c0 [ 1.248731] RIP: 0010:pci_read_config_byte+0x5/0x40 [ 1.253998] Call Trace: [ 1.254131] ? alcor_pci_find_cap_offset.isra.0+0x3a/0x100 [alcor_pci] [ 1.254476] alcor_pci_probe+0x169/0x2d5 [alcor_pci]
--- drivers/misc/cardreader/alcor_pci.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/misc/cardreader/alcor_pci.c +7 -1
@@ -133,7 +133,13 @@ static void alcor_pci_init_check_aspm(struct alcor_pci_priv *priv)u32 val32; priv->pdev_cap_off =alcor_pci_find_cap_offset (priv, priv->pdev); - priv->parent_cap_off =alcor_pci_find_cap_offset (priv, +/* +* A device might be attached to root complex directly and +* priv->parent_pdev will be NULL. In this case we don't check its +* capability and disable ASPM completely. +*/ +if (!priv->parent_pdev) + priv->parent_cap_off =alcor_pci_find_cap_offset (priv, priv->parent_pdev);if ((priv->pdev_cap_off ==0 ) || (priv->parent_cap_off ==0 )) {
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 7/63 iio: gyro: fxa21002c: Balance runtime pm + use pm_runtime_resume_and_get().
In reply to Sasha LevinFrom: Jonathan Cameron <[email protected]>
[ Upstream commit 41120ebbb1eb5e9dec93320e259d5b2c93226073 ]
In both the probe() error path and remove() pm_runtime_put_noidle() is called which will decrement the runtime pm reference count. However, there is no matching function to have raised the reference count. Not this isn't a fix as the runtime pm core will stop the reference count going negative anyway.
An alternative would have been to raise the count in these paths, but it is not clear why that would be necessary.
Whilst we are here replace some boilerplate with pm_runtime_resume_and_get() Found using coccicheck script under review at:
https://lore.kernel.org/lkml/[email protected]/
--- drivers/iio/gyro/fxas21002c_core.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-)
drivers/iio/gyro/fxas21002c_core.c +1 -10
@@ -300,14 +300,7 @@ static int fxas21002c_write(struct fxas21002c_data *data,static int fxas21002c_pm_get (struct fxas21002c_data *data) { -struct device *dev =regmap_get_device (data->regmap); -int ret; - - ret =pm_runtime_get_sync (dev); -if (ret <0 ) -pm_runtime_put_noidle (dev); - -return ret; +return pm_runtime_resume_and_get (regmap_get_device (data->regmap)); }static int fxas21002c_pm_put (struct fxas21002c_data *data)
@@ -940,7 +933,6 @@ int fxas21002c_core_probe(struct device *dev, struct regmap *regmap, int irq, pm_disable:pm_runtime_disable (dev);pm_runtime_set_suspended (dev); -pm_runtime_put_noidle (dev);return ret; }
@@ -954,7 +946,6 @@ void fxas21002c_core_remove(struct device *dev)pm_runtime_disable (dev);pm_runtime_set_suspended (dev); -pm_runtime_put_noidle (dev); }EXPORT_SYMBOL_GPL (fxas21002c_core_remove);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 8/63 iio: magn: bmc150: Balance runtime pm + use pm_runtime_resume_and_get()
In reply to Sasha LevinFrom: Jonathan Cameron <[email protected]>
[ Upstream commit 264da512431495e542fcaf56ffe75e7df0e7db74 ]
probe() error paths after runtime pm is enabled, should disable it. remove() should not call pm_runtime_put_noidle() as there is no matching get() to have raised the reference count. This case has no affect a the runtime pm core protects against going negative.
Whilst here use pm_runtime_resume_and_get() to tidy things up a little. coccicheck script didn't get this one due to complex code structure so found by inspection.
--- drivers/iio/magnetometer/bmc150_magn.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/iio/magnetometer/bmc150_magn.c +4 -6
@@ -260,7 +260,7 @@ static int bmc150_magn_set_power_state(struct bmc150_magn_data *data, bool on)int ret;if (on) { - ret =pm_runtime_get_sync (data->dev); + ret =pm_runtime_resume_and_get (data->dev); }else {pm_runtime_mark_last_busy (data->dev); ret =pm_runtime_put_autosuspend (data->dev);
@@ -269,9 +269,6 @@ static int bmc150_magn_set_power_state(struct bmc150_magn_data *data, bool on)if (ret <0 ) {dev_err (data->dev,"failed to change power state to %d\n" , on); -if (on) -pm_runtime_put_noidle (data->dev); -return ret; }#endif
@@ -944,12 +941,14 @@ int bmc150_magn_probe(struct device *dev, struct regmap *regmap, ret =iio_device_register (indio_dev);if (ret <0 ) {dev_err (dev,"unable to register iio device\n" ); - goto err_buffer_cleanup; + goto err_disable_runtime_pm; }dev_dbg (dev,"Registered device %s\n" , name);return 0 ; +err_disable_runtime_pm: +pm_runtime_disable (dev); err_buffer_cleanup:iio_triggered_buffer_cleanup (indio_dev); err_free_irq:
@@ -973,7 +972,6 @@ int bmc150_magn_remove(struct device *dev)pm_runtime_disable (dev);pm_runtime_set_suspended (dev); -pm_runtime_put_noidle (dev);iio_triggered_buffer_cleanup (indio_dev);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 9/63 ALSA: usx2y: Don't call free_pages_exact() with NULL address
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
[ Upstream commit cae0cf651adccee2c3f376e78f30fbd788d0829f ]
Unlike some other functions, we can't pass NULL pointer to free_pages_exact(). Add a proper NULL check for avoiding possible Oops.
--- sound/usb/usx2y/usb_stream.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
sound/usb/usx2y/usb_stream.c +5 -2
@@ -142,8 +142,11 @@ void usb_stream_free(struct usb_stream_kernel *sk)if (!s)return ; -free_pages_exact (sk->write_page, s->write_size); - sk->write_page =NULL ; +if (sk->write_page) { +free_pages_exact (sk->write_page, s->write_size); + sk->write_page =NULL ; + } +free_pages_exact (s, s->read_size); sk->s =NULL ; }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 10/63 Revert "ALSA: bebob/oxfw: fix Kconfig entry for Mackie d.2 Pro"
In reply to Sasha LevinFrom: Takashi Sakamoto <[email protected]>
[ Upstream commit 5d6fb80a142b5994355ce675c517baba6089d199 ]
This reverts commit 0edabdfe89581669609eaac5f6a8d0ae6fe95e7f.
I've explained that optional FireWire card for d.2 is also built-in to d.2 Pro, however it's wrong. The optional card uses DM1000 ASIC and has 'Mackie DJ Mixer' in its model name of configuration ROM. On the other hand, built-in FireWire card for d.2 Pro and d.4 Pro uses OXFW971 ASIC and has 'd.Pro' in its model name according to manuals and user experiences. The former card is not the card for d.2 Pro. They are similar in appearance but different internally.
--- sound/firewire/Kconfig | 4 ++-- sound/firewire/bebob/bebob.c | 2 +- sound/firewire/oxfw/oxfw.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)
sound/firewire/Kconfig +2 -2
@@ -38,7 +38,7 @@ config SND_OXFW * Mackie(Loud) Onyx 1640i (former model) * Mackie(Loud) Onyx Satellite * Mackie(Loud) Tapco Link.Firewire - * Mackie(Loud) d.4 pro + * Mackie(Loud) d.2 pro/d.4 pro (built-in FireWire card with OXFW971 ASIC) * Mackie(Loud) U.420/U.420d * TASCAM FireOne * Stanton Controllers & Systems 1 Deck/Mixer
@@ -84,7 +84,7 @@ config SND_BEBOB * PreSonus FIREBOX/FIREPOD/FP10/Inspire1394 * BridgeCo RDAudio1/Audio5 * Mackie Onyx 1220/1620/1640 (FireWire I/O Card) - * Mackie d.2 (FireWire Option) and d.2 Pro + * Mackie d.2 (optional FireWire card with DM1000 ASIC) * Stanton FinalScratch 2 (ScratchAmp) * Tascam IF-FW/DM * Behringer XENIX UFX 1204/1604
sound/firewire/bebob/bebob.c +1 -1
@@ -387,7 +387,7 @@ static const struct ieee1394_device_id bebob_id_table[] = {SND_BEBOB_DEV_ENTRY (VEN_BRIDGECO ,0x00010049 , &spec_normal),/* Mackie, Onyx 1220/1620/1640 (Firewire I/O Card) */ SND_BEBOB_DEV_ENTRY (VEN_MACKIE2 ,0x00010065 , &spec_normal), -// Mackie, d.2 (Firewire option card) and d.2 Pro (the card is built-in). +// Mackie, d.2 (optional Firewire card with DM1000). SND_BEBOB_DEV_ENTRY (VEN_MACKIE1 ,0x00010067 , &spec_normal),/* Stanton, ScratchAmp */ SND_BEBOB_DEV_ENTRY(VEN_STANTON, 0x00000001, &spec_normal),
sound/firewire/oxfw/oxfw.c +1 -1
@@ -350,7 +350,7 @@ static const struct ieee1394_device_id oxfw_id_table[] = {* Onyx-i series (former models): 0x081216 * Mackie Onyx Satellite: 0x00200f * Tapco LINK.firewire 4x6: 0x000460 -* d.4 pro: Unknown +* d.2 pro/d.4 pro (built-in card): Unknown * U.420: Unknown * U.420d: Unknown */
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 11/63 w1: ds2438: fixing bug that would always get page0
In reply to Sasha LevinFrom: Luiz Sampaio <[email protected]>
[ Upstream commit 1f5e7518f063728aee0679c5086b92d8ea429e11 ]
The purpose of the w1_ds2438_get_page function is to get the register values at the page passed as the pageno parameter. However, the page0 was hardcoded, such that the function always returned the page0 contents. Fixed so that the function can retrieve any page.
--- drivers/w1/slaves/w1_ds2438.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/w1/slaves/w1_ds2438.c +2 -2
@@ -62,13 +62,13 @@ static int w1_ds2438_get_page(struct w1_slave *sl, int pageno, u8 *buf)if (w1_reset_select_slave (sl))continue ; w1_buf[0 ] =W1_DS2438_RECALL_MEMORY ; - w1_buf[1 ] =0x00 ; + w1_buf[1 ] = (u8 )pageno;w1_write_block (sl->master, w1_buf,2 );if (w1_reset_select_slave (sl))continue ; w1_buf[0 ] =W1_DS2438_READ_SCRATCH ; - w1_buf[1 ] =0x00 ; + w1_buf[1 ] = (u8 )pageno;w1_write_block (sl->master, w1_buf,2 ); count =w1_read_block (sl->master, buf,DS2438_PAGE_SIZE +1 );
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 12/63 scsi: hisi_sas: Propagate errors in interrupt_init_v1_hw()
In reply to Sasha LevinFrom: Sergey Shtylyov <[email protected]>
[ Upstream commit ab17122e758ef68fb21033e25c041144067975f5 ]
After commit 6c11dc060427 ("scsi: hisi_sas: Fix IRQ checks") we have the error codes returned by platform_get_irq() ready for the propagation upsream in interrupt_init_v1_hw() -- that will fix still broken deferred probing. Let's propagate the error codes from devm_request_irq() as well since I don't see the reason to override them with -ENOENT...
--- drivers/scsi/hisi_sas/hisi_sas_v1_hw.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/scsi/hisi_sas/hisi_sas_v1_hw.c +6 -6
@@ -1648,7 +1648,7 @@ static int interrupt_init_v1_hw(struct hisi_hba *hisi_hba)if (irq <0 ) {dev_err (dev,"irq init: fail map phy interrupt %d\n" , idx); -return -ENOENT ; +return irq; } rc = devm_request_irq(dev, irq, phy_interrupts[j], 0,
@@ -1656,7 +1656,7 @@ static int interrupt_init_v1_hw(struct hisi_hba *hisi_hba)if (rc) {dev_err (dev,"irq init: could not request phy interrupt %d, rc=%d\n" , irq, rc); -return -ENOENT ; +return rc; } } }
@@ -1667,7 +1667,7 @@ static int interrupt_init_v1_hw(struct hisi_hba *hisi_hba)if (irq <0 ) {dev_err (dev,"irq init: could not map cq interrupt %d\n" , idx); -return -ENOENT ; +return irq; } rc = devm_request_irq(dev, irq, cq_interrupt_v1_hw, 0,
@@ -1675,7 +1675,7 @@ static int interrupt_init_v1_hw(struct hisi_hba *hisi_hba)if (rc) {dev_err (dev,"irq init: could not request cq interrupt %d, rc=%d\n" , irq, rc); -return -ENOENT ; +return rc; } }
@@ -1685,7 +1685,7 @@ static int interrupt_init_v1_hw(struct hisi_hba *hisi_hba)if (irq <0 ) {dev_err (dev,"irq init: could not map fatal interrupt %d\n" , idx); -return -ENOENT ; +return irq; } rc = devm_request_irq(dev, irq, fatal_interrupts[i], 0,
@@ -1693,7 +1693,7 @@ static int interrupt_init_v1_hw(struct hisi_hba *hisi_hba)if (rc) {dev_err (dev,"irq init: could not request fatal interrupt %d, rc=%d\n" , irq, rc); -return -ENOENT ; +return rc; } }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 13/63 scsi: lpfc: Fix "Unexpected timeout" error in direct attach topology
In reply to Sasha LevinFrom: James Smart <[email protected]>
[ Upstream commit e30d55137edef47434c40d7570276a0846fe922c ]
An 'unexpected timeout' message may be seen in a point-2-point topology. The message occurs when a PLOGI is received before the driver is notified of FLOGI completion. The FLOGI completion failure causes discovery to be triggered for a second time. The discovery timer is restarted but no new discovery activity is initiated, thus the timeout message eventually appears.
In point-2-point, when discovery has progressed before the FLOGI completion is processed, it is not a failure. Add code to FLOGI completion to detect that discovery has progressed and exit the FLOGI handling (noop'ing it).
--- drivers/scsi/lpfc/lpfc_els.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/scsi/lpfc/lpfc_els.c +9 -0
@@ -1179,6 +1179,15 @@ lpfc_cmpl_els_flogi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, phba->fcf.fcf_redisc_attempted =0 ;/* reset */ goto out; } + }else if (vport->port_state >LPFC_FLOGI && + vport->fc_flag &FC_PT2PT ) { +/* +* In a p2p topology, it is possible that discovery has +* already progressed, and this completion can be ignored. +* Recheck the indicated topology. +*/ +if (!sp->cmn.fPort) + goto out; } flogifail:
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 14/63 scsi: lpfc: Fix crash when lpfc_sli4_hba_setup() fails to initialize the SGLs
In reply to Sasha LevinFrom: James Smart <[email protected]>
[ Upstream commit 5aa615d195f1e142c662cb2253f057c9baec7531 ]
The driver is encountering a crash in lpfc_free_iocb_list() while performing initial attachment.
Code review found this to be an errant failure path that was taken, jumping to a tag that then referenced structures that were uninitialized.
Fix the failure path.
--- drivers/scsi/lpfc/lpfc_sli.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/scsi/lpfc/lpfc_sli.c +3 -2
@@ -7602,7 +7602,7 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba)"0393 Error %d during rpi post operation\n" , rc); rc = -ENODEV ; - goto out_destroy_queue; + goto out_free_iocblist; }lpfc_sli4_node_prep (phba);
@@ -7765,8 +7765,9 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba) out_unset_queue:/* Unset all the queues set up in this routine when error out */ lpfc_sli4_queue_unset (phba); -out_destroy_queue: +out_free_iocblist:lpfc_free_iocb_list (phba); +out_destroy_queue:lpfc_sli4_queue_destroy (phba); out_stop_timers:lpfc_stop_hba_timers (phba);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 15/63 scsi: core: Cap scsi_host cmd_per_lun at can_queue
In reply to Sasha LevinFrom: John Garry <[email protected]>
[ Upstream commit ea2f0f77538c50739b9fb4de4700cee5535e1f77 ]
The sysfs handling function sdev_store_queue_depth() enforces that the sdev queue depth cannot exceed shost can_queue. The initial sdev queue depth comes from shost cmd_per_lun. However, the LLDD may manually set cmd_per_lun to be larger than can_queue, which leads to an initial sdev queue depth greater than can_queue.
Such an issue was reported in [0], which caused a hang. That has since been fixed in commit fc09acb7de31 ("scsi: scsi_debug: Fix cmd_per_lun, set to max_queue").
Stop this possibly happening for other drivers by capping shost cmd_per_lun at shost can_queue.
[0] https://lore.kernel.org/linux-scsi/YHaez6iN2HHYxYOh@T590/
--- drivers/scsi/hosts.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/scsi/hosts.c +3 -0
@@ -219,6 +219,9 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev, goto fail; } + shost->cmd_per_lun =min_t (short, shost->cmd_per_lun, + shost->can_queue); + error =scsi_init_sense_cache (shost);if (error) goto fail;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 16/63 ALSA: ac97: fix PM reference leak in ac97_bus_remove()
In reply to Sasha LevinFrom: Yufen Yu <[email protected]>
[ Upstream commit a38e93302ee25b2ca6f4ee76c6c974cf3637985e ]
pm_runtime_get_sync will increment pm usage counter even it failed. Forgetting to putting operation will result in reference leak here. Fix it by replacing it with pm_runtime_resume_and_get to keep usage counter balanced.
--- sound/ac97/bus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/ac97/bus.c +1 -1
@@ -520,7 +520,7 @@ static int ac97_bus_remove(struct device *dev)struct ac97_codec_driver *adrv =to_ac97_driver (dev->driver);int ret; - ret =pm_runtime_get_sync (dev); + ret =pm_runtime_resume_and_get (dev);if (ret <0 )return ret;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 17/63 tty: serial: 8250: serial_cs: Fix a memory leak in error handling path
In reply to Sasha LevinFrom: Christophe JAILLET <[email protected]>
[ Upstream commit fad92b11047a748c996ebd6cfb164a63814eeb2e ]
In the probe function, if the final 'serial_config()' fails, 'info' is leaking.
Add a resource handling path to free this memory.
--- drivers/tty/serial/8250/serial_cs.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/tty/serial/8250/serial_cs.c +10 -1
@@ -306,6 +306,7 @@ static int serial_resume(struct pcmcia_device *link)static int serial_probe (struct pcmcia_device *link) {struct serial_info *info; +int ret;dev_dbg (&link->dev,"serial_attach()\n" );
@@ -320,7 +321,15 @@ static int serial_probe(struct pcmcia_device *link)if (do_sound) link->config_flags |=CONF_ENABLE_SPKR ; -return serial_config (link); + ret =serial_config (link); +if (ret) + goto free_info; + +return 0 ; + +free_info: +kfree (info); +return ret; }static void serial_detach (struct pcmcia_device *link)
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 18/63 scsi: scsi_dh_alua: Check for negative result value
In reply to Sasha LevinFrom: Hannes Reinecke <[email protected]>
[ Upstream commit 7e26e3ea028740f934477ec01ba586ab033c35aa ]
scsi_execute() will now return a negative error if there was an error prior to command submission; evaluate that instead if checking for DRIVER_ERROR.
[mkp: build fix]
--- drivers/scsi/device_handler/scsi_dh_alua.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/scsi/device_handler/scsi_dh_alua.c +4 -4
@@ -548,12 +548,12 @@ static int alua_rtpg(struct scsi_device *sdev, struct alua_port_group *pg)kfree (buff);return SCSI_DH_OK ; } -if (!scsi_sense_valid (&sense_hdr)) { +if (retval <0 || !scsi_sense_valid (&sense_hdr)) {sdev_printk (KERN_INFO , sdev,"%s: rtpg failed, result %d\n" ,ALUA_DH_NAME , retval);kfree (buff); -if (driver_byte (retval) ==DRIVER_ERROR ) +if (retval <0 )return SCSI_DH_DEV_TEMP_BUSY ;return SCSI_DH_IO ; }
@@ -775,11 +775,11 @@ static unsigned alua_stpg(struct scsi_device *sdev, struct alua_port_group *pg) retval =submit_stpg (sdev, pg->group_id, &sense_hdr);if (retval) { -if (!scsi_sense_valid (&sense_hdr)) { +if (retval <0 || !scsi_sense_valid (&sense_hdr)) {sdev_printk (KERN_INFO , sdev,"%s: stpg failed, result %d" ,ALUA_DH_NAME , retval); -if (driver_byte (retval) ==DRIVER_ERROR ) +if (retval <0 )return SCSI_DH_DEV_TEMP_BUSY ; }else { sdev_printk(KERN_INFO, sdev, "%s: stpg failed\n",
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 19/63 fs/jfs: Fix missing error code in lmLogInit()
In reply to Sasha LevinFrom: Jiapeng Chong <[email protected]>
[ Upstream commit 492109333c29e1bb16d8732e1d597b02e8e0bf2e ]
The error code is missing in this code scenario, add the error code '-EINVAL' to the return value 'rc.
Eliminate the follow smatch warning:
fs/jfs/jfs_logmgr.c:1327 lmLogInit() warn: missing error code 'rc'.
--- fs/jfs/jfs_logmgr.c | 1 + 1 file changed, 1 insertion(+)
fs/jfs/jfs_logmgr.c +1 -0
@@ -1324,6 +1324,7 @@ int lmLogInit(struct jfs_log * log) }else {if (!uuid_equal (&logsuper->uuid, &log->uuid)) {jfs_warn ("wrong uuid on JFS log device" ); + rc = -EINVAL ; goto errout20; } log->size =le32_to_cpu (logsuper->size);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 20/63 scsi: megaraid_sas: Fix resource leak in case of probe failure
In reply to Sasha LevinFrom: Chandrakanth Patil <[email protected]>
[ Upstream commit b5438f48fdd8e1c3f130d32637511efd32038152 ]
The driver doesn't clean up all the allocated resources properly when scsi_add_host(), megasas_start_aen() function fails during the PCI device probe.
Clean up all those resources.
--- drivers/scsi/megaraid/megaraid_sas_base.c | 13 +++++++++++++ drivers/scsi/megaraid/megaraid_sas_fusion.c | 1 + 2 files changed, 14 insertions(+)
drivers/scsi/megaraid/megaraid_sas_base.c +13 -0
@@ -7415,11 +7415,16 @@ static int megasas_probe_one(struct pci_dev *pdev,return 0 ; fail_start_aen: + instance->unload =1 ; +scsi_remove_host (instance->host); fail_io_attach: megasas_mgmt_info.count--; megasas_mgmt_info.max_index--; megasas_mgmt_info.instance[megasas_mgmt_info.max_index] =NULL ; +if (instance->requestorId && !instance->skip_heartbeat_timer_del) +del_timer_sync (&instance->sriov_heartbeat_timer); + instance->instancet->disable_intr (instance);megasas_destroy_irqs (instance);
@@ -7427,8 +7432,16 @@ static int megasas_probe_one(struct pci_dev *pdev,megasas_release_fusion (instance); elsemegasas_release_mfi (instance ); +if (instance->msix_vectors)pci_free_irq_vectors (instance->pdev); + instance->msix_vectors =0 ; + +if (instance->fw_crash_state !=UNAVAILABLE ) +megasas_free_host_crash_buffer (instance); + +if (instance->adapter_type !=MFI_SERIES ) +megasas_fusion_stop_watchdog (instance); fail_init_mfi:scsi_host_put (host); fail_alloc_instance:
drivers/scsi/megaraid/megaraid_sas_fusion.c +1 -0
@@ -5177,6 +5177,7 @@ megasas_alloc_fusion_context(struct megasas_instance *instance)if (!fusion->log_to_span) {dev_err (&instance->pdev->dev,"Failed from %s %d\n" , __func__, __LINE__); +kfree (instance->ctrl_context);return -ENOMEM ; } }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 21/63 scsi: megaraid_sas: Early detection of VD deletion through RaidMap update
In reply to Sasha LevinFrom: Kashyap Desai <[email protected]>
[ Upstream commit ae6874ba4b43c5a00065f48599811a09d33b873d ]
Consider the case where a VD is deleted and the targetID of that VD is assigned to a newly created VD. If the sequence of deletion/addition of VD happens very quickly there is a possibility that second event (VD add) occurs even before the driver processes the first event (VD delete). As event processing is done in deferred context the device list remains the same (but targetID is re-used) so driver will not learn the VD deletion/additon. I/Os meant for the older VD will be directed to new VD which may lead to data corruption.
Make driver detect the deleted VD as soon as possible based on the RaidMap update and block further I/O to that device.
--- drivers/scsi/megaraid/megaraid_sas.h | 12 ++++ drivers/scsi/megaraid/megaraid_sas_base.c | 83 ++++++++++++++++++++--- drivers/scsi/megaraid/megaraid_sas_fp.c | 6 +- 3 files changed, 92 insertions(+), 9 deletions(-)
drivers/scsi/megaraid/megaraid_sas.h +12 -0
@@ -2256,6 +2256,15 @@ enum MR_PERF_MODE { (mode) == MR_LATENCY_PERF_MODE ? "Latency" : \ "Unknown") +enum MEGASAS_LD_TARGET_ID_STATUS { +LD_TARGET_ID_INITIAL , +LD_TARGET_ID_ACTIVE , +LD_TARGET_ID_DELETED , +}; + +#define MEGASAS_TARGET_ID (sdev) \ + (((sdev->channel % 2) * MEGASAS_MAX_DEV_PER_CHANNEL) + sdev->id) +struct megasas_instance {unsigned int *reply_map;
@@ -2320,6 +2329,9 @@ struct megasas_instance {struct megasas_pd_list pd_list[MEGASAS_MAX_PD ];struct megasas_pd_list local_pd_list[MEGASAS_MAX_PD ];u8 ld_ids[MEGASAS_MAX_LD_IDS ]; +u8 ld_tgtid_status[MEGASAS_MAX_LD_IDS ]; +u8 ld_ids_prev[MEGASAS_MAX_LD_IDS ]; +u8 ld_ids_from_raidmap[MEGASAS_MAX_LD_IDS ];s8 init_id;u16 max_num_sge;
drivers/scsi/megaraid/megaraid_sas_base.c +75 -8
164 lines not on this page · raw message
drivers/scsi/megaraid/megaraid_sas_fp.c +5 -1
@@ -350,6 +350,10 @@ u8 MR_ValidateMapInfo(struct megasas_instance *instance, u64 map_id) num_lds =le16_to_cpu (drv_map->raidMap.ldCount); +memcpy (instance->ld_ids_prev, + instance->ld_ids_from_raidmap, +sizeof (instance->ld_ids_from_raidmap)); +memset (instance->ld_ids_from_raidmap,0xff ,MEGASAS_MAX_LD_IDS );/*Convert Raid capability values to CPU arch */ for (i =0 ; (num_lds >0 ) && (i <MAX_LOGICAL_DRIVES_EXT ); i++) { ld =MR_TargetIdToLdGet (i, drv_map);
@@ -360,7 +364,7 @@ u8 MR_ValidateMapInfo(struct megasas_instance *instance, u64 map_id) raid =MR_LdRaidGet (ld, drv_map);le32_to_cpus ((u32 *)&raid->capability); - + instance->ld_ids_from_raidmap[i] = i; num_lds--; }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 22/63 scsi: megaraid_sas: Handle missing interrupts while re-enabling IRQs
In reply to Sasha LevinFrom: Chandrakanth Patil <[email protected]>
[ Upstream commit 9bedd36e9146b34dda4d6994e3aa1d72bc6442c1 ]
While reenabling the IRQ after IRQ poll there may be a small window for the firmware to post the replies with interrupts raised. In that case the driver will not see the interrupts which leads to I/O timeout.
This issue only happens when there are many I/O completions on a single reply queue. This forces the driver to switch between the interrupt and IRQ context.
Make the driver process the reply queue one more time after enabling the IRQ.
--- drivers/scsi/megaraid/megaraid_sas_fusion.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/scsi/megaraid/megaraid_sas_fusion.c +7 -2
@@ -3716,6 +3716,7 @@ static void megasas_sync_irqs(unsigned long instance_addr)if (irq_ctx->irq_poll_scheduled) { irq_ctx->irq_poll_scheduled = false;enable_irq (irq_ctx->os_irq); +complete_cmd_fusion (instance, irq_ctx->MSIxIndex, irq_ctx); } } }
@@ -3747,6 +3748,7 @@ int megasas_irqpoll(struct irq_poll *irqpoll, int budget)irq_poll_complete (irqpoll); irq_ctx->irq_poll_scheduled = false;enable_irq (irq_ctx->os_irq); +complete_cmd_fusion (instance, irq_ctx->MSIxIndex, irq_ctx); }return num_entries;
@@ -3763,6 +3765,7 @@ megasas_complete_cmd_dpc_fusion(unsigned long instance_addr) {struct megasas_instance *instance = (struct megasas_instance *)instance_addr; +struct megasas_irq_context *irq_ctx =NULL ;u32 count, MSIxIndex; count = instance->msix_vectors >0 ? instance->msix_vectors :1 ;
@@ -3771,8 +3774,10 @@ megasas_complete_cmd_dpc_fusion(unsigned long instance_addr)if (atomic_read (&instance->adprecovery) ==MEGASAS_HW_CRITICAL_ERROR )return ; -for (MSIxIndex =0 ; MSIxIndex < count; MSIxIndex++) -complete_cmd_fusion (instance, MSIxIndex,NULL ); +for (MSIxIndex =0 ; MSIxIndex < count; MSIxIndex++) { + irq_ctx = &instance->irq_context[MSIxIndex]; +complete_cmd_fusion (instance, MSIxIndex, irq_ctx); + } }/**
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 23/63 scsi: iscsi: Add iscsi_cls_conn refcount helpers
In reply to Sasha LevinFrom: Mike Christie <[email protected]>
[ Upstream commit b1d19e8c92cfb0ded180ef3376c20e130414e067 ]
There are a couple places where we could free the iscsi_cls_conn while it's still in use. This adds some helpers to get/put a refcount on the struct and converts an exiting user. Subsequent commits will then use the helpers to fix 2 bugs in the eh code.
--- drivers/scsi/libiscsi.c | 7 ++----- drivers/scsi/scsi_transport_iscsi.c | 12 ++++++++++++ include/scsi/scsi_transport_iscsi.h | 2 ++ 3 files changed, 16 insertions(+), 5 deletions(-)
drivers/scsi/libiscsi.c +2 -5
@@ -1348,7 +1348,6 @@ void iscsi_session_failure(struct iscsi_session *session, enum iscsi_err err) {struct iscsi_conn *conn; -struct device *dev;spin_lock_bh (&session->frwd_lock); conn = session->leadconn;
@@ -1357,10 +1356,8 @@ void iscsi_session_failure(struct iscsi_session *session,return ; } - dev =get_device (&conn->cls_conn->dev); +iscsi_get_conn (conn->cls_conn);spin_unlock_bh (&session->frwd_lock); -if (!dev) -return ;/* * if the host is being removed bypass the connection * recovery initialization because we are going to kill
@@ -1370,7 +1367,7 @@ void iscsi_session_failure(struct iscsi_session *session,iscsi_conn_error_event (conn->cls_conn, err); elseiscsi_conn_failure (conn ,err ); -put_device (dev); +iscsi_put_conn (conn->cls_conn); }EXPORT_SYMBOL_GPL (iscsi_session_failure);
drivers/scsi/scsi_transport_iscsi.c +12 -0
@@ -2308,6 +2308,18 @@ int iscsi_destroy_conn(struct iscsi_cls_conn *conn) }EXPORT_SYMBOL_GPL (iscsi_destroy_conn); +void iscsi_put_conn (struct iscsi_cls_conn *conn) +{ +put_device (&conn->dev); +} +EXPORT_SYMBOL_GPL (iscsi_put_conn); + +void iscsi_get_conn (struct iscsi_cls_conn *conn) +{ +get_device (&conn->dev); +} +EXPORT_SYMBOL_GPL (iscsi_get_conn); +/* * iscsi interface functions */
include/scsi/scsi_transport_iscsi.h +2 -0
@@ -423,6 +423,8 @@ extern void iscsi_remove_session(struct iscsi_cls_session *session);extern void iscsi_free_session (struct iscsi_cls_session *session);extern struct iscsi_cls_conn *iscsi_create_conn (struct iscsi_cls_session *sess,int dd_size,uint32_t cid); +extern void iscsi_put_conn (struct iscsi_cls_conn *conn); +extern void iscsi_get_conn (struct iscsi_cls_conn *conn);extern int iscsi_destroy_conn (struct iscsi_cls_conn *conn);extern void iscsi_unblock_session (struct iscsi_cls_session *session);extern void iscsi_block_session (struct iscsi_cls_session *session);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 24/63 scsi: iscsi: Fix conn use after free during resets
In reply to Sasha LevinFrom: Mike Christie <[email protected]>
[ Upstream commit ec29d0ac29be366450a7faffbcf8cba3a6a3b506 ]
If we haven't done a unbind target call we can race where iscsi_conn_teardown wakes up the EH thread and then frees the conn while those threads are still accessing the conn ehwait.
We can only do one TMF per session so this just moves the TMF fields from the conn to the session. We can then rely on the iscsi_session_teardown->iscsi_remove_session->__iscsi_unbind_session call to remove the target and it's devices, and know after that point there is no device or scsi-ml callout trying to access the session.
--- drivers/scsi/libiscsi.c | 115 +++++++++++++++++++--------------------- include/scsi/libiscsi.h | 11 ++-- 2 files changed, 60 insertions(+), 66 deletions(-)
drivers/scsi/libiscsi.c +55 -60
@@ -230,11 +230,11 @@ static int iscsi_prep_ecdb_ahs(struct iscsi_task *task)*/ static int iscsi_check_tmf_restrictions (struct iscsi_task *task,int opcode) { -struct iscsi_conn *conn = task->conn; -struct iscsi_tm *tmf = &conn->tmhdr; +struct iscsi_session *session = task->conn->session; +struct iscsi_tm *tmf = &session->tmhdr;u64 hdr_lun; -if (conn->tmf_state ==TMF_INITIAL ) +if (session->tmf_state ==TMF_INITIAL )return 0 ;if ((tmf->opcode &ISCSI_OPCODE_MASK ) !=ISCSI_OP_SCSI_TMFUNC )
@@ -254,24 +254,19 @@ static int iscsi_check_tmf_restrictions(struct iscsi_task *task, int opcode)* Fail all SCSI cmd PDUs */ if (opcode !=ISCSI_OP_SCSI_DATA_OUT ) { -iscsi_conn_printk (KERN_INFO , conn, -"task [op %x itt " -"0x%x/0x%x] " -"rejected.\n" , - opcode, task->itt, - task->hdr_itt); +iscsi_session_printk (KERN_INFO , session, +"task [op %x itt 0x%x/0x%x] rejected.\n" , + opcode, task->itt, task->hdr_itt);return -EACCES ; }/* * And also all data-out PDUs in response to R2T * if fast_abort is set. */ -if (conn->session->fast_abort) { -iscsi_conn_printk (KERN_INFO , conn, -"task [op %x itt " -"0x%x/0x%x] fast abort.\n" , - opcode, task->itt, - task->hdr_itt); +if (session->fast_abort) { +iscsi_session_printk (KERN_INFO , session, +"task [op %x itt 0x%x/0x%x] fast abort.\n" , + opcode, task->itt, task->hdr_itt);return -EACCES ; }break ;
@@ -284,7 +279,7 @@ static int iscsi_check_tmf_restrictions(struct iscsi_task *task, int opcode)*/ if (opcode ==ISCSI_OP_SCSI_DATA_OUT && task->hdr_itt == tmf->rtt) { - ISCSI_DBG_SESSION(conn->session, + ISCSI_DBG_SESSION(session, "Preventing task %x/%x from sending " "data-out due to abort task in " "progress\n", task->itt,
@@ -923,20 +918,21 @@ iscsi_data_in_rsp(struct iscsi_conn *conn, struct iscsi_hdr *hdr,static void iscsi_tmf_rsp (struct iscsi_conn *conn,struct iscsi_hdr *hdr) {struct iscsi_tm_rsp *tmf = (struct iscsi_tm_rsp *)hdr; +struct iscsi_session *session = conn->session; conn->exp_statsn =be32_to_cpu (hdr->statsn) +1 ; conn->tmfrsp_pdus_cnt++; -if (conn->tmf_state !=TMF_QUEUED ) +if (session->tmf_state !=TMF_QUEUED )return ;if (tmf->response ==ISCSI_TMF_RSP_COMPLETE ) - conn->tmf_state =TMF_SUCCESS ; + session->tmf_state =TMF_SUCCESS ;else if (tmf->response ==ISCSI_TMF_RSP_NO_TASK ) - conn->tmf_state =TMF_NOT_FOUND ; + session->tmf_state =TMF_NOT_FOUND ;else - conn->tmf_state =TMF_FAILED ; -wake_up (&conn->ehwait); + session->tmf_state =TMF_FAILED ; +wake_up (&session->ehwait); }static int iscsi_send_nopout (struct iscsi_conn *conn,struct iscsi_nopin *rhdr)
@@ -1784,15 +1780,14 @@ EXPORT_SYMBOL_GPL(iscsi_target_alloc);static void iscsi_tmf_timedout (struct timer_list *t) { -struct iscsi_conn *conn =from_timer (conn, t, tmf_timer); -struct iscsi_session *session = conn->session; +struct iscsi_session *session =from_timer (session, t, tmf_timer);spin_lock (&session->frwd_lock); -if (conn->tmf_state ==TMF_QUEUED ) { - conn->tmf_state =TMF_TIMEDOUT ; +if (session->tmf_state ==TMF_QUEUED ) { + session->tmf_state =TMF_TIMEDOUT ;ISCSI_DBG_EH (session,"tmf timedout\n" );/* unblock eh_abort() */ -wake_up (&conn->ehwait); +wake_up (&session->ehwait); }spin_unlock (&session->frwd_lock); }
@@ -1815,8 +1810,8 @@ static int iscsi_exec_task_mgmt_fn(struct iscsi_conn *conn,return -EPERM ; } conn->tmfcmd_pdus_cnt++; - conn->tmf_timer.expires = timeout *HZ + jiffies; -add_timer (&conn->tmf_timer); + session->tmf_timer.expires = timeout *HZ + jiffies; +add_timer (&session->tmf_timer);ISCSI_DBG_EH (session,"tmf set timeout\n" );spin_unlock_bh (&session->frwd_lock);
@@ -1830,12 +1825,12 @@ static int iscsi_exec_task_mgmt_fn(struct iscsi_conn *conn,* 3) session is terminated or restarted or userspace has * given up on recovery */ -wait_event_interruptible (conn->ehwait, age != session->age || +wait_event_interruptible (session->ehwait, age != session->age || session->state !=ISCSI_STATE_LOGGED_IN || - conn->tmf_state !=TMF_QUEUED ); + session->tmf_state !=TMF_QUEUED );if (signal_pending (current))flush_signals (current); -del_timer_sync (&conn->tmf_timer); +del_timer_sync (&session->tmf_timer);mutex_lock (&session->eh_mutex);spin_lock_bh (&session->frwd_lock);
@@ -2195,17 +2190,17 @@ int iscsi_eh_abort(struct scsi_cmnd *sc) }/* only have one tmf outstanding at a time */ -if (conn->tmf_state !=TMF_INITIAL ) +if (session->tmf_state !=TMF_INITIAL ) goto failed; - conn->tmf_state =TMF_QUEUED ; + session->tmf_state =TMF_QUEUED ; - hdr = &conn->tmhdr; + hdr = &session->tmhdr;iscsi_prep_abort_task_pdu (task, hdr);if (iscsi_exec_task_mgmt_fn (conn, hdr, age, session->abort_timeout)) goto failed; -switch (conn->tmf_state) { +switch (session->tmf_state) {case TMF_SUCCESS :spin_unlock_bh (&session->frwd_lock);/*
@@ -2220,7 +2215,7 @@ int iscsi_eh_abort(struct scsi_cmnd *sc)*/ spin_lock_bh (&session->frwd_lock);fail_scsi_task (task,DID_ABORT ); - conn->tmf_state =TMF_INITIAL ; + session->tmf_state =TMF_INITIAL ;memset (hdr,0 ,sizeof (*hdr));spin_unlock_bh (&session->frwd_lock);iscsi_start_tx (conn);
@@ -2231,7 +2226,7 @@ int iscsi_eh_abort(struct scsi_cmnd *sc) goto failed_unlocked;case TMF_NOT_FOUND :if (!sc->SCp.ptr) { - conn->tmf_state =TMF_INITIAL ; + session->tmf_state =TMF_INITIAL ;memset (hdr,0 ,sizeof (*hdr));/* task completed before tmf abort response */ ISCSI_DBG_EH(session, "sc completed while abort in "
@@ -2240,7 +2235,7 @@ int iscsi_eh_abort(struct scsi_cmnd *sc) }/* fall through */ default : - conn->tmf_state =TMF_INITIAL ; + session->tmf_state =TMF_INITIAL ; goto failed; }
@@ -2297,11 +2292,11 @@ int iscsi_eh_device_reset(struct scsi_cmnd *sc) conn = session->leadconn;/* only have one tmf outstanding at a time */ -if (conn->tmf_state !=TMF_INITIAL ) +if (session->tmf_state !=TMF_INITIAL ) goto unlock; - conn->tmf_state =TMF_QUEUED ; + session->tmf_state =TMF_QUEUED ; - hdr = &conn->tmhdr; + hdr = &session->tmhdr;iscsi_prep_lun_reset_pdu (sc, hdr); if (iscsi_exec_task_mgmt_fn(conn, hdr, session->age,
@@ -2310,7 +2305,7 @@ int iscsi_eh_device_reset(struct scsi_cmnd *sc) goto unlock; } -switch (conn->tmf_state) { +switch (session->tmf_state) {case TMF_SUCCESS :break ;case TMF_TIMEDOUT :
@@ -2318,7 +2313,7 @@ int iscsi_eh_device_reset(struct scsi_cmnd *sc)iscsi_conn_failure (conn,ISCSI_ERR_SCSI_EH_SESSION_RST ); goto done;default : - conn->tmf_state =TMF_INITIAL ; + session->tmf_state =TMF_INITIAL ; goto unlock; }
@@ -2330,7 +2325,7 @@ int iscsi_eh_device_reset(struct scsi_cmnd *sc)spin_lock_bh (&session->frwd_lock);memset (hdr,0 ,sizeof (*hdr));fail_scsi_tasks (conn, sc->device->lun,DID_ERROR ); - conn->tmf_state =TMF_INITIAL ; + session->tmf_state =TMF_INITIAL ;spin_unlock_bh (&session->frwd_lock);iscsi_start_tx (conn);
@@ -2353,8 +2348,7 @@ void iscsi_session_recovery_timedout(struct iscsi_cls_session *cls_session)spin_lock_bh (&session->frwd_lock);if (session->state !=ISCSI_STATE_LOGGED_IN ) { session->state =ISCSI_STATE_RECOVERY_FAILED ; -if (session->leadconn) -wake_up (&session->leadconn->ehwait); +wake_up (&session->ehwait); }spin_unlock_bh (&session->frwd_lock); }
@@ -2399,7 +2393,7 @@ int iscsi_eh_session_reset(struct scsi_cmnd *sc)iscsi_conn_failure (conn,ISCSI_ERR_SCSI_EH_SESSION_RST );ISCSI_DBG_EH (session,"wait for relogin\n" ); -wait_event_interruptible (conn->ehwait, +wait_event_interruptible (session->ehwait, session->state ==ISCSI_STATE_TERMINATE || session->state ==ISCSI_STATE_LOGGED_IN || session->state ==ISCSI_STATE_RECOVERY_FAILED );
@@ -2460,11 +2454,11 @@ static int iscsi_eh_target_reset(struct scsi_cmnd *sc) conn = session->leadconn;/* only have one tmf outstanding at a time */ -if (conn->tmf_state !=TMF_INITIAL ) +if (session->tmf_state !=TMF_INITIAL ) goto unlock; - conn->tmf_state =TMF_QUEUED ; + session->tmf_state =TMF_QUEUED ; - hdr = &conn->tmhdr; + hdr = &session->tmhdr;iscsi_prep_tgt_reset_pdu (sc, hdr); if (iscsi_exec_task_mgmt_fn(conn, hdr, session->age,
@@ -2473,7 +2467,7 @@ static int iscsi_eh_target_reset(struct scsi_cmnd *sc) goto unlock; } -switch (conn->tmf_state) { +switch (session->tmf_state) {case TMF_SUCCESS :break ;case TMF_TIMEDOUT :
@@ -2481,7 +2475,7 @@ static int iscsi_eh_target_reset(struct scsi_cmnd *sc)iscsi_conn_failure (conn,ISCSI_ERR_SCSI_EH_SESSION_RST ); goto done;default : - conn->tmf_state =TMF_INITIAL ; + session->tmf_state =TMF_INITIAL ; goto unlock; }
@@ -2493,7 +2487,7 @@ static int iscsi_eh_target_reset(struct scsi_cmnd *sc)spin_lock_bh (&session->frwd_lock);memset (hdr,0 ,sizeof (*hdr));fail_scsi_tasks (conn,-1 ,DID_ERROR ); - conn->tmf_state =TMF_INITIAL ; + session->tmf_state =TMF_INITIAL ;spin_unlock_bh (&session->frwd_lock);iscsi_start_tx (conn);
@@ -2798,7 +2792,10 @@ iscsi_session_setup(struct iscsi_transport *iscsit, struct Scsi_Host *shost, session->tt = iscsit; session->dd_data = cls_session->dd_data +sizeof (*session); + session->tmf_state =TMF_INITIAL ; +timer_setup (&session->tmf_timer, iscsi_tmf_timedout,0 );mutex_init (&session->eh_mutex); +spin_lock_init (&session->frwd_lock);spin_lock_init (&session->back_lock);
@@ -2902,7 +2899,6 @@ iscsi_conn_setup(struct iscsi_cls_session *cls_session, int dd_size, conn->c_stage =ISCSI_CONN_INITIAL_STAGE ; conn->id = conn_idx; conn->exp_statsn =0 ; - conn->tmf_state =TMF_INITIAL ;timer_setup (&conn->transport_timer, iscsi_check_transport_timeouts,0 );
@@ -2928,8 +2924,7 @@ iscsi_conn_setup(struct iscsi_cls_session *cls_session, int dd_size, goto login_task_data_alloc_fail; conn->login_task->data = conn->data = data; -timer_setup (&conn->tmf_timer, iscsi_tmf_timedout,0 ); -init_waitqueue_head (&conn->ehwait); +init_waitqueue_head (&session->ehwait);return cls_conn;
@@ -2964,7 +2959,7 @@ void iscsi_conn_teardown(struct iscsi_cls_conn *cls_conn)* leading connection? then give up on recovery. */ session->state =ISCSI_STATE_TERMINATE ; -wake_up (&conn->ehwait); +wake_up (&session->ehwait); }spin_unlock_bh (&session->frwd_lock);
@@ -3039,7 +3034,7 @@ int iscsi_conn_start(struct iscsi_cls_conn *cls_conn)* commands after successful recovery */ conn->stop_stage =0 ; - conn->tmf_state =TMF_INITIAL ; + session->tmf_state =TMF_INITIAL ; session->age++;if (session->age ==16 ) session->age =0 ;
@@ -3053,7 +3048,7 @@ int iscsi_conn_start(struct iscsi_cls_conn *cls_conn)spin_unlock_bh (&session->frwd_lock);iscsi_unblock_session (session->cls_session); -wake_up (&conn->ehwait); +wake_up (&session->ehwait);return 0 ; }EXPORT_SYMBOL_GPL (iscsi_conn_start);
@@ -3140,7 +3135,7 @@ static void iscsi_start_session_recovery(struct iscsi_session *session,spin_lock_bh (&session->frwd_lock);fail_scsi_tasks (conn,-1 ,DID_TRANSPORT_DISRUPTED );fail_mgmt_tasks (session, conn); -memset (&conn->tmhdr,0 ,sizeof (conn->tmhdr)); +memset (&session->tmhdr,0 ,sizeof (session->tmhdr));spin_unlock_bh (&session->frwd_lock);mutex_unlock (&session->eh_mutex); }
include/scsi/libiscsi.h +5 -6
@@ -195,12 +195,6 @@ struct iscsi_conn {unsigned long suspend_tx;/* suspend Tx */ unsigned long suspend_rx;/* suspend Rx */ -/* abort */ -wait_queue_head_t ehwait;/* used in eh_abort() */ -struct iscsi_tm tmhdr; -struct timer_list tmf_timer; -int tmf_state;/* see TMF_INITIAL, etc.*/ -/* negotiated params */ unsigned max_recv_dlength;/* initiator_max_recv_dsl*/ unsigned max_xmit_dlength;/* target_max_recv_dsl */
@@ -270,6 +264,11 @@ struct iscsi_session {* and recv lock. */ struct mutex eh_mutex; +/* abort */ +wait_queue_head_t ehwait;/* used in eh_abort() */ +struct iscsi_tm tmhdr; +struct timer_list tmf_timer; +int tmf_state;/* see TMF_INITIAL, etc.*/ /* iSCSI session-wide sequencing */ uint32_t cmdsn;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 25/63 scsi: iscsi: Fix shost->max_id use
In reply to Sasha LevinFrom: Mike Christie <[email protected]>
[ Upstream commit bdd4aad7ff92ae39c2e93c415bb6761cb8b584da ]
The iscsi offload drivers are setting the shost->max_id to the max number of sessions they support. The problem is that max_id is not the max number of targets but the highest identifier the targets can have. To use it to limit the number of targets we need to set it to max sessions - 1, or we can end up with a session we might not have preallocated resources for.
--- drivers/scsi/be2iscsi/be_main.c | 4 ++-- drivers/scsi/bnx2i/bnx2i_iscsi.c | 2 +- drivers/scsi/cxgbi/libcxgbi.c | 4 ++-- drivers/scsi/qedi/qedi_main.c | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-)
drivers/scsi/be2iscsi/be_main.c +2 -2
@@ -416,7 +416,7 @@ static struct beiscsi_hba *beiscsi_hba_alloc(struct pci_dev *pcidev) "beiscsi_hba_alloc - iscsi_host_alloc failed\n");return NULL ; } - shost->max_id =BE2_MAX_SESSIONS ; + shost->max_id =BE2_MAX_SESSIONS -1 ; shost->max_channel =0 ; shost->max_cmd_len =BEISCSI_MAX_CMD_LEN ; shost->max_lun =BEISCSI_NUM_MAX_LUN ;
@@ -5318,7 +5318,7 @@ static int beiscsi_enable_port(struct beiscsi_hba *phba)/* Re-enable UER. If different TPE occurs then it is recoverable. */ beiscsi_set_uer_feature (phba); - phba->shost->max_id = phba->params.cxns_per_ctrl; + phba->shost->max_id = phba->params.cxns_per_ctrl -1 ; phba->shost->can_queue = phba->params.ios_per_ctrl; ret =beiscsi_init_port (phba);if (ret <0 ) {
drivers/scsi/bnx2i/bnx2i_iscsi.c +1 -1
@@ -793,7 +793,7 @@ struct bnx2i_hba *bnx2i_alloc_hba(struct cnic_dev *cnic)return NULL ; shost->dma_boundary = cnic->pcidev->dma_mask; shost->transportt = bnx2i_scsi_xport_template; - shost->max_id =ISCSI_MAX_CONNS_PER_HBA ; + shost->max_id =ISCSI_MAX_CONNS_PER_HBA -1 ; shost->max_channel =0 ; shost->max_lun =512 ; shost->max_cmd_len =16 ;
drivers/scsi/cxgbi/libcxgbi.c +2 -2
@@ -337,7 +337,7 @@ void cxgbi_hbas_remove(struct cxgbi_device *cdev)EXPORT_SYMBOL_GPL (cxgbi_hbas_remove);int cxgbi_hbas_add (struct cxgbi_device *cdev,u64 max_lun, -unsigned int max_id,struct scsi_host_template *sht, +unsigned int max_conns,struct scsi_host_template *sht,struct scsi_transport_template *stt) {struct cxgbi_hba *chba;
@@ -357,7 +357,7 @@ int cxgbi_hbas_add(struct cxgbi_device *cdev, u64 max_lun, shost->transportt = stt; shost->max_lun = max_lun; - shost->max_id = max_id; + shost->max_id = max_conns -1 ; shost->max_channel =0 ; shost->max_cmd_len =16 ;
drivers/scsi/qedi/qedi_main.c +1 -1
@@ -631,7 +631,7 @@ static struct qedi_ctx *qedi_host_alloc(struct pci_dev *pdev) goto exit_setup_shost; } - shost->max_id =QEDI_MAX_ISCSI_CONNS_PER_HBA ; + shost->max_id =QEDI_MAX_ISCSI_CONNS_PER_HBA -1 ; shost->max_channel =0 ; shost->max_lun = ~0 ; shost->max_cmd_len =16 ;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 26/63 scsi: qedi: Fix null ref during abort handling
In reply to Sasha LevinFrom: Mike Christie <[email protected]>
[ Upstream commit 5777b7f0f03ce49372203b6521631f62f2810c8f ]
If qedi_process_cmd_cleanup_resp finds the cmd it frees the work and sets list_tmf_work to NULL, so qedi_tmf_work should check if list_tmf_work is non-NULL when it wants to force cleanup.
--- drivers/scsi/qedi/qedi_fw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/qedi/qedi_fw.c +1 -1
@@ -1451,7 +1451,7 @@ static void qedi_tmf_work(struct work_struct *work) ldel_exit:spin_lock_bh (&qedi_conn->tmf_work_lock); -if (!qedi_cmd->list_tmf_work) { +if (qedi_cmd->list_tmf_work) {list_del_init (&list_work->list); qedi_cmd->list_tmf_work =NULL ;kfree (list_work);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 27/63 mfd: da9052/stmpe: Add and modify MODULE_DEVICE_TABLE
In reply to Sasha LevinFrom: Zou Wei <[email protected]>
[ Upstream commit 4700ef326556ed74aba188f12396740a8c1c21dd ]
This patch adds/modifies MODULE_DEVICE_TABLE definition which generates correct modalias for automatic loading of this driver when it is built as an external module.
--- drivers/mfd/da9052-i2c.c | 1 + drivers/mfd/stmpe-i2c.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/mfd/da9052-i2c.c +1 -0
@@ -113,6 +113,7 @@ static const struct i2c_device_id da9052_i2c_id[] = { {"da9053-bc", DA9053_BC}, {} }; +MODULE_DEVICE_TABLE (i2c, da9052_i2c_id);#ifdef CONFIG_OF static const struct of_device_id dialog_dt_ids[] = {
drivers/mfd/stmpe-i2c.c +1 -1
@@ -109,7 +109,7 @@ static const struct i2c_device_id stmpe_i2c_id[] = { { "stmpe2403", STMPE2403 }, { } }; -MODULE_DEVICE_TABLE(i2c, stmpe_id); +MODULE_DEVICE_TABLE(i2c, stmpe_i2c_id); static struct i2c_driver stmpe_i2c_driver = { .driver = {
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 28/63 mfd: cpcap: Fix cpcap dmamask not set warnings
In reply to Sasha LevinFrom: Tony Lindgren <[email protected]>
[ Upstream commit 0b7cbe811ca524295ea43d9a4d73d3427e419c54 ]
We have started to get a bunch of pointless dmamask not set warnings that makes the output of dmesg -l err,warn hard to read with many extra warnings:
cpcap-regulator cpcap-regulator.0: DMA mask not set cpcap_adc cpcap_adc.0: DMA mask not set cpcap_battery cpcap_battery.0: DMA mask not set cpcap-charger cpcap-charger.0: DMA mask not set cpcap-pwrbutton cpcap-pwrbutton.0: DMA mask not set cpcap-led cpcap-led.0: DMA mask not set cpcap-led cpcap-led.1: DMA mask not set cpcap-led cpcap-led.2: DMA mask not set cpcap-led cpcap-led.3: DMA mask not set cpcap-led cpcap-led.4: DMA mask not set cpcap-rtc cpcap-rtc.0: DMA mask not set cpcap-usb-phy cpcap-usb-phy.0: DMA mask not set
This seems to have started with commit 4d8bde883bfb ("OF: Don't set default coherent DMA mask"). We have the parent SPI controller use DMA, while CPCAP driver and it's children do not. For audio, the DMA is handled over I2S bus with the McBSP driver.
--- drivers/mfd/motorola-cpcap.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/mfd/motorola-cpcap.c +4 -0
@@ -305,6 +305,10 @@ static int cpcap_probe(struct spi_device *spi)if (ret)return ret; +/* Parent SPI controller uses DMA, CPCAP and child devices do not */ + spi->dev.coherent_dma_mask =0 ; + spi->dev.dma_mask = &spi->dev.coherent_dma_mask; +return devm_mfd_add_devices (&spi->dev,0 , cpcap_mfd_devices,ARRAY_SIZE (cpcap_mfd_devices),NULL ,0 ,NULL ); }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 29/63 ASoC: img: Fix PM reference leak in img_i2s_in_probe()
In reply to Sasha LevinFrom: Yufen Yu <[email protected]>
[ Upstream commit 81aad47278539f02de808bcc8251fed0ad3d6f55 ]
pm_runtime_get_sync will increment pm usage counter even it failed. Forgetting to putting operation will result in reference leak here. Fix it by replacing it with pm_runtime_resume_and_get to keep usage counter balanced.
--- sound/soc/img/img-i2s-in.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/img/img-i2s-in.c +1 -1
@@ -464,7 +464,7 @@ static int img_i2s_in_probe(struct platform_device *pdev)if (ret) goto err_pm_disable; } - ret =pm_runtime_get_sync (&pdev->dev); + ret =pm_runtime_resume_and_get (&pdev->dev);if (ret <0 ) goto err_suspend;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 30/63 serial: tty: uartlite: fix console setup
In reply to Sasha LevinFrom: Daniel Mack <[email protected]>
[ Upstream commit d157fca711ad42e75efef3444c83d2e1a17be27a ]
Remove the hack to assign the global console_port variable at probe time. This assumption that cons->index is -1 is wrong for systems that specify 'console=' in the cmdline (or 'stdout-path' in dts). Hence, on such system the actual console assignment is ignored, and the first UART that happens to be probed is used as console instead.
Move the logic to console_setup() and map the console to the correct port through the array of available ports instead.
--- drivers/tty/serial/uartlite.c | 27 ++++++--------------------- 1 file changed, 6 insertions(+), 21 deletions(-)
drivers/tty/serial/uartlite.c +6 -21
@@ -508,21 +508,23 @@ static void ulite_console_write(struct console *co, const char *s,static int ulite_console_setup (struct console *co,char *options) { -struct uart_port *port; +struct uart_port *port =NULL ;int baud =9600 ;int bits =8 ;int parity ='n' ;int flow ='n' ; - - port = console_port; +if (co->index >=0 && co->index <ULITE_NR_UARTS ) + port = ulite_ports + co->index;/* Has the device been initialized yet? */ -if (!port->mapbase) { +if (!port || !port->mapbase) {pr_debug ("console on ttyUL%i not present\n" , co->index);return -ENODEV ; } + console_port = port; +/* not initialized yet? */ if (!port->membase) {if (ulite_request_port (port))
@@ -658,17 +660,6 @@ static int ulite_assign(struct device *dev, int id, u32 base, int irq,dev_set_drvdata (dev, port); -#ifdef CONFIG_SERIAL_UARTLITE_CONSOLE -/* -* If console hasn't been found yet try to assign this port -* because it is required to be assigned for console setup function. -* If register_console() don't assign value, then console_port pointer -* is cleanup. -*/ -if (ulite_uart_driver.cons->index ==-1 ) - console_port = port; -#endif -/* Register the port */ rc =uart_add_one_port (&ulite_uart_driver, port);if (rc) {
@@ -678,12 +669,6 @@ static int ulite_assign(struct device *dev, int id, u32 base, int irq,return rc; } -#ifdef CONFIG_SERIAL_UARTLITE_CONSOLE -/* This is not port which is used for console that's why clean it up */ -if (ulite_uart_driver.cons->index ==-1 ) - console_port =NULL ; -#endif -return 0 ; }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 31/63 s390/sclp_vt220: fix console name to match device
In reply to Sasha LevinFrom: Valentin Vidic <[email protected]>
[ Upstream commit b7d91d230a119fdcc334d10c9889ce9c5e15118b ]
Console name reported in /proc/consoles:
ttyS1 -W- (EC p ) 4:65
does not match the char device name:
crw--w---- 1 root root 4, 65 May 17 12:18 /dev/ttysclp0
so debian-installer inside a QEMU s390x instance gets confused and fails to start with the following error:
steal-ctty: No such file or directory
--- arch/s390/kernel/setup.c | 2 +- drivers/s390/char/sclp_vt220.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
arch/s390/kernel/setup.c +1 -1
@@ -162,7 +162,7 @@ static void __init set_preferred_console(void)else if (CONSOLE_IS_3270 )add_preferred_console ("tty3270" ,0 ,NULL );else if (CONSOLE_IS_VT220 ) -add_preferred_console ("ttyS" ,1 ,NULL ); +add_preferred_console ("ttysclp" ,0 ,NULL );else if (CONSOLE_IS_HVC )add_preferred_console ("hvc" ,0 ,NULL ); }
drivers/s390/char/sclp_vt220.c +2 -2
@@ -35,8 +35,8 @@#define SCLP_VT220_MINOR 65#define SCLP_VT220_DRIVER_NAME "sclp_vt220"#define SCLP_VT220_DEVICE_NAME "ttysclp" -#define SCLP_VT220_CONSOLE_NAME "ttyS" -#define SCLP_VT220_CONSOLE_INDEX 1/* console=ttyS1 */ +#define SCLP_VT220_CONSOLE_NAME "ttysclp" +#define SCLP_VT220_CONSOLE_INDEX 0/* console=ttysclp0 */ /* Representation of a single write request */ struct sclp_vt220_request {
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 32/63 selftests: timers: rtcpie: skip test if default RTC device does not exist
In reply to Sasha LevinFrom: Po-Hsu Lin <[email protected]>
[ Upstream commit 0d3e5a057992bdc66e4dca2ca50b77fa4a7bd90e ]
This test will require /dev/rtc0, the default RTC device, or one specified by user to run. Since this default RTC is not guaranteed to exist on all of the devices, so check its existence first, otherwise skip this test with the kselftest skip code 4.
Without this patch this test will fail like this on a s390x zVM:
$ selftests: timers: rtcpie $ /dev/rtc0: No such file or directory not ok 1 selftests: timers: rtcpie # exit=22
With this patch:
$ selftests: timers: rtcpie $ Default RTC /dev/rtc0 does not exist. Test Skipped! not ok 9 selftests: timers: rtcpie # SKIP
Fixed up change log so "With this patch" text doesn't get dropped. Shuah Khan <[email protected]>
--- tools/testing/selftests/timers/rtcpie.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
tools/testing/selftests/timers/rtcpie.c +9 -1
@@ -18,6 +18,8 @@#include <stdlib.h> #include <errno.h> +#include "../kselftest.h" +/* * This expects the new RTC class driver framework, working with * clocks that will often not be clones of what the PC-AT had.
@@ -35,8 +37,14 @@ int main(int argc, char **argv)switch (argc) {case 2 : rtc = argv[1 ]; -/* FALLTHROUGH */ +break ;case 1 : + fd =open (default_rtc,O_RDONLY ); +if (fd ==-1 ) { +printf ("Default RTC %s does not exist. Test Skipped!\n" , default_rtc); +exit (KSFT_SKIP ); + } +close (fd);break ;default :fprintf (stderr,"usage: rtctest [rtcdev] [d]\n" );
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 33/63 USB: core: Avoid WARNings for 0-length descriptor requests
In reply to Sasha LevinFrom: Alan Stern <[email protected]>
[ Upstream commit 60dfe484cef45293e631b3a6e8995f1689818172 ]
The USB core has utility routines to retrieve various types of descriptors. These routines will now provoke a WARN if they are asked to retrieve 0 bytes (USB "receive" requests must not have zero length), so avert this by checking the size argument at the start.
--- drivers/usb/core/message.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/usb/core/message.c +6 -0
@@ -647,6 +647,9 @@ int usb_get_descriptor(struct usb_device *dev, unsigned char type,int i;int result; +if (size <=0 )/* No point in asking for no data */ +return -EINVAL ; +memset (buf,0 , size);/* Make sure we parse really received data */ for (i =0 ; i <3 ; ++i) {
@@ -695,6 +698,9 @@ static int usb_get_string(struct usb_device *dev, unsigned short langid,int i;int result; +if (size <=0 )/* No point in asking for no data */ +return -EINVAL ; +for (i =0 ; i <3 ; ++i) {/* retry on length 0 or stall; some devices are flakey */ result = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 34/63 ALSA: sb: Fix potential double-free of CSP mixer elements
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
[ Upstream commit c305366a37441c2ac90b08711cb6f032b43672f2 ]
snd_sb_qsound_destroy() contains the calls of removing the previously created mixer controls, but it doesn't clear the pointers. As snd_sb_qsound_destroy() itself may be repeatedly called via ioctl, this could lead to double-free potentially.
Fix it by clearing the struct fields properly afterwards.
--- sound/isa/sb/sb16_csp.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
sound/isa/sb/sb16_csp.c +6 -2
@@ -1072,10 +1072,14 @@ static void snd_sb_qsound_destroy(struct snd_sb_csp * p) card = p->chip->card;down_write (&card->controls_rwsem); -if (p->qsound_switch) +if (p->qsound_switch) {snd_ctl_remove (card, p->qsound_switch); -if (p->qsound_space) + p->qsound_switch =NULL ; + } +if (p->qsound_space) {snd_ctl_remove (card, p->qsound_space); + p->qsound_space =NULL ; + }up_write (&card->controls_rwsem);/* cancel pending transfer of QSound parameters */
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 35/63 powerpc/ps3: Add dma_mask to ps3_dma_region
In reply to Sasha LevinFrom: Geoff Levand <[email protected]>
[ Upstream commit 9733862e50fdba55e7f1554e4286fcc5302ff28e ]
Commit f959dcd6ddfd29235030e8026471ac1b022ad2b0 (dma-direct: Fix potential NULL pointer dereference) added a null check on the dma_mask pointer of the kernel's device structure.
Add a dma_mask variable to the ps3_dma_region structure and set the device structure's dma_mask pointer to point to this new variable.
Fixes runtime errors like these:
# WARNING: Fixes tag on line 10 doesn't match correct format # WARNING: Fixes tag on line 10 doesn't match correct format
ps3_system_bus_match:349: dev=8.0(sb_01), drv=8.0(ps3flash): match
WARNING: CPU: 0 PID: 1 at kernel/dma/mapping.c:151 .dma_map_page_attrs+0x34/0x1e0 ps3flash sb_01: ps3stor_setup:193: map DMA region failed
--- arch/powerpc/include/asm/ps3.h | 2 ++ arch/powerpc/platforms/ps3/mm.c | 12 ++++++++++++ 2 files changed, 14 insertions(+)
arch/powerpc/include/asm/ps3.h +2 -0
@@ -71,6 +71,7 @@ struct ps3_dma_region_ops;* @bus_addr: The 'translated' bus address of the region. * @len: The length in bytes of the region. * @offset: The offset from the start of memory of the region. +* @dma_mask: Device dma_mask. * @ioid: The IOID of the device who owns this region * @chunk_list: Opaque variable used by the ioc page manager. * @region_ops: struct ps3_dma_region_ops - dma region operations
@@ -85,6 +86,7 @@ struct ps3_dma_region {enum ps3_dma_region_type region_type;unsigned long len;unsigned long offset; +u64 dma_mask;/* driver variables (set by ps3_dma_region_create) */ unsigned long bus_addr;
arch/powerpc/platforms/ps3/mm.c +12 -0
@@ -6,6 +6,7 @@* Copyright 2006 Sony Corp. */ +#include <linux/dma-mapping.h> #include <linux/kernel.h> #include <linux/export.h> #include <linux/memblock.h>
@@ -1118,6 +1119,7 @@ int ps3_dma_region_init(struct ps3_system_bus_device *dev, enum ps3_dma_region_type region_type, void *addr, unsigned long len) { unsigned long lpar_addr; +int result; lpar_addr = addr ?ps3_mm_phys_to_lpar (__pa (addr)) :0 ;
@@ -1129,6 +1131,16 @@ int ps3_dma_region_init(struct ps3_system_bus_device *dev, r->offset -= map.r1.offset; r->len = len ? len :_ALIGN_UP (map.total,1 << r->page_size); + dev->core.dma_mask = &r->dma_mask; + + result =dma_set_mask_and_coherent (&dev->core,DMA_BIT_MASK (32 )); + +if (result <0 ) { +dev_err (&dev->core,"%s:%d: dma_set_mask_and_coherent failed: %d\n" , + __func__, __LINE__, result); +return result; + } +switch (dev->dev_type) {case PS3_DEVICE_TYPE_SB : r->region_ops = (USE_DYNAMIC_DMA )
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 36/63 iommu/arm-smmu: Fix arm_smmu_device refcount leak when arm_smmu_rpm_get fails
In reply to Sasha LevinFrom: Xiyu Yang <[email protected]>
[ Upstream commit 1adf30f198c26539a62d761e45af72cde570413d ]
arm_smmu_rpm_get() invokes pm_runtime_get_sync(), which increases the refcount of the "smmu" even though the return value is less than 0.
The reference counting issue happens in some error handling paths of arm_smmu_rpm_get() in its caller functions. When arm_smmu_rpm_get() fails, the caller functions forget to decrease the refcount of "smmu" increased by arm_smmu_rpm_get(), causing a refcount leak.
Fix this issue by calling pm_runtime_resume_and_get() instead of pm_runtime_get_sync() in arm_smmu_rpm_get(), which can keep the refcount balanced in case of failure.
--- drivers/iommu/arm-smmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/arm-smmu.c +1 -1
@@ -114,7 +114,7 @@ static bool using_legacy_binding, using_generic_binding;static inline int arm_smmu_rpm_get (struct arm_smmu_device *smmu) {if (pm_runtime_enabled (smmu->dev)) -return pm_runtime_get_sync (smmu->dev); +return pm_runtime_resume_and_get (smmu->dev);return 0 ; }
Signature · 6 lines
2.30.2 _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
Sasha Levin
maintainerPATCH 37/63 iommu/arm-smmu: Fix arm_smmu_device refcount leak in address translation
In reply to Sasha LevinFrom: Xiyu Yang <[email protected]>
[ Upstream commit 7c8f176d6a3fa18aa0f8875da6f7c672ed2a8554 ]
The reference counting issue happens in several exception handling paths of arm_smmu_iova_to_phys_hard(). When those error scenarios occur, the function forgets to decrease the refcount of "smmu" increased by arm_smmu_rpm_get(), causing a refcount leak.
Fix this issue by jumping to "out" label when those error scenarios occur.
--- drivers/iommu/arm-smmu.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/iommu/arm-smmu.c +6 -2
@@ -1231,6 +1231,7 @@ static phys_addr_t arm_smmu_iova_to_phys_hard(struct iommu_domain *domain,u64 phys;unsigned long va, flags;int ret, idx = cfg->cbndx; +phys_addr_t addr =0 ; ret =arm_smmu_rpm_get (smmu);if (ret <0 )
@@ -1249,6 +1250,7 @@ static phys_addr_t arm_smmu_iova_to_phys_hard(struct iommu_domain *domain,dev_err (dev,"iova to phys timed out on %pad. Falling back to software table walk.\n" , &iova); +arm_smmu_rpm_put (smmu);return ops->iova_to_phys (ops, iova); }
@@ -1257,12 +1259,14 @@ static phys_addr_t arm_smmu_iova_to_phys_hard(struct iommu_domain *domain,if (phys &CB_PAR_F ) {dev_err (dev,"translation fault!\n" );dev_err (dev,"PAR = 0x%llx\n" , phys); -return 0 ; + goto out; } + addr = (phys &GENMASK_ULL (39 ,12 )) | (iova &0xfff ); +out:arm_smmu_rpm_put (smmu); -return (phys &GENMASK_ULL (39 ,12 )) | (iova &0xfff ); +return addr; } static phys_addr_t arm_smmu_iova_to_phys(struct iommu_domain *domain,
Signature · 6 lines
2.30.2 _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
Sasha Levin
maintainerPATCH 38/63 gpio: zynq: Check return value of pm_runtime_get_sync
In reply to Sasha LevinFrom: Srinivas Neeli <[email protected]>
[ Upstream commit a51b2fb94b04ab71e53a71b9fad03fa826941254 ]
Return value of "pm_runtime_get_sync" API was neither captured nor checked. Fixed it by capturing the return value and then checking for any warning.
Addresses-Coverity: "check_return"
--- drivers/gpio/gpio-zynq.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpio/gpio-zynq.c +4 -1
@@ -938,8 +938,11 @@ static int zynq_gpio_probe(struct platform_device *pdev)static int zynq_gpio_remove (struct platform_device *pdev) {struct zynq_gpio *gpio =platform_get_drvdata (pdev); +int ret; -pm_runtime_get_sync (&pdev->dev); + ret =pm_runtime_get_sync (&pdev->dev); +if (ret <0 ) +dev_warn (&pdev->dev,"pm_runtime_get_sync() Failed\n" );gpiochip_remove (&gpio->chip);clk_disable_unprepare (gpio->clk);device_set_wakeup_capable (&pdev->dev,0 );
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 39/63 ALSA: ppc: fix error return code in snd_pmac_probe()
In reply to Sasha LevinFrom: Yang Yingliang <[email protected]>
[ Upstream commit 80b9c1be567c3c6bbe0d4b290af578e630485b5d ]
If snd_pmac_tumbler_init() or snd_pmac_tumbler_post_init() fails, snd_pmac_probe() need return error code.
--- sound/ppc/powermac.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
sound/ppc/powermac.c +5 -1
@@ -77,7 +77,11 @@ static int snd_pmac_probe(struct platform_device *devptr)sprintf (card->shortname,"PowerMac %s" , name_ext);sprintf (card->longname,"%s (Dev %d) Sub-frame %d" , card->shortname, chip->device_id, chip->subframe); -if (snd_pmac_tumbler_init (chip) <0 ||snd_pmac_tumbler_post_init () <0 ) + err =snd_pmac_tumbler_init (chip); +if (err <0 ) + goto __error; + err =snd_pmac_tumbler_post_init (); +if (err <0 ) goto __error;break ;case PMAC_AWACS :
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 40/63 selftests/powerpc: Fix "no_handler" EBB selftest
In reply to Sasha LevinFrom: Athira Rajeev <[email protected]>
[ Upstream commit 45677c9aebe926192e59475b35a1ff35ff2d4217 ]
The "no_handler_test" in ebb selftests attempts to read the PMU registers twice via helper function "dump_ebb_state". First dump is just before closing of event and the second invocation is done after closing of the event. The original intention of second dump_ebb_state was to dump the state of registers at the end of the test when the counters are frozen. But this will be achieved with the first call itself since sample period is set to low value and PMU will be frozen by then. Hence patch removes the dump which was done before closing of the event.
--- tools/testing/selftests/powerpc/pmu/ebb/no_handler_test.c | 2 -- 1 file changed, 2 deletions(-)
tools/testing/selftests/powerpc/pmu/ebb/no_handler_test.c +0 -2
@@ -50,8 +50,6 @@ static int no_handler_test(void)event_close (&event); -dump_ebb_state (); -/* The real test is that we never took an EBB at 0x0 */ return 0 ;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 41/63 gpio: pca953x: Add support for the On Semi pca9655
In reply to Sasha LevinFrom: Peter Robinson <[email protected]>
[ Upstream commit 6d49b3a0f351925b5ea5047166c112b7590b918a ]
The On Semi pca9655 is a 16 bit variant of the On Semi pca9654 GPIO expander, with 16 GPIOs and interrupt functionality.
--- drivers/gpio/gpio-pca953x.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpio/gpio-pca953x.c +1 -0
@@ -1272,6 +1272,7 @@ static const struct of_device_id pca953x_dt_ids[] = { { .compatible = "onnn,cat9554", .data = OF_953X( 8, PCA_INT), }, { .compatible = "onnn,pca9654", .data = OF_953X( 8, PCA_INT), }, + { .compatible = "onnn,pca9655", .data = OF_953X(16, PCA_INT), }, { .compatible = "exar,xra1202", .data = OF_953X( 8, 0), }, { }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 42/63 ASoC: soc-core: Fix the error return code in snd_soc_of_parse_audio_routing()
In reply to Sasha LevinFrom: Zhen Lei <[email protected]>
[ Upstream commit 7d3865a10b9ff2669c531d5ddd60bf46b3d48f1e ]
When devm_kcalloc() fails, the error code -ENOMEM should be returned instead of -EINVAL.
--- sound/soc/soc-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/soc-core.c +1 -1
@@ -3178,7 +3178,7 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,if (!routes) {dev_err (card->dev,"ASoC: Could not allocate DAPM route table\n" ); -return -EINVAL ; +return -ENOMEM ; }for (i =0 ; i < num_routes; i++) {
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 43/63 s390/processor: always inline stap() and __load_psw_mask()
In reply to Sasha LevinFrom: Heiko Carstens <[email protected]>
[ Upstream commit 9c9a915afd90f7534c16a71d1cd44b58596fddf3 ]
s390 is the only architecture which makes use of the __no_kasan_or_inline attribute for two functions. Given that both stap() and __load_psw_mask() are very small functions they can and should be always inlined anyway.
Therefore get rid of __no_kasan_or_inline and always inline these functions.
--- arch/s390/include/asm/processor.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/s390/include/asm/processor.h +2 -2
@@ -215,7 +215,7 @@ static inline unsigned long current_stack_pointer(void)return sp; } -static __no_kasan_or_inline unsigned short stap (void ) +static __always_inline unsigned short stap (void ) {unsigned short cpu_address;
@@ -254,7 +254,7 @@ static inline void __load_psw(psw_t psw)* Set PSW mask to specified value, while leaving the * PSW addr pointing to the next instruction. */ -static __no_kasan_or_inline void __load_psw_mask(unsigned long mask) +static __always_inline void __load_psw_mask(unsigned long mask) {unsigned long addr;psw_t psw;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 44/63 s390/ipl_parm: fix program check new psw handling
In reply to Sasha LevinFrom: Heiko Carstens <[email protected]>
[ Upstream commit 88c2510cecb7e2b518e3c4fdf3cf0e13ebe9377c ]
The __diag308() inline asm temporarily changes the program check new psw to redirect a potential program check on the diag instruction. Restoring of the program check new psw is done in C code behind the inline asm.
This can be problematic, especially if the function is inlined, since the compiler can reorder instructions in such a way that a different instruction, which may result in a program check, might be executed before the program check new psw has been restored.
To avoid such a scenario move restoring into the inline asm. For consistency reasons move also saving of the original program check new psw into the inline asm.
--- arch/s390/boot/ipl_parm.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)
arch/s390/boot/ipl_parm.c +11 -8
@@ -27,22 +27,25 @@ static inline int __diag308(unsigned long subcode, void *addr) register unsigned long _addr asm("0") = (unsigned long)addr; register unsigned long _rc asm("1") = 0;unsigned long reg1, reg2; -psw_t old = S390_lowcore.program_new_psw; +psw_t old; asmvolatile ( +" mvc 0(16,%[psw_old]),0(%[psw_pgm])\n" " epsw %0,%1\n" -" st %0,%[psw_pgm]\n" -" st %1,%[psw_pgm]+4\n" +" st %0,0(%[psw_pgm])\n" +" st %1,4(%[psw_pgm])\n" " larl %0,1f\n" -" stg %0,%[psw_pgm]+8\n" +" stg %0,8(%[psw_pgm])\n" " diag %[addr],%[subcode],0x308\n" -"1: nopr %%r7\n" +"1: mvc 0(16,%[psw_pgm]),0(%[psw_old])\n" :"=&d" (reg1),"=&a" (reg2), - [psw_pgm]"=Q" (S390_lowcore.program_new_psw), +"+Q" (S390_lowcore.program_new_psw), +"=Q" (old), [addr]"+d" (_addr),"+d" (_rc) - : [subcode]"d" (subcode) + : [subcode]"d" (subcode), + [psw_old]"a" (&old), + [psw_pgm]"a" (&S390_lowcore.program_new_psw) :"cc" ,"memory" ); - S390_lowcore.program_new_psw = old;return _rc; }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 45/63 s390/mem_detect: fix diag260() program check new psw handling
In reply to Sasha LevinFrom: Heiko Carstens <[email protected]>
[ Upstream commit 86807f348f418a84970eebb8f9912a7eea16b497 ]
The __diag260() inline asm temporarily changes the program check new psw to redirect a potential program check on the diag instruction. Restoring of the program check new psw is done in C code behind the inline asm.
This can be problematic, especially if the function is inlined, since the compiler can reorder instructions in such a way that a different instruction, which may result in a program check, might be executed before the program check new psw has been restored.
To avoid such a scenario move restoring into the inline asm. For consistency reasons move also saving of the original program check new psw into the inline asm.
--- arch/s390/boot/mem_detect.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)
arch/s390/boot/mem_detect.c +11 -8
@@ -70,24 +70,27 @@ static int __diag260(unsigned long rx1, unsigned long rx2) register unsigned long _ry asm("4") = 0x10; /* storage configuration */int rc =-1 ;/* fail */ unsigned long reg1, reg2; -psw_t old = S390_lowcore.program_new_psw; +psw_t old; asmvolatile ( +" mvc 0(16,%[psw_old]),0(%[psw_pgm])\n" " epsw %0,%1\n" -" st %0,%[psw_pgm]\n" -" st %1,%[psw_pgm]+4\n" +" st %0,0(%[psw_pgm])\n" +" st %1,4(%[psw_pgm])\n" " larl %0,1f\n" -" stg %0,%[psw_pgm]+8\n" +" stg %0,8(%[psw_pgm])\n" " diag %[rx],%[ry],0x260\n" " ipm %[rc]\n" " srl %[rc],28\n" -"1:\n" +"1: mvc 0(16,%[psw_pgm]),0(%[psw_old])\n" :"=&d" (reg1),"=&a" (reg2), - [psw_pgm]"=Q" (S390_lowcore.program_new_psw), +"+Q" (S390_lowcore.program_new_psw), +"=Q" (old), [rc]"+&d" (rc), [ry]"+d" (_ry) - : [rx]"d" (_rx1),"d" (_rx2) + : [rx]"d" (_rx1),"d" (_rx2), + [psw_old]"a" (&old), + [psw_pgm]"a" (&S390_lowcore.program_new_psw) :"cc" ,"memory" ); - S390_lowcore.program_new_psw = old;return rc ==0 ? _ry :-1 ; }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 46/63 s390/mem_detect: fix tprot() program check new psw handling
In reply to Sasha LevinFrom: Heiko Carstens <[email protected]>
[ Upstream commit da9057576785aaab52e706e76c0475c85b77ec14 ]
The tprot() inline asm temporarily changes the program check new psw to redirect a potential program check on the diag instruction. Restoring of the program check new psw is done in C code behind the inline asm.
This can be problematic, especially if the function is inlined, since the compiler can reorder instructions in such a way that a different instruction, which may result in a program check, might be executed before the program check new psw has been restored.
To avoid such a scenario move restoring into the inline asm. For consistency reasons move also saving of the original program check new psw into the inline asm.
--- arch/s390/boot/mem_detect.c | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-)
arch/s390/boot/mem_detect.c +17 -11
@@ -115,24 +115,30 @@ static int diag260(void)static int tprot (unsigned long addr) { -unsigned long pgm_addr; +unsigned long reg1, reg2;int rc = -EFAULT ; -psw_t old = S390_lowcore.program_new_psw; +psw_t old; - S390_lowcore.program_new_psw.mask =__extract_psw (); asmvolatile ( -" larl %[pgm_addr],1f\n" -" stg %[pgm_addr],%[psw_pgm_addr]\n" +" mvc 0(16,%[psw_old]),0(%[psw_pgm])\n" +" epsw %[reg1],%[reg2]\n" +" st %[reg1],0(%[psw_pgm])\n" +" st %[reg2],4(%[psw_pgm])\n" +" larl %[reg1],1f\n" +" stg %[reg1],8(%[psw_pgm])\n" " tprot 0(%[addr]),0\n" " ipm %[rc]\n" " srl %[rc],28\n" -"1:\n" - : [pgm_addr]"=&d" (pgm_addr), - [psw_pgm_addr]"=Q" (S390_lowcore.program_new_psw.addr), - [rc]"+&d" (rc) - : [addr]"a" (addr) +"1: mvc 0(16,%[psw_pgm]),0(%[psw_old])\n" + : [reg1]"=&d" (reg1), + [reg2]"=&a" (reg2), + [rc]"+&d" (rc), +"=Q" (S390_lowcore.program_new_psw.addr), +"=Q" (old) + : [psw_old]"a" (&old), + [psw_pgm]"a" (&S390_lowcore.program_new_psw), + [addr]"a" (addr) :"cc" ,"memory" ); - S390_lowcore.program_new_psw = old;return rc; }
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 47/63 Input: hideep - fix the uninitialized use in hideep_nvm_unlock()
In reply to Sasha LevinFrom: Yizhuo Zhai <[email protected]>
[ Upstream commit cac7100d4c51c04979dacdfe6c9a5e400d3f0a27 ]
Inside function hideep_nvm_unlock(), variable "unmask_code" could be uninitialized if hideep_pgm_r_reg() returns error, however, it is used in the later if statement after an "and" operation, which is potentially unsafe.
--- drivers/input/touchscreen/hideep.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/input/touchscreen/hideep.c +10 -3
@@ -361,13 +361,16 @@ static int hideep_enter_pgm(struct hideep_ts *ts)return -EIO ; } -static void hideep_nvm_unlock (struct hideep_ts *ts) +static int hideep_nvm_unlock (struct hideep_ts *ts) {u32 unmask_code; +int error;hideep_pgm_w_reg (ts,HIDEEP_FLASH_CFG ,HIDEEP_NVM_SFR_RPAGE ); -hideep_pgm_r_reg (ts,0x0000000C , &unmask_code); + error =hideep_pgm_r_reg (ts,0x0000000C , &unmask_code);hideep_pgm_w_reg (ts,HIDEEP_FLASH_CFG ,HIDEEP_NVM_DEFAULT_PAGE ); +if (error) +return error;/* make it unprotected code */ unmask_code &= ~HIDEEP_PROT_MODE ;
@@ -384,6 +387,8 @@ static void hideep_nvm_unlock(struct hideep_ts *ts)NVM_W_SFR (HIDEEP_NVM_MASK_OFS , ts->nvm_mask);SET_FLASH_HWCONTROL ();hideep_pgm_w_reg (ts,HIDEEP_FLASH_CFG ,HIDEEP_NVM_DEFAULT_PAGE ); + +return 0 ; }static int hideep_check_status (struct hideep_ts *ts)
@@ -462,7 +467,9 @@ static int hideep_program_nvm(struct hideep_ts *ts,u32 addr =0 ;int error; -hideep_nvm_unlock (ts); + error =hideep_nvm_unlock (ts); +if (error) +return error;while (ucode_len >0 ) { xfer_len =min_t (size_t, ucode_len,HIDEEP_NVM_PAGE_SIZE );
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 48/63 ALSA: bebob: add support for ToneWeal FW66
In reply to Sasha LevinFrom: Takashi Sakamoto <[email protected]>
[ Upstream commit 50ebe56222bfa0911a932930f9229ee5995508d9 ]
A user of FFADO project reported the issue of ToneWeal FW66. As a result, the device is identified as one of applications of BeBoB solution.
I note that in the report the device returns contradictory result in plug discovery process for audio subunit. Fortunately ALSA BeBoB driver doesn't perform it thus it's likely to handle the device without issues.
I receive no reaction to test request for this patch yet, however it would be worth to add support for it.
daniel@gibbonmoon:/sys/bus/firewire/devices/fw1$ grep -r . * Binary file config_rom matches dev:244:1 guid:0x0023270002000000 hardware_version:0x000002 is_local:0 model:0x020002 model_name:FW66 power/runtime_active_time:0 power/runtime_active_kids:0 power/runtime_usage:0 power/runtime_status:unsupported power/async:disabled power/runtime_suspended_time:0 power/runtime_enabled:disabled power/control:auto subsystem/drivers_autoprobe:1 uevent:MAJOR=244 uevent:MINOR=1 uevent:DEVNAME=fw1 units:0x00a02d:0x010001 vendor:0x002327 vendor_name:ToneWeal fw1.0/uevent:MODALIAS=ieee1394:ven00002327mo00020002sp0000A02Dver00010001 fw1.0/power/runtime_active_time:0 fw1.0/power/runtime_active_kids:0 fw1.0/power/runtime_usage:0 fw1.0/power/runtime_status:unsupported fw1.0/power/async:disabled fw1.0/power/runtime_suspended_time:0 fw1.0/power/runtime_enabled:disabled fw1.0/power/control:auto fw1.0/model:0x020002 fw1.0/rom_index:15 fw1.0/specifier_id:0x00a02d fw1.0/model_name:FW66 fw1.0/version:0x010001 fw1.0/modalias:ieee1394:ven00002327mo00020002sp0000A02Dver00010001
Cc: Daniel Jozsef <[email protected]>
Reference: https://lore.kernel.org/alsa-devel/20200119164335.GA11974@workstation/
--- sound/firewire/Kconfig | 1 + sound/firewire/bebob/bebob.c | 3 +++ 2 files changed, 4 insertions(+)
sound/firewire/Kconfig +1 -0
@@ -110,6 +110,7 @@ config SND_BEBOB * M-Audio Ozonic/NRV10/ProfireLightBridge * M-Audio FireWire 1814/ProjectMix IO * Digidesign Mbox 2 Pro + * ToneWeal FW66 To compile this driver as a module, choose M here: the module will be called snd-bebob.
sound/firewire/bebob/bebob.c +3 -0
@@ -59,6 +59,7 @@ static DECLARE_BITMAP(devices_used, SNDRV_CARDS);#define VEN_MAUDIO1 0x00000d6c#define VEN_MAUDIO2 0x000007f5#define VEN_DIGIDESIGN 0x00a07e +#define OUI_SHOUYO 0x002327#define MODEL_FOCUSRITE_SAFFIRE_BOTH 0x00000000#define MODEL_MAUDIO_AUDIOPHILE_BOTH 0x00010060
@@ -486,6 +487,8 @@ static const struct ieee1394_device_id bebob_id_table[] = { &maudio_special_spec),/* Digidesign Mbox 2 Pro */ SND_BEBOB_DEV_ENTRY (VEN_DIGIDESIGN ,0x0000a9 , &spec_normal), +// Toneweal FW66. + SND_BEBOB_DEV_ENTRY(OUI_SHOUYO, 0x020002, &spec_normal),/* IDs are unknown but able to be supported */ /* Apogee, Mini-ME Firewire */ /* Apogee, Mini-DAC Firewire */
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 49/63 ALSA: usb-audio: scarlett2: Fix 18i8 Gen 2 PCM Input count
In reply to Sasha LevinFrom: "Geoffrey D. Bennett" <[email protected]>
[ Upstream commit c5210f213456383482b4a77c5310282a89a106b5 ]
The 18i8 Gen 2 has 8 PCM Inputs, not 20. Fix the ports entry in s18i8_gen2_info.
--- sound/usb/mixer_scarlett_gen2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/usb/mixer_scarlett_gen2.c +1 -1
@@ -356,7 +356,7 @@ static const struct scarlett2_device_info s18i8_gen2_info = { }, [SCARLETT2_PORT_TYPE_PCM] = { .id = 0x600, - .num = { 20, 18, 18, 14, 10 }, + .num = { 8, 18, 18, 14, 10 }, .src_descr = "PCM %d", .src_num_offset = 1, .dst_descr = "PCM %02d Capture"
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 50/63 ALSA: usb-audio: scarlett2: Fix data_mutex lock
In reply to Sasha LevinFrom: "Geoffrey D. Bennett" <[email protected]>
[ Upstream commit 9b5ddea9ce5a68d7d2bedcb69901ac2a86c96c7b ]
The private->vol_updated flag was being checked outside of the mutex_lock/unlock() of private->data_mutex leading to the volume data being fetched twice from the device unnecessarily or old volume data being returned.
Update scarlett2_*_ctl_get() and include the private->vol_updated flag check inside the critical region.
--- sound/usb/mixer_scarlett_gen2.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-)
sound/usb/mixer_scarlett_gen2.c +9 -12
@@ -1028,11 +1028,10 @@ static int scarlett2_master_volume_ctl_get(struct snd_kcontrol *kctl,struct usb_mixer_interface *mixer = elem->head.mixer;struct scarlett2_mixer_data *private = mixer->private_data; -if (private->vol_updated) { -mutex_lock (&private->data_mutex); +mutex_lock (&private->data_mutex); +if (private->vol_updated)scarlett2_update_volumes (mixer); -mutex_unlock (&private->data_mutex); - } +mutex_unlock (&private->data_mutex); ucontrol->value.integer.value[0 ] = private->master_vol;return 0 ;
@@ -1046,11 +1045,10 @@ static int scarlett2_volume_ctl_get(struct snd_kcontrol *kctl,struct scarlett2_mixer_data *private = mixer->private_data;int index = elem->control; -if (private->vol_updated) { -mutex_lock (&private->data_mutex); +mutex_lock (&private->data_mutex); +if (private->vol_updated)scarlett2_update_volumes (mixer); -mutex_unlock (&private->data_mutex); - } +mutex_unlock (&private->data_mutex); ucontrol->value.integer.value[0 ] = private->vol[index];return 0 ;
@@ -1314,11 +1312,10 @@ static int scarlett2_button_ctl_get(struct snd_kcontrol *kctl,struct usb_mixer_interface *mixer = elem->head.mixer;struct scarlett2_mixer_data *private = mixer->private_data; -if (private->vol_updated) { -mutex_lock (&private->data_mutex); +mutex_lock (&private->data_mutex); +if (private->vol_updated)scarlett2_update_volumes (mixer); -mutex_unlock (&private->data_mutex); - } +mutex_unlock (&private->data_mutex); ucontrol->value.enumerated.item[0 ] = private->buttons[elem->control];return 0 ;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 51/63 ALSA: usb-audio: scarlett2: Fix scarlett2_*_ctl_put() return values
In reply to Sasha LevinFrom: "Geoffrey D. Bennett" <[email protected]>
[ Upstream commit c5d8e008032f3cd5f266d552732973a960b0bd4b ]
Mixer control put callbacks should return 1 if the value is changed. Fix the sw_hw, level, pad, and button controls accordingly.
--- sound/usb/mixer_scarlett_gen2.c | 8 ++++++++ 1 file changed, 8 insertions(+)
sound/usb/mixer_scarlett_gen2.c +8 -0
@@ -1179,6 +1179,8 @@ static int scarlett2_sw_hw_enum_ctl_put(struct snd_kcontrol *kctl,/* Send SW/HW switch change to the device */ err =scarlett2_usb_set_config (mixer,SCARLETT2_CONFIG_SW_HW_SWITCH , index, val); +if (err ==0 ) + err =1 ; unlock:mutex_unlock (&private->data_mutex);
@@ -1239,6 +1241,8 @@ static int scarlett2_level_enum_ctl_put(struct snd_kcontrol *kctl,/* Send switch change to the device */ err =scarlett2_usb_set_config (mixer,SCARLETT2_CONFIG_LEVEL_SWITCH , index, val); +if (err ==0 ) + err =1 ; unlock:mutex_unlock (&private->data_mutex);
@@ -1289,6 +1293,8 @@ static int scarlett2_pad_ctl_put(struct snd_kcontrol *kctl,/* Send switch change to the device */ err =scarlett2_usb_set_config (mixer,SCARLETT2_CONFIG_PAD_SWITCH , index, val); +if (err ==0 ) + err =1 ; unlock:mutex_unlock (&private->data_mutex);
@@ -1344,6 +1350,8 @@ static int scarlett2_button_ctl_put(struct snd_kcontrol *kctl,/* Send switch change to the device */ err =scarlett2_usb_set_config (mixer,SCARLETT2_CONFIG_BUTTONS , index, val); +if (err ==0 ) + err =1 ; unlock:mutex_unlock (&private->data_mutex);
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 52/63 usb: gadget: f_hid: fix endianness issue with descriptors
In reply to Sasha LevinFrom: Ruslan Bilovol <[email protected]>
[ Upstream commit 33cb46c4676d01956811b68a29157ea969a5df70 ]
Running sparse checker it shows warning message about incorrect endianness used for descriptor initialization:
| f_hid.c:91:43: warning: incorrect type in initializer (different base types) | f_hid.c:91:43: expected restricted __le16 [usertype] bcdHID | f_hid.c:91:43: got int
Fixing issue with cpu_to_le16() macro, however this is not a real issue as the value is the same both endians.
--- drivers/usb/gadget/function/f_hid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/gadget/function/f_hid.c +1 -1
@@ -88,7 +88,7 @@ static struct usb_interface_descriptor hidg_interface_desc = {static struct hid_descriptor hidg_desc = { .bLength =sizeof hidg_desc, .bDescriptorType =HID_DT_HID , - .bcdHID =0x0101 , + .bcdHID =cpu_to_le16 (0x0101 ), .bCountryCode =0x00 , .bNumDescriptors =0x1 ,/*.desc[0].bDescriptorType = DYNAMIC */
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 53/63 usb: gadget: hid: fix error return code in hid_bind()
In reply to Sasha LevinFrom: Yang Yingliang <[email protected]>
[ Upstream commit 88693f770bb09c196b1eb5f06a484a254ecb9924 ]
Fix to return a negative error code from the error handling case instead of 0.
--- drivers/usb/gadget/legacy/hid.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/usb/gadget/legacy/hid.c +3 -1
@@ -171,8 +171,10 @@ static int hid_bind(struct usb_composite_dev *cdev)struct usb_descriptor_header *usb_desc; usb_desc =usb_otg_descriptor_alloc (gadget); -if (!usb_desc) +if (!usb_desc) { + status = -ENOMEM ; goto put; + }usb_otg_descriptor_init (gadget, usb_desc); otg_desc[0 ] = usb_desc; otg_desc[1 ] =NULL ;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 54/63 powerpc/boot: Fixup device-tree on little endian
In reply to Sasha LevinFrom: Benjamin Herrenschmidt <[email protected]>
[ Upstream commit c93f80849bdd9b45d834053ae1336e28f0026c84 ]
This fixes the core devtree.c functions and the ns16550 UART backend.
--- arch/powerpc/boot/devtree.c | 59 +++++++++++++++++++++---------------- arch/powerpc/boot/ns16550.c | 9 ++++-- 2 files changed, 41 insertions(+), 27 deletions(-)
arch/powerpc/boot/devtree.c +34 -25
@@ -13,6 +13,7 @@#include "string.h" #include "stdio.h" #include "ops.h" +#include "of.h" void dt_fixup_memory (u64 start,u64 size) {
@@ -23,21 +24,25 @@ void dt_fixup_memory(u64 start, u64 size) root =finddevice ("/" );if (getprop (root,"#address-cells" , &naddr,sizeof (naddr)) <0 ) naddr =2 ; +else + naddr =be32_to_cpu (naddr);if (naddr <1 || naddr >2 )fatal ("Can't cope with #address-cells == %d in /\n\r" , naddr);if (getprop (root,"#size-cells" , &nsize,sizeof (nsize)) <0 ) nsize =1 ; +else + nsize =be32_to_cpu (nsize);if (nsize <1 || nsize >2 )fatal ("Can't cope with #size-cells == %d in /\n\r" , nsize); i =0 ;if (naddr ==2 ) - memreg[i++] = start >>32 ; - memreg[i++] = start &0xffffffff ; + memreg[i++] =cpu_to_be32 (start >>32 ); + memreg[i++] =cpu_to_be32 (start &0xffffffff );if (nsize ==2 ) - memreg[i++] = size >>32 ; - memreg[i++] = size &0xffffffff ; + memreg[i++] =cpu_to_be32 (size >>32 ); + memreg[i++] =cpu_to_be32 (size &0xffffffff ); memory =finddevice ("/memory" );if (! memory) {
@@ -45,9 +50,9 @@ void dt_fixup_memory(u64 start, u64 size)setprop_str (memory,"device_type" ,"memory" ); } -printf ("Memory <- <0x%x" , memreg[0 ]); +printf ("Memory <- <0x%x" ,be32_to_cpu (memreg[0 ]));for (i =1 ; i < (naddr + nsize); i++) -printf (" 0x%x" , memreg[i]); +printf (" 0x%x" ,be32_to_cpu (memreg[i]));printf ("> (%ldMB)\n\r" , (unsigned long )(size >>20 ));setprop (memory,"reg" , memreg, (naddr + nsize)*sizeof (u32));
@@ -65,10 +70,10 @@ void dt_fixup_cpu_clocks(u32 cpu, u32 tb, u32 bus)printf ("CPU bus-frequency <- 0x%x (%dMHz)\n\r" , bus,MHZ (bus));while ((devp =find_node_by_devtype (devp,"cpu" ))) { -setprop_val (devp,"clock-frequency" , cpu); -setprop_val (devp,"timebase-frequency" , tb); +setprop_val (devp,"clock-frequency" ,cpu_to_be32 (cpu)); +setprop_val (devp,"timebase-frequency" ,cpu_to_be32 (tb));if (bus >0 ) -setprop_val (devp,"bus-frequency" , bus); +setprop_val (devp,"bus-frequency" ,cpu_to_be32 (bus)); } timebase_period_ns =1000000000 / tb;
@@ -80,7 +85,7 @@ void dt_fixup_clock(const char *path, u32 freq)if (devp) {printf ("%s: clock-frequency <- %x (%dMHz)\n\r" , path, freq,MHZ (freq)); -setprop_val (devp,"clock-frequency" , freq); +setprop_val (devp,"clock-frequency" ,cpu_to_be32 (freq)); } }
@@ -133,8 +138,12 @@ void dt_get_reg_format(void *node, u32 *naddr, u32 *nsize) {if (getprop (node,"#address-cells" , naddr,4 ) !=4 ) *naddr =2 ; +else + *naddr =be32_to_cpu (*naddr);if (getprop (node,"#size-cells" , nsize,4 ) !=4 ) *nsize =1 ; +else + *nsize =be32_to_cpu (*nsize); }static void copy_val (u32 *dest,u32 *src,int naddr)
@@ -163,9 +172,9 @@ static int add_reg(u32 *reg, u32 *add, int naddr)int i, carry =0 ;for (i =MAX_ADDR_CELLS -1 ; i >=MAX_ADDR_CELLS - naddr; i--) { -u64 tmp = (u64 )reg[i] + add[i] + carry; +u64 tmp = (u64 )be32_to_cpu (reg[i]) +be32_to_cpu (add[i]) + carry; carry = tmp >>32 ; - reg[i] = (u32 )tmp; + reg[i] =cpu_to_be32 ((u32 )tmp); }return !carry;
@@ -180,18 +189,18 @@ static int compare_reg(u32 *reg, u32 *range, u32 *rangesize)u32 end;for (i =0 ; i <MAX_ADDR_CELLS ; i++) { -if (reg[i] < range[i]) +if (be32_to_cpu (reg[i]) <be32_to_cpu (range[i]))return 0 ; -if (reg[i] > range[i]) +if (be32_to_cpu (reg[i]) >be32_to_cpu (range[i]))break ; }for (i =0 ; i <MAX_ADDR_CELLS ; i++) { - end = range[i] + rangesize[i]; + end =be32_to_cpu (range[i]) +be32_to_cpu (rangesize[i]); -if (reg[i] < end) +if (be32_to_cpu (reg[i]) < end)break ; -if (reg[i] > end) +if (be32_to_cpu (reg[i]) > end)return 0 ; }
@@ -240,7 +249,6 @@ static int dt_xlate(void *node, int res, int reglen, unsigned long *addr,return 0 ;dt_get_reg_format (parent, &naddr, &nsize); -if (nsize >2 )return 0 ;
@@ -252,10 +260,10 @@ static int dt_xlate(void *node, int res, int reglen, unsigned long *addr,copy_val (last_addr, prop_buf + offset, naddr); - ret_size = prop_buf[offset + naddr]; + ret_size =be32_to_cpu (prop_buf[offset + naddr]);if (nsize ==2 ) { ret_size <<=32 ; - ret_size |= prop_buf[offset + naddr +1 ]; + ret_size |=be32_to_cpu (prop_buf[offset + naddr +1 ]); }for (;;) {
@@ -278,7 +286,6 @@ static int dt_xlate(void *node, int res, int reglen, unsigned long *addr, offset =find_range (last_addr, prop_buf, prev_naddr, naddr, prev_nsize, buflen /4 ); -if (offset <0 )return 0 ;
@@ -296,8 +303,7 @@ static int dt_xlate(void *node, int res, int reglen, unsigned long *addr,if (naddr >2 )return 0 ; - ret_addr = ((u64 )last_addr[2 ] <<32 ) | last_addr[3 ]; - + ret_addr = ((u64 )be32_to_cpu (last_addr[2 ]) <<32 ) |be32_to_cpu (last_addr[3 ]);if (sizeof (void *) ==4 && (ret_addr >=0x100000000ULL || ret_size >0x100000000ULL || ret_addr + ret_size >0x100000000ULL ))
@@ -350,11 +356,14 @@ int dt_is_compatible(void *node, const char *compat)int dt_get_virtual_reg (void *node,void **addr,int nres) {unsigned long xaddr; -int n; +int n, i; n =getprop (node,"virtual-reg" , addr, nres *4 ); -if (n >0 ) +if (n >0 ) { +for (i =0 ; i < n/4 ; i ++) + ((u32 *)addr)[i] =be32_to_cpu (((u32 *)addr)[i]);return n /4 ; + }for (n =0 ; n < nres; n++) {if (!dt_xlate_reg (node, n, &xaddr,NULL ))
arch/powerpc/boot/ns16550.c +7 -2
@@ -15,6 +15,7 @@#include "stdio.h" #include "io.h" #include "ops.h" +#include "of.h" #define UART_DLL 0/* Out: Divisor Latch Low */ #define UART_DLM 1/* Out: Divisor Latch High */
@@ -58,16 +59,20 @@ int ns16550_console_init(void *devp, struct serial_console_data *scdp)int n;u32 reg_offset; -if (dt_get_virtual_reg (devp, (void **)®_base,1 ) <1 ) +if (dt_get_virtual_reg (devp, (void **)®_base,1 ) <1 ) { +printf ("virt reg parse fail...\r\n" );return -1 ; + } n =getprop (devp,"reg-offset" , ®_offset,sizeof (reg_offset));if (n ==sizeof (reg_offset)) - reg_base += reg_offset; + reg_base +=be32_to_cpu (reg_offset); n =getprop (devp,"reg-shift" , ®_shift,sizeof (reg_shift));if (n !=sizeof (reg_shift)) reg_shift =0 ; +else + reg_shift =be32_to_cpu (reg_shift); scdp->open = ns16550_open; scdp->putc = ns16550_putc;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 55/63 ASoC: Intel: kbl_da7219_max98357a: shrink platform_id below 20 characters
In reply to Sasha LevinFrom: Pierre-Louis Bossart <[email protected]>
[ Upstream commit 94efd726b947f265bd313605c9f73edec5469d65 ]
Sparse throws the following warnings:
sound/soc/intel/boards/kbl_da7219_max98357a.c:647:25: error: too long initializer-string for array of char(no space for nul char)
Fix by using the 'mx' acronym for Maxim.
--- sound/soc/intel/boards/kbl_da7219_max98357a.c | 4 ++-- sound/soc/intel/common/soc-acpi-intel-kbl-match.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
sound/soc/intel/boards/kbl_da7219_max98357a.c +2 -2
@@ -607,7 +607,7 @@ static int kabylake_audio_probe(struct platform_device *pdev)static const struct platform_device_id kbl_board_ids[] = { { - .name ="kbl_da7219_max98357a" , + .name ="kbl_da7219_mx98357a" , .driver_data = (kernel_ulong_t)&kabylake_audio_card_da7219_m98357a, },
@@ -629,4 +629,4 @@ module_platform_driver(kabylake_audio)MODULE_DESCRIPTION ("Audio Machine driver-DA7219 & MAX98357A in I2S mode" );MODULE_AUTHOR ("Naveen Manohar <[email protected]>" );MODULE_LICENSE ("GPL v2" ); -MODULE_ALIAS ("platform:kbl_da7219_max98357a" ); +MODULE_ALIAS ("platform:kbl_da7219_mx98357a" );
sound/soc/intel/common/soc-acpi-intel-kbl-match.c +1 -1
@@ -113,7 +113,7 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_kbl_machines[] = { }, { .id = "DLGS7219", - .drv_name = "kbl_da7219_max98373", + .drv_name = "kbl_da7219_mx98373", .fw_filename = "intel/dsp_fw_kbl.bin", .machine_quirk = snd_soc_acpi_codec_list, .quirk_data = &kbl_7219_98373_codecs,
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 56/63 backlight: lm3630a: Fix return code of .update_status() callback
In reply to Sasha LevinFrom: Uwe Kleine-König <[email protected]>
[ Upstream commit b9481a667a90ec739995e85f91f3672ca44d6ffa ]
According to <linux/backlight.h> .update_status() is supposed to return 0 on success and a negative error code otherwise. Adapt lm3630a_bank_a_update_status() and lm3630a_bank_b_update_status() to actually do it.
While touching that also add the error code to the failure message.
--- drivers/video/backlight/lm3630a_bl.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/video/backlight/lm3630a_bl.c +6 -6
@@ -188,7 +188,7 @@ static int lm3630a_bank_a_update_status(struct backlight_device *bl)if ((pwm_ctrl &LM3630A_PWM_BANK_A ) !=0 ) {lm3630a_pwm_ctrl (pchip, bl->props.brightness, bl->props.max_brightness); -return bl->props.brightness; +return 0 ; }/* disable sleep */
@@ -208,8 +208,8 @@ static int lm3630a_bank_a_update_status(struct backlight_device *bl)return 0 ; out_i2c_err: -dev_err (pchip->dev,"i2c failed to access\n" ); -return bl->props.brightness; +dev_err (pchip->dev,"i2c failed to access (%pe)\n" ,ERR_PTR (ret)); +return ret; }static int lm3630a_bank_a_get_brightness (struct backlight_device *bl)
@@ -265,7 +265,7 @@ static int lm3630a_bank_b_update_status(struct backlight_device *bl)if ((pwm_ctrl &LM3630A_PWM_BANK_B ) !=0 ) {lm3630a_pwm_ctrl (pchip, bl->props.brightness, bl->props.max_brightness); -return bl->props.brightness; +return 0 ; }/* disable sleep */
@@ -285,8 +285,8 @@ static int lm3630a_bank_b_update_status(struct backlight_device *bl)return 0 ; out_i2c_err: -dev_err (pchip->dev,"i2c failed to access REG_CTRL\n" ); -return bl->props.brightness; +dev_err (pchip->dev,"i2c failed to access (%pe)\n" ,ERR_PTR (ret)); +return ret; }static int lm3630a_bank_b_get_brightness (struct backlight_device *bl)
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 57/63 ALSA: hda: Add IRQ check for platform_get_irq()
In reply to Sasha LevinFrom: Jiajun Cao <[email protected]>
[ Upstream commit 8c13212443230d03ff25014514ec0d53498c0912 ]
The function hda_tegra_first_init() neglects to check the return value after executing platform_get_irq().
hda_tegra_first_init() should check the return value (if negative error number) for errors so as to not pass a negative value to the devm_request_irq().
Fix it by adding a check for the return value irq_id.
--- sound/pci/hda/hda_tegra.c | 3 +++ 1 file changed, 3 insertions(+)
sound/pci/hda/hda_tegra.c +3 -0
@@ -292,6 +292,9 @@ static int hda_tegra_first_init(struct azx *chip, struct platform_device *pdev)const char *sname, *drv_name ="tegra-hda" ;struct device_node *np = pdev->dev.of_node; +if (irq_id <0 ) +return irq_id; + err =hda_tegra_init_chip (chip, pdev);if (err)return err;
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 58/63 ALSA: usb-audio: scarlett2: Fix 6i6 Gen 2 line out descriptions
In reply to Sasha LevinFrom: "Geoffrey D. Bennett" <[email protected]>
[ Upstream commit c712c6c0ff2d60478582e337185bcdd520a7dc2e ]
There are two headphone outputs, and they map to the four analogue outputs.
--- sound/usb/mixer_scarlett_gen2.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
sound/usb/mixer_scarlett_gen2.c +4 -4
@@ -254,10 +254,10 @@ static const struct scarlett2_device_info s6i6_gen2_info = { .pad_input_count = 2, .line_out_descrs = { -"Monitor L" , -"Monitor R" , -"Headphones L" , - "Headphones R", +"Headphones 1 L" , +"Headphones 1 R" , +"Headphones 2 L" , + "Headphones 2 R", }, .ports = {
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 59/63 jfs: fix GPF in diFree
In reply to Sasha LevinFrom: Pavel Skripkin <[email protected]>
[ Upstream commit 9d574f985fe33efd6911f4d752de6f485a1ea732 ]
Avoid passing inode with
JFS_SBI(inode->i_sb)->ipimap == NULL to
diFree()[1]. GFP will appear:
struct inode *ipimap = JFS_SBI(ip->i_sb)->ipimap; struct inomap *imap = JFS_IP(ipimap)->i_imap;
JFS_IP() will return invalid pointer when ipimap == NULL
Call Trace: diFree+0x13d/0x2dc0 fs/jfs/jfs_imap.c:853 [1] jfs_evict_inode+0x2c9/0x370 fs/jfs/inode.c:154 evict+0x2ed/0x750 fs/inode.c:578 iput_final fs/inode.c:1654 [inline] iput.part.0+0x3fe/0x820 fs/inode.c:1680 iput+0x58/0x70 fs/inode.c:1670
--- fs/jfs/inode.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/jfs/inode.c +2 -1
@@ -151,7 +151,8 @@ void jfs_evict_inode(struct inode *inode)if (test_cflag (COMMIT_Freewmap, inode))jfs_free_zero_link (inode); -diFree (inode); +if (JFS_SBI (inode->i_sb)->ipimap) +diFree (inode);/* * Free the inode from the quota allocation.
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 60/63 staging: rtl8723bs: fix macro value for 2.4Ghz only device
In reply to Sasha LevinFrom: Fabio Aiuto <[email protected]>
[ Upstream commit 6d490a27e23c5fb79b766530016ab8665169498e ]
fix IQK_Matrix_Settings_NUM macro value to 14 which is the max channel number value allowed in a 2.4Ghz device.
--- drivers/staging/rtl8723bs/hal/odm.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/staging/rtl8723bs/hal/odm.h +1 -4
@@ -197,10 +197,7 @@ typedef struct _ODM_RATE_ADAPTIVE {#define AVG_THERMAL_NUM 8#define IQK_Matrix_REG_NUM 8 -#define IQK_Matrix_Settings_NUM (14 + 24 + 21)/* Channels_2_4G_NUM -* + Channels_5G_20M_NUM -* + Channels_5G -*/ +#define IQK_Matrix_Settings_NUM 14/* Channels_2_4G_NUM */ #define DM_Type_ByFW 0#define DM_Type_ByDriver 1
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 61/63 intel_th: Wait until port is in reset before programming it
In reply to Sasha LevinFrom: Alexander Shishkin <[email protected]>
[ Upstream commit ab1afed701d2db7eb35c1a2526a29067a38e93d1 ]
Some devices don't drain their pipelines if we don't make sure that the corresponding output port is in reset before programming it for a new trace capture, resulting in bits of old trace appearing in the new trace capture. Fix that by explicitly making sure the reset is asserted before programming new trace capture.
--- drivers/hwtracing/intel_th/core.c | 17 +++++++++++++++++ drivers/hwtracing/intel_th/gth.c | 16 ++++++++++++++++ drivers/hwtracing/intel_th/intel_th.h | 3 +++ 3 files changed, 36 insertions(+)
drivers/hwtracing/intel_th/core.c +17 -0
@@ -215,6 +215,22 @@ static ssize_t port_show(struct device *dev, struct device_attribute *attr,static DEVICE_ATTR_RO (port); +static void intel_th_trace_prepare (struct intel_th_device *thdev) +{ +struct intel_th_device *hub =to_intel_th_hub (thdev); +struct intel_th_driver *hubdrv =to_intel_th_driver (hub->dev.driver); + +if (hub->type !=INTEL_TH_SWITCH ) +return ; + +if (thdev->type !=INTEL_TH_OUTPUT ) +return ; + +pm_runtime_get_sync (&thdev->dev); + hubdrv->prepare (hub, &thdev->output); +pm_runtime_put (&thdev->dev); +} +static int intel_th_output_activate (struct intel_th_device *thdev) { struct intel_th_driver *thdrv =
@@ -235,6 +251,7 @@ static int intel_th_output_activate(struct intel_th_device *thdev)if (ret) goto fail_put; +intel_th_trace_prepare (thdev);if (thdrv->activate) ret = thdrv->activate (thdev);else
drivers/hwtracing/intel_th/gth.c +16 -0
@@ -564,6 +564,21 @@ static void gth_tscu_resync(struct gth_device *gth)iowrite32 (reg, gth->base +REG_TSCU_TSUCTRL ); } +static void intel_th_gth_prepare (struct intel_th_device *thdev, +struct intel_th_output *output) +{ +struct gth_device *gth =dev_get_drvdata (&thdev->dev); +int count; + +/* +* Wait until the output port is in reset before we start +* programming it. +*/ +for (count =GTH_PLE_WAITLOOP_DEPTH ; + count && !(gth_output_get (gth, output->port) &BIT (5 )); count--) +cpu_relax (); +} +/** * intel_th_gth_enable() - enable tracing to an output device * @thdev: GTH device
@@ -815,6 +830,7 @@ static struct intel_th_driver intel_th_gth_driver = { .assign = intel_th_gth_assign, .unassign = intel_th_gth_unassign, .set_output = intel_th_gth_set_output, + .prepare = intel_th_gth_prepare, .enable = intel_th_gth_enable, .trig_switch = intel_th_gth_switch, .disable = intel_th_gth_disable,
drivers/hwtracing/intel_th/intel_th.h +3 -0
@@ -143,6 +143,7 @@ intel_th_output_assigned(struct intel_th_device *thdev)* @remove: remove method * @assign: match a given output type device against available outputs * @unassign: deassociate an output type device from an output port +* @prepare: prepare output port for tracing * @enable: enable tracing for a given output device * @disable: disable tracing for a given output device * @irq: interrupt callback
@@ -164,6 +165,8 @@ struct intel_th_driver { struct intel_th_device *othdev);void (*unassign)(struct intel_th_device *thdev,struct intel_th_device *othdev); +void (*prepare)(struct intel_th_device *thdev, +struct intel_th_output *output);void (*enable)(struct intel_th_device *thdev,struct intel_th_output *output); void (*trig_switch)(struct intel_th_device *thdev,
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 62/63 i2c: core: Disable client irq on reboot/shutdown
In reply to Sasha LevinFrom: Dmitry Torokhov <[email protected]>
[ Upstream commit b64210f2f7c11c757432ba3701d88241b2b98fb1 ]
If an i2c client receives an interrupt during reboot or shutdown it may be too late to service it by making an i2c transaction on the bus because the i2c controller has already been shutdown. This can lead to system hangs if the i2c controller tries to make a transfer that is doomed to fail because the access to the i2c pins is already shut down, or an iommu translation has been torn down so i2c controller register access doesn't work.
Let's simply disable the irq if there isn't a shutdown callback for an i2c client when there is an irq associated with the device. This will make sure that irqs don't come in later than the time that we can handle it. We don't do this if the i2c client device already has a shutdown callback because presumably they're doing the right thing and quieting the device so irqs don't come in after the shutdown callback returns.
[[email protected]: Dropped newline, added commit text, added interrupt.h for robot build error]
--- drivers/i2c/i2c-core-base.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/i2c/i2c-core-base.c +3 -0
@@ -24,6 +24,7 @@#include <linux/i2c-smbus.h> #include <linux/idr.h> #include <linux/init.h> +#include <linux/interrupt.h> #include <linux/irqflags.h> #include <linux/jump_label.h> #include <linux/kernel.h>
@@ -459,6 +460,8 @@ static void i2c_device_shutdown(struct device *dev) driver =to_i2c_driver (dev->driver);if (driver->shutdown) driver->shutdown (client); +else if (client->irq >0 ) +disable_irq (client->irq); }static void i2c_client_dev_release (struct device *dev)
Signature · 1 line
2.30.2
Sasha Levin
maintainerPATCH 63/63 lib/decompress_unlz4.c: correctly handle zero-padding around initrds.
In reply to Sasha LevinFrom: Dimitri John Ledkov <[email protected]>
[ Upstream commit 2c484419efc09e7234c667aa72698cb79ba8d8ed ]
lz4 compatible decompressor is simple. The format is underspecified and relies on EOF notification to determine when to stop. Initramfs buffer format[1] explicitly states that it can have arbitrary number of zero padding. Thus when operating without a fill function, be extra careful to ensure that sizes less than 4, or apperantly empty chunksizes are treated as EOF.
To test this I have created two cpio initrds, first a normal one, main.cpio. And second one with just a single /test-file with content "second" second.cpio. Then i compressed both of them with gzip, and with lz4 -l. Then I created a padding of 4 bytes (dd if=/dev/zero of=pad4 bs=1 count=4). To create four testcase initrds:
1) main.cpio.gzip + extra.cpio.gzip = pad0.gzip
2) main.cpio.lz4 + extra.cpio.lz4 = pad0.lz4
3) main.cpio.gzip + pad4 + extra.cpio.gzip = pad4.gzip
4) main.cpio.lz4 + pad4 + extra.cpio.lz4 = pad4.lz4
The pad4 test-cases replicate the initrd load by grub, as it pads and aligns every initrd it loads.
All of the above boot, however /test-file was not accessible in the initrd for the testcase #4, as decoding in lz4 decompressor failed. Also an error message printed which usually is harmless.
Whith a patched kernel, all of the above testcases now pass, and /test-file is accessible.
This fixes lz4 initrd decompress warning on every boot with grub. And more importantly this fixes inability to load multiple lz4 compressed initrds with grub. This patch has been shipping in Ubuntu kernels since January 2021.
[1] ./Documentation/driver-api/early-userspace/buffer-format.rst
--- lib/decompress_unlz4.c | 8 ++++++++ 1 file changed, 8 insertions(+)
lib/decompress_unlz4.c +8 -0
@@ -112,6 +112,9 @@ STATIC inline int INIT unlz4(u8 *input, long in_len,error ("data corrupted" ); goto exit_2; } + }else if (size <4 ) { +/* empty or end-of-file */ + goto exit_3; } chunksize =get_unaligned_le32 (inp);
@@ -125,6 +128,10 @@ STATIC inline int INIT unlz4(u8 *input, long in_len,continue ; } +if (!fill && chunksize ==0 ) { +/* empty or end-of-file */ + goto exit_3; + }if (posp) *posp +=4 ;
@@ -184,6 +191,7 @@ STATIC inline int INIT unlz4(u8 *input, long in_len, } } +exit_3: ret =0 ; exit_2:if (!input)
Signature · 1 line
2.30.2