5.0.7-stable review
Subsystems (12)
Greg Kroah-Hartman
maintainerPATCH 57/246 mm/resource: Return real error codes from walk failures
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 5cd401ace914dc68556c6d2fcae0c349444d5f86 ]
walk_system_ram_range() can return an error code either becuase *it* failed, or because the 'func' that it calls returned an error. The memory hotplug does the following:
ret = walk_system_ram_range(..., func);
if (ret)
return ret;and 'ret' makes it out to userspace, eventually. The problem s, walk_system_ram_range() failues that result from *it* failing (as opposed to 'func') return -1. That leads to a very odd -EPERM (-1) return code out to userspace.
Make walk_system_ram_range() return -EINVAL for internal failures to keep userspace less confused.
This return code is compatible with all the callers that I audited.
--- kernel/resource.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/resource.c +2 -2
@@ -382,7 +382,7 @@ static int __walk_iomem_res_desc(resource_size_t start, resource_size_t end, int (*func)(struct resource *, void *)) {struct resource res; -int ret =-1 ; +int ret = -EINVAL ;while (start < end && !find_next_iomem_res (start, end, flags, desc, first_lvl, &res)) {
@@ -462,7 +462,7 @@ int walk_system_ram_range(unsigned long start_pfn, unsigned long nr_pages,unsigned long flags;struct resource res;unsigned long pfn, end_pfn; -int ret =-1 ; +int ret = -EINVAL ; start = (u64 ) start_pfn <<PAGE_SHIFT ; end = ((u64)(start_pfn + nr_pages) <<PAGE_SHIFT ) -1 ;
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 60/246 mt76: fix a leaked reference by adding a missing of_node_put
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 34e022d8b780a03902d82fb3997ba7c7b1f40c81 ]
The call to of_find_node_by_phandle returns a node pointer with refcount incremented thus it must be explicitly decremented after the last usage.
Detected by coccinelle with the following warnings:
./drivers/net/wireless/mediatek/mt76/eeprom.c:58:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 48, but without a corresponding object release within this function. ./drivers/net/wireless/mediatek/mt76/eeprom.c:61:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 48, but without a corresponding object release within this function. ./drivers/net/wireless/mediatek/mt76/eeprom.c:67:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 48, but without a corresponding object release within this function. ./drivers/net/wireless/mediatek/mt76/eeprom.c:70:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 48, but without a corresponding object release within this function. ./drivers/net/wireless/mediatek/mt76/eeprom.c:72:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 48, but without a corresponding object release within this function.
--- drivers/net/wireless/mediatek/mt76/eeprom.c | 24 ++++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-)
drivers/net/wireless/mediatek/mt76/eeprom.c +16 -8
@@ -54,22 +54,30 @@ mt76_get_of_eeprom(struct mt76_dev *dev, int len) part = np->name; mtd =get_mtd_device_nm (part); -if (IS_ERR (mtd)) -return PTR_ERR (mtd); +if (IS_ERR (mtd)) { + ret =PTR_ERR (mtd); + goto out_put_node; + } -if (size <=sizeof (*list)) -return -EINVAL ; +if (size <=sizeof (*list)) { + ret = -EINVAL ; + goto out_put_node; + } offset =be32_to_cpup (list); ret =mtd_read (mtd, offset, len, &retlen, dev->eeprom.data);put_mtd_device (mtd);if (ret) -return ret; + goto out_put_node; -if (retlen < len) -return -EINVAL ; +if (retlen < len) { + ret = -EINVAL ; + goto out_put_node; + } -return 0 ; +out_put_node: +of_node_put (np); +return ret;#else return -ENOENT ;#endif
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 111/246 SoC: imx-sgtl5000: add missing put_device()
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 8fa857da9744f513036df1c43ab57f338941ae7d ]
The of_find_device_by_node() takes a reference to the underlying device structure, we should release that reference.
Detected by coccinelle with the following warnings:
./sound/soc/fsl/imx-sgtl5000.c:169:1-7: ERROR: missing put_device; call of_find_device_by_node on line 105, but without a corresponding object release within this function. ./sound/soc/fsl/imx-sgtl5000.c:177:1-7: ERROR: missing put_device; call of_find_device_by_node on line 105, but without a corresponding object release within this function.
--- sound/soc/fsl/imx-sgtl5000.c | 1 + 1 file changed, 1 insertion(+)
sound/soc/fsl/imx-sgtl5000.c +1 -0
@@ -108,6 +108,7 @@ static int imx_sgtl5000_probe(struct platform_device *pdev) ret = -EPROBE_DEFER ; goto fail; } +put_device (&ssi_pdev->dev); codec_dev =of_find_i2c_device_by_node (codec_np);if (!codec_dev) {dev_err (&pdev->dev,"failed to find codec platform device\n" );
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 121/246 gpio: of: Apply regulator-gpio quirk only to enable-gpios
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 0e7d6f94016407fd7e1ae472e254d64d4454e9c8 ]
Since commit d6cd33ad7102 ("regulator: gpio: Convert to use descriptors") the GPIO regulator had inverted the polarity of the control GPIO. This problem manifested itself on systems with DT containing the following description (snippet from salvator-common.dtsi):
gpios = <&gpio5 1 GPIO_ACTIVE_HIGH>; gpios-states = <1>; states = <3300000 1 1800000 0>;
Prior to the aforementioned commit, the gpio-regulator code used gpio_request_array() to claim the GPIO(s) specified in the "gpios" DT node, while the commit changed that to devm_gpiod_get_index().
The legacy gpio_request_array() calls gpio_request_one() and then gpiod_request(), which parses the DT flags of the "gpios" node and populates the GPIO descriptor flags field accordingly.
The new devm_gpiod_get_index() calls gpiod_get_index(), then of_find_gpio(), of_get_named_gpiod_flags() with flags != NULL, and then of_gpio_flags_quirks(). Since commit a603a2b8d86e ("gpio: of: Add special quirk to parse regulator flags"), of_gpio_flags_quirks() contains a quirk for regulator-gpio which was never triggered by the legacy gpio_request_array() code path, but is triggered by devm_gpiod_get_index() code path.
This quirk checks whether a GPIO is associated with a fixed or gpio-regulator and if so, checks two additional conditions. First, whether such GPIO is active-low, and if so, ignores the active-low flag. Second, whether the regulator DT node does have an "enable-active-high" property and if the property is NOT present, sets the GPIO flags as active-low.
The second check triggers a problem, since it is applied to all GPIOs associated with a gpio-regulator, rather than only on the "enable" GPIOs, as the old code did. This changes the way the gpio-regulator interprets the DT description of the control GPIOs.
The old code using gpio_request_array() explicitly parsed the "enable-active-high" DT property and only applied it to the GPIOs described in the "enable-gpios" DT node, and only if those were present.
This patch fixes the quirk code by only applying the quirk to "enable-gpios", thus restoring the old behavior.
--- drivers/gpio/gpiolib-of.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpio/gpiolib-of.c +1 -0
@@ -84,6 +84,7 @@ static void of_gpio_flags_quirks(struct device_node *np,* Note that active low is the default. */ if (IS_ENABLED (CONFIG_REGULATOR ) && + !strcmp (propname,"enable-gpio" ) && (of_device_is_compatible (np,"regulator-fixed" ) ||of_device_is_compatible (np,"reg-fixed-voltage" ) ||of_device_is_compatible (np,"regulator-gpio" ))) {
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 126/246 efi: Fix build error due to enum collision between efi.h and ima.h
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 5c418dc789a3898717ebf2caa5716ba91a7150b2 ]
The following commit:
a893ea15d764 ("tpm: move tpm_chip definition to include/linux/tpm.h")
introduced a build error when both IMA and EFI are enabled:
In file included from ../security/integrity/ima/ima_fs.c:30:
../security/integrity/ima/ima.h:176:7: error: redeclaration of enumerator "NONE"
What happens is that both headers (ima.h and efi.h) defines the same 'NONE' constant, and it broke when they started getting included from the same file:
Rework to prefix the EFI enum with 'EFI_*'.
--- arch/x86/platform/efi/quirks.c | 4 +-- drivers/firmware/efi/runtime-wrappers.c | 48 ++++++++++++------------- include/linux/efi.h | 26 +++++++------- 3 files changed, 39 insertions(+), 39 deletions(-)
arch/x86/platform/efi/quirks.c +2 -2
@@ -717,7 +717,7 @@ void efi_recover_from_page_fault(unsigned long phys_addr)* "efi_mm" cannot be used to check if the page fault had occurred * in the firmware context because efi=old_map doesn't use efi_pgd. */ -if (efi_rts_work.efi_rts_id ==NONE ) +if (efi_rts_work.efi_rts_id ==EFI_NONE )return ;/*
@@ -742,7 +742,7 @@ void efi_recover_from_page_fault(unsigned long phys_addr)* because this case occurs *very* rarely and hence could be improved * on a need by basis. */ -if (efi_rts_work.efi_rts_id ==RESET_SYSTEM ) { +if (efi_rts_work.efi_rts_id ==EFI_RESET_SYSTEM ) {pr_info ("efi_reset_system() buggy! Reboot through BIOS\n" );machine_real_restart (MRR_BIOS );return ;
drivers/firmware/efi/runtime-wrappers.c +24 -24
165 lines not on this page · raw message
include/linux/efi.h +13 -13
@@ -1699,19 +1699,19 @@ extern int efi_tpm_eventlog_init(void);* fault happened while executing an efi runtime service. */ enum efi_rts_ids { -NONE , -GET_TIME , -SET_TIME , -GET_WAKEUP_TIME , -SET_WAKEUP_TIME , -GET_VARIABLE , -GET_NEXT_VARIABLE , -SET_VARIABLE , -QUERY_VARIABLE_INFO , -GET_NEXT_HIGH_MONO_COUNT , -RESET_SYSTEM , -UPDATE_CAPSULE , -QUERY_CAPSULE_CAPS , +EFI_NONE , +EFI_GET_TIME , +EFI_SET_TIME , +EFI_GET_WAKEUP_TIME , +EFI_SET_WAKEUP_TIME , +EFI_GET_VARIABLE , +EFI_GET_NEXT_VARIABLE , +EFI_SET_VARIABLE , +EFI_QUERY_VARIABLE_INFO , +EFI_GET_NEXT_HIGH_MONO_COUNT , +EFI_RESET_SYSTEM , +EFI_UPDATE_CAPSULE , +EFI_QUERY_CAPSULE_CAPS , };/*
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 166/246 perf/aux: Make perf_event accessible to setup_aux()
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 840018668ce2d96783356204ff282d6c9b0e5f66 ]
When pmu::setup_aux() is called the coresight PMU needs to know which sink to use for the session by looking up the information in the event's attr::config2 field.
As such simply replace the cpu information by the complete perf_event structure and change all affected customers.
--- arch/s390/kernel/perf_cpum_sf.c | 6 +++--- arch/x86/events/intel/bts.c | 4 +++- arch/x86/events/intel/pt.c | 5 +++-- drivers/hwtracing/coresight/coresight-etm-perf.c | 6 +++--- drivers/perf/arm_spe_pmu.c | 6 +++--- include/linux/perf_event.h | 2 +- kernel/events/ring_buffer.c | 2 +- 7 files changed, 17 insertions(+), 14 deletions(-)
arch/s390/kernel/perf_cpum_sf.c +3 -3
@@ -1600,7 +1600,7 @@ static void aux_sdb_init(unsigned long sdb)/* * aux_buffer_setup() - Setup AUX buffer for diagnostic mode sampling -* @cpu: On which to allocate, -1 means current +* @event: Event the buffer is setup for, event->cpu == -1 means current * @pages: Array of pointers to buffer pages passed from perf core * @nr_pages: Total pages * @snapshot: Flag for snapshot mode
@@ -1612,8 +1612,8 @@ static void aux_sdb_init(unsigned long sdb)* * Return the private AUX buffer structure if success or NULL if fails. */ -static void *aux_buffer_setup (int cpu,void **pages,int nr_pages, -bool snapshot) +static void *aux_buffer_setup (struct perf_event *event,void **pages, +int nr_pages,bool snapshot) {struct sf_buffer *sfb;struct aux_buffer *aux;
arch/x86/events/intel/bts.c +3 -1
@@ -77,10 +77,12 @@ static size_t buf_size(struct page *page) }static void * -bts_buffer_setup_aux (int cpu,void **pages,int nr_pages,bool overwrite) +bts_buffer_setup_aux (struct perf_event *event,void **pages, +int nr_pages,bool overwrite) {struct bts_buffer *buf;struct page *page; +int cpu = event->cpu;int node = (cpu ==-1 ) ? cpu :cpu_to_node (cpu);unsigned long offset;size_t size = nr_pages <<PAGE_SHIFT ;
arch/x86/events/intel/pt.c +3 -2
@@ -1114,10 +1114,11 @@ static int pt_buffer_init_topa(struct pt_buffer *buf, unsigned long nr_pages,* Return: Our private PT buffer structure. */ static void * -pt_buffer_setup_aux (int cpu,void **pages,int nr_pages,bool snapshot) +pt_buffer_setup_aux (struct perf_event *event,void **pages, +int nr_pages,bool snapshot) {struct pt_buffer *buf; -int node, ret; +int node, ret, cpu = event->cpu;if (!nr_pages)return NULL ;
drivers/hwtracing/coresight/coresight-etm-perf.c +3 -3
@@ -177,15 +177,15 @@ static void etm_free_aux(void *data)schedule_work (&event_data->work); } -static void *etm_setup_aux (int event_cpu,void **pages, +static void *etm_setup_aux (struct perf_event *event,void **pages,int nr_pages,bool overwrite) { -int cpu; +int cpu = event->cpu;cpumask_t *mask;struct coresight_device *sink;struct etm_event_data *event_data =NULL ; - event_data =alloc_event_data (event_cpu); + event_data =alloc_event_data (cpu);if (!event_data)return NULL ;INIT_WORK (&event_data->work, free_event_data);
drivers/perf/arm_spe_pmu.c +3 -3
@@ -824,10 +824,10 @@ static void arm_spe_pmu_read(struct perf_event *event) { } -static void *arm_spe_pmu_setup_aux (int cpu,void **pages,int nr_pages, -bool snapshot) +static void *arm_spe_pmu_setup_aux (struct perf_event *event,void **pages, +int nr_pages,bool snapshot) { -int i; +int i, cpu = event->cpu;struct page **pglist;struct arm_spe_pmu_buf *buf;
include/linux/perf_event.h +1 -1
@@ -409,7 +409,7 @@ struct pmu {/* * Set up pmu-private data structures for an AUX area */ -void *(*setup_aux) (int cpu,void **pages, +void *(*setup_aux) (struct perf_event *event,void **pages,int nr_pages,bool overwrite);/* optional */
kernel/events/ring_buffer.c +1 -1
@@ -658,7 +658,7 @@ int rb_alloc_aux(struct ring_buffer *rb, struct perf_event *event, goto out; } - rb->aux_priv = event->pmu->setup_aux (event->cpu, rb->aux_pages, nr_pages, + rb->aux_priv = event->pmu->setup_aux (event, rb->aux_pages, nr_pages, overwrite);if (!rb->aux_priv) goto out;
Signature · 9 lines
2.19.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Greg Kroah-Hartman
maintainerPATCH 173/246 ASoC: fsl-asoc-card: fix object reference leaks in fsl_asoc_card_probe
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 11907e9d3533648615db08140e3045b829d2c141 ]
The of_find_device_by_node() takes a reference to the underlying device structure, we should release that reference.
--- sound/soc/fsl/fsl-asoc-card.c | 1 + 1 file changed, 1 insertion(+)
sound/soc/fsl/fsl-asoc-card.c +1 -0
@@ -689,6 +689,7 @@ static int fsl_asoc_card_probe(struct platform_device *pdev) asrc_fail:of_node_put (asrc_np);of_node_put (codec_np); +put_device (&cpu_pdev->dev); fail:of_node_put (cpu_np);
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 175/246 efi/memattr: Dont bail on zero VA if it equals the regions PA
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 5de0fef0230f3c8d75cff450a71740a7bf2db866 ]
The EFI memory attributes code cross-references the EFI memory map with the more granular EFI memory attributes table to ensure that they are in sync before applying the strict permissions to the regions it describes.
Since we always install virtual mappings for the EFI runtime regions to which these strict permissions apply, we currently perform a sanity check on the EFI memory descriptor, and ensure that the EFI_MEMORY_RUNTIME bit is set, and that the virtual address has been assigned.
However, in cases where a runtime region exists at physical address 0x0, and the virtual mapping equals the physical mapping, e.g., when running in mixed mode on x86, we encounter a memory descriptor with the runtime attribute and virtual address 0x0, and incorrectly draw the conclusion that a runtime region exists for which no virtual mapping was installed, and give up altogether. The consequence of this is that firmware mappings retain their read-write-execute permissions, making the system more vulnerable to attacks.
So let's only bail if the virtual address of 0x0 has been assigned to a physical region that does not reside at address 0x0.
--- drivers/firmware/efi/memattr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/firmware/efi/memattr.c +1 -1
@@ -94,7 +94,7 @@ static bool entry_is_valid(const efi_memory_desc_t *in, efi_memory_desc_t *out)if (!(md->attribute &EFI_MEMORY_RUNTIME ))continue ; -if (md->virt_addr ==0 ) { +if (md->virt_addr ==0 && md->phys_addr !=0 ) {/* no virtual mapping has been installed by the stub */ break ; }
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 180/246 efi/arm/arm64: Allow SetVirtualAddressMap() to be omitted
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 4e46c2a956215482418d7b315749fb1b6c6bc224 ]
The UEFI spec revision 2.7 errata A section 8.4 has the following to say about the virtual memory runtime services:
"This section contains function definitions for the virtual memory support that may be optionally used by an operating system at runtime. If an operating system chooses to make EFI runtime service calls in a virtual addressing mode instead of the flat physical mode, then the operating system must use the services in this section to switch the EFI runtime services from flat physical addressing to virtual addressing."
So it is pretty clear that calling SetVirtualAddressMap() is entirely optional, and so there is no point in doing so unless it achieves anything useful for us.
This is not the case for 64-bit ARM. The identity mapping used by the firmware is arbitrarily converted into another permutation of userland addresses (i.e., bits [63:48] cleared), and the runtime code could easily deal with the original layout in exactly the same way as it deals with the converted layout. However, due to constraints related to page size differences if the OS is not running with 4k pages, and related to systems that may expose the individual sections of PE/COFF runtime modules as different memory regions, creating the virtual layout is a bit fiddly, and requires us to sort the memory map and reason about adjacent regions with identical memory types etc etc.
So the obvious fix is to stop calling SetVirtualAddressMap() altogether on arm64 systems. However, to avoid surprises, which are notoriously hard to diagnose when it comes to OS<->firmware interactions, let's start by making it an opt-out feature, and implement support for the 'efi=novamap' kernel command line parameter on ARM and arm64 systems.
( Note that 32-bit ARM generally does require SetVirtualAddressMap() to be
used, given that the physical memory map and the kernel virtual address map are not guaranteed to be non-overlapping like on arm64. However, having support for efi=novamap,noruntime on 32-bit ARM, combined with the recently proposed support for earlycon=efifb, is likely to be useful to diagnose boot issues on such systems if they have no accessible serial port. )
--- drivers/firmware/efi/libstub/arm-stub.c | 5 +++++ drivers/firmware/efi/libstub/efi-stub-helper.c | 10 ++++++++++ drivers/firmware/efi/libstub/efistub.h | 1 + drivers/firmware/efi/libstub/fdt.c | 3 +++ 4 files changed, 19 insertions(+)
drivers/firmware/efi/libstub/arm-stub.c +5 -0
@@ -367,6 +367,11 @@ void efi_get_virtmap(efi_memory_desc_t *memory_map, unsigned long map_size, paddr = in->phys_addr; size = in->num_pages *EFI_PAGE_SIZE ; +if (novamap ()) { + in->virt_addr = in->phys_addr; +continue ; + } +/* * Make the mapping compatible with 64k pages: this allows * a 4k page size kernel to kexec a 64k page size kernel and
drivers/firmware/efi/libstub/efi-stub-helper.c +10 -0
@@ -34,6 +34,7 @@ static unsigned long __chunk_size = EFI_READ_CHUNK_SIZE; static int __section(.data) __nokaslr; static int __section(.data) __quiet; +static int __section(.data) __novamap; int __pure nokaslr(void) {
@@ -43,6 +44,10 @@ int __pure is_quiet(void) {return __quiet; } +int __pure novamap (void ) +{ +return __novamap; +}#define EFI_MMAP_NR_SLACK_SLOTS 8
@@ -482,6 +487,11 @@ efi_status_t efi_parse_options(char const *cmdline) __chunk_size =-1UL ; } +if (!strncmp (str,"novamap" ,7 )) { + str +=strlen ("novamap" ); + __novamap =1 ; + } +/* Group words together, delimited by "," */ while (*str && *str !=' ' && *str !=',' ) str++;
drivers/firmware/efi/libstub/efistub.h +1 -0
@@ -27,6 +27,7 @@extern int __pure nokaslr (void );extern int __pure is_quiet (void ); +extern int __pure novamap (void );#define pr_efi (sys_table, msg) do { \ if (!is_quiet()) efi_printk(sys_table, "EFI stub: "msg); \
drivers/firmware/efi/libstub/fdt.c +3 -0
@@ -327,6 +327,9 @@ efi_status_t allocate_new_fdt_and_exit_boot(efi_system_table_t *sys_table,if (status ==EFI_SUCCESS ) {efi_set_virtual_address_map_t *svam; +if (novamap ()) +return EFI_SUCCESS ; +/* Install the new virtual address map */ svam = sys_table->runtime->set_virtual_address_map; status = svam(runtime_entry_count * desc_size, desc_size,
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 1/246 ext4: cleanup bh release code in ext4_ind_remove_space()
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: zhangyi (F) <[email protected]>
commit 5e86bdda41534e17621d5a071b294943cae4376e upstream.
Currently, we are releasing the indirect buffer where we are done with it in ext4_ind_remove_space(), so we can see the brelse() and BUFFER_TRACE() everywhere. It seems fragile and hard to read, and we may probably forget to release the buffer some day. This patch cleans up the code by putting of the code which releases the buffers to the end of the function.
--- fs/ext4/indirect.c | 47 ++++++++++++++++++++++------------------------- 1 file changed, 22 insertions(+), 25 deletions(-)
fs/ext4/indirect.c +22 -25
@@ -1219,6 +1219,7 @@ int ext4_ind_remove_space(handle_t *handext4_lblk_t offsets[4 ], offsets2[4 ];Indirect chain[4 ], chain2[4 ];Indirect *partial, *partial2; +Indirect *p =NULL , *p2 =NULL ;ext4_lblk_t max_block;__le32 nr =0 , nr2 =0 ;int n =0 , n2 =0 ;
@@ -1260,7 +1261,7 @@ int ext4_ind_remove_space(handle_t *hand } - partial =ext4_find_shared (inode, n, offsets, chain, &nr); + partial = p =ext4_find_shared (inode, n, offsets, chain, &nr);if (nr) {if (partial == chain) {/* Shared branch grows from the inode */
@@ -1285,13 +1286,11 @@ int ext4_ind_remove_space(handle_t *hand partial->p +1 , (__le32 *)partial->bh->b_data+addr_per_block, (chain+n-1) - partial); -BUFFER_TRACE (partial->bh,"call brelse" ); -brelse (partial->bh); partial--; } end_range: - partial2 =ext4_find_shared (inode, n2, offsets2, chain2, &nr2); + partial2 = p2 =ext4_find_shared (inode, n2, offsets2, chain2, &nr2);if (nr2) {if (partial2 == chain2) {/*
@@ -1321,16 +1320,14 @@ end_range: (__le32 *)partial2->bh->b_data, partial2->p, (chain2+n2-1) - partial2); -BUFFER_TRACE (partial2->bh,"call brelse" ); -brelse (partial2->bh); partial2--; } goto do_indirects; }/* Punch happened within the same level (n == n2) */ - partial =ext4_find_shared (inode, n, offsets, chain, &nr); - partial2 =ext4_find_shared (inode, n2, offsets2, chain2, &nr2); + partial = p =ext4_find_shared (inode, n, offsets, chain, &nr); + partial2 = p2 =ext4_find_shared (inode, n2, offsets2, chain2, &nr2);/* Free top, but only if partial2 isn't its subtree. */ if (nr) {
@@ -1387,15 +1384,7 @@ end_range: partial->p +1 , partial2->p, (chain+n-1) - partial); -while (partial > chain) { -BUFFER_TRACE (partial->bh,"call brelse" ); -brelse (partial->bh); - } -while (partial2 > chain2) { -BUFFER_TRACE (partial2->bh,"call brelse" ); -brelse (partial2->bh); - } -return 0 ; + goto cleanup; }/*
@@ -1410,8 +1399,6 @@ end_range: partial->p +1 , (__le32 *)partial->bh->b_data+addr_per_block, (chain+n-1) - partial); -BUFFER_TRACE (partial->bh,"call brelse" ); -brelse (partial->bh); partial--; }if (partial2 > chain2 && depth2 <= depth) {
@@ -1419,11 +1406,21 @@ end_range: (__le32 *)partial2->bh->b_data, partial2->p, (chain2+n2-1) - partial2); -BUFFER_TRACE (partial2->bh,"call brelse" ); -brelse (partial2->bh); partial2--; } } + +cleanup: +while (p && p > chain) { +BUFFER_TRACE (p->bh,"call brelse" ); +brelse (p->bh); + p--; + } +while (p2 && p2 > chain2) { +BUFFER_TRACE (p2->bh,"call brelse" ); +brelse (p2->bh); + p2--; + }return 0 ; do_indirects:
@@ -1431,7 +1428,7 @@ do_indirects:switch (offsets[0 ]) {default :if (++n >= n2) -return 0 ; +break ; nr = i_data[EXT4_IND_BLOCK ];if (nr) {ext4_free_branches (handle, inode,NULL , &nr, &nr+1 ,1 );
@@ -1439,7 +1436,7 @@ do_indirects: }case EXT4_IND_BLOCK :if (++n >= n2) -return 0 ; +break ; nr = i_data[EXT4_DIND_BLOCK ];if (nr) {ext4_free_branches (handle, inode,NULL , &nr, &nr+1 ,2 );
@@ -1447,7 +1444,7 @@ do_indirects: }case EXT4_DIND_BLOCK :if (++n >= n2) -return 0 ; +break ; nr = i_data[EXT4_TIND_BLOCK ];if (nr) {ext4_free_branches (handle, inode,NULL , &nr, &nr+1 ,3 );
@@ -1456,5 +1453,5 @@ do_indirects:case EXT4_TIND_BLOCK : ; } -return 0 ; + goto cleanup; }
Greg Kroah-Hartman
maintainerPATCH 2/246 CIFS: fix POSIX lock leak and invalid ptr deref
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit bc31d0cdcfbadb6258b45db97e93b1c83822ba33 ]
We have a customer reporting crashes in lock_get_status() with many "Leaked POSIX lock" messages preceeding the crash.
Leaked POSIX lock on dev=0x0:0x56 ...
Leaked POSIX lock on dev=0x0:0x56 ...
Leaked POSIX lock on dev=0x0:0x56 ...
Leaked POSIX lock on dev=0x0:0x53 ...
Leaked POSIX lock on dev=0x0:0x53 ...
Leaked POSIX lock on dev=0x0:0x53 ...
Leaked POSIX lock on dev=0x0:0x53 ...
POSIX: fl_owner=ffff8900e7b79380 fl_flags=0x1 fl_type=0x1 fl_pid=20709 Leaked POSIX lock on dev=0x0:0x4b ino...
Leaked locks on dev=0x0:0x4b ino=0xf911400000029:
POSIX: fl_owner=ffff89f41c870e00 fl_flags=0x1 fl_type=0x1 fl_pid=19592
stack segment: 0000 [#1] SMP Modules linked in: binfmt_misc msr tcp_diag udp_diag inet_diag unix_diag af_packet_diag netlink_diag rpcsec_gss_krb5 arc4 ecb auth_rpcgss nfsv4 md4 nfs nls_utf8 lockd grace cifs sunrpc ccm dns_resolver fscache af_packet iscsi_ibft iscsi_boot_sysfs vmw_vsock_vmci_transport vsock xfs libcrc32c sb_edac edac_core crct10dif_pclmul crc32_pclmul ghash_clmulni_intel drbg ansi_cprng vmw_balloon aesni_intel aes_x86_64 lrw gf128mul glue_helper ablk_helper cryptd joydev pcspkr vmxnet3 i2c_piix4 vmw_vmci shpchp fjes processor button ac btrfs xor raid6_pq sr_mod cdrom ata_generic sd_mod ata_piix vmwgfx crc32c_intel drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops ttm serio_raw ahci libahci drm libata vmw_pvscsi sg dm_multipath dm_mod scsi_dh_rdac scsi_dh_emc scsi_dh_alua scsi_mod autofs4
Supported: Yes
CPU: 6 PID: 28250 Comm: lsof Not tainted 4.4.156-94.64-default #1 Hardware name: VMware, Inc. VMware Virtual Platform/440BX Desktop Reference Platform, BIOS 6.00 04/05/2016 task: ffff88a345f28740 ti: ffff88c74005c000 task.ti: ffff88c74005c000 RIP: 0010:[<ffffffff8125dcab>] [<ffffffff8125dcab>] lock_get_status+0x9b/0x3b0 RSP: 0018:ffff88c74005fd90 EFLAGS: 00010202 RAX: ffff89bde83e20ae RBX: ffff89e870003d18 RCX: 0000000049534f50 RDX: ffffffff81a3541f RSI: ffffffff81a3544e RDI: ffff89bde83e20ae RBP: 0026252423222120 R08: 0000000020584953 R09: 000000000000ffff R10: 0000000000000000 R11: ffff88c74005fc70 R12: ffff89e5ca7b1340 R13: 00000000000050e5 R14: ffff89e870003d30 R15: ffff89e5ca7b1340 FS: 00007fafd64be800(0000) GS:ffff89f41fd00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000001c80018 CR3: 000000a522048000 CR4: 0000000000360670 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Stack: 0000000000000208 ffffffff81a3d6b6 ffff89e870003d30 ffff89e870003d18 ffff89e5ca7b1340 ffff89f41738d7c0 ffff89e870003d30 ffff89e5ca7b1340 ffffffff8125e08f 0000000000000000 ffff89bc22b67d00 ffff88c74005ff28 Call Trace: [<ffffffff8125e08f>] locks_show+0x2f/0x70 [<ffffffff81230ad1>] seq_read+0x251/0x3a0 [<ffffffff81275bbc>] proc_reg_read+0x3c/0x70 [<ffffffff8120e456>] __vfs_read+0x26/0x140 [<ffffffff8120e9da>] vfs_read+0x7a/0x120 [<ffffffff8120faf2>] SyS_read+0x42/0xa0 [<ffffffff8161cbc3>] entry_SYSCALL_64_fastpath+0x1e/0xb7
When Linux closes a FD (close(), close-on-exec, dup2(), ...) it calls filp_close() which also removes all posix locks.
The lock struct is initialized like so in filp_close() and passed down to cifs
...
lock.fl_type = F_UNLCK;
lock.fl_flags = FL_POSIX | FL_CLOSE;
lock.fl_start = 0;
lock.fl_end = OFFSET_MAX;
...Note the FL_CLOSE flag, which hints the VFS code that this unlocking is done for closing the fd.
filp_close()
locks_remove_posix(filp, id);
vfs_lock_file(filp, F_SETLK, &lock, NULL);
return filp->f_op->lock(filp, cmd, fl) => cifs_lock()
rc = cifs_setlk(file, flock, type, wait_flag, posix_lck, lock, unlock, xid);
rc = server->ops->mand_unlock_range(cfile, flock, xid);
if (flock->fl_flags & FL_POSIX && !rc)
rc = locks_lock_file_wait(file, flock)Notice how we don't call locks_lock_file_wait() which does the generic VFS lock/unlock/wait work on the inode if rc != 0.
If we are closing the handle, the SMB server is supposed to remove any locks associated with it. Similarly, cifs.ko frees and wakes up any lock and lock waiter when closing the file:
cifs_close()
cifsFileInfo_put(file->private_data)
/*
* Delete any outstanding lock records. We'll lose them when the file
* is closed anyway.
*/
down_write(&cifsi->lock_sem);
list_for_each_entry_safe(li, tmp, &cifs_file->llist->locks, llist) {
list_del(&li->llist);
cifs_del_lock_waiters(li);
kfree(li);
}
list_del(&cifs_file->llist->llist);
kfree(cifs_file->llist);
up_write(&cifsi->lock_sem);So we can safely ignore unlocking failures in cifs_lock() if they happen with the FL_CLOSE flag hint set as both the server and the client take care of it during the actual closing.
This is not a proper fix for the unlocking failure but it's safe and it seems to prevent the lock leakages and crashes the customer experiences.
--- fs/cifs/file.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
fs/cifs/file.c +13 -1
@@ -1645,8 +1645,20 @@ cifs_setlk(struct file *file, struct file_lock *flock, __u32 type, rc = server->ops->mand_unlock_range (cfile, flock, xid); out: -if (flock->fl_flags &FL_POSIX && !rc) +if (flock->fl_flags &FL_POSIX ) { +/* +* If this is a request to remove all locks because we +* are closing the file, it doesn't matter if the +* unlocking failed as both cifs.ko and the SMB server +* remove the lock on file close +*/ +if (rc) { +cifs_dbg (VFS ,"%s failed rc=%d\n" , __func__, rc); +if (!(flock->fl_flags &FL_CLOSE )) +return rc; + } rc =locks_lock_file_wait (file, flock); + }return rc; }
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 3/246 nvme-fc: fix numa_node when dev is null
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 06f3d71ea071b70e62bcc146cd9ff7ed1f9d4e43 ]
A recent change added a numa_node field to the nvme controller and has the transport assign the node using dev_to_node(). However, fcloop registers with a NULL device struct, so the dev_to_node() call oops.
Revise the assignment to assign no node when device struct is null.
--- drivers/nvme/host/fc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/nvme/host/fc.c +4 -1
@@ -3018,7 +3018,10 @@ nvme_fc_init_ctrl(struct device *dev, struct nvmf_ctrl_options *opts, ctrl->ctrl.opts = opts; ctrl->ctrl.nr_reconnects =0 ; - ctrl->ctrl.numa_node =dev_to_node (lport->dev); +if (lport->dev) + ctrl->ctrl.numa_node =dev_to_node (lport->dev); +else + ctrl->ctrl.numa_node =NUMA_NO_NODE ;INIT_LIST_HEAD (&ctrl->ctrl_list); ctrl->lport = lport; ctrl->rport = rport;
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 5/246 h8300: use cc-cross-prefix instead of hardcoding h8300-unknown-linux-
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit fc2b47b55f17fd996f7a01975ce1c33c2f2513f6 ]
It believe it is a bad idea to hardcode a specific compiler prefix that may or may not be installed on a user's system. It is annoying when testing features that should not require compilers at all.
For example, mrproper, headers_install, etc. should work without any compiler.
They look like follows on my machine.
$ make ARCH=h8300 mrproper ./scripts/gcc-version.sh: line 26: h8300-unknown-linux-gcc: command not found ./scripts/gcc-version.sh: line 27: h8300-unknown-linux-gcc: command not found make: h8300-unknown-linux-gcc: Command not found make: h8300-unknown-linux-gcc: Command not found [ a bunch of the same error messages continue ]
$ make ARCH=h8300 headers_install ./scripts/gcc-version.sh: line 26: h8300-unknown-linux-gcc: command not found ./scripts/gcc-version.sh: line 27: h8300-unknown-linux-gcc: command not found make: h8300-unknown-linux-gcc: Command not found HOSTCC scripts/basic/fixdep make: h8300-unknown-linux-gcc: Command not found WRAP arch/h8300/include/generated/uapi/asm/kvm_para.h [ snip ]
The solution is to delete this line, or to use cc-cross-prefix like some architectures do. I chose the latter as a moderate fixup.
I added an alternative 'h8300-linux-' because it is available at:
https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/8.1.0/
--- arch/h8300/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/h8300/Makefile +1 -1
@@ -27,7 +27,7 @@ KBUILD_LDFLAGS += $(ldflags-y) CHECKFLAGS += -msize-long ifeq ($(CROSS_COMPILE),) -CROSS_COMPILE := h8300-unknown-linux- +CROSS_COMPILE := $(call cc-cross-prefix, h8300-unknown-linux- h8300-linux-) endif core-y += arch/$(ARCH)/kernel/ arch/$(ARCH)/mm/
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 7/246 f2fs: fix to avoid deadlock in f2fs_read_inline_dir()
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit aadcef64b22f668c1a107b86d3521d9cac915c24 ]
As Jiqun Li reported in bugzilla:
https://bugzilla.kernel.org/show_bug.cgi?id=202883
sometimes, dead lock when make system call SYS_getdents64 with fsync() is called by another process.
monkey running on android9.0
1. task 9785 held sbi->cp_rwsem and waiting lock_page()
2. task 10349 held mm_sem and waiting sbi->cp_rwsem
3. task 9709 held lock_page() and waiting mm_sem
so this is a dead lock scenario.
task stack is show by crash tools as following
crash_arm64> bt ffffffc03c354080
PID: 9785 TASK: ffffffc03c354080 CPU: 1 COMMAND: "RxIoScheduler-3"
Quoted 1 line
Quoted 1 line
#7 [
ffffffc01b50fac0]__lock_pageatffffff80081b11e8
crash-arm64> bt 10349
PID: 10349 TASK: ffffffc018b83080 CPU: 1 COMMAND: "BUGLY_ASYNC_UPL"
Quoted 1 line
Quoted 1 line
#3 [
ffffffc01f8cfa40]rwsem_down_read_failedatffffff8008a93afc
PC: 00000033 LR: 00000000 SP: 00000000 PSTATE: ffffffffffffffff
crash-arm64> bt 9709
PID: 9709 TASK: ffffffc03e7f3080 CPU: 1 COMMAND: "IntentService[A"
Quoted 2 lines
Quoted 2 lines
#3 [
ffffffc001e67850]rwsem_down_read_failedatffffff8008a93afc#8 [ffffffc001e67b80]el1_iaatffffff8008084fc4
PC: ffffff8008274114 [compat_filldir64+120]
LR: ffffff80083584d4 [f2fs_fill_dentries+448]
SP: ffffffc001e67b80 PSTATE: 80400145
X29: ffffffc001e67b80 X28: 0000000000000000 X27: 000000000000001a
X26: 00000000000093d7 X25: ffffffc070d52480 X24: 0000000000000008
X23: 0000000000000028 X22: 00000000d43dfd60 X21: ffffffc001e67e90
X20: 0000000000000011 X19: ffffff80093a4000 X18: 0000000000000000
X17: 0000000000000000 X16: 0000000000000000 X15: 0000000000000000
X14: ffffffffffffffff X13: 0000000000000008 X12: 0101010101010101
X11: 7f7f7f7f7f7f7f7f X10: 6a6a6a6a6a6a6a6a X9: 7f7f7f7f7f7f7f7f
X8: 0000000080808000 X7: ffffff800827409c X6: 0000000080808000
X5: 0000000000000008 X4: 00000000000093d7 X3: 000000000000001a
X2: 0000000000000011 X1: ffffffc070d52480 X0: 0000000000800238Quoted 1 line
Quoted 1 line
#9 [
ffffffc001e67be0]f2fs_fill_dentriesatffffff80083584d0
PC: 0000003c LR: 00000000 SP: 00000000 PSTATE: 000000d9
X12: f48a02ff X11: d4678960 X10: d43dfc00 X9: d4678ae4
X8: 00000058 X7: d4678994 X6: d43de800 X5: 000000d9
X4: d43dfc0c X3: d43dfc10 X2: d46799c8 X1: 00000000
X0: 00001068Below potential deadlock will happen between three threads:
Thread A Thread B Thread C
- f2fs_do_sync_file
- f2fs_write_checkpoint
- down_write(&sbi->node_change) -- 1)
- do_page_fault
- down_write(&mm->mmap_sem) -- 2)
- do_wp_page
- f2fs_vm_page_mkwrite
- getdents64
- f2fs_read_inline_dir
- lock_page -- 3)
- f2fs_sync_node_pages
- lock_page -- 3)
- __do_map_lock
- down_read(&sbi->node_change) -- 1)
- f2fs_fill_dentries
- dir_emit
- compat_filldir64
- do_page_fault
- down_read(&mm->mmap_sem) -- 2)
Since f2fs_readdir is protected by inode.i_rwsem, there should not be any updates in inode page, we're safe to lookup dents in inode page without its lock held, so taking off the lock to improve concurrency of readdir and avoid potential deadlock.
--- fs/f2fs/inline.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
fs/f2fs/inline.c +7 -1
@@ -659,6 +659,12 @@ int f2fs_read_inline_dir(struct file *file, struct dir_context *ctx,if (IS_ERR (ipage))return PTR_ERR (ipage); +/* +* f2fs_readdir was protected by inode.i_rwsem, it is safe to access +* ipage without page's lock held. +*/ +unlock_page (ipage); + inline_dentry =inline_data_addr (inode, ipage);make_dentry_ptr_inline (inode, &d, inline_dentry);
@@ -667,7 +673,7 @@ int f2fs_read_inline_dir(struct file *file, struct dir_context *ctx,if (!err) ctx->pos = d.max; -f2fs_put_page (ipage,1 ); +f2fs_put_page (ipage,0 );return err <0 ? err :0 ; }
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 6/246 f2fs: fix to adapt small inline xattr space in __find_inline_xattr()
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 2c28aba8b2e2a51749fa66e01b68e1cd5b53e022 ]
With below testcase, we will fail to find existed xattr entry:
1. mkfs.f2fs -O extra_attr -O flexible_inline_xattr /dev/zram0
2. mount -t f2fs -o inline_xattr_size=1 /dev/zram0 /mnt/f2fs/
3. touch /mnt/f2fs/file
4. setfattr -n "user.name" -v 0 /mnt/f2fs/file
5. getfattr -n "user.name" /mnt/f2fs/file
/mnt/f2fs/file: user.name: No such attribute
The reason is for inode which has very small inline xattr size, __find_inline_xattr() will fail to traverse any entry due to first entry may not be loaded from xattr node yet, later, we may skip to check entire xattr datas in __find_xattr(), result in such wrong condition.
This patch adds condition to check such case to avoid this issue.
--- fs/f2fs/xattr.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
fs/f2fs/xattr.c +10 -3
@@ -224,11 +224,11 @@ static struct f2fs_xattr_entry *__find_inline_xattr(struct inode *inode, {struct f2fs_xattr_entry *entry;unsigned int inline_size =inline_xattr_size (inode); +void *max_addr = base_addr + inline_size;list_for_each_xattr (entry, base_addr) { -if ((void *)entry +sizeof (__u32) > base_addr + inline_size || - (void *)XATTR_NEXT_ENTRY (entry) +sizeof (__u32) > - base_addr + inline_size) { +if ((void *)entry +sizeof (__u32) > max_addr || + (void *)XATTR_NEXT_ENTRY (entry) > max_addr) { *last_addr = entry;return NULL ; }
@@ -239,6 +239,13 @@ static struct f2fs_xattr_entry *__find_inline_xattr(struct inode *inode,if (!memcmp (entry->e_name, name, len))break ; } + +/* inline xattr header or entry across max inline xattr size */ +if (IS_XATTR_LAST_ENTRY (entry) && + (void *)entry +sizeof (__u32) > max_addr) { + *last_addr = entry; +return NULL ; + }return entry; }
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 8/246 apparmor: fix double free when unpack of secmark rules fails
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit d8dbb581d4f86a2ac669c056fc71a28ebeb367f4 ]
if secmark rules fail to unpack a double free happens resulting in the following oops
[ 1295.584074] audit: type=1400 audit(1549970525.256:51): apparmor="STATUS" info="failed to unpack profile secmark rules" error=-71 profile="unconfined" name="/root/test" pid=29882 comm="apparmor_parser" name="/root/test" offset=120 [ 1374.042334] ------------[ cut here ]------------ [ 1374.042336] kernel BUG at mm/slub.c:294! [ 1374.042404] invalid opcode: 0000 [#1] SMP PTI [ 1374.042436] CPU: 0 PID: 29921 Comm: apparmor_parser Not tainted 4.20.7-042007-generic #201902061234 [ 1374.042461] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1ubuntu1 04/01/2014 [ 1374.042489] RIP: 0010:kfree+0x164/0x180 [ 1374.042502] Code: 74 05 41 0f b6 72 51 4c 89 d7 e8 37 cd f8 ff eb 8b 41 b8 01 00 00 00 48 89 d9 48 89 da 4c 89 d6 e8 11 f6 ff ff e9 72 ff ff ff <0f> 0b 49 8b 42 08 a8 01 75 c2 0f 0b 48 8b 3d a9 f4 19 01 e9 c5 fe [ 1374.042552] RSP: 0018:ffffaf7b812d7b90 EFLAGS: 00010246 [ 1374.042568] RAX: ffff91e437679200 RBX: ffff91e437679200 RCX: ffff91e437679200 [ 1374.042589] RDX: 00000000000088b6 RSI: ffff91e43da27060 RDI: ffff91e43d401a80 [ 1374.042609] RBP: ffffaf7b812d7ba8 R08: 0000000000027080 R09: ffffffffa6627a6d [ 1374.042629] R10: ffffd3af41dd9e40 R11: ffff91e43a1740dc R12: ffff91e3f52e8000 [ 1374.042650] R13: ffffffffa6627a6d R14: ffffffffffffffb9 R15: 0000000000000001 [ 1374.042675] FS: 00007f928df77740(0000) GS:ffff91e43da00000(0000) knlGS:0000000000000000 [ 1374.042697] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 1374.042714] CR2: 000055a0c3ab6b50 CR3: 0000000079ed8004 CR4: 0000000000360ef0 [ 1374.042737] Call Trace: [ 1374.042750] kzfree+0x2d/0x40 [ 1374.042763] aa_free_profile+0x12b/0x270 [ 1374.042776] unpack_profile+0xc1/0xf10 [ 1374.042790] aa_unpack+0x115/0x4e0 [ 1374.042802] aa_replace_profiles+0x8e/0xcc0 [ 1374.042817] ? kvmalloc_node+0x6d/0x80 [ 1374.042831] ? __check_object_size+0x166/0x192 [ 1374.042845] policy_update+0xcf/0x1b0 [ 1374.042858] profile_load+0x7d/0xa0 [ 1374.042871] __vfs_write+0x3a/0x190 [ 1374.042883] ? apparmor_file_permission+0x1a/0x20 [ 1374.042899] ? security_file_permission+0x31/0xc0 [ 1374.042918] ? _cond_resched+0x19/0x30 [ 1374.042931] vfs_write+0xab/0x1b0 [ 1374.042963] ksys_write+0x55/0xc0 [ 1374.043004] __x64_sys_write+0x1a/0x20 [ 1374.043046] do_syscall_64+0x5a/0x110 [ 1374.043087] entry_SYSCALL_64_after_hwframe+0x44/0xa9
--- security/apparmor/policy_unpack.c | 1 + 1 file changed, 1 insertion(+)
security/apparmor/policy_unpack.c +1 -0
@@ -579,6 +579,7 @@ fail:kfree (profile->secmark[i].label);kfree (profile->secmark); profile->secmark_count =0 ; + profile->secmark =NULL ; } e->pos = pos;
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 9/246 tracing: kdb: Fix ftdump to not sleep
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 31b265b3baaf55f209229888b7ffea523ddab366 ]
As reported back in 2016-11 [1], the "ftdump" kdb command triggers a BUG for "sleeping function called from invalid context".
kdb's "ftdump" command wants to call ring_buffer_read_prepare() in atomic context. A very simple solution for this is to add allocation flags to ring_buffer_read_prepare() so kdb can call it without triggering the allocation error. This patch does that.
Note that in the original email thread about this, it was suggested that perhaps the solution for kdb was to either preallocate the buffer ahead of time or create our own iterator. I'm hoping that this alternative of adding allocation flags to ring_buffer_read_prepare() can be considered since it means I don't need to duplicate more of the core trace code into "trace_kdb.c" (for either creating my own iterator or re-preparing a ring allocator whose memory was already allocated).
NOTE: another option for kdb is to actually figure out how to make it reuse the existing ftrace_dump() function and totally eliminate the duplication. This sounds very appealing and actually works (the "sr z" command can be seen to properly dump the ftrace buffer). The downside here is that ftrace_dump() fully consumes the trace buffer. Unless that is changed I'd rather not use it because it means "ftdump | grep xyz" won't be very useful to search the ftrace buffer since it will throw away the whole trace on the first grep. A future patch to dump only the last few lines of the buffer will also be hard to implement.
[1] https://lkml.kernel.org/r/[email protected]
--- include/linux/ring_buffer.h | 2 +- kernel/trace/ring_buffer.c | 5 +++-- kernel/trace/trace.c | 6 ++++-- kernel/trace/trace_kdb.c | 6 ++++-- 4 files changed, 12 insertions(+), 7 deletions(-)
include/linux/ring_buffer.h +1 -1
@@ -128,7 +128,7 @@ ring_buffer_consume(struct ring_buffer *buffer, int cpu, u64 *ts, unsigned long *lost_events);struct ring_buffer_iter * -ring_buffer_read_prepare (struct ring_buffer *buffer,int cpu); +ring_buffer_read_prepare (struct ring_buffer *buffer,int cpu,gfp_t flags);void ring_buffer_read_prepare_sync (void );void ring_buffer_read_start (struct ring_buffer_iter *iter);void ring_buffer_read_finish (struct ring_buffer_iter *iter);
kernel/trace/ring_buffer.c +3 -2
@@ -4205,6 +4205,7 @@ EXPORT_SYMBOL_GPL(ring_buffer_consume);* ring_buffer_read_prepare - Prepare for a non consuming read of the buffer * @buffer: The ring buffer to read from * @cpu: The cpu buffer to iterate over +* @flags: gfp flags to use for memory allocation * * This performs the initial preparations necessary to iterate * through the buffer. Memory is allocated, buffer recording
@@ -4222,7 +4223,7 @@ EXPORT_SYMBOL_GPL(ring_buffer_consume);* This overall must be paired with ring_buffer_read_finish. */ struct ring_buffer_iter * -ring_buffer_read_prepare (struct ring_buffer *buffer,int cpu) +ring_buffer_read_prepare (struct ring_buffer *buffer,int cpu,gfp_t flags) {struct ring_buffer_per_cpu *cpu_buffer;struct ring_buffer_iter *iter;
@@ -4230,7 +4231,7 @@ ring_buffer_read_prepare(struct ring_buffer *buffer, int cpu)if (!cpumask_test_cpu (cpu, buffer->cpumask))return NULL ; - iter =kmalloc (sizeof (*iter),GFP_KERNEL ); + iter =kmalloc (sizeof (*iter), flags);if (!iter)return NULL ;
kernel/trace/trace.c +4 -2
@@ -3904,7 +3904,8 @@ __tracing_open(struct inode *inode, struct file *file, bool snapshot)if (iter->cpu_file ==RING_BUFFER_ALL_CPUS ) {for_each_tracing_cpu (cpu) { iter->buffer_iter[cpu] = -ring_buffer_read_prepare (iter->trace_buffer->buffer, cpu); +ring_buffer_read_prepare (iter->trace_buffer->buffer, + cpu,GFP_KERNEL ); }ring_buffer_read_prepare_sync ();for_each_tracing_cpu (cpu) {
@@ -3914,7 +3915,8 @@ __tracing_open(struct inode *inode, struct file *file, bool snapshot) }else { cpu = iter->cpu_file; iter->buffer_iter[cpu] = -ring_buffer_read_prepare (iter->trace_buffer->buffer, cpu); +ring_buffer_read_prepare (iter->trace_buffer->buffer, + cpu,GFP_KERNEL );ring_buffer_read_prepare_sync ();ring_buffer_read_start (iter->buffer_iter[cpu]);tracing_iter_reset (iter, cpu);
kernel/trace/trace_kdb.c +4 -2
@@ -51,14 +51,16 @@ static void ftrace_dump_buf(int skip_lines, long cpu_file)if (cpu_file ==RING_BUFFER_ALL_CPUS ) {for_each_tracing_cpu (cpu) { iter.buffer_iter[cpu] = -ring_buffer_read_prepare (iter.trace_buffer->buffer, cpu); +ring_buffer_read_prepare (iter.trace_buffer->buffer, + cpu,GFP_ATOMIC );ring_buffer_read_start (iter.buffer_iter[cpu]);tracing_iter_reset (&iter, cpu); } }else { iter.cpu_file = cpu_file; iter.buffer_iter[cpu_file] = -ring_buffer_read_prepare (iter.trace_buffer->buffer, cpu_file); +ring_buffer_read_prepare (iter.trace_buffer->buffer, + cpu_file,GFP_ATOMIC );ring_buffer_read_start (iter.buffer_iter[cpu_file]);tracing_iter_reset (&iter, cpu_file); }
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainercover 5.0.7-stable review
This is the start of the stable review cycle for the 5.0.7 release. There are 246 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 Apr 6 08:44:36 UTC 2019. 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.0.7-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.0.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 5.0.7-rc1
Coly Li <[email protected]>
bcache: fix potential div-zero error of writeback_rate_p_term_inverse
Hans de Goede <[email protected]>
ACPI / video: Extend chassis-type detection with a "Lunch Box" check
Thierry Reding <[email protected]>
gpio: of: Restrict enable-gpio quirk to regulator-gpio
Arnd Bergmann <[email protected]>
appletalk: Fix compile regression
Nathan Chancellor <[email protected]>
net: stmmac: Avoid one more sometimes uninitialized Clang warning
Ville Syrjälä <[email protected]>
drm/dp/mst: Configure no_stop_bit correctly for remote i2c xfers
Chris Wilson <[email protected]>
drm: Reorder set_property_atomic to avoid returning with an active ww_ctx
Kuninori Morimoto <[email protected]>
ASoC: simple-card-utils: check "reg" property on asoc_simple_card_get_dai_id()
Hans de Goede <[email protected]>
Input: soc_button_array - fix mapping of the 5th GPIO in a PNP0C40 device
Jeremy Fertic <[email protected]>
staging: iio: adt7316: fix dac_bits assignment
Ben Dooks <[email protected]>
dmaengine: tegra: avoid overflow of byte tracking
Katsuhiro Suzuki <[email protected]>
clk: rockchip: fix frac settings of GPLL clock for rk3328
Marek Vasut <[email protected]>
ARM: shmobile: Fix R-Car Gen2 regulator quirk
Jerome Brunet <[email protected]>
clk: meson: clean-up clock registration
Peter Wu <[email protected]>
drm/fb-helper: fix leaks in error path of drm_fb_helper_fbdev_setup
Rafael Ávila de Espíndola <[email protected]>
x86/build: Mark per-CPU symbols as absolute explicitly for LLD
Zumeng Chen <[email protected]>
wlcore: Fix memory leak in case wl12xx_fetch_firmware failure
Hans de Goede <[email protected]>
brcmfmac: Use firmware_request_nowarn for the clm_blob
Ondrej Mosnacek <[email protected]>
selinux: do not override context on context mounts
George Rimar <[email protected]>
x86/build: Specify elf_i386 linker emulation explicitly for i386 objects
Daniel Vetter <[email protected]>
drm/nouveau: Stop using drm_crtc_force_disable
Paul Kocialkowski <[email protected]>
drm: Auto-set allow_fb_modifiers when given modifiers at plane init
Martin Blumenstingl <[email protected]>
pinctrl: meson: meson8b: add the eth_rxd2 and eth_rxd3 pins
Axel Lin <[email protected]>
regulator: act8865: Fix act8600_sudcdc_voltage_ranges setting
Richard Guy Briggs <[email protected]>
audit: hand taken context to audit_kill_trees for syscall logging
Mika Westerberg <[email protected]>
PCI: pciehp: Assign ctrl->slot_ctrl before writing it to hardware
Pawe? Chmiel <[email protected]>
media: s5p-jpeg: Check for fmt_ver_flag when doing fmt enumeration
Steve Longerbeam <[email protected]>
media: rcar-vin: Allow independent VIN link enablement
Florian Westphal <[email protected]>
netfilter: physdev: relax br_netfilter dependency
Shunyong Yang <[email protected]>
dmaengine: qcom_hidma: initialize tx flags in hidma_prep_dma_*
Shunyong Yang <[email protected]>
dmaengine: qcom_hidma: assign channel cookie correctly
Anders Roxell <[email protected]>
dmaengine: imx-dma: fix warning comparison of distinct pointer types
Valentin Schneider <[email protected]>
cpu/hotplug: Mute hotplug lockdep during init
Takeshi Kihara <[email protected]>
pinctrl: sh-pfc: r8a77995: Fix MOD_SEL bit numbering
Takeshi Kihara <[email protected]>
pinctrl: sh-pfc: r8a77990: Fix MOD_SEL bit numbering
Xingyu Chen <[email protected]>
pinctrl: meson: fix G12A ao pull registers base address
Buland Singh <[email protected]>
hpet: Fix missing '=' character in the __setup() code of hpet_mmap_enable
Chao Yu <[email protected]>
f2fs: fix to initialize variable to avoid UBSAN/smatch warning
Sheng Yong <[email protected]>
f2fs: UBSAN: set boolean value iostat_enable correctly
Song Hongyan <[email protected]>
HID: intel-ish: ipc: handle PIMR before ish_wakeup also clear PISR busy_clear bit
Stanislav Fomichev <[email protected]>
selftests/bpf: suppress readelf stderr when probing for BTF support
Timo Alho <[email protected]>
soc/tegra: fuse: Fix illegal free of IO base address
David Tolnay <[email protected]>
hwrng: virtio - Avoid repeated init of completion
Akinobu Mita <[email protected]>
media: mt9m111: set initial frame size other than 0x0
Tony Jones <[email protected]>
perf script python: Add trace_context extension module to sys.modules
Tony Jones <[email protected]>
perf script python: Use PyBytes for attr in trace-event-python
Arnaldo Carvalho de Melo <[email protected]>
perf trace: Fixup etcsnoop example
Jérôme de Bretagne <[email protected]>
platform/x86: intel-hid: Missing power button release on some Dell models
Roger Quadros <[email protected]>
usb: dwc3: gadget: Fix OTG events when gadget driver isn't loaded
Axel Lin <[email protected]>
regulator: mcp16502: Include linux/gpio/consumer.h to fix build error
Takashi Sakamoto <[email protected]>
ALSA: dice: add support for Solid State Logic Duende Classic/Mini
Nicholas Kazlauskas <[email protected]>
drm/amd/display: Enable vblank interrupt during CRC capture
Nathan Fontenot <[email protected]>
powerpc/pseries: Perform full re-add of CPU for topology update post-migration
Manfred Schlaegl <[email protected]>
tty: increase the default flip buffer limit to 2*640K
Chen-Yu Tsai <[email protected]>
backlight: pwm_bl: Use gpiod_get_value_cansleep() to get initial state
Oleg Nesterov <[email protected]>
cgroup/pids: turn cgroup_subsys->free() into cgroup_subsys->release() to fix the accounting
Nicolai Stange <[email protected]>
powerpc/64s: Clear on-stack exception marker upon exception return
Stanislav Fomichev <[email protected]>
selftests/bpf: skip verifier tests for unsupported program types
Valdis Kletnieks <[email protected]>
bpf: fix missing prototype warnings
Paolo Valente <[email protected]>
block, bfq: fix queue removal from weights tree
Paolo Valente <[email protected]>
block, bfq: fix in-service-queue check for queue merging
Russell King <[email protected]>
ARM: avoid Cortex-A9 livelock on tight dmb loops
Vladimir Murzin <[email protected]>
ARM: 8830/1: NOMMU: Toggle only bits in EXC_RETURN we are really care of
Stanislaw Gruszka <[email protected]>
mt7601u: bump supported EEPROM version
Stephen Boyd <[email protected]>
drm/msm/dpu: Convert to a chained irq chip
Alexey Khoroshilov <[email protected]>
soc: qcom: gsbi: Fix error handling in gsbi_probe()
Ard Biesheuvel <[email protected]>
efi/arm/arm64: Allow SetVirtualAddressMap() to be omitted
Mathieu Malaterre <[email protected]>
ARM: dts: lpc32xx: Remove leading 0x and 0s from bindings notation
Shayenne Moura <[email protected]>
drm/vkms: Bugfix extra vblank frame
Shayenne Moura <[email protected]>
drm/vkms: Bugfix racing hrtimer vblank handle
Andrea Parri <[email protected]>
sched/core: Use READ_ONCE()/WRITE_ONCE() in move_queued_task()/task_rq_lock()
Ard Biesheuvel <[email protected]>
efi/memattr: Don't bail on zero VA if it equals the region's PA
Hidetoshi Seto <[email protected]>
sched/debug: Initialize sd_sysctl_cpus if !CONFIG_CPUMASK_OFFSTACK
wen yang <[email protected]>
ASoC: fsl-asoc-card: fix object reference leaks in fsl_asoc_card_probe
Johannes Berg <[email protected]>
iwlwifi: mvm: fix RFH config command with >=10 CPUs
Stefan Roese <[email protected]>
staging: spi: mt7621: Add return code check on device_reset()
Thierry Reding <[email protected]>
i2c: of: Try to find an I2C adapter matching the parent
Rajneesh Bhardwaj <[email protected]>
platform/x86: intel_pmc_core: Fix PCH IP sts reading
Kai-Heng Feng <[email protected]>
e1000e: Exclude device from suspend direct complete optimization
Konstantin Khlebnikov <[email protected]>
e1000e: fix cyclic resets at link up with active tx
Mathieu Poirier <[email protected]>
perf/aux: Make perf_event accessible to setup_aux()
Nicholas Kazlauskas <[email protected]>
drm/amd/display: Disconnect mpcc when changing tg
Breno Leitao <[email protected]>
powerpc/ptrace: Mitigate potential Spectre v1
Kairui Song <[email protected]>
x86/kexec: Fill in acpi_rsdp_addr from the first kernel
Breno Leitao <[email protected]>
bpf: test_maps: fix possible out of bound access warning
Nicholas Kazlauskas <[email protected]>
drm/amd/display: Don't re-program planes for DPMS changes
Julia Lawall <[email protected]>
drm: rcar-du: add missing of_node_put
Guenter Roeck <[email protected]>
cdrom: Fix race condition in cdrom_sysctl_register
Manfred Schlaegl <[email protected]>
fbdev: fbmem: fix memory access if logo is bigger than the screen
Heiner Kallweit <[email protected]>
net: phy: consider latched link-down status in polling mode
Raju Rangoju <[email protected]>
iw_cxgb4: fix srqidx leak during connection abort
Russell King <[email protected]>
net: marvell: mvpp2: fix stuck in-band SGMII negotiation
Thomas Gleixner <[email protected]>
genirq: Avoid summation loops for /proc/stat
Coly Li <[email protected]>
bcache: improve sysfs_strtoul_clamp()
Coly Li <[email protected]>
bcache: fix potential div-zero error of writeback_rate_i_term_inverse
Coly Li <[email protected]>
bcache: fix input overflow to sequential_cutoff
Coly Li <[email protected]>
bcache: fix input overflow to cache set sysfs file io_error_halflife
Luc Van Oostenryck <[email protected]>
sched/topology: Fix percpu data types in struct sd_data & struct s_data
John Stultz <[email protected]>
usb: f_fs: Avoid crash due to out-of-scope stack ptr access
Rakesh Pillai <[email protected]>
ath10k: fix shadow register implementation for WCN3990
Ranjani Sridharan <[email protected]>
ALSA: PCM: check if ops are defined before suspending PCM
Martin Blumenstingl <[email protected]>
ARM: dts: meson8b: fix the Ethernet data line signals in eth_rgmii_pins
Nathan Chancellor <[email protected]>
ARM: 8833/1: Ensure that NEON code always compiles with Clang
Chieh-Min Wang <[email protected]>
netfilter: conntrack: fix cloned unconfirmed skb->_nfct race in __nf_conntrack_confirm
Masami Hiramatsu <[email protected]>
kprobes: Prohibit probing on RCU debug routine
Andrea Righi <[email protected]>
kprobes: Prohibit probing on bsearch()
Tycho Andersen <[email protected]>
selftests: skip seccomp get_metadata test if not real root
Shuah Khan <[email protected]>
selftests: ir: fix warning: "%s" directive output may be truncated ’ directive output may be truncated
Hans de Goede <[email protected]>
ACPI / video: Refactor and fix dmi_is_desktop()
Sara Sharon <[email protected]>
iwlwifi: pcie: fix emergency path
Arnaldo Carvalho de Melo <[email protected]>
perf coresight: Do not test for libopencsd by default
Thomas Richter <[email protected]>
perf report: Add s390 diagnosic sampling descriptor size
Arnaldo Carvalho de Melo <[email protected]>
perf trace: Check if the 'fd' is negative when mapping it to pathname
Arnaldo Carvalho de Melo <[email protected]>
perf beauty waitid options: Fix up prefix showing logic
Arnaldo Carvalho de Melo <[email protected]>
tools build: Add test-reallocarray.c to test-all.c to fix the build
Arnaldo Carvalho de Melo <[email protected]>
tools build: Add -lrt to FEATURE_CHECK_LDFLAGS-libaio
Michal Kazior <[email protected]>
leds: lp55xx: fix null deref on firmware load failure
Theodore Ts'o <[email protected]>
jbd2: fix race when writing superblock
Niklas Cassel <[email protected]>
regulator: core: Take lock before applying system load
Bas Nieuwenhuizen <[email protected]>
drm/sched: Fix entities with 0 rqs.
Anders Roxell <[email protected]>
efi: Fix build error due to enum collision between efi.h and ima.h
Tejun Heo <[email protected]>
cgroup, rstat: Don't flush subtree root unless necessary
Hong Liu <[email protected]>
HID: intel-ish-hid: avoid binding wrong ishtp_cl_device
Aurelien Jarno <[email protected]>
vfs: fix preadv64v2 and pwritev64v2 compat syscalls with offset == -1
Oleksandr Andrushchenko <[email protected]>
xen/gntdev: Do not destroy context while dma-bufs are in use
Marek Vasut <[email protected]>
gpio: of: Apply regulator-gpio quirk only to enable-gpios
Lorenzo Bianconi <[email protected]>
mt76: usb: do not run mt76u_queues_deinit twice
Ezequiel Garcia <[email protected]>
media: rockchip/vpu: Correct return type for mem2mem buffer helpers
Ezequiel Garcia <[email protected]>
media: mtk-jpeg: Correct return type for mem2mem buffer helpers
Ezequiel Garcia <[email protected]>
media: mx2_emmaprp: Correct return type for mem2mem buffer helpers
Ezequiel Garcia <[email protected]>
media: s5p-g2d: Correct return type for mem2mem buffer helpers
Ezequiel Garcia <[email protected]>
media: rockchip/rga: Correct return type for mem2mem buffer helpers
Ezequiel Garcia <[email protected]>
media: s5p-jpeg: Correct return type for mem2mem buffer helpers
Ezequiel Garcia <[email protected]>
media: sh_veu: Correct return type for mem2mem buffer helpers
Akinobu Mita <[email protected]>
media: ov7740: fix runtime pm initialization
Wen Yang <[email protected]>
SoC: imx-sgtl5000: add missing put_device()
He Kuang <[email protected]>
perf report: Don't shadow inlined symbol with different addr range
Brian Norris <[email protected]>
mwifiex: don't advertise IBSS features without FW support
Thomas Richter <[email protected]>
perf test: Fix failure of 'evsel-tp-sched' test on s390
Nicholas Kazlauskas <[email protected]>
drm/amd/display: Clear stream->mode_changed after commit
Sedat Dilek <[email protected]>
scsi: fcoe: make use of fip_mode enum complete
Jason Yan <[email protected]>
scsi: megaraid_sas: return error when create DMA pool failed
Sebastian Ott <[email protected]>
s390/ism: ignore some errors during deregistration
Ross Lagerwall <[email protected]>
efi: cper: Fix possible out-of-bounds access
Erwan Velu <[email protected]>
cpufreq: acpi-cpufreq: Report if CPU doesn't support boost technologies
Takashi Iwai <[email protected]>
ASoC: qcom: Fix of-node refcount unbalance in qcom_snd_parse_of()
Michael Ellerman <[email protected]>
powerpc/44x: Force PCI on for CURRITUCK
Wei Li <[email protected]>
perf annotate: Fix getting source line failure
Katsuhiro Suzuki <[email protected]>
clk: fractional-divider: check parent rate only if flag is set
Håkon Bugge <[email protected]>
IB/mlx4: Increase the timeout for CM cache
Hans de Goede <[email protected]>
i2c: designware: Do not allow i2c_dw_xfer() calls while suspended
Dongli Zhang <[email protected]>
loop: set GENHD_FL_NO_PART_SCAN after blkdev_reread_part()
Vadim Pasternak <[email protected]>
platform/mellanox: mlxreg-hotplug: Fix KASAN warning
Yang Fan <[email protected]>
platform/x86: ideapad-laptop: Fix no_hw_rfkill_list for Lenovo RESCUER R720-15IKBN
Jim Broadus <[email protected]>
i2c: Allow recovery of the initial IRQ by an I2C client device.
Florian Fainelli <[email protected]>
mlxsw: spectrum: Avoid -Wformat-truncation warnings
Florian Fainelli <[email protected]>
e1000e: Fix -Wformat-truncation warnings
Florian Fainelli <[email protected]>
veth: Fix -Wformat-truncation
Shiju Jose <[email protected]>
net: hns3: fix setting of the hns reset_type for rdma hw errors
Andrew Lunn <[email protected]>
net: dsa: mv88e6xxx: Add lockdep classes to fix false positive splat
Aaro Koskinen <[email protected]>
mmc: omap: fix the maximum timeout setting
Josef Bacik <[email protected]>
btrfs: don't enospc all tickets on flush failure
Qu Wenruo <[email protected]>
btrfs: qgroup: Make qgroup async transaction commit more aggressive
Andi Kleen <[email protected]>
perf script: Handle missing fields with -F +..
Jacob Keller <[email protected]>
ice: fix ice_remove_rule_internal vsi_list handling
Marek Behún <[email protected]>
net: dsa: mv88e6xxx: Default CMODE to 1000BaseX only on 6390X
Aneesh Kumar K.V <[email protected]>
powerpc/hugetlb: Handle mmap_min_addr correctly in get_unmapped_area callback
Nicolas Boichat <[email protected]>
iommu/io-pgtable-arm-v7s: Only kmemleak_ignore L2 tables
Stefan Agner <[email protected]>
ARM: 8845/1: use unified assembler in c files
Sebastian Andrzej Siewior <[email protected]>
ARM: 8840/1: use a raw_spinlock_t in unwind
Lubomir Rintel <[email protected]>
serial: 8250_pxa: honor the port number from devicetree
Sai Prakash Ranjan <[email protected]>
coresight: etm4x: Add support to enable ETMv4.2
Nathan Chancellor <[email protected]>
powerpc/xmon: Fix opcode being uninitialized in print_insn_powerpc
Alagu Sankar <[email protected]>
ath10k: don't report unset rssi values to mac80211
Mathias Fröhlich <[email protected]>
drm/amd/display: Fix reference counting for struct dc_sink.
Josef Bacik <[email protected]>
btrfs: save drop_progress if we drop refs at all
Masahiro Yamada <[email protected]>
kbuild: make -r/-R effective in top Makefile for old Make versions
Masahiro Yamada <[email protected]>
kbuild: invoke syncconfig if include/config/auto.conf.cmd is missing
Benjamin Block <[email protected]>
scsi: core: replace GFP_ATOMIC with GFP_KERNEL in scsi_scan.c
Alexey Kardashevskiy <[email protected]>
powerpc/powernv/ioda: Fix locked_vm counting for memory used by IOMMU tables
Paul Kocialkowski <[email protected]>
usb: chipidea: Grab the (legacy) USB PHY by phandle first
Yonghong Song <[email protected]>
tools/bpf: selftests: add map lookup to test_map_in_map bpf prog
Eric Biggers <[email protected]>
crypto: cavium/zip - fix collision with generic cra_driver_name
Julia Lawall <[email protected]>
crypto: crypto4xx - add missing of_node_put after of_device_is_available
Bart Van Assche <[email protected]>
lockdep/lib/tests: Fix run_tests.sh
Surabhi Vishnoi <[email protected]>
ath10k: Fix the wrong updation of BW in tx_stats debugfs entry
Wen Yang <[email protected]>
mt76: fix a leaked reference by adding a missing of_node_put
Alexei Avshalom Lazar <[email protected]>
wil6210: check null pointer in _wil_cfg80211_merge_extra_ies
Rafael J. Wysocki <[email protected]>
PCI/PME: Fix hotplug/sysfs remove deadlock in pcie_pme_remove()
Dave Hansen <[email protected]>
mm/resource: Return real error codes from walk failures
Tony Jones <[email protected]>
tools lib traceevent: Fix buffer overflow in arg_eval
Carlos Maiolino <[email protected]>
fs: fix guard_bio_eod to check for real EOD errors
Eric Whitney <[email protected]>
ext4: fix bigalloc cluster freeing when hole punching under load
luojiajun <[email protected]>
jbd2: fix invalid descriptor block checksum
Lu Baolu <[email protected]>
iommu/vt-d: Disable ATS support on untrusted devices
Florian Westphal <[email protected]>
netfilter: conntrack: tcp: only close if RST matches exact sequence
Honghui Zhang <[email protected]>
PCI: mediatek: Fix memory mapped IO range size computation
Li RongQing <[email protected]>
netfilter: nf_tables: check the result of dereferencing base_chain->stats
Arnaldo Carvalho de Melo <[email protected]>
perf beauty msg_flags: Add missing %s lost when adding prefix suppression logic
Slavomir Kaslev <[email protected]>
fs: Make splice() and tee() take into account O_NONBLOCK flag on pipes
Yao Liu <[email protected]>
cifs: Fix NULL pointer dereference of devname
Namjae Jeon <[email protected]>
cifs: Accept validate negotiate if server return NT_STATUS_NOT_SUPPORTED
Chao Yu <[email protected]>
f2fs: fix to check inline_xattr_size boundary correctly
Jason Cai (Xiang Feng) <[email protected]>
dm thin: add sanity checks to thin-pool and external snapshot creation
Louis Taylor <[email protected]>
cifs: use correct format characters
Arnd Bergmann <[email protected]>
kasan: fix kasan_check_read/write definitions
Qian Cai <[email protected]>
page_poison: play nicely with KASAN
Shuriyc Chu <[email protected]>
fs/file.c: initialize init_files.resize_wait
zhengliang <[email protected]>
f2fs: fix to data block override node segment by mistake
Sahitya Tummala <[email protected]>
f2fs: do not use mutex lock in atomic context
Jia Guo <[email protected]>
ocfs2: fix a panic problem caused by o2cb_ctl
Qian Cai <[email protected]>
mm/slab.c: kmemleak no scan alien caches
Uladzislau Rezki (Sony) <[email protected]>
mm/vmalloc.c: fix kernel BUG at mm/vmalloc.c:512!
Vlastimil Babka <[email protected]>
mm, mempolicy: fix uninit memory access
Tetsuo Handa <[email protected]>
memcg: killed threads should not invoke memcg OOM killer
Tetsuo Handa <[email protected]>
mm,oom: don't kill global init via memory.oom.group
Mike Rapoport <[email protected]>
docs/core-api/mm: fix user memory accessors formatting
Daniel Jordan <[email protected]>
mm, swap: bounds check swap_info array accesses to avoid NULL derefs
Qian Cai <[email protected]>
mm/page_ext.c: fix an imbalance with kmemleak
Peng Fan <[email protected]>
mm/cma.c: cma_declare_contiguous: correct err handling
Qian Cai <[email protected]>
mm/sparse: fix a bad comparison
Jiri Olsa <[email protected]>
perf c2c: Fix c2c report for empty numa node
Kairui Song <[email protected]>
x86/hyperv: Fix kernel panic when kexec on HyperV
Linus Torvalds <[email protected]>
iio: adc: fix warning in Qualcomm PM8xxx HK/XOADC driver
Xiang Chen <[email protected]>
scsi: hisi_sas: Fix a timeout race of driver internal and SMP IO
John Garry <[email protected]>
scsi: hisi_sas: Set PHY linkrate when disconnected
Stanislav Fomichev <[email protected]>
libbpf: force fixdep compilation at the start of the build
Arnd Bergmann <[email protected]>
enic: fix build warning without CONFIG_CPUMASK_OFFSTACK
Nathan Chancellor <[email protected]>
net: stmmac: Avoid sometimes uninitialized Clang warnings
Christian Brauner <[email protected]>
sysctl: handle overflow for file-max
Luc Van Oostenryck <[email protected]>
include/linux/relay.h: fix percpu annotation in struct rchan
Russell King <[email protected]>
gpio: gpio-omap: fix level interrupt idling
Tony Lindgren <[email protected]>
clk: ti: clkctrl: Fix clkdm_name regression for TI_CLK_CLKCTRL_COMPAT
Björn Töpel <[email protected]>
xsk: fix to reject invalid flags in xsk_bind
Tonghao Zhang <[email protected]>
net/mlx5: Avoid panic when setting vport mac, getting vport config
Tonghao Zhang <[email protected]>
net/mlx5: Avoid panic when setting vport rate
Tariq Toukan <[email protected]>
net/mlx5e: Fix access to non-existing receive queue
Douglas Anderson <[email protected]>
tracing: kdb: Fix ftdump to not sleep
John Johansen <[email protected]>
apparmor: fix double free when unpack of secmark rules fails
Chao Yu <[email protected]>
f2fs: fix to avoid deadlock in f2fs_read_inline_dir()
Chao Yu <[email protected]>
f2fs: fix to adapt small inline xattr space in __find_inline_xattr()
Masahiro Yamada <[email protected]>
h8300: use cc-cross-prefix instead of hardcoding h8300-unknown-linux-
Yufen Yu <[email protected]>
nvme-loop: init nvmet_ctrl fatal_err_work when allocate
James Smart <[email protected]>
nvme-fc: fix numa_node when dev is null
Aurelien Aptel <[email protected]>
CIFS: fix POSIX lock leak and invalid ptr deref
zhangyi (F) <[email protected]>
ext4: cleanup bh release code in ext4_ind_remove_space()
-------------
Diffstat:
Documentation/arm/kernel_mode_neon.txt | 4 +- Makefile | 59 ++++++++++-------- arch/arm/boot/dts/lpc32xx.dtsi | 18 +++--- arch/arm/boot/dts/meson8b.dtsi | 6 +- arch/arm/include/asm/barrier.h | 2 + arch/arm/include/asm/processor.h | 6 +- arch/arm/include/asm/v7m.h | 2 +- arch/arm/kernel/entry-header.S | 3 +- arch/arm/kernel/entry-v7m.S | 4 ++ arch/arm/kernel/machine_kexec.c | 5 +- arch/arm/kernel/smp.c | 4 +- arch/arm/kernel/unwind.c | 14 ++--- arch/arm/lib/Makefile | 2 +- arch/arm/lib/xor-neon.c | 2 +- arch/arm/mach-omap2/prm_common.c | 4 +- arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c | 5 ++ arch/arm/mm/copypage-v4mc.c | 3 +- arch/arm/mm/copypage-v4wb.c | 3 +- arch/arm/mm/copypage-v4wt.c | 3 +- arch/arm/mm/proc-v7m.S | 3 + arch/h8300/Makefile | 2 +- arch/powerpc/include/asm/topology.h | 2 + arch/powerpc/kernel/entry_64.S | 7 +++ arch/powerpc/kernel/ptrace.c | 8 ++- arch/powerpc/mm/hugetlbpage-radix.c | 5 +- arch/powerpc/mm/numa.c | 9 +-- arch/powerpc/platforms/44x/Kconfig | 1 + arch/powerpc/platforms/powernv/pci-ioda-tce.c | 1 - arch/powerpc/platforms/powernv/pci-ioda.c | 7 ++- arch/powerpc/platforms/pseries/hotplug-cpu.c | 19 ++++++ arch/powerpc/xmon/ppc-dis.c | 2 +- arch/s390/kernel/perf_cpum_sf.c | 6 +- arch/x86/boot/Makefile | 2 +- arch/x86/events/intel/bts.c | 4 +- arch/x86/events/intel/pt.c | 5 +- arch/x86/hyperv/hv_init.c | 7 +++ arch/x86/include/asm/uaccess.h | 24 ++++---- arch/x86/kernel/kexec-bzimage64.c | 4 +- arch/x86/kernel/vmlinux.lds.S | 2 +- arch/x86/lib/usercopy_32.c | 8 +-- arch/x86/platform/efi/quirks.c | 4 +- arch/x86/realmode/rm/Makefile | 2 +- block/bfq-iosched.c | 22 +++++-- block/bfq-iosched.h | 3 + block/bfq-wf2q.c | 6 +- drivers/acpi/acpi_video.c | 20 ++++-- drivers/block/loop.c | 21 +++++-- drivers/cdrom/cdrom.c | 7 +-- drivers/char/hpet.c | 2 +- drivers/char/hw_random/virtio-rng.c | 2 +- drivers/clk/clk-fractional-divider.c | 2 +- drivers/clk/meson/meson-aoclk.c | 15 +++-- drivers/clk/rockchip/clk-rk3328.c | 12 ++-- drivers/clk/ti/clkctrl.c | 2 +- drivers/cpufreq/acpi-cpufreq.c | 4 +- drivers/crypto/amcc/crypto4xx_trng.c | 4 +- drivers/crypto/cavium/zip/zip_main.c | 6 +- drivers/dma/imx-dma.c | 2 +- drivers/dma/qcom/hidma.c | 19 +++--- drivers/dma/tegra20-apb-dma.c | 5 +- drivers/firmware/efi/cper.c | 13 ++-- drivers/firmware/efi/libstub/arm-stub.c | 5 ++ drivers/firmware/efi/libstub/efi-stub-helper.c | 10 +++ drivers/firmware/efi/libstub/efistub.h | 1 + drivers/firmware/efi/libstub/fdt.c | 3 + drivers/firmware/efi/memattr.c | 2 +- drivers/firmware/efi/runtime-wrappers.c | 48 +++++++-------- drivers/gpio/gpio-omap.c | 14 +++-- drivers/gpio/gpiolib-of.c | 3 +- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 60 +++++++++++++++--- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c | 42 ++++++------- .../amd/display/amdgpu_dm/amdgpu_dm_mst_types.c | 1 + drivers/gpu/drm/amd/display/dc/core/dc.c | 3 + drivers/gpu/drm/amd/display/dc/core/dc_link.c | 1 + .../drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | 7 ++- drivers/gpu/drm/drm_dp_mst_topology.c | 1 + drivers/gpu/drm/drm_fb_helper.c | 2 +- drivers/gpu/drm/drm_mode_object.c | 1 + drivers/gpu/drm/drm_plane.c | 3 + drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c | 36 ++++++----- drivers/gpu/drm/nouveau/dispnv04/tvnv17.c | 4 +- drivers/gpu/drm/rcar-du/rcar_du_kms.c | 2 + drivers/gpu/drm/scheduler/sched_entity.c | 39 ++++++++---- drivers/gpu/drm/vkms/vkms_crtc.c | 21 +++---- drivers/hid/intel-ish-hid/ipc/ipc.c | 9 ++- drivers/hid/intel-ish-hid/ishtp/bus.c | 4 +- drivers/hwtracing/coresight/coresight-etm-perf.c | 6 +- drivers/hwtracing/coresight/coresight-etm4x.c | 3 +- drivers/i2c/busses/i2c-designware-core.h | 2 + drivers/i2c/busses/i2c-designware-master.c | 6 ++ drivers/i2c/busses/i2c-designware-pcidrv.c | 7 ++- drivers/i2c/busses/i2c-designware-platdrv.c | 3 + drivers/i2c/i2c-core-base.c | 9 +-- drivers/i2c/i2c-core-of.c | 14 ++++- drivers/iio/adc/qcom-pm8xxx-xoadc.c | 10 +-- drivers/infiniband/hw/cxgb4/cm.c | 5 +- drivers/infiniband/hw/mlx4/cm.c | 2 +- drivers/input/misc/soc_button_array.c | 2 +- drivers/iommu/intel-iommu.c | 3 +- drivers/iommu/io-pgtable-arm-v7s.c | 3 +- drivers/leds/leds-lp55xx-common.c | 4 +- drivers/md/bcache/sysfs.c | 25 ++++++-- drivers/md/bcache/sysfs.h | 13 +++- drivers/md/dm-thin.c | 13 ++++ drivers/media/i2c/mt9m111.c | 2 + drivers/media/i2c/ov7740.c | 7 ++- drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c | 40 ++++++------ drivers/media/platform/mx2_emmaprp.c | 6 +- drivers/media/platform/rcar-vin/rcar-core.c | 8 ++- drivers/media/platform/rockchip/rga/rga.c | 6 +- drivers/media/platform/s5p-g2d/g2d.c | 6 +- drivers/media/platform/s5p-jpeg/jpeg-core.c | 57 +++++++++-------- drivers/media/platform/sh_veu.c | 4 +- drivers/mmc/host/omap.c | 2 +- drivers/net/dsa/mv88e6xxx/chip.c | 8 +++ drivers/net/dsa/mv88e6xxx/port.c | 2 + drivers/net/ethernet/cisco/enic/enic_main.c | 6 +- .../net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c | 36 ++++++----- drivers/net/ethernet/intel/e1000e/netdev.c | 21 +++---- drivers/net/ethernet/intel/ice/ice_switch.c | 15 ++++- drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 17 ++++-- .../net/ethernet/mellanox/mlx5/core/en_ethtool.c | 3 + drivers/net/ethernet/mellanox/mlx5/core/eswitch.c | 17 ++++-- drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 4 +- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 6 +- drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c | 2 +- drivers/net/phy/phy-c45.c | 10 ++- drivers/net/phy/phy_device.c | 13 ++-- drivers/net/veth.c | 3 +- drivers/net/wireless/ath/ath10k/ce.c | 26 ++++---- drivers/net/wireless/ath/ath10k/ce.h | 2 +- drivers/net/wireless/ath/ath10k/debugfs_sta.c | 7 ++- drivers/net/wireless/ath/ath10k/htt_rx.c | 12 +++- drivers/net/wireless/ath/ath10k/wmi.h | 2 +- drivers/net/wireless/ath/wil6210/cfg80211.c | 14 ++++- .../wireless/broadcom/brcm80211/brcmfmac/common.c | 2 +- drivers/net/wireless/intel/iwlwifi/mvm/fw.c | 20 ++++-- drivers/net/wireless/intel/iwlwifi/pcie/rx.c | 11 +++- drivers/net/wireless/marvell/mwifiex/cfg80211.c | 10 ++- drivers/net/wireless/mediatek/mt76/eeprom.c | 24 +++++--- drivers/net/wireless/mediatek/mt76/usb.c | 11 +--- drivers/net/wireless/mediatek/mt7601u/eeprom.h | 2 +- drivers/net/wireless/ti/wlcore/main.c | 7 ++- drivers/nvme/host/fc.c | 5 +- drivers/nvme/target/core.c | 20 +++--- drivers/pci/controller/pcie-mediatek.c | 5 +- drivers/pci/hotplug/pciehp_hpc.c | 2 +- drivers/pci/pcie/pme.c | 22 ++++--- drivers/perf/arm_spe_pmu.c | 6 +- drivers/pinctrl/meson/pinctrl-meson.c | 22 ++++--- drivers/pinctrl/meson/pinctrl-meson8b.c | 6 +- drivers/pinctrl/sh-pfc/pfc-r8a77990.c | 32 +++++----- drivers/pinctrl/sh-pfc/pfc-r8a77995.c | 11 ++-- drivers/platform/mellanox/mlxreg-hotplug.c | 5 +- drivers/platform/x86/ideapad-laptop.c | 2 +- drivers/platform/x86/intel-hid.c | 7 ++- drivers/platform/x86/intel_pmc_core.c | 3 +- drivers/platform/x86/intel_pmc_core.h | 2 +- drivers/regulator/act8865-regulator.c | 5 +- drivers/regulator/core.c | 2 + drivers/regulator/mcp16502.c | 1 + drivers/s390/net/ism_drv.c | 12 +++- drivers/scsi/bnx2fc/bnx2fc_fcoe.c | 2 +- drivers/scsi/fcoe/fcoe.c | 2 +- drivers/scsi/fcoe/fcoe_ctlr.c | 7 ++- drivers/scsi/fcoe/fcoe_transport.c | 2 +- drivers/scsi/hisi_sas/hisi_sas_main.c | 13 +++- drivers/scsi/megaraid/megaraid_sas_base.c | 1 + drivers/scsi/qedf/qedf_main.c | 2 +- drivers/scsi/scsi_scan.c | 6 +- drivers/soc/qcom/qcom_gsbi.c | 7 ++- drivers/soc/tegra/fuse/fuse-tegra.c | 12 +++- drivers/staging/iio/addac/adt7316.c | 18 +++--- .../media/rockchip/vpu/rk3288_vpu_hw_jpeg_enc.c | 6 +- .../media/rockchip/vpu/rk3399_vpu_hw_jpeg_enc.c | 6 +- drivers/staging/mt7621-spi/spi-mt7621.c | 7 ++- drivers/tty/serial/8250/8250_pxa.c | 4 ++ drivers/tty/tty_buffer.c | 2 +- drivers/usb/chipidea/core.c | 9 ++- drivers/usb/dwc3/gadget.c | 2 + drivers/usb/gadget/function/f_fs.c | 1 + drivers/video/backlight/pwm_bl.c | 2 +- drivers/video/fbdev/core/fbmem.c | 3 + drivers/xen/gntdev-dmabuf.c | 12 +++- drivers/xen/gntdev-dmabuf.h | 2 +- drivers/xen/gntdev.c | 2 +- fs/btrfs/extent-tree.c | 71 ++++++++++++++-------- fs/btrfs/qgroup.c | 28 ++++----- fs/buffer.c | 7 +++ fs/cifs/cifs_dfs_ref.c | 4 +- fs/cifs/connect.c | 5 ++ fs/cifs/file.c | 14 ++++- fs/cifs/smb1ops.c | 2 +- fs/cifs/smb2pdu.c | 10 ++- fs/ext4/extents.c | 17 +++--- fs/ext4/indirect.c | 47 +++++++------- fs/f2fs/extent_cache.c | 2 +- fs/f2fs/f2fs.h | 1 - fs/f2fs/inline.c | 8 ++- fs/f2fs/super.c | 17 ++++-- fs/f2fs/sysfs.c | 12 +++- fs/f2fs/trace.c | 20 +++--- fs/f2fs/xattr.c | 13 +++- fs/file.c | 1 + fs/jbd2/commit.c | 6 +- fs/jbd2/journal.c | 52 ++++++++-------- fs/ocfs2/cluster/nodemanager.c | 14 +++-- fs/read_write.c | 6 ++ fs/splice.c | 12 ++++ include/linux/atalk.h | 18 ++++-- include/linux/cgroup-defs.h | 2 +- include/linux/cgroup.h | 2 + include/linux/clk-provider.h | 3 + include/linux/efi.h | 26 ++++---- include/linux/f2fs_fs.h | 13 ++-- include/linux/filter.h | 4 +- include/linux/i2c.h | 1 + include/linux/irqdesc.h | 1 + include/linux/kasan-checks.h | 2 +- include/linux/perf_event.h | 2 +- include/linux/relay.h | 2 +- include/linux/ring_buffer.h | 2 +- include/linux/sched.h | 4 +- include/linux/sched/topology.h | 8 +-- include/net/netfilter/br_netfilter.h | 1 - include/scsi/libfcoe.h | 4 +- kernel/audit.h | 4 +- kernel/audit_tree.c | 19 +++--- kernel/auditsc.c | 12 ++-- kernel/cgroup/cgroup.c | 15 +++-- kernel/cgroup/pids.c | 4 +- kernel/cgroup/rstat.c | 10 +-- kernel/cpu.c | 9 +++ kernel/events/ring_buffer.c | 2 +- kernel/exit.c | 1 + kernel/irq/chip.c | 12 +++- kernel/irq/internals.h | 8 ++- kernel/irq/irqdesc.c | 7 ++- kernel/rcu/update.c | 2 + kernel/resource.c | 4 +- kernel/sched/core.c | 9 +-- kernel/sched/debug.c | 4 ++ kernel/sched/sched.h | 6 +- kernel/sched/topology.c | 2 +- kernel/sysctl.c | 3 + kernel/trace/ring_buffer.c | 5 +- kernel/trace/trace.c | 6 +- kernel/trace/trace_kdb.c | 6 +- lib/bsearch.c | 2 + lib/raid6/Makefile | 2 +- mm/cma.c | 4 +- mm/kasan/common.c | 2 + mm/memcontrol.c | 19 ++++-- mm/mempolicy.c | 2 +- mm/oom_kill.c | 3 +- mm/page_alloc.c | 2 +- mm/page_ext.c | 1 + mm/page_poison.c | 4 ++ mm/slab.c | 17 +++--- mm/sparse.c | 2 +- mm/swapfile.c | 51 +++++++++------- mm/vmalloc.c | 6 +- net/bridge/br_netfilter_hooks.c | 5 -- net/netfilter/nf_conntrack_core.c | 14 ++++- net/netfilter/nf_conntrack_proto_tcp.c | 50 ++++++++++++--- net/netfilter/nf_tables_core.c | 14 +++-- net/netfilter/xt_physdev.c | 9 ++- net/xdp/xsk.c | 5 +- security/apparmor/policy_unpack.c | 1 + security/selinux/hooks.c | 9 ++- sound/core/pcm_native.c | 8 +++ sound/firewire/dice/dice.c | 12 +++- sound/soc/fsl/fsl-asoc-card.c | 1 + sound/soc/fsl/imx-sgtl5000.c | 1 + sound/soc/generic/simple-card-utils.c | 14 ++++- sound/soc/qcom/common.c | 10 ++- tools/build/Makefile.feature | 2 +- tools/build/feature/test-all.c | 10 +-- tools/build/feature/test-reallocarray.c | 2 + tools/lib/bpf/Makefile | 3 +- tools/lib/lockdep/run_tests.sh | 6 +- tools/lib/traceevent/event-parse.c | 2 +- tools/perf/Makefile.config | 5 +- tools/perf/Makefile.perf | 2 +- tools/perf/builtin-c2c.c | 8 ++- tools/perf/builtin-script.c | 10 ++- tools/perf/builtin-trace.c | 6 +- tools/perf/tests/evsel-tp-sched.c | 6 +- tools/perf/trace/beauty/msg_flags.c | 2 +- tools/perf/trace/beauty/waitid_options.c | 2 +- tools/perf/util/annotate.c | 4 +- tools/perf/util/s390-cpumsf.c | 5 ++ .../util/scripting-engines/trace-event-python.c | 15 +++-- tools/perf/util/sort.c | 10 ++- tools/perf/util/srcline.c | 2 +- tools/testing/selftests/bpf/Makefile | 3 +- tools/testing/selftests/bpf/test_map_in_map.c | 4 ++ tools/testing/selftests/bpf/test_maps.c | 27 ++++---- tools/testing/selftests/bpf/test_verifier.c | 9 ++- tools/testing/selftests/ir/ir_loopback.c | 4 +- tools/testing/selftests/seccomp/seccomp_bpf.c | 6 ++ 301 files changed, 1765 insertions(+), 927 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 20/246 libbpf: force fixdep compilation at the start of the build
5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 8e2688876c7f7073d925e1f150e86b8ed3338f52 ]
libbpf targets don't explicitly depend on fixdep target, so when we do 'make -j$(nproc)', there is a high probability, that some objects will be built before fixdep binary is available.
Fix this by running sub-make; this makes sure that fixdep dependency is properly accounted for.
For the same issue in perf, see commit abb26210a395 ("perf tools: Force fixdep compilation at the start of the build").
Before:
$ rm -rf /tmp/bld; mkdir /tmp/bld; make -j$(nproc) O=/tmp/bld -C tools/lib/bpf/
Auto-detecting system features:
... libelf: [ on ]
... bpf: [ on ]
HOSTCC /tmp/bld/fixdep.o CC /tmp/bld/libbpf.o CC /tmp/bld/bpf.o CC /tmp/bld/btf.o CC /tmp/bld/nlattr.o CC /tmp/bld/libbpf_errno.o CC /tmp/bld/str_error.o CC /tmp/bld/netlink.o CC /tmp/bld/bpf_prog_linfo.o CC /tmp/bld/libbpf_probes.o CC /tmp/bld/xsk.o HOSTLD /tmp/bld/fixdep-in.o LINK /tmp/bld/fixdep LD /tmp/bld/libbpf-in.o LINK /tmp/bld/libbpf.a LINK /tmp/bld/libbpf.so LINK /tmp/bld/test_libbpf
$ head /tmp/bld/.libbpf.o.cmd # cannot find fixdep (/usr/local/google/home/sdf/src/linux/xxx//fixdep) # using basic dep data
/tmp/bld/libbpf.o: libbpf.c /usr/include/stdc-predef.h \
/usr/include/stdlib.h /usr/include/features.h \
/usr/include/x86_64-linux-gnu/sys/cdefs.h \
/usr/include/x86_64-linux-gnu/bits/wordsize.h \
/usr/include/x86_64-linux-gnu/gnu/stubs.h \
/usr/include/x86_64-linux-gnu/gnu/stubs-64.h \
/usr/lib/gcc/x86_64-linux-gnu/7/include/stddef.h \
After:
$ rm -rf /tmp/bld; mkdir /tmp/bld; make -j$(nproc) O=/tmp/bld -C tools/lib/bpf/
Auto-detecting system features:
... libelf: [ on ]
... bpf: [ on ]
HOSTCC /tmp/bld/fixdep.o HOSTLD /tmp/bld/fixdep-in.o LINK /tmp/bld/fixdep CC /tmp/bld/libbpf.o CC /tmp/bld/bpf.o CC /tmp/bld/nlattr.o CC /tmp/bld/btf.o CC /tmp/bld/libbpf_errno.o CC /tmp/bld/str_error.o CC /tmp/bld/netlink.o CC /tmp/bld/bpf_prog_linfo.o CC /tmp/bld/libbpf_probes.o CC /tmp/bld/xsk.o LD /tmp/bld/libbpf-in.o LINK /tmp/bld/libbpf.a LINK /tmp/bld/libbpf.so LINK /tmp/bld/test_libbpf
$ head /tmp/bld/.libbpf.o.cmd cmd_/tmp/bld/libbpf.o := gcc -Wp,-MD,/tmp/bld/.libbpf.o.d -Wp,-MT,/tmp/bld/libbpf.o -g -Wall -DHAVE_LIBELF_MMAP_SUPPORT -DCOMPAT_NEED_REALLOCARRAY -Wbad-function-cast -Wdeclaration-after-statement -Wformat-security -Wformat-y2k -Winit-self -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wno-system-headers -Wold-style-definition -Wpacked -Wredundant-decls -Wshadow -Wstrict-prototypes -Wswitch-default -Wswitch-enum -Wundef -Wwrite-strings -Wformat -Wstrict-aliasing=3 -Werror -Wall -fPIC -I. -I/usr/local/google/home/sdf/src/linux/tools/include -I/usr/local/google/home/sdf/src/linux/tools/arch/x86/include/uapi -I/usr/local/google/home/sdf/src/linux/tools/include/uapi -fvisibility=hidden -D"BUILD_STR(s)=$(pound)s" -c -o /tmp/bld/libbpf.o libbpf.c
source_/tmp/bld/libbpf.o := libbpf.c
deps_/tmp/bld/libbpf.o := \
/usr/include/stdc-predef.h \
/usr/include/stdlib.h \
/usr/include/features.h \
/usr/include/x86_64-linux-gnu/sys/cdefs.h \
/usr/include/x86_64-linux-gnu/bits/wordsize.h \
--- tools/lib/bpf/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/lib/bpf/Makefile +2 -1
@@ -162,7 +162,8 @@ endif TARGETS = $(CMD_TARGETS) -all: fixdep all_cmd +all: fixdep + $(Q)$(MAKE) all_cmd all_cmd: $(CMD_TARGETS) check
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 22/246 scsi: hisi_sas: Fix a timeout race of driver internal and SMP IO
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 4790595723d4b833b18c994973d39f9efb842887 ]
For internal IO and SMP IO, there is a time-out timer for them. In the timer handler, it checks whether IO is done according to the flag task->task_state_lock.
There is an issue which may cause system suspended: internal IO or SMP IO is sent, but at that time because of hardware exception (such as inject 2Bit ECC error), so IO is not completed and also not timeout. But, at that time, the SAS controller reset occurs to recover system. It will release the resource and set the status of IO to be SAS_TASK_STATE_DONE, so when IO timeout, it will never complete the completion of IO and wait for ever.
[ 729.123632] Call trace: [ 729.126791] [<ffff00000808655c>] __switch_to+0x94/0xa8 [ 729.133106] [<ffff000008d96e98>] __schedule+0x1e8/0x7fc [ 729.138975] [<ffff000008d974e0>] schedule+0x34/0x8c [ 729.144401] [<ffff000008d9b000>] schedule_timeout+0x1d8/0x3cc [ 729.150690] [<ffff000008d98218>] wait_for_common+0xdc/0x1a0 [ 729.157101] [<ffff000008d98304>] wait_for_completion+0x28/0x34 [ 729.165973] [<ffff000000dcefb4>] hisi_sas_internal_task_abort+0x2a0/0x424 [hisi_sas_test_main] [ 729.176447] [<ffff000000dd18f4>] hisi_sas_abort_task+0x244/0x2d8 [hisi_sas_test_main] [ 729.185258] [<ffff000008971714>] sas_eh_handle_sas_errors+0x1c8/0x7b8 [ 729.192391] [<ffff000008972774>] sas_scsi_recover_host+0x130/0x398 [ 729.199237] [<ffff00000894d8a8>] scsi_error_handler+0x148/0x5c0 [ 729.206009] [<ffff0000080f4118>] kthread+0x10c/0x138 [ 729.211563] [<ffff0000080855dc>] ret_from_fork+0x10/0x18
To solve the issue, callback function task_done of those IOs need to be called when on SAS controller reset.
--- drivers/scsi/hisi_sas/hisi_sas_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/scsi/hisi_sas/hisi_sas_main.c +2 -1
@@ -873,7 +873,8 @@ static void hisi_sas_do_release_task(struct hisi_hba *hisi_hba, struct sas_taskspin_lock_irqsave (&task->task_state_lock, flags); task->task_state_flags &= ~(SAS_TASK_STATE_PENDING |SAS_TASK_AT_INITIATOR ); - task->task_state_flags |=SAS_TASK_STATE_DONE ; +if (!slot->is_internal && task->task_proto !=SAS_PROTOCOL_SMP ) + task->task_state_flags |=SAS_TASK_STATE_DONE ;spin_unlock_irqrestore (&task->task_state_lock, flags); }
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 23/246 iio: adc: fix warning in Qualcomm PM8xxx HK/XOADC driver
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit e0f0ae838a25464179d37f355d763f9ec139fc15 ]
The pm8xxx_get_channel() implementation is unclear, and causes gcc to suddenly generate odd warnings. The trigger for the warning (at least for me) was the entirely unrelated commit 79a4e91d1bb2 ("device.h: Add __cold to dev_<level> logging functions"), which apparently changes gcc code generation in the caller function enough to cause this:
drivers/iio/adc/qcom-pm8xxx-xoadc.c: In function ‘pm8xxx_xoadc_probe’:
drivers/iio/adc/qcom-pm8xxx-xoadc.c:633:8: warning: ‘ch’ may be used uninitialized in this function [-Wmaybe-uninitialized]
ret = pm8xxx_read_channel_rsv(adc, ch, AMUX_RSV4,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
&read_nomux_rsv4, true);
~~~~~~~~~~~~~~~~~~~~~~~
drivers/iio/adc/qcom-pm8xxx-xoadc.c:426:27: note: ‘ch’ was declared here
struct pm8xxx_chan_info *ch;
^~because gcc for some reason then isn't able to see that the termination condition for the "for( )" loop in that function is also the condition for returning NULL.
So it's not _actually_ uninitialized, but the function is admittedly just unnecessarily oddly written.
Simplify and clarify the function, making gcc also see that it always returns a valid initialized value.
--- drivers/iio/adc/qcom-pm8xxx-xoadc.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
drivers/iio/adc/qcom-pm8xxx-xoadc.c +3 -7
@@ -423,18 +423,14 @@ static irqreturn_t pm8xxx_eoc_irq(int irq, void *d)static struct pm8xxx_chan_info *pm8xxx_get_channel (struct pm8xxx_xoadc *adc,u8 chan) { -struct pm8xxx_chan_info *ch;int i;for (i =0 ; i < adc->nchans; i++) { - ch = &adc->chans[i]; +struct pm8xxx_chan_info *ch = &adc->chans[i];if (ch->hwchan->amux_channel == chan) -break ; +return ch; } -if (i == adc->nchans) -return NULL ; - -return ch; +return NULL ; } static int pm8xxx_read_channel_rsv(struct pm8xxx_xoadc *adc,
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 25/246 perf c2c: Fix c2c report for empty numa node
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit e34c940245437f36d2c492edd1f8237eff391064 ]
Ravi Bangoria reported that we fail with an empty NUMA node with the following message:
$ lscpu NUMA node0 CPU(s): NUMA node1 CPU(s): 0-4
$ sudo ./perf c2c report node/cpu topology bugFailed setup nodes
Fix this by detecting the empty node and keeping its CPU set empty.
--- tools/perf/builtin-c2c.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
tools/perf/builtin-c2c.c +6 -2
@@ -2055,6 +2055,12 @@ static int setup_nodes(struct perf_session *session)if (!set)return -ENOMEM ; + nodes[node] = set; + +/* empty node, skip */ +if (cpu_map__empty (map)) +continue ; +for (cpu =0 ; cpu < map->nr; cpu++) {set_bit (map->map[cpu], set);
@@ -2063,8 +2069,6 @@ static int setup_nodes(struct perf_session *session) cpu2node[map->map[cpu]] = node; } - - nodes[node] = set; }setup_nodes_header ();
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 26/246 mm/sparse: fix a bad comparison
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit d778015ac95bc036af73342c878ab19250e01fe1 ]
next_present_section_nr() could only return an unsigned number -1, so just check it specifically where compilers will convert -1 to unsigned if needed.
mm/sparse.c: In function 'sparse_init_nid':
mm/sparse.c:200:20: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
((section_nr >= 0) && \
^~
mm/sparse.c:478:2: note: in expansion of macro
'for_each_present_section_nr'
for_each_present_section_nr(pnum_begin, pnum) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~
mm/sparse.c:200:20: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
((section_nr >= 0) && \
^~
mm/sparse.c:497:2: note: in expansion of macro
'for_each_present_section_nr'
for_each_present_section_nr(pnum_begin, pnum) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~
mm/sparse.c: In function 'sparse_init':
mm/sparse.c:200:20: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
((section_nr >= 0) && \
^~
mm/sparse.c:520:2: note: in expansion of macro
'for_each_present_section_nr'
for_each_present_section_nr(pnum_begin + 1, pnum_end) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~--- mm/sparse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/sparse.c +1 -1
@@ -197,7 +197,7 @@ static inline int next_present_section_nr(int section_nr) }#define for_each_present_section_nr (start, section_nr) \ for (section_nr = next_present_section_nr(start-1); \ - ((section_nr >= 0) && \ + ((section_nr != -1) && \ (section_nr <= __highest_present_section_nr)); \ section_nr = next_present_section_nr(section_nr))
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 27/246 mm/cma.c: cma_declare_contiguous: correct err handling
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 0d3bd18a5efd66097ef58622b898d3139790aa9d ]
In case cma_init_reserved_mem failed, need to free the memblock allocated by memblock_reserve or memblock_alloc_range.
Quote Catalin's comments:
https://lkml.org/lkml/2019/2/26/482
Kmemleak is supposed to work with the memblock_{alloc,free} pair and it ignores the memblock_reserve() as a memblock_alloc() implementation detail. It is, however, tolerant to memblock_free() being called on a sub-range or just a different range from a previous memblock_alloc(). So the original patch looks fine to me. FWIW:
--- mm/cma.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
mm/cma.c +3 -1
@@ -353,12 +353,14 @@ int __init cma_declare_contiguous(phys_addr_t base, ret =cma_init_reserved_mem (base, size, order_per_bit, name, res_cma);if (ret) - goto err; + goto free_mem;pr_info ("Reserved %ld MiB at %pa\n" , (unsigned long )size /SZ_1M , &base);return 0 ; +free_mem: +memblock_free (base, size); err:pr_err ("Failed to reserve %ld MiB\n" , (unsigned long )size /SZ_1M );return ret;
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 12/246 net/mlx5: Avoid panic when setting vport mac, getting vport config
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 6e77c413e8e73d0f36b5358b601389d75ec4451c ]
If we try to set VFs mac address on a VF (not PF) net device, the kernel will be crash. The commands are show as below:
$ echo 2 > /sys/class/net/$MLX_PF0/device/sriov_numvfs $ ip link set $MLX_VF0 vf 0 mac 00:11:22:33:44:00
[exception RIP: mlx5_eswitch_set_vport_mac+41] [ffffb8b7079e3688] do_setlink at ffffffff8f67f85b [ffffb8b7079e37a8] __rtnl_newlink at ffffffff8f683778 [ffffb8b7079e3b68] rtnl_newlink at ffffffff8f683a63 [ffffb8b7079e3b90] rtnetlink_rcv_msg at ffffffff8f67d812 [ffffb8b7079e3c10] netlink_rcv_skb at ffffffff8f6b88ab [ffffb8b7079e3c60] netlink_unicast at ffffffff8f6b808f [ffffb8b7079e3ca0] netlink_sendmsg at ffffffff8f6b8412 [ffffb8b7079e3d18] sock_sendmsg at ffffffff8f6452f6 [ffffb8b7079e3d30] ___sys_sendmsg at ffffffff8f645860 [ffffb8b7079e3eb0] __sys_sendmsg at ffffffff8f647a38 [ffffb8b7079e3f38] do_syscall_64 at ffffffff8f00401b [ffffb8b7079e3f50] entry_SYSCALL_64_after_hwframe at ffffffff8f80008c
and
[exception RIP: mlx5_eswitch_get_vport_config+12] [ffffa70607e57678] mlx5e_get_vf_config at ffffffffc03c7f8f [mlx5_core] [ffffa70607e57688] do_setlink at ffffffffbc67fa59 [ffffa70607e577a8] __rtnl_newlink at ffffffffbc683778 [ffffa70607e57b68] rtnl_newlink at ffffffffbc683a63 [ffffa70607e57b90] rtnetlink_rcv_msg at ffffffffbc67d812 [ffffa70607e57c10] netlink_rcv_skb at ffffffffbc6b88ab [ffffa70607e57c60] netlink_unicast at ffffffffbc6b808f [ffffa70607e57ca0] netlink_sendmsg at ffffffffbc6b8412 [ffffa70607e57d18] sock_sendmsg at ffffffffbc6452f6 [ffffa70607e57d30] ___sys_sendmsg at ffffffffbc645860 [ffffa70607e57eb0] __sys_sendmsg at ffffffffbc647a38 [ffffa70607e57f38] do_syscall_64 at ffffffffbc00401b [ffffa70607e57f50] entry_SYSCALL_64_after_hwframe at ffffffffbc80008c
--- drivers/net/ethernet/mellanox/mlx5/core/eswitch.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/eswitch.c +2 -2
@@ -1812,7 +1812,7 @@ int mlx5_eswitch_set_vport_mac(struct mlx5_eswitch *esw,u64 node_guid;int err =0 ; -if (!MLX5_CAP_GEN (esw->dev, vport_group_manager)) +if (!esw || !MLX5_CAP_GEN (esw->dev, vport_group_manager))return -EPERM ;if (!LEGAL_VPORT (esw, vport) ||is_multicast_ether_addr (mac))return -EINVAL ;
@@ -1886,7 +1886,7 @@ int mlx5_eswitch_get_vport_config(struct mlx5_eswitch *esw, {struct mlx5_vport *evport; -if (!MLX5_CAP_GEN (esw->dev, vport_group_manager)) +if (!esw || !MLX5_CAP_GEN (esw->dev, vport_group_manager))return -EPERM ;if (!LEGAL_VPORT (esw, vport))return -EINVAL ;
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 13/246 xsk: fix to reject invalid flags in xsk_bind
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit f54ba391d88f5a5d032175b4c308c176e34b80b7 ]
Passing a non-existing flag in the sxdp_flags member of struct sockaddr_xdp was, incorrectly, silently ignored. This patch addresses that behavior, and rejects any non-existing flags.
We have examined existing user space code, and to our best knowledge, no one is relying on the current incorrect behavior. AF_XDP is still in its infancy, so from our perspective, the risk of breakage is very low, and addressing this problem now is important.
--- net/xdp/xsk.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
net/xdp/xsk.c +4 -1
@@ -407,6 +407,10 @@ static int xsk_bind(struct socket *sock, struct sockaddr *addr, int addr_len)if (sxdp->sxdp_family !=AF_XDP )return -EINVAL ; + flags = sxdp->sxdp_flags; +if (flags & ~(XDP_SHARED_UMEM |XDP_COPY |XDP_ZEROCOPY )) +return -EINVAL ; +mutex_lock (&xs->mutex);if (xs->dev) { err = -EBUSY ;
@@ -425,7 +429,6 @@ static int xsk_bind(struct socket *sock, struct sockaddr *addr, int addr_len) } qid = sxdp->sxdp_queue_id; - flags = sxdp->sxdp_flags;if (flags &XDP_SHARED_UMEM ) {struct xdp_sock *umem_xs;
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 16/246 include/linux/relay.h: fix percpu annotation in struct rchan
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 62461ac2e5b6520b6d65fc6d7d7b4b8df4b848d8 ]
The percpu member of this structure is declared as:
struct ... ** __percpu member;
So its type is:
__percpu pointer to pointer to struct ...
But looking at how it's used, its type should be:
pointer to __percpu pointer to struct ...
and it should thus be declared as:
struct ... * __percpu *member;
So fix the placement of '__percpu' in the definition of this structures.
This silents a few Sparse's warnings like:
warning: incorrect type in initializer (different address spaces)
expected void const [noderef] <asn:3> *__vpp_verify got struct sched_domain **
--- include/linux/relay.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/relay.h +1 -1
@@ -66,7 +66,7 @@ struct rchanstruct kref kref;/* channel refcount */ void *private_data;/* for user-defined data */ size_t last_toobig;/* tried to log event > subbuf size */ -struct rchan_buf **__percpu buf;/* per-cpu channel buffers */ +struct rchan_buf *__percpu *buf;/* per-cpu channel buffers */ int is_global;/* One global buffer ? */ struct list_head list;/* for channel list */ struct dentry *parent;/* parent dentry passed to open */
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 29/246 mm, swap: bounds check swap_info array accesses to avoid NULL derefs
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit c10d38cc8d3e43f946b6c2bf4602c86791587f30 ]
Dan Carpenter reports a potential NULL dereference in get_swap_page_of_type:
Smatch complains that the NULL checks on "si" aren't consistent. This seems like a real bug because we have not ensured that the type is valid and so "si" can be NULL.
Add the missing check for NULL, taking care to use a read barrier to ensure CPU1 observes CPU0's updates in the correct order:
CPU0 CPU1
alloc_swap_info() if (type >= nr_swapfiles)
swap_info[type] = p /* handle invalid entry */
smp_wmb() smp_rmb()
++nr_swapfiles p = swap_info[type]
Without smp_rmb, CPU1 might observe CPU0's write to nr_swapfiles before CPU0's write to swap_info[type] and read NULL from swap_info[type].
Ying Huang noticed other places in swapfile.c don't order these reads properly. Introduce swap_type_to_swap_info to encourage correct usage.
Use READ_ONCE and WRITE_ONCE to follow the Linux Kernel Memory Model (see tools/memory-model/Documentation/explanation.txt).
This ordering need not be enforced in places where swap_lock is held (e.g. si_swapinfo) because swap_lock serializes updates to nr_swapfiles and the swap_info array.
--- mm/swapfile.c | 51 +++++++++++++++++++++++++++++---------------------- 1 file changed, 29 insertions(+), 22 deletions(-)
mm/swapfile.c +29 -22
@@ -98,6 +98,15 @@ static atomic_t proc_poll_event = ATOMIC_INIT(0);atomic_t nr_rotate_swap =ATOMIC_INIT (0 ); +static struct swap_info_struct *swap_type_to_swap_info (int type) +{ +if (type >=READ_ONCE (nr_swapfiles)) +return NULL ; + +smp_rmb ();/* Pairs with smp_wmb in alloc_swap_info. */ +return READ_ONCE (swap_info[type]); +} +static inline unsigned char swap_count (unsigned char ent) {return ent & ~SWAP_HAS_CACHE ;/* may include COUNT_CONTINUED flag */
@@ -1044,12 +1053,14 @@ noswap:/* The only caller of this function is now suspend routine */ swp_entry_t get_swap_page_of_type (int type) { -struct swap_info_struct *si; +struct swap_info_struct *si =swap_type_to_swap_info (type);pgoff_t offset; - si = swap_info[type]; +if (!si) + goto fail; +spin_lock (&si->lock); -if (si && (si->flags &SWP_WRITEOK )) { +if (si->flags &SWP_WRITEOK ) {atomic_long_dec (&nr_swap_pages);/* This is called for allocating swap entry, not cache */ offset =scan_swap_map (si,1 );
@@ -1060,6 +1071,7 @@ swp_entry_t get_swap_page_of_type(int type)atomic_long_inc (&nr_swap_pages); }spin_unlock (&si->lock); +fail:return (swp_entry_t ) {0 }; }
@@ -1071,9 +1083,9 @@ static struct swap_info_struct *__swap_info_get(swp_entry_t entry)if (!entry.val) goto out; type =swp_type (entry); -if (type >= nr_swapfiles) + p =swap_type_to_swap_info (type); +if (!p) goto bad_nofile; - p = swap_info[type];if (!(p->flags &SWP_USED )) goto bad_device; offset =swp_offset (entry);
@@ -1697,10 +1709,9 @@ int swap_type_of(dev_t device, sector_t offset, struct block_device **bdev_p)sector_t swapdev_block (int type,pgoff_t offset) {struct block_device *bdev; +struct swap_info_struct *si =swap_type_to_swap_info (type); -if ((unsigned int )type >= nr_swapfiles) -return 0 ; -if (!(swap_info[type]->flags &SWP_WRITEOK )) +if (!si || !(si->flags &SWP_WRITEOK ))return 0 ;return map_swap_entry (swp_entry (type, offset), &bdev); }
@@ -2258,7 +2269,7 @@ static sector_t map_swap_entry(swp_entry_t entry, struct block_device **bdev)struct swap_extent *se;pgoff_t offset; - sis = swap_info[swp_type (entry)]; + sis =swp_swap_info (entry); *bdev = sis->bdev; offset =swp_offset (entry);
@@ -2700,9 +2711,7 @@ static void *swap_start(struct seq_file *swap, loff_t *pos)if (!l)return SEQ_START_TOKEN ; -for (type =0 ; type < nr_swapfiles; type++) { -smp_rmb ();/* read nr_swapfiles before swap_info[type] */ - si = swap_info[type]; +for (type =0 ; (si =swap_type_to_swap_info (type)); type++) {if (!(si->flags &SWP_USED ) || !si->swap_map)continue ;if (!--l)
@@ -2722,9 +2731,7 @@ static void *swap_next(struct seq_file *swap, void *v, loff_t *pos)else type = si->type +1 ; -for (; type < nr_swapfiles; type++) { -smp_rmb ();/* read nr_swapfiles before swap_info[type] */ - si = swap_info[type]; +for (; (si =swap_type_to_swap_info (type)); type++) {if (!(si->flags &SWP_USED ) || !si->swap_map)continue ; ++*pos;
@@ -2831,14 +2838,14 @@ static struct swap_info_struct *alloc_swap_info(void) }if (type >= nr_swapfiles) { p->type = type; - swap_info[type] = p; +WRITE_ONCE (swap_info[type], p);/* * Write swap_info[type] before nr_swapfiles, in case a * racing procfs swap_start() or swap_next() is reading them. * (We never shrink nr_swapfiles, we never free this entry.) */ smp_wmb (); - nr_swapfiles++; +WRITE_ONCE (nr_swapfiles, nr_swapfiles +1 ); }else {kvfree (p); p = swap_info[type];
@@ -3358,7 +3365,7 @@ static int __swap_duplicate(swp_entry_t entry, unsigned char usage) {struct swap_info_struct *p;struct swap_cluster_info *ci; -unsigned long offset, type; +unsigned long offset;unsigned char count;unsigned char has_cache;int err = -EINVAL ;
@@ -3366,10 +3373,10 @@ static int __swap_duplicate(swp_entry_t entry, unsigned char usage)if (non_swap_entry (entry)) goto out; - type =swp_type (entry); -if (type >= nr_swapfiles) + p =swp_swap_info (entry); +if (!p) goto bad_file; - p = swap_info[type]; + offset =swp_offset (entry);if (unlikely (offset >= p->max)) goto out;
@@ -3466,7 +3473,7 @@ int swapcache_prepare(swp_entry_t entry)struct swap_info_struct *swp_swap_info (swp_entry_t entry) { -return swap_info[swp_type (entry)]; +return swap_type_to_swap_info (swp_type (entry)); }struct swap_info_struct *page_swap_info (struct page *page)
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 38/246 f2fs: fix to data block override node segment by mistake
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit a0770e13c8da83bdb64738c0209ab02dd3cfff8b ]
v4: Rearrange the previous three versions.
The following scenario could lead to data block override by mistake.
TASK A | TASK kworker | TASK B | TASK C
| | |
open | | |
write | | |
close | | |
| f2fs_write_data_pages | |
| f2fs_write_cache_pages | |
| f2fs_outplace_write_data | |
| f2fs_allocate_data_block (get block in seg S, | |
| S is full, and only | |
| have this valid data | |
| block) | |
| allocate_segment | |
| locate_dirty_segment (mark S as PRE) | |
| f2fs_submit_page_write (submit but is not | |
| written on dev) | |
unlink | | |
iput_final | | |
f2fs_drop_inode | | |
f2fs_truncate | | |
(not evict) | | |
| | write_checkpoint |
| | flush merged bio but not wait file data writeback |
| | set_prefree_as_free (mark S as FREE) |
| | | update NODE/DATA
| | | allocate_segment (select S)
| writeback done | |So we need to guarantee io complete before truncate inode in f2fs_drop_inode.
--- fs/f2fs/super.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/f2fs/super.c +4 -0
@@ -915,6 +915,10 @@ static int f2fs_drop_inode(struct inode *inode)sb_start_intwrite (inode->i_sb);f2fs_i_size_write (inode,0 ); +f2fs_submit_merged_write_cond (F2FS_I_SB (inode), + inode,NULL ,0 ,DATA ); +truncate_inode_pages_final (inode->i_mapping); +if (F2FS_HAS_BLOCKS (inode))f2fs_truncate (inode);
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 40/246 page_poison: play nicely with KASAN
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 4117992df66a26fa33908b4969e04801534baab1 ]
KASAN does not play well with the page poisoning (CONFIG_PAGE_POISONING). It triggers false positives in the allocation path:
BUG: KASAN: use-after-free in memchr_inv+0x2ea/0x330 Read of size 8 at addr ffff88881f800000 by task swapper/0 CPU: 0 PID: 0 Comm: swapper Not tainted 5.0.0-rc1+ #54 Call Trace: dump_stack+0xe0/0x19a print_address_description.cold.2+0x9/0x28b kasan_report.cold.3+0x7a/0xb5 __asan_report_load8_noabort+0x19/0x20 memchr_inv+0x2ea/0x330 kernel_poison_pages+0x103/0x3d5 get_page_from_freelist+0x15e7/0x4d90
because KASAN has not yet unpoisoned the shadow page for allocation before it checks memchr_inv() but only found a stale poison pattern.
Also, false positives in free path,
BUG: KASAN: slab-out-of-bounds in kernel_poison_pages+0x29e/0x3d5 Write of size 4096 at addr ffff8888112cc000 by task swapper/0/1 CPU: 5 PID: 1 Comm: swapper/0 Not tainted 5.0.0-rc1+ #55 Call Trace: dump_stack+0xe0/0x19a print_address_description.cold.2+0x9/0x28b kasan_report.cold.3+0x7a/0xb5 check_memory_region+0x22d/0x250 memset+0x28/0x40 kernel_poison_pages+0x29e/0x3d5 __free_pages_ok+0x75f/0x13e0
due to KASAN adds poisoned redzones around slab objects, but the page poisoning needs to poison the whole page.
--- mm/page_alloc.c | 2 +- mm/page_poison.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-)
mm/page_alloc.c +1 -1
@@ -1945,8 +1945,8 @@ inline void post_alloc_hook(struct page *page, unsigned int order,arch_alloc_page (page, order);kernel_map_pages (page,1 << order,1 ); -kernel_poison_pages (page,1 << order,1 );kasan_alloc_pages (page, order); +kernel_poison_pages (page,1 << order,1 );set_page_owner (page, order, gfp_flags); }
mm/page_poison.c +4 -0
@@ -6,6 +6,7 @@#include <linux/page_ext.h> #include <linux/poison.h> #include <linux/ratelimit.h> +#include <linux/kasan.h> static bool want_page_poisoning__read_mostly ;
@@ -40,7 +41,10 @@ static void poison_page(struct page *page) {void *addr =kmap_atomic (page); +/* KASAN still think the page is in-use, so skip it. */ +kasan_disable_current ();memset (addr,PAGE_POISON ,PAGE_SIZE ); +kasan_enable_current ();kunmap_atomic (addr); }
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 42/246 cifs: use correct format characters
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 259594bea574e515a148171b5cd84ce5cbdc028a ]
When compiling with -Wformat, clang emits the following warnings:
fs/cifs/smb1ops.c:312:20: warning: format specifies type 'unsigned short' but the argument has type 'unsigned int' [-Wformat]
tgt_total_cnt, total_in_tgt);
^~~~~~~~~~~~fs/cifs/cifs_dfs_ref.c:289:4: warning: format specifies type 'short' but the argument has type 'int' [-Wformat]
ref->flags, ref->server_type);
^~~~~~~~~~fs/cifs/cifs_dfs_ref.c:289:16: warning: format specifies type 'short' but the argument has type 'int' [-Wformat]
ref->flags, ref->server_type);
^~~~~~~~~~~~~~~~fs/cifs/cifs_dfs_ref.c:291:4: warning: format specifies type 'short' but the argument has type 'int' [-Wformat]
ref->ref_flag, ref->path_consumed);
^~~~~~~~~~~~~fs/cifs/cifs_dfs_ref.c:291:19: warning: format specifies type 'short' but the argument has type 'int' [-Wformat]
ref->ref_flag, ref->path_consumed);
^~~~~~~~~~~~~~~~~~The types of these arguments are unconditionally defined, so this patch updates the format character to the correct ones for ints and unsigned ints.
--- fs/cifs/cifs_dfs_ref.c | 4 ++-- fs/cifs/smb1ops.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
fs/cifs/cifs_dfs_ref.c +2 -2
@@ -285,9 +285,9 @@ static void dump_referral(const struct dfs_info3_param *ref) {cifs_dbg (FYI ,"DFS: ref path: %s\n" , ref->path_name);cifs_dbg (FYI ,"DFS: node path: %s\n" , ref->node_name); -cifs_dbg (FYI ,"DFS: fl: %hd, srv_type: %hd\n" , +cifs_dbg (FYI ,"DFS: fl: %d, srv_type: %d\n" , ref->flags, ref->server_type); -cifs_dbg (FYI ,"DFS: ref_flags: %hd, path_consumed: %hd\n" , +cifs_dbg (FYI ,"DFS: ref_flags: %d, path_consumed: %d\n" , ref->ref_flag, ref->path_consumed); }
fs/cifs/smb1ops.c +1 -1
@@ -308,7 +308,7 @@ coalesce_t2(char *second_buf, struct smb_hdr *target_hdr) remaining = tgt_total_cnt - total_in_tgt;if (remaining <0 ) { -cifs_dbg (FYI ,"Server sent too much data. tgt_total_cnt=%hu total_in_tgt=%hu\n" , +cifs_dbg (FYI ,"Server sent too much data. tgt_total_cnt=%hu total_in_tgt=%u\n" , tgt_total_cnt, total_in_tgt);return -EPROTO ; }
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 43/246 dm thin: add sanity checks to thin-pool and external snapshot creation
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 70de2cbda8a5d788284469e755f8b097d339c240 ]
Invoking dm_get_device() twice on the same device path with different modes is dangerous. Because in that case, upgrade_mode() will alloc a new 'dm_dev' and free the old one, which may be referenced by a previous caller. Dereferencing the dangling pointer will trigger kernel NULL pointer dereference.
The following two cases can reproduce this issue. Actually, they are invalid setups that must be disallowed, e.g.:
1. Creating a thin-pool with read_only mode, and the same device as both metadata and data.
dmsetup create thinp --table \
"0 41943040 thin-pool /dev/vdb /dev/vdb 128 0 1 read_only"BUG: unable to handle kernel NULL pointer dereference at 0000000000000080 ... Call Trace: new_read+0xfb/0x110 [dm_bufio] dm_bm_read_lock+0x43/0x190 [dm_persistent_data] ? kmem_cache_alloc_trace+0x15c/0x1e0 __create_persistent_data_objects+0x65/0x3e0 [dm_thin_pool] dm_pool_metadata_open+0x8c/0xf0 [dm_thin_pool] pool_ctr.cold.79+0x213/0x913 [dm_thin_pool] ? realloc_argv+0x50/0x70 [dm_mod] dm_table_add_target+0x14e/0x330 [dm_mod] table_load+0x122/0x2e0 [dm_mod] ? dev_status+0x40/0x40 [dm_mod] ctl_ioctl+0x1aa/0x3e0 [dm_mod] dm_ctl_ioctl+0xa/0x10 [dm_mod] do_vfs_ioctl+0xa2/0x600 ? handle_mm_fault+0xda/0x200 ? __do_page_fault+0x26c/0x4f0 ksys_ioctl+0x60/0x90 __x64_sys_ioctl+0x16/0x20 do_syscall_64+0x55/0x150 entry_SYSCALL_64_after_hwframe+0x44/0xa9
2. Creating a external snapshot using the same thin-pool device.
dmsetup create thinp --table \
"0 41943040 thin-pool /dev/vdc /dev/vdb 128 0 2 ignore_discard"
dmsetup message /dev/mapper/thinp 0 "create_thin 0"
dmsetup create snap --table \
"0 204800 thin /dev/mapper/thinp 0 /dev/mapper/thinp"BUG: unable to handle kernel NULL pointer dereference at 0000000000000000 ... Call Trace: ? __alloc_pages_nodemask+0x13c/0x2e0 retrieve_status+0xa5/0x1f0 [dm_mod] ? dm_get_live_or_inactive_table.isra.7+0x20/0x20 [dm_mod] table_status+0x61/0xa0 [dm_mod] ctl_ioctl+0x1aa/0x3e0 [dm_mod] dm_ctl_ioctl+0xa/0x10 [dm_mod] do_vfs_ioctl+0xa2/0x600 ksys_ioctl+0x60/0x90 ? ksys_write+0x4f/0xb0 __x64_sys_ioctl+0x16/0x20 do_syscall_64+0x55/0x150 entry_SYSCALL_64_after_hwframe+0x44/0xa9
--- drivers/md/dm-thin.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/md/dm-thin.c +13 -0
@@ -3283,6 +3283,13 @@ static int pool_ctr(struct dm_target *ti, unsigned argc, char **argv) as.argc = argc; as.argv = argv; +/* make sure metadata and data are different devices */ +if (!strcmp (argv[0 ], argv[1 ])) { + ti->error ="Error setting metadata or data device" ; + r = -EINVAL ; + goto out_unlock; + } +/* * Set default pool features. */
@@ -4167,6 +4174,12 @@ static int thin_ctr(struct dm_target *ti, unsigned argc, char **argv) tc->sort_bio_list =RB_ROOT ;if (argc ==3 ) { +if (!strcmp (argv[0 ], argv[2 ])) { + ti->error ="Error setting origin device" ; + r = -EINVAL ; + goto bad_origin_dev; + } + r =dm_get_device (ti, argv[2 ],FMODE_READ , &origin_dev);if (r) { ti->error ="Error opening origin device" ;
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 32/246 memcg: killed threads should not invoke memcg OOM killer
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 7775face207922ea62a4e96b9cd45abfdc7b9840 ]
If a memory cgroup contains a single process with many threads (including different process group sharing the mm) then it is possible to trigger a race when the oom killer complains that there are no oom elible tasks and complain into the log which is both annoying and confusing because there is no actual problem. The race looks as follows:
P1 oom_reaper P2try_charge try_charge
mem_cgroup_out_of_memory
mutex_lock(oom_lock)
out_of_memory
oom_kill_process(P1,P2)
wake_oom_reaper
mutex_unlock(oom_lock)
oom_reap_task
mutex_lock(oom_lock)
select_bad_process # no victim
The problem is more visible with many threads.
Fix this by checking for fatal_signal_pending from mem_cgroup_out_of_memory when the oom_lock is already held.
The oom bypass is safe because we do the same early in the try_charge path already. The situation migh have changed in the mean time. It should be safe to check for fatal_signal_pending and tsk_is_oom_victim but for a better code readability abstract the current charge bypass condition into should_force_charge and reuse it from that path. "
--- mm/memcontrol.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-)
mm/memcontrol.c +14 -5
@@ -248,6 +248,12 @@ enum res_type { iter !=NULL ; \ iter = mem_cgroup_iter(NULL, iter, NULL)) +static inline bool should_force_charge (void ) +{ +return tsk_is_oom_victim (current) ||fatal_signal_pending (current) || + (current->flags &PF_EXITING ); +} +/* Some nice accessors for the vmpressure. */ struct vmpressure *memcg_to_vmpressure (struct mem_cgroup *memcg) {
@@ -1389,8 +1395,13 @@ static bool mem_cgroup_out_of_memory(struct mem_cgroup *memcg, gfp_t gfp_mask, };bool ret; -mutex_lock (&oom_lock); - ret =out_of_memory (&oc); +if (mutex_lock_killable (&oom_lock)) +return true; +/* +* A few threads which were not waiting at mutex_lock_killable() can +* fail to bail out. Therefore, check again after holding oom_lock. +*/ + ret =should_force_charge () ||out_of_memory (&oc);mutex_unlock (&oom_lock);return ret; }
@@ -2209,9 +2220,7 @@ retry:* bypass the last charges so that they can exit quickly and * free their memory. */ -if (unlikely (tsk_is_oom_victim (current) || -fatal_signal_pending (current) || - current->flags &PF_EXITING )) +if (unlikely (should_force_charge ())) goto force;/*
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 31/246 mm,oom: dont kill global init via memory.oom.group
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit d342a0b38674867ea67fde47b0e1e60ffe9f17a2 ]
Since setting global init process to some memory cgroup is technically possible, oom_kill_memcg_member() must check it.
Tasks in /test1 are going to be killed due to memory.oom.group set
Memory cgroup out of memory: Killed process 1 (systemd) total-vm:43400kB, anon-rss:1228kB, file-rss:3992kB, shmem-rss:0kB
oom_reaper: reaped process 1 (systemd), now anon-rss:0kB, file-rss:0kB, shmem-rss:0kB
Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000008b
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
int main(int argc, char *argv[])
{
static char buffer[10485760];
static int pipe_fd[2] = { EOF, EOF };
unsigned int i;
int fd;
char buf[64] = { };
if (pipe(pipe_fd))
return 1;
if (chdir("/sys/fs/cgroup/"))
return 1;
fd = open("cgroup.subtree_control", O_WRONLY);
write(fd, "+memory", 7);
close(fd);
mkdir("test1", 0755);
fd = open("test1/memory.oom.group", O_WRONLY);
write(fd, "1", 1);
close(fd);
fd = open("test1/cgroup.procs", O_WRONLY);
write(fd, "1", 1);
snprintf(buf, sizeof(buf) - 1, "%d", getpid());
write(fd, buf, strlen(buf));
close(fd);
snprintf(buf, sizeof(buf) - 1, "%lu", sizeof(buffer) * 5);
fd = open("test1/memory.max", O_WRONLY);
write(fd, buf, strlen(buf));
close(fd);
for (i = 0; i < 10; i++)
if (fork() == 0) {
char c;
close(pipe_fd[1]);
read(pipe_fd[0], &c, 1);
memset(buffer, 0, sizeof(buffer));
sleep(3);
_exit(0);
}
close(pipe_fd[0]);
close(pipe_fd[1]);
sleep(3);
return 0;
}[ 37.052923][ T9185] a.out invoked oom-killer: gfp_mask=0xcc0(GFP_KERNEL), order=0, oom_score_adj=0 [ 37.056169][ T9185] CPU: 4 PID: 9185 Comm: a.out Kdump: loaded Not tainted 5.0.0-rc4-next-20190131 #280 [ 37.059205][ T9185] Hardware name: VMware, Inc. VMware Virtual Platform/440BX Desktop Reference Platform, BIOS 6.00 04/13/2018 [ 37.062954][ T9185] Call Trace: [ 37.063976][ T9185] dump_stack+0x67/0x95 [ 37.065263][ T9185] dump_header+0x51/0x570 [ 37.066619][ T9185] ? trace_hardirqs_on+0x3f/0x110 [ 37.068171][ T9185] ? _raw_spin_unlock_irqrestore+0x3d/0x70 [ 37.069967][ T9185] oom_kill_process+0x18d/0x210 [ 37.071515][ T9185] out_of_memory+0x11b/0x380 [ 37.072936][ T9185] mem_cgroup_out_of_memory+0xb6/0xd0 [ 37.074601][ T9185] try_charge+0x790/0x820 [ 37.076021][ T9185] mem_cgroup_try_charge+0x42/0x1d0 [ 37.077629][ T9185] mem_cgroup_try_charge_delay+0x11/0x30 [ 37.079370][ T9185] do_anonymous_page+0x105/0x5e0 [ 37.080939][ T9185] __handle_mm_fault+0x9cb/0x1070 [ 37.082485][ T9185] handle_mm_fault+0x1b2/0x3a0 [ 37.083819][ T9185] ? handle_mm_fault+0x47/0x3a0 [ 37.085181][ T9185] __do_page_fault+0x255/0x4c0 [ 37.086529][ T9185] do_page_fault+0x28/0x260 [ 37.087788][ T9185] ? page_fault+0x8/0x30 [ 37.088978][ T9185] page_fault+0x1e/0x30 [ 37.090142][ T9185] RIP: 0033:0x7f8b183aefe0 [ 37.091433][ T9185] Code: 20 f3 44 0f 7f 44 17 d0 f3 44 0f 7f 47 30 f3 44 0f 7f 44 17 c0 48 01 fa 48 83 e2 c0 48 39 d1 74 a3 66 0f 1f 84 00 00 00 00 00 <66> 44 0f 7f 01 66 44 0f 7f 41 10 66 44 0f 7f 41 20 66 44 0f 7f 41 [ 37.096917][ T9185] RSP: 002b:00007fffc5d329e8 EFLAGS: 00010206 [ 37.098615][ T9185] RAX: 00000000006010e0 RBX: 0000000000000008 RCX: 0000000000c30000 [ 37.100905][ T9185] RDX: 00000000010010c0 RSI: 0000000000000000 RDI: 00000000006010e0 [ 37.103349][ T9185] RBP: 0000000000000000 R08: 00007f8b188f4740 R09: 0000000000000000 [ 37.105797][ T9185] R10: 00007fffc5d32420 R11: 00007f8b183aef40 R12: 0000000000000005 [ 37.108228][ T9185] R13: 0000000000000000 R14: ffffffffffffffff R15: 0000000000000000 [ 37.110840][ T9185] memory: usage 51200kB, limit 51200kB, failcnt 125 [ 37.113045][ T9185] memory+swap: usage 0kB, limit 9007199254740988kB, failcnt 0 [ 37.115808][ T9185] kmem: usage 0kB, limit 9007199254740988kB, failcnt 0 [ 37.117660][ T9185] Memory cgroup stats for /test1: cache:0KB rss:49484KB rss_huge:30720KB shmem:0KB mapped_file:0KB dirty:0KB writeback:0KB inactive_anon:0KB active_anon:49700KB inactive_file:0KB active_file:0KB unevictable:0KB [ 37.123371][ T9185] oom-kill:constraint=CONSTRAINT_NONE,nodemask=(null),cpuset=/,mems_allowed=0,oom_memcg=/test1,task_memcg=/test1,task=a.out,pid=9188,uid=0 [ 37.128158][ T9185] Memory cgroup out of memory: Killed process 9188 (a.out) total-vm:14456kB, anon-rss:10324kB, file-rss:504kB, shmem-rss:0kB [ 37.132710][ T9185] Tasks in /test1 are going to be killed due to memory.oom.group set [ 37.132833][ T54] oom_reaper: reaped process 9188 (a.out), now anon-rss:0kB, file-rss:0kB, shmem-rss:0kB [ 37.135498][ T9185] Memory cgroup out of memory: Killed process 1 (systemd) total-vm:43400kB, anon-rss:1228kB, file-rss:3992kB, shmem-rss:0kB [ 37.143434][ T9185] Memory cgroup out of memory: Killed process 9182 (a.out) total-vm:14456kB, anon-rss:76kB, file-rss:588kB, shmem-rss:0kB [ 37.144328][ T54] oom_reaper: reaped process 1 (systemd), now anon-rss:0kB, file-rss:0kB, shmem-rss:0kB [ 37.147585][ T9185] Memory cgroup out of memory: Killed process 9183 (a.out) total-vm:14456kB, anon-rss:6228kB, file-rss:512kB, shmem-rss:0kB [ 37.157222][ T9185] Memory cgroup out of memory: Killed process 9184 (a.out) total-vm:14456kB, anon-rss:6228kB, file-rss:508kB, shmem-rss:0kB [ 37.157259][ T9185] Memory cgroup out of memory: Killed process 9185 (a.out) total-vm:14456kB, anon-rss:6228kB, file-rss:512kB, shmem-rss:0kB [ 37.157291][ T9185] Memory cgroup out of memory: Killed process 9186 (a.out) total-vm:14456kB, anon-rss:4180kB, file-rss:508kB, shmem-rss:0kB [ 37.157306][ T54] oom_reaper: reaped process 9183 (a.out), now anon-rss:0kB, file-rss:0kB, shmem-rss:0kB [ 37.157328][ T9185] Memory cgroup out of memory: Killed process 9187 (a.out) total-vm:14456kB, anon-rss:4180kB, file-rss:512kB, shmem-rss:0kB [ 37.157452][ T9185] Memory cgroup out of memory: Killed process 9189 (a.out) total-vm:14456kB, anon-rss:6228kB, file-rss:512kB, shmem-rss:0kB [ 37.158733][ T9185] Memory cgroup out of memory: Killed process 9190 (a.out) total-vm:14456kB, anon-rss:552kB, file-rss:512kB, shmem-rss:0kB [ 37.160083][ T54] oom_reaper: reaped process 9186 (a.out), now anon-rss:0kB, file-rss:0kB, shmem-rss:0kB [ 37.160187][ T54] oom_reaper: reaped process 9189 (a.out), now anon-rss:0kB, file-rss:0kB, shmem-rss:0kB [ 37.206941][ T54] oom_reaper: reaped process 9185 (a.out), now anon-rss:0kB, file-rss:0kB, shmem-rss:0kB [ 37.212300][ T9185] Memory cgroup out of memory: Killed process 9191 (a.out) total-vm:14456kB, anon-rss:4180kB, file-rss:512kB, shmem-rss:0kB [ 37.212317][ T54] oom_reaper: reaped process 9190 (a.out), now anon-rss:0kB, file-rss:0kB, shmem-rss:0kB [ 37.218860][ T9185] Memory cgroup out of memory: Killed process 9192 (a.out) total-vm:14456kB, anon-rss:1080kB, file-rss:512kB, shmem-rss:0kB [ 37.227667][ T54] oom_reaper: reaped process 9192 (a.out), now anon-rss:0kB, file-rss:0kB, shmem-rss:0kB [ 37.292323][ T9193] abrt-hook-ccpp (9193) used greatest stack depth: 10480 bytes left [ 37.351843][ T1] Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000008b [ 37.354833][ T1] CPU: 7 PID: 1 Comm: systemd Kdump: loaded Not tainted 5.0.0-rc4-next-20190131 #280 [ 37.357876][ T1] Hardware name: VMware, Inc. VMware Virtual Platform/440BX Desktop Reference Platform, BIOS 6.00 04/13/2018 [ 37.361685][ T1] Call Trace: [ 37.363239][ T1] dump_stack+0x67/0x95 [ 37.365010][ T1] panic+0xfc/0x2b0 [ 37.366853][ T1] do_exit+0xd55/0xd60 [ 37.368595][ T1] do_group_exit+0x47/0xc0 [ 37.370415][ T1] get_signal+0x32a/0x920 [ 37.372449][ T1] ? _raw_spin_unlock_irqrestore+0x3d/0x70 [ 37.374596][ T1] do_signal+0x32/0x6e0 [ 37.376430][ T1] ? exit_to_usermode_loop+0x26/0x9b [ 37.378418][ T1] ? prepare_exit_to_usermode+0xa8/0xd0 [ 37.380571][ T1] exit_to_usermode_loop+0x3e/0x9b [ 37.382588][ T1] prepare_exit_to_usermode+0xa8/0xd0 [ 37.384594][ T1] ? page_fault+0x8/0x30 [ 37.386453][ T1] retint_user+0x8/0x18 [ 37.388160][ T1] RIP: 0033:0x7f42c06974a8 [ 37.389922][ T1] Code: Bad RIP value. [ 37.391788][ T1] RSP: 002b:00007ffc3effd388 EFLAGS: 00010213 [ 37.394075][ T1] RAX: 000000000000000e RBX: 00007ffc3effd390 RCX: 0000000000000000 [ 37.396963][ T1] RDX: 000000000000002a RSI: 00007ffc3effd390 RDI: 0000000000000004 [ 37.399550][ T1] RBP: 00007ffc3effd680 R08: 0000000000000000 R09: 0000000000000000 [ 37.402334][ T1] R10: 00000000ffffffff R11: 0000000000000246 R12: 0000000000000001 [ 37.404890][ T1] R13: ffffffffffffffff R14: 0000000000000884 R15: 000056460b1ac3b0
--- mm/oom_kill.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
mm/oom_kill.c +2 -1
@@ -928,7 +928,8 @@ static void __oom_kill_process(struct task_struct *victim)*/ static int oom_kill_memcg_member (struct task_struct *task,void *unused) { -if (task->signal->oom_score_adj !=OOM_SCORE_ADJ_MIN ) { +if (task->signal->oom_score_adj !=OOM_SCORE_ADJ_MIN && + !is_global_init (task)) {get_task_struct (task);__oom_kill_process (task); }
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 34/246 mm/vmalloc.c: fix kernel BUG at mm/vmalloc.c:512!
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit afd07389d3f4933c7f7817a92fb5e053d59a3182 ]
One of the vmalloc stress test case triggers the kernel BUG():
<snip>
[60.562151] ------------[ cut here ]------------ [60.562154] kernel BUG at mm/vmalloc.c:512! [60.562206] invalid opcode: 0000 [#1] PREEMPT SMP PTI [60.562247] CPU: 0 PID: 430 Comm: vmalloc_test/0 Not tainted 4.20.0+ #161 [60.562293] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1 04/01/2014 [60.562351] RIP: 0010:alloc_vmap_area+0x36f/0x390 <snip>
it can happen due to big align request resulting in overflowing of calculated address, i.e. it becomes 0 after ALIGN()'s fixup.
Fix it by checking if calculated address is within vstart/vend range.
--- mm/vmalloc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
mm/vmalloc.c +5 -1
@@ -498,7 +498,11 @@ nocache: } found: -if (addr + size > vend) +/* +* Check also calculated address against the vstart, +* because it can be 0 because of big align request. +*/ +if (addr + size > vend || addr < vstart) goto overflow; va->va_start = addr;
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 36/246 ocfs2: fix a panic problem caused by o2cb_ctl
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit cc725ef3cb202ef2019a3c67c8913efa05c3cce6 ]
In the process of creating a node, it will cause NULL pointer dereference in kernel if o2cb_ctl failed in the interval (mkdir, o2cb_set_node_attribute(node_num)] in function o2cb_add_node.
The node num is initialized to 0 in function o2nm_node_group_make_item, o2nm_node_group_drop_item will mistake the node number 0 for a valid node number when we delete the node before the node number is set correctly. If the local node number of the current host happens to be 0, cluster->cl_local_node will be set to O2NM_INVALID_NODE_NUM while o2hb_thread still running. The panic stack is generated as follows:
o2hb_thread
\-o2hb_do_disk_heartbeat
\-o2hb_check_own_slot
|-slot = ®->hr_slots[o2nm_this_node()];
//o2nm_this_node() return O2NM_INVALID_NODE_NUMWe need to check whether the node number is set when we delete the node.
--- fs/ocfs2/cluster/nodemanager.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
fs/ocfs2/cluster/nodemanager.c +8 -6
@@ -621,13 +621,15 @@ static void o2nm_node_group_drop_item(struct config_group *group,struct o2nm_node *node =to_o2nm_node (item);struct o2nm_cluster *cluster =to_o2nm_cluster (group->cg_item.ci_parent); -o2net_disconnect_node (node); +if (cluster->cl_nodes[node->nd_num] == node) { +o2net_disconnect_node (node); -if (cluster->cl_has_local && - (cluster->cl_local_node == node->nd_num)) { - cluster->cl_has_local =0 ; - cluster->cl_local_node =O2NM_INVALID_NODE_NUM ; -o2net_stop_listening (node); +if (cluster->cl_has_local && + (cluster->cl_local_node == node->nd_num)) { + cluster->cl_has_local =0 ; + cluster->cl_local_node =O2NM_INVALID_NODE_NUM ; +o2net_stop_listening (node); + } }/* XXX call into net to stop this node from trading messages */
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 37/246 f2fs: do not use mutex lock in atomic context
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 9083977dabf3833298ddcd40dee28687f1e6b483 ]
Fix below warning coming because of using mutex lock in atomic context.
BUG: sleeping function called from invalid context at kernel/locking/mutex.c:98 in_atomic(): 1, irqs_disabled(): 0, pid: 585, name: sh Preemption disabled at: __radix_tree_preload+0x28/0x130 Call trace: dump_backtrace+0x0/0x2b4 show_stack+0x20/0x28 dump_stack+0xa8/0xe0 ___might_sleep+0x144/0x194 __might_sleep+0x58/0x8c mutex_lock+0x2c/0x48 f2fs_trace_pid+0x88/0x14c f2fs_set_node_page_dirty+0xd0/0x184
Do not use f2fs_radix_tree_insert() to avoid doing cond_resched() with spin_lock() acquired.
--- fs/f2fs/trace.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-)
fs/f2fs/trace.c +13 -7
@@ -14,7 +14,7 @@#include "trace.h" static RADIX_TREE(pids, GFP_ATOMIC); -static struct mutex pids_lock; +static spinlock_t pids_lock;static struct last_io_info last_io;static inline void __print_last_io (void )
@@ -58,23 +58,29 @@ void f2fs_trace_pid(struct page *page)set_page_private (page, (unsigned long )pid); +retry:if (radix_tree_preload (GFP_NOFS ))return ; -mutex_lock (&pids_lock); +spin_lock (&pids_lock); p =radix_tree_lookup (&pids, pid);if (p == current) goto out;if (p)radix_tree_delete (&pids, pid); -f2fs_radix_tree_insert (&pids, pid, current); +if (radix_tree_insert (&pids, pid, current)) { +spin_unlock (&pids_lock); +radix_tree_preload_end (); +cond_resched (); + goto retry; + }trace_printk ("%3x:%3x %4x %-16s\n" ,MAJOR (inode->i_sb->s_dev),MINOR (inode->i_sb->s_dev), pid, current->comm); out: -mutex_unlock (&pids_lock); +spin_unlock (&pids_lock);radix_tree_preload_end (); }
@@ -119,7 +125,7 @@ void f2fs_trace_ios(struct f2fs_io_info *fio, int flush)void f2fs_build_trace_ios (void ) { -mutex_init (&pids_lock); +spin_lock_init (&pids_lock); }#define PIDVEC_SIZE 128
@@ -147,7 +153,7 @@ void f2fs_destroy_trace_ios(void)pid_t next_pid =0 ;unsigned int found; -mutex_lock (&pids_lock); +spin_lock (&pids_lock);while ((found =gang_lookup_pids (pid, next_pid,PIDVEC_SIZE ))) {unsigned idx;
@@ -155,5 +161,5 @@ void f2fs_destroy_trace_ios(void)for (idx =0 ; idx < found; idx++)radix_tree_delete (&pids, pid[idx]); } -mutex_unlock (&pids_lock); +spin_unlock (&pids_lock); }
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 56/246 tools lib traceevent: Fix buffer overflow in arg_eval
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 7c5b019e3a638a5a290b0ec020f6ca83d2ec2aaa ]
Fix buffer overflow observed when running perf test.
The overflow is when trying to evaluate "1ULL << (64 - 1)" which is resulting in -9223372036854775808 which overflows the 20 character buffer.
If is possible this bug has been reported before but I still don't see any fix checked in:
See: https://www.spinics.net/lists/linux-perf-users/msg07714.html
--- tools/lib/traceevent/event-parse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/lib/traceevent/event-parse.c +1 -1
@@ -2457,7 +2457,7 @@ static int arg_num_eval(struct tep_print_arg *arg, long long *val)static char *arg_eval (struct tep_print_arg *arg) {long long val; -static char buf[20 ]; +static char buf[24 ];switch (arg->type) {case TEP_PRINT_ATOM :
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 58/246 PCI/PME: Fix hotplug/sysfs remove deadlock in pcie_pme_remove()
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 95c80bc6952b6a5badc7b702d23e5bf14d251e7c ]
Dongdong reported a deadlock triggered by a hotplug event during a sysfs "remove" operation:
pciehp 0000:00:0c.0:pcie004: Slot(0-1): Link Up
# echo 1 > 0000:00:0c.0/remove
PME and hotplug share an MSI/MSI-X vector. The sysfs "remove" side is:
remove_store
pci_stop_and_remove_bus_device_locked
pci_lock_rescan_remove
pci_stop_and_remove_bus_device
...
pcie_pme_remove
pcie_pme_suspend
synchronize_irq # wait for hotplug IRQ handler
pci_unlock_rescan_remove
The hotplug side is:
pciehp_ist
pciehp_handle_presence_or_link_change
pciehp_configure_device
pci_lock_rescan_remove # wait for pci_unlock_rescan_remove()
INFO: task bash:10913 blocked for more than 120 seconds.
# ps -ax |grep D PID TTY STAT TIME COMMAND 10913 ttyAMA0 Ds+ 0:00 -bash 14022 ? D 0:00 [irq/745-pciehp]
# cat /proc/14022/stack __switch_to+0x94/0xd8 pci_lock_rescan_remove+0x20/0x28 pciehp_configure_device+0x30/0x140 pciehp_handle_presence_or_link_change+0x324/0x458 pciehp_ist+0x1dc/0x1e0
# cat /proc/10913/stack __switch_to+0x94/0xd8 synchronize_irq+0x8c/0xc0 pcie_pme_suspend+0xa4/0x118 pcie_pme_remove+0x20/0x40 pcie_port_remove_service+0x3c/0x58 ... pcie_port_device_remove+0x2c/0x48 pcie_portdrv_remove+0x68/0x78 pci_device_remove+0x48/0x120 ... pci_stop_bus_device+0x84/0xc0 pci_stop_and_remove_bus_device_locked+0x24/0x40 remove_store+0xa4/0xb8 dev_attr_store+0x44/0x60 sysfs_kf_write+0x58/0x80
It is incorrect to call pcie_pme_suspend() from pcie_pme_remove() for two reasons.
First, pcie_pme_suspend() calls synchronize_irq(), which will wait for the native hotplug interrupt handler as well as for the PME one, because they share one IRQ (as per the spec). That may deadlock if hotplug is signaled while pcie_pme_remove() is running and the latter calls pci_lock_rescan_remove() before the former.
Second, if pcie_pme_suspend() figures out that wakeup needs to be enabled for the port, it will return without disabling the interrupt as expected by pcie_pme_remove() which was overlooked by commit c7b5a4e6e8fb ("PCI / PM:
Fix native PME handling during system suspend/resume").
To fix that, rework pcie_pme_remove() to disable the PME interrupt, clear its status and prevent the PME worker function from re-enabling it before calling free_irq() on it, which should be sufficient.
--- drivers/pci/pcie/pme.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-)
drivers/pci/pcie/pme.c +15 -7
@@ -363,6 +363,16 @@ static bool pcie_pme_check_wakeup(struct pci_bus *bus)return false; } +static void pcie_pme_disable_interrupt (struct pci_dev *port, +struct pcie_pme_service_data *data) +{ +spin_lock_irq (&data->lock); +pcie_pme_interrupt_enable (port, false); +pcie_clear_root_pme_status (port); + data->noirq = true; +spin_unlock_irq (&data->lock); +} +/** * pcie_pme_suspend - Suspend PCIe PME service device. * @srv: PCIe service device to suspend.
@@ -387,11 +397,7 @@ static int pcie_pme_suspend(struct pcie_device *srv)return 0 ; } -spin_lock_irq (&data->lock); -pcie_pme_interrupt_enable (port, false); -pcie_clear_root_pme_status (port); - data->noirq = true; -spin_unlock_irq (&data->lock); +pcie_pme_disable_interrupt (port, data);synchronize_irq (srv->irq);
@@ -427,9 +433,11 @@ static int pcie_pme_resume(struct pcie_device *srv)*/ static void pcie_pme_remove (struct pcie_device *srv) { -pcie_pme_suspend (srv); +struct pcie_pme_service_data *data =get_service_data (srv); + +pcie_pme_disable_interrupt (srv->port, data);free_irq (srv->irq, srv); -kfree (get_service_data (srv)); +kfree (data); }static struct pcie_port_service_driver pcie_pme_driver = {
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 59/246 wil6210: check null pointer in _wil_cfg80211_merge_extra_ies
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit de77a53c2d1e8fb3621e63e8e1f0f0c9a1a99ff7 ]
ies1 or ies2 might be null when code inside _wil_cfg80211_merge_extra_ies access them.
Add explicit check for null and make sure ies1/ies2 are not accessed in such a case.
spos might be null and be accessed inside _wil_cfg80211_merge_extra_ies.
Add explicit check for null in the while condition statement and make sure spos is not accessed in such a case.
--- drivers/net/wireless/ath/wil6210/cfg80211.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
drivers/net/wireless/ath/wil6210/cfg80211.c +11 -3
@@ -1580,6 +1580,12 @@ static int _wil_cfg80211_merge_extra_ies(const u8 *ies1, u16 ies1_len,u8 *buf, *dpos;const u8 *spos; +if (!ies1) + ies1_len =0 ; + +if (!ies2) + ies2_len =0 ; +if (ies1_len ==0 && ies2_len ==0 ) { *merged_ies =NULL ; *merged_len =0 ;
@@ -1589,17 +1595,19 @@ static int _wil_cfg80211_merge_extra_ies(const u8 *ies1, u16 ies1_len, buf =kmalloc (ies1_len + ies2_len,GFP_KERNEL );if (!buf)return -ENOMEM ; -memcpy (buf, ies1, ies1_len); +if (ies1) +memcpy (buf, ies1, ies1_len); dpos = buf + ies1_len; spos = ies2; -while (spos +1 < ies2 + ies2_len) { +while (spos && (spos +1 < ies2 + ies2_len)) {/* IE tag at offset 0, length at offset 1 */ u16 ielen =2 + spos[1 ];if (spos + ielen > ies2 + ies2_len)break ;if (spos[0 ] ==WLAN_EID_VENDOR_SPECIFIC && - !_wil_cfg80211_find_ie (ies1, ies1_len, spos, ielen)) { + (!ies1 || !_wil_cfg80211_find_ie (ies1, ies1_len, + spos, ielen))) {memcpy (dpos, spos, ielen); dpos += ielen; }
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 62/246 lockdep/lib/tests: Fix run_tests.sh
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit d93ac78bf7b37db36fa00225f8e9a14c7ed1b2ba ]
Apparently the execute bits were set for the tests/*.sh scripts on my test setup but these are not set in the kernel tree. Fix this by adding the interpreter path in front of the script paths.
--- tools/lib/lockdep/run_tests.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
tools/lib/lockdep/run_tests.sh +3 -3
@@ -11,7 +11,7 @@ find tests -name '*.c' | sort | while read -r i; do testname=$(basename "$i" .c) echo -ne "$testname... " if gcc -o "tests/$testname" -pthread "$i" liblockdep.a -Iinclude -D__USE_LIBLOCKDEP && - timeout 1 "tests/$testname" 2>&1 | "tests/${testname}.sh"; then + timeout 1 "tests/$testname" 2>&1 | /bin/bash "tests/${testname}.sh"; then echo "PASSED!" else echo "FAILED!"
@@ -24,7 +24,7 @@ find tests -name '*.c' | sort | while read -r i; do echo -ne "(PRELOAD) $testname... " if gcc -o "tests/$testname" -pthread -Iinclude "$i" && timeout 1 ./lockdep "tests/$testname" 2>&1 | - "tests/${testname}.sh"; then + /bin/bash "tests/${testname}.sh"; then echo "PASSED!" else echo "FAILED!"
@@ -37,7 +37,7 @@ find tests -name '*.c' | sort | while read -r i; do echo -ne "(PRELOAD + Valgrind) $testname... " if gcc -o "tests/$testname" -pthread -Iinclude "$i" && { timeout 10 valgrind --read-var-info=yes ./lockdep "./tests/$testname" >& "tests/${testname}.vg.out"; true; } && - "tests/${testname}.sh" < "tests/${testname}.vg.out" && + /bin/bash "tests/${testname}.sh" < "tests/${testname}.vg.out" && ! grep -Eq '(^==[0-9]*== (Invalid |Uninitialised ))|Mismatched free|Source and destination overlap| UME ' "tests/${testname}.vg.out"; then echo "PASSED!" else
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 46/246 cifs: Fix NULL pointer dereference of devname
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 68e2672f8fbd1e04982b8d2798dd318bf2515dd2 ]
There is a NULL pointer dereference of devname in strspn()
The oops looks something like:
CIFS: Attempting to mount (null)
BUG: unable to handle kernel NULL pointer dereference at 0000000000000000 ... RIP: 0010:strspn+0x0/0x50 ... Call Trace: ? cifs_parse_mount_options+0x222/0x1710 [cifs] ? cifs_get_volume_info+0x2f/0x80 [cifs] cifs_setup_volume_info+0x20/0x190 [cifs] cifs_get_volume_info+0x50/0x80 [cifs] cifs_smb3_do_mount+0x59/0x630 [cifs] ? ida_alloc_range+0x34b/0x3d0 cifs_do_mount+0x11/0x20 [cifs] mount_fs+0x52/0x170 vfs_kern_mount+0x6b/0x170 do_mount+0x216/0xdc0 ksys_mount+0x83/0xd0 __x64_sys_mount+0x25/0x30 do_syscall_64+0x65/0x220 entry_SYSCALL_64_after_hwframe+0x49/0xbe
Fix this by adding a NULL check on devname in cifs_parse_devname()
--- fs/cifs/connect.c | 5 +++++ 1 file changed, 5 insertions(+)
fs/cifs/connect.c +5 -0
@@ -1487,6 +1487,11 @@ cifs_parse_devname(const char *devname, struct smb_vol *vol)const char *delims ="/\\" ;size_t len; +if (unlikely (!devname || !*devname)) { +cifs_dbg (VFS ,"Device name not specified.\n" ); +return -EINVAL ; + } +/* make sure we have a valid UNC double delimiter prefix */ len =strspn (devname, delims);if (len !=2 )
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 47/246 fs: Make splice() and tee() take into account O_NONBLOCK flag on pipes
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit ee5e001196d1345b8fee25925ff5f1d67936081e ]
The current implementation of splice() and tee() ignores O_NONBLOCK set on pipe file descriptors and checks only the SPLICE_F_NONBLOCK flag for blocking on pipe arguments. This is inconsistent since splice()-ing from/to non-pipe file descriptors does take O_NONBLOCK into consideration.
Fix this by promoting O_NONBLOCK, when set on a pipe, to SPLICE_F_NONBLOCK.
Some context for how the current implementation of splice() leads to inconsistent behavior. In the ongoing work[1] to add VM tracing capability to trace-cmd we stream tracing data over named FIFOs or vsockets from guests back to the host.
When we receive SIGINT from user to stop tracing, we set O_NONBLOCK on the input file descriptor and set SPLICE_F_NONBLOCK for the next call to splice(). If splice() was blocked waiting on data from the input FIFO, after SIGINT splice() restarts with the same arguments (no SPLICE_F_NONBLOCK) and blocks again instead of returning -EAGAIN when no data is available.
This differs from the splice() behavior when reading from a vsocket or when we're doing a traditional read()/write() loop (trace-cmd's --nosplice argument).
With this patch applied we get the same behavior in all situations after setting O_NONBLOCK which also matches the behavior of doing a read()/write() loop instead of splice().
This change does have potential of breaking users who don't expect EAGAIN from splice() when SPLICE_F_NONBLOCK is not set. OTOH programs that set O_NONBLOCK and don't anticipate EAGAIN are arguably buggy[2].
[1] https://github.com/skaslev/trace-cmd/tree/vsock
[2] https://github.com/torvalds/linux/blob/d47e3da1759230e394096fd742aad423c291ba48/fs/read_write.c#L1425
--- fs/splice.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
fs/splice.c +12 -0
@@ -1123,6 +1123,9 @@ static long do_splice(struct file *in, loff_t __user *off_in,if (ipipe == opipe)return -EINVAL ; +if ((in->f_flags | out->f_flags) &O_NONBLOCK ) + flags |=SPLICE_F_NONBLOCK ; +return splice_pipe_to_pipe (ipipe, opipe, len, flags); }
@@ -1148,6 +1151,9 @@ static long do_splice(struct file *in, loff_t __user *off_in,if (unlikely (ret <0 ))return ret; +if (in->f_flags &O_NONBLOCK ) + flags |=SPLICE_F_NONBLOCK ; +file_start_write (out); ret =do_splice_from (ipipe, out, &offset, len, flags);file_end_write (out);
@@ -1172,6 +1178,9 @@ static long do_splice(struct file *in, loff_t __user *off_in, offset = in->f_pos; } +if (out->f_flags &O_NONBLOCK ) + flags |=SPLICE_F_NONBLOCK ; +pipe_lock (opipe); ret =wait_for_space (opipe, flags);if (!ret)
@@ -1721,6 +1730,9 @@ static long do_tee(struct file *in, struct file *out, size_t len,* copying the data. */ if (ipipe && opipe && ipipe != opipe) { +if ((in->f_flags | out->f_flags) &O_NONBLOCK ) + flags |=SPLICE_F_NONBLOCK ; +/* * Keep going, unless we encounter an error. The ipipe/opipe * ordering doesn't really matter.
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 48/246 perf beauty msg_flags: Add missing %s lost when adding prefix suppression logic
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit c3b81a500f35241a4c16febe0a015e572cf2c492 ]
When the prefix suppresion/enabling logic was added, I forgot to add an extra %, which ended up chopping off the strings:
Before:
# perf trace -e *mmsg --map-dump syscalls [299] = 1, [307] = 1, DNS Res~ver #3/14587 sendmmsg(106<socket:[3462393]>, 0x7f252b0fcaf0, 2, MSG_) = 2 chronyd/1053 recvmmsg(4, 0x558542ca5740, 4, MSG_, NULL) = 1 DNS Res~ver #2/14445 sendmmsg(106<socket:[3461475]>, 0x7f252ab09af0, 2, MSG_) = 2 DNS Res~ver #2/14444 sendmmsg(146<socket:[3457863]>, 0x7f2521a7aaf0, 2, MSG_) = 2 DNS Res~ver #2/14445 sendmmsg(106<socket:[3461475]>, 0x7f252ab09af0, 2, MSG_) = 2 DNS Res~ver #3/14587 sendmmsg(148<socket:[3460636]>, 0x7f252b0fcaf0, 2, MSG_) = 2 DNS Res~ver #2/14444 sendmmsg(146<socket:[3457863]>, 0x7f2521a7aaf0, 2, MSG_) = 2 ^C#
After:
# perf trace -e *mmsg --map-dump syscalls [299] = 1, [307] = 1, NetworkManager/17467 sendmmsg(22<socket:[3466493]>, 0x7f28927f9bb0, 2, MSG_NOSIGNAL) = 2 pool/17478 sendmmsg(10<socket:[3466523]>, 0x7f2769f95e90, 2, MSG_NOSIGNAL) = 2 DNS Res~ver #3/14587 sendmmsg(121<socket:[3466132]>, 0x7f252b0fcaf0, 2, MSG_NOSIGNAL) = 2 chronyd/1053 recvmmsg(4, 0x558542ca5740, 4, MSG_DONTWAIT, NULL) = 1 Socket Thread/17433 sendmmsg(121<socket:[3460903]>, 0x7f252668baf0, 2, MSG_NOSIGNAL) = 2 ^C#
--- tools/perf/trace/beauty/msg_flags.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/trace/beauty/msg_flags.c +1 -1
@@ -29,7 +29,7 @@ static size_t syscall_arg__scnprintf_msg_flags(char *bf, size_t size,return scnprintf (bf, size,"NONE" );#define P_MSG_FLAG (n) \ if (flags & MSG_##n) { \ - printed += scnprintf(bf + printed, size - printed, "%s%s", printed ? "|" : "", show_prefix ? prefix : "", #n); \ + printed += scnprintf(bf + printed, size - printed, "%s%s%s", printed ? "|" : "", show_prefix ? prefix : "", #n); \ flags &= ~MSG_##n; \ }
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 49/246 netfilter: nf_tables: check the result of dereferencing base_chain->stats
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit a9f5e78c403d2d62ade4f4c85040efc85f4049b8 ]
Check the result of dereferencing base_chain->stats, instead of result of this_cpu_ptr with NULL.
base_chain->stats maybe be changed to NULL when a chain is updated and a new NULL counter can be attached.
And we do not need to check returning of this_cpu_ptr since base_chain->stats is from percpu allocator if it is non-NULL, this_cpu_ptr returns a valid value.
And fix two sparse error by replacing rcu_access_pointer and rcu_dereference with READ_ONCE under rcu_read_lock.
Thanks for Eric's help to finish this patch.
--- net/netfilter/nf_tables_core.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
net/netfilter/nf_tables_core.c +8 -6
@@ -98,21 +98,23 @@ static noinline void nft_update_chain_stats(const struct nft_chain *chain, const struct nft_pktinfo *pkt) {struct nft_base_chain *base_chain; +struct nft_stats __percpu *pstats;struct nft_stats *stats; base_chain =nft_base_chain (chain); -if (!rcu_access_pointer (base_chain->stats)) -return ; -local_bh_disable (); - stats =this_cpu_ptr (rcu_dereference (base_chain->stats)); -if (stats) { +rcu_read_lock (); + pstats =READ_ONCE (base_chain->stats); +if (pstats) { +local_bh_disable (); + stats =this_cpu_ptr (pstats);u64_stats_update_begin (&stats->syncp); stats->pkts++; stats->bytes += pkt->skb->len;u64_stats_update_end (&stats->syncp); +local_bh_enable (); } -local_bh_enable (); +rcu_read_unlock (); }struct nft_jumpstack {
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 51/246 netfilter: conntrack: tcp: only close if RST matches exact sequence
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit be0502a3f2e94211a8809a09ecbc3a017189b8fb ]
TCP resets cause instant transition from established to closed state provided the reset is in-window. Endpoints that implement RFC 5961 require resets to match the next expected sequence number. RST segments that are in-window (but that do not match RCV.NXT) are ignored, and a "challenge ACK" is sent back.
Main problem for conntrack is that its a middlebox, i.e. whereas an end host might have ACK'd SEQ (and would thus accept an RST with this sequence number), conntrack might not have seen this ACK (yet).
Therefore we can't simply flag RSTs with non-exact match as invalid.
This updates RST processing as follows:
1. If the connection is in a state other than ESTABLISHED, nothing is changed, RST is subject to normal in-window check.
2. If the RSTs sequence number either matches exactly RCV.NXT, connection state moves to CLOSE.
3. The same applies if the RST sequence number aligns with a previous packet in the same direction.
In all other cases, the connection remains in ESTABLISHED state. If the normal-in-window check passes, the timeout will be lowered to that of CLOSE.
If the peer sends a challenge ack, connection timeout will be reset.
If the challenge ACK triggers another RST (RST was valid after all), this 2nd RST will match expected sequence and conntrack state changes to CLOSE.
If no challenge ACK is received, the connection will time out after CLOSE seconds (10 seconds by default), just like without this patch.
Packetdrill test case:
0.000 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3 0.000 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0 0.000 bind(3, ..., ...) = 0
0.000 listen(3, 1) = 0
0.100 < S 0:0(0) win 32792 <mss 1460,sackOK,nop,nop,nop,wscale 7> 0.100 > S. 0:0(0) ack 1 win 64240 <mss 1460,nop,nop,sackOK,nop,wscale 7> 0.200 < . 1:1(0) ack 1 win 257
0.200 accept(3, ..., ...) = 4
// Receive a segment.
0.210 < P. 1:1001(1000) ack 1 win 46
0.210 > . 1:1(0) ack 1001
// Application writes 1000 bytes.
0.250 write(4, ..., 1000) = 1000
0.250 > P. 1:1001(1000) ack 1001
// First reset, old sequence. Conntrack (correctly) considers this // invalid due to failed window validation (regardless of this patch). 0.260 < R 2:2(0) ack 1001 win 260
// 2nd reset, but too far ahead sequence. Same: correctly handled // as invalid.
0.270 < R 99990001:99990001(0) ack 1001 win 260
// in-window, but not exact sequence.
// Current Linux kernels might reply with a challenge ack, and do not // remove connection.
// Without this patch, conntrack state moves to CLOSE.
// With patch, timeout is lowered like CLOSE, but connection stays // in ESTABLISHED state.
0.280 < R 1010:1010(0) ack 1001 win 260
// Expect challenge ACK
0.281 > . 1001:1001(0) ack 1001 win 501
// With or without this patch, RST will cause connection // to move to CLOSE (sequence number matches) // 0.282 < R 1001:1001(0) ack 1001 win 260
// ACK
0.300 < . 1001:1001(0) ack 1001 win 257
// more data could be exchanged here, connection
// is still established
// Client closes the connection.
0.610 < F. 1001:1001(0) ack 1001 win 260
0.650 > . 1001:1001(0) ack 1002
// Close the connection without reading outstanding data 0.700 close(4) = 0
// so one more reset. Will be deemed acceptable with patch as well:
// connection is already closing.
0.701 > R. 1001:1001(0) ack 1002 win 501
// End packetdrill test case.
With patch, this generates following conntrack events:
[NEW] 120 SYN_SENT src=10.0.2.1 dst=10.0.0.1 sport=5437 dport=80 [UNREPLIED]
[UPDATE] 60 SYN_RECV src=10.0.2.1 dst=10.0.0.1 sport=5437 dport=80 [UPDATE] 432000 ESTABLISHED src=10.0.2.1 dst=10.0.0.1 sport=5437 dport=80 [ASSURED] [UPDATE] 120 FIN_WAIT src=10.0.2.1 dst=10.0.0.1 sport=5437 dport=80 [ASSURED] [UPDATE] 60 CLOSE_WAIT src=10.0.2.1 dst=10.0.0.1 sport=5437 dport=80 [ASSURED] [UPDATE] 10 CLOSE src=10.0.2.1 dst=10.0.0.1 sport=5437 dport=80 [ASSURED]
Without patch, first RST moves connection to close, whereas socket state does not change until FIN is received.
[NEW] 120 SYN_SENT src=10.0.2.1 dst=10.0.0.1 sport=5141 dport=80 [UNREPLIED]
[UPDATE] 60 SYN_RECV src=10.0.2.1 dst=10.0.0.1 sport=5141 dport=80 [UPDATE] 432000 ESTABLISHED src=10.0.2.1 dst=10.0.0.1 sport=5141 dport=80 [ASSURED] [UPDATE] 10 CLOSE src=10.0.2.1 dst=10.0.0.1 sport=5141 dport=80 [ASSURED]
--- net/netfilter/nf_conntrack_proto_tcp.c | 50 ++++++++++++++++++++------ 1 file changed, 40 insertions(+), 10 deletions(-)
net/netfilter/nf_conntrack_proto_tcp.c +40 -10
@@ -828,6 +828,12 @@ static noinline bool tcp_new(struct nf_conn *ct, const struct sk_buff *skb,return true; } +static bool nf_conntrack_tcp_established (const struct nf_conn *ct) +{ +return ct->proto.tcp.state ==TCP_CONNTRACK_ESTABLISHED && +test_bit (IPS_ASSURED_BIT , &ct->status); +} +/* Returns verdict for packet, or -1 for invalid. */ static int tcp_packet(struct nf_conn *ct, struct sk_buff *skb,
@@ -1030,16 +1036,38 @@ static int tcp_packet(struct nf_conn *ct, new_state =TCP_CONNTRACK_ESTABLISHED ;break ;case TCP_CONNTRACK_CLOSE : -if (index ==TCP_RST_SET - && (ct->proto.tcp.seen[!dir].flags &IP_CT_TCP_FLAG_MAXACK_SET ) - &&before (ntohl (th->seq), ct->proto.tcp.seen[!dir].td_maxack)) { -/* Invalid RST */ -spin_unlock_bh (&ct->lock); -nf_ct_l4proto_log_invalid (skb, ct,"invalid rst" ); -return -NF_ACCEPT ; +if (index !=TCP_RST_SET ) +break ; + +if (ct->proto.tcp.seen[!dir].flags &IP_CT_TCP_FLAG_MAXACK_SET ) { +u32 seq =ntohl (th->seq); + +if (before (seq, ct->proto.tcp.seen[!dir].td_maxack)) { +/* Invalid RST */ +spin_unlock_bh (&ct->lock); +nf_ct_l4proto_log_invalid (skb, ct,"invalid rst" ); +return -NF_ACCEPT ; + } + +if (!nf_conntrack_tcp_established (ct) || + seq == ct->proto.tcp.seen[!dir].td_maxack) +break ; + +/* Check if rst is part of train, such as +* foo:80 > bar:4379: P, 235946583:235946602(19) ack 42 +* foo:80 > bar:4379: R, 235946602:235946602(0) ack 42 +*/ +if (ct->proto.tcp.last_index ==TCP_ACK_SET && + ct->proto.tcp.last_dir == dir && + seq == ct->proto.tcp.last_end) +break ; + +/* ... RST sequence number doesn't match exactly, keep +* established state to allow a possible challenge ACK. +*/ + new_state = old_state; } -if (index ==TCP_RST_SET - && ((test_bit (IPS_SEEN_REPLY_BIT , &ct->status) +if (((test_bit (IPS_SEEN_REPLY_BIT , &ct->status) && ct->proto.tcp.last_index ==TCP_SYN_SET ) || (!test_bit (IPS_ASSURED_BIT , &ct->status) && ct->proto.tcp.last_index == TCP_ACK_SET))
@@ -1055,7 +1083,7 @@ static int tcp_packet(struct nf_conn *ct,* segments we ignored. */ goto in_window; } -/* Just fall through */ +break ;default :/* Keep compilers happy. */ break ;
@@ -1090,6 +1118,8 @@ static int tcp_packet(struct nf_conn *ct,if (ct->proto.tcp.retrans >= tn->tcp_max_retrans && timeouts[new_state] > timeouts[TCP_CONNTRACK_RETRANS ]) timeout = timeouts[TCP_CONNTRACK_RETRANS ]; +else if (unlikely (index ==TCP_RST_SET )) + timeout = timeouts[TCP_CONNTRACK_CLOSE ];else if ((ct->proto.tcp.seen[0 ].flags | ct->proto.tcp.seen[1 ].flags) &IP_CT_TCP_FLAG_DATA_UNACKNOWLEDGED && timeouts[new_state] > timeouts[TCP_CONNTRACK_UNACK ])
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 52/246 iommu/vt-d: Disable ATS support on untrusted devices
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit d8b8591054575f33237556c32762d54e30774d28 ]
Commit fb58fdcd295b9 ("iommu/vt-d: Do not enable ATS for untrusted devices") disables ATS support on the devices which have been marked as untrusted. Unfortunately this is not enough to fix the DMA attack vulnerabiltiies because IOMMU driver allows translated requests as long as a device advertises the ATS capability. Hence a malicious peripheral device could use this to bypass IOMMU.
This disables the ATS support on untrusted devices by clearing the internal per-device ATS mark. As the result, IOMMU driver will block any translated requests from any device marked as untrusted.
--- drivers/iommu/intel-iommu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/iommu/intel-iommu.c +2 -1
@@ -2485,7 +2485,8 @@ static struct dmar_domain *dmar_insert_one_dev_info(struct intel_iommu *iommu,if (dev &&dev_is_pci (dev)) {struct pci_dev *pdev =to_pci_dev (info->dev); -if (!pci_ats_disabled () && +if (!pdev->untrusted && + !pci_ats_disabled () &&ecap_dev_iotlb_support (iommu->ecap) &&pci_find_ext_capability (pdev,PCI_EXT_CAP_ID_ATS ) &&dmar_find_matched_atsr_unit (pdev))
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 53/246 jbd2: fix invalid descriptor block checksum
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 6e876c3dd205d30b0db6850e97a03d75457df007 ]
In jbd2_journal_commit_transaction(), if we are in abort mode, we may flush the buffer without setting descriptor block checksum by goto start_journal_io. Then fs is mounted, jbd2_descriptor_block_csum_verify() failed.
[ 271.379811] EXT4-fs (vdd): shut down requested (2) [ 271.381827] Aborting journal on device vdd-8. [ 271.597136] JBD2: Invalid checksum recovering block 22199 in log [ 271.598023] JBD2: recovery failed [ 271.598484] EXT4-fs (vdd): error loading journal
Fix this problem by keep setting descriptor block checksum if the descriptor buffer is not NULL.
This checksum problem can be reproduced by xfstests generic/388.
--- fs/jbd2/commit.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
fs/jbd2/commit.c +4 -2
@@ -694,9 +694,11 @@ void jbd2_journal_commit_transaction(journal_t *journal)the last tag we set up. */ tag->t_flags |=cpu_to_be16 (JBD2_FLAG_LAST_TAG ); - -jbd2_descriptor_block_csum_set (journal, descriptor); start_journal_io: +if (descriptor) +jbd2_descriptor_block_csum_set (journal, + descriptor); +for (i =0 ; i < bufs; i++) {struct buffer_head *bh = wbuf[i];/*
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 44/246 f2fs: fix to check inline_xattr_size boundary correctly
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 500e0b28ecd3c5aade98f3c3a339d18dcb166bb6 ]
We use below condition to check inline_xattr_size boundary:
if (!F2FS_OPTION(sbi).inline_xattr_size || F2FS_OPTION(sbi).inline_xattr_size >= DEF_ADDRS_PER_INODE - F2FS_TOTAL_EXTRA_ATTR_SIZE - DEF_INLINE_RESERVED_SIZE - DEF_MIN_INLINE_SIZE)
There is there problems in that check:
- we should allow inline_xattr_size equaling to min size of inline {data,dentry} area.
- F2FS_TOTAL_EXTRA_ATTR_SIZE and inline_xattr_size are based on different size unit, previous one is 4 bytes, latter one is 1 bytes.
- DEF_MIN_INLINE_SIZE only indicate min size of inline data area, however, we need to consider min size of inline dentry area as well, minimal inline dentry should at least contain two entries: '.' and '..', so that min inline_dentry size is 40 bytes.
.bitmap 1 * 1 = 1
.reserved 1 * 1 = 1
.dentry 11 * 2 = 22
.filename 8 * 2 = 16
total 40
--- fs/f2fs/f2fs.h | 1 - fs/f2fs/super.c | 13 +++++++------ include/linux/f2fs_fs.h | 13 +++++++------ 3 files changed, 14 insertions(+), 13 deletions(-)
fs/f2fs/f2fs.h +0 -1
@@ -456,7 +456,6 @@ struct f2fs_flush_device {/* for inline stuff */ #define DEF_INLINE_RESERVED_SIZE 1 -#define DEF_MIN_INLINE_SIZE 1static inline int get_extra_isize (struct inode *inode);static inline int get_inline_xattr_addrs (struct inode *inode);#define MAX_INLINE_DATA (inode) (sizeof(__le32) * \
fs/f2fs/super.c +7 -6
@@ -834,12 +834,13 @@ static int parse_options(struct super_block *sb, char *options) "set with inline_xattr option");return -EINVAL ; } -if (!F2FS_OPTION (sbi).inline_xattr_size || -F2FS_OPTION (sbi).inline_xattr_size >= -DEF_ADDRS_PER_INODE - -F2FS_TOTAL_EXTRA_ATTR_SIZE - -DEF_INLINE_RESERVED_SIZE - -DEF_MIN_INLINE_SIZE ) { +if (F2FS_OPTION (sbi).inline_xattr_size < +sizeof (struct f2fs_xattr_header ) /sizeof (__le32) || +F2FS_OPTION (sbi).inline_xattr_size > +DEF_ADDRS_PER_INODE - +F2FS_TOTAL_EXTRA_ATTR_SIZE /sizeof (__le32) - +DEF_INLINE_RESERVED_SIZE - +MIN_INLINE_DENTRY_SIZE /sizeof (__le32)) {f2fs_msg (sb,KERN_ERR ,"inline xattr size is out of range" );return -EINVAL ;
include/linux/f2fs_fs.h +7 -6
@@ -489,12 +489,12 @@ typedef __le32 f2fs_hash_t;/* * space utilization of regular dentry and inline dentry (w/o extra reservation) -* regular dentry inline dentry -* bitmap 1 * 27 = 27 1 * 23 = 23 -* reserved 1 * 3 = 3 1 * 7 = 7 -* dentry 11 * 214 = 2354 11 * 182 = 2002 -* filename 8 * 214 = 1712 8 * 182 = 1456 -* total 4096 3488 +* regular dentry inline dentry (def) inline dentry (min) +* bitmap 1 * 27 = 27 1 * 23 = 23 1 * 1 = 1 +* reserved 1 * 3 = 3 1 * 7 = 7 1 * 1 = 1 +* dentry 11 * 214 = 2354 11 * 182 = 2002 11 * 2 = 22 +* filename 8 * 214 = 1712 8 * 182 = 1456 8 * 2 = 16 +* total 4096 3488 40 * * Note: there are more reserved space in inline dentry than in regular * dentry, when converting inline dentry we should handle this carefully.
@@ -506,6 +506,7 @@ typedef __le32 f2fs_hash_t;#define SIZE_OF_RESERVED (PAGE_SIZE - ((SIZE_OF_DIR_ENTRY + \ F2FS_SLOT_LEN) * \ NR_DENTRY_IN_BLOCK + SIZE_OF_DENTRY_BITMAP)) +#define MIN_INLINE_DENTRY_SIZE 40/* just include '.' and '..' entries */ /* One directory entry slot representing F2FS_SLOT_LEN-sized file name */ struct f2fs_dir_entry {
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 64/246 crypto: cavium/zip - fix collision with generic cra_driver_name
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 41798036430015ad45137db2d4c213cd77fd0251 ]
The cavium/zip implementation of the deflate compression algorithm is incorrectly being registered under the generic driver name, which prevents the generic implementation from being registered with the crypto API when CONFIG_CRYPTO_DEV_CAVIUM_ZIP=y. Similarly the lzs algorithm (which does not currently have a generic implementation...) is incorrectly being registered as lzs-generic.
Fix the naming collision by adding a suffix "-cavium" to the cra_driver_name of the cavium/zip algorithms.
--- drivers/crypto/cavium/zip/zip_main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/crypto/cavium/zip/zip_main.c +4 -2
@@ -351,6 +351,7 @@ static struct pci_driver zip_driver = {static struct crypto_alg zip_comp_deflate = { .cra_name ="deflate" , + .cra_driver_name ="deflate-cavium" , .cra_flags =CRYPTO_ALG_TYPE_COMPRESS , .cra_ctxsize =sizeof (struct zip_kernel_ctx ), .cra_priority =300 ,
@@ -365,6 +366,7 @@ static struct crypto_alg zip_comp_deflate = {static struct crypto_alg zip_comp_lzs = { .cra_name ="lzs" , + .cra_driver_name ="lzs-cavium" , .cra_flags =CRYPTO_ALG_TYPE_COMPRESS , .cra_ctxsize =sizeof (struct zip_kernel_ctx ), .cra_priority =300 ,
@@ -384,7 +386,7 @@ static struct scomp_alg zip_scomp_deflate = { .decompress = zip_scomp_decompress, .base = { .cra_name = "deflate", - .cra_driver_name = "deflate-scomp", + .cra_driver_name = "deflate-scomp-cavium", .cra_module = THIS_MODULE, .cra_priority = 300, }
@@ -397,7 +399,7 @@ static struct scomp_alg zip_scomp_lzs = { .decompress = zip_scomp_decompress, .base = { .cra_name = "lzs", - .cra_driver_name = "lzs-scomp", + .cra_driver_name = "lzs-scomp-cavium", .cra_module = THIS_MODULE, .cra_priority = 300, }
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 74/246 powerpc/xmon: Fix opcode being uninitialized in print_insn_powerpc
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit e7140639b1de65bba435a6bd772d134901141f86 ]
When building with -Wsometimes-uninitialized, Clang warns:
arch/powerpc/xmon/ppc-dis.c:157:7: warning: variable 'opcode' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if (cpu_has_feature(CPU_FTRS_POWER9))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/powerpc/xmon/ppc-dis.c:167:7: note: uninitialized use occurs here
if (opcode == NULL)
^~~~~~
arch/powerpc/xmon/ppc-dis.c:157:3: note: remove the 'if' if its
condition is always true
if (cpu_has_feature(CPU_FTRS_POWER9))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/powerpc/xmon/ppc-dis.c:132:38: note: initialize the variable
'opcode' to silence this warning
const struct powerpc_opcode *opcode;
^
= NULL1 warning generated.
This warning seems to make no sense on the surface because opcode is set to NULL right below this statement. However, there is a comma instead of semicolon to end the dialect assignment, meaning that the opcode assignment only happens in the if statement. Properly terminate that line so that Clang no longer warns.
--- arch/powerpc/xmon/ppc-dis.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/xmon/ppc-dis.c +1 -1
@@ -158,7 +158,7 @@ int print_insn_powerpc (unsigned long insn, unsigned long memaddr) dialect |= (PPC_OPCODE_POWER5 |PPC_OPCODE_POWER6 |PPC_OPCODE_POWER7 |PPC_OPCODE_POWER8 |PPC_OPCODE_POWER9 |PPC_OPCODE_HTM |PPC_OPCODE_ALTIVEC |PPC_OPCODE_ALTIVEC2 - |PPC_OPCODE_VSX |PPC_OPCODE_VSX3 ), + |PPC_OPCODE_VSX |PPC_OPCODE_VSX3 );/* Get the major opcode of the insn. */ opcode =NULL ;
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 75/246 coresight: etm4x: Add support to enable ETMv4.2
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 5666dfd1d8a45a167f0d8b4ef47ea7f780b1f24a ]
SDM845 has ETMv4.2 and can use the existing etm4x driver. But the current etm driver checks only for ETMv4.0 and errors out for other etm4x versions. This patch adds this missing support to enable SoC's with ETMv4x to use same driver by checking only the ETM architecture major version number.
Without this change, we get below error during etm probe:
/ # dmesg | grep etm
[ 6.660093] coresight-etm4x: probe of 7040000.etm failed with error -22 [ 6.666902] coresight-etm4x: probe of 7140000.etm failed with error -22 [ 6.673708] coresight-etm4x: probe of 7240000.etm failed with error -22 [ 6.680511] coresight-etm4x: probe of 7340000.etm failed with error -22 [ 6.687313] coresight-etm4x: probe of 7440000.etm failed with error -22 [ 6.694113] coresight-etm4x: probe of 7540000.etm failed with error -22 [ 6.700914] coresight-etm4x: probe of 7640000.etm failed with error -22 [ 6.707717] coresight-etm4x: probe of 7740000.etm failed with error -22
With this change, etm probe is successful:
/ # dmesg | grep etm
[ 6.659198] coresight-etm4x 7040000.etm: CPU0: ETM v4.2 initialized [ 6.665848] coresight-etm4x 7140000.etm: CPU1: ETM v4.2 initialized [ 6.672493] coresight-etm4x 7240000.etm: CPU2: ETM v4.2 initialized [ 6.679129] coresight-etm4x 7340000.etm: CPU3: ETM v4.2 initialized [ 6.685770] coresight-etm4x 7440000.etm: CPU4: ETM v4.2 initialized [ 6.692403] coresight-etm4x 7540000.etm: CPU5: ETM v4.2 initialized [ 6.699024] coresight-etm4x 7640000.etm: CPU6: ETM v4.2 initialized [ 6.705646] coresight-etm4x 7740000.etm: CPU7: ETM v4.2 initialized
--- drivers/hwtracing/coresight/coresight-etm4x.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/hwtracing/coresight/coresight-etm4x.c +2 -1
@@ -55,7 +55,8 @@ static void etm4_os_unlock(struct etmv4_drvdata *drvdata)static bool etm4_arch_supported (u8 arch) { -switch (arch) { +/* Mask out the minor version number */ +switch (arch &0xf0 ) {case ETM_ARCH_V4 :break ;default :
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 77/246 ARM: 8840/1: use a raw_spinlock_t in unwind
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 74ffe79ae538283bbf7c155e62339f1e5c87b55a ]
Mostly unwind is done with irqs enabled however SLUB may call it with irqs disabled while creating a new SLUB cache.
I had system freeze while loading a module which called kmem_cache_create() on init. That means SLUB's __slab_alloc() disabled interrupts and then
->new_slab_objects()
->new_slab()
->setup_object()
->setup_object_debug()
->init_tracking()
->set_track()
->save_stack_trace()
->save_stack_trace_tsk()
->walk_stackframe()
->unwind_frame()
->unwind_find_idx()
=>spin_lock_irqsave(&unwind_lock);--- arch/arm/kernel/unwind.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
arch/arm/kernel/unwind.c +7 -7
@@ -93,7 +93,7 @@ extern const struct unwind_idx __start_unwind_idx[];static const struct unwind_idx *__origin_unwind_idx;extern const struct unwind_idx __stop_unwind_idx[]; -static DEFINE_SPINLOCK (unwind_lock); +static DEFINE_RAW_SPINLOCK (unwind_lock);static LIST_HEAD (unwind_tables);/* Convert a prel31 symbol to an absolute address */
@@ -201,7 +201,7 @@ static const struct unwind_idx *unwind_find_idx(unsigned long addr)/* module unwind tables */ struct unwind_table *table; -spin_lock_irqsave (&unwind_lock, flags); +raw_spin_lock_irqsave (&unwind_lock, flags);list_for_each_entry (table, &unwind_tables, list) {if (addr >= table->begin_addr && addr < table->end_addr) {
@@ -213,7 +213,7 @@ static const struct unwind_idx *unwind_find_idx(unsigned long addr)break ; } } -spin_unlock_irqrestore (&unwind_lock, flags); +raw_spin_unlock_irqrestore (&unwind_lock, flags); }pr_debug ("%s: idx = %p\n" , __func__, idx);
@@ -529,9 +529,9 @@ struct unwind_table *unwind_table_add(unsigned long start, unsigned long size, tab->begin_addr = text_addr; tab->end_addr = text_addr + text_size; -spin_lock_irqsave (&unwind_lock, flags); +raw_spin_lock_irqsave (&unwind_lock, flags);list_add_tail (&tab->list, &unwind_tables); -spin_unlock_irqrestore (&unwind_lock, flags); +raw_spin_unlock_irqrestore (&unwind_lock, flags);return tab; }
@@ -543,9 +543,9 @@ void unwind_table_del(struct unwind_table *tab)if (!tab)return ; -spin_lock_irqsave (&unwind_lock, flags); +raw_spin_lock_irqsave (&unwind_lock, flags);list_del (&tab->list); -spin_unlock_irqrestore (&unwind_lock, flags); +raw_spin_unlock_irqrestore (&unwind_lock, flags);kfree (tab); }
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 79/246 iommu/io-pgtable-arm-v7s: Only kmemleak_ignore L2 tables
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 032ebd8548c9d05e8d2bdc7a7ec2fe29454b0ad0 ]
L1 tables are allocated with __get_dma_pages, and therefore already ignored by kmemleak.
Without this, the kernel would print this error message on boot, when the first L1 table is allocated:
[ 2.810533] kmemleak: Trying to color unknown object at 0xffffffd652388000 as Black [ 2.818190] CPU: 5 PID: 39 Comm: kworker/5:0 Tainted: G S 4.19.16 #8 [ 2.831227] Workqueue: events deferred_probe_work_func [ 2.836353] Call trace: ... [ 2.852532] paint_ptr+0xa0/0xa8 [ 2.855750] kmemleak_ignore+0x38/0x6c [ 2.859490] __arm_v7s_alloc_table+0x168/0x1f4 [ 2.863922] arm_v7s_alloc_pgtable+0x114/0x17c [ 2.868354] alloc_io_pgtable_ops+0x3c/0x78
...
--- drivers/iommu/io-pgtable-arm-v7s.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/iommu/io-pgtable-arm-v7s.c +2 -1
@@ -228,7 +228,8 @@ static void *__arm_v7s_alloc_table(int lvl, gfp_t gfp,if (dma != phys) goto out_unmap; } -kmemleak_ignore (table); +if (lvl ==2 ) +kmemleak_ignore (table);return table; out_unmap:
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 65/246 tools/bpf: selftests: add map lookup to test_map_in_map bpf prog
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 9eca5083757b679b37f210092c871916c2c222d0 ]
The bpf_map_lookup_elem is added in the bpf program. Without previous patch, the test change will trigger the following error:
$ ./test_maps ... ; value_p = bpf_map_lookup_elem(map, &key); 20: (bf) r1 = r7 21: (bf) r2 = r8 22: (85) call bpf_map_lookup_elem#1 ; if (!value_p || *value_p != 123) 23: (15) if r0 == 0x0 goto pc+16 R0=map_value(id=2,off=0,ks=4,vs=4,imm=0) R6=inv1 R7=map_ptr(id=0,off=0,ks=4,vs=4,imm=0) R8=fp-8,call_-1 R10=fp0,call_-1 fp-8=mmmmmmmm ; if (!value_p || *value_p != 123) 24: (61) r1 = *(u32 *)(r0 +0) R0=map_value(id=2,off=0,ks=4,vs=4,imm=0) R6=inv1 R7=map_ptr(id=0,off=0,ks=4,vs=4,imm=0) R8=fp-8,call_-1 R10=fp0,call_-1 fp-8=mmmmmmmm bpf_spin_lock cannot be accessed directly by load/store
With the kernel fix in the previous commit, the error goes away.
--- tools/testing/selftests/bpf/test_map_in_map.c | 4 ++++ 1 file changed, 4 insertions(+)
tools/testing/selftests/bpf/test_map_in_map.c +4 -0
@@ -27,6 +27,7 @@ SEC("xdp_mimtest")int xdp_mimtest0 (struct xdp_md *ctx) {int value =123 ; +int *value_p;int key =0 ;void *map;
@@ -35,6 +36,9 @@ int xdp_mimtest0(struct xdp_md *ctx)return XDP_DROP ;bpf_map_update_elem (map, &key, &value,0 ); + value_p =bpf_map_lookup_elem (map, &key); +if (!value_p || *value_p !=123 ) +return XDP_DROP ; map =bpf_map_lookup_elem (&mim_hash, &key);if (!map)
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 66/246 usb: chipidea: Grab the (legacy) USB PHY by phandle first
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 68ef236274793066b9ba3154b16c0acc1c891e5c ]
According to the chipidea driver bindings, the USB PHY is specified via the "phys" phandle node. However, this only takes effect for USB PHYs that use the common PHY framework. For legacy USB PHYs, a simple lookup based on the USB PHY type is done instead.
This does not play out well when more than one USB PHY is registered, since the first registered PHY matching the type will always be returned regardless of what the driver was bound to.
Fix this by looking up the PHY based on the "phys" phandle node. Although generic PHYs are rather matched by their "phys-name" and not the "phys" phandle directly, there is no helper for similar lookup on legacy PHYs and it's probably not worth the effort to add it.
When no legacy USB PHY is found by phandle, fallback to grabbing any registered USB2 PHY. This ensures backward compatibility if some users were actually relying on this mechanism.
--- drivers/usb/chipidea/core.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/usb/chipidea/core.c +8 -1
@@ -954,8 +954,15 @@ static int ci_hdrc_probe(struct platform_device *pdev) }else if (ci->platdata->usb_phy) { ci->usb_phy = ci->platdata->usb_phy; }else { + ci->usb_phy =devm_usb_get_phy_by_phandle (dev->parent,"phys" , +0 ); ci->phy =devm_phy_get (dev->parent,"usb-phy" ); - ci->usb_phy =devm_usb_get_phy (dev->parent,USB_PHY_TYPE_USB2 ); + +/* Fallback to grabbing any registered USB2 PHY */ +if (IS_ERR (ci->usb_phy) && +PTR_ERR (ci->usb_phy) != -EPROBE_DEFER ) + ci->usb_phy =devm_usb_get_phy (dev->parent, +USB_PHY_TYPE_USB2 );/* if both generic PHY and USB PHY layers aren't enabled */ if (PTR_ERR(ci->phy) == -ENOSYS &&
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 67/246 powerpc/powernv/ioda: Fix locked_vm counting for memory used by IOMMU tables
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 11f5acce2fa43b015a8120fa7620fa4efd0a2952 ]
We store 2 multilevel tables in iommu_table - one for the hardware and one with the corresponding userspace addresses. Before allocating the tables, the iommu_table_group_ops::get_table_size() hook returns the combined size of the two and VFIO SPAPR TCE IOMMU driver adjusts the locked_vm counter correctly. When the table is actually allocated, the amount of allocated memory is stored in iommu_table::it_allocated_size and used to decrement the locked_vm counter when we release the memory used by the table; .get_table_size() and .create_table() calculate it independently but the result is expected to be the same.
However the allocator does not add the userspace table size to .it_allocated_size so when we destroy the table because of VFIO PCI unplug (i.e. VFIO container is gone but the userspace keeps running), we decrement locked_vm by just a half of size of memory we are releasing.
To make things worse, since we enabled on-demand allocation of indirect levels, it_allocated_size contains only the amount of memory actually allocated at the table creation time which can just be a fraction. It is not a problem with incrementing locked_vm (as get_table_size() value is used) but it is with decrementing.
As the result, we leak locked_vm and may not be able to allocate more IOMMU tables after few iterations of hotplug/unplug.
This sets it_allocated_size in the pnv_pci_ioda2_ops::create_table() hook to what pnv_pci_ioda2_get_table_size() returns so from now on we have a single place which calculates the maximum memory a table can occupy. The original meaning of it_allocated_size is somewhat lost now though.
We do not ditch it_allocated_size whatsoever here and we do not call get_table_size() from vfio_iommu_spapr_tce.c when decrementing locked_vm as we may have multiple IOMMU groups per container and even though they all are supposed to have the same get_table_size() implementation, there is a small chance for failure or confusion.
--- arch/powerpc/platforms/powernv/pci-ioda-tce.c | 1 - arch/powerpc/platforms/powernv/pci-ioda.c | 7 ++++++- 2 files changed, 6 insertions(+), 2 deletions(-)
arch/powerpc/platforms/powernv/pci-ioda-tce.c +0 -1
@@ -313,7 +313,6 @@ long pnv_pci_ioda2_table_alloc_pages(int nid, __u64 bus_offset, page_shift); tbl->it_level_size =1ULL << (level_shift -3 ); tbl->it_indirect_levels = levels -1 ; - tbl->it_allocated_size = total_allocated; tbl->it_userspace = uas; tbl->it_nid = nid;
arch/powerpc/platforms/powernv/pci-ioda.c +6 -1
@@ -2594,8 +2594,13 @@ static long pnv_pci_ioda2_create_table_userspace( int num, __u32 page_shift, __u64 window_size, __u32 levels, struct iommu_table **ptbl) { - return pnv_pci_ioda2_create_table(table_group, + long ret = pnv_pci_ioda2_create_table(table_group, num, page_shift, window_size, levels, true, ptbl); + +if (!ret) + (*ptbl)->it_allocated_size =pnv_pci_ioda2_get_table_size ( + page_shift, window_size, levels); +return ret; }static void pnv_ioda2_take_ownership (struct iommu_table_group *table_group)
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 69/246 kbuild: invoke syncconfig if include/config/auto.conf.cmd is missing
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 9390dff66a52d1a60c6e517d8fa6cdbdffc83cb1 ]
If include/config/auto.conf.cmd is lost for some reasons, it is not self-healing, so the top Makefile misses to run syncconfig. Move include/config/auto.conf.cmd to the target side.
I used a pattern rule instead of a normal rule here although it is a bit gross.
If the rule were written with a normal rule like this,
include/config/auto.conf \
include/config/auto.conf.cmd \
include/config/tristate.conf: $(KCONFIG_CONFIG)
$(Q)$(MAKE) -f $(srctree)/Makefile syncconfig... syncconfig would be executed per target.
Using a pattern rule makes sure that syncconfig is executed just once because Make assumes the recipe will create all of the targets.
Here is a quote from the GNU Make manual [1]:
"Pattern rules may have more than one target. Unlike normal rules, this does not act as many different rules with the same prerequisites and recipe. If a pattern rule has multiple targets, make knows that the rule's recipe is responsible for making all of the targets. The recipe is executed only once to make all the targets. When searching for a pattern rule to match a target, the target patterns of a rule other than the one that matches the target in need of a rule are
incidental: make worries only about giving a recipe and prerequisites to the file presently in question. However, when this file's recipe is run, the other targets are marked as having been updated themselves."
[1]: https://www.gnu.org/software/make/manual/html_node/Pattern-Intro.html
--- Makefile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
Makefile +5 -2
@@ -625,12 +625,15 @@ ifeq ($(may-sync-config),1) -include include/config/auto.conf.cmd # To avoid any implicit rule to kick in, define an empty command -$(KCONFIG_CONFIG) include/config/auto.conf.cmd: ; +$(KCONFIG_CONFIG): ; # The actual configuration files used during the build are stored in # include/generated/ and include/config/. Update them if .config is newer than # include/config/auto.conf (which mirrors .config). -include/config/%.conf: $(KCONFIG_CONFIG) include/config/auto.conf.cmd +# +# This exploits the 'multi-target pattern rule' trick. +# The syncconfig should be executed only once to make all the targets. +%/auto.conf %/auto.conf.cmd %/tristate.conf: $(KCONFIG_CONFIG) $(Q)$(MAKE) -f $(srctree)/Makefile syncconfig else # External modules and some install targets need include/generated/autoconf.h
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 70/246 kbuild: make -r/-R effective in top Makefile for old Make versions
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 3812b8c5c5d527239ac015f1f2c7654da7fcfbba ]
Adding -rR to MAKEFLAGS is important because we do not want to be bothered by built-in implicit rules or variables.
One problem that used to exist in older GNU Make versions is
MAKEFLAGS += -rR
... does not become effective in the current Makefile. When you are building with O= option, it becomes effective in the top Makefile since it recurses via 'sub-make' target. Otherwise, the top Makefile tries implicit rules. That is why we explicitly add empty rules for Makefiles, but we often miss to do that.
In fact, adding -d option to older GNU Make versions shows it is trying a bunch of implicit pattern rules.
Considering target file `scripts/Makefile.kcov'.
Looking for an implicit rule for scripts/Makefile.kcov'. Trying pattern rule with stem Makefile.kcov'. Trying implicit prerequisite scripts/Makefile.kcov.o'. Trying pattern rule with stem Makefile.kcov'. Trying implicit prerequisite scripts/Makefile.kcov.c'. Trying pattern rule with stem Makefile.kcov'. Trying implicit prerequisite scripts/Makefile.kcov.cc'. Trying pattern rule with stem Makefile.kcov'. Trying implicit prerequisite `scripts/Makefile.kcov.C'.
...
This issue was fixed by GNU Make commit 58dae243526b ("[Savannah #20501] Handle adding -r/-R to MAKEFLAGS in the makefile"). So, it is no longer a problem if you use GNU Make 4.0 or later. However, older versions are still widely used.
So, I decided to patch the kernel Makefile to invoke sub-make regardless of O= option. This will allow further cleanups.
--- Makefile | 48 ++++++++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 22 deletions(-)
Makefile +26 -22
@@ -15,19 +15,6 @@ NAME = Shy Crocodile PHONY := _all _all: -# Do not use make's built-in rules and variables -# (this increases performance and avoids hard-to-debug behaviour) -MAKEFLAGS += -rR - -# Avoid funny character set dependencies -unexport LC_ALL -LC_COLLATE=C -LC_NUMERIC=C -export LC_COLLATE LC_NUMERIC - -# Avoid interference with shell env settings -unexport GREP_OPTIONS - # We are using a recursive build, so we need to do a little thinking # to get the ordering right. #
@@ -44,6 +31,21 @@ unexport GREP_OPTIONS # descending is started. They are now explicitly listed as the # prepare rule. +ifneq ($(sub-make-done),1) + +# Do not use make's built-in rules and variables +# (this increases performance and avoids hard-to-debug behaviour) +MAKEFLAGS += -rR + +# Avoid funny character set dependencies +unexport LC_ALL +LC_COLLATE=C +LC_NUMERIC=C +export LC_COLLATE LC_NUMERIC + +# Avoid interference with shell env settings +unexport GREP_OPTIONS + # Beautify output # --------------------------------------------------------------------------- #
@@ -112,7 +114,6 @@ export quiet Q KBUILD_VERBOSE # KBUILD_SRC is not intended to be used by the regular user (for now), # it is set on invocation of make with KBUILD_OUTPUT or O= specified. -ifeq ($(KBUILD_SRC),) # OK, Make called in directory where kernel src resides # Do we want to locate output files in a separate directory?
@@ -142,6 +143,13 @@ $(if $(KBUILD_OUTPUT),, \ # 'sub-make' below. MAKEFLAGS += --include-dir=$(CURDIR) +else + +# Do not print "Entering directory ..." at all for in-tree build. +MAKEFLAGS += --no-print-directory + +endif # ifneq ($(KBUILD_OUTPUT),) + PHONY += $(MAKECMDGOALS) sub-make $(filter-out _all sub-make $(CURDIR)/Makefile, $(MAKECMDGOALS)) _all: sub-make
@@ -149,16 +157,12 @@ $(filter-out _all sub-make $(CURDIR)/Makefile, $(MAKECMDGOALS)) _all: sub-make # Invoke a second make in the output directory, passing relevant variables sub-make: - $(Q)$(MAKE) -C $(KBUILD_OUTPUT) KBUILD_SRC=$(CURDIR) \ + $(Q)$(MAKE) sub-make-done=1 \ + $(if $(KBUILD_OUTPUT),-C $(KBUILD_OUTPUT) KBUILD_SRC=$(CURDIR)) \ -f $(CURDIR)/Makefile $(filter-out _all sub-make,$(MAKECMDGOALS)) -# Leave processing to above invocation of make -skip-makefile := 1 -endif # ifneq ($(KBUILD_OUTPUT),) -endif # ifeq ($(KBUILD_SRC),) - +else # sub-make-done # We process the rest of the Makefile if this is the final invocation of make -ifeq ($(skip-makefile),) # Do not print "Entering directory ...", # but we want to display it when entering to the output directory
@@ -1759,7 +1763,7 @@ $(cmd_files): ; # Do not try to update included dependency files endif # ifeq ($(config-targets),1) endif # ifeq ($(mixed-targets),1) -endif # skip-makefile +endif # sub-make-done PHONY += FORCE FORCE:
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 71/246 btrfs: save drop_progress if we drop refs at all
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit aea6f028d01d629eda2e958ccd1133e805cda159 ]
Previously we only updated the drop_progress key if we were in the DROP_REFERENCE stage of snapshot deletion. This is because the UPDATE_BACKREF stage checks the flags of the blocks it's converting to FULL_BACKREF, so if we go over a block we processed before it doesn't matter, we just don't do anything.
The problem is in do_walk_down() we will go ahead and drop the roots reference to any blocks that we know we won't need to walk into.
Given subvolume A and snapshot B. The root of B points to all of the nodes that belong to A, so all of those nodes have a refcnt > 1. If B did not modify those blocks it'll hit this condition in do_walk_down
if (!wc->update_ref ||
generation <= root->root_key.offset) goto skip;
and in "goto skip" we simply do a btrfs_free_extent() for that bytenr that we point at.
Now assume we modified some data in B, and then took a snapshot of B and call it C. C points to all the nodes in B, making every node the root of B points to have a refcnt > 1. This assumes the root level is 2 or higher.
We delete snapshot B, which does the above work in do_walk_down, free'ing our ref for nodes we share with A that we didn't modify. Now we hit a node we _did_ modify, thus we own. We need to walk down into this node and we set wc->stage == UPDATE_BACKREF. We walk down to level 0 which we also own because we modified data. We can't walk any further down and thus now need to walk up and start the next part of the deletion. Now walk_up_proc is supposed to put us back into DROP_REFERENCE, but there's an exception to this
if (level < wc->shared_level)
goto out;
we are at level == 0, and our shared_level == 1. We skip out of this one and go up to level 1. Since path->slots[1] < nritems we path->slots[1]++ and break out of walk_up_tree to stop our transaction and loop back around. Now in btrfs_drop_snapshot we have this snippet
if (wc->stage == DROP_REFERENCE) {
level = wc->level;
btrfs_node_key(path->nodes[level],
&root_item->drop_progress,
path->slots[level]);
root_item->drop_level = level;
}our stage == UPDATE_BACKREF still, so we don't update the drop_progress key. This is a problem because we would have done btrfs_free_extent() for the nodes leading up to our current position. If we crash or unmount here and go to remount we'll start over where we were before and try to free our ref for blocks we've already freed, and thus abort() out.
Fix this by keeping track of the last place we dropped a reference for our block in do_walk_down. Then if wc->stage == UPDATE_BACKREF we know we'll start over from a place we meant to, and otherwise things continue to work as they did before.
I have a complicated reproducer for this problem, without this patch we'll fail to fsck the fs when replaying the log writes log. With this patch we can replay the whole log without any fsck or mount failures.
The steps to reproduce this easily are sort of tricky, I had to add a couple of debug patches to the kernel in order to make it easy, basically I just needed to make sure we did actually commit the transaction every time we finished a walk_down_tree/walk_up_tree combo.
The reproducer:
1) Creates a base subvolume.
2) Creates 100k files in the subvolume.
3) Snapshots the base subvolume (snap1).
4) Touches files 5000-6000 in snap1.
5) Snapshots snap1 (snap2).
6) Deletes snap1.
I do this with dm-log-writes, and then replay to every FUA in the log and fsck the fs.
--- fs/btrfs/extent-tree.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-)
fs/btrfs/extent-tree.c +20 -6
@@ -8690,6 +8690,8 @@ struct walk_control {u64 refs[BTRFS_MAX_LEVEL ];u64 flags[BTRFS_MAX_LEVEL ];struct btrfs_key update_progress; +struct btrfs_key drop_progress; +int drop_level;int stage;int level;int shared_level;
@@ -9028,6 +9030,16 @@ skip: ret); } } + +/* +* We need to update the next key in our walk control so we can +* update the drop_progress key accordingly. We don't care if +* find_next_key doesn't find a key because that means we're at +* the end and are going to clean up now. +*/ + wc->drop_level = level; +find_next_key (path, level, &wc->drop_progress); + ret =btrfs_free_extent (trans, root, bytenr, fs_info->nodesize, parent, root->root_key.objectid, level -1 ,0 );
@@ -9378,12 +9390,14 @@ int btrfs_drop_snapshot(struct btrfs_root *root, }if (wc->stage ==DROP_REFERENCE ) { - level = wc->level; -btrfs_node_key (path->nodes[level], - &root_item->drop_progress, - path->slots[level]); - root_item->drop_level = level; - } + wc->drop_level = wc->level; +btrfs_node_key_to_cpu (path->nodes[wc->drop_level], + &wc->drop_progress, + path->slots[wc->drop_level]); + } +btrfs_cpu_key_to_disk (&root_item->drop_progress, + &wc->drop_progress); + root_item->drop_level = wc->drop_level;BUG_ON (wc->level ==0 ); if (btrfs_should_end_transaction(trans) ||
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 72/246 drm/amd/display: Fix reference counting for struct dc_sink.
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit dcd5fb82ffb484124203aa339733663ac0b059f3 ]
Reference counting in amdgpu_dm_connector for amdgpu_dm_connector::dc_sink and amdgpu_dm_connector::dc_em_sink as well as in dc_link::local_sink seems to be out of shape. Thus make reference counting consistent for these members and just plain increment the reference count when the variable gets assigned and decrement when the pointer is set to zero or replaced. Also simplify reference counting in selected function sopes to be sure the reference is released in any case. In some cases add NULL pointer check before dereferencing.
At a hand full of places a comment is placed to stat that the reference increment happened already somewhere else.
This actually fixes the following kernel bug on my system when enabling display core in amdgpu. There are some more similar bug reports around, so it probably helps at more places.
kernel BUG at mm/slub.c:294!
invalid opcode: 0000 [#1] SMP PTI
CPU: 9 PID: 1180 Comm: Xorg Not tainted 5.0.0-rc1+ #2
Hardware name: Supermicro X10DAi/X10DAI, BIOS 3.0a 02/05/2018
RIP: 0010:__slab_free+0x1e2/0x3d0
Code: 8b 54 24 30 48 89 4c 24 28 e8 da fb ff ff 4c 8b 54 24 28 85 c0 0f 85 67 fe ff ff 48 8d 65 d8 5b 41 5c 41 5d 41 5e 41 5f 5d c3 <0f> 0b 49 3b 5c 24 28 75 ab 48 8b 44 24 30 49 89 4c 24 28 49 89 44
RSP: 0018:ffffb0978589fa90 EFLAGS: 00010246
RAX: ffff92f12806c400 RBX: 0000000080200019 RCX: ffff92f12806c400
RDX: ffff92f12806c400 RSI: ffffdd6421a01a00 RDI: ffff92ed2f406e80
RBP: ffffb0978589fb40 R08: 0000000000000001 R09: ffffffffc0ee4748
R10: ffff92f12806c400 R11: 0000000000000001 R12: ffffdd6421a01a00
R13: ffff92f12806c400 R14: ffff92ed2f406e80 R15: ffffdd6421a01a20
FS: 00007f4170be0ac0(0000) GS:ffff92ed2fb40000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000562818aaa000 CR3: 000000045745a002 CR4: 00000000003606e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
? drm_dbg+0x87/0x90 [drm]
dc_stream_release+0x28/0x50 [amdgpu]
amdgpu_dm_connector_mode_valid+0xb4/0x1f0 [amdgpu]
drm_helper_probe_single_connector_modes+0x492/0x6b0 [drm_kms_helper]
drm_mode_getconnector+0x457/0x490 [drm]
? drm_connector_property_set_ioctl+0x60/0x60 [drm]
drm_ioctl_kernel+0xa9/0xf0 [drm]
drm_ioctl+0x201/0x3a0 [drm]
? drm_connector_property_set_ioctl+0x60/0x60 [drm]
amdgpu_drm_ioctl+0x49/0x80 [amdgpu]
do_vfs_ioctl+0xa4/0x630
? __sys_recvmsg+0x83/0xa0
ksys_ioctl+0x60/0x90
__x64_sys_ioctl+0x16/0x20
do_syscall_64+0x5b/0x160
entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x7f417110809b
Code: 0f 1e fa 48 8b 05 ed bd 0c 00 64 c7 00 26 00 00 00 48 c7 c0 ff ff ff ff c3 66 0f 1f 44 00 00 f3 0f 1e fa b8 10 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d bd bd 0c 00 f7 d8 64 89 01 48
RSP: 002b:00007ffdd8d1c268 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 0000562818a8ebc0 RCX: 00007f417110809b
RDX: 00007ffdd8d1c2a0 RSI: 00000000c05064a7 RDI: 0000000000000012
RBP: 00007ffdd8d1c2a0 R08: 0000562819012280 R09: 0000000000000007
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000c05064a7
R13: 0000000000000012 R14: 0000000000000012 R15: 00007ffdd8d1c2a0
Modules linked in: nfsv4 dns_resolver nfs lockd grace fscache fuse vfat fat amdgpu intel_rapl sb_edac x86_pkg_temp_thermal intel_powerclamp coretemp kvm_intel kvm irqbypass crct10dif_pclmul chash gpu_sched crc32_pclmul snd_hda_codec_realtek ghash_clmulni_intel amd_iommu_v2 iTCO_wdt iTCO_vendor_support ttm snd_hda_codec_generic snd_hda_codec_hdmi ledtrig_audio snd_hda_intel drm_kms_helper snd_hda_codec intel_cstate snd_hda_core drm snd_hwdep snd_seq snd_seq_device intel_uncore snd_pcm intel_rapl_perf snd_timer snd soundcore ioatdma pcspkr intel_wmi_thunderbolt mxm_wmi i2c_i801 lpc_ich pcc_cpufreq auth_rpcgss sunrpc igb crc32c_intel i2c_algo_bit dca wmi hid_cherry analog gameport joydevThis patch is based on agd5f/drm-next-5.1-wip. This patch does not require all of that, but agd5f/drm-next-5.1-wip contains at least one more dc_sink counting fix that I could spot.
--- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 43 +++++++++++++++---- .../display/amdgpu_dm/amdgpu_dm_mst_types.c | 1 + drivers/gpu/drm/amd/display/dc/core/dc_link.c | 1 + 3 files changed, 37 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +35 -8
@@ -886,6 +886,7 @@ static void emulated_link_detect(struct dc_link *link)return ; } +/* dc_sink_create returns a new reference */ link->local_sink = sink; edid_status = dm_helpers_read_local_edid(
@@ -952,6 +953,8 @@ static int dm_resume(void *handle)if (aconnector->fake_enable && aconnector->dc_link->local_sink) aconnector->fake_enable = false; +if (aconnector->dc_sink) +dc_sink_release (aconnector->dc_sink); aconnector->dc_sink =NULL ;amdgpu_dm_update_connector_after_detect (aconnector);mutex_unlock (&aconnector->hpd_lock);
@@ -1061,6 +1064,8 @@ amdgpu_dm_update_connector_after_detect(struct amdgpu_dm_connector *aconnector) sink = aconnector->dc_link->local_sink; +if (sink) +dc_sink_retain (sink);/* * Edid mgmt connector gets first update only in mode_valid hook and then
@@ -1085,21 +1090,24 @@ amdgpu_dm_update_connector_after_detect(struct amdgpu_dm_connector *aconnector)* to it anymore after disconnect, so on next crtc to connector * reshuffle by UMD we will get into unwanted dc_sink release */ -if (aconnector->dc_sink != aconnector->dc_em_sink) -dc_sink_release (aconnector->dc_sink); +dc_sink_release (aconnector->dc_sink); } aconnector->dc_sink = sink; +dc_sink_retain (aconnector->dc_sink);amdgpu_dm_update_freesync_caps (connector, aconnector->edid); }else {amdgpu_dm_update_freesync_caps (connector,NULL ); -if (!aconnector->dc_sink) +if (!aconnector->dc_sink) { aconnector->dc_sink = aconnector->dc_em_sink; -else if (aconnector->dc_sink != aconnector->dc_em_sink)dc_sink_retain (aconnector->dc_sink); + } }mutex_unlock (&dev->mode_config.mutex); + +if (sink) +dc_sink_release (sink);return ; }
@@ -1107,8 +1115,10 @@ amdgpu_dm_update_connector_after_detect(struct amdgpu_dm_connector *aconnector)* TODO: temporary guard to look for proper fix * if this sink is MST sink, we should not do anything */ -if (sink && sink->sink_signal ==SIGNAL_TYPE_DISPLAY_PORT_MST ) +if (sink && sink->sink_signal ==SIGNAL_TYPE_DISPLAY_PORT_MST ) { +dc_sink_release (sink);return ; + }if (aconnector->dc_sink == sink) {/*
@@ -1117,6 +1127,8 @@ amdgpu_dm_update_connector_after_detect(struct amdgpu_dm_connector *aconnector)*/ DRM_DEBUG_DRIVER ("DCHPD: connector_id=%d: dc_sink didn't change.\n" , aconnector->connector_id); +if (sink) +dc_sink_release (sink);return ; }
@@ -1138,6 +1150,7 @@ amdgpu_dm_update_connector_after_detect(struct amdgpu_dm_connector *aconnector)amdgpu_dm_update_freesync_caps (connector,NULL ); aconnector->dc_sink = sink; +dc_sink_retain (aconnector->dc_sink);if (sink->dc_edid.length ==0 ) { aconnector->edid =NULL ;drm_dp_cec_unset_edid (&aconnector->dm_dp_aux.aux);
@@ -1158,11 +1171,15 @@ amdgpu_dm_update_connector_after_detect(struct amdgpu_dm_connector *aconnector)amdgpu_dm_update_freesync_caps (connector,NULL );drm_connector_update_edid_property (connector,NULL ); aconnector->num_modes =0 ; +dc_sink_release (aconnector->dc_sink); aconnector->dc_sink =NULL ; aconnector->edid =NULL ; }mutex_unlock (&dev->mode_config.mutex); + +if (sink) +dc_sink_release (sink); }static void handle_hpd_irq (void *param)
@@ -2908,6 +2925,7 @@ create_stream_for_sink(struct amdgpu_dm_connector *aconnector, } }else { sink = aconnector->dc_sink; +dc_sink_retain (sink); } stream =dc_create_stream_for_sink (sink);
@@ -2974,8 +2992,7 @@ create_stream_for_sink(struct amdgpu_dm_connector *aconnector, stream->ignore_msa_timing_param = true; finish: -if (sink && sink->sink_signal ==SIGNAL_TYPE_VIRTUAL && aconnector->base.force !=DRM_FORCE_ON ) -dc_sink_release (sink); +dc_sink_release (sink);return stream; }
@@ -3233,6 +3250,14 @@ static void amdgpu_dm_connector_destroy(struct drm_connector *connector) dm->backlight_dev = NULL; }#endif + +if (aconnector->dc_em_sink) +dc_sink_release (aconnector->dc_em_sink); + aconnector->dc_em_sink =NULL ; +if (aconnector->dc_sink) +dc_sink_release (aconnector->dc_sink); + aconnector->dc_sink =NULL ; +drm_dp_cec_unregister_connector (&aconnector->dm_dp_aux.aux);drm_connector_unregister (connector);drm_connector_cleanup (connector);
@@ -3330,10 +3355,12 @@ static void create_eml_sink(struct amdgpu_dm_connector *aconnector) (edid->extensions +1 ) *EDID_LENGTH , &init_params); -if (aconnector->base.force ==DRM_FORCE_ON ) +if (aconnector->base.force ==DRM_FORCE_ON ) { aconnector->dc_sink = aconnector->dc_link->local_sink ? aconnector->dc_link->local_sink : aconnector->dc_em_sink; +dc_sink_retain (aconnector->dc_sink); + } }static void handle_edid_mgmt (struct amdgpu_dm_connector *aconnector)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +1 -0
@@ -239,6 +239,7 @@ static int dm_dp_mst_get_modes(struct drm_connector *connector) &init_params); dc_sink->priv = aconnector; +/* dc_link_add_remote_sink returns a new reference */ aconnector->dc_sink = dc_sink;if (aconnector->dc_sink)
drivers/gpu/drm/amd/display/dc/core/dc_link.c +1 -0
@@ -792,6 +792,7 @@ bool dc_link_detect(struct dc_link *link, enum dc_detect_reason reason) sink->dongle_max_pix_clk = sink_caps.max_hdmi_pixel_clock; sink->converter_disable_audio = converter_disable_audio; +/* dc_sink_create returns a new reference */ link->local_sink = sink; edid_status = dm_helpers_read_local_edid(
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 81/246 net: dsa: mv88e6xxx: Default CMODE to 1000BaseX only on 6390X
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 65b034cf5c1766492aa107958149b440889480be ]
Commit 787799a9d555 sets the SERDES interfaces of 6390 and 6390X to 1000BaseX, but this is only needed on 6390X, since there are SERDES interfaces which can be used on lower ports on 6390.
This commit fixes this by returning to previous behaviour on 6390. (Previous behaviour means that CMODE is not set at all if requested mode is NA).
This is needed on Turris MOX, where the 88e6190 is connected to CPU in 2500BaseX mode.
--- drivers/net/dsa/mv88e6xxx/port.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/dsa/mv88e6xxx/port.c +2 -0
@@ -480,6 +480,8 @@ int mv88e6390_port_set_cmode(struct mv88e6xxx_chip *chip, int port, phy_interface_t mode) {switch (mode) { +case PHY_INTERFACE_MODE_NA : +return 0 ;case PHY_INTERFACE_MODE_XGMII :case PHY_INTERFACE_MODE_XAUI :case PHY_INTERFACE_MODE_RXAUI :
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 90/246 e1000e: Fix -Wformat-truncation warnings
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 135e7245479addc6b1f5d031e3d7e2ddb3d2b109 ]
Provide precision hints to snprintf() since we know the destination buffer size of the RX/TX ring names are IFNAMSIZ + 5 - 1. This fixes the following warnings:
drivers/net/ethernet/intel/e1000e/netdev.c: In function 'e1000_request_msix':drivers/net/ethernet/intel/e1000e/netdev.c:2109:13: warning: 'snprintf' output may be truncated before the last format character [-Wformat-truncation=]
"%s-rx-0", netdev->name);
^drivers/net/ethernet/intel/e1000e/netdev.c:2107:3: note: 'snprintf' output between 6 and 21 bytes into a destination of size 20
snprintf(adapter->rx_ring->name, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sizeof(adapter->rx_ring->name) - 1,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"%s-rx-0", netdev->name);
~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/intel/e1000e/netdev.c:2125:13: warning: 'snprintf'
output may be truncated before the last format character
[-Wformat-truncation=]
"%s-tx-0", netdev->name);
^drivers/net/ethernet/intel/e1000e/netdev.c:2123:3: note: 'snprintf' output between 6 and 21 bytes into a destination of size 20
snprintf(adapter->tx_ring->name, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sizeof(adapter->tx_ring->name) - 1,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"%s-tx-0", netdev->name);
~~~~~~~~~~~~~~~~~~~~~~~~--- drivers/net/ethernet/intel/e1000e/netdev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/e1000e/netdev.c +2 -2
@@ -2106,7 +2106,7 @@ static int e1000_request_msix(struct e1000_adapter *adapter)if (strlen (netdev->name) < (IFNAMSIZ -5 ))snprintf (adapter->rx_ring->name,sizeof (adapter->rx_ring->name) -1 , -"%s-rx-0" , netdev->name); +"%.14s-rx-0" , netdev->name);else memcpy (adapter->rx_ring->name, netdev->name,IFNAMSIZ ); err = request_irq(adapter->msix_entries[vector].vector,
@@ -2122,7 +2122,7 @@ static int e1000_request_msix(struct e1000_adapter *adapter)if (strlen (netdev->name) < (IFNAMSIZ -5 ))snprintf (adapter->tx_ring->name,sizeof (adapter->tx_ring->name) -1 , -"%s-tx-0" , netdev->name); +"%.14s-tx-0" , netdev->name);else memcpy (adapter->tx_ring->name, netdev->name,IFNAMSIZ ); err = request_irq(adapter->msix_entries[vector].vector,
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 91/246 mlxsw: spectrum: Avoid -Wformat-truncation warnings
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit ab2c4e2581ad32c28627235ff0ae8c5a5ea6899f ]
Give precision identifiers to the two snprintf() formatting the priority and TC strings to avoid producing these two warnings:
drivers/net/ethernet/mellanox/mlxsw/spectrum.c: In function 'mlxsw_sp_port_get_prio_strings':drivers/net/ethernet/mellanox/mlxsw/spectrum.c:2132:37: warning: '%d' directive output may be truncated writing between 1 and 3 bytes into a region of size between 0 and 31 [-Wformat-truncation=]
snprintf(*p, ETH_GSTRING_LEN, "%s_%d",
^~
drivers/net/ethernet/mellanox/mlxsw/spectrum.c:2132:3: note: 'snprintf' output between 3 and 36 bytes into a destination of size 32
snprintf(*p, ETH_GSTRING_LEN, "%s_%d", ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mlxsw_sp_port_hw_prio_stats[i].str, prio);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~drivers/net/ethernet/mellanox/mlxsw/spectrum.c: In function 'mlxsw_sp_port_get_tc_strings':drivers/net/ethernet/mellanox/mlxsw/spectrum.c:2143:37: warning: '%d' directive output may be truncated writing between 1 and 11 bytes into a region of size between 0 and 31 [-Wformat-truncation=]
snprintf(*p, ETH_GSTRING_LEN, "%s_%d",
^~
drivers/net/ethernet/mellanox/mlxsw/spectrum.c:2143:3: note: 'snprintf' output between 3 and 44 bytes into a destination of size 32
snprintf(*p, ETH_GSTRING_LEN, "%s_%d", ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mlxsw_sp_port_hw_tc_stats[i].str, tc);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--- drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlxsw/spectrum.c +2 -2
@@ -2105,7 +2105,7 @@ static void mlxsw_sp_port_get_prio_strings(u8 **p, int prio)int i;for (i =0 ; i <MLXSW_SP_PORT_HW_PRIO_STATS_LEN ; i++) { -snprintf (*p,ETH_GSTRING_LEN ,"%s_%d" , +snprintf (*p,ETH_GSTRING_LEN ,"%.29s_%.1d" , mlxsw_sp_port_hw_prio_stats[i].str, prio); *p +=ETH_GSTRING_LEN ; }
@@ -2116,7 +2116,7 @@ static void mlxsw_sp_port_get_tc_strings(u8 **p, int tc)int i;for (i =0 ; i <MLXSW_SP_PORT_HW_TC_STATS_LEN ; i++) { -snprintf (*p,ETH_GSTRING_LEN ,"%s_%d" , +snprintf (*p,ETH_GSTRING_LEN ,"%.29s_%.1d" , mlxsw_sp_port_hw_tc_stats[i].str, tc); *p +=ETH_GSTRING_LEN ; }
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 92/246 i2c: Allow recovery of the initial IRQ by an I2C client device.
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 93b6604c5a669d84e45fe5129294875bf82eb1ff ]
A previous change allowed I2C client devices to discover new IRQs upon reprobe by clearing the IRQ in i2c_device_remove. However, if an IRQ was assigned in i2c_new_device, that information is lost.
For example, the touchscreen and trackpad devices on a Dell Inspiron laptop are I2C devices whose IRQs are defined by ACPI extended IRQ types. The client device structures are initialized during an ACPI walk. After removing the i2c_hid device, modprobe fails.
This change caches the initial IRQ value in i2c_new_device and then resets the client device IRQ to the initial value in i2c_device_remove.
[wsa: this is an easy to backport fix for the regression. We will refactor the code to handle irq assignments better in general.]
--- drivers/i2c/i2c-core-base.c | 9 +++++---- include/linux/i2c.h | 1 + 2 files changed, 6 insertions(+), 4 deletions(-)
drivers/i2c/i2c-core-base.c +5 -4
@@ -430,7 +430,7 @@ static int i2c_device_remove(struct device *dev)dev_pm_clear_wake_irq (&client->dev);device_init_wakeup (&client->dev, false); - client->irq =0 ; + client->irq = client->init_irq;return status; }
@@ -741,10 +741,11 @@ i2c_new_device(struct i2c_adapter *adap, struct i2c_board_info const *info) client->flags = info->flags; client->addr = info->addr; - client->irq = info->irq; -if (!client->irq) - client->irq =i2c_dev_irq_from_resources (info->resources, + client->init_irq = info->irq; +if (!client->init_irq) + client->init_irq =i2c_dev_irq_from_resources (info->resources, info->num_resources); + client->irq = client->init_irq;strlcpy (client->name, info->type,sizeof (client->name));
include/linux/i2c.h +1 -0
@@ -333,6 +333,7 @@ struct i2c_client {char name[I2C_NAME_SIZE ];struct i2c_adapter *adapter;/* the adapter we sit on */ struct device dev;/* the device structure */ +int init_irq;/* irq set at initialization */ int irq;/* irq issued by device */ struct list_head detected;#if IS_ENABLED (CONFIG_I2C_SLAVE )
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 82/246 ice: fix ice_remove_rule_internal vsi_list handling
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit f9264dd687f8d3f9104c9900f8f3e5e419f27c55 ]
When adding multiple VLANs to the same VSI, the ice_add_vlan code will share the VSI list, so as not to create multiple unnecessary VSI lists.
Consider the following flow
ice_add_vlan(hw, <VSI 0 VID 7, VSI 0 VID 8, VSI 0 VID 9>)
Where we add three VLAN filters for VIDs 7, 8, and 9, all for VSI 0.
The ice_add_vlan will create a single vsi_list and share it among all the filters.
Later, if we try to remove a VLAN,
ice_remove_vlan(hw, <VSI 0 VID 7>)
Then the removal code will update the vsi_list and remove VSI 0 from it. But, since the vsi_list is shared, this breaks the list for the other users who reference it. We actually even free the VSI list memory, and may result in segmentation faults.
This is due to the way that VLAN rule share VSI lists with reference counts, and is caused because we call ice_rem_update_vsi_list even when the ref_cnt is greater than one.
To fix this, handle the case where ref_cnt is greater than one separately. In this case, we need to remove the associated rule without modifying the vsi_list, since it is currently being referenced by another rule. Instead, we just need to decrement the VSI list ref_cnt.
The case for handling sharing of VSI lists with multiple VSIs is not currently supported by this code. No such rules will be created today, and this code will require changes if/when such code is added.
--- drivers/net/ethernet/intel/ice/ice_switch.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/ice/ice_switch.c +13 -2
@@ -1538,9 +1538,20 @@ ice_remove_rule_internal(struct ice_hw *hw, u8 recp_id, }else if (!list_elem->vsi_list_info) { status =ICE_ERR_DOES_NOT_EXIST ; goto exit; + }else if (list_elem->vsi_list_info->ref_cnt >1 ) { +/* a ref_cnt > 1 indicates that the vsi_list is being +* shared by multiple rules. Decrement the ref_cnt and +* remove this rule, but do not modify the list, as it +* is in-use by other rules. +*/ + list_elem->vsi_list_info->ref_cnt--; + remove_rule = true; }else { -if (list_elem->vsi_list_info->ref_cnt >1 ) - list_elem->vsi_list_info->ref_cnt--; +/* a ref_cnt of 1 indicates the vsi_list is only used +* by one rule. However, the original removal request is only +* for a single VSI. Update the vsi_list first, and only +* remove the rule if there are no further VSIs in this list. +*/ vsi_handle = f_entry->fltr_info.vsi_handle; status =ice_rem_update_vsi_list (hw, vsi_handle, list_elem);if (status)
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 93/246 platform/x86: ideapad-laptop: Fix no_hw_rfkill_list for Lenovo RESCUER R720-15IKBN
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 4d9b2864a415fec39150bc13efc730c7eb88711e ]
Commit ae7c8cba3221 ("platform/x86: ideapad-laptop: add lenovo RESCUER R720-15IKBN to no_hw_rfkill_list") added
DMI_MATCH(DMI_BOARD_NAME, "80WW")
for Lenovo RESCUER R720-15IKBN.
But DMI_BOARD_NAME does not match 80WW on Lenovo RESCUER R720-15IKBN, thus cause Wireless LAN still be hard blocked.
On Lenovo RESCUER R720-15IKBN:
~$ cat /sys/class/dmi/id/sys_vendor
LENOVO
~$ cat /sys/class/dmi/id/board_name
Provence-5R3
~$ cat /sys/class/dmi/id/product_name
80WW
~$ cat /sys/class/dmi/id/product_version
Lenovo R720-15IKBN
So on Lenovo RESCUER R720-15IKBN:
DMI_SYS_VENDOR should match "LENOVO", DMI_BOARD_NAME should match "Provence-5R3", DMI_PRODUCT_NAME should match "80WW", DMI_PRODUCT_VERSION should match "Lenovo R720-15IKBN".
Fix it, and in according with other entries in no_hw_rfkill_list, use DMI_PRODUCT_VERSION instead of DMI_BOARD_NAME.
--- drivers/platform/x86/ideapad-laptop.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/x86/ideapad-laptop.c +1 -1
@@ -989,7 +989,7 @@ static const struct dmi_system_id no_hw_rfkill_list[] = { .ident = "Lenovo RESCUER R720-15IKBN", .matches = {DMI_MATCH (DMI_SYS_VENDOR ,"LENOVO" ), - DMI_MATCH(DMI_BOARD_NAME, "80WW"), + DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo R720-15IKBN"), }, }, {
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 83/246 perf script: Handle missing fields with -F +..
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 4b6ac811bce46c83811b83cdf87b41251596b9fc ]
When using -F + syntax to add a field the existing defaults are currently all marked user_set. This can cause errors when some field is missing in the perf.data
This patch tracks the actually user set fields separately, so that we don't error out in this case.
Before:
% perf record true
% perf script -F +metric
Samples for 'cycles:ppp' event do not have CPU attribute set. Cannot print 'cpu' field. %
After:
5 perf record true
% perf script -F +metric
perf 28936 278636.237688: 1 cycles:ppp: ffffffff8117da99 perf_event_exec+0x59 (/lib/modules/4.20.0-odilo/build/vmlinux)
...
%
--- tools/perf/builtin-script.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
tools/perf/builtin-script.c +7 -3
@@ -148,6 +148,7 @@ static struct {unsigned int print_ip_opts;u64 fields;u64 invalid_fields; +u64 user_set_fields; } output[OUTPUT_TYPE_MAX] = { [PERF_TYPE_HARDWARE] = {
@@ -344,7 +345,7 @@ static int perf_evsel__do_check_stype(struct perf_evsel *evsel,if (attr->sample_type & sample_type)return 0 ; -if (output[type].user_set) { +if (output[type].user_set_fields & field) {if (allow_user_set)return 0 ; evname =perf_evsel__name (evsel);
@@ -2627,10 +2628,13 @@ parse:pr_warning ("\'%s\' not valid for %s events. Ignoring.\n" , all_output_options[i].str,event_type (j)); }else { -if (change ==REMOVE ) +if (change ==REMOVE ) { output[j].fields &= ~all_output_options[i].field; -else + output[j].user_set_fields &= ~all_output_options[i].field; + }else { output[j].fields |= all_output_options[i].field; + output[j].user_set_fields |= all_output_options[i].field; + } output[j].user_set = true; output[j].wildcard_set = true; }
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 85/246 btrfs: dont enospc all tickets on flush failure
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit f91587e4151e84f798f37839dddd3e4152fb4c76 ]
With the introduction of the per-inode block_rsv it became possible to have really really large reservation requests made because of data fragmentation. Since the ticket stuff assumed that we'd always have relatively small reservation requests it just killed all tickets if we were unable to satisfy the current request.
However, this is generally not the case anymore. So fix this logic to instead see if we had a ticket that we were able to give some reservation to, and if we were continue the flushing loop again.
Likewise we make the tickets use the space_info_add_old_bytes() method of returning what reservation they did receive in hopes that it could satisfy reservations down the line.
--- fs/btrfs/extent-tree.c | 45 +++++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 20 deletions(-)
fs/btrfs/extent-tree.c +25 -20
@@ -4808,6 +4808,7 @@ skip_async: }struct reserve_ticket { +u64 orig_bytes;u64 bytes;int error;struct list_head list;
@@ -5030,7 +5031,7 @@ static inline int need_do_async_reclaim(struct btrfs_fs_info *fs_info, !test_bit(BTRFS_FS_STATE_REMOUNTING, &fs_info->fs_state)); } -static void wake_all_tickets (struct list_head *head) +static bool wake_all_tickets (struct list_head *head) {struct reserve_ticket *ticket;
@@ -5039,7 +5040,10 @@ static void wake_all_tickets(struct list_head *head)list_del_init (&ticket->list); ticket->error = -ENOSPC ;wake_up (&ticket->wait); +if (ticket->bytes != ticket->orig_bytes) +return true; } +return false; }/*
@@ -5094,8 +5098,12 @@ static void btrfs_async_reclaim_metadata_space(struct work_struct *work)if (flush_state >COMMIT_TRANS ) { commit_cycles++;if (commit_cycles >2 ) { -wake_all_tickets (&space_info->tickets); - space_info->flush =0 ; +if (wake_all_tickets (&space_info->tickets)) { + flush_state =FLUSH_DELAYED_ITEMS_NR ; + commit_cycles--; + }else { + space_info->flush =0 ; + } }else { flush_state =FLUSH_DELAYED_ITEMS_NR ; }
@@ -5147,10 +5155,11 @@ static void priority_reclaim_metadata_space(struct btrfs_fs_info *fs_info,static int wait_reserve_ticket (struct btrfs_fs_info *fs_info,struct btrfs_space_info *space_info, -struct reserve_ticket *ticket,u64 orig_bytes) +struct reserve_ticket *ticket) {DEFINE_WAIT (wait); +u64 reclaim_bytes =0 ;int ret =0 ;spin_lock (&space_info->lock);
@@ -5171,14 +5180,12 @@ static int wait_reserve_ticket(struct btrfs_fs_info *fs_info, ret = ticket->error;if (!list_empty (&ticket->list))list_del_init (&ticket->list); -if (ticket->bytes && ticket->bytes < orig_bytes) { -u64 num_bytes = orig_bytes - ticket->bytes; -update_bytes_may_use (space_info, -num_bytes); -trace_btrfs_space_reservation (fs_info,"space_info" , - space_info->flags, num_bytes,0 ); - } +if (ticket->bytes && ticket->bytes < ticket->orig_bytes) + reclaim_bytes = ticket->orig_bytes - ticket->bytes;spin_unlock (&space_info->lock); +if (reclaim_bytes) +space_info_add_old_bytes (fs_info, space_info, reclaim_bytes);return ret; }
@@ -5204,6 +5211,7 @@ static int __reserve_metadata_bytes(struct btrfs_fs_info *fs_info, {struct reserve_ticket ticket;u64 used; +u64 reclaim_bytes =0 ;int ret =0 ;ASSERT (orig_bytes);
@@ -5239,6 +5247,7 @@ static int __reserve_metadata_bytes(struct btrfs_fs_info *fs_info,* the list and we will do our own flushing further down. */ if (ret && flush !=BTRFS_RESERVE_NO_FLUSH ) { + ticket.orig_bytes = orig_bytes; ticket.bytes = orig_bytes; ticket.error =0 ;init_waitqueue_head (&ticket.wait);
@@ -5279,25 +5288,21 @@ static int __reserve_metadata_bytes(struct btrfs_fs_info *fs_info,return ret;if (flush ==BTRFS_RESERVE_FLUSH_ALL ) -return wait_reserve_ticket (fs_info, space_info, &ticket, - orig_bytes); +return wait_reserve_ticket (fs_info, space_info, &ticket); ret =0 ;priority_reclaim_metadata_space (fs_info, space_info, &ticket);spin_lock (&space_info->lock);if (ticket.bytes) { -if (ticket.bytes < orig_bytes) { -u64 num_bytes = orig_bytes - ticket.bytes; -update_bytes_may_use (space_info, -num_bytes); -trace_btrfs_space_reservation (fs_info,"space_info" , - space_info->flags, - num_bytes,0 ); - - } +if (ticket.bytes < orig_bytes) + reclaim_bytes = orig_bytes - ticket.bytes;list_del_init (&ticket.list); ret = -ENOSPC ; }spin_unlock (&space_info->lock); + +if (reclaim_bytes) +space_info_add_old_bytes (fs_info, space_info, reclaim_bytes);ASSERT (list_empty (&ticket.list));return ret; }
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 84/246 btrfs: qgroup: Make qgroup async transaction commit more aggressive
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit f5fef4593653dfa2a865c485bb81415de51d5c99 ]
[BUG]
Btrfs qgroup will still hit EDQUOT under the following case:
$ dev=/dev/test/test $ mnt=/mnt/btrfs $ umount $mnt &> /dev/null $ umount $dev &> /dev/null
$ mkfs.btrfs -f $dev $ mount $dev $mnt -o nospace_cache
$ btrfs subv create $mnt/subv $ btrfs quota enable $mnt $ btrfs quota rescan -w $mnt $ btrfs qgroup limit -e 1G $mnt/subv
$ fallocate -l 900M $mnt/subv/padding $ sync
$ rm $mnt/subv/padding
# Hit EDQUOT
$ xfs_io -f -c "pwrite 0 512M" $mnt/subv/real_file
[CAUSE]
Since commit a514d63882c3 ("btrfs: qgroup: Commit transaction in advance to reduce early EDQUOT"), btrfs is not forced to commit transaction to reclaim more quota space.
Instead, we just check pertrans metadata reservation against some threshold and try to do asynchronously transaction commit.
However in above case, the pertrans metadata reservation is pretty small thus it will never trigger asynchronous transaction commit.
[FIX]
Instead of only accounting pertrans metadata reservation, we calculate how much free space we have, and if there isn't much free space left, commit transaction asynchronously to try to free some space.
This may slow down the fs when we have less than 32M free qgroup space, but should reduce a lot of false EDQUOT, so the cost should be acceptable.
--- fs/btrfs/qgroup.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-)
fs/btrfs/qgroup.c +14 -14
@@ -2842,16 +2842,15 @@ out:/* * Two limits to commit transaction in advance. * -* For RATIO, it will be 1/RATIO of the remaining limit -* (excluding data and prealloc meta) as threshold. +* For RATIO, it will be 1/RATIO of the remaining limit as threshold. * For SIZE, it will be in byte unit as threshold. */ -#define QGROUP_PERTRANS_RATIO 32 -#define QGROUP_PERTRANS_SIZE SZ_32M +#define QGROUP_FREE_RATIO 32 +#define QGROUP_FREE_SIZE SZ_32Mstatic bool qgroup_check_limits (struct btrfs_fs_info *fs_info,const struct btrfs_qgroup *qg,u64 num_bytes) { -u64 limit; +u64 free;u64 threshold; if ((qg->lim_flags & BTRFS_QGROUP_LIMIT_MAX_RFER) &&
@@ -2870,20 +2869,21 @@ static bool qgroup_check_limits(struct btrfs_fs_info *fs_info,*/ if ((qg->lim_flags & (BTRFS_QGROUP_LIMIT_MAX_RFER |BTRFS_QGROUP_LIMIT_MAX_EXCL ))) { -if (qg->lim_flags &BTRFS_QGROUP_LIMIT_MAX_EXCL ) - limit = qg->max_excl; -else - limit = qg->max_rfer; - threshold = (limit - qg->rsv.values[BTRFS_QGROUP_RSV_DATA ] - - qg->rsv.values[BTRFS_QGROUP_RSV_META_PREALLOC ]) / -QGROUP_PERTRANS_RATIO ; - threshold =min_t (u64, threshold,QGROUP_PERTRANS_SIZE ); +if (qg->lim_flags &BTRFS_QGROUP_LIMIT_MAX_EXCL ) { + free = qg->max_excl -qgroup_rsv_total (qg) - qg->excl; + threshold =min_t (u64, qg->max_excl /QGROUP_FREE_RATIO , +QGROUP_FREE_SIZE ); + }else { + free = qg->max_rfer -qgroup_rsv_total (qg) - qg->rfer; + threshold =min_t (u64, qg->max_rfer /QGROUP_FREE_RATIO , +QGROUP_FREE_SIZE ); + }/* * Use transaction_kthread to commit transaction, so we no * longer need to bother nested transaction nor lock context. */ -if (qg->rsv.values[BTRFS_QGROUP_RSV_META_PERTRANS ] > threshold) +if (free < threshold)btrfs_commit_transaction_locksafe (fs_info); }
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 87/246 net: dsa: mv88e6xxx: Add lockdep classes to fix false positive splat
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit f6d9758b12660484b6639364cc406da92a918c96 ]
The following false positive lockdep splat has been observed.
======================================================
WARNING: possible circular locking dependency detected 4.20.0+ #302 Not tainted
------------------------------------------------------
systemd-udevd/160 is trying to acquire lock:edea6080 (&chip->reg_lock){+.+.}, at: __setup_irq+0x640/0x704
but task is already holding lock:edff0340 (&desc->request_mutex){+.+.}, at: __setup_irq+0xa0/0x704
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #1 (&desc->request_mutex){+.+.}:
mutex_lock_nested+0x1c/0x24
__setup_irq+0xa0/0x704
request_threaded_irq+0xd0/0x150
mv88e6xxx_probe+0x41c/0x694 [mv88e6xxx]
mdio_probe+0x2c/0x54
really_probe+0x200/0x2c4
driver_probe_device+0x5c/0x174
__driver_attach+0xd8/0xdc
bus_for_each_dev+0x58/0x7c
bus_add_driver+0xe4/0x1f0
driver_register+0x7c/0x110
mdio_driver_register+0x24/0x58
do_one_initcall+0x74/0x2e8
do_init_module+0x60/0x1d0
load_module+0x1968/0x1ff4
sys_finit_module+0x8c/0x98
ret_fast_syscall+0x0/0x28
0xbedf2ae8-> #0 (&chip->reg_lock){+.+.}:
__mutex_lock+0x50/0x8b8
mutex_lock_nested+0x1c/0x24
__setup_irq+0x640/0x704
request_threaded_irq+0xd0/0x150
mv88e6xxx_g2_irq_setup+0xcc/0x1b4 [mv88e6xxx]
mv88e6xxx_probe+0x44c/0x694 [mv88e6xxx]
mdio_probe+0x2c/0x54
really_probe+0x200/0x2c4
driver_probe_device+0x5c/0x174
__driver_attach+0xd8/0xdc
bus_for_each_dev+0x58/0x7c
bus_add_driver+0xe4/0x1f0
driver_register+0x7c/0x110
mdio_driver_register+0x24/0x58
do_one_initcall+0x74/0x2e8
do_init_module+0x60/0x1d0
load_module+0x1968/0x1ff4
sys_finit_module+0x8c/0x98
ret_fast_syscall+0x0/0x28
0xbedf2ae8other info that might help us debug this:
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(&desc->request_mutex);
lock(&chip->reg_lock);
lock(&desc->request_mutex); lock(&chip->reg_lock);
&desc->request_mutex refer to two different mutex. #1 is the GPIO for the chip interrupt. #2 is the chained interrupt between global 1 and global 2.
Add lockdep classes to the GPIO interrupt to avoid this.
--- drivers/net/dsa/mv88e6xxx/chip.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/net/dsa/mv88e6xxx/chip.c +8 -0
@@ -442,12 +442,20 @@ out_mapping:static int mv88e6xxx_g1_irq_setup (struct mv88e6xxx_chip *chip) { +static struct lock_class_key lock_key; +static struct lock_class_key request_key;int err; err =mv88e6xxx_g1_irq_setup_common (chip);if (err)return err; +/* These lock classes tells lockdep that global 1 irqs are in +* a different category than their parent GPIO, so it won't +* report false recursion. +*/ +irq_set_lockdep_class (chip->irq, &lock_key, &request_key); + err = request_threaded_irq(chip->irq, NULL, mv88e6xxx_g1_irq_thread_fn, IRQF_ONESHOT | IRQF_SHARED,
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 88/246 net: hns3: fix setting of the hns reset_type for rdma hw errors
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit eb4c2ccbad6c688be791e0c08640a40124558c03 ]
Presently the hns reset_type for the roce errors is set in the hclge_log_and_clear_rocee_ras_error function. This function is also called to detect and clear roce errors while enabling the rdma error interrupts. However there is no hns reset requested for this case. This can cause issue of wrong reset_type used with subsequent hns reset as the reset_type set in the above case was not cleared.
This patch moves setting of hns reset_type for the roce errors from hclge_log_and_clear_rocee_ras_error function
to hclge_handle_rocee_ras_error.
--- .../hisilicon/hns3/hns3pf/hclge_err.c | 36 ++++++++++--------- 1 file changed, 20 insertions(+), 16 deletions(-)
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c +20 -16
@@ -1094,10 +1094,10 @@ static int hclge_log_rocee_ovf_error(struct hclge_dev *hdev)return 0 ; } -static int hclge_log_and_clear_rocee_ras_error (struct hclge_dev *hdev) +static enum hnae3_reset_type +hclge_log_and_clear_rocee_ras_error (struct hclge_dev *hdev) { -enum hnae3_reset_type reset_type =HNAE3_FUNC_RESET ; -struct hnae3_ae_dev *ae_dev = hdev->ae_dev; +enum hnae3_reset_type reset_type =HNAE3_NONE_RESET ;struct device *dev = &hdev->pdev->dev;struct hclge_desc desc[2 ];unsigned int status;
@@ -1110,17 +1110,20 @@ static int hclge_log_and_clear_rocee_ras_error(struct hclge_dev *hdev)if (ret) {dev_err (dev,"failed(%d) to query ROCEE RAS INT SRC\n" , ret);/* reset everything for now */ -HCLGE_SET_DEFAULT_RESET_REQUEST (HNAE3_GLOBAL_RESET ); -return ret; +return HNAE3_GLOBAL_RESET ; } status =le32_to_cpu (desc[0 ].data[0 ]); -if (status &HCLGE_ROCEE_RERR_INT_MASK ) +if (status &HCLGE_ROCEE_RERR_INT_MASK ) {dev_warn (dev,"ROCEE RAS AXI rresp error\n" ); + reset_type =HNAE3_FUNC_RESET ; + } -if (status &HCLGE_ROCEE_BERR_INT_MASK ) +if (status &HCLGE_ROCEE_BERR_INT_MASK ) {dev_warn (dev,"ROCEE RAS AXI bresp error\n" ); + reset_type =HNAE3_FUNC_RESET ; + }if (status &HCLGE_ROCEE_ECC_INT_MASK ) {dev_warn (dev,"ROCEE RAS 2bit ECC error\n" );
@@ -1132,9 +1135,9 @@ static int hclge_log_and_clear_rocee_ras_error(struct hclge_dev *hdev)if (ret) {dev_err (dev,"failed(%d) to process ovf error\n" , ret);/* reset everything for now */ -HCLGE_SET_DEFAULT_RESET_REQUEST (HNAE3_GLOBAL_RESET ); -return ret; +return HNAE3_GLOBAL_RESET ; } + reset_type =HNAE3_FUNC_RESET ; }/* clear error status */
@@ -1143,12 +1146,10 @@ static int hclge_log_and_clear_rocee_ras_error(struct hclge_dev *hdev)if (ret) {dev_err (dev,"failed(%d) to clear ROCEE RAS error\n" , ret);/* reset everything for now */ - reset_type =HNAE3_GLOBAL_RESET ; +return HNAE3_GLOBAL_RESET ; } -HCLGE_SET_DEFAULT_RESET_REQUEST (reset_type); - -return ret; +return reset_type; }static int hclge_config_rocee_ras_interrupt (struct hclge_dev *hdev,bool en)
@@ -1178,15 +1179,18 @@ static int hclge_config_rocee_ras_interrupt(struct hclge_dev *hdev, bool en)return ret; } -static int hclge_handle_rocee_ras_error (struct hnae3_ae_dev *ae_dev) +static void hclge_handle_rocee_ras_error (struct hnae3_ae_dev *ae_dev) { +enum hnae3_reset_type reset_type =HNAE3_NONE_RESET ;struct hclge_dev *hdev = ae_dev->priv;if (test_bit (HCLGE_STATE_RST_HANDLING , &hdev->state) || hdev->pdev->revision <0x21 ) -return HNAE3_NONE_RESET ; +return ; -return hclge_log_and_clear_rocee_ras_error (hdev); + reset_type =hclge_log_and_clear_rocee_ras_error (hdev); +if (reset_type !=HNAE3_NONE_RESET ) +HCLGE_SET_DEFAULT_RESET_REQUEST (reset_type); }static const struct hclge_hw_blk hw_blk[] = {
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 80/246 powerpc/hugetlb: Handle mmap_min_addr correctly in get_unmapped_area callback
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 5330367fa300742a97e20e953b1f77f48392faae ]
After we ALIGN up the address we need to make sure we didn't overflow and resulted in zero address. In that case, we need to make sure that the returned address is greater than mmap_min_addr.
This fixes selftest va_128TBswitch --run-hugetlb reporting failures when run as non root user for
mmap(-1, MAP_HUGETLB)
The bug is that a non-root user requesting address -1 will be given address 0 which will then fail, whereas they should have been given something else that would have succeeded.
We also avoid the first mmap(-1, MAP_HUGETLB) returning NULL address as mmap address with this change. So we think this is not a security issue, because it only affects whether we choose an address below mmap_min_addr, not whether we actually allow that address to be mapped. ie. there are existing capability checks to prevent a user mapping below mmap_min_addr and those will still be honoured even without this fix.
--- arch/powerpc/mm/hugetlbpage-radix.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
arch/powerpc/mm/hugetlbpage-radix.c +3 -2
@@ -1,6 +1,7 @@// SPDX-License-Identifier: GPL-2.0 #include <linux/mm.h> #include <linux/hugetlb.h> +#include <linux/security.h> #include <asm/pgtable.h> #include <asm/pgalloc.h> #include <asm/cacheflush.h>
@@ -73,7 +74,7 @@ radix__hugetlb_get_unmapped_area(struct file *file, unsigned long addr,if (addr) { addr =ALIGN (addr,huge_page_size (h)); vma =find_vma (mm, addr); -if (high_limit - len >= addr && +if (high_limit - len >= addr && addr >= mmap_min_addr && (!vma || addr + len <=vm_start_gap (vma)))return addr; }
@@ -83,7 +84,7 @@ radix__hugetlb_get_unmapped_area(struct file *file, unsigned long addr,*/ info.flags =VM_UNMAPPED_AREA_TOPDOWN ; info.length = len; - info.low_limit =PAGE_SIZE ; + info.low_limit =max (PAGE_SIZE , mmap_min_addr); info.high_limit = mm->mmap_base + (high_limit -DEFAULT_MAP_WINDOW ); info.align_mask =PAGE_MASK & ~huge_page_mask (h); info.align_offset =0 ;
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 96/246 i2c: designware: Do not allow i2c_dw_xfer() calls while suspended
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 2751541555382dfa7661bcfaac3ee0fac49f505d ]
On most Intel Bay- and Cherry-Trail systems the PMIC is connected over I2C and the PMIC is accessed through various means by the _PS0 and _PS3 ACPI methods (power on / off methods) of various devices.
This leads to suspend/resume ordering problems where a device may be resumed and get its _PS0 method executed before the I2C controller is resumed. On Cherry Trail this leads to errors like these:
i2c_designware 808622C1:06: controller timed out
ACPI Error: AE_ERROR, Returned by Handler for [UserDefinedRegion] ACPI Error: Method parse/execution failed \_SB.P18W._ON, AE_ERROR video LNXVIDEO:00: Failed to change power state to D0
But on Bay Trail this caused I2C reads to seem to succeed, but they end up returning wrong data, which ends up getting written back by the typical read-modify-write cycle done to turn on various power-resources.
Debugging the problems caused by this silent data corruption is quite nasty. This commit adds a check which disallows i2c_dw_xfer() calls to happen until the controller's resume method has completed.
Which turns the silent data corruption into getting these errors in dmesg instead:
i2c_designware 80860F41:04: Error i2c_dw_xfer call while suspended ACPI Error: AE_ERROR, Returned by Handler for [UserDefinedRegion] ACPI Error: Method parse/execution failed \_SB.PCI0.GFX0._PS0, AE_ERROR
Which is much better.
Note the above errors are an example of issues which this patch will help to debug, the actual fix requires fixing the suspend order and this has been fixed by a different commit.
Note the setting / clearing of the suspended flag in the suspend / resume methods is NOT protected by i2c_lock_bus(). This is intentional as these methods get called from i2c_dw_xfer() (through pm_runtime_get/put) a nd i2c_dw_xfer() is called with the i2c_bus_lock held, so otherwise we would deadlock. This means that there is a theoretical race between a non runtime suspend and the suspended check in i2c_dw_xfer(), this is not a problem since normally we should not hit the race and this check is primarily a debugging tool so hitting the check if there are suspend/resume ordering problems does not need to be 100% reliable.
--- drivers/i2c/busses/i2c-designware-core.h | 2 ++ drivers/i2c/busses/i2c-designware-master.c | 6 ++++++ drivers/i2c/busses/i2c-designware-pcidrv.c | 7 ++++++- drivers/i2c/busses/i2c-designware-platdrv.c | 3 +++ 4 files changed, 17 insertions(+), 1 deletion(-)
drivers/i2c/busses/i2c-designware-core.h +2 -0
@@ -215,6 +215,7 @@* @disable_int: function to disable all interrupts * @init: function to initialize the I2C hardware * @mode: operation mode - DW_IC_MASTER or DW_IC_SLAVE +* @suspended: set to true if the controller is suspended * * HCNT and LCNT parameters can be used if the platform knows more accurate * values than the one computed based only on the input clock frequency.
@@ -270,6 +271,7 @@ struct dw_i2c_dev {int (*set_sda_hold_time)(struct dw_i2c_dev *dev);int mode;struct i2c_bus_recovery_info rinfo; +bool suspended; };#define ACCESS_SWAP 0x00000001
drivers/i2c/busses/i2c-designware-master.c +6 -0
@@ -426,6 +426,12 @@ i2c_dw_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num)pm_runtime_get_sync (dev->dev); +if (dev->suspended) { +dev_err (dev->dev,"Error %s call while suspended\n" , __func__); + ret = -ESHUTDOWN ; + goto done_nolock; + } +reinit_completion (&dev->cmd_complete); dev->msgs = msgs; dev->msgs_num = num;
drivers/i2c/busses/i2c-designware-pcidrv.c +6 -1
@@ -176,6 +176,7 @@ static int i2c_dw_pci_suspend(struct device *dev)struct pci_dev *pdev =to_pci_dev (dev);struct dw_i2c_dev *i_dev =pci_get_drvdata (pdev); + i_dev->suspended = true; i_dev->disable (i_dev);return 0 ;
@@ -185,8 +186,12 @@ static int i2c_dw_pci_resume(struct device *dev) {struct pci_dev *pdev =to_pci_dev (dev);struct dw_i2c_dev *i_dev =pci_get_drvdata (pdev); +int ret; -return i_dev->init (i_dev); + ret = i_dev->init (i_dev); + i_dev->suspended = false; + +return ret; }#endif
drivers/i2c/busses/i2c-designware-platdrv.c +3 -0
@@ -454,6 +454,8 @@ static int dw_i2c_plat_suspend(struct device *dev) {struct dw_i2c_dev *i_dev =dev_get_drvdata (dev); + i_dev->suspended = true; +if (i_dev->shared_with_punit)return 0 ;
@@ -471,6 +473,7 @@ static int dw_i2c_plat_resume(struct device *dev)i2c_dw_prepare_clk (i_dev, true); i_dev->init (i_dev); + i_dev->suspended = false;return 0 ; }
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 105/246 scsi: megaraid_sas: return error when create DMA pool failed
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit bcf3b67d16a4c8ffae0aa79de5853435e683945c ]
when create DMA pool for cmd frames failed, we should return -ENOMEM, instead of 0.
In some case in:
megasas_init_adapter_fusion()
-->megasas_alloc_cmds()
-->megasas_create_frame_pool
create DMA pool failed,
--> megasas_free_cmds() [1]
-->megasas_alloc_cmds_fusion()
failed, then goto fail_alloc_cmds.
-->megasas_free_cmds() [2]we will call megasas_free_cmds twice, [1] will kfree cmd_list,
[2] will use cmd_list.it will cause a problem:
Unable to handle kernel NULL pointer dereference at virtual address
00000000
pgd = ffffffc000f70000
[00000000] *pgd=0000001fbf893003, *pud=0000001fbf893003, *pmd=0000001fbf894003, *pte=006000006d000707
Internal error: Oops: 96000005 [#1] SMP Modules linked in: CPU: 18 PID: 1 Comm: swapper/0 Not tainted task: ffffffdfb9290000 ti: ffffffdfb923c000 task.ti: ffffffdfb923c000 PC is at megasas_free_cmds+0x30/0x70 LR is at megasas_free_cmds+0x24/0x70 ... Call trace: [<ffffffc0005b779c>] megasas_free_cmds+0x30/0x70 [<ffffffc0005bca74>] megasas_init_adapter_fusion+0x2f4/0x4d8 [<ffffffc0005b926c>] megasas_init_fw+0x2dc/0x760 [<ffffffc0005b9ab0>] megasas_probe_one+0x3c0/0xcd8 [<ffffffc0004a5abc>] local_pci_probe+0x4c/0xb4 [<ffffffc0004a5c40>] pci_device_probe+0x11c/0x14c [<ffffffc00053a5e4>] driver_probe_device+0x1ec/0x430 [<ffffffc00053a92c>] __driver_attach+0xa8/0xb0 [<ffffffc000538178>] bus_for_each_dev+0x74/0xc8 [<ffffffc000539e88>] driver_attach+0x28/0x34 [<ffffffc000539a18>] bus_add_driver+0x16c/0x248 [<ffffffc00053b234>] driver_register+0x6c/0x138 [<ffffffc0004a5350>] __pci_register_driver+0x5c/0x6c [<ffffffc000ce3868>] megasas_init+0xc0/0x1a8 [<ffffffc000082a58>] do_one_initcall+0xe8/0x1ec [<ffffffc000ca7be8>] kernel_init_freeable+0x1c8/0x284 [<ffffffc0008d90b8>] kernel_init+0x1c/0xe4
--- drivers/scsi/megaraid/megaraid_sas_base.c | 1 + 1 file changed, 1 insertion(+)
drivers/scsi/megaraid/megaraid_sas_base.c +1 -0
@@ -4188,6 +4188,7 @@ int megasas_alloc_cmds(struct megasas_instance *instance)if (megasas_create_frame_pool (instance)) {dev_printk (KERN_DEBUG , &instance->pdev->dev,"Error creating frame DMA pool\n" );megasas_free_cmds (instance); +return -ENOMEM ; }return 0 ;
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 106/246 scsi: fcoe: make use of fip_mode enum complete
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 8beb90aaf334a6efa3e924339926b5f93a234dbb ]
commit 1917d42d14b7 ("fcoe: use enum for fip_mode") introduces a separate enum for the fip_mode that shall be used during initialisation handling until it is passed to fcoe_ctrl_link_up to set the initial fip_state. That change was incomplete and gcc quietly converted in various places between the fip_mode and the fip_state enum values with implicit enum conversions, which fortunately cannot cause any issues in the actual code's execution.
clang however warns about these implicit enum conversions in the scsi drivers. This commit consolidates the use of the two enums, guided by clang's enum-conversion warnings.
This commit now completes the use of the fip_mode: It expects and uses fip_mode in {bnx2fc,fcoe}_interface_create and fcoe_ctlr_init, and it calls fcoe_ctrl_set_set() with the correct values in fcoe_ctlr_link_up(). It also breaks the association between FIP_MODE_AUTO and FIP_ST_AUTO to indicate these two enums are distinct.
--- drivers/scsi/bnx2fc/bnx2fc_fcoe.c | 2 +- drivers/scsi/fcoe/fcoe.c | 2 +- drivers/scsi/fcoe/fcoe_ctlr.c | 7 +++++-- drivers/scsi/fcoe/fcoe_transport.c | 2 +- drivers/scsi/qedf/qedf_main.c | 2 +- include/scsi/libfcoe.h | 4 ++-- 6 files changed, 11 insertions(+), 8 deletions(-)
drivers/scsi/bnx2fc/bnx2fc_fcoe.c +1 -1
@@ -1438,7 +1438,7 @@ bind_err:static struct bnx2fc_interface *bnx2fc_interface_create (struct bnx2fc_hba *hba,struct net_device *netdev, -enum fip_state fip_mode) +enum fip_mode fip_mode) {struct fcoe_ctlr_device *ctlr_dev;struct bnx2fc_interface *interface;
drivers/scsi/fcoe/fcoe.c +1 -1
@@ -389,7 +389,7 @@ static int fcoe_interface_setup(struct fcoe_interface *fcoe,* Returns: pointer to a struct fcoe_interface or NULL on error */ static struct fcoe_interface *fcoe_interface_create (struct net_device *netdev, -enum fip_state fip_mode) +enum fip_mode fip_mode) {struct fcoe_ctlr_device *ctlr_dev;struct fcoe_ctlr *ctlr;
drivers/scsi/fcoe/fcoe_ctlr.c +5 -2
@@ -147,7 +147,7 @@ static void fcoe_ctlr_map_dest(struct fcoe_ctlr *fip)* fcoe_ctlr_init() - Initialize the FCoE Controller instance * @fip: The FCoE controller to initialize */ -void fcoe_ctlr_init (struct fcoe_ctlr *fip,enum fip_state mode) +void fcoe_ctlr_init (struct fcoe_ctlr *fip,enum fip_mode mode) {fcoe_ctlr_set_state (fip,FIP_ST_LINK_WAIT ); fip->mode = mode;
@@ -454,7 +454,10 @@ void fcoe_ctlr_link_up(struct fcoe_ctlr *fip)mutex_unlock (&fip->ctlr_mutex);fc_linkup (fip->lp); }else if (fip->state ==FIP_ST_LINK_WAIT ) { -fcoe_ctlr_set_state (fip, fip->mode); +if (fip->mode ==FIP_MODE_NON_FIP ) +fcoe_ctlr_set_state (fip,FIP_ST_NON_FIP ); +else +fcoe_ctlr_set_state (fip,FIP_ST_AUTO );switch (fip->mode) {default :LIBFCOE_FIP_DBG (fip,"invalid mode %d\n" , fip->mode);
drivers/scsi/fcoe/fcoe_transport.c +1 -1
@@ -873,7 +873,7 @@ static int fcoe_transport_create(const char *buffer,int rc = -ENODEV ;struct net_device *netdev =NULL ;struct fcoe_transport *ft =NULL ; -enum fip_state fip_mode = (enum fip_state )(long )kp->arg; +enum fip_mode fip_mode = (enum fip_mode )kp->arg;mutex_lock (&ft_mutex);
drivers/scsi/qedf/qedf_main.c +1 -1
@@ -1418,7 +1418,7 @@ static struct libfc_function_template qedf_lport_template = {static void qedf_fcoe_ctlr_setup (struct qedf_ctx *qedf) { -fcoe_ctlr_init (&qedf->ctlr,FIP_ST_AUTO ); +fcoe_ctlr_init (&qedf->ctlr,FIP_MODE_AUTO ); qedf->ctlr.send = qedf_fip_send; qedf->ctlr.get_src_addr = qedf_get_src_mac;
include/scsi/libfcoe.h +2 -2
@@ -79,7 +79,7 @@ enum fip_state {* It must not change after fcoe_ctlr_init() sets it. */ enum fip_mode { -FIP_MODE_AUTO =FIP_ST_AUTO , +FIP_MODE_AUTO ,FIP_MODE_NON_FIP ,FIP_MODE_FABRIC ,FIP_MODE_VN2VN ,
@@ -250,7 +250,7 @@ struct fcoe_rport { };/* FIP API functions */ -void fcoe_ctlr_init (struct fcoe_ctlr *,enum fip_state ); +void fcoe_ctlr_init (struct fcoe_ctlr *,enum fip_mode );void fcoe_ctlr_destroy (struct fcoe_ctlr *);void fcoe_ctlr_link_up (struct fcoe_ctlr *);int fcoe_ctlr_link_down (struct fcoe_ctlr *);
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 108/246 perf test: Fix failure of evsel-tp-sched test on s390
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 03d309711d687460d1345de8a0363f45b1c8cd11 ]
Commit 489338a717a0 ("perf tests evsel-tp-sched: Fix bitwise operator") causes test case 14 "Parse sched tracepoints fields" to fail on s390.
This test succeeds on x86.
In fact this test now fails on all architectures with type char treated as type unsigned char.
The root cause is the signed-ness of character arrays in the tracepoints sched_switch for structure members prev_comm and next_comm.
On s390 the output of:
[root@m35lp76 perf]# cat /sys/kernel/debug/tracing/events/sched/sched_switch/format
name: sched_switch
ID: 287
format:
field:unsigned short common_type; offset:0; size:2; signed:0;
...
field:char prev_comm[16]; offset:8; size:16; signed:0;
...
field:char next_comm[16]; offset:40; size:16; signed:0;
reveals the character arrays prev_comm and next_comm are per default unsigned char and have values in the range of 0..255.
On x86 both fields are signed as this output shows:
[root@f29]# cat /sys/kernel/debug/tracing/events/sched/sched_switch/format name: sched_switch ID: 287 format: field:unsigned short common_type; offset:0; size:2; signed:0; ... field:char prev_comm[16]; offset:8; size:16; signed:1; ... field:char next_comm[16]; offset:40; size:16; signed:1;
and the character arrays prev_comm and next_comm are per default signed char and have values in the range of -1..127. The implementation of type char is architecture specific.
Since the character arrays in both tracepoints sched_switch and sched_wakeup should contain ascii characters, simply omit the check for signedness in the test case.
Output before:
[root@m35lp76 perf]# ./perf test -F 14
14: Parse sched tracepoints fields :
--- start ---
sched:sched_switch: "prev_comm" signedness(0) is wrong, should be 1 sched:sched_switch: "next_comm" signedness(0) is wrong, should be 1 sched:sched_wakeup: "comm" signedness(0) is wrong, should be 1 ---- end ----
14: Parse sched tracepoints fields : FAILED!
[root@m35lp76 perf]#
Output after:
[root@m35lp76 perf]# ./perf test -Fv 14
14: Parse sched tracepoints fields :
--- start ---
---- end ----
Parse sched tracepoints fields: Ok
[root@m35lp76 perf]#
--- tools/perf/tests/evsel-tp-sched.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
tools/perf/tests/evsel-tp-sched.c +3 -3
@@ -43,7 +43,7 @@ int test__perf_evsel__tp_sched_test(struct test *test __maybe_unused, int subtesreturn -1 ; } -if (perf_evsel__test_field (evsel,"prev_comm" ,16 , true)) +if (perf_evsel__test_field (evsel,"prev_comm" ,16 , false)) ret =-1 ;if (perf_evsel__test_field (evsel,"prev_pid" ,4 , true))
@@ -55,7 +55,7 @@ int test__perf_evsel__tp_sched_test(struct test *test __maybe_unused, int subtesif (perf_evsel__test_field (evsel,"prev_state" ,sizeof (long ), true)) ret =-1 ; -if (perf_evsel__test_field (evsel,"next_comm" ,16 , true)) +if (perf_evsel__test_field (evsel,"next_comm" ,16 , false)) ret =-1 ;if (perf_evsel__test_field (evsel,"next_pid" ,4 , true))
@@ -73,7 +73,7 @@ int test__perf_evsel__tp_sched_test(struct test *test __maybe_unused, int subtesreturn -1 ; } -if (perf_evsel__test_field (evsel,"comm" ,16 , true)) +if (perf_evsel__test_field (evsel,"comm" ,16 , false)) ret =-1 ;if (perf_evsel__test_field (evsel,"pid" ,4 , true))
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 109/246 mwifiex: dont advertise IBSS features without FW support
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 6f21ab30469d670de620f758330aca9f3433f693 ]
As it is, doing something like
# iw phy phy0 interface add foobar type ibss
on a firmware that doesn't have ad-hoc support just yields failures of HostCmd_CMD_SET_BSS_MODE, which happened to return a '-1' error code (-EPERM? not really right...) and sometimes may even crash the firmware along the way.
Let's parse the firmware capability flag while registering the wiphy, so we don't allow attempting IBSS at all, and we get a proper -EOPNOTSUPP from nl80211 instead.
--- drivers/net/wireless/marvell/mwifiex/cfg80211.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/net/wireless/marvell/mwifiex/cfg80211.c +7 -3
@@ -4310,11 +4310,13 @@ int mwifiex_register_cfg80211(struct mwifiex_adapter *adapter) wiphy->mgmt_stypes = mwifiex_mgmt_stypes; wiphy->max_remain_on_channel_duration =5000 ; wiphy->interface_modes =BIT (NL80211_IFTYPE_STATION ) | -BIT (NL80211_IFTYPE_ADHOC ) |BIT (NL80211_IFTYPE_P2P_CLIENT ) |BIT (NL80211_IFTYPE_P2P_GO ) |BIT (NL80211_IFTYPE_AP ); +if (ISSUPP_ADHOC_ENABLED (adapter->fw_cap_info)) + wiphy->interface_modes |=BIT (NL80211_IFTYPE_ADHOC ); + wiphy->bands[NL80211_BAND_2GHZ ] = &mwifiex_band_2ghz;if (adapter->config_bands &BAND_A ) wiphy->bands[NL80211_BAND_5GHZ ] = &mwifiex_band_5ghz;
@@ -4374,11 +4376,13 @@ int mwifiex_register_cfg80211(struct mwifiex_adapter *adapter) wiphy->available_antennas_tx =BIT (adapter->number_of_antenna) -1 ; wiphy->available_antennas_rx =BIT (adapter->number_of_antenna) -1 ; - wiphy->features |=NL80211_FEATURE_HT_IBSS | -NL80211_FEATURE_INACTIVITY_TIMER | + wiphy->features |=NL80211_FEATURE_INACTIVITY_TIMER |NL80211_FEATURE_LOW_PRIORITY_SCAN |NL80211_FEATURE_NEED_OBSS_SCAN ; +if (ISSUPP_ADHOC_ENABLED (adapter->fw_cap_info)) + wiphy->features |=NL80211_FEATURE_HT_IBSS ; +if (ISSUPP_RANDOM_MAC (adapter->fw_cap_info)) wiphy->features |=NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR | NL80211_FEATURE_SCHED_SCAN_RANDOM_MAC_ADDR |
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 97/246 IB/mlx4: Increase the timeout for CM cache
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 2612d723aadcf8281f9bf8305657129bd9f3cd57 ]
Using CX-3 virtual functions, either from a bare-metal machine or pass-through from a VM, MAD packets are proxied through the PF driver.
Since the VF drivers have separate name spaces for MAD Transaction Ids (TIDs), the PF driver has to re-map the TIDs and keep the book keeping in a cache.
Following the RDMA Connection Manager (CM) protocol, it is clear when an entry has to evicted form the cache. But life is not perfect, remote peers may die or be rebooted. Hence, it's a timeout to wipe out a cache entry, when the PF driver assumes the remote peer has gone.
During workloads where a high number of QPs are destroyed concurrently, excessive amount of CM DREQ retries has been observed
The problem can be demonstrated in a bare-metal environment, where two nodes have instantiated 8 VFs each. This using dual ported HCAs, so we have 16 vPorts per physical server.
64 processes are associated with each vPort and creates and destroys one QP for each of the remote 64 processes. That is, 1024 QPs per vPort, all in all 16K QPs. The QPs are created/destroyed using the CM.
When tearing down these 16K QPs, excessive CM DREQ retries (and duplicates) are observed. With some cat/paste/awk wizardry on the infiniband_cm sysfs, we observe as sum of the 16 vPorts on one of the nodes:
cm_rx_duplicates:
dreq 2102
cm_rx_msgs:
drep 1989
dreq 6195
rep 3968
req 4224
rtu 4224
cm_tx_msgs:
drep 4093
dreq 27568
rep 4224
req 3968
rtu 3968
cm_tx_retries:
dreq 23469Note that the active/passive side is equally distributed between the two nodes.
Enabling pr_debug in cm.c gives tons of:
[171778.814239] <mlx4_ib> mlx4_ib_multiplex_cm_handler: id{slave:1,sl_cm_id: 0xd393089f} is NULL!
By increasing the CM_CLEANUP_CACHE_TIMEOUT from 5 to 30 seconds, the tear-down phase of the application is reduced from approximately 90 to 50 seconds. Retries/duplicates are also significantly reduced:
cm_rx_duplicates:
dreq 2460
[]
cm_tx_retries:
dreq 3010
req 47Increasing the timeout further didn't help, as these duplicates and retries stems from a too short CMA timeout, which was 20 (~4 seconds) on the systems. By increasing the CMA timeout to 22 (~17 seconds), the numbers fell down to about 10 for both of them.
Adjustment of the CMA timeout is not part of this commit.
--- drivers/infiniband/hw/mlx4/cm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/mlx4/cm.c +1 -1
@@ -39,7 +39,7 @@#include "mlx4_ib.h" -#define CM_CLEANUP_CACHE_TIMEOUT (5 * HZ) +#define CM_CLEANUP_CACHE_TIMEOUT (30 * HZ)struct id_map_entry {struct rb_node node;
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 99/246 perf annotate: Fix getting source line failure
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 11db1ad4513d6205d2519e1a30ff4cef746e3243 ]
The output of "perf annotate -l --stdio xxx" changed since commit 425859ff0de33 ("perf annotate: No need to calculate notes->start twice") removed notes->start assignment in symbol__calc_lines(). It will get failed in find_address_in_section() from symbol__tty_annotate() subroutine as the a2l->addr is wrong. So the annotate summary doesn't report the line number of source code correctly.
Before fix:
liwei@euler:~/main_code/hulk_work/hulk/tools/perf$ cat common_while_1.c
void hotspot_1(void)
{
volatile int i;for (i = 0; i < 0x10000000; i++); for (i = 0; i < 0x10000000; i++); for (i = 0; i < 0x10000000; i++);
}
int main(void)
{
hotspot_1();
return 0;
}
liwei@euler:~/main_code/hulk_work/hulk/tools/perf$ gcc common_while_1.c -g -o common_while_1liwei@euler:~/main_code/hulk_work/hulk/tools/perf$ sudo ./perf record ./common_while_1 [ perf record: Woken up 2 times to write data ] [ perf record: Captured and wrote 0.488 MB perf.data (12498 samples) ] liwei@euler:~/main_code/hulk_work/hulk/tools/perf$ sudo ./perf annotate -l -s hotspot_1 --stdio
Sorted summary for file /home/liwei/main_code/hulk_work/hulk/tools/perf/common_while_1
----------------------------------------------
19.30 common_while_1[32]
19.03 common_while_1[4e]
19.01 common_while_1[16]
5.04 common_while_1[13]
4.99 common_while_1[4b]
4.78 common_while_1[2c]
4.77 common_while_1[10]
4.66 common_while_1[2f]
4.59 common_while_1[51]
4.59 common_while_1[35]
4.52 common_while_1[19]
4.20 common_while_1[56]
0.51 common_while_1[48]
Percent | Source code & Disassembly of common_while_1 for cycles:ppp (12480 samples, percent: local period)
-----------------------------------------------------------------------------------------------------------------
:
:
:
: Disassembly of section .text:
:
: 00000000000005fa <hotspot_1>:
: hotspot_1():
: void hotspot_1(void)
: {
0.00 : 5fa: push %rbp
0.00 : 5fb: mov %rsp,%rbp
: volatile int i;
:
: for (i = 0; i < 0x10000000; i++);
0.00 : 5fe: movl $0x0,-0x4(%rbp)
0.00 : 605: jmp 610 <hotspot_1+0x16>
0.00 : 607: mov -0x4(%rbp),%eax
common_while_1[10] 4.77 : 60a: add $0x1,%eax
common_while_1[13] 5.04 : 60d: mov %eax,-0x4(%rbp)
common_while_1[16] 19.01 : 610: mov -0x4(%rbp),%eax
common_while_1[19] 4.52 : 613: cmp $0xfffffff,%eax
0.00 : 618: jle 607 <hotspot_1+0xd>
: for (i = 0; i < 0x10000000; i++);
...After fix:
liwei@euler:~/main_code/hulk_work/hulk/tools/perf$ sudo ./perf record ./common_while_1 [ perf record: Woken up 2 times to write data ] [ perf record: Captured and wrote 0.488 MB perf.data (12500 samples) ] liwei@euler:~/main_code/hulk_work/hulk/tools/perf$ sudo ./perf annotate -l -s hotspot_1 --stdio
Sorted summary for file /home/liwei/main_code/hulk_work/hulk/tools/perf/common_while_1
----------------------------------------------
33.34 common_while_1.c:5
33.34 common_while_1.c:6
33.32 common_while_1.c:7
Percent | Source code & Disassembly of common_while_1 for cycles:ppp (12482 samples, percent: local period)
-----------------------------------------------------------------------------------------------------------------
:
:
:
: Disassembly of section .text:
:
: 00000000000005fa <hotspot_1>:
: hotspot_1():
: void hotspot_1(void)
: {
0.00 : 5fa: push %rbp
0.00 : 5fb: mov %rsp,%rbp
: volatile int i;
:
: for (i = 0; i < 0x10000000; i++);
0.00 : 5fe: movl $0x0,-0x4(%rbp)
0.00 : 605: jmp 610 <hotspot_1+0x16>
0.00 : 607: mov -0x4(%rbp),%eax
common_while_1.c:5 4.70 : 60a: add $0x1,%eax
4.89 : 60d: mov %eax,-0x4(%rbp)
common_while_1.c:5 19.03 : 610: mov -0x4(%rbp),%eax
common_while_1.c:5 4.72 : 613: cmp $0xfffffff,%eax
0.00 : 618: jle 607 <hotspot_1+0xd>
: for (i = 0; i < 0x10000000; i++);
0.00 : 61a: movl $0x0,-0x4(%rbp)
0.00 : 621: jmp 62c <hotspot_1+0x32>
0.00 : 623: mov -0x4(%rbp),%eax
common_while_1.c:6 4.54 : 626: add $0x1,%eax
4.73 : 629: mov %eax,-0x4(%rbp)
common_while_1.c:6 19.54 : 62c: mov -0x4(%rbp),%eax
common_while_1.c:6 4.54 : 62f: cmp $0xfffffff,%eax
...--- tools/perf/util/annotate.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/util/annotate.c +2 -2
@@ -1889,6 +1889,7 @@ int symbol__annotate(struct symbol *sym, struct map *map,struct annotation_options *options, struct arch **parch) { + struct annotation *notes = symbol__annotation(sym); struct annotate_args args = { .privsize = privsize, .evsel = evsel,
@@ -1919,6 +1920,7 @@ int symbol__annotate(struct symbol *sym, struct map *map, args.ms.map = map; args.ms.sym = sym; + notes->start =map__rip_2objdump (map, sym->start);return symbol__disassemble (sym, &args); }
@@ -2794,8 +2796,6 @@ int symbol__annotate2(struct symbol *sym, struct map *map, struct perf_evsel *evsymbol__calc_percent (sym, evsel); - notes->start =map__rip_2objdump (map, sym->start); -annotation__set_offsets (notes, size);annotation__mark_jump_targets (notes, sym);annotation__compute_ipc (notes, size);
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 100/246 powerpc/44x: Force PCI on for CURRITUCK
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit aa7150ba378650d0e9d84b8e4d805946965a5926 ]
The recent rework of PCI kconfig symbols exposed an existing bug in the CURRITUCK kconfig logic.
It selects PPC4xx_PCI_EXPRESS which depends on PCI, but PCI is user selectable and might be disabled, leading to a warning:
WARNING: unmet direct dependencies detected for PPC4xx_PCI_EXPRESS
Depends on [n]: PCI [=n] && 4xx [=y]
Selected by [y]:
- CURRITUCK [=y] && PPC_47x [=y]
Prior to commit eb01d42a7778 ("PCI: consolidate PCI config entry in drivers/pci") PCI was enabled by default for currituck_defconfig so we didn't see the warning. The bad logic was still there, it just required someone disabling PCI in their .config to hit it.
Fix it by forcing PCI on for CURRITUCK, which seems was always the expectation anyway.
--- arch/powerpc/platforms/44x/Kconfig | 1 + 1 file changed, 1 insertion(+)
arch/powerpc/platforms/44x/Kconfig +1 -0
@@ -180,6 +180,7 @@ config CURRITUCK depends on PPC_47x select SWIOTLB select 476FPE + select FORCE_PCI select PPC4xx_PCI_EXPRESS help This option enables support for the IBM Currituck (476fpe) evaluation board
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 102/246 cpufreq: acpi-cpufreq: Report if CPU doesnt support boost technologies
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 1222d527f314c86a3b59a522115d62facc5a7965 ]
There is some rare cases where CPB (and possibly IDA) are missing on processors.
This is the case fixed by commit f7f3dc00f612 ("x86/cpu/AMD: Fix erratum 1076 (CPB bit)") and following.
In such context, the boost status isn't reported by /sys/devices/system/cpu/cpufreq/boost.
This commit is about printing a message to report that the CPU doesn't expose the boost capabilities.
This message could help debugging platforms hit by this phenomena.
--- drivers/cpufreq/acpi-cpufreq.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/cpufreq/acpi-cpufreq.c +3 -1
@@ -916,8 +916,10 @@ static void __init acpi_cpufreq_boost_init(void) {int ret; -if (!(boot_cpu_has (X86_FEATURE_CPB ) ||boot_cpu_has (X86_FEATURE_IDA ))) +if (!(boot_cpu_has (X86_FEATURE_CPB ) ||boot_cpu_has (X86_FEATURE_IDA ))) { +pr_debug ("Boost capabilities not present in the processor\n" );return ; + } acpi_cpufreq_driver.set_boost = set_boost; acpi_cpufreq_driver.boost_enabled =boost_state (0 );
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 103/246 efi: cper: Fix possible out-of-bounds access
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 45b14a4ffcc1e0b5caa246638f942cbe7eaea7ad ]
When checking a generic status block, we iterate over all the generic data blocks. The loop condition only checks that the start of the generic data block is valid (within estatus->data_length) but not the whole block. Because the size of data blocks (excluding error data) may vary depending on the revision and the revision is contained within the data block, ensure that enough of the current data block is valid before dereferencing any members otherwise an out-of-bounds access may occur if estatus->data_length is invalid.
This relies on the fact that struct acpi_hest_generic_data_v300 is a superset of the earlier version. Also rework the other checks to avoid potential underflow.
--- drivers/firmware/efi/cper.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/firmware/efi/cper.c +9 -4
@@ -546,19 +546,24 @@ EXPORT_SYMBOL_GPL(cper_estatus_check_header);int cper_estatus_check (const struct acpi_hest_generic_status *estatus) {struct acpi_hest_generic_data *gdata; -unsigned int data_len, gedata_len; +unsigned int data_len, record_size;int rc; rc =cper_estatus_check_header (estatus);if (rc)return rc; + data_len = estatus->data_length;apei_estatus_for_each_section (estatus, gdata) { - gedata_len =acpi_hest_get_error_length (gdata); -if (gedata_len > data_len -acpi_hest_get_size (gdata)) +if (sizeof (struct acpi_hest_generic_data ) > data_len) +return -EINVAL ; + + record_size =acpi_hest_get_record_size (gdata); +if (record_size > data_len)return -EINVAL ; - data_len -=acpi_hest_get_record_size (gdata); + + data_len -= record_size; }if (data_len)return -EINVAL ;
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 95/246 loop: set GENHD_FL_NO_PART_SCAN after blkdev_reread_part()
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 758a58d0bc67457f1215321a536226654a830eeb ]
Commit 0da03cab87e6
("loop: Fix deadlock when calling blkdev_reread_part()") moves blkdev_reread_part() out of the loop_ctl_mutex. However, GENHD_FL_NO_PART_SCAN is set before __blkdev_reread_part(). As a result, __blkdev_reread_part() will fail the check of GENHD_FL_NO_PART_SCAN and will not rescan the loop device to delete all partitions.
Below are steps to reproduce the issue:
step1 # dd if=/dev/zero of=tmp.raw bs=1M count=100 step2 # losetup -P /dev/loop0 tmp.raw
step3 # parted /dev/loop0 mklabel gpt
step4 # parted -a none -s /dev/loop0 mkpart primary 64s 1 step5 # losetup -d /dev/loop0
Step5 will not be able to delete /dev/loop0p1 (introduced by step4) and there is below kernel warning message:
[ 464.414043] __loop_clr_fd: partition scan of loop0 failed (rc=-22)
This patch sets GENHD_FL_NO_PART_SCAN after blkdev_reread_part().
--- drivers/block/loop.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-)
drivers/block/loop.c +17 -4
@@ -1089,16 +1089,12 @@ static int __loop_clr_fd(struct loop_device *lo, bool release)kobject_uevent (&disk_to_dev (bdev->bd_disk)->kobj,KOBJ_CHANGE ); }mapping_set_gfp_mask (filp->f_mapping, gfp); - lo->lo_state = Lo_unbound;/* This is safe: open() is still holding a reference. */ module_put (THIS_MODULE );blk_mq_unfreeze_queue (lo->lo_queue); partscan = lo->lo_flags &LO_FLAGS_PARTSCAN && bdev; lo_number = lo->lo_number; - lo->lo_flags =0 ; -if (!part_shift) - lo->lo_disk->flags |=GENHD_FL_NO_PART_SCAN ;loop_unprepare_queue (lo); out_unlock:mutex_unlock (&loop_ctl_mutex);
@@ -1120,6 +1116,23 @@ out_unlock:/* Device is gone, no point in returning error */ err =0 ; } + +/* +* lo->lo_state is set to Lo_unbound here after above partscan has +* finished. +* +* There cannot be anybody else entering __loop_clr_fd() as +* lo->lo_backing_file is already cleared and Lo_rundown state +* protects us from all the other places trying to change the 'lo' +* device. +*/ +mutex_lock (&loop_ctl_mutex); + lo->lo_flags =0 ; +if (!part_shift) + lo->lo_disk->flags |=GENHD_FL_NO_PART_SCAN ; + lo->lo_state = Lo_unbound; +mutex_unlock (&loop_ctl_mutex); +/* * Need not hold loop_ctl_mutex to fput backing file. * Calling fput holding loop_ctl_mutex triggers a circular
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 123/246 vfs: fix preadv64v2 and pwritev64v2 compat syscalls with offset == -1
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit cc4b1242d7e3b42eed73881fc749944146493e4f ]
The preadv2 and pwritev2 syscalls are supposed to emulate the readv and writev syscalls when offset == -1. Therefore the compat code should check for offset before calling do_compat_preadv64 and do_compat_pwritev64. This is the case for the preadv2 and pwritev2 syscalls, but handling of offset == -1 is missing in their 64-bit equivalent.
This patch fixes that, calling do_compat_readv and do_compat_writev when offset == -1. This fixes the following glibc tests on x32:
- misc/tst-preadvwritev2
- misc/tst-preadvwritev64v2
--- fs/read_write.c | 6 ++++++ 1 file changed, 6 insertions(+)
fs/read_write.c +6 -0
@@ -1238,6 +1238,9 @@ COMPAT_SYSCALL_DEFINE5(preadv64v2, unsigned long, fd, const struct compat_iovec __user *,vec, unsigned long, vlen, loff_t, pos, rwf_t, flags) { + if (pos == -1) + return do_compat_readv(fd, vec, vlen, flags); +return do_compat_preadv64 (fd, vec, vlen, pos, flags); }#endif
@@ -1344,6 +1347,9 @@ COMPAT_SYSCALL_DEFINE5(pwritev64v2, unsigned long, fd, const struct compat_iovec __user *,vec, unsigned long, vlen, loff_t, pos, rwf_t, flags) { + if (pos == -1) + return do_compat_writev(fd, vec, vlen, flags); +return do_compat_pwritev64 (fd, vec, vlen, pos, flags); }#endif
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 112/246 media: ov7740: fix runtime pm initialization
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 12aceee1f412c3ddc7750155fec06c906f14ab51 ]
The runtime PM of this device is enabled after v4l2_ctrl_handler_setup(), and this makes this device's runtime PM usage count a negative value.
The ov7740_set_ctrl() tries to do something only if the device's runtime PM usage counter is nonzero.
ov7740_set_ctrl()
{
if (!pm_runtime_get_if_in_use(&client->dev))
return 0;
<do something>;
pm_runtime_put(&client->dev);
return ret;
}However, the ov7740_set_ctrl() is called by v4l2_ctrl_handler_setup() while the runtime PM of this device is not yet enabled. In this case, the pm_runtime_get_if_in_use() returns -EINVAL (!= 0).
Therefore we can't bail out of this function and the usage count is decreased by pm_runtime_put() without increment.
This fixes this problem by enabling the runtime PM of this device before v4l2_ctrl_handler_setup() so that the ov7740_set_ctrl() is always called when the runtime PM is enabled.
--- drivers/media/i2c/ov7740.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/media/i2c/ov7740.c +5 -2
@@ -1101,6 +1101,9 @@ static int ov7740_probe(struct i2c_client *client,if (ret)return ret; +pm_runtime_set_active (&client->dev); +pm_runtime_enable (&client->dev); + ret =ov7740_detect (ov7740);if (ret) goto error_detect;
@@ -1123,8 +1126,6 @@ static int ov7740_probe(struct i2c_client *client,if (ret) goto error_async_register; -pm_runtime_set_active (&client->dev); -pm_runtime_enable (&client->dev);pm_runtime_idle (&client->dev);return 0 ;
@@ -1134,6 +1135,8 @@ error_async_register: error_init_controls:ov7740_free_controls (ov7740); error_detect: +pm_runtime_disable (&client->dev); +pm_runtime_set_suspended (&client->dev);ov7740_set_power (ov7740,0 );media_entity_cleanup (&ov7740->subdev.entity);
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 114/246 media: s5p-jpeg: Correct return type for mem2mem buffer helpers
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 4a88f89885c7cf65c62793f385261a6e3315178a ]
Fix the assigned type of mem2mem buffer handling API. Namely, these functions:
v4l2_m2m_next_buf
v4l2_m2m_last_buf
v4l2_m2m_buf_remove
v4l2_m2m_next_src_buf
v4l2_m2m_next_dst_buf
v4l2_m2m_last_src_buf
v4l2_m2m_last_dst_buf
v4l2_m2m_src_buf_remove
v4l2_m2m_dst_buf_remove
return a struct vb2_v4l2_buffer, and not a struct vb2_buffer.
Fixing this is necessary to fix the mem2mem buffer handling API, changing the return to the correct struct vb2_v4l2_buffer instead of a void pointer.
--- drivers/media/platform/s5p-jpeg/jpeg-core.c | 38 ++++++++++----------- 1 file changed, 19 insertions(+), 19 deletions(-)
drivers/media/platform/s5p-jpeg/jpeg-core.c +19 -19
@@ -793,14 +793,14 @@ static void skip(struct s5p_jpeg_buffer *buf, long len);static void exynos4_jpeg_parse_decode_h_tbl (struct s5p_jpeg_ctx *ctx) {struct s5p_jpeg *jpeg = ctx->jpeg; -struct vb2_buffer *vb =v4l2_m2m_next_src_buf (ctx->fh.m2m_ctx); +struct vb2_v4l2_buffer *vb =v4l2_m2m_next_src_buf (ctx->fh.m2m_ctx);struct s5p_jpeg_buffer jpeg_buffer;unsigned int word;int c, x, components; jpeg_buffer.size =2 ;/* Ls */ jpeg_buffer.data = - (unsigned long )vb2_plane_vaddr (vb,0 ) + ctx->out_q.sos +2 ; + (unsigned long )vb2_plane_vaddr (&vb->vb2_buf,0 ) + ctx->out_q.sos +2 ; jpeg_buffer.curr =0 ; word =0 ;
@@ -830,14 +830,14 @@ static void exynos4_jpeg_parse_decode_h_tbl(struct s5p_jpeg_ctx *ctx)static void exynos4_jpeg_parse_huff_tbl (struct s5p_jpeg_ctx *ctx) {struct s5p_jpeg *jpeg = ctx->jpeg; -struct vb2_buffer *vb =v4l2_m2m_next_src_buf (ctx->fh.m2m_ctx); +struct vb2_v4l2_buffer *vb =v4l2_m2m_next_src_buf (ctx->fh.m2m_ctx);struct s5p_jpeg_buffer jpeg_buffer;unsigned int word;int c, i, n, j;for (j =0 ; j < ctx->out_q.dht.n; ++j) { jpeg_buffer.size = ctx->out_q.dht.len[j]; - jpeg_buffer.data = (unsigned long )vb2_plane_vaddr (vb,0 ) + + jpeg_buffer.data = (unsigned long )vb2_plane_vaddr (&vb->vb2_buf,0 ) + ctx->out_q.dht.marker[j]; jpeg_buffer.curr =0 ;
@@ -889,13 +889,13 @@ static void exynos4_jpeg_parse_huff_tbl(struct s5p_jpeg_ctx *ctx)static void exynos4_jpeg_parse_decode_q_tbl (struct s5p_jpeg_ctx *ctx) {struct s5p_jpeg *jpeg = ctx->jpeg; -struct vb2_buffer *vb =v4l2_m2m_next_src_buf (ctx->fh.m2m_ctx); +struct vb2_v4l2_buffer *vb =v4l2_m2m_next_src_buf (ctx->fh.m2m_ctx);struct s5p_jpeg_buffer jpeg_buffer;int c, x, components; jpeg_buffer.size = ctx->out_q.sof_len; jpeg_buffer.data = - (unsigned long )vb2_plane_vaddr (vb,0 ) + ctx->out_q.sof; + (unsigned long )vb2_plane_vaddr (&vb->vb2_buf,0 ) + ctx->out_q.sof; jpeg_buffer.curr =0 ;skip (&jpeg_buffer,5 );/* P, Y, X */
@@ -920,14 +920,14 @@ static void exynos4_jpeg_parse_decode_q_tbl(struct s5p_jpeg_ctx *ctx)static void exynos4_jpeg_parse_q_tbl (struct s5p_jpeg_ctx *ctx) {struct s5p_jpeg *jpeg = ctx->jpeg; -struct vb2_buffer *vb =v4l2_m2m_next_src_buf (ctx->fh.m2m_ctx); +struct vb2_v4l2_buffer *vb =v4l2_m2m_next_src_buf (ctx->fh.m2m_ctx);struct s5p_jpeg_buffer jpeg_buffer;unsigned int word;int c, i, j;for (j =0 ; j < ctx->out_q.dqt.n; ++j) { jpeg_buffer.size = ctx->out_q.dqt.len[j]; - jpeg_buffer.data = (unsigned long )vb2_plane_vaddr (vb,0 ) + + jpeg_buffer.data = (unsigned long )vb2_plane_vaddr (&vb->vb2_buf,0 ) + ctx->out_q.dqt.marker[j]; jpeg_buffer.curr =0 ;
@@ -2072,15 +2072,15 @@ static void s5p_jpeg_device_run(void *priv) {struct s5p_jpeg_ctx *ctx = priv;struct s5p_jpeg *jpeg = ctx->jpeg; -struct vb2_buffer *src_buf, *dst_buf; +struct vb2_v4l2_buffer *src_buf, *dst_buf;unsigned long src_addr, dst_addr, flags;spin_lock_irqsave (&ctx->jpeg->slock, flags); src_buf =v4l2_m2m_next_src_buf (ctx->fh.m2m_ctx); dst_buf =v4l2_m2m_next_dst_buf (ctx->fh.m2m_ctx); - src_addr =vb2_dma_contig_plane_dma_addr (src_buf,0 ); - dst_addr =vb2_dma_contig_plane_dma_addr (dst_buf,0 ); + src_addr =vb2_dma_contig_plane_dma_addr (&src_buf->vb2_buf,0 ); + dst_addr =vb2_dma_contig_plane_dma_addr (&dst_buf->vb2_buf,0 );s5p_jpeg_reset (jpeg->regs);s5p_jpeg_poweron (jpeg->regs);
@@ -2153,7 +2153,7 @@ static void exynos4_jpeg_set_img_addr(struct s5p_jpeg_ctx *ctx) {struct s5p_jpeg *jpeg = ctx->jpeg;struct s5p_jpeg_fmt *fmt; -struct vb2_buffer *vb; +struct vb2_v4l2_buffer *vb;struct s5p_jpeg_addr jpeg_addr = {};u32 pix_size, padding_bytes =0 ;
@@ -2172,7 +2172,7 @@ static void exynos4_jpeg_set_img_addr(struct s5p_jpeg_ctx *ctx) vb =v4l2_m2m_next_dst_buf (ctx->fh.m2m_ctx); } - jpeg_addr.y =vb2_dma_contig_plane_dma_addr (vb,0 ); + jpeg_addr.y =vb2_dma_contig_plane_dma_addr (&vb->vb2_buf,0 );if (fmt->colplanes ==2 ) { jpeg_addr.cb = jpeg_addr.y + pix_size - padding_bytes;
@@ -2190,7 +2190,7 @@ static void exynos4_jpeg_set_img_addr(struct s5p_jpeg_ctx *ctx)static void exynos4_jpeg_set_jpeg_addr (struct s5p_jpeg_ctx *ctx) {struct s5p_jpeg *jpeg = ctx->jpeg; -struct vb2_buffer *vb; +struct vb2_v4l2_buffer *vb;unsigned int jpeg_addr =0 ;if (ctx->mode ==S5P_JPEG_ENCODE )
@@ -2198,7 +2198,7 @@ static void exynos4_jpeg_set_jpeg_addr(struct s5p_jpeg_ctx *ctx)else vb =v4l2_m2m_next_src_buf (ctx->fh.m2m_ctx); - jpeg_addr =vb2_dma_contig_plane_dma_addr (vb,0 ); + jpeg_addr =vb2_dma_contig_plane_dma_addr (&vb->vb2_buf,0 );if (jpeg->variant->version ==SJPEG_EXYNOS5433 && ctx->mode ==S5P_JPEG_DECODE ) jpeg_addr += ctx->out_q.sos;
@@ -2314,7 +2314,7 @@ static void exynos3250_jpeg_set_img_addr(struct s5p_jpeg_ctx *ctx) {struct s5p_jpeg *jpeg = ctx->jpeg;struct s5p_jpeg_fmt *fmt; -struct vb2_buffer *vb; +struct vb2_v4l2_buffer *vb;struct s5p_jpeg_addr jpeg_addr = {};u32 pix_size;
@@ -2328,7 +2328,7 @@ static void exynos3250_jpeg_set_img_addr(struct s5p_jpeg_ctx *ctx) fmt = ctx->cap_q.fmt; } - jpeg_addr.y =vb2_dma_contig_plane_dma_addr (vb,0 ); + jpeg_addr.y =vb2_dma_contig_plane_dma_addr (&vb->vb2_buf,0 );if (fmt->colplanes ==2 ) { jpeg_addr.cb = jpeg_addr.y + pix_size;
@@ -2346,7 +2346,7 @@ static void exynos3250_jpeg_set_img_addr(struct s5p_jpeg_ctx *ctx)static void exynos3250_jpeg_set_jpeg_addr (struct s5p_jpeg_ctx *ctx) {struct s5p_jpeg *jpeg = ctx->jpeg; -struct vb2_buffer *vb; +struct vb2_v4l2_buffer *vb;unsigned int jpeg_addr =0 ;if (ctx->mode ==S5P_JPEG_ENCODE )
@@ -2354,7 +2354,7 @@ static void exynos3250_jpeg_set_jpeg_addr(struct s5p_jpeg_ctx *ctx)else vb =v4l2_m2m_next_src_buf (ctx->fh.m2m_ctx); - jpeg_addr =vb2_dma_contig_plane_dma_addr (vb,0 ); + jpeg_addr =vb2_dma_contig_plane_dma_addr (&vb->vb2_buf,0 );exynos3250_jpeg_jpgadr (jpeg->regs, jpeg_addr); }
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 115/246 media: rockchip/rga: Correct return type for mem2mem buffer helpers
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit da2d3a4e4adabc6ccfb100bc9abd58ee9cd6c4b7 ]
Fix the assigned type of mem2mem buffer handling API. Namely, these functions:
v4l2_m2m_next_buf
v4l2_m2m_last_buf
v4l2_m2m_buf_remove
v4l2_m2m_next_src_buf
v4l2_m2m_next_dst_buf
v4l2_m2m_last_src_buf
v4l2_m2m_last_dst_buf
v4l2_m2m_src_buf_remove
v4l2_m2m_dst_buf_remove
return a struct vb2_v4l2_buffer, and not a struct vb2_buffer.
Fixing this is necessary to fix the mem2mem buffer handling API, changing the return to the correct struct vb2_v4l2_buffer instead of a void pointer.
--- drivers/media/platform/rockchip/rga/rga.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/media/platform/rockchip/rga/rga.c +3 -3
@@ -43,7 +43,7 @@ static void device_run(void *prv) {struct rga_ctx *ctx = prv;struct rockchip_rga *rga = ctx->rga; -struct vb2_buffer *src, *dst; +struct vb2_v4l2_buffer *src, *dst;unsigned long flags;spin_lock_irqsave (&rga->ctrl_lock, flags);
@@ -53,8 +53,8 @@ static void device_run(void *prv) src =v4l2_m2m_next_src_buf (ctx->fh.m2m_ctx); dst =v4l2_m2m_next_dst_buf (ctx->fh.m2m_ctx); -rga_buf_map (src); -rga_buf_map (dst); +rga_buf_map (&src->vb2_buf); +rga_buf_map (&dst->vb2_buf);rga_hw_start (rga);
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 116/246 media: s5p-g2d: Correct return type for mem2mem buffer helpers
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 30fa627b32230737bc3f678067e2adfecf956987 ]
Fix the assigned type of mem2mem buffer handling API. Namely, these functions:
v4l2_m2m_next_buf
v4l2_m2m_last_buf
v4l2_m2m_buf_remove
v4l2_m2m_next_src_buf
v4l2_m2m_next_dst_buf
v4l2_m2m_last_src_buf
v4l2_m2m_last_dst_buf
v4l2_m2m_src_buf_remove
v4l2_m2m_dst_buf_remove
return a struct vb2_v4l2_buffer, and not a struct vb2_buffer.
Fixing this is necessary to fix the mem2mem buffer handling API, changing the return to the correct struct vb2_v4l2_buffer instead of a void pointer.
--- drivers/media/platform/s5p-g2d/g2d.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/media/platform/s5p-g2d/g2d.c +3 -3
@@ -513,7 +513,7 @@ static void device_run(void *prv) {struct g2d_ctx *ctx = prv;struct g2d_dev *dev = ctx->dev; -struct vb2_buffer *src, *dst; +struct vb2_v4l2_buffer *src, *dst;unsigned long flags;u32 cmd =0 ;
@@ -528,10 +528,10 @@ static void device_run(void *prv)spin_lock_irqsave (&dev->ctrl_lock, flags);g2d_set_src_size (dev, &ctx->in); -g2d_set_src_addr (dev,vb2_dma_contig_plane_dma_addr (src,0 )); +g2d_set_src_addr (dev,vb2_dma_contig_plane_dma_addr (&src->vb2_buf,0 ));g2d_set_dst_size (dev, &ctx->out); -g2d_set_dst_addr (dev,vb2_dma_contig_plane_dma_addr (dst,0 )); +g2d_set_dst_addr (dev,vb2_dma_contig_plane_dma_addr (&dst->vb2_buf,0 ));g2d_set_rop4 (dev, ctx->rop);g2d_set_flip (dev, ctx->flip);
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 118/246 media: mtk-jpeg: Correct return type for mem2mem buffer helpers
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 1b275e4e8b70dbff9850874b30831c1bd8d3c504 ]
Fix the assigned type of mem2mem buffer handling API. Namely, these functions:
v4l2_m2m_next_buf
v4l2_m2m_last_buf
v4l2_m2m_buf_remove
v4l2_m2m_next_src_buf
v4l2_m2m_next_dst_buf
v4l2_m2m_last_src_buf
v4l2_m2m_last_dst_buf
v4l2_m2m_src_buf_remove
v4l2_m2m_dst_buf_remove
return a struct vb2_v4l2_buffer, and not a struct vb2_buffer.
Fixing this is necessary to fix the mem2mem buffer handling API, changing the return to the correct struct vb2_v4l2_buffer instead of a void pointer.
--- .../media/platform/mtk-jpeg/mtk_jpeg_core.c | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-)
drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c +20 -20
@@ -702,7 +702,7 @@ end:v4l2_m2m_buf_queue (ctx->fh.m2m_ctx,to_vb2_v4l2_buffer (vb)); } -static void *mtk_jpeg_buf_remove (struct mtk_jpeg_ctx *ctx, +static struct vb2_v4l2_buffer *mtk_jpeg_buf_remove (struct mtk_jpeg_ctx *ctx,enum v4l2_buf_type type) {if (V4L2_TYPE_IS_OUTPUT (type))
@@ -714,7 +714,7 @@ static void *mtk_jpeg_buf_remove(struct mtk_jpeg_ctx *ctx,static int mtk_jpeg_start_streaming (struct vb2_queue *q,unsigned int count) {struct mtk_jpeg_ctx *ctx =vb2_get_drv_priv (q); -struct vb2_buffer *vb; +struct vb2_v4l2_buffer *vb;int ret =0 ; ret =pm_runtime_get_sync (ctx->jpeg->dev);
@@ -724,14 +724,14 @@ static int mtk_jpeg_start_streaming(struct vb2_queue *q, unsigned int count)return 0 ; err:while ((vb =mtk_jpeg_buf_remove (ctx, q->type))) -v4l2_m2m_buf_done (to_vb2_v4l2_buffer (vb),VB2_BUF_STATE_QUEUED ); +v4l2_m2m_buf_done (vb,VB2_BUF_STATE_QUEUED );return ret; }static void mtk_jpeg_stop_streaming (struct vb2_queue *q) {struct mtk_jpeg_ctx *ctx =vb2_get_drv_priv (q); -struct vb2_buffer *vb; +struct vb2_v4l2_buffer *vb;/* * STREAMOFF is an acknowledgment for source change event.
@@ -743,7 +743,7 @@ static void mtk_jpeg_stop_streaming(struct vb2_queue *q)struct mtk_jpeg_src_buf *src_buf; vb =v4l2_m2m_next_src_buf (ctx->fh.m2m_ctx); - src_buf =mtk_jpeg_vb2_to_srcbuf (vb); + src_buf =mtk_jpeg_vb2_to_srcbuf (&vb->vb2_buf);mtk_jpeg_set_queue_data (ctx, &src_buf->dec_param); ctx->state =MTK_JPEG_RUNNING ; }else if (V4L2_TYPE_IS_OUTPUT (q->type)) {
@@ -751,7 +751,7 @@ static void mtk_jpeg_stop_streaming(struct vb2_queue *q) }while ((vb =mtk_jpeg_buf_remove (ctx, q->type))) -v4l2_m2m_buf_done (to_vb2_v4l2_buffer (vb),VB2_BUF_STATE_ERROR ); +v4l2_m2m_buf_done (vb,VB2_BUF_STATE_ERROR );pm_runtime_put_sync (ctx->jpeg->dev); }
@@ -807,7 +807,7 @@ static void mtk_jpeg_device_run(void *priv) {struct mtk_jpeg_ctx *ctx = priv;struct mtk_jpeg_dev *jpeg = ctx->jpeg; -struct vb2_buffer *src_buf, *dst_buf; +struct vb2_v4l2_buffer *src_buf, *dst_buf;enum vb2_buffer_state buf_state =VB2_BUF_STATE_ERROR ;unsigned long flags;struct mtk_jpeg_src_buf *jpeg_src_buf;
@@ -817,11 +817,11 @@ static void mtk_jpeg_device_run(void *priv) src_buf =v4l2_m2m_next_src_buf (ctx->fh.m2m_ctx); dst_buf =v4l2_m2m_next_dst_buf (ctx->fh.m2m_ctx); - jpeg_src_buf =mtk_jpeg_vb2_to_srcbuf (src_buf); + jpeg_src_buf =mtk_jpeg_vb2_to_srcbuf (&src_buf->vb2_buf);if (jpeg_src_buf->flags &MTK_JPEG_BUF_FLAGS_LAST_FRAME ) { -for (i =0 ; i < dst_buf->num_planes; i++) -vb2_set_plane_payload (dst_buf, i,0 ); +for (i =0 ; i < dst_buf->vb2_buf.num_planes; i++) +vb2_set_plane_payload (&dst_buf->vb2_buf, i,0 ); buf_state =VB2_BUF_STATE_DONE ; goto dec_end; }
@@ -833,8 +833,8 @@ static void mtk_jpeg_device_run(void *priv)return ; } -mtk_jpeg_set_dec_src (ctx, src_buf, &bs); -if (mtk_jpeg_set_dec_dst (ctx, &jpeg_src_buf->dec_param, dst_buf, &fb)) +mtk_jpeg_set_dec_src (ctx, &src_buf->vb2_buf, &bs); +if (mtk_jpeg_set_dec_dst (ctx, &jpeg_src_buf->dec_param, &dst_buf->vb2_buf, &fb)) goto dec_end;spin_lock_irqsave (&jpeg->hw_lock, flags);
@@ -849,8 +849,8 @@ static void mtk_jpeg_device_run(void *priv) dec_end:v4l2_m2m_src_buf_remove (ctx->fh.m2m_ctx);v4l2_m2m_dst_buf_remove (ctx->fh.m2m_ctx); -v4l2_m2m_buf_done (to_vb2_v4l2_buffer (src_buf), buf_state); -v4l2_m2m_buf_done (to_vb2_v4l2_buffer (dst_buf), buf_state); +v4l2_m2m_buf_done (src_buf, buf_state); +v4l2_m2m_buf_done (dst_buf, buf_state);v4l2_m2m_job_finish (jpeg->m2m_dev, ctx->fh.m2m_ctx); }
@@ -921,7 +921,7 @@ static irqreturn_t mtk_jpeg_dec_irq(int irq, void *priv) {struct mtk_jpeg_dev *jpeg = priv;struct mtk_jpeg_ctx *ctx; -struct vb2_buffer *src_buf, *dst_buf; +struct vb2_v4l2_buffer *src_buf, *dst_buf;struct mtk_jpeg_src_buf *jpeg_src_buf;enum vb2_buffer_state buf_state =VB2_BUF_STATE_ERROR ;u32 dec_irq_ret;
@@ -938,7 +938,7 @@ static irqreturn_t mtk_jpeg_dec_irq(int irq, void *priv) src_buf =v4l2_m2m_src_buf_remove (ctx->fh.m2m_ctx); dst_buf =v4l2_m2m_dst_buf_remove (ctx->fh.m2m_ctx); - jpeg_src_buf =mtk_jpeg_vb2_to_srcbuf (src_buf); + jpeg_src_buf =mtk_jpeg_vb2_to_srcbuf (&src_buf->vb2_buf);if (dec_irq_ret >=MTK_JPEG_DEC_RESULT_UNDERFLOW )mtk_jpeg_dec_reset (jpeg->dec_reg_base);
@@ -948,15 +948,15 @@ static irqreturn_t mtk_jpeg_dec_irq(int irq, void *priv) goto dec_end; } -for (i =0 ; i < dst_buf->num_planes; i++) -vb2_set_plane_payload (dst_buf, i, +for (i =0 ; i < dst_buf->vb2_buf.num_planes; i++) +vb2_set_plane_payload (&dst_buf->vb2_buf, i, jpeg_src_buf->dec_param.comp_size[i]); buf_state =VB2_BUF_STATE_DONE ; dec_end: -v4l2_m2m_buf_done (to_vb2_v4l2_buffer (src_buf), buf_state); -v4l2_m2m_buf_done (to_vb2_v4l2_buffer (dst_buf), buf_state); +v4l2_m2m_buf_done (src_buf, buf_state); +v4l2_m2m_buf_done (dst_buf, buf_state);v4l2_m2m_job_finish (jpeg->m2m_dev, ctx->fh.m2m_ctx);return IRQ_HANDLED ; }
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 117/246 media: mx2_emmaprp: Correct return type for mem2mem buffer helpers
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 8d20dcefe471763f23ad538369ec65b51993ffff ]
Fix the assigned type of mem2mem buffer handling API. Namely, these functions:
v4l2_m2m_next_buf
v4l2_m2m_last_buf
v4l2_m2m_buf_remove
v4l2_m2m_next_src_buf
v4l2_m2m_next_dst_buf
v4l2_m2m_last_src_buf
v4l2_m2m_last_dst_buf
v4l2_m2m_src_buf_remove
v4l2_m2m_dst_buf_remove
return a struct vb2_v4l2_buffer, and not a struct vb2_buffer.
Fixing this is necessary to fix the mem2mem buffer handling API, changing the return to the correct struct vb2_v4l2_buffer instead of a void pointer.
--- drivers/media/platform/mx2_emmaprp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/media/platform/mx2_emmaprp.c +3 -3
@@ -274,7 +274,7 @@ static void emmaprp_device_run(void *priv) {struct emmaprp_ctx *ctx = priv;struct emmaprp_q_data *s_q_data, *d_q_data; -struct vb2_buffer *src_buf, *dst_buf; +struct vb2_v4l2_buffer *src_buf, *dst_buf;struct emmaprp_dev *pcdev = ctx->dev;unsigned int s_width, s_height;unsigned int d_width, d_height;
@@ -294,8 +294,8 @@ static void emmaprp_device_run(void *priv) d_height = d_q_data->height; d_size = d_width * d_height; - p_in =vb2_dma_contig_plane_dma_addr (src_buf,0 ); - p_out =vb2_dma_contig_plane_dma_addr (dst_buf,0 ); + p_in =vb2_dma_contig_plane_dma_addr (&src_buf->vb2_buf,0 ); + p_out =vb2_dma_contig_plane_dma_addr (&dst_buf->vb2_buf,0 );if (!p_in || !p_out) {v4l2_err (&pcdev->v4l2_dev,"Acquiring kernel pointers to buffers failed\n" );
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 135/246 perf report: Add s390 diagnosic sampling descriptor size
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 2187d87eacd46f6214ce3dc9cfd7a558375a4153 ]
On IBM z13 machine types 2964 and 2965 the descriptor sizes for sampling and diagnostic sampling entries might be missing in the trailer entry and are set to zero.
This leads to a perf report failure when processing diagnostic sampling entries.
This patch adds missing descriptor sizes when the trailer entry contains zero for these fields.
Output before:
[root@s38lp82 perf]# ./perf report --stdio | fgrep Samples 0xabbf0 [0x8]: failed to process type: 68
Error:
failed to process sample
[root@s38lp82 perf]#
Output after:
[root@s38lp82 perf]# ./perf report --stdio | fgrep Samples # Total Lost Samples: 0
# Samples: 3K of event 'SF_CYCLES_BASIC_DIAG'
# Samples: 162 of event 'CF_DIAG'
[root@s38lp82 perf]#
--- tools/perf/util/s390-cpumsf.c | 5 +++++ 1 file changed, 5 insertions(+)
tools/perf/util/s390-cpumsf.c +5 -0
@@ -301,6 +301,11 @@ static bool s390_cpumsf_validate(int machine_type, *dsdes =85 ; *bsdes =32 ;break ; +case 2964 : +case 2965 : + *dsdes =112 ; + *bsdes =32 ; +break ;default :/* Illegal trailer entry */ return false;
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 136/246 perf coresight: Do not test for libopencsd by default
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 1c3b28fd7ae80c8f6bf1a09e1848e20a953c9ce4 ]
Since it is not yet that generally available, avoid testing for the presence of libcoresight in the fast path test-all.bin feature test.
# dnf search opencsd No matches found. # dnf search OpenCSD No matches found. # cat /etc/fedora-release Fedora release 29 (Twenty Nine) #
I.e. right now, in my system test-all.bin is failing all the time since Fedora29 doesn't have libopencsd available:
$ cat /tmp/build/perf/feature/test-all.make.output
In file included from test-all.c:174:
test-libopencsd.c:2:10: fatal error: opencsd/c_api/opencsd_c_api.h: No such file or directory
#include <opencsd/c_api/opencsd_c_api.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.See:
6ab2b762befd ("perf build: Disable libbabeltrace check by default")
For the rationale, as soon as libopencsd becomes more generally packaged and available, we do the same thing we did with babeltrace, enabling it by default, as done in:
24787afbcd01 ("perf tools: Enable LIBBABELTRACE by default")
For now, to explicitely ask for opencsd, make sure you have it installed and use:
make -C tools/perf CORESIGHT=1
The feature test output will be there as an empty file:
$ ls -la /tmp/build/perf/feature/test-libopencsd.make.output
Because the binary used for the feature check was successfully built:
$ ls -la /tmp/build/perf/feature/test-libopencsd.bin -rwxrwxr-x. 1 acme acme 18336 Feb 12 14:49 /tmp/build/perf/feature/test-libopencsd.bin $ ldd /tmp/build/perf/feature/test-libopencsd.bin linux-vdso.so.1 (0x00007fffe18cc000) libopencsd_c_api.so.0 => /lib64/libopencsd_c_api.so.0 (0x00007fb8e67f6000) libopencsd.so.0 => /lib64/libopencsd.so.0 (0x00007fb8e676f000) libc.so.6 => /lib64/libc.so.6 (0x00007fb8e65a9000) libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007fb8e6411000) libm.so.6 => /lib64/libm.so.6 (0x00007fb8e628d000) libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007fb8e6272000) /lib64/ld-linux-x86-64.so.2 (0x00007fb8e6828000) $
And the resulting perf binary will be linked with it:
-rw-rw-r--. 1 acme acme 0 Feb 12 14:49 /tmp/build/perf/feature/test-libopencsd.make.output
$ ldd ~/bin/perf | grep opencsd libopencsd_c_api.so.0 => /lib64/libopencsd_c_api.so.0 (0x00007fd43097f000) libopencsd.so.0 => /lib64/libopencsd.so.0 (0x00007fd4308f8000) $
To make sure this gets built before pushing things upstream I have a ubuntu:19.04-x-arm64 container that has:
[root@quaco x-arm64]# grep CORESIGHT Dockerfile
ENV EXTRA_MAKE_ARGS=CORESIGHT=1
[root@quaco x-arm64]#
So that I always build with libopencsd before pushing things upstream.
--- tools/build/Makefile.feature | 2 +- tools/build/feature/test-all.c | 5 ----- tools/perf/Makefile.config | 3 ++- tools/perf/Makefile.perf | 2 +- 4 files changed, 4 insertions(+), 8 deletions(-)
tools/build/Makefile.feature +1 -1
@@ -70,7 +70,6 @@ FEATURE_TESTS_BASIC := \ sched_getcpu \ sdt \ setns \ - libopencsd \ libaio # FEATURE_TESTS_BASIC + FEATURE_TESTS_EXTRA is the complete list
@@ -84,6 +83,7 @@ FEATURE_TESTS_EXTRA := \ libbabeltrace \ libbfd-liberty \ libbfd-liberty-z \ + libopencsd \ libunwind-debug-frame \ libunwind-debug-frame-arm \ libunwind-debug-frame-aarch64 \
tools/build/feature/test-all.c +0 -5
@@ -170,10 +170,6 @@# include "test-setns.c" #undef main -#define main main_test_libopencsd -# include "test-libopencsd.c" -#undef main -#define main main_test_libaio# include "test-libaio.c" #undef main
@@ -221,7 +217,6 @@ int main(int argc, char *argv[])main_test_sched_getcpu ();main_test_sdt ();main_test_setns (); -main_test_libopencsd ();main_test_libaio ();main_test_reallocarray ();
tools/perf/Makefile.config +2 -1
@@ -388,7 +388,8 @@ ifeq ($(feature-setns), 1) $(call detected,CONFIG_SETNS) endif -ifndef NO_CORESIGHT +ifdef CORESIGHT + $(call feature_check,libopencsd) ifeq ($(feature-libopencsd), 1) CFLAGS += -DHAVE_CSTRACE_SUPPORT $(LIBOPENCSD_CFLAGS) LDFLAGS += $(LIBOPENCSD_LDFLAGS)
tools/perf/Makefile.perf +1 -1
@@ -102,7 +102,7 @@ include ../scripts/utilities.mak # When selected, pass LLVM_CONFIG=/path/to/llvm-config to `make' if # llvm-config is not in $PATH. # -# Define NO_CORESIGHT if you do not want support for CoreSight trace decoding. +# Define CORESIGHT if you DO WANT support for CoreSight trace decoding. # # Define NO_AIO if you do not want support of Posix AIO based trace # streaming for record mode. Currently Posix AIO trace streaming is
Signature · 9 lines
2.19.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Greg Kroah-Hartman
maintainerPATCH 138/246 ACPI / video: Refactor and fix dmi_is_desktop()
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit cecf3e3e0803462335e25d083345682518097334 ]
This commit refactors the chassis-type detection introduced by commit 53fa1f6e8a59 ("ACPI / video: Only default only_lcd to true on Win8-ready _desktops_") (where desktop means anything without a builtin screen).
The DMI chassis_type is an unsigned integer, so rather then doing a whole bunch of string-compares on it, convert it to an int and feed the result to a switch case.
Note the switch case uses hex values, this is done because the spec uses hex values too. This changes the check for "Main Server Chassis" from checking for 11 decimal to 11 hexadecimal, this is a bug fix, the original check for 11 decimal was wrong.
--- drivers/acpi/acpi_video.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-)
drivers/acpi/acpi_video.c +13 -6
@@ -2124,21 +2124,28 @@ static int __init intel_opregion_present(void)return opregion; } +/* Check if the chassis-type indicates there is no builtin LCD panel */ static bool dmi_is_desktop (void ) {const char *chassis_type; +unsigned long type; chassis_type =dmi_get_system_info (DMI_CHASSIS_TYPE );if (!chassis_type)return false; -if (!strcmp (chassis_type,"3" ) ||/* 3: Desktop */ - !strcmp (chassis_type,"4" ) ||/* 4: Low Profile Desktop */ - !strcmp (chassis_type,"5" ) ||/* 5: Pizza Box */ - !strcmp (chassis_type,"6" ) ||/* 6: Mini Tower */ - !strcmp (chassis_type,"7" ) ||/* 7: Tower */ - !strcmp (chassis_type,"11" ))/* 11: Main Server Chassis */ +if (kstrtoul (chassis_type,10 , &type) !=0 ) +return false; + +switch (type) { +case 0x03 :/* Desktop */ +case 0x04 :/* Low Profile Desktop */ +case 0x05 :/* Pizza Box */ +case 0x06 :/* Mini Tower */ +case 0x07 :/* Tower */ +case 0x11 :/* Main Server Chassis */ return true; + }return false; }
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 139/246 =?UTF-8?q?selftests:=20ir:=20fix=20warning:=20"%s"=20directive=20?= =?UTF-8?q?output=20may=20be=20truncated=20=E2=80=99=20directive=20output?= =?UTF-8?q?=20may=20be=20truncated?=
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit ed675ed9da6d951322efd72d739d6b5ce1c18f02 ]
Fix the following warning by sizing the buffer to max. of sysfs path max. size + d_name max. size.
gcc -Wall -O2 -I../../../include/uapi ir_loopback.c -o ../tools/testing/selftests/ir/ir_loopbackir_loopback.c: In function ‘lirc_open’:
ir_loopback.c:71:37: warning: ‘%s’ directive output may be truncated writing up to 255 bytes into a region of size 95 [-Wformat-truncation=]
snprintf(buf, sizeof(buf), "/dev/%s", dent->d_name);
^~
In file included from /usr/include/stdio.h:862:0,
from ir_loopback.c:14:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:64:10: note: ‘__builtin___snprintf_chk’ output between 6 and 261 bytes into a destination of size 100
return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
__bos (__s), __fmt, __va_arg_pack ());
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--- tools/testing/selftests/ir/ir_loopback.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
tools/testing/selftests/ir/ir_loopback.c +3 -1
@@ -27,6 +27,8 @@#define TEST_SCANCODES 10#define ARRAY_SIZE (arr) (sizeof(arr) / sizeof((arr)[0])) +#define SYSFS_PATH_MAX 256 +#define DNAME_PATH_MAX 256 static const struct { enum rc_proto proto;
@@ -56,7 +58,7 @@ static const struct {int lirc_open (const char *rc) {struct dirent *dent; -char buf[100 ]; +char buf[SYSFS_PATH_MAX +DNAME_PATH_MAX ];DIR *d;int fd;
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 128/246 regulator: core: Take lock before applying system load
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit e5e21f70bfd3a201e627b48aed82793d1bcd6f78 ]
Take the regulator lock before applying system load.
Fixes the following lockdep splat:
[ 5.583581] WARNING: CPU: 1 PID: 16 at drivers/regulator/core.c:925 drms_uA_update+0x114/0x360 [ 5.588467] Modules linked in: [ 5.596833] CPU: 1 PID: 16 Comm: kworker/1:0 Not tainted 5.0.0-rc6-next-20190213-00002-g0fce66ab480f #18 [ 5.599933] Hardware name: Qualcomm Technologies, Inc. APQ 8016 SBC (DT) [ 5.609544] Workqueue: events qcom_channel_state_worker [ 5.616209] pstate: 60000005 (nZCv daif -PAN -UAO) [ 5.621152] pc : drms_uA_update+0x114/0x360 [ 5.626006] lr : drms_uA_update+0x110/0x360 [ 5.630084] sp : ffff0000124b3490 [ 5.634242] x29: ffff0000124b3490 x28: ffff800005326e00 [ 5.637735] x27: ffff0000124b35f8 x26: 000000000032bc48 [ 5.643117] x25: ffff800004c7e800 x24: ffff800004c6d500 [ 5.648411] x23: ffff800004c38a80 x22: 00000000000000d1 [ 5.653706] x21: 00000000001ab3f0 x20: ffff800004c7e800 [ 5.659001] x19: ffff0000114c3000 x18: ffffffffffffffff [ 5.664297] x17: 0000000000000000 x16: 0000000000000000 [ 5.669592] x15: ffff0000114c3808 x14: 0720072007200720 [ 5.674888] x13: 00000000199c9b28 x12: ffff80002bcccc40 [ 5.680183] x11: ffff000012286000 x10: ffff0000114c3808 [ 5.685477] x9 : 0720072007200720 x8 : ffff000010e9e808 [ 5.690772] x7 : ffff0000106da568 x6 : 0000000000000000 [ 5.696067] x5 : 0000000000000000 x4 : 0000000000000000 [ 5.701362] x3 : 0000000000000004 x2 : 0000000000000000 [ 5.706658] x1 : 0000000000000000 x0 : 0000000000000000 [ 5.711952] Call trace: [ 5.717223] drms_uA_update+0x114/0x360 [ 5.719405] regulator_register+0xb30/0x1140 [ 5.723230] devm_regulator_register+0x4c/0xa8 [ 5.727745] rpm_reg_probe+0xfc/0x1b0 [ 5.731992] platform_drv_probe+0x50/0xa0 [ 5.735727] really_probe+0x20c/0x2b8 [ 5.739718] driver_probe_device+0x58/0x100 [ 5.743368] __device_attach_driver+0x90/0xd0 [ 5.747363] bus_for_each_drv+0x64/0xc8 [ 5.751870] __device_attach+0xd8/0x138 [ 5.755516] device_initial_probe+0x10/0x18 [ 5.759341] bus_probe_device+0x98/0xa0 [ 5.763502] device_add+0x3d0/0x640 [ 5.767319] of_device_add+0x48/0x58 [ 5.770793] of_platform_device_create_pdata+0xb0/0x128 [ 5.774629] of_platform_bus_create+0x174/0x370 [ 5.779569] of_platform_populate+0x78/0xe0 [ 5.784082] qcom_smd_rpm_probe+0x80/0xa0 [ 5.788245] rpmsg_dev_probe+0x114/0x1a0 [ 5.792411] really_probe+0x20c/0x2b8 [ 5.796401] driver_probe_device+0x58/0x100 [ 5.799964] __device_attach_driver+0x90/0xd0 [ 5.803960] bus_for_each_drv+0x64/0xc8 [ 5.808468] __device_attach+0xd8/0x138 [ 5.812115] device_initial_probe+0x10/0x18 [ 5.815936] bus_probe_device+0x98/0xa0 [ 5.820099] device_add+0x3d0/0x640 [ 5.823916] device_register+0x1c/0x28 [ 5.827391] rpmsg_register_device+0x4c/0x90 [ 5.831216] qcom_channel_state_worker+0x170/0x298 [ 5.835651] process_one_work+0x294/0x6e8 [ 5.840241] worker_thread+0x40/0x450 [ 5.844318] kthread+0x11c/0x120 [ 5.847961] ret_from_fork+0x10/0x18 [ 5.851260] irq event stamp: 9090 [ 5.854820] hardirqs last enabled at (9089): [<ffff000010160798>] console_unlock+0x3e0/0x5b0 [ 5.858086] hardirqs last disabled at (9090): [<ffff0000100817cc>] do_debug_exception+0x104/0x140 [ 5.866596] softirqs last enabled at (9086): [<ffff000010082024>] __do_softirq+0x474/0x574 [ 5.875446] softirqs last disabled at (9079): [<ffff0000100f2254>] irq_exit+0x13c/0x148 [ 5.883598] ---[ end trace 6984ef7f081afa21 ]---
--- drivers/regulator/core.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/regulator/core.c +2 -0
@@ -1349,7 +1349,9 @@ static int set_machine_constraints(struct regulator_dev *rdev,* We'll only apply the initial system load if an * initial mode wasn't specified. */ +regulator_lock (rdev);drms_uA_update (rdev); +regulator_unlock (rdev); } if ((rdev->constraints->ramp_delay || rdev->constraints->ramp_disable)
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 129/246 jbd2: fix race when writing superblock
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 538bcaa6261b77e71d37f5596c33127c1a3ec3f7 ]
The jbd2 superblock is lockless now, so there is probably a race condition between writing it so disk and modifing contents of it, which may lead to checksum error. The following race is the one case that we have captured.
jbd2 fsstressjbd2_journal_commit_transaction
jbd2_journal_update_sb_log_tail
jbd2_write_superblock
jbd2_superblock_csum_set jbd2_journal_revoke
jbd2_journal_set_features(revork) modify superblock
submit_bh(checksum incorrect)
Fix this by locking the buffer head before modifing it. We always write the jbd2 superblock after we modify it, so this just means calling the lock_buffer() a little earlier.
This checksum corruption problem can be reproduced by xfstests generic/475.
--- fs/jbd2/journal.c | 52 ++++++++++++++++++++++++----------------------- 1 file changed, 27 insertions(+), 25 deletions(-)
fs/jbd2/journal.c +27 -25
@@ -1356,6 +1356,10 @@ static int journal_reset(journal_t *journal)return jbd2_journal_start_thread (journal); } +/* +* This function expects that the caller will have locked the journal +* buffer head, and will return with it unlocked +*/ static int jbd2_write_superblock (journal_t *journal,int write_flags) {struct buffer_head *bh = journal->j_sb_buffer;
@@ -1365,7 +1369,6 @@ static int jbd2_write_superblock(journal_t *journal, int write_flags)trace_jbd2_write_superblock (journal, write_flags);if (!(journal->j_flags &JBD2_BARRIER )) write_flags &= ~(REQ_FUA |REQ_PREFLUSH ); -lock_buffer (bh);if (buffer_write_io_error (bh)) {/* * Oh, dear. A previous attempt to write the journal
@@ -1424,6 +1427,7 @@ int jbd2_journal_update_sb_log_tail(journal_t *journal, tid_t tail_tid,jbd_debug (1 ,"JBD2: updating superblock (start %lu, seq %u)\n" , tail_block, tail_tid); +lock_buffer (journal->j_sb_buffer); sb->s_sequence =cpu_to_be32 (tail_tid); sb->s_start =cpu_to_be32 (tail_block);
@@ -1454,18 +1458,17 @@ static void jbd2_mark_journal_empty(journal_t *journal, int write_op)journal_superblock_t *sb = journal->j_superblock;BUG_ON (!mutex_is_locked (&journal->j_checkpoint_mutex)); -read_lock (&journal->j_state_lock); -/* Is it already empty? */ -if (sb->s_start ==0 ) { -read_unlock (&journal->j_state_lock); +lock_buffer (journal->j_sb_buffer); +if (sb->s_start ==0 ) {/* Is it already empty? */ +unlock_buffer (journal->j_sb_buffer);return ; } +jbd_debug (1 ,"JBD2: Marking journal as empty (seq %d)\n" , journal->j_tail_sequence); sb->s_sequence =cpu_to_be32 (journal->j_tail_sequence); sb->s_start =cpu_to_be32 (0 ); -read_unlock (&journal->j_state_lock);jbd2_write_superblock (journal, write_op);
@@ -1488,9 +1491,8 @@ void jbd2_journal_update_sb_errno(journal_t *journal)journal_superblock_t *sb = journal->j_superblock;int errcode; -read_lock (&journal->j_state_lock); +lock_buffer (journal->j_sb_buffer); errcode = journal->j_errno; -read_unlock (&journal->j_state_lock);if (errcode == -ESHUTDOWN ) errcode =0 ;jbd_debug (1 ,"JBD2: updating superblock error (errno %d)\n" , errcode);
@@ -1894,28 +1896,27 @@ int jbd2_journal_set_features (journal_t *journal, unsigned long compat, sb = journal->j_superblock; +/* Load the checksum driver if necessary */ +if ((journal->j_chksum_driver ==NULL ) && +INCOMPAT_FEATURE_ON (JBD2_FEATURE_INCOMPAT_CSUM_V3 )) { + journal->j_chksum_driver =crypto_alloc_shash ("crc32c" ,0 ,0 ); +if (IS_ERR (journal->j_chksum_driver)) { +printk (KERN_ERR "JBD2: Cannot load crc32c driver.\n" ); + journal->j_chksum_driver =NULL ; +return 0 ; + } +/* Precompute checksum seed for all metadata */ + journal->j_csum_seed =jbd2_chksum (journal, ~0 , sb->s_uuid, +sizeof (sb->s_uuid)); + } + +lock_buffer (journal->j_sb_buffer); +/* If enabling v3 checksums, update superblock */ if (INCOMPAT_FEATURE_ON (JBD2_FEATURE_INCOMPAT_CSUM_V3 )) { sb->s_checksum_type =JBD2_CRC32C_CHKSUM ; sb->s_feature_compat &= ~cpu_to_be32 (JBD2_FEATURE_COMPAT_CHECKSUM ); - -/* Load the checksum driver */ -if (journal->j_chksum_driver ==NULL ) { - journal->j_chksum_driver =crypto_alloc_shash ("crc32c" , -0 ,0 ); -if (IS_ERR (journal->j_chksum_driver)) { -printk (KERN_ERR "JBD2: Cannot load crc32c " -"driver.\n" ); - journal->j_chksum_driver =NULL ; -return 0 ; - } - -/* Precompute checksum seed for all metadata */ - journal->j_csum_seed =jbd2_chksum (journal, ~0 , - sb->s_uuid, -sizeof (sb->s_uuid)); - } }/* If enabling v1 checksums, downgrade superblock */
@@ -1927,6 +1928,7 @@ int jbd2_journal_set_features (journal_t *journal, unsigned long compat, sb->s_feature_compat |=cpu_to_be32 (compat); sb->s_feature_ro_compat |=cpu_to_be32 (ro); sb->s_feature_incompat |=cpu_to_be32 (incompat); +unlock_buffer (journal->j_sb_buffer);return 1 ;#undef COMPAT_FEATURE_ON
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 131/246 tools build: Add -lrt to FEATURE_CHECK_LDFLAGS-libaio
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit aa8f9c517ebce7a0959da064ef2660ea03f133f8 ]
Since we need it to resolve the AIO symbols, otherwise we fail with:
$ cat /tmp/build/perf/feature/test-all.make.output /usr/bin/ld: /tmp/ccEqrj36.o: undefined reference to symbol 'aio_return64@@GLIBC_2.2.5' /usr/bin/ld: //usr/lib64/librt.so.1: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status $
When we added the aio support in 'perf record' only the test-libaio.bin target got the -lrt, i.e. the feature detection slow path. Fix it.
--- tools/perf/Makefile.config | 2 ++ 1 file changed, 2 insertions(+)
tools/perf/Makefile.config +2 -0
@@ -218,6 +218,8 @@ FEATURE_CHECK_LDFLAGS-libpython := $(PYTHON_EMBED_LDOPTS) FEATURE_CHECK_CFLAGS-libpython-version := $(PYTHON_EMBED_CCOPTS) FEATURE_CHECK_LDFLAGS-libpython-version := $(PYTHON_EMBED_LDOPTS) +FEATURE_CHECK_LDFLAGS-libaio = -lrt + CFLAGS += -fno-omit-frame-pointer CFLAGS += -ggdb3 CFLAGS += -funwind-tables
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 132/246 tools build: Add test-reallocarray.c to test-all.c to fix the build
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit a96c03e8cdcf123384319f312d0a08a7a760bb35 ]
When a test is in the FEATURE_TESTS_BASIC list in tools/build/Makefile.feature must be added to tools/build/feature/test-all.c, because the successfull compilation and linking of that test-all.bin file means that all the features listed in FEATURE_TESTS_BASIC are present in the system, so we don't have to go on feature by feature test building them.
Since reallocarray() is expected to be present in modern systems, it has a place in FEATURE_TESTS_BASIC, so that we speed up the build process building just that file.
For older systems, such as ubuntu:16.04 (build failure reported by Jin Yao) debian:8, and for the current flagship RHEL distro, RHEL7, the build will fail as test-all.bin (without test-reallocarray.c included) passes but reallocarray() isn't present, making the build fail with:
CC /tmp/build/perf/libbpf.o
MKDIR /tmp/build/perf/fs/
CC /tmp/build/perf/fs/tracing_path.o
LD /tmp/build/perf/fd/libapi-in.o
CC /tmp/build/perf/bpf.o
libbpf.c: In function 'bpf_object__add_program':
libbpf.c:367:10: error: implicit declaration of function 'reallocarray' [-Werror=implicit-function-declaration]
progs = reallocarray(progs, nr_progs + 1, sizeof(progs[0]));
^
libbpf.c:367:2: error: nested extern declaration of 'reallocarray' [-Werror=nested-externs]
progs = reallocarray(progs, nr_progs + 1, sizeof(progs[0]));
^
libbpf.c:367:8: error: assignment makes pointer from integer without a cast [-Werror=int-conversion]
progs = reallocarray(progs, nr_progs + 1, sizeof(progs[0]));
^
libbpf.c: In function 'bpf_object__elf_collect':
libbpf.c:887:10: error: assignment makes pointer from integer without a cast [-Werror=int-conversion]
reloc = reallocarray(reloc, nr_reloc,
^
libbpf.c: In function 'bpf_program__reloc_text':
libbpf.c:1394:12: error: assignment makes pointer from integer without a cast [-Werror=int-conversion]
new_insn = reallocarray(prog->insns, new_cnt, sizeof(*insn));
^
CC /tmp/build/perf/nlattr.oEven with:
$ grep reallocarray /tmp/build/perf/FEATURE-DUMP feature-reallocarray=1 $
Which ubuntu:16.04.5 LTS doesn't have:
perfbuilder@38a153a1bba8:/$ head -2 /etc/os-release NAME="Ubuntu" VERSION="16.04.5 LTS (Xenial Xerus)" perfbuilder@38a153a1bba8:/$ find /usr/include/ -name "*.h" | xargs grep -w reallocarray perfbuilder@38a153a1bba8:/$
Fix it by including it to test-all.c, which ends up forcing the individual tests to be triggered and for the build process to notice that indeed reallocarray() is not there:
perfbuilder@38a153a1bba8:/$ cat /tmp/build/perf/feature/test-all.make.output
In file included from test-all.c:178:0:
test-reallocarray.c: In function 'main_test_reallocarray':
test-reallocarray.c:7:11: error: implicit declaration of function 'reallocarray' [-Werror=implicit-function-declaration]
return !!reallocarray(NULL, 1, 1);
^
cc1: all warnings being treated as errors
perfbuilder@38a153a1bba8:/$That is the only test that is failing on Ubuntu 16.03.5 LTS, so all tests are forced:
perfbuilder@38a153a1bba8:/tmp/build/perf/feature$ ls -lSr *.make.output <SNIP successful tests> -rw-r--r--. 1 perfbuilder perfbuilder 0 Feb 14 15:00 test-dwarf.make.output -rw-r--r--. 1 perfbuilder perfbuilder 0 Feb 14 14:16 test-cplus-demangle.make.output -rw-r--r--. 1 perfbuilder perfbuilder 0 Feb 14 15:00 test-bpf.make.output -rw-r--r--. 1 perfbuilder perfbuilder 0 Feb 14 15:00 test-backtrace.make.output -rw-r--r--. 1 perfbuilder perfbuilder 104 Feb 14 15:00 test-bionic.make.output -rw-r--r--. 1 perfbuilder perfbuilder 107 Feb 14 15:00 test-libunwind-x86.make.output -rw-r--r--. 1 perfbuilder perfbuilder 115 Feb 14 15:00 test-libunwind-aarch64.make.output -rw-r--r--. 1 perfbuilder perfbuilder 122 Feb 14 15:00 test-libbabeltrace.make.output -rw-r--r--. 1 perfbuilder perfbuilder 254 Feb 14 15:00 test-reallocarray.make.output -rw-r--r--. 1 perfbuilder perfbuilder 312 Feb 14 15:00 test-all.make.output perfbuilder@38a153a1bba8:/tmp/build/perf/feature$
And that reallocarray() one shows:
perfbuilder@38a153a1bba8:/tmp/build/perf/feature$ cat test-reallocarray.make.output
test-reallocarray.c: In function 'main':
test-reallocarray.c:7:11: error: implicit declaration of function 'reallocarray' [-Werror=implicit-function-declaration]
return !!reallocarray(NULL, 1, 1);
^
cc1: all warnings being treated as errors
perfbuilder@38a153a1bba8:/tmp/build/perf/feature$Which now generates the expected result:
perfbuilder@38a153a1bba8:~$ grep reallocarray /tmp/build/perf/FEATURE-DUMP feature-reallocarray=0 perfbuilder@38a153a1bba8:~$
The fallback mechanism kicks in and libbpf and perf are again buildable in systems without reallocarray():
$ cat tools/include/tools/libc_compat.h // SPDX-License-Identifier: (LGPL-2.0+ OR BSD-2-Clause) /* Copyright (C) 2018 Netronome Systems, Inc. */
#ifndef __TOOLS_LIBC_COMPAT_H #define __TOOLS_LIBC_COMPAT_H #include <stdlib.h> #include <linux/overflow.h>
#ifdef COMPAT_NEED_REALLOCARRAY
static inline void *reallocarray(void *ptr, size_t nmemb, size_t size)
{
size_t bytes;
if (unlikely(check_mul_overflow(nmemb, size, &bytes)))
return NULL;
return realloc(ptr, bytes); }
#endif
#endif
$
--- tools/build/feature/test-all.c | 5 +++++ tools/build/feature/test-reallocarray.c | 2 ++ 2 files changed, 7 insertions(+)
tools/build/feature/test-all.c +5 -0
@@ -178,6 +178,10 @@# include "test-libaio.c" #undef main +#define main main_test_reallocarray +# include "test-reallocarray.c" +#undef main +int main (int argc,char *argv[]) {main_test_libpython ();
@@ -219,6 +223,7 @@ int main(int argc, char *argv[])main_test_setns ();main_test_libopencsd ();main_test_libaio (); +main_test_reallocarray ();return 0 ; }
tools/build/feature/test-reallocarray.c +2 -0
@@ -6,3 +6,5 @@ int main(void) {return !!reallocarray (NULL ,1 ,1 ); } + +#undef _GNU_SOURCE
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 133/246 perf beauty waitid options: Fix up prefix showing logic
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 1da7e0022784b0e05b49bf73521fa2cc4633af85 ]
When introducing the possibility for selecting if the common prefix to options such as the waitid ones, i.e. all 'waitid' options start with 'W', so, to make it make it more compact if configured to suppress it, 'perf trace' will do so, other examples include mmap's PROT_ prefix for its 'prot' argument, etc, which, when showing the syscall argument name ends up producing duplicated info that clutters the screen, i.e.:
# perf trace -e mmap --max-events 2 sleep 1
0.000 ( 0.014 ms): sleep/20886 mmap(len: 112595, prot: PROT_READ, flags: MAP_PRIVATE, fd: 3) = 0x7f3e986d2000
0.041 ( 0.005 ms): sleep/20886 mmap(len: 8192, prot: PROT_READ|PROT_WRITE, flags: MAP_PRIVATE|MAP_ANONYMOUS) = 0x7f3e986d0000
#So it is possible to suppress that and make it more compact by having this in your ~/.perfconfig:
# cat ~/.perfconfig [trace] show_prefix = no #
# perf trace -e mmap --max-events 2 sleep 1
0.000 ( 0.014 ms): sleep/8009 mmap(len: 112595, prot: READ, flags: PRIVATE, fd: 3) = 0x7ff2373de000
0.040 ( 0.005 ms): sleep/8009 mmap(len: 8192, prot: READ|WRITE, flags: PRIVATE|ANONYMOUS) = 0x7ff2373dc000
#To have it look more like strace's output, we instead want to suppress the arg name and show the prefix, so use:
# cat ~/.perfconfig
[trace]
show_prefix = yes
show_arg_names = no
#
# perf trace -e mmap --max-events 2 sleep 1
0.000 ( 0.006 ms): sleep/15513 mmap(NULL, 112595, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f7a9b6d3000
0.020 ( 0.002 ms): sleep/15513 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS) = 0x7f7a9b6d1000
#When this logic was introduced a bug came with it when processing the waitid 'option' arg that ended up expecting 3 strings when just two were being provided, fix it.
--- tools/perf/trace/beauty/waitid_options.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/trace/beauty/waitid_options.c +1 -1
@@ -11,7 +11,7 @@ static size_t syscall_arg__scnprintf_waitid_options(char *bf, size_t size,#define P_OPTION (n) \ if (options & W##n) { \ - printed += scnprintf(bf + printed, size - printed, "%s%s%s", printed ? "|" : "", show_prefix ? prefix : #n); \ + printed += scnprintf(bf + printed, size - printed, "%s%s%s", printed ? "|" : "", show_prefix ? prefix : "", #n); \ options &= ~W##n; \ }
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 125/246 cgroup, rstat: Dont flush subtree root unless necessary
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit b4ff1b44bcd384d22fcbac6ebaf9cc0d33debe50 ]
cgroup_rstat_cpu_pop_updated() is used to traverse the updated cgroups on flush. While it was only visiting updated ones in the subtree, it was visiting @root unconditionally. We can easily check whether @root is updated or not by looking at its ->updated_next just as with the cgroups in the subtree.
* Remove the unnecessary cgroup_parent() test. The system root cgroup is never updated and thus its ->updated_next is always NULL. No need to test whether cgroup_parent() exists in addition to ->updated_next.
* Terminate traverse if ->updated_next is NULL. This can only happen for subtree @root and there's no reason to visit it if it's not marked updated.
This reduces cpu consumption when reading a lot of rstat backed files. In a micro benchmark reading stat from ~1600 cgroups, the sys time was lowered by >40%.
--- kernel/cgroup/rstat.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
kernel/cgroup/rstat.c +6 -4
@@ -87,7 +87,6 @@ static struct cgroup *cgroup_rstat_cpu_pop_updated(struct cgroup *pos, struct cgroup *root, int cpu) {struct cgroup_rstat_cpu *rstatc; -struct cgroup *parent;if (pos == root)return NULL ;
@@ -115,8 +114,8 @@ static struct cgroup *cgroup_rstat_cpu_pop_updated(struct cgroup *pos,* However, due to the way we traverse, @pos will be the first * child in most cases. The only exception is @root. */ - parent =cgroup_parent (pos); -if (parent && rstatc->updated_next) { +if (rstatc->updated_next) { +struct cgroup *parent =cgroup_parent (pos);struct cgroup_rstat_cpu *prstatc =cgroup_rstat_cpu (parent, cpu);struct cgroup_rstat_cpu *nrstatc;struct cgroup **nextp;
@@ -140,9 +139,12 @@ static struct cgroup *cgroup_rstat_cpu_pop_updated(struct cgroup *pos,* updated stat. */ smp_mb (); + +return pos; } -return pos; +/* only happens for @root */ +return NULL ; }/* see cgroup_rstat_flush() */
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 134/246 perf trace: Check if the fd is negative when mapping it to pathname
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 051074867434cc520c08f188479d4757dcfdaef8 ]
We were crashing when processing a negative fd:
Program received signal SIGSEGV, Segmentation fault.
0x0000000000609bbf in syscall_arg__scnprintf_ioctl_cmd (bf=0x1172eca "", size=2038, arg=0x7fffffff8360) at trace/beauty/ioctl.c:182
182 if (file->dev_maj == USB_DEVICE_MAJOR)
Missing separate debuginfos, use: dnf debuginfo-install bzip2-libs-1.0.6-28.fc29.x86_64 elfutils-libelf-0.174-5.fc29.x86_64 elfutils-libs-0.174-5.fc29.x86_64 glib2-2.58.3-1.fc29.x86_64 libbabeltrace-1.5.6-1.fc29.x86_64 libunwind-1.2.1-6.fc29.x86_64 libuuid-2.32.1-1.fc29.x86_64 libxcrypt-4.4.3-2.fc29.x86_64 numactl-libs-2.0.12-1.fc29.x86_64 openssl-libs-1.1.1a-1.fc29.x86_64 pcre-8.42-6.fc29.x86_64 perl-libs-5.28.1-427.fc29.x86_64 popt-1.16-15.fc29.x86_64 python2-libs-2.7.15-11.fc29.x86_64 slang-2.3.2-4.fc29.x86_64 xz-libs-5.2.4-3.fc29.x86_64 (gdb) bt
#0 0x0000000000609bbf in syscall_arg__scnprintf_ioctl_cmd (bf=0x1172eca "", size=2038, arg=0x7fffffff8360) at trace/beauty/ioctl.c:182
#1 0x000000000048e295 in syscall__scnprintf_val (sc=0x123b500, bf=0x1172eca "", size=2038, arg=0x7fffffff8360, val=21519)
at builtin-trace.c:1594
#2 0x000000000048e60d in syscall__scnprintf_args (sc=0x123b500, bf=0x1172ec6 "-1, ", size=2042, args=0x7ffff6a7c034 "\377\377\377\377",
augmented_args=0x7ffff6a7c064, augmented_args_size=4, trace=0x7fffffffa8d0, thread=0x1175cd0) at builtin-trace.c:1661
#3 0x000000000048f04e in trace__sys_enter (trace=0x7fffffffa8d0, evsel=0xb260b0, event=0x7ffff6a7bfe8, sample=0x7fffffff84f0)
at builtin-trace.c:1880
#4 0x00000000004915a4 in trace__handle_event (trace=0x7fffffffa8d0, event=0x7ffff6a7bfe8, sample=0x7fffffff84f0) at builtin-trace.c:2590
#5 0x0000000000491eed in __trace__deliver_event (trace=0x7fffffffa8d0, event=0x7ffff6a7bfe8) at builtin-trace.c:2818
#6 0x0000000000492030 in trace__deliver_event (trace=0x7fffffffa8d0, event=0x7ffff6a7bfe8) at builtin-trace.c:2845
#7 0x0000000000492896 in trace__run (trace=0x7fffffffa8d0, argc=0, argv=0x7fffffffdb58) at builtin-trace.c:3040
#8 0x000000000049603a in cmd_trace (argc=0, argv=0x7fffffffdb58) at builtin-trace.c:3952
#9 0x00000000004d5103 in main (argc=1, argv=0x7fffffffdb58) at perf.c:474 (gdb) p fd
$1 = -1
(gdb) p file
$7 = (struct file *) 0xfffffffffffffff0
(gdb) p ((struct thread_trace *)arg->thread)->files.table + fd $8 = (struct file *) 0xfffffffffffffff0
(gdb)
Check for that and return NULL instead.
This problem was introduced recently, the other codepaths leading to thread_trace__files_entry() check for negative fds, like thread__fd_path(), but we need to do it at thread_trace__files_entry() as more users are now calling it directly.
--- tools/perf/builtin-trace.c | 3 +++ 1 file changed, 3 insertions(+)
tools/perf/builtin-trace.c +3 -0
@@ -1039,6 +1039,9 @@ static const size_t trace__entry_str_size = 2048;static struct file *thread_trace__files_entry (struct thread_trace *ttrace,int fd) { +if (fd <0 ) +return NULL ; +if (fd > ttrace->files.max) {struct file *nfiles =realloc (ttrace->files.table, (fd +1 ) *sizeof (struct file ));
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 152/246 bcache: fix potential div-zero error of writeback_rate_i_term_inverse
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit c3b75a2199cdbfc1c335155fe143d842604b1baa ]
dc->writeback_rate_i_term_inverse can be set via sysfs interface. It is in type unsigned int, and convert from input string by d_strtoul(). The problem is d_strtoul() does not check valid range of the input, if 4294967296 is written into sysfs file writeback_rate_i_term_inverse, an overflow of unsigned integer will happen and value 0 is set to dc->writeback_rate_i_term_inverse.
In writeback.c:__update_writeback_rate(), there are following lines of code,
integral_scaled = div_s64(dc->writeback_rate_integral,
dc->writeback_rate_i_term_inverse);If dc->writeback_rate_i_term_inverse is set to 0 via sysfs interface, a div-zero error might be triggered in the above code.
Therefore we need to add a range limitation in the sysfs interface, this is what this patch does, use sysfs_stroul_clamp() to replace d_strtoul() and restrict the input range in [1, UINT_MAX].
--- drivers/md/bcache/sysfs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/md/bcache/sysfs.c +3 -1
@@ -287,7 +287,9 @@ STORE(__cached_dev)sysfs_strtoul_clamp (writeback_rate_update_seconds, dc->writeback_rate_update_seconds,1 ,WRITEBACK_RATE_UPDATE_SECS_MAX ); -d_strtoul (writeback_rate_i_term_inverse); +sysfs_strtoul_clamp (writeback_rate_i_term_inverse, + dc->writeback_rate_i_term_inverse, +1 ,UINT_MAX );d_strtoul_nonzero (writeback_rate_p_term_inverse);d_strtoul_nonzero (writeback_rate_minimum);
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 153/246 bcache: improve sysfs_strtoul_clamp()
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 596b5a5dd1bc2fa019fdaaae522ef331deef927f ]
Currently sysfs_strtoul_clamp() is defined as,
82 #define sysfs_strtoul_clamp(file, var, min, max) \
83 do { \
84 if (attr == &sysfs_ ## file) \
85 return strtoul_safe_clamp(buf, var, min, max) \
86 ?: (ssize_t) size; \87 } while (0)
The problem is, if bit width of var is less then unsigned long, min and max may not protect var from integer overflow, because overflow happens in strtoul_safe_clamp() before checking min and max.
To fix such overflow in sysfs_strtoul_clamp(), to make min and max take effect, this patch adds an unsigned long variable, and uses it to macro strtoul_safe_clamp() to convert an unsigned long value in range defined by [min, max]. Then assign this value to var. By this method, if bit width of var is less than unsigned long, integer overflow won't happen before min and max are checking.
Now sysfs_strtoul_clamp() can properly handle smaller data type like unsigned int, of cause min and max should be defined in range of unsigned int too.
--- drivers/md/bcache/sysfs.h | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/md/bcache/sysfs.h +10 -3
@@ -81,9 +81,16 @@ do { \#define sysfs_strtoul_clamp (file, var, min, max) \ do { \ - if (attr == &sysfs_ ## file) \ - return strtoul_safe_clamp(buf, var, min, max) \ - ?: (ssize_t) size; \ + if (attr == &sysfs_ ## file) { \ + unsigned long v = 0; \ + ssize_t ret; \ + ret = strtoul_safe_clamp(buf, v, min, max); \ + if (!ret) { \ + var = v; \ + return size; \ + } \ + return ret; \ + } \ } while (0)#define strtoul_or_return (cp) \
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 154/246 genirq: Avoid summation loops for /proc/stat
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 1136b0728969901a091f0471968b2b76ed14d9ad ]
Waiman reported that on large systems with a large amount of interrupts the readout of /proc/stat takes a long time to sum up the interrupt statistics. In principle this is not a problem. but for unknown reasons some enterprise quality software reads /proc/stat with a high frequency.
The reason for this is that interrupt statistics are accounted per cpu. So the /proc/stat logic has to sum up the interrupt stats for each interrupt.
This can be largely avoided for interrupts which are not marked as 'PER_CPU' interrupts by simply adding a per interrupt summation counter which is incremented along with the per interrupt per cpu counter.
The PER_CPU interrupts need to avoid that and use only per cpu accounting because they share the interrupt number and the interrupt descriptor and concurrent updates would conflict or require unwanted synchronization.
8<-------------
v2: Undo the unintentional layout change of struct irq_desc.
include/linux/irqdesc.h | 1 + kernel/irq/chip.c | 12 ++++++++++-- kernel/irq/internals.h | 8 +++++++- kernel/irq/irqdesc.c | 7 ++++++- 4 files changed, 24 insertions(+), 4 deletions(-)
--- include/linux/irqdesc.h | 1 + kernel/irq/chip.c | 12 ++++++++++-- kernel/irq/internals.h | 8 +++++++- kernel/irq/irqdesc.c | 7 ++++++- 4 files changed, 24 insertions(+), 4 deletions(-)
include/linux/irqdesc.h +1 -0
@@ -65,6 +65,7 @@ struct irq_desc {unsigned int core_internal_state__do_not_mess_with_it;unsigned int depth;/* nested irq disables */ unsigned int wake_depth;/* nested wake enables */ +unsigned int tot_count;unsigned int irq_count;/* For detecting broken IRQs */ unsigned long last_unhandled;/* Aging timer for unhandled count */ unsigned int irqs_unhandled;
kernel/irq/chip.c +10 -2
@@ -855,7 +855,11 @@ void handle_percpu_irq(struct irq_desc *desc) {struct irq_chip *chip =irq_desc_get_chip (desc); -kstat_incr_irqs_this_cpu (desc); +/* +* PER CPU interrupts are not serialized. Do not touch +* desc->tot_count. +*/ +__kstat_incr_irqs_this_cpu (desc);if (chip->irq_ack) chip->irq_ack (&desc->irq_data);
@@ -884,7 +888,11 @@ void handle_percpu_devid_irq(struct irq_desc *desc)unsigned int irq =irq_desc_get_irq (desc);irqreturn_t res; -kstat_incr_irqs_this_cpu (desc); +/* +* PER CPU interrupts are not serialized. Do not touch +* desc->tot_count. +*/ +__kstat_incr_irqs_this_cpu (desc);if (chip->irq_ack) chip->irq_ack (&desc->irq_data);
kernel/irq/internals.h +7 -1
@@ -242,12 +242,18 @@ static inline void irq_state_set_masked(struct irq_desc *desc)#undef __irqd_to_state -static inline void kstat_incr_irqs_this_cpu (struct irq_desc *desc) +static inline void __kstat_incr_irqs_this_cpu (struct irq_desc *desc) {__this_cpu_inc (*desc->kstat_irqs);__this_cpu_inc (kstat.irqs_sum); } +static inline void kstat_incr_irqs_this_cpu (struct irq_desc *desc) +{ +__kstat_incr_irqs_this_cpu (desc); + desc->tot_count++; +} +static inline int irq_desc_get_node (struct irq_desc *desc) {return irq_common_data_get_node (&desc->irq_common_data);
kernel/irq/irqdesc.c +6 -1
@@ -119,6 +119,7 @@ static void desc_set_defaults(unsigned int irq, struct irq_desc *desc, int node, desc->depth =1 ; desc->irq_count =0 ; desc->irqs_unhandled =0 ; + desc->tot_count =0 ; desc->name =NULL ; desc->owner = owner;for_each_possible_cpu (cpu)
@@ -919,11 +920,15 @@ unsigned int kstat_irqs_cpu(unsigned int irq, int cpu)unsigned int kstat_irqs (unsigned int irq) {struct irq_desc *desc =irq_to_desc (irq); -int cpu;unsigned int sum =0 ; +int cpu;if (!desc || !desc->kstat_irqs)return 0 ; +if (!irq_settings_is_per_cpu_devid (desc) && + !irq_settings_is_per_cpu (desc)) +return desc->tot_count; +for_each_possible_cpu (cpu) sum += *per_cpu_ptr (desc->kstat_irqs, cpu);return sum;
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 142/246 kprobes: Prohibit probing on RCU debug routine
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit a39f15b9644fac3f950f522c39e667c3af25c588 ]
Since kprobe itself depends on RCU, probing on RCU debug routine can cause recursive breakpoint bugs.
Prohibit probing on RCU debug routines.
int3
->do_int3()
->ist_enter()
->RCU_LOCKDEP_WARN()
->debug_lockdep_rcu_enabled() -> int3--- kernel/rcu/update.c | 2 ++ 1 file changed, 2 insertions(+)
kernel/rcu/update.c +2 -0
@@ -52,6 +52,7 @@#include <linux/tick.h> #include <linux/rcupdate_wait.h> #include <linux/sched/isolation.h> +#include <linux/kprobes.h> #define CREATE_TRACE_POINTS
@@ -249,6 +250,7 @@ int notrace debug_lockdep_rcu_enabled(void) current->lockdep_recursion ==0 ; }EXPORT_SYMBOL_GPL (debug_lockdep_rcu_enabled); +NOKPROBE_SYMBOL (debug_lockdep_rcu_enabled);/** * rcu_read_lock_held() - might we be in RCU read-side critical section?
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 146/246 ALSA: PCM: check if ops are defined before suspending PCM
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit d9c0b2afe820fa3b3f8258a659daee2cc71ca3ef ]
BE dai links only have internal PCM's and their substream ops may not be set. Suspending these PCM's will result in their
ops->trigger() being invoked and cause a kernel oops.
So skip suspending PCM's if their ops are NULL.
[ NOTE: this change is required now for following the recent PCM core
change to get rid of snd_pcm_suspend() call. Since DPCM BE takes the runtime carried from FE while keeping NULL ops, it can hit this bug. See details at:
https://github.com/thesofproject/linux/pull/582
-- tiwai ]
--- sound/core/pcm_native.c | 8 ++++++++ 1 file changed, 8 insertions(+)
sound/core/pcm_native.c +8 -0
@@ -1513,6 +1513,14 @@ int snd_pcm_suspend_all(struct snd_pcm *pcm)/* FIXME: the open/close code should lock this as well */ if (substream->runtime ==NULL )continue ; + +/* +* Skip BE dai link PCM's that are internal and may +* not have their substream ops set. +*/ +if (!substream->ops) +continue ; + err =snd_pcm_suspend (substream);if (err <0 && err != -EBUSY )return err;
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 147/246 ath10k: fix shadow register implementation for WCN3990
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 1863008369ae0407508033b4b00f98b985adeb15 ]
WCN3990 supports shadow registers write operation support for copy engine for regular operation in powersave mode.
Since WCN3990 is a 64-bit target, the shadow register implementation needs to be done in the copy engine handlers for 64-bit target. Currently the shadow register implementation is present in the 32-bit target handlers of copy engine.
Fix the shadow register copy engine write operation implementation for 64-bit target(WCN3990).
Tested HW: WCN3990
Tested FW: WLAN.HL.2.0-01188-QCAHLSWMTPLZ-1
--- drivers/net/wireless/ath/ath10k/ce.c | 26 +++++++++++++------------- drivers/net/wireless/ath/ath10k/ce.h | 2 +- 2 files changed, 14 insertions(+), 14 deletions(-)
drivers/net/wireless/ath/ath10k/ce.c +13 -13
@@ -500,14 +500,8 @@ static int _ath10k_ce_send_nolock(struct ath10k_ce_pipe *ce_state, write_index =CE_RING_IDX_INCR (nentries_mask, write_index);/* WORKAROUND */ -if (!(flags &CE_SEND_FLAG_GATHER )) { -if (ar->hw_params.shadow_reg_support) -ath10k_ce_shadow_src_ring_write_index_set (ar, ce_state, - write_index); -else -ath10k_ce_src_ring_write_index_set (ar, ctrl_addr, - write_index); - } +if (!(flags &CE_SEND_FLAG_GATHER )) +ath10k_ce_src_ring_write_index_set (ar, ctrl_addr, write_index); src_ring->write_index = write_index; exit:
@@ -581,8 +575,14 @@ static int _ath10k_ce_send_nolock_64(struct ath10k_ce_pipe *ce_state,/* Update Source Ring Write Index */ write_index =CE_RING_IDX_INCR (nentries_mask, write_index); -if (!(flags &CE_SEND_FLAG_GATHER )) -ath10k_ce_src_ring_write_index_set (ar, ctrl_addr, write_index); +if (!(flags &CE_SEND_FLAG_GATHER )) { +if (ar->hw_params.shadow_reg_support) +ath10k_ce_shadow_src_ring_write_index_set (ar, ce_state, + write_index); +else +ath10k_ce_src_ring_write_index_set (ar, ctrl_addr, + write_index); + } src_ring->write_index = write_index; exit:
@@ -1404,12 +1404,12 @@ static int ath10k_ce_alloc_shadow_base(struct ath10k *ar, u32 nentries) { src_ring->shadow_base_unaligned =kcalloc (nentries, -sizeof (struct ce_desc ), +sizeof (struct ce_desc_64 ),GFP_KERNEL );if (!src_ring->shadow_base_unaligned)return -ENOMEM ; - src_ring->shadow_base = (struct ce_desc *) + src_ring->shadow_base = (struct ce_desc_64 *)PTR_ALIGN (src_ring->shadow_base_unaligned,CE_DESC_RING_ALIGN );return 0 ;
@@ -1461,7 +1461,7 @@ ath10k_ce_alloc_src_ring(struct ath10k *ar, unsigned int ce_id, ret =ath10k_ce_alloc_shadow_base (ar, src_ring, nentries);if (ret) {dma_free_coherent (ar->dev, - (nentries *sizeof (struct ce_desc ) + + (nentries *sizeof (struct ce_desc_64 ) +CE_DESC_RING_ALIGN ), src_ring->base_addr_owner_space_unaligned, base_addr);
drivers/net/wireless/ath/ath10k/ce.h +1 -1
@@ -118,7 +118,7 @@ struct ath10k_ce_ring {u32 base_addr_ce_space;char *shadow_base_unaligned; -struct ce_desc *shadow_base; +struct ce_desc_64 *shadow_base;/* keep last */ void *per_transfer_context[0 ];
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 140/246 selftests: skip seccomp get_metadata test if not real root
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 3aa415dd2128e478ea3225b59308766de0e94d6b ]
The get_metadata() test requires real root, so let's skip it if we're not real root.
Note that I used XFAIL here because that's what the test does later if CONFIG_CHEKCKPOINT_RESTORE happens to not be enabled. After looking at the code, there doesn't seem to be a nice way to skip tests defined as TEST(), since there's no return code (I tried exit(KSFT_SKIP), but that didn't work either...). So let's do it this way to be consistent, and easier to fix when someone comes along and fixes it.
--- tools/testing/selftests/seccomp/seccomp_bpf.c | 6 ++++++ 1 file changed, 6 insertions(+)
tools/testing/selftests/seccomp/seccomp_bpf.c +6 -0
@@ -2971,6 +2971,12 @@ TEST(get_metadata)struct seccomp_metadata md;long ret; +/* Only real root can get metadata. */ +if (geteuid ()) { +XFAIL (return,"get_metadata requires real root" ); +return ; + } +ASSERT_EQ (0 ,pipe (pipefd)); pid =fork ();
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 165/246 drm/amd/display: Disconnect mpcc when changing tg
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 77476360f173c127c191bfe8ca8113130ef283b8 ]
[Why]
This fixes an mpc programming error for the following sequence of atomic commits when pipe split is enabled:
Commit 1: CRTC0 (plane 4, plane 3)
Pipe 0: old_plane_state = A0, new_plane_state = A1, new_tg = T0
Pipe 1: old_plane_state = B0, new_plane_state = B1, new_tg = T0
Pipe 2: old_plane_state = A0, new_plane_state = A1, new_tg = T0
Pipe 3: old_plane_state = B0, new_plane_state = B1, new_tg = T0
Commit 2: CRTC0 (plane 3), CRTC1 (plane 2)
Pipe 0: old_plane_state = A1, new_plane_state = A2, new_tg = T0
Pipe 1: old_plane_state = B1, new_plane_state = B2, new_tg = T1
Pipe 2: old_plane_state = A1, new_plane_state = NULL, new_tg = NULL Pipe 3: old_plane_state = B1, new_plane_state = NULL, new_tg = NULL
In the second commit the assertion for mpcc in use is hit because mpcc disconnect never occurs for pipe 1. This is because the stream changes for pipe 1 and the opp_list is empty.
This sequence occurs when running the "igt@kms_plane_multiple@atomic-pipe-A-tiling-none" test with two displays connected.
[How]
Expand the reset condition to include:
"old_pipe_ctx->stream_res.tg != new_pipe_ctx->stream_res.tg"
...but only when the plane state is non-NULL for both old and new.
--- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +4 -3
@@ -2334,9 +2334,10 @@ static void dcn10_apply_ctx_for_surface( } } -if (!pipe_ctx->plane_state && - old_pipe_ctx->plane_state && - old_pipe_ctx->stream_res.tg == tg) { +if ((!pipe_ctx->plane_state || + pipe_ctx->stream_res.tg != old_pipe_ctx->stream_res.tg) && + old_pipe_ctx->plane_state && + old_pipe_ctx->stream_res.tg == tg) { dc->hwss.plane_atomic_disconnect (dc, old_pipe_ctx); removed_pipe[i] = true;
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 168/246 e1000e: Exclude device from suspend direct complete optimization
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 59f58708c5047289589cbf6ee95146b76cf57d1e ]
e1000e sets different WoL settings in system suspend callback and runtime suspend callback.
The suspend direct complete optimization leaves e1000e in runtime suspended state with wrong WoL setting during system suspend.
To fix this, we need to disable suspend direct complete optimization to let e1000e always use suspend callback to set correct WoL during system suspend.
--- drivers/net/ethernet/intel/e1000e/netdev.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/intel/e1000e/netdev.c +2 -0
@@ -7348,6 +7348,8 @@ static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent)e1000_print_device_info (adapter); +dev_pm_set_driver_flags (&pdev->dev,DPM_FLAG_NEVER_SKIP ); +if (pci_dev_run_wake (pdev))pm_runtime_put_noidle (&pdev->dev);
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 158/246 fbdev: fbmem: fix memory access if logo is bigger than the screen
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit a5399db139cb3ad9b8502d8b1bd02da9ce0b9df0 ]
There is no clipping on the x or y axis for logos larger that the framebuffer size. Therefore: a logo bigger than screen size leads to invalid memory access:
[ 1.254664] Backtrace: [ 1.254728] [<c02714e0>] (cfb_imageblit) from [<c026184c>] (fb_show_logo+0x620/0x684) [ 1.254763] r10:00000003 r9:00027fd8 r8:c6a40000 r7:c6a36e50 r6:00000000 r5:c06b81e4 [ 1.254774] r4:c6a3e800 [ 1.254810] [<c026122c>] (fb_show_logo) from [<c026c1e4>] (fbcon_switch+0x3fc/0x46c) [ 1.254842] r10:c6a3e824 r9:c6a3e800 r8:00000000 r7:c6a0c000 r6:c070b014 r5:c6a3e800 [ 1.254852] r4:c6808c00 [ 1.254889] [<c026bde8>] (fbcon_switch) from [<c029c8f8>] (redraw_screen+0xf0/0x1e8) [ 1.254918] r10:00000000 r9:00000000 r8:00000000 r7:00000000 r6:c070d5a0 r5:00000080 [ 1.254928] r4:c6808c00 [ 1.254961] [<c029c808>] (redraw_screen) from [<c029d264>] (do_bind_con_driver+0x194/0x2e4) [ 1.254991] r9:00000000 r8:00000000 r7:00000014 r6:c070d5a0 r5:c070d5a0 r4:c070d5a0
So prevent displaying a logo bigger than screen size and avoid invalid memory access.
--- drivers/video/fbdev/core/fbmem.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/video/fbdev/core/fbmem.c +3 -0
@@ -431,6 +431,9 @@ static void fb_do_show_logo(struct fb_info *info, struct fb_image *image, {unsigned int x; +if (image->width > info->var.xres || image->height > info->var.yres) +return ; +if (rotate ==FB_ROTATE_UR ) { for (x = 0; x < num && image->dx + image->width <= info->var.xres;
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 159/246 cdrom: Fix race condition in cdrom_sysctl_register
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit f25191bb322dec8fa2979ecb8235643aa42470e1 ]
The following traceback is sometimes seen when booting an image in qemu:
[ 54.608293] cdrom: Uniform CD-ROM driver Revision: 3.20 [ 54.611085] Fusion MPT base driver 3.04.20 [ 54.611877] Copyright (c) 1999-2008 LSI Corporation [ 54.616234] Fusion MPT SAS Host driver 3.04.20 [ 54.635139] sysctl duplicate entry: /dev/cdrom//info [ 54.639578] CPU: 0 PID: 266 Comm: kworker/u4:5 Not tainted 5.0.0-rc5 #1 [ 54.639578] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 0.0.0 02/06/2015 [ 54.641273] Workqueue: events_unbound async_run_entry_fn [ 54.641273] Call Trace: [ 54.641273] dump_stack+0x67/0x90 [ 54.641273] __register_sysctl_table+0x50b/0x570 [ 54.641273] ? rcu_read_lock_sched_held+0x6f/0x80 [ 54.641273] ? kmem_cache_alloc_trace+0x1c7/0x1f0 [ 54.646814] __register_sysctl_paths+0x1c8/0x1f0 [ 54.646814] cdrom_sysctl_register.part.7+0xc/0x5f [ 54.646814] register_cdrom.cold.24+0x2a/0x33 [ 54.646814] sr_probe+0x4bd/0x580 [ 54.646814] ? __driver_attach+0xd0/0xd0 [ 54.646814] really_probe+0xd6/0x260 [ 54.646814] ? __driver_attach+0xd0/0xd0 [ 54.646814] driver_probe_device+0x4a/0xb0 [ 54.646814] ? __driver_attach+0xd0/0xd0 [ 54.646814] bus_for_each_drv+0x73/0xc0 [ 54.646814] __device_attach+0xd6/0x130 [ 54.646814] bus_probe_device+0x9a/0xb0 [ 54.646814] device_add+0x40c/0x670 [ 54.646814] ? __pm_runtime_resume+0x4f/0x80 [ 54.646814] scsi_sysfs_add_sdev+0x81/0x290 [ 54.646814] scsi_probe_and_add_lun+0x888/0xc00 [ 54.646814] ? scsi_autopm_get_host+0x21/0x40 [ 54.646814] __scsi_add_device+0x116/0x130 [ 54.646814] ata_scsi_scan_host+0x93/0x1c0 [ 54.646814] async_run_entry_fn+0x34/0x100 [ 54.646814] process_one_work+0x237/0x5e0 [ 54.646814] worker_thread+0x37/0x380 [ 54.646814] ? rescuer_thread+0x360/0x360 [ 54.646814] kthread+0x118/0x130 [ 54.646814] ? kthread_create_on_node+0x60/0x60 [ 54.646814] ret_from_fork+0x3a/0x50
The only sensible explanation is that cdrom_sysctl_register() is called twice, once from the module init function and once from register_cdrom(). cdrom_sysctl_register() is not mutex protected and may happily execute twice if the second call is made before the first call is complete.
Use a static atomic to ensure that the function is executed exactly once.
--- drivers/cdrom/cdrom.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/cdrom/cdrom.c +3 -4
@@ -265,6 +265,7 @@/* #define ERRLOGMASK (CD_WARNING|CD_OPEN|CD_COUNT_TRACKS|CD_CLOSE) */ /* #define ERRLOGMASK (CD_WARNING|CD_REG_UNREG|CD_DO_IOCTL|CD_OPEN|CD_CLOSE|CD_COUNT_TRACKS) */ +#include <linux/atomic.h> #include <linux/module.h> #include <linux/fs.h> #include <linux/major.h>
@@ -3692,9 +3693,9 @@ static struct ctl_table_header *cdrom_sysctl_header;static void cdrom_sysctl_register (void ) { -static int initialized; +static atomic_t initialized =ATOMIC_INIT (0 ); -if (initialized ==1 ) +if (!atomic_add_unless (&initialized,1 ,1 ))return ; cdrom_sysctl_header =register_sysctl_table (cdrom_root_table);
@@ -3705,8 +3706,6 @@ static void cdrom_sysctl_register(void) cdrom_sysctl_settings.debug = debug; cdrom_sysctl_settings.lock = lockdoor; cdrom_sysctl_settings.check = check_media_type; - - initialized =1 ; }static void cdrom_sysctl_unregister (void )
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 161/246 drm/amd/display: Dont re-program planes for DPMS changes
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 5062b797db4103218fa00ee254417b8ecaab7401 ]
[Why]
There are opt1c lock warnings and CRTC read timeouts when running the "igt@kms_plane@plane-position-hole-dpms-pipe-*" tests. These are caused by trying to reprogram planes that are not in the current context.
DPMS off removes the stream from the context. In this case:
new_crtc_state->active_changed = truenew_crtc_state->mode_changed = false
The planes are reprogrammed before the stream is removed from the context because stream_state->mode_changed = false.
For DPMS adds the stream and planes back to the context:
new_crtc_state->active_changed = truenew_crtc_state->mode_changed = false
The planes are also reprogrammed here before the stream is added to the context because stream_state->mode_changed = true. They were not previously in the current context so warnings occur here.
[How]
Set stream_state->mode_changed = true whennew_crtc_state->active_changed = true too.
This prevents reprogramming before the context is applied in DC. The programming will be done after the context is applied.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +2 -1
@@ -4975,7 +4975,8 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,static void amdgpu_dm_crtc_copy_transient_flags (struct drm_crtc_state *crtc_state,struct dc_stream_state *stream_state) { - stream_state->mode_changed = crtc_state->mode_changed; + stream_state->mode_changed = + crtc_state->mode_changed || crtc_state->active_changed; } static int amdgpu_dm_atomic_commit(struct drm_device *dev,
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 162/246 bpf: test_maps: fix possible out of bound access warning
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit dd9cef43c222df7c0d76d34451808e789952379d ]
When compiling test_maps selftest with GCC-8, it warns that an array might be indexed with a negative value, which could cause a negative out of bound access, depending on parameters of the function. This is the GCC-8 warning:
gcc -Wall -O2 -I../../../include/uapi -I../../../lib -I../../../lib/bpf -I../../../../include/generated -DHAVE_GENHDR -I../../../include test_maps.c /home/breno/Devel/linux/tools/testing/selftests/bpf/libbpf.a -lcap -lelf -lrt -lpthread -o /home/breno/Devel/linux/tools/testing/selftests/bpf/test_maps In file included from test_maps.c:16: test_maps.c: In function ‘run_all_tests’: test_maps.c:1079:10: warning: array subscript -1 is below array bounds of ‘pid_t[<Ube20> + 1]’ [-Warray-bounds] assert(waitpid(pid[i], &status, 0) == pid[i]); ^~~~~~~~~~~~~~~~~~~~~~~~~~~ test_maps.c:1059:6: warning: array subscript -1 is below array bounds of ‘pid_t[<Ube20> + 1]’ [-Warray-bounds] pid[i] = fork(); ~~~^~~
This patch simply guarantees that the task(s) variables are unsigned, thus, they could never be a negative number (which they are not in current code anyway), hence avoiding an out of bound access warning.
--- tools/testing/selftests/bpf/test_maps.c | 27 +++++++++++++------------ 1 file changed, 14 insertions(+), 13 deletions(-)
tools/testing/selftests/bpf/test_maps.c +14 -13
@@ -43,7 +43,7 @@ static int map_flags; } \ }) -static void test_hashmap (int task,void *data) +static void test_hashmap (unsigned int task,void *data) {long long key, next_key, first_key, value;int fd;
@@ -133,7 +133,7 @@ static void test_hashmap(int task, void *data)close (fd); } -static void test_hashmap_sizes (int task,void *data) +static void test_hashmap_sizes (unsigned int task,void *data) {int fd, i, j;
@@ -153,7 +153,7 @@ static void test_hashmap_sizes(int task, void *data) } } -static void test_hashmap_percpu (int task,void *data) +static void test_hashmap_percpu (unsigned int task,void *data) {unsigned int nr_cpus =bpf_num_possible_cpus ();BPF_DECLARE_PERCPU (long, value);
@@ -280,7 +280,7 @@ static int helper_fill_hashmap(int max_entries)return fd; } -static void test_hashmap_walk (int task,void *data) +static void test_hashmap_walk (unsigned int task,void *data) {int fd, i, max_entries =1000 ;long long key, value, next_key;
@@ -351,7 +351,7 @@ static void test_hashmap_zero_seed(void)close (second); } -static void test_arraymap (int task,void *data) +static void test_arraymap (unsigned int task,void *data) {int key, next_key, fd;long long value;
@@ -406,7 +406,7 @@ static void test_arraymap(int task, void *data)close (fd); } -static void test_arraymap_percpu (int task,void *data) +static void test_arraymap_percpu (unsigned int task,void *data) {unsigned int nr_cpus =bpf_num_possible_cpus ();BPF_DECLARE_PERCPU (long, values);
@@ -502,7 +502,7 @@ static void test_arraymap_percpu_many_keys(void)close (fd); } -static void test_devmap (int task,void *data) +static void test_devmap (unsigned int task,void *data) {int fd;__u32 key, value;
@@ -517,7 +517,7 @@ static void test_devmap(int task, void *data)close (fd); } -static void test_queuemap (int task,void *data) +static void test_queuemap (unsigned int task,void *data) {const int MAP_SIZE =32 ;__u32 vals[MAP_SIZE +MAP_SIZE /2 ], val;
@@ -575,7 +575,7 @@ static void test_queuemap(int task, void *data)close (fd); } -static void test_stackmap (int task,void *data) +static void test_stackmap (unsigned int task,void *data) {const int MAP_SIZE =32 ;__u32 vals[MAP_SIZE +MAP_SIZE /2 ], val;
@@ -641,7 +641,7 @@ static void test_stackmap(int task, void *data)#define SOCKMAP_PARSE_PROG "./sockmap_parse_prog.o"#define SOCKMAP_VERDICT_PROG "./sockmap_verdict_prog.o"#define SOCKMAP_TCP_MSG_PROG "./sockmap_tcp_msg_prog.o" -static void test_sockmap (int tasks,void *data) +static void test_sockmap (unsigned int tasks,void *data) {struct bpf_map *bpf_map_rx, *bpf_map_tx, *bpf_map_msg, *bpf_map_break;int map_fd_msg =0 , map_fd_rx =0 , map_fd_tx =0 , map_fd_break;
@@ -1258,10 +1258,11 @@ static void test_map_large(void) }#define run_parallel (N ,FN ,DATA ) \ - printf("Fork %d tasks to '" #FN "'\n", N); \ + printf("Fork %u tasks to '" #FN "'\n", N); \ __run_parallel(N, FN, DATA) -static void __run_parallel (int tasks,void (*fn)(int task,void *data), +static void __run_parallel (unsigned int tasks, +void (*fn)(unsigned int task,void *data),void *data) {pid_t pid[tasks];
@@ -1302,7 +1303,7 @@ static void test_map_stress(void)#define DO_UPDATE 1#define DO_DELETE 0 -static void test_update_delete (int fn,void *data) +static void test_update_delete (unsigned int fn,void *data) {int do_update = ((int *)data)[1 ];int fd = ((int *)data)[0 ];
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 163/246 x86/kexec: Fill in acpi_rsdp_addr from the first kernel
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit ccec81e4251f5a5421e02874e394338a897056ca ]
When efi=noruntime or efi=oldmap is used on the kernel command line, EFI services won't be available in the second kernel, therefore the second kernel will not be able to get the ACPI RSDP address from firmware by calling EFI services and so it won't boot.
Commit
e6e094e053af ("x86/acpi, x86/boot: Take RSDP address from boot params if available")
added an acpi_rsdp_addr field to boot_params which stores the RSDP address for other kernel users.
Recently, after
3a63f70bf4c3 ("x86/boot: Early parse RSDP and save it in boot_params")
the acpi_rsdp_addr will always be filled with a valid RSDP address.
So fill in that value into the second kernel's boot_params thus ensuring that the second kernel receives the RSDP value from the first kernel.
[ bp: massage commit message. ]
--- arch/x86/kernel/kexec-bzimage64.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/x86/kernel/kexec-bzimage64.c +3 -1
@@ -218,6 +218,9 @@ setup_boot_parameters(struct kimage *image, struct boot_params *params, params->screen_info.ext_mem_k =0 ; params->alt_mem_k =0 ; +/* Always fill in RSDP: it is either 0 or a valid value */ + params->acpi_rsdp_addr = boot_params.acpi_rsdp_addr; +/* Default APM info */ memset (¶ms->apm_bios_info,0 ,sizeof (params->apm_bios_info));
@@ -256,7 +259,6 @@ setup_boot_parameters(struct kimage *image, struct boot_params *params,setup_efi_state (params, params_load_addr, efi_map_offset, efi_map_sz, efi_setup_data_offset);#endif -/* Setup EDD info */ memcpy (params->eddbuf, boot_params.eddbuf,EDDMAXNR *sizeof (struct edd_info ));
Signature · 9 lines
2.19.1 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
Greg Kroah-Hartman
maintainerPATCH 164/246 powerpc/ptrace: Mitigate potential Spectre v1
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit ebb0e13ead2ddc186a80b1b0235deeefc5a1a667 ]
'regno' is directly controlled by user space, hence leading to a potential exploitation of the Spectre variant 1 vulnerability.
On PTRACE_SETREGS and PTRACE_GETREGS requests, user space passes the register number that would be read or written. This register number is called 'regno' which is part of the 'addr' syscall parameter.
This 'regno' value is checked against the maximum pt_regs structure size, and then used to dereference it, which matches the initial part of a Spectre v1 (and Spectre v1.1) attack. The dereferenced value, then, is returned to userspace in the GETREGS case.
This patch sanitizes 'regno' before using it to dereference pt_reg.
Notice that given that speculation windows are large, the policy is to kill the speculation on the first load and not worry if it can be completed with a dependent load/store [1].
[1] https://marc.info/?l=linux-kernel&m=152449131114778&w=2
--- arch/powerpc/kernel/ptrace.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
arch/powerpc/kernel/ptrace.c +7 -1
@@ -33,6 +33,7 @@#include <linux/hw_breakpoint.h> #include <linux/perf_event.h> #include <linux/context_tracking.h> +#include <linux/nospec.h> #include <linux/uaccess.h> #include <linux/pkeys.h>
@@ -274,6 +275,8 @@ static int set_user_trap(struct task_struct *task, unsigned long trap)*/ int ptrace_get_reg (struct task_struct *task,int regno,unsigned long *data) { +unsigned int regs_max; +if ((task->thread.regs ==NULL ) || !data)return -EIO ;
@@ -297,7 +300,9 @@ int ptrace_get_reg(struct task_struct *task, int regno, unsigned long *data) }#endif -if (regno < (sizeof (struct user_pt_regs ) /sizeof (unsigned long ))) { + regs_max =sizeof (struct user_pt_regs ) /sizeof (unsigned long ); +if (regno < regs_max) { + regno =array_index_nospec (regno, regs_max); *data = ((unsigned long *)task->thread.regs)[regno];return 0 ; }
@@ -321,6 +326,7 @@ int ptrace_put_reg(struct task_struct *task, int regno, unsigned long data)return set_user_dscr (task, data);if (regno <=PT_MAX_PUT_REG ) { + regno =array_index_nospec (regno,PT_MAX_PUT_REG +1 ); ((unsigned long *)task->thread.regs)[regno] = data;return 0 ; }
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 171/246 staging: spi: mt7621: Add return code check on device_reset()
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 46c337872f34bc6387b0c29a4964f562c70139e3 ]
This patch adds a return code check on device_reset() and removes the compile warning.
--- drivers/staging/mt7621-spi/spi-mt7621.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/staging/mt7621-spi/spi-mt7621.c +6 -1
@@ -330,6 +330,7 @@ static int mt7621_spi_probe(struct platform_device *pdev)int status =0 ;struct clk *clk;struct mt7621_spi_ops *ops; +int ret; match =of_match_device (mt7621_spi_match, &pdev->dev);if (!match)
@@ -377,7 +378,11 @@ static int mt7621_spi_probe(struct platform_device *pdev) rs->pending_write =0 ;dev_info (&pdev->dev,"sys_freq: %u\n" , rs->sys_freq); -device_reset (&pdev->dev); + ret =device_reset (&pdev->dev); +if (ret) { +dev_err (&pdev->dev,"SPI reset failed!\n" ); +return ret; + }mt7621_spi_reset (rs);
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 181/246 soc: qcom: gsbi: Fix error handling in gsbi_probe()
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 8cd09a3dd3e176c62da67efcd477a44a8d87185e ]
If of_platform_populate() fails in gsbi_probe(), gsbi->hclk is left undisabled.
Found by Linux Driver Verification project (linuxtesting.org).
--- drivers/soc/qcom/qcom_gsbi.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/soc/qcom/qcom_gsbi.c +5 -2
@@ -138,7 +138,7 @@ static int gsbi_probe(struct platform_device *pdev)struct resource *res;void __iomem *base;struct gsbi_info *gsbi; -int i; +int i, ret;u32 mask, gsbi_num;const struct crci_config *config =NULL ;
@@ -221,7 +221,10 @@ static int gsbi_probe(struct platform_device *pdev)platform_set_drvdata (pdev, gsbi); -return of_platform_populate (node,NULL ,NULL , &pdev->dev); + ret =of_platform_populate (node,NULL ,NULL , &pdev->dev); +if (ret) +clk_disable_unprepare (gsbi->hclk); +return ret; }static int gsbi_remove (struct platform_device *pdev)
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 182/246 drm/msm/dpu: Convert to a chained irq chip
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 070e64dc1bbc879b7e0e9fffccd9dd139baf89f0 ]
Devices that make up DPU, i.e. graphics card, request their interrupts from this "virtual" interrupt chip. The interrupt chip builds upon a GIC SPI interrupt that raises high when any of the interrupts in the DPU's irq status register are triggered. From the kernel's perspective this is a chained irq chip, so requesting a flow handler for the GIC SPI and then calling generic IRQ handling code from that irq handler is not completely proper. It's better to convert this to a chained irq so that the GIC SPI irq doesn't appear in /proc/interrupts, can't have CPU affinity changed, and won't be accounted for with irq stats. Doing this also silences a recursive lockdep warning because we can specify a different lock class for the chained interrupts, silencing a warning that is easy to see with 'threadirqs' on the kernel commandline.
WARNING: inconsistent lock state
4.19.10 #76 Tainted: G W
--------------------------------
inconsistent {IN-HARDIRQ-W} -> {HARDIRQ-ON-W} usage. irq/40-dpu_mdss/203 [HC0[0]:SC0[2]:HE1:SE0] takes:
0000000053ea9021 (&irq_desc_lock_class){?.-.}, at: handle_level_irq+0x34/0x26c {IN-HARDIRQ-W} state was registered at:
lock_acquire+0x244/0x360 _raw_spin_lock+0x64/0xa0 handle_fasteoi_irq+0x54/0x2ec generic_handle_irq+0x44/0x5c __handle_domain_irq+0x9c/0x11c gic_handle_irq+0x208/0x260 el1_irq+0xb4/0x130 arch_cpu_idle+0x178/0x3cc default_idle_call+0x3c/0x54 do_idle+0x1a8/0x3dc cpu_startup_entry+0x24/0x28 rest_init+0x240/0x270 start_kernel+0x5a8/0x6bc irq event stamp: 18 hardirqs last enabled at (17): [<ffffff9042385e80>] _raw_spin_unlock_irq+0x40/0xc0 hardirqs last disabled at (16): [<ffffff904237a1f4>] __schedule+0x20c/0x1bbc softirqs last enabled at (0): [<ffffff9040f318d0>] copy_process+0xb50/0x3964 softirqs last disabled at (18): [<ffffff9041036364>] local_bh_disable+0x8/0x20
other info that might help us debug this:
Possible unsafe locking scenario:
CPU0
----
lock(&irq_desc_lock_class);
<Interrupt>
lock(&irq_desc_lock_class);*** DEADLOCK ***
no locks held by irq/40-dpu_mdss/203.
stack backtrace: CPU: 0 PID: 203 Comm: irq/40-dpu_mdss Tainted: G W 4.19.10 #76 Call trace: dump_backtrace+0x0/0x2f8 show_stack+0x20/0x2c __dump_stack+0x20/0x28 dump_stack+0xcc/0x10c mark_lock+0xbe0/0xe24 __lock_acquire+0x4cc/0x2708 lock_acquire+0x244/0x360 _raw_spin_lock+0x64/0xa0 handle_level_irq+0x34/0x26c generic_handle_irq+0x44/0x5c dpu_mdss_irq+0x64/0xec irq_forced_thread_fn+0x58/0x9c irq_thread+0x120/0x1dc kthread+0x248/0x260 ret_from_fork+0x10/0x18 ------------[ cut here ]------------ irq 169 handler irq_default_primary_handler+0x0/0x18 enabled interrupts
--- drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c | 36 ++++++++++++++---------- 1 file changed, 21 insertions(+), 15 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c +21 -15
@@ -23,11 +23,14 @@ struct dpu_mdss {struct dpu_irq_controller irq_controller; }; -static irqreturn_t dpu_mdss_irq (int irq,void *arg) +static void dpu_mdss_irq (struct irq_desc *desc) { -struct dpu_mdss *dpu_mdss = arg; +struct dpu_mdss *dpu_mdss =irq_desc_get_handler_data (desc); +struct irq_chip *chip =irq_desc_get_chip (desc);u32 interrupts; +chained_irq_enter (chip, desc); + interrupts =readl_relaxed (dpu_mdss->mmio +HW_INTR_STATUS );while (interrupts) {
@@ -39,20 +42,20 @@ static irqreturn_t dpu_mdss_irq(int irq, void *arg) hwirq);if (mapping ==0 ) {DRM_ERROR ("couldn't find irq mapping for %lu\n" , hwirq); -return IRQ_NONE ; +break ; } rc =generic_handle_irq (mapping);if (rc <0 ) {DRM_ERROR ("handle irq fail: irq=%lu mapping=%u rc=%d\n" , hwirq, mapping, rc); -return IRQ_NONE ; +break ; } interrupts &= ~(1 << hwirq); } -return IRQ_HANDLED ; +chained_irq_exit (chip, desc); }static void dpu_mdss_irq_mask (struct irq_data *irqd)
@@ -83,16 +86,16 @@ static struct irq_chip dpu_mdss_irq_chip = { .irq_unmask = dpu_mdss_irq_unmask, }; +static struct lock_class_key dpu_mdss_lock_key, dpu_mdss_request_key; +static int dpu_mdss_irqdomain_map (struct irq_domain *domain,unsigned int irq,irq_hw_number_t hwirq) {struct dpu_mdss *dpu_mdss = domain->host_data; -int ret; +irq_set_lockdep_class (irq, &dpu_mdss_lock_key, &dpu_mdss_request_key);irq_set_chip_and_handler (irq, &dpu_mdss_irq_chip, handle_level_irq); - ret =irq_set_chip_data (irq, dpu_mdss); - -return ret; +return irq_set_chip_data (irq, dpu_mdss); }static const struct irq_domain_ops dpu_mdss_irqdomain_ops = {
@@ -159,11 +162,13 @@ static void dpu_mdss_destroy(struct drm_device *dev)struct msm_drm_private *priv = dev->dev_private;struct dpu_mdss *dpu_mdss =to_dpu_mdss (priv->mdss);struct dss_module_power *mp = &dpu_mdss->mp; +int irq;pm_runtime_suspend (dev->dev);pm_runtime_disable (dev->dev);_dpu_mdss_irq_domain_fini (dpu_mdss); -free_irq (platform_get_irq (pdev,0 ), dpu_mdss); + irq =platform_get_irq (pdev,0 ); +irq_set_chained_handler_and_data (irq,NULL ,NULL );msm_dss_put_clk (mp->clk_config, mp->num_clk);devm_kfree (&pdev->dev, mp->clk_config);
@@ -187,6 +192,7 @@ int dpu_mdss_init(struct drm_device *dev)struct dpu_mdss *dpu_mdss;struct dss_module_power *mp;int ret =0 ; +int irq; dpu_mdss =devm_kzalloc (dev->dev,sizeof (*dpu_mdss),GFP_KERNEL );if (!dpu_mdss)
@@ -219,12 +225,12 @@ int dpu_mdss_init(struct drm_device *dev)if (ret) goto irq_domain_error; - ret =request_irq (platform_get_irq (pdev,0 ), - dpu_mdss_irq,0 ,"dpu_mdss_isr" , dpu_mdss); -if (ret) { -DPU_ERROR ("failed to init irq: %d\n" , ret); + irq =platform_get_irq (pdev,0 ); +if (irq <0 ) goto irq_error; - } + +irq_set_chained_handler_and_data (irq, dpu_mdss_irq, + dpu_mdss);pm_runtime_enable (dev->dev);
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 183/246 mt7601u: bump supported EEPROM version
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 3bd1505fed71d834f45e87b32ff07157fdda47e0 ]
As reported by Michael eeprom 0d is supported and work with the driver.
Dump of /sys/kernel/debug/ieee80211/phy1/mt7601u/eeprom_param with 0d EEPORM looks like this:
RSSI offset: 0 0
Reference temp: f9
LNA gain: 8
Reg channels: 1-14
Per rate power:
raw:05 bw20:05 bw40:05 raw:05 bw20:05 bw40:05 raw:03 bw20:03 bw40:03 raw:03 bw20:03 bw40:03 raw:04 bw20:04 bw40:04 raw:00 bw20:00 bw40:00 raw:00 bw20:00 bw40:00 raw:00 bw20:00 bw40:00 raw:02 bw20:02 bw40:02 raw:00 bw20:00 bw40:00 Per channel power: tx_power ch1:09 ch2:09 tx_power ch3:0a ch4:0a tx_power ch5:0a ch6:0a tx_power ch7:0b ch8:0b tx_power ch9:0b ch10:0b tx_power ch11:0b ch12:0b tx_power ch13:0b ch14:0b
--- drivers/net/wireless/mediatek/mt7601u/eeprom.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt7601u/eeprom.h +1 -1
@@ -17,7 +17,7 @@struct mt7601u_dev ; -#define MT7601U_EE_MAX_VER 0x0c +#define MT7601U_EE_MAX_VER 0x0d#define MT7601U_EEPROM_SIZE 256#define MT7601U_DEFAULT_TX_POWER 6
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 172/246 iwlwifi: mvm: fix RFH config command with >=10 CPUs
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit dbf592f3d14fb7d532cb7c820b1065cf33e02aaa ]
If we have >=10 (logical) CPUs, our command size exceeds the internal buffer size and the command fails; fix that by using IWL_HCMD_DFL_NOCOPY for the command that's allocated anyway.
While at it, also fix the leak of cmd, and use struct_size() to calculate its size.
--- drivers/net/wireless/intel/iwlwifi/mvm/fw.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/fw.c +14 -6
@@ -127,13 +127,17 @@ static int iwl_send_rss_cfg_cmd(struct iwl_mvm *mvm)static int iwl_configure_rxq (struct iwl_mvm *mvm) { -int i, num_queues, size; +int i, num_queues, size, ret;struct iwl_rfh_queue_config *cmd; +struct iwl_host_cmd hcmd = { + .id =WIDE_ID (DATA_PATH_GROUP ,RFH_QUEUE_CONFIG_CMD ), + .dataflags[0 ] =IWL_HCMD_DFL_NOCOPY , + };/* Do not configure default queue, it is configured via context info */ num_queues = mvm->trans->num_rx_queues -1 ; - size =sizeof (*cmd) + num_queues *sizeof (struct iwl_rfh_queue_data ); + size =struct_size (cmd, data, num_queues); cmd =kzalloc (size,GFP_KERNEL );if (!cmd)
@@ -154,10 +158,14 @@ static int iwl_configure_rxq(struct iwl_mvm *mvm) cmd->data[i].fr_bd_wid =cpu_to_le32 (data.fr_bd_wid); } -return iwl_mvm_send_cmd_pdu (mvm, -WIDE_ID (DATA_PATH_GROUP , -RFH_QUEUE_CONFIG_CMD ), -0 , size, cmd); + hcmd.data[0 ] = cmd; + hcmd.len[0 ] = size; + + ret =iwl_mvm_send_cmd (mvm, &hcmd); + +kfree (cmd); + +return ret; }static int iwl_mvm_send_dqa_cmd (struct iwl_mvm *mvm)
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 178/246 drm/vkms: Bugfix extra vblank frame
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit def35e7c592616bc09be328de8795e5e624a3cf8 ]
kms_flip tests are breaking on vkms when simulate vblank because vblank event sequence count returns one extra frame after arm vblank event to make a page flip.
When vblank interrupt happens, userspace processes the vblank event and issues the next page flip command. Kernel calls queue_work to call commit_planes and arm the new page flip. The next vblank picks up the newly armed vblank event and vblank interrupt happens again.
The arm and vblank event are asynchronous, then, on the next vblank, we receive x+2 from get_vblank_timestamp, instead x+1, although timestamp and vblank seqno matches.
Function get_vblank_timestamp is reached by 2 ways:
- from drm_mode_page_flip_ioctl: driver is doing one atomic operation to synchronize planes in the same output. There is no vblank simulation, the drm_crtc_arm_vblank_event function adds 1 on vblank count, and the variable in_vblank_irq is false
- from vkms_vblank_simulate: since the driver is doing a vblank simulation, the variable in_vblank_irq is true.
Fix this problem subtracting one vblank period from vblank_time when get_vblank_timestamp is called from trace drm_mode_page_flip_ioctl, i.e., is not a real vblank interrupt, and getting the timestamp and vblank seqno when it is a real vblank interrupt.
The reason for all this is that get_vblank_timestamp always supplies the timestamp for the next vblank event. The hrtimer is the vblank simulator, and it needs the correct previous value to present the next vblank. Since this is how hw timestamp registers work and what the vblank core expects.
--- drivers/gpu/drm/vkms/vkms_crtc.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/vkms/vkms_crtc.c +3 -0
@@ -75,6 +75,9 @@ bool vkms_get_vblank_timestamp(struct drm_device *dev, unsigned int pipe, *vblank_time = output->vblank_hrtimer.node.expires; +if (!in_vblank_irq) + *vblank_time -= output->period_ns; +return true; }
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 170/246 i2c: of: Try to find an I2C adapter matching the parent
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit e814e688413aabd7b0d75e2a8ed1caa472951dec ]
If an I2C adapter doesn't match the provided device tree node, also try matching the parent's device tree node. This allows finding an adapter based on the device node of the parent device that was used to register it.
This fixes a regression on Tegra124-based Chromebooks (Nyan) where the eDP controller registers an I2C adapter that is used to read to EDID. After commit 993a815dcbb2 ("dt-bindings: panel: Add missing .txt suffix") this stopped working because the I2C adapter could no longer be found. The approach in this patch fixes the regression without introducing the issues that the above commit solved.
--- drivers/i2c/i2c-core-of.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
drivers/i2c/i2c-core-of.c +13 -1
@@ -121,6 +121,17 @@ static int of_dev_node_match(struct device *dev, void *data)return dev->of_node == data; } +static int of_dev_or_parent_node_match (struct device *dev,void *data) +{ +if (dev->of_node == data) +return 1 ; + +if (dev->parent) +return dev->parent->of_node == data; + +return 0 ; +} +/* must call put_device() when done with returned i2c_client device */ struct i2c_client *of_find_i2c_device_by_node (struct device_node *node) {
@@ -145,7 +156,8 @@ struct i2c_adapter *of_find_i2c_adapter_by_node(struct device_node *node)struct device *dev;struct i2c_adapter *adapter; - dev =bus_find_device (&i2c_bus_type,NULL , node, of_dev_node_match); + dev =bus_find_device (&i2c_bus_type,NULL , node, + of_dev_or_parent_node_match);if (!dev)return NULL ;
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 185/246 ARM: avoid Cortex-A9 livelock on tight dmb loops
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 5388a5b82199facacd3d7ac0d05aca6e8f902fed ]
machine_crash_nonpanic_core() does this:
while (1) cpu_relax();
because the kernel has crashed, and we have no known safe way to deal with the CPU. So, we place the CPU into an infinite loop which we expect it to never exit - at least not until the system as a whole is reset by some method.
In the absence of erratum 754327, this code assembles to:
b .
In other words, an infinite loop. When erratum 754327 is enabled, this becomes:
1: dmb
b 1b
It has been observed that on some systems (eg, OMAP4) where, if a crash is triggered, the system tries to kexec into the panic kernel, but fails after taking the secondary CPU down - placing it into one of these loops. This causes the system to livelock, and the most noticable effect is the system stops after issuing:
Loading crashdump kernel...
to the system console.
The tested as working solution I came up with was to add wfe() to these infinite loops thusly:
while (1) {
cpu_relax();
wfe();
}which, without 754327 builds to:
1: wfe
b 1b
or with 754327 is enabled:
1: dmb
wfe b 1b
Adding "wfe" does two things depending on the environment we're running under:
- where we're running on bare metal, and the processor implements "wfe", it stops us spinning endlessly in a loop where we're never going to do any useful work.
- if we're running in a VM, it allows the CPU to be given back to the hypervisor and rescheduled for other purposes (maybe a different VM) rather than wasting CPU cycles inside a crashed VM.
However, in light of erratum 794072, Will Deacon wanted to see 10 nops as well - which is reasonable to cover the case where we have erratum 754327 enabled _and_ we have a processor that doesn't implement the wfe hint.
So, we now end up with:
1: wfe
b 1b
when erratum 754327 is disabled, or:
1: dmb
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
wfe
b 1b
when erratum 754327 is enabled. We also get the dmb + 10 nop sequence elsewhere in the kernel, in terminating loops.
This is reasonable - it means we get the workaround for erratum 794072 when erratum 754327 is enabled, but still relinquish the dead processor - either by placing it in a lower power mode when wfe is implemented as such or by returning it to the hypervisior, or in the case where wfe is a no-op, we use the workaround specified in erratum 794072 to avoid the problem.
These as two entirely orthogonal problems - the 10 nops addresses erratum 794072, and the wfe is an optimisation that makes the system more efficient when crashed either in terms of power consumption or by allowing the host/other VMs to make use of the CPU.
I don't see any reason not to use kexec() inside a VM - it has the potential to provide automated recovery from a failure of the VMs kernel with the opportunity for saving a crashdump of the failure. A panic() with a reboot timeout won't do that, and reading the libvirt documentation, setting on_reboot to "preserve" won't either (the documentation states "The preserve action for an on_reboot event is treated as a destroy".) Surely it has to be a good thing to avoiding having CPUs spinning inside a VM that is doing no useful work.
--- arch/arm/include/asm/barrier.h | 2 ++ arch/arm/include/asm/processor.h | 6 +++++- arch/arm/kernel/machine_kexec.c | 5 ++++- arch/arm/kernel/smp.c | 4 +++- arch/arm/mach-omap2/prm_common.c | 4 +++- 5 files changed, 17 insertions(+), 4 deletions(-)
arch/arm/include/asm/barrier.h +2 -0
@@ -11,6 +11,8 @@#define sev () __asm__ __volatile__ ("sev" : : : "memory")#define wfe () __asm__ __volatile__ ("wfe" : : : "memory")#define wfi () __asm__ __volatile__ ("wfi" : : : "memory") +#else +#define wfe () do { } while (0)#endif #if __LINUX_ARM_ARCH__ >=7
arch/arm/include/asm/processor.h +5 -1
@@ -89,7 +89,11 @@ extern void release_thread(struct task_struct *);unsigned long get_wchan (struct task_struct *p);#if __LINUX_ARM_ARCH__ ==6 || defined(CONFIG_ARM_ERRATA_754327 ) -#define cpu_relax () smp_mb() +#define cpu_relax () \ + do { \ + smp_mb(); \ + __asm__ __volatile__("nop; nop; nop; nop; nop; nop; nop; nop; nop; nop;"); \ + } while (0)#else #define cpu_relax () barrier()#endif
arch/arm/kernel/machine_kexec.c +4 -1
@@ -91,8 +91,11 @@ void machine_crash_nonpanic_core(void *unused)set_cpu_online (smp_processor_id (), false);atomic_dec (&waiting_for_crash_ipi); -while (1 ) + +while (1 ) {cpu_relax (); +wfe (); + } }void crash_smp_send_stop (void )
arch/arm/kernel/smp.c +3 -1
@@ -604,8 +604,10 @@ static void ipi_cpu_stop(unsigned int cpu)local_fiq_disable ();local_irq_disable (); -while (1 ) +while (1 ) {cpu_relax (); +wfe (); + } } static DEFINE_PER_CPU(struct completion *, cpu_completion);
arch/arm/mach-omap2/prm_common.c +3 -1
@@ -523,8 +523,10 @@ void omap_prm_reset_system(void) prm_ll_data->reset_system (); -while (1 ) +while (1 ) {cpu_relax (); +wfe (); + } }/**
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 194/246 powerpc/pseries: Perform full re-add of CPU for topology update post-migration
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 81b61324922c67f73813d8a9c175f3c153f6a1c6 ]
On pseries systems, performing a partition migration can result in altering the nodes a CPU is assigned to on the destination system. For exampl, pre-migration on the source system CPUs are in node 1 and 3, post-migration on the destination system CPUs are in nodes 2 and 3.
Handling the node change for a CPU can cause corruption in the slab cache if we hit a timing where a CPUs node is changed while cache_reap() is invoked. The corruption occurs because the slab cache code appears to rely on the CPU and slab cache pages being on the same node.
The current dynamic updating of a CPUs node done in arch/powerpc/mm/numa.c does not prevent us from hitting this scenario.
Changing the device tree property update notification handler that recognizes an affinity change for a CPU to do a full DLPAR remove and add of the CPU instead of dynamically changing its node resolves this issue.
--- arch/powerpc/include/asm/topology.h | 2 ++ arch/powerpc/mm/numa.c | 9 +-------- arch/powerpc/platforms/pseries/hotplug-cpu.c | 19 +++++++++++++++++++ 3 files changed, 22 insertions(+), 8 deletions(-)
arch/powerpc/include/asm/topology.h +2 -0
@@ -132,6 +132,8 @@ static inline void shared_proc_topology_init(void) {}#define topology_sibling_cpumask (cpu) (per_cpu(cpu_sibling_map, cpu))#define topology_core_cpumask (cpu) (per_cpu(cpu_core_map, cpu))#define topology_core_id (cpu) (cpu_to_core_id(cpu)) + +int dlpar_cpu_readd (int cpu);#endif #endif
arch/powerpc/mm/numa.c +1 -8
@@ -1460,13 +1460,6 @@ static void reset_topology_timer(void)#ifdef CONFIG_SMP -static void stage_topology_update (int core_id) -{ -cpumask_or (&cpu_associativity_changes_mask, - &cpu_associativity_changes_mask,cpu_sibling_mask (core_id)); -reset_topology_timer (); -} -static int dt_update_callback (struct notifier_block *nb,unsigned long action,void *data) {
@@ -1479,7 +1472,7 @@ static int dt_update_callback(struct notifier_block *nb, !of_prop_cmp(update->prop->name, "ibm,associativity")) {u32 core_id;of_property_read_u32 (update->dn,"reg" , &core_id); -stage_topology_update (core_id); + rc =dlpar_cpu_readd (core_id); rc =NOTIFY_OK ; }break ;
arch/powerpc/platforms/pseries/hotplug-cpu.c +19 -0
@@ -802,6 +802,25 @@ static int dlpar_cpu_add_by_count(u32 cpus_to_add)return rc; } +int dlpar_cpu_readd (int cpu) +{ +struct device_node *dn; +struct device *dev; +u32 drc_index; +int rc; + + dev =get_cpu_device (cpu); + dn = dev->of_node; + + rc =of_property_read_u32 (dn,"ibm,my-drc-index" , &drc_index); + + rc =dlpar_cpu_remove_by_index (drc_index); +if (!rc) + rc =dlpar_cpu_add (drc_index); + +return rc; +} +int dlpar_cpu (struct pseries_hp_errorlog *hp_elog) {u32 count, drc_index;
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 196/246 ALSA: dice: add support for Solid State Logic Duende Classic/Mini
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit b2e9e1c8810ee05c95f4d55800b8afae70ab01b4 ]
Duende Classic was produced by Solid State Logic in 2006, as a first model of Duende DSP series. The following model, Duende Mini was produced in 2008. They are designed to receive isochronous packets for PCM frames via IEEE 1394 bus, perform signal processing by downloaded program, then transfer isochronous packets for converted PCM frames.
These two models includes the same embedded board, consists of several ICs below:
- Texus Instruments Inc, TSB41AB3 for physical layer of IEEE 1394 bus
- WaveFront semiconductor, DICE II STD ASIC for link/protocol layer
- Altera MAX 3000A CPLD for programs
- Analog devices, SHARC ADSP-21363 for signal processing (4 chips)
This commit adds support for the two models to ALSA dice driver. Like support for the other devices, packet streaming is just available. Userspace applications should be developed if full features became available; e.g. program uploader and parameter controller.
$ ./hinawa-config-rom-printer /dev/fw1
{ 'bus-info': { 'adj': False,
'bmc': False,
'chip_ID': 349771402425,
'cmc': True,
'cyc_clk_acc': 255,
'generation': 1,
'imc': True,
'isc': True,
'link_spd': 2,
'max_ROM': 1,
'max_rec': 512,
'name': '1394',
'node_vendor_ID': 20674,
'pmc': False},
'root-directory': [ ['VENDOR', 20674],
['DESCRIPTOR', 'Solid State Logic'],
['MODEL', 112],
['DESCRIPTOR', 'Duende board'],
[ 'NODE_CAPABILITIES',
{ 'addressing': {'64': True, 'fix': True, 'prv': True},
'misc': {'int': False, 'ms': False, 'spt': True},
'state': { 'atn': False,
'ded': False,
'drq': True,
'elo': False,
'init': False,
'lst': True,
'off': False},
'testing': {'bas': False, 'ext': False}}],
[ 'UNIT',
[ ['SPECIFIER_ID', 20674],
['VERSION', 1],
['MODEL', 112],
['DESCRIPTOR', 'Duende board']]]]}--- sound/firewire/dice/dice.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
sound/firewire/dice/dice.c +11 -1
@@ -18,6 +18,7 @@ MODULE_LICENSE("GPL v2");#define OUI_ALESIS 0x000595#define OUI_MAUDIO 0x000d6c#define OUI_MYTEK 0x001ee8 +#define OUI_SSL 0x0050c2 // Actually ID reserved by IEEE.#define DICE_CATEGORY_ID 0x04#define WEISS_CATEGORY_ID 0x00
@@ -196,7 +197,7 @@ static int dice_probe(struct fw_unit *unit,struct snd_dice *dice;int err; -if (!entry->driver_data) { +if (!entry->driver_data && entry->vendor_id !=OUI_SSL ) { err =check_dice_category (unit);if (err <0 )return -ENODEV ;
@@ -361,6 +362,15 @@ static const struct ieee1394_device_id dice_id_table[] = { .model_id = 0x000002, .driver_data = (kernel_ulong_t)snd_dice_detect_mytek_formats, }, +// Solid State Logic, Duende Classic and Mini. +// NOTE: each field of GUID in config ROM is not compliant to standard +// DICE scheme. + { + .match_flags = IEEE1394_MATCH_VENDOR_ID | + IEEE1394_MATCH_MODEL_ID, + .vendor_id = OUI_SSL, + .model_id = 0x000070, + }, { .match_flags = IEEE1394_MATCH_VERSION, .version = DICE_INTERFACE,
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 197/246 regulator: mcp16502: Include linux/gpio/consumer.h to fix build error
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit f3c6a1a194317f3a31ee2b2067bb0a41de64bc8b ]
Fix below build error:drivers/regulator/mcp16502.c: In function ‘mcp16502_gpio_set_mode’:drivers/regulator/mcp16502.c:135:3: error: implicit declaration of function ‘gpiod_set_value’; did you mean ‘gpio_set_value’? [-Werror=implicit-function-declaration]
gpiod_set_value(mcp->lpm, 0);
^~~~~~~~~~~~~~~
gpio_set_valuedrivers/regulator/mcp16502.c: In function ‘mcp16502_probe’:drivers/regulator/mcp16502.c:486:13: error: implicit declaration of function ‘devm_gpiod_get’; did you mean ‘devm_gpio_free’? [-Werror=implicit-function-declaration]
mcp->lpm = devm_gpiod_get(dev, "lpm", GPIOD_OUT_LOW);
^~~~~~~~~~~~~~
devm_gpio_free
drivers/regulator/mcp16502.c:486:40: error: ‘GPIOD_OUT_LOW’ undeclared (first use in this function); did you mean ‘GPIOF_INIT_LOW’?
mcp->lpm = devm_gpiod_get(dev, "lpm", GPIOD_OUT_LOW);
^~~~~~~~~~~~~
GPIOF_INIT_LOW--- drivers/regulator/mcp16502.c | 1 + 1 file changed, 1 insertion(+)
drivers/regulator/mcp16502.c +1 -0
@@ -17,6 +17,7 @@#include <linux/regmap.h> #include <linux/regulator/driver.h> #include <linux/suspend.h> +#include <linux/gpio/consumer.h> #define VDD_LOW_SEL 0x0D#define VDD_HIGH_SEL 0x3F
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 198/246 usb: dwc3: gadget: Fix OTG events when gadget driver isnt loaded
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 169e3b68cadb5775daca009ced4faf01ffd97dcf ]
On v3.10a in dual-role mode, if port is in device mode and gadget driver isn't loaded, the OTG event interrupts don't come through.
It seems that if the core is configured to be OTG2.0 only, then we can't leave the DCFG.DEVSPD at Super-speed (default) if we expect OTG to work properly. It must be set to High-speed.
Fix this issue by configuring DCFG.DEVSPD to the supported maximum speed at gadget init. Device tree still needs to provide correct supported maximum speed for this to work.
This issue wasn't present on v2.40a but is seen on v3.10a. It doesn't cause any side effects on v2.40a.
--- drivers/usb/dwc3/gadget.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/dwc3/gadget.c +2 -0
@@ -3339,6 +3339,8 @@ int dwc3_gadget_init(struct dwc3 *dwc) goto err4; } +dwc3_gadget_set_speed (&dwc->gadget, dwc->maximum_speed); +return 0 ; err4:
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 200/246 perf trace: Fixup etcsnoop example
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 1d59cb1bbd4cbe5a8f8032242cdacea5658129cf ]
Where we don't have "raw_syscalls:sys_enter", so we need to look for a "*syscalls:sys_enter*" to initialize the offsets for the __augmented_syscalls__ evsel, which is the case with etcsnoop, that was segfaulting, fixed:
# trace -e /home/acme/git/perf/tools/perf/examples/bpf/etcsnoop.c
0.000 ( ): gnome-shell/2105 openat(dfd: CWD, filename: "/etc/localtime") ...
631.834 ( ): cat/6521 openat(dfd: CWD, filename: "/etc/ld.so.cache", flags: RDONLY|CLOEXEC) ...
632.637 ( ): bash/6521 openat(dfd: CWD, filename: "/etc/passwd") ...
^C#--- tools/perf/builtin-trace.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/perf/builtin-trace.c +2 -1
@@ -3868,7 +3868,8 @@ int cmd_trace(int argc, const char **argv) goto init_augmented_syscall_tp; } -if (strcmp (perf_evsel__name (evsel),"raw_syscalls:sys_enter" ) ==0 ) { +if (trace.syscalls.events.augmented->priv ==NULL && +strstr (perf_evsel__name (evsel),"syscalls:sys_enter" )) {struct perf_evsel *augmented = trace.syscalls.events.augmented;if (perf_evsel__init_augmented_syscall_tp (augmented, evsel) ||perf_evsel__init_augmented_syscall_tp_args (augmented))
Signature · 1 line
2.19.1
Greg Kroah-Hartman
maintainerPATCH 199/246 platform/x86: intel-hid: Missing power button release on some Dell models
In reply to Greg Kroah-Hartman5.0-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit e97a34563d18606ee5db93e495382a967f999cd4 ]
Power button suspend for some Dell models was added in:
commit 821b85366284 ("platform/x86: intel-hid: Power button suspend on Dell Latitude 7275")
by checking against the power button press notification (0xCE) to report the power button press event. The corresponding power button release notification (0xCF) was caught and ignored to stop it from being reported as an "unknown event" in the logs.
The missing button release event is creating issues on Android-x86, as reported on the project mailing list for a Dell Latitude 5175 model, since the events are expected in down/up pairs.
Report the power button release event to fix this issue.
--- drivers/platform/x86/intel-hid.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/platform/x86/intel-hid.c +5 -2
@@ -363,7 +363,7 @@ wakeup:* the 5-button array, but still send notifies with power button * event code to this device object on power button actions. * -* Report the power button press; catch and ignore the button release. +* Report the power button press and release. */ if (!priv->array) {if (event ==0xce ) {
@@ -372,8 +372,11 @@ wakeup:return ; } -if (event ==0xcf ) +if (event ==0xcf ) { +input_report_key (priv->input_dev,KEY_POWER ,0 ); +input_sync (priv->input_dev);return ; + } }/* 0xC0 is for HID events, other values are for 5 button array */
Signature · 1 line
2.19.1