5.8.2-rc1 review
Subsystems (4)
Greg Kroah-Hartman
maintainerPATCH 1/464 tracepoint: Mark __tracepoint_strings __used
In reply to Greg Kroah-HartmanFrom: Nick Desaulniers <[email protected]>
commit f3751ad0116fb6881f2c3c957d66a9327f69cefb upstream.
__tracepoint_string's have their string data stored in .rodata, and an address to that data stored in the "__tracepoint_str" section. Functions that refer to those strings refer to the symbol of the address. Compiler optimization can replace those address references with references directly to the string data. If the address doesn't appear to have other uses, then it appears dead to the compiler and is removed. This can break the /tracing/printk_formats sysfs node which iterates the addresses stored in the "__tracepoint_str" section.
Like other strings stored in custom sections in this header, mark these __used to inform the compiler that there are other non-obvious users of the address, so they should still be emitted.
--- include/linux/tracepoint.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/tracepoint.h +1 -1
@@ -361,7 +361,7 @@ static inline struct tracepoint *tracepo static const char *___tp_str __tracepoint_string = str; \ ___tp_str; \ }) -#define __tracepoint_string __attribute__((section("__tracepoint_str"))) +#define __tracepoint_string __attribute__((section("__tracepoint_str"), used))#else /* * tracepoint_string() is used to save the string address for userspace
Greg Kroah-Hartman
maintainerPATCH 14/464 arm64: dts: rockchip: fix rk3368-lion gmac reset gpio
In reply to Greg Kroah-HartmanFrom: Heiko Stuebner <[email protected]>
[ Upstream commit 2300e6dab473e93181cf76e4fe6671aa3d24c57b ]
The lion gmac node currently uses opposite active-values for the gmac phy reset pin. The gpio-declaration uses active-high while the separate snps,reset-active-low property marks the pin as active low.
While on the kernel side this works ok, other DT users may get confused - as seen with uboot right now.
So bring this in line and make both properties match, similar to the other Rockchip board.
--- arch/arm64/boot/dts/rockchip/rk3368-lion.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/rockchip/rk3368-lion.dtsi +1 -1
@@ -156,7 +156,7 @@ &gmac { pinctrl-0 = <&rgmii_pins>; snps,reset-active-low; snps,reset-delays-us = <0 10000 50000>; - snps,reset-gpio = <&gpio3 RK_PB3 GPIO_ACTIVE_HIGH>; + snps,reset-gpio = <&gpio3 RK_PB3 GPIO_ACTIVE_LOW>; tx_delay = <0x10>; rx_delay = <0x10>; status = "okay";
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 16/464 arm64: dts: rockchip: fix rk3399-puma gmac reset gpio
In reply to Greg Kroah-HartmanFrom: Heiko Stuebner <[email protected]>
[ Upstream commit 8a445086f8af0b7b9bd8d1901d6f306bb154f70d ]
The puma gmac node currently uses opposite active-values for the gmac phy reset pin. The gpio-declaration uses active-high while the separate snps,reset-active-low property marks the pin as active low.
While on the kernel side this works ok, other DT users may get confused - as seen with uboot right now.
So bring this in line and make both properties match, similar to the other Rockchip board.
--- arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi +1 -1
@@ -157,7 +157,7 @@ &gmac { phy-mode = "rgmii"; pinctrl-names = "default"; pinctrl-0 = <&rgmii_pins>; - snps,reset-gpio = <&gpio3 RK_PC0 GPIO_ACTIVE_HIGH>; + snps,reset-gpio = <&gpio3 RK_PC0 GPIO_ACTIVE_LOW>; snps,reset-active-low; snps,reset-delays-us = <0 10000 50000>; tx_delay = <0x10>;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 2/464 kunit: capture stderr on all make subprocess calls
In reply to Greg Kroah-HartmanFrom: Will Chen <[email protected]>
[ Upstream commit 5a9fcad71caa970f30aef99134a1cd19bc4b8eea ]
Direct stderr to subprocess.STDOUT so error messages get included in the subprocess.CalledProcessError exceptions output field. This results in more meaningful error messages for the user.
This is already being done in the make_allyesconfig method. Do the same for make_mrproper, make_olddefconfig, and make methods.
With this, failures on unclean trees [1] will give users an error message that includes:
"The source tree is not clean, please run 'make ARCH=um mrproper'"
[1] https://bugzilla.kernel.org/show_bug.cgi?id=205219
--- tools/testing/kunit/kunit_kernel.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
tools/testing/kunit/kunit_kernel.py +3 -3
@@ -34,7 +34,7 @@ class LinuxSourceTreeOperations(object): def make_mrproper(self): try: - subprocess.check_output(['make', 'mrproper']) + subprocess.check_output(['make', 'mrproper'], stderr=subprocess.STDOUT) except OSError as e: raise ConfigError('Could not call make command: ' + e) except subprocess.CalledProcessError as e:
@@ -47,7 +47,7 @@ class LinuxSourceTreeOperations(object): if build_dir: command += ['O=' + build_dir] try: - subprocess.check_output(command, stderr=subprocess.PIPE) + subprocess.check_output(command, stderr=subprocess.STDOUT) except OSError as e: raise ConfigError('Could not call make command: ' + e) except subprocess.CalledProcessError as e:
@@ -77,7 +77,7 @@ class LinuxSourceTreeOperations(object): if build_dir: command += ['O=' + build_dir] try: - subprocess.check_output(command) + subprocess.check_output(command, stderr=subprocess.STDOUT) except OSError as e: raise BuildError('Could not call execute make: ' + e) except subprocess.CalledProcessError as e:
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 3/464 io_uring: abstract out task work running
In reply to Greg Kroah-HartmanFrom: Jens Axboe <[email protected]>
[ Upstream commit 4c6e277c4cc4a6b3b2b9c66a7b014787ae757cc1 ]
Provide a helper to run task_work instead of checking and running manually in a bunch of different spots. While doing so, also move the task run state setting where we run the task work. Then we can move it out of the callback helpers. This also helps ensure we only do this once per task_work list run, not per task_work item.
--- fs/io_uring.c | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-)
fs/io_uring.c +19 -13
@@ -1747,6 +1747,17 @@ static int io_put_kbuf(struct io_kiocb *req)return cflags; } +static inline bool io_run_task_work (void ) +{ +if (current->task_works) { +__set_current_state (TASK_RUNNING ); +task_work_run (); +return true; + } + +return false; +} +static void io_iopoll_queue (struct list_head *again) {struct io_kiocb *req;
@@ -1936,6 +1947,7 @@ static int io_iopoll_check(struct io_ring_ctx *ctx, unsigned *nr_events,*/ if (!(++iters &7 )) {mutex_unlock (&ctx->uring_lock); +io_run_task_work ();mutex_lock (&ctx->uring_lock); }
@@ -4356,7 +4368,6 @@ static void io_async_task_func(struct callback_head *cb)kfree (apoll);if (!canceled) { -__set_current_state (TASK_RUNNING );if (io_sq_thread_acquire_mm (ctx, req)) {io_cqring_add_event (req, -EFAULT ); goto end_req;
@@ -6082,8 +6093,7 @@ static int io_sq_thread(void *data)if (!list_empty (&ctx->poll_list) ||need_resched () || (!time_after (jiffies, timeout) && ret != -EBUSY && !percpu_ref_is_dying (&ctx->refs))) { -if (current->task_works) -task_work_run (); +io_run_task_work ();cond_resched ();continue ; }
@@ -6115,8 +6125,7 @@ static int io_sq_thread(void *data)finish_wait (&ctx->sqo_wait, &wait);break ; } -if (current->task_works) { -task_work_run (); +if (io_run_task_work ()) {finish_wait (&ctx->sqo_wait, &wait);continue ; }
@@ -6145,8 +6154,7 @@ static int io_sq_thread(void *data) timeout = jiffies + ctx->sq_thread_idle; } -if (current->task_works) -task_work_run (); +io_run_task_work ();io_sq_thread_drop_mm (ctx);revert_creds (old_cred);
@@ -6211,9 +6219,8 @@ static int io_cqring_wait(struct io_ring_ctx *ctx, int min_events,do {if (io_cqring_events (ctx, false) >= min_events)return 0 ; -if (!current->task_works) +if (!io_run_task_work ())break ; -task_work_run (); }while (1 );if (sig) {
@@ -6235,8 +6242,8 @@ static int io_cqring_wait(struct io_ring_ctx *ctx, int min_events,prepare_to_wait_exclusive (&ctx->wait, &iowq.wq,TASK_INTERRUPTIBLE );/* make sure we run task_work before checking for signals */ -if (current->task_works) -task_work_run (); +if (io_run_task_work ()) +continue ;if (signal_pending (current)) {if (current->jobctl &JOBCTL_TASK_WORK ) {spin_lock_irq (¤t->sighand->siglock);
@@ -7655,8 +7662,7 @@ SYSCALL_DEFINE6(io_uring_enter, unsigned int, fd, u32, to_submit,int submitted =0 ;struct fd f; -if (current->task_works) -task_work_run (); +io_run_task_work ();if (flags & ~(IORING_ENTER_GETEVENTS |IORING_ENTER_SQ_WAKEUP ))return -EINVAL ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 4/464 HID: input: Fix devices that return multiple bytes in battery report
In reply to Greg Kroah-HartmanFrom: Grant Likely <[email protected]>
commit 4f57cace81438cc873a96f9f13f08298815c9b51 upstream.
Some devices, particularly the 3DConnexion Spacemouse wireless 3D controllers, return more than just the battery capacity in the battery report. The Spacemouse devices return an additional byte with a device specific field. However, hidinput_query_battery_capacity() only requests a 2 byte transfer.
When a spacemouse is connected via USB (direct wire, no wireless dongle) and it returns a 3 byte report instead of the assumed 2 byte battery report the larger transfer confuses and frightens the USB subsystem which chooses to ignore the transfer. Then after 2 seconds assume the device has stopped responding and reset it. This can be reproduced easily by using a wired connection with a wireless spacemouse. The Spacemouse will enter a loop of resetting every 2 seconds which can be observed in dmesg.
This patch solves the problem by increasing the transfer request to 4 bytes instead of 2. The fix isn't particularly elegant, but it is simple and safe to backport to stable kernels. A further patch will follow to more elegantly handle battery reports that contain additional data.
--- drivers/hid/hid-input.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/hid/hid-input.c +3 -3
@@ -350,13 +350,13 @@ static int hidinput_query_battery_capaciu8 *buf;int ret; - buf =kmalloc (2 ,GFP_KERNEL ); + buf =kmalloc (4 ,GFP_KERNEL );if (!buf)return -ENOMEM ; - ret =hid_hw_raw_request (dev, dev->battery_report_id, buf,2 , + ret =hid_hw_raw_request (dev, dev->battery_report_id, buf,4 , dev->battery_report_type,HID_REQ_GET_REPORT ); -if (ret !=2 ) { +if (ret <2 ) {kfree (buf);return -ENODATA ; }
Greg Kroah-Hartman
maintainerPATCH 7/464 x86/mce/inject: Fix a wrong assignment of i_mce.status
In reply to Greg Kroah-HartmanFrom: Zhenzhong Duan <[email protected]>
[ Upstream commit 5d7f7d1d5e01c22894dee7c9c9266500478dca99 ]
The original code is a nop as i_mce.status is or'ed with part of itself, fix it.
--- arch/x86/kernel/cpu/mce/inject.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/cpu/mce/inject.c +1 -1
@@ -511,7 +511,7 @@ static void do_inject(void)*/ if (inj_type ==DFR_INT_INJ ) { i_mce.status |=MCI_STATUS_DEFERRED ; - i_mce.status |= (i_mce.status & ~MCI_STATUS_UC ); + i_mce.status &= ~MCI_STATUS_UC ; }/*
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 8/464 perf/x86/intel/uncore: Fix oops when counting IMC uncore events on some TGL
In reply to Greg Kroah-HartmanFrom: Kan Liang <[email protected]>
[ Upstream commit 2af834f1faab3f1e218fcbcab70a399121620d62 ]
When counting IMC uncore events on some TGL machines, an oops will be triggered.
[ 393.101262] BUG: unable to handle page fault for address: ffffb45200e15858 [ 393.101269] #PF: supervisor read access in kernel mode [ 393.101271] #PF: error_code(0x0000) - not-present page
Current perf uncore driver still use the IMC MAP SIZE inherited from SNB, which is 0x6000.
However, the offset of IMC uncore counters is larger than 0x6000, e.g. 0xd8a0.
Enlarge the IMC MAP SIZE for TGL to 0xe000.
--- arch/x86/events/intel/uncore_snb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/x86/events/intel/uncore_snb.c +2 -1
@@ -1085,6 +1085,7 @@ static struct pci_dev *tgl_uncore_get_mc_dev(void) }#define TGL_UNCORE_MMIO_IMC_MEM_OFFSET 0x10000 +#define TGL_UNCORE_PCI_IMC_MAP_SIZE 0xe000static void tgl_uncore_imc_freerunning_init_box (struct intel_uncore_box *box) {
@@ -1112,7 +1113,7 @@ static void tgl_uncore_imc_freerunning_init_box(struct intel_uncore_box *box) addr |= ((resource_size_t )mch_bar <<32 );#endif - box->io_addr =ioremap (addr,SNB_UNCORE_PCI_IMC_MAP_SIZE ); + box->io_addr =ioremap (addr,TGL_UNCORE_PCI_IMC_MAP_SIZE ); }static struct intel_uncore_ops tgl_uncore_imc_freerunning_ops = {
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 35/464 platform/x86: intel-vbtn: Fix return value check in check_acpi_dev()
In reply to Greg Kroah-HartmanFrom: Lu Wei <[email protected]>
[ Upstream commit 64dd4a5a7d214a07e3d9f40227ec30ac8ba8796e ]
In the function check_acpi_dev(), if it fails to create platform device, the return value is ERR_PTR() or NULL. Thus it must use IS_ERR_OR_NULL() to check return value.
--- drivers/platform/x86/intel-vbtn.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/x86/intel-vbtn.c +1 -1
@@ -299,7 +299,7 @@ check_acpi_dev(acpi_handle handle, u32 lvl, void *context, void **rv)return AE_OK ;if (acpi_match_device_ids (dev, ids) ==0 ) -if (acpi_create_platform_device (dev,NULL )) +if (!IS_ERR_OR_NULL (acpi_create_platform_device (dev,NULL )))dev_info (&dev->dev,"intel-vbtn: created platform device\n" );
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 36/464 ARM: dts: gose: Fix ports node name for adv7180
In reply to Greg Kroah-HartmanFrom: Niklas Söderlund <[email protected]>
[ Upstream commit d344234abde938ae1062edb6c05852b0bafb4a03 ]
When adding the adv7180 device node the ports node was misspelled as port, fix this.
--- arch/arm/boot/dts/r8a7793-gose.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/r8a7793-gose.dts +1 -1
@@ -336,7 +336,7 @@ composite-in@20 { reg = <0x20>; remote = <&vin1>; - port { + ports { #address-cells = <1>; #size-cells = <0>;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 52/464 io_uring: fix sq array offset calculation
In reply to Greg Kroah-HartmanFrom: Dmitry Vyukov <[email protected]>
[ Upstream commit b36200f543ff07a1cb346aa582349141df2c8068 ]
rings_size() sets sq_offset to the total size of the rings (the returned value which is used for memory allocation). This is wrong: sq array should be located within the rings, not after them. Set sq_offset to where it should be.
--- fs/io_uring.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
fs/io_uring.c +3 -3
@@ -7093,6 +7093,9 @@ static unsigned long rings_size(unsigned sq_entries, unsigned cq_entries,return SIZE_MAX ;#endif +if (sq_offset) + *sq_offset = off; + sq_array_size =array_size (sizeof (u32), sq_entries);if (sq_array_size ==SIZE_MAX )return SIZE_MAX ;
@@ -7100,9 +7103,6 @@ static unsigned long rings_size(unsigned sq_entries, unsigned cq_entries,if (check_add_overflow (off, sq_array_size, &off))return SIZE_MAX ; -if (sq_offset) - *sq_offset = off; -return off; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 62/464 md: raid0/linear: fix dereference before null check on pointer mddev
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
[ Upstream commit 9a5a85972c073f720d81a7ebd08bfe278e6e16db ]
Pointer mddev is being dereferenced with a test_bit call before mddev is being null checked, this may cause a null pointer dereference. Fix this by moving the null pointer checks to sanity check mddev before it is dereferenced.
Addresses-Coverity: ("Dereference before null check")
--- drivers/md/md.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/md/md.c +5 -4
@@ -470,17 +470,18 @@ static blk_qc_t md_make_request(struct request_queue *q, struct bio *bio)struct mddev *mddev = bio->bi_disk->private_data;unsigned int sectors; -if (unlikely (test_bit (MD_BROKEN , &mddev->flags)) && (rw ==WRITE )) { +if (mddev ==NULL || mddev->pers ==NULL ) {bio_io_error (bio);return BLK_QC_T_NONE ; } -blk_queue_split (q, &bio); - -if (mddev ==NULL || mddev->pers ==NULL ) { +if (unlikely (test_bit (MD_BROKEN , &mddev->flags)) && (rw ==WRITE )) {bio_io_error (bio);return BLK_QC_T_NONE ; } + +blk_queue_split (q, &bio); +if (mddev->ro ==1 &&unlikely (rw ==WRITE )) {if (bio_sectors (bio) !=0 ) bio->bi_status =BLK_STS_IOERR ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 67/464 kunit: tool: fix broken default args in unit tests
In reply to Greg Kroah-HartmanFrom: Brendan Higgins <[email protected]>
[ Upstream commit 6816fe61bda8c819c368ad2002cd27172ecb79de ]
Commit ddbd60c779b4 ("kunit: use --build_dir=.kunit as default") changed the default build directory for KUnit tests, but failed to update associated unit tests for kunit_tool, so update them.
--- tools/testing/kunit/kunit_tool_test.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
tools/testing/kunit/kunit_tool_test.py +5 -5
@@ -258,14 +258,14 @@ class KUnitMainTest(unittest.TestCase): def test_build_passes_args_pass(self): kunit.main(['build'], self.linux_source_mock) assert self.linux_source_mock.build_reconfig.call_count == 0 - self.linux_source_mock.build_um_kernel.assert_called_once_with(False, 8, '', None) + self.linux_source_mock.build_um_kernel.assert_called_once_with(False, 8, '.kunit', None) assert self.linux_source_mock.run_kernel.call_count == 0 def test_exec_passes_args_pass(self): kunit.main(['exec'], self.linux_source_mock) assert self.linux_source_mock.build_reconfig.call_count == 0 assert self.linux_source_mock.run_kernel.call_count == 1 - self.linux_source_mock.run_kernel.assert_called_once_with(build_dir='', timeout=300) + self.linux_source_mock.run_kernel.assert_called_once_with(build_dir='.kunit', timeout=300) self.print_mock.assert_any_call(StrContains('Testing complete.')) def test_run_passes_args_pass(self):
@@ -273,7 +273,7 @@ class KUnitMainTest(unittest.TestCase): assert self.linux_source_mock.build_reconfig.call_count == 1 assert self.linux_source_mock.run_kernel.call_count == 1 self.linux_source_mock.run_kernel.assert_called_once_with( - build_dir='', timeout=300) + build_dir='.kunit', timeout=300) self.print_mock.assert_any_call(StrContains('Testing complete.')) def test_exec_passes_args_fail(self):
@@ -313,7 +313,7 @@ class KUnitMainTest(unittest.TestCase): def test_exec_timeout(self): timeout = 3453 kunit.main(['exec', '--timeout', str(timeout)], self.linux_source_mock) - self.linux_source_mock.run_kernel.assert_called_once_with(build_dir='', timeout=timeout) + self.linux_source_mock.run_kernel.assert_called_once_with(build_dir='.kunit', timeout=timeout) self.print_mock.assert_any_call(StrContains('Testing complete.')) def test_run_timeout(self):
@@ -321,7 +321,7 @@ class KUnitMainTest(unittest.TestCase): kunit.main(['run', '--timeout', str(timeout)], self.linux_source_mock) assert self.linux_source_mock.build_reconfig.call_count == 1 self.linux_source_mock.run_kernel.assert_called_once_with( - build_dir='', timeout=timeout) + build_dir='.kunit', timeout=timeout) self.print_mock.assert_any_call(StrContains('Testing complete.')) def test_run_builddir(self):
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 69/464 irqchip/irq-bcm7038-l1: Guard uses of cpu_logical_map
In reply to Greg Kroah-HartmanFrom: Florian Fainelli <[email protected]>
[ Upstream commit 9808357ff2e5bfe1e0dcafef5e78cc5b617a7078 ]
cpu_logical_map is only defined for CONFIG_SMP builds, when we are in an UP configuration, the boot CPU is 0.
--- drivers/irqchip/irq-bcm7038-l1.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/irqchip/irq-bcm7038-l1.c +8 -0
@@ -327,7 +327,11 @@ static int bcm7038_l1_suspend(void)u32 val;/* Wakeup interrupt should only come from the boot cpu */ +#ifdef CONFIG_SMP boot_cpu =cpu_logical_map (0 ); +#else + boot_cpu =0 ; +#endif list_for_each_entry (intc, &bcm7038_l1_intcs_list, list) {for (word =0 ; word < intc->n_words; word++) {
@@ -347,7 +351,11 @@ static void bcm7038_l1_resume(void)struct bcm7038_l1_chip *intc;int boot_cpu, word; +#ifdef CONFIG_SMP boot_cpu =cpu_logical_map (0 ); +#else + boot_cpu =0 ; +#endif list_for_each_entry (intc, &bcm7038_l1_intcs_list, list) {for (word =0 ; word < intc->n_words; word++) {
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 38/464 ARM: dts: gose: Fix ports node name for adv7612
In reply to Greg Kroah-HartmanFrom: Niklas Söderlund <[email protected]>
[ Upstream commit 59692ac5a7bb8c97ff440fc8917828083fbc38d6 ]
When adding the adv7612 device node the ports node was misspelled as port, fix this.
--- arch/arm/boot/dts/r8a7793-gose.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/r8a7793-gose.dts +1 -1
@@ -394,7 +394,7 @@ hdmi-in@4c { interrupts = <2 IRQ_TYPE_LEVEL_LOW>; default-input = <0>; - port { + ports { #address-cells = <1>; #size-cells = <0>;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 20/464 memory: tegra: Fix an error handling path in tegra186_emc_probe()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit c3d4eb3bf6ad32466555b31094f33a299444f795 ]
The call to tegra_bpmp_get() must be balanced by a call to tegra_bpmp_put() in case of error, as already done in the remove function.
Add an error handling path and corresponding goto.
--- drivers/memory/tegra/tegra186-emc.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
drivers/memory/tegra/tegra186-emc.c +11 -5
@@ -185,7 +185,7 @@ static int tegra186_emc_probe(struct platform_device *pdev)if (IS_ERR (emc->clk)) { err =PTR_ERR (emc->clk);dev_err (&pdev->dev,"failed to get EMC clock: %d\n" , err); -return err; + goto put_bpmp; }platform_set_drvdata (pdev, emc);
@@ -201,7 +201,7 @@ static int tegra186_emc_probe(struct platform_device *pdev) err =tegra_bpmp_transfer (emc->bpmp, &msg);if (err <0 ) {dev_err (&pdev->dev,"failed to EMC DVFS pairs: %d\n" , err); -return err; + goto put_bpmp; } emc->debugfs.min_rate =ULONG_MAX ;
@@ -211,8 +211,10 @@ static int tegra186_emc_probe(struct platform_device *pdev) emc->dvfs =devm_kmalloc_array (&pdev->dev, emc->num_dvfs,sizeof (*emc->dvfs),GFP_KERNEL ); -if (!emc->dvfs) -return -ENOMEM ; +if (!emc->dvfs) { + err = -ENOMEM ; + goto put_bpmp; + }dev_dbg (&pdev->dev,"%u DVFS pairs:\n" , emc->num_dvfs);
@@ -237,7 +239,7 @@ static int tegra186_emc_probe(struct platform_device *pdev)"failed to set rate range [%lu-%lu] for %pC\n" , emc->debugfs.min_rate, emc->debugfs.max_rate, emc->clk); -return err; + goto put_bpmp; } emc->debugfs.root =debugfs_create_dir ("emc" ,NULL );
@@ -254,6 +256,10 @@ static int tegra186_emc_probe(struct platform_device *pdev) emc, &tegra186_emc_debug_max_rate_fops);return 0 ; + +put_bpmp: +tegra_bpmp_put (emc->bpmp); +return err; }static int tegra186_emc_remove (struct platform_device *pdev)
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 53/464 arm64: dts: meson: misc fixups for w400 dtsi
In reply to Greg Kroah-HartmanFrom: Christian Hewitt <[email protected]>
[ Upstream commit 2fa17dd09533d5d83201be3229a28c1010a8ea3e ]
Current devices using the W400 dtsi show mmc tuning errors:
[12483.917391] mmc0: tuning execution failed: -5 [30535.551221] mmc0: tuning execution failed: -5 [35359.953671] mmc0: tuning execution failed: -5 [35561.875332] mmc0: tuning execution failed: -5 [61733.348709] mmc0: tuning execution failed: -5
Removing "sd-uhs-sdr50" from the SDIO node prevents this. We also add keep-power-in-suspend to the SDIO node and fix an indentation.
--- arch/arm64/boot/dts/amlogic/meson-g12b-w400.dtsi | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/amlogic/meson-g12b-w400.dtsi +4 -2
@@ -336,9 +336,11 @@ &sd_emmc_a { bus-width = <4>; cap-sd-highspeed; - sd-uhs-sdr50; max-frequency = <100000000>; + /* WiFi firmware requires power to be kept while in suspend */ + keep-power-in-suspend; + non-removable; disable-wp;
@@ -398,7 +400,7 @@ bluetooth { shutdown-gpios = <&gpio GPIOX_17 GPIO_ACTIVE_HIGH>; max-speed = <2000000>; clocks = <&wifi32k>; - clock-names = "lpo"; + clock-names = "lpo"; }; };
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 74/464 nvme-multipath: do not fall back to __nvme_find_path() for non-optimized paths
In reply to Greg Kroah-HartmanFrom: Hannes Reinecke <[email protected]>
[ Upstream commit fbd6a42d8932e172921c7de10468a2e12c34846b ]
When nvme_round_robin_path() finds a valid namespace we should be using it; falling back to __nvme_find_path() for non-optimized paths will cause the result from nvme_round_robin_path() to be ignored for non-optimized paths.
--- drivers/nvme/host/multipath.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/nvme/host/multipath.c +7 -4
@@ -272,10 +272,13 @@ inline struct nvme_ns *nvme_find_path(struct nvme_ns_head *head)struct nvme_ns *ns; ns =srcu_dereference (head->current_path[node], &head->srcu); -if (READ_ONCE (head->subsys->iopolicy) ==NVME_IOPOLICY_RR && ns) - ns =nvme_round_robin_path (head, node, ns); -if (unlikely (!ns || !nvme_path_is_optimized (ns))) - ns =__nvme_find_path (head, node); +if (unlikely (!ns)) +return __nvme_find_path (head, node); + +if (READ_ONCE (head->subsys->iopolicy) ==NVME_IOPOLICY_RR ) +return nvme_round_robin_path (head, node, ns); +if (unlikely (!nvme_path_is_optimized (ns))) +return __nvme_find_path (head, node);return ns; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 75/464 irqchip/loongson-pch-pic: Fix the misused irq flow handler
In reply to Greg Kroah-HartmanFrom: Huacai Chen <[email protected]>
[ Upstream commit ac62460c24126eb2442e3653a266ebbf05b004d8 ]
Loongson PCH PIC is a standard level triggered PIC, and it need to clear interrupt during unmask.
--- drivers/irqchip/irq-loongson-pch-pic.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-)
drivers/irqchip/irq-loongson-pch-pic.c +4 -11
@@ -64,15 +64,6 @@ static void pch_pic_bitclr(struct pch_pic *priv, int offset, int bit)raw_spin_unlock (&priv->pic_lock); } -static void pch_pic_eoi_irq (struct irq_data *d) -{ -u32 idx =PIC_REG_IDX (d->hwirq); -struct pch_pic *priv =irq_data_get_irq_chip_data (d); - -writel (BIT (PIC_REG_BIT (d->hwirq)), - priv->base +PCH_PIC_CLR + idx *4 ); -} -static void pch_pic_mask_irq (struct irq_data *d) {struct pch_pic *priv =irq_data_get_irq_chip_data (d);
@@ -85,6 +76,9 @@ static void pch_pic_unmask_irq(struct irq_data *d) {struct pch_pic *priv =irq_data_get_irq_chip_data (d); +writel (BIT (PIC_REG_BIT (d->hwirq)), + priv->base +PCH_PIC_CLR +PIC_REG_IDX (d->hwirq) *4 ); +irq_chip_unmask_parent (d);pch_pic_bitclr (priv,PCH_PIC_MASK , d->hwirq); }
@@ -124,7 +118,6 @@ static struct irq_chip pch_pic_irq_chip = { .irq_mask = pch_pic_mask_irq, .irq_unmask = pch_pic_unmask_irq, .irq_ack = irq_chip_ack_parent, - .irq_eoi = pch_pic_eoi_irq, .irq_set_affinity = irq_chip_set_affinity_parent, .irq_set_type = pch_pic_set_type, };
@@ -153,7 +146,7 @@ static int pch_pic_alloc(struct irq_domain *domain, unsigned int virq,irq_domain_set_info (domain, virq, hwirq, &pch_pic_irq_chip, priv, - handle_fasteoi_ack_irq,NULL ,NULL ); + handle_level_irq,NULL ,NULL );irq_set_probe (virq);return 0 ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 54/464 arm64: dts: meson: fix mmc0 tuning error on Khadas VIM3
In reply to Greg Kroah-HartmanFrom: Christian Hewitt <[email protected]>
[ Upstream commit f1bb924e8f5b50752a80fa5b48c43003680a7b64 ]
Similar to other G12B devices using the W400 dtsi, I see reports of mmc0 tuning errors on VIM3 after a few hours uptime:
[12483.917391] mmc0: tuning execution failed: -5 [30535.551221] mmc0: tuning execution failed: -5 [35359.953671] mmc0: tuning execution failed: -5 [35561.875332] mmc0: tuning execution failed: -5 [61733.348709] mmc0: tuning execution failed: -5
I do not see the same on VIM3L, so remove sd-uhs-sdr50 from the common dtsi to silence the error, then (re)add it to the VIM3L dts.
--- arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi | 1 - arch/arm64/boot/dts/amlogic/meson-sm1-khadas-vim3l.dts | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi +0 -1
@@ -270,7 +270,6 @@ &sd_emmc_a { bus-width = <4>; cap-sd-highspeed; - sd-uhs-sdr50; max-frequency = <100000000>; non-removable;
arch/arm64/boot/dts/amlogic/meson-sm1-khadas-vim3l.dts +4 -0
@@ -88,6 +88,10 @@ &pcie { status = "okay"; }; +&sd_emmc_a { + sd-uhs-sdr50; +}; + &usb { phys = <&usb2_phy0>, <&usb2_phy1>; phy-names = "usb2-phy0", "usb2-phy1";
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 80/464 ARM: exynos: clear L310_AUX_CTRL_FULL_LINE_ZERO in default l2c_aux_val
In reply to Greg Kroah-HartmanFrom: Guillaume Tucker <[email protected]>
[ Upstream commit 5b17a04addc29201dc142c8d2c077eb7745d2e35 ]
This "alert" error message can be seen on exynos4412-odroidx2:
L2C: platform modifies aux control register: 0x02070000 -> 0x3e470001
L2C: platform provided aux values permit register corruption.
Followed by this plain error message:
L2C-310: enabling full line of zeros but not enabled in Cortex-A9
To fix it, don't set the L310_AUX_CTRL_FULL_LINE_ZERO flag (bit 0) in the default value of l2c_aux_val. It may instead be enabled when applicable by the logic in l2c310_enable() if the attribute "arm,full-line-zero-disable" was set in the device tree.
The initial commit that introduced this default value was in v2.6.38 commit 1cf0eb799759 ("ARM: S5PV310: Add L2 cache init function in cpu.c").
However, the code to set the L310_AUX_CTRL_FULL_LINE_ZERO flag and manage that feature was added much later and the default value was not updated then. So this seems to have been a subtle oversight especially since enabling it only in the cache and not in the A9 core doesn't actually prevent the platform from running. According to the TRM, the opposite would be a real issue, if the feature was enabled in the A9 core but not in the cache controller.
--- arch/arm/mach-exynos/exynos.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-exynos/exynos.c +1 -1
@@ -193,7 +193,7 @@ static void __init exynos_dt_fixup(void) }DT_MACHINE_START (EXYNOS_DT ,"Samsung Exynos (Flattened Device Tree)" ) - .l2c_aux_val = 0x3c400001, + .l2c_aux_val = 0x3c400000, .l2c_aux_mask = 0xc20fffff, .smp = smp_ops(exynos_smp_ops), .map_io = exynos_init_io,
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 82/464 loop: be paranoid on exit and prevent new additions / removals
In reply to Greg Kroah-HartmanFrom: Luis Chamberlain <[email protected]>
[ Upstream commit 200f93377220504c5e56754823e7adfea6037f1a ]
Be pedantic on removal as well and hold the mutex. This should prevent uses of addition while we exit.
--- drivers/block/loop.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/block/loop.c +4 -0
@@ -2402,6 +2402,8 @@ static void __exit loop_exit(void) range = max_loop ? max_loop << part_shift :1UL <<MINORBITS ; +mutex_lock (&loop_ctl_mutex); +idr_for_each (&loop_index_idr, &loop_exit_cb,NULL );idr_destroy (&loop_index_idr);
@@ -2409,6 +2411,8 @@ static void __exit loop_exit(void)unregister_blkdev (LOOP_MAJOR ,"loop" );misc_deregister (&loop_misc); + +mutex_unlock (&loop_ctl_mutex); }module_init (loop_init);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 83/464 io_uring: fix req->work corruption
In reply to Greg Kroah-HartmanFrom: Pavel Begunkov <[email protected]>
[ Upstream commit 8ef77766ba8694968ed4ba24311b4bacee14f235 ]
req->work and req->task_work are in a union, so io_req_task_queue() screws everything that was in work. De-union them for now.
[ 704.367253] BUG: unable to handle page fault for address: ffffffffaf7330d0 [ 704.367256] #PF: supervisor write access in kernel mode [ 704.367256] #PF: error_code(0x0003) - permissions violation [ 704.367261] CPU: 6 PID: 1654 Comm: io_wqe_worker-0 Tainted: G I 5.8.0-rc2-00038-ge28d0bdc4863-dirty #498 [ 704.367265] RIP: 0010:_raw_spin_lock+0x1e/0x36 ... [ 704.367276] __alloc_fd+0x35/0x150 [ 704.367279] __get_unused_fd_flags+0x25/0x30 [ 704.367280] io_openat2+0xcb/0x1b0 [ 704.367283] io_issue_sqe+0x36a/0x1320 [ 704.367294] io_wq_submit_work+0x58/0x160 [ 704.367295] io_worker_handle_work+0x2a3/0x430 [ 704.367296] io_wqe_worker+0x2a0/0x350 [ 704.367301] kthread+0x136/0x180 [ 704.367304] ret_from_fork+0x22/0x30
--- fs/io_uring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/io_uring.c +1 -1
@@ -669,12 +669,12 @@ struct io_kiocb {* restore the work, if needed. */ struct { -struct callback_head task_work;struct hlist_node hash_node;struct async_poll *apoll; };struct io_wq_work work; }; +struct callback_head task_work; };#define IO_PLUG_THRESHOLD 2
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 84/464 fs/btrfs: Add cond_resched() for try_release_extent_mapping() stalls
In reply to Greg Kroah-HartmanFrom: Paul E. McKenney <[email protected]>
[ Upstream commit 9f47eb5461aaeb6cb8696f9d11503ae90e4d5cb0 ]
Very large I/Os can cause the following RCU CPU stall warning:
RIP: 0010:rb_prev+0x8/0x50 Code: 49 89 c0 49 89 d1 48 89 c2 48 89 f8 e9 e5 fd ff ff 4c 89 48 10 c3 4c =
89 06 c3 4c 89 40 10 c3 0f 1f 00 48 8b 0f 48 39 cf 74 38 <48> 8b 47 10 48 85 c0 74 22 48 8b 50 08 48 85 d2 74 0c 48 89 d0 48
RSP: 0018:ffffc9002212bab0 EFLAGS: 00000287 ORIG_RAX: ffffffffffffff13
RAX: ffff888821f93630 RBX: ffff888821f93630 RCX: ffff888821f937e0
RDX: 0000000000000000 RSI: 0000000000102000 RDI: ffff888821f93630
RBP: 0000000000103000 R08: 000000000006c000 R09: 0000000000000238
R10: 0000000000102fff R11: ffffc9002212bac8 R12: 0000000000000001
R13: ffffffffffffffff R14: 0000000000102000 R15: ffff888821f937e0
__lookup_extent_mapping+0xa0/0x110 try_release_extent_mapping+0xdc/0x220 btrfs_releasepage+0x45/0x70 shrink_page_list+0xa39/0xb30 shrink_inactive_list+0x18f/0x3b0 shrink_lruvec+0x38e/0x6b0 shrink_node+0x14d/0x690 do_try_to_free_pages+0xc6/0x3e0 try_to_free_mem_cgroup_pages+0xe6/0x1e0 reclaim_high.constprop.73+0x87/0xc0 mem_cgroup_handle_over_high+0x66/0x150 exit_to_usermode_loop+0x82/0xd0 do_syscall_64+0xd4/0x100 entry_SYSCALL_64_after_hwframe+0x44/0xa9
On a PREEMPT=n kernel, the try_release_extent_mapping() function's "while" loop might run for a very long time on a large I/O. This commit therefore adds a cond_resched() to this loop, providing RCU any needed quiescent states.
--- fs/btrfs/extent_io.c | 2 ++ 1 file changed, 2 insertions(+)
fs/btrfs/extent_io.c +2 -0
@@ -4516,6 +4516,8 @@ int try_release_extent_mapping(struct page *page, gfp_t mask)/* once for us */ free_extent_map (em); + +cond_resched ();/* Allow large-extent preemption. */ } }return try_release_extent_state (tree, page, mask);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 58/464 iocost: Fix check condition of iocg abs_vdebt
In reply to Greg Kroah-HartmanFrom: Chengming Zhou <[email protected]>
[ Upstream commit d9012a59db54442d5b2fcfdfcded35cf566397d3 ]
We shouldn't skip iocg when its abs_vdebt is not zero.
--- block/blk-iocost.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
block/blk-iocost.c +1 -1
@@ -1370,7 +1370,7 @@ static void ioc_timer_fn(struct timer_list *timer)* should have woken up in the last period and expire idle iocgs. */ list_for_each_entry_safe (iocg, tiocg, &ioc->active_iocgs, active_list) { -if (!waitqueue_active (&iocg->waitq) && iocg->abs_vdebt && +if (!waitqueue_active (&iocg->waitq) && !iocg->abs_vdebt && !iocg_is_idle (iocg))continue ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 59/464 scripts/selinux/mdp: fix initial SID handling
In reply to Greg Kroah-HartmanFrom: Stephen Smalley <[email protected]>
[ Upstream commit 382c2b5d23b4245f1818f69286db334355488dc4 ]
commit e3e0b582c321 ("selinux: remove unused initial SIDs and improve handling") broke scripts/selinux/mdp since the unused initial SID names were removed and the corresponding generation of policy initial SID definitions by mdp was not updated accordingly. Fix it. With latest upstream checkpolicy it is no longer necessary to include the SID context definitions for the unused initial SIDs but retain them for compatibility with older checkpolicy.
--- scripts/selinux/mdp/mdp.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-)
scripts/selinux/mdp/mdp.c +18 -5
@@ -67,8 +67,14 @@ int main(int argc, char *argv[]) initial_sid_to_string_len =sizeof (initial_sid_to_string) /sizeof (char *);/* print out the sids */ -for (i =1 ; i < initial_sid_to_string_len; i++) -fprintf (fout,"sid %s\n" , initial_sid_to_string[i]); +for (i =1 ; i < initial_sid_to_string_len; i++) { +const char *name = initial_sid_to_string[i]; + +if (name) +fprintf (fout,"sid %s\n" , name); +else +fprintf (fout,"sid unused%d\n" , i); + }fprintf (fout,"\n" );/* print out the class permissions */
@@ -126,9 +132,16 @@ int main(int argc, char *argv[])#define OBJUSERROLETYPE "user_u:object_r:base_t"/* default sids */ -for (i =1 ; i < initial_sid_to_string_len; i++) -fprintf (fout,"sid %s " SUBJUSERROLETYPE "%s\n" , - initial_sid_to_string[i], mls ?":" SYSTEMLOW :"" ); +for (i =1 ; i < initial_sid_to_string_len; i++) { +const char *name = initial_sid_to_string[i]; + +if (name) +fprintf (fout,"sid %s " , name); +else +fprintf (fout,"sid unused%d\n" , i); +fprintf (fout,SUBJUSERROLETYPE "%s\n" , + mls ?":" SYSTEMLOW :"" ); + }fprintf (fout,"\n" );#define FS_USE (behavior, fstype) \
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 78/464 soc: qcom: rpmh-rsc: Set suppress_bind_attrs flag
In reply to Greg Kroah-HartmanFrom: Maulik Shah <[email protected]>
[ Upstream commit 1a53ce9ab4faeb841b33d62d23283dc76c0e7c5a ]
rpmh-rsc driver is fairly core to system and should not be removable once its probed. However it allows to unbind driver from sysfs using below command which results into a crash on sc7180.
echo 18200000.rsc > /sys/bus/platform/drivers/rpmh/unbind
Lets prevent unbind at runtime by setting suppress_bind_attrs flag.
--- drivers/soc/qcom/rpmh-rsc.c | 1 + 1 file changed, 1 insertion(+)
drivers/soc/qcom/rpmh-rsc.c +1 -0
@@ -1031,6 +1031,7 @@ static struct platform_driver rpmh_driver = { .driver = { .name = "rpmh", .of_match_table = rpmh_drv_match, + .suppress_bind_attrs = true, }, };
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 60/464 irqchip/ti-sci-inta: Fix return value about devm_ioremap_resource()
In reply to Greg Kroah-HartmanFrom: Tiezhu Yang <[email protected]>
[ Upstream commit 4b127a14cb1385dd355c7673d975258d5d668922 ]
When call function devm_ioremap_resource(), we should use IS_ERR() to check the return value and return PTR_ERR() if failed.
--- drivers/irqchip/irq-ti-sci-inta.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/irqchip/irq-ti-sci-inta.c +1 -1
@@ -572,7 +572,7 @@ static int ti_sci_inta_irq_domain_probe(struct platform_device *pdev) res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); inta->base =devm_ioremap_resource (dev, res);if (IS_ERR (inta->base)) -return -ENODEV ; +return PTR_ERR (inta->base); domain = irq_domain_add_linear(dev_of_node(dev), ti_sci_get_num_resources(inta->vint),
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 97/464 memory: samsung: exynos5422-dmc: Do not ignore return code of regmap_read()
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit c4f16e96d8fdd62ef12898fc0965c42093bed237 ]
Check for regmap_read() return code before using the read value in following write in exynos5_switch_timing_regs(). Pass reading error code to the callers.
This does not introduce proper error handling for such failed reads (and obviously regmap_write() error is still ignored) because the driver ignored this in all places. Therefor it only fixes reported issue while matching current driver coding style:
drivers/memory/samsung/exynos5422-dmc.c: In function 'exynos5_switch_timing_regs':
>> drivers/memory/samsung/exynos5422-dmc.c:216:6: warning: variable 'ret' set but not used [-Wunused-but-set-variable]
--- drivers/memory/samsung/exynos5422-dmc.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/memory/samsung/exynos5422-dmc.c +9 -3
@@ -270,12 +270,14 @@ static int find_target_freq_idx(struct exynos5_dmc *dmc,* This function switches between these banks according to the * currently used clock source. */ -static void exynos5_switch_timing_regs (struct exynos5_dmc *dmc,bool set) +static int exynos5_switch_timing_regs (struct exynos5_dmc *dmc,bool set) {unsigned int reg;int ret; ret =regmap_read (dmc->clk_regmap,CDREX_LPDDR3PHY_CON3 , ®); +if (ret) +return ret;if (set) reg |=EXYNOS5_TIMING_SET_SWI ;
@@ -283,6 +285,8 @@ static void exynos5_switch_timing_regs(struct exynos5_dmc *dmc, bool set) reg &= ~EXYNOS5_TIMING_SET_SWI ;regmap_write (dmc->clk_regmap,CDREX_LPDDR3PHY_CON3 , reg); + +return 0 ; }/**
@@ -516,7 +520,7 @@ exynos5_dmc_switch_to_bypass_configuration(struct exynos5_dmc *dmc,/* * Delays are long enough, so use them for the new coming clock. */ -exynos5_switch_timing_regs (dmc,USE_MX_MSPLL_TIMINGS ); + ret =exynos5_switch_timing_regs (dmc,USE_MX_MSPLL_TIMINGS );return ret; }
@@ -577,7 +581,9 @@ exynos5_dmc_change_freq_and_volt(struct exynos5_dmc *dmc,clk_set_rate (dmc->fout_bpll, target_rate); -exynos5_switch_timing_regs (dmc,USE_BPLL_TIMINGS ); + ret =exynos5_switch_timing_regs (dmc,USE_BPLL_TIMINGS ); +if (ret) + goto disable_clocks; ret =clk_set_parent (dmc->mout_mclk_cdrex, dmc->mout_bpll);if (ret)
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 98/464 drm/nouveau: fix reference count leak in nouveau_debugfs_strap_peek
In reply to Greg Kroah-HartmanFrom: Aditya Pakki <[email protected]>
[ Upstream commit 8f29432417b11039ef960ab18987c7d61b2b5396 ]
nouveau_debugfs_strap_peek() calls pm_runtime_get_sync() that increments the reference count. In case of failure, decrement the ref count before returning the error.
--- drivers/gpu/drm/nouveau/nouveau_debugfs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nouveau_debugfs.c +3 -1
@@ -54,8 +54,10 @@ nouveau_debugfs_strap_peek(struct seq_file *m, void *data)int ret; ret =pm_runtime_get_sync (drm->dev->dev); -if (ret <0 && ret != -EACCES ) +if (ret <0 && ret != -EACCES ) { +pm_runtime_put_autosuspend (drm->dev->dev);return ret; + }seq_printf (m,"0x%08x\n" ,nvif_rd32 (&drm->client.device.object,0x101000 ));
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 99/464 drm/nouveau: fix multiple instances of reference count leaks
In reply to Greg Kroah-HartmanFrom: Aditya Pakki <[email protected]>
[ Upstream commit 659fb5f154c3434c90a34586f3b7aa1c39cf6062 ]
On calling pm_runtime_get_sync() the reference count of the device is incremented. In case of failure, decrement the
ref count before returning the error.
--- drivers/gpu/drm/nouveau/nouveau_drm.c | 8 ++++++-- drivers/gpu/drm/nouveau/nouveau_gem.c | 4 +++- 2 files changed, 9 insertions(+), 3 deletions(-)
drivers/gpu/drm/nouveau/nouveau_drm.c +6 -2
@@ -1026,8 +1026,10 @@ nouveau_drm_open(struct drm_device *dev, struct drm_file *fpriv)/* need to bring up power immediately if opening device */ ret =pm_runtime_get_sync (dev->dev); -if (ret <0 && ret != -EACCES ) +if (ret <0 && ret != -EACCES ) { +pm_runtime_put_autosuspend (dev->dev);return ret; + }get_task_comm (tmpname, current);snprintf (name,sizeof (name),"%s[%d]" , tmpname,pid_nr (fpriv->pid));
@@ -1109,8 +1111,10 @@ nouveau_drm_ioctl(struct file *file, unsigned int cmd, unsigned long arg)long ret; ret =pm_runtime_get_sync (dev->dev); -if (ret <0 && ret != -EACCES ) +if (ret <0 && ret != -EACCES ) { +pm_runtime_put_autosuspend (dev->dev);return ret; + }switch (_IOC_NR (cmd) -DRM_COMMAND_BASE ) {case DRM_NOUVEAU_NVIF :
drivers/gpu/drm/nouveau/nouveau_gem.c +3 -1
@@ -45,8 +45,10 @@ nouveau_gem_object_del(struct drm_gem_object *gem)int ret; ret =pm_runtime_get_sync (dev); -if (WARN_ON (ret <0 && ret != -EACCES )) +if (WARN_ON (ret <0 && ret != -EACCES )) { +pm_runtime_put_autosuspend (dev);return ; + }if (gem->import_attach)drm_prime_gem_destroy (gem, nvbo->bo.sg);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 103/464 drm: msm: a6xx: fix gpu failure after system resume
In reply to Greg Kroah-HartmanFrom: Akhil P Oommen <[email protected]>
[ Upstream commit 57c0bd517c06b088106b0236ed604056c8e06da5 ]
On targets where GMU is available, GMU takes over the ownership of GX GDSC during its initialization. So, move the refcount-get on GX PD before we initialize the GMU. This ensures that nobody can collapse the GX GDSC once GMU owns the GX GDSC. This patch fixes some GMU OOB errors seen during GPU wake up during a system resume.
--- drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-)
drivers/gpu/drm/msm/adreno/a6xx_gmu.c +10 -8
@@ -854,10 +854,19 @@ int a6xx_gmu_resume(struct a6xx_gpu *a6xx_gpu)/* Turn on the resources */ pm_runtime_get_sync (gmu->dev); +/* +* "enable" the GX power domain which won't actually do anything but it +* will make sure that the refcounting is correct in case we need to +* bring down the GX after a GMU failure +*/ +if (!IS_ERR_OR_NULL (gmu->gxpd)) +pm_runtime_get_sync (gmu->gxpd); +/* Use a known rate to bring up the GMU */ clk_set_rate (gmu->core_clk,200000000 ); ret =clk_bulk_prepare_enable (gmu->nr_clocks, gmu->clocks);if (ret) { +pm_runtime_put (gmu->gxpd);pm_runtime_put (gmu->dev);return ret; }
@@ -903,19 +912,12 @@ int a6xx_gmu_resume(struct a6xx_gpu *a6xx_gpu)else a6xx_hfi_set_freq (gmu, gmu->current_perf_index); -/* -* "enable" the GX power domain which won't actually do anything but it -* will make sure that the refcounting is correct in case we need to -* bring down the GX after a GMU failure -*/ -if (!IS_ERR_OR_NULL (gmu->gxpd)) -pm_runtime_get (gmu->gxpd); - out:/* On failure, shut down the GMU to leave it in a good state */ if (ret) {disable_irq (gmu->gmu_irq);a6xx_rpmh_stop (gmu); +pm_runtime_put (gmu->gxpd);pm_runtime_put (gmu->dev); }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 87/464 crypto: aesni - Fix build with LLVM_IAS=1
In reply to Greg Kroah-HartmanFrom: Sedat Dilek <[email protected]>
[ Upstream commit 3347c8a079d67af21760a78cc5f2abbcf06d9571 ]
When building with LLVM_IAS=1 means using Clang's Integrated Assembly (IAS) from LLVM/Clang >= v10.0.1-rc1+ instead of GNU/as from GNU/binutils I see the following breakage in Debian/testing AMD64:
<instantiation>:15:74: error: too many positional arguments
PRECOMPUTE 8*3+8(%rsp), %xmm1, %xmm2, %xmm3, %xmm4, %xmm5, %xmm6, %xmm7,
^
arch/x86/crypto/aesni-intel_asm.S:1598:2: note: while in macro instantiation
GCM_INIT %r9, 8*3 +8(%rsp), 8*3 +16(%rsp), 8*3 +24(%rsp)
^
<instantiation>:47:2: error: unknown use of instruction mnemonic without a size suffix
GHASH_4_ENCRYPT_4_PARALLEL_dec %xmm9, %xmm10, %xmm11, %xmm12, %xmm13, %xmm14, %xmm0, %xmm1, %xmm2, %xmm3, %xmm4, %xmm5, %xmm6, %xmm7, %xmm8, enc ^arch/x86/crypto/aesni-intel_asm.S:1599:2: note: while in macro instantiation
GCM_ENC_DEC dec
^
<instantiation>:15:74: error: too many positional arguments
PRECOMPUTE 8*3+8(%rsp), %xmm1, %xmm2, %xmm3, %xmm4, %xmm5, %xmm6, %xmm7,
^
arch/x86/crypto/aesni-intel_asm.S:1686:2: note: while in macro instantiation
GCM_INIT %r9, 8*3 +8(%rsp), 8*3 +16(%rsp), 8*3 +24(%rsp)
^
<instantiation>:47:2: error: unknown use of instruction mnemonic without a size suffix
GHASH_4_ENCRYPT_4_PARALLEL_enc %xmm9, %xmm10, %xmm11, %xmm12, %xmm13, %xmm14, %xmm0, %xmm1, %xmm2, %xmm3, %xmm4, %xmm5, %xmm6, %xmm7, %xmm8, enc ^arch/x86/crypto/aesni-intel_asm.S:1687:2: note: while in macro instantiation
GCM_ENC_DEC enc
Craig Topper suggested me in ClangBuiltLinux issue #1050:
Quoted 7 lines
I think the "too many positional arguments" is because the parser isn't able to handle the trailing commas.
The "unknown use of instruction mnemonic" is because the macro was named
GHASH_4_ENCRYPT_4_PARALLEL_DECbut its being instantiated withGHASH_4_ENCRYPT_4_PARALLEL_decI guess gas ignores case on the macro instantiation, but llvm doesn't.
First, I removed the trailing comma in the PRECOMPUTE line.
Second, I substituted:
1. GHASH_4_ENCRYPT_4_PARALLEL_DEC -> GHASH_4_ENCRYPT_4_PARALLEL_dec
2. GHASH_4_ENCRYPT_4_PARALLEL_ENC -> GHASH_4_ENCRYPT_4_PARALLEL_enc
With these changes I was able to build with LLVM_IAS=1 and boot on bare metal.
I confirmed that this works with Linux-kernel v5.7.5 final.
NOTE: This patch is on top of Linux v5.7 final.
Thanks to Craig and especially Nick for double-checking and his comments.
--- arch/x86/crypto/aesni-intel_asm.S | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/x86/crypto/aesni-intel_asm.S +3 -3
@@ -266,7 +266,7 @@ ALL_F: .octa 0xffffffffffffffffffffffffffffffff PSHUFB_XMM %xmm2, %xmm0 movdqu %xmm0, CurCount(%arg2) # ctx_data.current_counter = iv - PRECOMPUTE \SUBKEY, %xmm1, %xmm2, %xmm3, %xmm4, %xmm5, %xmm6, %xmm7, + PRECOMPUTE \SUBKEY, %xmm1, %xmm2, %xmm3, %xmm4, %xmm5, %xmm6, %xmm7 movdqu HashKey(%arg2), %xmm13 CALC_AAD_HASH %xmm13, \AAD, \AADLEN, %xmm0, %xmm1, %xmm2, %xmm3, \
@@ -978,7 +978,7 @@ _initial_blocks_done\@: * arg1, %arg3, %arg4 are used as pointers only, not modified * %r11 is the data offset value */ -.macro GHASH_4_ENCRYPT_4_PARALLEL_ENC TMP1 TMP2 TMP3 TMP4 TMP5 \ +.macro GHASH_4_ENCRYPT_4_PARALLEL_enc TMP1 TMP2 TMP3 TMP4 TMP5 \ TMP6 XMM0 XMM1 XMM2 XMM3 XMM4 XMM5 XMM6 XMM7 XMM8 operation movdqa \XMM1, \XMM5
@@ -1186,7 +1186,7 @@ aes_loop_par_enc_done\@: * arg1, %arg3, %arg4 are used as pointers only, not modified * %r11 is the data offset value */ -.macro GHASH_4_ENCRYPT_4_PARALLEL_DEC TMP1 TMP2 TMP3 TMP4 TMP5 \ +.macro GHASH_4_ENCRYPT_4_PARALLEL_dec TMP1 TMP2 TMP3 TMP4 TMP5 \ TMP6 XMM0 XMM1 XMM2 XMM3 XMM4 XMM5 XMM6 XMM7 XMM8 operation movdqa \XMM1, \XMM5
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 56/464 spi: rockchip: Fix error in SPI slave pio read
In reply to Greg Kroah-HartmanFrom: Jon Lin <[email protected]>
[ Upstream commit 4294e4accf8d695ea5605f6b189008b692e3e82c ]
The RXFLR is possible larger than rx_left in Rockchip SPI, fix it.
--- drivers/spi/spi-rockchip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spi-rockchip.c +1 -1
@@ -288,7 +288,7 @@ static void rockchip_spi_pio_writer(struct rockchip_spi *rs)static void rockchip_spi_pio_reader (struct rockchip_spi *rs) {u32 words =readl_relaxed (rs->regs +ROCKCHIP_SPI_RXFLR ); -u32 rx_left = rs->rx_left - words; +u32 rx_left = (rs->rx_left > words) ? rs->rx_left - words :0 ;/* the hardware doesn't allow us to change fifo threshold * level while spi is enabled, so instead make sure to leave
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 104/464 drm/msm: Fix a null pointer access in msm_gem_shrinker_count()
In reply to Greg Kroah-HartmanFrom: Akhil P Oommen <[email protected]>
[ Upstream commit 3cbdc8d8b7f39a7af3ea7b8dfa75caaebfda4e56 ]
Adding an msm_gem_object object to the inactive_list before completing its initialization is a bad idea because shrinker may pick it up from the inactive_list. Fix this by making sure that the initialization is complete before moving the msm_obj object to the inactive list.
This patch fixes the below error:
[10027.553044] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000068 [10027.573305] Mem abort info: [10027.590160] ESR = 0x96000006 [10027.597905] EC = 0x25: DABT (current EL), IL = 32 bits [10027.614430] SET = 0, FnV = 0 [10027.624427] EA = 0, S1PTW = 0 [10027.632722] Data abort info: [10027.638039] ISV = 0, ISS = 0x00000006 [10027.647459] CM = 0, WnR = 0 [10027.654345] user pgtable: 4k pages, 39-bit VAs, pgdp=00000001e3a6a000 [10027.672681] [0000000000000068] pgd=0000000198c31003, pud=0000000198c31003, pmd=0000000000000000 [10027.693900] Internal error: Oops: 96000006 [#1] PREEMPT SMP [10027.738261] CPU: 3 PID: 214 Comm: kswapd0 Tainted: G S 5.4.40 #1 [10027.745766] Hardware name: Qualcomm Technologies, Inc. SC7180 IDP (DT) [10027.752472] pstate: 80c00009 (Nzcv daif +PAN +UAO) [10027.757409] pc : mutex_is_locked+0x14/0x2c [10027.761626] lr : msm_gem_shrinker_count+0x70/0xec [10027.766454] sp : ffffffc011323ad0 [10027.769867] x29: ffffffc011323ad0 x28: ffffffe677e4b878 [10027.775324] x27: 0000000000000cc0 x26: 0000000000000000 [10027.780783] x25: ffffff817114a708 x24: 0000000000000008 [10027.786242] x23: ffffff8023ab7170 x22: 0000000000000001 [10027.791701] x21: ffffff817114a080 x20: 0000000000000119 [10027.797160] x19: 0000000000000068 x18: 00000000000003bc [10027.802621] x17: 0000000004a34210 x16: 00000000000000c0 [10027.808083] x15: 0000000000000000 x14: 0000000000000000 [10027.813542] x13: ffffffe677e0a3c0 x12: 0000000000000000 [10027.819000] x11: 0000000000000000 x10: ffffff8174b94340 [10027.824461] x9 : 0000000000000000 x8 : 0000000000000000 [10027.829919] x7 : 00000000000001fc x6 : ffffffc011323c88 [10027.835373] x5 : 0000000000000001 x4 : ffffffc011323d80 [10027.840832] x3 : ffffffff0477b348 x2 : 0000000000000000 [10027.846290] x1 : ffffffc011323b68 x0 : 0000000000000068 [10027.851748] Call trace: [10027.854264] mutex_is_locked+0x14/0x2c [10027.858121] msm_gem_shrinker_count+0x70/0xec [10027.862603] shrink_slab+0xc0/0x4b4 [10027.866187] shrink_node+0x4a8/0x818 [10027.869860] kswapd+0x624/0x890 [10027.873097] kthread+0x11c/0x12c [10027.876424] ret_from_fork+0x10/0x18 [10027.880102] Code: f9000bf3 910003fd aa0003f3 d503201f (f9400268) [10027.886362] ---[ end trace df5849a1a3543251 ]--- [10027.891518] Kernel panic - not syncing: Fatal exception
--- drivers/gpu/drm/msm/msm_gem.c | 36 ++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-)
drivers/gpu/drm/msm/msm_gem.c +21 -15
@@ -994,10 +994,8 @@ int msm_gem_new_handle(struct drm_device *dev, struct drm_file *file,static int msm_gem_new_impl (struct drm_device *dev,uint32_t size,uint32_t flags, -struct drm_gem_object **obj, -bool struct_mutex_locked) +struct drm_gem_object **obj) { -struct msm_drm_private *priv = dev->dev_private;struct msm_gem_object *msm_obj;switch (flags &MSM_BO_CACHE_MASK ) {
@@ -1023,15 +1021,6 @@ static int msm_gem_new_impl(struct drm_device *dev,INIT_LIST_HEAD (&msm_obj->submit_entry);INIT_LIST_HEAD (&msm_obj->vmas); -if (struct_mutex_locked) { -WARN_ON (!mutex_is_locked (&dev->struct_mutex)); -list_add_tail (&msm_obj->mm_list, &priv->inactive_list); - }else { -mutex_lock (&dev->struct_mutex); -list_add_tail (&msm_obj->mm_list, &priv->inactive_list); -mutex_unlock (&dev->struct_mutex); - } - *obj = &msm_obj->base;return 0 ;
@@ -1041,6 +1030,7 @@ static struct drm_gem_object *_msm_gem_new(struct drm_device *dev, uint32_t size, uint32_t flags, bool struct_mutex_locked) { struct msm_drm_private *priv = dev->dev_private; +struct msm_gem_object *msm_obj;struct drm_gem_object *obj =NULL ;bool use_vram = false;int ret;
@@ -1061,14 +1051,15 @@ static struct drm_gem_object *_msm_gem_new(struct drm_device *dev,if (size ==0 )return ERR_PTR (-EINVAL ); - ret =msm_gem_new_impl (dev, size, flags, &obj, struct_mutex_locked); + ret =msm_gem_new_impl (dev, size, flags, &obj);if (ret) goto fail; + msm_obj =to_msm_bo (obj); +if (use_vram) {struct msm_gem_vma *vma;struct page **pages; -struct msm_gem_object *msm_obj =to_msm_bo (obj);mutex_lock (&msm_obj->lock);
@@ -1103,6 +1094,15 @@ static struct drm_gem_object *_msm_gem_new(struct drm_device *dev,mapping_set_gfp_mask (obj->filp->f_mapping,GFP_HIGHUSER ); } +if (struct_mutex_locked) { +WARN_ON (!mutex_is_locked (&dev->struct_mutex)); +list_add_tail (&msm_obj->mm_list, &priv->inactive_list); + }else { +mutex_lock (&dev->struct_mutex); +list_add_tail (&msm_obj->mm_list, &priv->inactive_list); +mutex_unlock (&dev->struct_mutex); + } +return obj; fail:
@@ -1125,6 +1125,7 @@ struct drm_gem_object *msm_gem_new(struct drm_device *dev,struct drm_gem_object *msm_gem_import (struct drm_device *dev,struct dma_buf *dmabuf,struct sg_table *sgt) { +struct msm_drm_private *priv = dev->dev_private;struct msm_gem_object *msm_obj;struct drm_gem_object *obj;uint32_t size;
@@ -1138,7 +1139,7 @@ struct drm_gem_object *msm_gem_import(struct drm_device *dev, size =PAGE_ALIGN (dmabuf->size); - ret =msm_gem_new_impl (dev, size,MSM_BO_WC , &obj, false); + ret =msm_gem_new_impl (dev, size,MSM_BO_WC , &obj);if (ret) goto fail;
@@ -1163,6 +1164,11 @@ struct drm_gem_object *msm_gem_import(struct drm_device *dev, }mutex_unlock (&msm_obj->lock); + +mutex_lock (&dev->struct_mutex); +list_add_tail (&msm_obj->mm_list, &priv->inactive_list); +mutex_unlock (&dev->struct_mutex); +return obj; fail:
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 109/464 mm/mmap.c: Add cond_resched() for exit_mmap() CPU stalls
In reply to Greg Kroah-HartmanFrom: Paul E. McKenney <[email protected]>
[ Upstream commit 0a3b3c253a1eb2c7fe7f34086d46660c909abeb3 ]
A large process running on a heavily loaded system can encounter the following RCU CPU stall warning:
rcu: INFO: rcu_sched self-detected stall on CPU rcu: 3-....: (20998 ticks this GP) idle=4ea/1/0x4000000000000002 softirq=556558/556558 fqs=5190 (t=21013 jiffies g=1005461 q=132576) NMI backtrace for cpu 3 CPU: 3 PID: 501900 Comm: aio-free-ring-w Kdump: loaded Not tainted 5.2.9-108_fbk12_rc3_3858_gb83b75af7909 #1 Hardware name: Wiwynn HoneyBadger/PantherPlus, BIOS HBM6.71 02/03/2016 Call Trace: <IRQ> dump_stack+0x46/0x60 nmi_cpu_backtrace.cold.3+0x13/0x50 ? lapic_can_unplug_cpu.cold.27+0x34/0x34 nmi_trigger_cpumask_backtrace+0xba/0xca rcu_dump_cpu_stacks+0x99/0xc7 rcu_sched_clock_irq.cold.87+0x1aa/0x397 ? tick_sched_do_timer+0x60/0x60 update_process_times+0x28/0x60 tick_sched_timer+0x37/0x70 __hrtimer_run_queues+0xfe/0x270 hrtimer_interrupt+0xf4/0x210 smp_apic_timer_interrupt+0x5e/0x120 apic_timer_interrupt+0xf/0x20 </IRQ> RIP: 0010:kmem_cache_free+0x223/0x300 Code: 88 00 00 00 0f 85 ca 00 00 00 41 8b 55 18 31 f6 f7 da 41 f6 45 0a 02 40 0f 94 c6 83 c6 05 9c 41 5e fa e8 a0 a7 01 00 41 56 9d <49> 8b 47 08 a8 03 0f 85 87 00 00 00 65 48 ff 08 e9 3d fe ff ff 65 RSP: 0018:ffffc9000e8e3da8 EFLAGS: 00000206 ORIG_RAX: ffffffffffffff13 RAX: 0000000000020000 RBX: ffff88861b9de960 RCX: 0000000000000030 RDX: fffffffffffe41e8 RSI: 000060777fe3a100 RDI: 000000000001be18 RBP: ffffea00186e7780 R08: ffffffffffffffff R09: ffffffffffffffff R10: ffff88861b9dea28 R11: ffff88887ffde000 R12: ffffffff81230a1f R13: ffff888854684dc0 R14: 0000000000000206 R15: ffff8888547dbc00 ? remove_vma+0x4f/0x60 remove_vma+0x4f/0x60 exit_mmap+0xd6/0x160 mmput+0x4a/0x110 do_exit+0x278/0xae0 ? syscall_trace_enter+0x1d3/0x2b0 ? handle_mm_fault+0xaa/0x1c0 do_group_exit+0x3a/0xa0 __x64_sys_exit_group+0x14/0x20 do_syscall_64+0x42/0x100 entry_SYSCALL_64_after_hwframe+0x44/0xa9
And on a PREEMPT=n kernel, the "while (vma)" loop in exit_mmap() can run for a very long time given a large process. This commit therefore adds a cond_resched() to this loop, providing RCU any needed quiescent states.
--- mm/mmap.c | 1 + 1 file changed, 1 insertion(+)
mm/mmap.c +1 -0
@@ -3171,6 +3171,7 @@ void exit_mmap(struct mm_struct *mm)if (vma->vm_flags &VM_ACCOUNT ) nr_accounted +=vma_pages (vma); vma =remove_vma (vma); +cond_resched (); }vm_unacct_memory (nr_accounted); }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 108/464 irqchip/irq-mtk-sysirq: Replace spinlock with raw_spinlock
In reply to Greg Kroah-HartmanFrom: Bartosz Golaszewski <[email protected]>
[ Upstream commit 6eeb997ab5075e770a002c51351fa4ec2c6b5c39 ]
This driver may take a regular spinlock when a raw spinlock (irq_desc->lock) is already taken which results in the following lockdep splat:
=============================
[ BUG: Invalid wait context ]
5.7.0-rc7 #1 Not tainted
-----------------------------
swapper/0/0 is trying to lock:ffffff800303b798 (&chip_data->lock){....}-{3:3}, at: mtk_sysirq_set_type+0x48/0xc0 other info that might help us debug this:
context-{5:5}
2 locks held by swapper/0/0:
#0: ffffff800302ee68 (&desc->request_mutex){....}-{4:4}, at: __setup_irq+0xc4/0x8a0 #1: ffffff800302ecf0 (&irq_desc_lock_class){....}-{2:2}, at: __setup_irq+0xe4/0x8a0
stack backtrace: CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.7.0-rc7 #1 Hardware name: Pumpkin MT8516 (DT) Call trace: dump_backtrace+0x0/0x180 show_stack+0x14/0x20 dump_stack+0xd0/0x118 __lock_acquire+0x8c8/0x2270 lock_acquire+0xf8/0x470 _raw_spin_lock_irqsave+0x50/0x78 mtk_sysirq_set_type+0x48/0xc0 __irq_set_trigger+0x58/0x170 __setup_irq+0x420/0x8a0 request_threaded_irq+0xd8/0x190 timer_of_init+0x1e8/0x2c4 mtk_gpt_init+0x5c/0x1dc timer_probe+0x74/0xf4 time_init+0x14/0x44 start_kernel+0x394/0x4f0
Replace the spinlock_t with raw_spinlock_t to avoid this warning.
--- drivers/irqchip/irq-mtk-sysirq.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/irqchip/irq-mtk-sysirq.c +4 -4
@@ -15,7 +15,7 @@#include <linux/spinlock.h> struct mtk_sysirq_chip_data { -spinlock_t lock; +raw_spinlock_t lock;u32 nr_intpol_bases;void __iomem **intpol_bases;u32 *intpol_words;
@@ -37,7 +37,7 @@ static int mtk_sysirq_set_type(struct irq_data *data, unsigned int type) reg_index = chip_data->which_word[hwirq]; offset = hwirq &0x1f ; -spin_lock_irqsave (&chip_data->lock, flags); +raw_spin_lock_irqsave (&chip_data->lock, flags); value =readl_relaxed (base + reg_index *4 );if (type ==IRQ_TYPE_LEVEL_LOW || type ==IRQ_TYPE_EDGE_FALLING ) {if (type ==IRQ_TYPE_LEVEL_LOW )
@@ -53,7 +53,7 @@ static int mtk_sysirq_set_type(struct irq_data *data, unsigned int type) data = data->parent_data; ret = data->chip->irq_set_type (data, type); -spin_unlock_irqrestore (&chip_data->lock, flags); +raw_spin_unlock_irqrestore (&chip_data->lock, flags);return ret; }
@@ -212,7 +212,7 @@ static int __init mtk_sysirq_of_init(struct device_node *node, ret = -ENOMEM ; goto out_free_which_word; } -spin_lock_init (&chip_data->lock); +raw_spin_lock_init (&chip_data->lock);return 0 ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 107/464 net: phy: mscc: restore the base page in vsc8514/8584_config_init
In reply to Greg Kroah-HartmanFrom: Antoine Tenart <[email protected]>
[ Upstream commit 6119dda34e5d0821959e37641b287576826b6378 ]
In the vsc8584_config_init and vsc8514_config_init, the base page is set to 'GPIO', configuration is done, and the page is never explicitly restored to the standard page. No bug was triggered as it turns out helpers called in those config_init functions do modify the base page, and set it back to standard. But that is dangerous and any modification to those functions would introduce bugs. This patch fixes this, to improve maintenance, by restoring the base page to 'standard' once 'GPIO' accesses are completed.
--- drivers/net/phy/mscc/mscc_main.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/net/phy/mscc/mscc_main.c +9 -0
@@ -1379,6 +1379,11 @@ static int vsc8584_config_init(struct phy_device *phydev)if (ret) goto err; + ret =phy_base_write (phydev,MSCC_EXT_PAGE_ACCESS , +MSCC_PHY_PAGE_STANDARD ); +if (ret) + goto err; +if (!phy_interface_is_rgmii (phydev)) { val =PROC_CMD_MCB_ACCESS_MAC_CONF |PROC_CMD_RST_CONF_PORT |PROC_CMD_READ_MOD_WRITE_PORT ;
@@ -1751,7 +1756,11 @@ static int vsc8514_config_init(struct phy_device *phydev) val &= ~MAC_CFG_MASK ; val |=MAC_CFG_QSGMII ; ret =phy_base_write (phydev,MSCC_PHY_MAC_CFG_FASTLINK , val); +if (ret) + goto err; + ret =phy_base_write (phydev,MSCC_EXT_PAGE_ACCESS , +MSCC_PHY_PAGE_STANDARD );if (ret) goto err;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 57/464 ARM: socfpga: PM: add missing put_device() call in socfpga_setup_ocram_self_refresh()
In reply to Greg Kroah-HartmanFrom: Yu Kuai <[email protected]>
[ Upstream commit 3ad7b4e8f89d6bcc9887ca701cf2745a6aedb1a0 ]
if of_find_device_by_node() succeed, socfpga_setup_ocram_self_refresh doesn't have a corresponding put_device(). Thus add a jump target to fix the exception handling for this function implementation.
--- arch/arm/mach-socfpga/pm.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
arch/arm/mach-socfpga/pm.c +5 -3
@@ -49,14 +49,14 @@ static int socfpga_setup_ocram_self_refresh(void)if (!ocram_pool) {pr_warn ("%s: ocram pool unavailable!\n" , __func__); ret = -ENODEV ; - goto put_node; + goto put_device; } ocram_base =gen_pool_alloc (ocram_pool, socfpga_sdram_self_refresh_sz);if (!ocram_base) {pr_warn ("%s: unable to alloc ocram!\n" , __func__); ret = -ENOMEM ; - goto put_node; + goto put_device; } ocram_pbase =gen_pool_virt_to_phys (ocram_pool, ocram_base);
@@ -67,7 +67,7 @@ static int socfpga_setup_ocram_self_refresh(void)if (!suspend_ocram_base) {pr_warn ("%s: __arm_ioremap_exec failed!\n" , __func__); ret = -ENOMEM ; - goto put_node; + goto put_device; }/* Copy the code that puts DDR in self refresh to ocram */
@@ -81,6 +81,8 @@ static int socfpga_setup_ocram_self_refresh(void)if (!socfpga_sdram_self_refresh_in_ocram) ret = -EFAULT ; +put_device: +put_device (&pdev->dev); put_node:of_node_put (np);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 113/464 drm/amdgpu/display: properly guard the calls to swSMU functions
In reply to Greg Kroah-HartmanFrom: Alex Deucher <[email protected]>
[ Upstream commit 4072327a2622af8688b88f5cd0a472136d3bf33d ]
It's only applicable on newer asics. We could end up here when using DC on older asics like SI or KV.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_pp_smu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_pp_smu.c +2 -2
@@ -106,7 +106,7 @@ bool dm_pp_apply_display_requirements( adev->powerplay.pp_funcs->display_configuration_change ( adev->powerplay.pp_handle, &adev->pm.pm_display_cfg); - else + else if (adev->smu.ppt_funcs) smu_display_configuration_change(smu, &adev->pm.pm_display_cfg);
@@ -592,7 +592,7 @@ void pp_rv_set_wm_ranges(struct pp_smu *pp,if (pp_funcs && pp_funcs->set_watermarks_for_clocks_ranges) pp_funcs->set_watermarks_for_clocks_ranges (pp_handle, &wm_with_clock_ranges); -else +else if (adev->smu.ppt_funcs)smu_set_watermarks_for_clock_ranges (&adev->smu, &wm_with_clock_ranges); }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 88/464 video: fbdev: savage: fix memory leak on error handling path in probe
In reply to Greg Kroah-HartmanFrom: Evgeny Novikov <[email protected]>
[ Upstream commit e8d35898a78e34fc854ed9680bc3f9caedab08cd ]
savagefb_probe() calls savage_init_fb_info() that can successfully allocate memory for info->pixmap.addr but then fail when fb_alloc_cmap() fails. savagefb_probe() goes to label failed_init and does not free allocated memory. It is not valid to go to label failed_mmio since savage_init_fb_info() can fail during memory allocation as well. So, the patch free allocated memory on the error handling path in savage_init_fb_info() itself.
Found by Linux Driver Verification project (linuxtesting.org).
--- drivers/video/fbdev/savage/savagefb_driver.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/video/fbdev/savage/savagefb_driver.c +2 -0
@@ -2157,6 +2157,8 @@ static int savage_init_fb_info(struct fb_info *info, struct pci_dev *dev, info->flags |=FBINFO_HWACCEL_COPYAREA |FBINFO_HWACCEL_FILLRECT |FBINFO_HWACCEL_IMAGEBLIT ; + else + kfree(info->pixmap.addr); }#endif return err;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 115/464 drm/amd/powerplay: fix compile error with ARCH=arc
In reply to Greg Kroah-HartmanFrom: Evan Quan <[email protected]>
[ Upstream commit 9822ba2ead1baa3de4860ad9472f652c4cc78c9c ]
Fix the compile error below:drivers/gpu/drm/amd/amdgpu/../powerplay/smu_v11_0.c: In function 'smu_v11_0_init_microcode':
Quoted 1 line
Quoted 1 line
arch/arc/include/asm/bug.h:22:2: error: implicit declaration of function 'pr_warn'; did you mean 'pci_warn'? [-Werror=implicit-function-declaration]
22 | pr_warn("BUG: failure at %s:%d/%s()!\n", __FILE__, __LINE__, __func__); \
| ^~~~~~~
drivers/gpu/drm/amd/amdgpu/../powerplay/smu_v11_0.c:176:3: note: in expansion of macro 'BUG'
176 | BUG();--- drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/smu_v11_0.c +2 -1
@@ -164,7 +164,8 @@ int smu_v11_0_init_microcode(struct smu_context *smu) chip_name ="navi12" ;break ;default : -BUG (); +dev_err (adev->dev,"Unsupported ASIC type %d\n" , adev->asic_type); +return -EINVAL ; }snprintf (fw_name,sizeof (fw_name),"amdgpu/%s_smc.bin" , chip_name);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 89/464 video: fbdev: neofb: fix memory leak in neo_scan_monitor()
In reply to Greg Kroah-HartmanFrom: Evgeny Novikov <[email protected]>
[ Upstream commit edcb3895a751c762a18d25c8d9846ce9759ed7e1 ]
neofb_probe() calls neo_scan_monitor() that can successfully allocate a memory for info->monspecs.modedb and proceed to case 0x03. There it does not free the memory and returns -1. neofb_probe() goes to label err_scan_monitor, thus, it does not free this memory through calling fb_destroy_modedb() as well. We can not go to label err_init_hw since neo_scan_monitor() can fail during memory allocation. So, the patch frees the memory directly for case 0x03.
Found by Linux Driver Verification project (linuxtesting.org).
--- drivers/video/fbdev/neofb.c | 1 + 1 file changed, 1 insertion(+)
drivers/video/fbdev/neofb.c +1 -0
@@ -1819,6 +1819,7 @@ static int neo_scan_monitor(struct fb_info *info)#else printk (KERN_ERR "neofb: Only 640x480, 800x600/480 and 1024x768 panels are currently supported\n" ); +kfree (info->monspecs.modedb);return -1 ;#endif default :
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 92/464 rtw88: 8822ce: add support for device ID 0xc82f
In reply to Greg Kroah-HartmanFrom: Aaron Ma <[email protected]>
[ Upstream commit 7d428b1c9ffc9ddcdd64c6955836bbb17a233ef3 ]
New device ID 0xc82f found on Lenovo ThinkCenter.
Tested it with c822 driver, works good.
PCI id:
03:00.0 Network controller [0280]: Realtek Semiconductor Co., Ltd. Device [10ec:c82f]
Subsystem: Lenovo Device [17aa:c02f]
--- drivers/net/wireless/realtek/rtw88/rtw8822ce.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/wireless/realtek/rtw88/rtw8822ce.c +4 -0
@@ -11,6 +11,10 @@ static const struct pci_device_id rtw_8822ce_id_table[] = { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0xC822), .driver_data = (kernel_ulong_t)&rtw8822c_hw_spec }, + { + PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0xC82F), + .driver_data = (kernel_ulong_t)&rtw8822c_hw_spec + }, {} };MODULE_DEVICE_TABLE (pci, rtw_8822ce_id_table);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 94/464 arm64: dts: hisilicon: hikey: fixes to comply with adi, adv7533 DT binding
In reply to Greg Kroah-HartmanFrom: Ricardo Cañuelo <[email protected]>
[ Upstream commit bbe28fc3cbabbef781bcdf847615d52ce2e26e42 ]
hi3660-hikey960.dts:
Define a 'ports' node for 'adv7533: adv7533@39' and the 'adi,dsi-lanes' property to make it compliant with the adi,adv7533 DT binding.
This fills the requirements to meet the binding requirements, remote endpoints are not defined.
hi6220-hikey.dts:
Change property name s/pd-gpio/pd-gpios, gpio properties should be plural. This is just a cosmetic change.
--- arch/arm64/boot/dts/hisilicon/hi3660-hikey960.dts | 11 +++++++++++ arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/hisilicon/hi3660-hikey960.dts +11 -0
@@ -530,6 +530,17 @@ adv7533: adv7533@39 { status = "ok"; compatible = "adi,adv7533"; reg = <0x39>; + adi,dsi-lanes = <4>; + ports { + #address-cells = <1>; + #size-cells = <0>; + port@0 { + reg = <0>; + }; + port@1 { + reg = <1>; + }; + }; }; };
arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts +1 -1
@@ -516,7 +516,7 @@ adv7533: adv7533@39 { reg = <0x39>; interrupt-parent = <&gpio1>; interrupts = <1 2>; - pd-gpio = <&gpio0 4 0>; + pd-gpios = <&gpio0 4 0>; adi,dsi-lanes = <4>; #sound-dai-cells = <0>;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 102/464 usb: mtu3: clear dual mode of u3port when disable device
In reply to Greg Kroah-HartmanFrom: Chunfeng Yun <[email protected]>
[ Upstream commit f1e51e99ed498d4aa9ae5df28e43d558ea627781 ]
If not clear u3port's dual mode when disable device, the IP will fail to enter sleep mode when suspend.
--- drivers/usb/mtu3/mtu3_core.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/usb/mtu3/mtu3_core.c +5 -1
@@ -131,8 +131,12 @@ static void mtu3_device_disable(struct mtu3 *mtu)mtu3_setbits (ibase,SSUSB_U2_CTRL (0 ),SSUSB_U2_PORT_DIS |SSUSB_U2_PORT_PDN ); -if (mtu->ssusb->dr_mode ==USB_DR_MODE_OTG ) +if (mtu->ssusb->dr_mode ==USB_DR_MODE_OTG ) {mtu3_clrbits (ibase,SSUSB_U2_CTRL (0 ),SSUSB_U2_PORT_OTG_SEL ); +if (mtu->is_u3_ip) +mtu3_clrbits (ibase,SSUSB_U3_CTRL (0 ), +SSUSB_U3_PORT_DUAL_MODE ); + }mtu3_setbits (ibase,U3D_SSUSB_IP_PW_CTRL2 ,SSUSB_IP_DEV_PDN ); }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 138/464 crypto: caam - silence .setkey in case of bad key length
In reply to Greg Kroah-HartmanFrom: Horia Geantă <[email protected]>
[ Upstream commit da6a66853a381864f4b040832cf11f0dbba0a097 ]
In case of bad key length, driver emits "key size mismatch" messages, but only for xts(aes) algorithms.
Reduce verbosity by making them visible only when debugging. This way crypto fuzz testing log cleans up a bit.
--- drivers/crypto/caam/caamalg.c | 2 +- drivers/crypto/caam/caamalg_qi.c | 2 +- drivers/crypto/caam/caamalg_qi2.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
drivers/crypto/caam/caamalg.c +1 -1
@@ -838,7 +838,7 @@ static int xts_skcipher_setkey(struct crypto_skcipher *skcipher, const u8 *key,u32 *desc;if (keylen !=2 *AES_MIN_KEY_SIZE && keylen !=2 *AES_MAX_KEY_SIZE ) { -dev_err (jrdev,"key size mismatch\n" ); +dev_dbg (jrdev,"key size mismatch\n" );return -EINVAL ; }
drivers/crypto/caam/caamalg_qi.c +1 -1
@@ -728,7 +728,7 @@ static int xts_skcipher_setkey(struct crypto_skcipher *skcipher, const u8 *key,int ret =0 ;if (keylen !=2 *AES_MIN_KEY_SIZE && keylen !=2 *AES_MAX_KEY_SIZE ) { -dev_err (jrdev,"key size mismatch\n" ); +dev_dbg (jrdev,"key size mismatch\n" );return -EINVAL ; }
drivers/crypto/caam/caamalg_qi2.c +1 -1
@@ -1058,7 +1058,7 @@ static int xts_skcipher_setkey(struct crypto_skcipher *skcipher, const u8 *key,u32 *desc;if (keylen !=2 *AES_MIN_KEY_SIZE && keylen !=2 *AES_MAX_KEY_SIZE ) { -dev_err (dev,"key size mismatch\n" ); +dev_dbg (dev,"key size mismatch\n" );return -EINVAL ; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 111/464 drm/amdgpu/debugfs: fix ref count leak when pm_runtime_get_sync fails
In reply to Greg Kroah-HartmanFrom: Alex Deucher <[email protected]>
[ Upstream commit 9eee152aab56d374edb9ad21b3db05f5cdda2fe6 ]
The call to pm_runtime_get_sync increments the counter even in case of failure, leading to incorrect ref count.
In case of failure, decrement the ref count before returning.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 95 +++++++++++++++------ 1 file changed, 70 insertions(+), 25 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +70 -25
@@ -223,12 +223,16 @@ static int amdgpu_debugfs_process_reg_op(bool read, struct file *f, *pos &= (1UL <<22 ) -1 ; r =pm_runtime_get_sync (adev->ddev->dev); -if (r <0 ) +if (r <0 ) { +pm_runtime_put_autosuspend (adev->ddev->dev);return r; + } r =amdgpu_virt_enable_access_debugfs (adev); -if (r <0 ) +if (r <0 ) { +pm_runtime_put_autosuspend (adev->ddev->dev);return r; + }if (use_bank) { if ((sh_bank != 0xFFFFFFFF && sh_bank >= adev->gfx.config.max_sh_per_se) ||
@@ -332,12 +336,16 @@ static ssize_t amdgpu_debugfs_regs_pcie_read(struct file *f, char __user *buf,return -EINVAL ; r =pm_runtime_get_sync (adev->ddev->dev); -if (r <0 ) +if (r <0 ) { +pm_runtime_put_autosuspend (adev->ddev->dev);return r; + } r =amdgpu_virt_enable_access_debugfs (adev); -if (r <0 ) +if (r <0 ) { +pm_runtime_put_autosuspend (adev->ddev->dev);return r; + }while (size) {uint32_t value;
@@ -387,12 +395,16 @@ static ssize_t amdgpu_debugfs_regs_pcie_write(struct file *f, const char __userreturn -EINVAL ; r =pm_runtime_get_sync (adev->ddev->dev); -if (r <0 ) +if (r <0 ) { +pm_runtime_put_autosuspend (adev->ddev->dev);return r; + } r =amdgpu_virt_enable_access_debugfs (adev); -if (r <0 ) +if (r <0 ) { +pm_runtime_put_autosuspend (adev->ddev->dev);return r; + }while (size) {uint32_t value;
@@ -443,12 +455,16 @@ static ssize_t amdgpu_debugfs_regs_didt_read(struct file *f, char __user *buf,return -EINVAL ; r =pm_runtime_get_sync (adev->ddev->dev); -if (r <0 ) +if (r <0 ) { +pm_runtime_put_autosuspend (adev->ddev->dev);return r; + } r =amdgpu_virt_enable_access_debugfs (adev); -if (r <0 ) +if (r <0 ) { +pm_runtime_put_autosuspend (adev->ddev->dev);return r; + }while (size) {uint32_t value;
@@ -498,12 +514,16 @@ static ssize_t amdgpu_debugfs_regs_didt_write(struct file *f, const char __userreturn -EINVAL ; r =pm_runtime_get_sync (adev->ddev->dev); -if (r <0 ) +if (r <0 ) { +pm_runtime_put_autosuspend (adev->ddev->dev);return r; + } r =amdgpu_virt_enable_access_debugfs (adev); -if (r <0 ) +if (r <0 ) { +pm_runtime_put_autosuspend (adev->ddev->dev);return r; + }while (size) {uint32_t value;
@@ -554,12 +574,16 @@ static ssize_t amdgpu_debugfs_regs_smc_read(struct file *f, char __user *buf,return -EINVAL ; r =pm_runtime_get_sync (adev->ddev->dev); -if (r <0 ) +if (r <0 ) { +pm_runtime_put_autosuspend (adev->ddev->dev);return r; + } r =amdgpu_virt_enable_access_debugfs (adev); -if (r <0 ) +if (r <0 ) { +pm_runtime_put_autosuspend (adev->ddev->dev);return r; + }while (size) {uint32_t value;
@@ -609,12 +633,16 @@ static ssize_t amdgpu_debugfs_regs_smc_write(struct file *f, const char __user *return -EINVAL ; r =pm_runtime_get_sync (adev->ddev->dev); -if (r <0 ) +if (r <0 ) { +pm_runtime_put_autosuspend (adev->ddev->dev);return r; + } r =amdgpu_virt_enable_access_debugfs (adev); -if (r <0 ) +if (r <0 ) { +pm_runtime_put_autosuspend (adev->ddev->dev);return r; + }while (size) {uint32_t value;
@@ -764,12 +792,16 @@ static ssize_t amdgpu_debugfs_sensor_read(struct file *f, char __user *buf, valuesize =sizeof (values); r =pm_runtime_get_sync (adev->ddev->dev); -if (r <0 ) +if (r <0 ) { +pm_runtime_put_autosuspend (adev->ddev->dev);return r; + } r =amdgpu_virt_enable_access_debugfs (adev); -if (r <0 ) +if (r <0 ) { +pm_runtime_put_autosuspend (adev->ddev->dev);return r; + } r =amdgpu_dpm_read_sensor (adev, idx, &values[0 ], &valuesize);
@@ -842,12 +874,16 @@ static ssize_t amdgpu_debugfs_wave_read(struct file *f, char __user *buf, simd = (*pos &GENMASK_ULL (44 ,37 )) >>37 ; r =pm_runtime_get_sync (adev->ddev->dev); -if (r <0 ) +if (r <0 ) { +pm_runtime_put_autosuspend (adev->ddev->dev);return r; + } r =amdgpu_virt_enable_access_debugfs (adev); -if (r <0 ) +if (r <0 ) { +pm_runtime_put_autosuspend (adev->ddev->dev);return r; + }/* switch to the specific se/sh/cu */ mutex_lock (&adev->grbm_idx_mutex);
@@ -977,6 +1013,7 @@ static ssize_t amdgpu_debugfs_gpr_read(struct file *f, char __user *buf, } err: +pm_runtime_put_autosuspend (adev->ddev->dev);kfree (data);amdgpu_virt_disable_access_debugfs (adev);return result;
@@ -1003,8 +1040,10 @@ static ssize_t amdgpu_debugfs_gfxoff_write(struct file *f, const char __user *bureturn -EINVAL ; r =pm_runtime_get_sync (adev->ddev->dev); -if (r <0 ) +if (r <0 ) { +pm_runtime_put_autosuspend (adev->ddev->dev);return r; + }while (size) {uint32_t value;
@@ -1140,8 +1179,10 @@ static int amdgpu_debugfs_test_ib(struct seq_file *m, void *data)int r =0 , i; r =pm_runtime_get_sync (dev->dev); -if (r <0 ) +if (r <0 ) { +pm_runtime_put_autosuspend (adev->ddev->dev);return r; + }/* Avoid accidently unparking the sched thread during GPU reset */ mutex_lock (&adev->lock_reset);
@@ -1197,8 +1238,10 @@ static int amdgpu_debugfs_evict_vram(struct seq_file *m, void *data)int r; r =pm_runtime_get_sync (dev->dev); -if (r <0 ) +if (r <0 ) { +pm_runtime_put_autosuspend (adev->ddev->dev);return r; + }seq_printf (m,"(%d)\n" ,amdgpu_bo_evict_vram (adev));
@@ -1216,8 +1259,10 @@ static int amdgpu_debugfs_evict_gtt(struct seq_file *m, void *data)int r; r =pm_runtime_get_sync (dev->dev); -if (r <0 ) +if (r <0 ) { +pm_runtime_put_autosuspend (adev->ddev->dev);return r; + }seq_printf (m,"(%d)\n" ,ttm_bo_evict_mm (&adev->mman.bdev,TTM_PL_TT ));
@@ -1417,16 +1462,16 @@ static int amdgpu_debugfs_sclk_set(void *data, u64 val)return -EINVAL ; ret =pm_runtime_get_sync (adev->ddev->dev); -if (ret <0 ) +if (ret <0 ) { +pm_runtime_put_autosuspend (adev->ddev->dev);return ret; + }if (is_support_sw_smu (adev)) { ret =smu_get_dpm_freq_range (&adev->smu,SMU_SCLK , &min_freq, &max_freq, true);if (ret || val > max_freq || val < min_freq)return -EINVAL ; ret =smu_set_soft_freq_range (&adev->smu,SMU_SCLK , (uint32_t )val, (uint32_t )val, true); - }else { -return 0 ; }pm_runtime_mark_last_busy (adev->ddev->dev);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 139/464 drm/msm: ratelimit crtc event overflow error
In reply to Greg Kroah-HartmanFrom: Rob Clark <[email protected]>
[ Upstream commit 5e16372b5940b1fecc3cc887fc02a50ba148d373 ]
This can happen a lot when things go pear shaped. Lets not flood dmesg when this happens.
--- drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +1 -1
@@ -389,7 +389,7 @@ static void dpu_crtc_frame_event_cb(void *data, u32 event)spin_unlock_irqrestore (&dpu_crtc->spin_lock, flags);if (!fevent) { -DRM_ERROR ("crtc%d event %d overflow\n" , crtc->base.id, event); +DRM_ERROR_RATELIMITED ("crtc%d event %d overflow\n" , crtc->base.id, event);return ; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 112/464 drm/amdgpu/display bail early in dm_pp_get_static_clocks
In reply to Greg Kroah-HartmanFrom: Alex Deucher <[email protected]>
[ Upstream commit 376814f5fcf1aadda501d1413d56e8af85d19a97 ]
If there are no supported callbacks. We'll fall back to the nominal clocks.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_pp_smu.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_pp_smu.c +2 -0
@@ -530,6 +530,8 @@ bool dm_pp_get_static_clocks( &pp_clk_info); else if (adev->smu.ppt_funcs) ret =smu_get_current_clocks (&adev->smu, &pp_clk_info); + else + return false;if (ret)return false;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 140/464 drm/gem: Fix a leak in drm_gem_objects_lookup()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit ec0bb482de0ad5e4aba2a4537ea53eaeb77d11a6 ]
If the "handles" allocation or the copy_from_user() fails then we leak "objs". It's supposed to be freed in panfrost_job_cleanup().
--- drivers/gpu/drm/drm_gem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_gem.c +2 -2
@@ -709,6 +709,8 @@ int drm_gem_objects_lookup(struct drm_file *filp, void __user *bo_handles,if (!objs)return -ENOMEM ; + *objs_out = objs; + handles =kvmalloc_array (count,sizeof (u32),GFP_KERNEL );if (!handles) { ret = -ENOMEM ;
@@ -722,8 +724,6 @@ int drm_gem_objects_lookup(struct drm_file *filp, void __user *bo_handles, } ret =objects_lookup (filp, handles, count, objs); - *objs_out = objs; - out:kvfree (handles);return ret;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 141/464 drm/bridge: ti-sn65dsi86: Clear old error bits before AUX transfers
In reply to Greg Kroah-HartmanFrom: Douglas Anderson <[email protected]>
[ Upstream commit baef4d56195b6d6e0f681f6eac03d8c6db011d34 ]
The AUX channel transfer error bits in the status register are latched and need to be cleared. Clear them before doing our transfer so we don't see old bits and get confused.
Without this patch having a single failure would mean that all future transfers would look like they failed.
--- drivers/gpu/drm/bridge/ti-sn65dsi86.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/bridge/ti-sn65dsi86.c +6 -0
@@ -827,6 +827,12 @@ static ssize_t ti_sn_aux_transfer(struct drm_dp_aux *aux, buf[i]); } +/* Clear old status bits before start so we don't get confused */ +regmap_write (pdata->regmap,SN_AUX_CMD_STATUS_REG , +AUX_IRQ_STATUS_NAT_I2C_FAIL | +AUX_IRQ_STATUS_AUX_RPLY_TOUT | +AUX_IRQ_STATUS_AUX_SHORT ); +regmap_write (pdata->regmap,SN_AUX_CMD_REG , request_val |AUX_CMD_SEND ); ret = regmap_read_poll_timeout(pdata->regmap, SN_AUX_CMD_REG, val,
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 144/464 agp/intel: Fix a memory leak on module initialisation failure
In reply to Greg Kroah-HartmanFrom: Qiushi Wu <[email protected]>
[ Upstream commit b975abbd382fe442713a4c233549abb90e57c22b ]
In intel_gtt_setup_scratch_page(), pointer "page" is not released if pci_dma_mapping_error() return an error, leading to a memory leak on module initialisation failure. Simply fix this issue by freeing "page" before return.
--- drivers/char/agp/intel-gtt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/char/agp/intel-gtt.c +3 -1
@@ -304,8 +304,10 @@ static int intel_gtt_setup_scratch_page(void)if (intel_private.needs_dmar) { dma_addr =pci_map_page (intel_private.pcidev, page,0 ,PAGE_SIZE ,PCI_DMA_BIDIRECTIONAL ); -if (pci_dma_mapping_error (intel_private.pcidev, dma_addr)) +if (pci_dma_mapping_error (intel_private.pcidev, dma_addr)) { +__free_page (page);return -EINVAL ; + } intel_private.scratch_page_dma = dma_addr; }else
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 145/464 mwifiex: Fix firmware filename for sd8977 chipset
In reply to Greg Kroah-HartmanFrom: Pali Rohár <[email protected]>
[ Upstream commit 47fd3ee25e13cc5add48ba2ed71f7ee964b9c3a4 ]
Firmware for sd8977 chipset is distributed by Marvell package and also as part of the linux-firmware repository in filename sdsd8977_combo_v2.bin.
This patch fixes mwifiex driver to load correct firmware file for sd8977.
--- drivers/net/wireless/marvell/mwifiex/sdio.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/marvell/mwifiex/sdio.h +1 -1
@@ -36,7 +36,7 @@#define SD8897_DEFAULT_FW_NAME "mrvl/sd8897_uapsta.bin"#define SD8887_DEFAULT_FW_NAME "mrvl/sd8887_uapsta.bin"#define SD8801_DEFAULT_FW_NAME "mrvl/sd8801_uapsta.bin" -#define SD8977_DEFAULT_FW_NAME "mrvl/sd8977_uapsta.bin" +#define SD8977_DEFAULT_FW_NAME "mrvl/sdsd8977_combo_v2.bin"#define SD8987_DEFAULT_FW_NAME "mrvl/sd8987_uapsta.bin"#define SD8997_DEFAULT_FW_NAME "mrvl/sd8997_uapsta.bin"
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 147/464 btmrvl: Fix firmware filename for sd8977 chipset
In reply to Greg Kroah-HartmanFrom: Pali Rohár <[email protected]>
[ Upstream commit dbec3af5f13b88a96e31f252957ae1a82484a923 ]
Firmware for sd8977 chipset is distributed by Marvell package and also as part of the linux-firmware repository in filename sdsd8977_combo_v2.bin.
This patch fixes mwifiex driver to load correct firmware file for sd8977.
--- drivers/bluetooth/btmrvl_sdio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/bluetooth/btmrvl_sdio.c +2 -2
@@ -328,7 +328,7 @@ static const struct btmrvl_sdio_device btmrvl_sdio_sd8897 = {static const struct btmrvl_sdio_device btmrvl_sdio_sd8977 = { .helper =NULL , - .firmware ="mrvl/sd8977_uapsta.bin" , + .firmware ="mrvl/sdsd8977_combo_v2.bin" , .reg = &btmrvl_reg_8977, .support_pscan_win_report = true, .sd_blksz_fw_dl =256 ,
@@ -1831,6 +1831,6 @@ MODULE_FIRMWARE("mrvl/sd8787_uapsta.bin");MODULE_FIRMWARE ("mrvl/sd8797_uapsta.bin" );MODULE_FIRMWARE ("mrvl/sd8887_uapsta.bin" );MODULE_FIRMWARE ("mrvl/sd8897_uapsta.bin" ); -MODULE_FIRMWARE ("mrvl/sd8977_uapsta.bin" ); +MODULE_FIRMWARE ("mrvl/sdsd8977_combo_v2.bin" );MODULE_FIRMWARE ("mrvl/sd8987_uapsta.bin" );MODULE_FIRMWARE ("mrvl/sd8997_uapsta.bin" );
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 149/464 video: fbdev: sm712fb: fix an issue about iounmap for a wrong address
In reply to Greg Kroah-HartmanFrom: Dejin Zheng <[email protected]>
[ Upstream commit 98bd4f72988646c35569e1e838c0ab80d06c77f6 ]
the sfb->fb->screen_base is not save the value get by iounmap() when the chip id is 0x720. so iounmap() for address sfb->fb->screen_base is not right.
--- drivers/video/fbdev/sm712fb.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/video/fbdev/sm712fb.c +2 -0
@@ -1429,6 +1429,8 @@ static int smtc_map_smem(struct smtcfb_info *sfb,static void smtc_unmap_smem (struct smtcfb_info *sfb) {if (sfb && sfb->fb->screen_base) { +if (sfb->chip_id ==0x720 ) + sfb->fb->screen_base -=0x00200000 ;iounmap (sfb->fb->screen_base); sfb->fb->screen_base =NULL ; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 150/464 console: newport_con: fix an issue about leak related system resources
In reply to Greg Kroah-HartmanFrom: Dejin Zheng <[email protected]>
[ Upstream commit fd4b8243877250c05bb24af7fea5567110c9720b ]
A call of the function do_take_over_console() can fail here. The corresponding system resources were not released then. Thus add a call of iounmap() and release_mem_region() together with the check of a failure predicate. and also add release_mem_region() on device removal.
--- drivers/video/console/newport_con.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/video/console/newport_con.c +10 -2
@@ -31,6 +31,8 @@#include <linux/linux_logo.h> #include <linux/font.h> +#define NEWPORT_LEN 0x10000 +#define FONT_DATA ((unsigned char *)font_vga_8x16.data)/* borrowed from fbcon.c */
@@ -42,6 +44,7 @@static unsigned char *font_data[MAX_NR_CONSOLES ];static struct newport_regs *npregs; +static unsigned long newport_addr;static int logo_active;static int topscan;
@@ -701,7 +704,6 @@ const struct consw newport_con = {static int newport_probe (struct gio_device *dev,const struct gio_device_id *id) { -unsigned long newport_addr;int err;if (!dev->resource.start)
@@ -711,7 +713,7 @@ static int newport_probe(struct gio_device *dev,return -EBUSY ;/* we only support one Newport as console */ newport_addr = dev->resource.start +0xF0000 ; -if (!request_mem_region (newport_addr,0x10000 ,"Newport" )) +if (!request_mem_region (newport_addr,NEWPORT_LEN ,"Newport" ))return -ENODEV ; npregs = (struct newport_regs *)/* ioremap cannot fail */
@@ -719,6 +721,11 @@ static int newport_probe(struct gio_device *dev,console_lock (); err =do_take_over_console (&newport_con,0 ,MAX_NR_CONSOLES -1 ,1 );console_unlock (); + +if (err) { +iounmap ((void *)npregs); +release_mem_region (newport_addr,NEWPORT_LEN ); + }return err; }
@@ -726,6 +733,7 @@ static void newport_remove(struct gio_device *dev) {give_up_console (&newport_con);iounmap ((void *)npregs); +release_mem_region (newport_addr,NEWPORT_LEN ); }static struct gio_device_id newport_ids[] = {
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 125/464 ionic: update eid test for overflow
In reply to Greg Kroah-HartmanFrom: Shannon Nelson <[email protected]>
[ Upstream commit 3fbc9bb6ca32d12d4d32a7ae32abef67ac95f889 ]
Fix up our comparison to better handle a potential (but largely unlikely) wrap around.
--- drivers/net/ethernet/pensando/ionic/ionic_lif.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/pensando/ionic/ionic_lif.c +1 -1
@@ -723,7 +723,7 @@ static bool ionic_notifyq_service(struct ionic_cq *cq, eid =le64_to_cpu (comp->event.eid);/* Have we run out of new completions to process? */ -if (eid <= lif->last_eid) +if ((s64)(eid - lif->last_eid) <=0 )return false; lif->last_eid = eid;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 91/464 md-cluster: fix wild pointer of unlock_all_bitmaps()
In reply to Greg Kroah-HartmanFrom: Zhao Heming <[email protected]>
[ Upstream commit 60f80d6f2d07a6d8aee485a1d1252327eeee0c81 ]
reproduction steps:
``` node1 # mdadm -C /dev/md0 -b clustered -e 1.2 -n 2 -l mirror /dev/sda /dev/sdb node2 # mdadm -A /dev/md0 /dev/sda /dev/sdb node1 # mdadm -G /dev/md0 -b none mdadm: failed to remove clustered bitmap. node1 # mdadm -S --scan ^C <==== mdadm hung & kernel crash ```
kernel stack:
``` [ 335.230657] general protection fault: 0000 [#1] SMP NOPTI [...] [ 335.230848] Call Trace: [ 335.230873] ? unlock_all_bitmaps+0x5/0x70 [md_cluster] [ 335.230886] unlock_all_bitmaps+0x3d/0x70 [md_cluster] [ 335.230899] leave+0x10f/0x190 [md_cluster] [ 335.230932] ? md_super_wait+0x93/0xa0 [md_mod] [ 335.230947] ? leave+0x5/0x190 [md_cluster] [ 335.230973] md_cluster_stop+0x1a/0x30 [md_mod] [ 335.230999] md_bitmap_free+0x142/0x150 [md_mod] [ 335.231013] ? _cond_resched+0x15/0x40 [ 335.231025] ? mutex_lock+0xe/0x30 [ 335.231056] __md_stop+0x1c/0xa0 [md_mod] [ 335.231083] do_md_stop+0x160/0x580 [md_mod] [ 335.231119] ? 0xffffffffc05fb078 [ 335.231148] md_ioctl+0xa04/0x1930 [md_mod] [ 335.231165] ? filename_lookup+0xf2/0x190 [ 335.231179] blkdev_ioctl+0x93c/0xa10 [ 335.231205] ? _cond_resched+0x15/0x40 [ 335.231214] ? __check_object_size+0xd4/0x1a0 [ 335.231224] block_ioctl+0x39/0x40 [ 335.231243] do_vfs_ioctl+0xa0/0x680 [ 335.231253] ksys_ioctl+0x70/0x80 [ 335.231261] __x64_sys_ioctl+0x16/0x20 [ 335.231271] do_syscall_64+0x65/0x1f0 [ 335.231278] entry_SYSCALL_64_after_hwframe+0x44/0xa9 ```
--- drivers/md/md-cluster.c | 1 + 1 file changed, 1 insertion(+)
drivers/md/md-cluster.c +1 -0
@@ -1518,6 +1518,7 @@ static void unlock_all_bitmaps(struct mddev *mddev) } }kfree (cinfo->other_bitmap_lockres); + cinfo->other_bitmap_lockres =NULL ; } }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 126/464 x86/uaccess: Make __get_user_size() Clang compliant on 32-bit
In reply to Greg Kroah-HartmanFrom: Nick Desaulniers <[email protected]>
[ Upstream commit 158807de5822d1079e162a3762956fd743dd483e ]
Clang fails to compile __get_user_size() on 32-bit for the following code:
long long val;
__get_user(val, usrptr);with: error: invalid output size for constraint '=q'
GCC compiles the same code without complaints.
The reason is that GCC and Clang are architecturally different, which leads to subtle issues for code that's invalid but clearly dead, i.e. with code that emulates polymorphism with the preprocessor and sizeof.
GCC will perform semantic analysis after early inlining and dead code elimination, so it will not warn on invalid code that's dead. Clang strictly performs optimizations after semantic analysis, so it will warn for dead code.
Neither Clang nor GCC like this very much with -m32:
long long ret;
asm ("movb $5, %0" : "=q" (ret));
However, GCC can tolerate this variant:
long long ret;
switch (sizeof(ret)) {
case 1:
asm ("movb $5, %0" : "=q" (ret));
break;case 8:;
}
Clang, on the other hand, won't accept that because it validates the inline asm for the '1' case before the optimisation phase where it realises that it wouldn't have to emit it anyway.
If LLVM (Clang's "back end") fails such as during instruction selection or register allocation, it cannot provide accurate diagnostics (warnings / errors) that contain line information, as the AST has been discarded from memory at that point.
While there have been early discussions about having C/C++ specific language optimizations in Clang via the use of MLIR, which would enable such earlier optimizations, such work is not scoped and likely a multi-year endeavor.
It was discussed to change the asm output constraint for the one byte case from "=q" to "=r". While it works for 64-bit, it fails on 32-bit. With '=r' the compiler could fail to chose a register accessible as high/low which is required for the byte operation. If that happens the assembly will fail.
Use a local temporary variable of type 'unsigned char' as output for the byte copy inline asm and then assign it to the real output variable. This prevents Clang from failing the semantic analysis in the above case.
The resulting code for the actual one byte copy is not affected as the temporary variable is optimized out.
[ tglx: Amended changelog ]
--- arch/x86/include/asm/uaccess.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
arch/x86/include/asm/uaccess.h +4 -1
@@ -314,11 +314,14 @@ do { \#define __get_user_size (x, ptr, size, retval) \ do { \ + unsigned char x_u8__; \ + \ retval = 0; \ __chk_user_ptr(ptr); \ switch (size) { \ case 1: \ - __get_user_asm(x, ptr, retval, "b", "=q"); \ + __get_user_asm(x_u8__, ptr, retval, "b", "=q"); \ + (x) = x_u8__; \ break; \ case 2: \ __get_user_asm(x, ptr, retval, "w", "=r"); \
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 152/464 Bluetooth: hci_qca: Fix an error pointer dereference
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 4c07a5d7aeb39f559b29aa58ec9a8a5ab4282cb0 ]
When a function like devm_clk_get_optional() function returns both error pointers on error and NULL then the NULL return means that the optional feature is deliberately disabled. It is a special sort of success and should not trigger an error message. The surrounding code should be written to check for NULL and not crash.
On the other hand, if we encounter an error, then the probe from should clean up and return a failure.
In this code, if devm_clk_get_optional() returns an error pointer then the kernel will crash inside the call to:
clk_set_rate(qcadev->susclk, SUSCLK_RATE_32KHZ);
The error handling must be updated to prevent that.
--- drivers/bluetooth/hci_qca.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/bluetooth/hci_qca.c +9 -9
@@ -1994,17 +1994,17 @@ static int qca_serdev_probe(struct serdev_device *serdev) } qcadev->susclk =devm_clk_get_optional (&serdev->dev,NULL ); -if (!qcadev->susclk) { +if (IS_ERR (qcadev->susclk)) {dev_warn (&serdev->dev,"failed to acquire clk\n" ); - }else { - err =clk_set_rate (qcadev->susclk,SUSCLK_RATE_32KHZ ); -if (err) -return err; - - err =clk_prepare_enable (qcadev->susclk); -if (err) -return err; +return PTR_ERR (qcadev->susclk); } + err =clk_set_rate (qcadev->susclk,SUSCLK_RATE_32KHZ ); +if (err) +return err; + + err =clk_prepare_enable (qcadev->susclk); +if (err) +return err; err =hci_uart_register_device (&qcadev->serdev_hu, &qca_proto);if (err) {
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 129/464 bdc: Fix bug causing crash after multiple disconnects
In reply to Greg Kroah-HartmanFrom: Sasi Kumar <[email protected]>
[ Upstream commit a95bdfd22076497288868c028619bc5995f5cc7f ]
Multiple connects/disconnects can cause a crash on the second disconnect. The driver had a problem where it would try to send endpoint commands after it was disconnected which is not allowed by the hardware. The fix is to only allow the endpoint commands when the endpoint is connected. This will also fix issues that showed up when using configfs to create gadgets.
--- drivers/usb/gadget/udc/bdc/bdc_core.c | 4 ++++ drivers/usb/gadget/udc/bdc/bdc_ep.c | 16 ++++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-)
drivers/usb/gadget/udc/bdc/bdc_core.c +4 -0
@@ -282,6 +282,7 @@ static void bdc_mem_init(struct bdc *bdc, bool reinit)* in that case reinit is passed as 1 */ if (reinit) { +int i;/* Enable interrupts */ temp =bdc_readl (bdc->regs,BDC_BDCSC ); temp |=BDC_GIE ;
@@ -291,6 +292,9 @@ static void bdc_mem_init(struct bdc *bdc, bool reinit)/* Initialize SRR to 0 */ memset (bdc->srr.sr_bds,0 ,NUM_SR_ENTRIES *sizeof (struct bdc_bd )); +/* clear ep flags to avoid post disconnect stops/deconfigs */ +for (i =1 ; i < bdc->num_eps; ++i) + bdc->bdc_ep_array[i]->flags =0 ; }else {/* One time initiaization only */ /* Enable status report function pointers */
drivers/usb/gadget/udc/bdc/bdc_ep.c +10 -6
@@ -615,7 +615,6 @@ int bdc_ep_enable(struct bdc_ep *ep) }bdc_dbg_bd_list (bdc, ep);/* only for ep0: config ep is called for ep0 from connect event */ - ep->flags |=BDC_EP_ENABLED ;if (ep->ep_num ==1 )return ret;
@@ -759,10 +758,13 @@ static int ep_dequeue(struct bdc_ep *ep, struct bdc_req *req) __func__, ep->name, start_bdi, end_bdi);dev_dbg (bdc->dev,"ep_dequeue ep=%p ep->desc=%p\n" , ep, (void *)ep->usb_ep.desc); -/* Stop the ep to see where the HW is ? */ - ret =bdc_stop_ep (bdc, ep->ep_num); -/* if there is an issue with stopping ep, then no need to go further */ -if (ret) +/* if still connected, stop the ep to see where the HW is ? */ +if (!(bdc_readl (bdc->regs,BDC_USPC ) &BDC_PST_MASK )) { + ret =bdc_stop_ep (bdc, ep->ep_num); +/* if there is an issue, then no need to go further */ +if (ret) +return 0 ; + }else return 0 ;/*
@@ -1911,7 +1913,9 @@ static int bdc_gadget_ep_disable(struct usb_ep *_ep) __func__, ep->name, ep->flags);if (!(ep->flags &BDC_EP_ENABLED )) { -dev_warn (bdc->dev,"%s is already disabled\n" , ep->name); +if (bdc->gadget.speed !=USB_SPEED_UNKNOWN ) +dev_warn (bdc->dev,"%s is already disabled\n" , + ep->name);return 0 ; }spin_lock_irqsave (&bdc->lock, flags);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 161/464 scsi: ufs: Fix imprecise load calculation in devfreq window
In reply to Greg Kroah-HartmanFrom: Stanley Chu <[email protected]>
[ Upstream commit b1bf66d1d5a8fcb54f0e584db5d196ef015b5172 ]
The UFS load calculation is based on "total_time" and "busy_time" in a devfreq window. However, the source of time is different for both
parameters: "busy_time" is assigned from "jiffies" thus has different accuracy from "total_time" which is assigned from ktime_get().
In addition, the time of window boundary is not exactly the same as the starting busy time in this window if UFS is actually busy in the beginning of the window. A similar accuracy error may also happen for the end of busy time in current window.
To guarantee the precision of load calculation, we need to
1. Align time accuracy of both devfreq_dev_status.total_time and devfreq_dev_status.busy_time. For example, use "ktime_get()" directly.
2. Align the following timelines:
- The beginning time of devfreq windows
- The beginning of busy time in a new window
- The end of busy time in the current window
--- drivers/scsi/ufs/ufshcd.c | 18 ++++++++++-------- drivers/scsi/ufs/ufshcd.h | 2 +- 2 files changed, 11 insertions(+), 9 deletions(-)
drivers/scsi/ufs/ufshcd.c +10 -8
@@ -1314,6 +1314,7 @@ static int ufshcd_devfreq_get_dev_status(struct device *dev,unsigned long flags;struct list_head *clk_list = &hba->clk_list_head;struct ufs_clk_info *clki; +ktime_t curr_t;if (!ufshcd_is_clkscaling_supported (hba))return -EINVAL ;
@@ -1321,6 +1322,7 @@ static int ufshcd_devfreq_get_dev_status(struct device *dev,memset (stat,0 ,sizeof (*stat));spin_lock_irqsave (hba->host->host_lock, flags); + curr_t =ktime_get ();if (!scaling->window_start_t) goto start_window;
@@ -1332,18 +1334,17 @@ static int ufshcd_devfreq_get_dev_status(struct device *dev,*/ stat->current_frequency = clki->curr_freq;if (scaling->is_busy_started) - scaling->tot_busy_t +=ktime_to_us (ktime_sub (ktime_get (), - scaling->busy_start_t)); + scaling->tot_busy_t +=ktime_us_delta (curr_t, + scaling->busy_start_t); - stat->total_time =jiffies_to_usecs ((long )jiffies - - (long )scaling->window_start_t); + stat->total_time =ktime_us_delta (curr_t, scaling->window_start_t); stat->busy_time = scaling->tot_busy_t; start_window: - scaling->window_start_t = jiffies; + scaling->window_start_t = curr_t; scaling->tot_busy_t =0 ;if (hba->outstanding_reqs) { - scaling->busy_start_t =ktime_get (); + scaling->busy_start_t = curr_t; scaling->is_busy_started = true; }else { scaling->busy_start_t =0 ;
@@ -1877,6 +1878,7 @@ static void ufshcd_exit_clk_gating(struct ufs_hba *hba)static void ufshcd_clk_scaling_start_busy (struct ufs_hba *hba) {bool queue_resume_work = false; +ktime_t curr_t =ktime_get ();if (!ufshcd_is_clkscaling_supported (hba))return ;
@@ -1892,13 +1894,13 @@ static void ufshcd_clk_scaling_start_busy(struct ufs_hba *hba) &hba->clk_scaling.resume_work);if (!hba->clk_scaling.window_start_t) { - hba->clk_scaling.window_start_t = jiffies; + hba->clk_scaling.window_start_t = curr_t; hba->clk_scaling.tot_busy_t =0 ; hba->clk_scaling.is_busy_started = false; }if (!hba->clk_scaling.is_busy_started) { - hba->clk_scaling.busy_start_t =ktime_get (); + hba->clk_scaling.busy_start_t = curr_t; hba->clk_scaling.is_busy_started = true; } }
drivers/scsi/ufs/ufshcd.h +1 -1
@@ -411,7 +411,7 @@ struct ufs_saved_pwr_info {struct ufs_clk_scaling {int active_reqs;unsigned long tot_busy_t; -unsigned long window_start_t; +ktime_t window_start_t;ktime_t busy_start_t;struct device_attribute enable_attr;struct ufs_saved_pwr_info saved_pwr_info;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 118/464 brcmfmac: keep SDIO watchdog running when console_interval is non-zero
In reply to Greg Kroah-HartmanFrom: Wright Feng <[email protected]>
[ Upstream commit eccbf46b15bb3e35d004148f7c3a8fa8e9b26c1e ]
brcmfmac host driver makes SDIO bus sleep and stops SDIO watchdog if no pending event or data. As a result, host driver does not poll firmware console buffer before buffer overflow, which leads to missing firmware logs. We should not stop SDIO watchdog if console_interval is non-zero in debug build.
--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +5 -1
@@ -3699,7 +3699,11 @@ static void brcmf_sdio_bus_watchdog(struct brcmf_sdio *bus)if (bus->idlecount > bus->idletime) {brcmf_dbg (SDIO ,"idle\n" );sdio_claim_host (bus->sdiodev->func1); -brcmf_sdio_wd_timer (bus, false); +#ifdef DEBUG +if (!BRCMF_FWCON_ON () || + bus->console_interval == 0) +#endif +brcmf_sdio_wd_timer (bus, false); bus->idlecount =0 ;brcmf_sdio_bus_sleep (bus, true, false);sdio_release_host (bus->sdiodev->func1);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 131/464 dyndbg: fix a BUG_ON in ddebug_describe_flags
In reply to Greg Kroah-HartmanFrom: Jim Cromie <[email protected]>
[ Upstream commit f678ce8cc3cb2ad29df75d8824c74f36398ba871 ]
ddebug_describe_flags() currently fills a caller provided string buffer, after testing its size (also passed) in a BUG_ON. Fix this by replacing them with a known-big-enough string buffer wrapped in a struct, and passing that instead.
Also simplify ddebug_describe_flags() flags parameter from a struct to a member in that struct, and hoist the member deref up to the caller. This makes the function reusable (soon) where flags are unpacked.
--- lib/dynamic_debug.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-)
lib/dynamic_debug.c +11 -12
@@ -87,22 +87,22 @@ static struct { unsigned flag:8; char opt_char; } opt_array[] = { { _DPRINTK_FLAGS_NONE, '_' }, }; +struct flagsbuf {char buf[ARRAY_SIZE (opt_array)+1 ]; }; +/* format a string into buf[] which describes the _ddebug's flags */ -static char *ddebug_describe_flags (struct _ddebug *dp,char *buf, -size_t maxlen) +static char *ddebug_describe_flags (unsigned int flags,struct flagsbuf *fb) { -char *p = buf; +char *p = fb->buf;int i; -BUG_ON (maxlen <6 );for (i =0 ; i <ARRAY_SIZE (opt_array); ++i) -if (dp->flags & opt_array[i].flag) +if (flags & opt_array[i].flag) *p++ = opt_array[i].opt_char; -if (p == buf) +if (p == fb->buf) *p++ ='_' ; *p ='\0' ; -return buf; +return fb->buf; }#define vpr_info (fmt, ...) \
@@ -144,7 +144,7 @@ static int ddebug_change(const struct ddebug_query *query,struct ddebug_table *dt;unsigned int newflags;unsigned int nfound =0 ; -char flagbuf[10 ]; +struct flagsbuf fbuf;/* search for matching ddebugs */ mutex_lock (&ddebug_lock);
@@ -201,8 +201,7 @@ static int ddebug_change(const struct ddebug_query *query,vpr_info ("changed %s:%d [%s]%s =%s\n" ,trim_prefix (dp->filename), dp->lineno, dt->mod_name, dp->function, -ddebug_describe_flags (dp, flagbuf, -sizeof (flagbuf))); +ddebug_describe_flags (dp->flags, &fbuf)); } }mutex_unlock (&ddebug_lock);
@@ -816,7 +815,7 @@ static int ddebug_proc_show(struct seq_file *m, void *p) {struct ddebug_iter *iter = m->private;struct _ddebug *dp = p; -char flagsbuf[10 ]; +struct flagsbuf flags;vpr_info ("called m=%p p=%p\n" , m, p);
@@ -829,7 +828,7 @@ static int ddebug_proc_show(struct seq_file *m, void *p)seq_printf (m,"%s:%u [%s]%s =%s \"" ,trim_prefix (dp->filename), dp->lineno, iter->table->mod_name, dp->function, -ddebug_describe_flags (dp, flagsbuf,sizeof (flagsbuf))); +ddebug_describe_flags (dp->flags, &flags));seq_escape (m, dp->format,"\t\r\n\"" );seq_puts (m,"\"\n" );
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 166/464 powerpc/mm: Fix typo in IS_ENABLED()
In reply to Greg Kroah-HartmanFrom: Joe Perches <[email protected]>
[ Upstream commit 55bd9ac468397c4f12a33b7ec714b5d0362c3aa2 ]
IS_ENABLED() matches names exactly, so the missing "CONFIG_" prefix means this code would never be built.
Also fixes a missing newline in pr_warn().
--- arch/powerpc/mm/book3s64/hash_utils.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
arch/powerpc/mm/book3s64/hash_utils.c +2 -3
@@ -663,11 +663,10 @@ static void __init htab_init_page_sizes(void)* Pick a size for the linear mapping. Currently, we only * support 16M, 1M and 4K which is the default */ -if (IS_ENABLED (STRICT_KERNEL_RWX ) && +if (IS_ENABLED (CONFIG_STRICT_KERNEL_RWX ) && (unsigned long )_stext %0x1000000 ) {if (mmu_psize_defs[MMU_PAGE_16M ].shift) -pr_warn ("Kernel not 16M aligned, " -"disabling 16M linear map alignment" ); +pr_warn ("Kernel not 16M aligned, disabling 16M linear map alignment\n" ); aligned = false; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 167/464 powerpc/fixmap: Fix FIX_EARLY_DEBUG_BASE when page size is 256k
In reply to Greg Kroah-HartmanFrom: Christophe Leroy <[email protected]>
[ Upstream commit 03fd42d458fb9cb69e712600bd69ff77ff3a45a8 ]
FIX_EARLY_DEBUG_BASE reserves a 128k area for debuging.
When page size is 256k, the calculation results in a 0 number of pages, leading to the following failure:
CC arch/powerpc/kernel/asm-offsets.s
In file included from ./arch/powerpc/include/asm/nohash/32/pgtable.h:77:0,
from ./arch/powerpc/include/asm/nohash/pgtable.h:8,
from ./arch/powerpc/include/asm/pgtable.h:20,
from ./include/linux/pgtable.h:6,
from ./arch/powerpc/include/asm/kup.h:42,
from ./arch/powerpc/include/asm/uaccess.h:9,
from ./include/linux/uaccess.h:11,
from ./include/linux/crypto.h:21,
from ./include/crypto/hash.h:11,
from ./include/linux/uio.h:10,
from ./include/linux/socket.h:8,
from ./include/linux/compat.h:15,
from arch/powerpc/kernel/asm-offsets.c:14:./arch/powerpc/include/asm/fixmap.h:75:2: error: overflow in enumeration values
__end_of_permanent_fixed_addresses,
^
make[2]: *** [arch/powerpc/kernel/asm-offsets.s] Error 1
Ensure the debug area is at least one page.
--- arch/powerpc/include/asm/fixmap.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/include/asm/fixmap.h +1 -1
@@ -52,7 +52,7 @@ enum fixed_addresses {FIX_HOLE ,/* reserve the top 128K for early debugging purposes */ FIX_EARLY_DEBUG_TOP =FIX_HOLE , -FIX_EARLY_DEBUG_BASE =FIX_EARLY_DEBUG_TOP +((128 *1024 )/PAGE_SIZE )-1 , +FIX_EARLY_DEBUG_BASE =FIX_EARLY_DEBUG_TOP +(ALIGN (SZ_128 ,PAGE_SIZE )/PAGE_SIZE )-1 , #ifdef CONFIG_HIGHMEMFIX_KMAP_BEGIN ,/* reserved pte's for temporary kernel mappings */ FIX_KMAP_END = FIX_KMAP_BEGIN+(KM_TYPE_NR*NR_CPUS)-1,
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 132/464 bcache: fix super block seq numbers comparision in register_cache_set()
In reply to Greg Kroah-HartmanFrom: Coly Li <[email protected]>
[ Upstream commit 117f636ea695270fe492d0c0c9dfadc7a662af47 ]
In register_cache_set(), c is pointer to struct cache_set, and ca is pointer to struct cache, if ca->sb.seq > c->sb.seq, it means this registering cache has up to date version and other members, the in- memory version and other members should be updated to the newer value.
But current implementation makes a cache set only has a single cache device, so the above assumption works well except for a special case. The execption is when a cache device new created and both ca->sb.seq and c->sb.seq are 0, because the super block is never flushed out yet. In the location for the following if() check,
2156 if (ca->sb.seq > c->sb.seq) {
2157 c->sb.version = ca->sb.version;
2158 memcpy(c->sb.set_uuid, ca->sb.set_uuid, 16);
2159 c->sb.flags = ca->sb.flags;
2160 c->sb.seq = ca->sb.seq;
2161 pr_debug("set version = %llu\n", c->sb.version);2162 }c->sb.version is not initialized yet and valued 0. When ca->sb.seq is 0, the if() check will fail (because both values are 0), and the cache set version, set_uuid, flags and seq won't be updated.
The above problem is hiden for current code, because the bucket size is compatible among different super block version. And the next time when running cache set again, ca->sb.seq will be larger than 0 and cache set super block version will be updated properly.
But if the large bucket feature is enabled, sb->bucket_size is the low 16bits of the bucket size. For a power of 2 value, when the actual bucket size exceeds 16bit width, sb->bucket_size will always be 0. Then read_super_common() will fail because the if() check to is_power_of_2(sb->bucket_size) is false. This is how the long time hidden bug is triggered.
This patch modifies the if() check to the following way,
2156 if (ca->sb.seq > c->sb.seq || c->sb.seq == 0) {
Then cache set's version, set_uuid, flags and seq will always be updated corectly including for a new created cache device.
--- drivers/md/bcache/super.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/md/bcache/super.c +8 -1
@@ -2100,7 +2100,14 @@ static const char *register_cache_set(struct cache *ca) sysfs_create_link(&c->kobj, &ca->kobj, buf)) goto err; -if (ca->sb.seq > c->sb.seq) { +/* +* A special case is both ca->sb.seq and c->sb.seq are 0, +* such condition happens on a new created cache device whose +* super block is never flushed yet. In this case c->sb.version +* and other members should be updated too, otherwise we will +* have a mistaken super block version in cache set. +*/ +if (ca->sb.seq > c->sb.seq || c->sb.seq ==0 ) { c->sb.version = ca->sb.version;memcpy (c->sb.set_uuid, ca->sb.set_uuid,16 ); c->sb.flags = ca->sb.flags;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 134/464 btrfs: qgroup: free per-trans reserved space when a subvolume gets dropped
In reply to Greg Kroah-HartmanFrom: Qu Wenruo <[email protected]>
[ Upstream commit a3cf0e4342b6af9e6b34a4b913c630fbd03a82ea ]
[BUG]
Sometime fsstress could lead to qgroup warning for case like generic/013:
BTRFS warning (device dm-3): qgroup 0/259 has unreleased space, type 1 rsv 81920
------------[ cut here ]------------ WARNING: CPU: 9 PID: 24535 at fs/btrfs/disk-io.c:4142 close_ctree+0x1dc/0x323 [btrfs] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 0.0.0 02/06/2015 RIP: 0010:close_ctree+0x1dc/0x323 [btrfs] Call Trace: btrfs_put_super+0x15/0x17 [btrfs] generic_shutdown_super+0x72/0x110 kill_anon_super+0x18/0x30 btrfs_kill_super+0x17/0x30 [btrfs] deactivate_locked_super+0x3b/0xa0 deactivate_super+0x40/0x50 cleanup_mnt+0x135/0x190 __cleanup_mnt+0x12/0x20 task_work_run+0x64/0xb0 __prepare_exit_to_usermode+0x1bc/0x1c0 __syscall_return_slowpath+0x47/0x230 do_syscall_64+0x64/0xb0 entry_SYSCALL_64_after_hwframe+0x44/0xa9 ---[ end trace 6c341cdf9b6cc3c1 ]--- BTRFS error (device dm-3): qgroup reserved space leaked
While that subvolume 259 is no longer in that filesystem.
[CAUSE]
Normally per-trans qgroup reserved space is freed when a transaction is committed, in commit_fs_roots().
However for completely dropped subvolume, that subvolume is completely gone, thus is no longer in the fs_roots_radix, and its per-trans reserved qgroup will never be freed.
Since the subvolume is already gone, leaked per-trans space won't cause any trouble for end users.
[FIX]
Just call btrfs_qgroup_free_meta_all_pertrans() before a subvolume is completely dropped.
--- fs/btrfs/extent-tree.c | 8 ++++++++ 1 file changed, 8 insertions(+)
fs/btrfs/extent-tree.c +8 -0
@@ -5466,6 +5466,14 @@ int btrfs_drop_snapshot(struct btrfs_root *root, int update_ref, int for_reloc) } } +/* +* This subvolume is going to be completely dropped, and won't be +* recorded as dirty roots, thus pertrans meta rsv will not be freed at +* commit transaction time. So free it here manually. +*/ +btrfs_qgroup_convert_reserved_meta (root,INT_MAX ); +btrfs_qgroup_free_meta_all_pertrans (root); +if (test_bit (BTRFS_ROOT_IN_RADIX , &root->state))btrfs_add_dropped_root (trans, root);else
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 169/464 ASoC: fsl_easrc: Fix uninitialized scalar variable in fsl_easrc_set_ctx_format
In reply to Greg Kroah-HartmanFrom: Shengjiu Wang <[email protected]>
[ Upstream commit 5748f4eb01a4df7a42024fe8bc7855f05febb7c5 ]
The "ret" in fsl_easrc_set_ctx_format is not initialized, then the unknown value maybe returned by this function.
--- sound/soc/fsl/fsl_easrc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/fsl/fsl_easrc.c +1 -1
@@ -1133,7 +1133,7 @@ int fsl_easrc_set_ctx_format(struct fsl_asrc_pair *ctx,struct fsl_easrc_ctx_priv *ctx_priv = ctx->private;struct fsl_easrc_data_fmt *in_fmt = &ctx_priv->in_params.fmt;struct fsl_easrc_data_fmt *out_fmt = &ctx_priv->out_params.fmt; -int ret; +int ret =0 ;/* Get the bitfield values for input data format */ if (in_raw_format && out_raw_format) {
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 176/464 dpaa2-eth: fix condition for number of buffer acquire retries
In reply to Greg Kroah-HartmanFrom: Ioana Ciornei <[email protected]>
[ Upstream commit 0e5ad75b02d9341eb9ca22627247f9a02cc20d6f ]
We should keep retrying to acquire buffers through the software portals as long as the function returns -EBUSY and the number of retries is __below__ DPAA2_ETH_SWP_BUSY_RETRIES.
--- drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c +1 -1
@@ -1109,7 +1109,7 @@ static void drain_bufs(struct dpaa2_eth_priv *priv, int count) buf_array, count);if (ret <0 ) {if (ret == -EBUSY && - retries++ >=DPAA2_ETH_SWP_BUSY_RETRIES ) + retries++ <DPAA2_ETH_SWP_BUSY_RETRIES )continue ;netdev_err (priv->net_dev,"dpaa2_io_service_acquire() failed\n" );return ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 178/464 ASoC: Intel: cml_rt1011_rt5682: add missing .owner field
In reply to Greg Kroah-HartmanFrom: Pierre-Louis Bossart <[email protected]>
[ Upstream commit 299120928897d6cb893c7165df7cd232d835e259 ]
This field is required for ASoC cards. Not setting it will result in a module->name pointer being NULL and generate problems such as
cat /proc/asound/modules
0 (efault)
--- sound/soc/intel/boards/cml_rt1011_rt5682.c | 1 + 1 file changed, 1 insertion(+)
sound/soc/intel/boards/cml_rt1011_rt5682.c +1 -0
@@ -493,6 +493,7 @@ static struct snd_soc_codec_conf rt1011_conf[] = {/* Cometlake audio machine driver for RT1011 and RT5682 */ static struct snd_soc_card snd_soc_card_cml = { .name ="cml_rt1011_rt5682" , + .owner =THIS_MODULE , .dai_link = cml_rt1011_rt5682_dailink, .num_links =ARRAY_SIZE (cml_rt1011_rt5682_dailink), .codec_conf = rt1011_conf,
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 179/464 ASoC: Intel: sof_sdw: add missing .owner field
In reply to Greg Kroah-HartmanFrom: Pierre-Louis Bossart <[email protected]>
[ Upstream commit fb4b42f68972d6bc905c8b6e21a43a490dedfca7 ]
This field is required for ASoC cards. Not setting it will result in a module->name pointer being NULL and generate problems such as
cat /proc/asound/modules
0 (efault)
--- sound/soc/intel/boards/sof_sdw.c | 1 + 1 file changed, 1 insertion(+)
sound/soc/intel/boards/sof_sdw.c +1 -0
@@ -893,6 +893,7 @@ static const char sdw_card_long_name[] = "Intel Soundwire SOF";static struct snd_soc_card card_sof_sdw = { .name ="soundwire" , + .owner =THIS_MODULE , .late_probe = sof_sdw_hdmi_card_late_probe, .codec_conf = codec_conf, .num_configs =ARRAY_SIZE (codec_conf),
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 180/464 ASoC: Intel: bxt_rt298: add missing .owner field
In reply to Greg Kroah-HartmanFrom: Pierre-Louis Bossart <[email protected]>
[ Upstream commit 88cee34b776f80d2da04afb990c2a28c36799c43 ]
This field is required for ASoC cards. Not setting it will result in a module->name pointer being NULL and generate problems such as
cat /proc/asound/modules
0 (efault)
--- sound/soc/intel/boards/bxt_rt298.c | 2 ++ 1 file changed, 2 insertions(+)
sound/soc/intel/boards/bxt_rt298.c +2 -0
@@ -565,6 +565,7 @@ static int bxt_card_late_probe(struct snd_soc_card *card)/* broxton audio machine driver for SPT + RT298S */ static struct snd_soc_card broxton_rt298 = { .name ="broxton-rt298" , + .owner =THIS_MODULE , .dai_link = broxton_rt298_dais, .num_links =ARRAY_SIZE (broxton_rt298_dais), .controls = broxton_controls,
@@ -580,6 +581,7 @@ static struct snd_soc_card broxton_rt298 = {static struct snd_soc_card geminilake_rt298 = { .name ="geminilake-rt298" , + .owner =THIS_MODULE , .dai_link = broxton_rt298_dais, .num_links =ARRAY_SIZE (broxton_rt298_dais), .controls = broxton_controls,
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 155/464 Bluetooth: Allow suspend even when preparation has failed
In reply to Greg Kroah-HartmanFrom: Abhishek Pandit-Subedi <[email protected]>
[ Upstream commit a9ec8423134a54c9f0ae8d4ef59e1e833ca917c2 ]
It is preferable to allow suspend even when Bluetooth has problems preparing for sleep. When Bluetooth fails to finish preparing for suspend, log the error and allow the suspend notifier to continue instead.
To also make it clearer why suspend failed, change bt_dev_dbg to bt_dev_err when handling the suspend timeout.
--- net/bluetooth/hci_core.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-)
net/bluetooth/hci_core.c +10 -7
@@ -3289,10 +3289,10 @@ static int hci_suspend_wait_event(struct hci_dev *hdev) WAKE_COND, SUSPEND_NOTIFIER_TIMEOUT);if (ret ==0 ) { -bt_dev_dbg (hdev,"Timed out waiting for suspend" ); +bt_dev_err (hdev,"Timed out waiting for suspend events" );for (i =0 ; i < __SUSPEND_NUM_TASKS; ++i) {if (test_bit (i, hdev->suspend_tasks)) -bt_dev_dbg (hdev,"Bit %d is set" , i); +bt_dev_err (hdev,"Suspend timeout bit: %d" , i);clear_bit (i, hdev->suspend_tasks); }
@@ -3360,12 +3360,15 @@ static int hci_suspend_notifier(struct notifier_block *nb, unsigned long action, ret =hci_change_suspend_state (hdev,BT_RUNNING ); } -/* If suspend failed, restore it to running */ -if (ret && action ==PM_SUSPEND_PREPARE ) -hci_change_suspend_state (hdev,BT_RUNNING ); - done: -return ret ?notifier_from_errno (-EBUSY ) :NOTIFY_STOP ; +/* We always allow suspend even if suspend preparation failed and +* attempt to recover in resume. +*/ +if (ret) +bt_dev_err (hdev,"Suspend notifier action (%lu) failed: %d" , + action, ret); + +return NOTIFY_STOP ; }/* Alloc HCI device */
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 156/464 ath10k: Acquire tx_lock in tx error paths
In reply to Greg Kroah-HartmanFrom: Evan Green <[email protected]>
[ Upstream commit a738e766e3ed92c4ee5ec967777276b5ce11dd2c ]
ath10k_htt_tx_free_msdu_id() has a lockdep assertion that htt->tx_lock is held. Acquire the lock in a couple of error paths when calling that function to ensure this condition is met.
--- drivers/net/wireless/ath/ath10k/htt_tx.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/wireless/ath/ath10k/htt_tx.c +4 -0
@@ -1591,7 +1591,9 @@ static int ath10k_htt_tx_32(struct ath10k_htt *htt, err_unmap_msdu:dma_unmap_single (dev, skb_cb->paddr, msdu->len,DMA_TO_DEVICE ); err_free_msdu_id: +spin_lock_bh (&htt->tx_lock);ath10k_htt_tx_free_msdu_id (htt, msdu_id); +spin_unlock_bh (&htt->tx_lock); err:return res; }
@@ -1798,7 +1800,9 @@ static int ath10k_htt_tx_64(struct ath10k_htt *htt, err_unmap_msdu:dma_unmap_single (dev, skb_cb->paddr, msdu->len,DMA_TO_DEVICE ); err_free_msdu_id: +spin_lock_bh (&htt->tx_lock);ath10k_htt_tx_free_msdu_id (htt, msdu_id); +spin_unlock_bh (&htt->tx_lock); err:return res; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 157/464 Bluetooth: hci_qca: Bug fix during SSR timeout
In reply to Greg Kroah-HartmanFrom: Venkata Lakshmi Narayana Gubba <[email protected]>
[ Upstream commit f98aa80ff78c34fe328eb9cd3e2cc3058e42bcfd ]
Due to race conditions between qca_hw_error and qca_controller_memdump during SSR timeout,the same pointer is freed twice. This results in a double free. Now a lock is acquired before checking the stauts of SSR state.
--- drivers/bluetooth/hci_qca.c | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-)
drivers/bluetooth/hci_qca.c +17 -12
@@ -991,8 +991,11 @@ static void qca_controller_memdump(struct work_struct *work)while ((skb =skb_dequeue (&qca->rx_memdump_q))) {mutex_lock (&qca->hci_memdump_lock); -/* Skip processing the received packets if timeout detected. */ -if (qca->memdump_state ==QCA_MEMDUMP_TIMEOUT ) { +/* Skip processing the received packets if timeout detected +* or memdump collection completed. +*/ +if (qca->memdump_state ==QCA_MEMDUMP_TIMEOUT || + qca->memdump_state ==QCA_MEMDUMP_COLLECTED ) {mutex_unlock (&qca->hci_memdump_lock);return ; }
@@ -1494,8 +1497,6 @@ static void qca_hw_error(struct hci_dev *hdev, u8 code) {struct hci_uart *hu =hci_get_drvdata (hdev);struct qca_data *qca = hu->priv; -struct qca_memdump_data *qca_memdump = qca->qca_memdump; -char *memdump_buf =NULL ;set_bit (QCA_SSR_TRIGGERED , &qca->flags);set_bit (QCA_HW_ERROR_EVENT , &qca->flags);
@@ -1519,19 +1520,23 @@ static void qca_hw_error(struct hci_dev *hdev, u8 code)qca_wait_for_dump_collection (hdev); } +mutex_lock (&qca->hci_memdump_lock);if (qca->memdump_state !=QCA_MEMDUMP_COLLECTED ) {bt_dev_err (hu->hdev,"clearing allocated memory due to memdump timeout" ); -mutex_lock (&qca->hci_memdump_lock); -if (qca_memdump) - memdump_buf = qca_memdump->memdump_buf_head; -vfree (memdump_buf); -kfree (qca_memdump); - qca->qca_memdump =NULL ; +if (qca->qca_memdump) { +vfree (qca->qca_memdump->memdump_buf_head); +kfree (qca->qca_memdump); + qca->qca_memdump =NULL ; + } qca->memdump_state =QCA_MEMDUMP_TIMEOUT ;cancel_delayed_work (&qca->ctrl_memdump_timeout); -skb_queue_purge (&qca->rx_memdump_q); -mutex_unlock (&qca->hci_memdump_lock); + } +mutex_unlock (&qca->hci_memdump_lock); + +if (qca->memdump_state ==QCA_MEMDUMP_TIMEOUT || + qca->memdump_state ==QCA_MEMDUMP_COLLECTED ) {cancel_work_sync (&qca->ctrl_memdump_evt); +skb_queue_purge (&qca->rx_memdump_q); }clear_bit (QCA_HW_ERROR_EVENT , &qca->flags);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 158/464 Bluetooth: hci_qca: Increase SoC idle timeout to 200ms
In reply to Greg Kroah-HartmanFrom: Balakrishna Godavarthi <[email protected]>
[ Upstream commit 2d68476cfc2afa1a1a2d9007a23264ffc6308e77 ]
In some version of WCN399x, SoC idle timeout is configured as 80ms instead of 20ms or 40ms. To honor all the SoC's supported in the driver increasing SoC idle timeout to 200ms.
--- drivers/bluetooth/hci_qca.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/bluetooth/hci_qca.c +1 -1
@@ -46,7 +46,7 @@#define HCI_MAX_IBS_SIZE 10#define IBS_WAKE_RETRANS_TIMEOUT_MS 100 -#define IBS_BTSOC_TX_IDLE_TIMEOUT_MS 40 +#define IBS_BTSOC_TX_IDLE_TIMEOUT_MS 200#define IBS_HOST_TX_IDLE_TIMEOUT_MS 2000#define CMD_TRANS_TIMEOUT_MS 100#define MEMDUMP_TIMEOUT_MS 8000
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 121/464 platform/x86: asus-nb-wmi: add support for ASUS ROG Zephyrus G14 and G15
In reply to Greg Kroah-HartmanFrom: Armas Spann <[email protected]>
[ Upstream commit 13bceda68fb9ef388ad40d355ab8d03ee64d14c2 ]
Add device support for the new ASUS ROG Zephyrus G14 (GA401I) and G15 (GA502I) series.
This is accomplished by two new quirk entries (one per each series), as well as all current available G401I/G502I DMI_PRODUCT_NAMEs to match the corresponding devices.
--- drivers/platform/x86/asus-nb-wmi.c | 82 ++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+)
drivers/platform/x86/asus-nb-wmi.c +82 -0
@@ -110,6 +110,16 @@ static struct quirk_entry quirk_asus_forceals = { .wmi_force_als_set = true, }; +static struct quirk_entry quirk_asus_ga401i = { + .wmi_backlight_power = true, + .wmi_backlight_set_devstate = true, +}; + +static struct quirk_entry quirk_asus_ga502i = { + .wmi_backlight_power = true, + .wmi_backlight_set_devstate = true, +}; +static int dmi_matched (const struct dmi_system_id *dmi) {pr_info ("Identified laptop model '%s'\n" , dmi->ident);
@@ -411,6 +421,78 @@ static const struct dmi_system_id asus_quirks[] = { }, .driver_data = &quirk_asus_forceals, }, + { + .callback = dmi_matched, + .ident = "ASUSTeK COMPUTER INC. GA401IH", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), + DMI_MATCH(DMI_PRODUCT_NAME, "GA401IH"), + }, + .driver_data = &quirk_asus_ga401i, + }, + { + .callback = dmi_matched, + .ident = "ASUSTeK COMPUTER INC. GA401II", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), + DMI_MATCH(DMI_PRODUCT_NAME, "GA401II"), + }, + .driver_data = &quirk_asus_ga401i, + }, + { + .callback = dmi_matched, + .ident = "ASUSTeK COMPUTER INC. GA401IU", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), + DMI_MATCH(DMI_PRODUCT_NAME, "GA401IU"), + }, + .driver_data = &quirk_asus_ga401i, + }, + { + .callback = dmi_matched, + .ident = "ASUSTeK COMPUTER INC. GA401IV", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), + DMI_MATCH(DMI_PRODUCT_NAME, "GA401IV"), + }, + .driver_data = &quirk_asus_ga401i, + }, + { + .callback = dmi_matched, + .ident = "ASUSTeK COMPUTER INC. GA401IVC", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), + DMI_MATCH(DMI_PRODUCT_NAME, "GA401IVC"), + }, + .driver_data = &quirk_asus_ga401i, + }, + { + .callback = dmi_matched, + .ident = "ASUSTeK COMPUTER INC. GA502II", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), + DMI_MATCH(DMI_PRODUCT_NAME, "GA502II"), + }, + .driver_data = &quirk_asus_ga502i, + }, + { + .callback = dmi_matched, + .ident = "ASUSTeK COMPUTER INC. GA502IU", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), + DMI_MATCH(DMI_PRODUCT_NAME, "GA502IU"), + }, + .driver_data = &quirk_asus_ga502i, + }, + { + .callback = dmi_matched, + .ident = "ASUSTeK COMPUTER INC. GA502IV", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), + DMI_MATCH(DMI_PRODUCT_NAME, "GA502IV"), + }, + .driver_data = &quirk_asus_ga502i, + }, {}, };
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 194/464 drm/amdgpu: ensure 0 is returned for success in jpeg_v2_5_wait_for_idle
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
[ Upstream commit 57f01856645afe4c3d0f9915ee2bb043e8dd7982 ]
In the cases where adev->jpeg.num_jpeg_inst is zero or the condition adev->jpeg.harvest_config & (1 << i) is always non-zero the variable ret is never set to an error condition and the function returns an uninitialized value in ret. Since the only exit condition at the end if the function is a success then explicitly return 0 rather than a potentially uninitialized value in ret.
Addresses-Coverity: ("Uninitialized scalar variable")
--- drivers/gpu/drm/amd/amdgpu/jpeg_v2_5.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/jpeg_v2_5.c +1 -1
@@ -462,7 +462,7 @@ static int jpeg_v2_5_wait_for_idle(void *handle)return ret; } -return ret; +return 0 ; } static int jpeg_v2_5_set_clockgating_state(void *handle,
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 198/464 iavf: Fix updating statistics
In reply to Greg Kroah-HartmanFrom: Tony Nguyen <[email protected]>
[ Upstream commit 9358076642f14cec8c414850d5a909cafca3a9d6 ]
Commit bac8486116b0 ("iavf: Refactor the watchdog state machine") inverted the logic for when to update statistics. Statistics should be updated when no other commands are pending, instead they were only requested when a command was processed. iavf_request_stats() would see a pending request and not request statistics to be updated. This caused statistics to never be updated; fix the logic.
--- drivers/net/ethernet/intel/iavf/iavf_main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/iavf/iavf_main.c +4 -1
@@ -1948,7 +1948,10 @@ static void iavf_watchdog_task(struct work_struct *work)iavf_send_api_ver (adapter); } }else { -if (!iavf_process_aq_command (adapter) && +/* An error will be returned if no commands were +* processed; use this opportunity to update stats +*/ +if (iavf_process_aq_command (adapter) && adapter->state == __IAVF_RUNNING)iavf_request_stats (adapter); }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 143/464 drm/amdgpu: use the unlocked drm_gem_object_put
In reply to Greg Kroah-HartmanFrom: Emil Velikov <[email protected]>
[ Upstream commit 1a87f67a66de4ad0c0d79fd86b6c5273143387c3 ]
The driver does not hold struct_mutex, thus using the locked version of the helper is incorrect.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c +1 -1
@@ -587,7 +587,7 @@ struct drm_gem_object *amdgpu_gem_prime_import(struct drm_device *dev, attach =dma_buf_dynamic_attach (dma_buf, dev->dev, &amdgpu_dma_buf_attach_ops, obj);if (IS_ERR (attach)) { -drm_gem_object_put (obj); +drm_gem_object_put_unlocked (obj);return ERR_CAST (attach); }
Signature · 8 lines
2.25.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Greg Kroah-Hartman
maintainerPATCH 199/464 dma-buf: fix dma-fence-chain out of order test
In reply to Greg Kroah-HartmanFrom: Lionel Landwerlin <[email protected]>
[ Upstream commit 4cca2e641641767593583749dec26bfebd8f6f2d ]
There was probably a misunderstand on how the dma-fence-chain is supposed to work or what dma_fence_chain_find_seqno() is supposed to return.
dma_fence_chain_find_seqno() is here to give us the fence to wait upon for a particular point in the timeline. The timeline progresses only when all the points prior to a given number have completed.
--- drivers/dma-buf/st-dma-fence-chain.c | 43 ++++++++++++++-------------- 1 file changed, 21 insertions(+), 22 deletions(-)
drivers/dma-buf/st-dma-fence-chain.c +21 -22
@@ -318,15 +318,16 @@ static int find_out_of_order(void *arg) goto err; } -if (fence && fence != fc.chains[1 ]) { +/* +* We signaled the middle fence (2) of the 1-2-3 chain. The behavior +* of the dma-fence-chain is to make us wait for all the fences up to +* the point we want. Since fence 1 is still not signaled, this what +* we should get as fence to wait upon (fence 2 being garbage +* collected during the traversal of the chain). +*/ +if (fence != fc.chains[0 ]) {pr_err ("Incorrect chain-fence.seqno:%lld reported for completed seqno:2\n" , - fence->seqno); - -dma_fence_get (fence); - err =dma_fence_chain_find_seqno (&fence,2 ); -dma_fence_put (fence); -if (err) -pr_err ("Reported %d for finding self!\n" , err); + fence ? fence->seqno :0 ); err = -EINVAL ; }
@@ -415,20 +416,18 @@ static int __find_race(void *arg)if (!fence) goto signal; - err =dma_fence_chain_find_seqno (&fence, seqno); -if (err) { -pr_err ("Reported an invalid fence for find-self:%d\n" , - seqno); -dma_fence_put (fence); -break ; - } - -if (fence->seqno < seqno) { -pr_err ("Reported an earlier fence.seqno:%lld for seqno:%d\n" , - fence->seqno, seqno); - err = -EINVAL ; -dma_fence_put (fence); -break ; +/* +* We can only find ourselves if we are on fence we were +* looking for. +*/ +if (fence->seqno == seqno) { + err =dma_fence_chain_find_seqno (&fence, seqno); +if (err) { +pr_err ("Reported an invalid fence for find-self:%d\n" , + seqno); +dma_fence_put (fence); +break ; + } }dma_fence_put (fence);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 200/464 RDMA/core: Fix bogus WARN_ON during ib_unregister_device_queued()
In reply to Greg Kroah-HartmanFrom: Jason Gunthorpe <[email protected]>
[ Upstream commit 0cb42c0265837fafa2b4f302c8a7fed2631d7869 ]
ib_unregister_device_queued() can only be used by drivers using the new dealloc_device callback flow, and it has a safety WARN_ON to ensure drivers are using it properly.
However, if unregister and register are raced there is a special destruction path that maintains the uniform error handling semantic of 'caller does ib_dealloc_device() on failure'. This requires disabling the dealloc_device callback which triggers the WARN_ON.
Instead of using NULL to disable the callback use a special function pointer so the WARN_ON does not trigger.
--- drivers/infiniband/core/device.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/infiniband/core/device.c +8 -3
@@ -1339,6 +1339,10 @@ static int enable_device_and_get(struct ib_device *device)return ret; } +static void prevent_dealloc_device (struct ib_device *ib_dev) +{ +} +/** * ib_register_device - Register an IB device with IB core * @device: Device to register
@@ -1409,11 +1413,11 @@ int ib_register_device(struct ib_device *device, const char *name)* possibility for a parallel unregistration along with this * error flow. Since we have a refcount here we know any * parallel flow is stopped in disable_device and will see the -* NULL pointers, causing the responsibility to +* special dealloc_driver pointer, causing the responsibility to * ib_dealloc_device() to revert back to this thread. */ dealloc_fn = device->ops.dealloc_driver; - device->ops.dealloc_driver =NULL ; + device->ops.dealloc_driver = prevent_dealloc_device;ib_device_put (device);__ib_unregister_device (device); device->ops.dealloc_driver = dealloc_fn;
@@ -1462,7 +1466,8 @@ static void __ib_unregister_device(struct ib_device *ib_dev)* Drivers using the new flow may not call ib_dealloc_device except * in error unwind prior to registration success. */ -if (ib_dev->ops.dealloc_driver) { +if (ib_dev->ops.dealloc_driver && + ib_dev->ops.dealloc_driver != prevent_dealloc_device) {WARN_ON (kref_read (&ib_dev->dev.kobj.kref) <=1 );ib_dealloc_device (ib_dev); }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 201/464 scsi: powertec: Fix different dev_id between request_irq() and free_irq()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit d179f7c763241c1dc5077fca88ddc3c47d21b763 ]
The dev_id used in request_irq() and free_irq() should match. Use 'info' in both cases.
--- drivers/scsi/arm/powertec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/arm/powertec.c +1 -1
@@ -378,7 +378,7 @@ static int powertecscsi_probe(struct expansion_card *ec,if (info->info.scsi.dma !=NO_DMA )free_dma (info->info.scsi.dma); -free_irq (ec->irq, host); +free_irq (ec->irq, info); out_release:fas216_release (host);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 127/464 mmc: sdhci-pci-o2micro: Bug fix for O2 host controller Seabird1
In reply to Greg Kroah-HartmanFrom: shirley her <[email protected]>
[ Upstream commit cdd2b769789ae1a030e1a26f6c37c5833cabcb34 ]
To fix support for the O2 host controller Seabird1, set the quirk SDHCI_QUIRK2_PRESET_VALUE_BROKEN and the capability bit MMC_CAP2_NO_SDIO. Moreover, assign the ->get_cd() callback.
--- drivers/mmc/host/sdhci-pci-o2micro.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/mmc/host/sdhci-pci-o2micro.c +6 -0
@@ -561,6 +561,12 @@ static int sdhci_pci_o2_probe_slot(struct sdhci_pci_slot *slot) slot->host->mmc_host_ops.get_cd = sdhci_o2_get_cd; } +if (chip->pdev->device ==PCI_DEVICE_ID_O2_SEABIRD1 ) { + slot->host->mmc_host_ops.get_cd = sdhci_o2_get_cd; + host->mmc->caps2 |=MMC_CAP2_NO_SDIO ; + host->quirks2 |=SDHCI_QUIRK2_PRESET_VALUE_BROKEN ; + } + host->mmc_host_ops.execute_tuning = sdhci_o2_execute_tuning;if (chip->pdev->device !=PCI_DEVICE_ID_O2_FUJIN2 )
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 205/464 media: allegro: Fix some NULL vs IS_ERR() checks in probe
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit d93d45ab716e4107056be54969c8c70e50a8346d ]
The devm_ioremap() function doesn't return error pointers, it returns NULL on error.
--- drivers/staging/media/allegro-dvt/allegro-core.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/staging/media/allegro-dvt/allegro-core.c +4 -4
@@ -3065,9 +3065,9 @@ static int allegro_probe(struct platform_device *pdev)return -EINVAL ; } regs =devm_ioremap (&pdev->dev, res->start,resource_size (res)); -if (IS_ERR (regs)) { +if (!regs) {dev_err (&pdev->dev,"failed to map registers\n" ); -return PTR_ERR (regs); +return -ENOMEM ; } dev->regmap =devm_regmap_init_mmio (&pdev->dev, regs, &allegro_regmap_config);
@@ -3085,9 +3085,9 @@ static int allegro_probe(struct platform_device *pdev) sram_regs =devm_ioremap (&pdev->dev, sram_res->start,resource_size (sram_res)); -if (IS_ERR (sram_regs)) { +if (!sram_regs) {dev_err (&pdev->dev,"failed to map sram\n" ); -return PTR_ERR (sram_regs); +return -ENOMEM ; } dev->sram =devm_regmap_init_mmio (&pdev->dev, sram_regs, &allegro_sram_config);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 174/464 media: omap3isp: Add missed v4l2_ctrl_handler_free() for preview_init_entities()
In reply to Greg Kroah-HartmanFrom: Chuhong Yuan <[email protected]>
[ Upstream commit dc7690a73017e1236202022e26a6aa133f239c8c ]
preview_init_entities() does not call v4l2_ctrl_handler_free() when it fails.
Add the missed function to fix it.
--- drivers/media/platform/omap3isp/isppreview.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/media/platform/omap3isp/isppreview.c +3 -1
@@ -2287,7 +2287,7 @@ static int preview_init_entities(struct isp_prev_device *prev) me->ops = &preview_media_ops; ret =media_entity_pads_init (me,PREV_PADS_NUM , pads);if (ret <0 ) -return ret; + goto error_handler_free;preview_init_formats (sd,NULL );
@@ -2320,6 +2320,8 @@ static int preview_init_entities(struct isp_prev_device *prev)omap3isp_video_cleanup (&prev->video_in); error_video_in:media_entity_cleanup (&prev->subdev.entity); +error_handler_free: +v4l2_ctrl_handler_free (&prev->ctrls);return ret; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 210/464 media: cros-ec-cec: do not bail on device_init_wakeup failure
In reply to Greg Kroah-HartmanFrom: Dariusz Marcinkiewicz <[email protected]>
[ Upstream commit 6f01dfb760c027d5dd6199d91ee9599f2676b5c6 ]
Do not fail probing when device_init_wakeup fails.
device_init_wakeup fails when the device is already enabled as wakeup device. Hence, the driver fails to probe the device if:
- The device has already been enabled for wakeup (by e.g. sysfs)
- The driver has been unloaded and is being loaded again.
This goal of the patch is to fix the above cases.
Overwhelming majority of the drivers do not check device_init_wakeup return code.
--- drivers/media/cec/platform/cros-ec/cros-ec-cec.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/media/cec/platform/cros-ec/cros-ec-cec.c +1 -5
@@ -277,11 +277,7 @@ static int cros_ec_cec_probe(struct platform_device *pdev)platform_set_drvdata (pdev, cros_ec_cec); cros_ec_cec->cros_ec = cros_ec; - ret =device_init_wakeup (&pdev->dev,1 ); -if (ret) { -dev_err (&pdev->dev,"failed to initialize wakeup\n" ); -return ret; - } +device_init_wakeup (&pdev->dev,1 ); cros_ec_cec->adap = cec_allocate_adapter(&cros_ec_cec_ops, cros_ec_cec, DRV_NAME,
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 209/464 media: exynos4-is: Add missed check for pinctrl_lookup_state()
In reply to Greg Kroah-HartmanFrom: Chuhong Yuan <[email protected]>
[ Upstream commit 18ffec750578f7447c288647d7282c7d12b1d969 ]
fimc_md_get_pinctrl() misses a check for pinctrl_lookup_state(). Add the missed check to fix it.
--- drivers/media/platform/exynos4-is/media-dev.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/media/platform/exynos4-is/media-dev.c +3 -0
@@ -1270,6 +1270,9 @@ static int fimc_md_get_pinctrl(struct fimc_md *fmd) pctl->state_idle =pinctrl_lookup_state (pctl->pinctrl,PINCTRL_STATE_IDLE ); +if (IS_ERR (pctl->state_idle)) +return PTR_ERR (pctl->state_idle); +return 0 ; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 212/464 xfs: dont eat an EIO/ENOSPC writeback error when scrubbing data fork
In reply to Greg Kroah-HartmanFrom: Darrick J. Wong <[email protected]>
[ Upstream commit eb0efe5063bb10bcb653e4f8e92a74719c03a347 ]
The data fork scrubber calls filemap_write_and_wait to flush dirty pages and delalloc reservations out to disk prior to checking the data fork's extent mappings. Unfortunately, this means that scrub can consume the EIO/ENOSPC errors that would otherwise have stayed around in the address space until (we hope) the writer application calls fsync to persist data and collect errors. The end result is that programs that wrote to a file might never see the error code and proceed as if nothing were wrong.
xfs_scrub is not in a position to notify file writers about the writeback failure, and it's only here to check metadata, not file contents. Therefore, if writeback fails, we should stuff the error code back into the address space so that an fsync by the writer application can pick that up.
--- fs/xfs/scrub/bmap.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-)
fs/xfs/scrub/bmap.c +20 -2
@@ -45,9 +45,27 @@ xchk_setup_inode_bmap(*/ if (S_ISREG (VFS_I (sc->ip)->i_mode) && sc->sm->sm_type ==XFS_SCRUB_TYPE_BMBTD ) { +struct address_space *mapping =VFS_I (sc->ip)->i_mapping; +inode_dio_wait (VFS_I (sc->ip)); - error =filemap_write_and_wait (VFS_I (sc->ip)->i_mapping); -if (error) + +/* +* Try to flush all incore state to disk before we examine the +* space mappings for the data fork. Leave accumulated errors +* in the mapping for the writer threads to consume. +* +* On ENOSPC or EIO writeback errors, we continue into the +* extent mapping checks because write failures do not +* necessarily imply anything about the correctness of the file +* metadata. The metadata and the file data could be on +* completely separate devices; a media failure might only +* affect a subset of the disk, etc. We can handle delalloc +* extents in the scrubber, so leaving them in memory is fine. +*/ + error =filemap_fdatawrite (mapping); +if (!error) + error =filemap_fdatawait_keep_errors (mapping); +if (error && (error != -ENOSPC && error != -EIO )) goto out; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 218/464 drm/stm: repair runtime power management
In reply to Greg Kroah-HartmanFrom: Marek Vasut <[email protected]>
[ Upstream commit ebd267b2e3c25d5f93a08528b47c036569eb8744 ]
Add missing pm_runtime_get_sync() into ltdc_crtc_atomic_enable() to match pm_runtime_put_sync() in ltdc_crtc_atomic_disable(), otherwise the LTDC might suspend via runtime PM, disable clock, and then fail to resume later on.
The test which triggers it is roughly -- run qt5 application which uses eglfs platform and etnaviv, stop the application, sleep for 15 minutes, run the application again. This leads to a timeout waiting for vsync, because the LTDC has suspended, but did not resume.
--- drivers/gpu/drm/stm/ltdc.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/stm/ltdc.c +3 -0
@@ -423,9 +423,12 @@ static void ltdc_crtc_atomic_enable(struct drm_crtc *crtc, struct drm_crtc_state *old_state) {struct ltdc_device *ldev =crtc_to_ltdc (crtc); +struct drm_device *ddev = crtc->dev;DRM_DEBUG_DRIVER ("\n" ); +pm_runtime_get_sync (ddev->dev); +/* Sets the background color value */ reg_write (ldev->regs,LTDC_BCCR ,BCCR_BCBLACK );
Signature · 8 lines
2.25.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Greg Kroah-Hartman
maintainerPATCH 191/464 tracing: Move pipe reference to trace array instead of current_tracer
In reply to Greg Kroah-HartmanFrom: Steven Rostedt (VMware) <[email protected]>
[ Upstream commit 7ef282e05132d56b6f6b71e3873f317664bea78b ]
If a process has the trace_pipe open on a trace_array, the current tracer for that trace array should not be changed. This was original enforced by a global lock, but when instances were introduced, it was moved to the current_trace. But this structure is shared by all instances, and a trace_pipe is for a single instance. There's no reason that a process that has trace_pipe open on one instance should prevent another instance from changing its current tracer. Move the reference counter to the trace_array instead.
This is marked as "Fixes" but is more of a clean up than a true fix. Backport if you want, but its not critical.
--- kernel/trace/trace.c | 12 ++++++------ kernel/trace/trace.h | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-)
kernel/trace/trace.c +6 -6
@@ -5887,7 +5887,7 @@ int tracing_set_tracer(struct trace_array *tr, const char *buf) }/* If trace pipe files are being read, we can't change the tracer */ -if (tr->current_trace->ref) { +if (tr->trace_ref) { ret = -EBUSY ; goto out; }
@@ -6103,7 +6103,7 @@ static int tracing_open_pipe(struct inode *inode, struct file *filp)nonseekable_open (inode, filp); - tr->current_trace->ref++; + tr->trace_ref++; out:mutex_unlock (&trace_types_lock);return ret;
@@ -6122,7 +6122,7 @@ static int tracing_release_pipe(struct inode *inode, struct file *file)mutex_lock (&trace_types_lock); - tr->current_trace->ref--; + tr->trace_ref--;if (iter->trace->pipe_close) iter->trace->pipe_close (iter);
@@ -7424,7 +7424,7 @@ static int tracing_buffers_open(struct inode *inode, struct file *filp) filp->private_data = info; - tr->current_trace->ref++; + tr->trace_ref++;mutex_unlock (&trace_types_lock);
@@ -7525,7 +7525,7 @@ static int tracing_buffers_release(struct inode *inode, struct file *file)mutex_lock (&trace_types_lock); - iter->tr->current_trace->ref--; + iter->tr->trace_ref--;__trace_array_put (iter->tr);
@@ -8733,7 +8733,7 @@ static int __remove_instance(struct trace_array *tr)int i;/* Reference counter for a newly created trace array = 1. */ -if (tr->ref >1 || (tr->current_trace && tr->current_trace->ref)) +if (tr->ref >1 || (tr->current_trace && tr->trace_ref))return -EBUSY ;list_del (&tr->list);
kernel/trace/trace.h +1 -1
@@ -356,6 +356,7 @@ struct trace_array {struct trace_event_file *trace_marker_file;cpumask_var_t tracing_cpumask;/* only trace on set CPUs */ int ref; +int trace_ref;#ifdef CONFIG_FUNCTION_TRACER struct ftrace_ops *ops;struct trace_pid_list __rcu *function_pids;
@@ -547,7 +548,6 @@ struct tracer {struct tracer *next;struct tracer_flags *flags;int enabled; -int ref;bool print_max;bool allow_instances;#ifdef CONFIG_TRACER_MAX_TRACE
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 190/464 net: ethernet: ti: am65-cpsw-nuss: restore vlan configuration while down/up
In reply to Greg Kroah-HartmanFrom: Grygorii Strashko <[email protected]>
[ Upstream commit 7bcffde02152dd3cb180f6f3aef27e8586b2a905 ]
The vlan configuration is not restored after interface down/up sequence.
Steps to check:
# ip link add link eth0 name eth0.100 type vlan id 100 # ifconfig eth0 down # ifconfig eth0 up
This patch fixes it, restoring vlan ALE entries on .ndo_open().
--- drivers/net/ethernet/ti/am65-cpsw-nuss.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
drivers/net/ethernet/ti/am65-cpsw-nuss.c +19 -0
@@ -223,6 +223,9 @@ static int am65_cpsw_nuss_ndo_slave_add_vid(struct net_device *ndev,u32 port_mask, unreg_mcast =0 ;int ret; +if (!netif_running (ndev) || !vid) +return 0 ; + ret =pm_runtime_get_sync (common->dev);if (ret <0 ) {pm_runtime_put_noidle (common->dev);
@@ -246,6 +249,9 @@ static int am65_cpsw_nuss_ndo_slave_kill_vid(struct net_device *ndev,struct am65_cpsw_common *common =am65_ndev_to_common (ndev);int ret; +if (!netif_running (ndev) || !vid) +return 0 ; + ret =pm_runtime_get_sync (common->dev);if (ret <0 ) {pm_runtime_put_noidle (common->dev);
@@ -571,6 +577,16 @@ static int am65_cpsw_nuss_ndo_slave_stop(struct net_device *ndev)return 0 ; } +static int cpsw_restore_vlans (struct net_device *vdev,int vid,void *arg) +{ +struct am65_cpsw_port *port = arg; + +if (!vdev) +return 0 ; + +return am65_cpsw_nuss_ndo_slave_add_vid (port->ndev,0 , vid); +} +static int am65_cpsw_nuss_ndo_slave_open (struct net_device *ndev) {struct am65_cpsw_common *common =am65_ndev_to_common (ndev);
@@ -644,6 +660,9 @@ static int am65_cpsw_nuss_ndo_slave_open(struct net_device *ndev) } } +/* restore vlan configurations */ +vlan_for_each (ndev, cpsw_restore_vlans, port); +phy_attached_info (port->slave.phy);phy_start (port->slave.phy);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 193/464 drm/amdgpu/debugfs: fix memory leak when amdgpu_virt_enable_access_debugfs failed
In reply to Greg Kroah-HartmanFrom: Chen Tao <[email protected]>
[ Upstream commit 888e32d71115e26b57bdcbc717c68e9c5026bac3 ]
Fix memory leak in amdgpu_debugfs_gpr_read not freeing data when amdgpu_virt_enable_access_debugfs failed.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +1 -1
@@ -977,7 +977,7 @@ static ssize_t amdgpu_debugfs_gpr_read(struct file *f, char __user *buf, r =amdgpu_virt_enable_access_debugfs (adev);if (r <0 ) -return r; + goto err;/* switch to the specific se/sh/cu */ mutex_lock (&adev->grbm_idx_mutex);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 181/464 ASoC: Intel: Boards: cml_rt1011_rt5682: use statically define codec config
In reply to Greg Kroah-HartmanFrom: Fred Oh <[email protected]>
[ Upstream commit 8a473c39ae54c27e694a131c34a739d0f8aa5300 ]
When the cml_rt1011_rt5682_dailink[].codecs pointer is overridden by a quirk with a devm allocated structure and the probe is deferred, in the next probe we will see an use-after-free condition (verified with KASAN). This can be avoided by using statically allocated configurations - which simplifies the code quite a bit as well.
KASAN issue fixed.
[ 23.301373] cml_rt1011_rt5682 cml_rt1011_rt5682: sof_rt1011_quirk = f [ 23.301875] ================================================================== [ 23.302018] BUG: KASAN: use-after-free in snd_cml_rt1011_probe+0x23a/0x3d0 [snd_soc_cml_rt1011_rt5682] [ 23.302178] Read of size 8 at addr ffff8881ec6acae0 by task kworker/0:2/105 [ 23.302320] CPU: 0 PID: 105 Comm: kworker/0:2 Not tainted 5.7.0-rc7-test+ #3 [ 23.302322] Hardware name: Google Helios/Helios, BIOS 01/21/2020 [ 23.302329] Workqueue: events deferred_probe_work_func [ 23.302331] Call Trace: [ 23.302339] dump_stack+0x76/0xa0 [ 23.302345] print_address_description.constprop.0.cold+0xd3/0x43e [ 23.302351] ? _raw_spin_lock_irqsave+0x7b/0xd0 [ 23.302355] ? _raw_spin_trylock_bh+0xf0/0xf0 [ 23.302362] ? snd_cml_rt1011_probe+0x23a/0x3d0 [snd_soc_cml_rt1011_rt5682] [ 23.302365] __kasan_report.cold+0x37/0x86 [ 23.302371] ? snd_cml_rt1011_probe+0x23a/0x3d0 [snd_soc_cml_rt1011_rt5682] [ 23.302375] kasan_report+0x38/0x50 [ 23.302382] snd_cml_rt1011_probe+0x23a/0x3d0 [snd_soc_cml_rt1011_rt5682] [ 23.302389] platform_drv_probe+0x66/0xc0
--- sound/soc/intel/boards/cml_rt1011_rt5682.c | 83 ++++++---------------- 1 file changed, 23 insertions(+), 60 deletions(-)
sound/soc/intel/boards/cml_rt1011_rt5682.c +23 -60
@@ -34,7 +34,6 @@#define SOF_RT1011_SPEAKER_WR BIT(1)#define SOF_RT1011_SPEAKER_TL BIT(2)#define SOF_RT1011_SPEAKER_TR BIT(3) -#define SPK_CH 4/* Default: Woofer speakers */ static unsigned long sof_rt1011_quirk = SOF_RT1011_SPEAKER_WL |
@@ -376,10 +375,17 @@ SND_SOC_DAILINK_DEF(ssp0_codec,SND_SOC_DAILINK_DEF (ssp1_pin,DAILINK_COMP_ARRAY (COMP_CPU ("SSP1 Pin" ))); -SND_SOC_DAILINK_DEF (ssp1_codec, +SND_SOC_DAILINK_DEF (ssp1_codec_2spk,DAILINK_COMP_ARRAY (/* WL */ COMP_CODEC ("i2c-10EC1011:00" ,CML_RT1011_CODEC_DAI ),/* WR */ COMP_CODEC ("i2c-10EC1011:01" ,CML_RT1011_CODEC_DAI ))); +SND_SOC_DAILINK_DEF (ssp1_codec_4spk, +DAILINK_COMP_ARRAY ( +/* WL */ COMP_CODEC ("i2c-10EC1011:00" ,CML_RT1011_CODEC_DAI ), +/* WR */ COMP_CODEC ("i2c-10EC1011:01" ,CML_RT1011_CODEC_DAI ), +/* TL */ COMP_CODEC ("i2c-10EC1011:02" ,CML_RT1011_CODEC_DAI ), +/* TR */ COMP_CODEC ("i2c-10EC1011:03" ,CML_RT1011_CODEC_DAI ))); +SND_SOC_DAILINK_DEF (dmic_pin,DAILINK_COMP_ARRAY (COMP_CPU ("DMIC01 Pin" )));
@@ -475,7 +481,7 @@ static struct snd_soc_dai_link cml_rt1011_rt5682_dailink[] = { .no_pcm = 1, .init = cml_rt1011_spk_init, .ops = &cml_rt1011_ops, - SND_SOC_DAILINK_REG(ssp1_pin, ssp1_codec, platform), + SND_SOC_DAILINK_REG(ssp1_pin, ssp1_codec_2spk, platform), }, };
@@ -488,6 +494,15 @@ static struct snd_soc_codec_conf rt1011_conf[] = { .dlc = COMP_CODEC_CONF("i2c-10EC1011:01"), .name_prefix = "WR", }, +/* single configuration structure for 2 and 4 channels */ + { + .dlc = COMP_CODEC_CONF("i2c-10EC1011:02"), + .name_prefix = "TL", + }, + { + .dlc = COMP_CODEC_CONF("i2c-10EC1011:03"), + .name_prefix = "TR", + }, };/* Cometlake audio machine driver for RT1011 and RT5682 */
@@ -510,8 +525,6 @@ static struct snd_soc_card snd_soc_card_cml = {static int snd_cml_rt1011_probe (struct platform_device *pdev) { -struct snd_soc_dai_link_component *rt1011_dais_components; -struct snd_soc_codec_conf *rt1011_dais_confs;struct card_private *ctx;struct snd_soc_acpi_mach *mach;const char *platform_name;
@@ -530,65 +543,15 @@ static int snd_cml_rt1011_probe(struct platform_device *pdev)dev_info (&pdev->dev,"sof_rt1011_quirk = %lx\n" , sof_rt1011_quirk); +/* when 4 speaker is available, update codec config */ if (sof_rt1011_quirk & (SOF_RT1011_SPEAKER_TL |SOF_RT1011_SPEAKER_TR )) { - rt1011_dais_confs =devm_kzalloc (&pdev->dev, -sizeof (struct snd_soc_codec_conf ) * -SPK_CH ,GFP_KERNEL ); - -if (!rt1011_dais_confs) -return -ENOMEM ; - - rt1011_dais_components =devm_kzalloc (&pdev->dev, -sizeof (struct snd_soc_dai_link_component ) * -SPK_CH ,GFP_KERNEL ); - -if (!rt1011_dais_components) -return -ENOMEM ; - -for (i =0 ; i <SPK_CH ; i++) { - rt1011_dais_confs[i].dlc.name =devm_kasprintf (&pdev->dev, -GFP_KERNEL , -"i2c-10EC1011:0%d" , - i); - -if (!rt1011_dais_confs[i].dlc.name) -return -ENOMEM ; - -switch (i) { -case 0 : - rt1011_dais_confs[i].name_prefix ="WL" ; -break ; -case 1 : - rt1011_dais_confs[i].name_prefix ="WR" ; -break ; -case 2 : - rt1011_dais_confs[i].name_prefix ="TL" ; -break ; -case 3 : - rt1011_dais_confs[i].name_prefix ="TR" ; -break ; -default : -return -EINVAL ; - } - rt1011_dais_components[i].name =devm_kasprintf (&pdev->dev, -GFP_KERNEL , -"i2c-10EC1011:0%d" , - i); -if (!rt1011_dais_components[i].name) -return -ENOMEM ; - - rt1011_dais_components[i].dai_name =CML_RT1011_CODEC_DAI ; - } - - snd_soc_card_cml.codec_conf = rt1011_dais_confs; - snd_soc_card_cml.num_configs =SPK_CH ; -for (i =0 ; i <ARRAY_SIZE (cml_rt1011_rt5682_dailink); i++) {if (!strcmp (cml_rt1011_rt5682_dailink[i].codecs->dai_name, -CML_RT1011_CODEC_DAI )) { - cml_rt1011_rt5682_dailink[i].codecs = rt1011_dais_components; - cml_rt1011_rt5682_dailink[i].num_codecs =SPK_CH ; +CML_RT1011_CODEC_DAI )) { + cml_rt1011_rt5682_dailink[i].codecs = ssp1_codec_4spk; + cml_rt1011_rt5682_dailink[i].num_codecs = +ARRAY_SIZE (ssp1_codec_4spk); } } }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 227/464 scsi: scsi_debug: Add check for sdebug_max_queue during module init
In reply to Greg Kroah-HartmanFrom: John Garry <[email protected]>
[ Upstream commit c87bf24cfb60bce27b4d2c7e56ebfd86fb9d16bb ]
sdebug_max_queue should not exceed SDEBUG_CANQUEUE, otherwise crashes like this can be triggered by passing an out-of-range value:
Hardware name: Huawei D06 /D06, BIOS Hisilicon D06 UEFI RC0 - V1.16.01 03/15/2019 pstate: 20400009 (nzCv daif +PAN -UAO BTYPE=--) pc : schedule_resp+0x2a4/0xa70 [scsi_debug] lr : schedule_resp+0x52c/0xa70 [scsi_debug] sp : ffff800022ab36f0 x29: ffff800022ab36f0 x28: ffff0023a935a610 x27: ffff800008e0a648 x26: 0000000000000003 x25: ffff0023e84f3200 x24: 00000000003d0900 x23: 0000000000000000 x22: 0000000000000000 x21: ffff0023be60a320 x20: ffff0023be60b538 x19: ffff800008e13000 x18: 0000000000000000 x17: 0000000000000000 x16: 0000000000000000 x15: 0000000000000000 x14: 0000000000000000 x13: 0000000000000000 x12: 0000000000000000 x11: 0000000000000000 x10: 0000000000000000 x9 : 0000000000000001 x8 : 0000000000000000 x7 : 0000000000000000 x6 : 00000000000000c1 x5 : 0000020000200000 x4 : dead0000000000ff x3 : 0000000000000200 x2 : 0000000000000200 x1 : ffff800008e13d88 x0 : 0000000000000000 Call trace: schedule_resp+0x2a4/0xa70 [scsi_debug] scsi_debug_queuecommand+0x2c4/0x9e0 [scsi_debug] scsi_queue_rq+0x698/0x840 __blk_mq_try_issue_directly+0x108/0x228 blk_mq_request_issue_directly+0x58/0x98 blk_mq_try_issue_list_directly+0x5c/0xf0 blk_mq_sched_insert_requests+0x18c/0x200 blk_mq_flush_plug_list+0x11c/0x190 blk_flush_plug_list+0xdc/0x110 blk_finish_plug+0x38/0x210 blkdev_direct_IO+0x450/0x4d8 generic_file_read_iter+0x84/0x180 blkdev_read_iter+0x3c/0x50 aio_read+0xc0/0x170 io_submit_one+0x5c8/0xc98 __arm64_sys_io_submit+0x1b0/0x258 el0_svc_common.constprop.3+0x68/0x170 do_el0_svc+0x24/0x90 el0_sync_handler+0x13c/0x1a8 el0_sync+0x158/0x180 Code: 528847e0 72a001e0 6b00003f 540018cd (3941c340)
In addition, it should not be less than 1.
So add checks for these, and fail the module init for those cases.
[mkp: changed if condition to match error message]
--- drivers/scsi/scsi_debug.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/scsi/scsi_debug.c +6 -0
@@ -6610,6 +6610,12 @@ static int __init scsi_debug_init(void)pr_err ("submit_queues must be 1 or more\n" );return -EINVAL ; } + +if ((sdebug_max_queue >SDEBUG_CANQUEUE ) || (sdebug_max_queue <1 )) { +pr_err ("max_queue must be in range [1, %d]\n" ,SDEBUG_CANQUEUE ); +return -EINVAL ; + } + sdebug_q_arr =kcalloc (submit_queues,sizeof (struct sdebug_queue ),GFP_KERNEL );if (sdebug_q_arr ==NULL )
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 229/464 mwifiex: Prevent memory corruption handling keys
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit e18696786548244914f36ec3c46ac99c53df99c3 ]
The length of the key comes from the network and it's a 16 bit number. It needs to be capped to prevent a buffer overflow.
--- .../wireless/marvell/mwifiex/sta_cmdresp.c | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-)
drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c +15 -7
@@ -580,6 +580,11 @@ static int mwifiex_ret_802_11_key_material_v1(struct mwifiex_private *priv, {struct host_cmd_ds_802_11_key_material *key = &resp->params.key_material; +int len; + + len =le16_to_cpu (key->key_param_set.key_len); +if (len >sizeof (key->key_param_set.key)) +return -EINVAL ;if (le16_to_cpu (key->action) == HostCmd_ACT_GEN_SET) {if ((le16_to_cpu (key->key_param_set.key_info) &KEY_MCAST )) {
@@ -593,9 +598,8 @@ static int mwifiex_ret_802_11_key_material_v1(struct mwifiex_private *priv,memset (priv->aes_key.key_param_set.key,0 ,sizeof (key->key_param_set.key)); - priv->aes_key.key_param_set.key_len = key->key_param_set.key_len; -memcpy (priv->aes_key.key_param_set.key, key->key_param_set.key, -le16_to_cpu (priv->aes_key.key_param_set.key_len)); + priv->aes_key.key_param_set.key_len =cpu_to_le16 (len); +memcpy (priv->aes_key.key_param_set.key, key->key_param_set.key, len);return 0 ; }
@@ -610,9 +614,14 @@ static int mwifiex_ret_802_11_key_material_v2(struct mwifiex_private *priv, struct host_cmd_ds_command *resp) {struct host_cmd_ds_802_11_key_material_v2 *key_v2; -__le16 len; +int len; key_v2 = &resp->params.key_material_v2; + + len =le16_to_cpu (key_v2->key_param_set.key_params.aes.key_len); +if (len >WLAN_KEY_LEN_CCMP ) +return -EINVAL ; +if (le16_to_cpu (key_v2->action) == HostCmd_ACT_GEN_SET) {if ((le16_to_cpu (key_v2->key_param_set.key_info) &KEY_MCAST )) {mwifiex_dbg (priv->adapter,INFO ,"info: key: GTK is set\n" );
@@ -628,10 +637,9 @@ static int mwifiex_ret_802_11_key_material_v2(struct mwifiex_private *priv,memset (priv->aes_key_v2.key_param_set.key_params.aes.key,0 ,WLAN_KEY_LEN_CCMP ); priv->aes_key_v2.key_param_set.key_params.aes.key_len = - key_v2->key_param_set.key_params.aes.key_len; - len = priv->aes_key_v2.key_param_set.key_params.aes.key_len; +cpu_to_le16 (len);memcpy (priv->aes_key_v2.key_param_set.key_params.aes.key, - key_v2->key_param_set.key_params.aes.key,le16_to_cpu (len)); + key_v2->key_param_set.key_params.aes.key, len);return 0 ; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 233/464 powerpc/vdso: Fix vdso cpu truncation
In reply to Greg Kroah-HartmanFrom: Milton Miller <[email protected]>
[ Upstream commit a9f675f950a07d5c1dbcbb97aabac56f5ed085e3 ]
The code in vdso_cpu_init that exposes the cpu and numa node to userspace via SPRG_VDSO incorrctly masks the cpu to 12 bits. This means that any kernel running on a box with more than 4096 threads (NR_CPUS advertises a limit of of 8192 cpus) would expose userspace to two cpu contexts running at the same time with the same cpu number.
Note: I'm not aware of any distro shipping a kernel with support for more than 4096 threads today, nor of any system image that currently exceeds 4096 threads. Found via code browsing.
--- arch/powerpc/kernel/vdso.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/kernel/vdso.c +1 -1
@@ -677,7 +677,7 @@ int vdso_getcpu_init(void) node =cpu_to_node (cpu);WARN_ON_ONCE (node >0xffff ); - val = (cpu &0xfff ) | ((node &0xffff ) <<16 ); + val = (cpu &0xffff ) | ((node &0xffff ) <<16 );mtspr (SPRN_SPRG_VDSO_WRITE , val);get_paca ()->sprg_vdso = val;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 234/464 Bluetooth: Fix update of connection state in `hci_encrypt_cfm`
In reply to Greg Kroah-HartmanFrom: Patrick Steinhardt <[email protected]>
[ Upstream commit 339ddaa626995bc6218972ca241471f3717cc5f4 ]
Starting with the upgrade to v5.8-rc3, I've noticed I wasn't able to connect to my Bluetooth headset properly anymore. While connecting to the device would eventually succeed, bluetoothd seemed to be confused about the current connection state where the state was flapping hence and forth. Bisecting this issue led to commit 3ca44c16b0dc (Bluetooth:
Consolidate encryption handling in hci_encrypt_cfm, 2020-05-19), which refactored hci_encrypt_cfm to also handle updating the connection state.
The commit in question changed the code to call hci_connect_cfm inside hci_encrypt_cfm and to change the connection state. But with the conversion, we now only update the connection state if a status was set already. In fact, the reverse should be true: the status should be updated if no status is yet set. So let's fix the isuse by reversing the condition.
--- include/net/bluetooth/hci_core.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/net/bluetooth/hci_core.h +1 -1
@@ -1387,7 +1387,7 @@ static inline void hci_encrypt_cfm(struct hci_conn *conn, __u8 status)__u8 encrypt;if (conn->state ==BT_CONFIG ) { -if (status) +if (!status) conn->state =BT_CONNECTED ;hci_connect_cfm (conn, status);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 232/464 powerpc/rtas: dont online CPUs for partition suspend
In reply to Greg Kroah-HartmanFrom: Nathan Lynch <[email protected]>
[ Upstream commit ec2fc2a9e9bbad9023aab65bc472ce7a3ca8608f ]
Partition suspension, used for hibernation and migration, requires that the OS place all but one of the LPAR's processor threads into one of two states prior to calling the ibm,suspend-me RTAS function:
* the architected offline state (via RTAS stop-self); or
* the H_JOIN hcall, which does not return until the partition resumes execution
Using H_CEDE as the offline mode, introduced by
commit 3aa565f53c39 ("powerpc/pseries: Add hooks to put the CPU into an appropriate offline state"), means that any threads which are offline from Linux's point of view must be moved to one of those two states before a partition suspension can proceed.
This was eventually addressed in commit 120496ac2d2d ("powerpc: Bring all threads online prior to migration/hibernation"), which added code to temporarily bring up any offline processor threads so they can call H_JOIN. Conceptually this is fine, but the implementation has had multiple races with cpu hotplug operations initiated from user space[1][2][3], the error handling is fragile, and it generates user-visible cpu hotplug events which is a lot of noise for a platform feature that's supposed to minimize disruption to workloads.
With commit 3aa565f53c39 ("powerpc/pseries: Add hooks to put the CPU into an appropriate offline state") reverted, this code becomes unnecessary, so remove it. Since any offline CPUs now are truly offline from the platform's point of view, it is no longer necessary to bring up CPUs only to have them call H_JOIN and then go offline again upon resuming. Only active threads are required to call H_JOIN; stopped threads can be left alone.
[1] commit a6717c01ddc2 ("powerpc/rtas: use device model APIs and serialization during LPM")
[2] commit 9fb603050ffd ("powerpc/rtas: retry when cpu offline races with suspend/migration")
[3] commit dfd718a2ed1f ("powerpc/rtas: Fix a potential race between CPU-Offline & Migration")
--- arch/powerpc/include/asm/rtas.h | 2 - arch/powerpc/kernel/rtas.c | 122 +---------------------- arch/powerpc/platforms/pseries/suspend.c | 22 +--- 3 files changed, 3 insertions(+), 143 deletions(-)
arch/powerpc/include/asm/rtas.h +0 -2
@@ -253,8 +253,6 @@ extern int rtas_set_indicator_fast(int indicator, int index, int new_value);extern void rtas_progress (char *s,unsigned short hex);extern int rtas_suspend_cpu (struct rtas_suspend_me_data *data);extern int rtas_suspend_last_cpu (struct rtas_suspend_me_data *data); -extern int rtas_online_cpus_mask (cpumask_var_t cpus); -extern int rtas_offline_cpus_mask (cpumask_var_t cpus);extern int rtas_ibm_suspend_me (u64 handle);struct rtc_time ;
arch/powerpc/kernel/rtas.c +2 -120
157 lines not on this page · raw message
arch/powerpc/platforms/pseries/suspend.c +1 -21
@@ -132,15 +132,11 @@ static ssize_t store_hibernate(struct device *dev,struct device_attribute *attr, const char *buf, size_t count) { - cpumask_var_t offline_mask; int rc;if (!capable (CAP_SYS_ADMIN ))return -EPERM ; -if (!alloc_cpumask_var (&offline_mask,GFP_KERNEL )) -return -ENOMEM ; - stream_id =simple_strtoul (buf,NULL ,16 ); do {
@@ -150,32 +146,16 @@ static ssize_t store_hibernate(struct device *dev, }while (rc == -EAGAIN );if (!rc) { -/* All present CPUs must be online */ -cpumask_andnot (offline_mask, cpu_present_mask, - cpu_online_mask); - rc =rtas_online_cpus_mask (offline_mask); -if (rc) { -pr_err ("%s: Could not bring present CPUs online.\n" , - __func__); - goto out; - } -stop_topology_update (); rc =pm_suspend (PM_SUSPEND_MEM );start_topology_update (); - -/* Take down CPUs not online prior to suspend */ -if (!rtas_offline_cpus_mask (offline_mask)) -pr_warn ("%s: Could not restore CPUs to offline " -"state.\n" , __func__); } stream_id =0 ;if (!rc) rc = count; -out: -free_cpumask_var (offline_mask); +return rc; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 219/464 kobject: Avoid premature parent object freeing in kobject_cleanup()
In reply to Greg Kroah-HartmanFrom: Heikki Krogerus <[email protected]>
[ Upstream commit 079ad2fb4bf9eba8a0aaab014b49705cd7f07c66 ]
If kobject_del() is invoked by kobject_cleanup() to delete the target kobject, it may cause its parent kobject to be freed before invoking the target kobject's ->release() method, which effectively means freeing the parent before dealing with the child entirely.
That is confusing at best and it may also lead to functional issues if the callers of kobject_cleanup() are not careful enough about the order in which these calls are made, so avoid the problem by making kobject_cleanup() drop the last reference to the target kobject's parent at the end, after invoking the target kobject's ->release() method.
[ rjw: Rewrite the subject and changelog, make kobject_cleanup()
drop the parent reference only when __kobject_del() has been called. ]
--- lib/kobject.c | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-)
lib/kobject.c +23 -10
@@ -599,14 +599,7 @@ int kobject_move(struct kobject *kobj, struct kobject *new_parent) }EXPORT_SYMBOL_GPL (kobject_move); -/** -* kobject_del() - Unlink kobject from hierarchy. -* @kobj: object. -* -* This is the function that should be called to delete an object -* successfully added via kobject_add(). -*/ -void kobject_del (struct kobject *kobj) +static void __kobject_del (struct kobject *kobj) {struct kernfs_node *sd;const struct kobj_type *ktype;
@@ -632,9 +625,23 @@ void kobject_del(struct kobject *kobj) kobj->state_in_sysfs =0 ;kobj_kset_leave (kobj); -kobject_put (kobj->parent); kobj->parent =NULL ; } + +/** +* kobject_del() - Unlink kobject from hierarchy. +* @kobj: object. +* +* This is the function that should be called to delete an object +* successfully added via kobject_add(). +*/ +void kobject_del (struct kobject *kobj) +{ +struct kobject *parent = kobj->parent; + +__kobject_del (kobj); +kobject_put (parent); +}EXPORT_SYMBOL (kobject_del);/**
@@ -670,6 +677,7 @@ EXPORT_SYMBOL(kobject_get_unless_zero);*/ static void kobject_cleanup (struct kobject *kobj) { +struct kobject *parent = kobj->parent;struct kobj_type *t =get_ktype (kobj);const char *name = kobj->name;
@@ -684,7 +692,10 @@ static void kobject_cleanup(struct kobject *kobj)if (kobj->state_in_sysfs) {pr_debug ("kobject: '%s' (%p): auto cleanup kobject_del\n" ,kobject_name (kobj), kobj); -kobject_del (kobj); +__kobject_del (kobj); + }else { +/* avoid dropping the parent reference unnecessarily */ + parent =NULL ; }if (t && t->release) {
@@ -698,6 +709,8 @@ static void kobject_cleanup(struct kobject *kobj)pr_debug ("kobject: '%s': free name\n" , name);kfree_const (name); } + +kobject_put (parent); }#ifdef CONFIG_DEBUG_KOBJECT_RELEASE
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 238/464 RDMA/rxe: Prevent access to wr->next ptr afrer wr is posted to send queue
In reply to Greg Kroah-HartmanFrom: Mikhail Malygin <[email protected]>
[ Upstream commit 5f0b2a6093a4d9aab093964c65083fe801ef1e58 ]
rxe_post_send_kernel() iterates over linked list of wr's, until the wr->next ptr is NULL. However if we've got an interrupt after last wr is posted, control may be returned to the code after send completion callback is executed and wr memory is freed.
As a result, wr->next pointer may contain incorrect value leading to panic. Store the wr->next on the stack before posting it.
--- drivers/infiniband/sw/rxe/rxe_verbs.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/infiniband/sw/rxe/rxe_verbs.c +4 -1
@@ -684,6 +684,7 @@ static int rxe_post_send_kernel(struct rxe_qp *qp, const struct ib_send_wr *wr,unsigned int mask;unsigned int length =0 ;int i; +struct ib_send_wr *next;while (wr) { mask =wr_opcode_mask (wr->opcode, qp);
@@ -700,6 +701,8 @@ static int rxe_post_send_kernel(struct rxe_qp *qp, const struct ib_send_wr *wr,break ; } + next = wr->next; + length =0 ;for (i =0 ; i < wr->num_sge; i++) length += wr->sg_list[i].length;
@@ -710,7 +713,7 @@ static int rxe_post_send_kernel(struct rxe_qp *qp, const struct ib_send_wr *wr, *bad_wr = wr;break ; } - wr = wr->next; + wr = next; }rxe_run_task (&qp->req.task,1 );
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 239/464 ima: Have the LSM free its audit rule
In reply to Greg Kroah-HartmanFrom: Tyler Hicks <[email protected]>
[ Upstream commit 9ff8a616dfab96a4fa0ddd36190907dc68886d9b ]
Ask the LSM to free its audit rule rather than directly calling kfree(). Both AppArmor and SELinux do additional work in their audit_rule_free() hooks. Fix memory leaks by allowing the LSMs to perform necessary work.
--- security/integrity/ima/ima.h | 5 +++++ security/integrity/ima/ima_policy.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-)
security/integrity/ima/ima.h +5 -0
@@ -404,6 +404,7 @@ static inline void ima_free_modsig(struct modsig *modsig)#ifdef CONFIG_IMA_LSM_RULES #define security_filter_rule_init security_audit_rule_init +#define security_filter_rule_free security_audit_rule_free#define security_filter_rule_match security_audit_rule_match#else
@@ -414,6 +415,10 @@ static inline int security_filter_rule_init(u32 field, u32 op, char *rulestr,return -EINVAL ; } +static inline void security_filter_rule_free (void *lsmrule) +{ +} +static inline int security_filter_rule_match (u32 secid,u32 field,u32 op,void *lsmrule) {
security/integrity/ima/ima_policy.c +1 -1
@@ -258,7 +258,7 @@ static void ima_lsm_free_rule(struct ima_rule_entry *entry)int i;for (i =0 ; i <MAX_LSM_RULES ; i++) { -kfree (entry->lsm[i].rule); +security_filter_rule_free (entry->lsm[i].rule);kfree (entry->lsm[i].args_p); }kfree (entry);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 244/464 ima: Fail rule parsing when the KEY_CHECK hook is combined with an invalid cond
In reply to Greg Kroah-HartmanFrom: Tyler Hicks <[email protected]>
[ Upstream commit eb624fe214a2e156ddafd9868377cf91499f789d ]
The KEY_CHECK function only supports the uid, pcr, and keyrings conditionals. Make this clear at policy load so that IMA policy authors don't assume that other conditionals are supported.
--- security/integrity/ima/ima_policy.c | 7 +++++++ 1 file changed, 7 insertions(+)
security/integrity/ima/ima_policy.c +7 -0
@@ -1023,6 +1023,13 @@ static bool ima_validate_rule(struct ima_rule_entry *entry)if (entry->action & ~(MEASURE |DONT_MEASURE ))return false; +if (entry->flags & ~(IMA_FUNC |IMA_UID |IMA_PCR | +IMA_KEYRINGS )) +return false; + +if (ima_rule_contains_lsm_cond (entry)) +return false; +break ;default :return false;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 186/464 cxl: Fix kobject memleak
In reply to Greg Kroah-HartmanFrom: Wang Hai <[email protected]>
[ Upstream commit 85c5cbeba8f4fb28e6b9bfb3e467718385f78f76 ]
Currently the error return path from kobject_init_and_add() is not followed by a call to kobject_put() - which means we are leaking the kobject.
Fix it by adding a call to kobject_put() in the error path of kobject_init_and_add().
--- drivers/misc/cxl/sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/cxl/sysfs.c +1 -1
@@ -624,7 +624,7 @@ static struct afu_config_record *cxl_sysfs_afu_new_cr(struct cxl_afu *afu, int c rc =kobject_init_and_add (&cr->kobj, &afu_config_record_type, &afu->dev.kobj,"cr%i" , cr->cr);if (rc) - goto err; + goto err1; rc =sysfs_create_bin_file (&cr->kobj, &cr->config_attr);if (rc)
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 204/464 media: firewire: Using uninitialized values in node_probe()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 2505a210fc126599013aec2be741df20aaacc490 ]
If fw_csr_string() returns -ENOENT, then "name" is uninitialized. So then the "strlen(model_names[i]) <= name_len" is true because strlen() is unsigned and -ENOENT is type promoted to a very high positive value. Then the "strncmp(name, model_names[i], name_len)" uses uninitialized data because "name" is uninitialized.
--- drivers/media/firewire/firedtv-fw.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/media/firewire/firedtv-fw.c +2 -0
@@ -272,6 +272,8 @@ static int node_probe(struct fw_unit *unit, const struct ieee1394_device_id *id) name_len =fw_csr_string (unit->directory,CSR_MODEL , name,sizeof (name)); +if (name_len <0 ) +return name_len;for (i =ARRAY_SIZE (model_names); --i; )if (strlen (model_names[i]) <= name_len &&strncmp (name, model_names[i], name_len) ==0 )
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 220/464 leds: core: Flush scheduled work for system suspend
In reply to Greg Kroah-HartmanFrom: Kai-Heng Feng <[email protected]>
[ Upstream commit 302a085c20194bfa7df52e0fe684ee0c41da02e6 ]
Sometimes LED won't be turned off by LED_CORE_SUSPENDRESUME flag upon system suspend.
led_set_brightness_nopm() uses schedule_work() to set LED brightness. However, there's no guarantee that the scheduled work gets executed because no one flushes the work.
So flush the scheduled work to make sure LED gets turned off.
--- drivers/leds/led-class.c | 1 + 1 file changed, 1 insertion(+)
drivers/leds/led-class.c +1 -0
@@ -173,6 +173,7 @@ void led_classdev_suspend(struct led_classdev *led_cdev) { led_cdev->flags |=LED_SUSPENDED ;led_set_brightness_nopm (led_cdev,0 ); +flush_work (&led_cdev->set_brightness_work); }EXPORT_SYMBOL_GPL (led_classdev_suspend);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 249/464 media: s5p-g2d: Fix a memory leak in an error handling path in g2d_probe()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 94b9ce6870f9c90ac92505482689818b254312f7 ]
Memory allocated with 'v4l2_m2m_init()' must be freed by a corresponding call to 'v4l2_m2m_release()'
Also reorder the code at the end of the probe function so that 'video_register_device()' is called last.
Update the error handling path accordingly.
--- drivers/media/platform/s5p-g2d/g2d.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-)
drivers/media/platform/s5p-g2d/g2d.c +15 -13
@@ -695,21 +695,13 @@ static int g2d_probe(struct platform_device *pdev) vfd->lock = &dev->mutex; vfd->v4l2_dev = &dev->v4l2_dev; vfd->device_caps =V4L2_CAP_VIDEO_M2M |V4L2_CAP_STREAMING ; - ret =video_register_device (vfd,VFL_TYPE_VIDEO ,0 ); -if (ret) { -v4l2_err (&dev->v4l2_dev,"Failed to register video device\n" ); - goto rel_vdev; - } -video_set_drvdata (vfd, dev); - dev->vfd = vfd; -v4l2_info (&dev->v4l2_dev,"device registered as /dev/video%d\n" , - vfd->num); +platform_set_drvdata (pdev, dev); dev->m2m_dev =v4l2_m2m_init (&g2d_m2m_ops);if (IS_ERR (dev->m2m_dev)) {v4l2_err (&dev->v4l2_dev,"Failed to init mem2mem device\n" ); ret =PTR_ERR (dev->m2m_dev); - goto unreg_video_dev; + goto rel_vdev; } def_frame.stride = (def_frame.width * def_frame.fmt->depth) >>3 ;
@@ -717,14 +709,24 @@ static int g2d_probe(struct platform_device *pdev) of_id =of_match_node (exynos_g2d_match, pdev->dev.of_node);if (!of_id) { ret = -ENODEV ; - goto unreg_video_dev; + goto free_m2m; } dev->variant = (struct g2d_variant *)of_id->data; + ret =video_register_device (vfd,VFL_TYPE_VIDEO ,0 ); +if (ret) { +v4l2_err (&dev->v4l2_dev,"Failed to register video device\n" ); + goto free_m2m; + } +video_set_drvdata (vfd, dev); + dev->vfd = vfd; +v4l2_info (&dev->v4l2_dev,"device registered as /dev/video%d\n" , + vfd->num); +return 0 ; -unreg_video_dev: -video_unregister_device (dev->vfd); +free_m2m: +v4l2_m2m_release (dev->m2m_dev); rel_vdev:video_device_release (vfd); unreg_v4l2_dev:
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 222/464 phy: cadence: salvo: fix wrong bit definition
In reply to Greg Kroah-HartmanFrom: Peter Chen <[email protected]>
[ Upstream commit 270ff6048f45759d31a7b62d3983b084153837f5 ]
It fixes RX detect wakeup using USB3 device, otherwise, the USB3 device can't wakeup USB PHY when the PHY is in 32Khz clock.
--- drivers/phy/cadence/phy-cadence-salvo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/phy/cadence/phy-cadence-salvo.c +1 -1
@@ -88,7 +88,7 @@#define TB_ADDR_TX_RCVDETSC_CTRL 0x4124/* TB_ADDR_TX_RCVDETSC_CTRL */ -#define RXDET_IN_P3_32KHZ BIT(1) +#define RXDET_IN_P3_32KHZ BIT(0)struct cdns_reg_pairs {u16 val;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 225/464 mmc: sdhci-of-arasan: Add missed checks for devm_clk_register()
In reply to Greg Kroah-HartmanFrom: Chuhong Yuan <[email protected]>
[ Upstream commit c99e1d0c91ac8d7db3062ea1af315f21295701d7 ]
These functions do not check the return value of devm_clk_register():
- sdhci_arasan_register_sdcardclk()
- sdhci_arasan_register_sampleclk()
Therefore, add the missed checks to fix them.
--- drivers/mmc/host/sdhci-of-arasan.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/mmc/host/sdhci-of-arasan.c +4 -0
@@ -1299,6 +1299,8 @@ sdhci_arasan_register_sdcardclk(struct sdhci_arasan_data *sdhci_arasan, clk_data->sdcardclk_hw.init = &sdcardclk_init; clk_data->sdcardclk =devm_clk_register (dev, &clk_data->sdcardclk_hw); +if (IS_ERR (clk_data->sdcardclk)) +return PTR_ERR (clk_data->sdcardclk); clk_data->sdcardclk_hw.init =NULL ; ret = of_clk_add_provider(np, of_clk_src_simple_get,
@@ -1349,6 +1351,8 @@ sdhci_arasan_register_sampleclk(struct sdhci_arasan_data *sdhci_arasan, clk_data->sampleclk_hw.init = &sampleclk_init; clk_data->sampleclk =devm_clk_register (dev, &clk_data->sampleclk_hw); +if (IS_ERR (clk_data->sampleclk)) +return PTR_ERR (clk_data->sampleclk); clk_data->sampleclk_hw.init =NULL ; ret = of_clk_add_provider(np, of_clk_src_simple_get,
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 211/464 xfs: preserve rmapbt swapext block reservation from freed blocks
In reply to Greg Kroah-HartmanFrom: Brian Foster <[email protected]>
[ Upstream commit f74681ba2006434be195402e0b15fc5763cddd7e ]
The rmapbt extent swap algorithm remaps individual extents between the source inode and the target to trigger reverse mapping metadata updates. If either inode straddles a format or other bmap allocation boundary, the individual unmap and map cycles can trigger repeated bmap block allocations and frees as the extent count bounces back and forth across the boundary. While net block usage is bound across the swap operation, this behavior can prematurely exhaust the transaction block reservation because it continuously drains as the transaction rolls. Each allocation accounts against the reservation and each free returns to global free space on transaction roll.
The previous workaround to this problem attempted to detect this boundary condition and provide surplus block reservation to acommodate it. This is insufficient because more remaps can occur than implied by the extent counts; if start offset boundaries are not aligned between the two inodes, for example.
To address this problem more generically and dynamically, add a transaction accounting mode that returns freed blocks to the transaction reservation instead of the superblock counters on transaction roll and use it when the rmapbt based algorithm is active. This allows the chain of remap transactions to preserve the block reservation based own its own frees and prevent premature exhaustion regardless of the remap pattern. Note that this is only safe for superblocks with lazy sb accounting, but the latter is required for v5 supers and the rmap feature depends on v5.
--- fs/xfs/libxfs/xfs_shared.h | 1 + fs/xfs/xfs_bmap_util.c | 18 +++++++++--------- fs/xfs/xfs_trans.c | 19 ++++++++++++++++++- 3 files changed, 28 insertions(+), 10 deletions(-)
fs/xfs/libxfs/xfs_shared.h +1 -0
@@ -65,6 +65,7 @@ void xfs_log_get_max_trans_res(struct xfs_mount *mp,#define XFS_TRANS_DQ_DIRTY 0x10/* at least one dquot in trx dirty */ #define XFS_TRANS_RESERVE 0x20/* OK to use reserved data blocks */ #define XFS_TRANS_NO_WRITECOUNT 0x40/* do not elevate SB writecount */ +#define XFS_TRANS_RES_FDBLKS 0x80/* reserve newly freed blocks */ /* * LOWMODE is used by the allocator to activate the lowspace algorithm - when * free space is running low the extent allocator may choose to allocate an
fs/xfs/xfs_bmap_util.c +9 -9
@@ -1567,6 +1567,7 @@ xfs_swap_extents(int lock_flags;uint64_t f;int resblks =0 ; +unsigned int flags =0 ;/* * Lock the inodes against other IO, page faults and truncate to
@@ -1630,17 +1631,16 @@ xfs_swap_extents( resblks +=XFS_SWAP_RMAP_SPACE_RES (mp, tipnext, w);/* -* Handle the corner case where either inode might straddle the -* btree format boundary. If so, the inode could bounce between -* btree <-> extent format on unmap -> remap cycles, freeing and -* allocating a bmapbt block each time. +* If either inode straddles a bmapbt block allocation boundary, +* the rmapbt algorithm triggers repeated allocs and frees as +* extents are remapped. This can exhaust the block reservation +* prematurely and cause shutdown. Return freed blocks to the +* transaction reservation to counter this behavior. */ -if (ipnext == (XFS_IFORK_MAXEXT (ip, w) +1 )) - resblks +=XFS_IFORK_MAXEXT (ip, w); -if (tipnext == (XFS_IFORK_MAXEXT (tip, w) +1 )) - resblks +=XFS_IFORK_MAXEXT (tip, w); + flags |=XFS_TRANS_RES_FDBLKS ; } - error =xfs_trans_alloc (mp, &M_RES (mp)->tr_write, resblks,0 ,0 , &tp); + error =xfs_trans_alloc (mp, &M_RES (mp)->tr_write, resblks,0 , flags, + &tp);if (error) goto out_unlock;
fs/xfs/xfs_trans.c +18 -1
@@ -107,7 +107,8 @@ xfs_trans_dup( ntp->t_flags =XFS_TRANS_PERM_LOG_RES | (tp->t_flags &XFS_TRANS_RESERVE ) | - (tp->t_flags &XFS_TRANS_NO_WRITECOUNT ); + (tp->t_flags &XFS_TRANS_NO_WRITECOUNT ) | + (tp->t_flags &XFS_TRANS_RES_FDBLKS );/* We gave our writer reference to the new transaction */ tp->t_flags |=XFS_TRANS_NO_WRITECOUNT ; ntp->t_ticket =xfs_log_ticket_get (tp->t_ticket);
@@ -272,6 +273,8 @@ xfs_trans_alloc(*/ WARN_ON (resp->tr_logres >0 && mp->m_super->s_writers.frozen ==SB_FREEZE_COMPLETE ); +ASSERT (!(flags &XFS_TRANS_RES_FDBLKS ) || +xfs_sb_version_haslazysbcount (&mp->m_sb)); tp->t_magic =XFS_TRANS_HEADER_MAGIC ; tp->t_flags = flags;
@@ -365,6 +368,20 @@ xfs_trans_mod_sb( tp->t_blk_res_used += (uint)-delta;if (tp->t_blk_res_used > tp->t_blk_res)xfs_force_shutdown (mp,SHUTDOWN_CORRUPT_INCORE ); + }else if (delta >0 && (tp->t_flags &XFS_TRANS_RES_FDBLKS )) { +int64_t blkres_delta; + +/* +* Return freed blocks directly to the reservation +* instead of the global pool, being careful not to +* overflow the trans counter. This is used to preserve +* reservation across chains of transaction rolls that +* repeatedly free and allocate blocks. +*/ + blkres_delta =min_t (int64_t, delta, +UINT_MAX - tp->t_blk_res); + tp->t_blk_res += blkres_delta; + delta -= blkres_delta; } tp->t_fdblocks_delta += delta;if (xfs_sb_version_haslazysbcount (&mp->m_sb))
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 262/464 coresight: etmv4: Fix resource selector constant
In reply to Greg Kroah-HartmanFrom: Mike Leach <[email protected]>
[ Upstream commit cb8bba907a4ff4ba42f1d245cb506d55829674b8 ]
ETMv4 max resource selector constant incorrectly set to 16. Updated to the correct 32 value, and adjustments made to limited code using it.
--- drivers/hwtracing/coresight/coresight-etm4x.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/hwtracing/coresight/coresight-etm4x.h +2 -2
@@ -133,7 +133,7 @@#define ETMv4_MAX_CTXID_CMP 8#define ETM_MAX_VMID_CMP 8#define ETM_MAX_PE_CMP 8 -#define ETM_MAX_RES_SEL 16 +#define ETM_MAX_RES_SEL 32#define ETM_MAX_SS_CMP 8#define ETM_ARCH_V4 0x40
@@ -325,7 +325,7 @@ struct etmv4_save_state {u32 trccntctlr[ETMv4_MAX_CNTR];u32 trccntvr[ETMv4_MAX_CNTR]; -u32 trcrsctlr[ETM_MAX_RES_SEL *2 ]; +u32 trcrsctlr[ETM_MAX_RES_SEL ];u32 trcssccr[ETM_MAX_SS_CMP ];u32 trcsscsr[ETM_MAX_SS_CMP ];
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 263/464 coresight: etmv4: Counter values not saved on disable
In reply to Greg Kroah-HartmanFrom: Mike Leach <[email protected]>
[ Upstream commit 8fa43700f69703f995ea715b76be6fabdd2f05de ]
The counter value registers change during operation, however this change is not reflected in the values seen by the user in sysfs.
This fixes the issue by reading back the values on disable.
--- drivers/hwtracing/coresight/coresight-etm4x.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/hwtracing/coresight/coresight-etm4x.c +6 -0
@@ -507,6 +507,12 @@ static void etm4_disable_hw(void *info)readl_relaxed (drvdata->base +TRCSSCSRn (i)); } +/* read back the current counter values */ +for (i =0 ; i < drvdata->nr_cntr; i++) { + config->cntr_val[i] = +readl_relaxed (drvdata->base +TRCCNTVRn (i)); + } +coresight_disclaim_device_unlocked (drvdata->base);CS_LOCK (drvdata->base);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 187/464 lkdtm: Avoid more compiler optimizations for bad writes
In reply to Greg Kroah-HartmanFrom: Kees Cook <[email protected]>
[ Upstream commit 464e86b4abadfc490f426954b431e2ec6a9d7bd2 ]
It seems at least Clang is able to throw away writes it knows are destined for read-only memory, which makes things like the WRITE_RO test fail, as the write gets elided. Instead, force the variable to be volatile, and make similar changes through-out other tests in an effort to avoid needing to repeat fixing these kinds of problems. Also includes pr_err() calls in failure paths so that kernel logs are more clear in the failure case.
--- drivers/misc/lkdtm/bugs.c | 11 +++++------ drivers/misc/lkdtm/perms.c | 22 +++++++++++++++------- drivers/misc/lkdtm/usercopy.c | 7 +++++-- 3 files changed, 25 insertions(+), 15 deletions(-)
drivers/misc/lkdtm/bugs.c +5 -6
@@ -118,9 +118,8 @@ noinline void lkdtm_CORRUPT_STACK(void)/* Use default char array length that triggers stack protection. */ char data[8 ]__aligned(sizeof(void *)) ; -__lkdtm_CORRUPT_STACK (&data); - -pr_info ("Corrupted stack containing char array ...\n" ); +pr_info ("Corrupting stack containing char array ...\n" ); +__lkdtm_CORRUPT_STACK ((void *)&data); }/* Same as above but will only get a canary with -fstack-protector-strong */
@@ -131,9 +130,8 @@ noinline void lkdtm_CORRUPT_STACK_STRONG(void)unsigned long *ptr; } data__aligned(sizeof(void *)) ; -__lkdtm_CORRUPT_STACK (&data); - -pr_info ("Corrupted stack containing union ...\n" ); +pr_info ("Corrupting stack containing union ...\n" ); +__lkdtm_CORRUPT_STACK ((void *)&data); }void lkdtm_UNALIGNED_LOAD_STORE_WRITE (void )
@@ -248,6 +246,7 @@ void lkdtm_ARRAY_BOUNDS(void)kfree (not_checked);kfree (checked); +pr_err ("FAIL: survived array bounds overflow!\n" ); }void lkdtm_CORRUPT_LIST_ADD (void )
drivers/misc/lkdtm/perms.c +15 -7
@@ -57,6 +57,7 @@ static noinline void execute_location(void *dst, bool write) }pr_info ("attempting bad execution at %px\n" , func);func (); +pr_err ("FAIL: func returned\n" ); }static void execute_user_location (void *dst)
@@ -75,20 +76,22 @@ static void execute_user_location(void *dst)return ;pr_info ("attempting bad execution at %px\n" , func);func (); +pr_err ("FAIL: func returned\n" ); }void lkdtm_WRITE_RO (void ) { -/* Explicitly cast away "const" for the test. */ -unsigned long *ptr = (unsigned long *)&rodata; +/* Explicitly cast away "const" for the test and make volatile. */ +volatile unsigned long *ptr = (unsigned long *)&rodata;pr_info ("attempting bad rodata write at %px\n" , ptr); *ptr ^=0xabcd1234 ; +pr_err ("FAIL: survived bad write\n" ); }void lkdtm_WRITE_RO_AFTER_INIT (void ) { -unsigned long *ptr = &ro_after_init; +volatile unsigned long *ptr = &ro_after_init;/* * Verify we were written to during init. Since an Oops
@@ -102,19 +105,21 @@ void lkdtm_WRITE_RO_AFTER_INIT(void)pr_info ("attempting bad ro_after_init write at %px\n" , ptr); *ptr ^=0xabcd1234 ; +pr_err ("FAIL: survived bad write\n" ); }void lkdtm_WRITE_KERN (void ) {size_t size; -unsigned char *ptr; +volatile unsigned char *ptr; size = (unsigned long )do_overwritten - (unsigned long )do_nothing; ptr = (unsigned char *)do_overwritten;pr_info ("attempting bad %zu byte write at %px\n" , size, ptr); -memcpy (ptr, (unsigned char *)do_nothing, size); +memcpy ((void *)ptr, (unsigned char *)do_nothing, size);flush_icache_range ((unsigned long )ptr, (unsigned long )(ptr + size)); +pr_err ("FAIL: survived bad write\n" );do_overwritten (); }
@@ -193,9 +198,11 @@ void lkdtm_ACCESS_USERSPACE(void)pr_info ("attempting bad read at %px\n" , ptr); tmp = *ptr; tmp +=0xc0dec0de ; +pr_err ("FAIL: survived bad read\n" );pr_info ("attempting bad write at %px\n" , ptr); *ptr = tmp; +pr_err ("FAIL: survived bad write\n" );vm_munmap (user_addr,PAGE_SIZE ); }
@@ -203,19 +210,20 @@ void lkdtm_ACCESS_USERSPACE(void)void lkdtm_ACCESS_NULL (void ) {unsigned long tmp; -unsigned long *ptr = (unsigned long *)NULL ; +volatile unsigned long *ptr = (unsigned long *)NULL ;pr_info ("attempting bad read at %px\n" , ptr); tmp = *ptr; tmp +=0xc0dec0de ; +pr_err ("FAIL: survived bad read\n" );pr_info ("attempting bad write at %px\n" , ptr); *ptr = tmp; +pr_err ("FAIL: survived bad write\n" ); }void __init lkdtm_perms_init (void ) {/* Make sure we can write to __ro_after_init values during __init */ ro_after_init |=0xAA ; - }
drivers/misc/lkdtm/usercopy.c +5 -2
@@ -304,19 +304,22 @@ void lkdtm_USERCOPY_KERNEL(void)return ; } -pr_info ("attempting good copy_to_user from kernel rodata\n" ); +pr_info ("attempting good copy_to_user from kernel rodata: %px\n" , + test_text);if (copy_to_user ((void __user *)user_addr, test_text, unconst +sizeof (test_text))) {pr_warn ("copy_to_user failed unexpectedly?!\n" ); goto free_user; } -pr_info ("attempting bad copy_to_user from kernel text\n" ); +pr_info ("attempting bad copy_to_user from kernel text: %px\n" , + vm_mmap);if (copy_to_user ((void __user *)user_addr, vm_mmap, unconst +PAGE_SIZE )) {pr_warn ("copy_to_user failed, but lacked Oops\n" ); goto free_user; } +pr_err ("FAIL: survived bad copy_to_user()\n" ); free_user:vm_munmap (user_addr,PAGE_SIZE );
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 264/464 coresight: tmc: Fix TMC mode read in tmc_read_unprepare_etb()
In reply to Greg Kroah-HartmanFrom: Sai Prakash Ranjan <[email protected]>
[ Upstream commit d021f5c5ff679432c5e9faee0fd7350db2efb97c ]
Reading TMC mode register without proper coresight power management can lead to exceptions like the one in the call trace below in tmc_read_unprepare_etb() when the trace data is read after the sink is disabled. So fix this by having a check for coresight sysfs mode before reading TMC mode management register in tmc_read_unprepare_etb() similar to tmc_read_prepare_etb().
SError Interrupt on CPU6, code 0xbe000411 -- SError
pstate: 80400089 (Nzcv daIf +PAN -UAO)
pc : tmc_read_unprepare_etb+0x74/0x108 lr : tmc_read_unprepare_etb+0x54/0x108 sp : ffffff80d9507c30 x29: ffffff80d9507c30 x28: ffffff80b3569a0c x27: 0000000000000000 x26: 00000000000a0001 x25: ffffff80cbae9550 x24: 0000000000000010 x23: ffffffd07296b0f0 x22: ffffffd0109ee028 x21: 0000000000000000 x20: ffffff80d19e70e0 x19: ffffff80d19e7080 x18: 0000000000000000 x17: 0000000000000000 x16: 0000000000000000 x15: 0000000000000000 x14: 0000000000000000 x13: 0000000000000000 x12: 0000000000000000 x11: 0000000000000000 x10: dfffffd000000001 x9 : 0000000000000000 x8 : 0000000000000002 x7 : ffffffd071d0fe78 x6 : 0000000000000000 x5 : 0000000000000080 x4 : 0000000000000001 x3 : ffffffd071d0fe98 x2 : 0000000000000000 x1 : 0000000000000004 x0 : 0000000000000001 Kernel panic - not syncing: Asynchronous SError Interrupt
--- drivers/hwtracing/coresight/coresight-tmc-etf.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
drivers/hwtracing/coresight/coresight-tmc-etf.c +6 -7
@@ -639,15 +639,14 @@ int tmc_read_unprepare_etb(struct tmc_drvdata *drvdata)spin_lock_irqsave (&drvdata->spinlock, flags); -/* There is no point in reading a TMC in HW FIFO mode */ - mode =readl_relaxed (drvdata->base +TMC_MODE ); -if (mode !=TMC_MODE_CIRCULAR_BUFFER ) { -spin_unlock_irqrestore (&drvdata->spinlock, flags); -return -EINVAL ; - } -/* Re-enable the TMC if need be */ if (drvdata->mode ==CS_MODE_SYSFS ) { +/* There is no point in reading a TMC in HW FIFO mode */ + mode =readl_relaxed (drvdata->base +TMC_MODE ); +if (mode !=TMC_MODE_CIRCULAR_BUFFER ) { +spin_unlock_irqrestore (&drvdata->spinlock, flags); +return -EINVAL ; + }/* * The trace run will continue with the same allocated trace * buffer. As such zero-out the buffer so that we don't end
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 215/464 RDMA/rxe: Skip dgid check in loopback mode
In reply to Greg Kroah-HartmanFrom: Zhu Yanjun <[email protected]>
[ Upstream commit 5c99274be8864519328aa74bc550ba410095bc1c ]
In the loopback tests, the following call trace occurs.
Call Trace: __rxe_do_task+0x1a/0x30 [rdma_rxe] rxe_qp_destroy+0x61/0xa0 [rdma_rxe] rxe_destroy_qp+0x20/0x60 [rdma_rxe] ib_destroy_qp_user+0xcc/0x220 [ib_core] uverbs_free_qp+0x3c/0xc0 [ib_uverbs] destroy_hw_idr_uobject+0x24/0x70 [ib_uverbs] uverbs_destroy_uobject+0x43/0x1b0 [ib_uverbs] uobj_destroy+0x41/0x70 [ib_uverbs] __uobj_get_destroy+0x39/0x70 [ib_uverbs] ib_uverbs_destroy_qp+0x88/0xc0 [ib_uverbs] ib_uverbs_handler_UVERBS_METHOD_INVOKE_WRITE+0xb9/0xf0 [ib_uverbs] ib_uverbs_cmd_verbs+0xb16/0xc30 [ib_uverbs]
The root cause is that the actual RDMA connection is not created in the loopback tests and the rxe_match_dgid will fail randomly.
To fix this call trace which appear in the loopback tests, skip check of the dgid.
--- drivers/infiniband/sw/rxe/rxe_recv.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/infiniband/sw/rxe/rxe_recv.c +5 -1
@@ -330,10 +330,14 @@ static void rxe_rcv_mcast_pkt(struct rxe_dev *rxe, struct sk_buff *skb)static int rxe_match_dgid (struct rxe_dev *rxe,struct sk_buff *skb) { +struct rxe_pkt_info *pkt =SKB_TO_PKT (skb);const struct ib_gid_attr *gid_attr;union ib_gid dgid;union ib_gid *pdgid; +if (pkt->mask &RXE_LOOPBACK_MASK ) +return 0 ; +if (skb->protocol ==htons (ETH_P_IP )) {ipv6_addr_set_v4mapped (ip_hdr (skb)->daddr, (struct in6_addr *)&dgid);
@@ -366,7 +370,7 @@ void rxe_rcv(struct sk_buff *skb)if (unlikely (skb->len < pkt->offset +RXE_BTH_BYTES )) goto drop; -if (unlikely (rxe_match_dgid (rxe, skb) <0 )) { +if (rxe_match_dgid (rxe, skb) <0 ) {pr_warn_ratelimited ("failed matching dgid\n" ); goto drop; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 266/464 powerpc/perf: Fix missing is_sier_aviable() during build
In reply to Greg Kroah-HartmanFrom: Madhavan Srinivasan <[email protected]>
[ Upstream commit 3c9450c053f88e525b2db1e6990cdf34d14e7696 ]
Compilation error:
arch/powerpc/perf/perf_regs.c:80:undefined reference to `.is_sier_available'
Currently is_sier_available() is part of core-book3s.c, which is added to build based on CONFIG_PPC_PERF_CTRS.
A config with CONFIG_PERF_EVENTS and without CONFIG_PPC_PERF_CTRS will have a build break because of missing is_sier_available().
In practice it only breaks when CONFIG_FSL_EMB_PERF_EVENT=n because that also guards the usage of is_sier_available(). That only happens with CONFIG_PPC_BOOK3E_64=y and CONFIG_FSL_SOC_BOOKE=n.
Patch adds is_sier_available() in asm/perf_event.h to fix the build break for configs missing CONFIG_PPC_PERF_CTRS.
--- arch/powerpc/include/asm/perf_event.h | 2 ++ 1 file changed, 2 insertions(+)
arch/powerpc/include/asm/perf_event.h +2 -0
@@ -12,6 +12,8 @@#ifdef CONFIG_PPC_PERF_CTRS #include <asm/perf_event_server.h> +#else +static inline bool is_sier_available (void ) {return false; }#endif #ifdef CONFIG_FSL_EMB_PERF_EVENT
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 228/464 bpfilter: Initialize pos variable
In reply to Greg Kroah-HartmanFrom: Alexei Starovoitov <[email protected]>
[ Upstream commit a4fa458950b40d3849946daa32466392811a3716 ]
Make sure 'pos' is initialized to zero before calling kernel_write().
--- net/bpfilter/bpfilter_kern.c | 1 + 1 file changed, 1 insertion(+)
net/bpfilter/bpfilter_kern.c +1 -0
@@ -50,6 +50,7 @@ static int __bpfilter_process_sockopt(struct sock *sk, int optname, req.len = optlen;if (!bpfilter_ops.info.pid) goto out; + pos =0 ; n =kernel_write (bpfilter_ops.info.pipe_to_umh, &req,sizeof (req), &pos);if (n !=sizeof (req)) {
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 274/464 s390/bpf: Fix sign extension in branch_ku
In reply to Greg Kroah-HartmanFrom: Ilya Leoshkevich <[email protected]>
[ Upstream commit 7477d43be5b1448bc0d4c85cb185a0144cc080e1 ]
Both signed and unsigned variants of BPF_JMP | BPF_K require sign-extending the immediate. JIT emits cgfi for the signed case, which is correct, and clgfi for the unsigned case, which is not
correct: clgfi zero-extends the immediate.
s390 does not provide an instruction that does sign-extension and unsigned comparison at the same time. Therefore, fix by first loading the sign-extended immediate into work register REG_1 and proceeding as if it's BPF_X.
--- arch/s390/net/bpf_jit_comp.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-)
arch/s390/net/bpf_jit_comp.c +4 -15
@@ -1417,21 +1417,10 @@ static noinline int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, }break ; branch_ku: - is_jmp32 =BPF_CLASS (insn->code) ==BPF_JMP32 ; -/* clfi or clgfi %dst,imm */ -EMIT6_IMM (is_jmp32 ?0xc20f0000 :0xc20e0000 , - dst_reg, imm); -if (!is_first_pass (jit) && -can_use_rel (jit, addrs[i + off +1 ])) { -/* brc mask,off */ -EMIT4_PCREL_RIC (0xa7040000 , - mask >>12 , addrs[i + off +1 ]); - }else { -/* brcl mask,off */ -EMIT6_PCREL_RILC (0xc0040000 , - mask >>12 , addrs[i + off +1 ]); - } -break ; +/* lgfi %w1,imm (load sign extend imm) */ + src_reg =REG_1 ; +EMIT6_IMM (0xc0010000 , src_reg, imm); + goto branch_xu; branch_xs: is_jmp32 =BPF_CLASS (insn->code) ==BPF_JMP32 ; if (!is_first_pass(jit) &&
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 275/464 s390/bpf: Use brcl for jumping to exit_ip if necessary
In reply to Greg Kroah-HartmanFrom: Ilya Leoshkevich <[email protected]>
[ Upstream commit 5fa6974471c5518a50bdd814067508dbcb477251 ]
"BPF_MAXINSNS: Maximum possible literals" test causes panic with bpf_jit_harden = 2. The reason is that BPF_JMP | BPF_EXIT is always emitted as brc, however, after removal of JITed image size limitations, brcl might be required.
Fix by using brcl when necessary.
--- arch/s390/net/bpf_jit_comp.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
arch/s390/net/bpf_jit_comp.c +6 -2
@@ -1268,8 +1268,12 @@ static noinline int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, last = (i == fp->len -1 ) ?1 :0 ;if (last)break ; -/* j <exit> */ -EMIT4_PCREL (0xa7f40000 , jit->exit_ip - jit->prg); +if (!is_first_pass (jit) &&can_use_rel (jit, jit->exit_ip)) +/* brc 0xf, <exit> */ +EMIT4_PCREL_RIC (0xa7040000 ,0xf , jit->exit_ip); +else +/* brcl 0xf, <exit> */ +EMIT6_PCREL_RILC (0xc0040000 ,0xf , jit->exit_ip);break ;/* * Branch relative (number of skipped instructions) to offset on
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 276/464 s390/bpf: Tolerate not converging code shrinking
In reply to Greg Kroah-HartmanFrom: Ilya Leoshkevich <[email protected]>
[ Upstream commit 1491b73311a15bb5beeab5d30e03bff761ef6c18 ]
"BPF_MAXINSNS: Maximum possible literals" unnecessarily falls back to the interpreter because of failing sanity check in bpf_set_addr. The problem is that there are a lot of branches that can be shrunk, and doing so opens up the possibility to shrink even more. This process does not converge after 3 passes, causing code offsets to change during the codegen pass, which must never happen.
Fix by inserting nops during codegen pass in order to preserve code offets.
--- arch/s390/net/bpf_jit_comp.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-)
arch/s390/net/bpf_jit_comp.c +26 -1
@@ -489,6 +489,24 @@ static void save_restore_regs(struct bpf_jit *jit, int op, u32 stack_depth) }while (re <= last); } +static void bpf_skip (struct bpf_jit *jit,int size) +{ +if (size >=6 && !is_valid_rel (size)) { +/* brcl 0xf,size */ +EMIT6_PCREL_RIL (0xc0f4000000 , size); + size -=6 ; + }else if (size >=4 &&is_valid_rel (size)) { +/* brc 0xf,size */ +EMIT4_PCREL (0xa7f40000 , size); + size -=4 ; + } +while (size >=2 ) { +/* bcr 0,%0 */ +_EMIT2 (0x0700 ); + size -=2 ; + } +} +/* * Emit function prologue *
@@ -1503,7 +1521,14 @@ static bool bpf_is_new_addr_sane(struct bpf_jit *jit, int i)*/ static int bpf_set_addr (struct bpf_jit *jit,int i) { -if (!bpf_is_new_addr_sane (jit, i)) +int delta; + +if (is_codegen_pass (jit)) { + delta = jit->prg - jit->addrs[i]; +if (delta <0 ) +bpf_skip (jit, -delta); + } +if (WARN_ON_ONCE (!bpf_is_new_addr_sane (jit, i)))return -1 ; jit->addrs[i] = jit->prg;return 0 ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 277/464 tools/bpftool: Fix error handing in do_skeleton()
In reply to Greg Kroah-HartmanFrom: YueHaibing <[email protected]>
[ Upstream commit 956fcfcd359512f15b19bcd157fa8206ed26605b ]
Fix pass 0 to PTR_ERR, also dump more err info using libbpf_strerror.
--- tools/bpf/bpftool/gen.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
tools/bpf/bpftool/gen.c +4 -1
@@ -305,8 +305,11 @@ static int do_skeleton(int argc, char **argv) opts.object_name = obj_name; obj =bpf_object__open_mem (obj_data, file_sz, &opts);if (IS_ERR (obj)) { +char err_buf[256 ]; + +libbpf_strerror (PTR_ERR (obj), err_buf,sizeof (err_buf)); +p_err ("failed to open BPF object file: %s" , err_buf); obj =NULL ; -p_err ("failed to open BPF object file: %ld" ,PTR_ERR (obj)); goto out; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 253/464 drm/imx: fix use after free
In reply to Greg Kroah-HartmanFrom: Philipp Zabel <[email protected]>
[ Upstream commit ba807c94f67fd64b3051199810d9e4dd209fdc00 ]
Component driver structures allocated with devm_kmalloc() in bind() are freed automatically after unbind(). Since the contained drm structures are accessed afterwards in drm_mode_config_cleanup(), move the allocation into probe() to extend the driver structure's lifetime to the lifetime of the device. This should eventually be changed to use drm resource managed allocations with lifetime of the drm device.
We also need to ensure that all componets are available during the unbind() so we need to call component_unbind_all() before we free non-devres resources like planes.
Note this patch fixes the the use after free bug but introduces a possible boot loop issue. The issue is triggered if the HDMI support is enabled and a component driver always return -EPROBE_DEFER, see discussion [1] for more details.
[1] https://lkml.org/lkml/2020/3/24/1467
[m.felsch@pengutronix: resort component_unbind_all())
--- drivers/gpu/drm/imx/dw_hdmi-imx.c | 15 ++++++++++----- drivers/gpu/drm/imx/imx-drm-core.c | 3 ++- drivers/gpu/drm/imx/imx-ldb.c | 15 ++++++++++----- drivers/gpu/drm/imx/imx-tve.c | 15 ++++++++++----- drivers/gpu/drm/imx/ipuv3-crtc.c | 21 ++++++++++----------- drivers/gpu/drm/imx/parallel-display.c | 15 ++++++++++----- 6 files changed, 52 insertions(+), 32 deletions(-)
drivers/gpu/drm/imx/dw_hdmi-imx.c +10 -5
@@ -209,9 +209,8 @@ static int dw_hdmi_imx_bind(struct device *dev, struct device *master,if (!pdev->dev.of_node)return -ENODEV ; - hdmi =devm_kzalloc (&pdev->dev,sizeof (*hdmi),GFP_KERNEL ); -if (!hdmi) -return -ENOMEM ; + hdmi =dev_get_drvdata (dev); +memset (hdmi,0 ,sizeof (*hdmi)); match =of_match_node (dw_hdmi_imx_dt_ids, pdev->dev.of_node); plat_data = match->data;
@@ -235,8 +234,6 @@ static int dw_hdmi_imx_bind(struct device *dev, struct device *master,drm_encoder_helper_add (encoder, &dw_hdmi_imx_encoder_helper_funcs);drm_simple_encoder_init (drm, encoder,DRM_MODE_ENCODER_TMDS ); -platform_set_drvdata (pdev, hdmi); - hdmi->hdmi =dw_hdmi_bind (pdev, encoder, plat_data);/*
@@ -266,6 +263,14 @@ static const struct component_ops dw_hdmi_imx_ops = {static int dw_hdmi_imx_probe (struct platform_device *pdev) { +struct imx_hdmi *hdmi; + + hdmi =devm_kzalloc (&pdev->dev,sizeof (*hdmi),GFP_KERNEL ); +if (!hdmi) +return -ENOMEM ; + +platform_set_drvdata (pdev, hdmi); +return component_add (&pdev->dev, &dw_hdmi_imx_ops); }
drivers/gpu/drm/imx/imx-drm-core.c +2 -1
@@ -275,9 +275,10 @@ static void imx_drm_unbind(struct device *dev)drm_kms_helper_poll_fini (drm); +component_unbind_all (drm->dev, drm); +drm_mode_config_cleanup (drm); -component_unbind_all (drm->dev, drm);dev_set_drvdata (dev,NULL );drm_dev_put (drm);
drivers/gpu/drm/imx/imx-ldb.c +10 -5
@@ -590,9 +590,8 @@ static int imx_ldb_bind(struct device *dev, struct device *master, void *data)int ret;int i; - imx_ldb =devm_kzalloc (dev,sizeof (*imx_ldb),GFP_KERNEL ); -if (!imx_ldb) -return -ENOMEM ; + imx_ldb =dev_get_drvdata (dev); +memset (imx_ldb,0 ,sizeof (*imx_ldb)); imx_ldb->regmap =syscon_regmap_lookup_by_phandle (np,"gpr" );if (IS_ERR (imx_ldb->regmap)) {
@@ -700,8 +699,6 @@ static int imx_ldb_bind(struct device *dev, struct device *master, void *data) } } -dev_set_drvdata (dev, imx_ldb); -return 0 ; free_child:
@@ -733,6 +730,14 @@ static const struct component_ops imx_ldb_ops = {static int imx_ldb_probe (struct platform_device *pdev) { +struct imx_ldb *imx_ldb; + + imx_ldb =devm_kzalloc (&pdev->dev,sizeof (*imx_ldb),GFP_KERNEL ); +if (!imx_ldb) +return -ENOMEM ; + +platform_set_drvdata (pdev, imx_ldb); +return component_add (&pdev->dev, &imx_ldb_ops); }
drivers/gpu/drm/imx/imx-tve.c +10 -5
@@ -542,9 +542,8 @@ static int imx_tve_bind(struct device *dev, struct device *master, void *data)int irq;int ret; - tve =devm_kzalloc (dev,sizeof (*tve),GFP_KERNEL ); -if (!tve) -return -ENOMEM ; + tve =dev_get_drvdata (dev); +memset (tve,0 ,sizeof (*tve)); tve->dev = dev;spin_lock_init (&tve->lock);
@@ -655,8 +654,6 @@ static int imx_tve_bind(struct device *dev, struct device *master, void *data)if (ret)return ret; -dev_set_drvdata (dev, tve); -return 0 ; }
@@ -676,6 +673,14 @@ static const struct component_ops imx_tve_ops = {static int imx_tve_probe (struct platform_device *pdev) { +struct imx_tve *tve; + + tve =devm_kzalloc (&pdev->dev,sizeof (*tve),GFP_KERNEL ); +if (!tve) +return -ENOMEM ; + +platform_set_drvdata (pdev, tve); +return component_add (&pdev->dev, &imx_tve_ops); }
drivers/gpu/drm/imx/ipuv3-crtc.c +10 -11
@@ -438,21 +438,13 @@ static int ipu_drm_bind(struct device *dev, struct device *master, void *data)struct ipu_client_platformdata *pdata = dev->platform_data;struct drm_device *drm = data;struct ipu_crtc *ipu_crtc; -int ret; - ipu_crtc =devm_kzalloc (dev,sizeof (*ipu_crtc),GFP_KERNEL ); -if (!ipu_crtc) -return -ENOMEM ; + ipu_crtc =dev_get_drvdata (dev); +memset (ipu_crtc,0 ,sizeof (*ipu_crtc)); ipu_crtc->dev = dev; - ret =ipu_crtc_init (ipu_crtc, pdata, drm); -if (ret) -return ret; - -dev_set_drvdata (dev, ipu_crtc); - -return 0 ; +return ipu_crtc_init (ipu_crtc, pdata, drm); } static void ipu_drm_unbind(struct device *dev, struct device *master,
@@ -474,6 +466,7 @@ static const struct component_ops ipu_crtc_ops = {static int ipu_drm_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev; +struct ipu_crtc *ipu_crtc;int ret;if (!dev->platform_data)
@@ -483,6 +476,12 @@ static int ipu_drm_probe(struct platform_device *pdev)if (ret)return ret; + ipu_crtc =devm_kzalloc (dev,sizeof (*ipu_crtc),GFP_KERNEL ); +if (!ipu_crtc) +return -ENOMEM ; + +dev_set_drvdata (dev, ipu_crtc); +return component_add (dev, &ipu_crtc_ops); }
drivers/gpu/drm/imx/parallel-display.c +10 -5
@@ -326,9 +326,8 @@ static int imx_pd_bind(struct device *dev, struct device *master, void *data)u32 bus_format =0 ;const char *fmt; - imxpd =devm_kzalloc (dev,sizeof (*imxpd),GFP_KERNEL ); -if (!imxpd) -return -ENOMEM ; + imxpd =dev_get_drvdata (dev); +memset (imxpd,0 ,sizeof (*imxpd)); edidp =of_get_property (np,"edid" , &imxpd->edid_len);if (edidp)
@@ -359,8 +358,6 @@ static int imx_pd_bind(struct device *dev, struct device *master, void *data)if (ret)return ret; -dev_set_drvdata (dev, imxpd); -return 0 ; }
@@ -382,6 +379,14 @@ static const struct component_ops imx_pd_ops = {static int imx_pd_probe (struct platform_device *pdev) { +struct imx_parallel_display *imxpd; + + imxpd =devm_kzalloc (&pdev->dev,sizeof (*imxpd),GFP_KERNEL ); +if (!imxpd) +return -ENOMEM ; + +platform_set_drvdata (pdev, imxpd); +return component_add (&pdev->dev, &imx_pd_ops); }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 259/464 clk: qcom: gcc: Make disp gpll0 branch aon for sc7180/sdm845
In reply to Greg Kroah-HartmanFrom: Taniya Das <[email protected]>
[ Upstream commit 9c3df2b1993da9ab1110702d7b2815d5cd8c02f3 ]
The display gpll0 branch clock inside GCC needs to always be enabled. Otherwise the AHB clk (disp_cc_mdss_ahb_clk_src) for the display clk controller (dispcc) will stop clocking while sourcing from gpll0 when this branch inside GCC is turned off during unused clk disabling. We can never turn this branch off because the AHB clk for the display subsystem is needed to read/write any registers inside the display subsystem including clk related ones. This makes this branch a really easy way to turn off AHB access to the display subsystem and cause all sorts of mayhem. Let's just make the clk ops keep the clk enabled forever and ignore any attempts to disable this clk so that dispcc accesses keep working.
--- drivers/clk/qcom/gcc-sc7180.c | 2 +- drivers/clk/qcom/gcc-sdm845.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/clk/qcom/gcc-sc7180.c +1 -1
@@ -1061,7 +1061,7 @@ static struct clk_branch gcc_disp_gpll0_clk_src = { .hw = &gpll0.clkr.hw, }, .num_parents = 1, - .ops = &clk_branch2_ops, + .ops = &clk_branch2_aon_ops, }, }, };
drivers/clk/qcom/gcc-sdm845.c +2 -2
@@ -1,6 +1,6 @@// SPDX-License-Identifier: GPL-2.0 /* -* Copyright (c) 2018, The Linux Foundation. All rights reserved. +* Copyright (c) 2018, 2020, The Linux Foundation. All rights reserved. */ #include <linux/kernel.h>
@@ -1344,7 +1344,7 @@ static struct clk_branch gcc_disp_gpll0_clk_src = { "gpll0", }, .num_parents = 1, - .ops = &clk_branch2_ops, + .ops = &clk_branch2_aon_ops, }, }, };
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 296/464 macintosh/via-macii: Access autopoll_devs when inside lock
In reply to Greg Kroah-HartmanFrom: Finn Thain <[email protected]>
[ Upstream commit 59ea38f6b3af5636edf541768a1ed721eeaca99e ]
The interrupt handler should be excluded when accessing the autopoll_devs variable.
--- drivers/macintosh/via-macii.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/macintosh/via-macii.c +3 -6
@@ -270,15 +270,12 @@ static int macii_autopoll(int devs)unsigned long flags;int err =0 ; +local_irq_save (flags); +/* bit 1 == device 1, and so on. */ autopoll_devs = devs &0xFFFE ; -if (!autopoll_devs) -return 0 ; - -local_irq_save (flags); - -if (current_req ==NULL ) { +if (autopoll_devs && !current_req) {/* Send a Talk Reg 0. The controller will repeatedly transmit * this as long as it is idle. */
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 298/464 PCI: hv: Fix a timing issue which causes kdump to fail occasionally
In reply to Greg Kroah-HartmanFrom: Wei Hu <[email protected]>
[ Upstream commit d6af2ed29c7c1c311b96dac989dcb991e90ee195 ]
Kdump could fail sometime on Hyper-V guest because the retry in hv_pci_enter_d0() releases child device structures in hv_pci_bus_exit().
Although there is a second asynchronous device relations message sending from the host, if this message arrives to the guest after hv_send_resource_allocated() is called, the retry would fail.
Fix the problem by moving retry to hv_pci_probe() and start the retry from hv_pci_query_relations() call. This will cause a device relations message to arrive to the guest synchronously; the guest would then be able to rebuild the child device structures before calling hv_send_resource_allocated().
--- drivers/pci/controller/pci-hyperv.c | 71 +++++++++++++++-------------- 1 file changed, 37 insertions(+), 34 deletions(-)
drivers/pci/controller/pci-hyperv.c +37 -34
@@ -2759,10 +2759,8 @@ static int hv_pci_enter_d0(struct hv_device *hdev)struct pci_bus_d0_entry *d0_entry;struct hv_pci_compl comp_pkt;struct pci_packet *pkt; -bool retry = true;int ret; -enter_d0_retry:/* * Tell the host that the bus is ready to use, and moved into the * powered-on state. This includes telling the host which region
@@ -2789,38 +2787,6 @@ static int hv_pci_enter_d0(struct hv_device *hdev)if (ret) goto exit; -/* -* In certain case (Kdump) the pci device of interest was -* not cleanly shut down and resource is still held on host -* side, the host could return invalid device status. -* We need to explicitly request host to release the resource -* and try to enter D0 again. -*/ -if (comp_pkt.completion_status <0 && retry) { - retry = false; - -dev_err (&hdev->device,"Retrying D0 Entry\n" ); - -/* -* Hv_pci_bus_exit() calls hv_send_resource_released() -* to free up resources of its child devices. -* In the kdump kernel we need to set the -* wslot_res_allocated to 255 so it scans all child -* devices to release resources allocated in the -* normal kernel before panic happened. -*/ - hbus->wslot_res_allocated =255 ; - - ret =hv_pci_bus_exit (hdev, true); - -if (ret ==0 ) { -kfree (pkt); - goto enter_d0_retry; - } -dev_err (&hdev->device, -"Retrying D0 failed with ret %d\n" , ret); - } -if (comp_pkt.completion_status <0 ) { dev_err(&hdev->device, "PCI Pass-through VSP failed D0 Entry with status %x\n",
@@ -3058,6 +3024,7 @@ static int hv_pci_probe(struct hv_device *hdev,struct hv_pcibus_device *hbus;u16 dom_req, dom;char *name; +bool enter_d0_retry = true;int ret;/*
@@ -3178,11 +3145,47 @@ static int hv_pci_probe(struct hv_device *hdev,if (ret) goto free_fwnode; +retry: ret =hv_pci_query_relations (hdev);if (ret) goto free_irq_domain; ret =hv_pci_enter_d0 (hdev); +/* +* In certain case (Kdump) the pci device of interest was +* not cleanly shut down and resource is still held on host +* side, the host could return invalid device status. +* We need to explicitly request host to release the resource +* and try to enter D0 again. +* Since the hv_pci_bus_exit() call releases structures +* of all its child devices, we need to start the retry from +* hv_pci_query_relations() call, requesting host to send +* the synchronous child device relations message before this +* information is needed in hv_send_resources_allocated() +* call later. +*/ +if (ret == -EPROTO && enter_d0_retry) { + enter_d0_retry = false; + +dev_err (&hdev->device,"Retrying D0 Entry\n" ); + +/* +* Hv_pci_bus_exit() calls hv_send_resources_released() +* to free up resources of its child devices. +* In the kdump kernel we need to set the +* wslot_res_allocated to 255 so it scans all child +* devices to release resources allocated in the +* normal kernel before panic happened. +*/ + hbus->wslot_res_allocated =255 ; + ret =hv_pci_bus_exit (hdev, true); + +if (ret ==0 ) + goto retry; + +dev_err (&hdev->device, +"Retrying D0 failed with ret %d\n" , ret); + }if (ret) goto free_irq_domain;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 303/464 Smack: prevent underflow in smk_set_cipso()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 42a2df3e829f3c5562090391b33714b2e2e5ad4a ]
We have an upper bound on "maplevel" but forgot to check for negative values.
--- security/smack/smackfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
security/smack/smackfs.c +1 -1
@@ -884,7 +884,7 @@ static ssize_t smk_set_cipso(struct file *file, const char __user *buf, } ret =sscanf (rule,"%d" , &maplevel); -if (ret !=1 || maplevel >SMACK_CIPSO_MAXLEVEL ) +if (ret !=1 || maplevel <0 || maplevel >SMACK_CIPSO_MAXLEVEL ) goto out; rule +=SMK_DIGITLEN ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 307/464 Bluetooth: hci_serdev: Only unregister device if it was registered
In reply to Greg Kroah-HartmanFrom: Nicolas Boichat <[email protected]>
[ Upstream commit 202798db9570104728dce8bb57dfeed47ce764bc ]
We should not call hci_unregister_dev if the device was not successfully registered.
--- drivers/bluetooth/hci_serdev.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/bluetooth/hci_serdev.c +2 -1
@@ -355,7 +355,8 @@ void hci_uart_unregister_device(struct hci_uart *hu)struct hci_dev *hdev = hu->hdev;clear_bit (HCI_UART_PROTO_READY , &hu->flags); -hci_unregister_dev (hdev); +if (test_bit (HCI_UART_REGISTERED , &hu->flags)) +hci_unregister_dev (hdev);hci_free_dev (hdev);cancel_work_sync (&hu->write_work);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 308/464 bpf: Fix bpf_ringbuf_output() signature to return long
In reply to Greg Kroah-HartmanFrom: Andrii Nakryiko <[email protected]>
[ Upstream commit e1613b5714ee6c186c9628e9958edf65e9d9cddd ]
Due to bpf tree fix merge, bpf_ringbuf_output() signature ended up with int as a return type, while all other helpers got converted to returning long. So fix it in bpf-next now.
--- include/uapi/linux/bpf.h | 2 +- tools/include/uapi/linux/bpf.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
include/uapi/linux/bpf.h +1 -1
@@ -3168,7 +3168,7 @@ union bpf_attr {* Return * The id is returned or 0 in case the id could not be retrieved. * -* int bpf_ringbuf_output(void *ringbuf, void *data, u64 size, u64 flags) +* long bpf_ringbuf_output(void *ringbuf, void *data, u64 size, u64 flags) * Description * Copy *size* bytes from *data* into a ring buffer *ringbuf*. * If **BPF_RB_NO_WAKEUP** is specified in *flags*, no notification
tools/include/uapi/linux/bpf.h +1 -1
@@ -3168,7 +3168,7 @@ union bpf_attr {* Return * The id is returned or 0 in case the id could not be retrieved. * -* int bpf_ringbuf_output(void *ringbuf, void *data, u64 size, u64 flags) +* long bpf_ringbuf_output(void *ringbuf, void *data, u64 size, u64 flags) * Description * Copy *size* bytes from *data* into a ring buffer *ringbuf*. * If **BPF_RB_NO_WAKEUP** is specified in *flags*, no notification
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 309/464 Bluetooth: Fix suspend notifier race
In reply to Greg Kroah-HartmanFrom: Abhishek Pandit-Subedi <[email protected]>
[ Upstream commit 4e8c36c3b0d73d46aa27cfd4308aaa445a1067df ]
Unregister from suspend notifications and cancel suspend preparations before running hci_dev_do_close. Otherwise, the suspend notifier may race with unregister and cause cmd_timeout even after hdev has been freed.
Below is the trace from when this panic was seen:
[ 832.578518] Bluetooth: hci_core.c:hci_cmd_timeout() hci0: command 0x0c05 tx timeout [ 832.586200] BUG: kernel NULL pointer dereference, address: 0000000000000000 [ 832.586203] #PF: supervisor read access in kernel mode [ 832.586205] #PF: error_code(0x0000) - not-present page [ 832.586206] PGD 0 P4D 0 [ 832.586210] PM: suspend exit [ 832.608870] Oops: 0000 [#1] PREEMPT SMP NOPTI [ 832.613232] CPU: 3 PID: 10755 Comm: kworker/3:7 Not tainted 5.4.44-04894-g1e9dbb96a161 #1 [ 832.630036] Workqueue: events hci_cmd_timeout [bluetooth] [ 832.630046] RIP: 0010:__queue_work+0xf0/0x374 [ 832.630051] RSP: 0018:ffff9b5285f1fdf8 EFLAGS: 00010046 [ 832.674033] RAX: ffff8a97681bac00 RBX: 0000000000000000 RCX: ffff8a976a000600 [ 832.681162] RDX: 0000000000000000 RSI: 0000000000000009 RDI: ffff8a976a000748 [ 832.688289] RBP: ffff9b5285f1fe38 R08: 0000000000000000 R09: ffff8a97681bac00 [ 832.695418] R10: 0000000000000002 R11: ffff8a976a0006d8 R12: ffff8a9745107600 [ 832.698045] usb 1-6: new full-speed USB device number 119 using xhci_hcd [ 832.702547] R13: ffff8a9673658850 R14: 0000000000000040 R15: 000000000000001e [ 832.702549] FS: 0000000000000000(0000) GS:ffff8a976af80000(0000) knlGS:0000000000000000 [ 832.702550] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 832.702550] CR2: 0000000000000000 CR3: 000000010415a000 CR4: 00000000003406e0 [ 832.702551] Call Trace: [ 832.702558] queue_work_on+0x3f/0x68 [ 832.702562] process_one_work+0x1db/0x396 [ 832.747397] worker_thread+0x216/0x375 [ 832.751147] kthread+0x138/0x140 [ 832.754377] ? pr_cont_work+0x58/0x58 [ 832.758037] ? kthread_blkcg+0x2e/0x2e [ 832.761787] ret_from_fork+0x22/0x40 [ 832.846191] ---[ end trace fa93f466da517212 ]---
--- net/bluetooth/hci_core.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
net/bluetooth/hci_core.c +3 -2
@@ -3608,9 +3608,10 @@ void hci_unregister_dev(struct hci_dev *hdev)cancel_work_sync (&hdev->power_on); -hci_dev_do_close (hdev); -unregister_pm_notifier (&hdev->suspend_notifier); +cancel_work_sync (&hdev->suspend_prepare); + +hci_dev_do_close (hdev); if (!test_bit(HCI_INIT, &hdev->flags) && !hci_dev_test_flag(hdev, HCI_SETUP) &&
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 240/464 ima: Free the entire rule when deleting a list of rules
In reply to Greg Kroah-HartmanFrom: Tyler Hicks <[email protected]>
[ Upstream commit 465aee77aae857b5fcde56ee192b33dc369fba04 ]
Create a function, ima_free_rule(), to free all memory associated with an ima_rule_entry. Use the new function to fix memory leaks of allocated ima_rule_entry members, such as .fsname and .keyrings, when deleting a list of rules.
Make the existing ima_lsm_free_rule() function specific to the LSM audit rule array of an ima_rule_entry and require that callers make an additional call to kfree to free the ima_rule_entry itself.
This fixes a memory leak seen when loading by a valid rule that contains an additional piece of allocated memory, such as an fsname, followed by an invalid rule that triggers a policy load failure:
# echo -e "dont_measure fsname=securityfs\nbad syntax" > \
/sys/kernel/security/ima/policy
-bash: echo: write error: Invalid argument
# echo scan > /sys/kernel/debug/kmemleak
# cat /sys/kernel/debug/kmemleak
unreferenced object 0xffff9bab67ca12c0 (size 16):
comm "bash", pid 684, jiffies 4295212803 (age 252.344s)
hex dump (first 16 bytes):
73 65 63 75 72 69 74 79 66 73 00 6b 6b 6b 6b a5 securityfs.kkkk.
backtrace:
[<00000000adc80b1b>] kstrdup+0x2e/0x60
[<00000000d504cb0d>] ima_parse_add_rule+0x7d4/0x1020
[<00000000444825ac>] ima_write_policy+0xab/0x1d0
[<000000002b7f0d6c>] vfs_write+0xde/0x1d0
[<0000000096feedcf>] ksys_write+0x68/0xe0
[<0000000052b544a2>] do_syscall_64+0x56/0xa0
[<000000007ead1ba7>] entry_SYSCALL_64_after_hwframe+0x44/0xa9--- security/integrity/ima/ima_policy.c | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-)
security/integrity/ima/ima_policy.c +24 -5
@@ -261,6 +261,21 @@ static void ima_lsm_free_rule(struct ima_rule_entry *entry)security_filter_rule_free (entry->lsm[i].rule);kfree (entry->lsm[i].args_p); } +} + +static void ima_free_rule (struct ima_rule_entry *entry) +{ +if (!entry) +return ; + +/* +* entry->template->fields may be allocated in ima_parse_rule() but that +* reference is owned by the corresponding ima_template_desc element in +* the defined_templates list and cannot be freed here +*/ +kfree (entry->fsname); +kfree (entry->keyrings); +ima_lsm_free_rule (entry);kfree (entry); }
@@ -302,6 +317,7 @@ static struct ima_rule_entry *ima_lsm_copy_rule(struct ima_rule_entry *entry) out_err:ima_lsm_free_rule (nentry); +kfree (nentry);return NULL ; }
@@ -315,7 +331,14 @@ static int ima_lsm_update_rule(struct ima_rule_entry *entry)list_replace_rcu (&entry->list, &nentry->list);synchronize_rcu (); +/* +* ima_lsm_copy_rule() shallow copied all references, except for the +* LSM references, from entry to nentry so we only want to free the LSM +* references and the entry itself. All other memory refrences will now +* be owned by nentry. +*/ ima_lsm_free_rule (entry); +kfree (entry);return 0 ; }
@@ -1402,15 +1425,11 @@ ssize_t ima_parse_add_rule(char *rule)void ima_delete_rules (void ) {struct ima_rule_entry *entry, *tmp; -int i; temp_ima_appraise =0 ;list_for_each_entry_safe (entry, tmp, &ima_temp_rules, list) { -for (i =0 ; i <MAX_LSM_RULES ; i++) -kfree (entry->lsm[i].args_p); -list_del (&entry->list); -kfree (entry); +ima_free_rule (entry); } }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 311/464 net: dsa: rtl8366: Fix VLAN semantics
In reply to Greg Kroah-HartmanFrom: Linus Walleij <[email protected]>
[ Upstream commit 15ab7906cc9290afb006df1bb1074907fbcc7061 ]
The RTL8366 would not handle adding new members (ports) to a VLAN: the code assumed that ->port_vlan_add() was only called once for a single port. When intializing the switch with .configure_vlan_while_not_filtering set to true, the function is called numerous times for adding all ports to VLAN1, which was something the code could not handle.
Alter rtl8366_set_vlan() to just |= new members and untagged flags to 4k and MC VLAN table entries alike. This makes it possible to just add new ports to a VLAN.
Put in some helpful debug code that can be used to find any further bugs here.
--- drivers/net/dsa/rtl8366.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-)
drivers/net/dsa/rtl8366.c +17 -4
@@ -43,18 +43,26 @@ int rtl8366_set_vlan(struct realtek_smi *smi, int vid, u32 member,int ret;int i; +dev_dbg (smi->dev, +"setting VLAN%d 4k members: 0x%02x, untagged: 0x%02x\n" , + vid, member, untag); +/* Update the 4K table */ ret = smi->ops->get_vlan_4k (smi, vid, &vlan4k);if (ret)return ret; - vlan4k.member = member; - vlan4k.untag = untag; + vlan4k.member |= member; + vlan4k.untag |= untag; vlan4k.fid = fid; ret = smi->ops->set_vlan_4k (smi, &vlan4k);if (ret)return ret; +dev_dbg (smi->dev, +"resulting VLAN%d 4k members: 0x%02x, untagged: 0x%02x\n" , + vid, vlan4k.member, vlan4k.untag); +/* Try to find an existing MC entry for this VID */ for (i =0 ; i < smi->num_vlan_mc; i++) {struct rtl8366_vlan_mc vlanmc;
@@ -65,11 +73,16 @@ int rtl8366_set_vlan(struct realtek_smi *smi, int vid, u32 member,if (vid == vlanmc.vid) {/* update the MC entry */ - vlanmc.member = member; - vlanmc.untag = untag; + vlanmc.member |= member; + vlanmc.untag |= untag; vlanmc.fid = fid; ret = smi->ops->set_vlan_mc (smi, i, &vlanmc); + +dev_dbg (smi->dev, +"resulting VLAN%d MC members: 0x%02x, untagged: 0x%02x\n" , + vid, vlanmc.member, vlanmc.untag); +break ; } }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 286/464 usb: dwc2: Fix error path in gadget registration
In reply to Greg Kroah-HartmanFrom: Marek Szyprowski <[email protected]>
[ Upstream commit 33a06f1300a79cfd461cea0268f05e969d4f34ec ]
When gadget registration fails, one should not call usb_del_gadget_udc(). Ensure this by setting gadget->udc to NULL. Also in case of a failure there is no need to disable low-level hardware, so return immiedetly instead of jumping to error_init label.
This fixes the following kernel NULL ptr dereference on gadget failure (can be easily triggered with g_mass_storage without any module parameters):
dwc2 12480000.hsotg: dwc2_check_params: Invalid parameter besl=1 dwc2 12480000.hsotg: dwc2_check_params: Invalid parameter g_np_tx_fifo_size=1024 dwc2 12480000.hsotg: EPs: 16, dedicated fifos, 7808 entries in SPRAM Mass Storage Function, version: 2009/09/11
LUN: removable file: (no medium)
no file given for LUN0g_mass_storage 12480000.hsotg: failed to start g_mass_storage: -22 8<--- cut here ---
Unable to handle kernel NULL pointer dereference at virtual address 00000104 pgd = (ptrval) [00000104] *pgd=00000000 Internal error: Oops: 805 [#1] PREEMPT SMP ARM Modules linked in: CPU: 0 PID: 12 Comm: kworker/0:1 Not tainted 5.8.0-rc5 #3133 Hardware name: Samsung Exynos (Flattened Device Tree) Workqueue: events deferred_probe_work_func PC is at usb_del_gadget_udc+0x38/0xc4 LR is at __mutex_lock+0x31c/0xb18 ... Process kworker/0:1 (pid: 12, stack limit = 0x(ptrval)) Stack: (0xef121db0 to 0xef122000)
...
[<c076bf3c>] (usb_del_gadget_udc) from [<c0726bec>] (dwc2_hsotg_remove+0x10/0x20) [<c0726bec>] (dwc2_hsotg_remove) from [<c0711208>] (dwc2_driver_probe+0x57c/0x69c) [<c0711208>] (dwc2_driver_probe) from [<c06247c0>] (platform_drv_probe+0x6c/0xa4) [<c06247c0>] (platform_drv_probe) from [<c0621df4>] (really_probe+0x200/0x48c) [<c0621df4>] (really_probe) from [<c06221e8>] (driver_probe_device+0x78/0x1fc) [<c06221e8>] (driver_probe_device) from [<c061fcd4>] (bus_for_each_drv+0x74/0xb8) [<c061fcd4>] (bus_for_each_drv) from [<c0621b54>] (__device_attach+0xd4/0x16c) [<c0621b54>] (__device_attach) from [<c0620c98>] (bus_probe_device+0x88/0x90) [<c0620c98>] (bus_probe_device) from [<c06211b0>] (deferred_probe_work_func+0x3c/0xd0) [<c06211b0>] (deferred_probe_work_func) from [<c0149280>] (process_one_work+0x234/0x7dc) [<c0149280>] (process_one_work) from [<c014986c>] (worker_thread+0x44/0x51c) [<c014986c>] (worker_thread) from [<c0150b1c>] (kthread+0x158/0x1a0) [<c0150b1c>] (kthread) from [<c0100114>] (ret_from_fork+0x14/0x20)
Exception stack(0xef121fb0 to 0xef121ff8) ... ---[ end trace 9724c2fc7cc9c982 ]---
While fixing this also fix the double call to dwc2_lowlevel_hw_disable() if dr_mode is set to USB_DR_MODE_PERIPHERAL. In such case low-level hardware is already disabled before calling usb_add_gadget_udc(). That function correctly preserves low-level hardware state, there is no need for the second unconditional dwc2_lowlevel_hw_disable() call.
--- drivers/usb/dwc2/platform.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/usb/dwc2/platform.c +3 -1
@@ -582,6 +582,7 @@ static int dwc2_driver_probe(struct platform_device *dev)if (hsotg->gadget_enabled) { retval =usb_add_gadget_udc (hsotg->dev, &hsotg->gadget);if (retval) { + hsotg->gadget.udc =NULL ;dwc2_hsotg_remove (hsotg); goto error_init; }
@@ -593,7 +594,8 @@ static int dwc2_driver_probe(struct platform_device *dev)if (hsotg->params.activate_stm_id_vb_detection)regulator_disable (hsotg->usb33d); error: -dwc2_lowlevel_hw_disable (hsotg); +if (hsotg->dr_mode !=USB_DR_MODE_PERIPHERAL ) +dwc2_lowlevel_hw_disable (hsotg);return retval; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 242/464 ima: Fail rule parsing when buffer hook functions have an invalid action
In reply to Greg Kroah-HartmanFrom: Tyler Hicks <[email protected]>
[ Upstream commit 712183437ebebc89cd086ef96cf9a521fd97fd09 ]
Buffer based hook functions, such as KEXEC_CMDLINE and KEY_CHECK, can only measure. The process_buffer_measurement() function quietly ignores all actions except measure so make this behavior clear at the time of policy load.
The parsing of the keyrings conditional had a check to ensure that it was only specified with measure actions but the check should be on the hook function and not the keyrings conditional since "appraise func=KEY_CHECK" is not a valid rule.
--- security/integrity/ima/ima_policy.c | 40 +++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-)
security/integrity/ima/ima_policy.c +38 -2
@@ -973,6 +973,43 @@ static void check_template_modsig(const struct ima_template_desc *template)#undef MSG } +static bool ima_validate_rule (struct ima_rule_entry *entry) +{ +/* Ensure that the action is set */ +if (entry->action ==UNKNOWN ) +return false; + +/* +* Ensure that the hook function is compatible with the other +* components of the rule +*/ +switch (entry->func) { +case NONE : +case FILE_CHECK : +case MMAP_CHECK : +case BPRM_CHECK : +case CREDS_CHECK : +case POST_SETATTR : +case MODULE_CHECK : +case FIRMWARE_CHECK : +case KEXEC_KERNEL_CHECK : +case KEXEC_INITRAMFS_CHECK : +case POLICY_CHECK : +/* Validation of these hook functions is in ima_parse_rule() */ +break ; +case KEXEC_CMDLINE : +case KEY_CHECK : +if (entry->action & ~(MEASURE |DONT_MEASURE )) +return false; + +break ; +default : +return false; + } + +return true; +} +static int ima_parse_rule (char *rule,struct ima_rule_entry *entry) {struct audit_buffer *ab;
@@ -1150,7 +1187,6 @@ static int ima_parse_rule(char *rule, struct ima_rule_entry *entry) keyrings_len =strlen (args[0 ].from) +1 ;if ((entry->keyrings) || - (entry->action !=MEASURE ) || (entry->func !=KEY_CHECK ) || (keyrings_len <2 )) { result = -EINVAL ;
@@ -1356,7 +1392,7 @@ static int ima_parse_rule(char *rule, struct ima_rule_entry *entry)break ; } } -if (!result && (entry->action ==UNKNOWN )) +if (!result && !ima_validate_rule (entry)) result = -EINVAL ;else if (entry->action ==APPRAISE ) temp_ima_appraise |=ima_appraise_flag (entry->func);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 287/464 usb: gadget: f_uac2: fix AC Interface Header Descriptor wTotalLength
In reply to Greg Kroah-HartmanFrom: Ruslan Bilovol <[email protected]>
[ Upstream commit a9cf8715180b18c62addbfe6f6267b8101903119 ]
As per UAC2 spec (ch. 4.7.2), wTotalLength of AC Interface Header Descriptor "includes the combined length of this descriptor header and all Clock Source, Unit and Terminal descriptors."
Thus add its size to its wTotalLength.
Also after recent changes wTotalLength is calculated dynamically, update static definition of uac2_ac_header_descriptor accordingly
--- drivers/usb/gadget/function/f_uac2.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/usb/gadget/function/f_uac2.c +2 -5
@@ -215,10 +215,7 @@ static struct uac2_ac_header_descriptor ac_hdr_desc = { .bDescriptorSubtype = UAC_MS_HEADER, .bcdADC = cpu_to_le16(0x200), .bCategory = UAC2_FUNCTION_IO_BOX, - .wTotalLength =cpu_to_le16 (sizeof in_clk_src_desc - +sizeof out_clk_src_desc +sizeof usb_out_it_desc - +sizeof io_in_it_desc +sizeof usb_in_ot_desc - + sizeof io_out_ot_desc), + /* .wTotalLength = DYNAMIC */ .bmControls = 0, };
@@ -501,7 +498,7 @@ static void setup_descriptor(struct f_uac2_opts *opts) as_in_hdr_desc.bTerminalLink = usb_in_ot_desc.bTerminalID; iad_desc.bInterfaceCount =1 ; - ac_hdr_desc.wTotalLength =0 ; + ac_hdr_desc.wTotalLength =cpu_to_le16 (sizeof (ac_hdr_desc));if (EPIN_EN (opts)) {u16 len =le16_to_cpu (ac_hdr_desc.wTotalLength);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 315/464 selftests/powerpc: Squash spurious errors due to device removal
In reply to Greg Kroah-HartmanFrom: Oliver O'Halloran <[email protected]>
[ Upstream commit 5f8cf6475828b600ff6d000e580c961ac839cc61 ]
For drivers that don't have the error handling callbacks we implement recovery by removing the device and re-probing it. This causes the sysfs directory for the PCI device to be removed which causes the following spurious error to be printed when checking the PE state:
Breaking 0005:03:00.0...
./eeh-basic.sh: line 13: can't open /sys/bus/pci/devices/0005:03:00.0/eeh_pe_state: no such file 0005:03:00.0, waited 0/60
0005:03:00.0, waited 1/60
0005:03:00.0, waited 2/60
0005:03:00.0, waited 3/60
0005:03:00.0, waited 4/60
0005:03:00.0, waited 5/60
0005:03:00.0, waited 6/60
0005:03:00.0, waited 7/60
0005:03:00.0, Recovered after 8 seconds
We currently try to avoid this by checking if the PE state file exists before reading from it. This is however inherently racy so re-work the state checking so that we only read from the file once, and we squash any errors that occur while reading.
--- tools/testing/selftests/powerpc/eeh/eeh-functions.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
tools/testing/selftests/powerpc/eeh/eeh-functions.sh +8 -3
@@ -5,12 +5,17 @@ pe_ok() { local dev="$1" local path="/sys/bus/pci/devices/$dev/eeh_pe_state" - if ! [ -e "$path" ] ; then + # if a driver doesn't support the error handling callbacks then the + # device is recovered by removing and re-probing it. This causes the + # sysfs directory to disappear so read the PE state once and squash + # any potential error messages + local eeh_state="$(cat $path 2>/dev/null)" + if [ -z "$eeh_state" ]; then return 1; fi - local fw_state="$(cut -d' ' -f1 < $path)" - local sw_state="$(cut -d' ' -f2 < $path)" + local fw_state="$(echo $eeh_state | cut -d' ' -f1)" + local sw_state="$(echo $eeh_state | cut -d' ' -f2)" # If EEH_PE_ISOLATED or EEH_PE_RECOVERING are set then the PE is in an # error state or being recovered. Either way, not ok.
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 288/464 scsi: megaraid_sas: Clear affinity hint
In reply to Greg Kroah-HartmanFrom: Tomas Henzl <[email protected]>
[ Upstream commit 1eb81df5c53b1e785fdef298d533feab991381e4 ]
To avoid a warning in free_irq, clear the affinity hint.
--- drivers/scsi/megaraid/megaraid_sas_base.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/scsi/megaraid/megaraid_sas_base.c +8 -1
@@ -5602,9 +5602,13 @@ megasas_setup_irqs_msix(struct megasas_instance *instance, u8 is_probe) &instance->irq_context[i])) {dev_err (&instance->pdev->dev,"Failed to register IRQ for vector %d.\n" , i); -for (j =0 ; j < i; j++) +for (j =0 ; j < i; j++) { +if (j < instance->low_latency_index_start) +irq_set_affinity_hint ( +pci_irq_vector (pdev, j),NULL );free_irq (pci_irq_vector (pdev, j), &instance->irq_context[j]); + }/* Retry irq register for IO_APIC*/ instance->msix_vectors =0 ; instance->msix_load_balance = false;
@@ -5642,6 +5646,9 @@ megasas_destroy_irqs(struct megasas_instance *instance) {if (instance->msix_vectors)for (i =0 ; i < instance->msix_vectors; i++) { +if (i < instance->low_latency_index_start) +irq_set_affinity_hint ( +pci_irq_vector (instance->pdev, i),NULL );free_irq (pci_irq_vector (instance->pdev, i), &instance->irq_context[i]); }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 245/464 staging: rtl8192u: fix a dubious looking mask before a shift
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
[ Upstream commit c4283950a9a4d3bf4a3f362e406c80ab14f10714 ]
Currently the masking of ret with 0xff and followed by a right shift of 8 bits always leaves a zero result. It appears the mask of 0xff is incorrect and should be 0xff00, but I don't have the hardware to test this. Fix this to mask the upper 8 bits before shifting.
[ Not tested ]
Addresses-Coverity: ("Operands don't affect result")
--- drivers/staging/rtl8192u/r8192U_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8192u/r8192U_core.c +1 -1
@@ -2374,7 +2374,7 @@ static int rtl8192_read_eeprom_info(struct net_device *dev) ret =eprom_read (dev, (EEPROM_TX_PW_INDEX_CCK >>1 ));if (ret <0 )return ret; - priv->EEPROMTxPowerLevelCCK = ((u16 )ret &0xff ) >>8 ; + priv->EEPROMTxPowerLevelCCK = ((u16 )ret &0xff00 ) >>8 ; }else priv->EEPROMTxPowerLevelCCK =0x10 ;RT_TRACE (COMP_EPROM ,"CCK Tx Power Levl: 0x%02x\n" , priv->EEPROMTxPowerLevelCCK);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 289/464 scsi: mesh: Fix panic after host or bus reset
In reply to Greg Kroah-HartmanFrom: Finn Thain <[email protected]>
[ Upstream commit edd7dd2292ab9c3628b65c4d04514c3068ad54f6 ]
Booting Linux with a Conner CP3200 drive attached to the MESH SCSI bus results in EH measures and a panic:
[ 25.499838] mesh: configured for synchronous 5 MB/s [ 25.787154] mesh: performing initial bus reset... [ 29.867115] scsi host0: MESH [ 29.929527] mesh: target 0 synchronous at 3.6 MB/s [ 29.998763] scsi 0:0:0:0: Direct-Access CONNER CP3200-200mb-3.5 4040 PQ: 0 ANSI: 1 CCS [ 31.989975] sd 0:0:0:0: [sda] 415872 512-byte logical blocks: (213 MB/203 MiB) [ 32.070975] sd 0:0:0:0: [sda] Write Protect is off [ 32.137197] sd 0:0:0:0: [sda] Mode Sense: 5b 00 00 08 [ 32.209661] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA [ 32.332708] sda: [mac] sda1 sda2 sda3 [ 32.417733] sd 0:0:0:0: [sda] Attached SCSI disk ... snip ... [ 76.687067] mesh_abort((ptrval)) [ 76.743606] mesh: state at (ptrval), regs at (ptrval), dma at (ptrval) [ 76.810798] ct=6000 seq=86 bs=4017 fc= 0 exc= 0 err= 0 im= 7 int= 0 sp=85 [ 76.880720] dma stat=84e0 cmdptr=1f73d000 [ 76.941387] phase=4 msgphase=0 conn_tgt=0 data_ptr=24576 [ 77.005567] dma_st=1 dma_ct=0 n_msgout=0 [ 77.065456] target 0: req=(ptrval) goes_out=0 saved_ptr=0 [ 77.130512] mesh_abort((ptrval)) [ 77.187670] mesh: state at (ptrval), regs at (ptrval), dma at (ptrval) [ 77.255594] ct=6000 seq=86 bs=4017 fc= 0 exc= 0 err= 0 im= 7 int= 0 sp=85 [ 77.325778] dma stat=84e0 cmdptr=1f73d000 [ 77.387239] phase=4 msgphase=0 conn_tgt=0 data_ptr=24576 [ 77.453665] dma_st=1 dma_ct=0 n_msgout=0 [ 77.515900] target 0: req=(ptrval) goes_out=0 saved_ptr=0 [ 77.582902] mesh_host_reset [ 88.187083] Kernel panic - not syncing: mesh: double DMA start ! [ 88.254510] CPU: 0 PID: 358 Comm: scsi_eh_0 Not tainted 5.6.13-pmac #1 [ 88.323302] Call Trace: [ 88.378854] [e16ddc58] [c0027080] panic+0x13c/0x308 (unreliable) [ 88.446221] [e16ddcb8] [c02b2478] mesh_start.part.12+0x130/0x414 [ 88.513298] [e16ddcf8] [c02b2fc8] mesh_queue+0x54/0x70 [ 88.577097] [e16ddd18] [c02a1848] scsi_send_eh_cmnd+0x374/0x384 [ 88.643476] [e16dddc8] [c02a1938] scsi_eh_tur+0x5c/0xb8 [ 88.707878] [e16dddf8] [c02a1ab8] scsi_eh_test_devices+0x124/0x178 [ 88.775663] [e16dde28] [c02a2094] scsi_eh_ready_devs+0x588/0x8a8 [ 88.843124] [e16dde98] [c02a31d8] scsi_error_handler+0x344/0x520 [ 88.910697] [e16ddf08] [c00409c8] kthread+0xe4/0xe8 [ 88.975166] [e16ddf38] [c000f234] ret_from_kernel_thread+0x14/0x1c [ 89.044112] Rebooting in 180 seconds..
In theory, a panic can happen after a bus or host reset with dma_started flag set. Fix this by halting the DMA before reinitializing the host. Don't assume that ms->current_req is set when halt_dma() is invoked as it may not hold for bus or host reset.
BTW, this particular Conner drive can be made to work by inhibiting disconnect/reselect with 'mesh.resel_targets=0'.
--- drivers/scsi/mesh.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/scsi/mesh.c +7 -1
@@ -1045,6 +1045,8 @@ static void handle_error(struct mesh_state *ms)while ((in_8 (&mr->bus_status1) &BS1_RST ) !=0 )udelay (1 );printk ("done\n" ); +if (ms->dma_started) +halt_dma (ms);handle_reset (ms);/* request_q is empty, no point in mesh_start() */ return ;
@@ -1357,7 +1359,8 @@ static void halt_dma(struct mesh_state *ms) ms->conn_tgt, ms->data_ptr,scsi_bufflen (cmd), ms->tgts[ms->conn_tgt].data_goes_out); } -scsi_dma_unmap (cmd); +if (cmd) +scsi_dma_unmap (cmd); ms->dma_started =0 ; }
@@ -1712,6 +1715,9 @@ static int mesh_host_reset(struct scsi_cmnd *cmd)spin_lock_irqsave (ms->host->host_lock, flags); +if (ms->dma_started) +halt_dma (ms); +/* Reset the controller & dbdma channel */ out_le32 (&md->control, (RUN |PAUSE |FLUSH |WAKE ) <<16 );/* stop dma */ out_8 (&mr->exception,0xff );/* clear all exception bits */
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 292/464 bpf: Fix pos computation for bpf_iter seq_ops->start()
In reply to Greg Kroah-HartmanFrom: Yonghong Song <[email protected]>
[ Upstream commit 3f9969f2c040ba2ba635b6b5a7051f404bcc634d ]
Currently, the pos pointer in bpf iterator map/task/task_file seq_ops->start() is always incremented.
This is incorrect. It should be increased only if *pos is 0 (for SEQ_START_TOKEN) since these start() function actually returns the first real object.
If *pos is not 0, it merely found the object
based on the state in seq->private, and not really advancing the *pos. This patch fixed this issue
by only incrementing *pos if it is 0.
Note that the old *pos calculation, although not correct, does not affect correctness of bpf_iter as bpf_iter seq_file->read() does not support llseek.
This patch also renamed "mid" in bpf_map iterator seq_file private data to "map_id" for better clarity.
--- kernel/bpf/map_iter.c | 16 ++++++---------- kernel/bpf/task_iter.c | 6 ++++-- 2 files changed, 10 insertions(+), 12 deletions(-)
kernel/bpf/map_iter.c +6 -10
@@ -6,7 +6,7 @@#include <linux/kernel.h> struct bpf_iter_seq_map_info { -u32 mid; +u32 map_id; };static void *bpf_map_seq_start (struct seq_file *seq,loff_t *pos)
@@ -14,27 +14,23 @@ static void *bpf_map_seq_start(struct seq_file *seq, loff_t *pos)struct bpf_iter_seq_map_info *info = seq->private;struct bpf_map *map; - map =bpf_map_get_curr_or_next (&info->mid); + map =bpf_map_get_curr_or_next (&info->map_id);if (!map)return NULL ; - ++*pos; +if (*pos ==0 ) + ++*pos;return map; }static void *bpf_map_seq_next (struct seq_file *seq,void *v,loff_t *pos) {struct bpf_iter_seq_map_info *info = seq->private; -struct bpf_map *map; ++*pos; - ++info->mid; + ++info->map_id;bpf_map_put ((struct bpf_map *)v); - map =bpf_map_get_curr_or_next (&info->mid); -if (!map) -return NULL ; - -return map; +return bpf_map_get_curr_or_next (&info->map_id); }struct bpf_iter__bpf_map {
kernel/bpf/task_iter.c +4 -2
@@ -50,7 +50,8 @@ static void *task_seq_start(struct seq_file *seq, loff_t *pos)if (!task)return NULL ; - ++*pos; +if (*pos ==0 ) + ++*pos;return task; }
@@ -209,7 +210,8 @@ static void *task_file_seq_start(struct seq_file *seq, loff_t *pos)return NULL ; } - ++*pos; +if (*pos ==0 ) + ++*pos; info->task = task; info->files = files;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 283/464 MIPS: OCTEON: add missing put_device() call in dwc3_octeon_device_init()
In reply to Greg Kroah-HartmanFrom: Yu Kuai <[email protected]>
[ Upstream commit e8b9fc10f2615b9a525fce56981e40b489528355 ]
if of_find_device_by_node() succeed, dwc3_octeon_device_init() doesn't have a corresponding put_device(). Thus add put_device() to fix the exception handling for this function implementation.
--- arch/mips/cavium-octeon/octeon-usb.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
arch/mips/cavium-octeon/octeon-usb.c +4 -1
@@ -518,6 +518,7 @@ static int __init dwc3_octeon_device_init(void) res =platform_get_resource (pdev,IORESOURCE_MEM ,0 );if (res ==NULL ) { +put_device (&pdev->dev);dev_err (&pdev->dev,"No memory resources\n" );return -ENXIO ; }
@@ -529,8 +530,10 @@ static int __init dwc3_octeon_device_init(void)* know the difference. */ base =devm_ioremap_resource (&pdev->dev, res); -if (IS_ERR (base)) +if (IS_ERR (base)) { +put_device (&pdev->dev);return PTR_ERR (base); + }mutex_lock (&dwc3_octeon_clocks_mutex);dwc3_octeon_clocks_start (&pdev->dev, (u64 )base);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 247/464 PCI/ASPM: Add missing newline in sysfs policy
In reply to Greg Kroah-HartmanFrom: Xiongfeng Wang <[email protected]>
[ Upstream commit 3167e3d340c092fd47924bc4d23117a3074ef9a9 ]
When I cat ASPM parameter 'policy' by sysfs, it displays as follows. Add a newline for easy reading. Other sysfs attributes already include a newline.
[root@localhost ~]# cat /sys/module/pcie_aspm/parameters/policy [default] performance powersave powersupersave [root@localhost ~]#
--- drivers/pci/pcie/aspm.c | 1 + 1 file changed, 1 insertion(+)
drivers/pci/pcie/aspm.c +1 -0
@@ -1182,6 +1182,7 @@ static int pcie_aspm_get_policy(char *buffer, const struct kernel_param *kp) cnt +=sprintf (buffer + cnt,"[%s] " , policy_str[i]); else cnt += sprintf(buffer + cnt, "%s ", policy_str[i]); + cnt +=sprintf (buffer + cnt,"\n" );return cnt; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 317/464 powerpc/boot: Fix CONFIG_PPC_MPC52XX references
In reply to Greg Kroah-HartmanFrom: Michael Ellerman <[email protected]>
[ Upstream commit e5eff89657e72a9050d95fde146b54c7dc165981 ]
Commit 866bfc75f40e ("powerpc: conditionally compile platform-specific serial drivers") made some code depend on CONFIG_PPC_MPC52XX, which doesn't exist.
Fix it to use CONFIG_PPC_MPC52xx.
--- arch/powerpc/boot/Makefile | 2 +- arch/powerpc/boot/serial.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/boot/Makefile +1 -1
@@ -117,7 +117,7 @@ src-wlib-y := string.S crt0.S stdio.c decompress.c main.c \ elf_util.c $(zlib-y) devtree.c stdlib.c \ oflib.c ofconsole.c cuboot.c -src-wlib-$(CONFIG_PPC_MPC52XX) += mpc52xx-psc.c +src-wlib-$(CONFIG_PPC_MPC52xx) += mpc52xx-psc.c src-wlib-$(CONFIG_PPC64_BOOT_WRAPPER) += opal-calls.S opal.c ifndef CONFIG_PPC64_BOOT_WRAPPER src-wlib-y += crtsavres.S
arch/powerpc/boot/serial.c +1 -1
@@ -128,7 +128,7 @@ int serial_console_init(void) dt_is_compatible(devp, "fsl,cpm2-smc-uart")) rc =cpm_console_init (devp, &serial_cd);#endif -#ifdef CONFIG_PPC_MPC52XX +#ifdef CONFIG_PPC_MPC52xx else if (dt_is_compatible(devp, "fsl,mpc5200-psc-uart")) rc =mpc5200_psc_console_init (devp, &serial_cd);#endif
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 326/464 selftests/powerpc: Fix online CPU selection
In reply to Greg Kroah-HartmanFrom: Sandipan Das <[email protected]>
[ Upstream commit dfa03fff86027e58c8dba5c03ae68150d4e513ad ]
The size of the CPU affinity mask must be large enough for systems with a very large number of CPUs. Otherwise, tests which try to determine the first online CPU by calling sched_getaffinity() will fail. This makes sure that the size of the allocated affinity mask is dependent on the number of CPUs as reported by get_nprocs_conf().
--- tools/testing/selftests/powerpc/utils.c | 37 +++++++++++++++++-------- 1 file changed, 25 insertions(+), 12 deletions(-)
tools/testing/selftests/powerpc/utils.c +25 -12
@@ -16,6 +16,7 @@#include <string.h> #include <sys/ioctl.h> #include <sys/stat.h> +#include <sys/sysinfo.h> #include <sys/types.h> #include <sys/utsname.h> #include <unistd.h>
@@ -88,28 +89,40 @@ void *get_auxv_entry(int type)int pick_online_cpu (void ) { -cpu_set_t mask; -int cpu; +int ncpus, cpu =-1 ; +cpu_set_t *mask; +size_t size; + + ncpus =get_nprocs_conf (); + size =CPU_ALLOC_SIZE (ncpus); + mask =CPU_ALLOC (ncpus); +if (!mask) { +perror ("malloc" ); +return -1 ; + } -CPU_ZERO (&mask); +CPU_ZERO_S (size, mask); -if (sched_getaffinity (0 ,sizeof (mask), &mask)) { +if (sched_getaffinity (0 , size, mask)) {perror ("sched_getaffinity" ); -return -1 ; + goto done; }/* We prefer a primary thread, but skip 0 */ -for (cpu =8 ; cpu <CPU_SETSIZE ; cpu +=8 ) -if (CPU_ISSET (cpu, &mask)) -return cpu; +for (cpu =8 ; cpu < ncpus; cpu +=8 ) +if (CPU_ISSET_S (cpu, size, mask)) + goto done;/* Search for anything, but in reverse */ -for (cpu =CPU_SETSIZE -1 ; cpu >=0 ; cpu--) -if (CPU_ISSET (cpu, &mask)) -return cpu; +for (cpu = ncpus -1 ; cpu >=0 ; cpu--) +if (CPU_ISSET_S (cpu, size, mask)) + goto done;printf ("No cpus in affinity mask?!\n" ); -return -1 ; + +done: +CPU_FREE (mask); +return cpu; }bool is_ppc64le (void )
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 327/464 RDMA/hns: Fix error during modify qp RTS2RTS
In reply to Greg Kroah-HartmanFrom: Lang Cheng <[email protected]>
[ Upstream commit 4327bd2c41412657ee2c8c0d8d3d1945268b4238 ]
One qp state migrations legal configuration was deleted mistakenly.
--- drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/infiniband/hw/hns/hns_roce_hw_v2.c +3 -1
@@ -4301,7 +4301,9 @@ static bool check_qp_state(enum ib_qp_state cur_state, [IB_QPS_RTR ] = { [IB_QPS_RESET ] = true, [IB_QPS_RTS ] = true, [IB_QPS_ERR] = true }, - [IB_QPS_RTS] = { [IB_QPS_RESET] = true, [IB_QPS_ERR] = true }, + [IB_QPS_RTS ] = { [IB_QPS_RESET ] = true, + [IB_QPS_RTS ] = true, + [IB_QPS_ERR] = true }, [IB_QPS_SQD] = {}, [IB_QPS_SQE] = {}, [IB_QPS_ERR ] = { [IB_QPS_RESET ] = true, [IB_QPS_ERR ] = true }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 329/464 ASoC: meson: axg-tdm-interface: fix link fmt setup
In reply to Greg Kroah-HartmanFrom: Jerome Brunet <[email protected]>
[ Upstream commit 6878ba91ce84f7a07887a0615af70f969508839f ]
The .set_fmt() callback of the axg tdm interface incorrectly test the content of SND_SOC_DAIFMT_MASTER_MASK as if it was a bitfield, which it is not.
Implement the test correctly.
--- sound/soc/meson/axg-tdm-interface.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-)
sound/soc/meson/axg-tdm-interface.c +17 -9
@@ -119,18 +119,25 @@ static int axg_tdm_iface_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) {struct axg_tdm_iface *iface =snd_soc_dai_get_drvdata (dai); -/* These modes are not supported */ -if (fmt & (SND_SOC_DAIFMT_CBS_CFM |SND_SOC_DAIFMT_CBM_CFS )) { +switch (fmt &SND_SOC_DAIFMT_MASTER_MASK ) { +case SND_SOC_DAIFMT_CBS_CFS : +if (!iface->mclk) { +dev_err (dai->dev,"cpu clock master: mclk missing\n" ); +return -ENODEV ; + } +break ; + +case SND_SOC_DAIFMT_CBM_CFM : +break ; + +case SND_SOC_DAIFMT_CBS_CFM : +case SND_SOC_DAIFMT_CBM_CFS :dev_err (dai->dev,"only CBS_CFS and CBM_CFM are supported\n" ); +/* Fall-through */ +default :return -EINVAL ; } -/* If the TDM interface is the clock master, it requires mclk */ -if (!iface->mclk && (fmt &SND_SOC_DAIFMT_CBS_CFS )) { -dev_err (dai->dev,"cpu clock master: mclk missing\n" ); -return -ENODEV ; - } - iface->fmt = fmt;return 0 ; }
@@ -319,7 +326,8 @@ static int axg_tdm_iface_hw_params(struct snd_pcm_substream *substream,if (ret)return ret; -if (iface->fmt &SND_SOC_DAIFMT_CBS_CFS ) { +if ((iface->fmt &SND_SOC_DAIFMT_MASTER_MASK ) == +SND_SOC_DAIFMT_CBS_CFS ) { ret =axg_tdm_iface_set_sclk (dai, params);if (ret)return ret;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 339/464 ASoC: fsl_sai: Fix value of FSL_SAI_CR1_RFW_MASK
In reply to Greg Kroah-HartmanFrom: Shengjiu Wang <[email protected]>
[ Upstream commit 5aef1ff2397d021f93d874b57dff032fdfac73de ]
The fifo_depth is 64 on i.MX8QM/i.MX8QXP, 128 on i.MX8MQ, 16 on i.MX7ULP.
Original FSL_SAI_CR1_RFW_MASK value 0x1F is not suitable for these platform, the FIFO watermark mask should be updated according to the fifo_depth.
--- sound/soc/fsl/fsl_sai.c | 5 +++-- sound/soc/fsl/fsl_sai.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-)
sound/soc/fsl/fsl_sai.c +3 -2
@@ -680,10 +680,11 @@ static int fsl_sai_dai_probe(struct snd_soc_dai *cpu_dai)regmap_write (sai->regmap,FSL_SAI_RCSR (ofs),0 );regmap_update_bits (sai->regmap,FSL_SAI_TCR1 (ofs), -FSL_SAI_CR1_RFW_MASK , +FSL_SAI_CR1_RFW_MASK (sai->soc_data->fifo_depth), sai->soc_data->fifo_depth -FSL_SAI_MAXBURST_TX );regmap_update_bits (sai->regmap,FSL_SAI_RCR1 (ofs), -FSL_SAI_CR1_RFW_MASK ,FSL_SAI_MAXBURST_RX -1 ); +FSL_SAI_CR1_RFW_MASK (sai->soc_data->fifo_depth), +FSL_SAI_MAXBURST_RX -1 );snd_soc_dai_init_dma_data (cpu_dai, &sai->dma_params_tx, &sai->dma_params_rx);
sound/soc/fsl/fsl_sai.h +1 -1
@@ -94,7 +94,7 @@#define FSL_SAI_CSR_FRDE BIT(0)/* SAI Transmit and Receive Configuration 1 Register */ -#define FSL_SAI_CR1_RFW_MASK 0x1f +#define FSL_SAI_CR1_RFW_MASK (x) ((x) - 1)/* SAI Transmit and Receive Configuration 2 Register */ #define FSL_SAI_CR2_SYNC BIT(30)
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 338/464 ASoC: meson: cards: deal dpcm flag change
In reply to Greg Kroah-HartmanFrom: Jerome Brunet <[email protected]>
[ Upstream commit da3f23fde9d7b4a7e0ca9a9a096cec3104df1b82 ]
Commit b73287f0b074 ("ASoC: soc-pcm: dpcm: fix playback/capture checks") changed the meaning of dpcm_playback/dpcm_capture and now requires the CPU DAI BE to aligned with those flags.
This broke all Amlogic cards with uni-directional backends (All gx and most axg cards).
While I'm still confused as to how this change is an improvement, those cards can't remain broken forever. Hopefully, next time an API change is done like that, all the users will be updated as part of the change, and not left to fend for themselves.
--- sound/soc/meson/axg-card.c | 18 ++++++++++-------- sound/soc/meson/gx-card.c | 18 +++++++++--------- sound/soc/meson/meson-card-utils.c | 4 ---- 3 files changed, 19 insertions(+), 21 deletions(-)
sound/soc/meson/axg-card.c +10 -8
@@ -327,20 +327,22 @@ static int axg_card_add_link(struct snd_soc_card *card, struct device_node *np,return ret;if (axg_card_cpu_is_playback_fe (dai_link->cpus->of_node)) - ret =meson_card_set_fe_link (card, dai_link, np, true); +return meson_card_set_fe_link (card, dai_link, np, true);else if (axg_card_cpu_is_capture_fe (dai_link->cpus->of_node)) - ret =meson_card_set_fe_link (card, dai_link, np, false); -else - ret =meson_card_set_be_link (card, dai_link, np); +return meson_card_set_fe_link (card, dai_link, np, false); + + ret =meson_card_set_be_link (card, dai_link, np);if (ret)return ret; -if (axg_card_cpu_is_tdm_iface (dai_link->cpus->of_node)) - ret =axg_card_parse_tdm (card, np, index); -else if (axg_card_cpu_is_codec (dai_link->cpus->of_node)) { +if (axg_card_cpu_is_codec (dai_link->cpus->of_node)) { dai_link->params = &codec_params; - dai_link->no_pcm =0 ;/* link is not a DPCM BE */ + }else { + dai_link->no_pcm =1 ; +snd_soc_dai_link_set_capabilities (dai_link); +if (axg_card_cpu_is_tdm_iface (dai_link->cpus->of_node)) + ret =axg_card_parse_tdm (card, np, index); }return ret;
sound/soc/meson/gx-card.c +9 -9
@@ -96,21 +96,21 @@ static int gx_card_add_link(struct snd_soc_card *card, struct device_node *np,return ret;if (gx_card_cpu_identify (dai_link->cpus,"FIFO" )) - ret =meson_card_set_fe_link (card, dai_link, np, true); -else - ret =meson_card_set_be_link (card, dai_link, np); +return meson_card_set_fe_link (card, dai_link, np, true); + ret =meson_card_set_be_link (card, dai_link, np);if (ret)return ret; -/* Check if the cpu is the i2s encoder and parse i2s data */ -if (gx_card_cpu_identify (dai_link->cpus,"I2S Encoder" )) - ret =gx_card_parse_i2s (card, np, index); -/* Or apply codec to codec params if necessary */ -else if (gx_card_cpu_identify (dai_link->cpus,"CODEC CTRL" )) { +if (gx_card_cpu_identify (dai_link->cpus,"CODEC CTRL" )) { dai_link->params = &codec_params; - dai_link->no_pcm =0 ;/* link is not a DPCM BE */ + }else { + dai_link->no_pcm =1 ; +snd_soc_dai_link_set_capabilities (dai_link); +/* Check if the cpu is the i2s encoder and parse i2s data */ +if (gx_card_cpu_identify (dai_link->cpus,"I2S Encoder" )) + ret =gx_card_parse_i2s (card, np, index); }return ret;
sound/soc/meson/meson-card-utils.c +0 -4
@@ -147,10 +147,6 @@ int meson_card_set_be_link(struct snd_soc_card *card,struct device_node *np;int ret, num_codecs; - link->no_pcm =1 ; - link->dpcm_playback =1 ; - link->dpcm_capture =1 ; - num_codecs =of_get_child_count (node);if (!num_codecs) { dev_err(card->dev, "be link %s has no codec\n",
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 343/464 ice: Graceful error handling in HW table calloc failure
In reply to Greg Kroah-HartmanFrom: Surabhi Boob <[email protected]>
[ Upstream commit bcc46cb8a077c6189b44f1555b8659837f748eb2 ]
In the ice_init_hw_tbls, if the devm_kcalloc for es->written fails, catch that error and bail out gracefully, instead of continuing with a NULL pointer.
--- drivers/net/ethernet/intel/ice/ice_flex_pipe.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/ice/ice_flex_pipe.c +3 -1
@@ -3152,10 +3152,12 @@ enum ice_status ice_init_hw_tbls(struct ice_hw *hw) es->ref_count =devm_kcalloc (ice_hw_to_dev (hw), es->count,sizeof (*es->ref_count),GFP_KERNEL ); +if (!es->ref_count) + goto err; es->written =devm_kcalloc (ice_hw_to_dev (hw), es->count,sizeof (*es->written),GFP_KERNEL ); -if (!es->ref_count) +if (!es->written) goto err; }return 0 ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 251/464 powerpc/mm/radix: Free PUD table when freeing pagetable
In reply to Greg Kroah-HartmanFrom: Bharata B Rao <[email protected]>
[ Upstream commit 9ce8853b4a735c8115f55ac0e9c2b27a4c8f80b5 ]
remove_pagetable() isn't freeing PUD table. This causes memory leak during memory unplug. Fix this.
--- arch/powerpc/mm/book3s64/radix_pgtable.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
arch/powerpc/mm/book3s64/radix_pgtable.c +16 -0
@@ -700,6 +700,21 @@ static void free_pmd_table(pmd_t *pmd_start, pud_t *pud)pud_clear (pud); } +static void free_pud_table (pud_t *pud_start,p4d_t *p4d) +{ +pud_t *pud; +int i; + +for (i =0 ; i <PTRS_PER_PUD ; i++) { + pud = pud_start + i; +if (!pud_none (*pud)) +return ; + } + +pud_free (&init_mm, pud_start); +p4d_clear (p4d); +} +struct change_mapping_params {pte_t *pte;unsigned long start;
@@ -874,6 +889,7 @@ static void __meminit remove_pagetable(unsigned long start, unsigned long end) pud_base = (pud_t *)p4d_page_vaddr (*p4d);remove_pud_table (pud_base, addr, next); +free_pud_table (pud_base, p4d); }spin_unlock (&init_mm.page_table_lock);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 321/464 RDMA/rtrs: remove WQ_MEM_RECLAIM for rtrs_wq
In reply to Greg Kroah-HartmanFrom: Jack Wang <[email protected]>
[ Upstream commit 03ed5a8cda659e3c71d106b0dd4ce6520e4dcd6e ]
lockdep triggers a warning from time to time when running a regression test:
rnbd_client L685: </dev/nullb0@bla> Device disconnected. rnbd_client L1756: Unloading module
workqueue: WQ_MEM_RECLAIM rtrs_client_wq:rtrs_clt_reconnect_work [rtrs_client] is flushing !WQ_MEM_RECLAIM ib_addr:process_one_req [ib_core]
WARNING: CPU: 2 PID: 18824 at kernel/workqueue.c:2517 check_flush_dependency+0xad/0x130
The root cause is workqueue core expect flushing should not be done for a !WQ_MEM_RECLAIM wq from a WQ_MEM_RECLAIM workqueue.
In above case ib_addr workqueue without WQ_MEM_RECLAIM, but rtrs_wq WQ_MEM_RECLAIM.
To avoid the warning, remove the WQ_MEM_RECLAIM flag.
--- drivers/infiniband/ulp/rtrs/rtrs-clt.c | 2 +- drivers/infiniband/ulp/rtrs/rtrs-srv.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/infiniband/ulp/rtrs/rtrs-clt.c +1 -1
@@ -2982,7 +2982,7 @@ static int __init rtrs_client_init(void)pr_err ("Failed to create rtrs-client dev class\n" );return PTR_ERR (rtrs_clt_dev_class); } - rtrs_wq =alloc_workqueue ("rtrs_client_wq" ,WQ_MEM_RECLAIM ,0 ); + rtrs_wq =alloc_workqueue ("rtrs_client_wq" ,0 ,0 );if (!rtrs_wq) {class_destroy (rtrs_clt_dev_class);return -ENOMEM ;
drivers/infiniband/ulp/rtrs/rtrs-srv.c +1 -1
@@ -2150,7 +2150,7 @@ static int __init rtrs_server_init(void) err =PTR_ERR (rtrs_dev_class); goto out_chunk_pool; } - rtrs_wq =alloc_workqueue ("rtrs_server_wq" ,WQ_MEM_RECLAIM ,0 ); + rtrs_wq =alloc_workqueue ("rtrs_server_wq" ,0 ,0 );if (!rtrs_wq) { err = -ENOMEM ; goto out_dev_class;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 349/464 wl1251: fix always return 0 error
In reply to Greg Kroah-HartmanFrom: Wang Hai <[email protected]>
[ Upstream commit 20e6421344b5bc2f97b8e2db47b6994368417904 ]
wl1251_event_ps_report() should not always return 0 because wl1251_ps_set_mode() may fail. Change it to return 'ret'.
--- drivers/net/wireless/ti/wl1251/event.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ti/wl1251/event.c +1 -1
@@ -70,7 +70,7 @@ static int wl1251_event_ps_report(struct wl1251 *wl,break ; } -return 0 ; +return ret; }static void wl1251_event_mbox_dump (struct event_mailbox *mbox)
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 362/464 fsl/fman: fix unreachable code
In reply to Greg Kroah-HartmanFrom: Florinel Iordache <[email protected]>
[ Upstream commit cc79fd8f557767de90ff199d3b6fb911df43160a ]
The parameter 'priority' is incorrectly forced to zero which ultimately induces logically dead code in the subsequent lines.
--- drivers/net/ethernet/freescale/fman/fman_memac.c | 1 - 1 file changed, 1 deletion(-)
drivers/net/ethernet/freescale/fman/fman_memac.c +0 -1
@@ -852,7 +852,6 @@ int memac_set_tx_pause_frames(struct fman_mac *memac, u8 priority, tmp =ioread32be (®s->command_config); tmp &= ~CMD_CFG_PFC_MODE ; - priority =0 ;iowrite32be (tmp, ®s->command_config);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 351/464 tools, bpftool: Fix wrong return value in do_dump()
In reply to Greg Kroah-HartmanFrom: Tianjia Zhang <[email protected]>
[ Upstream commit 041549b7b2c7811ec40e705c439211f00ade2dda ]
In case of btf_id does not exist, a negative error code -ENOENT should be returned.
--- tools/bpf/bpftool/btf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/bpf/bpftool/btf.c +1 -1
@@ -596,7 +596,7 @@ static int do_dump(int argc, char **argv) goto done; }if (!btf) { - err =ENOENT ; + err = -ENOENT ;p_err ("can't find btf with ID (%u)" , btf_id); goto done; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 368/464 dpaa2-eth: Fix passing zero to PTR_ERR warning
In reply to Greg Kroah-HartmanFrom: YueHaibing <[email protected]>
[ Upstream commit 02afa9c66bb954c6959877c70d9e128dcf0adce7 ]
Fix smatch warning:
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c:2419
alloc_channel() warn: passing zero to 'ERR_PTR'
setup_dpcon() should return ERR_PTR(err) instead of zero in error handling case.
--- drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c +3 -3
@@ -2207,7 +2207,7 @@ static struct fsl_mc_device *setup_dpcon(struct dpaa2_eth_priv *priv) free:fsl_mc_object_free (dpcon); -return NULL ; +return ERR_PTR (err); } static void free_dpcon(struct dpaa2_eth_priv *priv,
@@ -2231,8 +2231,8 @@ alloc_channel(struct dpaa2_eth_priv *priv)return NULL ; channel->dpcon =setup_dpcon (priv); -if (IS_ERR_OR_NULL (channel->dpcon)) { - err =PTR_ERR_OR_ZERO (channel->dpcon); +if (IS_ERR (channel->dpcon)) { + err =PTR_ERR (channel->dpcon); goto err_setup; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 374/464 dlm: Fix kobject memleak
In reply to Greg Kroah-HartmanFrom: Wang Hai <[email protected]>
[ Upstream commit 0ffddafc3a3970ef7013696e7f36b3d378bc4c16 ]
Currently the error return path from kobject_init_and_add() is not followed by a call to kobject_put() - which means we are leaking the kobject.
Set do_unreg = 1 before kobject_init_and_add() to ensure that kobject_put() can be called in its error patch.
--- fs/dlm/lockspace.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
fs/dlm/lockspace.c +3 -3
@@ -622,6 +622,9 @@ static int new_lockspace(const char *name, const char *cluster,wait_event (ls->ls_recover_lock_wait,test_bit (LSFL_RECOVER_LOCK , &ls->ls_flags)); +/* let kobject handle freeing of ls if there's an error */ + do_unreg =1 ; + ls->ls_kobj.kset = dlm_kset; error =kobject_init_and_add (&ls->ls_kobj, &dlm_ktype,NULL ,"%s" , ls->ls_name);
@@ -629,9 +632,6 @@ static int new_lockspace(const char *name, const char *cluster, goto out_recoverd;kobject_uevent (&ls->ls_kobj,KOBJ_ADD ); -/* let kobject handle freeing of ls if there's an error */ - do_unreg =1 ; -/* This uevent triggers dlm_controld in userspace to add us to the group of nodes that are members of this lockspace (managed by the cluster infrastructure.) Once it's done that, it tells us who the
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 373/464 media: mtk-mdp: Fix a refcounting bug on error in init
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit dd4eddc4ba31fbf4554fc5fa12d3a553b50e1469 ]
We need to call of_node_put(comp->dev_node); on the error paths in this function.
--- drivers/media/platform/mtk-mdp/mtk_mdp_comp.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
drivers/media/platform/mtk-mdp/mtk_mdp_comp.c +12 -4
@@ -96,6 +96,7 @@ int mtk_mdp_comp_init(struct device *dev, struct device_node *node, {struct device_node *larb_node;struct platform_device *larb_pdev; +int ret;int i;if (comp_id <0 || comp_id >=MTK_MDP_COMP_ID_MAX ) {
@@ -113,8 +114,8 @@ int mtk_mdp_comp_init(struct device *dev, struct device_node *node,if (IS_ERR (comp->clk[i])) {if (PTR_ERR (comp->clk[i]) != -EPROBE_DEFER )dev_err (dev,"Failed to get clock\n" ); - -return PTR_ERR (comp->clk[i]); + ret =PTR_ERR (comp->clk[i]); + goto put_dev; }/* Only RDMA needs two clocks */
@@ -133,20 +134,27 @@ int mtk_mdp_comp_init(struct device *dev, struct device_node *node,if (!larb_node) {dev_err (dev,"Missing mediadek,larb phandle in %pOF node\n" , node); -return -EINVAL ; + ret = -EINVAL ; + goto put_dev; } larb_pdev =of_find_device_by_node (larb_node);if (!larb_pdev) {dev_warn (dev,"Waiting for larb device %pOF\n" , larb_node);of_node_put (larb_node); -return -EPROBE_DEFER ; + ret = -EPROBE_DEFER ; + goto put_dev; }of_node_put (larb_node); comp->larb_dev = &larb_pdev->dev;return 0 ; + +put_dev: +of_node_put (comp->dev_node); + +return ret; }void mtk_mdp_comp_deinit (struct device *dev,struct mtk_mdp_comp *comp)
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 265/464 coresight: etm4x: Fix save/restore during cpu idle
In reply to Greg Kroah-HartmanFrom: Suzuki K Poulose <[email protected]>
[ Upstream commit 342c8a1d1d9e418d32fa02d635cf96989f9a986e ]
The ETM state save/restore incorrectly reads/writes some of the 64bit registers (e.g, address comparators, vmid/cid comparators etc.) using 32bit accesses. Ensure we use the appropriate width accessors for the registers.
--- drivers/hwtracing/coresight/coresight-etm4x.c | 16 ++++++++-------- drivers/hwtracing/coresight/coresight-etm4x.h | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-)
drivers/hwtracing/coresight/coresight-etm4x.c +8 -8
@@ -1202,8 +1202,8 @@ static int etm4_cpu_save(struct etmv4_drvdata *drvdata) }for (i =0 ; i < drvdata->nr_addr_cmp *2 ; i++) { - state->trcacvr[i] =readl (drvdata->base +TRCACVRn (i)); - state->trcacatr[i] =readl (drvdata->base +TRCACATRn (i)); + state->trcacvr[i] =readq (drvdata->base +TRCACVRn (i)); + state->trcacatr[i] =readq (drvdata->base +TRCACATRn (i)); }/*
@@ -1214,10 +1214,10 @@ static int etm4_cpu_save(struct etmv4_drvdata *drvdata)*/ for (i =0 ; i < drvdata->numcidc; i++) - state->trccidcvr[i] =readl (drvdata->base +TRCCIDCVRn (i)); + state->trccidcvr[i] =readq (drvdata->base +TRCCIDCVRn (i));for (i =0 ; i < drvdata->numvmidc; i++) - state->trcvmidcvr[i] =readl (drvdata->base +TRCVMIDCVRn (i)); + state->trcvmidcvr[i] =readq (drvdata->base +TRCVMIDCVRn (i)); state->trccidcctlr0 =readl (drvdata->base +TRCCIDCCTLR0 ); state->trccidcctlr1 =readl (drvdata->base +TRCCIDCCTLR1 );
@@ -1315,18 +1315,18 @@ static void etm4_cpu_restore(struct etmv4_drvdata *drvdata) }for (i =0 ; i < drvdata->nr_addr_cmp *2 ; i++) { -writel_relaxed (state->trcacvr[i], +writeq_relaxed (state->trcacvr[i], drvdata->base +TRCACVRn (i)); -writel_relaxed (state->trcacatr[i], +writeq_relaxed (state->trcacatr[i], drvdata->base +TRCACATRn (i)); }for (i =0 ; i < drvdata->numcidc; i++) -writel_relaxed (state->trccidcvr[i], +writeq_relaxed (state->trccidcvr[i], drvdata->base +TRCCIDCVRn (i));for (i =0 ; i < drvdata->numvmidc; i++) -writel_relaxed (state->trcvmidcvr[i], +writeq_relaxed (state->trcvmidcvr[i], drvdata->base +TRCVMIDCVRn (i));writel_relaxed (state->trccidcctlr0, drvdata->base +TRCCIDCCTLR0 );
drivers/hwtracing/coresight/coresight-etm4x.h +1 -1
@@ -334,7 +334,7 @@ struct etmv4_save_state {u64 trcacvr[ETM_MAX_SINGLE_ADDR_CMP ];u64 trcacatr[ETM_MAX_SINGLE_ADDR_CMP ];u64 trccidcvr[ETMv4_MAX_CTXID_CMP]; -u32 trcvmidcvr[ETM_MAX_VMID_CMP ]; +u64 trcvmidcvr[ETM_MAX_VMID_CMP ];u32 trccidcctlr0;u32 trccidcctlr1;u32 trcvmidcctlr0;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 267/464 mt76: mt7663u: fix memory leak in set key
In reply to Greg Kroah-HartmanFrom: Sean Wang <[email protected]>
[ Upstream commit 4a850f8dc68b8c4a20333521b31600c9d31ccb5d ]
Fix memory leak in set key.
--- .../net/wireless/mediatek/mt76/mt7615/usb.c | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7615/usb.c +14 -7
@@ -166,12 +166,16 @@ __mt7663u_mac_set_key(struct mt7615_dev *dev,lockdep_assert_held (&dev->mt76.mutex); -if (!sta) -return -EINVAL ; +if (!sta) { + err = -EINVAL ; + goto out; + } cipher =mt7615_mac_get_cipher (key->cipher); -if (cipher ==MT_CIPHER_NONE ) -return -EOPNOTSUPP ; +if (cipher ==MT_CIPHER_NONE ) { + err = -EOPNOTSUPP ; + goto out; + } wcid = &wd->sta->wcid;
@@ -179,19 +183,22 @@ __mt7663u_mac_set_key(struct mt7615_dev *dev, err =mt7615_mac_wtbl_update_key (dev, wcid, key->key, key->keylen, cipher, key->cmd);if (err <0 ) -return err; + goto out; err =mt7615_mac_wtbl_update_pk (dev, wcid, cipher, key->keyidx, key->cmd);if (err <0 ) -return err; + goto out;if (key->cmd ==SET_KEY ) wcid->cipher |=BIT (cipher);else wcid->cipher &= ~BIT (cipher); -return 0 ; +out: +kfree (key->key); + +return err; }void mt7663u_wtbl_work (struct work_struct *work)
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 354/464 ftrace: Fix ftrace_trace_task return value
In reply to Greg Kroah-HartmanFrom: Josef Bacik <[email protected]>
[ Upstream commit c58b6b0372de0d4cd0536d6585addd1b36b151ae ]
I was attempting to use pid filtering with function_graph, but it wasn't allowing anything to make it through. Turns out ftrace_trace_task returns false if ftrace_ignore_pid is not-empty, which isn't correct anymore. We're now setting it to FTRACE_PID_IGNORE if we need to ignore that pid, otherwise it's set to the pid (which is weird considering the name) or to FTRACE_PID_TRACE. Fix the check to check for != FTRACE_PID_IGNORE. With this we can now use function_graph with pid filtering.
--- kernel/trace/ftrace.c | 3 --- kernel/trace/trace.h | 7 ++++++- 2 files changed, 6 insertions(+), 4 deletions(-)
kernel/trace/ftrace.c +0 -3
@@ -139,9 +139,6 @@ static inline void ftrace_ops_init(struct ftrace_ops *ops)#endif } -#define FTRACE_PID_IGNORE -1 -#define FTRACE_PID_TRACE -2 -static void ftrace_pid_func (unsigned long ip,unsigned long parent_ip,struct ftrace_ops *op,struct pt_regs *regs) {
kernel/trace/trace.h +6 -1
@@ -1103,6 +1103,10 @@ print_graph_function_flags(struct trace_iterator *iter, u32 flags)extern struct list_head ftrace_pids; #ifdef CONFIG_FUNCTION_TRACER + +#define FTRACE_PID_IGNORE -1 +#define FTRACE_PID_TRACE -2 + struct ftrace_func_command { struct list_head list; char *name;
@@ -1114,7 +1118,8 @@ struct ftrace_func_command {extern bool ftrace_filter_param__initdata ;static inline int ftrace_trace_task (struct trace_array *tr) { -return !this_cpu_read (tr->array_buffer.data->ftrace_ignore_pid); +return this_cpu_read (tr->array_buffer.data->ftrace_ignore_pid) != +FTRACE_PID_IGNORE ; }extern int ftrace_is_dead (void ); int ftrace_create_function_files(struct trace_array *tr,
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 270/464 mt76: mt7915: potential array overflow in mt7915_mcu_tx_rate_report()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit eb744e5df86cf7e377d0acc4e686101b0fd9663a ]
Smatch complains that "wcidx" value comes from the network and thus cannot be trusted. In this case, it actually seems to come from the firmware. If your wireless firmware is malicious then probably no amount of carefulness can protect you.
On the other hand, these days we still try to check the firmware as much as possible. Verifying that the index is within bounds will silence a static checker warning. And it's harmless and a good exercise in kernel hardening. So I suggest that we do add a bounds check.
--- .../net/wireless/mediatek/mt76/mt7915/mcu.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c +13 -6
@@ -505,15 +505,22 @@ static void mt7915_mcu_tx_rate_report(struct mt7915_dev *dev, struct sk_buff *skb) { struct mt7915_mcu_ra_info *ra = (struct mt7915_mcu_ra_info *)skb->data; -u16 wcidx =le16_to_cpu (ra->wlan_idx); -struct mt76_wcid *wcid =rcu_dereference (dev->mt76.wcid[wcidx]); - struct mt7915_sta *msta = container_of(wcid, struct mt7915_sta, wcid); -struct mt7915_sta_stats *stats = &msta->stats; -struct mt76_phy *mphy = &dev->mphy;struct rate_info rate = {}, prob_rate = {}; +u16 probe =le16_to_cpu (ra->prob_up_rate);u16 attempts =le16_to_cpu (ra->attempts);u16 curr =le16_to_cpu (ra->curr_rate); -u16 probe =le16_to_cpu (ra->prob_up_rate); +u16 wcidx =le16_to_cpu (ra->wlan_idx); +struct mt76_phy *mphy = &dev->mphy; +struct mt7915_sta_stats *stats; +struct mt7915_sta *msta; +struct mt76_wcid *wcid; + +if (wcidx >=MT76_N_WCIDS ) +return ; + + wcid =rcu_dereference (dev->mt76.wcid[wcidx]); + msta = container_of(wcid, struct mt7915_sta, wcid); + stats = &msta->stats;if (msta->wcid.ext_phy && dev->mt76.phy2) mphy = dev->mt76.phy2;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 272/464 mt76: mt7615: fix possible memory leak in mt7615_mcu_wtbl_sta_add
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit 2bccc8415883c1cd5ae8836548d9783dbbd84999 ]
Free the second mcu skb if __mt76_mcu_skb_send_msg() fails to transmit the first one in mt7615_mcu_wtbl_sta_add().
--- drivers/net/wireless/mediatek/mt76/mt7615/mcu.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7615/mcu.c +5 -1
@@ -1209,8 +1209,12 @@ mt7615_mcu_wtbl_sta_add(struct mt7615_dev *dev, struct ieee80211_vif *vif, skb = enable ? wskb : sskb; err =__mt76_mcu_skb_send_msg (&dev->mt76, skb, cmd, true); -if (err <0 ) +if (err <0 ) { + skb = enable ? sskb : wskb; +dev_kfree_skb (skb); +return err; + } cmd = enable ?MCU_EXT_CMD_STA_REC_UPDATE :MCU_EXT_CMD_WTBL_UPDATE ; skb = enable ? sskb : wskb;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 395/464 net: phy: marvell10g: fix null pointer dereference
In reply to Greg Kroah-HartmanFrom: "Marek Behún" <[email protected]>
[ Upstream commit 1b8ef1423dbfd34de2439a2db457b84480b7c8a8 ]
Commit c3e302edca24 ("net: phy: marvell10g: fix temperature sensor on 2110") added a check for PHY ID via phydev->drv->phy_id in a function which is called by devres at a time when phydev->drv is already set to null by phy_remove function.
This null pointer dereference can be triggered via SFP subsystem with a SFP module containing this Marvell PHY. When the SFP interface is put down, the SFP subsystem removes the PHY.
--- drivers/net/phy/marvell10g.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-)
drivers/net/phy/marvell10g.c +7 -11
@@ -205,13 +205,6 @@ static int mv3310_hwmon_config(struct ph MV_V2_TEMP_CTRL_MASK, val); } -static void mv3310_hwmon_disable (void *data) -{ -struct phy_device *phydev = data; - -mv3310_hwmon_config (phydev, false); -} -static int mv3310_hwmon_probe (struct phy_device *phydev) {struct device *dev = &phydev->mdio.dev;
@@ -235,10 +228,6 @@ static int mv3310_hwmon_probe(struct phyif (ret)return ret; - ret =devm_add_action_or_reset (dev, mv3310_hwmon_disable, phydev); -if (ret) -return ret; - priv->hwmon_dev =devm_hwmon_device_register_with_info (dev, priv->hwmon_name, phydev, &mv3310_hwmon_chip_info,NULL );
@@ -423,6 +412,11 @@ static int mv3310_probe(struct phy_devicreturn phy_sfp_probe (phydev, &mv3310_sfp_ops); } +static void mv3310_remove (struct phy_device *phydev) +{ +mv3310_hwmon_config (phydev, false); +} +static int mv3310_suspend (struct phy_device *phydev) {return mv3310_power_down (phydev);
@@ -762,6 +756,7 @@ static struct phy_driver mv3310_drivers[ .read_status = mv3310_read_status, .get_tunable = mv3310_get_tunable, .set_tunable = mv3310_set_tunable, + .remove = mv3310_remove, }, { .phy_id = MARVELL_PHY_ID_88E2110,
@@ -776,6 +771,7 @@ static struct phy_driver mv3310_drivers[ .read_status = mv3310_read_status, .get_tunable = mv3310_get_tunable, .set_tunable = mv3310_set_tunable, + .remove = mv3310_remove, }, };
Greg Kroah-Hartman
maintainerPATCH 404/464 ALSA: usb-audio: Creative USB X-Fi Pro SB1095 volume knob support
In reply to Greg Kroah-HartmanFrom: Mirko Dietrich <[email protected]>
commit fec9008828cde0076aae595ac031bfcf49d335a4 upstream.
Adds an entry for Creative USB X-Fi to the rc_config array in mixer_quirks.c to allow use of volume knob on the device. Adds support for newer X-Fi Pro card, known as "Model No. SB1095" with USB ID "041e:3263"
--- sound/usb/mixer_quirks.c | 1 + 1 file changed, 1 insertion(+)
sound/usb/mixer_quirks.c +1 -0
@@ -185,6 +185,7 @@ static const struct rc_config { { USB_ID(0x041e, 0x3042), 0, 1, 1, 1, 1, 0x000d }, /* Usb X-Fi S51 */ { USB_ID(0x041e, 0x30df), 0, 1, 1, 1, 1, 0x000d }, /* Usb X-Fi S51 Pro */ { USB_ID(0x041e, 0x3237), 0, 1, 1, 1, 1, 0x000d }, /* Usb X-Fi S51 Pro */ + { USB_ID(0x041e, 0x3263), 0, 1, 1, 1, 1, 0x000d }, /* Usb X-Fi S51 Pro */ { USB_ID(0x041e, 0x3048), 2, 2, 6, 6, 2, 0x6e91 }, /* Toshiba SB0500 */ };
Greg Kroah-Hartman
maintainerPATCH 403/464 ALSA: hda - reverse the setting value in the micmute_led_set
In reply to Greg Kroah-HartmanFrom: Hui Wang <[email protected]>
commit 404690649e6a52ee39817168f2d984726412e091 upstream.
Before the micmute_led_set() is introduced, the function of alc_gpio_micmute_update() will set the gpio value with the !micmute_led.led_value, and the machines have the correct micmute led status. After the micmute_led_set() is introduced, it sets the gpio value with !!micmute_led.led_value, so the led status is not correct anymore, we need to set micmute_led_polarity = 1 to workaround it.
Now we fix the micmute_led_set() and remove micmute_led_polarity = 1.
--- sound/pci/hda/patch_realtek.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
sound/pci/hda/patch_realtek.c +1 -4
@@ -4118,7 +4118,7 @@ static int micmute_led_set(struct led_clstruct alc_spec *spec = codec->spec;alc_update_gpio_led (codec, spec->gpio_mic_led_mask, - spec->micmute_led_polarity, !!brightness); + spec->micmute_led_polarity, !brightness);return 0 ; }
@@ -4173,8 +4173,6 @@ static void alc285_fixup_hp_gpio_led(str {struct alc_spec *spec = codec->spec; - spec->micmute_led_polarity =1 ; -alc_fixup_hp_gpio_led (codec, action,0x04 ,0x01 ); }
@@ -4426,7 +4424,6 @@ static void alc233_fixup_lenovo_line2_mi {struct alc_spec *spec = codec->spec; - spec->micmute_led_polarity =1 ;alc_fixup_hp_gpio_led (codec, action,0 ,0x04 );if (action ==HDA_FIXUP_ACT_PRE_PROBE ) { spec->init_amp =ALC_INIT_DEFAULT ;
Greg Kroah-Hartman
maintainerPATCH 406/464 ALSA: usb-audio: work around streaming quirk for MacroSilicon MS2109
In reply to Greg Kroah-HartmanFrom: Hector Martin <[email protected]>
commit 1b7ecc241a67ad6b584e071bd791a54e0cd5f097 upstream.
Further investigation of the L-R swap problem on the MS2109 reveals that the problem isn't that the channels are swapped, but rather that they are swapped and also out of phase by one sample. In other words, the issue is actually that the very first frame that comes from the hardware is a half-frame containing only the right channel, and after that everything becomes offset.
So introduce a new quirk field to drop the very first 2 bytes that come in after the format is configured and a capture stream starts. This puts the channels in phase and in the correct order.
--- sound/usb/card.h | 1 + sound/usb/pcm.c | 6 ++++++ sound/usb/quirks.c | 3 +++ sound/usb/stream.c | 1 + 4 files changed, 11 insertions(+)
sound/usb/card.h +1 -0
@@ -137,6 +137,7 @@ struct snd_usb_substream { unsigned int tx_length_quirk:1; /* add length specifier to transfers */unsigned int fmt_type;/* USB audio format type (1-3) */ unsigned int pkt_offset_adj;/* Bytes to drop from beginning of packets (for non-compliant devices) */ +unsigned int stream_offset_adj;/* Bytes to drop from beginning of stream (for non-compliant devices) */ unsigned int running: 1; /* running status */
sound/usb/pcm.c +6 -0
@@ -1420,6 +1420,12 @@ static void retire_capture_urb(struct sn// continue; } bytes = urb->iso_frame_desc[i].actual_length; +if (subs->stream_offset_adj >0 ) { +unsigned int adj =min (subs->stream_offset_adj, bytes); + cp += adj; + bytes -= adj; + subs->stream_offset_adj -= adj; + } frames = bytes / stride;if (!subs->txfr_quirk) bytes = frames * stride;
sound/usb/quirks.c +3 -0
@@ -1495,6 +1495,9 @@ void snd_usb_set_format_quirk(struct sndcase USB_ID (0x2b73 ,0x000a ):/* Pioneer DJ DJM-900NXS2 */ pioneer_djm_set_format_quirk (subs);break ; +case USB_ID (0x534d ,0x2109 ):/* MacroSilicon MS2109 */ + subs->stream_offset_adj =2 ; +break ; } }
sound/usb/stream.c +1 -0
@@ -94,6 +94,7 @@ static void snd_usb_init_substream(struc subs->tx_length_quirk = as->chip->tx_length_quirk; subs->speed =snd_usb_get_speed (subs->dev); subs->pkt_offset_adj =0 ; + subs->stream_offset_adj =0 ;snd_usb_set_pcm_ops (as->pcm, stream);
Greg Kroah-Hartman
maintainerPATCH 405/464 ALSA: usb-audio: fix overeager device match for MacroSilicon MS2109
In reply to Greg Kroah-HartmanFrom: Hector Martin <[email protected]>
commit 14a720dc1f5332f3bdf30a23a3bc549e81be974c upstream.
Matching by device matches all interfaces, which breaks the video/HID portions of the device depending on module load order.
--- sound/usb/quirks-table.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
sound/usb/quirks-table.h +7 -1
@@ -3645,7 +3645,13 @@ ALC1220_VB_DESKTOP(0x26ce, 0x0a01), /* A* with. */ { - USB_DEVICE(0x534d, 0x2109), + .match_flags = USB_DEVICE_ID_MATCH_DEVICE | +USB_DEVICE_ID_MATCH_INT_CLASS | + USB_DEVICE_ID_MATCH_INT_SUBCLASS, + .idVendor = 0x534d, + .idProduct = 0x2109, + .bInterfaceClass = USB_CLASS_AUDIO, + .bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL, .driver_info = (unsigned long ) &(const struct snd_usb_audio_quirk ) { .vendor_name ="MacroSilicon" , .product_name ="MS2109" ,