5.10.150-rc1 review
Subsystems (10)
Greg Kroah-Hartman
maintainerPATCH 179/390 ia64: export memory_add_physaddr_to_nid to fix cxl build error
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit 97c318bfbe84efded246e80428054f300042f110 ]
cxl_pmem.ko uses memory_add_physaddr_to_nid() but ia64 does not export it, so this causes a build error:
ERROR: modpost: "memory_add_physaddr_to_nid" [drivers/cxl/cxl_pmem.ko] undefined!
Fix this by exporting that function.
--- arch/ia64/mm/numa.c | 1 + 1 file changed, 1 insertion(+)
arch/ia64/mm/numa.c +1 -0
@@ -106,5 +106,6 @@ int memory_add_physaddr_to_nid(u64 addr)return 0 ;return nid; } +EXPORT_SYMBOL (memory_add_physaddr_to_nid);#endif #endif
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 54/390 hardening: Avoid harmless Clang option under CONFIG_INIT_STACK_ALL_ZERO
In reply to Greg Kroah-HartmanFrom: Kees Cook <[email protected]>
commit f02003c860d921171be4a27e2893766eb3bc6871 upstream.
Currently under Clang, CC_HAS_AUTO_VAR_INIT_ZERO requires an extra -enable flag compared to CC_HAS_AUTO_VAR_INIT_PATTERN. GCC 12[1] will not, and will happily ignore the Clang-specific flag. However, its presence on the command-line is both cumbersome and confusing. Due to GCC's tolerant behavior, though, we can continue to use a single Kconfig cc-option test for the feature on both compilers, but then drop the Clang-specific option in the Makefile.
In other words, this patch does not change anything other than making the compiler command line shorter once GCC supports -ftrivial-auto-var-init=zero.
[1] https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=a25e0b5e6ac8a77a71c229e0a7b744603365b0e9
--- Makefile | 6 +++--- security/Kconfig.hardening | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-)
Makefile +3 -3
@@ -816,12 +816,12 @@ endif # Initialize all stack variables with a zero value. ifdef CONFIG_INIT_STACK_ALL_ZERO -# Future support for zero initialization is still being debated, see -# https://bugs.llvm.org/show_bug.cgi?id=45497. These flags are subject to being -# renamed or dropped. KBUILD_CFLAGS += -ftrivial-auto-var-init=zero +ifdef CONFIG_CC_IS_CLANG +# https://bugs.llvm.org/show_bug.cgi?id=45497 KBUILD_CFLAGS += -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang endif +endif DEBUG_CFLAGS :=
security/Kconfig.hardening +4 -1
@@ -23,13 +23,16 @@ config CC_HAS_AUTO_VAR_INIT_PATTERN def_bool $(cc-option,-ftrivial-auto-var-init=pattern) config CC_HAS_AUTO_VAR_INIT_ZERO + # GCC ignores the -enable flag, so we can test for the feature with + # a single invocation using the flag, but drop it as appropriate in + # the Makefile, depending on the presence of Clang. def_bool $(cc-option,-ftrivial-auto-var-init=zero -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang) choice prompt "Initialize kernel stack variables at function entry" default GCC_PLUGIN_STRUCTLEAK_BYREF_ALL if COMPILE_TEST && GCC_PLUGINS default INIT_STACK_ALL_PATTERN if COMPILE_TEST && CC_HAS_AUTO_VAR_INIT_PATTERN - default INIT_STACK_ALL_ZERO if CC_HAS_AUTO_VAR_INIT_PATTERN + default INIT_STACK_ALL_ZERO if CC_HAS_AUTO_VAR_INIT_ZERO default INIT_STACK_NONE help This option enables initialization of stack variables at
Greg Kroah-Hartman
maintainerPATCH 55/390 hardening: Remove Clangs enable flag for -ftrivial-auto-var-init=zero
In reply to Greg Kroah-HartmanFrom: Kees Cook <[email protected]>
commit 607e57c6c62c00965ae276902c166834ce73014a upstream.
Now that Clang's -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang option is no longer required, remove it from the command line. Clang 16
and later will warn when it is used, which will cause Kconfig to think
it can't use -ftrivial-auto-var-init=zero at all. Check for whether it
is required and only use it when so.
--- Makefile | 4 ++-- security/Kconfig.hardening | 14 ++++++++++---- 2 files changed, 12 insertions(+), 6 deletions(-)
Makefile +2 -2
@@ -817,8 +817,8 @@ endif # Initialize all stack variables with a zero value. ifdef CONFIG_INIT_STACK_ALL_ZERO KBUILD_CFLAGS += -ftrivial-auto-var-init=zero -ifdef CONFIG_CC_IS_CLANG -# https://bugs.llvm.org/show_bug.cgi?id=45497 +ifdef CONFIG_CC_HAS_AUTO_VAR_INIT_ZERO_ENABLER +# https://github.com/llvm/llvm-project/issues/44842 KBUILD_CFLAGS += -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang endif endif
security/Kconfig.hardening +10 -4
@@ -22,11 +22,17 @@ menu "Memory initialization" config CC_HAS_AUTO_VAR_INIT_PATTERN def_bool $(cc-option,-ftrivial-auto-var-init=pattern) -config CC_HAS_AUTO_VAR_INIT_ZERO - # GCC ignores the -enable flag, so we can test for the feature with - # a single invocation using the flag, but drop it as appropriate in - # the Makefile, depending on the presence of Clang. +config CC_HAS_AUTO_VAR_INIT_ZERO_BARE + def_bool $(cc-option,-ftrivial-auto-var-init=zero) + +config CC_HAS_AUTO_VAR_INIT_ZERO_ENABLER + # Clang 16 and later warn about using the -enable flag, but it + # is required before then. def_bool $(cc-option,-ftrivial-auto-var-init=zero -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang) + depends on !CC_HAS_AUTO_VAR_INIT_ZERO_BARE + +config CC_HAS_AUTO_VAR_INIT_ZERO + def_bool CC_HAS_AUTO_VAR_INIT_ZERO_BARE || CC_HAS_AUTO_VAR_INIT_ZERO_ENABLER choice prompt "Initialize kernel stack variables at function entry"
Greg Kroah-Hartman
maintainerPATCH 154/390 drm: fix drm_mipi_dbi build errors
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit eb7de496451bd969e203f02f66585131228ba4ae ]
drm_mipi_dbi needs lots of DRM_KMS_HELPER support, so select that Kconfig symbol like it is done is most other uses, and the way that it was before MIPS_DBI was moved from tinydrm to its core location.
Fixes these build errors:
ld: drivers/gpu/drm/drm_mipi_dbi.o: in function `mipi_dbi_buf_copy':drivers/gpu/drm/drm_mipi_dbi.c:205: undefined reference to `drm_gem_fb_get_obj'
ld: drivers/gpu/drm/drm_mipi_dbi.c:211: undefined reference to `drm_gem_fb_begin_cpu_access'
ld: drivers/gpu/drm/drm_mipi_dbi.c:215: undefined reference to `drm_gem_fb_vmap'
ld: drivers/gpu/drm/drm_mipi_dbi.c:222: undefined reference to `drm_fb_swab'
ld: drivers/gpu/drm/drm_mipi_dbi.c:224: undefined reference to `drm_fb_memcpy'
ld: drivers/gpu/drm/drm_mipi_dbi.c:227: undefined reference to `drm_fb_xrgb8888_to_rgb565'
ld: drivers/gpu/drm/drm_mipi_dbi.c:235: undefined reference to `drm_gem_fb_vunmap'
ld: drivers/gpu/drm/drm_mipi_dbi.c:237: undefined reference to `drm_gem_fb_end_cpu_access'
ld: drivers/gpu/drm/drm_mipi_dbi.o: in function `mipi_dbi_dev_init_with_formats':
ld: drivers/gpu/drm/drm_mipi_dbi.o:/X64/../drivers/gpu/drm/drm_mipi_dbi.c:469: undefined reference to `drm_gem_fb_create_with_dirty'
--- drivers/gpu/drm/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/Kconfig +1 -0
@@ -30,6 +30,7 @@ menuconfig DRM config DRM_MIPI_DBI tristate depends on DRM + select DRM_KMS_HELPER config DRM_MIPI_DSI bool
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 298/390 MIPS: BCM47XX: Cast memcmp() of function to (void *)
In reply to Greg Kroah-HartmanFrom: Kees Cook <[email protected]>
[ Upstream commit 0dedcf6e3301836eb70cfa649052e7ce4fcd13ba ]
Clang is especially sensitive about argument type matching when using __overloaded functions (like memcmp(), etc). Help it see that function pointers are just "void *". Avoids this error:
arch/mips/bcm47xx/prom.c:89:8: error: no matching function for call to 'memcmp'
if (!memcmp(prom_init, prom_init + mem, 32))
^~~~~~include/linux/string.h:156:12: note: candidate function not viable: no known conversion from 'void (void)' to 'const void *' for 1st argument extern int memcmp(const void *,const void *,__kernel_size_t);
--- arch/mips/bcm47xx/prom.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/mips/bcm47xx/prom.c +2 -2
@@ -86,7 +86,7 @@ static __init void prom_init_mem(void)pr_debug ("Assume 128MB RAM\n" );break ; } -if (!memcmp (prom_init, prom_init + mem,32 )) +if (!memcmp ((void *)prom_init, (void *)prom_init + mem,32 ))break ; } lowmem = mem;
@@ -163,7 +163,7 @@ void __init bcm47xx_prom_highmem_init(void) off =EXTVBASE +__pa (off);for (extmem =128 <<20 ; extmem <512 <<20 ; extmem <<=1 ) { -if (!memcmp (prom_init, (void *)(off + extmem),16 )) +if (!memcmp ((void *)prom_init, (void *)(off + extmem),16 ))break ; } extmem -= lowmem;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 283/390 tracing: kprobe: Fix kprobe event gen test module on exit
In reply to Greg Kroah-HartmanFrom: Yipeng Zou <[email protected]>
[ Upstream commit ac48e189527fae87253ef2bf58892e782fb36874 ]
Correct gen_kretprobe_test clr event para on module exit. This will make it can't to delete.
--- kernel/trace/kprobe_event_gen_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/trace/kprobe_event_gen_test.c +1 -1
@@ -206,7 +206,7 @@ static void __exit kprobe_event_gen_test_exit(void)WARN_ON (kprobe_event_delete ("gen_kprobe_test" ));/* Disable the event or you can't remove it */ -WARN_ON (trace_array_set_clr_event (gen_kprobe_test->tr, +WARN_ON (trace_array_set_clr_event (gen_kretprobe_test->tr,"kprobes" ,"gen_kretprobe_test" , false));
Signature · 9 lines
2.35.1 _______________________________________________ linux-riscv mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-riscv
Greg Kroah-Hartman
maintainerPATCH 302/390 x86/entry: Work around Clang __bdos() bug
In reply to Greg Kroah-HartmanFrom: Kees Cook <[email protected]>
[ Upstream commit 3e1730842f142add55dc658929221521a9ea62b6 ]
Clang produces a false positive when building with CONFIG_FORTIFY_SOURCE=y and CONFIG_UBSAN_BOUNDS=y when operating on an array with a dynamic offset. Work around this by using a direct assignment of an empty instance. Avoids this warning:
../include/linux/fortify-string.h:309:4: warning: call to __write_overflow_field declared with 'warn ing' attribute: detected write beyond size of field (1st parameter); maybe use struct_group()? [-Wat tribute-warning]
__write_overflow_field(p_size_field, size);
^which was isolated to the memset() call in xen_load_idt().
Note that this looks very much like another bug that was worked around:
https://github.com/ClangBuiltLinux/linux/issues/1592
--- arch/x86/xen/enlighten_pv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/x86/xen/enlighten_pv.c +2 -1
@@ -768,6 +768,7 @@ static void xen_load_idt(const struct desc_ptr *desc) {static DEFINE_SPINLOCK (lock);static struct trap_info traps[257 ]; +static const struct trap_info zero = { };unsigned out;trace_xen_cpu_load_idt (desc);
@@ -777,7 +778,7 @@ static void xen_load_idt(const struct desc_ptr *desc)memcpy (this_cpu_ptr (&idt_desc), desc,sizeof (idt_desc)); out =xen_convert_trap_info (desc, traps, false); -memset (&traps[out],0 ,sizeof (traps[0 ])); + traps[out] = zero;xen_mc_flush ();if (HYPERVISOR_set_trap_table (traps))
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 284/390 tracing: kprobe: Make gen test module work in arm and riscv
In reply to Greg Kroah-HartmanFrom: Yipeng Zou <[email protected]>
[ Upstream commit d8ef45d66c01425ff748e13ef7dd1da7a91cc93c ]
For now, this selftest module can only work in x86 because of the kprobe cmd was fixed use of x86 registers.
This patch adapted to register names under arm and riscv, So that this module can be worked on those platform.
--- kernel/trace/kprobe_event_gen_test.c | 47 +++++++++++++++++++++++++--- 1 file changed, 43 insertions(+), 4 deletions(-)
kernel/trace/kprobe_event_gen_test.c +43 -4
@@ -35,6 +35,45 @@static struct trace_event_file *gen_kprobe_test;static struct trace_event_file *gen_kretprobe_test; +#define KPROBE_GEN_TEST_FUNC "do_sys_open" + +/* X86 */ +#if defined(CONFIG_X86_64 ) || defined(CONFIG_X86_32 ) +#define KPROBE_GEN_TEST_ARG0 "dfd=%ax" +#define KPROBE_GEN_TEST_ARG1 "filename=%dx" +#define KPROBE_GEN_TEST_ARG2 "flags=%cx" +#define KPROBE_GEN_TEST_ARG3 "mode=+4($stack)" + +/* ARM64 */ +#elif defined(CONFIG_ARM64 ) +#define KPROBE_GEN_TEST_ARG0 "dfd=%x0" +#define KPROBE_GEN_TEST_ARG1 "filename=%x1" +#define KPROBE_GEN_TEST_ARG2 "flags=%x2" +#define KPROBE_GEN_TEST_ARG3 "mode=%x3" + +/* ARM */ +#elif defined(CONFIG_ARM ) +#define KPROBE_GEN_TEST_ARG0 "dfd=%r0" +#define KPROBE_GEN_TEST_ARG1 "filename=%r1" +#define KPROBE_GEN_TEST_ARG2 "flags=%r2" +#define KPROBE_GEN_TEST_ARG3 "mode=%r3" + +/* RISCV */ +#elif defined(CONFIG_RISCV ) +#define KPROBE_GEN_TEST_ARG0 "dfd=%a0" +#define KPROBE_GEN_TEST_ARG1 "filename=%a1" +#define KPROBE_GEN_TEST_ARG2 "flags=%a2" +#define KPROBE_GEN_TEST_ARG3 "mode=%a3" + +/* others */ +#else +#define KPROBE_GEN_TEST_ARG0 NULL +#define KPROBE_GEN_TEST_ARG1 NULL +#define KPROBE_GEN_TEST_ARG2 NULL +#define KPROBE_GEN_TEST_ARG3 NULL +#endif + +/* * Test to make sure we can create a kprobe event, then add more * fields.
@@ -58,14 +97,14 @@ static int __init test_gen_kprobe_cmd(void)* fields. */ ret =kprobe_event_gen_cmd_start (&cmd,"gen_kprobe_test" , -"do_sys_open" , -"dfd=%ax" ,"filename=%dx" ); +KPROBE_GEN_TEST_FUNC , +KPROBE_GEN_TEST_ARG0 ,KPROBE_GEN_TEST_ARG1 );if (ret) goto free;/* Use kprobe_event_add_fields to add the rest of the fields */ - ret =kprobe_event_add_fields (&cmd,"flags=%cx" ,"mode=+4($stack)" ); + ret =kprobe_event_add_fields (&cmd,KPROBE_GEN_TEST_ARG2 ,KPROBE_GEN_TEST_ARG3 );if (ret) goto free;
@@ -128,7 +167,7 @@ static int __init test_gen_kretprobe_cmd(void)* Define the kretprobe event. */ ret =kretprobe_event_gen_cmd_start (&cmd,"gen_kretprobe_test" , -"do_sys_open" , +KPROBE_GEN_TEST_FUNC ,"$retval" );if (ret) goto free;
Signature · 9 lines
2.35.1 _______________________________________________ linux-riscv mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-riscv
Greg Kroah-Hartman
maintainerPATCH 301/390 ARM: decompressor: Include .data.rel.ro.local
In reply to Greg Kroah-HartmanFrom: Kees Cook <[email protected]>
[ Upstream commit 1b64daf413acd86c2c13f5443f6b4ef3690c8061 ]
The .data.rel.ro.local section has the same semantics as .data.rel.ro here, so include it in the .rodata section of the decompressor. Additionally since the .printk_index section isn't usable outside of the core kernel, discard it in the decompressor. Avoids these warnings:
arm-linux-gnueabi-ld: warning: orphan section .data.rel.ro.local' from arch/arm/boot/compressed/fdt_rw.o' being placed in section `.data.rel.ro.local'
arm-linux-gnueabi-ld: warning: orphan section .printk_index' from arch/arm/boot/compressed/fdt_rw.o' being placed in section `.printk_index'
--- arch/arm/boot/compressed/vmlinux.lds.S | 2 ++ 1 file changed, 2 insertions(+)
arch/arm/boot/compressed/vmlinux.lds.S +2 -0
@@ -23,6 +23,7 @@ SECTIONS *(.ARM.extab*) *(.note.*) *(.rel.*) + *(.printk_index) /* * Discard any r/w data - this produces a link error if we have any, * which is required for PIC decompression. Local data generates
@@ -57,6 +58,7 @@ SECTIONS *(.rodata) *(.rodata.*) *(.data.rel.ro) + *(.data.rel.ro.*) } .piggydata : { *(.piggydata)
Signature · 9 lines
2.35.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Greg Kroah-Hartman
maintainerPATCH 4/390 ALSA: usb-audio: Fix NULL dererence at error path
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
commit 568be8aaf8a535f79c4db76cabe17b035aa2584d upstream.
At an error path to release URB buffers and contexts, the driver might hit a NULL dererence for u->urb pointer, when u->buffer_size has been already set but the actual URB allocation failed.
Fix it by adding the NULL check of urb. Also, make sure that buffer_size is cleared after the error path or the close.
--- sound/usb/endpoint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
sound/usb/endpoint.c +2 -1
@@ -73,12 +73,13 @@ static inline unsigned get_usb_high_spee*/ static void release_urb_ctx (struct snd_urb_ctx *u) { -if (u->buffer_size) +if (u->urb && u->buffer_size)usb_free_coherent (u->ep->chip->dev, u->buffer_size, u->urb->transfer_buffer, u->urb->transfer_dma);usb_free_urb (u->urb); u->urb =NULL ; + u->buffer_size =0 ; }static const char *usb_error_string (int err)
Greg Kroah-Hartman
maintainerPATCH 10/390 cifs: destage dirty pages before re-reading them for cache=none
In reply to Greg Kroah-HartmanFrom: Ronnie Sahlberg <[email protected]>
commit bb44c31cdcac107344dd2fcc3bd0504a53575c51 upstream.
This is the opposite case of kernel bugzilla 216301.
If we mmap a file using cache=none and then proceed to update the mmapped area these updates are not reflected in a later pread() of that part of the file.
To fix this we must first destage any dirty pages in the range before we allow the pread() to proceed.
--- fs/cifs/file.c | 9 +++++++++ 1 file changed, 9 insertions(+)
fs/cifs/file.c +9 -0
@@ -3936,6 +3936,15 @@ static ssize_t __cifs_readv( len = ctx->len; } +if (direct) { + rc =filemap_write_and_wait_range (file->f_inode->i_mapping, + offset, offset + len -1 ); +if (rc) { +kref_put (&ctx->refcount, cifs_aio_ctx_release); +return -EAGAIN ; + } + } +/* grab a lock here due to read response handlers can access ctx */ mutex_lock (&ctx->aio_mutex);
Greg Kroah-Hartman
maintainerPATCH 16/390 iio: pressure: dps310: Reset chip after timeout
In reply to Greg Kroah-HartmanFrom: Eddie James <[email protected]>
commit 7b4ab4abcea4c0c10b25187bf2569e5a07e9a20c upstream.
The DPS310 chip has been observed to get "stuck" such that pressure and temperature measurements are never indicated as "ready" in the MEAS_CFG register. The only solution is to reset the device and try again. In order to avoid continual failures, use a boolean flag to only try the reset after timeout once if errors persist.
--- drivers/iio/pressure/dps310.c | 74 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 64 insertions(+), 10 deletions(-)
drivers/iio/pressure/dps310.c +64 -10
@@ -89,6 +89,7 @@ struct dps310_data {s32 c00, c10, c20, c30, c01, c11, c21;s32 pressure_raw;s32 temp_raw; +bool timeout_recovery_failed; };static const struct iio_chan_spec dps310_channels[] = {
@@ -393,11 +394,69 @@ static int dps310_get_temp_k(struct dps3return scale_factors[ilog2 (rc)]; } +static int dps310_reset_wait (struct dps310_data *data) +{ +int rc; + + rc =regmap_write (data->regmap,DPS310_RESET ,DPS310_RESET_MAGIC ); +if (rc) +return rc; + +/* Wait for device chip access: 2.5ms in specification */ +usleep_range (2500 ,12000 ); +return 0 ; +} + +static int dps310_reset_reinit (struct dps310_data *data) +{ +int rc; + + rc =dps310_reset_wait (data); +if (rc) +return rc; + +return dps310_startup (data); +} + +static int dps310_ready_status (struct dps310_data *data,int ready_bit,int timeout) +{ +int sleep =DPS310_POLL_SLEEP_US (timeout); +int ready; + +return regmap_read_poll_timeout (data->regmap,DPS310_MEAS_CFG , ready, ready & ready_bit, + sleep, timeout); +} + +static int dps310_ready (struct dps310_data *data,int ready_bit,int timeout) +{ +int rc; + + rc =dps310_ready_status (data, ready_bit, timeout); +if (rc) { +if (rc == -ETIMEDOUT && !data->timeout_recovery_failed) { +/* Reset and reinitialize the chip. */ +if (dps310_reset_reinit (data)) { + data->timeout_recovery_failed = true; + }else { +/* Try again to get sensor ready status. */ +if (dps310_ready_status (data, ready_bit, timeout)) + data->timeout_recovery_failed = true; +else +return 0 ; + } + } + +return rc; + } + + data->timeout_recovery_failed = false; +return 0 ; +} +static int dps310_read_pres_raw (struct dps310_data *data) {int rc;int rate; -int ready;int timeout;s32 raw;u8 val[3 ];
@@ -409,9 +468,7 @@ static int dps310_read_pres_raw(struct d timeout =DPS310_POLL_TIMEOUT_US (rate);/* Poll for sensor readiness; base the timeout upon the sample rate. */ - rc =regmap_read_poll_timeout (data->regmap,DPS310_MEAS_CFG , ready, - ready &DPS310_PRS_RDY , -DPS310_POLL_SLEEP_US (timeout), timeout); + rc =dps310_ready (data,DPS310_PRS_RDY , timeout);if (rc) goto done;
@@ -448,7 +505,6 @@ static int dps310_read_temp_raw(struct d {int rc;int rate; -int ready;int timeout;if (mutex_lock_interruptible (&data->lock))
@@ -458,10 +514,8 @@ static int dps310_read_temp_raw(struct d timeout =DPS310_POLL_TIMEOUT_US (rate);/* Poll for sensor readiness; base the timeout upon the sample rate. */ - rc =regmap_read_poll_timeout (data->regmap,DPS310_MEAS_CFG , ready, - ready &DPS310_TMP_RDY , -DPS310_POLL_SLEEP_US (timeout), timeout); -if (rc <0 ) + rc =dps310_ready (data,DPS310_TMP_RDY , timeout); +if (rc) goto done; rc =dps310_read_temp_ready (data);
@@ -756,7 +810,7 @@ static void dps310_reset(void *action_da {struct dps310_data *data = action_data; -regmap_write (data->regmap,DPS310_RESET ,DPS310_RESET_MAGIC ); +dps310_reset_wait (data); }static const struct regmap_config dps310_regmap_config = {
Greg Kroah-Hartman
maintainerPATCH 12/390 iio: dac: ad5593r: Fix i2c read protocol requirements
In reply to Greg Kroah-HartmanFrom: Michael Hennerich <[email protected]>
commit 558a25f903b4af6361b7fbeea08a6446a0745653 upstream.
For reliable operation across the full range of supported interface rates, the AD5593R needs a STOP condition between address write, and data read (like show in the datasheet Figure 40) so in turn i2c_smbus_read_word_swapped cannot be used.
While at it, a simple helper was added to make the code simpler.
--- drivers/iio/dac/ad5593r.c | 46 +++++++++++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 19 deletions(-)
drivers/iio/dac/ad5593r.c +27 -19
@@ -13,6 +13,8 @@#include <linux/module.h> #include <linux/mod_devicetable.h> +#include <asm/unaligned.h> +#define AD5593R_MODE_CONF (0 << 4)#define AD5593R_MODE_DAC_WRITE (1 << 4)#define AD5593R_MODE_ADC_READBACK (4 << 4)
@@ -20,6 +22,24 @@#define AD5593R_MODE_GPIO_READBACK (6 << 4)#define AD5593R_MODE_REG_READBACK (7 << 4) +static int ad5593r_read_word (struct i2c_client *i2c,u8 reg,u16 *value) +{ +int ret; +u8 buf[2 ]; + + ret =i2c_smbus_write_byte (i2c, reg); +if (ret <0 ) +return ret; + + ret =i2c_master_recv (i2c, buf,sizeof (buf)); +if (ret <0 ) +return ret; + + *value =get_unaligned_be16 (buf); + +return 0 ; +} +static int ad5593r_write_dac (struct ad5592r_state *st,unsigned chan,u16 value) {struct i2c_client *i2c =to_i2c_client (st->dev);
@@ -38,13 +58,7 @@ static int ad5593r_read_adc(struct ad559if (val <0 )return (int ) val; - val =i2c_smbus_read_word_swapped (i2c,AD5593R_MODE_ADC_READBACK ); -if (val <0 ) -return (int ) val; - - *value = (u16 ) val; - -return 0 ; +return ad5593r_read_word (i2c,AD5593R_MODE_ADC_READBACK , value); }static int ad5593r_reg_write (struct ad5592r_state *st,u8 reg,u16 value)
@@ -58,25 +72,19 @@ static int ad5593r_reg_write(struct ad55static int ad5593r_reg_read (struct ad5592r_state *st,u8 reg,u16 *value) {struct i2c_client *i2c =to_i2c_client (st->dev); -s32 val; - - val =i2c_smbus_read_word_swapped (i2c,AD5593R_MODE_REG_READBACK | reg); -if (val <0 ) -return (int ) val; - *value = (u16 ) val; - -return 0 ; +return ad5593r_read_word (i2c,AD5593R_MODE_REG_READBACK | reg, value); }static int ad5593r_gpio_read (struct ad5592r_state *st,u8 *value) {struct i2c_client *i2c =to_i2c_client (st->dev); -s32 val; +u16 val; +int ret; - val =i2c_smbus_read_word_swapped (i2c,AD5593R_MODE_GPIO_READBACK ); -if (val <0 ) -return (int ) val; + ret =ad5593r_read_word (i2c,AD5593R_MODE_GPIO_READBACK , &val); +if (ret) +return ret; *value = (u8 ) val;
Greg Kroah-Hartman
maintainerPATCH 5/390 ALSA: hda/realtek: remove ALC289_FIXUP_DUAL_SPK for Dell 5530
In reply to Greg Kroah-HartmanFrom: Callum Osmotherly <[email protected]>
commit 417b9c51f59734d852e47252476fadc293ad994a upstream.
After some feedback from users with Dell Precision 5530 machines, this patch reverts the previous change to add ALC289_FIXUP_DUAL_SPK. While it improved the speaker output quality, it caused the headphone jack to have an audible "pop" sound when power saving was toggled.
--- sound/pci/hda/patch_realtek.c | 1 - 1 file changed, 1 deletion(-)
sound/pci/hda/patch_realtek.c +0 -1
@@ -8774,7 +8774,6 @@ static const struct snd_pci_quirk alc269SND_PCI_QUIRK (0x1028 ,0x0871 ,"Dell Precision 3630" ,ALC255_FIXUP_DELL_HEADSET_MIC ),SND_PCI_QUIRK (0x1028 ,0x0872 ,"Dell Precision 3630" ,ALC255_FIXUP_DELL_HEADSET_MIC ),SND_PCI_QUIRK (0x1028 ,0x0873 ,"Dell Precision 3930" ,ALC255_FIXUP_DUMMY_LINEOUT_VERB ), -SND_PCI_QUIRK (0x1028 ,0x087d ,"Dell Precision 5530" ,ALC289_FIXUP_DUAL_SPK ),SND_PCI_QUIRK (0x1028 ,0x08ad ,"Dell WYSE AIO" ,ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x1028 ,0x08ae ,"Dell WYSE NB" ,ALC225_FIXUP_DELL1_MIC_NO_PRESENCE ), SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
Greg Kroah-Hartman
maintainerPATCH 25/390 HID: multitouch: Add memory barriers
In reply to Greg Kroah-HartmanFrom: Andri Yngvason <[email protected]>
commit be6e2b5734a425941fcdcdbd2a9337be498ce2cf upstream.
This fixes broken atomic checks which cause a race between the release-timer and processing of hid input.
I noticed that contacts were sometimes sticking, even with the "sticky fingers" quirk enabled. This fixes that problem.
--- drivers/hid/hid-multitouch.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/hid/hid-multitouch.c +4 -4
@@ -1155,7 +1155,7 @@ static void mt_touch_report(struct hid_dint contact_count =-1 ;/* sticky fingers release in progress, abort */ -if (test_and_set_bit (MT_IO_FLAGS_RUNNING , &td->mt_io_flags)) +if (test_and_set_bit_lock (MT_IO_FLAGS_RUNNING , &td->mt_io_flags))return ; scantime = *app->scantime;
@@ -1236,7 +1236,7 @@ static void mt_touch_report(struct hid_ddel_timer (&td->release_timer); } -clear_bit (MT_IO_FLAGS_RUNNING , &td->mt_io_flags); +clear_bit_unlock (MT_IO_FLAGS_RUNNING , &td->mt_io_flags); } static int mt_touch_input_configured(struct hid_device *hdev,
@@ -1671,11 +1671,11 @@ static void mt_expired_timeout(struct ti* An input report came in just before we release the sticky fingers, * it will take care of the sticky fingers. */ -if (test_and_set_bit (MT_IO_FLAGS_RUNNING , &td->mt_io_flags)) +if (test_and_set_bit_lock (MT_IO_FLAGS_RUNNING , &td->mt_io_flags))return ;if (test_bit (MT_IO_FLAGS_PENDING_SLOTS , &td->mt_io_flags))mt_release_contacts (hdev); -clear_bit (MT_IO_FLAGS_RUNNING , &td->mt_io_flags); +clear_bit_unlock (MT_IO_FLAGS_RUNNING , &td->mt_io_flags); }static int mt_probe (struct hid_device *hdev,const struct hid_device_id *id)
Greg Kroah-Hartman
maintainerPATCH 35/390 riscv: Make VM_WRITE imply VM_READ
In reply to Greg Kroah-HartmanFrom: Andrew Bresticker <[email protected]>
commit 7ab72c597356be1e7f0f3d856e54ce78527f43c8 upstream.
RISC-V does not presently have write-only mappings as that PTE bit pattern is considered reserved in the privileged spec, so allow handling of read faults in VMAs that have VM_WRITE without VM_READ in order to be consistent with other architectures that have similar limitations.
--- arch/riscv/mm/fault.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/riscv/mm/fault.c +2 -1
@@ -167,7 +167,8 @@ static inline bool access_error(unsigned }break ;case EXC_LOAD_PAGE_FAULT : -if (!(vma->vm_flags &VM_READ )) { +/* Write implies read */ +if (!(vma->vm_flags & (VM_READ |VM_WRITE ))) {return true; }break ;
Greg Kroah-Hartman
maintainerPATCH 27/390 platform/chrome: cros_ec_proto: Update version on GET_NEXT_EVENT failure
In reply to Greg Kroah-HartmanFrom: Patryk Duda <[email protected]>
commit f74c7557ed0d321947e8bb4e9d47c1013f8b2227 upstream.
Some EC based devices (e.g. Fingerpint MCU) can jump to RO part of the firmware (intentionally or due to device reboot). The RO part doesn't change during the device lifecycle, so it won't support newer version of EC_CMD_GET_NEXT_EVENT command.
Function cros_ec_query_all() is responsible for finding maximum supported MKBP event version. It's usually called when the device is running RW part of the firmware, so the command version can be potentially higher than version supported by the RO.
The problem was fixed by updating maximum supported version when the device returns EC_RES_INVALID_VERSION (mapped to -ENOPROTOOPT). That way the kernel will use highest common version supported by RO and RW.
--- drivers/platform/chrome/cros_ec_proto.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)
drivers/platform/chrome/cros_ec_proto.c +32 -0
@@ -748,6 +748,7 @@ int cros_ec_get_next_event(struct cros_eu8 event_type;u32 host_event;int ret; +u32 ver_mask;/* * Default value for wake_event.
@@ -769,6 +770,37 @@ int cros_ec_get_next_event(struct cros_ereturn get_keyboard_state_event (ec_dev); ret =get_next_event (ec_dev); +/* +* -ENOPROTOOPT is returned when EC returns EC_RES_INVALID_VERSION. +* This can occur when EC based device (e.g. Fingerprint MCU) jumps to +* the RO image which doesn't support newer version of the command. In +* this case we will attempt to update maximum supported version of the +* EC_CMD_GET_NEXT_EVENT. +*/ +if (ret == -ENOPROTOOPT ) { +dev_dbg (ec_dev->dev, +"GET_NEXT_EVENT returned invalid version error.\n" ); + ret =cros_ec_get_host_command_version_mask (ec_dev, +EC_CMD_GET_NEXT_EVENT , + &ver_mask); +if (ret <0 || ver_mask ==0 ) +/* +* Do not change the MKBP supported version if we can't +* obtain supported version correctly. Please note that +* calling EC_CMD_GET_NEXT_EVENT returned +* EC_RES_INVALID_VERSION which means that the command +* is present. +*/ +return -ENOPROTOOPT ; + + ec_dev->mkbp_event_supported =fls (ver_mask); +dev_dbg (ec_dev->dev,"MKBP support version changed to %u\n" , + ec_dev->mkbp_event_supported -1 ); + +/* Try to get next event with new MKBP support version set. */ + ret =get_next_event (ec_dev); + } +if (ret <=0 )return ret;
Greg Kroah-Hartman
maintainerPATCH 36/390 riscv: Pass -mno-relax only on lld < 15.0.0
In reply to Greg Kroah-HartmanFrom: Fangrui Song <[email protected]>
commit 3cebf80e9a0d3adcb174053be32c88a640b3344b upstream.
lld since llvm:6611d58f5bbc ("[ELF] Relax R_RISCV_ALIGN"), which will be included in the 15.0.0 release, has implemented some RISC-V linker relaxation. -mno-relax is no longer needed in KBUILD_CFLAGS/KBUILD_AFLAGS to suppress R_RISCV_ALIGN which older lld can not handle:
ld.lld: error: capability.c:(.fixup+0x0): relocation R_RISCV_ALIGN requires unimplemented linker relaxation; recompile with -mno-relax but the .o is already compiled with -mno-relax
--- arch/riscv/Makefile | 2 ++ 1 file changed, 2 insertions(+)
arch/riscv/Makefile +2 -0
@@ -37,6 +37,7 @@ else endif ifeq ($(CONFIG_LD_IS_LLD),y) +ifeq ($(shell test $(CONFIG_LLD_VERSION) -lt 150000; echo $$?),0) KBUILD_CFLAGS += -mno-relax KBUILD_AFLAGS += -mno-relax ifneq ($(LLVM_IAS),1)
@@ -44,6 +45,7 @@ ifneq ($(LLVM_IAS),1) KBUILD_AFLAGS += -Wa,-mno-relax endif endif +endif # ISA string setting riscv-march-$(CONFIG_ARCH_RV32I) := rv32ima
Greg Kroah-Hartman
maintainerPATCH 33/390 parisc: fbdev/stifb: Align graphics memory size to 4MB
In reply to Greg Kroah-HartmanFrom: Helge Deller <[email protected]>
commit aca7c13d3bee81a968337a5515411409ae9d095d upstream.
Independend of the current graphics resolution, adjust the reported graphics card memory size to the next 4MB boundary.
This fixes the fbtest program which expects a naturally aligned size.
--- drivers/video/fbdev/stifb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/fbdev/stifb.c +1 -1
@@ -1257,7 +1257,7 @@ static int __init stifb_init_fb(struct s/* limit fbsize to max visible screen size */ if (fix->smem_len > yres*fix->line_length) - fix->smem_len = yres*fix->line_length; + fix->smem_len =ALIGN (yres*fix->line_length,4 *1024 *1024 ); fix->accel =FB_ACCEL_NONE ;
Greg Kroah-Hartman
maintainerPATCH 40/390 drm/udl: Restore display mode on resume
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
commit 6d6e732835db92e66c28dbcf258a7e3d3c71420d upstream.
Restore the display mode whne resuming from suspend. Currently, the display remains dark.
On resume, the CRTC's mode does not change, but the 'active' flag changes to 'true'. Taking this into account when considering a mode switch restores the display mode.
The bug is reproducable by using Gnome with udl and observing the adapter's suspend/resume behavior.
Actually, the whole check added in udl_simple_display_pipe_enable() about the crtc_state->mode_changed was bogus. We should drop the whole check and always apply the mode change in this function.
[ tiwai -- Drop the mode_changed check entirely instead, per Daniel's
suggestion ]
--- drivers/gpu/drm/udl/udl_modeset.c | 3 --- 1 file changed, 3 deletions(-)
drivers/gpu/drm/udl/udl_modeset.c +0 -3
@@ -400,9 +400,6 @@ udl_simple_display_pipe_enable(struct drudl_handle_damage (fb,0 ,0 , fb->width, fb->height); -if (!crtc_state->mode_changed) -return ; -/* enable display */ udl_crtc_write_mode_to_hw (crtc); }
Greg Kroah-Hartman
maintainerPATCH 41/390 block: fix inflight statistics of part0
In reply to Greg Kroah-HartmanFrom: Jeffle Xu <[email protected]>
commit b0d97557ebfc9d5ba5f2939339a9fdd267abafeb upstream.
The inflight of partition 0 doesn't include inflight IOs to all sub-partitions, since currently mq calculates inflight of specific partition by simply camparing the value of the partition pointer.
Thus the following case is possible:
$ cat /sys/block/vda/inflight 0 0 $ cat /sys/block/vda/vda1/inflight 0 128
While single queue device (on a previous version, e.g. v3.10) has no this issue:
$cat /sys/block/sda/sda3/inflight
0 33
$cat /sys/block/sda/inflight
0 33Partition 0 should be specially handled since it represents the whole disk. This issue is introduced since commit bf0ddaba65dd ("blk-mq: fix sysfs inflight counter").
Besides, this patch can also fix the inflight statistics of part 0 in /proc/diskstats. Before this patch, the inflight statistics of part 0 doesn't include that of sub partitions. (I have marked the 'inflight' field with asterisk.)
$cat /proc/diskstats
259 0 nvme0n1 45974469 0 367814768 6445794 1 0 1 0 *0* 111062 6445794 0 0 0 0 0 0
259 2 nvme0n1p1 45974058 0 367797952 6445727 0 0 0 0 *33* 111001 6445727 0 0 0 0 0 0
This is introduced since commit f299b7c7a9de ("blk-mq: provide internal in-flight variant").
--- block/blk-mq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
block/blk-mq.c +2 -1
@@ -105,7 +105,8 @@ static bool blk_mq_check_inflight(struct {struct mq_inflight *mi = priv; -if (rq->part == mi->part &&blk_mq_rq_state (rq) ==MQ_RQ_IN_FLIGHT ) +if ((!mi->part->partno || rq->part == mi->part) && +blk_mq_rq_state (rq) ==MQ_RQ_IN_FLIGHT ) mi->inflight[rq_data_dir (rq)]++;return true;
Greg Kroah-Hartman
maintainerPATCH 39/390 drm/virtio: Check whether transferred 2D BO is shmem
In reply to Greg Kroah-HartmanFrom: Dmitry Osipenko <[email protected]>
commit e473216b42aa1fd9fc6b94b608b42c210c655908 upstream.
Transferred 2D BO always must be a shmem BO. Add check for that to prevent NULL dereference if userspace passes a VRAM BO.
--- drivers/gpu/drm/virtio/virtgpu_vq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/virtio/virtgpu_vq.c +1 -1
@@ -601,7 +601,7 @@ void virtio_gpu_cmd_transfer_to_host_2d(bool use_dma_api = !virtio_has_dma_quirk (vgdev->vdev);struct virtio_gpu_object_shmem *shmem =to_virtio_gpu_shmem (bo); -if (use_dma_api) +if (virtio_gpu_is_shmem (bo) && use_dma_api)dma_sync_sgtable_for_device (vgdev->vdev->dev.parent, shmem->pages,DMA_TO_DEVICE );
Greg Kroah-Hartman
maintainerPATCH 42/390 mm/mmap: undo ->mmap() when arch_validate_flags() fails
In reply to Greg Kroah-HartmanFrom: Carlos Llamas <[email protected]>
commit deb0f6562884b5b4beb883d73e66a7d3a1b96d99 upstream.
Commit c462ac288f2c ("mm: Introduce arch_validate_flags()") added a late check in mmap_region() to let architectures validate vm_flags. The check needs to happen after calling ->mmap() as the flags can potentially be modified during this callback.
If arch_validate_flags() check fails we unmap and free the vma. However, the error path fails to undo the ->mmap() call that previously succeeded and depending on the specific ->mmap() implementation this translates to reference increments, memory allocations and other operations what will not be cleaned up.
There are several places (mainly device drivers) where this is an issue. However, one specific example is bpf_map_mmap() which keeps count of the mappings in map->writecnt. The count is incremented on ->mmap() and then decremented on vm_ops->close(). When arch_validate_flags() fails this count is off since bpf_map_mmap_close() is never called.
One can reproduce this issue in arm64 devices with MTE support. Here the vm_flags are checked to only allow VM_MTE if VM_MTE_ALLOWED has been set previously. From userspace then is enough to pass the PROT_MTE flag to mmap() syscall to trigger the arch_validate_flags() failure.
The following program reproduces this issue:
#include <stdio.h> #include <unistd.h> #include <linux/unistd.h> #include <linux/bpf.h> #include <sys/mman.h>
int main(void)
{
union bpf_attr attr = {
.map_type = BPF_MAP_TYPE_ARRAY,
.key_size = sizeof(int),
.value_size = sizeof(long long),
.max_entries = 256,
.map_flags = BPF_F_MMAPABLE,
};
int fd;
fd = syscall(__NR_bpf, BPF_MAP_CREATE, &attr, sizeof(attr));
mmap(NULL, 4096, PROT_WRITE | PROT_MTE, MAP_SHARED, fd, 0);
return 0;}
By manually adding some log statements to the vm_ops callbacks we can confirm that when passing PROT_MTE to mmap() the map->writecnt is off upon ->release():
With PROT_MTE flag:
root@debian:~# ./bpf-test [ 111.263874] bpf_map_write_active_inc: map=9 writecnt=1 [ 111.288763] bpf_map_release: map=9 writecnt=1
Without PROT_MTE flag:
root@debian:~# ./bpf-test [ 157.816912] bpf_map_write_active_inc: map=10 writecnt=1 [ 157.830442] bpf_map_write_active_dec: map=10 writecnt=0 [ 157.832396] bpf_map_release: map=10 writecnt=0
This patch fixes the above issue by calling vm_ops->close() when the arch_validate_flags() check fails, after this we can proceed to unmap and free the vma on the error path.
--- mm/mmap.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
mm/mmap.c +4 -1
@@ -1856,7 +1856,7 @@ unsigned long mmap_region(struct file *fif (!arch_validate_flags (vma->vm_flags)) { error = -EINVAL ;if (file) - goto unmap_and_free_vma; + goto close_and_free_vma;else goto free_vma; }
@@ -1900,6 +1900,9 @@ out:return addr; +close_and_free_vma: +if (vma->vm_ops && vma->vm_ops->close) + vma->vm_ops->close (vma); unmap_and_free_vma: vma->vm_file =NULL ;fput (file);
Greg Kroah-Hartman
maintainerPATCH 43/390 PCI: Sanitise firmware BAR assignments behind a PCI-PCI bridge
In reply to Greg Kroah-HartmanFrom: Maciej W. Rozycki <[email protected]>
commit 0e32818397426a688f598f35d3bc762eca6d7592 upstream.
When pci_assign_resource() is unable to assign resources to a BAR, it uses pci_revert_fw_address() to fall back to a firmware assignment (if any). Previously pci_revert_fw_address() assumed all addresses could reach the device, but this is not true if the device is below a bridge that only forwards addresses within its windows.
This problem was observed on a Tyan Tomcat IV S1564D system where the BIOS did not assign valid addresses to several bridges and USB devices:
pci 0000:00:11.0: PCI-to-PCIe bridge to [bus 01-ff]
pci 0000:00:11.0: bridge window [io 0xe000-0xefff]
pci 0000:01:00.0: PCIe Upstream Port to [bus 02-ff]
pci 0000:01:00.0: bridge window [io 0x0000-0x0fff] # unreachable
pci 0000:02:02.0: PCIe Downstream Port to [bus 05-ff]
pci 0000:02:02.0: bridge window [io 0x0000-0x0fff] # unreachable
pci 0000:05:00.0: PCIe-to-PCI bridge to [bus 06-ff]
pci 0000:05:00.0: bridge window [io 0x0000-0x0fff] # unreachable
pci 0000:06:08.0: USB UHCI 1.1
pci 0000:06:08.0: BAR 4: [io 0xfce0-0xfcff] # unreachable
pci 0000:06:08.1: USB UHCI 1.1
pci 0000:06:08.1: BAR 4: [io 0xfce0-0xfcff] # unreachable
pci 0000:06:08.0: can't claim BAR 4 [io 0xfce0-0xfcff]: no compatible bridge window pci 0000:06:08.1: can't claim BAR 4 [io 0xfce0-0xfcff]: no compatible bridge window
During the first pass of assigning unassigned resources, there was not enough I/O space available, so we couldn't assign the 06:08.0 BAR and reverted to the firmware assignment (still unreachable). Reverting the 06:08.1 assignment failed because it conflicted with 06:08.0:
pci 0000:00:11.0: bridge window [io 0xe000-0xefff]
pci 0000:01:00.0: no space for bridge window [io size 0x2000] pci 0000:02:02.0: no space for bridge window [io size 0x1000] pci 0000:05:00.0: no space for bridge window [io size 0x1000]
pci 0000:06:08.0: BAR 4: no space for [io size 0x0020]
pci 0000:06:08.0: BAR 4: trying firmware assignment [io 0xfce0-0xfcff]
pci 0000:06:08.1: BAR 4: no space for [io size 0x0020]
pci 0000:06:08.1: BAR 4: trying firmware assignment [io 0xfce0-0xfcff]
pci 0000:06:08.1: BAR 4: [io 0xfce0-0xfcff] conflicts with 0000:06:08.0 [io 0xfce0-0xfcff]
A subsequent pass assigned valid bridge windows and a valid 06:08.1 BAR, but left the 06:08.0 BAR alone, so the UHCI device was still unusable:
pci 0000:00:11.0: bridge window [io 0xe000-0xefff] released pci 0000:00:11.0: bridge window [io 0x1000-0x2fff] # reassigned pci 0000:01:00.0: bridge window [io 0x1000-0x2fff] # reassigned pci 0000:02:02.0: bridge window [io 0x2000-0x2fff] # reassigned pci 0000:05:00.0: bridge window [io 0x2000-0x2fff] # reassigned pci 0000:06:08.0: BAR 4: assigned [io 0xfce0-0xfcff] # left alone pci 0000:06:08.1: BAR 4: assigned [io 0x2000-0x201f]
...
uhci_hcd 0000:06:08.0: host system error, PCI problems?
uhci_hcd 0000:06:08.0: host controller process error, something bad happened! uhci_hcd 0000:06:08.0: host controller halted, very bad! uhci_hcd 0000:06:08.0: HCRESET not completed yet!
uhci_hcd 0000:06:08.0: HC died; cleaning up
If the address assigned by firmware is not reachable because it's not within upstream bridge windows, fail instead of assigning the unusable address from firmware.
--- drivers/pci/setup-res.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/pci/setup-res.c +11 -0
@@ -210,6 +210,17 @@ static int pci_revert_fw_address(struct root =pci_find_parent_resource (dev, res);if (!root) { +/* +* If dev is behind a bridge, accesses will only reach it +* if res is inside the relevant bridge window. +*/ +if (pci_upstream_bridge (dev)) +return -ENXIO ; + +/* +* On the root bus, assume the host bridge will forward +* everything. +*/ if (res->flags &IORESOURCE_IO ) root = &ioport_resource;else
Greg Kroah-Hartman
maintainerPATCH 46/390 powerpc/boot: Explicitly disable usage of SPE instructions
In reply to Greg Kroah-HartmanFrom: Pali Rohár <[email protected]>
commit 110a58b9f91c66f743c01a2c217243d94c899c23 upstream.
uImage boot wrapper should not use SPE instructions, like kernel itself. Boot wrapper has already disabled Altivec and VSX instructions but not SPE. Options -mno-spe and -mspe=no already set when compilation of kernel, but not when compiling uImage wrapper yet. Fix it.
--- arch/powerpc/boot/Makefile | 1 + 1 file changed, 1 insertion(+)
arch/powerpc/boot/Makefile +1 -0
@@ -30,6 +30,7 @@ endif BOOTCFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ -fno-strict-aliasing -O2 -msoft-float -mno-altivec -mno-vsx \ + $(call cc-option,-mno-spe) $(call cc-option,-mspe=no) \ -pipe -fomit-frame-pointer -fno-builtin -fPIC -nostdinc \ $(LINUXINCLUDE)
Greg Kroah-Hartman
maintainerPATCH 18/390 can: kvaser_usb: Fix use of uninitialized completion
In reply to Greg Kroah-HartmanFrom: Anssi Hannula <[email protected]>
commit cd7f30e174d09a02ca2afa5ef093fb0f0352e0d8 upstream.
flush_comp is initialized when CMD_FLUSH_QUEUE is sent to the device and completed when the device sends CMD_FLUSH_QUEUE_RESP.
This causes completion of uninitialized completion if the device sends CMD_FLUSH_QUEUE_RESP before CMD_FLUSH_QUEUE is ever sent (e.g. as a response to a flush by a previously bound driver, or a misbehaving device).
Fix that by initializing flush_comp in kvaser_usb_init_one() like the other completions.
This issue is only triggerable after RX URBs have been set up, i.e. the interface has been opened at least once.
--- drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c | 1 + drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c +1 -0
@@ -690,6 +690,7 @@ static int kvaser_usb_init_one(struct kvinit_usb_anchor (&priv->tx_submitted);init_completion (&priv->start_comp);init_completion (&priv->stop_comp); +init_completion (&priv->flush_comp); priv->can.ctrlmode_supported =0 ; priv->dev = dev;
drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c +1 -1
@@ -1886,7 +1886,7 @@ static int kvaser_usb_hydra_flush_queue( {int err; -init_completion (&priv->flush_comp); +reinit_completion (&priv->flush_comp); err =kvaser_usb_hydra_send_simple_cmd (priv->dev,CMD_FLUSH_QUEUE , priv->channel);
Greg Kroah-Hartman
maintainerPATCH 21/390 can: kvaser_usb_leaf: Fix CAN state after restart
In reply to Greg Kroah-HartmanFrom: Anssi Hannula <[email protected]>
commit 0be1a655fe68c8e6dcadbcbddb69cf2fb29881f5 upstream.
can_restart() expects CMD_START_CHIP to set the error state to ERROR_ACTIVE as it calls netif_carrier_on() immediately afterwards.
Otherwise the user may immediately trigger restart again and hit a BUG_ON() in can_restart().
Fix kvaser_usb_leaf set_mode(CMD_START_CHIP) to set the expected state.
--- drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c +2 -0
@@ -1435,6 +1435,8 @@ static int kvaser_usb_leaf_set_mode(stru err =kvaser_usb_leaf_simple_cmd_async (priv,CMD_START_CHIP );if (err)return err; + + priv->can.state =CAN_STATE_ERROR_ACTIVE ;break ;default :return -EOPNOTSUPP ;
Greg Kroah-Hartman
maintainerPATCH 48/390 fbdev: smscufx: Fix use-after-free in ufx_ops_open()
In reply to Greg Kroah-HartmanFrom: Hyunwoo Kim <[email protected]>
commit 5610bcfe8693c02e2e4c8b31427f1bdbdecc839c upstream.
A race condition may occur if the user physically removes the USB device while calling open() for this device node.
This is a race condition between the ufx_ops_open() function and the ufx_usb_disconnect() function, which may eventually result in UAF.
So, add a mutex to the ufx_ops_open() and ufx_usb_disconnect() functions to avoid race contidion of krefs.
--- drivers/video/fbdev/smscufx.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
drivers/video/fbdev/smscufx.c +13 -1
@@ -137,6 +137,8 @@ static int ufx_submit_urb(struct ufx_datstatic int ufx_alloc_urb_list (struct ufx_data *dev,int count,size_t size);static void ufx_free_urb_list (struct ufx_data *dev); +static DEFINE_MUTEX (disconnect_mutex); +/* reads a control register */ static int ufx_reg_read (struct ufx_data *dev,u32 index,u32 *data) {
@@ -1070,9 +1072,13 @@ static int ufx_ops_open(struct fb_info *if (user ==0 && !console)return -EBUSY ; +mutex_lock (&disconnect_mutex); +/* If the USB device is gone, we don't accept new opens */ -if (dev->virtualized) +if (dev->virtualized) { +mutex_unlock (&disconnect_mutex);return -ENODEV ; + } dev->fb_count++;
@@ -1096,6 +1102,8 @@ static int ufx_ops_open(struct fb_info *pr_debug ("open /dev/fb%d user=%d fb_info=%p count=%d" , info->node, user, info, dev->fb_count); +mutex_unlock (&disconnect_mutex); +return 0 ; }
@@ -1740,6 +1748,8 @@ static void ufx_usb_disconnect(struct us {struct ufx_data *dev; +mutex_lock (&disconnect_mutex); + dev =usb_get_intfdata (interface);pr_debug ("USB disconnect starting\n" );
@@ -1760,6 +1770,8 @@ static void ufx_usb_disconnect(struct uskref_put (&dev->kref, ufx_free);/* consider ufx_data freed */ + +mutex_unlock (&disconnect_mutex); }static struct usb_driver ufx_driver = {
Greg Kroah-Hartman
maintainerPATCH 23/390 fs: dlm: fix race between test_bit() and queue_work()
In reply to Greg Kroah-HartmanFrom: Alexander Aring <[email protected]>
commit eef6ec9bf390e836a6c4029f3620fe49528aa1fe upstream.
This patch fixes a race by using ls_cb_mutex around the bit operations and conditional code blocks for LSFL_CB_DELAY.
The function dlm_callback_stop() expects to stop all callbacks and flush all currently queued onces. The set_bit() is not enough because there can still be queue_work() after the workqueue was flushed. To avoid queue_work() after set_bit(), surround both by ls_cb_mutex.
--- fs/dlm/ast.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
fs/dlm/ast.c +4 -2
@@ -198,13 +198,13 @@ void dlm_add_cb(struct dlm_lkb *lkb, uinif (!prev_seq) {kref_get (&lkb->lkb_ref); +mutex_lock (&ls->ls_cb_mutex);if (test_bit (LSFL_CB_DELAY , &ls->ls_flags)) { -mutex_lock (&ls->ls_cb_mutex);list_add (&lkb->lkb_cb_list, &ls->ls_cb_delay); -mutex_unlock (&ls->ls_cb_mutex); }else {queue_work (ls->ls_callback_wq, &lkb->lkb_cb_work); } +mutex_unlock (&ls->ls_cb_mutex); } out:mutex_unlock (&lkb->lkb_cb_mutex);
@@ -284,7 +284,9 @@ void dlm_callback_stop(struct dlm_ls *lsvoid dlm_callback_suspend (struct dlm_ls *ls) { +mutex_lock (&ls->ls_cb_mutex);set_bit (LSFL_CB_DELAY , &ls->ls_flags); +mutex_unlock (&ls->ls_cb_mutex);if (ls->ls_callback_wq)flush_workqueue (ls->ls_callback_wq);
Greg Kroah-Hartman
maintainerPATCH 69/390 ext4: fix potential memory leak in ext4_fc_record_regions()
In reply to Greg Kroah-HartmanFrom: Ye Bin <[email protected]>
commit 7069d105c1f15c442b68af43f7fde784f3126739 upstream.
As krealloc may return NULL, in this case 'state->fc_regions' may not be freed by krealloc, but 'state->fc_regions' already set NULL. Then will lead to 'state->fc_regions' memory leak.
--- fs/ext4/fast_commit.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
fs/ext4/fast_commit.c +8 -6
@@ -1584,15 +1584,17 @@ int ext4_fc_record_regions(struct super_if (replay && state->fc_regions_used != state->fc_regions_valid) state->fc_regions_used = state->fc_regions_valid;if (state->fc_regions_used == state->fc_regions_size) { +struct ext4_fc_alloc_region *fc_regions; + state->fc_regions_size +=EXT4_FC_REPLAY_REALLOC_INCREMENT ; - state->fc_regions =krealloc ( - state->fc_regions, - state->fc_regions_size * -sizeof (struct ext4_fc_alloc_region ), -GFP_KERNEL ); -if (!state->fc_regions) + fc_regions =krealloc (state->fc_regions, + state->fc_regions_size * +sizeof (struct ext4_fc_alloc_region ), +GFP_KERNEL ); +if (!fc_regions)return -ENOMEM ; + state->fc_regions = fc_regions; } region = &state->fc_regions[state->fc_regions_used++]; region->ino = ino;
Greg Kroah-Hartman
maintainerPATCH 75/390 ring-buffer: Check pending waiters when doing wake ups as well
In reply to Greg Kroah-HartmanFrom: Steven Rostedt (Google) <[email protected]>
commit ec0bbc5ec5664dcee344f79373852117dc672c86 upstream.
The wake up waiters only checks the "wakeup_full" variable and not the "full_waiters_pending". The full_waiters_pending is set when a waiter is added to the wait queue. The wakeup_full is only set when an event is triggered, and it clears the full_waiters_pending to avoid multiple calls to irq_work_queue().
The irq_work callback really needs to check both wakeup_full as well as full_waiters_pending such that this code can be used to wake up waiters when a file is closed that represents the ring buffer and the waiters need to be woken up.
--- kernel/trace/ring_buffer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/trace/ring_buffer.c +2 -1
@@ -794,8 +794,9 @@ static void rb_wake_up_waiters(struct ir struct rb_irq_work *rbwork = container_of(work, struct rb_irq_work, work);wake_up_all (&rbwork->waiters); -if (rbwork->wakeup_full) { +if (rbwork->full_waiters_pending || rbwork->wakeup_full) { rbwork->wakeup_full = false; + rbwork->full_waiters_pending = false;wake_up_all (&rbwork->full_waiters); } }
Greg Kroah-Hartman
maintainerPATCH 63/390 ext4: fix check for block being out of directory size
In reply to Greg Kroah-HartmanFrom: Jan Kara <[email protected]>
commit 61a1d87a324ad5e3ed27c6699dfc93218fcf3201 upstream.
The check in __ext4_read_dirblock() for block being outside of directory size was wrong because it compared block number against directory size in bytes. Fix it.
CVE: CVE-2022-1184
--- fs/ext4/namei.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ext4/namei.c +1 -1
@@ -125,7 +125,7 @@ static struct buffer_head *__ext4_read_dstruct ext4_dir_entry *dirent;int is_dx_block =0 ; -if (block >= inode->i_size) { +if (block >= inode->i_size >> inode->i_blkbits) {ext4_error_inode (inode, func, line, block,"Attempting to read directory block (%u) that is past i_size (%llu)" , block, inode->i_size);
Greg Kroah-Hartman
maintainerPATCH 64/390 ext4: dont increase iversion counter for ea_inodes
In reply to Greg Kroah-HartmanFrom: Lukas Czerner <[email protected]>
commit 50f094a5580e6297bf10a807d16f0ee23fa576cf upstream.
ea_inodes are using i_version for storing part of the reference count so we really need to leave it alone.
The problem can be reproduced by xfstest ext4/026 when iversion is enabled. Fix it by not calling inode_inc_iversion() for EXT4_EA_INODE_FL inodes in ext4_mark_iloc_dirty().
--- fs/ext4/inode.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
fs/ext4/inode.c +6 -1
@@ -5769,7 +5769,12 @@ int ext4_mark_iloc_dirty(handle_t *handl }ext4_fc_track_inode (handle, inode); -if (IS_I_VERSION (inode)) +/* +* ea_inodes are using i_version for storing reference count, don't +* mess with it +*/ +if (IS_I_VERSION (inode) && + !(EXT4_I (inode)->i_flags &EXT4_EA_INODE_FL ))inode_inc_iversion (inode);/* the do_update_inode consumes one bh->b_count */
Greg Kroah-Hartman
maintainerPATCH 74/390 ring-buffer: Have the shortest_full queue be the shortest not longest
In reply to Greg Kroah-HartmanFrom: Steven Rostedt (Google) <[email protected]>
commit 3b19d614b61b93a131f463817e08219c9ce1fee3 upstream.
The logic to know when the shortest waiters on the ring buffer should be woken up or not has uses a less than instead of a greater than compare, which causes the shortest_full to actually be the longest.
--- kernel/trace/ring_buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/trace/ring_buffer.c +1 -1
@@ -888,7 +888,7 @@ int ring_buffer_wait(struct trace_buffer nr_pages = cpu_buffer->nr_pages; dirty =ring_buffer_nr_dirty_pages (buffer, cpu);if (!cpu_buffer->shortest_full || - cpu_buffer->shortest_full < full) + cpu_buffer->shortest_full > full) cpu_buffer->shortest_full = full;raw_spin_unlock_irqrestore (&cpu_buffer->reader_lock, flags); if (!pagebusy &&
Greg Kroah-Hartman
maintainerPATCH 65/390 ext4: ext4_read_bh_lock() should submit IO if the buffer isnt uptodate
In reply to Greg Kroah-HartmanFrom: Zhang Yi <[email protected]>
commit 0b73284c564d3ae4feef4bc920292f004acf4980 upstream.
Recently we notice that ext4 filesystem would occasionally fail to read metadata from disk and report error message, but the disk and block layer looks fine. After analyse, we lockon commit 88dbcbb3a484 ("blkdev: avoid migration stalls for blkdev pages"). It provide a migration method for the bdev, we could move page that has buffers without extra users now, but it lock the buffers on the page, which breaks the fragile metadata read operation on ext4 filesystem, ext4_read_bh_lock() was copied from ll_rw_block(), it depends on the assumption of that locked buffer means it is under IO. So it just trylock the buffer and skip submit IO if it lock failed, after wait_on_buffer() we conclude IO error because the buffer is not uptodate.
This issue could be easily reproduced by add some delay just after buffer_migrate_lock_buffers() in __buffer_migrate_folio() and do fsstress on ext4 filesystem.
EXT4-fs error (device pmem1): __ext4_find_entry:1658: inode #73193:
comm fsstress: reading directory lblock 0
EXT4-fs error (device pmem1): __ext4_find_entry:1658: inode #75334:
comm fsstress: reading directory lblock 0
Fix it by removing the trylock logic in ext4_read_bh_lock(), just lock the buffer and submit IO if it's not uptodate, and also leave over readahead helper.
--- fs/ext4/super.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-)
fs/ext4/super.c +5 -11
@@ -188,19 +188,12 @@ int ext4_read_bh(struct buffer_head *bh,int ext4_read_bh_lock (struct buffer_head *bh,int op_flags,bool wait) { -if (trylock_buffer (bh)) { -if (wait) -return ext4_read_bh (bh, op_flags,NULL ); +lock_buffer (bh); +if (!wait) {ext4_read_bh_nowait (bh, op_flags,NULL );return 0 ; } -if (wait) { -wait_on_buffer (bh); -if (buffer_uptodate (bh)) -return 0 ; -return -EIO ; - } -return 0 ; +return ext4_read_bh (bh, op_flags,NULL ); }/*
@@ -247,7 +240,8 @@ void ext4_sb_breadahead_unmovable(structstruct buffer_head *bh =sb_getblk_gfp (sb, block,0 );if (likely (bh)) { -ext4_read_bh_lock (bh,REQ_RAHEAD , false); +if (trylock_buffer (bh)) +ext4_read_bh_nowait (bh,REQ_RAHEAD ,NULL );brelse (bh); } }
Greg Kroah-Hartman
maintainerPATCH 70/390 ext4: update state->fc_regions_size after successful memory allocation
In reply to Greg Kroah-HartmanFrom: Ye Bin <[email protected]>
commit 27cd49780381c6ccbf248798e5e8fd076200ffba upstream.
To avoid to 'state->fc_regions_size' mismatch with 'state->fc_regions' when fail to reallocate 'fc_reqions',only update 'state->fc_regions_size' after 'state->fc_regions' is allocated successfully.
--- fs/ext4/fast_commit.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
fs/ext4/fast_commit.c +5 -4
@@ -1586,14 +1586,15 @@ int ext4_fc_record_regions(struct super_if (state->fc_regions_used == state->fc_regions_size) {struct ext4_fc_alloc_region *fc_regions; - state->fc_regions_size += -EXT4_FC_REPLAY_REALLOC_INCREMENT ; fc_regions =krealloc (state->fc_regions, - state->fc_regions_size * -sizeof (struct ext4_fc_alloc_region ), +sizeof (struct ext4_fc_alloc_region ) * + (state->fc_regions_size + +EXT4_FC_REPLAY_REALLOC_INCREMENT ),GFP_KERNEL );if (!fc_regions)return -ENOMEM ; + state->fc_regions_size += +EXT4_FC_REPLAY_REALLOC_INCREMENT ; state->fc_regions = fc_regions; } region = &state->fc_regions[state->fc_regions_used++];
Greg Kroah-Hartman
maintainerPATCH 53/390 hardening: Clarify Kconfig text for auto-var-init
In reply to Greg Kroah-HartmanFrom: Kees Cook <[email protected]>
commit dcb7c0b9461c2a30f6616262736daac6f01ecb09 upstream.
Clarify the details around the automatic variable initialization modes available. Specifically this details the values used for pattern init and expands on the rationale for zero init safety. Additionally makes zero init the default when available.
--- security/Kconfig.hardening | 52 +++++++++++++++++++++++++++------------------ 1 file changed, 32 insertions(+), 20 deletions(-)
security/Kconfig.hardening +32 -20
@@ -29,6 +29,7 @@ choice prompt "Initialize kernel stack variables at function entry" default GCC_PLUGIN_STRUCTLEAK_BYREF_ALL if COMPILE_TEST && GCC_PLUGINS default INIT_STACK_ALL_PATTERN if COMPILE_TEST && CC_HAS_AUTO_VAR_INIT_PATTERN + default INIT_STACK_ALL_ZERO if CC_HAS_AUTO_VAR_INIT_PATTERN default INIT_STACK_NONE help This option enables initialization of stack variables at
@@ -39,11 +40,11 @@ choice syscalls. This chooses the level of coverage over classes of potentially - uninitialized variables. The selected class will be + uninitialized variables. The selected class of variable will be initialized before use in a function. config INIT_STACK_NONE - bool "no automatic initialization (weakest)" + bool "no automatic stack variable initialization (weakest)" help Disable automatic stack variable initialization. This leaves the kernel vulnerable to the standard
@@ -80,7 +81,7 @@ choice and is disallowed. config GCC_PLUGIN_STRUCTLEAK_BYREF_ALL - bool "zero-init anything passed by reference (very strong)" + bool "zero-init everything passed by reference (very strong)" depends on GCC_PLUGINS depends on !(KASAN && KASAN_STACK=1) select GCC_PLUGIN_STRUCTLEAK
@@ -91,33 +92,44 @@ choice of uninitialized stack variable exploits and information exposures. + As a side-effect, this keeps a lot of variables on the + stack that can otherwise be optimized out, so combining + this with CONFIG_KASAN_STACK can lead to a stack overflow + and is disallowed. + config INIT_STACK_ALL_PATTERN - bool "0xAA-init everything on the stack (strongest)" + bool "pattern-init everything (strongest)" depends on CC_HAS_AUTO_VAR_INIT_PATTERN help - Initializes everything on the stack with a 0xAA - pattern. This is intended to eliminate all classes - of uninitialized stack variable exploits and information - exposures, even variables that were warned to have been - left uninitialized. + Initializes everything on the stack (including padding) + with a specific debug value. This is intended to eliminate + all classes of uninitialized stack variable exploits and + information exposures, even variables that were warned about + having been left uninitialized. Pattern initialization is known to provoke many existing bugs related to uninitialized locals, e.g. pointers receive - non-NULL values, buffer sizes and indices are very big. + non-NULL values, buffer sizes and indices are very big. The + pattern is situation-specific; Clang on 64-bit uses 0xAA + repeating for all types and padding except float and double + which use 0xFF repeating (-NaN). Clang on 32-bit uses 0xFF + repeating for all types and padding. config INIT_STACK_ALL_ZERO - bool "zero-init everything on the stack (strongest and safest)" + bool "zero-init everything (strongest and safest)" depends on CC_HAS_AUTO_VAR_INIT_ZERO help - Initializes everything on the stack with a zero - value. This is intended to eliminate all classes - of uninitialized stack variable exploits and information - exposures, even variables that were warned to have been - left uninitialized. - - Zero initialization provides safe defaults for strings, - pointers, indices and sizes, and is therefore - more suitable as a security mitigation measure. + Initializes everything on the stack (including padding) + with a zero value. This is intended to eliminate all + classes of uninitialized stack variable exploits and + information exposures, even variables that were warned + about having been left uninitialized. + + Zero initialization provides safe defaults for strings + (immediately NUL-terminated), pointers (NULL), indices + (index 0), and sizes (0 length), so it is therefore more + suitable as a production security mitigation than pattern + initialization. endchoice
Greg Kroah-Hartman
maintainerPATCH 50/390 f2fs: increase the limit for reserve_root
In reply to Greg Kroah-HartmanFrom: Jaegeuk Kim <[email protected]>
commit da35fe96d12d15779f3cb74929b7ed03941cf983 upstream.
This patch increases the threshold that limits the reserved root space from 0.2% to 12.5% by using simple shift operation.
Typically Android sets 128MB, but if the storage capacity is 32GB, 0.2% which is around 64MB becomes too small. Let's relax it.
--- fs/f2fs/super.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/f2fs/super.c +2 -2
@@ -267,10 +267,10 @@ static int f2fs_sb_read_encoding(const sstatic inline void limit_reserve_root (struct f2fs_sb_info *sbi) { -block_t limit =min ((sbi->user_block_count <<1 ) /1000 , +block_t limit =min ((sbi->user_block_count >>3 ), sbi->user_block_count - sbi->reserved_blocks); -/* limit is 0.2% */ +/* limit is 12.5% */ if (test_opt (sbi,RESERVE_ROOT ) &&F2FS_OPTION (sbi).root_reserved_blocks > limit) {F2FS_OPTION (sbi).root_reserved_blocks = limit;
Greg Kroah-Hartman
maintainerPATCH 79/390 thunderbolt: Explicitly enable lane adapter hotplug events at startup
In reply to Greg Kroah-HartmanFrom: Mario Limonciello <[email protected]>
commit 5d2569cb4a65c373896ec0217febdf88739ed295 upstream.
Software that has run before the USB4 CM in Linux runs may have disabled hotplug events for a given lane adapter.
Other CMs such as that one distributed with Windows 11 will enable hotplug events. Do the same thing in the Linux CM which fixes hotplug events on "AMD Pink Sardine".
--- drivers/thunderbolt/switch.c | 24 ++++++++++++++++++++++++ drivers/thunderbolt/tb.h | 1 + drivers/thunderbolt/tb_regs.h | 1 + drivers/thunderbolt/usb4.c | 20 ++++++++++++++++++++ 4 files changed, 46 insertions(+)
drivers/thunderbolt/switch.c +24 -0
@@ -2413,6 +2413,26 @@ void tb_switch_unconfigure_link(struct ttb_lc_unconfigure_port (down); } +static int tb_switch_port_hotplug_enable (struct tb_switch *sw) +{ +struct tb_port *port; + +if (tb_switch_is_icm (sw)) +return 0 ; + +tb_switch_for_each_port (sw, port) { +int res; + +if (!port->cap_usb4) +continue ; + + res =usb4_port_hotplug_enable (port); +if (res) +return res; + } +return 0 ; +} +/** * tb_switch_add() - Add a switch to the domain * @sw: Switch to add
@@ -2480,6 +2500,10 @@ int tb_switch_add(struct tb_switch *sw)return ret; } + ret =tb_switch_port_hotplug_enable (sw); +if (ret) +return ret; + ret =device_add (&sw->dev);if (ret) {dev_err (&sw->dev,"failed to add device: %d\n" , ret);
drivers/thunderbolt/tb.h +1 -0
@@ -979,6 +979,7 @@ struct tb_port *usb4_switch_map_usb3_dow const struct tb_port *port);int usb4_port_unlock (struct tb_port *port); +int usb4_port_hotplug_enable (struct tb_port *port);int usb4_port_configure (struct tb_port *port);void usb4_port_unconfigure (struct tb_port *port);int usb4_port_configure_xdomain (struct tb_port *port);
drivers/thunderbolt/tb_regs.h +1 -0
@@ -285,6 +285,7 @@ struct tb_regs_port_header {#define ADP_CS_5 0x05#define ADP_CS_5_LCA_MASK GENMASK(28, 22)#define ADP_CS_5_LCA_SHIFT 22 +#define ADP_CS_5_DHP BIT(31)/* TMU adapter registers */ #define TMU_ADP_CS_3 0x03
drivers/thunderbolt/usb4.c +20 -0
@@ -854,6 +854,26 @@ int usb4_port_unlock(struct tb_port *porreturn tb_port_write (port, &val,TB_CFG_PORT ,ADP_CS_4 ,1 ); } +/** +* usb4_port_hotplug_enable() - Enables hotplug for a port +* @port: USB4 port to operate on +* +* Enables hot plug events on a given port. This is only intended +* to be used on lane, DP-IN, and DP-OUT adapters. +*/ +int usb4_port_hotplug_enable (struct tb_port *port) +{ +int ret; +u32 val; + + ret =tb_port_read (port, &val,TB_CFG_PORT ,ADP_CS_5 ,1 ); +if (ret) +return ret; + + val &= ~ADP_CS_5_DHP ; +return tb_port_write (port, &val,TB_CFG_PORT ,ADP_CS_5 ,1 ); +} +static int usb4_port_set_configured (struct tb_port *port,bool configured) {int ret;
Greg Kroah-Hartman
maintainerPATCH 91/390 selinux: use "grep -E" instead of "egrep"
In reply to Greg Kroah-HartmanFrom: Greg Kroah-Hartman <[email protected]>
commit c969bb8dbaf2f3628927eae73e7c579a74cf1b6e upstream.
The latest version of grep claims that egrep is now obsolete so the build now contains warnings that look like:
egrep: warning: egrep is obsolescent; using grep -E
fix this by using "grep -E" instead.
--- scripts/selinux/install_policy.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/selinux/install_policy.sh +1 -1
@@ -78,7 +78,7 @@ cd /etc/selinux/dummy/contexts/files $SF -F file_contexts / mounts=`cat /proc/$$/mounts | \ - egrep "ext[234]|jfs|xfs|reiserfs|jffs2|gfs2|btrfs|f2fs|ocfs2" | \ + grep -E "ext[234]|jfs|xfs|reiserfs|jffs2|gfs2|btrfs|f2fs|ocfs2" | \ awk '{ print $2 '}` $SF -F file_contexts $mounts
Greg Kroah-Hartman
maintainerPATCH 51/390 f2fs: fix to do sanity check on destination blkaddr during recovery
In reply to Greg Kroah-HartmanFrom: Chao Yu <[email protected]>
commit 0ef4ca04a3f9223ff8bc440041c524b2123e09a3 upstream.
As Wenqing Liu reported in bugzilla:
https://bugzilla.kernel.org/show_bug.cgi?id=216456
loop5: detected capacity change from 0 to 131072 F2FS-fs (loop5): recover_inode: ino = 6, name = hln, inline = 1 F2FS-fs (loop5): recover_data: ino = 6 (i_size: recover) err = 0 F2FS-fs (loop5): recover_inode: ino = 6, name = hln, inline = 1 F2FS-fs (loop5): recover_data: ino = 6 (i_size: recover) err = 0 F2FS-fs (loop5): recover_inode: ino = 6, name = hln, inline = 1 F2FS-fs (loop5): recover_data: ino = 6 (i_size: recover) err = 0 F2FS-fs (loop5): Bitmap was wrongly set, blk:5634
------------[ cut here ]------------ WARNING: CPU: 3 PID: 1013 at fs/f2fs/segment.c:2198 RIP: 0010:update_sit_entry+0xa55/0x10b0 [f2fs] Call Trace: <TASK> f2fs_do_replace_block+0xa98/0x1890 [f2fs] f2fs_replace_block+0xeb/0x180 [f2fs] recover_data+0x1a69/0x6ae0 [f2fs] f2fs_recover_fsync_data+0x120d/0x1fc0 [f2fs] f2fs_fill_super+0x4665/0x61e0 [f2fs] mount_bdev+0x2cf/0x3b0 legacy_get_tree+0xed/0x1d0 vfs_get_tree+0x81/0x2b0 path_mount+0x47e/0x19d0 do_mount+0xce/0xf0 __x64_sys_mount+0x12c/0x1a0 do_syscall_64+0x38/0x90 entry_SYSCALL_64_after_hwframe+0x63/0xcd
If we enable CONFIG_F2FS_CHECK_FS config, it will trigger a kernel panic instead of warning.
The root cause is: in fuzzed image, SIT table is inconsistent with inode mapping table, result in triggering such warning during SIT table update.
This patch introduces a new flag DATA_GENERIC_ENHANCE_UPDATE, w/ this flag, data block recovery flow can check destination blkaddr's validation in SIT table, and skip f2fs_replace_block() to avoid inconsistent status.
--- fs/f2fs/checkpoint.c | 10 +++++++++- fs/f2fs/f2fs.h | 4 ++++ fs/f2fs/recovery.c | 8 ++++++++ 3 files changed, 21 insertions(+), 1 deletion(-)
fs/f2fs/checkpoint.c +9 -1
@@ -136,7 +136,7 @@ static bool __is_bitmap_valid(struct f2funsigned int segno, offset;bool exist; -if (type !=DATA_GENERIC_ENHANCE && type !=DATA_GENERIC_ENHANCE_READ ) +if (type ==DATA_GENERIC )return true; segno =GET_SEGNO (sbi, blkaddr);
@@ -144,6 +144,13 @@ static bool __is_bitmap_valid(struct f2f se =get_seg_entry (sbi, segno); exist =f2fs_test_bit (offset, se->cur_valid_map); +if (exist && type ==DATA_GENERIC_ENHANCE_UPDATE ) { +f2fs_err (sbi,"Inconsistent error blkaddr:%u, sit bitmap:%d" , + blkaddr, exist); +set_sbi_flag (sbi,SBI_NEED_FSCK ); +return exist; + } +if (!exist && type ==DATA_GENERIC_ENHANCE ) {f2fs_err (sbi,"Inconsistent error blkaddr:%u, sit bitmap:%d" , blkaddr, exist);
@@ -181,6 +188,7 @@ bool f2fs_is_valid_blkaddr(struct f2fs_scase DATA_GENERIC :case DATA_GENERIC_ENHANCE :case DATA_GENERIC_ENHANCE_READ : +case DATA_GENERIC_ENHANCE_UPDATE :if (unlikely (blkaddr >=MAX_BLKADDR (sbi) || blkaddr <MAIN_BLKADDR (sbi))) { f2fs_warn(sbi, "access invalid blkaddr:%u",
fs/f2fs/f2fs.h +4 -0
@@ -235,6 +235,10 @@ enum {* condition of read on truncated area * by extent_cache */ +DATA_GENERIC_ENHANCE_UPDATE ,/* +* strong check on range and segment +* bitmap for update case +*/ META_GENERIC, };
fs/f2fs/recovery.c +8 -0
@@ -661,6 +661,14 @@ retry_prev: goto err; } +if (f2fs_is_valid_blkaddr (sbi, dest, +DATA_GENERIC_ENHANCE_UPDATE )) { +f2fs_err (sbi,"Inconsistent dest blkaddr:%u, ino:%lu, ofs:%u" , + dest, inode->i_ino, dn.ofs_in_node); + err = -EFSCORRUPTED ; + goto err; + } +/* write dummy data page */ f2fs_replace_block (sbi, &dn, src, dest, ni.version, false, false);
Greg Kroah-Hartman
maintainerPATCH 90/390 smb3: must initialize two ACL struct fields to zero
In reply to Greg Kroah-HartmanFrom: Steve French <[email protected]>
commit f09bd695af3b8ab46fc24e5d6954a24104c38387 upstream.
Coverity spotted that we were not initalizing Stbz1 and Stbz2 to zero in create_sd_buf.
Addresses-Coverity: 1513848 ("Uninitialized scalar variable")
--- fs/cifs/smb2pdu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/cifs/smb2pdu.c +2 -1
@@ -2294,7 +2294,7 @@ create_sd_buf(umode_t mode, bool set_ownunsigned int acelen, acl_size, ace_count;unsigned int owner_offset =0 ;unsigned int group_offset =0 ; -struct smb3_acl acl; +struct smb3_acl acl = {}; *len =roundup (sizeof (struct crt_sd_ctxt ) + (sizeof (struct cifs_ace ) *4 ),8 );
@@ -2367,6 +2367,7 @@ create_sd_buf(umode_t mode, bool set_own acl.AclRevision =ACL_REVISION ;/* See 2.4.4.1 of MS-DTYP */ acl.AclSize =cpu_to_le16 (acl_size); acl.AceCount =cpu_to_le16 (ace_count); +/* acl.Sbz1 and Sbz2 MBZ so are not set here, but initialized above */ memcpy (aclptr, &acl,sizeof (struct smb3_acl )); buf->ccontext.DataLength =cpu_to_le32 (ptr - (__u8 *)&buf->sd);
Greg Kroah-Hartman
maintainerPATCH 77/390 ring-buffer: Fix race between reset page and reading page
In reply to Greg Kroah-HartmanFrom: Steven Rostedt (Google) <[email protected]>
commit a0fcaaed0c46cf9399d3a2d6e0c87ddb3df0e044 upstream.
The ring buffer is broken up into sub buffers (currently of page size). Each sub buffer has a pointer to its "tail" (the last event written to the sub buffer). When a new event is requested, the tail is locally incremented to cover the size of the new event. This is done in a way that there is no need for locking.
If the tail goes past the end of the sub buffer, the process of moving to the next sub buffer takes place. After setting the current sub buffer to the next one, the previous one that had the tail go passed the end of the sub buffer needs to be reset back to the original tail location (before the new event was requested) and the rest of the sub buffer needs to be "padded".
The race happens when a reader takes control of the sub buffer. As readers do a "swap" of sub buffers from the ring buffer to get exclusive access to the sub buffer, it replaces the "head" sub buffer with an empty sub buffer that goes back into the writable portion of the ring buffer. This swap can happen as soon as the writer moves to the next sub buffer and before it updates the last sub buffer with padding.
Because the sub buffer can be released to the reader while the writer is still updating the padding, it is possible for the reader to see the event that goes past the end of the sub buffer. This can cause obvious issues.
To fix this, add a few memory barriers so that the reader definitely sees the updates to the sub buffer, and also waits until the writer has put back the "tail" of the sub buffer back to the last event that was written on it.
To be paranoid, it will only spin for 1 second, otherwise it will warn and shutdown the ring buffer code. 1 second should be enough as the writer does have preemption disabled. If the writer doesn't move within 1 second (with preemption disabled) something is horribly wrong. No interrupt should last 1 second!
--- kernel/trace/ring_buffer.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+)
kernel/trace/ring_buffer.c +33 -0
@@ -2531,6 +2531,9 @@ rb_reset_tail(struct ring_buffer_per_cpu/* Mark the rest of the page with padding */ rb_event_set_padding (event); +/* Make sure the padding is visible before the write update */ +smp_wmb (); +/* Set the write back to the previous setting */ local_sub (length, &tail_page->write);return ;
@@ -2542,6 +2545,9 @@ rb_reset_tail(struct ring_buffer_per_cpu/* time delta must be non zero */ event->time_delta =1 ; +/* Make sure the padding is visible before the tail_page->write update */ +smp_wmb (); +/* Set write to end of buffer */ length = (tail + length) -BUF_PAGE_SIZE ;local_sub (length, &tail_page->write);
@@ -4356,6 +4362,33 @@ rb_get_reader_page(struct ring_buffer_pearch_spin_unlock (&cpu_buffer->lock);local_irq_restore (flags); +/* +* The writer has preempt disable, wait for it. But not forever +* Although, 1 second is pretty much "forever" +*/ +#define USECS_WAIT 1000000 +for (nr_loops =0 ; nr_loops <USECS_WAIT ; nr_loops++) { +/* If the write is past the end of page, a writer is still updating it */ +if (likely (!reader ||rb_page_write (reader) <=BUF_PAGE_SIZE )) +break ; + +udelay (1 ); + +/* Get the latest version of the reader write value */ +smp_rmb (); + } + +/* The writer is not moving forward? Something is wrong */ +if (RB_WARN_ON (cpu_buffer, nr_loops ==USECS_WAIT )) + reader =NULL ; + +/* +* Make sure we see any padding after the write update +* (see rb_reset_tail()) +*/ +smp_rmb (); + +return reader; }
Greg Kroah-Hartman
maintainerPATCH 95/390 MIPS: SGI-IP27: Fix platform-device leak in bridge_platform_create()
In reply to Greg Kroah-HartmanFrom: Lin Yujun <[email protected]>
[ Upstream commit 11bec9cba4de06b3c0e9e4041453c2caaa1cbec1 ]
In error case in bridge_platform_create after calling platform_device_add()/platform_device_add_data()/ platform_device_add_resources(), release the failed 'pdev' or it will be leak, call platform_device_put() to fix this problem.
Besides, 'pdev' is divided into 'pdev_wd' and 'pdev_bd', use platform_device_unregister() to release sgi_w1 resources when xtalk-bridge registration fails.
--- arch/mips/sgi-ip27/ip27-xtalk.c | 70 +++++++++++++++++++++++---------- 1 file changed, 50 insertions(+), 20 deletions(-)
arch/mips/sgi-ip27/ip27-xtalk.c +50 -20
@@ -27,15 +27,18 @@ static void bridge_platform_create(nasid_t nasid, int widget, int masterwid) {struct xtalk_bridge_platform_data *bd;struct sgi_w1_platform_data *wd; -struct platform_device *pdev; +struct platform_device *pdev_wd; +struct platform_device *pdev_bd;struct resource w1_res;unsigned long offset; offset =NODE_OFFSET (nasid); wd =kzalloc (sizeof (*wd),GFP_KERNEL ); -if (!wd) - goto no_mem; +if (!wd) { +pr_warn ("xtalk:n%d/%x bridge create out of memory\n" , nasid, widget); +return ; + }snprintf (wd->dev_id,sizeof (wd->dev_id),"bridge-%012lx" , offset + (widget <<SWIN_SIZE_BITS ));
@@ -46,24 +49,35 @@ static void bridge_platform_create(nasid_t nasid, int widget, int masterwid) w1_res.end = w1_res.start +3 ; w1_res.flags =IORESOURCE_MEM ; - pdev =platform_device_alloc ("sgi_w1" ,PLATFORM_DEVID_AUTO ); -if (!pdev) { -kfree (wd); - goto no_mem; + pdev_wd =platform_device_alloc ("sgi_w1" ,PLATFORM_DEVID_AUTO ); +if (!pdev_wd) { +pr_warn ("xtalk:n%d/%x bridge create out of memory\n" , nasid, widget); + goto err_kfree_wd; + } +if (platform_device_add_resources (pdev_wd, &w1_res,1 )) { +pr_warn ("xtalk:n%d/%x bridge failed to add platform resources.\n" , nasid, widget); + goto err_put_pdev_wd; + } +if (platform_device_add_data (pdev_wd, wd,sizeof (*wd))) { +pr_warn ("xtalk:n%d/%x bridge failed to add platform data.\n" , nasid, widget); + goto err_put_pdev_wd; + } +if (platform_device_add (pdev_wd)) { +pr_warn ("xtalk:n%d/%x bridge failed to add platform device.\n" , nasid, widget); + goto err_put_pdev_wd; } -platform_device_add_resources (pdev, &w1_res,1 ); -platform_device_add_data (pdev, wd,sizeof (*wd));/* platform_device_add_data() duplicates the data */ kfree (wd); -platform_device_add (pdev); bd =kzalloc (sizeof (*bd),GFP_KERNEL ); -if (!bd) - goto no_mem; - pdev =platform_device_alloc ("xtalk-bridge" ,PLATFORM_DEVID_AUTO ); -if (!pdev) { -kfree (bd); - goto no_mem; +if (!bd) { +pr_warn ("xtalk:n%d/%x bridge create out of memory\n" , nasid, widget); + goto err_unregister_pdev_wd; + } + pdev_bd =platform_device_alloc ("xtalk-bridge" ,PLATFORM_DEVID_AUTO ); +if (!pdev_bd) { +pr_warn ("xtalk:n%d/%x bridge create out of memory\n" , nasid, widget); + goto err_kfree_bd; }
@@ -84,15 +98,31 @@ static void bridge_platform_create(nasid_t nasid, int widget, int masterwid) bd->io.flags =IORESOURCE_IO ; bd->io_offset = offset; -platform_device_add_data (pdev, bd,sizeof (*bd)); +if (platform_device_add_data (pdev_bd, bd,sizeof (*bd))) { +pr_warn ("xtalk:n%d/%x bridge failed to add platform data.\n" , nasid, widget); + goto err_put_pdev_bd; + } +if (platform_device_add (pdev_bd)) { +pr_warn ("xtalk:n%d/%x bridge failed to add platform device.\n" , nasid, widget); + goto err_put_pdev_bd; + }/* platform_device_add_data() duplicates the data */ kfree (bd); -platform_device_add (pdev);pr_info ("xtalk:n%d/%x bridge widget\n" , nasid, widget);return ; -no_mem: -pr_warn ("xtalk:n%d/%x bridge create out of memory\n" , nasid, widget); +err_put_pdev_bd: +platform_device_put (pdev_bd); +err_kfree_bd: +kfree (bd); +err_unregister_pdev_wd: +platform_device_unregister (pdev_wd); +return ; +err_put_pdev_wd: +platform_device_put (pdev_wd); +err_kfree_wd: +kfree (wd); +return ; }static int probe_one_port (nasid_t nasid,int widget,int masterwid)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 52/390 f2fs: fix to do sanity check on summary info
In reply to Greg Kroah-HartmanFrom: Chao Yu <[email protected]>
commit c6ad7fd16657ebd34a87a97d9588195aae87597d upstream.
As Wenqing Liu reported in bugzilla:
https://bugzilla.kernel.org/show_bug.cgi?id=216456
BUG: KASAN: use-after-free in recover_data+0x63ae/0x6ae0 [f2fs] Read of size 4 at addr ffff8881464dcd80 by task mount/1013 CPU: 3 PID: 1013 Comm: mount Tainted: G W 6.0.0-rc4 #1 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.15.0-1 04/01/2014 Call Trace: dump_stack_lvl+0x45/0x5e print_report.cold+0xf3/0x68d kasan_report+0xa8/0x130 recover_data+0x63ae/0x6ae0 [f2fs] f2fs_recover_fsync_data+0x120d/0x1fc0 [f2fs] f2fs_fill_super+0x4665/0x61e0 [f2fs] mount_bdev+0x2cf/0x3b0 legacy_get_tree+0xed/0x1d0 vfs_get_tree+0x81/0x2b0 path_mount+0x47e/0x19d0 do_mount+0xce/0xf0 __x64_sys_mount+0x12c/0x1a0 do_syscall_64+0x38/0x90 entry_SYSCALL_64_after_hwframe+0x63/0xcd
The root cause is: in fuzzed image, SSA table is corrupted: ofs_in_node is larger than ADDRS_PER_PAGE(), result in out-of-range access on 4k-size page.
- recover_data
- do_recover_data
- check_index_in_prev_nodes
- f2fs_data_blkaddr
This patch adds sanity check on summary info in recovery and GC flow in where the flows rely on them.
After patch:
[ 29.310883] F2FS-fs (loop0): Inconsistent ofs_in_node:65286 in summary, ino:0, nid:6, max:1018
--- fs/f2fs/gc.c | 10 +++++++++- fs/f2fs/recovery.c | 15 ++++++++++++--- 2 files changed, 21 insertions(+), 4 deletions(-)
fs/f2fs/gc.c +9 -1
@@ -977,7 +977,7 @@ static bool is_alive(struct f2fs_sb_info {struct page *node_page;nid_t nid; -unsigned int ofs_in_node; +unsigned int ofs_in_node, max_addrs;block_t source_blkaddr; nid =le32_to_cpu (sum->nid);
@@ -1003,6 +1003,14 @@ static bool is_alive(struct f2fs_sb_inforeturn false; } + max_addrs =IS_INODE (node_page) ?DEF_ADDRS_PER_INODE : +DEF_ADDRS_PER_BLOCK ; +if (ofs_in_node >= max_addrs) { +f2fs_err (sbi,"Inconsistent ofs_in_node:%u in summary, ino:%u, nid:%u, max:%u" , + ofs_in_node, dni->ino, dni->nid, max_addrs); +return false; + } + *nofs =ofs_of_node (node_page); source_blkaddr =data_blkaddr (NULL , node_page, ofs_in_node);f2fs_put_page (node_page,1 );
fs/f2fs/recovery.c +12 -3
@@ -437,7 +437,7 @@ static int check_index_in_prev_nodes(strstruct dnode_of_data tdn = *dn;nid_t ino, nid;struct inode *inode; -unsigned int offset; +unsigned int offset, ofs_in_node, max_addrs;block_t bidx;int i;
@@ -463,15 +463,24 @@ static int check_index_in_prev_nodes(str got_it:/* Use the locked dnode page and inode */ nid =le32_to_cpu (sum.nid); + ofs_in_node =le16_to_cpu (sum.ofs_in_node); + + max_addrs =ADDRS_PER_PAGE (dn->node_page, dn->inode); +if (ofs_in_node >= max_addrs) { +f2fs_err (sbi,"Inconsistent ofs_in_node:%u in summary, ino:%lu, nid:%u, max:%u" , + ofs_in_node, dn->inode->i_ino, nid, max_addrs); +return -EFSCORRUPTED ; + } +if (dn->inode->i_ino == nid) { tdn.nid = nid;if (!dn->inode_page_locked)lock_page (dn->inode_page); tdn.node_page = dn->inode_page; - tdn.ofs_in_node =le16_to_cpu (sum.ofs_in_node); + tdn.ofs_in_node = ofs_in_node; goto truncate_out; }else if (dn->nid == nid) { - tdn.ofs_in_node =le16_to_cpu (sum.ofs_in_node); + tdn.ofs_in_node = ofs_in_node; goto truncate_out; }
Greg Kroah-Hartman
maintainerPATCH 92/390 userfaultfd: open userfaultfds with O_RDONLY
In reply to Greg Kroah-HartmanFrom: Ondrej Mosnacek <[email protected]>
[ Upstream commit abec3d015fdfb7c63105c7e1c956188bf381aa55 ]
Since userfaultfd doesn't implement a write operation, it is more appropriate to open it read-only.
When userfaultfds are opened read-write like it is now, and such fd is passed from one process to another, SELinux will check both read and write permissions for the target process, even though it can't actually do any write operation on the fd later.
Inspired by the following bug report, which has hit the SELinux scenario described above:
https://bugzilla.redhat.com/show_bug.cgi?id=1974559
--- fs/userfaultfd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/userfaultfd.c +2 -2
@@ -974,7 +974,7 @@ static int resolve_userfault_fork(struct userfaultfd_ctx *ctx,int fd; fd =anon_inode_getfd ("[userfaultfd]" , &userfaultfd_fops, new, -O_RDWR | (new->flags &UFFD_SHARED_FCNTL_FLAGS )); +O_RDONLY | (new->flags &UFFD_SHARED_FCNTL_FLAGS ));if (fd <0 )return fd;
@@ -1987,7 +1987,7 @@ SYSCALL_DEFINE1(userfaultfd, int, flags)mmgrab (ctx->mm); fd =anon_inode_getfd ("[userfaultfd]" , &userfaultfd_fops, ctx, -O_RDWR | (flags &UFFD_SHARED_FCNTL_FLAGS )); +O_RDONLY | (flags &UFFD_SHARED_FCNTL_FLAGS ));if (fd <0 ) {mmdrop (ctx->mm);kmem_cache_free (userfaultfd_ctx_cachep, ctx);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 99/390 nfsd: Fix a memory leak in an error handling path
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit fd1ef88049de09bc70d60b549992524cfc0e66ff ]
If this memdup_user() call fails, the memory allocated in a previous call a few lines above should be freed. Otherwise it leaks.
--- fs/nfsd/nfs4recover.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/nfsd/nfs4recover.c +3 -1
@@ -815,8 +815,10 @@ __cld_pipe_inprogress_downcall(const struct cld_msg_v2 __user *cmsg, princhash.data =memdup_user ( &ci->cc_princhash.cp_data, princhashlen); -if (IS_ERR_OR_NULL (princhash.data)) +if (IS_ERR_OR_NULL (princhash.data)) { +kfree (name.data);return -EFAULT ; + } princhash.len = princhashlen; }else princhash.len =0 ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 93/390 sh: machvec: Use char[] for section boundaries
In reply to Greg Kroah-HartmanFrom: Kees Cook <[email protected]>
[ Upstream commit c5783af354688b24abd359f7086c282ec74de993 ]
As done for other sections, define the extern as a character array, which relaxes many of the compiler-time object size checks, which would otherwise assume it's a single long. Solves the following build error:
arch/sh/kernel/machvec.c: error: array subscript 'struct sh_machine_vector[0]' is partly outside array bounds of 'long int[1]' [-Werror=array-bounds]: => 105:33
--- arch/sh/include/asm/sections.h | 2 +- arch/sh/kernel/machvec.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-)
arch/sh/include/asm/sections.h +1 -1
@@ -4,7 +4,7 @@#include <asm-generic/sections.h> -extern long __machvec_start, __machvec_end; +extern char __machvec_start[], __machvec_end[];extern char __uncached_start, __uncached_end;extern char __start_eh_frame[], __stop_eh_frame[];
arch/sh/kernel/machvec.c +5 -5
@@ -20,8 +20,8 @@#define MV_NAME_SIZE 32#define for_each_mv (mv) \ - for ((mv) = (struct sh_machine_vector *)&__machvec_start; \ - (mv) && (unsigned long)(mv) < (unsigned long)&__machvec_end; \ + for ((mv) = (struct sh_machine_vector *)__machvec_start; \ + (mv) && (unsigned long)(mv) < (unsigned long)__machvec_end; \ (mv)++)static struct sh_machine_vector *__init get_mv_byname (const char *name)
@@ -87,8 +87,8 @@ void __init sh_mv_setup(void)if (!machvec_selected) {unsigned long machvec_size; - machvec_size = ((unsigned long )&__machvec_end - - (unsigned long )&__machvec_start); + machvec_size = ((unsigned long )__machvec_end - + (unsigned long )__machvec_start);/* * Sanity check for machvec section alignment. Ensure
@@ -102,7 +102,7 @@ void __init sh_mv_setup(void)* vector (usually the only one) from .machvec.init. */ if (machvec_size >=sizeof (struct sh_machine_vector )) - sh_mv = *(struct sh_machine_vector *)&__machvec_start; + sh_mv = *(struct sh_machine_vector *)__machvec_start; }pr_notice ("Booting machvec: %s\n" ,get_system_type ());
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 108/390 Bluetooth: btusb: mediatek: fix WMT failure during runtime suspend
In reply to Greg Kroah-HartmanFrom: Sean Wang <[email protected]>
[ Upstream commit fd3f106677bac70437dc12e76c827294ed495a44 ]
WMT cmd/event doesn't follow up the generic HCI cmd/event handling, it needs constantly polling control pipe until the host received the WMT event, thus, we should require to specifically acquire PM counter on the USB to prevent the interface from entering auto suspended while WMT cmd/event in progress.
--- drivers/bluetooth/btusb.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
drivers/bluetooth/btusb.c +14 -0
@@ -3033,15 +3033,29 @@ static int btusb_mtk_hci_wmt_sync(struct hci_dev *hdev,set_bit (BTUSB_TX_WAIT_VND_EVT , &data->flags); +/* WMT cmd/event doesn't follow up the generic HCI cmd/event handling, +* it needs constantly polling control pipe until the host received the +* WMT event, thus, we should require to specifically acquire PM counter +* on the USB to prevent the interface from entering auto suspended +* while WMT cmd/event in progress. +*/ + err =usb_autopm_get_interface (data->intf); +if (err <0 ) + goto err_free_wc; + err =__hci_cmd_send (hdev,0xfc6f , hlen, wc);if (err <0 ) {clear_bit (BTUSB_TX_WAIT_VND_EVT , &data->flags); +usb_autopm_put_interface (data->intf); goto err_free_wc; }/* Submit control IN URB on demand to process the WMT event */ err =btusb_mtk_submit_wmt_recv_urb (hdev); + +usb_autopm_put_interface (data->intf); +if (err <0 )return err;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 101/390 leds: lm3601x: Dont use mutex after it was destroyed
In reply to Greg Kroah-HartmanFrom: Uwe Kleine-König <[email protected]>
[ Upstream commit 32f7eed0c763a9b89f6b357ec54b48398fc7b99e ]
The mutex might still be in use until the devm cleanup callback devm_led_classdev_flash_release() is called. This only happens some time after lm3601x_remove() completed.
--- drivers/leds/leds-lm3601x.c | 2 -- 1 file changed, 2 deletions(-)
drivers/leds/leds-lm3601x.c +0 -2
@@ -444,8 +444,6 @@ static int lm3601x_remove(struct i2c_client *client) {struct lm3601x_led *led =i2c_get_clientdata (client); -mutex_destroy (&led->lock); -return regmap_update_bits (led->regmap,LM3601X_ENABLE_REG ,LM3601X_ENABLE_MASK ,LM3601X_MODE_STANDBY );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 100/390 wifi: ath10k: add peer map clean up for peer delete in ath10k_sta_state()
In reply to Greg Kroah-HartmanFrom: Wen Gong <[email protected]>
[ Upstream commit f020d9570a04df0762a2ac5c50cf1d8c511c9164 ]
When peer delete failed in a disconnect operation, use-after-free detected by KFENCE in below log. It is because for each vdev_id and address, it has only one struct ath10k_peer, it is allocated in ath10k_peer_map_event(). When connected to an AP, it has more than one HTT_T2H_MSG_TYPE_PEER_MAP reported from firmware, then the array peer_map of struct ath10k will be set muti-elements to the same ath10k_peer in ath10k_peer_map_event(). When peer delete failed in ath10k_sta_state(), the ath10k_peer will be free for the 1st peer id in array peer_map of struct ath10k, and then use-after-free happened for the 2nd peer id because they map to the same ath10k_peer.
And clean up all peers in array peer_map for the ath10k_peer, then user-after-free disappeared
peer map event log:
[ 306.911021] wlan0: authenticate with b0:2a:43:e6:75:0e [ 306.957187] ath10k_pci 0000:01:00.0: mac vdev 0 peer create b0:2a:43:e6:75:0e (new sta) sta 1 / 32 peer 1 / 33 [ 306.957395] ath10k_pci 0000:01:00.0: htt peer map vdev 0 peer b0:2a:43:e6:75:0e id 246 [ 306.957404] ath10k_pci 0000:01:00.0: htt peer map vdev 0 peer b0:2a:43:e6:75:0e id 198 [ 306.986924] ath10k_pci 0000:01:00.0: htt peer map vdev 0 peer b0:2a:43:e6:75:0e id 166
peer unmap event log:
[ 435.715691] wlan0: deauthenticating from b0:2a:43:e6:75:0e by local choice (Reason: 3=DEAUTH_LEAVING) [ 435.716802] ath10k_pci 0000:01:00.0: mac vdev 0 peer delete b0:2a:43:e6:75:0e sta ffff990e0e9c2b50 (sta gone) [ 435.717177] ath10k_pci 0000:01:00.0: htt peer unmap vdev 0 peer b0:2a:43:e6:75:0e id 246 [ 435.717186] ath10k_pci 0000:01:00.0: htt peer unmap vdev 0 peer b0:2a:43:e6:75:0e id 198 [ 435.717193] ath10k_pci 0000:01:00.0: htt peer unmap vdev 0 peer b0:2a:43:e6:75:0e id 166
use-after-free log:
[21705.888627] wlan0: deauthenticating from d0:76:8f:82:be:75 by local choice (Reason: 3=DEAUTH_LEAVING) [21713.799910] ath10k_pci 0000:01:00.0: failed to delete peer d0:76:8f:82:be:75 for vdev 0: -110 [21713.799925] ath10k_pci 0000:01:00.0: found sta peer d0:76:8f:82:be:75 (ptr 0000000000000000 id 102) entry on vdev 0 after it was supposedly removed [21713.799968] ================================================================== [21713.799991] BUG: KFENCE: use-after-free read in ath10k_sta_state+0x265/0xb8a [ath10k_core] [21713.799991] [21713.799997] Use-after-free read at 0x00000000abe1c75e (in kfence-#69): [21713.800010] ath10k_sta_state+0x265/0xb8a [ath10k_core] [21713.800041] drv_sta_state+0x115/0x677 [mac80211] [21713.800059] __sta_info_destroy_part2+0xb1/0x133 [mac80211] [21713.800076] __sta_info_flush+0x11d/0x162 [mac80211] [21713.800093] ieee80211_set_disassoc+0x12d/0x2f4 [mac80211] [21713.800110] ieee80211_mgd_deauth+0x26c/0x29b [mac80211] [21713.800137] cfg80211_mlme_deauth+0x13f/0x1bb [cfg80211] [21713.800153] nl80211_deauthenticate+0xf8/0x121 [cfg80211] [21713.800161] genl_rcv_msg+0x38e/0x3be [21713.800166] netlink_rcv_skb+0x89/0xf7 [21713.800171] genl_rcv+0x28/0x36 [21713.800176] netlink_unicast+0x179/0x24b [21713.800181] netlink_sendmsg+0x3a0/0x40e [21713.800187] sock_sendmsg+0x72/0x76 [21713.800192] ____sys_sendmsg+0x16d/0x1e3 [21713.800196] ___sys_sendmsg+0x95/0xd1 [21713.800200] __sys_sendmsg+0x85/0xbf [21713.800205] do_syscall_64+0x43/0x55 [21713.800210] entry_SYSCALL_64_after_hwframe+0x44/0xa9 [21713.800213] [21713.800219] kfence-#69: 0x000000009149b0d5-0x000000004c0697fb, size=1064, cache=kmalloc-2k [21713.800219] [21713.800224] allocated by task 13 on cpu 0 at 21705.501373s: [21713.800241] ath10k_peer_map_event+0x7e/0x154 [ath10k_core] [21713.800254] ath10k_htt_t2h_msg_handler+0x586/0x1039 [ath10k_core] [21713.800265] ath10k_htt_htc_t2h_msg_handler+0x12/0x28 [ath10k_core] [21713.800277] ath10k_htc_rx_completion_handler+0x14c/0x1b5 [ath10k_core] [21713.800283] ath10k_pci_process_rx_cb+0x195/0x1df [ath10k_pci] [21713.800294] ath10k_ce_per_engine_service+0x55/0x74 [ath10k_core] [21713.800305] ath10k_ce_per_engine_service_any+0x76/0x84 [ath10k_core] [21713.800310] ath10k_pci_napi_poll+0x49/0x144 [ath10k_pci] [21713.800316] net_rx_action+0xdc/0x361 [21713.800320] __do_softirq+0x163/0x29a [21713.800325] asm_call_irq_on_stack+0x12/0x20 [21713.800331] do_softirq_own_stack+0x3c/0x48 [21713.800337] __irq_exit_rcu+0x9b/0x9d [21713.800342] common_interrupt+0xc9/0x14d [21713.800346] asm_common_interrupt+0x1e/0x40 [21713.800351] ksoftirqd_should_run+0x5/0x16 [21713.800357] smpboot_thread_fn+0x148/0x211 [21713.800362] kthread+0x150/0x15f [21713.800367] ret_from_fork+0x22/0x30 [21713.800370] [21713.800374] freed by task 708 on cpu 1 at 21713.799953s: [21713.800498] ath10k_sta_state+0x2c6/0xb8a [ath10k_core] [21713.800515] drv_sta_state+0x115/0x677 [mac80211] [21713.800532] __sta_info_destroy_part2+0xb1/0x133 [mac80211] [21713.800548] __sta_info_flush+0x11d/0x162 [mac80211] [21713.800565] ieee80211_set_disassoc+0x12d/0x2f4 [mac80211] [21713.800581] ieee80211_mgd_deauth+0x26c/0x29b [mac80211] [21713.800598] cfg80211_mlme_deauth+0x13f/0x1bb [cfg80211] [21713.800614] nl80211_deauthenticate+0xf8/0x121 [cfg80211] [21713.800619] genl_rcv_msg+0x38e/0x3be [21713.800623] netlink_rcv_skb+0x89/0xf7 [21713.800628] genl_rcv+0x28/0x36 [21713.800632] netlink_unicast+0x179/0x24b [21713.800637] netlink_sendmsg+0x3a0/0x40e [21713.800642] sock_sendmsg+0x72/0x76 [21713.800646] ____sys_sendmsg+0x16d/0x1e3 [21713.800651] ___sys_sendmsg+0x95/0xd1 [21713.800655] __sys_sendmsg+0x85/0xbf [21713.800659] do_syscall_64+0x43/0x55 [21713.800663] entry_SYSCALL_64_after_hwframe+0x44/0xa9
Tested-on: QCA6174 hw3.2 PCI WLAN.RM.4.4.1-00288-QCARMSWPZ-1
--- drivers/net/wireless/ath/ath10k/mac.c | 54 ++++++++++++++------------- 1 file changed, 29 insertions(+), 25 deletions(-)
drivers/net/wireless/ath/ath10k/mac.c +29 -25
@@ -853,11 +853,36 @@ static int ath10k_peer_delete(struct ath10k *ar, u32 vdev_id, const u8 *addr)return 0 ; } +static void ath10k_peer_map_cleanup (struct ath10k *ar,struct ath10k_peer *peer) +{ +int peer_id, i; + +lockdep_assert_held (&ar->conf_mutex); + +for_each_set_bit (peer_id, peer->peer_ids, +ATH10K_MAX_NUM_PEER_IDS ) { + ar->peer_map[peer_id] =NULL ; + } + +/* Double check that peer is properly un-referenced from +* the peer_map +*/ +for (i =0 ; i <ARRAY_SIZE (ar->peer_map); i++) { +if (ar->peer_map[i] == peer) { +ath10k_warn (ar,"removing stale peer_map entry for %pM (ptr %pK idx %d)\n" , + peer->addr, peer, i); + ar->peer_map[i] =NULL ; + } + } + +list_del (&peer->list); +kfree (peer); + ar->num_peers--; +} +static void ath10k_peer_cleanup (struct ath10k *ar,u32 vdev_id) {struct ath10k_peer *peer, *tmp; -int peer_id; -int i;lockdep_assert_held (&ar->conf_mutex);
@@ -869,25 +894,7 @@ static void ath10k_peer_cleanup(struct ath10k *ar, u32 vdev_id)ath10k_warn (ar,"removing stale peer %pM from vdev_id %d\n" , peer->addr, vdev_id); -for_each_set_bit (peer_id, peer->peer_ids, -ATH10K_MAX_NUM_PEER_IDS ) { - ar->peer_map[peer_id] =NULL ; - } - -/* Double check that peer is properly un-referenced from -* the peer_map -*/ -for (i =0 ; i <ARRAY_SIZE (ar->peer_map); i++) { -if (ar->peer_map[i] == peer) { -ath10k_warn (ar,"removing stale peer_map entry for %pM (ptr %pK idx %d)\n" , - peer->addr, peer, i); - ar->peer_map[i] =NULL ; - } - } - -list_del (&peer->list); -kfree (peer); - ar->num_peers--; +ath10k_peer_map_cleanup (ar, peer); }spin_unlock_bh (&ar->data_lock); }
@@ -7470,10 +7477,7 @@ static int ath10k_sta_state(struct ieee80211_hw *hw,/* Clean up the peer object as well since we * must have failed to do this above. */ -list_del (&peer->list); - ar->peer_map[i] =NULL ; -kfree (peer); - ar->num_peers--; +ath10k_peer_map_cleanup (ar, peer); } }spin_unlock_bh (&ar->data_lock);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 107/390 Bluetooth: btusb: fix excessive stack usage
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 10888140f09c3472146dc206accd0cfa051d0ed4 ]
Enlarging the size of 'struct btmtk_hci_wmt_cmd' makes it no longer fit on the kernel stack, as seen from this compiler warning:
drivers/bluetooth/btusb.c:3365:12: error: stack frame size of 1036 bytes in function 'btusb_mtk_hci_wmt_sync' [-Werror,-Wframe-larger-than=]
Change the function to dynamically allocate the buffer instead. As there are other sleeping functions called from the same location, using GFP_KERNEL should be fine here, and the runtime overhead should not matter as this is rarely called.
Unfortunately, I could not figure out why the message size is increased in the previous patch. Using dynamic allocation means any size is possible now, but there is still a range check that limits the total size (including the five-byte header) to 255 bytes, so whatever was intended there is now undone.
Stable-dep-of: fd3f106677ba ("Bluetooth: btusb: mediatek: fix WMT failure during runtime suspend")
--- drivers/bluetooth/btusb.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-)
drivers/bluetooth/btusb.c +15 -9
@@ -2832,7 +2832,7 @@ struct btmtk_wmt_hdr {struct btmtk_hci_wmt_cmd {struct btmtk_wmt_hdr hdr; -u8 data[1000 ]; +u8 data[]; } __packed;struct btmtk_hci_wmt_evt {
@@ -3011,7 +3011,7 @@ static int btusb_mtk_hci_wmt_sync(struct hci_dev *hdev,struct btmtk_hci_wmt_evt_funcc *wmt_evt_funcc;u32 hlen, status =BTMTK_WMT_INVALID ;struct btmtk_hci_wmt_evt *wmt_evt; -struct btmtk_hci_wmt_cmd wc; +struct btmtk_hci_wmt_cmd *wc;struct btmtk_wmt_hdr *hdr;int err;
@@ -3020,20 +3020,24 @@ static int btusb_mtk_hci_wmt_sync(struct hci_dev *hdev,if (hlen >255 )return -EINVAL ; - hdr = (struct btmtk_wmt_hdr *)&wc; + wc =kzalloc (hlen,GFP_KERNEL ); +if (!wc) +return -ENOMEM ; + + hdr = &wc->hdr; hdr->dir =1 ; hdr->op = wmt_params->op; hdr->dlen =cpu_to_le16 (wmt_params->dlen +1 ); hdr->flag = wmt_params->flag; -memcpy (wc.data, wmt_params->data, wmt_params->dlen); +memcpy (wc->data, wmt_params->data, wmt_params->dlen);set_bit (BTUSB_TX_WAIT_VND_EVT , &data->flags); - err =__hci_cmd_send (hdev,0xfc6f , hlen, &wc); + err =__hci_cmd_send (hdev,0xfc6f , hlen, wc);if (err <0 ) {clear_bit (BTUSB_TX_WAIT_VND_EVT , &data->flags); -return err; + goto err_free_wc; }/* Submit control IN URB on demand to process the WMT event */
@@ -3055,13 +3059,14 @@ static int btusb_mtk_hci_wmt_sync(struct hci_dev *hdev,if (err == -EINTR ) {bt_dev_err (hdev,"Execution of wmt command interrupted" );clear_bit (BTUSB_TX_WAIT_VND_EVT , &data->flags); -return err; + goto err_free_wc; }if (err) {bt_dev_err (hdev,"Execution of wmt command timed out" );clear_bit (BTUSB_TX_WAIT_VND_EVT , &data->flags); -return -ETIMEDOUT ; + err = -ETIMEDOUT ; + goto err_free_wc; }/* Parse and handle the return WMT event */
@@ -3097,7 +3102,8 @@ static int btusb_mtk_hci_wmt_sync(struct hci_dev *hdev, err_free_skb:kfree_skb (data->evt_skb); data->evt_skb =NULL ; - +err_free_wc: +kfree (wc);return err; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 26/390 quota: Check next/prev free block number after reading from quota file
In reply to Greg Kroah-HartmanFrom: Zhihao Cheng <[email protected]>
commit 6c8ea8b8cd4722efd419f91ca46a2dc81b7d89a3 upstream.
Following process:
Init: v2_read_file_info: <3> dqi_free_blk 0 dqi_free_entry 5 dqi_blks 6
Step 1. chown bin f_a -> dquot_acquire -> v2_write_dquot:
qtree_write_dquot
do_insert_tree
find_free_dqentry
get_free_dqblk
write_blk(info->dqi_blocks) // info->dqi_blocks = 6, failure. The
content in physical block (corresponding to blk 6) is random.
Step 2. chown root f_a -> dquot_transfer -> dqput_all -> dqput ->
ext4_release_dquot -> v2_release_dquot -> qtree_delete_dquot:
dquot_release
remove_tree
free_dqentry
put_free_dqblk(6)
info->dqi_free_blk = blk // info->dqi_free_blk = 6Step 3. drop cache (buffer head for block 6 is released)
Step 4. chown bin f_b -> dquot_acquire -> commit_dqblk -> v2_write_dquot:
qtree_write_dquot
do_insert_tree
find_free_dqentry
get_free_dqblk
dh = (struct qt_disk_dqdbheader *)buf
blk = info->dqi_free_blk // 6
ret = read_blk(info, blk, buf) // The content of buf is random info->dqi_free_blk = le32_to_cpu(dh->dqdh_next_free) // random blk
Step 5. chown bin f_c -> notify_change -> ext4_setattr -> dquot_transfer:
dquot = dqget -> acquire_dquot -> ext4_acquire_dquot -> dquot_acquire ->
commit_dqblk -> v2_write_dquot -> dq_insert_tree:
do_insert_tree
find_free_dqentry
get_free_dqblk
blk = info->dqi_free_blk // If blk < 0 and blk is not an error
code, it will be returned as dquot
transfer_to[USRQUOTA] = dquot // A random negative value __dquot_transfer(transfer_to)
dquot_add_inodes(transfer_to[cnt])
spin_lock(&dquot->dq_dqb_lock) // page fault
, which will lead to kernel page fault:
Quota error (device sda): qtree_write_dquot: Error -8000 occurred while creating quota
BUG: unable to handle page fault for address: ffffffffffffe120 #PF: supervisor write access in kernel mode #PF: error_code(0x0002) - not-present page Oops: 0002 [#1] PREEMPT SMP CPU: 0 PID: 5974 Comm: chown Not tainted 6.0.0-rc1-00004 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996) RIP: 0010:_raw_spin_lock+0x3a/0x90 Call Trace: dquot_add_inodes+0x28/0x270 __dquot_transfer+0x377/0x840 dquot_transfer+0xde/0x540 ext4_setattr+0x405/0x14d0 notify_change+0x68e/0x9f0 chown_common+0x300/0x430 __x64_sys_fchownat+0x29/0x40
In order to avoid accessing invalid quota memory address, this patch adds block number checking of next/prev free block read from quota file.
Fetch a reproducer in [Link].
--- fs/quota/quota_tree.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+)
fs/quota/quota_tree.c +38 -0
@@ -80,6 +80,35 @@ static ssize_t write_blk(struct qtree_mereturn ret; } +static inline int do_check_range (struct super_block *sb,const char *val_name, +uint val,uint min_val,uint max_val) +{ +if (val < min_val || val > max_val) { +quota_error (sb,"Getting %s %u out of range %u-%u" , + val_name, val, min_val, max_val); +return -EUCLEAN ; + } + +return 0 ; +} + +static int check_dquot_block_header (struct qtree_mem_dqinfo *info, +struct qt_disk_dqdbheader *dh) +{ +int err =0 ; + + err =do_check_range (info->dqi_sb,"dqdh_next_free" , +le32_to_cpu (dh->dqdh_next_free),0 , + info->dqi_blocks -1 ); +if (err) +return err; + err =do_check_range (info->dqi_sb,"dqdh_prev_free" , +le32_to_cpu (dh->dqdh_prev_free),0 , + info->dqi_blocks -1 ); + +return err; +} +/* Remove empty block from list and return it */ static int get_free_dqblk (struct qtree_mem_dqinfo *info) {
@@ -94,6 +123,9 @@ static int get_free_dqblk(struct qtree_m ret =read_blk (info, blk, buf);if (ret <0 ) goto out_buf; + ret =check_dquot_block_header (info, dh); +if (ret) + goto out_buf; info->dqi_free_blk =le32_to_cpu (dh->dqdh_next_free); }else {
@@ -241,6 +273,9 @@ static uint find_free_dqentry(struct qtr *err =read_blk (info, blk, buf);if (*err <0 ) goto out_buf; + *err =check_dquot_block_header (info, dh); +if (*err) + goto out_buf; }else { blk =get_free_dqblk (info);if ((int )blk <0 ) {
@@ -433,6 +468,9 @@ static int free_dqentry(struct qtree_mem goto out_buf; } dh = (struct qt_disk_dqdbheader *)buf; + ret =check_dquot_block_header (info, dh); +if (ret) + goto out_buf;le16_add_cpu (&dh->dqdh_entries,-1 );if (!le16_to_cpu (dh->dqdh_entries)) {/* Block got free? */ ret =remove_free_dqentry (info, buf, blk);
Greg Kroah-Hartman
maintainerPATCH 125/390 spi/omap100k:Fix PM disable depth imbalance in omap1_spi100k_probe
In reply to Greg Kroah-HartmanFrom: Zhang Qilong <[email protected]>
[ Upstream commit 29f65f2171c85a9633daa380df14009a365f42f2 ]
The pm_runtime_enable will increase power disable depth. Thus a pairing decrement is needed on the error handling path to keep it balanced according to context.
--- drivers/spi/spi-omap-100k.c | 1 + 1 file changed, 1 insertion(+)
drivers/spi/spi-omap-100k.c +1 -0
@@ -414,6 +414,7 @@ static int omap1_spi100k_probe(struct platform_device *pdev)return status; err_fck: +pm_runtime_disable (&pdev->dev);clk_disable_unprepare (spi100k->fck); err_ick:clk_disable_unprepare (spi100k->ick);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 94/390 MIPS: SGI-IP27: Free some unused memory
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 33d7085682b4aa212ebfadbc21da81dfefaaac16 ]
platform_device_add_data() duplicates the memory it is passed. So we can free some memory to save a few bytes that would remain unused otherwise.
Stable-dep-of: 11bec9cba4de ("MIPS: SGI-IP27: Fix platform-device leak in bridge_platform_create()")
--- arch/mips/sgi-ip27/ip27-xtalk.c | 4 ++++ 1 file changed, 4 insertions(+)
arch/mips/sgi-ip27/ip27-xtalk.c +4 -0
@@ -53,6 +53,8 @@ static void bridge_platform_create(nasid_t nasid, int widget, int masterwid) }platform_device_add_resources (pdev, &w1_res,1 );platform_device_add_data (pdev, wd,sizeof (*wd)); +/* platform_device_add_data() duplicates the data */ +kfree (wd);platform_device_add (pdev); bd =kzalloc (sizeof (*bd),GFP_KERNEL );
@@ -83,6 +85,8 @@ static void bridge_platform_create(nasid_t nasid, int widget, int masterwid) bd->io_offset = offset;platform_device_add_data (pdev, bd,sizeof (*bd)); +/* platform_device_add_data() duplicates the data */ +kfree (bd);platform_device_add (pdev);pr_info ("xtalk:n%d/%x bridge widget\n" , nasid, widget);return ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 44/390 serial: 8250: Let drivers request full 16550A feature probing
In reply to Greg Kroah-HartmanFrom: Maciej W. Rozycki <[email protected]>
commit 9906890c89e4dbd900ed87ad3040080339a7f411 upstream.
A SERIAL_8250_16550A_VARIANTS configuration option has been recently defined that lets one request the 8250 driver not to probe for 16550A device features so as to reduce the driver's device startup time in virtual machines.
Some actual hardware devices require these features to have been fully determined however for their driver to work correctly, so define a flag to let drivers request full 16550A feature probing on a device-by-device basis if required regardless of the SERIAL_8250_16550A_VARIANTS option setting chosen.
--- drivers/tty/serial/8250/8250_port.c | 3 ++- include/linux/serial_core.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/tty/serial/8250/8250_port.c +2 -1
@@ -1021,7 +1021,8 @@ static void autoconfig_16550a(struct uar up->port.type =PORT_16550A ; up->capabilities |=UART_CAP_FIFO ; -if (!IS_ENABLED (CONFIG_SERIAL_8250_16550A_VARIANTS )) +if (!IS_ENABLED (CONFIG_SERIAL_8250_16550A_VARIANTS ) && + !(up->port.flags &UPF_FULL_PROBE ))return ;/*
include/linux/serial_core.h +2 -1
@@ -100,7 +100,7 @@ struct uart_icount {__u32 buf_overrun; }; -typedef unsigned int __bitwise upf_t ; +typedef u64 __bitwise upf_t ;typedef unsigned int __bitwise upstat_t ;struct uart_port {
@@ -207,6 +207,7 @@ struct uart_port {#define UPF_FIXED_PORT ((__force upf_t) (1 << 29))#define UPF_DEAD ((__force upf_t) (1 << 30))#define UPF_IOREMAP ((__force upf_t) (1 << 31)) +#define UPF_FULL_PROBE ((__force upf_t) (1ULL << 32))#define __UPF_CHANGE_MASK 0x17fff#define UPF_CHANGE_MASK ((__force upf_t) __UPF_CHANGE_MASK)
Greg Kroah-Hartman
maintainerPATCH 61/390 ext4: fix null-ptr-deref in ext4_write_info
In reply to Greg Kroah-HartmanFrom: Baokun Li <[email protected]>
commit f9c1f248607d5546075d3f731e7607d5571f2b60 upstream.
I caught a null-ptr-deref bug as follows:
==================================================================
KASAN: null-ptr-deref in range [0x0000000000000068-0x000000000000006f] CPU: 1 PID: 1589 Comm: umount Not tainted 5.10.0-02219-dirty #339 RIP: 0010:ext4_write_info+0x53/0x1b0 [...] Call Trace: dquot_writeback_dquots+0x341/0x9a0 ext4_sync_fs+0x19e/0x800 __sync_filesystem+0x83/0x100 sync_filesystem+0x89/0xf0 generic_shutdown_super+0x79/0x3e0 kill_block_super+0xa1/0x110 deactivate_locked_super+0xac/0x130 deactivate_super+0xb6/0xd0 cleanup_mnt+0x289/0x400 __cleanup_mnt+0x16/0x20 task_work_run+0x11c/0x1c0 exit_to_user_mode_prepare+0x203/0x210 syscall_exit_to_user_mode+0x5b/0x3a0 do_syscall_64+0x59/0x70 entry_SYSCALL_64_after_hwframe+0x44/0xa9 ==================================================================
Above issue may happen as follows:
-------------------------------------exit_to_user_mode_prepare
task_work_run
__cleanup_mnt
cleanup_mnt
deactivate_super
deactivate_locked_super
kill_block_super
generic_shutdown_super
shrink_dcache_for_umount
dentry = sb->s_root
sb->s_root = NULL <--- Here set NULL
sync_filesystem
__sync_filesystem
sb->s_op->sync_fs > ext4_sync_fs
dquot_writeback_dquots
sb->dq_op->write_info > ext4_write_info
ext4_journal_start(d_inode(sb->s_root), EXT4_HT_QUOTA, 2)
d_inode(sb->s_root)
s_root->d_inode <--- Null pointer dereferenceTo solve this problem, we use ext4_journal_start_sb directly to avoid s_root being used.
--- fs/ext4/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ext4/super.c +1 -1
@@ -6273,7 +6273,7 @@ static int ext4_write_info(struct super_handle_t *handle;/* Data block + inode block */ - handle =ext4_journal_start (d_inode (sb->s_root),EXT4_HT_QUOTA ,2 ); + handle =ext4_journal_start_sb (sb,EXT4_HT_QUOTA ,2 );if (IS_ERR (handle))return PTR_ERR (handle); ret =dquot_commit_info (sb, type);
Greg Kroah-Hartman
maintainerPATCH 145/390 drm/dp_mst: fix drm_dp_dpcd_read return value checks
In reply to Greg Kroah-HartmanFrom: Simon Ser <[email protected]>
[ Upstream commit 2ac6cdd581f48c8f68747156fde5868486a44985 ]
drm_dp_dpcd_read returns the number of bytes read. The previous code would print garbage on DPCD error, and would exit with on error on success.
--- drivers/gpu/drm/drm_dp_mst_topology.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_dp_mst_topology.c +3 -3
@@ -4856,14 +4856,14 @@ void drm_dp_mst_dump_topology(struct seq_file *m,seq_printf (m,"dpcd: %*ph\n" ,DP_RECEIVER_CAP_SIZE , buf); ret =drm_dp_dpcd_read (mgr->aux,DP_FAUX_CAP , buf,2 ); -if (ret) { +if (ret !=2 ) {seq_printf (m,"faux/mst read failed\n" ); goto out; }seq_printf (m,"faux/mst: %*ph\n" ,2 , buf); ret =drm_dp_dpcd_read (mgr->aux,DP_MSTM_CTRL , buf,1 ); -if (ret) { +if (ret !=1 ) {seq_printf (m,"mst ctrl read failed\n" ); goto out; }
@@ -4871,7 +4871,7 @@ void drm_dp_mst_dump_topology(struct seq_file *m,/* dump the standard OUI branch header */ ret =drm_dp_dpcd_read (mgr->aux,DP_BRANCH_OUI , buf,DP_BRANCH_OUI_HEADER_SIZE ); -if (ret) { +if (ret !=DP_BRANCH_OUI_HEADER_SIZE ) {seq_printf (m,"branch oui read failed\n" ); goto out; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 85/390 staging: greybus: audio_helper: remove unused and wrong debugfs usage
In reply to Greg Kroah-HartmanFrom: Greg Kroah-Hartman <[email protected]>
commit d517cdeb904ddc0cbebcc959d43596426cac40b0 upstream.
In the greybus audio_helper code, the debugfs file for the dapm has the potential to be removed and memory will be leaked. There is also the very real potential for this code to remove ALL debugfs entries from the system, and it seems like this is what will really happen if this code ever runs. This all is very wrong as the greybus audio driver did not create this debugfs file, the sound core did and controls the lifespan of it.
So remove all of the debugfs logic from the audio_helper code as there's no way it could be correct. If this really is needed, it can come back with a fixup for the incorrect usage of the debugfs_lookup() call which is what caused this to be noticed at all.
--- drivers/staging/greybus/audio_helper.c | 11 ----------- 1 file changed, 11 deletions(-)
drivers/staging/greybus/audio_helper.c +0 -11
@@ -3,7 +3,6 @@* Greybus Audio Sound SoC helper APIs */ -#include <linux/debugfs.h> #include <sound/core.h> #include <sound/soc.h> #include <sound/soc-dapm.h>
@@ -116,10 +115,6 @@ int gbaudio_dapm_free_controls(struct sn {int i;struct snd_soc_dapm_widget *w, *next_w; -#ifdef CONFIG_DEBUG_FS -struct dentry *parent = dapm->debugfs_dapm; -struct dentry *debugfs_w =NULL ; -#endif mutex_lock (&dapm->card->dapm_mutex);for (i =0 ; i < num; i++) {
@@ -139,12 +134,6 @@ int gbaudio_dapm_free_controls(struct sncontinue ; } widget++; -#ifdef CONFIG_DEBUG_FS -if (!parent) - debugfs_w =debugfs_lookup (w->name, parent); -debugfs_remove (debugfs_w); - debugfs_w =NULL ; -#endif gbaudio_dapm_free_widget (w); }mutex_unlock (&dapm->card->dapm_mutex);
Greg Kroah-Hartman
maintainerPATCH 121/390 wifi: ath11k: fix number of VHT beamformee spatial streams
In reply to Greg Kroah-HartmanFrom: Jesus Fernandez Manzano <[email protected]>
[ Upstream commit 55b5ee3357d7bb98ee578cf9b84a652e7a1bc199 ]
The number of spatial streams used when acting as a beamformee in VHT mode are reported by the firmware as 7 (8 sts - 1) both in IPQ6018 and IPQ8074 which respectively have 2 and 4 sts each. So the firmware should report 1 (2 - 1) and 3 (4 - 1).
Fix this by checking that the number of VHT beamformee sts reported by the firmware is not greater than the number of receiving antennas - 1. The fix is based on the same approach used in this same function for sanitizing the number of sounding dimensions reported by the firmware.
Without this change, acting as a beamformee in VHT mode is not working properly.
Tested-on: IPQ6018 hw1.0 AHB WLAN.HK.2.5.0.1-01208-QCAHKSWPL_SILICONZ-1
Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.5.0.1-01208-QCAHKSWPL_SILICONZ-1
--- drivers/net/wireless/ath/ath11k/mac.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-)
drivers/net/wireless/ath/ath11k/mac.c +20 -5
@@ -3419,6 +3419,8 @@ static int ath11k_mac_set_txbf_conf(struct ath11k_vif *arvif)if (vht_cap & (IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE )) { nsts = vht_cap &IEEE80211_VHT_CAP_BEAMFORMEE_STS_MASK ; nsts >>=IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT ; +if (nsts > (ar->num_rx_chains -1 )) + nsts = ar->num_rx_chains -1 ; value |=SM (nsts,WMI_TXBF_STS_CAP_OFFSET ); }
@@ -3459,7 +3461,7 @@ static int ath11k_mac_set_txbf_conf(struct ath11k_vif *arvif)static void ath11k_set_vht_txbf_cap (struct ath11k *ar,u32 *vht_cap) {bool subfer, subfee; -int sound_dim =0 ; +int sound_dim =0 , nsts =0 ; subfer = !!(*vht_cap & (IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE )); subfee = !!(*vht_cap & (IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE ));
@@ -3469,6 +3471,11 @@ static void ath11k_set_vht_txbf_cap(struct ath11k *ar, u32 *vht_cap) subfer = false; } +if (ar->num_rx_chains <2 ) { + *vht_cap &= ~(IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE ); + subfee = false; + } +/* If SU Beaformer is not set, then disable MU Beamformer Capability */ if (!subfer) *vht_cap &= ~(IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE );
@@ -3481,7 +3488,9 @@ static void ath11k_set_vht_txbf_cap(struct ath11k *ar, u32 *vht_cap) sound_dim >>=IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_SHIFT ; *vht_cap &= ~IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_MASK ; -/* TODO: Need to check invalid STS and Sound_dim values set by FW? */ + nsts = (*vht_cap &IEEE80211_VHT_CAP_BEAMFORMEE_STS_MASK ); + nsts >>=IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT ; + *vht_cap &= ~IEEE80211_VHT_CAP_BEAMFORMEE_STS_MASK ;/* Enable Sounding Dimension Field only if SU BF is enabled */ if (subfer) {
@@ -3493,9 +3502,15 @@ static void ath11k_set_vht_txbf_cap(struct ath11k *ar, u32 *vht_cap) *vht_cap |= sound_dim; } -/* Use the STS advertised by FW unless SU Beamformee is not supported*/ -if (!subfee) - *vht_cap &= ~(IEEE80211_VHT_CAP_BEAMFORMEE_STS_MASK ); +/* Enable Beamformee STS Field only if SU BF is enabled */ +if (subfee) { +if (nsts > (ar->num_rx_chains -1 )) + nsts = ar->num_rx_chains -1 ; + + nsts <<=IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT ; + nsts &=IEEE80211_VHT_CAP_BEAMFORMEE_STS_MASK ; + *vht_cap |= nsts; + } } static struct ieee80211_sta_vht_cap
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 128/390 netfilter: nft_fib: Fix for rpath check with VRF devices
In reply to Greg Kroah-HartmanFrom: Phil Sutter <[email protected]>
[ Upstream commit 2a8a7c0eaa8747c16aa4a48d573aa920d5c00a5c ]
Analogous to commit b575b24b8eee3 ("netfilter: Fix rpfilter dropping vrf packets by mistake") but for nftables fib expression:
Add special treatment of VRF devices so that typical reverse path filtering via 'fib saddr . iif oif' expression works as expected.
--- net/ipv4/netfilter/nft_fib_ipv4.c | 3 +++ net/ipv6/netfilter/nft_fib_ipv6.c | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-)
net/ipv4/netfilter/nft_fib_ipv4.c +3 -0
@@ -83,6 +83,9 @@ void nft_fib4_eval(const struct nft_expr *expr, struct nft_regs *regs,else oif =NULL ; +if (priv->flags &NFTA_FIB_F_IIF ) + fl4.flowi4_oif =l3mdev_master_ifindex_rcu (oif); +if (nft_hook (pkt) ==NF_INET_PRE_ROUTING &&nft_fib_is_loopback (pkt->skb,nft_in (pkt))) {nft_fib_store_result (dest, priv,nft_in (pkt));
net/ipv6/netfilter/nft_fib_ipv6.c +5 -1
@@ -37,6 +37,9 @@ static int nft_fib6_flowi_init(struct flowi6 *fl6, const struct nft_fib *priv,if (ipv6_addr_type (&fl6->daddr) &IPV6_ADDR_LINKLOCAL ) { lookup_flags |=RT6_LOOKUP_F_IFACE ; fl6->flowi6_oif =get_ifindex (dev ? dev : pkt->skb->dev); + }else if ((priv->flags &NFTA_FIB_F_IIF ) && + (netif_is_l3_master (dev) ||netif_is_l3_slave (dev))) { + fl6->flowi6_oif = dev->ifindex; }if (ipv6_addr_type (&fl6->saddr) &IPV6_ADDR_UNICAST )
@@ -193,7 +196,8 @@ void nft_fib6_eval(const struct nft_expr *expr, struct nft_regs *regs,if (rt->rt6i_flags & (RTF_REJECT |RTF_ANYCAST |RTF_LOCAL )) goto put_rt_err; -if (oif && oif != rt->rt6i_idev->dev) +if (oif && oif != rt->rt6i_idev->dev && +l3mdev_master_ifindex_rcu (rt->rt6i_idev->dev) != oif->ifindex) goto put_rt_err;nft_fib_store_result (dest, priv, rt->rt6i_idev->dev);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 103/390 bpftool: Fix a wrong type cast in btf_dumper_int
In reply to Greg Kroah-HartmanFrom: Lam Thai <[email protected]>
[ Upstream commit 7184aef9c0f7a81db8fd18d183ee42481d89bf35 ]
When data points to a boolean value, casting it to int * is problematic and could lead to a wrong value being passed to jsonw_bool. Change the cast to bool * instead.
--- tools/bpf/bpftool/btf_dumper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/bpf/bpftool/btf_dumper.c +1 -1
@@ -416,7 +416,7 @@ static int btf_dumper_int(const struct btf_type *t, __u8 bit_offset, *(char *)data);break ;case BTF_INT_BOOL : -jsonw_bool (jw, *(int *)data); +jsonw_bool (jw, *(bool *)data);break ;default :/* shouldn't happen */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 140/390 net: mvpp2: fix mvpp2 debugfs leak
In reply to Greg Kroah-HartmanFrom: Russell King (Oracle) <[email protected]>
[ Upstream commit 0152dfee235e87660f52a117fc9f70dc55956bb4 ]
When mvpp2 is unloaded, the driver specific debugfs directory is not removed, which technically leads to a memory leak. However, this directory is only created when the first device is probed, so the hardware is present. Removing the module is only something a developer would to when e.g. testing out changes, so the module would be reloaded. So this memory leak is minor.
The original attempt in commit fe2c9c61f668 ("net: mvpp2: debugfs: fix memory leak when using debugfs_lookup()") that was labelled as a memory leak fix was not, it fixed a refcount leak, but in doing so created a problem when the module is reloaded - the directory already exists, but mvpp2_root is NULL, so we lose all debugfs entries. This fix has been reverted.
This is the alternative fix, where we remove the offending directory whenever the driver is unloaded.
--- drivers/net/ethernet/marvell/mvpp2/mvpp2.h | 1 + drivers/net/ethernet/marvell/mvpp2/mvpp2_debugfs.c | 10 ++++++++-- drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 13 ++++++++++++- 3 files changed, 21 insertions(+), 3 deletions(-)
drivers/net/ethernet/marvell/mvpp2/mvpp2.h +1 -0
@@ -1434,6 +1434,7 @@ u32 mvpp2_read(struct mvpp2 *priv, u32 offset);void mvpp2_dbgfs_init (struct mvpp2 *priv,const char *name);void mvpp2_dbgfs_cleanup (struct mvpp2 *priv); +void mvpp2_dbgfs_exit (void );#ifdef CONFIG_MVPP2_PTP int mvpp22_tai_probe (struct device *dev,struct mvpp2 *priv);
drivers/net/ethernet/marvell/mvpp2/mvpp2_debugfs.c +8 -2
@@ -691,6 +691,13 @@ static int mvpp2_dbgfs_port_init(struct dentry *parent,return 0 ; } +static struct dentry *mvpp2_root; + +void mvpp2_dbgfs_exit (void ) +{ +debugfs_remove (mvpp2_root); +} +void mvpp2_dbgfs_cleanup (struct mvpp2 *priv) {debugfs_remove_recursive (priv->dbgfs_dir);
@@ -700,10 +707,9 @@ void mvpp2_dbgfs_cleanup(struct mvpp2 *priv)void mvpp2_dbgfs_init (struct mvpp2 *priv,const char *name) { -struct dentry *mvpp2_dir, *mvpp2_root; +struct dentry *mvpp2_dir;int ret, i; - mvpp2_root =debugfs_lookup (MVPP2_DRIVER_NAME ,NULL );if (!mvpp2_root) mvpp2_root =debugfs_create_dir (MVPP2_DRIVER_NAME ,NULL );
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +12 -1
@@ -7155,7 +7155,18 @@ static struct platform_driver mvpp2_driver = { }, }; -module_platform_driver (mvpp2_driver); +static int __init mvpp2_driver_init (void ) +{ +return platform_driver_register (&mvpp2_driver); +} +module_init (mvpp2_driver_init); + +static void __exit mvpp2_driver_exit(void) +{ +platform_driver_unregister (&mvpp2_driver); +mvpp2_dbgfs_exit (); +} +module_exit (mvpp2_driver_exit);MODULE_DESCRIPTION ("Marvell PPv2 Ethernet Driver - www.marvell.com" );MODULE_AUTHOR ("Marcin Wojtas <[email protected]>" );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 133/390 sctp: handle the error returned from sctp_auth_asoc_init_active_key
In reply to Greg Kroah-HartmanFrom: Xin Long <[email protected]>
[ Upstream commit 022152aaebe116a25c39818a07e175a8cd3c1e11 ]
When it returns an error from sctp_auth_asoc_init_active_key(), the active_key is actually not updated. The old sh_key will be freeed while it's still used as active key in asoc. Then an use-after-free will be triggered when sending patckets, as found by syzbot:
sctp_auth_shkey_hold+0x22/0xa0 net/sctp/auth.c:112 sctp_set_owner_w net/sctp/socket.c:132 [inline] sctp_sendmsg_to_asoc+0xbd5/0x1a20 net/sctp/socket.c:1863 sctp_sendmsg+0x1053/0x1d50 net/sctp/socket.c:2025 inet_sendmsg+0x99/0xe0 net/ipv4/af_inet.c:819 sock_sendmsg_nosec net/socket.c:714 [inline] sock_sendmsg+0xcf/0x120 net/socket.c:734
This patch is to fix it by not replacing the sh_key when it returns errors from sctp_auth_asoc_init_active_key() in sctp_auth_set_key(). For sctp_auth_set_active_key(), old active_key_id will be set back to asoc->active_key_id when the same thing happens.
--- net/sctp/auth.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)
net/sctp/auth.c +14 -4
@@ -863,12 +863,17 @@ int sctp_auth_set_key(struct sctp_endpoint *ep, }list_del_init (&shkey->key_list); -sctp_auth_shkey_release (shkey);list_add (&cur_key->key_list, sh_keys); -if (asoc && asoc->active_key_id == auth_key->sca_keynumber) -sctp_auth_asoc_init_active_key (asoc,GFP_KERNEL ); +if (asoc && asoc->active_key_id == auth_key->sca_keynumber && +sctp_auth_asoc_init_active_key (asoc,GFP_KERNEL )) { +list_del_init (&cur_key->key_list); +sctp_auth_shkey_release (cur_key); +list_add (&shkey->key_list, sh_keys); +return -ENOMEM ; + } +sctp_auth_shkey_release (shkey);return 0 ; }
@@ -902,8 +907,13 @@ int sctp_auth_set_active_key(struct sctp_endpoint *ep,return -EINVAL ;if (asoc) { +__u16 active_key_id = asoc->active_key_id; + asoc->active_key_id = key_id; -sctp_auth_asoc_init_active_key (asoc,GFP_KERNEL ); +if (sctp_auth_asoc_init_active_key (asoc,GFP_KERNEL )) { + asoc->active_key_id = active_key_id; +return -ENOMEM ; + } }else ep->active_key_id = key_id;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 137/390 bnx2x: fix potential memory leak in bnx2x_tpa_stop()
In reply to Greg Kroah-HartmanFrom: Jianglei Nie <[email protected]>
[ Upstream commit b43f9acbb8942b05252be83ac25a81cec70cc192 ]
bnx2x_tpa_stop() allocates a memory chunk from new_data with bnx2x_frag_alloc(). The new_data should be freed when gets some error. But when "pad + len > fp->rx_buf_size" is true, bnx2x_tpa_stop() returns without releasing the new_data, which will lead to a memory leak.
We should free the new_data with bnx2x_frag_free() when "pad + len > fp->rx_buf_size" is true.
--- drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +1 -0
@@ -788,6 +788,7 @@ static void bnx2x_tpa_stop(struct bnx2x *bp, struct bnx2x_fastpath *fp,BNX2X_ERR ("skb_put is about to fail... pad %d len %d rx_buf_size %d\n" , pad, len, fp->rx_buf_size);bnx2x_panic (); +bnx2x_frag_free (fp, new_data); return; }#endif
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 129/390 spi: s3c64xx: Fix large transfers with DMA
In reply to Greg Kroah-HartmanFrom: Vincent Whitchurch <[email protected]>
[ Upstream commit 1224e29572f655facfcd850cf0f0a4784f36a903 ]
The COUNT_VALUE in the PACKET_CNT register is 16-bit so the maximum value is 65535. Asking the driver to transfer a larger size currently leads to the DMA transfer timing out. Implement ->max_transfer_size() and have the core split the transfer as needed.
--- drivers/spi/spi-s3c64xx.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/spi/spi-s3c64xx.c +9 -0
@@ -84,6 +84,7 @@#define S3C64XX_SPI_ST_TX_FIFORDY (1<<0)#define S3C64XX_SPI_PACKET_CNT_EN (1<<16) +#define S3C64XX_SPI_PACKET_CNT_MASK GENMASK(15, 0)#define S3C64XX_SPI_PND_TX_UNDERRUN_CLR (1<<4)#define S3C64XX_SPI_PND_TX_OVERRUN_CLR (1<<3)
@@ -660,6 +661,13 @@ static int s3c64xx_spi_prepare_message(struct spi_master *master,return 0 ; } +static size_t s3c64xx_spi_max_transfer_size (struct spi_device *spi) +{ +struct spi_controller *ctlr = spi->controller; + +return ctlr->can_dma ?S3C64XX_SPI_PACKET_CNT_MASK :SIZE_MAX ; +} +static int s3c64xx_spi_transfer_one (struct spi_master *master,struct spi_device *spi,struct spi_transfer *xfer)
@@ -1135,6 +1143,7 @@ static int s3c64xx_spi_probe(struct platform_device *pdev) master->prepare_transfer_hardware = s3c64xx_spi_prepare_transfer; master->prepare_message = s3c64xx_spi_prepare_message; master->transfer_one = s3c64xx_spi_transfer_one; + master->max_transfer_size = s3c64xx_spi_max_transfer_size; master->num_chipselect = sci->num_cs; master->dma_alignment =8 ; master->bits_per_word_mask = SPI_BPW_MASK(32) | SPI_BPW_MASK(16) |
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 88/390 drm/i915: Fix watermark calculations for gen12+ RC CCS modifier
In reply to Greg Kroah-HartmanFrom: Ville Syrjälä <[email protected]>
commit c56453a00f19ccddee302f5f9fe96b80e0b47fd3 upstream.
Take the gen12+ RC CCS modifier into account when calculating the watermarks. Othwerwise we'll calculate the watermarks thinking this Y-tiled modifier is linear.
The rc_surface part is actually a nop since that is not used for any glk+ platform.
v2: Split RC CCS vs. MC CCS to separate patches
--- drivers/gpu/drm/i915/intel_pm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +4 -2
@@ -5145,10 +5145,12 @@ skl_compute_wm_params(const struct intel wp->y_tiled = modifier ==I915_FORMAT_MOD_Y_TILED || modifier == I915_FORMAT_MOD_Yf_TILED || modifier ==I915_FORMAT_MOD_Y_TILED_CCS || - modifier == I915_FORMAT_MOD_Yf_TILED_CCS; + modifier == I915_FORMAT_MOD_Yf_TILED_CCS || + modifier ==I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS ; wp->x_tiled = modifier ==I915_FORMAT_MOD_X_TILED ; wp->rc_surface = modifier ==I915_FORMAT_MOD_Y_TILED_CCS || - modifier == I915_FORMAT_MOD_Yf_TILED_CCS; + modifier == I915_FORMAT_MOD_Yf_TILED_CCS || + modifier ==I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS ; wp->is_planar =intel_format_info_is_yuv_semiplanar (format, modifier); wp->width = width;
Greg Kroah-Hartman
maintainerPATCH 116/390 wifi: rtl8xxxu: gen2: Fix mistake in path B IQ calibration
In reply to Greg Kroah-HartmanFrom: Bitterblue Smith <[email protected]>
[ Upstream commit e963a19c64ac0d2f8785d36a27391abd91ac77aa ]
Found by comparing with the vendor driver. Currently this affects only the RTL8192EU, which is the only gen2 chip with 2 TX paths supported by this driver. It's unclear what kind of effect the mistake had in practice, since I don't have any RTL8192EU devices to test it.
--- drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +2 -2
@@ -2925,12 +2925,12 @@ bool rtl8xxxu_gen2_simularity_compare(struct rtl8xxxu_priv *priv, }if (!(simubitmap &0x30 ) && priv->tx_paths >1 ) { -/* path B RX OK */ +/* path B TX OK */ for (i =4 ; i <6 ; i++) result[3 ][i] = result[c1][i]; } -if (!(simubitmap &0x30 ) && priv->tx_paths >1 ) { +if (!(simubitmap &0xc0 ) && priv->tx_paths >1 ) {/* path B RX OK */ for (i =6 ; i <8 ; i++) result[3 ][i] = result[c1][i];
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 130/390 wifi: rtl8xxxu: Fix AIFS written to REG_EDCA_*_PARAM
In reply to Greg Kroah-HartmanFrom: Bitterblue Smith <[email protected]>
[ Upstream commit 5574d3290449916397f3092dcd2bac92415498e1 ]
ieee80211_tx_queue_params.aifs is not supposed to be written directly to the REG_EDCA_*_PARAM registers. Instead process it like the vendor drivers do. It's kinda hacky but it works.
This change boosts the download speed and makes it more stable.
Tested with RTL8188FU but all the other supported chips should also benefit.
--- .../wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+)
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +49 -0
@@ -4507,6 +4507,53 @@ rtl8xxxu_wireless_mode(struct ieee80211_hw *hw, struct ieee80211_sta *sta)return network_type; } +static void rtl8xxxu_set_aifs (struct rtl8xxxu_priv *priv,u8 slot_time) +{ +u32 reg_edca_param[IEEE80211_NUM_ACS ] = { + [IEEE80211_AC_VO ] =REG_EDCA_VO_PARAM , + [IEEE80211_AC_VI ] =REG_EDCA_VI_PARAM , + [IEEE80211_AC_BE ] =REG_EDCA_BE_PARAM , + [IEEE80211_AC_BK ] =REG_EDCA_BK_PARAM , + }; +u32 val32; +u16 wireless_mode =0 ; +u8 aifs, aifsn, sifs; +int i; + +if (priv->vif) { +struct ieee80211_sta *sta; + +rcu_read_lock (); + sta =ieee80211_find_sta (priv->vif, priv->vif->bss_conf.bssid); +if (sta) + wireless_mode =rtl8xxxu_wireless_mode (priv->hw, sta); +rcu_read_unlock (); + } + +if (priv->hw->conf.chandef.chan->band ==NL80211_BAND_5GHZ || + (wireless_mode &WIRELESS_MODE_N_24G )) + sifs =16 ; +else + sifs =10 ; + +for (i =0 ; i <IEEE80211_NUM_ACS ; i++) { + val32 =rtl8xxxu_read32 (priv, reg_edca_param[i]); + +/* It was set in conf_tx. */ + aifsn = val32 &0xff ; + +/* aifsn not set yet or already fixed */ +if (aifsn <2 || aifsn >15 ) +continue ; + + aifs = aifsn * slot_time + sifs; + + val32 &= ~0xff ; + val32 |= aifs; +rtl8xxxu_write32 (priv, reg_edca_param[i], val32); + } +} +static void rtl8xxxu_bss_info_changed (struct ieee80211_hw *hw,struct ieee80211_vif *vif,struct ieee80211_bss_conf *bss_conf,u32 changed)
@@ -4592,6 +4639,8 @@ rtl8xxxu_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif,else val8 =20 ;rtl8xxxu_write8 (priv,REG_SLOT , val8); + +rtl8xxxu_set_aifs (priv, val8); }if (changed &BSS_CHANGED_BSSID ) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 160/390 ASoC: eureka-tlv320: Hold reference returned from of_find_xxx API
In reply to Greg Kroah-HartmanFrom: Liang He <[email protected]>
[ Upstream commit bfb735a3ceff0bab6473bac275da96f9b2a06dec ]
In eukrea_tlv320_probe(), we need to hold the reference returned from of_find_compatible_node() which has increased the refcount and then call of_node_put() with it when done.
--- sound/soc/fsl/eukrea-tlv320.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
sound/soc/fsl/eukrea-tlv320.c +5 -3
@@ -86,7 +86,7 @@ static int eukrea_tlv320_probe(struct platform_device *pdev)int ret;int int_port =0 , ext_port;struct device_node *np = pdev->dev.of_node; -struct device_node *ssi_np =NULL , *codec_np =NULL ; +struct device_node *ssi_np =NULL , *codec_np =NULL , *tmp_np =NULL ; eukrea_tlv320.dev = &pdev->dev;if (np) {
@@ -143,7 +143,7 @@ static int eukrea_tlv320_probe(struct platform_device *pdev) }if (machine_is_eukrea_cpuimx27 () || -of_find_compatible_node (NULL ,NULL ,"fsl,imx21-audmux" )) { + (tmp_np =of_find_compatible_node (NULL ,NULL ,"fsl,imx21-audmux" ))) { imx_audmux_v1_configure_port(MX27_AUDMUX_HPCR1_SSI0, IMX_AUDMUX_V1_PCR_SYN | IMX_AUDMUX_V1_PCR_TFSDIR |
@@ -158,10 +158,11 @@ static int eukrea_tlv320_probe(struct platform_device *pdev)IMX_AUDMUX_V1_PCR_SYN |IMX_AUDMUX_V1_PCR_RXDSEL (MX27_AUDMUX_HPCR1_SSI0 ) ); +of_node_put (tmp_np); }else if (machine_is_eukrea_cpuimx25sd () ||machine_is_eukrea_cpuimx35sd () ||machine_is_eukrea_cpuimx51sd () || -of_find_compatible_node (NULL ,NULL ,"fsl,imx31-audmux" )) { + (tmp_np =of_find_compatible_node (NULL ,NULL ,"fsl,imx31-audmux" ))) {if (!np) ext_port =machine_is_eukrea_cpuimx25sd () ?4 :3 ;
@@ -178,6 +179,7 @@ static int eukrea_tlv320_probe(struct platform_device *pdev)IMX_AUDMUX_V2_PTCR_SYN ,IMX_AUDMUX_V2_PDCR_RXDSEL (int_port) ); +of_node_put (tmp_np); }else {if (np) {/* The eukrea,asoc-tlv320 driver was explicitly
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 135/390 spi: Ensure that sg_table wont be used after being freed
In reply to Greg Kroah-HartmanFrom: Marek Szyprowski <[email protected]>
[ Upstream commit 8e9204cddcc3fea9affcfa411715ba4f66e97587 ]
SPI code checks for non-zero sgt->orig_nents to determine if the buffer has been DMA-mapped. Ensure that sg_table is really zeroed after free to avoid potential NULL pointer dereference if the given SPI xfer object is reused again without being DMA-mapped.
--- drivers/spi/spi.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/spi/spi.c +2 -0
@@ -946,6 +946,8 @@ void spi_unmap_buf(struct spi_controller *ctlr, struct device *dev,if (sgt->orig_nents) {dma_unmap_sg (dev, sgt->sgl, sgt->orig_nents, dir);sg_free_table (sgt); + sgt->orig_nents =0 ; + sgt->nents =0 ; } }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 163/390 ASoC: da7219: Fix an error handling path in da7219_register_dai_clks()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit abb4e4349afe7eecdb0499582f1c777031e3a7c8 ]
If clk_hw_register() fails, the corresponding clk should not be unregistered.
To handle errors from loops, clean up partial iterations before doing the goto. So add a clk_hw_unregister().
Then use a while (--i >= 0) loop in the unwind section.
--- sound/soc/codecs/da7219.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
sound/soc/codecs/da7219.c +3 -2
@@ -2194,6 +2194,7 @@ static int da7219_register_dai_clks(struct snd_soc_component *component) dai_clk_lookup =clkdev_hw_create (dai_clk_hw, init.name,"%s" ,dev_name (dev));if (!dai_clk_lookup) { +clk_hw_unregister (dai_clk_hw); ret = -ENOMEM ; goto err; }else {
@@ -2215,12 +2216,12 @@ static int da7219_register_dai_clks(struct snd_soc_component *component)return 0 ; err: -do { +while (--i >=0 ) {if (da7219->dai_clks_lookup[i])clkdev_drop (da7219->dai_clks_lookup[i]);clk_hw_unregister (&da7219->dai_clks_hw[i]); - }while (i-- >0 ); + }if (np)kfree (da7219->clk_hw_data);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 169/390 ASoC: mt6660: Fix PM disable depth imbalance in mt6660_i2c_probe
In reply to Greg Kroah-HartmanFrom: Zhang Qilong <[email protected]>
[ Upstream commit b73f11e895e140537e7f8c7251211ccd3ce0782b ]
The pm_runtime_enable will increase power disable depth. Thus a pairing decrement is needed on the error handling path to keep it balanced according to context. We fix it by moving pm_runtime_enable to the endding of mt6660_i2c_probe.
--- sound/soc/codecs/mt6660.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
sound/soc/codecs/mt6660.c +6 -2
@@ -504,13 +504,17 @@ static int mt6660_i2c_probe(struct i2c_client *client,dev_err (chip->dev,"read chip revision fail\n" ); goto probe_fail; } -pm_runtime_set_active (chip->dev); -pm_runtime_enable (chip->dev); ret =devm_snd_soc_register_component (chip->dev, &mt6660_component_driver, &mt6660_codec_dai,1 ); +if (!ret) { +pm_runtime_set_active (chip->dev); +pm_runtime_enable (chip->dev); + } +return ret; + probe_fail:_mt6660_chip_power_on (chip,0 );mutex_destroy (&chip->io_lock);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 167/390 ASoC: wm5110: Fix PM disable depth imbalance in wm5110_probe
In reply to Greg Kroah-HartmanFrom: Zhang Qilong <[email protected]>
[ Upstream commit 86b46bf1feb83898d89a2b4a8d08d21e9ea277a7 ]
The pm_runtime_enable will increase power disable depth. Thus a pairing decrement is needed on the error handling path to keep it balanced according to context. We fix it by moving pm_runtime_enable to the endding of wm5110_probe.
--- sound/soc/codecs/wm5110.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
sound/soc/codecs/wm5110.c +3 -3
@@ -2452,9 +2452,6 @@ static int wm5110_probe(struct platform_device *pdev)regmap_update_bits (arizona->regmap, wm5110_digital_vu[i],WM5110_DIG_VU ,WM5110_DIG_VU ); -pm_runtime_enable (&pdev->dev); -pm_runtime_idle (&pdev->dev); - ret =arizona_request_irq (arizona,ARIZONA_IRQ_DSP_IRQ1 ,"ADSP2 Compressed IRQ" , wm5110_adsp2_irq, wm5110);
@@ -2487,6 +2484,9 @@ static int wm5110_probe(struct platform_device *pdev) goto err_spk_irqs; } +pm_runtime_enable (&pdev->dev); +pm_runtime_idle (&pdev->dev); +return ret; err_spk_irqs:
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 172/390 memory: of: Fix refcount leak bug in of_get_ddr_timings()
In reply to Greg Kroah-HartmanFrom: Liang He <[email protected]>
[ Upstream commit 05215fb32010d4afb68fbdbb4d237df6e2d4567b ]
We should add the of_node_put() when breaking out of for_each_child_of_node() as it will automatically increase and decrease the refcount.
--- drivers/memory/of_memory.c | 1 + 1 file changed, 1 insertion(+)
drivers/memory/of_memory.c +1 -0
@@ -134,6 +134,7 @@ const struct lpddr2_timings *of_get_ddr_timings(struct device_node *np_ddr,for_each_child_of_node (np_ddr, np_tim) {if (of_device_is_compatible (np_tim, tim_compat)) {if (of_do_get_timings (np_tim, &timings[i])) { +of_node_put (np_tim);devm_kfree (dev, timings); goto default_timings; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 171/390 memory: pl353-smc: Fix refcount leak bug in pl353_smc_probe()
In reply to Greg Kroah-HartmanFrom: Liang He <[email protected]>
[ Upstream commit 61b3c876c1cbdb1efd1f52a1f348580e6e14efb6 ]
The break of for_each_available_child_of_node() needs a corresponding of_node_put() when the reference 'child' is not used anymore. Here we do not need to call of_node_put() in fail path as '!match' means no break.
While the of_platform_device_create() will created a new reference by 'child' but it has considered the refcounting.
--- drivers/memory/pl353-smc.c | 1 + 1 file changed, 1 insertion(+)
drivers/memory/pl353-smc.c +1 -0
@@ -416,6 +416,7 @@ static int pl353_smc_probe(struct amba_device *adev, const struct amba_id *id)if (init)init (adev, child);of_platform_device_create (child,NULL , &adev->dev); +of_node_put (child);return 0 ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 149/390 ASoC: tas2764: Allow mono streams
In reply to Greg Kroah-HartmanFrom: Martin Povišer <[email protected]>
[ Upstream commit 23204d928a27146d13e11c9383632775345ecca8 ]
The part is a mono speaker amp, but it can do downmix and switch between left and right channel, so the right channel range is 1 to 2.
(This mirrors commit bf54d97a835d ("ASoC: tas2770: Allow mono streams") which was a fix to the tas2770 driver.)
--- sound/soc/codecs/tas2764.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/tas2764.c +1 -1
@@ -485,7 +485,7 @@ static struct snd_soc_dai_driver tas2764_dai_driver[] = { .id = 0, .playback = { .stream_name = "ASI1 Playback", - .channels_min = 2, + .channels_min = 1, .channels_max = 2, .rates = TAS2764_RATES, .formats = TAS2764_FORMATS,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 180/390 soc/tegra: fuse: Drop Kconfig dependency on TEGRA20_APB_DMA
In reply to Greg Kroah-HartmanFrom: Dmitry Osipenko <[email protected]>
[ Upstream commit 2254182807fc09ba9dec9a42ef239e373796f1b2 ]
The DMA subsystem could be entirely disabled in Kconfig and then the TEGRA20_APB_DMA option isn't available too. Hence kernel configuration fails if DMADEVICES Kconfig option is disabled due to the unsatisfiable dependency.
The FUSE driver isn't a critical driver and currently it only provides NVMEM interface to userspace which isn't known to be widely used, and thus, it's fine if FUSE driver fails to load.
Let's remove the erroneous Kconfig dependency and let the FUSE driver to fail the probing if DMA is unavailable.
--- drivers/soc/tegra/Kconfig | 1 - 1 file changed, 1 deletion(-)
drivers/soc/tegra/Kconfig +0 -1
@@ -136,7 +136,6 @@ config SOC_TEGRA_FUSE def_bool y depends on ARCH_TEGRA select SOC_BUS - select TEGRA20_APB_DMA if ARCH_TEGRA_2x_SOC config SOC_TEGRA_FLOWCTRL bool
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 177/390 ARM: dts: kirkwood: lsxl: fix serial line
In reply to Greg Kroah-HartmanFrom: Michael Walle <[email protected]>
[ Upstream commit 04eabc6ac10fda9424606d9a7ab6ab9a5d95350a ]
Commit 327e15428977 ("ARM: dts: kirkwood: consolidate common pinctrl settings") unknowingly broke the serial output on this board. Before this commit, the pinmux was still configured by the bootloader and the kernel didn't reconfigured it again. This was an oversight by the initial board support where the pinmux for the serial line was never configured by the kernel. But with this commit, the serial line will be reconfigured to the wrong pins. This is especially confusing, because the output still works, but the input doesn't. Presumingly, the input is reconfigured to MPP10, but the output is connected to both MPP11 and MPP5.
Override the pinmux in the board device tree.
--- arch/arm/boot/dts/kirkwood-lsxl.dtsi | 5 +++++ 1 file changed, 5 insertions(+)
arch/arm/boot/dts/kirkwood-lsxl.dtsi +5 -0
@@ -10,6 +10,11 @@ ocp@f1000000 { pinctrl: pin-controller@10000 { + /* Non-default UART pins */ + pmx_uart0: pmx-uart0 { + marvell,pins = "mpp4", "mpp5"; + }; + pmx_power_hdd: pmx-power-hdd { marvell,pins = "mpp10"; marvell,function = "gpo";
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 178/390 ARM: dts: kirkwood: lsxl: remove first ethernet port
In reply to Greg Kroah-HartmanFrom: Michael Walle <[email protected]>
[ Upstream commit 2d528eda7c96ce5c70f895854ecd5684bd5d80b9 ]
Both the Linkstation LS-CHLv2 and the LS-XHL have only one ethernet port. This has always been wrong, i.e. the board code used to set up both ports, but the driver will play nice and return -ENODEV if the assiciated PHY is not found. Nevertheless, it is wrong. Remove it.
--- arch/arm/boot/dts/kirkwood-lsxl.dtsi | 11 ----------- 1 file changed, 11 deletions(-)
arch/arm/boot/dts/kirkwood-lsxl.dtsi +0 -11
@@ -218,22 +218,11 @@ &mdio { status = "okay"; - ethphy0: ethernet-phy@0 { - reg = <0>; - }; - ethphy1: ethernet-phy@8 { reg = <8>; }; }; -ð0 { - status = "okay"; - ethernet0-port@0 { - phy-handle = <ðphy0>; - }; -}; - ð1 { status = "okay"; ethernet1-port@0 {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 150/390 ASoC: tas2764: Drop conflicting set_bias_level power setting
In reply to Greg Kroah-HartmanFrom: Martin Povišer <[email protected]>
[ Upstream commit 09273f38832406db19a8907a934687cc10660a6b ]
The driver is setting the PWR_CTRL field in both the set_bias_level callback and on DAPM events of the DAC widget (and also in the mute_stream method). Drop the set_bias_level callback altogether as the power setting it does is in conflict with the other code paths.
(This mirrors commit c8a6ae3fe1c8 ("ASoC: tas2770: Drop conflicting set_bias_level power setting") which was a fix to the tas2770 driver.)
--- sound/soc/codecs/tas2764.c | 33 --------------------------------- 1 file changed, 33 deletions(-)
sound/soc/codecs/tas2764.c +0 -33
@@ -50,38 +50,6 @@ static void tas2764_reset(struct tas2764_priv *tas2764)usleep_range (1000 ,2000 ); } -static int tas2764_set_bias_level (struct snd_soc_component *component, -enum snd_soc_bias_level level) -{ -struct tas2764_priv *tas2764 =snd_soc_component_get_drvdata (component); - -switch (level) { -case SND_SOC_BIAS_ON : -snd_soc_component_update_bits (component,TAS2764_PWR_CTRL , -TAS2764_PWR_CTRL_MASK , -TAS2764_PWR_CTRL_ACTIVE ); -break ; -case SND_SOC_BIAS_STANDBY : -case SND_SOC_BIAS_PREPARE : -snd_soc_component_update_bits (component,TAS2764_PWR_CTRL , -TAS2764_PWR_CTRL_MASK , -TAS2764_PWR_CTRL_MUTE ); -break ; -case SND_SOC_BIAS_OFF : -snd_soc_component_update_bits (component,TAS2764_PWR_CTRL , -TAS2764_PWR_CTRL_MASK , -TAS2764_PWR_CTRL_SHUTDOWN ); -break ; - -default : -dev_err (tas2764->dev, -"wrong power level setting %d\n" , level); -return -EINVAL ; - } - -return 0 ; -} -#ifdef CONFIG_PM static int tas2764_codec_suspend (struct snd_soc_component *component) {
@@ -549,7 +517,6 @@ static const struct snd_soc_component_driver soc_component_driver_tas2764 = { .probe = tas2764_codec_probe, .suspend = tas2764_codec_suspend, .resume = tas2764_codec_resume, - .set_bias_level = tas2764_set_bias_level, .controls = tas2764_snd_controls, .num_controls = ARRAY_SIZE(tas2764_snd_controls), .dapm_widgets = tas2764_dapm_widgets,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 152/390 platform/x86: msi-laptop: Fix old-ec check for backlight registering
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit 83ac7a1c2ed5f17caa07cbbc84bad3c05dc3bf22 ]
Commit 2cc6c717799f ("msi-laptop: Port to new backlight interface selection API") replaced this check:
if (!quirks->old_ec_model || acpi_video_backlight_support())
pr_info("Brightness ignored, ...");
else
do_register();With:
if (quirks->old_ec_model || acpi_video_get_backlight_type() == acpi_backlight_vendor) do_register();
But since the do_register() part was part of the else branch, the entire condition should be inverted. So not only the 2 statements on either side of the || should be inverted, but the || itself should be replaced with a &&.
In practice this has likely not been an issue because the new-ec models (old_ec_model==false) likely all support ACPI video backlight control, making acpi_video_get_backlight_type() return acpi_backlight_video turning the second part of the || also false when old_ec_model == false.
--- drivers/platform/x86/msi-laptop.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/platform/x86/msi-laptop.c +1 -2
@@ -1048,8 +1048,7 @@ static int __init msi_init(void)return -EINVAL ;/* Register backlight stuff */ - -if (quirks->old_ec_model || +if (quirks->old_ec_model &&acpi_video_get_backlight_type () == acpi_backlight_vendor) {struct backlight_properties props;memset (&props,0 ,sizeof (struct backlight_properties ));
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 183/390 arm64: ftrace: fix module PLTs with mcount
In reply to Greg Kroah-HartmanFrom: Mark Rutland <[email protected]>
[ Upstream commit 8cfb08575c6d4585f1ce0deeb189e5c824776b04 ]
Li Huafei reports that mcount-based ftrace with module PLTs was broken by commit:
a6253579977e4c6f ("arm64: ftrace: consistently handle PLTs.")
When a module PLTs are used and a module is loaded sufficiently far away from the kernel, we'll create PLTs for any branches which are out-of-range. These are separate from the special ftrace trampoline PLTs, which the module PLT code doesn't directly manipulate.
When mcount is in use this is a problem, as each mcount callsite in a module will be initialized to point to a module PLT, but since commit a6253579977e4c6f ftrace_make_nop() will assume that the callsite has been initialized to point to the special ftrace trampoline PLT, and ftrace_find_callable_addr() rejects other cases.
This means that when ftrace tries to initialize a callsite via ftrace_make_nop(), the call to ftrace_find_callable_addr() will find that the _mcount stub is out-of-range and is not handled by the ftrace PLT, resulting in a splat:
| ftrace_test: loading out-of-tree module taints kernel. | ftrace: no module PLT for _mcount | ------------[ ftrace bug ]------------ | ftrace failed to modify | [<ffff800029180014>] 0xffff800029180014 | actual: 44:00:00:94 | Initializing ftrace call sites | ftrace record flags: 2000000 | (0) | expected tramp: ffff80000802eb3c | ------------[ cut here ]------------ | WARNING: CPU: 3 PID: 157 at kernel/trace/ftrace.c:2120 ftrace_bug+0x94/0x270 | Modules linked in: | CPU: 3 PID: 157 Comm: insmod Tainted: G O 6.0.0-rc6-00151-gcd722513a189-dirty #22 | Hardware name: linux,dummy-virt (DT) | pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--) | pc : ftrace_bug+0x94/0x270 | lr : ftrace_bug+0x21c/0x270 | sp : ffff80000b2bbaf0 | x29: ffff80000b2bbaf0 x28: 0000000000000000 x27: ffff0000c4d38000 | x26: 0000000000000001 x25: ffff800009d7e000 x24: ffff0000c4d86e00 | x23: 0000000002000000 x22: ffff80000a62b000 x21: ffff8000098ebea8 | x20: ffff0000c4d38000 x19: ffff80000aa24158 x18: ffffffffffffffff | x17: 0000000000000000 x16: 0a0d2d2d2d2d2d2d x15: ffff800009aa9118 | x14: 0000000000000000 x13: 6333626532303830 x12: 3030303866666666 | x11: 203a706d61727420 x10: 6465746365707865 x9 : 3362653230383030 | x8 : c0000000ffffefff x7 : 0000000000017fe8 x6 : 000000000000bff4 | x5 : 0000000000057fa8 x4 : 0000000000000000 x3 : 0000000000000001 | x2 : ad2cb14bb5438900 x1 : 0000000000000000 x0 : 0000000000000022 | Call trace: | ftrace_bug+0x94/0x270 | ftrace_process_locs+0x308/0x430 | ftrace_module_init+0x44/0x60 | load_module+0x15b4/0x1ce8 | __do_sys_init_module+0x1ec/0x238 | __arm64_sys_init_module+0x24/0x30 | invoke_syscall+0x54/0x118 | el0_svc_common.constprop.4+0x84/0x100 | do_el0_svc+0x3c/0xd0 | el0_svc+0x1c/0x50 | el0t_64_sync_handler+0x90/0xb8 | el0t_64_sync+0x15c/0x160 | ---[ end trace 0000000000000000 ]--- | ---------test_init-----------
Fix this by reverting to the old behaviour of ignoring the old instruction when initialising an mcount callsite in a module, which was the behaviour prior to commit a6253579977e4c6f.
--- arch/arm64/kernel/ftrace.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
arch/arm64/kernel/ftrace.c +16 -1
@@ -216,11 +216,26 @@ int ftrace_make_nop(struct module *mod, struct dyn_ftrace *rec,unsigned long pc = rec->ip;u32 old =0 , new; + new =aarch64_insn_gen_nop (); + +/* +* When using mcount, callsites in modules may have been initalized to +* call an arbitrary module PLT (which redirects to the _mcount stub) +* rather than the ftrace PLT we'll use at runtime (which redirects to +* the ftrace trampoline). We can ignore the old PLT when initializing +* the callsite. +* +* Note: 'mod' is only set at module load time. +*/ +if (!IS_ENABLED (CONFIG_DYNAMIC_FTRACE_WITH_REGS ) && +IS_ENABLED (CONFIG_ARM64_MODULE_PLTS ) && mod) { +return aarch64_insn_patch_text_nosync ((void *)pc, new); + } +if (!ftrace_find_callable_addr (rec, mod, &addr))return -EINVAL ; old =aarch64_insn_gen_branch_imm (pc, addr,AARCH64_INSN_BRANCH_LINK ); - new =aarch64_insn_gen_nop ();return ftrace_modify_code (pc, old, new, true); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 153/390 platform/x86: msi-laptop: Fix resource cleanup
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit 5523632aa10f906dfe2eb714ee748590dc7fc6b1 ]
Fix the input-device not getting free-ed on probe-errors and fix the msi_touchpad_dwork not getting cancelled on neither probe-errors nor on remove.
--- drivers/platform/x86/msi-laptop.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/platform/x86/msi-laptop.c +3 -0
@@ -1116,6 +1116,8 @@ static int __init msi_init(void) fail_create_group:if (quirks->load_scm_model) {i8042_remove_filter (msi_laptop_i8042_filter); +cancel_delayed_work_sync (&msi_touchpad_dwork); +input_unregister_device (msi_laptop_input_dev);cancel_delayed_work_sync (&msi_rfkill_dwork);cancel_work_sync (&msi_rfkill_work);rfkill_cleanup ();
@@ -1136,6 +1138,7 @@ static void __exit msi_cleanup(void) {if (quirks->load_scm_model) {i8042_remove_filter (msi_laptop_i8042_filter); +cancel_delayed_work_sync (&msi_touchpad_dwork);input_unregister_device (msi_laptop_input_dev);cancel_delayed_work_sync (&msi_rfkill_dwork);cancel_work_sync (&msi_rfkill_work);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 194/390 usb: common: move functions kerneldoc next to its definition
In reply to Greg Kroah-HartmanFrom: Chunfeng Yun <[email protected]>
[ Upstream commit 365038f24b3e9d2b7c9e499f03f432040e28a35c ]
Following a general rule, add the kerneldoc for a function next to it's definition, but not next to its declaration in a header file.
Stable-dep-of: b6155eaf6b05 ("usb: common: debug: Check non-standard control requests")
--- drivers/usb/common/common.c | 35 +++++++++++++++++++++ drivers/usb/common/debug.c | 22 +++++++++++-- include/linux/usb/ch9.h | 61 ------------------------------------- 3 files changed, 55 insertions(+), 63 deletions(-)
drivers/usb/common/common.c +35 -0
@@ -25,6 +25,12 @@ static const char *const ep_type_names[] = { [USB_ENDPOINT_XFER_INT] = "intr", }; +/** +* usb_ep_type_string() - Returns human readable-name of the endpoint type. +* @ep_type: The endpoint type to return human-readable name for. If it's not +* any of the types: USB_ENDPOINT_XFER_{CONTROL, ISOC, BULK, INT}, +* usually got by usb_endpoint_type(), the string 'unknown' will be returned. +*/ const char *usb_ep_type_string (int ep_type) {if (ep_type <0 || ep_type >=ARRAY_SIZE (ep_type_names))
@@ -76,6 +82,12 @@ static const char *const ssp_rate[] = { [USB_SSP_GEN_2x2] = "super-speed-plus-gen2x2", }; +/** +* usb_speed_string() - Returns human readable-name of the speed. +* @speed: The speed to return human-readable name for. If it's not +* any of the speeds defined in usb_device_speed enum, string for +* USB_SPEED_UNKNOWN will be returned. +*/ const char *usb_speed_string (enum usb_device_speed speed) {if (speed <0 || speed >=ARRAY_SIZE (speed_names))
@@ -84,6 +96,14 @@ const char *usb_speed_string(enum usb_device_speed speed) }EXPORT_SYMBOL_GPL (usb_speed_string); +/** +* usb_get_maximum_speed - Get maximum requested speed for a given USB +* controller. +* @dev: Pointer to the given USB controller device +* +* The function gets the maximum speed string from property "maximum-speed", +* and returns the corresponding enum usb_device_speed. +*/ enum usb_device_speed usb_get_maximum_speed (struct device *dev) {const char *maximum_speed;
@@ -102,6 +122,15 @@ enum usb_device_speed usb_get_maximum_speed(struct device *dev) }EXPORT_SYMBOL_GPL (usb_get_maximum_speed); +/** +* usb_get_maximum_ssp_rate - Get the signaling rate generation and lane count +* of a SuperSpeed Plus capable device. +* @dev: Pointer to the given USB controller device +* +* If the string from "maximum-speed" property is super-speed-plus-genXxY where +* 'X' is the generation number and 'Y' is the number of lanes, then this +* function returns the corresponding enum usb_ssp_rate. +*/ enum usb_ssp_rate usb_get_maximum_ssp_rate (struct device *dev) {const char *maximum_speed;
@@ -116,6 +145,12 @@ enum usb_ssp_rate usb_get_maximum_ssp_rate(struct device *dev) }EXPORT_SYMBOL_GPL (usb_get_maximum_ssp_rate); +/** +* usb_state_string - Returns human readable name for the state. +* @state: The state to return a human-readable name for. If it's not +* any of the states devices in usb_device_state_string enum, +* the string UNKNOWN will be returned. +*/ const char *usb_state_string (enum usb_device_state state) {static const char *const names[] = {
drivers/usb/common/debug.c +20 -2
@@ -207,8 +207,26 @@ static void usb_decode_set_isoch_delay(__u8 wValue, char *str, size_t size)snprintf (str, size,"Set Isochronous Delay(Delay = %d ns)" , wValue); } -/* -* usb_decode_ctrl - returns a string representation of ctrl request +/** +* usb_decode_ctrl - Returns human readable representation of control request. +* @str: buffer to return a human-readable representation of control request. +* This buffer should have about 200 bytes. +* @size: size of str buffer. +* @bRequestType: matches the USB bmRequestType field +* @bRequest: matches the USB bRequest field +* @wValue: matches the USB wValue field (CPU byte order) +* @wIndex: matches the USB wIndex field (CPU byte order) +* @wLength: matches the USB wLength field (CPU byte order) +* +* Function returns decoded, formatted and human-readable description of +* control request packet. +* +* The usage scenario for this is for tracepoints, so function as a return +* use the same value as in parameters. This approach allows to use this +* function in TP_printk +* +* Important: wValue, wIndex, wLength parameters before invoking this function +* should be processed by le16_to_cpu macro. */ const char *usb_decode_ctrl(char *str, size_t size, __u8 bRequestType, __u8 bRequest, __u16 wValue, __u16 wIndex,
include/linux/usb/ch9.h +0 -61
76 lines not on this page · raw message
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 184/390 ARM: dts: exynos: fix polarity of VBUS GPIO of Origen
In reply to Greg Kroah-HartmanFrom: Dmitry Torokhov <[email protected]>
[ Upstream commit a08137bd1e0a7ce951dce9ce4a83e39d379b6e1b ]
EHCI Oxynos (drivers/usb/host/ehci-exynos.c) drives VBUS GPIO high when trying to power up the bus, therefore the GPIO in DTS must be marked as "active high". This will be important when EHCI driver is converted to gpiod API that respects declared polarities.
--- arch/arm/boot/dts/exynos4412-origen.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/exynos4412-origen.dts +1 -1
@@ -95,7 +95,7 @@ }; &ehci { - samsung,vbus-gpio = <&gpx3 5 1>; + samsung,vbus-gpio = <&gpx3 5 GPIO_ACTIVE_HIGH>; status = "okay"; phys = <&exynos_usbphy 2>, <&exynos_usbphy 3>; phy-names = "hsic0", "hsic1";
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 197/390 clk: oxnas: Hold reference returned by of_get_parent()
In reply to Greg Kroah-HartmanFrom: Liang He <[email protected]>
[ Upstream commit 1d6aa08c54cd0e005210ab8e3b1e92ede70f8a4f ]
In oxnas_stdclk_probe(), we need to hold the reference returned by of_get_parent() and use it to call of_node_put() for refcount balance.
--- drivers/clk/clk-oxnas.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/clk/clk-oxnas.c +4 -2
@@ -207,7 +207,7 @@ static const struct of_device_id oxnas_stdclk_dt_ids[] = {static int oxnas_stdclk_probe (struct platform_device *pdev) { -struct device_node *np = pdev->dev.of_node; +struct device_node *np = pdev->dev.of_node, *parent_np;const struct oxnas_stdclk_data *data;const struct of_device_id *id;struct regmap *regmap;
@@ -219,7 +219,9 @@ static int oxnas_stdclk_probe(struct platform_device *pdev)return -ENODEV ; data = id->data; - regmap =syscon_node_to_regmap (of_get_parent (np)); + parent_np =of_get_parent (np); + regmap =syscon_node_to_regmap (parent_np); +of_node_put (parent_np);if (IS_ERR (regmap)) {dev_err (&pdev->dev,"failed to have parent regmap\n" );return PTR_ERR (regmap);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 199/390 clk: berlin: Add of_node_put() for of_get_parent()
In reply to Greg Kroah-HartmanFrom: Liang He <[email protected]>
[ Upstream commit 37c381b812dcbfde9c3f1f3d3e75fdfc1b40d5bc ]
In berlin2_clock_setup() and berlin2q_clock_setup(), we need to call of_node_put() for the reference returned by of_get_parent() which has increased the refcount. We should call *_put() in fail path or when it is not used anymore.
--- drivers/clk/berlin/bg2.c | 5 ++++- drivers/clk/berlin/bg2q.c | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-)
drivers/clk/berlin/bg2.c +4 -1
@@ -500,12 +500,15 @@ static void __init berlin2_clock_setup(struct device_node *np)int n, ret; clk_data =kzalloc (struct_size (clk_data, hws,MAX_CLKS ),GFP_KERNEL ); -if (!clk_data) +if (!clk_data) { +of_node_put (parent_np);return ; + } clk_data->num =MAX_CLKS ; hws = clk_data->hws; gbase =of_iomap (parent_np,0 ); +of_node_put (parent_np);if (!gbase)return ;
drivers/clk/berlin/bg2q.c +5 -1
@@ -286,19 +286,23 @@ static void __init berlin2q_clock_setup(struct device_node *np)int n, ret; clk_data =kzalloc (struct_size (clk_data, hws,MAX_CLKS ),GFP_KERNEL ); -if (!clk_data) +if (!clk_data) { +of_node_put (parent_np);return ; + } clk_data->num =MAX_CLKS ; hws = clk_data->hws; gbase =of_iomap (parent_np,0 );if (!gbase) { +of_node_put (parent_np);pr_err ("%pOF: Unable to map global base\n" , np);return ; }/* BG2Q CPU PLL is not part of global registers */ cpupll_base =of_iomap (parent_np,1 ); +of_node_put (parent_np);if (!cpupll_base) {pr_err ("%pOF: Unable to map cpupll base\n" , np);iounmap (gbase);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 204/390 HSI: omap_ssi: Fix refcount leak in ssi_probe
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit 9a2ea132df860177b33c9fd421b26c4e9a0a9396 ]
When returning or breaking early from a for_each_available_child_of_node() loop, we need to explicitly call of_node_put() on the child node to possibly release the node.
--- drivers/hsi/controllers/omap_ssi_core.c | 1 + 1 file changed, 1 insertion(+)
drivers/hsi/controllers/omap_ssi_core.c +1 -0
@@ -524,6 +524,7 @@ static int ssi_probe(struct platform_device *pd)if (!childpdev) { err = -ENODEV ;dev_err (&pd->dev,"failed to create ssi controller port\n" ); +of_node_put (child); goto out3; } }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 202/390 clk: tegra: Fix refcount leak in tegra114_clock_init
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit db16a80c76ea395766913082b1e3f939dde29b2c ]
of_find_matching_node() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak.
--- drivers/clk/tegra/clk-tegra114.c | 1 + 1 file changed, 1 insertion(+)
drivers/clk/tegra/clk-tegra114.c +1 -0
@@ -1317,6 +1317,7 @@ static void __init tegra114_clock_init(struct device_node *np) } pmc_base =of_iomap (node,0 ); +of_node_put (node);if (!pmc_base) {pr_err ("Can't map pmc registers\n" );WARN_ON (1 );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 213/390 fpga: prevent integer overflow in dfl_feature_ioctl_set_irq()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 939bc5453b8cbdde9f1e5110ce8309aedb1b501a ]
The "hdr.count * sizeof(s32)" multiplication can overflow on 32 bit systems leading to memory corruption. Use array_size() to fix that.
--- drivers/fpga/dfl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/fpga/dfl.c +1 -1
@@ -1857,7 +1857,7 @@ long dfl_feature_ioctl_set_irq(struct platform_device *pdev,return -EINVAL ; fds =memdup_user ((void __user *)(arg +sizeof (hdr)), - hdr.count *sizeof (s32)); +array_size (hdr.count,sizeof (s32)));if (IS_ERR (fds))return PTR_ERR (fds);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 210/390 RDMA/rxe: Fix "kernel NULL pointer dereference" error
In reply to Greg Kroah-HartmanFrom: Zhu Yanjun <[email protected]>
[ Upstream commit a625ca30eff806395175ebad3ac1399014bdb280 ]
When rxe_queue_init in the function rxe_qp_init_req fails, both qp->req.task.func and qp->req.task.arg are not initialized.
Because of creation of qp fails, the function rxe_create_qp will call rxe_qp_do_cleanup to handle allocated resource.
Before calling __rxe_do_task, both qp->req.task.func and qp->req.task.arg should be checked.
--- drivers/infiniband/sw/rxe/rxe_qp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/infiniband/sw/rxe/rxe_qp.c +3 -1
@@ -775,7 +775,9 @@ void rxe_qp_destroy(struct rxe_qp *qp)rxe_cleanup_task (&qp->comp.task);/* flush out any receive wr's or pending requests */ -__rxe_do_task (&qp->req.task); +if (qp->req.task.func) +__rxe_do_task (&qp->req.task); +if (qp->sq.queue) {__rxe_do_task (&qp->comp.task);__rxe_do_task (&qp->req.task);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 215/390 dmaengine: hisilicon: Fix CQ head update
In reply to Greg Kroah-HartmanFrom: Jie Hai <[email protected]>
[ Upstream commit 94477a79cf80e8ab55b68f14bc579a12ddea1e0b ]
After completion of data transfer of one or multiple descriptors, the completion status and the current head pointer to submission queue are written into the CQ and interrupt can be generated to inform the software. In interrupt process CQ is read and cq_head is updated.
hisi_dma_irq updates cq_head only when the completion status is success. When an abnormal interrupt reports, cq_head will not update which will cause subsequent interrupt processes read the error CQ and never report the correct status.
This patch updates cq_head whenever CQ is accessed.
--- drivers/dma/hisi_dma.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/dma/hisi_dma.c +3 -5
@@ -442,12 +442,10 @@ static irqreturn_t hisi_dma_irq(int irq, void *data) desc = chan->desc; cqe = chan->cq + chan->cq_head;if (desc) { + chan->cq_head = (chan->cq_head +1 ) % hdma_dev->chan_depth; +hisi_dma_chan_write (hdma_dev->base,HISI_DMA_CQ_HEAD_PTR , + chan->qp_num, chan->cq_head);if (FIELD_GET (STATUS_MASK , cqe->w0) ==STATUS_SUCC ) { - chan->cq_head = (chan->cq_head +1 ) % - hdma_dev->chan_depth; -hisi_dma_chan_write (hdma_dev->base, -HISI_DMA_CQ_HEAD_PTR , chan->qp_num, - chan->cq_head);vchan_cookie_complete (&desc->vd); }else {dev_err (&hdma_dev->pdev->dev,"task error!\n" );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 207/390 tty: xilinx_uartps: Fix the ignore_status
In reply to Greg Kroah-HartmanFrom: Shubhrajyoti Datta <[email protected]>
[ Upstream commit b8a6c3b3d4654fba19881cc77da61eac29f57cae ]
Currently the ignore_status is not considered in the isr. Add a check to add the ignore_status.
--- drivers/tty/serial/xilinx_uartps.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/tty/serial/xilinx_uartps.c +2 -0
@@ -375,6 +375,8 @@ static irqreturn_t cdns_uart_isr(int irq, void *dev_id) isrstatus &= ~CDNS_UART_IXR_TXEMPTY ; } + isrstatus &= port->read_status_mask; + isrstatus &= ~port->ignore_status_mask;/* * Skip RX processing if RX is disabled as RXEMPTY will never be set * as read bytes will not be removed from the FIFO.
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 188/390 iio: adc: at91-sama5d2_adc: disable/prepare buffer on suspend/resume
In reply to Greg Kroah-HartmanFrom: Claudiu Beznea <[email protected]>
[ Upstream commit 808175e21d9b7f866eda742e8970f27b78afe5db ]
In case triggered buffers are enabled while system is suspended they will not work anymore after resume. For this call at91_adc_buffer_postdisable() on suspend and at91_adc_buffer_prepare() on resume. On tests it has been seen that at91_adc_buffer_postdisable() call is not necessary but it has been kept because it also does the book keeping for DMA. On resume path there is no need to call at91_adc_configure_touch() as it is embedded in at91_adc_buffer_prepare().
--- drivers/iio/adc/at91-sama5d2_adc.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/iio/adc/at91-sama5d2_adc.c +7 -7
@@ -1907,6 +1907,9 @@ static __maybe_unused int at91_adc_suspend(struct device *dev)struct iio_dev *indio_dev =dev_get_drvdata (dev);struct at91_adc_state *st =iio_priv (indio_dev); +if (iio_buffer_enabled (indio_dev)) +at91_adc_buffer_postdisable (indio_dev); +/* * Do a sofware reset of the ADC before we go to suspend. * this will ensure that all pins are free from being muxed by the ADC
@@ -1950,14 +1953,11 @@ static __maybe_unused int at91_adc_resume(struct device *dev)if (!iio_buffer_enabled (indio_dev))return 0 ; -/* check if we are enabling triggered buffer or the touchscreen */ -if (at91_adc_current_chan_is_touch (indio_dev)) -return at91_adc_configure_touch (st, true); -else -return at91_adc_configure_trigger (st->trig, true); + ret =at91_adc_buffer_prepare (indio_dev); +if (ret) + goto vref_disable_resume; -/* not needed but more explicit */ -return 0 ; +return at91_adc_configure_trigger (st->trig, true); vref_disable_resume:regulator_disable (st->vref);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 186/390 iio: adc: at91-sama5d2_adc: check return status for pressure and touch
In reply to Greg Kroah-HartmanFrom: Claudiu Beznea <[email protected]>
[ Upstream commit d84ace944a3b24529798dbae1340dea098473155 ]
Check return status of at91_adc_read_position() and at91_adc_read_pressure() in at91_adc_read_info_raw().
--- drivers/iio/adc/at91-sama5d2_adc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/iio/adc/at91-sama5d2_adc.c +6 -2
@@ -1355,8 +1355,10 @@ static int at91_adc_read_info_raw(struct iio_dev *indio_dev, *val = tmp_val;mutex_unlock (&st->lock);iio_device_release_direct_mode (indio_dev); +if (ret >0 ) + ret =at91_adc_adjust_val_osr (st, val); -return at91_adc_adjust_val_osr (st, val); +return ret; }if (chan->type ==IIO_PRESSURE ) { ret =iio_device_claim_direct_mode (indio_dev);
@@ -1369,8 +1371,10 @@ static int at91_adc_read_info_raw(struct iio_dev *indio_dev, *val = tmp_val;mutex_unlock (&st->lock);iio_device_release_direct_mode (indio_dev); +if (ret >0 ) + ret =at91_adc_adjust_val_osr (st, val); -return at91_adc_adjust_val_osr (st, val); +return ret; }/* in this case we have a voltage channel */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 182/390 ARM: Drop CMDLINE_* dependency on ATAGS
In reply to Greg Kroah-HartmanFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit 136f4b1ec7c962ee37a787e095fd37b058d72bd3 ]
On arm32, the configuration options to specify the kernel command line type depend on ATAGS. However, the actual CMDLINE cofiguration option does not depend on ATAGS, and the code that handles this is not specific to ATAGS (see drivers/of/fdt.c:early_init_dt_scan_chosen()).
Hence users who desire to override the kernel command line on arm32 must enable support for ATAGS, even on a pure-DT system. Other architectures (arm64, loongarch, microblaze, nios2, powerpc, and riscv) do not impose such a restriction.
Hence drop the dependency on ATAGS.
--- arch/arm/Kconfig | 1 - 1 file changed, 1 deletion(-)
arch/arm/Kconfig +0 -1
@@ -1791,7 +1791,6 @@ config CMDLINE choice prompt "Kernel command line type" if CMDLINE != "" default CMDLINE_FROM_BOOTLOADER - depends on ATAGS config CMDLINE_FROM_BOOTLOADER bool "Use bootloader kernel arguments if available"
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 159/390 mmc: au1xmmc: Fix an error handling path in au1xmmc_probe()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 5cbedf52608cc3cbc1c2a9a861fb671620427a20 ]
If clk_prepare_enable() fails, there is no point in calling clk_disable_unprepare() in the error handling path.
Move the out_clk label at the right place.
--- drivers/mmc/host/au1xmmc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/mmc/host/au1xmmc.c +2 -1
@@ -1097,8 +1097,9 @@ static int au1xmmc_probe(struct platform_device *pdev)if (host->platdata && host->platdata->cd_setup && !(mmc->caps &MMC_CAP_NEEDS_POLL )) host->platdata->cd_setup (mmc,0 ); -out_clk: +clk_disable_unprepare (host->clk); +out_clk:clk_put (host->clk); out_irq:free_irq (host->irq, host);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 231/390 RDMA/cm: Use SLID in the work completion as the DLID in responder side
In reply to Greg Kroah-HartmanFrom: Mark Zhang <[email protected]>
[ Upstream commit b7d95040c13f61a4a6a859c5355faf583eff9658 ]
The responder should always use WC's SLID as the dlid, to follow the IB SPEC section "13.5.4.2 COMMON RESPONSE ACTIONS":
A responder always takes the following actions in constructing a response packet:
- The SLID of the received packet is used as the DLID in the response packet.
--- drivers/infiniband/core/cm.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/infiniband/core/cm.c +7 -7
@@ -1643,14 +1643,13 @@ static void cm_path_set_rec_type(structstatic void cm_format_path_lid_from_req (struct cm_req_msg *req_msg,struct sa_path_rec *primary_path, -struct sa_path_rec *alt_path) +struct sa_path_rec *alt_path, +struct ib_wc *wc) {u32 lid;if (primary_path->rec_type !=SA_PATH_REC_TYPE_OPA ) { -sa_path_set_dlid (primary_path, -IBA_GET (CM_REQ_PRIMARY_LOCAL_PORT_LID , - req_msg)); +sa_path_set_dlid (primary_path, wc->slid);sa_path_set_slid (primary_path,IBA_GET (CM_REQ_PRIMARY_REMOTE_PORT_LID , req_msg));
@@ -1687,7 +1686,8 @@ static void cm_format_path_lid_from_req(static void cm_format_paths_from_req (struct cm_req_msg *req_msg,struct sa_path_rec *primary_path, -struct sa_path_rec *alt_path) +struct sa_path_rec *alt_path, +struct ib_wc *wc) { primary_path->dgid = *IBA_GET_MEM_PTR (CM_REQ_PRIMARY_LOCAL_PORT_GID , req_msg);
@@ -1745,7 +1745,7 @@ static void cm_format_paths_from_req(strif (sa_path_is_roce (alt_path)) alt_path->roce.route_resolved = false; } -cm_format_path_lid_from_req (req_msg, primary_path, alt_path); +cm_format_path_lid_from_req (req_msg, primary_path, alt_path, wc); }static u16 cm_get_bth_pkey (struct cm_work *work)
@@ -2163,7 +2163,7 @@ static int cm_req_handler(struct cm_workif (cm_req_has_alt_path (req_msg)) work->path[1 ].rec_type = work->path[0 ].rec_type;cm_format_paths_from_req (req_msg, &work->path[0 ], - &work->path[1 ]); + &work->path[1 ], work->mad_recv_wc->wc);if (cm_id_priv->av.ah_attr.type ==RDMA_AH_ATTR_TYPE_ROCE )sa_path_set_dmac (&work->path[0 ], cm_id_priv->av.ah_attr.roce.dmac);
Greg Kroah-Hartman
maintainerPATCH 219/390 dyndbg: let query-modname override actual module name
In reply to Greg Kroah-HartmanFrom: Jim Cromie <[email protected]>
[ Upstream commit e75ef56f74965f426dd819a41336b640ffdd8fbc ]
dyndbg's control-parser: ddebug_parse_query(), requires that search
terms: module, func, file, lineno, are used only once in a query; a thing cannot be named both foo and bar.
The cited commit added an overriding module modname, taken from the module loader, which is authoritative. So it set query.module 1st, which disallowed its use in the query-string.
But now, its useful to allow a module-load to enable classes across a whole (or part of) a subsystem at once.
# enable (dynamic-debug in) drm only modprobe drm dyndbg="class DRM_UT_CORE +p"
# get drm_helper too modprobe drm dyndbg="class DRM_UT_CORE module drm* +p"
# get everything that knows DRM_UT_CORE modprobe drm dyndbg="class DRM_UT_CORE module * +p"
# also for boot-args: drm.dyndbg="class DRM_UT_CORE module * +p"
So convert the override into a default, by filling it only when/after the query-string omitted the module.
NB: the query class FOO handling is forthcoming.
--- lib/dynamic_debug.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
lib/dynamic_debug.c +7 -4
@@ -380,10 +380,6 @@ static int ddebug_parse_query(char *words[], int nwords,return -EINVAL ; } -if (modname) -/* support $modname.dyndbg=<multiple queries> */ - query->module = modname; -for (i =0 ; i < nwords; i +=2 ) {char *keyword = words[i];char *arg = words[i+1 ];
@@ -424,6 +420,13 @@ static int ddebug_parse_query(char *words[], int nwords,if (rc)return rc; } +if (!query->module && modname) +/* +* support $modname.dyndbg=<multiple queries>, when +* not given in the query itself +*/ + query->module = modname; +vpr_info_dq (query,"parsed" );return 0 ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 162/390 drm/msm/dp: correct 1.62G link rate at dp_catalog_ctrl_config_msa()
In reply to Greg Kroah-HartmanFrom: Kuogee Hsieh <[email protected]>
[ Upstream commit aa0bff10af1c4b92e6b56e3e1b7f81c660d3ba78 ]
At current implementation there is an extra 0 at 1.62G link rate which cause no correct pixel_div selected for 1.62G link rate to calculate mvid and nvid. This patch delete the extra 0 to have mvid and nvid be calculated correctly.
Changes in v2:
-- fix Fixes tag's text
Changes in v3:
-- fix misspelling of "Reviewed-by"
Patchwork: https://patchwork.freedesktop.org/patch/499328/
--- drivers/gpu/drm/msm/dp/dp_catalog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/dp/dp_catalog.c +1 -1
@@ -416,7 +416,7 @@ void dp_catalog_ctrl_config_msa(struct dp_catalog *dp_catalog,if (rate == link_rate_hbr3) pixel_div =6 ; -else if (rate ==1620000 || rate ==270000 ) +else if (rate ==162000 || rate ==270000 ) pixel_div =2 ;else if (rate == link_rate_hbr2) pixel_div =4 ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 227/390 ata: fix ata_id_has_dipm()
In reply to Greg Kroah-HartmanFrom: Niklas Cassel <[email protected]>
[ Upstream commit 630624cb1b5826d753ac8e01a0e42de43d66dedf ]
ACS-5 section
7.13.6.36 Word 78: Serial ATA features supported
states that:
If word 76 is not 0000h or FFFFh, word 78 reports the features supported by the device. If this word is not supported, the word shall be cleared to zero.
(This text also exists in really old ACS standards, e.g. ACS-3.)
The problem with ata_id_has_dipm() is that the while it performs a check against 0 and 0xffff, it performs the check against ATA_ID_FEATURE_SUPP (word 78), the same word where the feature bit is stored.
Fix this by performing the check against ATA_ID_SATA_CAPABILITY (word 76), like required by the spec. The feature bit check itself is of course still performed against ATA_ID_FEATURE_SUPP (word 78).
Additionally, move the macro to the other ATA_ID_FEATURE_SUPP macros (which already have this check), thus making it more likely that the next ATA_ID_FEATURE_SUPP macro that is added will include this check.
--- include/linux/ata.h | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-)
include/linux/ata.h +4 -11
@@ -573,6 +573,10 @@ struct ata_bmdma_prd { ((((id)[ATA_ID_SATA_CAPABILITY ] !=0x0000 ) && \ ((id)[ATA_ID_SATA_CAPABILITY ] !=0xffff )) && \ ((id)[ATA_ID_FEATURE_SUPP] & (1 << 7))) +#define ata_id_has_dipm (id) \ + ((((id)[ATA_ID_SATA_CAPABILITY] != 0x0000) && \ + ((id)[ATA_ID_SATA_CAPABILITY] != 0xffff)) && \ + ((id)[ATA_ID_FEATURE_SUPP] & (1 << 3)))#define ata_id_iordy_disable (id) ((id)[ATA_ID_CAPABILITY] & (1 << 10))#define ata_id_has_iordy (id) ((id)[ATA_ID_CAPABILITY] & (1 << 11))#define ata_id_u32 (id,n) \
@@ -596,17 +600,6 @@ static inline bool ata_id_has_hipm(const u16 *id)return val & (1 <<9 ); } -static inline bool ata_id_has_dipm (const u16 *id) -{ -u16 val = id[ATA_ID_FEATURE_SUPP ]; - -if (val ==0 || val ==0xffff ) -return false; - -return val & (1 <<3 ); -} - -static inline bool ata_id_has_fua (const u16 *id) {if ((id[ATA_ID_CFSSE ] &0xC000 ) !=0x4000 )
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 233/390 xhci: Dont show warning for reinit on known broken suspend
In reply to Greg Kroah-HartmanFrom: Mario Limonciello <[email protected]>
[ Upstream commit 484d6f7aa3283d082c87654b7fe7a7f725423dfb ]
commit 8b328f8002bc ("xhci: re-initialize the HC during resume if HCE was set") introduced a new warning message when the host controller error was set and re-initializing.
This is expected behavior on some designs which already set xhci->broken_suspend so the new warning is alarming to some users.
Modify the code to only show the warning if this was a surprising behavior to the XHCI driver.
--- drivers/usb/host/xhci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/host/xhci.c +2 -1
@@ -1163,7 +1163,8 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated)/* re-initialize the HC on Restore Error, or Host Controller Error */ if (temp & (STS_SRE |STS_HCE )) { reinit_xhc = true; -xhci_warn (xhci,"xHC error in resume, USBSTS 0x%x, Reinit\n" , temp); +if (!xhci->broken_suspend) +xhci_warn (xhci,"xHC error in resume, USBSTS 0x%x, Reinit\n" , temp); }if (reinit_xhc) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 242/390 serial: 8250: Fix restoring termios speed after suspend
In reply to Greg Kroah-HartmanFrom: Pali Rohár <[email protected]>
[ Upstream commit 379a33786d489ab81885ff0b3935cfeb36137fea ]
Since commit edc6afc54968 ("tty: switch to ktermios and new framework") termios speed is no longer stored only in c_cflag member but also in new additional c_ispeed and c_ospeed members. If BOTHER flag is set in c_cflag then termios speed is stored only in these new members.
Since commit 027b57170bf8 ("serial: core: Fix initializing and restoring termios speed") termios speed is available also in struct console.
So properly restore also c_ispeed and c_ospeed members after suspend to fix restoring termios speed which is not represented by Bnnn constant.
--- drivers/tty/serial/8250/8250_port.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/tty/serial/8250/8250_port.c +6 -1
@@ -3289,8 +3289,13 @@ static void serial8250_console_restore(struct uart_8250_port *up)unsigned int baud, quot, frac =0 ; termios.c_cflag = port->cons->cflag; -if (port->state->port.tty && termios.c_cflag ==0 ) + termios.c_ispeed = port->cons->ispeed; + termios.c_ospeed = port->cons->ospeed; +if (port->state->port.tty && termios.c_cflag ==0 ) { termios.c_cflag = port->state->port.tty->termios.c_cflag; + termios.c_ispeed = port->state->port.tty->termios.c_ispeed; + termios.c_ospeed = port->state->port.tty->termios.c_ospeed; + } baud =serial8250_get_baud_rate (port, &termios,NULL ); quot =serial8250_get_divisor (port, baud, &frac);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 148/390 platform/chrome: fix memory corruption in ioctl
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 8a07b45fd3c2dda24fad43639be5335a4595196a ]
If "s_mem.bytes" is larger than the buffer size it leads to memory corruption.
--- drivers/platform/chrome/cros_ec_chardev.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/platform/chrome/cros_ec_chardev.c +3 -0
@@ -327,6 +327,9 @@ static long cros_ec_chardev_ioctl_readmem(struct cros_ec_dev *ec,if (copy_from_user (&s_mem, arg,sizeof (s_mem)))return -EFAULT ; +if (s_mem.bytes >sizeof (s_mem.buffer)) +return -EINVAL ; + num = ec_dev->cmd_readmem (ec_dev, s_mem.offset, s_mem.bytes, s_mem.buffer);if (num <=0 )
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 174/390 soc: qcom: smsm: Fix refcount leak bugs in qcom_smsm_probe()
In reply to Greg Kroah-HartmanFrom: Liang He <[email protected]>
[ Upstream commit af8f6f39b8afd772fda4f8e61823ef8c021bf382 ]
There are two refcount leak bugs in qcom_smsm_probe():
(1) The 'local_node' is escaped out from for_each_child_of_node() as the break of iteration, we should call of_node_put() for it in error path or when it is not used anymore.
(2) The 'node' is escaped out from for_each_available_child_of_node() as the 'goto', we should call of_node_put() for it in goto target.
--- drivers/soc/qcom/smsm.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-)
drivers/soc/qcom/smsm.c +13 -7
@@ -511,7 +511,7 @@ static int qcom_smsm_probe(struct platform_device *pdev)for (id =0 ; id < smsm->num_hosts; id++) { ret =smsm_parse_ipc (smsm, id);if (ret <0 ) -return ret; + goto out_put; }/* Acquire the main SMSM state vector */
@@ -519,13 +519,14 @@ static int qcom_smsm_probe(struct platform_device *pdev) smsm->num_entries * sizeof(u32));if (ret <0 && ret != -EEXIST ) {dev_err (&pdev->dev,"unable to allocate shared state entry\n" ); -return ret; + goto out_put; } states =qcom_smem_get (QCOM_SMEM_HOST_ANY ,SMEM_SMSM_SHARED_STATE ,NULL );if (IS_ERR (states)) {dev_err (&pdev->dev,"Unable to acquire shared state entry\n" ); -return PTR_ERR (states); + ret =PTR_ERR (states); + goto out_put; }/* Acquire the list of interrupt mask vectors */
@@ -533,13 +534,14 @@ static int qcom_smsm_probe(struct platform_device *pdev) ret =qcom_smem_alloc (QCOM_SMEM_HOST_ANY ,SMEM_SMSM_CPU_INTR_MASK , size);if (ret <0 && ret != -EEXIST ) {dev_err (&pdev->dev,"unable to allocate smsm interrupt mask\n" ); -return ret; + goto out_put; } intr_mask =qcom_smem_get (QCOM_SMEM_HOST_ANY ,SMEM_SMSM_CPU_INTR_MASK ,NULL );if (IS_ERR (intr_mask)) {dev_err (&pdev->dev,"unable to acquire shared memory interrupt mask\n" ); -return PTR_ERR (intr_mask); + ret =PTR_ERR (intr_mask); + goto out_put; }/* Setup the reference to the local state bits */
@@ -550,7 +552,8 @@ static int qcom_smsm_probe(struct platform_device *pdev) smsm->state =qcom_smem_state_register (local_node, &smsm_state_ops, smsm);if (IS_ERR (smsm->state)) {dev_err (smsm->dev,"failed to register qcom_smem_state\n" ); -return PTR_ERR (smsm->state); + ret =PTR_ERR (smsm->state); + goto out_put; }/* Register handlers for remote processor entries of interest. */
@@ -580,16 +583,19 @@ static int qcom_smsm_probe(struct platform_device *pdev) }platform_set_drvdata (pdev, smsm); +of_node_put (local_node);return 0 ; unwind_interfaces: +of_node_put (node);for (id =0 ; id < smsm->num_entries; id++)if (smsm->entries[id].domain)irq_domain_remove (smsm->entries[id].domain);qcom_smem_state_unregister (smsm->state); - +out_put: +of_node_put (local_node);return ret; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 244/390 scsi: iscsi: iscsi_tcp: Fix null-ptr-deref while calling getpeername()
In reply to Greg Kroah-HartmanFrom: Mike Christie <[email protected]>
[ Upstream commit 57569c37f0add1b6489e1a1563c71519daf732cf ]
Fix a NULL pointer crash that occurs when we are freeing the socket at the same time we access it via sysfs.
The problem is that:
1. iscsi_sw_tcp_conn_get_param() and iscsi_sw_tcp_host_get_param() take the frwd_lock and do sock_hold() then drop the frwd_lock. sock_hold() does a get on the "struct sock".
2. iscsi_sw_tcp_release_conn() does sockfd_put() which does the last put on the "struct socket" and that does __sock_release() which sets the sock->ops to NULL.
3. iscsi_sw_tcp_conn_get_param() and iscsi_sw_tcp_host_get_param() then
call kernel_getpeername() which accesses the NULL sock->ops.
Above we do a get on the "struct sock", but we needed a get on the "struct socket". Originally, we just held the frwd_lock the entire time but in commit bcf3a2953d36 ("scsi: iscsi: iscsi_tcp: Avoid holding spinlock while calling getpeername()") we switched to refcount based because the network layer changed and started taking a mutex in that path, so we could no longer hold the frwd_lock.
Instead of trying to maintain multiple refcounts, this just has us use a mutex for accessing the socket in the interface code paths.
--- drivers/scsi/iscsi_tcp.c | 73 ++++++++++++++++++++++++++++------------ drivers/scsi/iscsi_tcp.h | 2 ++ 2 files changed, 54 insertions(+), 21 deletions(-)
drivers/scsi/iscsi_tcp.c +52 -21
@@ -558,6 +558,8 @@ iscsi_sw_tcp_conn_create(struct iscsi_cls_session *cls_session, tcp_conn = conn->dd_data; tcp_sw_conn = tcp_conn->dd_data; +mutex_init (&tcp_sw_conn->sock_lock); + tfm =crypto_alloc_ahash ("crc32c" ,0 ,CRYPTO_ALG_ASYNC );if (IS_ERR (tfm)) goto free_conn;
@@ -592,11 +594,15 @@ iscsi_sw_tcp_conn_create(struct iscsi_cls_session *cls_session,static void iscsi_sw_tcp_release_conn (struct iscsi_conn *conn) { -struct iscsi_session *session = conn->session;struct iscsi_tcp_conn *tcp_conn = conn->dd_data;struct iscsi_sw_tcp_conn *tcp_sw_conn = tcp_conn->dd_data;struct socket *sock = tcp_sw_conn->sock; +/* +* The iscsi transport class will make sure we are not called in +* parallel with start, stop, bind and destroys. However, this can be +* called twice if userspace does a stop then a destroy. +*/ if (!sock)return ;
@@ -604,9 +610,9 @@ static void iscsi_sw_tcp_release_conn(struct iscsi_conn *conn)iscsi_sw_tcp_conn_restore_callbacks (conn);sock_put (sock->sk); -spin_lock_bh (&session->frwd_lock); +mutex_lock (&tcp_sw_conn->sock_lock); tcp_sw_conn->sock =NULL ; -spin_unlock_bh (&session->frwd_lock); +mutex_unlock (&tcp_sw_conn->sock_lock);sockfd_put (sock); }
@@ -658,7 +664,6 @@ iscsi_sw_tcp_conn_bind(struct iscsi_cls_session *cls_session, struct iscsi_cls_conn *cls_conn, uint64_t transport_eph, int is_leading) { - struct iscsi_session *session = cls_session->dd_data; struct iscsi_conn *conn = cls_conn->dd_data;struct iscsi_tcp_conn *tcp_conn = conn->dd_data;struct iscsi_sw_tcp_conn *tcp_sw_conn = tcp_conn->dd_data;
@@ -678,10 +683,10 @@ iscsi_sw_tcp_conn_bind(struct iscsi_cls_session *cls_session,if (err) goto free_socket; -spin_lock_bh (&session->frwd_lock); +mutex_lock (&tcp_sw_conn->sock_lock);/* bind iSCSI connection and socket */ tcp_sw_conn->sock = sock; -spin_unlock_bh (&session->frwd_lock); +mutex_unlock (&tcp_sw_conn->sock_lock);/* setup Socket parameters */ sk = sock->sk;
@@ -717,8 +722,15 @@ static int iscsi_sw_tcp_conn_set_param(struct iscsi_cls_conn *cls_conn,break ;case ISCSI_PARAM_DATADGST_EN :iscsi_set_param (cls_conn, param, buf, buflen); + +mutex_lock (&tcp_sw_conn->sock_lock); +if (!tcp_sw_conn->sock) { +mutex_unlock (&tcp_sw_conn->sock_lock); +return -ENOTCONN ; + } tcp_sw_conn->sendpage = conn->datadgst_en ? sock_no_sendpage : tcp_sw_conn->sock->ops->sendpage; +mutex_unlock (&tcp_sw_conn->sock_lock);break ;case ISCSI_PARAM_MAX_R2T :return iscsi_tcp_set_max_r2t (conn, buf);
@@ -733,8 +745,8 @@ static int iscsi_sw_tcp_conn_get_param(struct iscsi_cls_conn *cls_conn, enum iscsi_param param, char *buf) { struct iscsi_conn *conn = cls_conn->dd_data; -struct iscsi_tcp_conn *tcp_conn = conn->dd_data; -struct iscsi_sw_tcp_conn *tcp_sw_conn = tcp_conn->dd_data; +struct iscsi_sw_tcp_conn *tcp_sw_conn; +struct iscsi_tcp_conn *tcp_conn;struct sockaddr_in6 addr;struct socket *sock;int rc;
@@ -744,21 +756,36 @@ static int iscsi_sw_tcp_conn_get_param(struct iscsi_cls_conn *cls_conn,case ISCSI_PARAM_CONN_ADDRESS :case ISCSI_PARAM_LOCAL_PORT :spin_lock_bh (&conn->session->frwd_lock); -if (!tcp_sw_conn || !tcp_sw_conn->sock) { +if (!conn->session->leadconn) {spin_unlock_bh (&conn->session->frwd_lock);return -ENOTCONN ; } - sock = tcp_sw_conn->sock; -sock_hold (sock->sk); +/* +* The conn has been setup and bound, so just grab a ref +* incase a destroy runs while we are in the net layer. +*/ +iscsi_get_conn (conn->cls_conn);spin_unlock_bh (&conn->session->frwd_lock); + tcp_conn = conn->dd_data; + tcp_sw_conn = tcp_conn->dd_data; + +mutex_lock (&tcp_sw_conn->sock_lock); + sock = tcp_sw_conn->sock; +if (!sock) { + rc = -ENOTCONN ; + goto sock_unlock; + } +if (param ==ISCSI_PARAM_LOCAL_PORT ) rc =kernel_getsockname (sock, (struct sockaddr *)&addr);else rc =kernel_getpeername (sock, (struct sockaddr *)&addr); -sock_put (sock->sk); +sock_unlock: +mutex_unlock (&tcp_sw_conn->sock_lock); +iscsi_put_conn (conn->cls_conn);if (rc <0 )return rc;
@@ -796,17 +823,21 @@ static int iscsi_sw_tcp_host_get_param(struct Scsi_Host *shost, } tcp_conn = conn->dd_data; tcp_sw_conn = tcp_conn->dd_data; - sock = tcp_sw_conn->sock; -if (!sock) { -spin_unlock_bh (&session->frwd_lock); -return -ENOTCONN ; - } -sock_hold (sock->sk); +/* +* The conn has been setup and bound, so just grab a ref +* incase a destroy runs while we are in the net layer. +*/ +iscsi_get_conn (conn->cls_conn);spin_unlock_bh (&session->frwd_lock); - rc =kernel_getsockname (sock, - (struct sockaddr *)&addr); -sock_put (sock->sk); +mutex_lock (&tcp_sw_conn->sock_lock); + sock = tcp_sw_conn->sock; +if (!sock) + rc = -ENOTCONN ; +else + rc =kernel_getsockname (sock, (struct sockaddr *)&addr); +mutex_unlock (&tcp_sw_conn->sock_lock); +iscsi_put_conn (conn->cls_conn);if (rc <0 )return rc;
drivers/scsi/iscsi_tcp.h +2 -0
@@ -28,6 +28,8 @@ struct iscsi_sw_tcp_send {struct iscsi_sw_tcp_conn {struct socket *sock; +/* Taken when accessing the sock from the netlink/sysfs interface */ +struct mutex sock_lock;struct iscsi_sw_tcp_send out;/* old values for socket callbacks */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 206/390 media: exynos4-is: fimc-is: Add of_node_put() when breaking out of loop
In reply to Greg Kroah-HartmanFrom: Liang He <[email protected]>
[ Upstream commit 211f8304fa21aaedc2c247f0c9d6c7f1aaa61ad7 ]
In fimc_is_register_subdevs(), we need to call of_node_put() for the reference 'i2c_bus' when breaking out of the for_each_compatible_node() which has increased the refcount.
--- drivers/media/platform/exynos4-is/fimc-is.c | 1 + 1 file changed, 1 insertion(+)
drivers/media/platform/exynos4-is/fimc-is.c +1 -0
@@ -213,6 +213,7 @@ static int fimc_is_register_subdevs(struct fimc_is *is)if (ret <0 || index >=FIMC_IS_SENSORS_NUM ) {of_node_put (child); +of_node_put (i2c_bus);return ret; } index++;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 195/390 usb: common: debug: Check non-standard control requests
In reply to Greg Kroah-HartmanFrom: Thinh Nguyen <[email protected]>
[ Upstream commit b6155eaf6b05e558218b44b88a6cad03f15a586c ]
Previously usb_decode_ctrl() only decodes standard control requests, but it was used for non-standard requests also. If it's non-standard or unknown standard bRequest, print the Setup data values.
--- drivers/usb/common/debug.c | 96 +++++++++++++++++++++++++------------- 1 file changed, 64 insertions(+), 32 deletions(-)
drivers/usb/common/debug.c +64 -32
@@ -207,30 +207,28 @@ static void usb_decode_set_isoch_delay(__u8 wValue, char *str, size_t size)snprintf (str, size,"Set Isochronous Delay(Delay = %d ns)" , wValue); } -/** -* usb_decode_ctrl - Returns human readable representation of control request. -* @str: buffer to return a human-readable representation of control request. -* This buffer should have about 200 bytes. -* @size: size of str buffer. -* @bRequestType: matches the USB bmRequestType field -* @bRequest: matches the USB bRequest field -* @wValue: matches the USB wValue field (CPU byte order) -* @wIndex: matches the USB wIndex field (CPU byte order) -* @wLength: matches the USB wLength field (CPU byte order) -* -* Function returns decoded, formatted and human-readable description of -* control request packet. -* -* The usage scenario for this is for tracepoints, so function as a return -* use the same value as in parameters. This approach allows to use this -* function in TP_printk -* -* Important: wValue, wIndex, wLength parameters before invoking this function -* should be processed by le16_to_cpu macro. -*/ -const char *usb_decode_ctrl (char *str,size_t size,__u8 bRequestType, -__u8 bRequest,__u16 wValue,__u16 wIndex, -__u16 wLength) +static void usb_decode_ctrl_generic (char *str,size_t size,__u8 bRequestType, +__u8 bRequest,__u16 wValue,__u16 wIndex, +__u16 wLength) +{ +u8 recip = bRequestType &USB_RECIP_MASK ; +u8 type = bRequestType &USB_TYPE_MASK ; + +snprintf (str, size, +"Type=%s Recipient=%s Dir=%s bRequest=%u wValue=%u wIndex=%u wLength=%u" , + (type ==USB_TYPE_STANDARD ) ?"Standard" : + (type ==USB_TYPE_VENDOR ) ?"Vendor" : + (type ==USB_TYPE_CLASS ) ?"Class" :"Unknown" , + (recip ==USB_RECIP_DEVICE ) ?"Device" : + (recip ==USB_RECIP_INTERFACE ) ?"Interface" : + (recip ==USB_RECIP_ENDPOINT ) ?"Endpoint" :"Unknown" , + (bRequestType &USB_DIR_IN ) ?"IN" :"OUT" , + bRequest, wValue, wIndex, wLength); +} + +static void usb_decode_ctrl_standard (char *str,size_t size,__u8 bRequestType, +__u8 bRequest,__u16 wValue,__u16 wIndex, +__u16 wLength) {switch (bRequest) {case USB_REQ_GET_STATUS :
@@ -271,14 +269,48 @@ const char *usb_decode_ctrl(char *str, size_t size, __u8 bRequestType,usb_decode_set_isoch_delay (wValue, str, size);break ;default : -snprintf (str, size,"%02x %02x %02x %02x %02x %02x %02x %02x" , - bRequestType, bRequest, - (u8)(cpu_to_le16 (wValue) &0xff ), - (u8)(cpu_to_le16 (wValue) >>8 ), - (u8)(cpu_to_le16 (wIndex) &0xff ), - (u8)(cpu_to_le16 (wIndex) >>8 ), - (u8)(cpu_to_le16 (wLength) &0xff ), - (u8)(cpu_to_le16 (wLength) >>8 )); +usb_decode_ctrl_generic (str, size, bRequestType, bRequest, + wValue, wIndex, wLength); +break ; + } +} + +/** +* usb_decode_ctrl - Returns human readable representation of control request. +* @str: buffer to return a human-readable representation of control request. +* This buffer should have about 200 bytes. +* @size: size of str buffer. +* @bRequestType: matches the USB bmRequestType field +* @bRequest: matches the USB bRequest field +* @wValue: matches the USB wValue field (CPU byte order) +* @wIndex: matches the USB wIndex field (CPU byte order) +* @wLength: matches the USB wLength field (CPU byte order) +* +* Function returns decoded, formatted and human-readable description of +* control request packet. +* +* The usage scenario for this is for tracepoints, so function as a return +* use the same value as in parameters. This approach allows to use this +* function in TP_printk +* +* Important: wValue, wIndex, wLength parameters before invoking this function +* should be processed by le16_to_cpu macro. +*/ +const char *usb_decode_ctrl (char *str,size_t size,__u8 bRequestType, +__u8 bRequest,__u16 wValue,__u16 wIndex, +__u16 wLength) +{ +switch (bRequestType &USB_TYPE_MASK ) { +case USB_TYPE_STANDARD : +usb_decode_ctrl_standard (str, size, bRequestType, bRequest, + wValue, wIndex, wLength); +break ; +case USB_TYPE_VENDOR : +case USB_TYPE_CLASS : +default : +usb_decode_ctrl_generic (str, size, bRequestType, bRequest, + wValue, wIndex, wLength); +break ; }return str;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 37/390 UM: cpuinfo: Fix a warning for CONFIG_CPUMASK_OFFSTACK
In reply to Greg Kroah-HartmanFrom: Huacai Chen <[email protected]>
commit 16c546e148fa6d14a019431436a6f7b4087dbccd upstream.
When CONFIG_CPUMASK_OFFSTACK and CONFIG_DEBUG_PER_CPU_MAPS is selected, cpu_max_bits_warn() generates a runtime warning similar as below while we show /proc/cpuinfo. Fix this by using nr_cpu_ids (the runtime limit) instead of NR_CPUS to iterate CPUs.
[ 3.052463] ------------[ cut here ]------------ [ 3.059679] WARNING: CPU: 3 PID: 1 at include/linux/cpumask.h:108 show_cpuinfo+0x5e8/0x5f0 [ 3.070072] Modules linked in: efivarfs autofs4 [ 3.076257] CPU: 0 PID: 1 Comm: systemd Not tainted 5.19-rc5+ #1052 [ 3.099465] Stack : 9000000100157b08 9000000000f18530 9000000000cf846c 9000000100154000 [ 3.109127] 9000000100157a50 0000000000000000 9000000100157a58 9000000000ef7430 [ 3.118774] 90000001001578e8 0000000000000040 0000000000000020 ffffffffffffffff [ 3.128412] 0000000000aaaaaa 1ab25f00eec96a37 900000010021de80 900000000101c890 [ 3.138056] 0000000000000000 0000000000000000 0000000000000000 0000000000aaaaaa [ 3.147711] ffff8000339dc220 0000000000000001 0000000006ab4000 0000000000000000 [ 3.157364] 900000000101c998 0000000000000004 9000000000ef7430 0000000000000000 [ 3.167012] 0000000000000009 000000000000006c 0000000000000000 0000000000000000 [ 3.176641] 9000000000d3de08 9000000001639390 90000000002086d8 00007ffff0080286 [ 3.186260] 00000000000000b0 0000000000000004 0000000000000000 0000000000071c1c [ 3.195868] ... [ 3.199917] Call Trace: [ 3.203941] [<90000000002086d8>] show_stack+0x38/0x14c [ 3.210666] [<9000000000cf846c>] dump_stack_lvl+0x60/0x88 [ 3.217625] [<900000000023d268>] __warn+0xd0/0x100 [ 3.223958] [<9000000000cf3c90>] warn_slowpath_fmt+0x7c/0xcc [ 3.231150] [<9000000000210220>] show_cpuinfo+0x5e8/0x5f0 [ 3.238080] [<90000000004f578c>] seq_read_iter+0x354/0x4b4 [ 3.245098] [<90000000004c2e90>] new_sync_read+0x17c/0x1c4 [ 3.252114] [<90000000004c5174>] vfs_read+0x138/0x1d0 [ 3.258694] [<90000000004c55f8>] ksys_read+0x70/0x100 [ 3.265265] [<9000000000cfde9c>] do_syscall+0x7c/0x94 [ 3.271820] [<9000000000202fe4>] handle_syscall+0xc4/0x160 [ 3.281824] ---[ end trace 8b484262b4b8c24c ]---
--- arch/um/kernel/um_arch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/um/kernel/um_arch.c +1 -1
@@ -77,7 +77,7 @@ static int show_cpuinfo(struct seq_filestatic void *c_start (struct seq_file *m,loff_t *pos) { -return *pos <NR_CPUS ? cpu_data + *pos :NULL ; +return *pos < nr_cpu_ids ? cpu_data + *pos :NULL ; }static void *c_next (struct seq_file *m,void *v,loff_t *pos)
Greg Kroah-Hartman
maintainerPATCH 8/390 ALSA: hda/realtek: Add Intel Reference SSID to support headset keys
In reply to Greg Kroah-HartmanFrom: Saranya Gopal <[email protected]>
commit 4f2e56a59b9947b3e698d3cabcb858765c12b1e8 upstream.
This patch fixes the issue with 3.5mm headset keys on RPL-P platform.
[ Rearranged the entry in SSID order by tiwai ]
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -8986,6 +8986,7 @@ static const struct snd_pci_quirk alc269SND_PCI_QUIRK (0x10ec ,0x10f2 ,"Intel Reference board" ,ALC700_FIXUP_INTEL_REFERENCE ),SND_PCI_QUIRK (0x10ec ,0x118c ,"Medion EE4254 MD62100" ,ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE ),SND_PCI_QUIRK (0x10ec ,0x1230 ,"Intel Reference board" ,ALC295_FIXUP_CHROME_BOOK ), +SND_PCI_QUIRK (0x10ec ,0x124c ,"Intel Reference board" ,ALC295_FIXUP_CHROME_BOOK ),SND_PCI_QUIRK (0x10ec ,0x1252 ,"Intel Reference board" ,ALC295_FIXUP_CHROME_BOOK ),SND_PCI_QUIRK (0x10ec ,0x1254 ,"Intel Reference board" ,ALC295_FIXUP_CHROME_BOOK ), SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-SZ6", ALC269_FIXUP_HEADSET_MODE),
Greg Kroah-Hartman
maintainerPATCH 32/390 RISC-V: Make port I/O string accessors actually work
In reply to Greg Kroah-HartmanFrom: Maciej W. Rozycki <[email protected]>
commit 9cc205e3c17d5716da7ebb7fa0c985555e95d009 upstream.
Fix port I/O string accessors such as insb', outsb', etc. which use the physical PCI port I/O address rather than the corresponding memory mapping to get at the requested location, which in turn breaks at least accesses made by our parport driver to a PCIe parallel port such as:
PCI parallel port detected: 1415:c118, I/O at 0x1000(0x1008), IRQ 20
parport0: PC-style at 0x1000 (0x1008), irq 20, using FIFO [PCSPP,TRISTATE,COMPAT,EPP,ECP]
causing a memory access fault:
Unable to handle kernel access to user memory without uaccess routines at virtual address 0000000000001008 Oops [#1] Modules linked in: CPU: 1 PID: 350 Comm: cat Not tainted 6.0.0-rc2-00283-g10d4879f9ef0-dirty #23 Hardware name: SiFive HiFive Unmatched A00 (DT) epc : parport_pc_fifo_write_block_pio+0x266/0x416 ra : parport_pc_fifo_write_block_pio+0xb4/0x416
epc : ffffffff80542c3e ra : ffffffff80542a8c sp : ffffffd88899fc60
gp : ffffffff80fa2700 tp : ffffffd882b1e900 t0 : ffffffd883d0b000 t1 : ffffffffff000002 t2 : 4646393043330a38 s0 : ffffffd88899fcf0 s1 : 0000000000001000 a0 : 0000000000000010 a1 : 0000000000000000 a2 : ffffffd883d0a010 a3 : 0000000000000023 a4 : 00000000ffff8fbb a5 : ffffffd883d0a001 a6 : 0000000100000000 a7 : ffffffc800000000 s2 : ffffffffff000002 s3 : ffffffff80d28880 s4 : ffffffff80fa1f50 s5 : 0000000000001008 s6 : 0000000000000008 s7 : ffffffd883d0a000 s8 : 0004000000000000 s9 : ffffffff80dc1d80 s10: ffffffd8807e4000
s11: 0000000000000000 t3 : 00000000000000ff t4 : 393044410a303930 t5 : 0000000000001000 t6 : 0000000000040000
status: 0000000200000120 badaddr: 0000000000001008 cause: 000000000000000f
[<ffffffff80543212>] parport_pc_compat_write_block_pio+0xfe/0x200 [<ffffffff8053bbc0>] parport_write+0x46/0xf8 [<ffffffff8050530e>] lp_write+0x158/0x2d2 [<ffffffff80185716>] vfs_write+0x8e/0x2c2 [<ffffffff80185a74>] ksys_write+0x52/0xc2 [<ffffffff80185af2>] sys_write+0xe/0x16 [<ffffffff80003770>] ret_from_syscall+0x0/0x2 ---[ end trace 0000000000000000 ]---
For simplicity address the problem by adding PCI_IOBASE to the physical address requested in the respective wrapper macros only, observing that the raw accessors such as __insb', __outsb', etc. are not supposed to be used other than by said macros. Remove the cast to long' that is no longer needed on addr' now that it is used as an offset from PCI_IOBASE and add parentheses around `addr' needed for predictable evaluation in macro expansion. No need to make said adjustments in separate changes given that current code is gravely broken and does not ever work.
--- arch/riscv/include/asm/io.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
arch/riscv/include/asm/io.h +8 -8
@@ -114,9 +114,9 @@ __io_reads_ins(reads, u32, l, __io_br(), __io_reads_ins(ins, u8, b, __io_pbr(), __io_par(addr)) __io_reads_ins(ins, u16, w, __io_pbr(), __io_par(addr)) __io_reads_ins(ins, u32, l, __io_pbr(), __io_par(addr)) -#define insb (addr, buffer, count) __insb((void __iomem *)(long)addr, buffer, count) -#define insw (addr, buffer, count) __insw((void __iomem *)(long)addr, buffer, count) -#define insl (addr, buffer, count) __insl((void __iomem *)(long)addr, buffer, count) +#define insb (addr, buffer, count) __insb(PCI_IOBASE + (addr), buffer, count) +#define insw (addr, buffer, count) __insw(PCI_IOBASE + (addr), buffer, count) +#define insl (addr, buffer, count) __insl(PCI_IOBASE + (addr), buffer, count) __io_writes_outs(writes, u8, b, __io_bw(), __io_aw())__io_writes_outs (writes, u16, w,__io_bw (),__io_aw ())
@@ -128,22 +128,22 @@ __io_writes_outs(writes, u32, l, __io_bw __io_writes_outs(outs, u8, b, __io_pbw(), __io_paw()) __io_writes_outs(outs, u16, w, __io_pbw(), __io_paw()) __io_writes_outs(outs, u32, l, __io_pbw(), __io_paw()) -#define outsb (addr, buffer, count) __outsb((void __iomem *)(long)addr, buffer, count) -#define outsw (addr, buffer, count) __outsw((void __iomem *)(long)addr, buffer, count) -#define outsl (addr, buffer, count) __outsl((void __iomem *)(long)addr, buffer, count) +#define outsb (addr, buffer, count) __outsb(PCI_IOBASE + (addr), buffer, count) +#define outsw (addr, buffer, count) __outsw(PCI_IOBASE + (addr), buffer, count) +#define outsl (addr, buffer, count) __outsl(PCI_IOBASE + (addr), buffer, count)#ifdef CONFIG_64BIT __io_reads_ins(reads, u64, q, __io_br(), __io_ar(addr))#define readsq (addr, buffer, count) __readsq(addr, buffer, count) __io_reads_ins(ins, u64, q, __io_pbr(), __io_par(addr)) -#define insq (addr, buffer, count) __insq((void __iomem *)addr, buffer, count) +#define insq (addr, buffer, count) __insq(PCI_IOBASE + (addr), buffer, count) __io_writes_outs(writes, u64, q, __io_bw(), __io_aw())#define writesq (addr, buffer, count) __writesq(addr, buffer, count) __io_writes_outs(outs, u64, q, __io_pbr(), __io_paw()) -#define outsq (addr, buffer, count) __outsq((void __iomem *)addr, buffer, count) +#define outsq (addr, buffer, count) __outsq(PCI_IOBASE + (addr), buffer, count)#endif #include <asm-generic/io.h>
Greg Kroah-Hartman
maintainerPATCH 271/390 crypto: sahara - dont sleep when in softirq
In reply to Greg Kroah-HartmanFrom: Zhengchao Shao <[email protected]>
[ Upstream commit 108586eba094b318e6a831f977f4ddcc403a15da ]
Function of sahara_aes_crypt maybe could be called by function of crypto_skcipher_encrypt during the rx softirq, so it is not allowed to use mutex lock.
--- drivers/crypto/sahara.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/crypto/sahara.c +9 -9
@@ -25,10 +25,10 @@#include <linux/kernel.h> #include <linux/kthread.h> #include <linux/module.h> -#include <linux/mutex.h> #include <linux/of.h> #include <linux/of_device.h> #include <linux/platform_device.h> +#include <linux/spinlock.h> #define SHA_BUFFER_LEN PAGE_SIZE#define SAHARA_MAX_SHA_BLOCK_SIZE SHA256_BLOCK_SIZE
@@ -195,7 +195,7 @@ struct sahara_dev {void __iomem *regs_base;struct clk *clk_ipg;struct clk *clk_ahb; -struct mutex queue_mutex; +spinlock_t queue_spinlock;struct task_struct *kthread;struct completion dma_completion;
@@ -641,9 +641,9 @@ static int sahara_aes_crypt(struct skcipher_request *req, unsigned long mode) rctx->mode = mode; -mutex_lock (&dev->queue_mutex); +spin_lock_bh (&dev->queue_spinlock); err =crypto_enqueue_request (&dev->queue, &req->base); -mutex_unlock (&dev->queue_mutex); +spin_unlock_bh (&dev->queue_spinlock);wake_up_process (dev->kthread);
@@ -1042,10 +1042,10 @@ static int sahara_queue_manage(void *data) do { __set_current_state(TASK_INTERRUPTIBLE); - mutex_lock(&dev->queue_mutex); + spin_lock_bh(&dev->queue_spinlock); backlog = crypto_get_backlog(&dev->queue); async_req = crypto_dequeue_request(&dev->queue); - mutex_unlock(&dev->queue_mutex); + spin_unlock_bh(&dev->queue_spinlock); if (backlog) backlog->complete(backlog, -EINPROGRESS);
@@ -1091,9 +1091,9 @@ static int sahara_sha_enqueue(struct ahash_request *req, int last) rctx->first =1 ; } -mutex_lock (&dev->queue_mutex); +spin_lock_bh (&dev->queue_spinlock); ret =crypto_enqueue_request (&dev->queue, &req->base); -mutex_unlock (&dev->queue_mutex); +spin_unlock_bh (&dev->queue_spinlock);wake_up_process (dev->kthread);
@@ -1454,7 +1454,7 @@ static int sahara_probe(struct platform_device *pdev)crypto_init_queue (&dev->queue,SAHARA_QUEUE_LENGTH ); -mutex_init (&dev->queue_mutex); +spin_lock_init (&dev->queue_spinlock); dev_ptr = dev;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 112/390 spi: qup: add missing clk_disable_unprepare on error in spi_qup_pm_resume_runtime()
In reply to Greg Kroah-HartmanFrom: Xu Qiang <[email protected]>
[ Upstream commit 494a22765ce479c9f8ad181c5d24cffda9f534bb ]
Add the missing clk_disable_unprepare() before return from spi_qup_pm_resume_runtime() in the error handling case.
--- drivers/spi/spi-qup.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/spi/spi-qup.c +3 -1
@@ -1199,8 +1199,10 @@ static int spi_qup_pm_resume_runtime(struct device *device)return ret; ret =clk_prepare_enable (controller->cclk); -if (ret) +if (ret) { +clk_disable_unprepare (controller->iclk);return ret; + }/* Disable clocks auto gaiting */ config =readl_relaxed (controller->base +QUP_CONFIG );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 246/390 fsi: core: Check error number after calling ida_simple_get
In reply to Greg Kroah-HartmanFrom: Jiasheng Jiang <[email protected]>
[ Upstream commit 35af9fb49bc5c6d61ef70b501c3a56fe161cce3e ]
If allocation fails, the ida_simple_get() will return error number. So master->idx could be error number and be used in dev_set_name(). Therefore, it should be better to check it and return error if fails, like the ida_simple_get() in __fsi_get_new_minor().
--- drivers/fsi/fsi-core.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/fsi/fsi-core.c +3 -0
@@ -1309,6 +1309,9 @@ int fsi_master_register(struct fsi_master *master)mutex_init (&master->scan_lock); master->idx =ida_simple_get (&master_ida,0 ,INT_MAX ,GFP_KERNEL ); +if (master->idx <0 ) +return master->idx; +dev_set_name (&master->dev,"fsi%d" , master->idx); master->dev.class = &fsi_master_class;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 278/390 crypto: inside-secure - Change swab to swab32
In reply to Greg Kroah-HartmanFrom: Peter Harliman Liem <[email protected]>
[ Upstream commit 664593407e936b6438fbfaaf98876910fd31cf9a ]
The use of swab() is causing failures in 64-bit arch, as it translates to __swab64() instead of the intended __swab32(). It eventually causes wrong results in xcbcmac & cmac algo.
--- drivers/crypto/inside-secure/safexcel_hash.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/crypto/inside-secure/safexcel_hash.c +4 -4
@@ -381,7 +381,7 @@ static int safexcel_ahash_send_req(struct crypto_async_request *async, int ring,u32 x; x = ipad[i] ^ ipad[i +4 ]; - cache[i] ^=swab (x); + cache[i] ^=swab32 (x); } } cache_len =AES_BLOCK_SIZE ;
@@ -819,7 +819,7 @@ static int safexcel_ahash_final(struct ahash_request *areq)u32 *result = (void *)areq->result;/* K3 */ - result[i] =swab (ctx->base.ipad.word[i +4 ]); + result[i] =swab32 (ctx->base.ipad.word[i +4 ]); } areq->result[0 ] ^=0x80 ;// 10- padding crypto_cipher_encrypt_one (ctx->kaes, areq->result, areq->result);
@@ -2104,7 +2104,7 @@ static int safexcel_xcbcmac_setkey(struct crypto_ahash *tfm, const u8 *key,crypto_cipher_encrypt_one (ctx->kaes, (u8 *)key_tmp +AES_BLOCK_SIZE ,"\x3\x3\x3\x3\x3\x3\x3\x3\x3\x3\x3\x3\x3\x3\x3\x3" );for (i =0 ; i <3 *AES_BLOCK_SIZE /sizeof (u32); i++) - ctx->base.ipad.word[i] =swab (key_tmp[i]); + ctx->base.ipad.word[i] =swab32 (key_tmp[i]);crypto_cipher_clear_flags (ctx->kaes,CRYPTO_TFM_REQ_MASK ); crypto_cipher_set_flags(ctx->kaes, crypto_ahash_get_flags(tfm) &
@@ -2187,7 +2187,7 @@ static int safexcel_cmac_setkey(struct crypto_ahash *tfm, const u8 *key,return ret;for (i =0 ; i < len /sizeof (u32); i++) - ctx->base.ipad.word[i +8 ] =swab (aes.key_enc[i]); + ctx->base.ipad.word[i +8 ] =swab32 (aes.key_enc[i]);/* precompute the CMAC key material */ crypto_cipher_clear_flags (ctx->kaes,CRYPTO_TFM_REQ_MASK );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 237/390 serial: 8250: Toggle IER bits on only after irq has been set up
In reply to Greg Kroah-HartmanFrom: Ilpo Järvinen <[email protected]>
[ Upstream commit 039d4926379b1d1c17b51cf21c500a5eed86899e ]
Invoking TIOCVHANGUP on 8250_mid port on Ice Lake-D and then reopening the port triggers these faults during serial8250_do_startup():
DMAR: DRHD: handling fault status reg 3
DMAR: [DMA Write NO_PASID] Request device [00:1a.0] fault addr 0x0 [fault reason 0x05] PTE Write access is not set
If the IRQ hasn't been set up yet, the UART will have zeroes in its MSI address/data registers. Disabling the IRQ at the interrupt controller won't stop the UART from performing a DMA write to the address programmed in its MSI address register (zero) when it wants to signal an interrupt.
The UARTs (in Ice Lake-D) implement PCI 2.1 style MSI without masking capability, so there is no way to mask the interrupt at the source PCI function level, except disabling the MSI capability entirely, but that would cause it to fall back to INTx# assertion, and the PCI specification prohibits disabling the MSI capability as a way to mask a function's interrupt service request.
The MSI address register is zeroed by the hangup as the irq is freed. The interrupt is signalled during serial8250_do_startup() performing a THRE test that temporarily toggles THRI in IER. The THRE test currently occurs before UART's irq (and MSI address) is properly set up.
Refactor serial8250_do_startup() such that irq is set up before the THRE test. The current irq setup code is intermixed with the timer setup code. As THRE test must be performed prior to the timer setup, extract it into own function and call it only after the THRE test.
The ->setup_timer() needs to be part of the struct uart_8250_ops in order to not create circular dependency between 8250 and 8250_base modules.
--- drivers/tty/serial/8250/8250_core.c | 16 +++++++++++----- drivers/tty/serial/8250/8250_port.c | 8 +++++--- include/linux/serial_8250.h | 1 + 3 files changed, 17 insertions(+), 8 deletions(-)
drivers/tty/serial/8250/8250_core.c +11 -5
@@ -310,10 +310,9 @@ static void serial8250_backup_timeout(struct timer_list *t) jiffies + uart_poll_timeout(&up->port) + HZ / 5); } -static int univ8250_setup_irq (struct uart_8250_port *up) +static void univ8250_setup_timer (struct uart_8250_port *up) {struct uart_port *port = &up->port; -int retval =0 ;/* * The above check will only give an accurate result the first time
@@ -334,10 +333,16 @@ static int univ8250_setup_irq(struct uart_8250_port *up)*/ if (!port->irq)mod_timer (&up->timer, jiffies +uart_poll_timeout (port)); -else - retval =serial_link_irq_chain (up); +} -return retval; +static int univ8250_setup_irq (struct uart_8250_port *up) +{ +struct uart_port *port = &up->port; + +if (port->irq) +return serial_link_irq_chain (up); + +return 0 ; }static void univ8250_release_irq (struct uart_8250_port *up)
@@ -393,6 +398,7 @@ static struct uart_ops univ8250_port_ops;static const struct uart_8250_ops univ8250_driver_ops = { .setup_irq = univ8250_setup_irq, .release_irq = univ8250_release_irq, + .setup_timer = univ8250_setup_timer, };static struct uart_8250_port serial8250_ports[UART_NR ];
drivers/tty/serial/8250/8250_port.c +5 -3
@@ -2277,6 +2277,10 @@ int serial8250_do_startup(struct uart_port *port)if (port->irq && (up->port.flags &UPF_SHARE_IRQ )) up->port.irqflags |=IRQF_SHARED ; + retval = up->ops->setup_irq (up); +if (retval) + goto out; +if (port->irq && !(up->port.flags &UPF_NO_THRE_TEST )) {unsigned char iir1;
@@ -2319,9 +2323,7 @@ int serial8250_do_startup(struct uart_port *port) } } - retval = up->ops->setup_irq (up); -if (retval) - goto out; + up->ops->setup_timer (up);/* * Now, initialize the UART
include/linux/serial_8250.h +1 -0
@@ -74,6 +74,7 @@ struct uart_8250_port;struct uart_8250_ops {int (*setup_irq)(struct uart_8250_port *);void (*release_irq)(struct uart_8250_port *); +void (*setup_timer)(struct uart_8250_port *); };struct uart_8250_em485 {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 272/390 crypto: hisilicon/zip - fix mismatch in get/set sgl_sge_nr
In reply to Greg Kroah-HartmanFrom: Ye Weihua <[email protected]>
[ Upstream commit d74f9340097a881869c4c22ca376654cc2516ecc ]
KASAN reported this Bug:
[17619.659757] BUG: KASAN: global-out-of-bounds in param_get_int+0x34/0x60 [17619.673193] Read of size 4 at addr fffff01332d7ed00 by task read_all/1507958 ... [17619.698934] The buggy address belongs to the variable: [17619.708371] sgl_sge_nr+0x0/0xffffffffffffa300 [hisi_zip]
There is a mismatch in hisi_zip when get/set the variable sgl_sge_nr. The type of sgl_sge_nr is u16, and get/set sgl_sge_nr by param_get/set_int.
Replacing param_get/set_int to param_get/set_ushort can fix this bug.
--- drivers/crypto/hisilicon/zip/zip_crypto.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/crypto/hisilicon/zip/zip_crypto.c +2 -2
@@ -107,12 +107,12 @@ static int sgl_sge_nr_set(const char *val, const struct kernel_param *kp)if (ret || n ==0 || n >HISI_ACC_SGL_SGE_NR_MAX )return -EINVAL ; -return param_set_int (val, kp); +return param_set_ushort (val, kp); }static const struct kernel_param_ops sgl_sge_nr_ops = { .set = sgl_sge_nr_set, - .get = param_get_int, + .get = param_get_ushort, };static u16 sgl_sge_nr =HZIP_SGL_SGE_NR ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 275/390 iommu/omap: Fix buffer overflow in debugfs
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 184233a5202786b20220acd2d04ddf909ef18f29 ]
There are two issues here:
1) The "len" variable needs to be checked before the very first write. Otherwise if omap2_iommu_dump_ctx() with "bytes" less than 32 it is a buffer overflow.
2) The snprintf() function returns the number of bytes that *would* have been copied if there were enough space. But we want to know the number of bytes which were *actually* copied so use scnprintf() instead.
--- drivers/iommu/omap-iommu-debug.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/iommu/omap-iommu-debug.c +3 -3
@@ -32,12 +32,12 @@ static inline bool is_omap_iommu_detached(struct omap_iommu *obj)ssize_t bytes; \const char *str ="%20s: %08x\n" ; \const int maxcol =32 ; \ - bytes =snprintf (p, maxcol, str,__stringify (name), \ +if (len < maxcol) \ + goto out; \ + bytes =scnprintf (p, maxcol, str,__stringify (name), \ iommu_read_reg(obj, MMU_##name)); \ p += bytes; \ len -= bytes; \ -if (len < maxcol) \ - goto out; \ }while (0 ) static ssize_t
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 253/390 clk: mediatek: mt8183: mfgcfg: Propagate rate changes to parent
In reply to Greg Kroah-HartmanFrom: Chen-Yu Tsai <[email protected]>
[ Upstream commit 9f94f545f258b15bfa6357eb62e1e307b712851e ]
The only clock in the MT8183 MFGCFG block feeds the GPU. Propagate its rate change requests to its parent, so that DVFS for the GPU can work properly.
--- drivers/clk/mediatek/clk-mt8183-mfgcfg.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/clk/mediatek/clk-mt8183-mfgcfg.c +3 -3
@@ -18,9 +18,9 @@ static const struct mtk_gate_regs mfg_cg_regs = { .sta_ofs = 0x0, }; -#define GATE_MFG (_id, _name, _parent, _shift) \ - GATE_MTK(_id, _name, _parent, &mfg_cg_regs, _shift, \ - &mtk_clk_gate_ops_setclr) +#define GATE_MFG (_id, _name, _parent, _shift) \ + GATE_MTK_FLAGS(_id, _name, _parent, &mfg_cg_regs, _shift, \ + &mtk_clk_gate_ops_setclr, CLK_SET_RATE_PARENT)static const struct mtk_gate mfg_clks[] = {GATE_MFG (CLK_MFG_BG3D ,"mfg_bg3d" ,"mfg_sel" ,0 )
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 259/390 clk: baikal-t1: Add SATA internal ref clock buffer
In reply to Greg Kroah-HartmanFrom: Serge Semin <[email protected]>
[ Upstream commit 081a9b7c74eae4e12b2cb1b86720f836a8f29247 ]
It turns out the internal SATA reference clock signal will stay unavailable for the SATA interface consumer until the buffer on it's way is ungated. So aside with having the actual clock divider enabled we need to ungate a buffer placed on the signal way to the SATA controller (most likely some rudiment from the initial SoC release). Seeing the switch flag is placed in the same register as the SATA-ref clock divider at a non-standard ffset, let's implement it as a separate clock controller with the set-rate propagation to the parental clock divider wrapper. As such we'll be able to disable/enable and still change the original clock source rate.
--- drivers/clk/baikal-t1/ccu-div.c | 64 +++++++++++++++++++++++++++++ drivers/clk/baikal-t1/ccu-div.h | 4 ++ drivers/clk/baikal-t1/clk-ccu-div.c | 18 +++++++- 3 files changed, 85 insertions(+), 1 deletion(-)
drivers/clk/baikal-t1/ccu-div.c +64 -0
@@ -34,6 +34,7 @@#define CCU_DIV_CTL_CLKDIV_MASK (_width) \ GENMASK((_width) + CCU_DIV_CTL_CLKDIV_FLD - 1, CCU_DIV_CTL_CLKDIV_FLD)#define CCU_DIV_CTL_LOCK_SHIFTED BIT(27) +#define CCU_DIV_CTL_GATE_REF_BUF BIT(28)#define CCU_DIV_CTL_LOCK_NORMAL BIT(31)#define CCU_DIV_RST_DELAY_US 1
@@ -170,6 +171,40 @@ static int ccu_div_gate_is_enabled(struct clk_hw *hw)return !!(val &CCU_DIV_CTL_EN ); } +static int ccu_div_buf_enable (struct clk_hw *hw) +{ +struct ccu_div *div =to_ccu_div (hw); +unsigned long flags; + +spin_lock_irqsave (&div->lock, flags); +regmap_update_bits (div->sys_regs, div->reg_ctl, +CCU_DIV_CTL_GATE_REF_BUF ,0 ); +spin_unlock_irqrestore (&div->lock, flags); + +return 0 ; +} + +static void ccu_div_buf_disable (struct clk_hw *hw) +{ +struct ccu_div *div =to_ccu_div (hw); +unsigned long flags; + +spin_lock_irqsave (&div->lock, flags); +regmap_update_bits (div->sys_regs, div->reg_ctl, +CCU_DIV_CTL_GATE_REF_BUF ,CCU_DIV_CTL_GATE_REF_BUF ); +spin_unlock_irqrestore (&div->lock, flags); +} + +static int ccu_div_buf_is_enabled (struct clk_hw *hw) +{ +struct ccu_div *div =to_ccu_div (hw); +u32 val =0 ; + +regmap_read (div->sys_regs, div->reg_ctl, &val); + +return !(val &CCU_DIV_CTL_GATE_REF_BUF ); +} +static unsigned long ccu_div_var_recalc_rate (struct clk_hw *hw,unsigned long parent_rate) {
@@ -323,6 +358,7 @@ static const struct ccu_div_dbgfs_bit ccu_div_bits[] = {CCU_DIV_DBGFS_BIT_ATTR ("div_en" ,CCU_DIV_CTL_EN ),CCU_DIV_DBGFS_BIT_ATTR ("div_rst" ,CCU_DIV_CTL_RST ),CCU_DIV_DBGFS_BIT_ATTR ("div_bypass" ,CCU_DIV_CTL_SET_CLKDIV ), +CCU_DIV_DBGFS_BIT_ATTR ("div_buf" ,CCU_DIV_CTL_GATE_REF_BUF ), CCU_DIV_DBGFS_BIT_ATTR("div_lock", CCU_DIV_CTL_LOCK_NORMAL) };
@@ -441,6 +477,9 @@ static void ccu_div_var_debug_init(struct clk_hw *hw, struct dentry *dentry)continue ; } +if (!strcmp ("div_buf" , name)) +continue ; + bits[didx] = ccu_div_bits[bidx]; bits[didx].div = div;
@@ -477,6 +516,21 @@ static void ccu_div_gate_debug_init(struct clk_hw *hw, struct dentry *dentry) &ccu_div_dbgfs_fixed_clkdiv_fops); } +static void ccu_div_buf_debug_init (struct clk_hw *hw,struct dentry *dentry) +{ +struct ccu_div *div =to_ccu_div (hw); +struct ccu_div_dbgfs_bit *bit; + + bit =kmalloc (sizeof (*bit),GFP_KERNEL ); +if (!bit) +return ; + + *bit = ccu_div_bits[3 ]; + bit->div = div; +debugfs_create_file_unsafe (bit->name, ccu_div_dbgfs_mode, dentry, bit, + &ccu_div_dbgfs_bit_fops); +} +static void ccu_div_fixed_debug_init (struct clk_hw *hw,struct dentry *dentry) {struct ccu_div *div =to_ccu_div (hw);
@@ -489,6 +543,7 @@ static void ccu_div_fixed_debug_init(struct clk_hw *hw, struct dentry *dentry)#define ccu_div_var_debug_init NULL#define ccu_div_gate_debug_init NULL +#define ccu_div_buf_debug_init NULL#define ccu_div_fixed_debug_init NULL#endif /* !CONFIG_DEBUG_FS */
@@ -520,6 +575,13 @@ static const struct clk_ops ccu_div_gate_ops = { .debug_init = ccu_div_gate_debug_init }; +static const struct clk_ops ccu_div_buf_ops = { + .enable = ccu_div_buf_enable, + .disable = ccu_div_buf_disable, + .is_enabled = ccu_div_buf_is_enabled, + .debug_init = ccu_div_buf_debug_init +}; +static const struct clk_ops ccu_div_fixed_ops = { .recalc_rate = ccu_div_fixed_recalc_rate, .round_rate = ccu_div_fixed_round_rate,
@@ -566,6 +628,8 @@ struct ccu_div *ccu_div_hw_register(const struct ccu_div_init_data *div_init) }else if (div_init->type ==CCU_DIV_GATE ) { hw_init.ops = &ccu_div_gate_ops; div->divider = div_init->divider; + }else if (div_init->type ==CCU_DIV_BUF ) { + hw_init.ops = &ccu_div_buf_ops; }else if (div_init->type ==CCU_DIV_FIXED ) { hw_init.ops = &ccu_div_fixed_ops; div->divider = div_init->divider;
drivers/clk/baikal-t1/ccu-div.h +4 -0
@@ -15,8 +15,10 @@/* * CCU Divider private clock IDs +* @CCU_SYS_SATA_CLK: CCU SATA internal clock * @CCU_SYS_XGMAC_CLK: CCU XGMAC internal clock */ +#define CCU_SYS_SATA_CLK -1#define CCU_SYS_XGMAC_CLK -2/*
@@ -37,11 +39,13 @@* enum ccu_div_type - CCU Divider types * @CCU_DIV_VAR: Clocks gate with variable divider. * @CCU_DIV_GATE: Clocks gate with fixed divider. +* @CCU_DIV_BUF: Clock gate with no divider. * @CCU_DIV_FIXED: Ungateable clock with fixed divider. */ enum ccu_div_type {CCU_DIV_VAR ,CCU_DIV_GATE , +CCU_DIV_BUF ,CCU_DIV_FIXED };
drivers/clk/baikal-t1/clk-ccu-div.c +17 -1
@@ -76,6 +76,16 @@ .divider = _divider \ } +#define CCU_DIV_BUF_INFO (_id, _name, _pname, _base, _flags) \ + { \ + .id = _id, \ + .name = _name, \ + .parent_name = _pname, \ + .base = _base, \ + .type = CCU_DIV_BUF, \ + .flags = _flags \ + } +#define CCU_DIV_FIXED_INFO (_id, _name, _pname, _divider) \ { \ .id = _id, \
@@ -188,11 +198,14 @@ static const struct ccu_div_rst_map axi_rst_map[] = {* for the SoC devices registers IO-operations. */ static const struct ccu_div_info sys_info[] = { -CCU_DIV_VAR_INFO (CCU_SYS_SATA_REF_CLK ,"sys_sata_ref_clk" , +CCU_DIV_VAR_INFO (CCU_SYS_SATA_CLK ,"sys_sata_clk" ,"sata_clk" ,CCU_SYS_SATA_REF_BASE ,4 ,CLK_SET_RATE_GATE ,CCU_DIV_SKIP_ONE |CCU_DIV_LOCK_SHIFTED |CCU_DIV_RESET_DOMAIN ), +CCU_DIV_BUF_INFO (CCU_SYS_SATA_REF_CLK ,"sys_sata_ref_clk" , +"sys_sata_clk" ,CCU_SYS_SATA_REF_BASE , +CLK_SET_RATE_PARENT ),CCU_DIV_VAR_INFO (CCU_SYS_APB_CLK ,"sys_apb_clk" ,"pcie_clk" ,CCU_SYS_APB_BASE ,5 ,CLK_IS_CRITICAL ,CCU_DIV_RESET_DOMAIN ),
@@ -398,6 +411,9 @@ static int ccu_div_clk_register(struct ccu_div_data *data) init.base = info->base; init.sys_regs = data->sys_regs; init.divider = info->divider; + }else if (init.type ==CCU_DIV_BUF ) { + init.base = info->base; + init.sys_regs = data->sys_regs; }else { init.divider = info->divider; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 256/390 clk: vc5: Fix 5P49V6901 outputs disabling when enabling FOD
In reply to Greg Kroah-HartmanFrom: Serge Semin <[email protected]>
[ Upstream commit c388cc804016cf0f65afdc2362b120aa594ff3e6 ]
We have discovered random glitches during the system boot up procedure. The problem investigation led us to the weird outcomes: when none of the Renesas 5P49V6901 ports are explicitly enabled by the kernel driver, the glitches disappeared. It was a mystery since the SoC external clock domains were fed with different 5P49V6901 outputs. The driver code didn't seem like bogus either. We almost despaired to find out a root cause when the solution has been found for a more modern revision of the chip. It turned out the 5P49V6901 clock generator stopped its output for a short period of time during the VC5_OUT_DIV_CONTROL register writing. The same problem was found for the 5P49V6965 revision of the chip and was successfully fixed in commit fc336ae622df ("clk: vc5: fix output disabling when enabling a FOD") by enabling the "bypass_sync" flag hidden inside "Unused Factory Reserved Register". Even though the 5P49V6901 registers description and programming guide doesn't provide any intel regarding that flag, setting it up anyway in the officially unused register completely eliminated the denoted glitches. Thus let's activate the functionality submitted in commit fc336ae622df ("clk: vc5: fix output disabling when enabling a FOD") for the Renesas 5P49V6901 chip too in order to remove the ports implicit inter-dependency.
--- drivers/clk/clk-versaclock5.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/clk-versaclock5.c +1 -1
@@ -1116,7 +1116,7 @@ static const struct vc5_chip_info idt_5p49v6901_info = { .model = IDT_VC6_5P49V6901, .clk_fod_cnt = 4, .clk_out_cnt = 5, - .flags = VC5_HAS_PFD_FREQ_DBL, + .flags = VC5_HAS_PFD_FREQ_DBL | VC5_HAS_BYPASS_SYNC_BIT, };static const struct vc5_chip_info idt_5p49v6965_info = {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 294/390 selftest: tpm2: Add Client.__del__() to close /dev/tpm* handle
In reply to Greg Kroah-HartmanFrom: Stefan Berger <[email protected]>
[ Upstream commit 2d869f0b458547386fbcd8cf3004b271b7347b7f ]
The following output can bee seen when the test is executed:
test_flush_context (tpm2_tests.SpaceTest) ... \
/usr/lib64/python3.6/unittest/case.py:605: ResourceWarning: \
unclosed file <_io.FileIO name='/dev/tpmrm0' mode='rb+' closefd=True>An instance of Client does not implicitly close /dev/tpm* handle, once it gets destroyed. Close the file handle in the class destructor Client.__del__().
--- tools/testing/selftests/tpm2/tpm2.py | 4 ++++ 1 file changed, 4 insertions(+)
tools/testing/selftests/tpm2/tpm2.py +4 -0
@@ -370,6 +370,10 @@ class Client: fcntl.fcntl(self.tpm, fcntl.F_SETFL, flags) self.tpm_poll = select.poll() + def __del__(self): + if self.tpm: + self.tpm.close() + def close(self): self.tpm.close()
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 299/390 powercap: intel_rapl: fix UBSAN shift-out-of-bounds issue
In reply to Greg Kroah-HartmanFrom: Chao Qin <[email protected]>
[ Upstream commit 2d93540014387d1c73b9ccc4d7895320df66d01b ]
When value < time_unit, the parameter of ilog2() will be zero and the return value is -1. u64(-1) is too large for shift exponent and then will trigger shift-out-of-bounds:
shift exponent 18446744073709551615 is too large for 32-bit type 'int'
Call Trace: rapl_compute_time_window_core rapl_write_data_raw set_time_window store_constraint_time_window_us
--- drivers/powercap/intel_rapl_common.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/powercap/intel_rapl_common.c +3 -0
@@ -938,6 +938,9 @@ static u64 rapl_compute_time_window_core(struct rapl_package *rp, u64 value, y = value &0x1f ; value = (1 << y) * (4 + f) * rp->time_unit /4 ; }else { +if (value < rp->time_unit) +return 0 ; +do_div (value, rp->time_unit); y =ilog2 (value); f =div64_u64 (4 * (value - (1 << y)),1 << y);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 262/390 clk: ast2600: BCLK comes from EPLL
In reply to Greg Kroah-HartmanFrom: Joel Stanley <[email protected]>
[ Upstream commit b8c1dc9c00b252b3be853720a71b05ed451ddd9f ]
This correction was made in the u-boot SDK recently. There are no in-tree users of this clock so the impact is minimal.
--- drivers/clk/clk-ast2600.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/clk-ast2600.c +1 -1
@@ -622,7 +622,7 @@ static int aspeed_g6_clk_probe(struct platform_device *pdev)regmap_write (map,0x308 ,0x12000 );/* 3x3 = 9 */ /* P-Bus (BCLK) clock divider */ - hw =clk_hw_register_divider_table (dev,"bclk" ,"hpll" ,0 , + hw =clk_hw_register_divider_table (dev,"bclk" ,"epll" ,0 , scu_g6_base +ASPEED_G6_CLK_SELECTION1 ,20 ,3 ,0 , ast2600_div_table, &aspeed_g6_clk_lock);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 266/390 powerpc/pci_dn: Add missing of_node_put()
In reply to Greg Kroah-HartmanFrom: Liang He <[email protected]>
[ Upstream commit 110a1fcb6c4d55144d8179983a475f17a1d6f832 ]
In pci_add_device_node_info(), use of_node_put() to drop the reference to 'parent' returned by of_get_parent() to keep refcount balance.
--- arch/powerpc/kernel/pci_dn.c | 1 + 1 file changed, 1 insertion(+)
arch/powerpc/kernel/pci_dn.c +1 -0
@@ -330,6 +330,7 @@ struct pci_dn *pci_add_device_node_info(struct pci_controller *hose,INIT_LIST_HEAD (&pdn->list); parent =of_get_parent (dn); pdn->parent = parent ?PCI_DN (parent) :NULL ; +of_node_put (parent);if (pdn->parent)list_add_tail (&pdn->list, &pdn->parent->child_list);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 288/390 crypto: cavium - prevent integer overflow loading firmware
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 2526d6bf27d15054bb0778b2f7bc6625fd934905 ]
The "code_length" value comes from the firmware file. If your firmware is untrusted realistically there is probably very little you can do to protect yourself. Still we try to limit the damage as much as possible. Also Smatch marks any data read from the filesystem as untrusted and prints warnings if it not capped correctly.
The "ntohl(ucode->code_length) * 2" multiplication can have an integer overflow.
--- drivers/crypto/cavium/cpt/cptpf_main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/crypto/cavium/cpt/cptpf_main.c +4 -2
@@ -254,6 +254,7 @@ static int cpt_ucode_load_fw(struct cpt_device *cpt, const u8 *fw, bool is_ae)const struct firmware *fw_entry;struct device *dev = &cpt->pdev->dev;struct ucode_header *ucode; +unsigned int code_length;struct microcode *mcode;int j, ret =0 ;
@@ -264,11 +265,12 @@ static int cpt_ucode_load_fw(struct cpt_device *cpt, const u8 *fw, bool is_ae) ucode = (struct ucode_header *)fw_entry->data; mcode = &cpt->mcode[cpt->next_mc_idx];memcpy (mcode->version, (u8 *)fw_entry->data,CPT_UCODE_VERSION_SZ ); - mcode->code_size =ntohl (ucode->code_length) *2 ; -if (!mcode->code_size) { + code_length =ntohl (ucode->code_length); +if (code_length ==0 || code_length >=INT_MAX /2 ) { ret = -EINVAL ; goto fw_release; } + mcode->code_size = code_length *2 ; mcode->is_ae = is_ae; mcode->core_mask =0ULL ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 296/390 rcu-tasks: Convert RCU_LOCKDEP_WARN() to WARN_ONCE()
In reply to Greg Kroah-HartmanFrom: Zqiang <[email protected]>
[ Upstream commit fcd53c8a4dfa38bafb89efdd0b0f718f3a03f884 ]
Kernels built with CONFIG_PROVE_RCU=y and CONFIG_DEBUG_LOCK_ALLOC=y attempt to emit a warning when the synchronize_rcu_tasks_generic() function is called during early boot while the rcu_scheduler_active variable is RCU_SCHEDULER_INACTIVE. However the warnings is not actually be printed because the debug_lockdep_rcu_enabled() returns false, exactly because the rcu_scheduler_active variable is still equal to RCU_SCHEDULER_INACTIVE.
This commit therefore replaces RCU_LOCKDEP_WARN() with WARN_ONCE() to force these warnings to actually be printed.
--- kernel/rcu/tasks.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/rcu/tasks.h +1 -1
@@ -171,7 +171,7 @@ static void call_rcu_tasks_generic(struct rcu_head *rhp, rcu_callback_t func,static void synchronize_rcu_tasks_generic (struct rcu_tasks *rtp) {/* Complain if the scheduler has not started. */ -RCU_LOCKDEP_WARN (rcu_scheduler_active ==RCU_SCHEDULER_INACTIVE , +WARN_ONCE (rcu_scheduler_active ==RCU_SCHEDULER_INACTIVE ,"synchronize_rcu_tasks called too soon" );/* Wait for the grace period. */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 303/390 NFSD: Return nfserr_serverfault if splice_ok but buf->pages have data
In reply to Greg Kroah-HartmanFrom: Anna Schumaker <[email protected]>
[ Upstream commit 06981d560606ac48d61e5f4fff6738b925c93173 ]
This was discussed with Chuck as part of this patch set. Returning nfserr_resource was decided to not be the best error message here, and he suggested changing to nfserr_serverfault instead.
--- fs/nfsd/nfs4xdr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfsd/nfs4xdr.c +1 -1
@@ -3871,7 +3871,7 @@ nfsd4_encode_read(struct nfsd4_compoundres *resp, __be32 nfserr,if (resp->xdr.buf->page_len &&test_bit (RQ_SPLICE_OK , &resp->rqstp->rq_flags)) {WARN_ON_ONCE (1 ); -return nfserr_resource; +return nfserr_serverfault; }xdr_commit_encode (xdr);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 309/390 tcp: annotate data-race around tcp_md5sig_pool_populated
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit aacd467c0a576e5e44d2de4205855dc0fe43f6fb ]
tcp_md5sig_pool_populated can be read while another thread changes its value.
The race has no consequence because allocations are protected with tcp_md5sig_mutex.
This patch adds READ_ONCE() and WRITE_ONCE() to document the race and silence KCSAN.
--- net/ipv4/tcp.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
net/ipv4/tcp.c +10 -4
@@ -4043,12 +4043,16 @@ static void __tcp_alloc_md5sig_pool(void)* to memory. See smp_rmb() in tcp_get_md5sig_pool() */ smp_wmb (); - tcp_md5sig_pool_populated = true; +/* Paired with READ_ONCE() from tcp_alloc_md5sig_pool() +* and tcp_get_md5sig_pool(). +*/ +WRITE_ONCE (tcp_md5sig_pool_populated, true); }bool tcp_alloc_md5sig_pool (void ) { -if (unlikely (!tcp_md5sig_pool_populated)) { +/* Paired with WRITE_ONCE() from __tcp_alloc_md5sig_pool() */ +if (unlikely (!READ_ONCE (tcp_md5sig_pool_populated))) {mutex_lock (&tcp_md5sig_mutex);if (!tcp_md5sig_pool_populated) {
@@ -4059,7 +4063,8 @@ bool tcp_alloc_md5sig_pool(void)mutex_unlock (&tcp_md5sig_mutex); } -return tcp_md5sig_pool_populated; +/* Paired with WRITE_ONCE() from __tcp_alloc_md5sig_pool() */ +return READ_ONCE (tcp_md5sig_pool_populated); }EXPORT_SYMBOL (tcp_alloc_md5sig_pool);
@@ -4075,7 +4080,8 @@ struct tcp_md5sig_pool *tcp_get_md5sig_pool(void) {local_bh_disable (); -if (tcp_md5sig_pool_populated) { +/* Paired with WRITE_ONCE() from __tcp_alloc_md5sig_pool() */ +if (READ_ONCE (tcp_md5sig_pool_populated)) {/* coupled with smp_wmb() in __tcp_alloc_md5sig_pool() */ smp_rmb ();return this_cpu_ptr (&tcp_md5sig_pool);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 311/390 xfrm: Update ipcomp_scratches with NULL when freed
In reply to Greg Kroah-HartmanFrom: Khalid Masum <[email protected]>
[ Upstream commit 8a04d2fc700f717104bfb95b0f6694e448a4537f ]
Currently if ipcomp_alloc_scratches() fails to allocate memory ipcomp_scratches holds obsolete address. So when we try to free the percpu scratches using ipcomp_free_scratches() it tries to vfree non existent vm area. Described below:
static void * __percpu *ipcomp_alloc_scratches(void)
{
...
scratches = alloc_percpu(void *);
if (!scratches)
return NULL;
ipcomp_scratches does not know about this allocation failure.
Therefore holding the old obsolete address.
...
}So when we free,
static void ipcomp_free_scratches(void)
{
...
scratches = ipcomp_scratches;Assigning obsolete address from ipcomp_scratches
if (!scratches)
return;
for_each_possible_cpu(i)
vfree(*per_cpu_ptr(scratches, i));
Trying to free non existent page, causing warning: trying to vfree
existent vm area.
...
}Fix this breakage by updating ipcomp_scrtches with NULL when scratches is freed
--- net/xfrm/xfrm_ipcomp.c | 1 + 1 file changed, 1 insertion(+)
net/xfrm/xfrm_ipcomp.c +1 -0
@@ -212,6 +212,7 @@ static void ipcomp_free_scratches(void)vfree (*per_cpu_ptr (scratches, i));free_percpu (scratches); + ipcomp_scratches =NULL ; }static void *__percpu *ipcomp_alloc_scratches (void )
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 286/390 kbuild: rpm-pkg: fix breakage when V=1 is used
In reply to Greg Kroah-HartmanFrom: Janis Schoetterl-Glausch <[email protected]>
[ Upstream commit 2e07005f4813a9ff6e895787e0c2d1fea859b033 ]
Doing make V=1 binrpm-pkg results in:
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.EgV6qJ
+ umask 022
+ cd .
+ /bin/rm -rf /home/scgl/rpmbuild/BUILDROOT/kernel-6.0.0_rc5+-1.s390x
+ /bin/mkdir -p /home/scgl/rpmbuild/BUILDROOT
+ /bin/mkdir /home/scgl/rpmbuild/BUILDROOT/kernel-6.0.0_rc5+-1.s390x
+ mkdir -p /home/scgl/rpmbuild/BUILDROOT/kernel-6.0.0_rc5+-1.s390x/boot
+ make -f ./Makefile image_name
+ cp test -e include/generated/autoconf.h -a -e include/config/auto.conf || ( \ echo >&2; \ echo >&2 " ERROR: Kernel configuration is invalid."; \ echo >&2 " include/generated/autoconf.h or include/config/auto.conf are missing.";\ echo >&2 " Run 'make oldconfig && make prepare' on kernel src to fix it."; \ echo >&2 ; \ /bin/false) arch/s390/boot/bzImage /home/scgl/rpmbuild/BUILDROOT/kernel-6.0.0_rc5+-1.s390x/boot/vmlinuz-6.0.0-rc5+
cp: invalid option -- 'e'
Try 'cp --help' for more information.
error: Bad exit status from /var/tmp/rpm-tmp.EgV6qJ (%install)
Because the make call to get the image name is verbose and prints additional information.
--- scripts/package/mkspec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/package/mkspec +2 -2
@@ -85,10 +85,10 @@ $S mkdir -p %{buildroot}/boot %ifarch ia64 mkdir -p %{buildroot}/boot/efi - cp \$($MAKE image_name) %{buildroot}/boot/efi/vmlinuz-$KERNELRELEASE + cp \$($MAKE -s image_name) %{buildroot}/boot/efi/vmlinuz-$KERNELRELEASE ln -s efi/vmlinuz-$KERNELRELEASE %{buildroot}/boot/ %else - cp \$($MAKE image_name) %{buildroot}/boot/vmlinuz-$KERNELRELEASE + cp \$($MAKE -s image_name) %{buildroot}/boot/vmlinuz-$KERNELRELEASE %endif $M $MAKE %{?_smp_mflags} INSTALL_MOD_PATH=%{buildroot} modules_install $MAKE %{?_smp_mflags} INSTALL_HDR_PATH=%{buildroot}/usr headers_install
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 291/390 f2fs: fix race condition on setting FI_NO_EXTENT flag
In reply to Greg Kroah-HartmanFrom: Zhang Qilong <[email protected]>
[ Upstream commit 07725adc55c0a414c10acb5c8c86cea34b95ddef ]
The following scenarios exist.
process A: process B:
->f2fs_drop_extent_tree ->f2fs_update_extent_cache_range
->f2fs_update_extent_tree_range
->write_lock
->set_inode_flag
->is_inode_flag_set
->__free_extent_tree // Shouldn't
// have been
// cleaned up
// here->write_lock
In this case, the "FI_NO_EXTENT" flag is set between f2fs_update_extent_tree_range and is_inode_flag_set by other process. it leads to clearing the whole exten tree which should not have happened. And we fix it by move the setting it to the range of write_lock.
--- fs/f2fs/extent_cache.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
fs/f2fs/extent_cache.c +1 -2
@@ -762,9 +762,8 @@ void f2fs_drop_extent_tree(struct inode *inode)if (!f2fs_may_extent_tree (inode))return ; -set_inode_flag (inode,FI_NO_EXTENT ); -write_lock (&et->lock); +set_inode_flag (inode,FI_NO_EXTENT );__free_extent_tree (sbi, et);if (et->largest.len) { et->largest.len =0 ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 306/390 bpftool: Clear errno after libcaps checks
In reply to Greg Kroah-HartmanFrom: Quentin Monnet <[email protected]>
[ Upstream commit cea558855c39b7f1f02ff50dcf701ca6596bc964 ]
When bpftool is linked against libcap, the library runs a "constructor" function to compute the number of capabilities of the running kernel [0], at the beginning of the execution of the program. As part of this, it performs multiple calls to prctl(). Some of these may fail, and set errno to a non-zero value:
# strace -e prctl ./bpftool version
prctl(PR_CAPBSET_READ, CAP_MAC_OVERRIDE) = 1
prctl(PR_CAPBSET_READ, 0x30 /* CAP_??? */) = -1 EINVAL (Invalid argument)
prctl(PR_CAPBSET_READ, CAP_CHECKPOINT_RESTORE) = 1
prctl(PR_CAPBSET_READ, 0x2c /* CAP_??? */) = -1 EINVAL (Invalid argument)
prctl(PR_CAPBSET_READ, 0x2a /* CAP_??? */) = -1 EINVAL (Invalid argument)
prctl(PR_CAPBSET_READ, 0x29 /* CAP_??? */) = -1 EINVAL (Invalid argument)
** fprintf added at the top of main(): we have errno == 1
./bpftool v7.0.0
using libbpf v1.0
features: libbfd, libbpf_strict, skeletons
+++ exited with 0 +++This has been addressed in libcap 2.63 [1], but until this version is available everywhere, we can fix it on bpftool side.
Let's clean errno at the beginning of the main() function, to make sure that these checks do not interfere with the batch mode, where we error out if errno is set after a bpftool command.
[0] https://git.kernel.org/pub/scm/libs/libcap/libcap.git/tree/libcap/cap_alloc.c?h=libcap-2.65#n20
[1] https://git.kernel.org/pub/scm/libs/libcap/libcap.git/commit/?id=f25a1b7e69f7b33e6afb58b3e38f3450b7d2d9a0
--- tools/bpf/bpftool/main.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
tools/bpf/bpftool/main.c +10 -0
@@ -398,6 +398,16 @@ int main(int argc, char **argv)setlinebuf (stdout); +#ifdef USE_LIBCAP +/* Libcap < 2.63 hooks before main() to compute the number of +* capabilities of the running kernel, and doing so it calls prctl() +* which may fail and set errno to non-zero. +* Let's reset errno to make sure this does not interfere with the +* batch mode. +*/ + errno =0 ; +#endif + last_do_help = do_help; pretty_output = false; json_output = false;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 313/390 regulator: core: Prevent integer underflow
In reply to Greg Kroah-HartmanFrom: Patrick Rudolph <[email protected]>
[ Upstream commit 8d8e16592022c9650df8aedfe6552ed478d7135b ]
By using a ratio of delay to poll_enabled_time that is not integer time_remaining underflows and does not exit the loop as expected. As delay could be derived from DT and poll_enabled_time is defined in the driver this can easily happen.
Use a signed iterator to make sure that the loop exits once the remaining time is negative.
--- drivers/regulator/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/regulator/core.c +1 -1
@@ -2544,7 +2544,7 @@ static int _regulator_do_enable(struct regulator_dev *rdev)* expired, return -ETIMEDOUT. */ if (rdev->desc->poll_enabled_time) { -unsigned int time_remaining = delay; +int time_remaining = delay;while (time_remaining >0 ) {_regulator_enable_delay (rdev->desc->poll_enabled_time);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 324/390 r8152: Rate limit overflow messages
In reply to Greg Kroah-HartmanFrom: Andrew Gaul <[email protected]>
[ Upstream commit 93e2be344a7db169b7119de21ac1bf253b8c6907 ]
My system shows almost 10 million of these messages over a 24-hour period which pollutes my logs.
--- drivers/net/usb/r8152.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/usb/r8152.c +3 -1
@@ -1689,7 +1689,9 @@ static void intr_callback(struct urb *urb) "Stop submitting intr, status %d\n", status);return ;case -EOVERFLOW : -netif_info (tp, intr, tp->netdev,"intr status -EOVERFLOW\n" ); +if (net_ratelimit ()) +netif_info (tp, intr, tp->netdev, +"intr status -EOVERFLOW\n" ); goto resubmit;/* -EPIPE: should clear the halt */ default :
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 331/390 drm: bridge: dw_hdmi: only trigger hotplug event on link change
In reply to Greg Kroah-HartmanFrom: Lucas Stach <[email protected]>
[ Upstream commit da09daf881082266e4075657fac53c7966de8e4d ]
There are two events that signal a real change of the link state: HPD going high means the sink is newly connected or wants the source to re-read the EDID, RX sense going low is a indication that the link has been disconnected.
Ignore the other two events that also trigger interrupts, but don't need immediate attention: HPD going low does not necessarily mean the link has been lost and should not trigger a immediate read of the status. RX sense going high also does not require a detect cycle, as HPD going high is the right point in time to read the EDID.
--- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +8 -5
@@ -2984,6 +2984,7 @@ static irqreturn_t dw_hdmi_irq(int irq, void *dev_id) {struct dw_hdmi *hdmi = dev_id;u8 intr_stat, phy_int_pol, phy_pol_mask, phy_stat; +enum drm_connector_status status = connector_status_unknown; intr_stat =hdmi_readb (hdmi,HDMI_IH_PHY_STAT0 ); phy_int_pol =hdmi_readb (hdmi,HDMI_PHY_POL0 );
@@ -3022,13 +3023,15 @@ static irqreturn_t dw_hdmi_irq(int irq, void *dev_id)cec_notifier_phys_addr_invalidate (hdmi->cec_notifier);mutex_unlock (&hdmi->cec_notifier_mutex); } - } -if (intr_stat &HDMI_IH_PHY_STAT0_HPD ) { -enum drm_connector_status status = phy_int_pol &HDMI_PHY_HPD - ? connector_status_connected - : connector_status_disconnected; +if (phy_stat &HDMI_PHY_HPD ) + status = connector_status_connected; + +if (!(phy_stat & (HDMI_PHY_HPD |HDMI_PHY_RX_SENSE ))) + status = connector_status_disconnected; + } +if (status != connector_status_unknown) {dev_dbg (hdmi->dev,"EVENT=%s\n" , status == connector_status_connected ?"plugin" :"plugout" );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 343/390 ARM: dts: imx6q: add missing properties for sram
In reply to Greg Kroah-HartmanFrom: Alexander Stein <[email protected]>
[ Upstream commit b11d083c5dcec7c42fe982c854706d404ddd3a5f ]
All 3 properties are required by sram.yaml. Fixes the dtbs_check warning:
sram@900000: '#address-cells' is a required property sram@900000: '#size-cells' is a required property sram@900000: 'ranges' is a required property
--- arch/arm/boot/dts/imx6q.dtsi | 3 +++ 1 file changed, 3 insertions(+)
arch/arm/boot/dts/imx6q.dtsi +3 -0
@@ -163,6 +163,9 @@ ocram: sram@900000 { compatible = "mmio-sram"; reg = <0x00900000 0x40000>; + ranges = <0 0x00900000 0x40000>; + #address-cells = <1>; + #size-cells = <1>; clocks = <&clks IMX6QDL_CLK_OCRAM>; };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 341/390 drm/amd/display: Remove interface for periodic interrupt 1
In reply to Greg Kroah-HartmanFrom: Aric Cyr <[email protected]>
[ Upstream commit 97d8d6f075bd8f988589be02b91f6fa644d0b0b8 ]
[why]
Only a single VLINE interrupt is available so interface should not expose the second one which is used by DMU firmware.
[how]
Remove references to periodic_interrupt1 and VLINE1 from DC interfaces.
--- drivers/gpu/drm/amd/display/dc/core/dc.c | 16 +++------ drivers/gpu/drm/amd/display/dc/dc_stream.h | 6 ++-- .../amd/display/dc/dcn10/dcn10_hw_sequencer.c | 35 ++++++------------- .../amd/display/dc/dcn10/dcn10_hw_sequencer.h | 3 +- .../gpu/drm/amd/display/dc/inc/hw_sequencer.h | 8 +---- 5 files changed, 18 insertions(+), 50 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +4 -12
@@ -2202,11 +2202,8 @@ static void copy_stream_update_to_stream(struct dc *dc,if (update->abm_level) stream->abm_level = *update->abm_level; -if (update->periodic_interrupt0) - stream->periodic_interrupt0 = *update->periodic_interrupt0; - -if (update->periodic_interrupt1) - stream->periodic_interrupt1 = *update->periodic_interrupt1; +if (update->periodic_interrupt) + stream->periodic_interrupt = *update->periodic_interrupt;if (update->gamut_remap) stream->gamut_remap_matrix = *update->gamut_remap;
@@ -2288,13 +2285,8 @@ static void commit_planes_do_stream_update(struct dc *dc,if (!pipe_ctx->top_pipe && !pipe_ctx->prev_odm_pipe && pipe_ctx->stream == stream) { -if (stream_update->periodic_interrupt0 && - dc->hwss.setup_periodic_interrupt) - dc->hwss.setup_periodic_interrupt (dc, pipe_ctx,VLINE0 ); - -if (stream_update->periodic_interrupt1 && - dc->hwss.setup_periodic_interrupt) - dc->hwss.setup_periodic_interrupt (dc, pipe_ctx,VLINE1 ); +if (stream_update->periodic_interrupt && dc->hwss.setup_periodic_interrupt) + dc->hwss.setup_periodic_interrupt (dc, pipe_ctx); if ((stream_update->hdr_static_metadata && !stream->use_dynamic_meta) || stream_update->vrr_infopacket ||
drivers/gpu/drm/amd/display/dc/dc_stream.h +2 -4
@@ -179,8 +179,7 @@ struct dc_stream_state {/* DMCU info */ unsigned int abm_level; -struct periodic_interrupt_config periodic_interrupt0; -struct periodic_interrupt_config periodic_interrupt1; +struct periodic_interrupt_config periodic_interrupt;/* from core_stream struct */ struct dc_context *ctx;
@@ -244,8 +243,7 @@ struct dc_stream_update {struct dc_info_packet *hdr_static_metadata;unsigned int *abm_level; -struct periodic_interrupt_config *periodic_interrupt0; -struct periodic_interrupt_config *periodic_interrupt1; +struct periodic_interrupt_config *periodic_interrupt;struct dc_info_packet *vrr_infopacket;struct dc_info_packet *vsc_infopacket;
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +10 -25
@@ -3611,7 +3611,7 @@ void dcn10_calc_vupdate_position( {const struct dc_crtc_timing *dc_crtc_timing = &pipe_ctx->stream->timing;int vline_int_offset_from_vupdate = - pipe_ctx->stream->periodic_interrupt0.lines_offset; + pipe_ctx->stream->periodic_interrupt.lines_offset;int vupdate_offset_from_vsync = dc->hwss.get_vupdate_offset_from_vsync (pipe_ctx);int start_position;
@@ -3636,18 +3636,10 @@ void dcn10_calc_vupdate_position(static void dcn10_cal_vline_position (struct dc *dc,struct pipe_ctx *pipe_ctx, -enum vline_select vline,uint32_t *start_line,uint32_t *end_line) { -enum vertical_interrupt_ref_point ref_point =INVALID_POINT ; - -if (vline ==VLINE0 ) - ref_point = pipe_ctx->stream->periodic_interrupt0.ref_point; -else if (vline ==VLINE1 ) - ref_point = pipe_ctx->stream->periodic_interrupt1.ref_point; - -switch (ref_point) { +switch (pipe_ctx->stream->periodic_interrupt.ref_point) {case START_V_UPDATE : dcn10_calc_vupdate_position( dc,
@@ -3656,7 +3648,9 @@ static void dcn10_cal_vline_position( end_line);break ;case START_V_SYNC : -// Suppose to do nothing because vsync is 0; +// vsync is line 0 so start_line is just the requested line offset + *start_line = pipe_ctx->stream->periodic_interrupt.lines_offset; + *end_line = *start_line +2 ;break ;default :ASSERT (0 );
@@ -3666,24 +3660,15 @@ static void dcn10_cal_vline_position(void dcn10_setup_periodic_interrupt (struct dc *dc, -struct pipe_ctx *pipe_ctx, -enum vline_select vline) +struct pipe_ctx *pipe_ctx) {struct timing_generator *tg = pipe_ctx->stream_res.tg; +uint32_t start_line =0 ; +uint32_t end_line =0 ; -if (vline ==VLINE0 ) { -uint32_t start_line =0 ; -uint32_t end_line =0 ; +dcn10_cal_vline_position (dc, pipe_ctx, &start_line, &end_line); -dcn10_cal_vline_position (dc, pipe_ctx, vline, &start_line, &end_line); - - tg->funcs->setup_vertical_interrupt0 (tg, start_line, end_line); - - }else if (vline ==VLINE1 ) { - pipe_ctx->stream_res.tg->funcs->setup_vertical_interrupt1 ( - tg, - pipe_ctx->stream->periodic_interrupt1.lines_offset); - } + tg->funcs->setup_vertical_interrupt0 (tg, start_line, end_line); }void dcn10_setup_vupdate_interrupt (struct dc *dc,struct pipe_ctx *pipe_ctx)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.h +1 -2
@@ -174,8 +174,7 @@ void dcn10_set_cursor_attribute(struct pipe_ctx *pipe_ctx);void dcn10_set_cursor_sdr_white_level (struct pipe_ctx *pipe_ctx);void dcn10_setup_periodic_interrupt (struct dc *dc, -struct pipe_ctx *pipe_ctx, -enum vline_select vline); +struct pipe_ctx *pipe_ctx); enum dc_status dcn10_set_clock(struct dc *dc, enum dc_clock_type clock_type, uint32_t clk_khz,
drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h +1 -7
@@ -32,11 +32,6 @@#include "inc/hw/link_encoder.h" #include "core_status.h" -enum vline_select { -VLINE0 , -VLINE1 -}; -struct pipe_ctx ;struct dc_state ;struct dc_stream_status ;
@@ -112,8 +107,7 @@ struct hw_sequencer_funcs { int group_index, int group_size, struct pipe_ctx *grouped_pipes[]);void (*setup_periodic_interrupt)(struct dc *dc, -struct pipe_ctx *pipe_ctx, -enum vline_select vline); +struct pipe_ctx *pipe_ctx);void (*set_drr)(struct pipe_ctx **pipe_ctx,int num_pipes,unsigned int vmin,unsigned int vmax,unsigned int vmid,unsigned int vmid_frame_number);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 336/390 ASoC: SOF: pci: Change DMI match info to support all Chrome platforms
In reply to Greg Kroah-HartmanFrom: Jairaj Arava <[email protected]>
[ Upstream commit c1c1fc8103f794a10c5c15e3c17879caf4f42c8f ]
In some Chrome platforms if OEM's use their own string as SYS_VENDOR than "Google", it leads to firmware load failure from intel/sof/community path.
Hence, changing SYS_VENDOR to PRODUCT_FAMILY in which "Google" is used as common prefix and is supported in all Chrome platforms.
--- sound/soc/sof/sof-pci-dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/sof/sof-pci-dev.c +1 -1
@@ -75,7 +75,7 @@ static const struct dmi_system_id community_key_platforms[] = { { .ident = "Google Chromebooks", .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "Google"), + DMI_MATCH(DMI_PRODUCT_FAMILY, "Google"), } }, {},
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 320/390 wifi: rt2x00: set SoC wmac clock register
In reply to Greg Kroah-HartmanFrom: Daniel Golle <[email protected]>
[ Upstream commit cbde6ed406a51092d9e8a2df058f5f8490f27443 ]
Instead of using the default value 33 (pci), set US_CYC_CNT init based on Programming guide:
If available, set chipset bus clock with fallback to cpu clock/3.
--- .../net/wireless/ralink/rt2x00/rt2800lib.c | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+)
drivers/net/wireless/ralink/rt2x00/rt2800lib.c +21 -0
@@ -6112,6 +6112,27 @@ static int rt2800_init_registers(struct rt2x00_dev *rt2x00dev) reg =rt2800_register_read (rt2x00dev,US_CYC_CNT );rt2x00_set_field32 (®,US_CYC_CNT_CLOCK_CYCLE ,125 );rt2800_register_write (rt2x00dev,US_CYC_CNT , reg); + }else if (rt2x00_is_soc (rt2x00dev)) { +struct clk *clk =clk_get_sys ("bus" ,NULL ); +int rate; + +if (IS_ERR (clk)) { + clk =clk_get_sys ("cpu" ,NULL ); + +if (IS_ERR (clk)) { + rate =125 ; + }else { + rate =clk_get_rate (clk) /3000000 ; +clk_put (clk); + } + }else { + rate =clk_get_rate (clk) /1000000 ; +clk_put (clk); + } + + reg =rt2800_register_read (rt2x00dev,US_CYC_CNT ); +rt2x00_set_field32 (®,US_CYC_CNT_CLOCK_CYCLE , rate); +rt2800_register_write (rt2x00dev,US_CYC_CNT , reg); } reg =rt2800_register_read (rt2x00dev,HT_FBK_CFG0 );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 344/390 ARM: dts: imx6dl: add missing properties for sram
In reply to Greg Kroah-HartmanFrom: Alexander Stein <[email protected]>
[ Upstream commit f5848b95633d598bacf0500e0108dc5961af88c0 ]
All 3 properties are required by sram.yaml. Fixes the dtbs_check warning:
sram@900000: '#address-cells' is a required property sram@900000: '#size-cells' is a required property sram@900000: 'ranges' is a required property
--- arch/arm/boot/dts/imx6dl.dtsi | 3 +++ 1 file changed, 3 insertions(+)
arch/arm/boot/dts/imx6dl.dtsi +3 -0
@@ -84,6 +84,9 @@ ocram: sram@900000 { compatible = "mmio-sram"; reg = <0x00900000 0x20000>; + ranges = <0 0x00900000 0x20000>; + #address-cells = <1>; + #size-cells = <1>; clocks = <&clks IMX6QDL_CLK_OCRAM>; };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 318/390 wifi: rt2x00: set correct TX_SW_CFG1 MAC register for MT7620
In reply to Greg Kroah-HartmanFrom: Daniel Golle <[email protected]>
[ Upstream commit eeb50acf15762b61921f9df18663f839f387c054 ]
Set correct TX_SW_CFG1 MAC register as it is done also in v3 of the vendor driver[1].
--- drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ralink/rt2x00/rt2800lib.c +1 -1
@@ -5849,7 +5849,7 @@ static int rt2800_init_registers(struct rt2x00_dev *rt2x00dev)rt2800_register_write (rt2x00dev,TX_SW_CFG0 ,0x00000404 ); }else if (rt2x00_rt (rt2x00dev,RT6352 )) {rt2800_register_write (rt2x00dev,TX_SW_CFG0 ,0x00000401 ); -rt2800_register_write (rt2x00dev,TX_SW_CFG1 ,0x000C0000 ); +rt2800_register_write (rt2x00dev,TX_SW_CFG1 ,0x000C0001 );rt2800_register_write (rt2x00dev,TX_SW_CFG2 ,0x00000000 );rt2800_register_write (rt2x00dev,TX_ALC_VGA3 ,0x00000000 );rt2800_register_write (rt2x00dev,TX0_BB_GAIN_ATTEN ,0x0 );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 297/390 ACPI: video: Add Toshiba Satellite/Portege Z830 quirk
In reply to Greg Kroah-HartmanFrom: Arvid Norlander <[email protected]>
[ Upstream commit 574160b8548deff8b80b174f03201e94ab8431e2 ]
Toshiba Satellite Z830 needs the quirk video_disable_backlight_sysfs_if for proper backlight control after suspend/resume cycles.
Toshiba Portege Z830 is simply the same laptop rebranded for certain markets (I looked through the manual to other language sections to confirm this) and thus also needs this quirk.
Thanks to Hans de Goede for suggesting this fix.
--- drivers/acpi/acpi_video.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
drivers/acpi/acpi_video.c +16 -0
@@ -498,6 +498,22 @@ static const struct dmi_system_id video_dmi_table[] = { DMI_MATCH(DMI_PRODUCT_NAME, "SATELLITE R830"), }, }, + { + .callback = video_disable_backlight_sysfs_if, + .ident = "Toshiba Satellite Z830", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), + DMI_MATCH(DMI_PRODUCT_NAME, "SATELLITE Z830"), + }, + }, + { + .callback = video_disable_backlight_sysfs_if, + .ident = "Toshiba Portege Z830", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), + DMI_MATCH(DMI_PRODUCT_NAME, "PORTEGE Z830"), + }, + }, /* * Some machine's _DOD IDs don't have bit 31(Device ID Scheme) set * but the IDs actually follow the Device ID Scheme.
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 319/390 wifi: rt2x00: set VGC gain for both chains of MT7620
In reply to Greg Kroah-HartmanFrom: Daniel Golle <[email protected]>
[ Upstream commit 0e09768c085709e10ece3b68f6ac921d3f6a9caa ]
Set bbp66 for all chains of the MT7620.
--- drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/ralink/rt2x00/rt2800lib.c +2 -1
@@ -5626,7 +5626,8 @@ static inline void rt2800_set_vgc(struct rt2x00_dev *rt2x00dev,if (qual->vgc_level != vgc_level) {if (rt2x00_rt (rt2x00dev,RT3572 ) ||rt2x00_rt (rt2x00dev,RT3593 ) || -rt2x00_rt (rt2x00dev,RT3883 )) { +rt2x00_rt (rt2x00dev,RT3883 ) || +rt2x00_rt (rt2x00dev,RT6352 )) {rt2800_bbp_write_with_rx_chain (rt2x00dev,66 , vgc_level); }else if (rt2x00_rt (rt2x00dev,RT5592 )) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 321/390 wifi: rt2x00: correctly set BBP register 86 for MT7620
In reply to Greg Kroah-HartmanFrom: Daniel Golle <[email protected]>
[ Upstream commit c9aada64fe6493461127f1522d7e2f01792d2424 ]
Instead of 0 set the correct value for BBP register 86 for MT7620.
--- drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/wireless/ralink/rt2x00/rt2800lib.c +4 -1
@@ -4151,7 +4151,10 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev,rt2800_bbp_write (rt2x00dev,62 ,0x37 - rt2x00dev->lna_gain);rt2800_bbp_write (rt2x00dev,63 ,0x37 - rt2x00dev->lna_gain);rt2800_bbp_write (rt2x00dev,64 ,0x37 - rt2x00dev->lna_gain); -rt2800_bbp_write (rt2x00dev,86 ,0 ); +if (rt2x00_rt (rt2x00dev,RT6352 )) +rt2800_bbp_write (rt2x00dev,86 ,0x38 ); +else +rt2800_bbp_write (rt2x00dev,86 ,0 ); }if (rf->channel <=14 ) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 322/390 net: If sock is dead dont access socks sk_wq in sk_stream_wait_memory
In reply to Greg Kroah-HartmanFrom: Liu Jian <[email protected]>
[ Upstream commit 3f8ef65af927db247418d4e1db49164d7a158fc5 ]
Fixes the below NULL pointer dereference:
[...]
[ 14.471200] Call Trace: [ 14.471562] <TASK> [ 14.471882] lock_acquire+0x245/0x2e0 [ 14.472416] ? remove_wait_queue+0x12/0x50 [ 14.473014] ? _raw_spin_lock_irqsave+0x17/0x50 [ 14.473681] _raw_spin_lock_irqsave+0x3d/0x50 [ 14.474318] ? remove_wait_queue+0x12/0x50 [ 14.474907] remove_wait_queue+0x12/0x50 [ 14.475480] sk_stream_wait_memory+0x20d/0x340 [ 14.476127] ? do_wait_intr_irq+0x80/0x80 [ 14.476704] do_tcp_sendpages+0x287/0x600 [ 14.477283] tcp_bpf_push+0xab/0x260 [ 14.477817] tcp_bpf_sendmsg_redir+0x297/0x500 [ 14.478461] ? __local_bh_enable_ip+0x77/0xe0 [ 14.479096] tcp_bpf_send_verdict+0x105/0x470 [ 14.479729] tcp_bpf_sendmsg+0x318/0x4f0 [ 14.480311] sock_sendmsg+0x2d/0x40 [ 14.480822] ____sys_sendmsg+0x1b4/0x1c0 [ 14.481390] ? copy_msghdr_from_user+0x62/0x80 [ 14.482048] ___sys_sendmsg+0x78/0xb0 [ 14.482580] ? vmf_insert_pfn_prot+0x91/0x150 [ 14.483215] ? __do_fault+0x2a/0x1a0 [ 14.483738] ? do_fault+0x15e/0x5d0 [ 14.484246] ? __handle_mm_fault+0x56b/0x1040 [ 14.484874] ? lock_is_held_type+0xdf/0x130 [ 14.485474] ? find_held_lock+0x2d/0x90 [ 14.486046] ? __sys_sendmsg+0x41/0x70 [ 14.486587] __sys_sendmsg+0x41/0x70 [ 14.487105] ? intel_pmu_drain_pebs_core+0x350/0x350 [ 14.487822] do_syscall_64+0x34/0x80 [ 14.488345] entry_SYSCALL_64_after_hwframe+0x63/0xcd [...]
The test scenario has the following flow:
thread1 thread2
----------- ---------------
tcp_bpf_sendmsg
tcp_bpf_send_verdict
tcp_bpf_sendmsg_redir sock_close
tcp_bpf_push_locked __sock_release
tcp_bpf_push //inet_release
do_tcp_sendpages sock->ops->release
sk_stream_wait_memory // tcp_close
sk_wait_event sk->sk_prot->close
release_sock(__sk);
***
lock_sock(sk);
__tcp_close
sock_orphan(sk)
sk->sk_wq = NULL
release_sock
****
lock_sock(__sk);
remove_wait_queue(sk_sleep(sk), &wait);
sk_sleep(sk)
//NULL pointer dereference
&rcu_dereference_raw(sk->sk_wq)->waitWhile waiting for memory in thread1, the socket is released with its wait queue because thread2 has closed it. This caused by tcp_bpf_send_verdict didn't increase the f_count of psock->sk_redir->sk_socket->file in thread1.
We should check if SOCK_DEAD flag is set on wakeup in sk_stream_wait_memory before accessing the wait queue.
--- net/core/stream.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/core/stream.c +2 -1
@@ -159,7 +159,8 @@ int sk_stream_wait_memory(struct sock *sk, long *timeo_p) *timeo_p = current_timeo; } out: -remove_wait_queue (sk_sleep (sk), &wait); +if (!sock_flag (sk,SOCK_DEAD )) +remove_wait_queue (sk_sleep (sk), &wait);return err; do_error:
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 323/390 Bluetooth: L2CAP: Fix user-after-free
In reply to Greg Kroah-HartmanFrom: Luiz Augusto von Dentz <[email protected]>
[ Upstream commit 35fcbc4243aad7e7d020b7c1dfb14bb888b20a4f ]
This uses l2cap_chan_hold_unless_zero() after calling __l2cap_get_chan_blah() to prevent the following trace:
Bluetooth: l2cap_core.c:static void l2cap_chan_destroy(struct kref *kref)
Bluetooth: chan 0000000023c4974d
Bluetooth: parent 00000000ae861c08
==================================================================
BUG: KASAN: use-after-free in __mutex_waiter_is_first kernel/locking/mutex.c:191 [inline] BUG: KASAN: use-after-free in __mutex_lock_common kernel/locking/mutex.c:671 [inline] BUG: KASAN: use-after-free in __mutex_lock+0x278/0x400 kernel/locking/mutex.c:729 Read of size 8 at addr ffff888006a49b08 by task kworker/u3:2/389
--- net/bluetooth/l2cap_core.c | 7 +++++++ 1 file changed, 7 insertions(+)
net/bluetooth/l2cap_core.c +7 -0
@@ -4305,6 +4305,12 @@ static int l2cap_connect_create_rsp(struct l2cap_conn *conn, } } + chan =l2cap_chan_hold_unless_zero (chan); +if (!chan) { + err = -EBADSLT ; + goto unlock; + } + err =0 ;l2cap_chan_lock (chan);
@@ -4334,6 +4340,7 @@ static int l2cap_connect_create_rsp(struct l2cap_conn *conn, }l2cap_chan_unlock (chan); +l2cap_chan_put (chan); unlock:mutex_unlock (&conn->chan_lock);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 350/390 arm64: dts: imx8mq-librem5: Add bq25895 as max17055s power supply
In reply to Greg Kroah-HartmanFrom: Sebastian Krzyszkowiak <[email protected]>
[ Upstream commit 6effe295e1a87408033c29dbcea9d5a5c8b937d5 ]
This allows the userspace to notice that there's not enough current provided to charge the battery, and also fixes issues with 0% SOC values being considered invalid.
--- arch/arm64/boot/dts/freescale/imx8mq-librem5.dtsi | 1 + 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/freescale/imx8mq-librem5.dtsi +1 -0
@@ -899,6 +899,7 @@ interrupts = <20 IRQ_TYPE_LEVEL_LOW>; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_gauge>; + power-supplies = <&bq25895>; maxim,over-heat-temp = <700>; maxim,over-volt = <4500>; maxim,rsns-microohm = <5000>;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 365/390 soundwire: intel: fix error handling on dai registration issues
In reply to Greg Kroah-HartmanFrom: Pierre-Louis Bossart <[email protected]>
[ Upstream commit c6867cda906aadbce5e71efde9c78a26108b2bad ]
The call to intel_register_dai() may fail because of memory allocation issues or problems reported by the ASoC core. In all cases, when a error is thrown the component is not registered, it's invalid to unregister it.
--- drivers/soundwire/intel.c | 1 - 1 file changed, 1 deletion(-)
drivers/soundwire/intel.c +0 -1
@@ -1470,7 +1470,6 @@ int intel_master_startup(struct platform_device *pdev) ret =intel_register_dai (sdw);if (ret) {dev_err (dev,"DAI registration failed: %d\n" , ret); -snd_soc_unregister_component (dev); goto err_interrupt; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 86/390 drm/nouveau/kms/nv140-: Disable interlacing
In reply to Greg Kroah-HartmanFrom: Lyude Paul <[email protected]>
commit 8ba9249396bef37cb68be9e8dee7847f1737db9d upstream.
As it turns out: while Nvidia does actually have interlacing knobs on their GPU still pretty much no current GPUs since Volta actually support it. Trying interlacing on these GPUs will result in NVDisplay being quite unhappy like so:
nouveau 0000:1f:00.0: disp: chid 0 stat 00004802 reason 4 [INVALID_ARG] mthd 2008 data 00000001 code 00080000 nouveau 0000:1f:00.0: disp: chid 0 stat 10005080 reason 5 [INVALID_STATE] mthd 0200 data 00000001 code 00000001
So let's fix this by following the same behavior Nvidia's driver does and disable interlacing entirely.
--- drivers/gpu/drm/nouveau/nouveau_connector.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nouveau_connector.c +2 -1
@@ -500,7 +500,8 @@ nouveau_connector_set_encoder(struct drm connector->interlace_allowed = nv_encoder->caps.dp_interlace; else - connector->interlace_allowed = true; + connector->interlace_allowed = + drm->client.device.info.family <NV_DEVICE_INFO_V0_VOLTA ; connector->doublescan_allowed = true; }else if (nv_encoder->dcb->type == DCB_OUTPUT_LVDS ||
Greg Kroah-Hartman
maintainerPATCH 371/390 staging: rtl8723bs: fix a potential memory leak in rtw_init_cmd_priv()
In reply to Greg Kroah-HartmanFrom: Xiaoke Wang <[email protected]>
[ Upstream commit 708056fba733a73d926772ea4ce9a42d240345da ]
In rtw_init_cmd_priv(), if pcmdpriv->rsp_allocated_buf is allocated in failure, then pcmdpriv->cmd_allocated_buf will be not properly released. Besides, considering there are only two error paths and the first one can directly return, so we do not need implicitly jump to the exit tag to execute the error handler.
So this patch added kfree(pcmdpriv->cmd_allocated_buf); on the error path to release the resource and simplified the return logic of rtw_init_cmd_priv(). As there is no proper device to test with, no runtime testing was performed.
--- drivers/staging/rtl8723bs/core/rtw_cmd.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-)
drivers/staging/rtl8723bs/core/rtw_cmd.c +6 -10
@@ -165,8 +165,6 @@ No irqsave is necessary.int rtw_init_cmd_priv (struct cmd_priv *pcmdpriv) { -int res =0 ; -init_completion (&pcmdpriv->cmd_queue_comp);init_completion (&pcmdpriv->terminate_cmdthread_comp);
@@ -178,18 +176,16 @@ int rtw_init_cmd_priv(struct cmd_priv *pcmdpriv) pcmdpriv->cmd_allocated_buf =rtw_zmalloc (MAX_CMDSZ +CMDBUFF_ALIGN_SZ ); -if (!pcmdpriv->cmd_allocated_buf) { - res = -ENOMEM ; - goto exit; - } +if (!pcmdpriv->cmd_allocated_buf) +return -ENOMEM ; pcmdpriv->cmd_buf = pcmdpriv->cmd_allocated_buf +CMDBUFF_ALIGN_SZ - ((SIZE_PTR )(pcmdpriv->cmd_allocated_buf) & (CMDBUFF_ALIGN_SZ -1 )); pcmdpriv->rsp_allocated_buf =rtw_zmalloc (MAX_RSPSZ +4 );if (!pcmdpriv->rsp_allocated_buf) { - res = -ENOMEM ; - goto exit; +kfree (pcmdpriv->cmd_allocated_buf); +return -ENOMEM ; } pcmdpriv->rsp_buf = pcmdpriv->rsp_allocated_buf +4 - ((SIZE_PTR )(pcmdpriv->rsp_allocated_buf) &3 );
@@ -199,8 +195,8 @@ int rtw_init_cmd_priv(struct cmd_priv *pcmdpriv) pcmdpriv->rsp_cnt =0 ;mutex_init (&pcmdpriv->sctx_mutex); -exit: -return res; + +return 0 ; }static void c2h_wk_callback (_workitem * work);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 373/390 nvmet-tcp: add bounds check on Transfer Tag
In reply to Greg Kroah-HartmanFrom: Varun Prakash <[email protected]>
[ Upstream commit b6a545ffa2c192b1e6da4a7924edac5ba9f4ea2b ]
ttag is used as an index to get cmd in nvmet_tcp_handle_h2c_data_pdu(), add a bounds check to avoid out-of-bounds access.
--- drivers/nvme/target/tcp.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/nvme/target/tcp.c +9 -2
@@ -922,10 +922,17 @@ static int nvmet_tcp_handle_h2c_data_pdu(struct nvmet_tcp_queue *queue)struct nvme_tcp_data_pdu *data = &queue->pdu.data;struct nvmet_tcp_cmd *cmd; -if (likely (queue->nr_cmds)) +if (likely (queue->nr_cmds)) { +if (unlikely (data->ttag >= queue->nr_cmds)) { +pr_err ("queue %d: received out of bound ttag %u, nr_cmds %u\n" , + queue->idx, data->ttag, queue->nr_cmds); +nvmet_tcp_fatal_error (queue); +return -EPROTO ; + } cmd = &queue->cmds[data->ttag]; -else + }else { cmd = &queue->connect; + }if (le32_to_cpu (data->data_offset) != cmd->rbytes_done) { pr_err("ttag %u unexpected data offset %u (expected %u)\n",
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 369/390 usb: musb: Fix musb_gadget.c rxstate overflow bug
In reply to Greg Kroah-HartmanFrom: Robin Guo <[email protected]>
[ Upstream commit eea4c860c3b366369eff0489d94ee4f0571d467d ]
The usb function device call musb_gadget_queue() adds the passed request to musb_ep::req_list,If the (request->length > musb_ep->packet_sz) and (is_buffer_mapped(req) return false),the rxstate() will copy all data in fifo to request->buf which may cause request->buf out of bounds.
Fix it by add the length check :
fifocnt = min_t(unsigned, request->length - request->actual, fifocnt);
--- drivers/usb/musb/musb_gadget.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/usb/musb/musb_gadget.c +3 -0
@@ -760,6 +760,9 @@ static void rxstate(struct musb *musb, struct musb_request *req)musb_writew (epio,MUSB_RXCSR , csr); buffer_aint_mapped: + fifo_count = min_t(unsigned int, + request->length - request->actual, + (unsigned int )fifo_count);musb_read_fifo (musb_ep->hw_ep, fifo_count, (u8 *) (request->buf + request->actual)); request->actual += fifo_count;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 257/390 clk: baikal-t1: Fix invalid xGMAC PTP clock divider
In reply to Greg Kroah-HartmanFrom: Serge Semin <[email protected]>
[ Upstream commit 3c742088686ce922704aec5b11d09bcc5a396589 ]
Most likely due to copy-paste mistake the divider has been set to 10 while according to the SoC reference manual it's supposed to be 8 thus having PTP clock frequency of 156.25 MHz.
--- drivers/clk/baikal-t1/clk-ccu-div.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/baikal-t1/clk-ccu-div.c +1 -1
@@ -207,7 +207,7 @@ static const struct ccu_div_info sys_info[] = {CCU_DIV_GATE_INFO (CCU_SYS_XGMAC_REF_CLK ,"sys_xgmac_ref_clk" ,"eth_clk" ,CCU_SYS_XGMAC_BASE ,8 ),CCU_DIV_FIXED_INFO (CCU_SYS_XGMAC_PTP_CLK ,"sys_xgmac_ptp_clk" , -"eth_clk" ,10 ), +"eth_clk" ,8 ),CCU_DIV_GATE_INFO (CCU_SYS_USB_CLK ,"sys_usb_clk" ,"eth_clk" ,CCU_SYS_USB_BASE ,10 ), CCU_DIV_VAR_INFO(CCU_SYS_PVT_CLK, "sys_pvt_clk",
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 279/390 crypto: qat - fix use of dma_map_single
In reply to Greg Kroah-HartmanFrom: Hui Tang <[email protected]>
[ Upstream commit 7cc05071f930a631040fea16a41f9d78771edc49 ]
DMA_TO_DEVICE synchronisation must be done after the last modification of the memory region by the software and before it is handed off to the device.
Stable-dep-of: cf5bb835b7c8 ("crypto: qat - fix DMA transfer direction")
--- drivers/crypto/qat/qat_common/qat_algs.c | 27 ++++++++++++------------ 1 file changed, 14 insertions(+), 13 deletions(-)
drivers/crypto/qat/qat_common/qat_algs.c +14 -13
@@ -669,8 +669,8 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst,int n =sg_nents (sgl);struct qat_alg_buf_list *bufl;struct qat_alg_buf_list *buflout =NULL ; -dma_addr_t blp; -dma_addr_t bloutp; +dma_addr_t blp =DMA_MAPPING_ERROR ; +dma_addr_t bloutp =DMA_MAPPING_ERROR ;struct scatterlist *sg;size_t sz_out, sz =struct_size (bufl, bufers, n +1 );
@@ -685,10 +685,6 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst,for_each_sg (sgl, sg, n, i) bufl->bufers[i].addr =DMA_MAPPING_ERROR ; - blp =dma_map_single (dev, bufl, sz,DMA_TO_DEVICE ); -if (unlikely (dma_mapping_error (dev, blp))) - goto err_in; -for_each_sg (sgl, sg, n, i) {int y = sg_nctr;
@@ -704,6 +700,9 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst, sg_nctr++; } bufl->num_bufs = sg_nctr; + blp =dma_map_single (dev, bufl, sz,DMA_TO_DEVICE ); +if (unlikely (dma_mapping_error (dev, blp))) + goto err_in; qat_req->buf.bl = bufl; qat_req->buf.blp = blp; qat_req->buf.sz = sz;
@@ -723,9 +722,6 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst,for_each_sg (sglout, sg, n, i) bufers[i].addr =DMA_MAPPING_ERROR ; - bloutp =dma_map_single (dev, buflout, sz_out,DMA_TO_DEVICE ); -if (unlikely (dma_mapping_error (dev, bloutp))) - goto err_out;for_each_sg (sglout, sg, n, i) {int y = sg_nctr;
@@ -742,6 +738,9 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst, } buflout->num_bufs = sg_nctr; buflout->num_mapped_bufs = sg_nctr; + bloutp =dma_map_single (dev, buflout, sz_out,DMA_TO_DEVICE ); +if (unlikely (dma_mapping_error (dev, bloutp))) + goto err_out; qat_req->buf.blout = buflout; qat_req->buf.bloutp = bloutp; qat_req->buf.sz_out = sz_out;
@@ -753,17 +752,21 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst,return 0 ; err_out: +if (!dma_mapping_error (dev, bloutp)) +dma_unmap_single (dev, bloutp, sz_out,DMA_TO_DEVICE ); + n =sg_nents (sglout);for (i =0 ; i < n; i++)if (!dma_mapping_error (dev, buflout->bufers[i].addr))dma_unmap_single (dev, buflout->bufers[i].addr, buflout->bufers[i].len,DMA_BIDIRECTIONAL ); -if (!dma_mapping_error (dev, bloutp)) -dma_unmap_single (dev, bloutp, sz_out,DMA_TO_DEVICE );kfree (buflout); err_in: +if (!dma_mapping_error (dev, blp)) +dma_unmap_single (dev, blp, sz,DMA_TO_DEVICE ); + n =sg_nents (sgl);for (i =0 ; i < n; i++)if (!dma_mapping_error (dev, bufl->bufers[i].addr))
@@ -771,8 +774,6 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst, bufl->bufers[i].len, DMA_BIDIRECTIONAL); -if (!dma_mapping_error (dev, blp)) -dma_unmap_single (dev, blp, sz,DMA_TO_DEVICE );kfree (bufl);dev_err (dev,"Failed to map buf for dma\n" );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 304/390 NFSD: fix use-after-free on source server when doing inter-server copy
In reply to Greg Kroah-HartmanFrom: Dai Ngo <[email protected]>
[ Upstream commit 019805fea91599b22dfa62ffb29c022f35abeb06 ]
Use-after-free occurred when the laundromat tried to free expired cpntf_state entry on the s2s_cp_stateids list after inter-server copy completed. The sc_cp_list that the expired copy state was inserted on was already freed.
When COPY completes, the Linux client normally sends LOCKU(lock_state x), FREE_STATEID(lock_state x) and CLOSE(open_state y) to the source server. The nfs4_put_stid call from nfsd4_free_stateid cleans up the copy state from the s2s_cp_stateids list before freeing the lock state's stid.
However, sometimes the CLOSE was sent before the FREE_STATEID request. When this happens, the nfsd4_close_open_stateid call from nfsd4_close frees all lock states on its st_locks list without cleaning up the copy state on the sc_cp_list list. When the time the FREE_STATEID arrives the server returns BAD_STATEID since the lock state was freed. This causes the use-after-free error to occur when the laundromat tries to free the expired cpntf_state.
This patch adds a call to nfs4_free_cpntf_statelist in nfsd4_close_open_stateid to clean up the copy state before calling free_ol_stateid_reaplist to free the lock state's stid on the reaplist.
--- fs/nfsd/nfs4state.c | 5 +++++ 1 file changed, 5 insertions(+)
fs/nfsd/nfs4state.c +5 -0
@@ -843,6 +843,7 @@ static struct nfs4_ol_stateid * nfs4_alloc_open_stateid(struct nfs4_client *clp)static void nfs4_free_deleg (struct nfs4_stid *stid) { +WARN_ON (!list_empty (&stid->sc_cp_list));kmem_cache_free (deleg_slab, stid);atomic_long_dec (&num_delegations); }
@@ -1358,6 +1359,7 @@ static void nfs4_free_ol_stateid(struct nfs4_stid *stid)release_all_access (stp);if (stp->st_stateowner)nfs4_put_stateowner (stp->st_stateowner); +WARN_ON (!list_empty (&stid->sc_cp_list));kmem_cache_free (stateid_slab, stid); }
@@ -6207,6 +6209,7 @@ static void nfsd4_close_open_stateid(struct nfs4_ol_stateid *s)struct nfs4_client *clp = s->st_stid.sc_client;bool unhashed;LIST_HEAD (reaplist); +struct nfs4_ol_stateid *stp;spin_lock (&clp->cl_lock); unhashed =unhash_open_stateid (s, &reaplist);
@@ -6215,6 +6218,8 @@ static void nfsd4_close_open_stateid(struct nfs4_ol_stateid *s)if (unhashed)put_ol_stateid_locked (s, &reaplist);spin_unlock (&clp->cl_lock); +list_for_each_entry (stp, &reaplist, st_locks) +nfs4_free_cpntf_statelist (clp->net, &stp->st_stid);free_ol_stateid_reaplist (&reaplist); }else {spin_unlock (&clp->cl_lock);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 352/390 clk: zynqmp: Fix stack-out-of-bounds in strncpy`
In reply to Greg Kroah-HartmanFrom: Ian Nam <[email protected]>
[ Upstream commit dd80fb2dbf1cd8751efbe4e53e54056f56a9b115 ]
"BUG: KASAN: stack-out-of-bounds in strncpy+0x30/0x68"
Linux-ATF interface is using 16 bytes of SMC payload. In case clock name is longer than 15 bytes, string terminated NULL character will not be received by Linux. Add explicit NULL character at last byte to fix issues when clock name is longer.
This fixes below bug reported by KASAN:
==================================================================
BUG: KASAN: stack-out-of-bounds in strncpy+0x30/0x68 Read of size 1 at addr ffff0008c89a7410 by task swapper/0/1 CPU: 1 PID: 1 Comm: swapper/0 Not tainted 5.4.0-00396-g81ef9e7-dirty #3 Hardware name: Xilinx Versal vck190 Eval board revA (QSPI) (DT) Call trace: dump_backtrace+0x0/0x1e8 show_stack+0x14/0x20 dump_stack+0xd4/0x108 print_address_description.isra.0+0xbc/0x37c __kasan_report+0x144/0x198 kasan_report+0xc/0x18 __asan_load1+0x5c/0x68 strncpy+0x30/0x68 zynqmp_clock_probe+0x238/0x7b8 platform_drv_probe+0x6c/0xc8 really_probe+0x14c/0x418 driver_probe_device+0x74/0x130 __device_attach_driver+0xc4/0xe8 bus_for_each_drv+0xec/0x150 __device_attach+0x160/0x1d8 device_initial_probe+0x10/0x18 bus_probe_device+0xe0/0xf0 device_add+0x528/0x950 of_device_add+0x5c/0x80 of_platform_device_create_pdata+0x120/0x168 of_platform_bus_create+0x244/0x4e0 of_platform_populate+0x50/0xe8 zynqmp_firmware_probe+0x370/0x3a8 platform_drv_probe+0x6c/0xc8 really_probe+0x14c/0x418 driver_probe_device+0x74/0x130 device_driver_attach+0x94/0xa0 __driver_attach+0x70/0x108 bus_for_each_dev+0xe4/0x158 driver_attach+0x30/0x40 bus_add_driver+0x21c/0x2b8 driver_register+0xbc/0x1d0 __platform_driver_register+0x7c/0x88 zynqmp_firmware_driver_init+0x1c/0x24 do_one_initcall+0xa4/0x234 kernel_init_freeable+0x1b0/0x24c kernel_init+0x10/0x110 ret_from_fork+0x10/0x18 The buggy address belongs to the page: page:ffff0008f9be1c88 refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 raw: 0008d00000000000 ffff0008f9be1c90 ffff0008f9be1c90 0000000000000000 raw: 0000000000000000 0000000000000000 00000000ffffffff page dumped because: kasan: bad access detected
addr ffff0008c89a7410 is located in stack of task swapper/0/1 at offset 112 in frame:
zynqmp_clock_probe+0x0/0x7b8
this frame has 3 objects:
[32, 44) 'response'
[64, 80) 'ret_payload'
[96, 112) 'name'
Memory state around the buggy address:
ffff0008c89a7300: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff0008c89a7380: 00 00 00 00 f1 f1 f1 f1 00 04 f2 f2 00 00 f2 f2
>ffff0008c89a7400: 00 00 f3 f3 00 00 00 00 00 00 00 00 00 00 00 00
^
ffff0008c89a7480: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff0008c89a7500: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================--- drivers/clk/zynqmp/clkc.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/clk/zynqmp/clkc.c +7 -0
@@ -687,6 +687,13 @@ static void zynqmp_get_clock_info(void)FIELD_PREP (CLK_ATTR_NODE_INDEX , i);zynqmp_pm_clock_get_name (clock[i].clk_id, &name); + +/* +* Terminate with NULL character in case name provided by firmware +* is longer and truncated due to size limit. +*/ + name.name[sizeof (name.name) -1 ] ='\0' ; +if (!strcmp (name.name,RESERVED_CLK_NAME ))continue ;strncpy (clock[i].clk_name, name.name,MAX_NAME_LEN );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 354/390 clk: zynqmp: pll: rectify rate rounding in zynqmp_pll_round_rate
In reply to Greg Kroah-HartmanFrom: Quanyang Wang <[email protected]>
[ Upstream commit 30eaf02149ecc3c5815e45d27187bf09e925071d ]
The function zynqmp_pll_round_rate is used to find a most appropriate PLL frequency which the hardware can generate according to the desired frequency. For example, if the desired frequency is 297MHz, considering the limited range from PS_PLL_VCO_MIN (1.5GHz) to PS_PLL_VCO_MAX (3.0GHz) of PLL, zynqmp_pll_round_rate should return 1.872GHz (297MHz * 5).
There are two problems with the current code of zynqmp_pll_round_rate:
1) When the rate is below PS_PLL_VCO_MIN, it can't find a correct rate when the parameter "rate" is an integer multiple of *prate, in other words, if "f" is zero, zynqmp_pll_round_rate won't return a valid frequency which is from PS_PLL_VCO_MIN to PS_PLL_VCO_MAX. For example, *prate is 33MHz and the rate is 660MHz, zynqmp_pll_round_rate will not boost up rate and just return 660MHz, and this will cause clk_calc_new_rates failure since zynqmp_pll_round_rate returns an invalid rate out of its boundaries.
2) Even if the rate is higher than PS_PLL_VCO_MIN, there is still a risk that zynqmp_pll_round_rate returns an invalid rate because the function DIV_ROUND_CLOSEST makes some loss in the fractional part. If the parent clock *prate is 33333333Hz and we want to set the PLL rate to 1.5GHz, this function will return 1499999985Hz by using the formula below:
value = *prate * DIV_ROUND_CLOSEST(rate, *prate)).
This value is also invalid since it's slightly smaller than PS_PLL_VCO_MIN. because DIV_ROUND_CLOSEST makes some loss in the fractional part.
--- drivers/clk/zynqmp/pll.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-)
drivers/clk/zynqmp/pll.c +15 -16
@@ -99,26 +99,25 @@ static long zynqmp_pll_round_rate(struct clk_hw *hw, unsigned long rate, unsigned long *prate) {u32 fbdiv; -long rate_div, f; +u32 mult, div; -/* Enable the fractional mode if needed */ - rate_div = (rate *FRAC_DIV ) / *prate; - f = rate_div %FRAC_DIV ; -if (f) { -if (rate >PS_PLL_VCO_MAX ) { - fbdiv = rate /PS_PLL_VCO_MAX ; - rate = rate / (fbdiv +1 ); - } -if (rate <PS_PLL_VCO_MIN ) { - fbdiv =DIV_ROUND_UP (PS_PLL_VCO_MIN , rate); - rate = rate * fbdiv; - } -return rate; +/* Let rate fall inside the range PS_PLL_VCO_MIN ~ PS_PLL_VCO_MAX */ +if (rate >PS_PLL_VCO_MAX ) { + div =DIV_ROUND_UP (rate,PS_PLL_VCO_MAX ); + rate = rate / div; + } +if (rate <PS_PLL_VCO_MIN ) { + mult =DIV_ROUND_UP (PS_PLL_VCO_MIN , rate); + rate = rate * mult; } fbdiv =DIV_ROUND_CLOSEST (rate, *prate); - fbdiv =clamp_t (u32, fbdiv,PLL_FBDIV_MIN ,PLL_FBDIV_MAX ); -return *prate * fbdiv; +if (fbdiv <PLL_FBDIV_MIN || fbdiv >PLL_FBDIV_MAX ) { + fbdiv =clamp_t (u32, fbdiv,PLL_FBDIV_MIN ,PLL_FBDIV_MAX ); + rate = *prate * fbdiv; + } + +return rate; }/**
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 375/390 clk: bcm2835: Make peripheral PLLC critical
In reply to Greg Kroah-HartmanFrom: Maxime Ripard <[email protected]>
[ Upstream commit 6c5422851d8be8c7451e968fd2e6da41b6109e17 ]
When testing for a series affecting the VEC, it was discovered that turning off and on the VEC clock is crashing the system.
It turns out that, when disabling the VEC clock, it's the only child of the PLLC-per clock which will also get disabled. The source of the crash is PLLC-per being disabled.
It's likely that some other device might not take a clock reference that it actually needs, but it's unclear which at this point. Let's make PLLC-per critical so that we don't have that crash.
--- drivers/clk/bcm/clk-bcm2835.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/bcm/clk-bcm2835.c +1 -1
@@ -1786,7 +1786,7 @@ static const struct bcm2835_clk_desc clk_desc_array[] = { .load_mask = CM_PLLC_LOADPER, .hold_mask = CM_PLLC_HOLDPER, .fixed_divider = 1, - .flags = CLK_SET_RATE_PARENT), + .flags = CLK_IS_CRITICAL | CLK_SET_RATE_PARENT),/* * PLLD is the display PLL, used to drive DSI display panels.
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 376/390 perf intel-pt: Fix segfault in intel_pt_print_info() with uClibc
In reply to Greg Kroah-HartmanFrom: Adrian Hunter <[email protected]>
commit 5a3d47071f0ced0431ef82a5fb6bd077ed9493db upstream.
uClibc segfaulted because NULL was passed as the format to fprintf().
That happened because one of the format strings was missing and intel_pt_print_info() didn't check that before calling fprintf().
Add the missing format string, and check format is not NULL before calling fprintf().
--- tools/perf/util/intel-pt.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
tools/perf/util/intel-pt.c +7 -2
@@ -3279,6 +3279,7 @@ static const char * const intel_pt_info_ [INTEL_PT_SNAPSHOT_MODE] = " Snapshot mode %"PRId64"\n", [INTEL_PT_PER_CPU_MMAPS] = " Per-cpu maps %"PRId64"\n", [INTEL_PT_MTC_BIT] = " MTC bit %#"PRIx64"\n", + [INTEL_PT_MTC_FREQ_BITS] = " MTC freq bits %#"PRIx64"\n", [INTEL_PT_TSC_CTC_N] = " TSC:CTC numerator %"PRIu64"\n", [INTEL_PT_TSC_CTC_D] = " TSC:CTC denominator %"PRIu64"\n", [INTEL_PT_CYC_BIT] = " CYC bit %#"PRIx64"\n",
@@ -3293,8 +3294,12 @@ static void intel_pt_print_info(__u64 *aif (!dump_trace)return ; -for (i = start; i <= finish; i++) -fprintf (stdout, intel_pt_info_fmts[i], arr[i]); +for (i = start; i <= finish; i++) { +const char *fmt = intel_pt_info_fmts[i]; + +if (fmt) +fprintf (stdout, fmt, arr[i]); + } }static void intel_pt_print_info_str (const char *name,const char *str)
Greg Kroah-Hartman
maintainerPATCH 123/390 x86/cpu: Include the header of init_ia32_feat_ctl()s prototype
In reply to Greg Kroah-HartmanFrom: Luciano Leão <[email protected]>
[ Upstream commit 30ea703a38ef76ca119673cd8bdd05c6e068e2ac ]
Include the header containing the prototype of init_ia32_feat_ctl(), solving the following warning:
$ make W=1 arch/x86/kernel/cpu/feat_ctl.o
arch/x86/kernel/cpu/feat_ctl.c:112:6: warning: no previous prototype for ‘init_ia32_feat_ctl’ [-Wmissing-prototypes]
112 | void init_ia32_feat_ctl(struct cpuinfo_x86 *c)This warning appeared after commit
5d5103595e9e5 ("x86/cpu: Reinitialize IA32_FEAT_CTL MSR on BSP during wakeup")
had moved the function init_ia32_feat_ctl()'s prototype from arch/x86/kernel/cpu/cpu.h to arch/x86/include/asm/cpu.h.
Note that, before the commit mentioned above, the header include "cpu.h" (arch/x86/kernel/cpu/cpu.h) was added by commit
0e79ad863df43 ("x86/cpu: Fix a -Wmissing-prototypes warning for init_ia32_feat_ctl()")
solely to fix init_ia32_feat_ctl()'s missing prototype. So, the header include "cpu.h" is no longer necessary.
[ bp: Massage commit message. ]
--- arch/x86/kernel/cpu/feat_ctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/cpu/feat_ctl.c +1 -1
@@ -1,11 +1,11 @@// SPDX-License-Identifier: GPL-2.0 #include <linux/tboot.h> +#include <asm/cpu.h> #include <asm/cpufeature.h> #include <asm/msr-index.h> #include <asm/processor.h> #include <asm/vmx.h> -#include "cpu.h" #undef pr_fmt#define pr_fmt (fmt) "x86/cpu: " fmt
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 238/390 tty: serial: fsl_lpuart: disable dma rx/tx use flags in lpuart_dma_shutdown
In reply to Greg Kroah-HartmanFrom: Sherry Sun <[email protected]>
[ Upstream commit 316ae95c175a7d770d1bfe4c011192712f57aa4a ]
lpuart_dma_shutdown tears down lpuart dma, but lpuart_flush_buffer can still occur which in turn tries to access dma apis if lpuart_dma_tx_use flag is true. At this point since dma is torn down, these dma apis can abort. Set lpuart_dma_tx_use and the corresponding rx flag lpuart_dma_rx_use to false in lpuart_dma_shutdown so that dmas are not accessed after they are relinquished.
Otherwise, when try to kill btattach, kernel may panic. This patch may fix this issue.
root@imx8ulpevk:~# btattach -B /dev/ttyLP2 -S 115200 ^C[ 90.182296] Internal error: synchronous external abort: 96000210 [#1] PREEMPT SMP [ 90.189806] Modules linked in: moal(O) mlan(O) [ 90.194258] CPU: 0 PID: 503 Comm: btattach Tainted: G O 5.15.32-06136-g34eecdf2f9e4 #37 [ 90.203554] Hardware name: NXP i.MX8ULP 9X9 EVK (DT) [ 90.208513] pstate: 600000c5 (nZCv daIF -PAN -UAO -TCO -DIT -SSBS BTYPE=--) [ 90.215470] pc : fsl_edma3_disable_request+0x8/0x60 [ 90.220358] lr : fsl_edma3_terminate_all+0x34/0x20c [ 90.225237] sp : ffff800013f0bac0 [ 90.228548] x29: ffff800013f0bac0 x28: 0000000000000001 x27: ffff000008404800 [ 90.235681] x26: ffff000008404960 x25: ffff000008404a08 x24: ffff000008404a00 [ 90.242813] x23: ffff000008404a60 x22: 0000000000000002 x21: 0000000000000000 [ 90.249946] x20: ffff800013f0baf8 x19: ffff00000559c800 x18: 0000000000000000 [ 90.257078] x17: 0000000000000000 x16: 0000000000000000 x15: 0000000000000000 [ 90.264211] x14: 0000000000000003 x13: 0000000000000000 x12: 0000000000000040 [ 90.271344] x11: ffff00000600c248 x10: ffff800013f0bb10 x9 : ffff000057bcb090 [ 90.278477] x8 : fffffc0000241a08 x7 : ffff00000534ee00 x6 : ffff000008404804 [ 90.285609] x5 : 0000000000000000 x4 : 0000000000000000 x3 : ffff0000055b3480 [ 90.292742] x2 : ffff8000135c0000 x1 : ffff00000534ee00 x0 : ffff00000559c800 [ 90.299876] Call trace: [ 90.302321] fsl_edma3_disable_request+0x8/0x60 [ 90.306851] lpuart_flush_buffer+0x40/0x160 [ 90.311037] uart_flush_buffer+0x88/0x120 [ 90.315050] tty_driver_flush_buffer+0x20/0x30 [ 90.319496] hci_uart_flush+0x44/0x90 [ 90.323162] +0x34/0x12c [ 90.327253] tty_ldisc_close+0x38/0x70 [ 90.331005] tty_ldisc_release+0xa8/0x190 [ 90.335018] tty_release_struct+0x24/0x8c [ 90.339022] tty_release+0x3ec/0x4c0 [ 90.342593] __fput+0x70/0x234 [ 90.345652] ____fput+0x14/0x20 [ 90.348790] task_work_run+0x84/0x17c [ 90.352455] do_exit+0x310/0x96c [ 90.355688] do_group_exit+0x3c/0xa0 [ 90.359259] __arm64_sys_exit_group+0x1c/0x20 [ 90.363609] invoke_syscall+0x48/0x114 [ 90.367362] el0_svc_common.constprop.0+0xd4/0xfc [ 90.372068] do_el0_svc+0x2c/0x94 [ 90.375379] el0_svc+0x28/0x80 [ 90.378438] el0t_64_sync_handler+0xa8/0x130 [ 90.382711] el0t_64_sync+0x1a0/0x1a4 [ 90.386376] Code: 17ffffda d503201f d503233f f9409802 (b9400041) [ 90.392467] ---[ end trace 2f60524b4a43f1f6 ]--- [ 90.397073] note: btattach[503] exited with preempt_count 1 [ 90.402636] Fixing recursive fault but reboot is needed!
--- drivers/tty/serial/fsl_lpuart.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/tty/serial/fsl_lpuart.c +2 -0
@@ -1725,6 +1725,7 @@ static void lpuart_dma_shutdown(struct lpuart_port *sport)if (sport->lpuart_dma_rx_use) {del_timer_sync (&sport->lpuart_timer);lpuart_dma_rx_free (&sport->port); + sport->lpuart_dma_rx_use = false; }if (sport->lpuart_dma_tx_use) {
@@ -1733,6 +1734,7 @@ static void lpuart_dma_shutdown(struct lpuart_port *sport) sport->dma_tx_in_progress = false;dmaengine_terminate_all (sport->dma_tx_chan); } + sport->lpuart_dma_tx_use = false; }if (sport->dma_tx_chan)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 110/390 selftests/xsk: Avoid use-after-free on ctx
In reply to Greg Kroah-HartmanFrom: Ian Rogers <[email protected]>
[ Upstream commit af515a5587b8f45f19e11657746e0c89411b0380 ]
The put lowers the reference count to 0 and frees ctx, reading it afterwards is invalid. Move the put after the uses and determine the last use by the reference count being 1.
--- tools/lib/bpf/xsk.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
tools/lib/bpf/xsk.c +3 -3
@@ -930,13 +930,13 @@ void xsk_socket__delete(struct xsk_socket *xsk) ctx = xsk->ctx; umem = ctx->umem; -xsk_put_ctx (ctx, true); - -if (!ctx->refcount) { +if (ctx->refcount ==1 ) {xsk_delete_bpf_maps (xsk);close (ctx->prog_fd); } +xsk_put_ctx (ctx, true); + err =xsk_get_mmap_offsets (xsk->fd, &off);if (!err) {if (xsk->rx) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 156/390 ASoC: rsnd: Add check for rsnd_mod_power_on
In reply to Greg Kroah-HartmanFrom: Jiasheng Jiang <[email protected]>
[ Upstream commit 376be51caf8871419bbcbb755e1e615d30dc3153 ]
As rsnd_mod_power_on() can return negative numbers, it should be better to check the return value and deal with the exception.
--- sound/soc/sh/rcar/ctu.c | 6 +++++- sound/soc/sh/rcar/dvc.c | 6 +++++- sound/soc/sh/rcar/mix.c | 6 +++++- sound/soc/sh/rcar/src.c | 5 ++++- sound/soc/sh/rcar/ssi.c | 4 +++- 5 files changed, 22 insertions(+), 5 deletions(-)
sound/soc/sh/rcar/ctu.c +5 -1
@@ -171,7 +171,11 @@ static int rsnd_ctu_init(struct rsnd_mod *mod,struct rsnd_dai_stream *io, struct rsnd_priv *priv) { -rsnd_mod_power_on (mod ); + int ret; + + ret =rsnd_mod_power_on (mod); +if (ret <0 ) +return ret;rsnd_ctu_activation (mod);
sound/soc/sh/rcar/dvc.c +5 -1
@@ -186,7 +186,11 @@ static int rsnd_dvc_init(struct rsnd_mod *mod,struct rsnd_dai_stream *io, struct rsnd_priv *priv) { -rsnd_mod_power_on (mod ); + int ret; + + ret =rsnd_mod_power_on (mod); +if (ret <0 ) +return ret;rsnd_dvc_activation (mod);
sound/soc/sh/rcar/mix.c +5 -1
@@ -146,7 +146,11 @@ static int rsnd_mix_init(struct rsnd_mod *mod,struct rsnd_dai_stream *io, struct rsnd_priv *priv) { -rsnd_mod_power_on (mod ); + int ret; + + ret =rsnd_mod_power_on (mod); +if (ret <0 ) +return ret;rsnd_mix_activation (mod);
sound/soc/sh/rcar/src.c +4 -1
@@ -454,11 +454,14 @@ static int rsnd_src_init(struct rsnd_mod *mod, struct rsnd_priv *priv) {struct rsnd_src *src =rsnd_mod_to_src (mod); +int ret;/* reset sync convert_rate */ src->sync.val =0 ; -rsnd_mod_power_on (mod); + ret =rsnd_mod_power_on (mod); +if (ret <0 ) +return ret;rsnd_src_activation (mod);
sound/soc/sh/rcar/ssi.c +3 -1
@@ -518,7 +518,9 @@ static int rsnd_ssi_init(struct rsnd_mod *mod, ssi->usrcnt++; -rsnd_mod_power_on (mod); + ret =rsnd_mod_power_on (mod); +if (ret <0 ) +return ret;rsnd_ssi_config_init (mod, io);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 305/390 wifi: brcmfmac: fix invalid address access when enabling SCAN log level
In reply to Greg Kroah-HartmanFrom: Wright Feng <[email protected]>
[ Upstream commit aa666b68e73fc06d83c070d96180b9010cf5a960 ]
The variable i is changed when setting random MAC address and causes invalid address access when printing the value of pi->reqs[i]->reqid.
We replace reqs index with ri to fix the issue.
[ 136.726473] Unable to handle kernel access to user memory outside uaccess routines at virtual address 0000000000000000 [ 136.737365] Mem abort info: [ 136.740172] ESR = 0x96000004 [ 136.743359] Exception class = DABT (current EL), IL = 32 bits [ 136.749294] SET = 0, FnV = 0 [ 136.752481] EA = 0, S1PTW = 0 [ 136.755635] Data abort info: [ 136.758514] ISV = 0, ISS = 0x00000004 [ 136.762487] CM = 0, WnR = 0 [ 136.765522] user pgtable: 4k pages, 48-bit VAs, pgdp = 000000005c4e2577 [ 136.772265] [0000000000000000] pgd=0000000000000000 [ 136.777160] Internal error: Oops: 96000004 [#1] PREEMPT SMP [ 136.782732] Modules linked in: brcmfmac(O) brcmutil(O) cfg80211(O) compat(O) [ 136.789788] Process wificond (pid: 3175, stack limit = 0x00000000053048fb) [ 136.796664] CPU: 3 PID: 3175 Comm: wificond Tainted: G O 4.19.42-00001-g531a5f5 #1 [ 136.805532] Hardware name: Freescale i.MX8MQ EVK (DT) [ 136.810584] pstate: 60400005 (nZCv daif +PAN -UAO) [ 136.815429] pc : brcmf_pno_config_sched_scans+0x6cc/0xa80 [brcmfmac] [ 136.821811] lr : brcmf_pno_config_sched_scans+0x67c/0xa80 [brcmfmac] [ 136.828162] sp : ffff00000e9a3880 [ 136.831475] x29: ffff00000e9a3890 x28: ffff800020543400 [ 136.836786] x27: ffff8000b1008880 x26: ffff0000012bf6a0 [ 136.842098] x25: ffff80002054345c x24: ffff800088d22400 [ 136.847409] x23: ffff0000012bf638 x22: ffff0000012bf6d8 [ 136.852721] x21: ffff8000aced8fc0 x20: ffff8000ac164400 [ 136.858032] x19: ffff00000e9a3946 x18: 0000000000000000 [ 136.863343] x17: 0000000000000000 x16: 0000000000000000 [ 136.868655] x15: ffff0000093f3b37 x14: 0000000000000050 [ 136.873966] x13: 0000000000003135 x12: 0000000000000000 [ 136.879277] x11: 0000000000000000 x10: ffff000009a61888 [ 136.884589] x9 : 000000000000000f x8 : 0000000000000008 [ 136.889900] x7 : 303a32303d726464 x6 : ffff00000a1f957d [ 136.895211] x5 : 0000000000000000 x4 : ffff00000e9a3942 [ 136.900523] x3 : 0000000000000000 x2 : ffff0000012cead8 [ 136.905834] x1 : ffff0000012bf6d8 x0 : 0000000000000000 [ 136.911146] Call trace: [ 136.913623] brcmf_pno_config_sched_scans+0x6cc/0xa80 [brcmfmac] [ 136.919658] brcmf_pno_start_sched_scan+0xa4/0x118 [brcmfmac] [ 136.925430] brcmf_cfg80211_sched_scan_start+0x80/0xe0 [brcmfmac] [ 136.931636] nl80211_start_sched_scan+0x140/0x308 [cfg80211] [ 136.937298] genl_rcv_msg+0x358/0x3f4 [ 136.940960] netlink_rcv_skb+0xb4/0x118 [ 136.944795] genl_rcv+0x34/0x48 [ 136.947935] netlink_unicast+0x264/0x300 [ 136.951856] netlink_sendmsg+0x2e4/0x33c [ 136.955781] __sys_sendto+0x120/0x19c
--- .../net/wireless/broadcom/brcm80211/brcmfmac/pno.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c +6 -6
@@ -158,12 +158,12 @@ static int brcmf_pno_set_random(struct brcmf_if *ifp, struct brcmf_pno_info *pi)struct brcmf_pno_macaddr_le pfn_mac;u8 *mac_addr =NULL ;u8 *mac_mask =NULL ; -int err, i; +int err, i, ri; -for (i =0 ; i < pi->n_reqs; i++) -if (pi->reqs[i]->flags &NL80211_SCAN_FLAG_RANDOM_ADDR ) { - mac_addr = pi->reqs[i]->mac_addr; - mac_mask = pi->reqs[i]->mac_addr_mask; +for (ri =0 ; ri < pi->n_reqs; ri++) +if (pi->reqs[ri]->flags &NL80211_SCAN_FLAG_RANDOM_ADDR ) { + mac_addr = pi->reqs[ri]->mac_addr; + mac_mask = pi->reqs[ri]->mac_addr_mask;break ; }
@@ -185,7 +185,7 @@ static int brcmf_pno_set_random(struct brcmf_if *ifp, struct brcmf_pno_info *pi) pfn_mac.mac[0 ] |=0x02 ;brcmf_dbg (SCAN ,"enabling random mac: reqid=%llu mac=%pM\n" , - pi->reqs[i]->reqid, pfn_mac.mac); + pi->reqs[ri]->reqid, pfn_mac.mac); err =brcmf_fil_iovar_data_set (ifp,"pfn_macaddr" , &pfn_mac,sizeof (pfn_mac));if (err)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 24/390 fs: dlm: handle -EBUSY first in lock arg validation
In reply to Greg Kroah-HartmanFrom: Alexander Aring <[email protected]>
commit 44637ca41d551d409a481117b07fa209b330fca9 upstream.
During lock arg validation, first check for -EBUSY cases, then for -EINVAL cases. The -EINVAL checks look at lkb state variables which are not stable when an lkb is busy and would cause an -EBUSY result, e.g. lkb->lkb_grmode.
--- fs/dlm/lock.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
fs/dlm/lock.c +8 -8
@@ -2888,24 +2888,24 @@ static int set_unlock_args(uint32_t flagstatic int validate_lock_args (struct dlm_ls *ls,struct dlm_lkb *lkb,struct dlm_args *args) { -int rv = -EINVAL ; +int rv = -EBUSY ;if (args->flags &DLM_LKF_CONVERT ) { -if (lkb->lkb_flags &DLM_IFL_MSTCPY ) +if (lkb->lkb_status !=DLM_LKSTS_GRANTED ) goto out; -if (args->flags &DLM_LKF_QUECVT && - !__quecvt_compat_matrix[lkb->lkb_grmode+1 ][args->mode+1 ]) +if (lkb->lkb_wait_type) goto out; - rv = -EBUSY ; -if (lkb->lkb_status !=DLM_LKSTS_GRANTED ) +if (is_overlap (lkb)) goto out; -if (lkb->lkb_wait_type) + rv = -EINVAL ; +if (lkb->lkb_flags &DLM_IFL_MSTCPY ) goto out; -if (is_overlap (lkb)) +if (args->flags &DLM_LKF_QUECVT && + !__quecvt_compat_matrix[lkb->lkb_grmode+1 ][args->mode+1 ]) goto out; }