5.6.5-rc1 review
Subsystems (3)
Greg Kroah-Hartman
maintainerPATCH 200/254 drm/i915/gem: Flush all the reloc_gpu batch
In reply to Greg Kroah-HartmanFrom: Chris Wilson <[email protected]>
commit 1aaea8476d9f014667d2cb24819f9bcaf3ebb7a4 upstream.
__i915_gem_object_flush_map() takes a byte range, so feed it the written bytes and do not mistake the u32 index as bytes!
--- drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c +5 -3
@@ -914,11 +914,13 @@ static inline struct i915_ggtt *cache_tostatic void reloc_gpu_flush (struct reloc_cache *cache) { -GEM_BUG_ON (cache->rq_size >= cache->rq->batch->obj->base.size /sizeof (u32)); +struct drm_i915_gem_object *obj = cache->rq->batch->obj; + +GEM_BUG_ON (cache->rq_size >= obj->base.size /sizeof (u32)); cache->rq_cmd[cache->rq_size] =MI_BATCH_BUFFER_END ; -__i915_gem_object_flush_map (cache->rq->batch->obj,0 , cache->rq_size); -i915_gem_object_unpin_map (cache->rq->batch->obj); +__i915_gem_object_flush_map (obj,0 ,sizeof (u32) * (cache->rq_size +1 )); +i915_gem_object_unpin_map (obj);intel_gt_chipset_flush (cache->rq->engine->gt);
Greg Kroah-Hartman
maintainerPATCH 198/254 selftests/powerpc: Fix try-run when source tree is not writable
In reply to Greg Kroah-HartmanFrom: Michael Ellerman <[email protected]>
commit 9686813f6e9d5568bc045de0be853411e44958c8 upstream.
We added a usage of try-run to pmu/ebb/Makefile to detect if the toolchain supported the -no-pie option.
This fails if we build out-of-tree and the source tree is not writable, as try-run tries to write its temporary files to the current directory. That leads to the -no-pie option being silently dropped, which leads to broken executables with some toolchains.
If we remove the redirect to /dev/null in try-run, we see the error:
make[3]: Entering directory '/linux/tools/testing/selftests/powerpc/pmu/ebb' /usr/bin/ld: cannot open output file .54.tmp: Read-only file system
collect2: error: ld returned 1 exit status
make[3]: Nothing to be done for 'all'.
And looking with strace we see it's trying to use a file that's in the source tree:
lstat("/linux/tools/testing/selftests/powerpc/pmu/ebb/.54.tmp", 0x7ffffc0f83c8)
We can fix it by setting TMPOUT to point to the $(OUTPUT) directory, and we can verify with strace it's now trying to write to the output directory:
lstat("/output/kselftest/powerpc/pmu/ebb/.54.tmp", 0x7fffd1bf6bf8)
And also see that the -no-pie option is now correctly detected.
--- tools/testing/selftests/powerpc/pmu/ebb/Makefile | 1 + 1 file changed, 1 insertion(+)
tools/testing/selftests/powerpc/pmu/ebb/Makefile +1 -0
@@ -7,6 +7,7 @@ noarg: # The EBB handler is 64-bit code and everything links against it CFLAGS += -m64 +TMPOUT = $(OUTPUT)/ # Toolchains may build PIE by default which breaks the assembly no-pie-option := $(call try-run, echo 'int main() { return 0; }' | \ $(CC) -Werror $(KBUILD_CPPFLAGS) $(CC_OPTION_CFLAGS) -no-pie -x c - -o "$$TMP", -no-pie)
Greg Kroah-Hartman
maintainerPATCH 195/254 selftests: vm: drop dependencies on page flags from mlock2 tests
In reply to Greg Kroah-HartmanFrom: Michal Hocko <[email protected]>
commit eea274d64e6ea8aff2224d33d0851133a84cc7b5 upstream.
It was noticed that mlock2 tests are failing after 9c4e6b1a7027f ("mm, mlock, vmscan: no more skipping pagevecs") because the patch has changed the timing on when the page is added to the unevictable LRU list and thus gains the unevictable page flag.
The test was just too dependent on the implementation details which were true at the time when it was introduced. Page flags and the timing when they are set is something no userspace should ever depend on. The test should be testing only for the user observable contract of the tested syscalls. Those are defined pretty well for the mlock and there are other means for testing them. In fact this is already done and testing for page flags can be safely dropped to achieve the aimed purpose. Present bits can be checked by /proc/<pid>/smaps RSS field and the locking state by VmFlags although I would argue that Locked: field would be more appropriate.
Drop all the page flag machinery and considerably simplify the test. This should be more robust for future kernel changes while checking the promised contract is still valid.
--- tools/testing/selftests/vm/mlock2-tests.c | 233 ++++-------------------------- 1 file changed, 37 insertions(+), 196 deletions(-)
tools/testing/selftests/vm/mlock2-tests.c +37 -196
@@ -67,59 +67,6 @@ out:return ret; } -static uint64_t get_pageflags (unsigned long addr) -{ -FILE *file; -uint64_t pfn; -unsigned long offset; - - file =fopen ("/proc/self/pagemap" ,"r" ); -if (!file) { -perror ("fopen pagemap" ); -_exit (1 ); - } - - offset = addr /getpagesize () *sizeof (pfn); - -if (fseek (file, offset,SEEK_SET )) { -perror ("fseek pagemap" ); -_exit (1 ); - } - -if (fread (&pfn,sizeof (pfn),1 , file) !=1 ) { -perror ("fread pagemap" ); -_exit (1 ); - } - -fclose (file); -return pfn; -} - -static uint64_t get_kpageflags (unsigned long pfn) -{ -uint64_t flags; -FILE *file; - - file =fopen ("/proc/kpageflags" ,"r" ); -if (!file) { -perror ("fopen kpageflags" ); -_exit (1 ); - } - -if (fseek (file, pfn *sizeof (flags),SEEK_SET )) { -perror ("fseek kpageflags" ); -_exit (1 ); - } - -if (fread (&flags,sizeof (flags),1 , file) !=1 ) { -perror ("fread kpageflags" ); -_exit (1 ); - } - -fclose (file); -return flags; -} -#define VMFLAGS "VmFlags:"static bool is_vmflag_set (unsigned long addr,const char *vmflag)
@@ -159,19 +106,13 @@ out:#define RSS "Rss:"#define LOCKED "lo" -static bool is_vma_lock_on_fault (unsigned long addr) +static unsigned long get_value_for_name (unsigned long addr,const char *name) { -bool ret = false; -bool locked; -FILE *smaps =NULL ; -unsigned long vma_size, vma_rss;char *line =NULL ; -char *value;size_t size =0 ; - - locked =is_vmflag_set (addr,LOCKED ); -if (!locked) - goto out; +char *value_ptr; +FILE *smaps =NULL ; +unsigned long value =-1UL ; smaps =seek_to_smaps_entry (addr);if (!smaps) {
@@ -180,112 +121,70 @@ static bool is_vma_lock_on_fault(unsigne }while (getline (&line, &size, smaps) >0 ) { -if (!strstr (line,SIZE )) { +if (!strstr (line, name)) {free (line); line =NULL ; size =0 ;continue ; } - value = line +strlen (SIZE ); -if (sscanf (value,"%lu kB" , &vma_size) <1 ) { + value_ptr = line +strlen (name); +if (sscanf (value_ptr,"%lu kB" , &value) <1 ) {printf ("Unable to parse smaps entry for Size\n" ); goto out; }break ; } -while (getline (&line, &size, smaps) >0 ) { -if (!strstr (line,RSS )) { -free (line); - line =NULL ; - size =0 ; -continue ; - } - - value = line +strlen (RSS ); -if (sscanf (value,"%lu kB" , &vma_rss) <1 ) { -printf ("Unable to parse smaps entry for Rss\n" ); - goto out; - } -break ; - } - - ret = locked && (vma_rss < vma_size); out: -free (line);if (smaps)fclose (smaps); -return ret; +free (line); +return value; } -#define PRESENT_BIT 0x8000000000000000ULL -#define PFN_MASK 0x007FFFFFFFFFFFFFULL -#define UNEVICTABLE_BIT (1UL << 18) - -static int lock_check (char *map) +static bool is_vma_lock_on_fault (unsigned long addr) { -unsigned long page_size =getpagesize (); -uint64_t page1_flags, page2_flags; +bool locked; +unsigned long vma_size, vma_rss; + + locked =is_vmflag_set (addr,LOCKED ); +if (!locked) +return false; - page1_flags =get_pageflags ((unsigned long )map); - page2_flags =get_pageflags ((unsigned long )map + page_size); + vma_size =get_value_for_name (addr,SIZE ); + vma_rss =get_value_for_name (addr,RSS ); -/* Both pages should be present */ -if (((page1_flags &PRESENT_BIT ) ==0 ) || - ((page2_flags &PRESENT_BIT ) ==0 )) { -printf ("Failed to make both pages present\n" ); -return 1 ; - } +/* only one page is faulted in */ +return (vma_rss < vma_size); +} - page1_flags =get_kpageflags (page1_flags &PFN_MASK ); - page2_flags =get_kpageflags (page2_flags &PFN_MASK ); +#define PRESENT_BIT 0x8000000000000000ULL +#define PFN_MASK 0x007FFFFFFFFFFFFFULL +#define UNEVICTABLE_BIT (1UL << 18) -/* Both pages should be unevictable */ -if (((page1_flags &UNEVICTABLE_BIT ) ==0 ) || - ((page2_flags &UNEVICTABLE_BIT ) ==0 )) { -printf ("Failed to make both pages unevictable\n" ); -return 1 ; - } +static int lock_check (unsigned long addr) +{ +bool locked; +unsigned long vma_size, vma_rss; -if (!is_vmflag_set ((unsigned long )map,LOCKED )) { -printf ("VMA flag %s is missing on page 1\n" ,LOCKED ); -return 1 ; - } + locked =is_vmflag_set (addr,LOCKED ); +if (!locked) +return false; -if (!is_vmflag_set ((unsigned long )map + page_size,LOCKED )) { -printf ("VMA flag %s is missing on page 2\n" ,LOCKED ); -return 1 ; - } + vma_size =get_value_for_name (addr,SIZE ); + vma_rss =get_value_for_name (addr,RSS ); -return 0 ; +return (vma_rss == vma_size); }static int unlock_lock_check (char *map) { -unsigned long page_size =getpagesize (); -uint64_t page1_flags, page2_flags; - - page1_flags =get_pageflags ((unsigned long )map); - page2_flags =get_pageflags ((unsigned long )map + page_size); - page1_flags =get_kpageflags (page1_flags &PFN_MASK ); - page2_flags =get_kpageflags (page2_flags &PFN_MASK ); - -if ((page1_flags &UNEVICTABLE_BIT ) || (page2_flags &UNEVICTABLE_BIT )) { -printf ("A page is still marked unevictable after unlock\n" ); -return 1 ; - } -if (is_vmflag_set ((unsigned long )map,LOCKED )) {printf ("VMA flag %s is present on page 1 after unlock\n" ,LOCKED );return 1 ; } -if (is_vmflag_set ((unsigned long )map + page_size,LOCKED )) { -printf ("VMA flag %s is present on page 2 after unlock\n" ,LOCKED ); -return 1 ; - } -return 0 ; }
@@ -311,7 +210,7 @@ static int test_mlock_lock() goto unmap; } -if (lock_check (map)) +if (!lock_check ((unsigned long )map)) goto unmap;/* Now unlock and recheck attributes */
@@ -330,64 +229,18 @@ out:static int onfault_check (char *map) { -unsigned long page_size =getpagesize (); -uint64_t page1_flags, page2_flags; - - page1_flags =get_pageflags ((unsigned long )map); - page2_flags =get_pageflags ((unsigned long )map + page_size); - -/* Neither page should be present */ -if ((page1_flags &PRESENT_BIT ) || (page2_flags &PRESENT_BIT )) { -printf ("Pages were made present by MLOCK_ONFAULT\n" ); -return 1 ; - } - *map ='a' ; - page1_flags =get_pageflags ((unsigned long )map); - page2_flags =get_pageflags ((unsigned long )map + page_size); - -/* Only page 1 should be present */ -if ((page1_flags &PRESENT_BIT ) ==0 ) { -printf ("Page 1 is not present after fault\n" ); -return 1 ; - }else if (page2_flags &PRESENT_BIT ) { -printf ("Page 2 was made present\n" ); -return 1 ; - } - - page1_flags =get_kpageflags (page1_flags &PFN_MASK ); - -/* Page 1 should be unevictable */ -if ((page1_flags &UNEVICTABLE_BIT ) ==0 ) { -printf ("Failed to make faulted page unevictable\n" ); -return 1 ; - } -if (!is_vma_lock_on_fault ((unsigned long )map)) {printf ("VMA is not marked for lock on fault\n" );return 1 ; } -if (!is_vma_lock_on_fault ((unsigned long )map + page_size)) { -printf ("VMA is not marked for lock on fault\n" ); -return 1 ; - } -return 0 ; }static int unlock_onfault_check (char *map) {unsigned long page_size =getpagesize (); -uint64_t page1_flags; - - page1_flags =get_pageflags ((unsigned long )map); - page1_flags =get_kpageflags (page1_flags &PFN_MASK ); - -if (page1_flags &UNEVICTABLE_BIT ) { -printf ("Page 1 is still marked unevictable after unlock\n" ); -return 1 ; - }if (is_vma_lock_on_fault ((unsigned long )map) ||is_vma_lock_on_fault ((unsigned long )map + page_size)) {
@@ -445,7 +298,6 @@ static int test_lock_onfault_of_present(char *map;int ret =1 ;unsigned long page_size =getpagesize (); -uint64_t page1_flags, page2_flags; map =mmap (NULL ,2 * page_size,PROT_READ |PROT_WRITE ,MAP_ANONYMOUS |MAP_PRIVATE ,-1 ,0 );
@@ -465,17 +317,6 @@ static int test_lock_onfault_of_present( goto unmap; } - page1_flags =get_pageflags ((unsigned long )map); - page2_flags =get_pageflags ((unsigned long )map + page_size); - page1_flags =get_kpageflags (page1_flags &PFN_MASK ); - page2_flags =get_kpageflags (page2_flags &PFN_MASK ); - -/* Page 1 should be unevictable */ -if ((page1_flags &UNEVICTABLE_BIT ) ==0 ) { -printf ("Failed to make present page unevictable\n" ); - goto unmap; - } -if (!is_vma_lock_on_fault ((unsigned long )map) || !is_vma_lock_on_fault ((unsigned long )map + page_size)) {printf ("VMA with present pages is not marked lock on fault\n" );
@@ -507,7 +348,7 @@ static int test_munlockall() goto out; } -if (lock_check (map)) +if (!lock_check ((unsigned long )map)) goto unmap;if (munlockall ()) {
@@ -549,7 +390,7 @@ static int test_munlockall() goto out; } -if (lock_check (map)) +if (!lock_check ((unsigned long )map)) goto unmap;if (munlockall ()) {
Greg Kroah-Hartman
maintainerPATCH 196/254 selftests/vm: fix map_hugetlb length used for testing read and write
In reply to Greg Kroah-HartmanFrom: Christophe Leroy <[email protected]>
commit cabc30da10e677c67ab9a136b1478175734715c5 upstream.
Commit fa7b9a805c79 ("tools/selftest/vm: allow choosing mem size and page size in map_hugetlb") added the possibility to change the size of memory mapped for the test, but left the read and write test using the default value. This is unnoticed when mapping a length greater than the default one, but segfaults otherwise.
Fix read_bytes() and write_bytes() by giving them the real length.
Also fix the call to munmap().
--- tools/testing/selftests/vm/map_hugetlb.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
tools/testing/selftests/vm/map_hugetlb.c +7 -7
@@ -45,20 +45,20 @@ static void check_bytes(char *addr)printf ("First hex is %x\n" , *((unsigned int *)addr)); } -static void write_bytes (char *addr) +static void write_bytes (char *addr,size_t length) {unsigned long i; -for (i =0 ; i <LENGTH ; i++) +for (i =0 ; i < length; i++) *(addr + i) = (char )i; } -static int read_bytes (char *addr) +static int read_bytes (char *addr,size_t length) {unsigned long i;check_bytes (addr); -for (i =0 ; i <LENGTH ; i++) +for (i =0 ; i < length; i++)if (*(addr + i) != (char )i) {printf ("Mismatch at %lu\n" , i);return 1 ;
@@ -96,11 +96,11 @@ int main(int argc, char **argv)printf ("Returned address is %p\n" , addr);check_bytes (addr); -write_bytes (addr); - ret =read_bytes (addr); +write_bytes (addr, length); + ret =read_bytes (addr, length);/* munmap() length of MAP_HUGETLB memory must be hugepage aligned */ -if (munmap (addr,LENGTH )) { +if (munmap (addr, length)) {perror ("munmap" );exit (1 ); }
Greg Kroah-Hartman
maintainerPATCH 193/254 arm64: dts: ti: k3-am65: Add clocks to dwc3 nodes
In reply to Greg Kroah-HartmanFrom: Dave Gerlach <[email protected]>
commit a81e5442d796ccfa2cc97d205a5477053264d978 upstream.
The TI sci-clk driver can scan the DT for all clocks provided by system firmware and does this by checking the clocks property of all nodes, so we must add this to the dwc3 nodes so USB clocks are available.
Without this USB does not work with latest system firmware i.e.
[ 1.714662] clk: couldn't get parent clock 0 for /interconnect@100000/dwc3@4020000
--- arch/arm64/boot/dts/ti/k3-am65-main.dtsi | 2 ++ 1 file changed, 2 insertions(+)
arch/arm64/boot/dts/ti/k3-am65-main.dtsi +2 -0
@@ -296,6 +296,7 @@ interrupts = <GIC_SPI 97 IRQ_TYPE_LEVEL_HIGH>; dma-coherent; power-domains = <&k3_pds 151 TI_SCI_PD_EXCLUSIVE>; + clocks = <&k3_clks 151 2>, <&k3_clks 151 7>; assigned-clocks = <&k3_clks 151 2>, <&k3_clks 151 7>; assigned-clock-parents = <&k3_clks 151 4>, /* set REF_CLK to 20MHz i.e. PER0_PLL/48 */ <&k3_clks 151 9>; /* set PIPE3_TXB_CLK to CLK_12M_RC/256 (for HS only) */
@@ -335,6 +336,7 @@ interrupts = <GIC_SPI 117 IRQ_TYPE_LEVEL_HIGH>; dma-coherent; power-domains = <&k3_pds 152 TI_SCI_PD_EXCLUSIVE>; + clocks = <&k3_clks 152 2>; assigned-clocks = <&k3_clks 152 2>; assigned-clock-parents = <&k3_clks 152 4>; /* set REF_CLK to 20MHz i.e. PER0_PLL/48 */
Greg Kroah-Hartman
maintainerPATCH 194/254 arm64: armv8_deprecated: Fix undef_hook mask for thumb setend
In reply to Greg Kroah-HartmanFrom: Fredrik Strupe <[email protected]>
commit fc2266011accd5aeb8ebc335c381991f20e26e33 upstream.
For thumb instructions, call_undef_hook() in traps.c first reads a u16, and if the u16 indicates a T32 instruction (u16 >= 0xe800), a second u16 is read, which then makes up the the lower half-word of a T32 instruction. For T16 instructions, the second u16 is not read, which makes the resulting u32 opcode always have the upper half set to 0.
However, having the upper half of instr_mask in the undef_hook set to 0 masks out the upper half of all thumb instructions - both T16 and T32. This results in trapped T32 instructions with the lower half-word equal to the T16 encoding of setend (b650) being matched, even though the upper half-word is not 0000 and thus indicates a T32 opcode.
An example of such a T32 instruction is eaa0b650, which should raise a SIGILL since T32 instructions with an eaa prefix are unallocated as per Arm ARM, but instead works as a SETEND because the second half-word is set to b650.
This patch fixes the issue by extending instr_mask to include the upper u32 half, which will still match T16 instructions where the upper half is 0, but not T32 instructions.
--- arch/arm64/kernel/armv8_deprecated.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/kernel/armv8_deprecated.c +1 -1
@@ -601,7 +601,7 @@ static struct undef_hook setend_hooks[] }, {/* Thumb mode */ - .instr_mask = 0x0000fff7, + .instr_mask = 0xfffffff7, .instr_val = 0x0000b650, .pstate_mask = (PSR_AA32_T_BIT | PSR_AA32_MODE_MASK), .pstate_val = (PSR_AA32_T_BIT | PSR_AA32_MODE_USR),
Greg Kroah-Hartman
maintainerPATCH 192/254 ARM: dts: exynos: Fix polarity of the LCD SPI bus on UniversalC210 board
In reply to Greg Kroah-HartmanFrom: Marek Szyprowski <[email protected]>
commit 32a1671ff8e84f0dfff3a50d4b2091d25e91f5e2 upstream.
Recent changes in the SPI core and the SPI-GPIO driver revealed that the GPIO lines for the LD9040 LCD controller on the UniversalC210 board are defined incorrectly. Fix the polarity for those lines to match the old behavior and hardware requirements to fix LCD panel operation with recent kernels.
--- arch/arm/boot/dts/exynos4210-universal_c210.dts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
arch/arm/boot/dts/exynos4210-universal_c210.dts +1 -3
@@ -115,7 +115,7 @@ gpio-sck = <&gpy3 1 GPIO_ACTIVE_HIGH>; gpio-mosi = <&gpy3 3 GPIO_ACTIVE_HIGH>; num-chipselects = <1>; - cs-gpios = <&gpy4 3 GPIO_ACTIVE_HIGH>; + cs-gpios = <&gpy4 3 GPIO_ACTIVE_LOW>; lcd@0 { compatible = "samsung,ld9040";
@@ -124,8 +124,6 @@ vci-supply = <&ldo17_reg>; reset-gpios = <&gpy4 5 GPIO_ACTIVE_HIGH>; spi-max-frequency = <1200000>; - spi-cpol; - spi-cpha; power-on-delay = <10>; reset-delay = <10>; panel-width-mm = <90>;
Greg Kroah-Hartman
maintainerPATCH 145/254 mtd: rawnand: cadence: change bad block marker size
In reply to Greg Kroah-HartmanFrom: Piotr Sroka <[email protected]>
commit 9bf1903bed7a2e84f5a8deedb38f7e0ac5e8bfc6 upstream.
Increase bad block marker size from one byte to two bytes. Bad block marker is handled by skip bytes feature of HPNFC. Controller expects this value to be an even number.
--- drivers/mtd/nand/raw/cadence-nand-controller.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/mtd/nand/raw/cadence-nand-controller.c +3 -6
@@ -2603,12 +2603,9 @@ int cadence_nand_attach_chip(struct nand chip->options |=NAND_NO_SUBPAGE_WRITE ; cdns_chip->bbm_offs = chip->badblockpos; -if (chip->options &NAND_BUSWIDTH_16 ) { - cdns_chip->bbm_offs &= ~0x01 ; - cdns_chip->bbm_len =2 ; - }else { - cdns_chip->bbm_len =1 ; - } + cdns_chip->bbm_offs &= ~0x01 ; +/* this value should be even number */ + cdns_chip->bbm_len =2 ; ret = nand_ecc_choose_conf(chip, &cdns_ctrl->ecc_caps,
Greg Kroah-Hartman
maintainerPATCH 146/254 mtd: rawnand: cadence: reinit completion before executing a new command
In reply to Greg Kroah-HartmanFrom: Piotr Sroka <[email protected]>
commit 0d7d6c8183aadb1dcc13f415941404a7913b46b3 upstream.
Reing the completion object before executing CDMA command to make sure the 'done' flag is OK.
--- drivers/mtd/nand/raw/cadence-nand-controller.c | 1 + 1 file changed, 1 insertion(+)
drivers/mtd/nand/raw/cadence-nand-controller.c +1 -0
@@ -997,6 +997,7 @@ static int cadence_nand_cdma_send(structreturn status;cadence_nand_reset_irq (cdns_ctrl); +reinit_completion (&cdns_ctrl->complete);writel_relaxed ((u32 )cdns_ctrl->dma_cdma_desc, cdns_ctrl->reg +CMD_REG2 );
Greg Kroah-Hartman
maintainerPATCH 144/254 mtd: rawnand: cadence: fix the calculation of the avaialble OOB size
In reply to Greg Kroah-HartmanFrom: Piotr Sroka <[email protected]>
commit e4578af0354176ff6b4ae78b9998b4f479f7c31c upstream.
The value of cdns_chip->sector_count is not known at the moment of the derivation of ecc_size, leading to a zero value. Fix this by assigning ecc_size later in the code.
--- drivers/mtd/nand/raw/cadence-nand-controller.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/mtd/nand/raw/cadence-nand-controller.c +2 -1
@@ -2585,7 +2585,7 @@ int cadence_nand_attach_chip(struct nand {struct cdns_nand_ctrl *cdns_ctrl =to_cdns_nand_ctrl (chip->controller);struct cdns_nand_chip *cdns_chip =to_cdns_nand_chip (chip); -u32 ecc_size = cdns_chip->sector_count * chip->ecc.bytes; +u32 ecc_size;struct mtd_info *mtd =nand_to_mtd (chip);u32 max_oob_data_size;int ret;
@@ -2625,6 +2625,7 @@ int cadence_nand_attach_chip(struct nand/* Error correction configuration. */ cdns_chip->sector_size = chip->ecc.size; cdns_chip->sector_count = mtd->writesize / cdns_chip->sector_size; + ecc_size = cdns_chip->sector_count * chip->ecc.bytes; cdns_chip->avail_oob_size = mtd->oobsize - ecc_size;
Greg Kroah-Hartman
maintainerPATCH 143/254 mtd: spinand: Do not erase the block before writing a bad block marker
In reply to Greg Kroah-HartmanFrom: Frieder Schrempf <[email protected]>
commit b645ad39d56846618704e463b24bb994c9585c7f upstream.
Currently when marking a block, we use spinand_erase_op() to erase the block before writing the marker to the OOB area. Doing so without waiting for the operation to finish can lead to the marking failing silently and no bad block marker being written to the flash.
In fact we don't need to do an erase at all before writing the BBM. The ECC is disabled for raw accesses to the OOB data and we don't need to work around any issues with chips reporting ECC errors as it is known to be the case for raw NAND.
--- drivers/mtd/nand/spi/core.c | 3 --- 1 file changed, 3 deletions(-)
drivers/mtd/nand/spi/core.c +0 -3
@@ -612,7 +612,6 @@ static int spinand_markbad(struct nand_d };int ret; -/* Erase block before marking it bad. */ ret =spinand_select_target (spinand, pos->target);if (ret)return ret;
@@ -621,8 +620,6 @@ static int spinand_markbad(struct nand_dif (ret)return ret; -spinand_erase_op (spinand, pos); -return spinand_write_page (spinand, &req); }
Greg Kroah-Hartman
maintainerPATCH 142/254 mtd: spinand: Stop using spinand->oobbuf for buffering bad block markers
In reply to Greg Kroah-HartmanFrom: Frieder Schrempf <[email protected]>
commit 2148937501ee3d663e0010e519a553fea67ad103 upstream.
For reading and writing the bad block markers, spinand->oobbuf is currently used as a buffer for the marker bytes. During the underlying read and write operations to actually get/set the content of the OOB area, the content of spinand->oobbuf is reused and changed by accessing it through spinand->oobbuf and/or spinand->databuf.
This is a flaw in the original design of the SPI NAND core and at the latest from 13c15e07eedf ("mtd: spinand: Handle the case where PROGRAM LOAD does not reset the cache") on, it results in not having the bad block marker written at all, as the spinand->oobbuf is cleared to 0xff after setting the marker bytes to zero.
To fix it, we now just store the two bytes for the marker on the stack and let the read/write operations copy it from/to the page buffer later.
--- drivers/mtd/nand/spi/core.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/mtd/nand/spi/core.c +7 -7
@@ -568,18 +568,18 @@ static int spinand_mtd_write(struct mtd_static bool spinand_isbad (struct nand_device *nand,const struct nand_pos *pos) {struct spinand_device *spinand =nand_to_spinand (nand); +u8 marker[2 ] = { };struct nand_page_io_req req = { .pos = *pos, - .ooblen =2 , + .ooblen =sizeof (marker), .ooboffs =0 , - .oobbuf.in = spinand->oobbuf, + .oobbuf.in = marker, .mode =MTD_OPS_RAW , }; -memset (spinand->oobbuf,0 ,2 );spinand_select_target (spinand, pos->target);spinand_read_page (spinand, &req, false); -if (spinand->oobbuf[0 ] !=0xff || spinand->oobbuf[1 ] !=0xff ) +if (marker[0 ] !=0xff || marker[1 ] !=0xff )return true;return false;
@@ -603,11 +603,12 @@ static int spinand_mtd_block_isbad(strucstatic int spinand_markbad (struct nand_device *nand,const struct nand_pos *pos) {struct spinand_device *spinand =nand_to_spinand (nand); +u8 marker[2 ] = { };struct nand_page_io_req req = { .pos = *pos, .ooboffs =0 , - .ooblen =2 , - .oobbuf.out = spinand->oobbuf, + .ooblen =sizeof (marker), + .oobbuf.out = marker, };int ret;
@@ -622,7 +623,6 @@ static int spinand_markbad(struct nand_dspinand_erase_op (spinand, pos); -memset (spinand->oobbuf,0 ,2 );return spinand_write_page (spinand, &req); }
Greg Kroah-Hartman
maintainerPATCH 177/254 dm clone: Fix handling of partial region discards
In reply to Greg Kroah-HartmanFrom: Nikos Tsironis <[email protected]>
commit 4b5142905d4ff58a4b93f7c8eaa7ba829c0a53c9 upstream.
There is a bug in the way dm-clone handles discards, which can lead to discarding the wrong blocks or trying to discard blocks beyond the end of the device.
This could lead to data corruption, if the destination device indeed discards the underlying blocks, i.e., if the discard operation results in the original contents of a block to be lost.
The root of the problem is the code that calculates the range of regions covered by a discard request and decides which regions to discard.
Since dm-clone handles the device in units of regions, we don't discard parts of a region, only whole regions.
The range is calculated as:
rs = dm_sector_div_up(bio->bi_iter.bi_sector, clone->region_size);
re = bio_end_sector(bio) >> clone->region_shift;, where 'rs' is the first region to discard and (re - rs) is the number of regions to discard.
The bug manifests when we try to discard part of a single region, i.e., when we try to discard a block with size < region_size, and the discard request both starts at an offset with respect to the beginning of that region and ends before the end of the region.
The root cause is the following comparison:
if (rs == re)
// skip discard and complete original bio immediately
, which doesn't take into account that 'rs' might be greater than 're'.
Thus, we then issue a discard request for the wrong blocks, instead of skipping the discard all together.
Fix the check to also take into account the above case, so we don't end up discarding the wrong blocks.
Also, add some range checks to dm_clone_set_region_hydrated() and dm_clone_cond_set_range(), which update dm-clone's region bitmap.
Note that the aforementioned bug doesn't cause invalid memory accesses, because dm_clone_is_range_hydrated() returns True for this case, so the checks are just precautionary.
--- drivers/md/dm-clone-metadata.c | 13 ++++++++++++ drivers/md/dm-clone-target.c | 43 +++++++++++++++++++++++++++-------------- 2 files changed, 42 insertions(+), 14 deletions(-)
drivers/md/dm-clone-metadata.c +13 -0
@@ -850,6 +850,12 @@ int dm_clone_set_region_hydrated(structstruct dirty_map *dmap;unsigned long word, flags; +if (unlikely (region_nr >= cmd->nr_regions)) { +DMERR ("Region %lu out of range (total number of regions %lu)" , + region_nr, cmd->nr_regions); +return -ERANGE ; + } + word = region_nr /BITS_PER_LONG ;spin_lock_irqsave (&cmd->bitmap_lock, flags);
@@ -879,6 +885,13 @@ int dm_clone_cond_set_range(struct dm_clstruct dirty_map *dmap;unsigned long word, region_nr; +if (unlikely (start >= cmd->nr_regions || (start + nr_regions) < start || + (start + nr_regions) > cmd->nr_regions)) { +DMERR ("Invalid region range: start %lu, nr_regions %lu (total number of regions %lu)" , + start, nr_regions, cmd->nr_regions); +return -ERANGE ; + } +spin_lock_irq (&cmd->bitmap_lock);if (cmd->read_only) {
drivers/md/dm-clone-target.c +29 -14
95 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 175/254 dm verity fec: fix memory leak in verity_fec_dtr
In reply to Greg Kroah-HartmanFrom: Shetty, Harshini X (EXT-Sony Mobile) <[email protected]>
commit 75fa601934fda23d2f15bf44b09c2401942d8e15 upstream.
Fix below kmemleak detected in verity_fec_ctr. output_pool is allocated for each dm-verity-fec device. But it is not freed when dm-table for the verity target is removed. Hence free the output mempool in destructor function verity_fec_dtr.
unreferenced object 0xffffffffa574d000 (size 4096):
comm "init", pid 1667, jiffies 4294894890 (age 307.168s) hex dump (first 32 bytes):
8e 36 00 98 66 a8 0b 9b 00 00 00 00 00 00 00 00 .6..f...........
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<0000000060e82407>] __kmalloc+0x2b4/0x340
[<00000000dd99488f>] mempool_kmalloc+0x18/0x20
[<000000002560172b>] mempool_init_node+0x98/0x118
[<000000006c3574d2>] mempool_init+0x14/0x20
[<0000000008cb266e>] verity_fec_ctr+0x388/0x3b0
[<000000000887261b>] verity_ctr+0x87c/0x8d0
[<000000002b1e1c62>] dm_table_add_target+0x174/0x348
[<000000002ad89eda>] table_load+0xe4/0x328
[<000000001f06f5e9>] dm_ctl_ioctl+0x3b4/0x5a0
[<00000000bee5fbb7>] do_vfs_ioctl+0x5dc/0x928
[<00000000b475b8f5>] __arm64_sys_ioctl+0x70/0x98
[<000000005361e2e8>] el0_svc_common+0xa0/0x158
[<000000001374818f>] el0_svc_handler+0x6c/0x88
[<000000003364e9f4>] el0_svc+0x8/0xc
[<000000009d84cec9>] 0xffffffffffffffffDepends-on: 6f1c819c219f7 ("dm: convert to bioset_init()/mempool_init()")
--- drivers/md/dm-verity-fec.c | 1 + 1 file changed, 1 insertion(+)
drivers/md/dm-verity-fec.c +1 -0
@@ -551,6 +551,7 @@ void verity_fec_dtr(struct dm_verity *v)mempool_exit (&f->rs_pool);mempool_exit (&f->prealloc_pool);mempool_exit (&f->extra_pool); +mempool_exit (&f->output_pool);kmem_cache_destroy (f->cache);if (f->data_bufio)
Greg Kroah-Hartman
maintainerPATCH 176/254 dm zoned: remove duplicate nr_rnd_zones increase in dmz_init_zone()
In reply to Greg Kroah-HartmanFrom: Bob Liu <[email protected]>
commit b8fdd090376a7a46d17db316638fe54b965c2fb0 upstream.
zmd->nr_rnd_zones was increased twice by mistake. The other place it is increased in dmz_init_zone() is the only one needed:
1131 zmd->nr_useable_zones++;
1132 if (dmz_is_rnd(zone)) {
1133 zmd->nr_rnd_zones++; ^^^
--- drivers/md/dm-zoned-metadata.c | 1 - 1 file changed, 1 deletion(-)
drivers/md/dm-zoned-metadata.c +0 -1
@@ -1109,7 +1109,6 @@ static int dmz_init_zone(struct blk_zoneswitch (blkz->type) {case BLK_ZONE_TYPE_CONVENTIONAL :set_bit (DMZ_RND , &zone->flags); - zmd->nr_rnd_zones++;break ;case BLK_ZONE_TYPE_SEQWRITE_REQ :case BLK_ZONE_TYPE_SEQWRITE_PREF :
Greg Kroah-Hartman
maintainerPATCH 172/254 mm, memcg: do not high throttle allocators based on wraparound
In reply to Greg Kroah-HartmanFrom: Jakub Kicinski <[email protected]>
commit 9b8b17541f13809d06f6f873325305ddbb760e3e upstream.
If a cgroup violates its memory.high constraints, we may end up unduly penalising it. For example, for the following hierarchy:
A: max high, 20 usage
A/B: 9 high, 10 usage
A/C: max high, 10 usage
We would end up doing the following calculation below when calculating high delay for A/B:
A/B: 10 - 9 = 1...
A: 20 - PAGE_COUNTER_MAX = 21, so set max_overage to 21.
This gets worse with higher disparities in usage in the parent.
I have no idea how this disappeared from the final version of the patch, but it is certainly Not Good(tm). This wasn't obvious in testing because, for a simple cgroup hierarchy with only one child, the result is usually roughly the same. It's only in more complex hierarchies that things go really awry (although still, the effects are limited to a maximum of 2 seconds in schedule_timeout_killable at a maximum).
--- mm/memcontrol.c | 3 +++ 1 file changed, 3 insertions(+)
mm/memcontrol.c +3 -0
@@ -2324,6 +2324,9 @@ static unsigned long calculate_high_dela usage =page_counter_read (&memcg->memory); high =READ_ONCE (memcg->high); +if (usage <= high) +continue ; +/* * Prevent division by 0 in overage calculation by acting as if * it was a threshold of 1 page
Greg Kroah-Hartman
maintainerPATCH 141/254 CIFS: check new file size when extending file by fallocate
In reply to Greg Kroah-HartmanFrom: Murphy Zhou <[email protected]>
commit ef4a632ccc1c7d3fb71a5baae85b79af08b7f94b upstream.
xfstests generic/228 checks if fallocate respect RLIMIT_FSIZE. After fallocate mode 0 extending enabled, we can hit this failure. Fix this by check the new file size with vfs helper, return error if file size is larger then RLIMIT_FSIZE(ulimit -f).
This patch has been tested by LTP/xfstests aginst samba and Windows server.
--- fs/cifs/smb2ops.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/cifs/smb2ops.c +4 -0
@@ -3248,6 +3248,10 @@ static long smb3_simple_falloc(struct fi* Extending the file */ if ((keep_size == false) &&i_size_read (inode) < off + len) { + rc =inode_newsize_ok (inode, off + len); +if (rc) + goto out; +if ((cifsi->cifsAttrs &FILE_ATTRIBUTE_SPARSE_FILE ) ==0 )smb2_set_sparse (xid, tcon, cfile, inode, false);
Greg Kroah-Hartman
maintainerPATCH 166/254 scsi: mpt3sas: Fix kernel panic observed on soft HBA unplug
In reply to Greg Kroah-HartmanFrom: Sreekanth Reddy <[email protected]>
commit cc41f11a21a51d6869d71e525a7264c748d7c0d7 upstream.
Generic protection fault type kernel panic is observed when user performs soft (ordered) HBA unplug operation while IOs are running on drives connected to HBA.
When user performs ordered HBA removal operation, the kernel calls PCI device's .remove() call back function where driver is flushing out all the outstanding SCSI IO commands with DID_NO_CONNECT host byte and also unmaps sg buffers allocated for these IO commands.
However, in the ordered HBA removal case (unlike of real HBA hot removal), HBA device is still alive and hence HBA hardware is performing the DMA operations to those buffers on the system memory which are already unmapped while flushing out the outstanding SCSI IO commands and this leads to kernel panic.
Don't flush out the outstanding IOs from .remove() path in case of ordered removal since HBA will be still alive in this case and it can complete the outstanding IOs. Flush out the outstanding IOs only in case of 'physical HBA hot unplug' where there won't be any communication with the HBA.
During shutdown also it is possible that HBA hardware can perform DMA operations on those outstanding IO buffers which are completed with DID_NO_CONNECT by the driver from .shutdown(). So same above fix is applied in shutdown path as well.
It is safe to drop the outstanding commands when HBA is inaccessible such as when permanent PCI failure happens, when HBA is in non-operational state, or when someone does a real HBA hot unplug operation. Since driver knows that HBA is inaccessible during these cases, it is safe to drop the outstanding commands instead of waiting for SCSI error recovery to kick in and clear these outstanding commands.
--- drivers/scsi/mpt3sas/mpt3sas_scsih.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/scsi/mpt3sas/mpt3sas_scsih.c +4 -4
@@ -9908,8 +9908,8 @@ static void scsih_remove(struct pci_dev ioc->remove_host =1 ; -mpt3sas_wait_for_commands_to_complete (ioc); -_scsih_flush_running_cmds (ioc); +if (!pci_device_is_present (pdev)) +_scsih_flush_running_cmds (ioc);_scsih_fw_event_cleanup_queue (ioc);
@@ -9992,8 +9992,8 @@ scsih_shutdown(struct pci_dev *pdev) ioc->remove_host =1 ; -mpt3sas_wait_for_commands_to_complete (ioc); -_scsih_flush_running_cmds (ioc); +if (!pci_device_is_present (pdev)) +_scsih_flush_running_cmds (ioc);_scsih_fw_event_cleanup_queue (ioc);
Greg Kroah-Hartman
maintainerPATCH 169/254 arm64: dts: allwinner: h6: Fix PMU compatible
In reply to Greg Kroah-HartmanFrom: Maxime Ripard <[email protected]>
commit 4c7eeb9af3e41ae7d840977119c58f3bbb3f4f59 upstream.
The commit 7aa9b9eb7d6a ("arm64: dts: allwinner: H6: Add PMU mode") introduced support for the PMU found on the Allwinner H6. However, the binding only allows for a single compatible, while the patch was adding two.
Make sure we follow the binding.
--- arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi +1 -2
@@ -70,8 +70,7 @@ }; pmu { - compatible = "arm,cortex-a53-pmu", - "arm,armv8-pmuv3"; + compatible = "arm,cortex-a53-pmu"; interrupts = <GIC_SPI 140 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 141 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 142 IRQ_TYPE_LEVEL_HIGH>,
Greg Kroah-Hartman
maintainerPATCH 168/254 net: qualcomm: rmnet: Allow configuration updates to existing devices
In reply to Greg Kroah-HartmanFrom: Subash Abhinov Kasiviswanathan <[email protected]>
commit 2abb5792387eb188b12051337d5dcd2cba615cb0 upstream.
This allows the changelink operation to succeed if the mux_id was specified as an argument. Note that the mux_id must match the existing mux_id of the rmnet device or should be an unused mux_id.
--- drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c | 31 ++++++++++++--------- 1 file changed, 19 insertions(+), 12 deletions(-)
drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c +19 -12
@@ -279,7 +279,6 @@ static int rmnet_changelink(struct net_d {struct rmnet_priv *priv =netdev_priv (dev);struct net_device *real_dev; -struct rmnet_endpoint *ep;struct rmnet_port *port;u16 mux_id;
@@ -294,19 +293,27 @@ static int rmnet_changelink(struct net_dif (data[IFLA_RMNET_MUX_ID ]) { mux_id =nla_get_u16 (data[IFLA_RMNET_MUX_ID ]); -if (rmnet_get_endpoint (port, mux_id)) { -NL_SET_ERR_MSG_MOD (extack,"MUX ID already exists" ); -return -EINVAL ; - } - ep =rmnet_get_endpoint (port, priv->mux_id); -if (!ep) -return -ENODEV ; -hlist_del_init_rcu (&ep->hlnode); -hlist_add_head_rcu (&ep->hlnode, &port->muxed_ep[mux_id]); +if (mux_id != priv->mux_id) { +struct rmnet_endpoint *ep; + + ep =rmnet_get_endpoint (port, priv->mux_id); +if (!ep) +return -ENODEV ; + +if (rmnet_get_endpoint (port, mux_id)) { +NL_SET_ERR_MSG_MOD (extack, +"MUX ID already exists" ); +return -EINVAL ; + } + +hlist_del_init_rcu (&ep->hlnode); +hlist_add_head_rcu (&ep->hlnode, + &port->muxed_ep[mux_id]); - ep->mux_id = mux_id; - priv->mux_id = mux_id; + ep->mux_id = mux_id; + priv->mux_id = mux_id; + } }if (data[IFLA_RMNET_FLAGS ]) {
Greg Kroah-Hartman
maintainerPATCH 167/254 tools: gpio: Fix out-of-tree build regression
In reply to Greg Kroah-HartmanFrom: Anssi Hannula <[email protected]>
commit 82f04bfe2aff428b063eefd234679b2d693228ed upstream.
Commit 0161a94e2d1c7 ("tools: gpio: Correctly add make dependencies for gpio_utils") added a make rule for gpio-utils-in.o but used $(output) instead of the correct $(OUTPUT) for the output directory, breaking out-of-tree build (O=xx) with the following error:
No rule to make target 'out/tools/gpio/gpio-utils-in.o', needed by 'out/tools/gpio/lsgpio-in.o'. Stop.
Fix that.
--- tools/gpio/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/gpio/Makefile +1 -1
@@ -35,7 +35,7 @@ $(OUTPUT)include/linux/gpio.h: ../../inc prepare: $(OUTPUT)include/linux/gpio.h -GPIO_UTILS_IN := $(output)gpio-utils-in.o +GPIO_UTILS_IN := $(OUTPUT)gpio-utils-in.o $(GPIO_UTILS_IN): prepare FORCE $(Q)$(MAKE) $(build)=gpio-utils
Greg Kroah-Hartman
maintainerPATCH 163/254 crypto: rng - Fix a refcounting bug in crypto_rng_reset()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
commit eed74b3eba9eda36d155c11a12b2b4b50c67c1d8 upstream.
We need to decrement this refcounter on these error paths.
--- crypto/rng.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
crypto/rng.c +6 -2
@@ -37,12 +37,16 @@ int crypto_rng_reset(struct crypto_rng *crypto_stats_get (alg);if (!seed && slen) { buf =kmalloc (slen,GFP_KERNEL ); -if (!buf) +if (!buf) { +crypto_alg_put (alg);return -ENOMEM ; + } err =get_random_bytes_wait (buf, slen); -if (err) +if (err) { +crypto_alg_put (alg); goto out; + } seed = buf; }
Greg Kroah-Hartman
maintainerPATCH 162/254 time/namespace: Add max_time_namespaces ucount
In reply to Greg Kroah-HartmanFrom: Dmitry Safonov <[email protected]>
commit eeec26d5da8248ea4e240b8795bb4364213d3247 upstream.
Michael noticed that userns limit for number of time namespaces is missing.
Furthermore, time namespace introduced UCOUNT_TIME_NAMESPACES, but didn't introduce an array member in user_table[]. It would make array's initialisation OOB write, but by luck the user_table array has an excessive empty member (all accesses to the array are limited with UCOUNT_COUNTS - so it silently reuses the last free member.
Fixes user-visible regression: max_inotify_instances by reason of the missing UCOUNT_ENTRY() has limited max number of namespaces instead of the number of inotify instances.
--- Documentation/admin-guide/sysctl/user.rst | 6 ++++++ kernel/ucount.c | 1 + 2 files changed, 7 insertions(+)
Documentation/admin-guide/sysctl/user.rst +6 -0
@@ -65,6 +65,12 @@ max_pid_namespaces The maximum number of pid namespaces that any user in the current user namespace may create. +max_time_namespaces +=================== + + The maximum number of time namespaces that any user in the current + user namespace may create. + max_user_namespaces ===================
kernel/ucount.c +1 -0
@@ -69,6 +69,7 @@ static struct ctl_table user_table[] = {UCOUNT_ENTRY ("max_net_namespaces" ),UCOUNT_ENTRY ("max_mnt_namespaces" ),UCOUNT_ENTRY ("max_cgroup_namespaces" ), +UCOUNT_ENTRY ("max_time_namespaces" ), #ifdef CONFIG_INOTIFY_USERUCOUNT_ENTRY ("max_inotify_instances" ), UCOUNT_ENTRY("max_inotify_watches"),
Greg Kroah-Hartman
maintainerPATCH 160/254 remoteproc: Fix NULL pointer dereference in rproc_virtio_notify
In reply to Greg Kroah-HartmanFrom: Nikita Shubin <[email protected]>
commit 791c13b709dd51eb37330f2a5837434e90c87c27 upstream.
Undefined rproc_ops .kick method in remoteproc driver will result in "Unable to handle kernel NULL pointer dereference" in rproc_virtio_notify, after firmware loading if:
1) .kick method wasn't defined in driver
2) resource_table exists in firmware and has "Virtio device entry" defined
Let's refuse to register an rproc-induced virtio device if no kick method was defined for rproc.
[ 13.180049][ T415] 8<--- cut here --- [ 13.190558][ T415] Unable to handle kernel NULL pointer dereference at virtual address 00000000 [ 13.212544][ T415] pgd = (ptrval) [ 13.217052][ T415] [00000000] *pgd=00000000 [ 13.224692][ T415] Internal error: Oops: 80000005 [#1] PREEMPT SMP ARM [ 13.231318][ T415] Modules linked in: rpmsg_char imx_rproc virtio_rpmsg_bus rpmsg_core [last unloaded: imx_rproc] [ 13.241687][ T415] CPU: 0 PID: 415 Comm: unload-load.sh Not tainted 5.5.2-00002-g707df13bbbdd #6 [ 13.250561][ T415] Hardware name: Freescale i.MX7 Dual (Device Tree) [ 13.257009][ T415] PC is at 0x0 [ 13.260249][ T415] LR is at rproc_virtio_notify+0x2c/0x54 [ 13.265738][ T415] pc : [<00000000>] lr : [<8050f6b0>] psr: 60010113 [ 13.272702][ T415] sp : b8d47c48 ip : 00000001 fp : bc04de00 [ 13.278625][ T415] r10: bc04c000 r9 : 00000cc0 r8 : b8d46000 [ 13.284548][ T415] r7 : 00000000 r6 : b898f200 r5 : 00000000 r4 : b8a29800 [ 13.291773][ T415] r3 : 00000000 r2 : 990a3ad4 r1 : 00000000 r0 : b8a29800 [ 13.299000][ T415] Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment none [ 13.306833][ T415] Control: 10c5387d Table: b8b4806a DAC: 00000051 [ 13.313278][ T415] Process unload-load.sh (pid: 415, stack limit = 0x(ptrval)) [ 13.320591][ T415] Stack: (0xb8d47c48 to 0xb8d48000) [ 13.325651][ T415] 7c40: b895b680 00000001 b898f200 803c6430 b895bc80 7f00ae18 [ 13.334531][ T415] 7c60: 00000035 00000000 00000000 b9393200 80b3ed80 00004000 b9393268 bbf5a9a2 [ 13.343410][ T415] 7c80: 00000e00 00000200 00000000 7f00aff0 7f00a014 b895b680 b895b800 990a3ad4 [ 13.352290][ T415] 7ca0: 00000001 b898f210 b898f200 00000000 00000000 7f00e000 00000001 00000000 [ 13.361170][ T415] 7cc0: 00000000 803c62e0 80b2169c 802a0924 b898f210 00000000 00000000 b898f210 [ 13.370049][ T415] 7ce0: 80b9ba44 00000000 80b9ba48 00000000 7f00e000 00000008 80b2169c 80400114 [ 13.378929][ T415] 7d00: 80b2169c 8061fd64 b898f210 7f00e000 80400744 b8d46000 80b21634 80b21634 [ 13.387809][ T415] 7d20: 80b2169c 80400614 80b21634 80400718 7f00e000 00000000 b8d47d7c 80400744 [ 13.396689][ T415] 7d40: b8d46000 80b21634 80b21634 803fe338 b898f254 b80fe76c b8d32e38 990a3ad4 [ 13.405569][ T415] 7d60: fffffff3 b898f210 b8d46000 00000001 b898f254 803ffe7c 80857a90 b898f210 [ 13.414449][ T415] 7d80: 00000001 990a3ad4 b8d46000 b898f210 b898f210 80b17aec b8a29c20 803ff0a4 [ 13.423328][ T415] 7da0: b898f210 00000000 b8d46000 803fb8e0 b898f200 00000000 80b17aec b898f210 [ 13.432209][ T415] 7dc0: b8a29c20 990a3ad4 b895b900 b898f200 8050fb7c 80b17aec b898f210 b8a29c20 [ 13.441088][ T415] 7de0: b8a29800 b895b900 b8a29a04 803c5ec0 b8a29c00 b898f200 b8a29a20 00000007 [ 13.449968][ T415] 7e00: b8a29c20 8050fd78 b8a29800 00000000 b8a29a20 b8a29c04 b8a29820 b8a299d0 [ 13.458848][ T415] 7e20: b895b900 8050e5a4 b8a29800 b8a299d8 b8d46000 b8a299e0 b8a29820 b8a299d0 [ 13.467728][ T415] 7e40: b895b900 8050e008 000041ed 00000000 b8b8c440 b8a299d8 b8a299e0 b8a299d8 [ 13.476608][ T415] 7e60: b8b8c440 990a3ad4 00000000 b8a29820 b8b8c400 00000006 b8a29800 b895b880 [ 13.485487][ T415] 7e80: b8d47f78 00000000 00000000 8050f4b4 00000006 b895b890 b8b8c400 008fbea0 [ 13.494367][ T415] 7ea0: b895b880 8029f530 00000000 00000000 b8d46000 00000006 b8d46000 008fbea0 [ 13.503246][ T415] 7ec0: 8029f434 00000000 b8d46000 00000000 00000000 8021e2e4 0000000a 8061fd0c [ 13.512125][ T415] 7ee0: 0000000a b8af0c00 0000000a b8af0c40 00000001 b8af0c40 00000000 8061f910 [ 13.521005][ T415] 7f00: 0000000a 80240af4 00000002 b8d46000 00000000 8061fd0c 00000002 80232d7c [ 13.529884][ T415] 7f20: 00000000 b8d46000 00000000 990a3ad4 00000000 00000006 b8a62d80 008fbea0 [ 13.538764][ T415] 7f40: b8d47f78 00000000 b8d46000 00000000 00000000 802210c0 b88f2900 00000000 [ 13.547644][ T415] 7f60: b8a62d80 b8a62d80 b8d46000 00000006 008fbea0 80221320 00000000 00000000 [ 13.556524][ T415] 7f80: b8af0c00 990a3ad4 0000006c 008fbea0 76f1cda0 00000004 80101204 00000004 [ 13.565403][ T415] 7fa0: 00000000 80101000 0000006c 008fbea0 00000001 008fbea0 00000006 00000000 [ 13.574283][ T415] 7fc0: 0000006c 008fbea0 76f1cda0 00000004 00000006 00000006 00000000 00000000 [ 13.583162][ T415] 7fe0: 00000004 7ebaf7d0 76eb4c0b 76e3f206 600d0030 00000001 00000000 00000000 [ 13.592056][ T415] [<8050f6b0>] (rproc_virtio_notify) from [<803c6430>] (virtqueue_notify+0x1c/0x34) [ 13.601298][ T415] [<803c6430>] (virtqueue_notify) from [<7f00ae18>] (rpmsg_probe+0x280/0x380 [virtio_rpmsg_bus]) [ 13.611663][ T415] [<7f00ae18>] (rpmsg_probe [virtio_rpmsg_bus]) from [<803c62e0>] (virtio_dev_probe+0x1f8/0x2c4) [ 13.622022][ T415] [<803c62e0>] (virtio_dev_probe) from [<80400114>] (really_probe+0x200/0x450) [ 13.630817][ T415] [<80400114>] (really_probe) from [<80400614>] (driver_probe_device+0x16c/0x1ac) [ 13.639873][ T415] [<80400614>] (driver_probe_device) from [<803fe338>] (bus_for_each_drv+0x84/0xc8) [ 13.649102][ T415] [<803fe338>] (bus_for_each_drv) from [<803ffe7c>] (__device_attach+0xd4/0x164) [ 13.658069][ T415] [<803ffe7c>] (__device_attach) from [<803ff0a4>] (bus_probe_device+0x84/0x8c) [ 13.666950][ T415] [<803ff0a4>] (bus_probe_device) from [<803fb8e0>] (device_add+0x444/0x768) [ 13.675572][ T415] [<803fb8e0>] (device_add) from [<803c5ec0>] (register_virtio_device+0xa4/0xfc) [ 13.684541][ T415] [<803c5ec0>] (register_virtio_device) from [<8050fd78>] (rproc_add_virtio_dev+0xcc/0x1b8) [ 13.694466][ T415] [<8050fd78>] (rproc_add_virtio_dev) from [<8050e5a4>] (rproc_start+0x148/0x200) [ 13.703521][ T415] [<8050e5a4>] (rproc_start) from [<8050e008>] (rproc_boot+0x384/0x5c0) [ 13.711708][ T415] [<8050e008>] (rproc_boot) from [<8050f4b4>] (state_store+0x3c/0xc8) [ 13.719723][ T415] [<8050f4b4>] (state_store) from [<8029f530>] (kernfs_fop_write+0xfc/0x214) [ 13.728348][ T415] [<8029f530>] (kernfs_fop_write) from [<8021e2e4>] (__vfs_write+0x30/0x1cc) [ 13.736971][ T415] [<8021e2e4>] (__vfs_write) from [<802210c0>] (vfs_write+0xac/0x17c) [ 13.744985][ T415] [<802210c0>] (vfs_write) from [<80221320>] (ksys_write+0x64/0xe4) [ 13.752825][ T415] [<80221320>] (ksys_write) from [<80101000>] (ret_fast_syscall+0x0/0x54) [ 13.761178][ T415] Exception stack(0xb8d47fa8 to 0xb8d47ff0) [ 13.766932][ T415] 7fa0: 0000006c 008fbea0 00000001 008fbea0 00000006 00000000 [ 13.775811][ T415] 7fc0: 0000006c 008fbea0 76f1cda0 00000004 00000006 00000006 00000000 00000000 [ 13.784687][ T415] 7fe0: 00000004 7ebaf7d0 76eb4c0b 76e3f206 [ 13.790442][ T415] Code: bad PC value [ 13.839214][ T415] ---[ end trace 1fe21ecfc9f28852 ]---
--- drivers/remoteproc/remoteproc_virtio.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/remoteproc/remoteproc_virtio.c +7 -0
@@ -334,6 +334,13 @@ int rproc_add_virtio_dev(struct rproc_vdstruct rproc_mem_entry *mem;int ret; +if (rproc->ops->kick ==NULL ) { + ret = -EINVAL ; +dev_err (dev,".kick method not defined for %s" , + rproc->name); + goto out; + } +/* Try to find dedicated vdev buffer carveout */ mem =rproc_find_carveout_by_name (rproc,"vdev%dbuffer" , rvdev->index);if (mem) {
Greg Kroah-Hartman
maintainerPATCH 157/254 btrfs: use nofs allocations for running delayed items
In reply to Greg Kroah-HartmanFrom: Josef Bacik <[email protected]>
commit 351cbf6e4410e7ece05e35d0a07320538f2418b4 upstream.
Zygo reported the following lockdep splat while testing the balance patches
======================================================
WARNING: possible circular locking dependency detected
5.6.0-c6f0579d496a+ #53 Not tainted
------------------------------------------------------
kswapd0/1133 is trying to acquire lock:ffff888092f622c0 (&delayed_node->mutex){+.+.}, at: __btrfs_release_delayed_node+0x7c/0x5b0
but task is already holding lock:ffffffff8fc5f860 (fs_reclaim){+.+.}, at: __fs_reclaim_acquire+0x5/0x30
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #1 (fs_reclaim){+.+.}:
fs_reclaim_acquire.part.91+0x29/0x30
fs_reclaim_acquire+0x19/0x20
kmem_cache_alloc_trace+0x32/0x740
add_block_entry+0x45/0x260
btrfs_ref_tree_mod+0x6e2/0x8b0
btrfs_alloc_tree_block+0x789/0x880
alloc_tree_block_no_bg_flush+0xc6/0xf0
__btrfs_cow_block+0x270/0x940
btrfs_cow_block+0x1ba/0x3a0
btrfs_search_slot+0x999/0x1030
btrfs_insert_empty_items+0x81/0xe0
btrfs_insert_delayed_items+0x128/0x7d0
__btrfs_run_delayed_items+0xf4/0x2a0
btrfs_run_delayed_items+0x13/0x20
btrfs_commit_transaction+0x5cc/0x1390
insert_balance_item.isra.39+0x6b2/0x6e0
btrfs_balance+0x72d/0x18d0
btrfs_ioctl_balance+0x3de/0x4c0
btrfs_ioctl+0x30ab/0x44a0
ksys_ioctl+0xa1/0xe0
__x64_sys_ioctl+0x43/0x50
do_syscall_64+0x77/0x2c0
entry_SYSCALL_64_after_hwframe+0x49/0xbe-> #0 (&delayed_node->mutex){+.+.}:
__lock_acquire+0x197e/0x2550
lock_acquire+0x103/0x220
__mutex_lock+0x13d/0xce0
mutex_lock_nested+0x1b/0x20
__btrfs_release_delayed_node+0x7c/0x5b0
btrfs_remove_delayed_node+0x49/0x50
btrfs_evict_inode+0x6fc/0x900
evict+0x19a/0x2c0
dispose_list+0xa0/0xe0
prune_icache_sb+0xbd/0xf0
super_cache_scan+0x1b5/0x250
do_shrink_slab+0x1f6/0x530
shrink_slab+0x32e/0x410
shrink_node+0x2a5/0xba0
balance_pgdat+0x4bd/0x8a0
kswapd+0x35a/0x800
kthread+0x1e9/0x210
ret_from_fork+0x3a/0x50other info that might help us debug this:
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(fs_reclaim);
lock(&delayed_node->mutex);
lock(fs_reclaim); lock(&delayed_node->mutex);
*** DEADLOCK ***
3 locks held by kswapd0/1133:
#0: ffffffff8fc5f860 (fs_reclaim){+.+.}, at: __fs_reclaim_acquire+0x5/0x30 #1: ffffffff8fc380d8 (shrinker_rwsem){++++}, at: shrink_slab+0x1e8/0x410 #2: ffff8881e0e6c0e8 (&type->s_umount_key#42){++++}, at: trylock_super+0x1b/0x70
stack backtrace: CPU: 2 PID: 1133 Comm: kswapd0 Not tainted 5.6.0-c6f0579d496a+ #53 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-1 04/01/2014 Call Trace: dump_stack+0xc1/0x11a print_circular_bug.isra.38.cold.57+0x145/0x14a check_noncircular+0x2a9/0x2f0 ? print_circular_bug.isra.38+0x130/0x130 ? stack_trace_consume_entry+0x90/0x90 ? save_trace+0x3cc/0x420 __lock_acquire+0x197e/0x2550 ? btrfs_inode_clear_file_extent_range+0x9b/0xb0 ? register_lock_class+0x960/0x960 lock_acquire+0x103/0x220 ? __btrfs_release_delayed_node+0x7c/0x5b0 __mutex_lock+0x13d/0xce0 ? __btrfs_release_delayed_node+0x7c/0x5b0 ? __asan_loadN+0xf/0x20 ? pvclock_clocksource_read+0xeb/0x190 ? __btrfs_release_delayed_node+0x7c/0x5b0 ? mutex_lock_io_nested+0xc20/0xc20 ? __kasan_check_read+0x11/0x20 ? check_chain_key+0x1e6/0x2e0 mutex_lock_nested+0x1b/0x20 ? mutex_lock_nested+0x1b/0x20 __btrfs_release_delayed_node+0x7c/0x5b0 btrfs_remove_delayed_node+0x49/0x50 btrfs_evict_inode+0x6fc/0x900 ? btrfs_setattr+0x840/0x840 ? do_raw_spin_unlock+0xa8/0x140 evict+0x19a/0x2c0 dispose_list+0xa0/0xe0 prune_icache_sb+0xbd/0xf0 ? invalidate_inodes+0x310/0x310 super_cache_scan+0x1b5/0x250 do_shrink_slab+0x1f6/0x530 shrink_slab+0x32e/0x410 ? do_shrink_slab+0x530/0x530 ? do_shrink_slab+0x530/0x530 ? __kasan_check_read+0x11/0x20 ? mem_cgroup_protected+0x13d/0x260 shrink_node+0x2a5/0xba0 balance_pgdat+0x4bd/0x8a0 ? mem_cgroup_shrink_node+0x490/0x490 ? _raw_spin_unlock_irq+0x27/0x40 ? finish_task_switch+0xce/0x390 ? rcu_read_lock_bh_held+0xb0/0xb0 kswapd+0x35a/0x800 ? _raw_spin_unlock_irqrestore+0x4c/0x60 ? balance_pgdat+0x8a0/0x8a0 ? finish_wait+0x110/0x110 ? __kasan_check_read+0x11/0x20 ? __kthread_parkme+0xc6/0xe0 ? balance_pgdat+0x8a0/0x8a0 kthread+0x1e9/0x210 ? kthread_create_worker_on_cpu+0xc0/0xc0 ret_from_fork+0x3a/0x50
This is because we hold that delayed node's mutex while doing tree operations. Fix this by just wrapping the searches in nofs.
--- fs/btrfs/delayed-inode.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
fs/btrfs/delayed-inode.c +13 -0
@@ -6,6 +6,7 @@#include <linux/slab.h> #include <linux/iversion.h> +#include <linux/sched/mm.h> #include "misc.h" #include "delayed-inode.h" #include "disk-io.h"
@@ -805,11 +806,14 @@ static int btrfs_insert_delayed_item(str struct btrfs_delayed_item *delayed_item) {struct extent_buffer *leaf; +unsigned int nofs_flag;char *ptr;int ret; + nofs_flag =memalloc_nofs_save (); ret =btrfs_insert_empty_item (trans, root, path, &delayed_item->key, delayed_item->data_len); +memalloc_nofs_restore (nofs_flag);if (ret <0 && ret != -EEXIST )return ret;
@@ -937,6 +941,7 @@ static int btrfs_delete_delayed_items(st struct btrfs_delayed_node *node) {struct btrfs_delayed_item *curr, *prev; +unsigned int nofs_flag;int ret =0 ; do_again:
@@ -945,7 +950,9 @@ do_again:if (!curr) goto delete_fail; + nofs_flag =memalloc_nofs_save (); ret =btrfs_search_slot (trans, root, &curr->key, path,-1 ,1 ); +memalloc_nofs_restore (nofs_flag);if (ret <0 ) goto delete_fail;else if (ret >0 ) {
@@ -1012,6 +1019,7 @@ static int __btrfs_update_delayed_inode(struct btrfs_key key;struct btrfs_inode_item *inode_item;struct extent_buffer *leaf; +unsigned int nofs_flag;int mod;int ret;
@@ -1024,7 +1032,9 @@ static int __btrfs_update_delayed_inode(else mod =1 ; + nofs_flag =memalloc_nofs_save (); ret =btrfs_lookup_inode (trans, root, path, &key, mod); +memalloc_nofs_restore (nofs_flag);if (ret >0 ) {btrfs_release_path (path);return -ENOENT ;
@@ -1075,7 +1085,10 @@ search: key.type =BTRFS_INODE_EXTREF_KEY ; key.offset =-1 ; + + nofs_flag =memalloc_nofs_save (); ret =btrfs_search_slot (trans, root, &key, path,-1 ,1 ); +memalloc_nofs_restore (nofs_flag);if (ret <0 ) goto err_out;ASSERT (ret);
Greg Kroah-Hartman
maintainerPATCH 140/254 CIFS: Fix bug which the return value by asynchronous read is error
In reply to Greg Kroah-HartmanFrom: Yilu Lin <[email protected]>
commit 97adda8b3ab703de8e4c8d27646ddd54fe22879c upstream.
This patch is used to fix the bug in collect_uncached_read_data() that rc is automatically converted from a signed number to an unsigned number when the CIFS asynchronous read fails. It will cause ctx->rc is error.
Example:
Share a directory and create a file on the Windows OS. Mount the directory to the Linux OS using CIFS.
On the CIFS client of the Linux OS, invoke the pread interface to deliver the read request.
The size of the read length plus offset of the read request is greater than the maximum file size.
In this case, the CIFS server on the Windows OS returns a failure message (for example, the return value of smb2.nt_status is STATUS_INVALID_PARAMETER).
After receiving the response message, the CIFS client parses smb2.nt_status to STATUS_INVALID_PARAMETER
and converts it to the Linux error code (rdata->result=-22).
Then the CIFS client invokes the collect_uncached_read_data function to assign the value of rdata->result to rc, that is, rc=rdata->result=-22.
The type of the ctx->total_len variable is unsigned integer, the type of the rc variable is integer, and the type of the ctx->rc variable is ssize_t.
Therefore, during the ternary operation, the value of rc is automatically converted to an unsigned number. The final result is ctx->rc=4294967274. However, the expected result is ctx->rc=-22.
--- fs/cifs/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/cifs/file.c +1 -1
@@ -3841,7 +3841,7 @@ again:if (rc == -ENODATA ) rc =0 ; - ctx->rc = (rc ==0 ) ? ctx->total_len : rc; + ctx->rc = (rc ==0 ) ? (ssize_t )ctx->total_len : rc;mutex_unlock (&ctx->aio_mutex);
Greg Kroah-Hartman
maintainerPATCH 159/254 remoteproc: qcom_q6v5_mss: Reload the mba region on coredump
In reply to Greg Kroah-HartmanFrom: Sibi Sankar <[email protected]>
commit d96f2571dc84d128cacf1944f4ecc87834c779a6 upstream.
On secure devices after a wdog/fatal interrupt, the mba region has to be refreshed in order to prevent the following errors during mba load.
Err Logs:
remoteproc remoteproc2: stopped remote processor 4080000.remoteproc qcom-q6v5-mss 4080000.remoteproc: PBL returned unexpected status -284031232 qcom-q6v5-mss 4080000.remoteproc: PBL returned unexpected status -284031232
....
qcom-q6v5-mss 4080000.remoteproc: PBL returned unexpected status -284031232 qcom-q6v5-mss 4080000.remoteproc: MBA booted, loading mpss
--- drivers/remoteproc/qcom_q6v5_mss.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-)
drivers/remoteproc/qcom_q6v5_mss.c +18 -1
@@ -1030,6 +1030,23 @@ static void q6v5_mba_reclaim(struct q6v5 } } +static int q6v5_reload_mba (struct rproc *rproc) +{ +struct q6v5 *qproc = rproc->priv; +const struct firmware *fw; +int ret; + + ret =request_firmware (&fw, rproc->firmware, qproc->dev); +if (ret <0 ) +return ret; + +q6v5_load (rproc, fw); + ret =q6v5_mba_load (qproc); +release_firmware (fw); + +return ret; +} +static int q6v5_mpss_load (struct q6v5 *qproc) {const struct elf32_phdr *phdrs;
@@ -1188,7 +1205,7 @@ static void qcom_q6v5_dump_segment(struc/* Unlock mba before copying segments */ if (!qproc->dump_mba_loaded) { - ret =q6v5_mba_load (qproc); + ret =q6v5_reload_mba (rproc);if (!ret) {/* Reset ownership back to Linux to copy segments */ ret = q6v5_xfer_mem_ownership(qproc, &qproc->mpss_perm,
Greg Kroah-Hartman
maintainerPATCH 156/254 btrfs: fix missing semaphore unlock in btrfs_sync_file
In reply to Greg Kroah-HartmanFrom: Robbie Ko <[email protected]>
commit 6ff06729c22ec0b7498d900d79cc88cfb8aceaeb upstream.
Ordered ops are started twice in sync file, once outside of inode mutex and once inside, taking the dio semaphore. There was one error path missing the semaphore unlock.
--- fs/btrfs/file.c | 1 + 1 file changed, 1 insertion(+)
fs/btrfs/file.c +1 -0
@@ -2134,6 +2134,7 @@ int btrfs_sync_file(struct file *file, l*/ ret =start_ordered_ops (inode, start, end);if (ret) { +up_write (&BTRFS_I (inode)->dio_sem);inode_unlock (inode); goto out; }
Greg Kroah-Hartman
maintainerPATCH 154/254 btrfs: fix missing file extent item for hole after ranged fsync
In reply to Greg Kroah-HartmanFrom: Filipe Manana <[email protected]>
commit 95418ed1d10774cd9a49af6f39e216c1256f1eeb upstream.
When doing a fast fsync for a range that starts at an offset greater than zero, we can end up with a log that when replayed causes the respective inode miss a file extent item representing a hole if we are not using the NO_HOLES feature. This is because for fast fsyncs we don't log any extents that cover a range different from the one requested in the fsync.
Example scenario to trigger it:
$ mkfs.btrfs -O ^no-holes -f /dev/sdd $ mount /dev/sdd /mnt
# Create a file with a single 256K and fsync it to clear to full sync
# bit in the inode - we want the msync below to trigger a fast fsync. $ xfs_io -f -c "pwrite -S 0xab 0 256K" -c "fsync" /mnt/foo
# Force a transaction commit and wipe out the log tree.
$ sync
# Dirty 768K of data, increasing the file size to 1Mb, and flush only
# the range from 256K to 512K without updating the log tree # (sync_file_range() does not trigger fsync, it only starts writeback # and waits for it to finish).
$ xfs_io -c "pwrite -S 0xcd 256K 768K" /mnt/foo $ xfs_io -c "sync_range -abw 256K 256K" /mnt/foo
# Now dirty the range from 768K to 1M again and sync that range.
$ xfs_io -c "mmap -w 768K 256K" \
-c "mwrite -S 0xef 768K 256K" \
-c "msync -s 768K 256K" \
-c "munmap" \
/mnt/foo<power fail>
# Mount to replay the log.
$ mount /dev/sdd /mnt $ umount /mnt
$ btrfs check /dev/sdd
Opening filesystem to check...
Checking filesystem on /dev/sdd
UUID: 482fb574-b288-478e-a190-a9c44a78fca6
[1/7] checking root items
[2/7] checking extents
[3/7] checking free space cache
[4/7] checking fs roots
root 5 inode 257 errors 100, file extent discount
Found file extent holes:
start: 262144, len: 524288
ERROR: errors found in fs roots
found 720896 bytes used, error(s) found
total csum bytes: 512
total tree bytes: 131072
total fs tree bytes: 32768
total extent tree bytes: 16384
btree space waste bytes: 123514
file data blocks allocated: 589824
referenced 589824Fix this issue by setting the range to full (0 to LLONG_MAX) when the NO_HOLES feature is not enabled. This results in extra work being done but it gives the guarantee we don't end up with missing holes after replaying the log.
--- fs/btrfs/file.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
fs/btrfs/file.c +10 -0
@@ -2071,6 +2071,16 @@ int btrfs_sync_file(struct file *file, lbtrfs_init_log_ctx (&ctx, inode);/* +* Set the range to full if the NO_HOLES feature is not enabled. +* This is to avoid missing file extent items representing holes after +* replaying the log. +*/ +if (!btrfs_fs_incompat (fs_info,NO_HOLES )) { + start =0 ; + end =LLONG_MAX ; + } + +/* * We write the dirty pages in the range and wait until they complete * out of the ->i_mutex. If so, we can flush the dirty pages by * multi-task, and make the performance up. See
Greg Kroah-Hartman
maintainerPATCH 153/254 btrfs: drop block from cache on error in relocation
In reply to Greg Kroah-HartmanFrom: Josef Bacik <[email protected]>
commit 8e19c9732ad1d127b5575a10f4fbcacf740500ff upstream.
If we have an error while building the backref tree in relocation we'll process all the pending edges and then free the node. However if we integrated some edges into the cache we'll lose our link to those edges by simply freeing this node, which means we'll leak memory and references to any roots that we've found.
Instead we need to use remove_backref_node(), which walks through all of the edges that are still linked to this node and free's them up and drops any root references we may be holding.
--- fs/btrfs/relocation.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/relocation.c +1 -1
@@ -1186,7 +1186,7 @@ out:free_backref_node (cache, lower); } -free_backref_node (cache, node); +remove_backref_node (cache, node);return ERR_PTR (err); }ASSERT (!node || !node->detached);
Greg Kroah-Hartman
maintainerPATCH 150/254 Btrfs: fix crash during unmount due to race with delayed inode workers
In reply to Greg Kroah-HartmanFrom: Filipe Manana <[email protected]>
commit f0cc2cd70164efe8f75c5d99560f0f69969c72e4 upstream.
During unmount we can have a job from the delayed inode items work queue still running, that can lead to at least two bad things:
1) A crash, because the worker can try to create a transaction just after the fs roots were freed;
2) A transaction leak, because the worker can create a transaction before the fs roots are freed and just after we committed the last transaction and after we stopped the transaction kthread.
A stack trace example of the crash:
[79011.691214] kernel BUG at lib/radix-tree.c:982! [79011.692056] invalid opcode: 0000 [#1] PREEMPT SMP DEBUG_PAGEALLOC PTI [79011.693180] CPU: 3 PID: 1394 Comm: kworker/u8:2 Tainted: G W 5.6.0-rc2-btrfs-next-54 #2 (...) [79011.696789] Workqueue: btrfs-delayed-meta btrfs_work_helper [btrfs] [79011.697904] RIP: 0010:radix_tree_tag_set+0xe7/0x170 (...) [79011.702014] RSP: 0018:ffffb3c84a317ca0 EFLAGS: 00010293 [79011.702949] RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000 [79011.704202] RDX: ffffb3c84a317cb0 RSI: ffffb3c84a317ca8 RDI: ffff8db3931340a0 [79011.705463] RBP: 0000000000000005 R08: 0000000000000005 R09: ffffffff974629d0 [79011.706756] R10: ffffb3c84a317bc0 R11: 0000000000000001 R12: ffff8db393134000 [79011.708010] R13: ffff8db3931340a0 R14: ffff8db393134068 R15: 0000000000000001 [79011.709270] FS: 0000000000000000(0000) GS:ffff8db3b6a00000(0000) knlGS:0000000000000000 [79011.710699] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [79011.711710] CR2: 00007f22c2a0a000 CR3: 0000000232ad4005 CR4: 00000000003606e0 [79011.712958] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [79011.714205] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [79011.715448] Call Trace: [79011.715925] record_root_in_trans+0x72/0xf0 [btrfs] [79011.716819] btrfs_record_root_in_trans+0x4b/0x70 [btrfs] [79011.717925] start_transaction+0xdd/0x5c0 [btrfs] [79011.718829] btrfs_async_run_delayed_root+0x17e/0x2b0 [btrfs] [79011.719915] btrfs_work_helper+0xaa/0x720 [btrfs] [79011.720773] process_one_work+0x26d/0x6a0 [79011.721497] worker_thread+0x4f/0x3e0 [79011.722153] ? process_one_work+0x6a0/0x6a0 [79011.722901] kthread+0x103/0x140 [79011.723481] ? kthread_create_worker_on_cpu+0x70/0x70 [79011.724379] ret_from_fork+0x3a/0x50 (...)
The following diagram shows a sequence of steps that lead to the crash during ummount of the filesystem:
CPU 1 CPU 2 CPU 3
btrfs_punch_hole()
btrfs_btree_balance_dirty()
btrfs_balance_delayed_items()
--> sees
fs_info->delayed_root->items
with value 200, which is greater
than
BTRFS_DELAYED_BACKGROUND (128)
and smaller than
BTRFS_DELAYED_WRITEBACK (512)
btrfs_wq_run_delayed_node()
--> queues a job for
fs_info->delayed_workers to run
btrfs_async_run_delayed_root()
btrfs_async_run_delayed_root()
--> job queued by CPU 1
--> starts picking and running
delayed nodes from the
prepare_list list
close_ctree()
btrfs_delete_unused_bgs()
btrfs_commit_super()
btrfs_join_transaction()
--> gets transaction N
btrfs_commit_transaction(N)
--> set transaction state
to TRANTS_STATE_COMMIT_START
btrfs_first_prepared_delayed_node()
--> picks delayed node X through
the prepared_list list
btrfs_run_delayed_items()
btrfs_first_delayed_node()
--> also picks delayed node X
but through the node_list
list
__btrfs_commit_inode_delayed_items()
--> runs all delayed items from
this node and drops the
node's item count to 0
through call to
btrfs_release_delayed_inode()
--> finishes running any remaining
delayed nodes
--> finishes transaction commit
--> stops cleaner and transaction threads
btrfs_free_fs_roots()
--> frees all roots and removes them
from the radix tree
fs_info->fs_roots_radix
btrfs_join_transaction()
start_transaction()
btrfs_record_root_in_trans()
record_root_in_trans()
radix_tree_tag_set()
--> crashes because
the root is not in
the radix tree
anymoreIf the worker is able to call btrfs_join_transaction() before the unmount task frees the fs roots, we end up leaking a transaction and all its resources, since after the call to btrfs_commit_super() and stopping the transaction kthread, we don't expect to have any transaction open anymore.
When this situation happens the worker has a delayed node that has no more items to run, since the task calling btrfs_run_delayed_items(), which is doing a transaction commit, picks the same node and runs all its items first.
We can not wait for the worker to complete when running delayed items through btrfs_run_delayed_items(), because we call that function in several phases of a transaction commit, and that could cause a deadlock because the worker calls btrfs_join_transaction() and the task doing the transaction commit may have already set the transaction state to TRANS_STATE_COMMIT_DOING.
Also it's not possible to get into a situation where only some of the items of a delayed node are added to the fs/subvolume tree in the current transaction and the remaining ones in the next transaction, because when running the items of a delayed inode we lock its mutex, effectively waiting for the worker if the worker is running the items of the delayed node already.
Since this can only cause issues when unmounting a filesystem, fix it in a simple way by waiting for any jobs on the delayed workers queue before calling btrfs_commit_supper() at close_ctree(). This works because at this point no one can call btrfs_btree_balance_dirty() or btrfs_balance_delayed_items(), and if we end up waiting for any worker to complete, btrfs_commit_super() will commit the transaction created by the worker.
--- fs/btrfs/async-thread.c | 8 ++++++++ fs/btrfs/async-thread.h | 1 + fs/btrfs/disk-io.c | 13 +++++++++++++ 3 files changed, 22 insertions(+)
fs/btrfs/async-thread.c +8 -0
@@ -395,3 +395,11 @@ void btrfs_set_work_high_priority(struct {set_bit (WORK_HIGH_PRIO_BIT , &work->flags); } + +void btrfs_flush_workqueue (struct btrfs_workqueue *wq) +{ +if (wq->high) +flush_workqueue (wq->high->normal_wq); + +flush_workqueue (wq->normal->normal_wq); +}
fs/btrfs/async-thread.h +1 -0
@@ -44,5 +44,6 @@ void btrfs_set_work_high_priority(structstruct btrfs_fs_info *__pure btrfs_work_owner (const struct btrfs_work *work);struct btrfs_fs_info *__pure btrfs_workqueue_owner (const struct __btrfs_workqueue *wq);bool btrfs_workqueue_normal_congested (const struct btrfs_workqueue *wq); +void btrfs_flush_workqueue (struct btrfs_workqueue *wq);#endif
fs/btrfs/disk-io.c +13 -0
@@ -3990,6 +3990,19 @@ void __cold close_ctree(struct btrfs_fs_*/ btrfs_delete_unused_bgs (fs_info); +/* +* There might be existing delayed inode workers still running +* and holding an empty delayed inode item. We must wait for +* them to complete first because they can create a transaction. +* This happens when someone calls btrfs_balance_delayed_items() +* and then a transaction commit runs the same delayed nodes +* before any delayed worker has done something with the nodes. +* We must wait for any worker here and not at transaction +* commit time since that could cause a deadlock. +* This is a very rare case. +*/ +btrfs_flush_workqueue (fs_info->delayed_workers); + ret =btrfs_commit_super (fs_info);if (ret)btrfs_err (fs_info,"commit super ret %d" , ret);
Greg Kroah-Hartman
maintainerPATCH 152/254 btrfs: set update the uuid generation as soon as possible
In reply to Greg Kroah-HartmanFrom: Josef Bacik <[email protected]>
commit 75ec1db8717a8f0a9d9c8d033e542fdaa7b73898 upstream.
In my EIO stress testing I noticed I was getting forced to rescan the uuid tree pretty often, which was weird. This is because my error injection stuff would sometimes inject an error after log replay but before we loaded the UUID tree. If log replay committed the transaction it wouldn't have updated the uuid tree generation, but the tree was valid and didn't change, so there's no reason to not update the generation here.
Fix this by setting the BTRFS_FS_UPDATE_UUID_TREE_GEN bit immediately after reading all the fs roots if the uuid tree generation matches the fs generation. Then any transaction commits that happen during mount won't screw up our uuid tree state, forcing us to do needless uuid rescans.
--- fs/btrfs/disk-io.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
fs/btrfs/disk-io.c +12 -2
@@ -3061,6 +3061,18 @@ int __cold open_ctree(struct super_blockif (ret) goto fail_tree_roots; +/* +* If we have a uuid root and we're not being told to rescan we need to +* check the generation here so we can set the +* BTRFS_FS_UPDATE_UUID_TREE_GEN bit. Otherwise we could commit the +* transaction during a balance or the log replay without updating the +* uuid generation, and then if we crash we would rescan the uuid tree, +* even though it was perfectly fine. +*/ +if (fs_info->uuid_root && !btrfs_test_opt (fs_info,RESCAN_UUID_TREE ) && + fs_info->generation ==btrfs_super_uuid_tree_generation (disk_super)) +set_bit (BTRFS_FS_UPDATE_UUID_TREE_GEN , &fs_info->flags); + ret =btrfs_verify_dev_extents (fs_info);if (ret) { btrfs_err(fs_info,
@@ -3285,8 +3297,6 @@ int __cold open_ctree(struct super_blockclose_ctree (fs_info);return ret; } - }else { -set_bit (BTRFS_FS_UPDATE_UUID_TREE_GEN , &fs_info->flags); }set_bit (BTRFS_FS_OPEN , &fs_info->flags);
Greg Kroah-Hartman
maintainerPATCH 99/254 PCI: pciehp: Fix indefinite wait on sysfs requests
In reply to Greg Kroah-HartmanFrom: Lukas Wunner <[email protected]>
commit 3e487d2e4aa466decd226353755c9d423e8fbacc upstream.
David Hoyer reports that powering pciehp slots up or down via sysfs may
hang: The call to wait_event() in pciehp_sysfs_enable_slot() and _disable_slot() does not return because ctrl->ist_running remains true.
This flag, which was introduced by commit 157c1062fcd8 ("PCI: pciehp: Avoid returning prematurely from sysfs requests"), signifies that the IRQ thread pciehp_ist() is running. It is set to true at the top of pciehp_ist() and reset to false at the end. However there are two additional return statements in pciehp_ist() before which the commit neglected to reset the flag to false and wake up waiters for the flag.
That omission opens up the following race when powering up the slot:
* pciehp_ist() runs because a PCI_EXP_SLTSTA_PDC event was requested by pciehp_sysfs_enable_slot()
* pciehp_ist() turns on slot power via the following call stack:
pciehp_handle_presence_or_link_change() -> pciehp_enable_slot() -> __pciehp_enable_slot() -> board_added() -> pciehp_power_on_slot()
* after slot power is turned on, the link comes up, resulting in a PCI_EXP_SLTSTA_DLLSC event
* the IRQ handler pciehp_isr() stores the event in ctrl->pending_events and returns IRQ_WAKE_THREAD
* the IRQ thread is already woken (it's bringing up the slot), but the genirq code remembers to re-run the IRQ thread after it has finished (such that it can deal with the new event) by setting IRQTF_RUNTHREAD via __handle_irq_event_percpu() -> __irq_wake_thread()
* the IRQ thread removes PCI_EXP_SLTSTA_DLLSC from ctrl->pending_events via board_added() -> pciehp_check_link_status() in order to deal with presence and link flaps per commit 6c35a1ac3da6 ("PCI: pciehp:
Tolerate initially unstable link")
* after pciehp_ist() has successfully brought up the slot, it resets ctrl->ist_running to false and wakes up the sysfs requester
* the genirq code re-runs pciehp_ist(), which sets ctrl->ist_running to true but then returns with IRQ_NONE because ctrl->pending_events is empty
* pciehp_sysfs_enable_slot() is finally woken but notices that ctrl->ist_running is true, hence continues waiting
The only way to get the hung task going again is to trigger a hotplug event which brings down the slot, e.g. by yanking out the card.
The same race exists when powering down the slot because remove_board() likewise clears link or presence changes in ctrl->pending_events per commit 3943af9d01e9 ("PCI: pciehp: Ignore Link State Changes after powering off a slot") and thereby may cause a re-run of pciehp_ist() which returns with IRQ_NONE without resetting ctrl->ist_running to false.
Fix by adding a goto label before the teardown steps at the end of pciehp_ist() and jumping to that label from the two return statements which currently neglect to reset the ctrl->ist_running flag.
--- drivers/pci/hotplug/pciehp_hpc.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/pci/hotplug/pciehp_hpc.c +7 -7
@@ -625,17 +625,15 @@ static irqreturn_t pciehp_ist(int irq, vif (atomic_fetch_and (~RERUN_ISR , &ctrl->pending_events) &RERUN_ISR ) { ret =pciehp_isr (irq, dev_id);enable_irq (irq); -if (ret !=IRQ_WAKE_THREAD ) { -pci_config_pm_runtime_put (pdev); -return ret; - } +if (ret !=IRQ_WAKE_THREAD ) + goto out; }synchronize_hardirq (irq); events =atomic_xchg (&ctrl->pending_events,0 );if (!events) { -pci_config_pm_runtime_put (pdev); -return IRQ_NONE ; + ret =IRQ_NONE ; + goto out; }/* Check Attention Button Pressed */
@@ -664,10 +662,12 @@ static irqreturn_t pciehp_ist(int irq, vpciehp_handle_presence_or_link_change (ctrl, events);up_read (&ctrl->reset_lock); + ret =IRQ_HANDLED ; +out:pci_config_pm_runtime_put (pdev); ctrl->ist_running = false;wake_up (&ctrl->requester); -return IRQ_HANDLED ; +return ret; }static int pciehp_poll (void *data)
Greg Kroah-Hartman
maintainerPATCH 136/254 KVM: x86: Gracefully handle __vmalloc() failure during VM allocation
In reply to Greg Kroah-HartmanFrom: Sean Christopherson <[email protected]>
commit d18b2f43b9147c8005ae0844fb445d8cc6a87e31 upstream.
Check the result of __vmalloc() to avoid dereferencing a NULL pointer in the event that allocation failres.
--- arch/x86/kvm/svm.c | 4 ++++ arch/x86/kvm/vmx/vmx.c | 4 ++++ 2 files changed, 8 insertions(+)
arch/x86/kvm/svm.c +4 -0
@@ -1943,6 +1943,10 @@ static struct kvm *svm_vm_alloc(void)struct kvm_svm *kvm_svm =__vmalloc (sizeof (struct kvm_svm ),GFP_KERNEL_ACCOUNT | __GFP_ZERO,PAGE_KERNEL ); + +if (!kvm_svm) +return NULL ; +return &kvm_svm->kvm; }
arch/x86/kvm/vmx/vmx.c +4 -0
@@ -6671,6 +6671,10 @@ static struct kvm *vmx_vm_alloc(void)struct kvm_vmx *kvm_vmx =__vmalloc (sizeof (struct kvm_vmx ),GFP_KERNEL_ACCOUNT | __GFP_ZERO,PAGE_KERNEL ); + +if (!kvm_vmx) +return NULL ; +return &kvm_vmx->kvm; }
Greg Kroah-Hartman
maintainerPATCH 134/254 KVM: x86: Allocate new rmap and large page tracking when moving memslot
In reply to Greg Kroah-HartmanFrom: Sean Christopherson <[email protected]>
commit edd4fa37baa6ee8e44dc65523b27bd6fe44c94de upstream.
Reallocate a rmap array and recalcuate large page compatibility when moving an existing memslot to correctly handle the alignment properties of the new memslot. The number of rmap entries required at each level is dependent on the alignment of the memslot's base gfn with respect to that level, e.g. moving a large-page aligned memslot so that it becomes unaligned will increase the number of rmap entries needed at the now unaligned level.
Not updating the rmap array is the most obvious bug, as KVM accesses garbage data beyond the end of the rmap. KVM interprets the bad data as pointers, leading to non-canonical #GPs, unexpected #PFs, etc...
general protection fault: 0000 [#1] SMP CPU: 0 PID: 1909 Comm: move_memory_reg Not tainted 5.4.0-rc7+ #139 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 0.0.0 02/06/2015 RIP: 0010:rmap_get_first+0x37/0x50 [kvm] Code: <48> 8b 3b 48 85 ff 74 ec e8 6c f4 ff ff 85 c0 74 e3 48 89 d8 5b c3 RSP: 0018:ffffc9000021bbc8 EFLAGS: 00010246 RAX: ffff00617461642e RBX: ffff00617461642e RCX: 0000000000000012 RDX: ffff88827400f568 RSI: ffffc9000021bbe0 RDI: ffff88827400f570 RBP: 0010000000000000 R08: ffffc9000021bd00 R09: ffffc9000021bda8 R10: ffffc9000021bc48 R11: 0000000000000000 R12: 0030000000000000 R13: 0000000000000000 R14: ffff88827427d700 R15: ffffc9000021bce8 FS: 00007f7eda014700(0000) GS:ffff888277a00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f7ed9216ff8 CR3: 0000000274391003 CR4: 0000000000162eb0 Call Trace: kvm_mmu_slot_set_dirty+0xa1/0x150 [kvm] __kvm_set_memory_region.part.64+0x559/0x960 [kvm] kvm_set_memory_region+0x45/0x60 [kvm] kvm_vm_ioctl+0x30f/0x920 [kvm] do_vfs_ioctl+0xa1/0x620 ksys_ioctl+0x66/0x70 __x64_sys_ioctl+0x16/0x20 do_syscall_64+0x4c/0x170 entry_SYSCALL_64_after_hwframe+0x44/0xa9 RIP: 0033:0x7f7ed9911f47 Code: <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 21 6f 2c 00 f7 d8 64 89 01 48 RSP: 002b:00007ffc00937498 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 0000000001ab0010 RCX: 00007f7ed9911f47 RDX: 0000000001ab1350 RSI: 000000004020ae46 RDI: 0000000000000004 RBP: 000000000000000a R08: 0000000000000000 R09: 00007f7ed9214700 R10: 00007f7ed92149d0 R11: 0000000000000246 R12: 00000000bffff000 R13: 0000000000000003 R14: 00007f7ed9215000 R15: 0000000000000000 Modules linked in: kvm_intel kvm irqbypass ---[ end trace 0c5f570b3358ca89 ]---
The disallow_lpage tracking is more subtle. Failure to update results in KVM creating large pages when it shouldn't, either due to stale data or again due to indexing beyond the end of the metadata arrays, which can lead to memory corruption and/or leaking data to guest/userspace.
Note, the arrays for the old memslot are freed by the unconditional call to kvm_free_memslot() in __kvm_set_memory_region().
--- arch/x86/kvm/x86.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
arch/x86/kvm/x86.c +11 -0
@@ -9873,6 +9873,13 @@ int kvm_arch_create_memslot(struct kvm * {int i; +/* +* Clear out the previous array pointers for the KVM_MR_MOVE case. The +* old arrays will be freed by __kvm_set_memory_region() if installing +* the new memslot is successful. +*/ +memset (&slot->arch,0 ,sizeof (slot->arch)); +for (i =0 ; i <KVM_NR_PAGE_SIZES ; ++i) {struct kvm_lpage_info *linfo;unsigned long ugfn;
@@ -9954,6 +9961,10 @@ int kvm_arch_prepare_memory_region(struc const struct kvm_userspace_memory_region *mem, enum kvm_mr_change change) { + if (change == KVM_MR_MOVE) + return kvm_arch_create_memslot(kvm, memslot, + mem->memory_size >> PAGE_SHIFT); +return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 126/254 x86/tsc_msr: Fix MSR_FSB_FREQ mask for Cherry Trail devices
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
commit c8810e2ffc30c7e1577f9c057c4b85d984bbc35a upstream.
According to the "Intel 64 and IA-32 Architectures Software Developer's Manual Volume 4: Model-Specific Registers" on Cherry Trail (Airmont) devices the 4 lowest bits of the MSR_FSB_FREQ mask indicate the bus freq unlike on e.g. Bay Trail where only the lowest 3 bits are used.
This is also the reason why MAX_NUM_FREQS is defined as 9, since Cherry Trail SoCs have 9 possible frequencies, so the lo value from the MSR needs to be masked with 0x0f, not with 0x07 otherwise the 9th frequency will get interpreted as the 1st.
Bump MAX_NUM_FREQS to 16 to avoid any possibility of addressing the array out of bounds and makes the mask part of the cpufreq struct so it can be set it per model.
While at it also log an error when the index points to an uninitialized part of the freqs lookup-table.
--- arch/x86/kernel/tsc_msr.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)
arch/x86/kernel/tsc_msr.c +15 -2
@@ -15,7 +15,7 @@#include <asm/param.h> #include <asm/tsc.h> -#define MAX_NUM_FREQS 9 +#define MAX_NUM_FREQS 16/* 4 bits to select the frequency */ /* * If MSR_PERF_STAT[31] is set, the maximum resolved bus ratio can be
@@ -27,6 +27,7 @@struct freq_desc {bool use_msr_plat;u32 freqs[MAX_NUM_FREQS ]; +u32 mask; };/*
@@ -37,37 +38,44 @@ struct freq_desc {static const struct freq_desc freq_desc_pnw = { .use_msr_plat = false, .freqs = {0 ,0 ,0 ,0 ,0 ,99840 ,0 ,83200 }, + .mask =0x07 , };static const struct freq_desc freq_desc_clv = { .use_msr_plat = false, .freqs = {0 ,133200 ,0 ,0 ,0 ,99840 ,0 ,83200 }, + .mask =0x07 , };static const struct freq_desc freq_desc_byt = { .use_msr_plat = true, .freqs = {83300 ,100000 ,133300 ,116700 ,80000 ,0 ,0 ,0 }, + .mask =0x07 , };static const struct freq_desc freq_desc_cht = { .use_msr_plat = true, .freqs = {83300 ,100000 ,133300 ,116700 ,80000 ,93300 ,90000 ,88900 ,87500 }, + .mask =0x0f , };static const struct freq_desc freq_desc_tng = { .use_msr_plat = true, .freqs = {0 ,100000 ,133300 ,0 ,0 ,0 ,0 ,0 }, + .mask =0x07 , };static const struct freq_desc freq_desc_ann = { .use_msr_plat = true, .freqs = {83300 ,100000 ,133300 ,100000 ,0 ,0 ,0 ,0 }, + .mask =0x0f , };static const struct freq_desc freq_desc_lgm = { .use_msr_plat = true, .freqs = {78000 ,78000 ,78000 ,78000 ,78000 ,78000 ,78000 ,78000 }, + .mask =0x0f , };static const struct x86_cpu_id tsc_msr_cpu_ids[] = {
@@ -93,6 +101,7 @@ unsigned long cpu_khz_from_msr(void)const struct freq_desc *freq_desc;const struct x86_cpu_id *id;unsigned long res; +int index; id =x86_match_cpu (tsc_msr_cpu_ids);if (!id)
@@ -109,13 +118,17 @@ unsigned long cpu_khz_from_msr(void)/* Get FSB FREQ ID */ rdmsr (MSR_FSB_FREQ , lo, hi); + index = lo & freq_desc->mask;/* Map CPU reference clock freq ID(0-7) to CPU reference clock freq(KHz) */ - freq = freq_desc->freqs[lo &0x7 ]; + freq = freq_desc->freqs[index];/* TSC frequency = maximum resolved freq * maximum resolved bus ratio */ res = freq * ratio; +if (freq ==0 ) +pr_err ("Error MSR_FSB_FREQ index %d is unknown\n" , index); +#ifdef CONFIG_X86_LOCAL_APIC lapic_timer_period = (freq *1000 ) /HZ ;#endif
Greg Kroah-Hartman
maintainerPATCH 125/254 x86/tsc_msr: Use named struct initializers
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
commit 812c2d7506fde7cdf83cb2532810a65782b51741 upstream.
Use named struct initializers for the freq_desc struct-s initialization and change the "u8 msr_plat" to a "bool use_msr_plat" to make its meaning more clear instead of relying on a comment to explain it.
--- arch/x86/kernel/tsc_msr.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-)
arch/x86/kernel/tsc_msr.c +18 -10
@@ -22,10 +22,10 @@* read in MSR_PLATFORM_ID[12:8], otherwise in MSR_PERF_STAT[44:40]. * Unfortunately some Intel Atom SoCs aren't quite compliant to this, * so we need manually differentiate SoC families. This is what the -* field msr_plat does. +* field use_msr_plat does. */ struct freq_desc { -u8 msr_plat;/* 1: use MSR_PLATFORM_INFO, 0: MSR_IA32_PERF_STATUS */ +bool use_msr_plat;u32 freqs[MAX_NUM_FREQS ]; };
@@ -35,31 +35,39 @@ struct freq_desc {* by MSR based on SDM. */ static const struct freq_desc freq_desc_pnw = { -0 , {0 ,0 ,0 ,0 ,0 ,99840 ,0 ,83200 } + .use_msr_plat = false, + .freqs = {0 ,0 ,0 ,0 ,0 ,99840 ,0 ,83200 }, };static const struct freq_desc freq_desc_clv = { -0 , {0 ,133200 ,0 ,0 ,0 ,99840 ,0 ,83200 } + .use_msr_plat = false, + .freqs = {0 ,133200 ,0 ,0 ,0 ,99840 ,0 ,83200 }, };static const struct freq_desc freq_desc_byt = { -1 , {83300 ,100000 ,133300 ,116700 ,80000 ,0 ,0 ,0 } + .use_msr_plat = true, + .freqs = {83300 ,100000 ,133300 ,116700 ,80000 ,0 ,0 ,0 }, };static const struct freq_desc freq_desc_cht = { -1 , {83300 ,100000 ,133300 ,116700 ,80000 ,93300 ,90000 ,88900 ,87500 } + .use_msr_plat = true, + .freqs = {83300 ,100000 ,133300 ,116700 ,80000 ,93300 ,90000 , +88900 ,87500 }, };static const struct freq_desc freq_desc_tng = { -1 , {0 ,100000 ,133300 ,0 ,0 ,0 ,0 ,0 } + .use_msr_plat = true, + .freqs = {0 ,100000 ,133300 ,0 ,0 ,0 ,0 ,0 }, };static const struct freq_desc freq_desc_ann = { -1 , {83300 ,100000 ,133300 ,100000 ,0 ,0 ,0 ,0 } + .use_msr_plat = true, + .freqs = {83300 ,100000 ,133300 ,100000 ,0 ,0 ,0 ,0 }, };static const struct freq_desc freq_desc_lgm = { -1 , {78000 ,78000 ,78000 ,78000 ,78000 ,78000 ,78000 ,78000 } + .use_msr_plat = true, + .freqs = {78000 ,78000 ,78000 ,78000 ,78000 ,78000 ,78000 ,78000 }, };static const struct x86_cpu_id tsc_msr_cpu_ids[] = {
@@ -91,7 +99,7 @@ unsigned long cpu_khz_from_msr(void)return 0 ; freq_desc = (struct freq_desc *)id->driver_data; -if (freq_desc->msr_plat) { +if (freq_desc->use_msr_plat) {rdmsr (MSR_PLATFORM_INFO , lo, hi); ratio = (lo >>8 ) &0xff ; }else {
Greg Kroah-Hartman
maintainerPATCH 129/254 platform/x86: asus-wmi: Support laptops where the first battery is named BATT
In reply to Greg Kroah-HartmanFrom: Kristian Klausen <[email protected]>
commit 6b3586d45bba14f6912f37488090c37a3710e7b4 upstream.
The WMI method to set the charge threshold does not provide a way to specific a battery, so we assume it is the first/primary battery (by checking if the name is BAT0).
On some newer ASUS laptops (Zenbook UM431DA) though, the primary/first battery isn't named BAT0 but BATT, so we need to support that case.
--- drivers/platform/x86/asus-wmi.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/platform/x86/asus-wmi.c +4 -1
@@ -426,8 +426,11 @@ static int asus_wmi_battery_add(struct p {/* The WMI method does not provide a way to specific a battery, so we * just assume it is the first battery. +* Note: On some newer ASUS laptops (Zenbook UM431DA), the primary/first +* battery is named BATT. */ -if (strcmp (battery->desc->name,"BAT0" ) !=0 ) +if (strcmp (battery->desc->name,"BAT0" ) !=0 && +strcmp (battery->desc->name,"BATT" ) !=0 )return -ENODEV ; if (device_create_file(&battery->dev,
Greg Kroah-Hartman
maintainerPATCH 122/254 PM: sleep: wakeup: Skip wakeup_source_sysfs_remove() if device is not there
In reply to Greg Kroah-HartmanFrom: Neeraj Upadhyay <[email protected]>
commit 87de6594dc45dbf6819f3e0ef92f9331c5a9444c upstream.
Skip wakeup_source_sysfs_remove() to fix a NULL pinter dereference via ws->dev, if the wakeup source is unregistered before registering the wakeup class from device_add().
--- drivers/base/power/wakeup.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/base/power/wakeup.c +3 -1
@@ -241,7 +241,9 @@ void wakeup_source_unregister(struct wak {if (ws) {wakeup_source_remove (ws); -wakeup_source_sysfs_remove (ws); +if (ws->dev) +wakeup_source_sysfs_remove (ws); +wakeup_source_destroy (ws); } }
Greg Kroah-Hartman
maintainerPATCH 121/254 PM / Domains: Allow no domain-idle-states DT property in genpd when parsing
In reply to Greg Kroah-HartmanFrom: Ulf Hansson <[email protected]>
commit 56cb26891ea4180121265dc6b596015772c4a4b8 upstream.
Commit 2c361684803e ("PM / Domains: Don't treat zero found compatible idle states as an error"), moved of_genpd_parse_idle_states() towards allowing none compatible idle state to be found for the device node, rather than returning an error code.
However, it didn't consider that the "domain-idle-states" DT property may be missing as it's optional, which makes of_count_phandle_with_args() to return -ENOENT. Let's fix this to make the behaviour consistent.
--- drivers/base/power/domain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/power/domain.c +1 -1
@@ -2653,7 +2653,7 @@ static int genpd_iterate_idle_states(str ret =of_count_phandle_with_args (dn,"domain-idle-states" ,NULL );if (ret <=0 ) -return ret; +return ret == -ENOENT ?0 : ret;/* Loop over the phandles until all the requested entry is found */ of_for_each_phandle (&it, ret, dn,"domain-idle-states" ,NULL ,0 ) {
Greg Kroah-Hartman
maintainerPATCH 119/254 MIPS/tlbex: Fix LDDIR usage in setup_pw() for Loongson-3
In reply to Greg Kroah-HartmanFrom: Huacai Chen <[email protected]>
commit d191aaffe3687d1e73e644c185f5f0550ec242b5 upstream.
LDDIR/LDPTE is Loongson-3's acceleration for Page Table Walking. If BD (Base Directory, the 4th page directory) is not enabled, then GDOffset is biased by BadVAddr[63:62]. So, if GDOffset (aka. BadVAddr[47:36] for Loongson-3) is big enough, "0b11(BadVAddr[63:62])|BadVAddr[47:36]|...." can far beyond pg_swapper_dir. This means the pg_swapper_dir may NOT be accessed by LDDIR correctly, so fix it by set PWDirExt in CP0_PWCtl.
--- arch/mips/mm/tlbex.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
arch/mips/mm/tlbex.c +4 -1
@@ -1480,6 +1480,7 @@ static void build_r4000_tlb_refill_handlstatic void setup_pw (void ) { +unsigned int pwctl;unsigned long pgd_i, pgd_w;#ifndef __PAGETABLE_PMD_FOLDEDunsigned long pmd_i, pmd_w;
@@ -1506,6 +1507,7 @@ static void setup_pw(void) pte_i =ilog2 (_PAGE_GLOBAL); pte_w =0 ; + pwctl =1 <<30 ;/* Set PWDirExt */ #ifndef __PAGETABLE_PMD_FOLDEDwrite_c0_pwfield (pgd_i <<24 | pmd_i <<12 | pt_i <<6 | pte_i);
@@ -1516,8 +1518,9 @@ static void setup_pw(void)#endif #ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT -write_c0_pwctl (1 <<6 | psn); + pwctl |= (1 <<6 | psn);#endif +write_c0_pwctl (pwctl);write_c0_kpgd ((long )swapper_pg_dir); kscratch_used_mask |= (1 <<7 );/* KScratch6 is used for KPGD */ }
Greg Kroah-Hartman
maintainerPATCH 120/254 MIPS: OCTEON: irq: Fix potential NULL pointer dereference
In reply to Greg Kroah-HartmanFrom: Gustavo A. R. Silva <[email protected]>
commit 792a402c2840054533ef56279c212ef6da87d811 upstream.
There is a potential NULL pointer dereference in case kzalloc() fails and returns NULL.
Fix this by adding a NULL check on *cd*
This bug was detected with the help of Coccinelle.
--- arch/mips/cavium-octeon/octeon-irq.c | 3 +++ 1 file changed, 3 insertions(+)
arch/mips/cavium-octeon/octeon-irq.c +3 -0
@@ -2199,6 +2199,9 @@ static int octeon_irq_cib_map(struct irq } cd =kzalloc (sizeof (*cd),GFP_KERNEL ); +if (!cd) +return -ENOMEM ; + cd->host_data = host_data; cd->bit = hw;
Greg Kroah-Hartman
maintainerPATCH 117/254 io_uring: fix ctx refcounting in io_submit_sqes()
In reply to Greg Kroah-HartmanFrom: Pavel Begunkov <[email protected]>
commit 48bdd849e967f1c573d2b2bc24308e24a83f39c2 upstream.
If io_get_req() fails, it drops a ref. Then, awhile keeping @submitted unmodified, io_submit_sqes() breaks the loop and puts @nr - @submitted refs. For each submitted req a ref is dropped in io_put_req() and friends. So, for @nr taken refs there will be
(@nr - @submitted + @submitted + 1) dropped.
Remove ctx refcounting from io_get_req(), that at the same time makes it clearer.
--- fs/io_uring.c | 1 - 1 file changed, 1 deletion(-)
fs/io_uring.c +0 -1
@@ -1242,7 +1242,6 @@ fallback: req =io_get_fallback_req (ctx);if (req) goto got_it; -percpu_ref_put (&ctx->refs);return NULL ; }
Greg Kroah-Hartman
maintainerPATCH 116/254 io_uring: remove bogus RLIMIT_NOFILE check in file registration
In reply to Greg Kroah-HartmanFrom: Jens Axboe <[email protected]>
commit c336e992cb1cb1db9ee608dfb30342ae781057ab upstream.
We already checked this limit when the file was opened, and we keep it open in the file table. Hence when we added unit_inflight to the count we want to register, we're doubly accounting these files. This results in -EMFILE for file registration, if we're at half the limit.
--- fs/io_uring.c | 7 ------- 1 file changed, 7 deletions(-)
fs/io_uring.c +0 -7
@@ -5426,13 +5426,6 @@ static int __io_sqe_files_scm(struct io_struct sk_buff *skb;int i, nr_files; -if (!capable (CAP_SYS_RESOURCE ) && !capable (CAP_SYS_ADMIN )) { -unsigned long inflight = ctx->user->unix_inflight + nr; - -if (inflight >task_rlimit (current,RLIMIT_NOFILE )) -return -EMFILE ; - } - fpl =kzalloc (sizeof (*fpl),GFP_KERNEL );if (!fpl)return -ENOMEM ;
Greg Kroah-Hartman
maintainerPATCH 115/254 io_uring: ensure openat sets O_LARGEFILE if needed
In reply to Greg Kroah-HartmanFrom: Jens Axboe <[email protected]>
commit 08a1d26eb894a9dcf79f674558a284ad1ffef517 upstream.
OPENAT2 correctly sets O_LARGEFILE if it has to, but that escaped the OPENAT opcode. Dmitry reports that his test case that compares openat() and IORING_OP_OPENAT sees failures on large files:
--- fs/io_uring.c | 2 ++ 1 file changed, 2 insertions(+)
fs/io_uring.c +2 -0
@@ -2571,6 +2571,8 @@ static int io_openat_prep(struct io_kioc req->open.how.mode =READ_ONCE (sqe->len); fname =u64_to_user_ptr (READ_ONCE (sqe->addr)); req->open.how.flags =READ_ONCE (sqe->open_flags); +if (force_o_largefile ()) + req->open.how.flags |=O_LARGEFILE ; req->open.filename =getname (fname);if (IS_ERR (req->open.filename)) {
Greg Kroah-Hartman
maintainerPATCH 108/254 tpm: tpm2_bios_measurements_next should increase position index
In reply to Greg Kroah-HartmanFrom: Vasily Averin <[email protected]>
commit f9bf8adb55cd5a357b247a16aafddf8c97b276e0 upstream.
If .next function does not change position index, following .show function will repeat output related to current position index.
For /sys/kernel/security/tpm0/binary_bios_measurements:
1) read after lseek beyound end of file generates whole last line.
2) read after lseek to middle of last line generates expected end of last line and unexpected whole last line once again.
--- drivers/char/tpm/eventlog/tpm2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/char/tpm/eventlog/tpm2.c +1 -1
@@ -94,6 +94,7 @@ static void *tpm2_bios_measurements_nextsize_t event_size;void *marker; + (*pos)++; event_header = log->bios_event_log;if (v ==SEQ_START_TOKEN ) {
@@ -118,7 +119,6 @@ static void *tpm2_bios_measurements_nextif (((v + event_size) >= limit) || (event_size ==0 ))return NULL ; - (*pos)++;return v; }
Greg Kroah-Hartman
maintainerPATCH 110/254 mmc: mmci_sdmmc: Fix clear busyd0end irq flag
In reply to Greg Kroah-HartmanFrom: Ludovic Barre <[email protected]>
commit d4a384cb563e555ce00255f5f496b503e6cc6358 upstream.
The busyd0 line transition can be very fast. The busy request may be completed by busy_d0end, without waiting for the busy_d0 steps. Therefore, clear the busyd0end irq flag, even if no busy_status.
--- drivers/mmc/host/mmci_stm32_sdmmc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mmc/host/mmci_stm32_sdmmc.c +2 -2
@@ -315,11 +315,11 @@ complete:if (host->busy_status) {writel_relaxed (mask & ~host->variant->busy_detect_mask, base +MMCIMASK0 ); -writel_relaxed (host->variant->busy_detect_mask, - base +MMCICLEAR ); host->busy_status =0 ; } +writel_relaxed (host->variant->busy_detect_mask, base +MMCICLEAR ); +return true; }
Greg Kroah-Hartman
maintainerPATCH 106/254 tpm: Dont make log failures fatal
In reply to Greg Kroah-HartmanFrom: Matthew Garrett <[email protected]>
commit 805fa88e0780b7ce1cc9b649dd91a0a7164c6eb4 upstream.
If a TPM is in disabled state, it's reasonable for it to have an empty log. Bailing out of probe in this case means that the PPI interface isn't available, so there's no way to then enable the TPM from the OS. In general it seems reasonable to ignore log errors - they shouldn't interfere with any other TPM functionality.
--- drivers/char/tpm/eventlog/common.c | 12 ++++-------- drivers/char/tpm/tpm-chip.c | 4 +--- drivers/char/tpm/tpm.h | 2 +- 3 files changed, 6 insertions(+), 12 deletions(-)
drivers/char/tpm/eventlog/common.c +4 -8
@@ -99,11 +99,8 @@ static int tpm_read_log(struct tpm_chip* * If an event log is found then the securityfs files are setup to * export it to userspace, otherwise nothing is done. -* -* Returns -ENODEV if the firmware has no event log or securityfs is not -* supported. */ -int tpm_bios_log_setup (struct tpm_chip *chip) +void tpm_bios_log_setup (struct tpm_chip *chip) {const char *name =dev_name (&chip->dev);unsigned int cnt;
@@ -112,7 +109,7 @@ int tpm_bios_log_setup(struct tpm_chip * rc =tpm_read_log (chip);if (rc <0 ) -return rc; +return ; log_version = rc; cnt =0 ;
@@ -158,13 +155,12 @@ int tpm_bios_log_setup(struct tpm_chip * cnt++; } -return 0 ; +return ; err: - rc =PTR_ERR (chip->bios_dir[cnt]); chip->bios_dir[cnt] =NULL ;tpm_bios_log_teardown (chip); -return rc; +return ; }void tpm_bios_log_teardown (struct tpm_chip *chip)
drivers/char/tpm/tpm-chip.c +1 -3
@@ -596,9 +596,7 @@ int tpm_chip_register(struct tpm_chip *ctpm_sysfs_add_device (chip); - rc =tpm_bios_log_setup (chip); -if (rc !=0 && rc != -ENODEV ) -return rc; +tpm_bios_log_setup (chip);tpm_add_ppi (chip);
drivers/char/tpm/tpm.h +1 -1
@@ -235,7 +235,7 @@ int tpm2_prepare_space(struct tpm_chip *int tpm2_commit_space (struct tpm_chip *chip,struct tpm_space *space,void *buf,size_t *bufsiz); -int tpm_bios_log_setup (struct tpm_chip *chip); +void tpm_bios_log_setup (struct tpm_chip *chip);void tpm_bios_log_teardown (struct tpm_chip *chip);int tpm_dev_common_init (void );void tpm_dev_common_exit (void );
Greg Kroah-Hartman
maintainerPATCH 107/254 tpm: tpm1_bios_measurements_next should increase position index
In reply to Greg Kroah-HartmanFrom: Vasily Averin <[email protected]>
commit d7a47b96ed1102551eb7325f97937e276fb91045 upstream.
If .next function does not change position index, following .show function will repeat output related to current position index.
In case of /sys/kernel/security/tpm0/ascii_bios_measurements and binary_bios_measurements:
1) read after lseek beyound end of file generates whole last line.
2) read after lseek to middle of last line generates expected end of last line and unexpected whole last line once again.
--- drivers/char/tpm/eventlog/tpm1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/char/tpm/eventlog/tpm1.c +1 -1
@@ -115,6 +115,7 @@ static void *tpm1_bios_measurements_nextu32 converted_event_size;u32 converted_event_type; + (*pos)++; converted_event_size =do_endian_conversion (event->event_size); v +=sizeof (struct tcpa_event ) + converted_event_size;
@@ -132,7 +133,6 @@ static void *tpm1_bios_measurements_next ((v + sizeof(struct tcpa_event) + converted_event_size) > limit))return NULL ; - (*pos)++;return v; }
Greg Kroah-Hartman
maintainerPATCH 105/254 sched/fair: Fix enqueue_task_fair warning
In reply to Greg Kroah-HartmanFrom: Vincent Guittot <[email protected]>
commit fe61468b2cbc2b7ce5f8d3bf32ae5001d4c434e9 upstream.
When a cfs rq is throttled, the latter and its child are removed from the leaf list but their nr_running is not changed which includes staying higher than 1. When a task is enqueued in this throttled branch, the cfs rqs must be added back in order to ensure correct ordering in the list but this can only happens if nr_running == 1.
When cfs bandwidth is used, we call unconditionnaly list_add_leaf_cfs_rq() when enqueuing an entity to make sure that the complete branch will be added.
Similarly unthrottle_cfs_rq() can stop adding cfs in the list when a parent is throttled. Iterate the remaining entity to ensure that the complete branch will be added in the list.
--- kernel/sched/fair.c | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-)
kernel/sched/fair.c +22 -4
@@ -3957,6 +3957,7 @@ static inline void check_schedstat_requi#endif } +static inline bool cfs_bandwidth_used (void );/* * MIGRATION
@@ -4035,10 +4036,16 @@ enqueue_entity(struct cfs_rq *cfs_rq, st__enqueue_entity (cfs_rq, se); se->on_rq =1 ; -if (cfs_rq->nr_running ==1 ) { +/* +* When bandwidth control is enabled, cfs might have been removed +* because of a parent been throttled but cfs->nr_running > 1. Try to +* add it unconditionnally. +*/ +if (cfs_rq->nr_running ==1 ||cfs_bandwidth_used ())list_add_leaf_cfs_rq (cfs_rq); + +if (cfs_rq->nr_running ==1 )check_enqueue_throttle (cfs_rq); - } }static void __clear_buddies_last (struct sched_entity *se)
@@ -4619,11 +4626,22 @@ void unthrottle_cfs_rq(struct cfs_rq *cfbreak ; } -assert_list_leaf_cfs_rq (rq); -if (!se)add_nr_running (rq, task_delta); +/* +* The cfs_rq_throttled() breaks in the above iteration can result in +* incomplete leaf list maintenance, resulting in triggering the +* assertion below. +*/ +for_each_sched_entity (se) { + cfs_rq =cfs_rq_of (se); + +list_add_leaf_cfs_rq (cfs_rq); + } + +assert_list_leaf_cfs_rq (rq); +/* Determine whether we need to wake up potentially idle CPU: */ if (rq->curr == rq->idle && rq->cfs.nr_running)resched_curr (rq);
Greg Kroah-Hartman
maintainerPATCH 96/254 nvmet-tcp: fix maxh2cdata icresp parameter
In reply to Greg Kroah-HartmanFrom: Sagi Grimberg <[email protected]>
commit 9cda34e37489244a8c8628617e24b2dbc8a8edad upstream.
MAXH2CDATA is not zero based. Also no reason to limit ourselves to 1M transfers as we can do more easily. Make this an arbitrary limit of 16M.
--- drivers/nvme/target/tcp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/target/tcp.c +1 -1
@@ -794,7 +794,7 @@ static int nvmet_tcp_handle_icreq(struct icresp->hdr.pdo =0 ; icresp->hdr.plen =cpu_to_le32 (icresp->hdr.hlen); icresp->pfv =cpu_to_le16 (NVME_TCP_PFV_1_0 ); - icresp->maxdata =cpu_to_le32 (0xffff );/* FIXME: support r2t */ + icresp->maxdata =cpu_to_le32 (0x400000 );/* 16M arbitrary limit */ icresp->cpda =0 ;if (queue->hdr_digest) icresp->digest |=NVME_TCP_HDR_DIGEST_ENABLE ;
Greg Kroah-Hartman
maintainerPATCH 59/254 locking/lockdep: Avoid recursion in lockdep_count_{for,back}ward_deps()
In reply to Greg Kroah-HartmanFrom: Boqun Feng <[email protected]>
[ Upstream commit 25016bd7f4caf5fc983bbab7403d08e64cba3004 ]
Qian Cai reported a bug when PROVE_RCU_LIST=y, and read on /proc/lockdep triggered a warning:
[ ] DEBUG_LOCKS_WARN_ON(current->hardirqs_enabled)
...
[ ] Call Trace:
[ ] lock_is_held_type+0x5d/0x150 [ ] ? rcu_lockdep_current_cpu_online+0x64/0x80 [ ] rcu_read_lock_any_held+0xac/0x100 [ ] ? rcu_read_lock_held+0xc0/0xc0 [ ] ? __slab_free+0x421/0x540 [ ] ? kasan_kmalloc+0x9/0x10 [ ] ? __kmalloc_node+0x1d7/0x320 [ ] ? kvmalloc_node+0x6f/0x80 [ ] __bfs+0x28a/0x3c0 [ ] ? class_equal+0x30/0x30 [ ] lockdep_count_forward_deps+0x11a/0x1a0
The warning got triggered because lockdep_count_forward_deps() call __bfs() without current->lockdep_recursion being set, as a result a lockdep internal function (__bfs()) is checked by lockdep, which is unexpected, and the inconsistency between the irq-off state and the state traced by lockdep caused the warning.
Apart from this warning, lockdep internal functions like __bfs() should always be protected by current->lockdep_recursion to avoid potential deadlocks and data inconsistency, therefore add the current->lockdep_recursion on-and-off section to protect __bfs() in both lockdep_count_forward_deps() and lockdep_count_backward_deps()
--- kernel/locking/lockdep.c | 4 ++++ 1 file changed, 4 insertions(+)
kernel/locking/lockdep.c +4 -0
@@ -1719,9 +1719,11 @@ unsigned long lockdep_count_forward_deps(struct lock_class *class) this.class = class;raw_local_irq_save (flags); + current->lockdep_recursion =1 ;arch_spin_lock (&lockdep_lock); ret =__lockdep_count_forward_deps (&this);arch_spin_unlock (&lockdep_lock); + current->lockdep_recursion =0 ;raw_local_irq_restore (flags);return ret;
@@ -1746,9 +1748,11 @@ unsigned long lockdep_count_backward_deps(struct lock_class *class) this.class = class;raw_local_irq_save (flags); + current->lockdep_recursion =1 ;arch_spin_lock (&lockdep_lock); ret =__lockdep_count_backward_deps (&this);arch_spin_unlock (&lockdep_lock); + current->lockdep_recursion =0 ;raw_local_irq_restore (flags);return ret;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 60/254 staging: mt7621-pci: avoid to poweroff the phy for slot one
In reply to Greg Kroah-HartmanFrom: Sergio Paracuellos <[email protected]>
[ Upstream commit 5737cfe87a9c242ad0f60b34b5ac1688770a9236 ]
Phy for slot 0 and 1 is shared and handled properly in slot 0. If there is only one port in use,(slot 0) we shall not call the 'phy_power_off' function with an invalid slot because kernel will crash with an unaligned access fault like the following:
mt7621-pci 1e140000.pcie: Error applying setting, reverse things back mt7621-pci-phy 1e149000.pcie-phy: PHY for 0xbe149000 (dual port = 1) mt7621-pci-phy 1e14a000.pcie-phy: PHY for 0xbe14a000 (dual port = 0) mt7621-pci-phy 1e149000.pcie-phy: Xtal is 40MHz mt7621-pci-phy 1e14a000.pcie-phy: Xtal is 40MHz
mt7621-pci 1e140000.pcie: pcie1 no card, disable it (RST & CLK) Unhandled kernel unaligned access[#1]:
CPU: 3 PID: 111 Comm: kworker/3:2 Not tainted 5.6.0-rc3-00347-g825c6f470c62-dirty #9
Workqueue: events deferred_probe_work_func
$ 0 : 00000000 00000001 5f60d043 8fe1ba80
$ 4 : 0000010d 01eb9000 00000000 00000000
$ 8 : 294b4c00 80940000 00000008 000000ce
$12 : 2e303030 00000000 00000000 65696370
$16 : ffffffed 0000010d 8e373cd0 8214c1e0
$20 : 00000000 82144c80 82144680 8214c250
$24 : 00000018 803ef8f4
$28 : 8e372000 8e373c60 8214c080 803940e8
Hi : 00000125
Lo : 122f2000
epc : 807b3328 mutex_lock+0x8/0x44
ra : 803940e8 phy_power_off+0x28/0xb0
Status: 1100fc03 KERNEL EXL IE
Cause : 00800010 (ExcCode 04)
BadVA : 0000010d
PrId : 0001992f (MIPS 1004Kc)
Modules linked in:
Process kworker/3:2 (pid: 111, threadinfo=(ptrval), task=(ptrval), tls=00000000)
Stack : 8e373cd0 803fe4f4 8e372000 8e373c90 8214c080 804fde1c 8e373c98 808d62f4
8e373c78 00000000 8214c254 804fe648 1e160000 804f27b8 00000001 808d62f4
00000000 00000001 8214c228 808d62f4 80930000 809a0000 8fd47e10 808d63d4
808d62d4 8fd47e10 808d0000 808d0000 8e373cd0 8e373cd0 809e2a74 809db510
809db510 00000006 00000001 00000000 00000000 00000000 01000000 1e1440ff
...
Call Trace:
[<807b3328>] mutex_lock+0x8/0x44
[<803940e8>] phy_power_off+0x28/0xb0
[<804fe648>] mt7621_pci_probe+0xc20/0xd18
[<80402ab8>] platform_drv_probe+0x40/0x94
[<80400a74>] really_probe+0x104/0x364
[<803feb74>] bus_for_each_drv+0x84/0xdc
[<80400924>] __device_attach+0xdc/0x120
[<803ffb5c>] bus_probe_device+0xa0/0xbc
[<80400124>] deferred_probe_work_func+0x7c/0xbc
[<800420e8>] process_one_work+0x230/0x450
[<80042638>] worker_thread+0x330/0x5fc
[<80048eb0>] kthread+0x12c/0x134
[<80007438>] ret_from_kernel_thread+0x14/0x1c
Code: 24050002 27bdfff8 8f830000 <c0850000> 14a00005 00000000 00600825 e0810000 1020fffa--- drivers/staging/mt7621-pci/pci-mt7621.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/mt7621-pci/pci-mt7621.c +2 -1
@@ -485,7 +485,8 @@ static void mt7621_pcie_init_ports(struct mt7621_pcie *pcie)if (!mt7621_pcie_port_is_linkup (port)) {dev_err (dev,"pcie%d no card, disable it (RST & CLK)\n" , slot); -phy_power_off (port->phy); +if (slot !=1 ) +phy_power_off (port->phy);mt7621_control_assert (port);mt7621_pcie_port_clk_disable (port); port->enabled = false;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 58/254 spi: spi-fsl-dspi: Replace interruptible wait queue with a simple completion
In reply to Greg Kroah-HartmanFrom: Vladimir Oltean <[email protected]>
[ Upstream commit 4f5ee75ea1718a09149460b3df993f389a67b56a ]
Currently the driver puts the process in interruptible sleep waiting for the interrupt train to finish transfer to/from the tx_buf and rx_buf.
But exiting the process with ctrl-c may make the kernel panic: the wait_event_interruptible call will return -ERESTARTSYS, which a proper driver implementation is perhaps supposed to handle, but nonetheless this one doesn't, and aborts the transfer altogether.
Actually when the task is interrupted, there is still a high chance that the dspi_interrupt is still triggering. And if dspi_transfer_one_message returns execution all the way to the spi_device driver, that can free the spi_message and spi_transfer structures, leaving the interrupts to access a freed tx_buf and rx_buf.
hexdump -C /dev/mtd0
00000000 00 75 68 75 0a ff ff ff ff ff ff ff ff ff ff ff
|.uhu............| 00000010 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................| * ^C[ 38.495955] fsl-dspi 2120000.spi: Waiting for transfer to complete failed! [ 38.503097] spi_master spi2: failed to transfer one message from queue [ 38.509729] Unable to handle kernel paging request at virtual address ffff800095ab3377 [ 38.517676] Mem abort info: [ 38.520474] ESR = 0x96000045 [ 38.523533] EC = 0x25: DABT (current EL), IL = 32 bits [ 38.528861] SET = 0, FnV = 0 [ 38.531921] EA = 0, S1PTW = 0 [ 38.535067] Data abort info: [ 38.537952] ISV = 0, ISS = 0x00000045 [ 38.541797] CM = 0, WnR = 1 [ 38.544771] swapper pgtable: 4k pages, 48-bit VAs, pgdp=0000000082621000 [ 38.551494] [ffff800095ab3377] pgd=00000020fffff003, p4d=00000020fffff003, pud=0000000000000000 [ 38.560229] Internal error: Oops: 96000045 [#1] PREEMPT SMP [ 38.565819] Modules linked in: [ 38.568882] CPU: 0 PID: 2729 Comm: hexdump Not tainted 5.6.0-rc4-next-20200306-00052-gd8730cdc8a0b-dirty #193 [ 38.578834] Hardware name: Kontron SMARC-sAL28 (Single PHY) on SMARC Eval 2.0 carrier (DT) [ 38.587129] pstate: 20000085 (nzCv daIf -PAN -UAO) [ 38.591941] pc : ktime_get_real_ts64+0x3c/0x110 [ 38.596487] lr : spi_take_timestamp_pre+0x40/0x90 [ 38.601203] sp : ffff800010003d90 [ 38.604525] x29: ffff800010003d90 x28: ffff80001200e000 [ 38.609854] x27: ffff800011da9000 x26: ffff002079c40400 [ 38.615184] x25: ffff8000117fe018 x24: ffff800011daa1a0 [ 38.620513] x23: ffff800015ab3860 x22: ffff800095ab3377 [ 38.625841] x21: 000000000000146e x20: ffff8000120c3000 [ 38.631170] x19: ffff0020795f6e80 x18: ffff800011da9948 [ 38.636498] x17: 0000000000000000 x16: 0000000000000000 [ 38.641826] x15: ffff800095ab3377 x14: 0720072007200720 [ 38.647155] x13: 0720072007200765 x12: 0775076507750771 [ 38.652483] x11: 0720076d076f0772 x10: 0000000000000040 [ 38.657812] x9 : ffff8000108e2100 x8 : ffff800011dcabe8 [ 38.663139] x7 : 0000000000000000 x6 : ffff800015ab3a60 [ 38.668468] x5 : 0000000007200720 x4 : ffff800095ab3377 [ 38.673796] x3 : 0000000000000000 x2 : 0000000000000ab0 [ 38.679125] x1 : ffff800011daa000 x0 : 0000000000000026 [ 38.684454] Call trace: [ 38.686905] ktime_get_real_ts64+0x3c/0x110 [ 38.691100] spi_take_timestamp_pre+0x40/0x90 [ 38.695470] dspi_fifo_write+0x58/0x2c0 [ 38.699315] dspi_interrupt+0xbc/0xd0 [ 38.702987] __handle_irq_event_percpu+0x78/0x2c0 [ 38.707706] handle_irq_event_percpu+0x3c/0x90 [ 38.712161] handle_irq_event+0x4c/0xd0 [ 38.716008] handle_fasteoi_irq+0xbc/0x170 [ 38.720115] generic_handle_irq+0x2c/0x40 [ 38.724135] __handle_domain_irq+0x68/0xc0 [ 38.728243] gic_handle_irq+0xc8/0x160 [ 38.732000] el1_irq+0xb8/0x180 [ 38.735149] spi_nor_spimem_read_data+0xe0/0x140 [ 38.739779] spi_nor_read+0xc4/0x120 [ 38.743364] mtd_read_oob+0xa8/0xc0 [ 38.746860] mtd_read+0x4c/0x80 [ 38.750007] mtdchar_read+0x108/0x2a0 [ 38.753679] __vfs_read+0x20/0x50 [ 38.757002] vfs_read+0xa4/0x190 [ 38.760237] ksys_read+0x6c/0xf0 [ 38.763471] __arm64_sys_read+0x20/0x30 [ 38.767319] el0_svc_common.constprop.3+0x90/0x160 [ 38.772125] do_el0_svc+0x28/0x90 [ 38.775449] el0_sync_handler+0x118/0x190 [ 38.779468] el0_sync+0x140/0x180 [ 38.782793] Code: 91000294 1400000f d50339bf f9405e80 (f90002c0) [ 38.788910] ---[ end trace 55da560db4d6bef7 ]--- [ 38.793540] Kernel panic - not syncing: Fatal exception in interrupt [ 38.799914] SMP: stopping secondary CPUs [ 38.803849] Kernel Offset: disabled [ 38.807344] CPU features: 0x10002,20006008 [ 38.811451] Memory Limit: none [ 38.814513] ---[ end Kernel panic - not syncing: Fatal exception in interrupt ]---
So it is clear that the "interruptible" part isn't handled correctly. When the process receives a signal, one could either attempt a clean abort (which appears to be difficult with this hardware) or just keep restarting the sleep until the wait queue really completes. But checking in a loop for -ERESTARTSYS is a bit too complicated for this driver, so just make the sleep uninterruptible, to avoid all that nonsense.
The wait queue was actually restructured as a completion, after polling other drivers for the most "popular" approach.
--- drivers/spi/spi-fsl-dspi.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-)
drivers/spi/spi-fsl-dspi.c +6 -13
@@ -196,8 +196,7 @@ struct fsl_dspi {u8 bytes_per_word;const struct fsl_dspi_devtype_data *devtype_data; -wait_queue_head_t waitq; -u32 waitflags; +struct completion xfer_done;struct fsl_dspi_dma *dma; };
@@ -714,10 +713,8 @@ static irqreturn_t dspi_interrupt(int irq, void *dev_id)if (!(spi_sr &SPI_SR_EOQF ))return IRQ_NONE ; -if (dspi_rxtx (dspi) ==0 ) { - dspi->waitflags =1 ; -wake_up_interruptible (&dspi->waitq); - } +if (dspi_rxtx (dspi) ==0 ) +complete (&dspi->xfer_done);return IRQ_HANDLED ; }
@@ -815,13 +812,9 @@ static int dspi_transfer_one_message(struct spi_controller *ctlr, status =dspi_poll (dspi); }while (status == -EINPROGRESS ); }else if (trans_mode !=DSPI_DMA_MODE ) { - status =wait_event_interruptible (dspi->waitq, - dspi->waitflags); - dspi->waitflags =0 ; +wait_for_completion (&dspi->xfer_done); +reinit_completion (&dspi->xfer_done); } -if (status) -dev_err (&dspi->pdev->dev, -"Waiting for transfer to complete failed!\n" );spi_transfer_delay_exec (transfer); }
@@ -1161,7 +1154,7 @@ static int dspi_probe(struct platform_device *pdev) goto out_clk_put; } -init_waitqueue_head (&dspi->waitq); +init_completion (&dspi->xfer_done); poll_mode:
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 57/254 firmware: fix a double abort case with fw_load_sysfs_fallback
In reply to Greg Kroah-HartmanFrom: Junyong Sun <[email protected]>
[ Upstream commit bcfbd3523f3c6eea51a74d217a8ebc5463bcb7f4 ]
fw_sysfs_wait_timeout may return err with -ENOENT at fw_load_sysfs_fallback and firmware is already in abort status, no need to abort again, so skip it.
This issue is caused by concurrent situation like below:
when thread 1# wait firmware loading, thread 2# may write -1 to abort loading and wakeup thread 1# before it timeout. so wait_for_completion_killable_timeout of thread 1# would return remaining time which is != 0 with fw_st->status FW_STATUS_ABORTED.And the results would be converted into err -ENOENT in __fw_state_wait_common and transfered to fw_load_sysfs_fallback in thread 1#.
The -ENOENT means firmware status is already at ABORTED, so fw_load_sysfs_fallback no need to get mutex to abort again.
-----------------------------
thread 1#,wait for loadingfw_load_sysfs_fallback
->fw_sysfs_wait_timeout
->__fw_state_wait_common
->wait_for_completion_killable_timeoutin __fw_state_wait_common,
...
93 ret = wait_for_completion_killable_timeout(&fw_st->completion, timeout);
94 if (ret != 0 && fw_st->status == FW_STATUS_ABORTED)
95 return -ENOENT;
96 if (!ret)
97 return -ETIMEDOUT;
98
99 return ret < 0 ? ret : 0;
-----------------------------
thread 2#, write -1 to abort loadingfirmware_loading_store
->fw_load_abort
->__fw_load_abort
->fw_state_aborted
->__fw_state_set
->complete_allin __fw_state_set,
...
111 if (status == FW_STATUS_DONE || status == FW_STATUS_ABORTED)
112 complete_all(&fw_st->completion);
-------------------------------------------
BTW,the double abort issue would not cause kernel panic or create an issue, but slow down it sometimes.The change is just a minor optimization.
--- drivers/base/firmware_loader/fallback.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/firmware_loader/fallback.c +1 -1
@@ -525,7 +525,7 @@ static int fw_load_sysfs_fallback(struct fw_sysfs *fw_sysfs, } retval =fw_sysfs_wait_timeout (fw_priv, timeout); -if (retval <0 ) { +if (retval <0 && retval != -ENOENT ) {mutex_lock (&fw_lock);fw_load_abort (fw_sysfs);mutex_unlock (&fw_lock);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 90/254 ACPI: EC: Avoid printing confusing messages in acpi_ec_setup()
In reply to Greg Kroah-HartmanFrom: Rafael J. Wysocki <[email protected]>
commit c823c17a8ea4db4943152388a0beb9a556715716 upstream.
It doesn't really make sense to pass ec->handle of the ECDT EC to acpi_handle_info(), because it is set to ACPI_ROOT_OBJECT in acpi_ec_ecdt_probe(), so rework acpi_ec_setup() to avoid using acpi_handle_info() for printing messages.
First, notice that the "Used as first EC" message is not really useful, because it is immediately followed by a more meaningful one from either acpi_ec_ecdt_probe() or acpi_ec_dsdt_probe() (the latter also includes the EC object path), so drop it altogether.
Second, use pr_info() for printing the EC configuration information.
While at it, make the code in question avoid printing invalid GPE or IRQ numbers and make it print the GPE/IRQ information only when the driver is ready to handle events.
--- drivers/acpi/ec.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
drivers/acpi/ec.c +10 -5
@@ -1584,14 +1584,19 @@ static int acpi_ec_setup(struct acpi_ecreturn ret;/* First EC capable of handling transactions */ -if (!first_ec) { +if (!first_ec) first_ec = ec; -acpi_handle_info (first_ec->handle,"Used as first EC\n" ); + +pr_info ("EC_CMD/EC_SC=0x%lx, EC_DATA=0x%lx\n" , ec->command_addr, + ec->data_addr); + +if (test_bit (EC_FLAGS_EVENT_HANDLER_INSTALLED , &ec->flags)) { +if (ec->gpe >=0 ) +pr_info ("GPE=0x%x\n" , ec->gpe); +else +pr_info ("IRQ=%d\n" , ec->irq); } -acpi_handle_info (ec->handle, -"GPE=0x%x, IRQ=%d, EC_CMD/EC_SC=0x%lx, EC_DATA=0x%lx\n" , - ec->gpe, ec->irq, ec->command_addr, ec->data_addr);return ret; }
Greg Kroah-Hartman
maintainerPATCH 91/254 acpi/x86: ignore unspecified bit positions in the ACPI global lock field
In reply to Greg Kroah-HartmanFrom: Jan Engelhardt <[email protected]>
commit ecb9c790999fd6c5af0f44783bd0217f0b89ec2b upstream.
The value in "new" is constructed from "old" such that all bits defined as reserved by the ACPI spec[1] are left untouched. But if those bits do not happen to be all zero, "new < 3" will not evaluate to true.
The firmware of the laptop(s) Medion MD63490 / Akoya P15648 comes with garbage inside the "FACS" ACPI table. The starting value is old=0x4944454d, therefore new=0x4944454e, which is >= 3. Mask off the reserved bits.
[1] https://uefi.org/sites/default/files/resources/ACPI_6_2.pdf
--- arch/x86/kernel/acpi/boot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/acpi/boot.c +1 -1
@@ -1740,7 +1740,7 @@ int __acpi_acquire_global_lock(unsigned new = (((old & ~0x3 ) +2 ) + ((old >>1 ) &0x1 )); val =cmpxchg (lock, old, new); }while (unlikely (val != old)); -return (new <3 ) ?-1 :0 ; +return ((new &0x3 ) <3 ) ?-1 :0 ; }int __acpi_release_global_lock (unsigned int *lock)
Greg Kroah-Hartman
maintainerPATCH 88/254 media: ti-vpe: cal: fix a kernel oops when unloading module
In reply to Greg Kroah-HartmanFrom: Benoit Parrot <[email protected]>
commit 80264809ea0a3fd2ee8251f31a9eb85d2c3fc77e upstream.
After the switch to use v4l2_async_notifier_add_subdev() and v4l2_async_notifier_cleanup(), unloading the ti_cal module would cause a kernel oops.
This was root cause to the fact that v4l2_async_notifier_cleanup() tries to kfree the asd pointer passed into v4l2_async_notifier_add_subdev().
In our case the asd reference was from a statically allocated struct. So in effect v4l2_async_notifier_cleanup() was trying to free a pointer that was not kalloc.
So here we switch to using a kzalloc struct instead of a static one. To achieve this we re-order some of the calls to prevent asd allocation from leaking.
--- drivers/media/platform/ti-vpe/cal.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/media/platform/ti-vpe/cal.c +8 -5
@@ -372,8 +372,6 @@ struct cal_ctx {struct v4l2_subdev *sensor;struct v4l2_fwnode_endpoint endpoint; -struct v4l2_async_subdev asd; -struct v4l2_fh fh;struct cal_dev *dev;struct cc_data *cc;
@@ -2032,7 +2030,6 @@ static int of_cal_create_instance(struct parent = pdev->dev.of_node; - asd = &ctx->asd; endpoint = &ctx->endpoint; ep_node =NULL ;
@@ -2079,8 +2076,6 @@ static int of_cal_create_instance(structctx_dbg (3 , ctx,"can't get remote parent\n" ); goto cleanup_exit; } - asd->match_type =V4L2_ASYNC_MATCH_FWNODE ; - asd->match.fwnode =of_fwnode_handle (sensor_node);v4l2_fwnode_endpoint_parse (of_fwnode_handle (ep_node), endpoint);
@@ -2110,9 +2105,17 @@ static int of_cal_create_instance(structv4l2_async_notifier_init (&ctx->notifier); + asd =kzalloc (sizeof (*asd),GFP_KERNEL ); +if (!asd) + goto cleanup_exit; + + asd->match_type =V4L2_ASYNC_MATCH_FWNODE ; + asd->match.fwnode =of_fwnode_handle (sensor_node); + ret =v4l2_async_notifier_add_subdev (&ctx->notifier, asd);if (ret) {ctx_err (ctx,"Error adding asd\n" ); +kfree (asd); goto cleanup_exit; }
Greg Kroah-Hartman
maintainerPATCH 87/254 media: ti-vpe: cal: fix disable_irqs to only the intended target
In reply to Greg Kroah-HartmanFrom: Benoit Parrot <[email protected]>
commit 1db56284b9da9056093681f28db48a09a243274b upstream.
disable_irqs() was mistakenly disabling all interrupts when called. This cause all port stream to stop even if only stopping one of them.
--- drivers/media/platform/ti-vpe/cal.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/media/platform/ti-vpe/cal.c +8 -8
@@ -722,16 +722,16 @@ static void enable_irqs(struct cal_ctx *static void disable_irqs (struct cal_ctx *ctx) { +u32 val; +/* Disable IRQ_WDMA_END 0/1 */ -reg_write_field (ctx->dev, -CAL_HL_IRQENABLE_CLR (2 ), -CAL_HL_IRQ_CLEAR , -CAL_HL_IRQ_MASK (ctx->csi2_port)); + val =0 ; +set_field (&val,CAL_HL_IRQ_CLEAR ,CAL_HL_IRQ_MASK (ctx->csi2_port)); +reg_write (ctx->dev,CAL_HL_IRQENABLE_CLR (2 ), val);/* Disable IRQ_WDMA_START 0/1 */ -reg_write_field (ctx->dev, -CAL_HL_IRQENABLE_CLR (3 ), -CAL_HL_IRQ_CLEAR , -CAL_HL_IRQ_MASK (ctx->csi2_port)); + val =0 ; +set_field (&val,CAL_HL_IRQ_CLEAR ,CAL_HL_IRQ_MASK (ctx->csi2_port)); +reg_write (ctx->dev,CAL_HL_IRQENABLE_CLR (3 ), val);/* Todo: Add VC_IRQ and CSI2_COMPLEXIO_IRQ handling */ reg_write (ctx->dev,CAL_CSI2_VC_IRQENABLE (1 ),0 ); }
Greg Kroah-Hartman
maintainerPATCH 84/254 media: venus: cache vb payload to be used by clock scaling
In reply to Greg Kroah-HartmanFrom: Stanimir Varbanov <[email protected]>
commit fd1ee315dcd4a0f913a74939eb88f6d9b0bd9250 upstream.
Instead of iterate over previously queued buffers in clock scaling code do cache the payload in instance context structure for later use when calculating new clock rate.
This will avoid to use spin locks during buffer list iteration in clock_scaling.
This fixes following kernel Oops:
Unable to handle kernel paging request at virtual address deacfffffffffd6c Mem abort info: ESR = 0x96000004 EC = 0x25: DABT (current EL), IL = 32 bits SET = 0, FnV = 0 EA = 0, S1PTW = 0 Data abort info: ISV = 0, ISS = 0x00000004 CM = 0, WnR = 0 [deacfffffffffd6c] address between user and kernel address ranges Internal error: Oops: 96000004 [#1] PREEMPT SMP CPU: 7 PID: 5763 Comm: V4L2DecoderThre Tainted: G S W 5.4.11 #8 pstate: 20400009 (nzCv daif +PAN -UAO) pc : load_scale_v4+0x4c/0x2bc [venus_core] lr : session_process_buf+0x18c/0x1c0 [venus_core] sp : ffffffc01376b8d0 x29: ffffffc01376b8d0 x28: ffffff80cf1b0220 x27: ffffffc01376bba0 x26: ffffffd8f562b2d8 x25: ffffff80cf1b0220 x24: 0000000000000005 x23: ffffffd8f5620d98 x22: ffffff80ca01c800 x21: ffffff80cf1b0000 x20: ffffff8149490080 x19: ffffff8174b2c010 x18: 0000000000000000 x17: 0000000000000000 x16: ffffffd96ee3a0dc x15: 0000000000000026 x14: 0000000000000026 x13: 00000000000055ac x12: 0000000000000001 x11: deacfffffffffd6c x10: dead000000000100 x9 : ffffff80ca01cf28 x8 : 0000000000000026 x7 : 0000000000000000 x6 : ffffff80cdd899c0 x5 : ffffff80cdd899c0 x4 : 0000000000000008 x3 : ffffff80ca01cf28 x2 : ffffff80ca01cf28 x1 : ffffff80d47ffc00 x0 : ffffff80cf1b0000 Call trace: load_scale_v4+0x4c/0x2bc [venus_core] session_process_buf+0x18c/0x1c0 [venus_core] venus_helper_vb2_buf_queue+0x7c/0xf0 [venus_core] __enqueue_in_driver+0xe4/0xfc [videobuf2_common] vb2_core_qbuf+0x15c/0x338 [videobuf2_common] vb2_qbuf+0x78/0xb8 [videobuf2_v4l2] v4l2_m2m_qbuf+0x80/0xf8 [v4l2_mem2mem] v4l2_m2m_ioctl_qbuf+0x2c/0x38 [v4l2_mem2mem] v4l_qbuf+0x48/0x58 __video_do_ioctl+0x2b0/0x39c video_usercopy+0x394/0x710 video_ioctl2+0x38/0x48 v4l2_ioctl+0x6c/0x80 do_video_ioctl+0xb00/0x2874 v4l2_compat_ioctl32+0x5c/0xcc __se_compat_sys_ioctl+0x100/0x2074 __arm64_compat_sys_ioctl+0x20/0x2c el0_svc_common+0xa4/0x154 el0_svc_compat_handler+0x2c/0x38 el0_svc_compat+0x8/0x10 Code: eb0a013f 54000200 aa1f03e8 d10e514b (b940016c) ---[ end trace e11304b46552e0b9 ]---
--- drivers/media/platform/qcom/venus/core.h | 1 + drivers/media/platform/qcom/venus/helpers.c | 20 +++++++++++++------- 2 files changed, 14 insertions(+), 7 deletions(-)
drivers/media/platform/qcom/venus/core.h +1 -0
@@ -344,6 +344,7 @@ struct venus_inst {unsigned int subscriptions;int buf_count;struct venus_ts_metadata tss[VIDEO_MAX_FRAME ]; +unsigned long payloads[VIDEO_MAX_FRAME ];u64 fps;struct v4l2_fract timeperframe;const struct venus_format *fmt_out;
drivers/media/platform/qcom/venus/helpers.c +13 -7
@@ -544,18 +544,13 @@ static int scale_clocks_v4(struct venus_struct venus_core *core = inst->core;const struct freq_tbl *table = core->res->freq_tbl;unsigned int num_rows = core->res->freq_tbl_size; -struct v4l2_m2m_ctx *m2m_ctx = inst->m2m_ctx;struct device *dev = core->dev;unsigned long freq =0 , freq_core1 =0 , freq_core2 =0 ;unsigned long filled_len =0 ; -struct venus_buffer *buf, *n; -struct vb2_buffer *vb;int i, ret; -v4l2_m2m_for_each_src_buf_safe (m2m_ctx, buf, n) { - vb = &buf->vb.vb2_buf; - filled_len =max (filled_len,vb2_get_plane_payload (vb,0 )); - } +for (i =0 ; i < inst->num_input_bufs; i++) + filled_len =max (filled_len, inst->payloads[i]);if (inst->session_type ==VIDC_SESSION_TYPE_DEC && !filled_len)return 0 ;
@@ -1289,6 +1284,15 @@ int venus_helper_vb2_buf_prepare(struct }EXPORT_SYMBOL_GPL (venus_helper_vb2_buf_prepare); +static void cache_payload (struct venus_inst *inst,struct vb2_buffer *vb) +{ +struct vb2_v4l2_buffer *vbuf =to_vb2_v4l2_buffer (vb); +unsigned int idx = vbuf->vb2_buf.index; + +if (vbuf->vb2_buf.type ==V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE ) + inst->payloads[idx] =vb2_get_plane_payload (vb,0 ); +} +void venus_helper_vb2_buf_queue (struct vb2_buffer *vb) {struct vb2_v4l2_buffer *vbuf =to_vb2_v4l2_buffer (vb);
@@ -1300,6 +1304,8 @@ void venus_helper_vb2_buf_queue(struct vv4l2_m2m_buf_queue (m2m_ctx, vbuf); +cache_payload (inst, vb); +if (inst->session_type ==VIDC_SESSION_TYPE_ENC && !(inst->streamon_out && inst->streamon_cap)) goto unlock;
Greg Kroah-Hartman
maintainerPATCH 55/254 irqchip/gic-v4: Provide irq_retrigger to avoid circular locking dependency
In reply to Greg Kroah-HartmanFrom: Marc Zyngier <[email protected]>
[ Upstream commit 7809f7011c3bce650e502a98afeb05961470d865 ]
On a very heavily loaded D05 with GICv4, I managed to trigger the following lockdep splat:
[ 6022.598864] ======================================================
[ 6022.605031] WARNING: possible circular locking dependency detected
[ 6022.611200] 5.6.0-rc4-00026-geee7c7b0f498 #680 Tainted: G E
[ 6022.618061] ------------------------------------------------------
[ 6022.624227] qemu-system-aar/7569 is trying to acquire lock:
[ 6022.629789] ffff042f97606808 (&p->pi_lock){-.-.}, at: try_to_wake_up+0x54/0x7a0
[ 6022.637102]
[ 6022.637102] but task is already holding lock:
[ 6022.642921] ffff002fae424cf0 (&irq_desc_lock_class){-.-.}, at: __irq_get_desc_lock+0x5c/0x98
[ 6022.651350]
[ 6022.651350] which lock already depends on the new lock.
[ 6022.651350]
[ 6022.659512]
[ 6022.659512] the existing dependency chain (in reverse order) is:
[ 6022.666980]
[ 6022.666980] -> #2 (&irq_desc_lock_class){-.-.}:
[ 6022.672983] _raw_spin_lock_irqsave+0x50/0x78
[ 6022.677848] __irq_get_desc_lock+0x5c/0x98
[ 6022.682453] irq_set_vcpu_affinity+0x40/0xc0
[ 6022.687236] its_make_vpe_non_resident+0x6c/0xb8
[ 6022.692364] vgic_v4_put+0x54/0x70
[ 6022.696273] vgic_v3_put+0x20/0xd8
[ 6022.700183] kvm_vgic_put+0x30/0x48
[ 6022.704182] kvm_arch_vcpu_put+0x34/0x50
[ 6022.708614] kvm_sched_out+0x34/0x50
[ 6022.712700] __schedule+0x4bc/0x7f8
[ 6022.716697] schedule+0x50/0xd8
[ 6022.720347] kvm_arch_vcpu_ioctl_run+0x5f0/0x978
[ 6022.725473] kvm_vcpu_ioctl+0x3d4/0x8f8
[ 6022.729820] ksys_ioctl+0x90/0xd0
[ 6022.733642] __arm64_sys_ioctl+0x24/0x30
[ 6022.738074] el0_svc_common.constprop.3+0xa8/0x1e8
[ 6022.743373] do_el0_svc+0x28/0x88
[ 6022.747198] el0_svc+0x14/0x40
[ 6022.750761] el0_sync_handler+0x124/0x2b8
[ 6022.755278] el0_sync+0x140/0x180
[ 6022.759100]
[ 6022.759100] -> #1 (&rq->lock){-.-.}:
[ 6022.764143] _raw_spin_lock+0x38/0x50
[ 6022.768314] task_fork_fair+0x40/0x128
[ 6022.772572] sched_fork+0xe0/0x210
[ 6022.776484] copy_process+0x8c4/0x18d8
[ 6022.780742] _do_fork+0x88/0x6d8
[ 6022.784478] kernel_thread+0x64/0x88
[ 6022.788563] rest_init+0x30/0x270
[ 6022.792390] arch_call_rest_init+0x14/0x1c
[ 6022.796995] start_kernel+0x498/0x4c4
[ 6022.801164]
[ 6022.801164] -> #0 (&p->pi_lock){-.-.}:
[ 6022.806382] __lock_acquire+0xdd8/0x15c8
[ 6022.810813] lock_acquire+0xd0/0x218
[ 6022.814896] _raw_spin_lock_irqsave+0x50/0x78
[ 6022.819761] try_to_wake_up+0x54/0x7a0
[ 6022.824018] wake_up_process+0x1c/0x28
[ 6022.828276] wakeup_softirqd+0x38/0x40
[ 6022.832533] __tasklet_schedule_common+0xc4/0xf0
[ 6022.837658] __tasklet_schedule+0x24/0x30
[ 6022.842176] check_irq_resend+0xc8/0x158
[ 6022.846609] irq_startup+0x74/0x128
[ 6022.850606] __enable_irq+0x6c/0x78
[ 6022.854602] enable_irq+0x54/0xa0
[ 6022.858431] its_make_vpe_non_resident+0xa4/0xb8
[ 6022.863557] vgic_v4_put+0x54/0x70
[ 6022.867469] kvm_arch_vcpu_blocking+0x28/0x38
[ 6022.872336] kvm_vcpu_block+0x48/0x490
[ 6022.876594] kvm_handle_wfx+0x18c/0x310
[ 6022.880938] handle_exit+0x138/0x198
[ 6022.885022] kvm_arch_vcpu_ioctl_run+0x4d4/0x978
[ 6022.890148] kvm_vcpu_ioctl+0x3d4/0x8f8
[ 6022.894494] ksys_ioctl+0x90/0xd0
[ 6022.898317] __arm64_sys_ioctl+0x24/0x30
[ 6022.902748] el0_svc_common.constprop.3+0xa8/0x1e8
[ 6022.908046] do_el0_svc+0x28/0x88
[ 6022.911871] el0_svc+0x14/0x40
[ 6022.915434] el0_sync_handler+0x124/0x2b8
[ 6022.919951] el0_sync+0x140/0x180
[ 6022.923773]
[ 6022.923773] other info that might help us debug this:
[ 6022.923773]
[ 6022.931762] Chain exists of:
[ 6022.931762] &p->pi_lock --> &rq->lock --> &irq_desc_lock_class
[ 6022.931762]
[ 6022.942101] Possible unsafe locking scenario:
[ 6022.942101]
[ 6022.948007] CPU0 CPU1
[ 6022.952523] ---- ----
[ 6022.957039] lock(&irq_desc_lock_class);
[ 6022.961036] lock(&rq->lock);
[ 6022.966595] lock(&irq_desc_lock_class);
[ 6022.973109] lock(&p->pi_lock);
[ 6022.976324]
[ 6022.976324] *** DEADLOCK ***This is happening because we have a pending doorbell that requires retrigger. As SW retriggering is done in a tasklet, we trigger the circular dependency above.
The easy cop-out is to provide a retrigger callback that doesn't require acquiring any extra lock.
--- drivers/irqchip/irq-gic-v3-its.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/irqchip/irq-gic-v3-its.c +6 -0
@@ -3679,12 +3679,18 @@ static int its_vpe_set_irqchip_state(struct irq_data *d,return 0 ; } +static int its_vpe_retrigger (struct irq_data *d) +{ +return !its_vpe_set_irqchip_state (d,IRQCHIP_STATE_PENDING , true); +} +static struct irq_chip its_vpe_irq_chip = { .name ="GICv4-vpe" , .irq_mask = its_vpe_mask_irq, .irq_unmask = its_vpe_unmask_irq, .irq_eoi = irq_chip_eoi_parent, .irq_set_affinity = its_vpe_set_affinity, + .irq_retrigger = its_vpe_retrigger, .irq_set_irqchip_state = its_vpe_set_irqchip_state, .irq_set_vcpu_affinity = its_vpe_set_vcpu_affinity, };
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 81/254 ALSA: hda/realtek - Remove now-unnecessary XPS 13 headphone noise fixups
In reply to Greg Kroah-HartmanFrom: Thomas Hebb <[email protected]>
commit f36938aa7440f46a0a365f1cfde5f5985af2bef3 upstream.
patch_realtek.c has historically failed to properly configure the PC Beep Hidden Register for the ALC256 codec (among others). Depending on your kernel version, symptoms of this misconfiguration can range from chassis noise, picked up by a poorly-shielded PCBEEP trace, getting amplified and played on your internal speaker and/or headphones to loud feedback, which responds to the "Headphone Mic Boost" ALSA control, getting played through your headphones. For details of the problem, see the patch in this series titled "ALSA: hda/realtek - Set principled PC Beep configuration for ALC256", which fixes the configuration.
These symptoms have been most noticed on the Dell XPS 13 9350 and 9360, popular laptops that use the ALC256. As a result, several model-specific fixups have been introduced to try and fix the problem, the most egregious of which locks the "Headphone Mic Boost" control as a hack to minimize noise from a feedback loop that shouldn't have been there in the first place.
Now that the underlying issue has been fixed, remove all these fixups. Remaining fixups needed by the XPS 13 are all picked up by existing pin quirks.
This change should, for the XPS 13 9350/9360
- Significantly increase volume and audio quality on headphones
- Eliminate headphone popping on suspend/resume
- Allow "Headphone Mic Boost" to be set again, making the headphone jack fully usable as a microphone jack too.
--- Documentation/sound/hd-audio/models.rst | 2 - sound/pci/hda/patch_realtek.c | 34 -------------------------------- 2 files changed, 36 deletions(-)
Documentation/sound/hd-audio/models.rst +0 -2
@@ -216,8 +216,6 @@ alc298-dell-aio ALC298 fixups on Dell AIO machines alc275-dell-xps ALC275 fixups on Dell XPS models -alc256-dell-xps13 - ALC256 fixups on Dell XPS13 lenovo-spk-noise Workaround for speaker noise on Lenovo machines lenovo-hotkey
sound/pci/hda/patch_realtek.c +0 -34
@@ -5491,17 +5491,6 @@ static void alc271_hp_gate_mic_jack(stru } } -static void alc256_fixup_dell_xps_13_headphone_noise2 (struct hda_codec *codec, -const struct hda_fixup *fix, -int action) -{ -if (action !=HDA_FIXUP_ACT_PRE_PROBE ) -return ; - -snd_hda_codec_amp_stereo (codec,0x1a ,HDA_INPUT ,0 ,HDA_AMP_VOLMASK ,1 ); -snd_hda_override_wcaps (codec,0x1a ,get_wcaps (codec,0x1a ) & ~AC_WCAP_IN_AMP ); -} -static void alc269_fixup_limit_int_mic_boost (struct hda_codec *codec,const struct hda_fixup *fix,int action)
@@ -5916,8 +5905,6 @@ enum {ALC298_FIXUP_DELL1_MIC_NO_PRESENCE ,ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE ,ALC275_FIXUP_DELL_XPS , -ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE , -ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE2 ,ALC293_FIXUP_LENOVO_SPK_NOISE ,ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY , ALC255_FIXUP_DELL_SPK_NOISE,
@@ -6658,23 +6645,6 @@ static const struct hda_fixup alc269_fix {} } }, - [ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE] = { - .type = HDA_FIXUP_VERBS, - .v.verbs = (const struct hda_verb []) { -/* Disable pass-through path for FRONT 14h */ - {0x20 ,AC_VERB_SET_COEF_INDEX ,0x36 }, - {0x20 ,AC_VERB_SET_PROC_COEF ,0x1737 }, - {} - }, - .chained = true, - .chain_id =ALC255_FIXUP_DELL1_MIC_NO_PRESENCE - }, - [ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE2] = { - .type = HDA_FIXUP_FUNC, - .v.func = alc256_fixup_dell_xps_13_headphone_noise2, - .chained = true, - .chain_id =ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE - }, [ALC293_FIXUP_LENOVO_SPK_NOISE] = { .type = HDA_FIXUP_FUNC, .v.func = alc_fixup_disable_aamix,
@@ -7172,17 +7142,14 @@ static const struct snd_pci_quirk alc269SND_PCI_QUIRK (0x1028 ,0x06de ,"Dell" ,ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK ),SND_PCI_QUIRK (0x1028 ,0x06df ,"Dell" ,ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK ),SND_PCI_QUIRK (0x1028 ,0x06e0 ,"Dell" ,ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK ), -SND_PCI_QUIRK (0x1028 ,0x0704 ,"Dell XPS 13 9350" ,ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE2 ),SND_PCI_QUIRK (0x1028 ,0x0706 ,"Dell Inspiron 7559" ,ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER ),SND_PCI_QUIRK (0x1028 ,0x0725 ,"Dell Inspiron 3162" ,ALC255_FIXUP_DELL_SPK_NOISE ),SND_PCI_QUIRK (0x1028 ,0x0738 ,"Dell Precision 5820" ,ALC269_FIXUP_NO_SHUTUP ), -SND_PCI_QUIRK (0x1028 ,0x075b ,"Dell XPS 13 9360" ,ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE2 ),SND_PCI_QUIRK (0x1028 ,0x075c ,"Dell XPS 27 7760" ,ALC298_FIXUP_SPK_VOLUME ),SND_PCI_QUIRK (0x1028 ,0x075d ,"Dell AIO" ,ALC298_FIXUP_SPK_VOLUME ),SND_PCI_QUIRK (0x1028 ,0x07b0 ,"Dell Precision 7520" ,ALC295_FIXUP_DISABLE_DAC3 ),SND_PCI_QUIRK (0x1028 ,0x0798 ,"Dell Inspiron 17 7000 Gaming" ,ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER ),SND_PCI_QUIRK (0x1028 ,0x080c ,"Dell WYSE" ,ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE ), -SND_PCI_QUIRK (0x1028 ,0x082a ,"Dell XPS 13 9360" ,ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE2 ),SND_PCI_QUIRK (0x1028 ,0x084b ,"Dell" ,ALC274_FIXUP_DELL_AIO_LINEOUT_VERB ),SND_PCI_QUIRK (0x1028 ,0x084e ,"Dell" ,ALC274_FIXUP_DELL_AIO_LINEOUT_VERB ), SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
@@ -7536,7 +7503,6 @@ static const struct hda_model_fixup alc2 {.id = ALC298_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc298-dell1"}, {.id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE, .name = "alc298-dell-aio"}, {.id = ALC275_FIXUP_DELL_XPS, .name = "alc275-dell-xps"}, - {.id = ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE, .name = "alc256-dell-xps13"}, {.id = ALC293_FIXUP_LENOVO_SPK_NOISE, .name = "lenovo-spk-noise"}, {.id = ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY, .name = "lenovo-hotkey"}, {.id = ALC255_FIXUP_DELL_SPK_NOISE, .name = "dell-spk-noise"},
Greg Kroah-Hartman
maintainerPATCH 80/254 ALSA: hda/realtek - Set principled PC Beep configuration for ALC256
In reply to Greg Kroah-HartmanFrom: Thomas Hebb <[email protected]>
commit c44737449468a0bdc50e09ec75e530f208391561 upstream.
The Realtek PC Beep Hidden Register[1] is currently set by patch_realtek.c in two different places:
In alc_fill_eapd_coef(), it's set to the value 0x5757, corresponding to non-beep input on 1Ah and no 1Ah loopback to either headphones or speakers. (Although, curiously, the loopback amp is still enabled.) This write was added fairly recently by commit e3743f431143 ("ALSA:
hda/realtek - Dell headphone has noise on unmute for ALC236") and is a safe default. However, it happens in the wrong place:alc_fill_eapd_coef() runs on module load and cold boot but not on S3 resume, meaning the register loses its value after suspend.
Conversely, in alc256_init(), the register is updated to unset bit 13 (disable speaker loopback) and set bit 5 (set non-beep input on 1Ah). Although this write does run on S3 resume, it's not quite enough to fix up the register's default value of 0x3717. What's missing is a set of bit 14 to disable headphone loopback. Without that, we end up with a feedback loop where the headphone jack is being driven by amplified samples of itself[2].
This change eliminates the update in alc256_init() and replaces it with the 0x5757 write from alc_fill_eapd_coef(). Kailang says that 0x5757 is supposed to be the codec's default value, so using it will make debugging easier for Realtek.
Affects the ALC255, ALC256, ALC257, ALC235, and ALC236 codecs.
[1] Newly documented in Documentation/sound/hd-audio/realtek-pc-beep.rst
[2] Setting the "Headphone Mic Boost" control from userspace changes this feedback loop and has been a widely-shared workaround for headphone noise on laptops like the Dell XPS 13 9350. This commit eliminates the feedback loop and makes the workaround unnecessary.
--- sound/pci/hda/patch_realtek.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
sound/pci/hda/patch_realtek.c +9 -6
@@ -368,7 +368,9 @@ static void alc_fill_eapd_coef(struct hdcase 0x10ec0215 :case 0x10ec0233 :case 0x10ec0235 : +case 0x10ec0236 :case 0x10ec0255 : +case 0x10ec0256 :case 0x10ec0257 :case 0x10ec0282 :case 0x10ec0283 :
@@ -380,11 +382,6 @@ static void alc_fill_eapd_coef(struct hdcase 0x10ec0300 :alc_update_coef_idx (codec,0x10 ,1 <<9 ,0 );break ; -case 0x10ec0236 : -case 0x10ec0256 : -alc_write_coef_idx (codec,0x36 ,0x5757 ); -alc_update_coef_idx (codec,0x10 ,1 <<9 ,0 ); -break ;case 0x10ec0275 :alc_update_coef_idx (codec,0xe ,0 ,1 <<0 );break ;
@@ -3371,7 +3368,13 @@ static void alc256_init(struct hda_codecalc_update_coefex_idx (codec,0x57 ,0x04 ,0x0007 ,0x4 );/* Hight power */ alc_update_coefex_idx (codec,0x53 ,0x02 ,0x8000 ,1 <<15 );/* Clear bit */ alc_update_coefex_idx (codec,0x53 ,0x02 ,0x8000 ,0 <<15 ); -alc_update_coef_idx (codec,0x36 ,1 <<13 ,1 <<5 );/* Switch pcbeep path to Line in path*/ +/* +* Expose headphone mic (or possibly Line In on some machines) instead +* of PC Beep on 1Ah, and disable 1Ah loopback for all outputs. See +* Documentation/sound/hd-audio/realtek-pc-beep.rst for details of +* this register. +*/ +alc_write_coef_idx (codec,0x36 ,0x5757 ); }static void alc256_shutup (struct hda_codec *codec)
Greg Kroah-Hartman
maintainerPATCH 79/254 ALSA: doc: Document PC Beep Hidden Register on Realtek ALC256
In reply to Greg Kroah-HartmanFrom: Thomas Hebb <[email protected]>
commit f128090491c3f5aacef91a863f8c52abf869c436 upstream.
This codec (among others) has a hidden set of audio routes, apparently designed to allow PC Beep output without a mixer widget on the output path, which are controlled by an undocumented Realtek vendor register. The default configuration of these routes means that certain inputs aren't accessible, necessitating driver control of the register. However, Realtek has provided no documentation of the register, instead opting to fix issues by providing magic numbers, most of which have been at least somewhat erroneous. These magic numbers then get copied by others into model-specific fixups, leading to a fragmented and buggy set of configurations.
To get out of this situation, I've reverse engineered the register by flipping bits and observing how the codec's behavior changes. This commit documents my findings. It does not change any code.
--- Documentation/sound/hd-audio/index.rst | 1 Documentation/sound/hd-audio/realtek-pc-beep.rst | 129 +++++++++++++++++++++++ 2 files changed, 130 insertions(+)
Documentation/sound/hd-audio/index.rst +1 -0
@@ -8,3 +8,4 @@ HD-Audio models controls dp-mst + realtek-pc-beep
Documentation/sound/hd-audio/realtek-pc-beep.rst new file +129 -0
129 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 73/254 ALSA: hda: Add driver blacklist
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
commit 3c6fd1f07ed03a04debbb9a9d782205f1ef5e2ab upstream.
The recent AMD platform exposes an HD-audio bus but without any actual codecs, which is internally tied with a USB-audio device, supposedly. It results in "no codecs" error of HD-audio bus driver, and it's nothing but a waste of resources.
This patch introduces a static blacklist table for skipping such a known bogus PCI SSID entry. As of writing this patch, the known SSIDs are:
* 1043:874f - ASUS ROG Zenith II / Strix
* 1462:cb59 - MSI TRX40 Creator
* 1462:cb60 - MSI TRX40
--- sound/pci/hda/hda_intel.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
sound/pci/hda/hda_intel.c +16 -0
@@ -2076,6 +2076,17 @@ static void pcm_mmap_prepare(struct snd_#endif } +/* Blacklist for skipping the whole probe: +* some HD-audio PCI entries are exposed without any codecs, and such devices +* should be ignored from the beginning. +*/ +static const struct snd_pci_quirk driver_blacklist[] = { +SND_PCI_QUIRK (0x1043 ,0x874f ,"ASUS ROG Zenith II / Strix" ,0 ), +SND_PCI_QUIRK (0x1462 ,0xcb59 ,"MSI TRX40 Creator" ,0 ), +SND_PCI_QUIRK (0x1462 ,0xcb60 ,"MSI TRX40" ,0 ), + {} +}; +static const struct hda_controller_ops pci_hda_ops = { .disable_msi_reset_irq = disable_msi_reset_irq, .pcm_mmap_prepare = pcm_mmap_prepare,
@@ -2092,6 +2103,11 @@ static int azx_probe(struct pci_dev *pcibool schedule_probe;int err; +if (snd_pci_quirk_lookup (pci, driver_blacklist)) { +dev_info (&pci->dev,"Skipping the blacklisted device\n" ); +return -ENODEV ; + } +if (dev >=SNDRV_CARDS )return -ENODEV ;if (!enable[dev]) {
Greg Kroah-Hartman
maintainerPATCH 54/254 usb: dwc3: core: add support for disabling SS instances in park mode
In reply to Greg Kroah-HartmanFrom: Neil Armstrong <[email protected]>
[ Upstream commit 7ba6b09fda5e0cb741ee56f3264665e0edc64822 ]
In certain circumstances, the XHCI SuperSpeed instance in park mode can fail to recover, thus on Amlogic G12A/G12B/SM1 SoCs when there is high load on the single XHCI SuperSpeed instance, the controller can crash like:
xhci-hcd xhci-hcd.0.auto: xHCI host not responding to stop endpoint command. xhci-hcd xhci-hcd.0.auto: Host halt failed, -110
xhci-hcd xhci-hcd.0.auto: xHCI host controller not responding, assume dead xhci-hcd xhci-hcd.0.auto: xHCI host not responding to stop endpoint command. hub 2-1.1:1.0: hub_ext_port_status failed (err = -22)
xhci-hcd xhci-hcd.0.auto: HC died; cleaning up
usb 2-1.1-port1: cannot reset (err = -22)
Setting the PARKMODE_DISABLE_SS bit in the DWC3_USB3_GUCTL1 mitigates the issue. The bit is described as :
"When this bit is set to '1' all SS bus instances in park mode are disabled"
Synopsys explains:
The GUCTL1.PARKMODE_DISABLE_SS is only available in dwc_usb3 controller running in host mode.
This should not be set for other IPs.
This can be disabled by default based on IP, but I recommend to have a property to enable this feature for devices that need this.
--- drivers/usb/dwc3/core.c | 5 +++++ drivers/usb/dwc3/core.h | 4 ++++ 2 files changed, 9 insertions(+)
drivers/usb/dwc3/core.c +5 -0
@@ -1029,6 +1029,9 @@ static int dwc3_core_init(struct dwc3 *dwc)if (dwc->dis_tx_ipgap_linecheck_quirk) reg |=DWC3_GUCTL1_TX_IPGAP_LINECHECK_DIS ; +if (dwc->parkmode_disable_ss_quirk) + reg |=DWC3_GUCTL1_PARKMODE_DISABLE_SS ; +dwc3_writel (dwc->regs,DWC3_GUCTL1 , reg); }
@@ -1342,6 +1345,8 @@ static void dwc3_get_properties(struct dwc3 *dwc) "snps,dis-del-phy-power-chg-quirk"); dwc->dis_tx_ipgap_linecheck_quirk =device_property_read_bool (dev,"snps,dis-tx-ipgap-linecheck-quirk" ); + dwc->parkmode_disable_ss_quirk =device_property_read_bool (dev, +"snps,parkmode-disable-ss-quirk" ); dwc->tx_de_emphasis_quirk =device_property_read_bool (dev,"snps,tx_de_emphasis_quirk" );
drivers/usb/dwc3/core.h +4 -0
@@ -249,6 +249,7 @@#define DWC3_GUCTL_HSTINAUTORETRY BIT(14)/* Global User Control 1 Register */ +#define DWC3_GUCTL1_PARKMODE_DISABLE_SS BIT(17)#define DWC3_GUCTL1_TX_IPGAP_LINECHECK_DIS BIT(28)#define DWC3_GUCTL1_DEV_L1_EXIT_BY_HW BIT(24)
@@ -1024,6 +1025,8 @@ struct dwc3_scratchpad_array {* change quirk. * @dis_tx_ipgap_linecheck_quirk: set if we disable u2mac linestate * check during HS transmit. +* @parkmode_disable_ss_quirk: set if we need to disable all SuperSpeed +* instances in park mode. * @tx_de_emphasis_quirk: set if we enable Tx de-emphasis quirk * @tx_de_emphasis: Tx de-emphasis value * 0 - -6dB de-emphasis
@@ -1215,6 +1218,7 @@ struct dwc3 { unsigned dis_u2_freeclk_exists_quirk:1; unsigned dis_del_phy_power_chg_quirk:1; unsigned dis_tx_ipgap_linecheck_quirk:1; + unsigned parkmode_disable_ss_quirk:1; unsigned tx_de_emphasis_quirk:1; unsigned tx_de_emphasis:2;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 71/254 usb: gadget: composite: Inform controller driver of self-powered
In reply to Greg Kroah-HartmanFrom: Thinh Nguyen <[email protected]>
commit 5e5caf4fa8d3039140b4548b6ab23dd17fce9b2c upstream.
Different configuration/condition may draw different power. Inform the controller driver of the change so it can respond properly (e.g. GET_STATUS request). This fixes an issue with setting MaxPower from configfs. The composite driver doesn't check this value when setting self-powered.
--- drivers/usb/gadget/composite.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/usb/gadget/composite.c +9 -0
@@ -861,6 +861,11 @@ static int set_config(struct usb_composielse power =min (power,900U ); done: +if (power <=USB_SELF_POWER_VBUS_MAX_DRAW ) +usb_gadget_set_selfpowered (gadget); +else +usb_gadget_clear_selfpowered (gadget); +usb_gadget_vbus_draw (gadget, power);if (result >=0 && cdev->delayed_status) result =USB_GADGET_DELAYED_STATUS ;
@@ -2279,6 +2284,7 @@ void composite_suspend(struct usb_gadget cdev->suspended =1 ; +usb_gadget_set_selfpowered (gadget);usb_gadget_vbus_draw (gadget,2 ); }
@@ -2307,6 +2313,9 @@ void composite_resume(struct usb_gadgetelse maxpower =min (maxpower,900U ); +if (maxpower >USB_SELF_POWER_VBUS_MAX_DRAW ) +usb_gadget_clear_selfpowered (gadget); +usb_gadget_vbus_draw (gadget, maxpower); }
Greg Kroah-Hartman
maintainerPATCH 70/254 usb: gadget: f_fs: Fix use after free issue as part of queue failure
In reply to Greg Kroah-HartmanFrom: Sriharsha Allenki <[email protected]>
commit f63ec55ff904b2f2e126884fcad93175f16ab4bb upstream.
In AIO case, the request is freed up if ep_queue fails. However, io_data->req still has the reference to this freed request. In the case of this failure if there is aio_cancel call on this io_data it will lead to an invalid dequeue operation and a potential use after free issue.
Fix this by setting the io_data->req to NULL when the request is freed as part of queue failure.
--- drivers/usb/gadget/function/f_fs.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/gadget/function/f_fs.c +1 -0
@@ -1120,6 +1120,7 @@ static ssize_t ffs_epfile_io(struct file ret =usb_ep_queue (ep->ep, req,GFP_ATOMIC );if (unlikely (ret)) { + io_data->req =NULL ;usb_ep_free_request (ep->ep, req); goto error_lock; }
Greg Kroah-Hartman
maintainerPATCH 68/254 ASoC: dpcm: allow start or stop during pause for backend
In reply to Greg Kroah-HartmanFrom: 이경택 <[email protected]>
commit 21fca8bdbb64df1297e8c65a746c4c9f4a689751 upstream.
soc_compr_trigger_fe() allows start or stop after pause_push. In dpcm_be_dai_trigger(), however, only pause_release is allowed command after pause_push.
So, start or stop after pause in compress offload is always returned as error if the compress offload is used with dpcm. To fix the problem, SND_SOC_DPCM_STATE_PAUSED should be allowed for start or stop command.
--- sound/soc/soc-pcm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
sound/soc/soc-pcm.c +4 -2
@@ -2236,7 +2236,8 @@ int dpcm_be_dai_trigger(struct snd_soc_pswitch (cmd) {case SNDRV_PCM_TRIGGER_START :if ((be->dpcm[stream].state !=SND_SOC_DPCM_STATE_PREPARE ) && - (be->dpcm[stream].state !=SND_SOC_DPCM_STATE_STOP )) + (be->dpcm[stream].state !=SND_SOC_DPCM_STATE_STOP ) && + (be->dpcm[stream].state !=SND_SOC_DPCM_STATE_PAUSED ))continue ; ret =dpcm_do_trigger (dpcm, be_substream, cmd);
@@ -2266,7 +2267,8 @@ int dpcm_be_dai_trigger(struct snd_soc_p be->dpcm[stream].state =SND_SOC_DPCM_STATE_START ;break ;case SNDRV_PCM_TRIGGER_STOP : -if (be->dpcm[stream].state !=SND_SOC_DPCM_STATE_START ) +if ((be->dpcm[stream].state !=SND_SOC_DPCM_STATE_START ) && + (be->dpcm[stream].state !=SND_SOC_DPCM_STATE_PAUSED ))continue ;if (!snd_soc_dpcm_can_be_free_stop (fe, be, stream))
Greg Kroah-Hartman
maintainerPATCH 66/254 ASoC: fix regwmask
In reply to Greg Kroah-HartmanFrom: 이경택 <[email protected]>
commit 0ab070917afdc93670c2d0ea02ab6defb6246a7c upstream.
If regwshift is 32 and the selected architecture compiles '<<' operator for signed int literal into rotating shift, '1<<regwshift' became 1 and it makes regwmask to 0x0.
The literal is set to unsigned long to get intended regwmask.
--- sound/soc/soc-ops.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/soc-ops.c +2 -2
@@ -825,7 +825,7 @@ int snd_soc_get_xr_sx(struct snd_kcontrounsigned int regbase = mc->regbase;unsigned int regcount = mc->regcount;unsigned int regwshift = component->val_bytes *BITS_PER_BYTE ; -unsigned int regwmask = (1 <<regwshift)-1 ; +unsigned int regwmask = (1UL <<regwshift)-1 ;unsigned int invert = mc->invert;unsigned long mask = (1UL <<mc->nbits)-1 ;long min = mc->min;
@@ -874,7 +874,7 @@ int snd_soc_put_xr_sx(struct snd_kcontrounsigned int regbase = mc->regbase;unsigned int regcount = mc->regcount;unsigned int regwshift = component->val_bytes *BITS_PER_BYTE ; -unsigned int regwmask = (1 <<regwshift)-1 ; +unsigned int regwmask = (1UL <<regwshift)-1 ;unsigned int invert = mc->invert;unsigned long mask = (1UL <<mc->nbits)-1 ;long max = mc->max;
Greg Kroah-Hartman
maintainerPATCH 69/254 ASoC: topology: use name_prefix for new kcontrol
In reply to Greg Kroah-HartmanFrom: 이경택 <[email protected]>
commit abca9e4a04fbe9c6df4d48ca7517e1611812af25 upstream.
Current topology doesn't add prefix of component to new kcontrol.
--- sound/soc/soc-topology.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/soc-topology.c +1 -1
@@ -362,7 +362,7 @@ static int soc_tplg_add_kcontrol(structstruct snd_soc_component *comp = tplg->comp;return soc_tplg_add_dcontrol (comp->card->snd_card, - comp->dev, k,NULL , comp, kcontrol); + comp->dev, k, comp->name_prefix, comp, kcontrol); }/* remove a mixer kcontrol */
Greg Kroah-Hartman
maintainerPATCH 65/254 btrfs: track reloc roots based on their commit root bytenr
In reply to Greg Kroah-HartmanFrom: Josef Bacik <[email protected]>
[ Upstream commit ea287ab157c2816bf12aad4cece41372f9d146b4 ]
We always search the commit root of the extent tree for looking up back references, however we track the reloc roots based on their current bytenr.
This is wrong, if we commit the transaction between relocating tree blocks we could end up in this code in build_backref_tree
if (key.objectid == key.offset) {
/*
* Only root blocks of reloc trees use backref
* pointing to itself.
*/
root = find_reloc_root(rc, cur->bytenr);
ASSERT(root);
cur->root = root;
break;}
find_reloc_root() is looking based on the bytenr we had in the commit root, but if we've COWed this reloc root we will not find that bytenr, and we will trip over the ASSERT(root).
Fix this by using the commit_root->start bytenr for indexing the commit root. Then we change the __update_reloc_root() caller to be used when we switch the commit root for the reloc root during commit.
This fixes the panic I was seeing when we started throttling relocation for delayed refs.
--- fs/btrfs/relocation.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-)
fs/btrfs/relocation.c +7 -10
@@ -1298,7 +1298,7 @@ static int __must_check __add_reloc_root(struct btrfs_root *root)if (!node)return -ENOMEM ; - node->bytenr = root->node->start; + node->bytenr = root->commit_root->start; node->data = root;spin_lock (&rc->reloc_root_tree.lock);
@@ -1329,10 +1329,11 @@ static void __del_reloc_root(struct btrfs_root *root)if (rc && root->node) {spin_lock (&rc->reloc_root_tree.lock); rb_node =tree_search (&rc->reloc_root_tree.rb_root, - root->node->start); + root->commit_root->start);if (rb_node) { node = rb_entry(rb_node, struct mapping_node, rb_node);rb_erase (&node->rb_node, &rc->reloc_root_tree.rb_root); +RB_CLEAR_NODE (&node->rb_node); }spin_unlock (&rc->reloc_root_tree.lock);if (!node)
@@ -1350,7 +1351,7 @@ static void __del_reloc_root(struct btrfs_root *root)* helper to update the 'address of tree root -> reloc tree' * mapping */ -static int __update_reloc_root (struct btrfs_root *root,u64 new_bytenr) +static int __update_reloc_root (struct btrfs_root *root) {struct btrfs_fs_info *fs_info = root->fs_info;struct rb_node *rb_node;
@@ -1359,7 +1360,7 @@ static int __update_reloc_root(struct btrfs_root *root, u64 new_bytenr)spin_lock (&rc->reloc_root_tree.lock); rb_node =tree_search (&rc->reloc_root_tree.rb_root, - root->node->start); + root->commit_root->start);if (rb_node) { node = rb_entry(rb_node, struct mapping_node, rb_node);rb_erase (&node->rb_node, &rc->reloc_root_tree.rb_root);
@@ -1371,7 +1372,7 @@ static int __update_reloc_root(struct btrfs_root *root, u64 new_bytenr)BUG_ON ((struct btrfs_root *)node->data != root);spin_lock (&rc->reloc_root_tree.lock); - node->bytenr = new_bytenr; + node->bytenr = root->node->start; rb_node =tree_insert (&rc->reloc_root_tree.rb_root, node->bytenr, &node->rb_node);spin_unlock (&rc->reloc_root_tree.lock);
@@ -1529,6 +1530,7 @@ int btrfs_update_reloc_root(struct btrfs_trans_handle *trans, }if (reloc_root->commit_root != reloc_root->node) { +__update_reloc_root (reloc_root);btrfs_set_root_node (root_item, reloc_root->node);free_extent_buffer (reloc_root->commit_root); reloc_root->commit_root =btrfs_root_node (reloc_root);
@@ -4727,11 +4729,6 @@ int btrfs_reloc_cow_block(struct btrfs_trans_handle *trans,BUG_ON (rc->stage ==UPDATE_DATA_PTRS && root->root_key.objectid ==BTRFS_DATA_RELOC_TREE_OBJECTID ); -if (root->root_key.objectid ==BTRFS_TREE_RELOC_OBJECTID ) { -if (buf == root->node) -__update_reloc_root (root, cow->start); - } - level =btrfs_header_level (buf);if (btrfs_header_generation (buf) <=btrfs_root_last_snapshot (&root->root_item))
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 64/254 btrfs: restart relocate_tree_blocks properly
In reply to Greg Kroah-HartmanFrom: Josef Bacik <[email protected]>
[ Upstream commit 50dbbb71c79df89532ec41d118d59386e5a877e3 ]
There are two bugs here, but fixing them independently would just result in pain if you happened to bisect between the two patches.
First is how we handle the -EAGAIN from relocate_tree_block(). We don't set error, unless we happen to be the first node, which makes no sense, I have no idea what the code was trying to accomplish here.
We in fact _do_ want err set here so that we know we need to restart in relocate_block_group(). Also we need finish_pending_nodes() to not actually call link_to_upper(), because we didn't actually relocate the block.
And then if we do get -EAGAIN we do not want to set our backref cache last_trans to the one before ours. This would force us to update our backref cache if we didn't cross transaction ids, which would mean we'd have some nodes updated to their new_bytenr, but still able to find their old bytenr because we're searching the same commit root as the last time we went through relocate_tree_blocks.
Fixing these two things keeps us from panicing when we start breaking out of relocate_tree_blocks() either for delayed ref flushing or enospc.
--- fs/btrfs/relocation.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-)
fs/btrfs/relocation.c +2 -9
@@ -3175,9 +3175,8 @@ int relocate_tree_blocks(struct btrfs_trans_handle *trans, ret =relocate_tree_block (trans, rc, node, &block->key, path);if (ret <0 ) { -if (ret != -EAGAIN || &block->rb_node ==rb_first (blocks)) - err = ret; - goto out; + err = ret; +break ; } } out:
@@ -4151,12 +4150,6 @@ restart:if (!RB_EMPTY_ROOT (&blocks)) { ret =relocate_tree_blocks (trans, rc, &blocks);if (ret <0 ) { -/* -* if we fail to relocate tree blocks, force to update -* backref cache when committing transaction. -*/ - rc->backref_cache.last_trans = trans->transid -1 ; -if (ret != -EAGAIN ) { err = ret;break ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 53/254 media: i2c: ov5695: Fix power on and off sequences
In reply to Greg Kroah-HartmanFrom: Dongchun Zhu <[email protected]>
[ Upstream commit f1a64f56663e9d03e509439016dcbddd0166b2da ]
Quoted 1 line
From the measured hardware signal, OV5695 reset pin goes high for a
short period of time during boot-up. From the sensor specification, the reset pin is active low and the DT binding defines the pin as active low, which means that the values set by the driver are inverted and thus the value requested in probe ends up high.
Fix it by changing probe to request the reset GPIO initialized to high, which makes the initial state of the physical signal low.
In addition, DOVDD rising must occur before DVDD rising from spec., but regulator_bulk_enable() API enables all the regulators asynchronously. Use an explicit loops of regulator_enable() instead.
For power off sequence, it is required that DVDD falls first. Given the bulk API does not give any guarantee about the order of regulators, change the driver to use regulator_disable() instead.
The sensor also requires a delay between reset high and first I2C transaction, which was assumed to be 8192 XVCLK cycles, but 1ms is recommended by the vendor. Fix this as well.
--- drivers/media/i2c/ov5695.c | 49 ++++++++++++++++++++++++-------------- 1 file changed, 31 insertions(+), 18 deletions(-)
drivers/media/i2c/ov5695.c +31 -18
@@ -971,16 +971,9 @@ unlock_and_return:return ret; } -/* Calculate the delay in us by clock rate and clock cycles */ -static inline u32 ov5695_cal_delay (u32 cycles) -{ -return DIV_ROUND_UP (cycles,OV5695_XVCLK_FREQ /1000 /1000 ); -} -static int __ov5695_power_on (struct ov5695 *ov5695) { -int ret; -u32 delay_us; +int i, ret;struct device *dev = &ov5695->client->dev; ret =clk_prepare_enable (ov5695->xvclk);
@@ -991,21 +984,28 @@ static int __ov5695_power_on(struct ov5695 *ov5695)gpiod_set_value_cansleep (ov5695->reset_gpio,1 ); - ret =regulator_bulk_enable (OV5695_NUM_SUPPLIES , ov5695->supplies); -if (ret <0 ) { -dev_err (dev,"Failed to enable regulators\n" ); - goto disable_clk; +/* +* The hardware requires the regulators to be powered on in order, +* so enable them one by one. +*/ +for (i =0 ; i <OV5695_NUM_SUPPLIES ; i++) { + ret =regulator_enable (ov5695->supplies[i].consumer); +if (ret) { +dev_err (dev,"Failed to enable %s: %d\n" , + ov5695->supplies[i].supply, ret); + goto disable_reg_clk; + } }gpiod_set_value_cansleep (ov5695->reset_gpio,0 ); -/* 8192 cycles prior to first SCCB transaction */ - delay_us =ov5695_cal_delay (8192 ); -usleep_range (delay_us, delay_us *2 ); +usleep_range (1000 ,1200 );return 0 ; -disable_clk: +disable_reg_clk: +for (--i; i >=0 ; i--) +regulator_disable (ov5695->supplies[i].consumer);clk_disable_unprepare (ov5695->xvclk);return ret;
@@ -1013,9 +1013,22 @@ disable_clk:static void __ov5695_power_off (struct ov5695 *ov5695) { +struct device *dev = &ov5695->client->dev; +int i, ret; +clk_disable_unprepare (ov5695->xvclk);gpiod_set_value_cansleep (ov5695->reset_gpio,1 ); -regulator_bulk_disable (OV5695_NUM_SUPPLIES , ov5695->supplies); + +/* +* The hardware requires the regulators to be powered off in order, +* so disable them one by one. +*/ +for (i =OV5695_NUM_SUPPLIES -1 ; i >=0 ; i--) { + ret =regulator_disable (ov5695->supplies[i].consumer); +if (ret) +dev_err (dev,"Failed to disable %s: %d\n" , + ov5695->supplies[i].supply, ret); + } }static int __maybe_unused ov5695_runtime_resume (struct device *dev)
@@ -1285,7 +1298,7 @@ static int ov5695_probe(struct i2c_client *client,if (clk_get_rate (ov5695->xvclk) !=OV5695_XVCLK_FREQ )dev_warn (dev,"xvclk mismatched, modes are based on 24MHz\n" ); - ov5695->reset_gpio =devm_gpiod_get (dev,"reset" ,GPIOD_OUT_LOW ); + ov5695->reset_gpio =devm_gpiod_get (dev,"reset" ,GPIOD_OUT_HIGH );if (IS_ERR (ov5695->reset_gpio)) {dev_err (dev,"Failed to get reset-gpios\n" );return -EINVAL ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 8/254 media: staging: rkisp1: use consistent bus_info string for media_dev
In reply to Greg Kroah-HartmanFrom: Helen Koike <[email protected]>
[ Upstream commit 12d3d8090bc5e8cdda2f56caed2a2a0d70009456 ]
Media device is using a slightly different bus_info string "platform: rkisp1" (with a space) instead of "platform:rkisp1" used by the rest of rkisp1 code.
This causes errors when using v4l2-util tools that uses the bus_info string to identify the device.
--- drivers/staging/media/rkisp1/rkisp1-dev.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/staging/media/rkisp1/rkisp1-dev.c +1 -2
@@ -502,8 +502,7 @@ static int rkisp1_probe(struct platform_device *pdev)strscpy (rkisp1->media_dev.model,RKISP1_DRIVER_NAME ,sizeof (rkisp1->media_dev.model)); rkisp1->media_dev.dev = &pdev->dev; -strscpy (rkisp1->media_dev.bus_info, -"platform: " RKISP1_DRIVER_NAME , +strscpy (rkisp1->media_dev.bus_info,RKISP1_BUS_INFO ,sizeof (rkisp1->media_dev.bus_info));media_device_init (&rkisp1->media_dev);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 16/254 iio: imu: st_lsm6dsx: check return value from st_lsm6dsx_sensor_set_enable
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit f20dbe11e2e904547597ae7371c1f635e3be9cad ]
Add missing return value check in st_lsm6dsx_shub_read_oneshot disabling the slave device connected to the st_lsm6dsx i2c controller. The issue is reported by coverity with the following error:
Unchecked return value:
If the function returns an error value, the error value may be mistaken for a normal value.
Addresses-Coverity-ID: 1456767 ("Unchecked return value")
--- drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c +3 -2
@@ -464,9 +464,10 @@ st_lsm6dsx_shub_read_oneshot(struct st_lsm6dsx_sensor *sensor, len =min_t (int,sizeof (data), ch->scan_type.realbits >>3 ); err =st_lsm6dsx_shub_read (sensor, ch->address, data, len); +if (err <0 ) +return err; -st_lsm6dsx_shub_set_enable (sensor, false); - + err =st_lsm6dsx_shub_set_enable (sensor, false);if (err <0 )return err;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 13/254 usb: phy: tegra: Include proper GPIO consumer header to fix compile testing
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit 9cb9322a26ae84424c3e16e58617b3d8962fdbbb ]
The driver uses only GPIO Descriptor Consumer Interface so include proper header. This fixes compile test failures (e.g. on i386):
drivers/usb/phy/phy-tegra-usb.c: In function ‘ulpi_phy_power_on’:
drivers/usb/phy/phy-tegra-usb.c:695:2: error:
implicit declaration of function ‘gpiod_set_value_cansleep’ [-Werror=implicit-function-declaration]
drivers/usb/phy/phy-tegra-usb.c: In function ‘tegra_usb_phy_probe’:
drivers/usb/phy/phy-tegra-usb.c:1167:11: error:
implicit declaration of function ‘devm_gpiod_get_from_of_node’ [-Werror=implicit-function-declaration]
--- drivers/usb/phy/phy-tegra-usb.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/usb/phy/phy-tegra-usb.c +1 -2
@@ -12,12 +12,11 @@#include <linux/delay.h> #include <linux/err.h> #include <linux/export.h> -#include <linux/gpio.h> +#include <linux/gpio/consumer.h> #include <linux/iopoll.h> #include <linux/module.h> #include <linux/of.h> #include <linux/of_device.h> -#include <linux/of_gpio.h> #include <linux/platform_device.h> #include <linux/resource.h> #include <linux/slab.h>
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 51/254 block, zoned: fix integer overflow with BLKRESETZONE et al
In reply to Greg Kroah-HartmanFrom: Alexey Dobriyan <[email protected]>
[ Upstream commit 11bde986002c0af67eb92d73321d06baefae7128 ]
Check for overflow in addition before checking for end-of-block-device.
Steps to reproduce:
#define _GNU_SOURCE 1
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
typedef unsigned long long __u64;
struct blk_zone_range {
__u64 sector;
__u64 nr_sectors;
};
#define BLKRESETZONE _IOW(0x12, 131, struct blk_zone_range)
int main(void)
{
int fd = open("/dev/nullb0", O_RDWR|O_DIRECT);
struct blk_zone_range zr = {4096, 0xfffffffffffff000ULL};
ioctl(fd, BLKRESETZONE, &zr);
return 0;
}BUG: KASAN: null-ptr-deref in submit_bio_wait+0x74/0xe0 Write of size 8 at addr 0000000000000040 by task a.out/1590 CPU: 8 PID: 1590 Comm: a.out Not tainted 5.6.0-rc1-00019-g359c92c02bfa #2 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS ?-20190711_202441-buildvm-armv7-10.arm.fedoraproject.org-2.fc31 04/01/2014 Call Trace: dump_stack+0x76/0xa0 __kasan_report.cold+0x5/0x3e kasan_report+0xe/0x20 submit_bio_wait+0x74/0xe0 blkdev_zone_mgmt+0x26f/0x2a0 blkdev_zone_mgmt_ioctl+0x14b/0x1b0 blkdev_ioctl+0xb28/0xe60 block_ioctl+0x69/0x80 ksys_ioctl+0x3af/0xa50
--- block/blk-zoned.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
block/blk-zoned.c +1 -1
@@ -173,7 +173,7 @@ int blkdev_zone_mgmt(struct block_device *bdev, enum req_opf op,if (!op_is_zone_mgmt (op))return -EOPNOTSUPP ; -if (!nr_sectors || end_sector > capacity) +if (end_sector <= sector || end_sector > capacity)/* Out of range */ return -EINVAL ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 46/254 cpufreq: imx6q: fix error handling
In reply to Greg Kroah-HartmanFrom: Peng Fan <[email protected]>
[ Upstream commit 3646f50a3838c5949a89ecbdb868497cdc05b8fd ]
When speed checking failed, direclty jumping to put_node label is not correct. Need jump to out_free_opp to avoid resources leak.
--- drivers/cpufreq/imx6q-cpufreq.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/cpufreq/imx6q-cpufreq.c +5 -4
@@ -381,23 +381,24 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev) goto put_reg; } +/* Because we have added the OPPs here, we must free them */ + free_opp = true; +if (of_machine_is_compatible ("fsl,imx6ul" ) ||of_machine_is_compatible ("fsl,imx6ull" )) { ret =imx6ul_opp_check_speed_grading (cpu_dev);if (ret) {if (ret == -EPROBE_DEFER ) - goto put_node; + goto out_free_opp;dev_err (cpu_dev,"failed to read ocotp: %d\n" , ret); - goto put_node; + goto out_free_opp; } }else {imx6q_opp_check_speed_grading (cpu_dev); } -/* Because we have added the OPPs here, we must free them */ - free_opp = true; num =dev_pm_opp_get_opp_count (cpu_dev);if (num <0 ) { ret = num;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 50/254 block: Fix use-after-free issue accessing struct io_cq
In reply to Greg Kroah-HartmanFrom: Sahitya Tummala <[email protected]>
[ Upstream commit 30a2da7b7e225ef6c87a660419ea04d3cef3f6a7 ]
There is a potential race between ioc_release_fn() and ioc_clear_queue() as shown below, due to which below kernel crash is observed. It also can result into use-after-free issue.
context#1: context#2:ioc_release_fn() __ioc_clear_queue() gets the same icq
->spin_lock(&ioc->lock); ->spin_lock(&ioc->lock);
->ioc_destroy_icq(icq);
->list_del_init(&icq->q_node);
->call_rcu(&icq->__rcu_head,
icq_free_icq_rcu);
->spin_unlock(&ioc->lock); ->ioc_destroy_icq(icq); ->hlist_del_init(&icq->ioc_node); This results into below crash as this memory is now used by icq->__rcu_head in context#1. There is a chance that icq could be free'd as well.
22150.386550: <6> Unable to handle kernel write to read-only memory
at virtual address ffffffaa8d31ca50
...
Call trace: 22150.607350: <2> ioc_destroy_icq+0x44/0x110 22150.611202: <2> ioc_clear_queue+0xac/0x148 22150.615056: <2> blk_cleanup_queue+0x11c/0x1a0 22150.619174: <2> __scsi_remove_device+0xdc/0x128 22150.623465: <2> scsi_forget_host+0x2c/0x78 22150.627315: <2> scsi_remove_host+0x7c/0x2a0 22150.631257: <2> usb_stor_disconnect+0x74/0xc8 22150.635371: <2> usb_unbind_interface+0xc8/0x278 22150.639665: <2> device_release_driver_internal+0x198/0x250 22150.644897: <2> device_release_driver+0x24/0x30 22150.649176: <2> bus_remove_device+0xec/0x140 22150.653204: <2> device_del+0x270/0x460 22150.656712: <2> usb_disable_device+0x120/0x390 22150.660918: <2> usb_disconnect+0xf4/0x2e0 22150.664684: <2> hub_event+0xd70/0x17e8 22150.668197: <2> process_one_work+0x210/0x480 22150.672222: <2> worker_thread+0x32c/0x4c8
Fix this by adding a new ICQ_DESTROYED flag in ioc_destroy_icq() to indicate this icq is once marked as destroyed. Also, ensure __ioc_clear_queue() is accessing icq within rcu_read_lock/unlock so that icq doesn't get free'd up while it is still using it.
--- block/blk-ioc.c | 7 +++++++ include/linux/iocontext.h | 1 + 2 files changed, 8 insertions(+)
block/blk-ioc.c +7 -0
@@ -84,6 +84,7 @@ static void ioc_destroy_icq(struct io_cq *icq)* making it impossible to determine icq_cache. Record it in @icq. */ icq->__rcu_icq_cache = et->icq_cache; + icq->flags |=ICQ_DESTROYED ;call_rcu (&icq->__rcu_head, icq_free_icq_rcu); }
@@ -212,15 +213,21 @@ static void __ioc_clear_queue(struct list_head *icq_list) {unsigned long flags; +rcu_read_lock ();while (!list_empty (icq_list)) {struct io_cq *icq =list_entry (icq_list->next, struct io_cq, q_node);struct io_context *ioc = icq->ioc;spin_lock_irqsave (&ioc->lock, flags); +if (icq->flags &ICQ_DESTROYED ) { +spin_unlock_irqrestore (&ioc->lock, flags); +continue ; + }ioc_destroy_icq (icq);spin_unlock_irqrestore (&ioc->lock, flags); } +rcu_read_unlock (); }/**
include/linux/iocontext.h +1 -0
@@ -8,6 +8,7 @@enum {ICQ_EXITED =1 <<2 , +ICQ_DESTROYED =1 <<3 , };/*
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 47/254 x86/boot: Use unsigned comparison for addresses
In reply to Greg Kroah-HartmanFrom: Arvind Sankar <[email protected]>
[ Upstream commit 81a34892c2c7c809f9c4e22c5ac936ae673fb9a2 ]
The load address is compared with LOAD_PHYSICAL_ADDR using a signed comparison currently (using jge instruction).
When loading a 64-bit kernel using the new efi32_pe_entry() point added by:
97aa276579b2 ("efi/x86: Add true mixed mode entry point into .compat section")
using Qemu with -m 3072, the firmware actually loads us above 2Gb, resulting in a very early crash.
Use the JAE instruction to perform a unsigned comparison instead, as physical addresses should be considered unsigned.
--- arch/x86/boot/compressed/head_32.S | 2 +- arch/x86/boot/compressed/head_64.S | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
arch/x86/boot/compressed/head_32.S +1 -1
@@ -106,7 +106,7 @@ SYM_FUNC_START(startup_32) notl %eax andl %eax, %ebx cmpl $LOAD_PHYSICAL_ADDR, %ebx - jge 1f + jae 1f #endif movl $LOAD_PHYSICAL_ADDR, %ebx 1:
arch/x86/boot/compressed/head_64.S +2 -2
@@ -106,7 +106,7 @@ SYM_FUNC_START(startup_32) notl %eax andl %eax, %ebx cmpl $LOAD_PHYSICAL_ADDR, %ebx - jge 1f + jae 1f #endif movl $LOAD_PHYSICAL_ADDR, %ebx 1:
@@ -296,7 +296,7 @@ SYM_CODE_START(startup_64) notq %rax andq %rax, %rbp cmpq $LOAD_PHYSICAL_ADDR, %rbp - jge 1f + jae 1f #endif movq $LOAD_PHYSICAL_ADDR, %rbp 1:
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 49/254 genirq/irqdomain: Check pointer in irq_domain_alloc_irqs_hierarchy()
In reply to Greg Kroah-HartmanFrom: Alexander Sverdlin <[email protected]>
[ Upstream commit 87f2d1c662fa1761359fdf558246f97e484d177a ]
irq_domain_alloc_irqs_hierarchy() has 3 call sites in the compilation unit but only one of them checks for the pointer which is being dereferenced inside the called function. Move the check into the function. This allows for catching the error instead of the following crash:
Unable to handle kernel NULL pointer dereference at virtual address 00000000
PC is at 0x0
LR is at gpiochip_hierarchy_irq_domain_alloc+0x11f/0x140
...
[<c06c23ff>] (gpiochip_hierarchy_irq_domain_alloc) [<c0462a89>] (__irq_domain_alloc_irqs) [<c0462dad>] (irq_create_fwspec_mapping) [<c06c2251>] (gpiochip_to_irq)
[<c06c1c9b>] (gpiod_to_irq)
[<bf973073>] (gpio_irqs_init [gpio_irqs]) [<bf974048>] (gpio_irqs_exit+0xecc/0xe84 [gpio_irqs])
Code: bad PC value
--- kernel/irq/irqdomain.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
kernel/irq/irqdomain.c +5 -5
@@ -1310,6 +1310,11 @@ int irq_domain_alloc_irqs_hierarchy(struct irq_domain *domain, unsigned int irq_base, unsigned int nr_irqs, void *arg) { + if (!domain->ops->alloc) { + pr_debug("domain->ops->alloc() is NULL\n"); +return -ENOSYS ; + } +return domain->ops->alloc (domain, irq_base, nr_irqs, arg); }
@@ -1347,11 +1352,6 @@ int __irq_domain_alloc_irqs(struct irq_domain *domain, int irq_base,return -EINVAL ; } -if (!domain->ops->alloc) { -pr_debug ("domain->ops->alloc() is NULL\n" ); -return -ENOSYS ; - } -if (realloc && irq_base >=0 ) { virq = irq_base; }else {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 44/254 gfs2: Do log_flush in gfs2_ail_empty_gl even if ail list is empty
In reply to Greg Kroah-HartmanFrom: Bob Peterson <[email protected]>
[ Upstream commit 9ff78289356af640941bbb0dd3f46af2063f0046 ]
Before this patch, if gfs2_ail_empty_gl saw there was nothing on the ail list, it would return and not flush the log. The problem is that there could still be a revoke for the rgrp sitting on the sd_log_le_revoke list that's been recently taken off the ail list. But that revoke still needs to be written, and the rgrp_go_inval still needs to call log_flush_wait to ensure the revokes are all properly written to the journal before we relinquish control of the glock to another node. If we give the glock to another node before we have this knowledge, the node might crash and its journal replayed, in which case the missing revoke would allow the journal replay to replay the rgrp over top of the rgrp we already gave to another node, thus overwriting its changes and corrupting the file system.
This patch makes gfs2_ail_empty_gl still call gfs2_log_flush rather than returning.
--- fs/gfs2/glops.c | 27 ++++++++++++++++++++++++++- fs/gfs2/log.c | 2 +- fs/gfs2/log.h | 1 + 3 files changed, 28 insertions(+), 2 deletions(-)
fs/gfs2/glops.c +26 -1
@@ -89,8 +89,32 @@ static void gfs2_ail_empty_gl(struct gfs2_glock *gl)INIT_LIST_HEAD (&tr.tr_databuf); tr.tr_revokes =atomic_read (&gl->gl_ail_count); -if (!tr.tr_revokes) +if (!tr.tr_revokes) { +bool have_revokes; +bool log_in_flight; + +/* +* We have nothing on the ail, but there could be revokes on +* the sdp revoke queue, in which case, we still want to flush +* the log and wait for it to finish. +* +* If the sdp revoke list is empty too, we might still have an +* io outstanding for writing revokes, so we should wait for +* it before returning. +* +* If none of these conditions are true, our revokes are all +* flushed and we can return. +*/ +gfs2_log_lock (sdp); + have_revokes = !list_empty (&sdp->sd_log_revokes); + log_in_flight =atomic_read (&sdp->sd_log_in_flight); +gfs2_log_unlock (sdp); +if (have_revokes) + goto flush; +if (log_in_flight) +log_flush_wait (sdp);return ; + }/* A shortened, inline version of gfs2_trans_begin() * tr->alloced is not set since the transaction structure is
@@ -105,6 +129,7 @@ static void gfs2_ail_empty_gl(struct gfs2_glock *gl)__gfs2_ail_flush (gl,0 , tr.tr_revokes);gfs2_trans_end (sdp); +flush:gfs2_log_flush (sdp,NULL ,GFS2_LOG_HEAD_FLUSH_NORMAL |GFS2_LFC_AIL_EMPTY_GL ); }
fs/gfs2/log.c +1 -1
@@ -512,7 +512,7 @@ static void log_pull_tail(struct gfs2_sbd *sdp, unsigned int new_tail) } -static void log_flush_wait (struct gfs2_sbd *sdp) +void log_flush_wait (struct gfs2_sbd *sdp) {DEFINE_WAIT (wait);
fs/gfs2/log.h +1 -0
@@ -73,6 +73,7 @@ extern void gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl, u32 type);extern void gfs2_log_commit (struct gfs2_sbd *sdp,struct gfs2_trans *trans);extern void gfs2_ail1_flush (struct gfs2_sbd *sdp,struct writeback_control *wbc); +extern void log_flush_wait (struct gfs2_sbd *sdp);extern int gfs2_logd (void *data);extern void gfs2_add_revoke (struct gfs2_sbd *sdp,struct gfs2_bufdata *bd);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 43/254 pstore/platform: fix potential mem leak if pstore_init_fs failed
In reply to Greg Kroah-HartmanFrom: chenqiwu <[email protected]>
[ Upstream commit 8a57d6d4ddfa41c49014e20493152c41a38fcbf8 ]
There is a potential mem leak when pstore_init_fs failed, since the pstore compression maybe unlikey to initialized successfully. We must clean up the allocation once this unlikey issue happens.
--- fs/pstore/platform.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/pstore/platform.c +2 -2
@@ -823,9 +823,9 @@ static int __init pstore_init(void) ret =pstore_init_fs ();if (ret) -return ret; +free_buf_for_compression (); -return 0 ; +return ret; }late_initcall (pstore_init);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 40/254 block, bfq: move forward the getting of an extra ref in bfq_bfqq_move
In reply to Greg Kroah-HartmanFrom: Paolo Valente <[email protected]>
[ Upstream commit fd1bb3ae54a9a2e0c42709de861c69aa146b8955 ]
Commit ecedd3d7e199 ("block, bfq: get extra ref to prevent a queue from being freed during a group move") gets an extra reference to a bfq_queue before possibly deactivating it (temporarily), in bfq_bfqq_move(). This prevents the bfq_queue from disappearing before being reactivated in its new group.
Yet, the bfq_queue may also be expired (i.e., its service may be stopped) before the bfq_queue is deactivated. And also an expiration may lead to a premature freeing. This commit fixes this issue by simply moving forward the getting of the extra reference already introduced by commit ecedd3d7e199 ("block, bfq: get extra ref to prevent a queue from being freed during a group move").
--- block/bfq-cgroup.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
block/bfq-cgroup.c +7 -7
@@ -642,6 +642,12 @@ void bfq_bfqq_move(struct bfq_data *bfqd, struct bfq_queue *bfqq, {struct bfq_entity *entity = &bfqq->entity; +/* +* Get extra reference to prevent bfqq from being freed in +* next possible expire or deactivate. +*/ + bfqq->ref++; +/* If bfqq is empty, then bfq_bfqq_expire also invokes * bfq_del_bfqq_busy, thereby removing bfqq and its entity * from data structures related to current group. Otherwise we
@@ -652,12 +658,6 @@ void bfq_bfqq_move(struct bfq_data *bfqd, struct bfq_queue *bfqq,bfq_bfqq_expire (bfqd, bfqd->in_service_queue, false,BFQQE_PREEMPTED ); -/* -* get extra reference to prevent bfqq from being freed in -* next possible deactivate -*/ - bfqq->ref++; -if (bfq_bfqq_busy (bfqq))bfq_deactivate_bfqq (bfqd, bfqq, false, false);else if (entity->on_st_or_in_serv)
@@ -677,7 +677,7 @@ void bfq_bfqq_move(struct bfq_data *bfqd, struct bfq_queue *bfqq,if (!bfqd->in_service_queue && !bfqd->rq_in_driver)bfq_schedule_dispatch (bfqd); -/* release extra ref taken above */ +/* release extra ref taken above, bfqq may happen to be freed now */ bfq_put_queue (bfqq); }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 42/254 libata: Remove extra scsi_host_put() in ata_scsi_add_hosts()
In reply to Greg Kroah-HartmanFrom: John Garry <[email protected]>
[ Upstream commit 1d72f7aec3595249dbb83291ccac041a2d676c57 ]
If the call to scsi_add_host_with_dma() in ata_scsi_add_hosts() fails, then we may get use-after-free KASAN warns:
==================================================================
BUG: KASAN: use-after-free in kobject_put+0x24/0x180 Read of size 1 at addr ffff0026b8c80364 by task swapper/0/1 CPU: 1 PID: 1 Comm: swapper/0 Tainted: G W 5.6.0-rc3-00004-g5a71b206ea82-dirty #1765 Hardware name: Huawei TaiShan 200 (Model 2280)/BC82AMDD, BIOS 2280-V2 CS V3.B160.01 02/24/2020 Call trace: dump_backtrace+0x0/0x298 show_stack+0x14/0x20 dump_stack+0x118/0x190 print_address_description.isra.9+0x6c/0x3b8 __kasan_report+0x134/0x23c kasan_report+0xc/0x18 __asan_load1+0x5c/0x68 kobject_put+0x24/0x180 put_device+0x10/0x20 scsi_host_put+0x10/0x18 ata_devres_release+0x74/0xb0 release_nodes+0x2d0/0x470 devres_release_all+0x50/0x78 really_probe+0x2d4/0x560 driver_probe_device+0x7c/0x148 device_driver_attach+0x94/0xa0 __driver_attach+0xa8/0x110 bus_for_each_dev+0xe8/0x158 driver_attach+0x30/0x40 bus_add_driver+0x220/0x2e0 driver_register+0xbc/0x1d0 __pci_register_driver+0xbc/0xd0 ahci_pci_driver_init+0x20/0x28 do_one_initcall+0xf0/0x608 kernel_init_freeable+0x31c/0x384 kernel_init+0x10/0x118 ret_from_fork+0x10/0x18 Allocated by task 5: save_stack+0x28/0xc8 __kasan_kmalloc.isra.8+0xbc/0xd8 kasan_kmalloc+0xc/0x18 __kmalloc+0x1a8/0x280 scsi_host_alloc+0x44/0x678 ata_scsi_add_hosts+0x74/0x268 ata_host_register+0x228/0x488 ahci_host_activate+0x1c4/0x2a8 ahci_init_one+0xd18/0x1298 local_pci_probe+0x74/0xf0 work_for_cpu_fn+0x2c/0x48 process_one_work+0x488/0xc08 worker_thread+0x330/0x5d0 kthread+0x1c8/0x1d0 ret_from_fork+0x10/0x18 Freed by task 5: save_stack+0x28/0xc8 __kasan_slab_free+0x118/0x180 kasan_slab_free+0x10/0x18 slab_free_freelist_hook+0xa4/0x1a0 kfree+0xd4/0x3a0 scsi_host_dev_release+0x100/0x148 device_release+0x7c/0xe0 kobject_put+0xb0/0x180 put_device+0x10/0x20 scsi_host_put+0x10/0x18 ata_scsi_add_hosts+0x210/0x268 ata_host_register+0x228/0x488 ahci_host_activate+0x1c4/0x2a8 ahci_init_one+0xd18/0x1298 local_pci_probe+0x74/0xf0 work_for_cpu_fn+0x2c/0x48 process_one_work+0x488/0xc08 worker_thread+0x330/0x5d0 kthread+0x1c8/0x1d0 ret_from_fork+0x10/0x18
There is also refcount issue, as well:
WARNING: CPU: 1 PID: 1 at lib/refcount.c:28 refcount_warn_saturate+0xf8/0x170
The issue is that we make an erroneous extra call to scsi_host_put() for that host:
So in ahci_init_one()->ata_host_alloc_pinfo()->ata_host_alloc(), we setup a device release method - ata_devres_release() - which intends to release the SCSI hosts:
static void ata_devres_release(struct device *gendev, void *res)
{
...
for (i = 0; i < host->n_ports; i++) {
struct ata_port *ap = host->ports[i];
if (!ap)
continue;
if (ap->scsi_host)
scsi_host_put(ap->scsi_host);
}
...
}However in the ata_scsi_add_hosts() error path, we also call scsi_host_put() for the SCSI hosts.
Fix by removing the the scsi_host_put() calls in ata_scsi_add_hosts() and leave this to ata_devres_release().
--- drivers/ata/libata-scsi.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/ata/libata-scsi.c +3 -6
@@ -4562,22 +4562,19 @@ int ata_scsi_add_hosts(struct ata_host *host, struct scsi_host_template *sht)*/ shost->max_host_blocked =1 ; - rc =scsi_add_host_with_dma (ap->scsi_host, - &ap->tdev, ap->host->dev); + rc =scsi_add_host_with_dma (shost, &ap->tdev, ap->host->dev);if (rc) - goto err_add; + goto err_alloc; }return 0 ; - err_add: -scsi_host_put (host->ports[i]->scsi_host); err_alloc:while (--i >=0 ) {struct Scsi_Host *shost = host->ports[i]->scsi_host; +/* scsi_host_put() is in ata_devres_release() */ scsi_remove_host (shost); -scsi_host_put (shost); }return rc; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 38/254 selftests/x86/ptrace_syscall_32: Fix no-vDSO segfault
In reply to Greg Kroah-HartmanFrom: Andy Lutomirski <[email protected]>
[ Upstream commit 630b99ab60aa972052a4202a1ff96c7e45eb0054 ]
If AT_SYSINFO is not present, don't try to call a NULL pointer.
--- tools/testing/selftests/x86/ptrace_syscall.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
tools/testing/selftests/x86/ptrace_syscall.c +6 -2
@@ -414,8 +414,12 @@ int main()#if defined(__i386__) && (!defined(__GLIBC__) || __GLIBC__ >2 || __GLIBC_MINOR__ >=16 ) vsyscall32 = (void *)getauxval (AT_SYSINFO ); -printf ("[RUN]\tCheck AT_SYSINFO return regs\n" ); -test_sys32_regs (do_full_vsyscall32); +if (vsyscall32) { +printf ("[RUN]\tCheck AT_SYSINFO return regs\n" ); +test_sys32_regs (do_full_vsyscall32); + }else { +printf ("[SKIP]\tAT_SYSINFO is not available\n" ); + }#endif test_ptrace_syscall_restart ();
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 37/254 sched/fair: Fix condition of avg_load calculation
In reply to Greg Kroah-HartmanFrom: Tao Zhou <[email protected]>
[ Upstream commit 6c8116c914b65be5e4d6f66d69c8142eb0648c22 ]
In update_sg_wakeup_stats(), the comment says:
Computing avg_load makes sense only when group is fully busy or overloaded.
But, the code below this comment does not check like this.
Quoted 1 line
From reading the code about
avg_loadin other functions, I
confirm that avg_load should be calculated in fully busy or overloaded case. The comment is correct and the checking condition is wrong. So, change that condition.
--- kernel/sched/fair.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/sched/fair.c +2 -1
@@ -8345,7 +8345,8 @@ static inline void update_sg_wakeup_stats(struct sched_domain *sd,* Computing avg_load makes sense only when group is fully busy or * overloaded */ -if (sgs->group_type < group_fully_busy) +if (sgs->group_type == group_fully_busy || + sgs->group_type == group_overloaded) sgs->avg_load = (sgs->group_load *SCHED_CAPACITY_SCALE ) / sgs->group_capacity; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 35/254 media: allegro: fix type of gop_length in channel_create message
In reply to Greg Kroah-HartmanFrom: Michael Tretter <[email protected]>
[ Upstream commit 8277815349327b8e65226eb58ddb680f90c2c0c0 ]
The gop_length field is actually only u16 and there are two more u8 fields in the message:
- the number of consecutive b-frames
- frequency of golden frames
Fix the message and thus fix the configuration of the GOP length.
--- drivers/staging/media/allegro-dvt/allegro-core.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/staging/media/allegro-dvt/allegro-core.c +4 -1
@@ -393,7 +393,10 @@ struct mcu_msg_create_channel {u32 freq_ird;u32 freq_lt;u32 gdr_mode; -u32 gop_length; +u16 gop_length; +u8 num_b; +u8 freq_golden_ref; +u32 unknown39;u32 subframe_latency;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 36/254 sched: Avoid scale real weight down to zero
In reply to Greg Kroah-HartmanFrom: Michael Wang <[email protected]>
[ Upstream commit 26cf52229efc87e2effa9d788f9b33c40fb3358a ]
During our testing, we found a case that shares no longer working correctly, the cgroup topology is like:
/sys/fs/cgroup/cpu/A (shares=102400)
/sys/fs/cgroup/cpu/A/B (shares=2)
/sys/fs/cgroup/cpu/A/B/C (shares=1024)
/sys/fs/cgroup/cpu/D (shares=1024)
/sys/fs/cgroup/cpu/D/E (shares=1024)
/sys/fs/cgroup/cpu/D/E/F (shares=1024)
The same benchmark is running in group C & F, no other tasks are running, the benchmark is capable to consumed all the CPUs.
We suppose the group C will win more CPU resources since it could enjoy all the shares of group A, but it's F who wins much more.
The reason is because we have group B with shares as 2, since A->cfs_rq.load.weight == B->se.load.weight == B->shares/nr_cpus, so A->cfs_rq.load.weight become very small.
And in calc_group_shares() we calculate shares as:
load = max(scale_load_down(cfs_rq->load.weight), cfs_rq->avg.load_avg); shares = (tg_shares * load) / tg_weight;
Since the 'cfs_rq->load.weight' is too small, the load become 0 after scale down, although 'tg_shares' is 102400, shares of the se which stand for group A on root cfs_rq become 2.
While the se of D on root cfs_rq is far more bigger than 2, so it wins the battle.
Thus when scale_load_down() scale real weight down to 0, it's no longer telling the real story, the caller will have the wrong information and the calculation will be buggy.
This patch add check in scale_load_down(), so the real weight will be >= MIN_SHARES after scale, after applied the group C wins as expected.
--- kernel/sched/sched.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
kernel/sched/sched.h +7 -1
@@ -118,7 +118,13 @@ extern long calc_load_fold_active(struct rq *this_rq, long adjust);#ifdef CONFIG_64BIT # define NICE_0_LOAD_SHIFT (SCHED_FIXEDPOINT_SHIFT + SCHED_FIXEDPOINT_SHIFT)# define scale_load (w) ((w) << SCHED_FIXEDPOINT_SHIFT) -# define scale_load_down (w) ((w) >> SCHED_FIXEDPOINT_SHIFT) +# define scale_load_down (w) \ +({ \ + unsigned long __w = (w); \ + if (__w) \ + __w = max(2UL, __w >> SCHED_FIXEDPOINT_SHIFT); \ + __w; \ +})#else # define NICE_0_LOAD_SHIFT (SCHED_FIXEDPOINT_SHIFT)# define scale_load (w) (w)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 29/254 block: keep bdi->io_pages in sync with max_sectors_kb for stacked devices
In reply to Greg Kroah-HartmanFrom: Konstantin Khlebnikov <[email protected]>
[ Upstream commit e74d93e96d721c4297f2a900ad0191890d2fc2b0 ]
Field bdi->io_pages added in commit 9491ae4aade6 ("mm: don't cap request size based on read-ahead setting") removes unneeded split of read requests.
Stacked drivers do not call blk_queue_max_hw_sectors(). Instead they set limits of their devices by blk_set_stacking_limits() + disk_stack_limits(). Field bio->io_pages stays zero until user set max_sectors_kb via sysfs.
This patch updates io_pages after merging limits in disk_stack_limits().
Commit c6d6e9b0f6b4 ("dm: do not allow readahead to limit IO size") fixed the same problem for device-mapper devices, this one fixes MD RAIDs.
--- block/blk-settings.c | 3 +++ 1 file changed, 3 insertions(+)
block/blk-settings.c +3 -0
@@ -664,6 +664,9 @@ void disk_stack_limits(struct gendisk *disk, struct block_device *bdev,printk (KERN_NOTICE "%s: Warning: Device %s is misaligned\n" , top, bottom); } + + t->backing_dev_info->io_pages = + t->limits.max_sectors >> (PAGE_SHIFT -9 ); }EXPORT_SYMBOL (disk_stack_limits);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 32/254 irqchip/versatile-fpga: Handle chained IRQs properly
In reply to Greg Kroah-HartmanFrom: Sungbo Eo <[email protected]>
[ Upstream commit 486562da598c59e9f835b551d7cf19507de2d681 ]
Enclose the chained handler with chained_irq_{enter,exit}(), so that the muxed interrupts get properly acked.
This patch also fixes a reboot bug on OX820 SoC, where the jiffies timer interrupt is never acked. The kernel waits a clock tick forever in calibrate_delay_converge(), which leads to a boot hang.
--- drivers/irqchip/irq-versatile-fpga.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/irqchip/irq-versatile-fpga.c +10 -2
@@ -6,6 +6,7 @@#include <linux/irq.h> #include <linux/io.h> #include <linux/irqchip.h> +#include <linux/irqchip/chained_irq.h> #include <linux/irqchip/versatile-fpga.h> #include <linux/irqdomain.h> #include <linux/module.h>
@@ -68,12 +69,16 @@ static void fpga_irq_unmask(struct irq_data *d)static void fpga_irq_handle (struct irq_desc *desc) { +struct irq_chip *chip =irq_desc_get_chip (desc);struct fpga_irq_data *f =irq_desc_get_handler_data (desc); -u32 status =readl (f->base +IRQ_STATUS ); +u32 status; + +chained_irq_enter (chip, desc); + status =readl (f->base +IRQ_STATUS );if (status ==0 ) {do_bad_IRQ (desc); -return ; + goto out; } do {
@@ -82,6 +87,9 @@ static void fpga_irq_handle(struct irq_desc *desc) status &= ~(1 << irq);generic_handle_irq (irq_find_mapping (f->domain, irq)); }while (status); + +out: +chained_irq_exit (chip, desc); }/*
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 31/254 spi: spi-fsl-dspi: Avoid NULL pointer in dspi_slave_abort for non-DMA mode
In reply to Greg Kroah-HartmanFrom: Vladimir Oltean <[email protected]>
[ Upstream commit 3d6224e63be39ff26cf416492cb3923cd3d07dd0 ]
The driver does not create the dspi->dma structure unless operating in DSPI_DMA_MODE, so it makes sense to check for that.
--- drivers/spi/spi-fsl-dspi.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/spi/spi-fsl-dspi.c +4 -2
@@ -1021,8 +1021,10 @@ static int dspi_slave_abort(struct spi_master *master)* Terminate all pending DMA transactions for the SPI working * in SLAVE mode. */ -dmaengine_terminate_sync (dspi->dma->chan_rx); -dmaengine_terminate_sync (dspi->dma->chan_tx); +if (dspi->devtype_data->trans_mode ==DSPI_DMA_MODE ) { +dmaengine_terminate_sync (dspi->dma->chan_rx); +dmaengine_terminate_sync (dspi->dma->chan_tx); + }/* Clear the internal DSPI RX and TX FIFO buffers */ regmap_update_bits(dspi->regmap, SPI_MCR,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 24/254 xhci: bail out early if driver cant accress host in resume
In reply to Greg Kroah-HartmanFrom: Mathias Nyman <[email protected]>
[ Upstream commit 72ae194704da212e2ec312ab182a96799d070755 ]
Bail out early if the xHC host needs to be reset at resume but driver can't access xHC PCI registers.
If xhci driver already fails to reset the controller then there is no point in attempting to free, re-initialize, re-allocate and re-start the host. If failure to access the host is detected later, failing the resume, xhci interrupts will be double freed when remove is called.
--- drivers/usb/host/xhci.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/usb/host/xhci.c +3 -1
@@ -1157,8 +1157,10 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated)xhci_dbg (xhci,"Stop HCD\n" );xhci_halt (xhci);xhci_zero_64b_regs (xhci); -xhci_reset (xhci); + retval =xhci_reset (xhci);spin_unlock_irq (&xhci->lock); +if (retval) +return retval;xhci_cleanup_msix (xhci);xhci_dbg (xhci,"// Disabling event ring interrupts\n" );
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 23/254 media: imx: imx7-media-csi: Fix video field handling
In reply to Greg Kroah-HartmanFrom: Laurent Pinchart <[email protected]>
[ Upstream commit f7b8488bd39ae8feced4dfbb41cf1431277b893f ]
Commit 4791bd7d6adc ("media: imx: Try colorimetry at both sink and source pads") reworked the way that formats are set on the sink pad of the CSI subdevice, and accidentally removed video field handling. Restore it by defaulting to V4L2_FIELD_NONE if the field value isn't supported, with the only two supported value being V4L2_FIELD_NONE and V4L2_FIELD_INTERLACED.
--- drivers/staging/media/imx/imx7-media-csi.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/staging/media/imx/imx7-media-csi.c +4 -0
@@ -1009,6 +1009,7 @@ static int imx7_csi_try_fmt(struct imx7_csi *csi, sdformat->format.width = in_fmt->width; sdformat->format.height = in_fmt->height; sdformat->format.code = in_fmt->code; + sdformat->format.field = in_fmt->field; *cc = in_cc; sdformat->format.colorspace = in_fmt->colorspace;
@@ -1023,6 +1024,9 @@ static int imx7_csi_try_fmt(struct imx7_csi *csi, false); sdformat->format.code = (*cc)->codes[0 ]; } + +if (sdformat->format.field !=V4L2_FIELD_INTERLACED ) + sdformat->format.field =V4L2_FIELD_NONE ;break ;default :return -EINVAL ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 22/254 media: imx: imx7_mipi_csis: Power off the source when stopping streaming
In reply to Greg Kroah-HartmanFrom: Laurent Pinchart <[email protected]>
[ Upstream commit 770cbf89f90b0663499dbb3f03aa81b3322757ec ]
The .s_stream() implementation incorrectly powers on the source when stopping the stream. Power it off instead.
--- drivers/staging/media/imx/imx7-mipi-csis.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/imx/imx7-mipi-csis.c +1 -1
@@ -577,7 +577,7 @@ static int mipi_csis_s_stream(struct v4l2_subdev *mipi_sd, int enable) state->flags |=ST_STREAMING ; }else {v4l2_subdev_call (state->src_sd, video, s_stream,0 ); - ret =v4l2_subdev_call (state->src_sd, core, s_power,1 ); + ret =v4l2_subdev_call (state->src_sd, core, s_power,0 );mipi_csis_stop_stream (state); state->flags &= ~ST_STREAMING ;if (state->debug)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainercover 5.6.5-rc1 review
This is the start of the stable review cycle for the 5.6.5 release. There are 254 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sat, 18 Apr 2020 13:11:20 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.6.5-rc1.gz
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.6.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 5.6.5-rc1
Christophe Leroy <[email protected]>
powerpc/kasan: Fix kasan_remap_early_shadow_ro()
Peter Zijlstra <[email protected]>
perf/core: Remove 'struct sched_in_data'
Peter Zijlstra <[email protected]>
perf/core: Fix event cgroup tracking
Peter Zijlstra <[email protected]>
perf/core: Unify {pinned,flexible}_sched_in()
Chris Wilson <[email protected]>
drm/i915/gt: Fill all the unused space in the GGTT
Daniele Ceraolo Spurio <[email protected]>
drm/i915/ggtt: do not set bits 1-11 in gen12 ptes
Prike Liang <[email protected]>
drm/amdgpu: fix gfx hang during suspend with video playback (v2)
Lyude Paul <[email protected]>
drm/dp_mst: Fix clearing payload state on topology disable
Lyude Paul <[email protected]>
Revert "drm/dp_mst: Remove VCPI while disabling topology mgr"
Mark Brown <[email protected]>
arm64: Always force a branch protection mode when the compiler has one
Michael Ellerman <[email protected]>
powerpc/64: Prevent stack protection in early boot
Christophe Leroy <[email protected]>
powerpc/kprobes: Ignore traps that happened in real mode
Cédric Le Goater <[email protected]>
powerpc/xive: Fix xmon support on the PowerNV platform
Daniel Axtens <[email protected]>
powerpc/64: Setup a paca before parsing device tree etc.
Cédric Le Goater <[email protected]>
powerpc/xive: Use XIVE_BAD_IRQ instead of zero to catch non configured IPIs
Aneesh Kumar K.V <[email protected]>
powerpc/hash64/devmap: Use H_PAGE_THP_HUGE when setting up huge devmap PTE entries
Laurentiu Tudor <[email protected]>
powerpc/fsl_booke: Avoid creating duplicate tlb1 entry
Michael Ellerman <[email protected]>
powerpc/64/tm: Don't let userspace set regs->trap via sigreturn
Clement Courbet <[email protected]>
powerpc: Make setjmp/longjmp signature standard
Bart Van Assche <[email protected]>
scsi: sr: Fix sr_block_release()
Merlijn Wajer <[email protected]>
scsi: sr: get rid of sr global mutex
Juergen Gross <[email protected]>
xen/blkfront: fix memory allocation flags in blkfront_setup_indirect()
Wen Yang <[email protected]>
ipmi: fix hung processes in __get_guid()
Kai-Heng Feng <[email protected]>
libata: Return correct status in sata_pmp_eh_recover_pm() when ATA_DFLAG_DETACH is set
Simon Gander <[email protected]>
hfsplus: fix crash and filesystem corruption when deleting files
Oliver O'Halloran <[email protected]>
cpufreq: powernv: Fix use-after-free
Eric Biggers <[email protected]>
kmod: make request_module() return an error when autoloading is disabled
Paul Cercueil <[email protected]>
clk: ingenic/TCU: Fix round_rate returning error
Paul Cercueil <[email protected]>
clk: ingenic/jz4770: Exit with error if CGU init failed
Masami Hiramatsu <[email protected]>
ftrace/kprobe: Show the maxactive number on kprobe_events
Hans de Goede <[email protected]>
Input: i8042 - add Acer Aspire 5738z to nomux list
Michael Mueller <[email protected]>
s390/diag: fix display of diagnose call statistics
Sam Lunt <[email protected]>
perf tools: Support Python 3.8+ in Makefile
Changwei Ge <[email protected]>
ocfs2: no need try to truncate file beyond i_size
Eric Biggers <[email protected]>
fs/filesystems.c: downgrade user-reachable WARN_ONCE() to pr_warn_once()
Mike Willard <[email protected]>
ASoC: cs4270: pull reset GPIO low then high
Chris Wilson <[email protected]>
drm/i915/gt: Treat idling as a RPS downclock event
Qian Cai <[email protected]>
ext4: fix a data race at inode->i_blocks
Scott Mayhew <[email protected]>
NFS: Fix a few constant_table array definitions
Trond Myklebust <[email protected]>
NFS: finish_automount() requires us to hold 2 refs to the mount record
Trond Myklebust <[email protected]>
NFS: Fix a page leak in nfs_destroy_unlinked_subrequests()
Trond Myklebust <[email protected]>
NFS: Fix use-after-free issues in nfs_pageio_add_request()
J. Bruce Fields <[email protected]>
nfsd: fsnotify on rmdir under nfsd/clients/
Hans de Goede <[email protected]>
drm/vboxvideo: Add missing remove_conflicting_pci_framebuffers call, v2
Libor Pechacek <[email protected]>
powerpc/pseries: Avoid NULL pointer dereference when drmem is unavailable
Imre Deak <[email protected]>
drm/i915/icl+: Don't enable DDI IO power on a TypeC port in TBT mode
Marek Szyprowski <[email protected]>
drm/prime: fix extracting of the DMA addresses from a scatterlist
Michael Strauss <[email protected]>
drm/amd/display: Check for null fclk voltage when parsing clock table
Aaron Liu <[email protected]>
drm/amdgpu: unify fw_write_wait for new gfx9 asics
Prike Liang <[email protected]>
drm/amd/powerplay: implement the is_dpm_running()
Yuxian Dai <[email protected]>
drm/amdgpu/powerplay: using the FCLK DPM table to set the MCLK
Chris Wilson <[email protected]>
drm: Remove PageReserved manipulation from drm_pci_alloc
Christian Gmeiner <[email protected]>
drm/etnaviv: rework perfmon query infrastructure
Torsten Duwe <[email protected]>
drm/bridge: analogix-anx78xx: Fix drm_dp_link helper removal
Chris Wilson <[email protected]>
drm/i915/gem: Flush all the reloc_gpu batch
Eric Auger <[email protected]>
vfio: platform: Switch to platform_get_irq_optional()
Michael Ellerman <[email protected]>
selftests/powerpc: Fix try-run when source tree is not writable
Christophe Leroy <[email protected]>
selftests/powerpc: Add tlbie_test in .gitignore
Christophe Leroy <[email protected]>
selftests/vm: fix map_hugetlb length used for testing read and write
Michal Hocko <[email protected]>
selftests: vm: drop dependencies on page flags from mlock2 tests
Fredrik Strupe <[email protected]>
arm64: armv8_deprecated: Fix undef_hook mask for thumb setend
Dave Gerlach <[email protected]>
arm64: dts: ti: k3-am65: Add clocks to dwc3 nodes
Marek Szyprowski <[email protected]>
ARM: dts: exynos: Fix polarity of the LCD SPI bus on UniversalC210 board
James Smart <[email protected]>
scsi: lpfc: Fix broken Credit Recovery after driver load
James Smart <[email protected]>
scsi: lpfc: Fix lpfc_io_buf resource leak in lpfc_get_scsi_buf_s4 error path
Stanley Chu <[email protected]>
scsi: ufs: fix Auto-Hibern8 error detection
Steffen Maier <[email protected]>
scsi: zfcp: fix missing erp_lock in port recovery trigger for point-to-point
Gilad Ben-Yossef <[email protected]>
crypto: ccree - dec auth tag size from cryptlen map
Gilad Ben-Yossef <[email protected]>
crypto: ccree - only try to map auth tag if needed
Gilad Ben-Yossef <[email protected]>
crypto: ccree - protect against empty or NULL scatterlists
Andrei Botila <[email protected]>
crypto: caam - update xts sector size for large input length
Horia Geantă <[email protected]>
crypto: caam/qi2 - fix chacha20 data size error
Matthew Wilcox (Oracle) <[email protected]>
xarray: Fix early termination of xas_for_each_marked
Matthew Wilcox (Oracle) <[email protected]>
XArray: Fix xas_pause for large multi-index entries
Nikos Tsironis <[email protected]>
dm clone metadata: Fix return type of dm_clone_nr_of_hydrated_regions()
Nikos Tsironis <[email protected]>
dm clone: Add missing casts to prevent overflows and data corruption
Nikos Tsironis <[email protected]>
dm clone: Add overflow check for number of regions
Nikos Tsironis <[email protected]>
dm clone: Fix handling of partial region discards
Bob Liu <[email protected]>
dm zoned: remove duplicate nr_rnd_zones increase in dmz_init_zone()
Shetty, Harshini X (EXT-Sony Mobile) <[email protected]>
dm verity fec: fix memory leak in verity_fec_dtr
Mikulas Patocka <[email protected]>
dm integrity: fix a crash with unusually large tag size
Mikulas Patocka <[email protected]>
dm writecache: add cond_resched to avoid CPU hangs
Jakub Kicinski <[email protected]>
mm, memcg: do not high throttle allocators based on wraparound
Maxime Ripard <[email protected]>
arm64: dts: allwinner: h5: Fix PMU compatible
Scott Wood <[email protected]>
sched/core: Remove duplicate assignment in sched_tick_remote()
Maxime Ripard <[email protected]>
arm64: dts: allwinner: h6: Fix PMU compatible
Subash Abhinov Kasiviswanathan <[email protected]>
net: qualcomm: rmnet: Allow configuration updates to existing devices
Anssi Hannula <[email protected]>
tools: gpio: Fix out-of-tree build regression
Sreekanth Reddy <[email protected]>
scsi: mpt3sas: Fix kernel panic observed on soft HBA unplug
Jens Axboe <[email protected]>
io_uring: honor original task RLIMIT_FSIZE
Rosioru Dragos <[email protected]>
crypto: mxs-dcp - fix scatterlist linearization for hash
Dan Carpenter <[email protected]>
crypto: rng - Fix a refcounting bug in crypto_rng_reset()
Dmitry Safonov <[email protected]>
time/namespace: Add max_time_namespaces ucount
Michael Kerrisk (man-pages) <[email protected]>
time/namespace: Fix time_for_children symlink
Nikita Shubin <[email protected]>
remoteproc: Fix NULL pointer dereference in rproc_virtio_notify
Sibi Sankar <[email protected]>
remoteproc: qcom_q6v5_mss: Reload the mba region on coredump
Bjorn Andersson <[email protected]>
remoteproc: qcom_q6v5_mss: Don't reassign mpss region on shutdown
Josef Bacik <[email protected]>
btrfs: use nofs allocations for running delayed items
Robbie Ko <[email protected]>
btrfs: fix missing semaphore unlock in btrfs_sync_file
Josef Bacik <[email protected]>
btrfs: unset reloc control if we fail to recover
Filipe Manana <[email protected]>
btrfs: fix missing file extent item for hole after ranged fsync
Josef Bacik <[email protected]>
btrfs: drop block from cache on error in relocation
Josef Bacik <[email protected]>
btrfs: set update the uuid generation as soon as possible
Josef Bacik <[email protected]>
btrfs: reloc: clean dirty subvols if we fail to start a transaction
Filipe Manana <[email protected]>
Btrfs: fix crash during unmount due to race with delayed inode workers
Josef Bacik <[email protected]>
btrfs: fix btrfs_calc_reclaim_metadata_size calculation
Qu Wenruo <[email protected]>
btrfs: Don't submit any btree write bio if the fs has errors
Tvrtko Ursulin <[email protected]>
drm/i915/gen12: Disable preemption timeout
Piotr Sroka <[email protected]>
mtd: rawnand: cadence: reinit completion before executing a new command
Piotr Sroka <[email protected]>
mtd: rawnand: cadence: change bad block marker size
Piotr Sroka <[email protected]>
mtd: rawnand: cadence: fix the calculation of the avaialble OOB size
Frieder Schrempf <[email protected]>
mtd: spinand: Do not erase the block before writing a bad block marker
Frieder Schrempf <[email protected]>
mtd: spinand: Stop using spinand->oobbuf for buffering bad block markers
Murphy Zhou <[email protected]>
CIFS: check new file size when extending file by fallocate
Yilu Lin <[email protected]>
CIFS: Fix bug which the return value by asynchronous read is error
Steve French <[email protected]>
smb3: fix performance regression with setting mtime
Vitaly Kuznetsov <[email protected]>
KVM: VMX: fix crash cleanup when KVM wasn't used
Sean Christopherson <[email protected]>
KVM: VMX: Add a trampoline to fix VMREAD error handling
Sean Christopherson <[email protected]>
KVM: x86: Gracefully handle __vmalloc() failure during VM allocation
Sean Christopherson <[email protected]>
KVM: VMX: Always VMCLEAR in-use VMCSes during crash with kexec support
Sean Christopherson <[email protected]>
KVM: x86: Allocate new rmap and large page tracking when moving memslot
David Hildenbrand <[email protected]>
KVM: s390: vsie: Fix delivery of addressing exceptions
David Hildenbrand <[email protected]>
KVM: s390: vsie: Fix region 1 ASCE sanity shadow address checks
Sean Christopherson <[email protected]>
KVM: nVMX: Properly handle userspace interrupt window request
Fabiano Rosas <[email protected]>
KVM: PPC: Book3S HV: Skip kvmppc_uvmem_free if Ultravisor is not supported
Kristian Klausen <[email protected]>
platform/x86: asus-wmi: Support laptops where the first battery is named BATT
Thomas Gleixner <[email protected]>
x86/entry/32: Add missing ASM_CLAC to general_protection entry
Hans de Goede <[email protected]>
x86/tsc_msr: Make MSR derived TSC frequency more accurate
Hans de Goede <[email protected]>
x86/tsc_msr: Fix MSR_FSB_FREQ mask for Cherry Trail devices
Hans de Goede <[email protected]>
x86/tsc_msr: Use named struct initializers
Eric W. Biederman <[email protected]>
signal: Extend exec_id to 64bits
Remi Pommarel <[email protected]>
ath9k: Handle txpower changes even when TPC is disabled
Neeraj Upadhyay <[email protected]>
PM: sleep: wakeup: Skip wakeup_source_sysfs_remove() if device is not there
Ulf Hansson <[email protected]>
PM / Domains: Allow no domain-idle-states DT property in genpd when parsing
Gustavo A. R. Silva <[email protected]>
MIPS: OCTEON: irq: Fix potential NULL pointer dereference
Huacai Chen <[email protected]>
MIPS/tlbex: Fix LDDIR usage in setup_pw() for Loongson-3
Vasily Averin <[email protected]>
pstore: pstore_ftrace_seq_next should increase position index
Pavel Begunkov <[email protected]>
io_uring: fix ctx refcounting in io_submit_sqes()
Jens Axboe <[email protected]>
io_uring: remove bogus RLIMIT_NOFILE check in file registration
Jens Axboe <[email protected]>
io_uring: ensure openat sets O_LARGEFILE if needed
Sungbo Eo <[email protected]>
irqchip/versatile-fpga: Apply clear-mask earlier
Thomas Gleixner <[email protected]>
genirq/debugfs: Add missing sanity checks to interrupt injection
Thomas Gleixner <[email protected]>
cpu/hotplug: Ignore pm_wakeup_pending() for disable_nonboot_cpus()
Paul E. McKenney <[email protected]>
rcu: Make rcu_barrier() account for offline no-CBs CPUs
Ludovic Barre <[email protected]>
mmc: mmci_sdmmc: Fix clear busyd0end irq flag
Yang Xu <[email protected]>
KEYS: reaching the keys quotas correctly
Vasily Averin <[email protected]>
tpm: tpm2_bios_measurements_next should increase position index
Vasily Averin <[email protected]>
tpm: tpm1_bios_measurements_next should increase position index
Matthew Garrett <[email protected]>
tpm: Don't make log failures fatal
Vincent Guittot <[email protected]>
sched/fair: Fix enqueue_task_fair warning
Gao Xiang <[email protected]>
erofs: correct the remaining shrink objects
Kishon Vijay Abraham I <[email protected]>
PCI: endpoint: Fix for concurrent memory allocation in OB address region
Bjorn Andersson <[email protected]>
PCI: qcom: Fix the fixup of PCI_VENDOR_ID_QCOM
Sean V Kelley <[email protected]>
PCI: Add boot interrupt quirk mechanism for Xeon chipsets
Yicong Yang <[email protected]>
PCI/ASPM: Clear the correct bits when enabling L1 substates
Lukas Wunner <[email protected]>
PCI: pciehp: Fix indefinite wait on sysfs requests
Tom Lendacky <[email protected]>
efi/x86: Add TPM related EFI tables to unencrypted mapping checks
James Smart <[email protected]>
nvme-fc: Revert "add module to ops template to allow module references"
Sagi Grimberg <[email protected]>
nvmet-tcp: fix maxh2cdata icresp parameter
Martin Blumenstingl <[email protected]>
thermal: devfreq_cooling: inline all stubs for CONFIG_DEVFREQ_THERMAL=n
Gayatri Kammela <[email protected]>
thermal: int340x_thermal: fix: Update Tiger Lake ACPI device IDs
Rafael J. Wysocki <[email protected]>
ACPI: PM: s2idle: Refine active GPEs check
Rafael J. Wysocki <[email protected]>
ACPICA: Allow acpi_any_gpe_status_set() to skip one GPE
Jan Engelhardt <[email protected]>
acpi/x86: ignore unspecified bit positions in the ACPI global lock field
Rafael J. Wysocki <[email protected]>
ACPI: EC: Avoid printing confusing messages in acpi_ec_setup()
Sven Schnelle <[email protected]>
seccomp: Add missing compat_ioctl for notify
Benoit Parrot <[email protected]>
media: ti-vpe: cal: fix a kernel oops when unloading module
Benoit Parrot <[email protected]>
media: ti-vpe: cal: fix disable_irqs to only the intended target
Andrzej Pietrasiewicz <[email protected]>
media: hantro: Read be32 words starting at every fourth byte
Stanimir Varbanov <[email protected]>
media: venus: firmware: Ignore secure call error on first resume
Stanimir Varbanov <[email protected]>
media: venus: cache vb payload to be used by clock scaling
Takashi Iwai <[email protected]>
ALSA: hda/realtek - Add quirk for MSI GL63
Hans de Goede <[email protected]>
ALSA: hda/realtek - Add quirk for Lenovo Carbon X1 8th gen
Thomas Hebb <[email protected]>
ALSA: hda/realtek - Remove now-unnecessary XPS 13 headphone noise fixups
Thomas Hebb <[email protected]>
ALSA: hda/realtek - Set principled PC Beep configuration for ALC256
Thomas Hebb <[email protected]>
ALSA: doc: Document PC Beep Hidden Register on Realtek ALC256
Hui Wang <[email protected]>
ALSA: hda/realtek - a fake key event is triggered by running shutup
Kai-Heng Feng <[email protected]>
ALSA: hda/realtek: Enable mute LED on an HP system
Takashi Iwai <[email protected]>
ALSA: pcm: oss: Fix regression by buffer overflow fix
Takashi Iwai <[email protected]>
ALSA: ice1724: Fix invalid access for enumerated ctl items
Takashi Iwai <[email protected]>
ALSA: hda: Fix potential access overflow in beep helper
Takashi Iwai <[email protected]>
ALSA: hda: Add driver blacklist
Takashi Iwai <[email protected]>
ALSA: usb-audio: Add mixer workaround for TRX40 and co
Thinh Nguyen <[email protected]>
usb: gadget: composite: Inform controller driver of self-powered
Sriharsha Allenki <[email protected]>
usb: gadget: f_fs: Fix use after free issue as part of queue failure
이경택 <[email protected]>
ASoC: topology: use name_prefix for new kcontrol
이경택 <[email protected]>
ASoC: dpcm: allow start or stop during pause for backend
이경택 <[email protected]>
ASoC: dapm: connect virtual mux with default value
이경택 <[email protected]>
ASoC: fix regwmask
Josef Bacik <[email protected]>
btrfs: track reloc roots based on their commit root bytenr
Josef Bacik <[email protected]>
btrfs: restart relocate_tree_blocks properly
Josef Bacik <[email protected]>
btrfs: remove a BUG_ON() from merge_reloc_roots()
Qu Wenruo <[email protected]>
btrfs: qgroup: ensure qgroup_rescan_running is only set when the worker is at least queued
Zhiqiang Liu <[email protected]>
block, bfq: fix use-after-free in bfq_idle_slice_timer_body
Sergio Paracuellos <[email protected]>
staging: mt7621-pci: avoid to poweroff the phy for slot one
Boqun Feng <[email protected]>
locking/lockdep: Avoid recursion in lockdep_count_{for,back}ward_deps()
Vladimir Oltean <[email protected]>
spi: spi-fsl-dspi: Replace interruptible wait queue with a simple completion
Junyong Sun <[email protected]>
firmware: fix a double abort case with fw_load_sysfs_fallback
Guoqing Jiang <[email protected]>
md: check arrays is suspended in mddev_detach before call quiesce operations
Marc Zyngier <[email protected]>
irqchip/gic-v4: Provide irq_retrigger to avoid circular locking dependency
Neil Armstrong <[email protected]>
usb: dwc3: core: add support for disabling SS instances in park mode
Dongchun Zhu <[email protected]>
media: i2c: ov5695: Fix power on and off sequences
Hsin-Yi Wang <[email protected]>
media: mtk-vpu: avoid unaligned access to DTCM buffer.
Alexey Dobriyan <[email protected]>
block, zoned: fix integer overflow with BLKRESETZONE et al
Sahitya Tummala <[email protected]>
block: Fix use-after-free issue accessing struct io_cq
Alexander Sverdlin <[email protected]>
genirq/irqdomain: Check pointer in irq_domain_alloc_irqs_hierarchy()
Ard Biesheuvel <[email protected]>
efi/x86: Ignore the memory attributes table on i386
Arvind Sankar <[email protected]>
x86/boot: Use unsigned comparison for addresses
Peng Fan <[email protected]>
cpufreq: imx6q: fix error handling
Bob Peterson <[email protected]>
gfs2: Don't demote a glock until its revokes are written
Bob Peterson <[email protected]>
gfs2: Do log_flush in gfs2_ail_empty_gl even if ail list is empty
chenqiwu <[email protected]>
pstore/platform: fix potential mem leak if pstore_init_fs failed
John Garry <[email protected]>
libata: Remove extra scsi_host_put() in ata_scsi_add_hosts()
Matt Ranostay <[email protected]>
media: i2c: video-i2c: fix build errors due to 'imply hwmon'
Paolo Valente <[email protected]>
block, bfq: move forward the getting of an extra ref in bfq_bfqq_move
Logan Gunthorpe <[email protected]>
PCI/switchtec: Fix init_completion race condition with poll_wait()
Andy Lutomirski <[email protected]>
selftests/x86/ptrace_syscall_32: Fix no-vDSO segfault
Tao Zhou <[email protected]>
sched/fair: Fix condition of avg_load calculation
Michael Wang <[email protected]>
sched: Avoid scale real weight down to zero
Michael Tretter <[email protected]>
media: allegro: fix type of gop_length in channel_create message
Marc Zyngier <[email protected]>
irqchip/gic-v4.1: Skip absent CPUs while iterating over redistributors
Ahmed S. Darwish <[email protected]>
time/sched_clock: Expire timer in hardirq context
Sungbo Eo <[email protected]>
irqchip/versatile-fpga: Handle chained IRQs properly
Vladimir Oltean <[email protected]>
spi: spi-fsl-dspi: Avoid NULL pointer in dspi_slave_abort for non-DMA mode
Taehee Yoo <[email protected]>
debugfs: Check module state before warning in {full/open}_proxy_open()
Konstantin Khlebnikov <[email protected]>
block: keep bdi->io_pages in sync with max_sectors_kb for stacked devices
Thomas Hellstrom <[email protected]>
dma-mapping: Fix dma_pgprot() for unencrypted coherent pages
Thomas Hellstrom <[email protected]>
x86: Don't let pgprot_modify() change the page encryption bit
Claudiu Beznea <[email protected]>
clocksource/drivers/timer-microchip-pit64b: Fix rate for gck
Rafael J. Wysocki <[email protected]>
ACPI: EC: Do not clear boot_ec_is_ecdt in acpi_ec_add()
Mathias Nyman <[email protected]>
xhci: bail out early if driver can't accress host in resume
Laurent Pinchart <[email protected]>
media: imx: imx7-media-csi: Fix video field handling
Laurent Pinchart <[email protected]>
media: imx: imx7_mipi_csis: Power off the source when stopping streaming
Alexey Dobriyan <[email protected]>
null_blk: fix spurious IO errors after failed past-wp access
Bart Van Assche <[email protected]>
null_blk: Suppress an UBSAN complaint triggered when setting 'memory_backed'
Bart Van Assche <[email protected]>
null_blk: Handle null_add_dev() failures properly
Bart Van Assche <[email protected]>
blk-mq: Fix a recently introduced regression in blk_mq_realloc_hw_ctxs()
Bart Van Assche <[email protected]>
null_blk: Fix the null_add_dev() error path
Lorenzo Bianconi <[email protected]>
iio: imu: st_lsm6dsx: check return value from st_lsm6dsx_sensor_set_enable
Chris Wilson <[email protected]>
sched/vtime: Prevent unstable evaluation of WARN(vtime->state)
Anshuman Khandual <[email protected]>
arm64/mm: Hold memory hotplug lock while walking for kernel page table dump
Krzysztof Kozlowski <[email protected]>
usb: phy: tegra: Include proper GPIO consumer header to fix compile testing
Mohammad Rasim <[email protected]>
media: arm64: dts: amlogic: add rc-videostrong-kii-pro keymap
James Morse <[email protected]>
firmware: arm_sdei: fix double-lock on hibernate with shared events
Stephan Gerhold <[email protected]>
media: venus: hfi_parser: Ignore HEVC encoding for V1
Helen Koike <[email protected]>
media: staging: rkisp1: isp: do not set invalid mbus code for pad
Helen Koike <[email protected]>
media: staging: rkisp1: use consistent bus_info string for media_dev
Philipp Zabel <[email protected]>
media: hantro: fix extra MV/MC sync space calculation
Dafna Hirschfeld <[email protected]>
media: vimc: streamer: fix memory leak in vimc subdevs if kthread_run fails
Ajay Singh <[email protected]>
staging: wilc1000: avoid double unlocking of 'wilc->hif_cs' mutex
Ajay Gupta <[email protected]>
usb: ucsi: ccg: disable runtime pm during fw flashing
Robert Richter <[email protected]>
EDAC/mc: Report "unknown memory" on too many DIMM labels found
Christoph Niedermaier <[email protected]>
cpufreq: imx6q: Fixes unwanted cpu overclocking on i.MX6ULL
Mohammad Rasim <[email protected]>
media: rc: add keymap for Videostrong KII Pro
-------------
Diffstat:
Documentation/admin-guide/sysctl/user.rst | 6 + Documentation/sound/hd-audio/index.rst | 1 + Documentation/sound/hd-audio/models.rst | 2 - Documentation/sound/hd-audio/realtek-pc-beep.rst | 129 ++++++++++++ Makefile | 4 +- arch/arm/boot/dts/exynos4210-universal_c210.dts | 4 +- arch/arm64/Makefile | 4 + arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi | 3 +- arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi | 3 +- arch/arm64/boot/dts/amlogic/meson-gxbb-kii-pro.dts | 4 + arch/arm64/boot/dts/ti/k3-am65-main.dtsi | 2 + arch/arm64/kernel/armv8_deprecated.c | 2 +- arch/arm64/mm/ptdump_debugfs.c | 4 + arch/mips/cavium-octeon/octeon-irq.c | 3 + arch/mips/mm/tlbex.c | 5 +- arch/powerpc/include/asm/book3s/64/hash-4k.h | 6 + arch/powerpc/include/asm/book3s/64/hash-64k.h | 8 +- arch/powerpc/include/asm/book3s/64/pgtable.h | 4 +- arch/powerpc/include/asm/book3s/64/radix.h | 5 + arch/powerpc/include/asm/drmem.h | 4 +- arch/powerpc/include/asm/setjmp.h | 6 +- arch/powerpc/kernel/dt_cpu_ftrs.c | 1 - arch/powerpc/kernel/kprobes.c | 3 + arch/powerpc/kernel/paca.c | 14 +- arch/powerpc/kernel/setup.h | 6 + arch/powerpc/kernel/setup_64.c | 32 ++- arch/powerpc/kernel/signal_64.c | 4 +- arch/powerpc/kexec/Makefile | 3 - arch/powerpc/kvm/book3s_hv_uvmem.c | 3 + arch/powerpc/mm/kasan/kasan_init_32.c | 2 +- arch/powerpc/mm/nohash/tlb_low.S | 12 +- arch/powerpc/platforms/pseries/hotplug-memory.c | 8 +- arch/powerpc/sysdev/xive/common.c | 16 +- arch/powerpc/sysdev/xive/native.c | 4 +- arch/powerpc/sysdev/xive/spapr.c | 4 +- arch/powerpc/sysdev/xive/xive-internal.h | 7 + arch/powerpc/xmon/Makefile | 3 - arch/s390/kernel/diag.c | 2 +- arch/s390/kvm/vsie.c | 1 + arch/s390/mm/gmap.c | 6 +- arch/x86/boot/compressed/head_32.S | 2 +- arch/x86/boot/compressed/head_64.S | 4 +- arch/x86/entry/entry_32.S | 1 + arch/x86/include/asm/kvm_host.h | 2 +- arch/x86/include/asm/pgtable.h | 7 +- arch/x86/include/asm/pgtable_types.h | 2 +- arch/x86/kernel/acpi/boot.c | 2 +- arch/x86/kernel/tsc_msr.c | 128 +++++++++-- arch/x86/kvm/svm.c | 4 + arch/x86/kvm/vmx/nested.c | 18 +- arch/x86/kvm/vmx/ops.h | 28 ++- arch/x86/kvm/vmx/vmenter.S | 58 +++++ arch/x86/kvm/vmx/vmx.c | 92 +++----- arch/x86/kvm/x86.c | 21 +- arch/x86/platform/efi/efi.c | 2 + block/bfq-cgroup.c | 14 +- block/bfq-iosched.c | 16 +- block/blk-ioc.c | 7 + block/blk-mq.c | 1 - block/blk-settings.c | 3 + block/blk-zoned.c | 2 +- crypto/rng.c | 8 +- drivers/acpi/acpica/achware.h | 2 +- drivers/acpi/acpica/evxfgpe.c | 17 +- drivers/acpi/acpica/hwgpe.c | 47 ++++- drivers/acpi/ec.c | 26 ++- drivers/acpi/internal.h | 1 + drivers/acpi/sleep.c | 19 +- drivers/ata/libata-pmp.c | 1 + drivers/ata/libata-scsi.c | 9 +- drivers/base/firmware_loader/fallback.c | 2 +- drivers/base/power/domain.c | 2 +- drivers/base/power/wakeup.c | 4 +- drivers/block/null_blk_main.c | 12 +- drivers/block/xen-blkfront.c | 17 +- drivers/char/ipmi/ipmi_msghandler.c | 4 +- drivers/char/tpm/eventlog/common.c | 12 +- drivers/char/tpm/eventlog/tpm1.c | 2 +- drivers/char/tpm/eventlog/tpm2.c | 2 +- drivers/char/tpm/tpm-chip.c | 4 +- drivers/char/tpm/tpm.h | 2 +- drivers/clk/ingenic/jz4770-cgu.c | 4 +- drivers/clk/ingenic/tcu.c | 2 +- drivers/clocksource/timer-microchip-pit64b.c | 1 + drivers/cpufreq/imx6q-cpufreq.c | 12 +- drivers/cpufreq/powernv-cpufreq.c | 6 + drivers/crypto/caam/caamalg_desc.c | 30 ++- drivers/crypto/ccree/cc_buffer_mgr.c | 76 ++++--- drivers/crypto/ccree/cc_buffer_mgr.h | 1 + drivers/crypto/mxs-dcp.c | 58 +++-- drivers/edac/edac_mc.c | 21 +- drivers/firmware/arm_sdei.c | 32 ++- drivers/firmware/efi/efi.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 5 +- drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 2 + .../drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c | 2 +- drivers/gpu/drm/amd/powerplay/renoir_ppt.c | 18 ++ drivers/gpu/drm/amd/powerplay/renoir_ppt.h | 2 +- drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c | 5 +- drivers/gpu/drm/drm_dp_mst_topology.c | 20 +- drivers/gpu/drm/drm_pci.c | 23 +- drivers/gpu/drm/drm_prime.c | 37 ++-- drivers/gpu/drm/etnaviv/etnaviv_perfmon.c | 59 +++++- drivers/gpu/drm/i915/Kconfig.profile | 4 + drivers/gpu/drm/i915/display/intel_ddi.c | 6 +- drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c | 8 +- drivers/gpu/drm/i915/gt/gen8_ppgtt.c | 26 +++ drivers/gpu/drm/i915/gt/intel_engine_cs.c | 13 +- drivers/gpu/drm/i915/gt/intel_ggtt.c | 48 +++-- drivers/gpu/drm/i915/gt/intel_gtt.c | 24 --- drivers/gpu/drm/i915/gt/intel_gtt.h | 4 - drivers/gpu/drm/i915/gt/intel_rps.c | 13 ++ drivers/gpu/drm/vboxvideo/vbox_drv.c | 4 + drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c | 5 +- drivers/input/serio/i8042-x86ia64io.h | 11 + drivers/irqchip/irq-gic-v3-its.c | 10 + drivers/irqchip/irq-versatile-fpga.c | 18 +- drivers/md/dm-clone-metadata.c | 15 +- drivers/md/dm-clone-metadata.h | 2 +- drivers/md/dm-clone-target.c | 66 ++++-- drivers/md/dm-integrity.c | 4 +- drivers/md/dm-verity-fec.c | 1 + drivers/md/dm-writecache.c | 6 +- drivers/md/dm-zoned-metadata.c | 1 - drivers/md/md.c | 2 +- drivers/media/i2c/ov5695.c | 49 +++-- drivers/media/i2c/video-i2c.c | 2 +- drivers/media/platform/mtk-mdp/mtk_mdp_vpu.c | 9 +- drivers/media/platform/mtk-vcodec/vdec_vpu_if.c | 6 +- drivers/media/platform/mtk-vcodec/venc_vpu_if.c | 12 +- drivers/media/platform/mtk-vpu/mtk_vpu.c | 45 ++-- drivers/media/platform/mtk-vpu/mtk_vpu.h | 2 +- drivers/media/platform/qcom/venus/core.h | 1 + drivers/media/platform/qcom/venus/firmware.c | 10 +- drivers/media/platform/qcom/venus/helpers.c | 20 +- drivers/media/platform/qcom/venus/hfi_parser.c | 1 + drivers/media/platform/ti-vpe/cal.c | 29 +-- drivers/media/platform/vimc/vimc-streamer.c | 9 +- drivers/media/rc/keymaps/Makefile | 1 + drivers/media/rc/keymaps/rc-videostrong-kii-pro.c | 83 ++++++++ drivers/mmc/host/mmci_stm32_sdmmc.c | 4 +- drivers/mtd/nand/raw/cadence-nand-controller.c | 13 +- drivers/mtd/nand/spi/core.c | 17 +- drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c | 31 +-- drivers/net/wireless/ath/ath9k/main.c | 3 + drivers/nvme/host/fc.c | 14 +- drivers/nvme/target/fcloop.c | 1 - drivers/nvme/target/tcp.c | 2 +- drivers/pci/controller/dwc/pcie-qcom.c | 8 +- drivers/pci/endpoint/pci-epc-mem.c | 10 +- drivers/pci/hotplug/pciehp_hpc.c | 14 +- drivers/pci/pcie/aspm.c | 4 +- drivers/pci/quirks.c | 80 ++++++- drivers/pci/switch/switchtec.c | 2 +- drivers/platform/x86/asus-wmi.c | 5 +- drivers/remoteproc/qcom_q6v5_mss.c | 54 +++-- drivers/remoteproc/remoteproc_virtio.c | 7 + drivers/s390/scsi/zfcp_erp.c | 2 +- drivers/scsi/lpfc/lpfc.h | 1 + drivers/scsi/lpfc/lpfc_hbadisc.c | 59 ++++-- drivers/scsi/lpfc/lpfc_nvme.c | 2 - drivers/scsi/lpfc/lpfc_scsi.c | 4 +- drivers/scsi/mpt3sas/mpt3sas_scsih.c | 8 +- drivers/scsi/qla2xxx/qla_nvme.c | 1 - drivers/scsi/sr.c | 22 +- drivers/scsi/sr.h | 2 + drivers/scsi/ufs/ufshcd.c | 3 +- drivers/scsi/ufs/ufshcd.h | 6 + drivers/spi/spi-fsl-dspi.c | 25 +-- drivers/staging/media/allegro-dvt/allegro-core.c | 5 +- drivers/staging/media/hantro/hantro_h1_jpeg_enc.c | 9 +- drivers/staging/media/hantro/hantro_v4l2.c | 2 +- .../staging/media/hantro/rk3399_vpu_hw_jpeg_enc.c | 9 +- drivers/staging/media/imx/imx7-media-csi.c | 4 + drivers/staging/media/imx/imx7-mipi-csis.c | 2 +- drivers/staging/media/rkisp1/rkisp1-dev.c | 3 +- drivers/staging/media/rkisp1/rkisp1-isp.c | 4 +- drivers/staging/mt7621-pci/pci-mt7621.c | 3 +- drivers/staging/wilc1000/wlan.c | 1 - .../intel/int340x_thermal/int3400_thermal.c | 2 +- .../intel/int340x_thermal/int3403_thermal.c | 2 +- drivers/usb/dwc3/core.c | 5 + drivers/usb/dwc3/core.h | 4 + drivers/usb/gadget/composite.c | 9 + drivers/usb/gadget/function/f_fs.c | 1 + drivers/usb/host/xhci.c | 4 +- drivers/usb/phy/phy-tegra-usb.c | 3 +- drivers/usb/typec/ucsi/ucsi_ccg.c | 2 + drivers/vfio/platform/vfio_platform.c | 2 +- fs/btrfs/async-thread.c | 8 + fs/btrfs/async-thread.h | 1 + fs/btrfs/delayed-inode.c | 13 ++ fs/btrfs/disk-io.c | 27 ++- fs/btrfs/extent_io.c | 35 +++- fs/btrfs/file.c | 11 + fs/btrfs/qgroup.c | 11 +- fs/btrfs/relocation.c | 62 +++--- fs/btrfs/space-info.c | 43 +++- fs/cifs/file.c | 2 +- fs/cifs/inode.c | 23 +- fs/cifs/smb2ops.c | 4 + fs/debugfs/file.c | 18 +- fs/erofs/utils.c | 2 +- fs/exec.c | 2 +- fs/ext4/inode.c | 2 +- fs/filesystems.c | 4 +- fs/gfs2/glock.c | 3 + fs/gfs2/glops.c | 27 ++- fs/gfs2/log.c | 2 +- fs/gfs2/log.h | 1 + fs/hfsplus/attributes.c | 4 + fs/io_uring.c | 23 +- fs/nfs/fs_context.c | 5 +- fs/nfs/namespace.c | 12 +- fs/nfs/pagelist.c | 48 ++--- fs/nfs/write.c | 1 + fs/nfsd/nfsctl.c | 1 + fs/ocfs2/alloc.c | 4 + fs/pstore/inode.c | 5 +- fs/pstore/platform.c | 4 +- include/acpi/acpixf.h | 2 +- include/linux/cpu.h | 12 +- include/linux/devfreq_cooling.h | 2 +- include/linux/iocontext.h | 1 + include/linux/nvme-fc-driver.h | 4 - include/linux/pci-epc.h | 3 + include/linux/sched.h | 4 +- include/linux/xarray.h | 6 +- include/media/rc-map.h | 1 + include/trace/events/rcu.h | 1 + kernel/cpu.c | 4 +- kernel/dma/mapping.c | 2 + kernel/events/core.c | 150 ++++++------- kernel/irq/debugfs.c | 11 +- kernel/irq/irqdomain.c | 10 +- kernel/kmod.c | 4 +- kernel/locking/lockdep.c | 4 + kernel/rcu/tree.c | 36 ++-- kernel/sched/core.c | 1 - kernel/sched/cputime.c | 41 ++-- kernel/sched/fair.c | 29 ++- kernel/sched/sched.h | 8 +- kernel/seccomp.c | 1 + kernel/signal.c | 2 +- kernel/time/namespace.c | 1 + kernel/time/sched_clock.c | 9 +- kernel/trace/trace_kprobe.c | 2 + kernel/ucount.c | 1 + lib/test_xarray.c | 37 ++++ lib/xarray.c | 4 +- mm/memcontrol.c | 3 + security/keys/key.c | 2 +- security/keys/keyctl.c | 4 +- sound/core/oss/pcm_plugin.c | 32 ++- sound/pci/hda/hda_beep.c | 6 +- sound/pci/hda/hda_intel.c | 16 ++ sound/pci/hda/patch_realtek.c | 233 ++++++++++++--------- sound/pci/ice1712/prodigy_hifi.c | 4 +- sound/soc/codecs/cs4270.c | 40 +++- sound/soc/soc-dapm.c | 8 +- sound/soc/soc-ops.c | 4 +- sound/soc/soc-pcm.c | 6 +- sound/soc/soc-topology.c | 2 +- sound/usb/mixer_maps.c | 28 +++ tools/gpio/Makefile | 2 +- tools/perf/Makefile.config | 11 +- tools/testing/radix-tree/Makefile | 4 +- tools/testing/radix-tree/iteration_check_2.c | 87 ++++++++ tools/testing/radix-tree/main.c | 1 + tools/testing/radix-tree/test.h | 1 + tools/testing/selftests/powerpc/mm/.gitignore | 1 + tools/testing/selftests/powerpc/pmu/ebb/Makefile | 1 + tools/testing/selftests/vm/map_hugetlb.c | 14 +- tools/testing/selftests/vm/mlock2-tests.c | 233 ++++----------------- tools/testing/selftests/x86/ptrace_syscall.c | 8 +- 275 files changed, 2648 insertions(+), 1319 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 18/254 blk-mq: Fix a recently introduced regression in blk_mq_realloc_hw_ctxs()
From: Bart Van Assche <[email protected]>
[ Upstream commit d0930bb8f46b8fb4a7d429c0bf1c91b3ed00a7cf ]
q->nr_hw_queues must only be updated once it is known that blk_mq_realloc_hw_ctxs() has succeeded. Otherwise it can happen that reallocation fails and that q->nr_hw_queues is larger than the number of allocated hardware queues. This patch fixes the following crash if increasing the number of hardware queues fails:
BUG: KASAN: null-ptr-deref in blk_mq_map_swqueue+0x775/0x810 Write of size 8 at addr 0000000000000118 by task check/977 CPU: 3 PID: 977 Comm: check Not tainted 5.6.0-rc1-dbg+ #8 Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011 Call Trace: dump_stack+0xa5/0xe6 __kasan_report.cold+0x65/0x99 kasan_report+0x16/0x20 check_memory_region+0x140/0x1b0 memset+0x28/0x40 blk_mq_map_swqueue+0x775/0x810 blk_mq_update_nr_hw_queues+0x468/0x710 nullb_device_submit_queues_store+0xf7/0x1a0 [null_blk] configfs_write_file+0x1c4/0x250 [configfs] __vfs_write+0x4c/0x90 vfs_write+0x145/0x2c0 ksys_write+0xd7/0x180 __x64_sys_write+0x47/0x50 do_syscall_64+0x6f/0x2f0 entry_SYSCALL_64_after_hwframe+0x49/0xbe
--- block/blk-mq.c | 1 - 1 file changed, 1 deletion(-)
block/blk-mq.c +0 -1
@@ -2824,7 +2824,6 @@ static void blk_mq_realloc_hw_ctxs(struct blk_mq_tag_set *set,memcpy (new_hctxs, hctxs, q->nr_hw_queues *sizeof (*hctxs)); q->queue_hw_ctx = new_hctxs; - q->nr_hw_queues = set->nr_hw_queues;kfree (hctxs); hctxs = new_hctxs; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 9/254 media: staging: rkisp1: isp: do not set invalid mbus code for pad
In reply to Greg Kroah-HartmanFrom: Helen Koike <[email protected]>
[ Upstream commit 100f720aabab3d5f58f67c508186041b3c797a9b ]
When setting source pad, check if the given mbus code is indeed valid for source pad, if not, then set the default code.
Same for sink pad.
--- drivers/staging/media/rkisp1/rkisp1-isp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/media/rkisp1/rkisp1-isp.c +2 -2
@@ -683,7 +683,7 @@ static void rkisp1_isp_set_src_fmt(struct rkisp1_isp *isp, src_fmt->code = format->code; mbus_info =rkisp1_isp_mbus_info_get (src_fmt->code); -if (!mbus_info) { +if (!mbus_info || !(mbus_info->direction &RKISP1_DIR_SRC )) { src_fmt->code =RKISP1_DEF_SRC_PAD_FMT ; mbus_info =rkisp1_isp_mbus_info_get (src_fmt->code); }
@@ -767,7 +767,7 @@ static void rkisp1_isp_set_sink_fmt(struct rkisp1_isp *isp, which); sink_fmt->code = format->code; mbus_info =rkisp1_isp_mbus_info_get (sink_fmt->code); -if (!mbus_info) { +if (!mbus_info || !(mbus_info->direction &RKISP1_DIR_SINK )) { sink_fmt->code =RKISP1_DEF_SINK_PAD_FMT ; mbus_info =rkisp1_isp_mbus_info_get (sink_fmt->code); }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 6/254 media: vimc: streamer: fix memory leak in vimc subdevs if kthread_run fails
In reply to Greg Kroah-HartmanFrom: Dafna Hirschfeld <[email protected]>
[ Upstream commit ceeb2e6166dddf3c9757abbbf84032027e2fa2d2 ]
In case kthread_run fails, the vimc subdevices should be notified that streaming stopped so they can release the memory for the streaming. Also, kthread should be set to NULL.
--- drivers/media/platform/vimc/vimc-streamer.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/media/platform/vimc/vimc-streamer.c +7 -2
@@ -207,8 +207,13 @@ int vimc_streamer_s_stream(struct vimc_stream *stream, stream->kthread =kthread_run (vimc_streamer_thread, stream,"vimc-streamer thread" ); -if (IS_ERR (stream->kthread)) -return PTR_ERR (stream->kthread); +if (IS_ERR (stream->kthread)) { + ret =PTR_ERR (stream->kthread); +dev_err (ved->dev,"kthread_run failed with %d\n" , ret); +vimc_streamer_pipeline_terminate (stream); + stream->kthread =NULL ; +return ret; + } }else {if (!stream->kthread)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 7/254 media: hantro: fix extra MV/MC sync space calculation
In reply to Greg Kroah-HartmanFrom: Philipp Zabel <[email protected]>
[ Upstream commit 042584e9055b615ac917239884fb0d65690f56ec ]
Add space for MVs and MC sync data to the capture buffers depending on whether the post processor will be enabled for the new capture format passed to TRY_FMT, not the currently set capture format.
--- drivers/staging/media/hantro/hantro_v4l2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/hantro/hantro_v4l2.c +1 -1
@@ -295,7 +295,7 @@ static int vidioc_try_fmt(struct file *file, void *priv, struct v4l2_format *f,* +---------------------------+ */ if (ctx->vpu_src_fmt->fourcc ==V4L2_PIX_FMT_H264_SLICE && - !hantro_needs_postproc (ctx, ctx->vpu_dst_fmt)) + !hantro_needs_postproc (ctx, fmt)) pix_mp->plane_fmt[0 ].sizeimage +=64 *MB_WIDTH (pix_mp->width) *MB_WIDTH (pix_mp->height) +32 ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 5/254 staging: wilc1000: avoid double unlocking of wilc->hif_cs mutex
In reply to Greg Kroah-HartmanFrom: Ajay Singh <[email protected]>
[ Upstream commit 6c411581caef6e3b2c286871641018364c6db50a ]
Possible double unlocking of 'wilc->hif_cs' mutex was identified by smatch [1]. Removed the extra call to release_bus() in wilc_wlan_handle_txq() which was missed in earlier commit fdc2ac1aafc6 ("staging: wilc1000: support suspend/resume functionality").
[1]. https://lists.01.org/hyperkitty/list/[email protected]/thread/NOEVW7C3GV74EWXJO3XX6VT2NKVB2HMT/
--- drivers/staging/wilc1000/wlan.c | 1 - 1 file changed, 1 deletion(-)
drivers/staging/wilc1000/wlan.c +0 -1
@@ -572,7 +572,6 @@ int wilc_wlan_handle_txq(struct wilc *wilc, u32 *txq_count) entries = ((reg >>3 ) &0x3f );break ; } -release_bus (wilc,WILC_BUS_RELEASE_ALLOW_SLEEP ); }while (--timeout);if (timeout <=0 ) { ret = func->hif_write_reg (wilc,WILC_HOST_VMM_CTL ,0x0 );
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 2/254 cpufreq: imx6q: Fixes unwanted cpu overclocking on i.MX6ULL
In reply to Greg Kroah-HartmanFrom: Christoph Niedermaier <[email protected]>
[ Upstream commit 36eb7dc1bd42fe5f850329c893768ff89b696fba ]
imx6ul_opp_check_speed_grading is called for both i.MX6UL and i.MX6ULL. Since the i.MX6ULL was introduced to a separate ocotp compatible node later, it is possible that the i.MX6ULL has also dtbs with "fsl,imx6ull-ocotp". On a system without nvmem-cell speed grade a missing check on this node causes a driver fail without considering the cpu speed grade.
This patch prevents unwanted cpu overclocking on i.MX6ULL with compatible node "fsl,imx6ull-ocotp" in old dtbs without nvmem-cell speed grade.
--- drivers/cpufreq/imx6q-cpufreq.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/cpufreq/imx6q-cpufreq.c +3 -0
@@ -280,6 +280,9 @@ static int imx6ul_opp_check_speed_grading(struct device *dev)void __iomem *base; np =of_find_compatible_node (NULL ,NULL ,"fsl,imx6ul-ocotp" ); +if (!np) + np =of_find_compatible_node (NULL ,NULL , +"fsl,imx6ull-ocotp" );if (!np)return -ENOENT ;
Signature · 1 line
2.20.1
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.6.5 release. There are 254 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sat, 18 Apr 2020 13:11:20 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.6.5-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.6.y
and the diffstat can be found below.thanks,
greg k-h
Results from Linaro’s test farm.
No regressions on arm64, arm, x86_64, and i386.
Summary
------------------------------------------------------------------------
kernel: 5.6.5-rc1
git repo: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
git branch: linux-5.6.y
git commit: 576aa353744ce5f1279071363e4a55e97f486f39
git describe: v5.6.4-255-g576aa353744c
Test details: https://qa-reports.linaro.org/lkft/linux-stable-rc-5.6-oe/build/v5.6.4-255-g576aa353744c
No regressions (compared to build v5.6.3-39-g62251e4703ac)
No fixes (compared to build v5.6.3-39-g62251e4703ac)
Ran 33508 total tests in the following environments and test suites.
Environments
--------------
- dragonboard-410c
- hi6220-hikey
- i386
- juno-r2
- juno-r2-compat
- juno-r2-kasan
- nxp-ls2088
- qemu_arm
- qemu_arm64
- qemu_i386
- qemu_x86_64
- x15
- x86
- x86-kasan
Test Suites
-----------
* build
* install-android-platform-tools-r2600
* install-android-platform-tools-r2800
* libgpiod
* libhugetlbfs
* linux-log-parser
* ltp-cap_bounds-tests
* ltp-commands-tests
* ltp-containers-tests
* ltp-cpuhotplug-tests
* ltp-crypto-tests
* ltp-cve-tests
* ltp-fcntl-locktests-tests
* ltp-filecaps-tests
* ltp-fs-tests
* ltp-fs_bind-tests
* ltp-fs_perms_simple-tests
* ltp-fsx-tests
* ltp-hugetlb-tests
* ltp-ipc-tests
* ltp-math-tests
* ltp-mm-tests
* ltp-nptl-tests
* ltp-pty-tests
* ltp-securebits-tests
* ltp-syscalls-tests
* perf
* v4l2-compliance
* kvm-unit-tests
* kselftest
* ltp-dio-tests
* ltp-io-tests
* ltp-open-posix-tests
* ltp-sched-tests
* network-basic-tests
* spectre-meltdown-checker-test
* kselftest-vsyscall-mode-native
* kselftest-vsyscall-mode-none
Signature · 2 lines
Linaro LKFT https://lkft.linaro.org
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.6.5 release. There are 254 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sat, 18 Apr 2020 13:11:20 +0000. Anything received after that time might be too late.
Build results:
total: 155 pass: 155 fail: 0 Qemu test results: total: 428 pass: 428 fail: 0
Guenter
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.6.5 release. There are 254 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sat, 18 Apr 2020 13:11:20 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.6.5-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.6.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions. reboot and poweroff hang forever. I saw this problem on Linux 5.7rc1 as well.
AMD Ryzen 5 PRO 2400GE
I don't see this problem on Intel i7-8550U
I haven't started debugging yet. I will have to go back and check if it is introduced in 5.6.4-rc1. 5.6-3-rc2 is the last good one.
I will update you later on today with bisect data.
thanks,
-- Shuah
Greg Kroah-Hartman
maintainerQuoted 26 lines · shuah
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.6.5 release. There are 254 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sat, 18 Apr 2020 13:11:20 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.6.5-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.6.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions. reboot and poweroff hang forever. I saw this problem on Linux 5.7rc1 as well.
AMD Ryzen 5 PRO 2400GE
Quoted 7 lines
I don't see this problem on Intel i7-8550U
I haven't started debugging yet. I will have to go back and check if it is introduced in 5.6.4-rc1. 5.6-3-rc2 is the last good one.
I will update you later on today with bisect data.
Oh nice, we are bug-compatible with mainline :(
Thanks for the testing, let me know if you find the issue.
thanks,
greg k-h
Greg Kroah-Hartman
maintainerQuoted 6 lines · Guenter Roeck
Quoted 5 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.6.5 release. There are 254 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Quoted 8 lines
Quoted 3 lines
Responses should be made by Sat, 18 Apr 2020 13:11:20 +0000. Anything received after that time might be too late.
Build results:
total: 155 pass: 155 fail: 0 Qemu test results: total: 428 pass: 428 fail: 0
Thanks for testing all of these and letting me know.
greg k-h
Greg Kroah-Hartman
maintainerQuoted 17 lines · Naresh Kamboju
Quoted 15 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.6.5 release. There are 254 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sat, 18 Apr 2020 13:11:20 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.6.5-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.6.y
and the diffstat can be found below.
Quoted 6 lines
Quoted 3 lines
thanks,
greg k-h
Results from Linaro’s test farm.
No regressions on arm64, arm,x86_64, and i386.
Great! Thanks for testing and letting me know.
greg k-h
Jon Hunter
maintainerQuoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.6.5 release. There are 254 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sat, 18 Apr 2020 13:11:20 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.6.5-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.6.y
and the diffstat can be found below.thanks,
greg k-h
All tests are passing for Tegra ...
Test results for stable-v5.6:
13 builds: 13 pass, 0 fail
24 boots: 24 pass, 0 fail
40 tests: 40 pass, 0 failLinux version: 5.6.5-rc1-g576aa353744c
Boards tested: tegra124-jetson-tk1, tegra186-p2771-0000,
tegra194-p2972-0000, tegra20-ventana,
tegra210-p2371-2180, tegra210-p3450-0000,
tegra30-cardhu-a04Cheers
Jon
Signature · 1 line
nvpublic
Greg Kroah-Hartman
maintainerQuoted 27 lines · Jon Hunter
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.6.5 release. There are 254 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sat, 18 Apr 2020 13:11:20 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.6.5-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.6.y
and the diffstat can be found below.thanks,
greg k-h
All tests are passing for Tegra ...
Test results for stable-v5.6:
13 builds: 13 pass, 0 fail 24 boots: 24 pass, 0 fail 40 tests: 40 pass, 0 fail
Quoted 6 lines
Linux version: 5.6.5-rc1-g576aa353744c
Boards tested: tegra124-jetson-tk1, tegra186-p2771-0000,tegra194-p2972-0000, tegra20-ventana, tegra210-p2371-2180, tegra210-p3450-0000, tegra30-cardhu-a04
Thanks for testing all of these and letting me know.
greg k-h
Quoted 29 lines · Greg Kroah-Hartman
Quoted 28 lines · shuah
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.6.5 release. There are 254 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sat, 18 Apr 2020 13:11:20 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.6.5-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.6.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions. reboot and poweroff hang forever. I saw this problem on Linux 5.7rc1 as well.
AMD Ryzen 5 PRO 2400GE
I don't see this problem on Intel i7-8550U
Quoted 8 lines
Quoted 5 lines
I haven't started debugging yet. I will have to go back and check if it is introduced in 5.6.4-rc1. 5.6-3-rc2 is the last good one.
I will update you later on today with bisect data.
Oh nice, we are bug-compatible with mainline :(
Okay success. I reverted it and Linux 5.6-rc1 no longer hangs on reboot/poweroff
git bisect bad a655a99c9f6a1d819d695fca6d48b450449f45ee is the first bad commit
Okay success. I reverted it and Linux 5.6-rc1 no longer hangs on reboot/poweroff
I am building Linux 5.7-rc1 with this reverted now.
Details and full bisect log. I am building Linux 5.7-rc1 with this reverted now.
commit a655a99c9f6a1d819d695fca6d48b450449f45ee
Author: Prike Liang <[email protected]> Date: Tue Apr 7 20:21:26 2020 +0800
drm/amdgpu: fix gfx hang during suspend with video playback (v2)
[ Upstream commit 487eca11a321ef33bcf4ca5adb3c0c4954db1b58 ]
The system will be hang up during S3 suspend because of SMU is pending for GC not respose the register CP_HQD_ACTIVE access request.This issue root cause of accessing the GC register under enter GFX CGGPG and can be fixed by disable GFX CGPG before perform suspend.
v2: Use disable the GFX CGPG instead of RLC safe mode guard.
:040000 040000 95fb17ff249bfc19d8b65119fdcb5a4ced21d487 7a62a4762daedbb41f0eda5831a116ad2c2b8077 M drivers
Full bisect log:
git bisect start
# good: [0a27a29496060843ae3a8fe78aaec0062cbd5dfa] Linux 5.6.4
git bisect good 0a27a29496060843ae3a8fe78aaec0062cbd5dfa
# bad: [576aa353744ce5f1279071363e4a55e97f486f39] Linux 5.6.5-rc1
git bisect bad 576aa353744ce5f1279071363e4a55e97f486f39
# good: [7509db5d111a5763a199902052eecc480e0ec724] x86/tsc_msr: Make MSR derived TSC frequency more accurate git bisect good 7509db5d111a5763a199902052eecc480e0ec724
# good: [15f1ead7d7966d087352ba2cf81a1759b25ad163] scsi: lpfc: Fix broken Credit Recovery after driver load
git bisect good 15f1ead7d7966d087352ba2cf81a1759b25ad163
# good: [9e52b4ab5fadd803c8c2e617aa8c151720757fb1] s390/diag: fix display of diagnose call statistics
git bisect good 9e52b4ab5fadd803c8c2e617aa8c151720757fb1
# good: [3e1e6903924fd6c95db7e46c5baa41dfa0f46fdb] powerpc/hash64/devmap: Use H_PAGE_THP_HUGE when setting up huge devmap PTE entries git bisect good 3e1e6903924fd6c95db7e46c5baa41dfa0f46fdb
# good: [0344e0fee2f904ebce1d58bec8ace3ee9cf5f777] drm/dp_mst: Fix clearing payload state on topology disable git bisect good 0344e0fee2f904ebce1d58bec8ace3ee9cf5f777
# bad: [136881c0420bb52d5f21f75688f5aee1cf401737] perf/core: Unify {pinned,flexible}_sched_in()
git bisect bad 136881c0420bb52d5f21f75688f5aee1cf401737
# bad: [0d928b424b99cfe0e7806c530f6039a053d5082d] drm/i915/ggtt: do not set bits 1-11 in gen12 ptes
git bisect bad 0d928b424b99cfe0e7806c530f6039a053d5082d
# bad: [a655a99c9f6a1d819d695fca6d48b450449f45ee] drm/amdgpu: fix gfx hang during suspend with video playback (v2) git bisect bad a655a99c9f6a1d819d695fca6d48b450449f45ee
# first bad commit: [a655a99c9f6a1d819d695fca6d48b450449f45ee] drm/amdgpu: fix gfx hang during suspend with video playback (v2)
thanks,
-- Shuah