5.8.17-rc1 review
Subsystems (3)
Greg Kroah-Hartman
maintainerPATCH 450/633 clk: at91: clk-main: update key before writing AT91_CKGR_MOR
In reply to Greg Kroah-HartmanFrom: Claudiu Beznea <[email protected]>
[ Upstream commit 85d071e7f19a6a9abf30476b90b3819642568756 ]
SAMA5D2 datasheet specifies on chapter 33.22.8 (PMC Clock Generator Main Oscillator Register) that writing any value other than 0x37 on KEY field aborts the write operation. Use the key when selecting main clock parent.
--- drivers/clk/at91/clk-main.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/clk/at91/clk-main.c +8 -3
@@ -437,12 +437,17 @@ static int clk_sam9x5_main_set_parent(struct clk_hw *hw, u8 index)return -EINVAL ;regmap_read (regmap,AT91_CKGR_MOR , &tmp); - tmp &= ~MOR_KEY_MASK ;if (index && !(tmp &AT91_PMC_MOSCSEL )) -regmap_write (regmap,AT91_CKGR_MOR , tmp |AT91_PMC_MOSCSEL ); + tmp =AT91_PMC_MOSCSEL ;else if (!index && (tmp &AT91_PMC_MOSCSEL )) -regmap_write (regmap,AT91_CKGR_MOR , tmp & ~AT91_PMC_MOSCSEL ); + tmp =0 ; +else +return 0 ; + +regmap_update_bits (regmap,AT91_CKGR_MOR , +AT91_PMC_MOSCSEL |MOR_KEY_MASK , + tmp |AT91_PMC_KEY );while (!clk_sam9x5_main_ready (regmap))cpu_relax ();
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 451/633 clk: bcm2835: add missing release if devm_clk_hw_register fails
In reply to Greg Kroah-HartmanFrom: Navid Emamdoost <[email protected]>
[ Upstream commit f6c992ca7dd4f49042eec61f3fb426c94d901675 ]
In the implementation of bcm2835_register_pll(), the allocated pll is leaked if devm_clk_hw_register() fails to register hw. Release pll if devm_clk_hw_register() fails.
--- drivers/clk/bcm/clk-bcm2835.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/clk/bcm/clk-bcm2835.c +3 -1
@@ -1337,8 +1337,10 @@ static struct clk_hw *bcm2835_register_pll(struct bcm2835_cprman *cprman, pll->hw.init = &init; ret =devm_clk_hw_register (cprman->dev, &pll->hw); -if (ret) +if (ret) { +kfree (pll);return NULL ; + }return &pll->hw; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 452/633 kbuild: deb-pkg: do not build linux-headers package if CONFIG_MODULES=n
In reply to Greg Kroah-HartmanFrom: Masahiro Yamada <[email protected]>
[ Upstream commit bac977cbc0d6731fb8e67c2be0e4acbd959e10b3 ]
Since commit 269a535ca931 ("modpost: generate vmlinux.symvers and reuse it for the second modpost"), with CONFIG_MODULES disabled, "make deb-pkg" (or "make bindeb-pkg") fails with:
find: ‘Module.symvers’: No such file or directory
If CONFIG_MODULES is disabled, it doesn't really make sense to build the linux-headers package.
--- scripts/package/builddeb | 6 ++++-- scripts/package/mkdebian | 19 ++++++++++++------- 2 files changed, 16 insertions(+), 9 deletions(-)
scripts/package/builddeb +4 -2
@@ -202,8 +202,10 @@ EOF done if [ "$ARCH" != "um" ]; then - deploy_kernel_headers debian/linux-headers - create_package linux-headers-$version debian/linux-headers + if is_enabled CONFIG_MODULES; then + deploy_kernel_headers debian/linux-headers + create_package linux-headers-$version debian/linux-headers + fi deploy_libc_headers debian/linux-libc-dev create_package linux-libc-dev debian/linux-libc-dev
scripts/package/mkdebian +12 -7
@@ -183,13 +183,6 @@ Description: Linux kernel, version $version This package contains the Linux kernel, modules and corresponding other files, version: $version. -Package: $kernel_headers_packagename -Architecture: $debarch -Description: Linux kernel headers for $version on $debarch - This package provides kernel header files for $version on $debarch - . - This is useful for people who need to build external modules - Package: linux-libc-dev Section: devel Provides: linux-kernel-headers
@@ -200,6 +193,18 @@ Description: Linux support headers for userspace development Multi-Arch: same EOF +if is_enabled CONFIG_MODULES; then +cat <<EOF >> debian/control + +Package: $kernel_headers_packagename +Architecture: $debarch +Description: Linux kernel headers for $version on $debarch + This package provides kernel header files for $version on $debarch + . + This is useful for people who need to build external modules +EOF +fi + if is_enabled CONFIG_DEBUG_INFO; then cat <<EOF >> debian/control
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 453/633 watchdog: Fix memleak in watchdog_cdev_register
In reply to Greg Kroah-HartmanFrom: Dinghao Liu <[email protected]>
[ Upstream commit 5afb6d203d0293512aa2c6ae098274a2a4f6ed02 ]
When watchdog_kworker is NULL, we should free wd_data before the function returns to prevent memleak.
--- drivers/watchdog/watchdog_dev.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/watchdog/watchdog_dev.c +3 -1
@@ -991,8 +991,10 @@ static int watchdog_cdev_register(struct watchdog_device *wdd) wd_data->wdd = wdd; wdd->wd_data = wd_data; -if (IS_ERR_OR_NULL (watchdog_kworker)) +if (IS_ERR_OR_NULL (watchdog_kworker)) { +kfree (wd_data);return -ENODEV ; + }device_initialize (&wd_data->dev); wd_data->dev.devt =MKDEV (MAJOR (watchdog_devt), wdd->id);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 454/633 watchdog: Use put_device on error
In reply to Greg Kroah-HartmanFrom: Dinghao Liu <[email protected]>
[ Upstream commit 937425d4cd3ae4e2882b41e332bbbab616bcf0ad ]
We should use put_device() instead of freeing device directly after device_initialize().
--- drivers/watchdog/watchdog_dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/watchdog/watchdog_dev.c +1 -1
@@ -1020,7 +1020,7 @@ static int watchdog_cdev_register(struct watchdog_device *wdd)pr_err ("%s: a legacy watchdog module is probably present.\n" , wdd->info->identity); old_wd_data =NULL ; -kfree (wd_data); +put_device (&wd_data->dev);return err; } }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 455/633 watchdog: sp5100: Fix definition of EFCH_PM_DECODEEN3
In reply to Greg Kroah-HartmanFrom: Guenter Roeck <[email protected]>
[ Upstream commit 08c619b4923056b5dd2d5045757468c76ad0e3fe ]
EFCH_PM_DECODEEN3 is supposed to access DECODEEN register bits 24..31, in other words the register at byte offset 3.
--- drivers/watchdog/sp5100_tco.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/watchdog/sp5100_tco.h +1 -1
@@ -70,7 +70,7 @@#define EFCH_PM_DECODEEN_WDT_TMREN BIT(7) -#define EFCH_PM_DECODEEN3 0x00 +#define EFCH_PM_DECODEEN3 0x03#define EFCH_PM_DECODEEN_SECOND_RES GENMASK(1, 0)#define EFCH_PM_WATCHDOG_DISABLE ((u8)GENMASK(3, 2))
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 456/633 svcrdma: fix bounce buffers for unaligned offsets and multiple pages
In reply to Greg Kroah-HartmanFrom: Dan Aloni <[email protected]>
[ Upstream commit c327a310ec4d6ecbea13185ed56c11def441d9ab ]
This was discovered using O_DIRECT at the client side, with small unaligned file offsets or IOs that span multiple file pages.
--- net/sunrpc/xprtrdma/svc_rdma_sendto.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/sunrpc/xprtrdma/svc_rdma_sendto.c +2 -1
@@ -637,10 +637,11 @@ static int svc_rdma_pull_up_reply_msg(struct svcxprt_rdma *rdma,while (remaining) { len =min_t (u32,PAGE_SIZE - pageoff, remaining); -memcpy (dst,page_address (*ppages), len); +memcpy (dst,page_address (*ppages) + pageoff, len); remaining -= len; dst += len; pageoff =0 ; + ppages++; } }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 457/633 ext4: fix dead loop in ext4_mb_new_blocks
In reply to Greg Kroah-HartmanFrom: Ye Bin <[email protected]>
[ Upstream commit 70022da804f0f3f152115688885608c39182082e ]
As we test disk offline/online with running fsstress, we find fsstress process is keeping running state.
kworker/u32:3-262 [004] ...1 140.787471: ext4_mb_discard_preallocations: dev 8,32 needed 114
....
kworker/u32:3-262 [004] ...1 140.787471: ext4_mb_discard_preallocations: dev 8,32 needed 114
ext4_mb_new_blocks
repeat:
ext4_mb_discard_preallocations_should_retry(sb, ac, &seq)
freed = ext4_mb_discard_preallocations
ext4_mb_discard_group_preallocations
this_cpu_inc(discard_pa_seq);
---> freed == 0
seq_retry = ext4_get_discard_pa_seq_sum
for_each_possible_cpu(__cpu)
__seq += per_cpu(discard_pa_seq, __cpu);
if (seq_retry != *seq) {
*seq = seq_retry;
ret = true;
}As we see seq_retry is sum of discard_pa_seq every cpu, if ext4_mb_discard_group_preallocations return zero discard_pa_seq in this cpu maybe increase one, so condition "seq_retry != *seq" have always been met.
Ritesh Harjani suggest to in ext4_mb_discard_group_preallocations function we only increase discard_pa_seq when there is some PA to free.
--- fs/ext4/mballoc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/ext4/mballoc.c +3 -1
@@ -4066,7 +4066,6 @@ ext4_mb_discard_group_preallocations(struct super_block *sb,INIT_LIST_HEAD (&list); repeat:ext4_lock_group (sb, group); -this_cpu_inc (discard_pa_seq);list_for_each_entry_safe (pa, tmp, &grp->bb_prealloc_list, pa_group_list) {spin_lock (&pa->pa_lock);
@@ -4083,6 +4082,9 @@ ext4_mb_discard_group_preallocations(struct super_block *sb,/* seems this one can be freed ... */ ext4_mb_mark_pa_deleted (sb, pa); +if (!free) +this_cpu_inc (discard_pa_seq); +/* we can trust pa_free ... */ free += pa->pa_free;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 458/633 ext4: discard preallocations before releasing group lock
In reply to Greg Kroah-HartmanFrom: Jan Kara <[email protected]>
[ Upstream commit 5b3dc19dda6691e8ab574e8eede1aef6f02a4f1c ]
ext4_mb_discard_group_preallocations() can be releasing group lock with preallocations accumulated on its local list. Thus although discard_pa_seq was incremented and concurrent allocating processes will be retrying allocations, it can happen that premature ENOSPC error is returned because blocks used for preallocations are not available for reuse yet. Make sure we always free locally accumulated preallocations before releasing group lock.
--- fs/ext4/mballoc.c | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-)
fs/ext4/mballoc.c +13 -20
@@ -4037,7 +4037,7 @@ ext4_mb_discard_group_preallocations(struct super_block *sb,struct ext4_buddy e4b;int err;int busy =0 ; -int free =0 ; +int free, free_total =0 ;mb_debug (sb,"discard preallocation for group %u\n" , group);if (list_empty (&grp->bb_prealloc_list))
@@ -4065,6 +4065,7 @@ ext4_mb_discard_group_preallocations(struct super_block *sb,INIT_LIST_HEAD (&list); repeat: + free =0 ;ext4_lock_group (sb, group);list_for_each_entry_safe (pa, tmp, &grp->bb_prealloc_list, pa_group_list) {
@@ -4094,22 +4095,6 @@ ext4_mb_discard_group_preallocations(struct super_block *sb,list_add (&pa->u.pa_tmp_list, &list); } -/* if we still need more blocks and some PAs were used, try again */ -if (free < needed && busy) { - busy =0 ; -ext4_unlock_group (sb, group); -cond_resched (); - goto repeat; - } - -/* found anything to free? */ -if (list_empty (&list)) { -BUG_ON (free !=0 ); -mb_debug (sb,"Someone else may have freed PA for this group %u\n" , - group); - goto out; - } -/* now free all selected PAs */ list_for_each_entry_safe (pa, tmp, &list, u.pa_tmp_list) {
@@ -4127,14 +4112,22 @@ ext4_mb_discard_group_preallocations(struct super_block *sb,call_rcu (&(pa)->u.pa_rcu, ext4_mb_pa_callback); } -out: + free_total += free; + +/* if we still need more blocks and some PAs were used, try again */ +if (free_total < needed && busy) { +ext4_unlock_group (sb, group); +cond_resched (); + busy =0 ; + goto repeat; + }ext4_unlock_group (sb, group);ext4_mb_unload_buddy (&e4b);put_bh (bitmap_bh); out_dbg:mb_debug (sb,"discarded (%d) blocks preallocated for group %u bb_free (%d)\n" , - free, group, grp->bb_free); -return free; + free_total, group, grp->bb_free); +return free_total; }/*
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 459/633 ext4: disallow modifying DAX inode flag if inline_data has been set
In reply to Greg Kroah-HartmanFrom: Xiao Yang <[email protected]>
[ Upstream commit aa2f77920b743c44e02e2dc8474bbf8bd30007a2 ]
inline_data is mutually exclusive to DAX so enabling both of them triggers the following issue:
------------------------------------------
# mkfs.ext4 -F -O inline_data /dev/pmem1 ... # mount /dev/pmem1 /mnt # echo 'test' >/mnt/file # lsattr -l /mnt/file /mnt/file Inline_Data # xfs_io -c "chattr +x" /mnt/file # xfs_io -c "lsattr -v" /mnt/file [dax] /mnt/file # umount /mnt # mount /dev/pmem1 /mnt # cat /mnt/file cat: /mnt/file: Numerical result out of range ------------------------------------------
--- fs/ext4/ext4.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ext4/ext4.h +1 -1
@@ -466,7 +466,7 @@ struct flex_groups {/* Flags which are mutually exclusive to DAX */ #define EXT4_DAX_MUT_EXCL (EXT4_VERITY_FL | EXT4_ENCRYPT_FL |\ - EXT4_JOURNAL_DATA_FL) + EXT4_JOURNAL_DATA_FL | EXT4_INLINE_DATA_FL)/* Mask out flags that are inappropriate for the given type of inode. */ static inline __u32 ext4_mask_flags (umode_t mode,__u32 flags)
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 460/633 ext4: limit entries returned when counting fsmap records
In reply to Greg Kroah-HartmanFrom: Darrick J. Wong <[email protected]>
[ Upstream commit af8c53c8bc087459b1aadd4c94805d8272358d79 ]
If userspace asked fsmap to try to count the number of entries, we cannot return more than UINT_MAX entries because fmh_entries is u32. Therefore, stop counting if we hit this limit or else we will waste time to return truncated results.
--- fs/ext4/fsmap.c | 3 +++ 1 file changed, 3 insertions(+)
fs/ext4/fsmap.c +3 -0
@@ -108,6 +108,9 @@ static int ext4_getfsmap_helper(struct super_block *sb,/* Are we just counting mappings? */ if (info->gfi_head->fmh_count ==0 ) { +if (info->gfi_head->fmh_entries ==UINT_MAX ) +return EXT4_QUERY_RANGE_ABORT ; +if (rec_fsblk > info->gfi_next_fsblk) info->gfi_head->fmh_entries++;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 461/633 vfio/pci: Clear token on bypass registration failure
In reply to Greg Kroah-HartmanFrom: Alex Williamson <[email protected]>
[ Upstream commit 852b1beecb6ff9326f7ca4bc0fe69ae860ebdb9e ]
The eventfd context is used as our irqbypass token, therefore if an eventfd is re-used, our token is the same. The irqbypass code will return an -EBUSY in this case, but we'll still attempt to unregister the producer, where if that duplicate token still exists, results in removing the wrong object. Clear the token of failed producers so that they harmlessly fall out when unregistered.
--- drivers/vfio/pci/vfio_pci_intrs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/vfio/pci/vfio_pci_intrs.c +3 -1
@@ -352,11 +352,13 @@ static int vfio_msi_set_vector_signal(struct vfio_pci_device *vdev, vdev->ctx[vector].producer.token = trigger; vdev->ctx[vector].producer.irq = irq; ret =irq_bypass_register_producer (&vdev->ctx[vector].producer); -if (unlikely (ret)) +if (unlikely (ret)) {dev_info (&pdev->dev,"irq bypass producer (token %p) registration fails: %d\n" , vdev->ctx[vector].producer.token, ret); + vdev->ctx[vector].producer.token =NULL ; + } vdev->ctx[vector].trigger = trigger;return 0 ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 462/633 vfio iommu type1: Fix memory leak in vfio_iommu_type1_pin_pages
In reply to Greg Kroah-HartmanFrom: Xiaoyang Xu <[email protected]>
[ Upstream commit 2e6cfd496f5b57034cf2aec738799571b5a52124 ]
pfn is not added to pfn_list when vfio_add_to_pfn_list fails. vfio_unpin_page_external will exit directly without calling vfio_iova_put_vfio_pfn. This will lead to a memory leak.
--- drivers/vfio/vfio_iommu_type1.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/vfio/vfio_iommu_type1.c +2 -1
@@ -693,7 +693,8 @@ static int vfio_iommu_type1_pin_pages(void *iommu_data, ret =vfio_add_to_pfn_list (dma, iova, phys_pfn[i]);if (ret) { -vfio_unpin_page_external (dma, iova, do_accounting); +if (put_pfn (phys_pfn[i], dma->prot) && do_accounting) +vfio_lock_acct (dma,-1 , true); goto pin_unwind; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 463/633 clk: imx8mq: Fix usdhc parents order
In reply to Greg Kroah-HartmanFrom: Abel Vesa <[email protected]>
[ Upstream commit b159c63d82ff8ffddc6c6f0eb881b113b36ecad7 ]
According to the latest RM (see Table 5-1. Clock Root Table), both usdhc root clocks have the parent order as follows:
000 - 25M_REF_CLK
001 - SYSTEM_PLL1_DIV2
010 - SYSTEM_PLL1_CLK
011 - SYSTEM_PLL2_DIV2
100 - SYSTEM_PLL3_CLK
101 - SYSTEM_PLL1_DIV3
110 - AUDIO_PLL2_CLK
111 - SYSTEM_PLL1_DIV8
So the audio_pll2_out and sys3_pll_out have to be swapped.
--- drivers/clk/imx/clk-imx8mq.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/clk/imx/clk-imx8mq.c +2 -2
@@ -157,10 +157,10 @@ static const char * const imx8mq_qspi_sels[] = {"osc_25m", "sys1_pll_400m", "sys "audio_pll2_out", "sys1_pll_266m", "sys3_pll_out", "sys1_pll_100m", };static const char *const imx8mq_usdhc1_sels[] = {"osc_25m" ,"sys1_pll_400m" ,"sys1_pll_800m" ,"sys2_pll_500m" , -"audio_pll2_out" ,"sys1_pll_266m" ,"sys3_pll_out" ,"sys1_pll_100m" , }; +"sys3_pll_out" ,"sys1_pll_266m" ,"audio_pll2_out" ,"sys1_pll_100m" , };static const char *const imx8mq_usdhc2_sels[] = {"osc_25m" ,"sys1_pll_400m" ,"sys1_pll_800m" ,"sys2_pll_500m" , -"audio_pll2_out" ,"sys1_pll_266m" ,"sys3_pll_out" ,"sys1_pll_100m" , }; +"sys3_pll_out" ,"sys1_pll_266m" ,"audio_pll2_out" ,"sys1_pll_100m" , };static const char *const imx8mq_i2c1_sels[] = {"osc_25m" ,"sys1_pll_160m" ,"sys2_pll_50m" ,"sys3_pll_out" ,"audio_pll1_out" ,"video_pll1_out" ,"audio_pll2_out" ,"sys1_pll_133m" , };
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 464/633 SUNRPC: fix copying of multiple pages in gss_read_proxy_verf()
In reply to Greg Kroah-HartmanFrom: Martijn de Gouw <[email protected]>
[ Upstream commit d48c8124749c9a5081fe68680f83605e272c984b ]
When the passed token is longer than 4032 bytes, the remaining part of the token must be copied from the rqstp->rq_arg.pages. But the copy must make sure it happens in a consecutive way.
With the existing code, the first memcpy copies 'length' bytes from argv->iobase, but since the header is in front, this never fills the whole first page of in_token->pages.
The mecpy in the loop copies the following bytes, but starts writing at the next page of in_token->pages. This leaves the last bytes of page 0 unwritten.
Symptoms were that users with many groups were not able to access NFS exports, when using Active Directory as the KDC.
--- net/sunrpc/auth_gss/svcauth_gss.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-)
net/sunrpc/auth_gss/svcauth_gss.c +17 -10
@@ -1104,9 +1104,9 @@ static int gss_read_proxy_verf(struct svc_rqst *rqstp, struct gssp_in_token *in_token) {struct kvec *argv = &rqstp->rq_arg.head[0 ]; -unsigned int page_base, length; -int pages, i, res; -size_t inlen; +unsigned int length, pgto_offs, pgfrom_offs; +int pages, i, res, pgto, pgfrom; +size_t inlen, to_offs, from_offs; res =gss_read_common_verf (gc, argv, authp, in_handle);if (res)
@@ -1134,17 +1134,24 @@ static int gss_read_proxy_verf(struct svc_rqst *rqstp,memcpy (page_address (in_token->pages[0 ]), argv->iov_base, length); inlen -= length; - i =1 ; - page_base = rqstp->rq_arg.page_base; + to_offs = length; + from_offs = rqstp->rq_arg.page_base;while (inlen) { - length = min_t(unsigned int, inlen, PAGE_SIZE); -memcpy (page_address (in_token->pages[i]), -page_address (rqstp->rq_arg.pages[i]) + page_base, + pgto = to_offs >>PAGE_SHIFT ; + pgfrom = from_offs >>PAGE_SHIFT ; + pgto_offs = to_offs & ~PAGE_MASK ; + pgfrom_offs = from_offs & ~PAGE_MASK ; + + length = min_t(unsigned int, inlen, + min_t(unsigned int, PAGE_SIZE - pgto_offs, +PAGE_SIZE - pgfrom_offs)); +memcpy (page_address (in_token->pages[pgto]) + pgto_offs, +page_address (rqstp->rq_arg.pages[pgfrom]) + pgfrom_offs, length); + to_offs += length; + from_offs += length; inlen -= length; - page_base =0 ; - i++; }return 0 ; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 465/633 platform/chrome: cros_ec_lightbar: Reduce ligthbar get version command
In reply to Greg Kroah-HartmanFrom: Gwendal Grignou <[email protected]>
[ Upstream commit 1e7913ff5f9f1b73146ad8522958bd266f22a510 ]
By default, the lightbar commands are set to the biggest lightbar command and response. That length is greater than 128 bytes and may not work on all machines. But all EC are probed for lightbar by sending a get version request. Set that request size precisely.
Before the command would be:
cros_ec_cmd: version: 0, command: EC_CMD_LIGHTBAR_CMD, outsize: 194, insize: 128, result: 0
Afer:
cros_ec_cmd: version: 0, command: EC_CMD_LIGHTBAR_CMD, outsize: 1, insize: 8, result: 0
--- drivers/platform/chrome/cros_ec_lightbar.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/platform/chrome/cros_ec_lightbar.c +2 -0
@@ -116,6 +116,8 @@ static int get_lightbar_version(struct cros_ec_dev *ec, param = (struct ec_params_lightbar *)msg->data; param->cmd =LIGHTBAR_CMD_VERSION ; + msg->outsize =sizeof (param->cmd); + msg->result =sizeof (resp->version); ret =cros_ec_cmd_xfer_status (ec->ec_dev, msg);if (ret <0 ) { ret =0 ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 466/633 Input: elants_i2c - fix typo for an attribute to show calibration count
In reply to Greg Kroah-HartmanFrom: Johnny Chuang <[email protected]>
[ Upstream commit 93f634069707cfe562c38739f5062feccbe9a834 ]
Fixed typo for command from 0xE0 to 0xD0.
--- drivers/input/touchscreen/elants_i2c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/touchscreen/elants_i2c.c +1 -1
@@ -90,7 +90,7 @@/* FW read command, 0x53 0x?? 0x0, 0x01 */ #define E_ELAN_INFO_FW_VER 0x00#define E_ELAN_INFO_BC_VER 0x10 -#define E_ELAN_INFO_REK 0xE0 +#define E_ELAN_INFO_REK 0xD0#define E_ELAN_INFO_TEST_VER 0xE0#define E_ELAN_INFO_FW_ID 0xF0#define E_INFO_OSR 0xD6
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 467/633 Input: imx6ul_tsc - clean up some errors in imx6ul_tsc_resume()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 30df23c5ecdfb8da5b0bc17ceef67eff9e1b0957 ]
If imx6ul_tsc_init() fails then we need to clean up the clocks.
I reversed the "if (input_dev->users) {" condition to make the code a bit simpler.
--- drivers/input/touchscreen/imx6ul_tsc.c | 27 +++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-)
drivers/input/touchscreen/imx6ul_tsc.c +16 -11
@@ -530,20 +530,25 @@ static int __maybe_unused imx6ul_tsc_resume(struct device *dev)mutex_lock (&input_dev->mutex); -if (input_dev->users) { - retval =clk_prepare_enable (tsc->adc_clk); -if (retval) - goto out; - - retval =clk_prepare_enable (tsc->tsc_clk); -if (retval) { -clk_disable_unprepare (tsc->adc_clk); - goto out; - } +if (!input_dev->users) + goto out; - retval =imx6ul_tsc_init (tsc); + retval =clk_prepare_enable (tsc->adc_clk); +if (retval) + goto out; + + retval =clk_prepare_enable (tsc->tsc_clk); +if (retval) { +clk_disable_unprepare (tsc->adc_clk); + goto out; } + retval =imx6ul_tsc_init (tsc); +if (retval) { +clk_disable_unprepare (tsc->tsc_clk); +clk_disable_unprepare (tsc->adc_clk); + goto out; + } out:mutex_unlock (&input_dev->mutex);return retval;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 468/633 Input: stmfts - fix a & vs && typo
In reply to Greg Kroah-HartmanFrom: YueHaibing <[email protected]>
[ Upstream commit d04afe14b23651e7a8bc89727a759e982a8458e4 ]
In stmfts_sysfs_hover_enable_write(), we should check value and sdata->hover_enabled is all true.
--- drivers/input/touchscreen/stmfts.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/touchscreen/stmfts.c +1 -1
@@ -479,7 +479,7 @@ static ssize_t stmfts_sysfs_hover_enable_write(struct device *dev,mutex_lock (&sdata->mutex); -if (value & sdata->hover_enabled) +if (value && sdata->hover_enabled) goto out;if (sdata->running)
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 469/633 Input: ep93xx_keypad - fix handling of platform_get_irq() error
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit 7d50f6656dacf085a00beeedbc48b19a37d17881 ]
platform_get_irq() returns -ERRNO on error. In such case comparison to 0 would pass the check.
--- drivers/input/keyboard/ep93xx_keypad.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/input/keyboard/ep93xx_keypad.c +2 -2
@@ -250,8 +250,8 @@ static int ep93xx_keypad_probe(struct platform_device *pdev) } keypad->irq =platform_get_irq (pdev,0 ); -if (!keypad->irq) { - err = -ENXIO ; +if (keypad->irq <0 ) { + err = keypad->irq; goto failed_free; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 470/633 Input: omap4-keypad - fix handling of platform_get_irq() error
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit 4738dd1992fa13acfbbd71800c71c612f466fa44 ]
platform_get_irq() returns -ERRNO on error. In such case comparison to 0 would pass the check.
--- drivers/input/keyboard/omap4-keypad.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/input/keyboard/omap4-keypad.c +2 -4
@@ -240,10 +240,8 @@ static int omap4_keypad_probe(struct platform_device *pdev) } irq =platform_get_irq (pdev,0 ); -if (!irq) { -dev_err (&pdev->dev,"no keyboard irq assigned\n" ); -return -EINVAL ; - } +if (irq <0 ) +return irq; keypad_data =kzalloc (sizeof (struct omap4_keypad ),GFP_KERNEL );if (!keypad_data) {
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 471/633 Input: twl4030_keypad - fix handling of platform_get_irq() error
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit c277e1f0dc3c7d7b5b028e20dd414df241642036 ]
platform_get_irq() returns -ERRNO on error. In such case casting to unsigned and comparing to 0 would pass the check.
--- drivers/input/keyboard/twl4030_keypad.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/input/keyboard/twl4030_keypad.c +3 -5
@@ -50,7 +50,7 @@ struct twl4030_keypad {bool autorepeat;unsigned int n_rows;unsigned int n_cols; -unsigned int irq; +int irq;struct device *dbg_dev;struct input_dev *input;
@@ -376,10 +376,8 @@ static int twl4030_kp_probe(struct platform_device *pdev) } kp->irq =platform_get_irq (pdev,0 ); -if (!kp->irq) { -dev_err (&pdev->dev,"no keyboard irq assigned\n" ); -return -EINVAL ; - } +if (kp->irq <0 ) +return kp->irq; error = matrix_keypad_build_keymap(keymap_data, NULL, TWL4030_MAX_ROWS,
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 472/633 Input: sun4i-ps2 - fix handling of platform_get_irq() error
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit cafb3abea6136e59ea534004e5773361e196bb94 ]
platform_get_irq() returns -ERRNO on error. In such case comparison to 0 would pass the check.
--- drivers/input/serio/sun4i-ps2.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/input/serio/sun4i-ps2.c +3 -6
@@ -211,7 +211,6 @@ static int sun4i_ps2_probe(struct platform_device *pdev)struct sun4i_ps2data *drvdata;struct serio *serio;struct device *dev = &pdev->dev; -unsigned int irq;int error; drvdata =kzalloc (sizeof (struct sun4i_ps2data ),GFP_KERNEL );
@@ -264,14 +263,12 @@ static int sun4i_ps2_probe(struct platform_device *pdev)writel (0 , drvdata->reg_base +PS2_REG_GCTL );/* Get IRQ for the device */ - irq =platform_get_irq (pdev,0 ); -if (!irq) { -dev_err (dev,"no IRQ found\n" ); - error = -ENXIO ; + drvdata->irq =platform_get_irq (pdev,0 ); +if (drvdata->irq <0 ) { + error = drvdata->irq; goto err_disable_clk; } - drvdata->irq = irq; drvdata->serio = serio; drvdata->dev = dev;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 473/633 KVM: x86: emulating RDPID failure shall return #UD rather than #GP
In reply to Greg Kroah-HartmanFrom: Robert Hoo <[email protected]>
[ Upstream commit a9e2e0ae686094571378c72d8146b5a1a92d0652 ]
Per Intel's SDM, RDPID takes a #UD if it is unsupported, which is more or less what KVM is emulating when MSR_TSC_AUX is not available. In fact, there are no scenarios in which RDPID is supposed to #GP.
Message-Id: <[email protected]>
--- arch/x86/kvm/emulate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kvm/emulate.c +1 -1
@@ -3594,7 +3594,7 @@ static int em_rdpid(struct x86_emulate_ctxt *ctxt)u64 tsc_aux =0 ;if (ctxt->ops->get_msr (ctxt,MSR_TSC_AUX , &tsc_aux)) -return emulate_gp (ctxt,0 ); +return emulate_ud (ctxt); ctxt->dst.val = tsc_aux;return X86EMUL_CONTINUE ; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 474/633 scsi: bfa: Fix error return in bfad_pci_init()
In reply to Greg Kroah-HartmanFrom: Jing Xiangfeng <[email protected]>
[ Upstream commit f0f6c3a4fcb80fcbcce4ff6739996dd98c228afd ]
Fix to return error code -ENODEV from the error handling case instead of 0.
--- drivers/scsi/bfa/bfad.c | 1 + 1 file changed, 1 insertion(+)
drivers/scsi/bfa/bfad.c +1 -0
@@ -749,6 +749,7 @@ bfad_pci_init(struct pci_dev *pdev, struct bfad_s *bfad)if (bfad->pci_bar0_kva ==NULL ) {printk (KERN_ERR "Fail to map bar0\n" ); + rc = -ENODEV ; goto out_release_region; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 475/633 arm64: mm: use single quantity to represent the PA to VA translation
In reply to Greg Kroah-HartmanFrom: Ard Biesheuvel <[email protected]>
[ Upstream commit 7bc1a0f9e1765830e945669c99c59c35cf9bca82 ]
On arm64, the global variable memstart_addr represents the physical address of PAGE_OFFSET, and so physical to virtual translations or vice versa used to come down to simple additions or subtractions involving the values of PAGE_OFFSET and memstart_addr.
When support for 52-bit virtual addressing was introduced, we had to deal with PAGE_OFFSET potentially being outside of the region that can be covered by the virtual range (as the 52-bit VA capable build needs to be able to run on systems that are only 48-bit VA capable), and for this reason, another translation was introduced, and recorded in the global variable physvirt_offset.
However, if we go back to the original definition of memstart_addr, i.e., the physical address of PAGE_OFFSET, it turns out that there is no need for two separate translations: instead, we can simply subtract the size of the unaddressable VA space from memstart_addr to make the available physical memory appear in the 48-bit addressable VA region.
This simplifies things, but also fixes a bug on KASLR builds, which may update memstart_addr later on in arm64_memblock_init(), but fails to update vmemmap and physvirt_offset accordingly.
--- arch/arm64/include/asm/memory.h | 5 ++--- arch/arm64/include/asm/pgtable.h | 4 ++-- arch/arm64/mm/init.c | 30 ++++++++++-------------------- 3 files changed, 14 insertions(+), 25 deletions(-)
arch/arm64/include/asm/memory.h +2 -3
@@ -163,7 +163,6 @@ extern u64 vabits_actual;#include <linux/bitops.h> #include <linux/mmdebug.h> -extern s64 physvirt_offset;extern s64 memstart_addr;/* PHYS_OFFSET - the physical address of the start of memory. */ #define PHYS_OFFSET ({ VM_BUG_ON(memstart_addr & 1); memstart_addr; })
@@ -239,7 +238,7 @@ static inline const void *__tag_set(const void *addr, u8 tag)*/ #define __is_lm_address (addr) (!(((u64)addr) & BIT(vabits_actual - 1))) -#define __lm_to_phys (addr) (((addr) + physvirt_offset)) +#define __lm_to_phys (addr) (((addr) & ~PAGE_OFFSET) + PHYS_OFFSET)#define __kimg_to_phys (addr) ((addr) - kimage_voffset)#define __virt_to_phys_nodebug (x) ({ \
@@ -257,7 +256,7 @@ extern phys_addr_t __phys_addr_symbol(unsigned long x);#define __phys_addr_symbol (x) __pa_symbol_nodebug(x)#endif /* CONFIG_DEBUG_VIRTUAL */ -#define __phys_to_virt (x) ((unsigned long)((x) - physvirt_offset)) +#define __phys_to_virt (x) ((unsigned long)((x) - PHYS_OFFSET) | PAGE_OFFSET)#define __phys_to_kimg (x) ((unsigned long)((x) + kimage_voffset))/*
arch/arm64/include/asm/pgtable.h +2 -2
@@ -23,6 +23,8 @@#define VMALLOC_START (MODULES_END)#define VMALLOC_END (- PUD_SIZE - VMEMMAP_SIZE - SZ_64K) +#define vmemmap ((struct page *)VMEMMAP_START - (memstart_addr >> PAGE_SHIFT)) +#define FIRST_USER_ADDRESS 0UL#ifndef __ASSEMBLY__
@@ -33,8 +35,6 @@#include <linux/mm_types.h> #include <linux/sched.h> -extern struct page *vmemmap; -extern void __pte_error (const char *file,int line,unsigned long val);extern void __pmd_error (const char *file,int line,unsigned long val);extern void __pud_error (const char *file,int line,unsigned long val);
arch/arm64/mm/init.c +10 -20
@@ -54,12 +54,6 @@s64 memstart_addr__ro_after_init =-1 ;EXPORT_SYMBOL (memstart_addr); -s64 physvirt_offset__ro_after_init ; -EXPORT_SYMBOL (physvirt_offset); - -struct page *vmemmap__ro_after_init ; -EXPORT_SYMBOL (vmemmap); -/* * We create both ZONE_DMA and ZONE_DMA32. ZONE_DMA covers the first 1G of * memory as some devices, namely the Raspberry Pi 4, have peripherals with
@@ -290,20 +284,6 @@ void __init arm64_memblock_init(void) memstart_addr =round_down (memblock_start_of_DRAM (),ARM64_MEMSTART_ALIGN ); - physvirt_offset =PHYS_OFFSET -PAGE_OFFSET ; - - vmemmap = ((struct page *)VMEMMAP_START - (memstart_addr >>PAGE_SHIFT )); - -/* -* If we are running with a 52-bit kernel VA config on a system that -* does not support it, we have to offset our vmemmap and physvirt_offset -* s.t. we avoid the 52-bit portion of the direct linear map -*/ -if (IS_ENABLED (CONFIG_ARM64_VA_BITS_52 ) && (vabits_actual !=52 )) { - vmemmap += (_PAGE_OFFSET (48 ) -_PAGE_OFFSET (52 )) >>PAGE_SHIFT ; - physvirt_offset =PHYS_OFFSET -_PAGE_OFFSET (48 ); - } -/* * Remove the memory that we will not be able to cover with the * linear mapping. Take care not to clip the kernel which may be
@@ -318,6 +298,16 @@ void __init arm64_memblock_init(void)memblock_remove (0 , memstart_addr); } +/* +* If we are running with a 52-bit kernel VA config on a system that +* does not support it, we have to place the available physical +* memory in the 48-bit addressable part of the linear region, i.e., +* we have to move it upward. Since memstart_addr represents the +* physical address of PAGE_OFFSET, we have to *subtract* from it. +*/ +if (IS_ENABLED (CONFIG_ARM64_VA_BITS_52 ) && (vabits_actual !=52 )) + memstart_addr -=_PAGE_OFFSET (48 ) -_PAGE_OFFSET (52 ); +/* * Apply the memory limit if it was set. Since the kernel may be loaded * high up in memory, add back the kernel region that must be accessible
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 476/633 netfilter: conntrack: connection timeout after re-register
In reply to Greg Kroah-HartmanFrom: Francesco Ruggeri <[email protected]>
[ Upstream commit 4f25434bccc28cf8a07876ef5142a2869a674353 ]
If the first packet conntrack sees after a re-register is an outgoing keepalive packet with no data (SEG.SEQ = SND.NXT-1), td_end is set to SND.NXT-1.
When the peer correctly acknowledges SND.NXT, tcp_in_window fails check III (Upper bound for valid (s)ack: sack <= receiver.td_end) and returns false, which cascades into nf_conntrack_in setting skb->_nfct = 0 and in later conntrack iptables rules not matching. In cases where iptables are dropping packets that do not match conntrack rules this can result in idle tcp connections to time out.
v2: adjust td_end when getting the reply rather than when sending out
the keepalive packet.
--- net/netfilter/nf_conntrack_proto_tcp.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-)
net/netfilter/nf_conntrack_proto_tcp.c +13 -6
@@ -541,13 +541,20 @@ static bool tcp_in_window(const struct nf_conn *ct, swin = win << sender->td_scale; sender->td_maxwin = (swin ==0 ?1 : swin); sender->td_maxend = end + sender->td_maxwin; -/* -* We haven't seen traffic in the other direction yet -* but we have to tweak window tracking to pass III -* and IV until that happens. -*/ -if (receiver->td_maxwin ==0 ) +if (receiver->td_maxwin ==0 ) { +/* We haven't seen traffic in the other +* direction yet but we have to tweak window +* tracking to pass III and IV until that +* happens. +*/ receiver->td_end = receiver->td_maxend = sack; + }else if (sack == receiver->td_end +1 ) { +/* Likely a reply to a keepalive. +* Needed for III. +*/ + receiver->td_end++; + } + } } else if (((state->state == TCP_CONNTRACK_SYN_SENT && dir == IP_CT_DIR_ORIGINAL)
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 477/633 netfilter: ebtables: Fixes dropping of small packets in bridge nat
In reply to Greg Kroah-HartmanFrom: Timothée COCAULT <[email protected]>
[ Upstream commit 63137bc5882a1882c553d389fdeeeace86ee1741 ]
Fixes an error causing small packets to get dropped. skb_ensure_writable expects the second parameter to be a length in the ethernet payload.=20 If we want to write the ethernet header (src, dst), we should pass 0. Otherwise, packets with small payloads (< ETH_ALEN) will get dropped.
--- net/bridge/netfilter/ebt_dnat.c | 2 +- net/bridge/netfilter/ebt_redirect.c | 2 +- net/bridge/netfilter/ebt_snat.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
net/bridge/netfilter/ebt_dnat.c +1 -1
@@ -21,7 +21,7 @@ ebt_dnat_tg(struct sk_buff *skb, const struct xt_action_param *par) {const struct ebt_nat_info *info = par->targinfo; -if (skb_ensure_writable (skb,ETH_ALEN )) +if (skb_ensure_writable (skb,0 ))return EBT_DROP ;ether_addr_copy (eth_hdr (skb)->h_dest, info->mac);
net/bridge/netfilter/ebt_redirect.c +1 -1
@@ -21,7 +21,7 @@ ebt_redirect_tg(struct sk_buff *skb, const struct xt_action_param *par) {const struct ebt_redirect_info *info = par->targinfo; -if (skb_ensure_writable (skb,ETH_ALEN )) +if (skb_ensure_writable (skb,0 ))return EBT_DROP ;if (xt_hooknum (par) !=NF_BR_BROUTING )
net/bridge/netfilter/ebt_snat.c +1 -1
@@ -22,7 +22,7 @@ ebt_snat_tg(struct sk_buff *skb, const struct xt_action_param *par) {const struct ebt_nat_info *info = par->targinfo; -if (skb_ensure_writable (skb,ETH_ALEN *2 )) +if (skb_ensure_writable (skb,0 ))return EBT_DROP ;ether_addr_copy (eth_hdr (skb)->h_source, info->mac);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 478/633 netsec: ignore phy-mode device property on ACPI systems
In reply to Greg Kroah-HartmanFrom: Ard Biesheuvel <[email protected]>
[ Upstream commit acd7aaf51b20263a7e62d2a26569988c63bdd3d8 ]
Since commit bbc4d71d63549bc ("net: phy: realtek: fix rtl8211e rx/tx delay config"), the Realtek PHY driver will override any TX/RX delay set by hardware straps if the phy-mode device property does not match.
This is causing problems on SynQuacer based platforms (the only SoC that incorporates the netsec hardware), since many were built with this Realtek PHY, and shipped with firmware that defines the phy-mode as 'rgmii', even though the PHY is configured for TX and RX delay using pull-ups.
Quoted 1 line
From the driver's perspective, we should not make any assumptions in
the general case that the PHY hardware does not require any initial configuration. However, the situation is slightly different for ACPI boot, since it implies rich firmware with AML abstractions to handle hardware details that are not exposed to the OS. So in the ACPI case, it is reasonable to assume that the PHY comes up in the right mode, regardless of whether the mode is set by straps, by boot time firmware or by AML executed by the ACPI interpreter.
So let's ignore the 'phy-mode' device property when probing the netsec driver in ACPI mode, and hardcode the mode to PHY_INTERFACE_MODE_NA, which should work with any PHY provided that it is configured by the time the driver attaches to it. While at it, document that omitting the mode is permitted for DT probing as well, by setting the phy-mode DT property to the empty string.
--- .../bindings/net/socionext-netsec.txt | 4 +++- drivers/net/ethernet/socionext/netsec.c | 24 +++++++++++++------ 2 files changed, 20 insertions(+), 8 deletions(-)
Documentation/devicetree/bindings/net/socionext-netsec.txt +3 -1
@@ -30,7 +30,9 @@ Optional properties: (See ethernet.txt file in the same directory) - max-frame-size: See ethernet.txt in the same directory. The MAC address will be determined using the optional properties -defined in ethernet.txt. +defined in ethernet.txt. The 'phy-mode' property is required, but may +be set to the empty string if the PHY configuration is programmed by +the firmware or set by hardware straps, and needs to be preserved. Example: eth0: ethernet@522d0000 {
drivers/net/ethernet/socionext/netsec.c +17 -7
@@ -6,6 +6,7 @@#include <linux/pm_runtime.h> #include <linux/acpi.h> #include <linux/of_mdio.h> +#include <linux/of_net.h> #include <linux/etherdevice.h> #include <linux/interrupt.h> #include <linux/io.h>
@@ -1836,6 +1837,14 @@ static const struct net_device_ops netsec_netdev_ops = {static int netsec_of_probe (struct platform_device *pdev,struct netsec_priv *priv,u32 *phy_addr) { +int err; + + err =of_get_phy_mode (pdev->dev.of_node, &priv->phy_interface); +if (err) { +dev_err (&pdev->dev,"missing required property 'phy-mode'\n" ); +return err; + } + priv->phy_np =of_parse_phandle (pdev->dev.of_node,"phy-handle" ,0 );if (!priv->phy_np) {dev_err (&pdev->dev,"missing required property 'phy-handle'\n" );
@@ -1862,6 +1871,14 @@ static int netsec_acpi_probe(struct platform_device *pdev,if (!IS_ENABLED (CONFIG_ACPI ))return -ENODEV ; +/* ACPI systems are assumed to configure the PHY in firmware, so +* there is really no need to discover the PHY mode from the DSDT. +* Since firmware is known to exist in the field that configures the +* PHY correctly but passes the wrong mode string in the phy-mode +* device property, we have no choice but to ignore it. +*/ + priv->phy_interface =PHY_INTERFACE_MODE_NA ; + ret =device_property_read_u32 (&pdev->dev,"phy-channel" , phy_addr);if (ret) { dev_err(&pdev->dev,
@@ -1998,13 +2015,6 @@ static int netsec_probe(struct platform_device *pdev) priv->msg_enable =NETIF_MSG_TX_ERR |NETIF_MSG_HW |NETIF_MSG_DRV |NETIF_MSG_LINK |NETIF_MSG_PROBE ; - priv->phy_interface =device_get_phy_mode (&pdev->dev); -if ((int )priv->phy_interface <0 ) { -dev_err (&pdev->dev,"missing required property 'phy-mode'\n" ); - ret = -ENODEV ; - goto free_ndev; - } - priv->ioaddr =devm_ioremap (&pdev->dev, mmio_res->start,resource_size (mmio_res));if (!priv->ioaddr) {
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 479/633 netfilter: nf_fwd_netdev: clear timestamp in forwarding path
In reply to Greg Kroah-HartmanFrom: Pablo Neira Ayuso <[email protected]>
[ Upstream commit c77761c8a59405cb7aa44188b30fffe13fbdd02d ]
Similar to 7980d2eabde8 ("ipvs: clear skb->tstamp in forwarding path"). fq qdisc requires tstamp to be cleared in forwarding path.
--- net/netfilter/nf_dup_netdev.c | 1 + net/netfilter/nft_fwd_netdev.c | 1 + 2 files changed, 2 insertions(+)
net/netfilter/nf_dup_netdev.c +1 -0
@@ -19,6 +19,7 @@ static void nf_do_netdev_egress(struct sk_buff *skb, struct net_device *dev)skb_push (skb, skb->mac_len); skb->dev = dev; + skb->tstamp =0 ;dev_queue_xmit (skb); }
net/netfilter/nft_fwd_netdev.c +1 -0
@@ -138,6 +138,7 @@ static void nft_fwd_neigh_eval(const struct nft_expr *expr,return ; skb->dev = dev; + skb->tstamp =0 ;neigh_xmit (neigh_table, dev, addr, skb); out: regs->verdict.code = verdict;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 480/633 soc: xilinx: Fix error code in zynqmp_pm_probe()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit a6f2f0fdc73aacc6e10ae48ae78634dba26702d4 ]
This should be returning PTR_ERR() but it returns IS_ERR() instead.
--- drivers/soc/xilinx/zynqmp_power.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soc/xilinx/zynqmp_power.c +1 -1
@@ -205,7 +205,7 @@ static int zynqmp_pm_probe(struct platform_device *pdev) rx_chan =mbox_request_channel_byname (client,"rx" );if (IS_ERR (rx_chan)) {dev_err (&pdev->dev,"Failed to request rx channel\n" ); -return IS_ERR (rx_chan); +return PTR_ERR (rx_chan); } }else if (of_find_property (pdev->dev.of_node,"interrupts" ,NULL )) { irq =platform_get_irq (pdev,0 );
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 481/633 arm64: dts: meson: vim3: correct led polarity
In reply to Greg Kroah-HartmanFrom: Jerome Brunet <[email protected]>
[ Upstream commit 1f9d87d08e4a2299e86f8a1600aedf87ecd3b636 ]
The LEDs on the vim3 are active when the gpio is high, not low.
--- arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi +2 -2
@@ -41,13 +41,13 @@ leds { led-white { label = "vim3:white:sys"; - gpios = <&gpio_ao GPIOAO_4 GPIO_ACTIVE_LOW>; + gpios = <&gpio_ao GPIOAO_4 GPIO_ACTIVE_HIGH>; linux,default-trigger = "heartbeat"; }; led-red { label = "vim3:red"; - gpios = <&gpio_expander 5 GPIO_ACTIVE_LOW>; + gpios = <&gpio_expander 5 GPIO_ACTIVE_HIGH>; }; };
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 482/633 ARM: dts: imx6sl: fix rng node
In reply to Greg Kroah-HartmanFrom: Horia Geantă <[email protected]>
[ Upstream commit 82ffb35c2ce63ef8e0325f75eb48022abcf8edbe ]
rng DT node was added without a compatible string.
i.MX driver for RNGC (drivers/char/hw_random/imx-rngc.c) also claims support for RNGB, and is currently used for i.MX25.
Let's use this driver also for RNGB block in i.MX6SL.
--- arch/arm/boot/dts/imx6sl.dtsi | 2 ++ 1 file changed, 2 insertions(+)
arch/arm/boot/dts/imx6sl.dtsi +2 -0
@@ -939,8 +939,10 @@ memory-controller@21b0000 { }; rngb: rngb@21b4000 { + compatible = "fsl,imx6sl-rngb", "fsl,imx25-rngb"; reg = <0x021b4000 0x4000>; interrupts = <0 5 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&clks IMX6SL_CLK_DUMMY>; }; weim: weim@21b8000 {
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 483/633 ARM: at91: pm: of_node_put() after its usage
In reply to Greg Kroah-HartmanFrom: Claudiu Beznea <[email protected]>
[ Upstream commit e222f943519564978e082c152b4140a47e93392c ]
Put node after it has been used.
--- arch/arm/mach-at91/pm.c | 1 + 1 file changed, 1 insertion(+)
arch/arm/mach-at91/pm.c +1 -0
@@ -800,6 +800,7 @@ static void __init at91_pm_init(void (*pm_idle)(void)) pmc_np =of_find_matching_node_and_match (NULL , atmel_pmc_ids, &of_id); soc_pm.data.pmc =of_iomap (pmc_np,0 ); +of_node_put (pmc_np);if (!soc_pm.data.pmc) {pr_err ("AT91: PM not supported, PMC not found\n" );return ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 484/633 ARM: s3c24xx: fix mmc gpio lookup tables
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 3af4e8774b6d03683932b0961998e01355bccd74 ]
The gpio controller names differ between s3c24xx and s3c64xx, and it seems that these all got the wrong names, using GPx instead of GPIOx.
--- arch/arm/mach-s3c24xx/mach-at2440evb.c | 2 +- arch/arm/mach-s3c24xx/mach-h1940.c | 4 ++-- arch/arm/mach-s3c24xx/mach-mini2440.c | 4 ++-- arch/arm/mach-s3c24xx/mach-n30.c | 4 ++-- arch/arm/mach-s3c24xx/mach-rx1950.c | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-)
arch/arm/mach-s3c24xx/mach-at2440evb.c +1 -1
@@ -143,7 +143,7 @@ static struct gpiod_lookup_table at2440evb_mci_gpio_table = { .dev_id = "s3c2410-sdi", .table = {/* Card detect S3C2410_GPG(10) */ - GPIO_LOOKUP("GPG", 10, "cd", GPIO_ACTIVE_LOW), + GPIO_LOOKUP("GPIOG", 10, "cd", GPIO_ACTIVE_LOW), { }, }, };
arch/arm/mach-s3c24xx/mach-h1940.c +2 -2
@@ -468,9 +468,9 @@ static struct gpiod_lookup_table h1940_mmc_gpio_table = { .dev_id = "s3c2410-sdi", .table = {/* Card detect S3C2410_GPF(5) */ -GPIO_LOOKUP ("GPF" ,5 ,"cd" ,GPIO_ACTIVE_LOW ), +GPIO_LOOKUP ("GPIOF" ,5 ,"cd" ,GPIO_ACTIVE_LOW ),/* Write protect S3C2410_GPH(8) */ - GPIO_LOOKUP("GPH", 8, "wp", GPIO_ACTIVE_LOW), + GPIO_LOOKUP("GPIOH", 8, "wp", GPIO_ACTIVE_LOW), { }, }, };
arch/arm/mach-s3c24xx/mach-mini2440.c +2 -2
@@ -244,9 +244,9 @@ static struct gpiod_lookup_table mini2440_mmc_gpio_table = { .dev_id = "s3c2410-sdi", .table = {/* Card detect S3C2410_GPG(8) */ -GPIO_LOOKUP ("GPG" ,8 ,"cd" ,GPIO_ACTIVE_LOW ), +GPIO_LOOKUP ("GPIOG" ,8 ,"cd" ,GPIO_ACTIVE_LOW ),/* Write protect S3C2410_GPH(8) */ - GPIO_LOOKUP("GPH", 8, "wp", GPIO_ACTIVE_HIGH), + GPIO_LOOKUP("GPIOH", 8, "wp", GPIO_ACTIVE_HIGH), { }, }, };
arch/arm/mach-s3c24xx/mach-n30.c +2 -2
@@ -359,9 +359,9 @@ static struct gpiod_lookup_table n30_mci_gpio_table = { .dev_id = "s3c2410-sdi", .table = {/* Card detect S3C2410_GPF(1) */ -GPIO_LOOKUP ("GPF" ,1 ,"cd" ,GPIO_ACTIVE_LOW ), +GPIO_LOOKUP ("GPIOF" ,1 ,"cd" ,GPIO_ACTIVE_LOW ),/* Write protect S3C2410_GPG(10) */ - GPIO_LOOKUP("GPG", 10, "wp", GPIO_ACTIVE_LOW), + GPIO_LOOKUP("GPIOG", 10, "wp", GPIO_ACTIVE_LOW), { }, }, };
arch/arm/mach-s3c24xx/mach-rx1950.c +2 -2
@@ -571,9 +571,9 @@ static struct gpiod_lookup_table rx1950_mmc_gpio_table = { .dev_id = "s3c2410-sdi", .table = {/* Card detect S3C2410_GPF(5) */ -GPIO_LOOKUP ("GPF" ,5 ,"cd" ,GPIO_ACTIVE_LOW ), +GPIO_LOOKUP ("GPIOF" ,5 ,"cd" ,GPIO_ACTIVE_LOW ),/* Write protect S3C2410_GPH(8) */ - GPIO_LOOKUP("GPH", 8, "wp", GPIO_ACTIVE_LOW), + GPIO_LOOKUP("GPIOH", 8, "wp", GPIO_ACTIVE_LOW), { }, }, };
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 485/633 ARM: dts: sun8i: r40: bananapi-m2-ultra: Fix dcdc1 regulator
In reply to Greg Kroah-HartmanFrom: Jernej Skrabec <[email protected]>
[ Upstream commit 3658a2b7f3e16c7053eb8d70657b94bb62c5a0f4 ]
DCDC1 regulator powers many different subsystems. While some of them can work at 3.0 V, some of them can not. For example, VCC-HDMI can only work between 3.24 V and 3.36 V. According to OS images provided by the board manufacturer this regulator should be set to 3.3 V.
Set DCDC1 and DCDC1SW to 3.3 V in order to fix this.
--- arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts +5 -5
@@ -223,16 +223,16 @@ ®_aldo3 { }; ®_dc1sw { - regulator-min-microvolt = <3000000>; - regulator-max-microvolt = <3000000>; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; regulator-name = "vcc-gmac-phy"; }; ®_dcdc1 { regulator-always-on; - regulator-min-microvolt = <3000000>; - regulator-max-microvolt = <3000000>; - regulator-name = "vcc-3v0"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-name = "vcc-3v3"; }; ®_dcdc2 {
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 486/633 arm64: dts: allwinner: h5: remove Mali GPU PMU module
In reply to Greg Kroah-HartmanFrom: Qiang Yu <[email protected]>
[ Upstream commit 2933bf3528007f834fb7f5eab033f9c5b0683f91 ]
H5's Mali GPU PMU is not present or working corretly although H5 datasheet record its interrupt vector.
Adding this module will miss lead lima driver try to shutdown it and get waiting timeout. This problem is not exposed before lima runtime PM support is added.
--- arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi +2 -4
@@ -125,8 +125,7 @@ mali: gpu@1e80000 { <GIC_SPI 104 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 105 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 106 IRQ_TYPE_LEVEL_HIGH>, - <GIC_SPI 107 IRQ_TYPE_LEVEL_HIGH>, - <GIC_SPI 98 IRQ_TYPE_LEVEL_HIGH>; + <GIC_SPI 107 IRQ_TYPE_LEVEL_HIGH>; interrupt-names = "gp", "gpmmu", "pp",
@@ -137,8 +136,7 @@ mali: gpu@1e80000 { "pp2", "ppmmu2", "pp3", - "ppmmu3", - "pmu"; + "ppmmu3"; clocks = <&ccu CLK_BUS_GPU>, <&ccu CLK_GPU>; clock-names = "bus", "core"; resets = <&ccu RST_BUS_GPU>;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 487/633 memory: omap-gpmc: Fix a couple off by ones
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 4c54228ac8fd55044195825873c50a524131fa53 ]
These comparisons should be >= instead of > to prevent reading one element beyond the end of the gpmc_cs[] array.
--- drivers/memory/omap-gpmc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/memory/omap-gpmc.c +2 -2
@@ -949,7 +949,7 @@ static int gpmc_cs_remap(int cs, u32 base)int ret;u32 old_base, size; -if (cs > gpmc_cs_num) { +if (cs >= gpmc_cs_num) {pr_err ("%s: requested chip-select is disabled\n" , __func__);return -ENODEV ; }
@@ -984,7 +984,7 @@ int gpmc_cs_request(int cs, unsigned long size, unsigned long *base)struct resource *res = &gpmc->mem;int r =-1 ; -if (cs > gpmc_cs_num) { +if (cs >= gpmc_cs_num) {pr_err ("%s: requested chip-select is disabled\n" , __func__);return -ENODEV ; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 488/633 memory: omap-gpmc: Fix build error without CONFIG_OF
In reply to Greg Kroah-HartmanFrom: YueHaibing <[email protected]>
[ Upstream commit 13d029ee51da365aa9c859db0c7395129252bde8 ]
If CONFIG_OF is n, gcc fails:
drivers/memory/omap-gpmc.o: In function `gpmc_omap_onenand_set_timings':
omap-gpmc.c:(.text+0x2a88): undefined reference to `gpmc_read_settings_dt'
Add gpmc_read_settings_dt() helper function, which zero the gpmc_settings so the caller doesn't proceed with random/invalid settings.
--- drivers/memory/omap-gpmc.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/memory/omap-gpmc.c +4 -0
@@ -2274,6 +2274,10 @@ static void gpmc_probe_dt_children(struct platform_device *pdev) } }#else +void gpmc_read_settings_dt (struct device_node *np,struct gpmc_settings *p) +{ +memset (p,0 ,sizeof (*p)); +}static int gpmc_probe_dt (struct platform_device *pdev) {return 0 ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 489/633 arm64: dts: qcom: sc7180: Fix the LLCC base register size
In reply to Greg Kroah-HartmanFrom: Sai Prakash Ranjan <[email protected]>
[ Upstream commit efe788361f72914017515223414d3f20abe4b403 ]
There is one LLCC logical bank(LLCC0) on SC7180 SoC and the size of the LLCC0 base is 0x50000(320KB) not 2MB, so correct the size and fix copy paste mistake carried over from SDM845.
--- arch/arm64/boot/dts/qcom/sc7180.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/sc7180.dtsi +1 -1
@@ -2193,7 +2193,7 @@ dc_noc: interconnect@9160000 { system-cache-controller@9200000 { compatible = "qcom,sc7180-llcc"; - reg = <0 0x09200000 0 0x200000>, <0 0x09600000 0 0x50000>; + reg = <0 0x09200000 0 0x50000>, <0 0x09600000 0 0x50000>; reg-names = "llcc_base", "llcc_broadcast_base"; interrupts = <GIC_SPI 582 IRQ_TYPE_LEVEL_HIGH>; };
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 490/633 memory: fsl-corenet-cf: Fix handling of platform_get_irq() error
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit dd85345abca60a8916617e8d75c0f9ce334336dd ]
platform_get_irq() returns -ERRNO on error. In such case comparison to 0 would pass the check.
--- drivers/memory/fsl-corenet-cf.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/memory/fsl-corenet-cf.c +2 -4
@@ -211,10 +211,8 @@ static int ccf_probe(struct platform_device *pdev)dev_set_drvdata (&pdev->dev, ccf); irq =platform_get_irq (pdev,0 ); -if (!irq) { -dev_err (&pdev->dev,"%s: no irq\n" , __func__); -return -ENXIO ; - } +if (irq <0 ) +return irq; ret =devm_request_irq (&pdev->dev, irq, ccf_irq,0 , pdev->name, ccf);if (ret) {
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 491/633 firmware: arm_scmi: Fix NULL pointer dereference in mailbox_chan_free
In reply to Greg Kroah-HartmanFrom: Sudeep Holla <[email protected]>
[ Upstream commit 6ed6c558234f0b6c22e47a3c2feddce3d02324dd ]
scmi_mailbox is obtained from cinfo->transport_info and the first call to mailbox_chan_free frees the channel and sets cinfo->transport_info to NULL. Care is taken to check for non NULL smbox->chan but smbox can itself be NULL. Fix it by checking for it without which, kernel crashes with below NULL pointer dereference and eventually kernel panic.
Unable to handle kernel NULL pointer dereference at
virtual address 0000000000000038
Modules linked in: scmi_module(-)
Hardware name: ARM LTD ARM Juno Development Platform/ARM Juno
Development Platform, BIOS EDK II Sep 2 2020
pstate: 80000005 (Nzcv daif -PAN -UAO BTYPE=--)
pc : mailbox_chan_free+0x2c/0x70 [scmi_module]
lr : idr_for_each+0x6c/0xf8
Call trace:
mailbox_chan_free+0x2c/0x70 [scmi_module]
idr_for_each+0x6c/0xf8
scmi_remove+0xa8/0xf0 [scmi_module]
platform_drv_remove+0x34/0x58
device_release_driver_internal+0x118/0x1f0
driver_detach+0x58/0xe8
bus_remove_driver+0x64/0xe0
driver_unregister+0x38/0x68
platform_driver_unregister+0x1c/0x28
scmi_driver_exit+0x38/0x44 [scmi_module]
---[ end trace 17bde19f50436de9 ]---
Kernel panic - not syncing: Fatal exception
SMP: stopping secondary CPUs
Kernel Offset: 0x1d0000 from 0xffff800010000000
PHYS_OFFSET: 0x80000000
CPU features: 0x0240022,25806004
Memory Limit: none
---[ end Kernel panic - not syncing: Fatal exception ]------ drivers/firmware/arm_scmi/mailbox.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/firmware/arm_scmi/mailbox.c +1 -1
@@ -110,7 +110,7 @@ static int mailbox_chan_free(int id, void *p, void *data)struct scmi_chan_info *cinfo = p;struct scmi_mailbox *smbox = cinfo->transport_info; -if (!IS_ERR (smbox->chan)) { +if (smbox && !IS_ERR (smbox->chan)) {mbox_free_channel (smbox->chan); cinfo->transport_info =NULL ; smbox->chan =NULL ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 492/633 arm64: dts: imx8mq: Add missing interrupts to GPC
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit 791619f66843a213784efb2f171be98933bad991 ]
The i.MX General Power Controller v2 device node was missing interrupts property necessary to route its interrupt to GIC. This also fixes the dbts_check warnings like:
arch/arm64/boot/dts/freescale/imx8mq-evk.dt.yaml: gpc@303a0000:
{'compatible': ... '$nodename': ['gpc@303a0000']} is not valid under any of the given schemas arch/arm64/boot/dts/freescale/imx8mq-evk.dt.yaml: gpc@303a0000: 'interrupts' is a required property
--- arch/arm64/boot/dts/freescale/imx8mq.dtsi | 1 + 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/freescale/imx8mq.dtsi +1 -0
@@ -614,6 +614,7 @@ src: reset-controller@30390000 { gpc: gpc@303a0000 { compatible = "fsl,imx8mq-gpc"; reg = <0x303a0000 0x10000>; + interrupts = <GIC_SPI 87 IRQ_TYPE_LEVEL_HIGH>; interrupt-parent = <&gic>; interrupt-controller; #interrupt-cells = <3>;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 493/633 arm64: dts: qcom: sc7180: Drop flags on mdss irqs
In reply to Greg Kroah-HartmanFrom: Stephen Boyd <[email protected]>
[ Upstream commit 51e9874d382e089f664b3ce12773bbbaece5f369 ]
The number of interrupt cells for the mdss interrupt controller is 1, meaning there should only be one cell for the interrupt number, not two where the second cell is the irq flags. Drop the second cell to match the binding.
--- arch/arm64/boot/dts/qcom/sc7180.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/qcom/sc7180.dtsi +2 -2
@@ -2357,7 +2357,7 @@ mdp: mdp@ae01000 { <19200000>; interrupt-parent = <&mdss>; - interrupts = <0 IRQ_TYPE_LEVEL_HIGH>; + interrupts = <0>; status = "disabled";
@@ -2380,7 +2380,7 @@ dsi0: dsi@ae94000 { reg-names = "dsi_ctrl"; interrupt-parent = <&mdss>; - interrupts = <4 IRQ_TYPE_LEVEL_HIGH>; + interrupts = <4>; clocks = <&dispcc DISP_CC_MDSS_BYTE0_CLK>, <&dispcc DISP_CC_MDSS_BYTE0_INTF_CLK>,
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 494/633 soc: qcom: pdr: Fixup array type of get_domain_list_resp message
In reply to Greg Kroah-HartmanFrom: Sibi Sankar <[email protected]>
[ Upstream commit 7a366707bb6a93baeb1a9ef46c4b9c875e0132d6 ]
The array type of get_domain_list_resp is incorrectly marked as NO_ARRAY. Due to which the following error was observed when using pdr helpers with the downstream proprietary pd-mapper. Fix this up by marking it as VAR_LEN_ARRAY instead.
Err logs:qmi_decode_struct_elem: Fault in decoding: dl(2), db(27), tl(160), i(1), el(1) failed to decode incoming message
PDR: tms/servreg get domain list txn wait failed: -14
PDR: service lookup for tms/servreg failed: -14
--- drivers/soc/qcom/pdr_internal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soc/qcom/pdr_internal.h +1 -1
@@ -185,7 +185,7 @@ struct qmi_elem_info servreg_get_domain_list_resp_ei[] = { .data_type = QMI_STRUCT, .elem_len = SERVREG_DOMAIN_LIST_LENGTH, .elem_size = sizeof(struct servreg_location_entry), - .array_type = NO_ARRAY, + .array_type = VAR_LEN_ARRAY, .tlv_type = 0x12, .offset = offsetof(struct servreg_get_domain_list_resp , domain_list),
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 495/633 arm64: dts: qcom: msm8916: Remove one more thermal trip point unit name
In reply to Greg Kroah-HartmanFrom: Stephan Gerhold <[email protected]>
[ Upstream commit e6859ae8603c5946b8f3ecbd9b4f02b72955b9d0 ]
Commit fe2aff0c574d2 ("arm64: dts: qcom: msm8916: remove unit name for thermal trip points") removed the unit names for most of the thermal trip points defined
in msm8916.dtsi, but missed to update the one for cpu0_1-thermal.
So why wasn't this spotted by "make dtbs_check"? Apparently, the name of the thermal zone is already invalid: thermal-zones.yaml specifies a regex of ^[a-zA-Z][a-zA-Z0-9\\-]{1,12}-thermal$, so it is not allowed to contain underscores. Therefore the thermal zone was never verified using the DTB schema.
After replacing the underscore in the thermal zone name, the warning shows up:
apq8016-sbc.dt.yaml: thermal-zones: cpu0-1-thermal:trips: 'trip-point@0'
does not match any of the regexes: '^[a-zA-Z][a-zA-Z0-9\\-_]{0,63}$', 'pinctrl-[0-9]+'Fix up the thermal zone names and remove the unit name for the trip point.
--- arch/arm64/boot/dts/qcom/msm8916.dtsi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm64/boot/dts/qcom/msm8916.dtsi +3 -3
@@ -228,14 +228,14 @@ pmu { }; thermal-zones { - cpu0_1-thermal { + cpu0-1-thermal { polling-delay-passive = <250>; polling-delay = <1000>; thermal-sensors = <&tsens 5>; trips { - cpu0_1_alert0: trip-point@0 { + cpu0_1_alert0: trip-point0 { temperature = <75000>; hysteresis = <2000>; type = "passive";
@@ -258,7 +258,7 @@ map0 { }; }; - cpu2_3-thermal { + cpu2-3-thermal { polling-delay-passive = <250>; polling-delay = <1000>;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 496/633 arm64: dts: qcom: pm8916: Remove invalid reg size from wcd_codec
In reply to Greg Kroah-HartmanFrom: Stephan Gerhold <[email protected]>
[ Upstream commit c2f0cbb57dbac6da3d38b47b5b96de0fe4e23884 ]
Tha parent node of "wcd_codec" specifies #address-cells = <1> and #size-cells = <0>, which means that each resource should be described by one cell for the address and size omitted.
However, wcd_codec currently lists 0x200 as second cell (probably the size of the resource). When parsing this would be treated like another memory resource - which is entirely wrong.
To quote the device tree specification [1]:
"If the parent node specifies a value of 0 for #size-cells,
the length field in the value of reg shall be omitted."
[1]: https://www.devicetree.org/specifications/
--- arch/arm64/boot/dts/qcom/pm8916.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/pm8916.dtsi +1 -1
@@ -119,7 +119,7 @@ pm8916_vib: vibrator@c000 { wcd_codec: codec@f000 { compatible = "qcom,pm8916-wcd-analog-codec"; - reg = <0xf000 0x200>; + reg = <0xf000>; reg-names = "pmic-codec-core"; clocks = <&gcc GCC_CODEC_DIGCODEC_CLK>; clock-names = "mclk";
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 497/633 arm64: dts: qcom: msm8916: Fix MDP/DSI interrupts
In reply to Greg Kroah-HartmanFrom: Stephan Gerhold <[email protected]>
[ Upstream commit 027cca9eb5b450c3f6bb916ba999144c2ec23cb7 ]
The mdss node sets #interrupt-cells = <1>, so its interrupts should be referenced using a single cell (in this case: only the interrupt number).
However, right now the mdp/dsi node both have two interrupt cells set, e.g. interrupts = <4 0>. The 0 is probably meant to say IRQ_TYPE_NONE (= 0), but with #interrupt-cells = <1> this is actually interpreted as a second interrupt line.
Remove the IRQ flags from both interrupts to fix this.
--- arch/arm64/boot/dts/qcom/msm8916.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/qcom/msm8916.dtsi +2 -2
@@ -1021,7 +1021,7 @@ mdp: mdp@1a01000 { reg-names = "mdp_phys"; interrupt-parent = <&mdss>; - interrupts = <0 0>; + interrupts = <0>; clocks = <&gcc GCC_MDSS_AHB_CLK>, <&gcc GCC_MDSS_AXI_CLK>,
@@ -1053,7 +1053,7 @@ dsi0: dsi@1a98000 { reg-names = "dsi_ctrl"; interrupt-parent = <&mdss>; - interrupts = <4 0>; + interrupts = <4>; assigned-clocks = <&gcc BYTE0_CLK_SRC>, <&gcc PCLK0_CLK_SRC>;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 498/633 soc: qcom: apr: Fixup the error displayed on lookup failure
In reply to Greg Kroah-HartmanFrom: Sibi Sankar <[email protected]>
[ Upstream commit ba34f977c333f96c8acd37ec30e232220399f5a5 ]
APR client incorrectly prints out "ret" variable on pdr_add_lookup failure, it should be printing the error value returned by the lookup instead.
--- drivers/soc/qcom/apr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soc/qcom/apr.c +1 -1
@@ -328,7 +328,7 @@ static int of_apr_add_pd_lookups(struct device *dev) pds =pdr_add_lookup (apr->pdr, service_name, service_path);if (IS_ERR (pds) &&PTR_ERR (pds) != -EALREADY ) { -dev_err (dev,"pdr add lookup failed: %d\n" , ret); +dev_err (dev,"pdr add lookup failed: %ld\n" ,PTR_ERR (pds));return PTR_ERR (pds); } }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 499/633 dt-bindings: crypto: Specify that allwinner, sun8i-a33-crypto needs reset
In reply to Greg Kroah-HartmanFrom: Corentin Labbe <[email protected]>
[ Upstream commit 884d1a334ae8130fabede56f59b224619ad6bca4 ]
When adding allwinner,sun8i-a33-crypto, I forgot to add that it needs reset. Furthermore, there are no need to use items to list only one compatible in compatible list.
--- .../bindings/crypto/allwinner,sun4i-a10-crypto.yaml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/crypto/allwinner,sun4i-a10-crypto.yaml +4 -3
@@ -23,8 +23,7 @@ properties: - items: - const: allwinner,sun7i-a20-crypto - const: allwinner,sun4i-a10-crypto - - items: - - const: allwinner,sun8i-a33-crypto + - const: allwinner,sun8i-a33-crypto reg: maxItems: 1
@@ -59,7 +58,9 @@ if: properties: compatible: contains: - const: allwinner,sun6i-a31-crypto + enum: + - allwinner,sun6i-a31-crypto + - allwinner,sun8i-a33-crypto then: required:
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 500/633 arm64: dts: renesas: r8a77990: Fix MSIOF1 DMA channels
In reply to Greg Kroah-HartmanFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit 453802c463abd003a7c38ffbc90b67ba162335b6 ]
According to Technical Update TN-RCT-S0352A/E, MSIOF1 DMA can only be used with SYS-DMAC0 on R-Car E3.
--- arch/arm64/boot/dts/renesas/r8a77990.dtsi | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
arch/arm64/boot/dts/renesas/r8a77990.dtsi +2 -3
@@ -1192,9 +1192,8 @@ msiof1: spi@e6ea0000 { reg = <0 0xe6ea0000 0 0x0064>; interrupts = <GIC_SPI 157 IRQ_TYPE_LEVEL_HIGH>; clocks = <&cpg CPG_MOD 210>; - dmas = <&dmac1 0x43>, <&dmac1 0x42>, - <&dmac2 0x43>, <&dmac2 0x42>; - dma-names = "tx", "rx", "tx", "rx"; + dmas = <&dmac0 0x43>, <&dmac0 0x42>; + dma-names = "tx", "rx"; power-domains = <&sysc R8A77990_PD_ALWAYS_ON>; resets = <&cpg 210>; #address-cells = <1>;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 501/633 arm64: dts: renesas: r8a774c0: Fix MSIOF1 DMA channels
In reply to Greg Kroah-HartmanFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit c91dfc9818df5f43c10c727f1cecaebdb5e2fa92 ]
According to Technical Update TN-RCT-S0352A/E, MSIOF1 DMA can only be used with SYS-DMAC0 on R-Car E3.
--- arch/arm64/boot/dts/renesas/r8a774c0.dtsi | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
arch/arm64/boot/dts/renesas/r8a774c0.dtsi +2 -3
@@ -1214,9 +1214,8 @@ msiof1: spi@e6ea0000 { reg = <0 0xe6ea0000 0 0x0064>; interrupts = <GIC_SPI 157 IRQ_TYPE_LEVEL_HIGH>; clocks = <&cpg CPG_MOD 210>; - dmas = <&dmac1 0x43>, <&dmac1 0x42>, - <&dmac2 0x43>, <&dmac2 0x42>; - dma-names = "tx", "rx", "tx", "rx"; + dmas = <&dmac0 0x43>, <&dmac0 0x42>; + dma-names = "tx", "rx"; power-domains = <&sysc R8A774C0_PD_ALWAYS_ON>; resets = <&cpg 210>; #address-cells = <1>;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 502/633 arm64: dts: mt8173: elm: Fix nor_flash node property
In reply to Greg Kroah-HartmanFrom: Hsin-Yi Wang <[email protected]>
[ Upstream commit 1276be23fd53e1c4e752966d0eab42aa54a343da ]
bus-width and non-removable is not used by the driver. max-frequency should be spi-max-frequency for flash node.
--- arch/arm64/boot/dts/mediatek/mt8173-elm.dtsi | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
arch/arm64/boot/dts/mediatek/mt8173-elm.dtsi +2 -3
@@ -431,12 +431,11 @@ &nor_flash { status = "okay"; pinctrl-names = "default"; pinctrl-0 = <&nor_gpio1_pins>; - bus-width = <8>; - max-frequency = <50000000>; - non-removable; + flash@0 { compatible = "jedec,spi-nor"; reg = <0>; + spi-max-frequency = <50000000>; }; };
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 503/633 arm64: dts: actions: limit address range for pinctrl node
In reply to Greg Kroah-HartmanFrom: Amit Singh Tomar <[email protected]>
[ Upstream commit 4bb1eb3cd4bd6241d5e5f99bbfd801ea5a007b6c ]
After commit 7cdf8446ed1d ("arm64: dts: actions: Add pinctrl node for Actions Semi S700") following error has been observed while booting Linux on Cubieboard7-lite(based on S700 SoC).
[ 0.257415] pinctrl-s700 e01b0000.pinctrl: can't request region for resource [mem 0xe01b0000-0xe01b0fff] [ 0.266902] pinctrl-s700: probe of e01b0000.pinctrl failed with error -16
This is due to the fact that memory range for "sps" power domain controller clashes with pinctrl.
One way to fix it, is to limit pinctrl address range which is safe to do as current pinctrl driver uses address range only up to 0x100.
This commit limits the pinctrl address range to 0x100 so that it doesn't conflict with sps range.
Semi S700")
--- arch/arm64/boot/dts/actions/s700.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/actions/s700.dtsi +1 -1
@@ -231,7 +231,7 @@ timer: timer@e024c000 { pinctrl: pinctrl@e01b0000 { compatible = "actions,s700-pinctrl"; - reg = <0x0 0xe01b0000 0x0 0x1000>; + reg = <0x0 0xe01b0000 0x0 0x100>; clocks = <&cmu CLK_GPIO>; gpio-controller; gpio-ranges = <&pinctrl 0 0 136>;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 504/633 ARM: dts: owl-s500: Fix incorrect PPI interrupt specifiers
In reply to Greg Kroah-HartmanFrom: Cristian Ciocaltea <[email protected]>
[ Upstream commit 55f6c9931f7c32f19cf221211f099dfd8dab3af9 ]
The PPI interrupts for cortex-a9 were incorrectly specified, fix them.
--- arch/arm/boot/dts/owl-s500.dtsi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm/boot/dts/owl-s500.dtsi +3 -3
@@ -84,21 +84,21 @@ scu: scu@b0020000 { global_timer: timer@b0020200 { compatible = "arm,cortex-a9-global-timer"; reg = <0xb0020200 0x100>; - interrupts = <GIC_PPI 0 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_EDGE_RISING)>; + interrupts = <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_EDGE_RISING)>; status = "disabled"; }; twd_timer: timer@b0020600 { compatible = "arm,cortex-a9-twd-timer"; reg = <0xb0020600 0x20>; - interrupts = <GIC_PPI 2 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_EDGE_RISING)>; + interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_EDGE_RISING)>; status = "disabled"; }; twd_wdt: wdt@b0020620 { compatible = "arm,cortex-a9-twd-wdt"; reg = <0xb0020620 0xe0>; - interrupts = <GIC_PPI 3 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_EDGE_RISING)>; + interrupts = <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_EDGE_RISING)>; status = "disabled"; };
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 505/633 soc: fsl: qbman: Fix return value on success
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit 750cf40c0f7088f36a8a5d102e0488b1ac47faf5 ]
On error the function was meant to return -ERRNO. This also fixes compile warning:
drivers/soc/fsl/qbman/bman.c:640:6: warning: variable 'err' set but not used [-Wunused-but-set-variable]
--- drivers/soc/fsl/qbman/bman.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soc/fsl/qbman/bman.c +1 -1
@@ -660,7 +660,7 @@ int bm_shutdown_pool(u32 bpid) } done:put_affine_portal (); -return 0 ; +return err; }struct gen_pool *bm_bpalloc;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 506/633 ARM: OMAP2+: Restore MPU power domain if cpu_cluster_pm_enter() fails
In reply to Greg Kroah-HartmanFrom: Tony Lindgren <[email protected]>
[ Upstream commit 8f04aea048d56f3e39a7e543939450246542a6fc ]
If cpu_cluster_pm_enter() fails, we need to set MPU power domain back to enabled to prevent the next WFI from potentially triggering an undesired MPU power domain state change.
We already do this for omap_enter_idle_smp() but are missing it for omap_enter_idle_coupled().
--- arch/arm/mach-omap2/cpuidle44xx.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/arm/mach-omap2/cpuidle44xx.c +3 -1
@@ -174,8 +174,10 @@ static int omap_enter_idle_coupled(struct cpuidle_device *dev,*/ if (mpuss_can_lose_context) { error =cpu_cluster_pm_enter (); -if (error) +if (error) { +omap_set_pwrdm_state (mpu_pd,PWRDM_POWER_ON ); goto cpu_cluster_pm_out; + } } }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 507/633 ARM: dts: stm32: Fix sdmmc2 pins on AV96
In reply to Greg Kroah-HartmanFrom: Marek Vasut <[email protected]>
[ Upstream commit 1ad6e36ec266cedb0d274aa13253ff1fb2eed4ba ]
The AV96 uses sdmmc2_d47_pins_c and sdmmc2_d47_sleep_pins_c, which differ from sdmmc2_d47_pins_b and sdmmc2_d47_sleep_pins_b in one pin, SDMMC2_D5, which is PA15 in the former and PA9 in the later. The PA15 is correct on AV96, so fix this. This error is likely a result of rebasing across the stm32mp1 DT pinctrl rework.
--- arch/arm/boot/dts/stm32mp15xx-dhcor-avenger96.dtsi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm/boot/dts/stm32mp15xx-dhcor-avenger96.dtsi +3 -3
@@ -295,9 +295,9 @@ &sdmmc1 { &sdmmc2 { pinctrl-names = "default", "opendrain", "sleep"; - pinctrl-0 = <&sdmmc2_b4_pins_a &sdmmc2_d47_pins_b>; - pinctrl-1 = <&sdmmc2_b4_od_pins_a &sdmmc2_d47_pins_b>; - pinctrl-2 = <&sdmmc2_b4_sleep_pins_a &sdmmc2_d47_sleep_pins_b>; + pinctrl-0 = <&sdmmc2_b4_pins_a &sdmmc2_d47_pins_c>; + pinctrl-1 = <&sdmmc2_b4_od_pins_a &sdmmc2_d47_pins_c>; + pinctrl-2 = <&sdmmc2_b4_sleep_pins_a &sdmmc2_d47_sleep_pins_c>; bus-width = <8>; mmc-ddr-1_8v; no-sd;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 508/633 ARM: dts: stm32: lxa-mc1: Fix kernel warning about PHY delays
In reply to Greg Kroah-HartmanFrom: Holger Assmann <[email protected]>
[ Upstream commit 42a31ac6698681363363d48335559d212a26a7ca ]
The KSZ9031 PHY skew timings for rxc/txc, originally set to achieve the desired phase shift between clock- and data-signal, now trigger a kernel warning when used in rgmii-id mode:
*-skew-ps values should be used only with phy-mode = "rgmii"
This is because commit bcf3440c6dd7 ("net: phy: micrel: add phy-mode support for the KSZ9031 PHY") now configures own timings when phy-mode = "rgmii-id". Device trees wanting to set their own delays should use phy-mode "rgmii" instead as the warning prescribes.
The "standard" timings now used with "rgmii-id" work fine on this board, so drop the explicit timings in the device tree and thereby silence the warning.
--- arch/arm/boot/dts/stm32mp157c-lxa-mc1.dts | 2 -- 1 file changed, 2 deletions(-)
arch/arm/boot/dts/stm32mp157c-lxa-mc1.dts +0 -2
@@ -121,8 +121,6 @@ ethphy: ethernet-phy@3 { /* KSZ9031RN */ reset-gpios = <&gpiog 0 GPIO_ACTIVE_LOW>; /* ETH_RST# */ interrupt-parent = <&gpioa>; interrupts = <6 IRQ_TYPE_EDGE_FALLING>; /* ETH_MDINT# */ - rxc-skew-ps = <1860>; - txc-skew-ps = <1860>; reset-assert-us = <10000>; reset-deassert-us = <300>; micrel,force-master;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 509/633 ARM: dts: stm32: Move ethernet PHY into DH SoM DT
In reply to Greg Kroah-HartmanFrom: Marek Vasut <[email protected]>
[ Upstream commit b0a07f609600b6fa4c30f783db50c38456804485 ]
The PHY and the VIO regulator is populated on the SoM, move it into the SoM DT.
--- arch/arm/boot/dts/stm32mp15xx-dhcom-pdk2.dtsi | 33 ----------------- arch/arm/boot/dts/stm32mp15xx-dhcom-som.dtsi | 36 +++++++++++++++++++ 2 files changed, 36 insertions(+), 33 deletions(-)
arch/arm/boot/dts/stm32mp15xx-dhcom-pdk2.dtsi +0 -33
@@ -11,7 +11,6 @@ aliases { serial0 = &uart4; serial1 = &usart3; serial2 = &uart8; - ethernet0 = ðernet0; }; chosen {
@@ -33,16 +32,6 @@ display_bl: display-bl { status = "okay"; }; - ethernet_vio: vioregulator { - compatible = "regulator-fixed"; - regulator-name = "vio"; - regulator-min-microvolt = <3300000>; - regulator-max-microvolt = <3300000>; - gpio = <&gpiog 3 GPIO_ACTIVE_LOW>; - regulator-always-on; - regulator-boot-on; - }; - gpio-keys-polled { compatible = "gpio-keys-polled"; #size-cells = <0>;
@@ -141,28 +130,6 @@ &cec { status = "okay"; }; -ðernet0 { - status = "okay"; - pinctrl-0 = <ðernet0_rmii_pins_a>; - pinctrl-1 = <ðernet0_rmii_sleep_pins_a>; - pinctrl-names = "default", "sleep"; - phy-mode = "rmii"; - max-speed = <100>; - phy-handle = <&phy0>; - st,eth-ref-clk-sel; - phy-reset-gpios = <&gpioh 15 GPIO_ACTIVE_LOW>; - - mdio0 { - #address-cells = <1>; - #size-cells = <0>; - compatible = "snps,dwmac-mdio"; - - phy0: ethernet-phy@1 { - reg = <1>; - }; - }; -}; - &i2c2 { /* Header X22 */ pinctrl-names = "default"; pinctrl-0 = <&i2c2_pins_a>;
arch/arm/boot/dts/stm32mp15xx-dhcom-som.dtsi +36 -0
@@ -9,6 +9,10 @@ #include <dt-bindings/mfd/st,stpmic1.h> / { + aliases { + ethernet0 = ðernet0; + }; + memory@c0000000 { device_type = "memory"; reg = <0xC0000000 0x40000000>;
@@ -55,6 +59,16 @@ retram: retram@38000000 { no-map; }; }; + + ethernet_vio: vioregulator { + compatible = "regulator-fixed"; + regulator-name = "vio"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + gpio = <&gpiog 3 GPIO_ACTIVE_LOW>; + regulator-always-on; + regulator-boot-on; + }; }; &adc {
@@ -94,6 +108,28 @@ &dts { status = "okay"; }; +ðernet0 { + status = "okay"; + pinctrl-0 = <ðernet0_rmii_pins_a>; + pinctrl-1 = <ðernet0_rmii_sleep_pins_a>; + pinctrl-names = "default", "sleep"; + phy-mode = "rmii"; + max-speed = <100>; + phy-handle = <&phy0>; + st,eth-ref-clk-sel; + phy-reset-gpios = <&gpioh 15 GPIO_ACTIVE_LOW>; + + mdio0 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "snps,dwmac-mdio"; + + phy0: ethernet-phy@1 { + reg = <1>; + }; + }; +}; + &i2c4 { pinctrl-names = "default"; pinctrl-0 = <&i2c4_pins_a>;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 510/633 ARM: dts: stm32: Swap PHY reset GPIO and TSC2004 IRQ on DHCOM SOM
In reply to Greg Kroah-HartmanFrom: Marek Vasut <[email protected]>
[ Upstream commit 9ad98319e95263469d8ca2cb543c37c5a2f40980 ]
On the production revision of the SoM, 587-200, the PHY reset GPIO and touchscreen IRQs are swapped to prevent collision between EXTi IRQs, reflect that in DT.
--- arch/arm/boot/dts/stm32mp15xx-dhcom-som.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/stm32mp15xx-dhcom-som.dtsi +2 -2
@@ -117,7 +117,7 @@ ðernet0 { max-speed = <100>; phy-handle = <&phy0>; st,eth-ref-clk-sel; - phy-reset-gpios = <&gpioh 15 GPIO_ACTIVE_LOW>; + phy-reset-gpios = <&gpioh 3 GPIO_ACTIVE_LOW>; mdio0 { #address-cells = <1>;
@@ -285,7 +285,7 @@ touchscreen@49 { compatible = "ti,tsc2004"; reg = <0x49>; vio-supply = <&v3v3>; - interrupts-extended = <&gpioh 3 IRQ_TYPE_EDGE_FALLING>; + interrupts-extended = <&gpioh 15 IRQ_TYPE_EDGE_FALLING>; }; eeprom@50 {
Signature · 9 lines
2.25.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Greg Kroah-Hartman
maintainerPATCH 511/633 ARM: dts: stm32: Fix DH PDK2 display PWM channel
In reply to Greg Kroah-HartmanFrom: Marek Vasut <[email protected]>
[ Upstream commit 57592d2a98dbc3bde3ddc062e91a8486bdcb211e ]
The display PWM channel is number 3 (PWM2 CH4), make it so.
--- arch/arm/boot/dts/stm32mp15xx-dhcom-pdk2.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/stm32mp15xx-dhcom-pdk2.dtsi +1 -1
@@ -25,7 +25,7 @@ clk_ext_audio_codec: clock-codec { display_bl: display-bl { compatible = "pwm-backlight"; - pwms = <&pwm2 0 500000 PWM_POLARITY_INVERTED>; + pwms = <&pwm2 3 500000 PWM_POLARITY_INVERTED>; brightness-levels = <0 16 22 30 40 55 75 102 138 188 255>; default-brightness-level = <8>; enable-gpios = <&gpioi 0 GPIO_ACTIVE_HIGH>;
Signature · 9 lines
2.25.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Greg Kroah-Hartman
maintainerPATCH 512/633 ARM: dts: iwg20d-q7-common: Fix touch controller probe failure
In reply to Greg Kroah-HartmanFrom: Biju Das <[email protected]>
[ Upstream commit 08d7a73fffb6769b1cf2278bf697e692daba3abf ]
As per the iWave RZ/G1M schematic, the signal LVDS_PPEN controls the supply voltage for the touch panel, LVDS receiver and RGB LCD panel. Add a regulator for these device nodes and remove the powerdown-gpios property from the lvds-receiver node as it results in a touch controller driver probe failure.
--- arch/arm/boot/dts/iwg20d-q7-common.dtsi | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
arch/arm/boot/dts/iwg20d-q7-common.dtsi +14 -1
@@ -57,7 +57,7 @@ lcd_backlight: backlight { lvds-receiver { compatible = "ti,ds90cf384a", "lvds-decoder"; - powerdown-gpios = <&gpio7 25 GPIO_ACTIVE_LOW>; + power-supply = <&vcc_3v3_tft1>; ports { #address-cells = <1>;
@@ -81,6 +81,7 @@ lvds_receiver_out: endpoint { panel { compatible = "edt,etm0700g0dh6"; backlight = <&lcd_backlight>; + power-supply = <&vcc_3v3_tft1>; port { panel_in: endpoint {
@@ -113,6 +114,17 @@ sndcodec: simple-audio-card,codec { }; }; + vcc_3v3_tft1: regulator-panel { + compatible = "regulator-fixed"; + + regulator-name = "vcc-3v3-tft1"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + enable-active-high; + startup-delay-us = <500>; + gpio = <&gpio7 25 GPIO_ACTIVE_HIGH>; + }; + vcc_sdhi1: regulator-vcc-sdhi1 { compatible = "regulator-fixed";
@@ -207,6 +219,7 @@ touch: touchpanel@38 { reg = <0x38>; interrupt-parent = <&gpio2>; interrupts = <12 IRQ_TYPE_EDGE_FALLING>; + vcc-supply = <&vcc_3v3_tft1>; }; };
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 513/633 soc: mediatek: cmdq: add clear option in cmdq_pkt_wfe api
In reply to Greg Kroah-HartmanFrom: Dennis YC Hsieh <[email protected]>
[ Upstream commit 23c22299cd290409c6b78f57c42b64f8dfb6dd92 ]
Add clear parameter to let client decide if
event should be clear to 0 after GCE receive it.
--- drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 2 +- drivers/soc/mediatek/mtk-cmdq-helper.c | 5 +++-- include/linux/mailbox/mtk-cmdq-mailbox.h | 3 +-- include/linux/soc/mediatek/mtk-cmdq.h | 5 +++-- 4 files changed, 8 insertions(+), 7 deletions(-)
drivers/gpu/drm/mediatek/mtk_drm_crtc.c +1 -1
@@ -485,7 +485,7 @@ static void mtk_drm_crtc_hw_config(struct mtk_drm_crtc *mtk_crtc)mbox_flush (mtk_crtc->cmdq_client->chan,2000 ); cmdq_handle =cmdq_pkt_create (mtk_crtc->cmdq_client,PAGE_SIZE );cmdq_pkt_clear_event (cmdq_handle, mtk_crtc->cmdq_event); -cmdq_pkt_wfe (cmdq_handle, mtk_crtc->cmdq_event); +cmdq_pkt_wfe (cmdq_handle, mtk_crtc->cmdq_event, true);mtk_crtc_ddp_config (crtc, cmdq_handle);cmdq_pkt_flush_async (cmdq_handle, ddp_cmdq_cb, cmdq_handle); }
drivers/soc/mediatek/mtk-cmdq-helper.c +3 -2
@@ -213,15 +213,16 @@ int cmdq_pkt_write_mask(struct cmdq_pkt *pkt, u8 subsys, }EXPORT_SYMBOL (cmdq_pkt_write_mask); -int cmdq_pkt_wfe (struct cmdq_pkt *pkt,u16 event) +int cmdq_pkt_wfe (struct cmdq_pkt *pkt,u16 event,bool clear) {struct cmdq_instruction inst = { {0 } }; +u32 clear_option = clear ?CMDQ_WFE_UPDATE :0 ;if (event >=CMDQ_MAX_EVENT )return -EINVAL ; inst.op =CMDQ_CODE_WFE ; - inst.value =CMDQ_WFE_OPTION ; + inst.value =CMDQ_WFE_OPTION | clear_option; inst.event = event;return cmdq_pkt_append_command (pkt, inst);
include/linux/mailbox/mtk-cmdq-mailbox.h +1 -2
@@ -27,8 +27,7 @@* bit 16-27: update value * bit 31: 1 - update, 0 - no update */ -#define CMDQ_WFE_OPTION (CMDQ_WFE_UPDATE | CMDQ_WFE_WAIT | \ - CMDQ_WFE_WAIT_VALUE) +#define CMDQ_WFE_OPTION (CMDQ_WFE_WAIT | CMDQ_WFE_WAIT_VALUE)/** cmdq event maximum */ #define CMDQ_MAX_EVENT 0x3ff
include/linux/soc/mediatek/mtk-cmdq.h +3 -2
@@ -105,11 +105,12 @@ int cmdq_pkt_write_mask(struct cmdq_pkt *pkt, u8 subsys,/** * cmdq_pkt_wfe() - append wait for event command to the CMDQ packet * @pkt: the CMDQ packet -* @event: the desired event type to "wait and CLEAR" +* @event: the desired event type to wait +* @clear: clear event or not after event arrive * * Return: 0 for success; else the error code is returned */ -int cmdq_pkt_wfe (struct cmdq_pkt *pkt,u16 event); +int cmdq_pkt_wfe (struct cmdq_pkt *pkt,u16 event,bool clear);/** * cmdq_pkt_clear_event() - append clear event command to the CMDQ packet
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 514/633 drm/mediatek: reduce clear event
In reply to Greg Kroah-HartmanFrom: Dennis YC Hsieh <[email protected]>
[ Upstream commit bee1abc9cc021f50b90f22a589d9ddc816a80db0 ]
No need to clear event again since event always clear before wait. This fix depend on patch:
"soc: mediatek: cmdq: add clear option in cmdq_pkt_wfe api"
--- drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/mediatek/mtk_drm_crtc.c +1 -1
@@ -485,7 +485,7 @@ static void mtk_drm_crtc_hw_config(struct mtk_drm_crtc *mtk_crtc)mbox_flush (mtk_crtc->cmdq_client->chan,2000 ); cmdq_handle =cmdq_pkt_create (mtk_crtc->cmdq_client,PAGE_SIZE );cmdq_pkt_clear_event (cmdq_handle, mtk_crtc->cmdq_event); -cmdq_pkt_wfe (cmdq_handle, mtk_crtc->cmdq_event, true); +cmdq_pkt_wfe (cmdq_handle, mtk_crtc->cmdq_event, false);mtk_crtc_ddp_config (crtc, cmdq_handle);cmdq_pkt_flush_async (cmdq_handle, ddp_cmdq_cb, cmdq_handle); }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 515/633 arm64: dts: zynqmp: Remove additional compatible string for i2c IPs
In reply to Greg Kroah-HartmanFrom: Michal Simek <[email protected]>
[ Upstream commit 35292518cb0a626fcdcabf739aed75060a018ab5 ]
DT binding permits only one compatible string which was decribed in past by commit 63cab195bf49 ("i2c: removed work arounds in i2c driver for Zynq Ultrascale+ MPSoC").
The commit aea37006e183 ("dt-bindings: i2c: cadence: Migrate i2c-cadence documentation to YAML") has converted binding to yaml and the following issues is reported:
...: i2c@ff030000: compatible: Additional items are not allowed ('cdns,i2c-r1p10' was unexpected)
From schema:.../Documentation/devicetree/bindings/i2c/cdns,i2c-r1p10.yaml fds ...: i2c@ff030000: compatible: ['cdns,i2c-r1p14', 'cdns,i2c-r1p10'] is too long
The commit c415f9e8304a ("ARM64: zynqmp: Fix i2c node's compatible string") has added the second compatible string but without removing origin one. The patch is only keeping one compatible string "cdns,i2c-r1p14".
--- arch/arm64/boot/dts/xilinx/zynqmp.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/xilinx/zynqmp.dtsi +2 -2
@@ -500,7 +500,7 @@ gpio: gpio@ff0a0000 { }; i2c0: i2c@ff020000 { - compatible = "cdns,i2c-r1p14", "cdns,i2c-r1p10"; + compatible = "cdns,i2c-r1p14"; status = "disabled"; interrupt-parent = <&gic>; interrupts = <0 17 4>;
@@ -511,7 +511,7 @@ i2c0: i2c@ff020000 { }; i2c1: i2c@ff030000 { - compatible = "cdns,i2c-r1p14", "cdns,i2c-r1p10"; + compatible = "cdns,i2c-r1p14"; status = "disabled"; interrupt-parent = <&gic>; interrupts = <0 18 4>;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 516/633 ARM: dts: meson8: remove two invalid interrupt lines from the GPU node
In reply to Greg Kroah-HartmanFrom: Martin Blumenstingl <[email protected]>
[ Upstream commit 737e7610b545cc901a9696083c1824a7104b8d1b ]
The 3.10 vendor kernel defines the following GPU 20 interrupt lines:
#define INT_MALI_GP AM_IRQ(160) #define INT_MALI_GP_MMU AM_IRQ(161) #define INT_MALI_PP AM_IRQ(162) #define INT_MALI_PMU AM_IRQ(163) #define INT_MALI_PP0 AM_IRQ(164) #define INT_MALI_PP0_MMU AM_IRQ(165) #define INT_MALI_PP1 AM_IRQ(166) #define INT_MALI_PP1_MMU AM_IRQ(167) #define INT_MALI_PP2 AM_IRQ(168) #define INT_MALI_PP2_MMU AM_IRQ(169) #define INT_MALI_PP3 AM_IRQ(170) #define INT_MALI_PP3_MMU AM_IRQ(171) #define INT_MALI_PP4 AM_IRQ(172) #define INT_MALI_PP4_MMU AM_IRQ(173) #define INT_MALI_PP5 AM_IRQ(174) #define INT_MALI_PP5_MMU AM_IRQ(175) #define INT_MALI_PP6 AM_IRQ(176) #define INT_MALI_PP6_MMU AM_IRQ(177) #define INT_MALI_PP7 AM_IRQ(178) #define INT_MALI_PP7_MMU AM_IRQ(179)
However, the driver from the 3.10 vendor kernel does not use the following four interrupt lines:
- INT_MALI_PP3
- INT_MALI_PP3_MMU
- INT_MALI_PP7
- INT_MALI_PP7_MMU
Drop the "pp3" and "ppmmu3" interrupt lines. This is also important because there is no matching entry in interrupt-names for it (meaning the "pp2" interrupt is actually assigned to the "pp3" interrupt line).
--- arch/arm/boot/dts/meson8.dtsi | 2 -- 1 file changed, 2 deletions(-)
arch/arm/boot/dts/meson8.dtsi +0 -2
@@ -239,8 +239,6 @@ mali: gpu@c0000 { <GIC_SPI 167 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 168 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 169 IRQ_TYPE_LEVEL_HIGH>, - <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, - <GIC_SPI 171 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 172 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 173 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 174 IRQ_TYPE_LEVEL_HIGH>,
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 517/633 lightnvm: fix out-of-bounds write to array devices->info[]
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
[ Upstream commit a48faebe65b0db55a73b9220c3d919eee849bb79 ]
There is an off-by-one array check that can lead to a out-of-bounds write to devices->info[i]. Fix this by checking by using >= rather than > for the size check. Also replace hard-coded array size limit with ARRAY_SIZE on the array.
Addresses-Coverity: ("Out-of-bounds write")
--- drivers/lightnvm/core.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/lightnvm/core.c +3 -2
@@ -1315,8 +1315,9 @@ static long nvm_ioctl_get_devices(struct file *file, void __user *arg)strlcpy (info->bmname,"gennvm" ,sizeof (info->bmname)); i++; -if (i >31 ) { -pr_err ("max 31 devices can be reported.\n" ); +if (i >=ARRAY_SIZE (devices->info)) { +pr_err ("max %zd devices can be reported.\n" , +ARRAY_SIZE (devices->info));break ; } }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 518/633 powerpc/powernv/dump: Fix race while processing OPAL dump
In reply to Greg Kroah-HartmanFrom: Vasant Hegde <[email protected]>
[ Upstream commit 0a43ae3e2beb77e3481d812834d33abe270768ab ]
Every dump reported by OPAL is exported to userspace through a sysfs interface and notified using kobject_uevent(). The userspace daemon (opal_errd) then reads the dump and acknowledges that the dump is saved safely to disk. Once acknowledged the kernel removes the respective sysfs file entry causing respective resources to be released including kobject.
However it's possible the userspace daemon may already be scanning dump entries when a new sysfs dump entry is created by the kernel. User daemon may read this new entry and ack it even before kernel can notify userspace about it through kobject_uevent() call. If that happens then we have a potential race between dump_ack_store->kobject_put() and kobject_uevent which can lead to use-after-free of a kernfs object resulting in a kernel crash.
This patch fixes this race by protecting the sysfs file creation/notification by holding a reference count on kobject until we safely send kobject_uevent().
The function create_dump_obj() returns the dump object which if used by caller function will end up in use-after-free problem again. However, the return value of create_dump_obj() function isn't being used today and there is no need as well. Hence change it to return void to make this fix complete.
--- arch/powerpc/platforms/powernv/opal-dump.c | 41 +++++++++++++++------- 1 file changed, 29 insertions(+), 12 deletions(-)
arch/powerpc/platforms/powernv/opal-dump.c +29 -12
@@ -318,15 +318,14 @@ static ssize_t dump_attr_read(struct file *filep, struct kobject *kobj,return count; } -static struct dump_obj *create_dump_obj (uint32_t id,size_t size, -uint32_t type) +static void create_dump_obj (uint32_t id,size_t size,uint32_t type) {struct dump_obj *dump;int rc; dump =kzalloc (sizeof (*dump),GFP_KERNEL );if (!dump) -return NULL ; +return ; dump->kobj.kset = dump_kset;
@@ -346,21 +345,39 @@ static struct dump_obj *create_dump_obj(uint32_t id, size_t size, rc =kobject_add (&dump->kobj,NULL ,"0x%x-0x%x" , type, id);if (rc) {kobject_put (&dump->kobj); -return NULL ; +return ; } +/* +* As soon as the sysfs file for this dump is created/activated there is +* a chance the opal_errd daemon (or any userspace) might read and +* acknowledge the dump before kobject_uevent() is called. If that +* happens then there is a potential race between +* dump_ack_store->kobject_put() and kobject_uevent() which leads to a +* use-after-free of a kernfs object resulting in a kernel crash. +* +* To avoid that, we need to take a reference on behalf of the bin file, +* so that our reference remains valid while we call kobject_uevent(). +* We then drop our reference before exiting the function, leaving the +* bin file to drop the last reference (if it hasn't already). +*/ + +/* Take a reference for the bin file */ +kobject_get (&dump->kobj); rc =sysfs_create_bin_file (&dump->kobj, &dump->dump_attr); -if (rc) { +if (rc ==0 ) { +kobject_uevent (&dump->kobj,KOBJ_ADD ); + +pr_info ("%s: New platform dump. ID = 0x%x Size %u\n" , + __func__, dump->id, dump->size); + }else { +/* Drop reference count taken for bin file */ kobject_put (&dump->kobj); -return NULL ; } -pr_info ("%s: New platform dump. ID = 0x%x Size %u\n" , - __func__, dump->id, dump->size); - -kobject_uevent (&dump->kobj,KOBJ_ADD ); - -return dump; +/* Drop our reference */ +kobject_put (&dump->kobj); +return ; }static irqreturn_t process_dump (int irq,void *data)
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 519/633 powerpc/pseries: Avoid using addr_to_pfn in real mode
In reply to Greg Kroah-HartmanFrom: Ganesh Goudar <[email protected]>
[ Upstream commit 4ff753feab021242144818b9a3ba011238218145 ]
When an UE or memory error exception is encountered the MCE handler tries to find the pfn using addr_to_pfn() which takes effective address as an argument, later pfn is used to poison the page where memory error occurred, recent rework in this area made addr_to_pfn to run in real mode, which can be fatal as it may try to access memory outside RMO region.
Have two helper functions to separate things to be done in real mode and virtual mode without changing any functionality. This also fixes the following error as the use of addr_to_pfn is now moved to virtual mode.
Without this change following kernel crash is seen on hitting UE.
[ 485.128036] Oops: Kernel access of bad area, sig: 11 [#1] [ 485.128040] LE SMP NR_CPUS=2048 NUMA pSeries [ 485.128047] Modules linked in: [ 485.128067] CPU: 15 PID: 6536 Comm: insmod Kdump: loaded Tainted: G OE 5.7.0 #22 [ 485.128074] NIP: c00000000009b24c LR: c0000000000398d8 CTR: c000000000cd57c0 [ 485.128078] REGS: c000000003f1f970 TRAP: 0300 Tainted: G OE (5.7.0) [ 485.128082] MSR: 8000000000001003 <SF,ME,RI,LE> CR: 28008284 XER: 00000001 [ 485.128088] CFAR: c00000000009b190 DAR: c0000001fab00000 DSISR: 40000000 IRQMASK: 1 [ 485.128088] GPR00: 0000000000000001 c000000003f1fbf0 c000000001634300 0000b0fa01000000 [ 485.128088] GPR04: d000000002220000 0000000000000000 00000000fab00000 0000000000000022 [ 485.128088] GPR08: c0000001fab00000 0000000000000000 c0000001fab00000 c000000003f1fc14 [ 485.128088] GPR12: 0000000000000008 c000000003ff5880 d000000002100008 0000000000000000 [ 485.128088] GPR16: 000000000000ff20 000000000000fff1 000000000000fff2 d0000000021a1100 [ 485.128088] GPR20: d000000002200000 c00000015c893c50 c000000000d49b28 c00000015c893c50 [ 485.128088] GPR24: d0000000021a0d08 c0000000014e5da8 d0000000021a0818 000000000000000a [ 485.128088] GPR28: 0000000000000008 000000000000000a c0000000017e2970 000000000000000a [ 485.128125] NIP [c00000000009b24c] __find_linux_pte+0x11c/0x310 [ 485.128130] LR [c0000000000398d8] addr_to_pfn+0x138/0x170 [ 485.128133] Call Trace: [ 485.128135] Instruction dump: [ 485.128138] 3929ffff 7d4a3378 7c883c36 7d2907b4 794a1564 7d294038 794af082 3900ffff [ 485.128144] 79291f24 790af00e 78e70020 7d095214 <7c69502a> 2fa30000 419e011c 70690040 [ 485.128152] ---[ end trace d34b27e29ae0e340 ]---
--- arch/powerpc/platforms/pseries/ras.c | 118 ++++++++++++++++----------- 1 file changed, 69 insertions(+), 49 deletions(-)
arch/powerpc/platforms/pseries/ras.c +69 -49
@@ -521,18 +521,55 @@ int pSeries_system_reset_exception(struct pt_regs *regs)return 0 ;/* need to perform reset */ } +static int mce_handle_err_realmode (int disposition,u8 error_type) +{ +#ifdef CONFIG_PPC_BOOK3S_64 +if (disposition ==RTAS_DISP_NOT_RECOVERED ) { +switch (error_type) { +case MC_ERROR_TYPE_SLB : +case MC_ERROR_TYPE_ERAT : +/* +* Store the old slb content in paca before flushing. +* Print this when we go to virtual mode. +* There are chances that we may hit MCE again if there +* is a parity error on the SLB entry we trying to read +* for saving. Hence limit the slb saving to single +* level of recursion. +*/ +if (local_paca->in_mce ==1 ) +slb_save_contents (local_paca->mce_faulty_slbs); +flush_and_reload_slb (); + disposition =RTAS_DISP_FULLY_RECOVERED ; +break ; +default : +break ; + } + }else if (disposition ==RTAS_DISP_LIMITED_RECOVERY ) { +/* Platform corrected itself but could be degraded */ +pr_err ("MCE: limited recovery, system may be degraded\n" ); + disposition =RTAS_DISP_FULLY_RECOVERED ; + } +#endif +return disposition; +} -static int mce_handle_error (struct pt_regs *regs,struct rtas_error_log *errp) +static int mce_handle_err_virtmode (struct pt_regs *regs, +struct rtas_error_log *errp, +struct pseries_mc_errorlog *mce_log, +int disposition) {struct mce_error_info mce_err = {0 }; -unsigned long eaddr =0 , paddr =0 ; -struct pseries_errorlog *pseries_log; -struct pseries_mc_errorlog *mce_log; -int disposition =rtas_error_disposition (errp);int initiator =rtas_error_initiator (errp);int severity =rtas_error_severity (errp); +unsigned long eaddr =0 , paddr =0 ;u8 error_type, err_sub_type; +if (!mce_log) + goto out; + + error_type = mce_log->error_type; + err_sub_type =rtas_mc_error_sub_type (mce_log); +if (initiator ==RTAS_INITIATOR_UNKNOWN ) mce_err.initiator =MCE_INITIATOR_UNKNOWN ;else if (initiator ==RTAS_INITIATOR_CPU )
@@ -571,18 +608,7 @@ static int mce_handle_error(struct pt_regs *regs, struct rtas_error_log *errp) mce_err.error_type =MCE_ERROR_TYPE_UNKNOWN ; mce_err.error_class =MCE_ECLASS_UNKNOWN ; -if (!rtas_error_extended (errp)) - goto out; - - pseries_log =get_pseries_errorlog (errp,PSERIES_ELOG_SECT_ID_MCE ); -if (pseries_log ==NULL ) - goto out; - - mce_log = (struct pseries_mc_errorlog *)pseries_log->data; - error_type = mce_log->error_type; - err_sub_type =rtas_mc_error_sub_type (mce_log); - -switch (mce_log->error_type) { +switch (error_type) {case MC_ERROR_TYPE_UE : mce_err.error_type =MCE_ERROR_TYPE_UE ;mce_common_process_ue (regs, &mce_err);
@@ -682,37 +708,31 @@ static int mce_handle_error(struct pt_regs *regs, struct rtas_error_log *errp) mce_err.error_type =MCE_ERROR_TYPE_UNKNOWN ;break ; } +out: +save_mce_event (regs, disposition ==RTAS_DISP_FULLY_RECOVERED , + &mce_err, regs->nip, eaddr, paddr); +return disposition; +} -#ifdef CONFIG_PPC_BOOK3S_64 -if (disposition ==RTAS_DISP_NOT_RECOVERED ) { -switch (error_type) { -case MC_ERROR_TYPE_SLB : -case MC_ERROR_TYPE_ERAT : -/* -* Store the old slb content in paca before flushing. -* Print this when we go to virtual mode. -* There are chances that we may hit MCE again if there -* is a parity error on the SLB entry we trying to read -* for saving. Hence limit the slb saving to single -* level of recursion. -*/ -if (local_paca->in_mce ==1 ) -slb_save_contents (local_paca->mce_faulty_slbs); -flush_and_reload_slb (); - disposition =RTAS_DISP_FULLY_RECOVERED ; -break ; -default : -break ; - } - }else if (disposition ==RTAS_DISP_LIMITED_RECOVERY ) { -/* Platform corrected itself but could be degraded */ -printk (KERN_ERR "MCE: limited recovery, system may " -"be degraded\n" ); - disposition =RTAS_DISP_FULLY_RECOVERED ; - } -#endif +static int mce_handle_error (struct pt_regs *regs,struct rtas_error_log *errp) +{ +struct pseries_errorlog *pseries_log; +struct pseries_mc_errorlog *mce_log =NULL ; +int disposition =rtas_error_disposition (errp); +u8 error_type; + +if (!rtas_error_extended (errp)) + goto out; + + pseries_log =get_pseries_errorlog (errp,PSERIES_ELOG_SECT_ID_MCE ); +if (!pseries_log) + goto out; + + mce_log = (struct pseries_mc_errorlog *)pseries_log->data; + error_type = mce_log->error_type; + + disposition =mce_handle_err_realmode (disposition, error_type); -out:/* * Enable translation as we will be accessing per-cpu variables * in save_mce_event() which may fall outside RMO region, also
@@ -723,10 +743,10 @@ static int mce_handle_error(struct pt_regs *regs, struct rtas_error_log *errp)* Note: All the realmode handling like flushing SLB entries for * SLB multihit is done by now. */ +out:mtmsr (mfmsr () |MSR_IR |MSR_DR ); -save_mce_event (regs, disposition ==RTAS_DISP_FULLY_RECOVERED , - &mce_err, regs->nip, eaddr, paddr); - + disposition =mce_handle_err_virtmode (regs, errp, mce_log, + disposition);return disposition; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 520/633 nvmet: fix uninitialized work for zero kato
In reply to Greg Kroah-HartmanFrom: zhenwei pi <[email protected]>
[ Upstream commit 85bd23f3dc09a2ae9e56885420e52c54bf983713 ]
When connecting a controller with a zero kato value using the following command line
nvme connect -t tcp -n NQN -a ADDR -s PORT --keep-alive-tmo=0
the warning below can be reproduced:
WARNING: CPU: 1 PID: 241 at kernel/workqueue.c:1627 __queue_delayed_work+0x6d/0x90 with trace: mod_delayed_work_on+0x59/0x90 nvmet_update_cc+0xee/0x100 [nvmet] nvmet_execute_prop_set+0x72/0x80 [nvmet] nvmet_tcp_try_recv_pdu+0x2f7/0x770 [nvmet_tcp] nvmet_tcp_io_work+0x63f/0xb2d [nvmet_tcp] ...
This is caused by queuing up an uninitialized work. Althrough the keep-alive timer is disabled during allocating the controller (fixed in 0d3b6a8d213a), ka_work still has a chance to run (called by nvmet_start_ctrl).
--- drivers/nvme/target/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/nvme/target/core.c +2 -1
@@ -1142,7 +1142,8 @@ static void nvmet_start_ctrl(struct nvmet_ctrl *ctrl)* in case a host died before it enabled the controller. Hence, simply * reset the keep alive timer when the controller is enabled. */ -mod_delayed_work (system_wq, &ctrl->ka_work, ctrl->kato *HZ ); +if (ctrl->kato) +mod_delayed_work (system_wq, &ctrl->ka_work, ctrl->kato *HZ ); }static void nvmet_clear_ctrl (struct nvmet_ctrl *ctrl)
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 521/633 KVM: ioapic: break infinite recursion on lazy EOI
In reply to Greg Kroah-HartmanFrom: Vitaly Kuznetsov <[email protected]>
[ Upstream commit 77377064c3a94911339f13ce113b3abf265e06da ]
During shutdown the IOAPIC trigger mode is reset to edge triggered while the vfio-pci INTx is still registered with a resampler. This allows us to get into an infinite loop:
ioapic_set_irq
-> ioapic_lazy_update_eoi
-> kvm_ioapic_update_eoi_one
-> kvm_notify_acked_irq
-> kvm_notify_acked_gsi
-> (via irq_acked fn ptr) irqfd_resampler_ack
-> kvm_set_irq
-> (via set fn ptr) kvm_set_ioapic_irq
-> kvm_ioapic_set_irq
-> ioapic_set_irq
Commit 8be8f932e3db ("kvm: ioapic: Restrict lazy EOI update to edge-triggered interrupts", 2020-05-04) acknowledges that this recursion loop exists and tries to avoid it at the call to ioapic_lazy_update_eoi, but at this point the scenario is already set, we have an edge interrupt with resampler on the same gsi.
Fortunately, the only user of irq ack notifiers (in addition to resamplefd) is i8254 timer interrupt reinjection. These are edge-triggered, so in principle they would need the call to kvm_ioapic_update_eoi_one from ioapic_lazy_update_eoi, but they already disable AVIC(*), so they don't need the lazy EOI behavior. Therefore, remove the call to kvm_ioapic_update_eoi_one from ioapic_lazy_update_eoi.
This fixes CVE-2020-27152. Note that this issue cannot happen with SR-IOV assigned devices because virtual functions do not have INTx, only MSI.
--- arch/x86/kvm/ioapic.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
arch/x86/kvm/ioapic.c +1 -4
@@ -197,12 +197,9 @@ static void ioapic_lazy_update_eoi(struct kvm_ioapic *ioapic, int irq)/* * If no longer has pending EOI in LAPICs, update -* EOI for this vetor. +* EOI for this vector. */ rtc_irq_eoi (ioapic, vcpu, entry->fields.vector); -kvm_ioapic_update_eoi_one (vcpu, ioapic, - entry->fields.trig_mode, - irq);break ; } }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 522/633 NTB: hw: amd: fix an issue about leak system resources
In reply to Greg Kroah-HartmanFrom: Kaige Li <[email protected]>
[ Upstream commit 44a0a3c17919db1498cebb02ecf3cf4abc1ade7b ]
The related system resources were not released when pci_set_dma_mask(), pci_set_consistent_dma_mask(), or pci_iomap() return error in the amd_ntb_init_pci() function. Add pci_release_regions() to fix it.
--- drivers/ntb/hw/amd/ntb_hw_amd.c | 1 + 1 file changed, 1 insertion(+)
drivers/ntb/hw/amd/ntb_hw_amd.c +1 -0
@@ -1203,6 +1203,7 @@ static int amd_ntb_init_pci(struct amd_ntb_dev *ndev, err_dma_mask:pci_clear_master (pdev); +pci_release_regions (pdev); err_pci_regions:pci_disable_device (pdev); err_pci_enable:
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 523/633 ntb: intel: Fix memleak in intel_ntb_pci_probe
In reply to Greg Kroah-HartmanFrom: Dinghao Liu <[email protected]>
[ Upstream commit dbb8df5c2d27610a87b0168a8acc89d73fbfde94 ]
The default error branch of a series of pdev_is_gen calls should free ndev just like what we've done in these calls.
--- drivers/ntb/hw/intel/ntb_hw_gen1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ntb/hw/intel/ntb_hw_gen1.c +1 -1
@@ -1893,7 +1893,7 @@ static int intel_ntb_pci_probe(struct pci_dev *pdev, goto err_init_dev; }else { rc = -EINVAL ; - goto err_ndev; + goto err_init_pci; }ndev_reset_unsafe_flags (ndev);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 524/633 sched/features: Fix !CONFIG_JUMP_LABEL case
In reply to Greg Kroah-HartmanFrom: Juri Lelli <[email protected]>
[ Upstream commit a73f863af4ce9730795eab7097fb2102e6854365 ]
Commit:
765cc3a4b224e ("sched/core: Optimize sched_feat() for !CONFIG_SCHED_DEBUG builds")
made sched features static for !CONFIG_SCHED_DEBUG configurations, but overlooked the CONFIG_SCHED_DEBUG=y and !CONFIG_JUMP_LABEL cases.
For the latter echoing changes to /sys/kernel/debug/sched_features has the nasty effect of effectively changing what sched_features reports, but without actually changing the scheduler behaviour (since different translation units get different sysctl_sched_features).
Fix CONFIG_SCHED_DEBUG=y and !CONFIG_JUMP_LABEL configurations by properly restructuring ifdefs.
--- kernel/sched/core.c | 2 +- kernel/sched/sched.h | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-)
kernel/sched/core.c +1 -1
@@ -39,7 +39,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(sched_overutilized_tp); DEFINE_PER_CPU_SHARED_ALIGNED(struct rq, runqueues); -#if defined(CONFIG_SCHED_DEBUG ) && defined(CONFIG_JUMP_LABEL ) +#ifdef CONFIG_SCHED_DEBUG /* * Debugging: various feature bits *
kernel/sched/sched.h +10 -3
@@ -1600,7 +1600,7 @@ enum {#undef SCHED_FEAT -#if defined(CONFIG_SCHED_DEBUG ) && defined(CONFIG_JUMP_LABEL ) +#ifdef CONFIG_SCHED_DEBUG /* * To support run-time toggling of sched features, all the translation units
@@ -1608,6 +1608,7 @@ enum {*/ extern const_debug unsigned int sysctl_sched_features; +#ifdef CONFIG_JUMP_LABEL #define SCHED_FEAT (name, enabled) \ static __always_inline bool static_branch_##name(struct static_key *key) \ { \
@@ -1620,7 +1621,13 @@ static __always_inline bool static_branch_##name(struct static_key *key) \extern struct static_key sched_feat_keys[__SCHED_FEAT_NR];#define sched_feat (x) (static_branch_##x(&sched_feat_keys[__SCHED_FEAT_##x])) -#else /* !(SCHED_DEBUG && CONFIG_JUMP_LABEL) */ +#else /* !CONFIG_JUMP_LABEL */ + +#define sched_feat (x) (sysctl_sched_features & (1UL << __SCHED_FEAT_##x)) + +#endif /* CONFIG_JUMP_LABEL */ + +#else /* !SCHED_DEBUG */ /* * Each translation unit has its own copy of sysctl_sched_features to allow
@@ -1636,7 +1643,7 @@ static const_debug __maybe_unused unsigned int sysctl_sched_features =#define sched_feat (x) !!(sysctl_sched_features & (1UL << __SCHED_FEAT_##x)) -#endif /* SCHED_DEBUG && CONFIG_JUMP_LABEL */ +#endif /* SCHED_DEBUG */ extern struct static_key_false sched_numa_balancing;extern struct static_key_false sched_schedstats;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 525/633 perf: correct SNOOPX field offset
In reply to Greg Kroah-HartmanFrom: Al Grant <[email protected]>
[ Upstream commit f3d301c1f2f5676465cdf3259737ea19cc82731f ]
perf_event.h has macros that define the field offsets in the data_src bitmask in perf records. The SNOOPX and REMOTE offsets were both 37. These are distinct fields, and the bitfield layout in perf_mem_data_src confirms that SNOOPX should be at offset 38.
--- include/uapi/linux/perf_event.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/uapi/linux/perf_event.h +1 -1
@@ -1155,7 +1155,7 @@ union perf_mem_data_src {#define PERF_MEM_SNOOPX_FWD 0x01/* forward */ /* 1 free */ -#define PERF_MEM_SNOOPX_SHIFT 37 +#define PERF_MEM_SNOOPX_SHIFT 38/* locked instruction */ #define PERF_MEM_LOCK_NA 0x01/* not available */
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 526/633 i2c: core: Restore acpi_walk_dep_device_list() getting called after registering the ACPI i2c devs
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit 8058d69905058ec8f467a120b5ec5bb831ea67f3 ]
Commit 21653a4181ff ("i2c: core: Call i2c_acpi_install_space_handler() before i2c_acpi_register_devices()")'s intention was to only move the acpi_install_address_space_handler() call to the point before where the ACPI declared i2c-children of the adapter where instantiated by i2c_acpi_register_devices().
But i2c_acpi_install_space_handler() had a call to acpi_walk_dep_device_list() hidden (that is I missed it) at the end of it, so as an unwanted side-effect now acpi_walk_dep_device_list() was also being called before i2c_acpi_register_devices().
Move the acpi_walk_dep_device_list() call to the end of i2c_acpi_register_devices(), so that it is once again called *after* the i2c_client-s hanging of the adapter have been created.
This fixes the Microsoft Surface Go 2 hanging at boot.
--- drivers/i2c/i2c-core-acpi.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/i2c/i2c-core-acpi.c +10 -1
@@ -264,6 +264,7 @@ static acpi_status i2c_acpi_add_device(acpi_handle handle, u32 level,void i2c_acpi_register_devices (struct i2c_adapter *adap) {acpi_status status; +acpi_handle handle;if (!has_acpi_companion (&adap->dev))return ;
@@ -274,6 +275,15 @@ void i2c_acpi_register_devices(struct i2c_adapter *adap) adap, NULL);if (ACPI_FAILURE (status))dev_warn (&adap->dev,"failed to enumerate I2C slaves\n" ); + +if (!adap->dev.parent) +return ; + + handle =ACPI_HANDLE (adap->dev.parent); +if (!handle) +return ; + +acpi_walk_dep_device_list (handle); } const struct acpi_device_id *
@@ -729,7 +739,6 @@ int i2c_acpi_install_space_handler(struct i2c_adapter *adapter)return -ENOMEM ; } -acpi_walk_dep_device_list (handle);return 0 ; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 527/633 md/bitmap: fix memory leak of temporary bitmap
In reply to Greg Kroah-HartmanFrom: Zhao Heming <[email protected]>
[ Upstream commit 1383b347a8ae4a69c04ae3746e6cb5c8d38e2585 ]
Callers of get_bitmap_from_slot() are responsible to free the bitmap.
--- drivers/md/md-bitmap.c | 3 ++- drivers/md/md-cluster.c | 1 + 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/md/md-bitmap.c +2 -1
@@ -1949,6 +1949,7 @@ int md_bitmap_load(struct mddev *mddev) }EXPORT_SYMBOL_GPL (md_bitmap_load); +/* caller need to free returned bitmap with md_bitmap_free() */ struct bitmap *get_bitmap_from_slot (struct mddev *mddev,int slot) {int rv =0 ;
@@ -2012,6 +2013,7 @@ int md_bitmap_copy_from_slot(struct mddev *mddev, int slot,md_bitmap_unplug (mddev->bitmap); *low = lo; *high = hi; +md_bitmap_free (bitmap);return rv; }
@@ -2615,4 +2617,3 @@ struct attribute_group md_bitmap_group = { .name = "bitmap", .attrs = md_bitmap_attrs, }; -
drivers/md/md-cluster.c +1 -0
@@ -1166,6 +1166,7 @@ static int resize_bitmaps(struct mddev *mddev, sector_t newsize, sector_t oldsiz* can't resize bitmap */ goto out; +md_bitmap_free (bitmap); }return 0 ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 528/633 block: ratelimit handle_bad_sector() message
In reply to Greg Kroah-HartmanFrom: Tetsuo Handa <[email protected]>
[ Upstream commit f4ac712e4fe009635344b9af5d890fe25fcc8c0d ]
syzbot is reporting unkillable task [1], for the caller is failing to handle a corrupted filesystem image which attempts to access beyond the end of the device. While we need to fix the caller, flooding the console with handle_bad_sector() message is unlikely useful.
[1] https://syzkaller.appspot.com/bug?id=f1f49fb971d7a3e01bd8ab8cff2ff4572ccf3092
--- block/blk-core.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
block/blk-core.c +4 -5
@@ -798,11 +798,10 @@ static void handle_bad_sector(struct bio *bio, sector_t maxsector) {char b[BDEVNAME_SIZE ]; -printk (KERN_INFO "attempt to access beyond end of device\n" ); -printk (KERN_INFO "%s: rw=%d, want=%Lu, limit=%Lu\n" , -bio_devname (bio, b), bio->bi_opf, - (unsigned long long )bio_end_sector (bio), - (long long )maxsector); +pr_info_ratelimited ("attempt to access beyond end of device\n" +"%s: rw=%d, want=%llu, limit=%llu\n" , +bio_devname (bio, b), bio->bi_opf, +bio_end_sector (bio), maxsector); }#ifdef CONFIG_FAIL_MAKE_REQUEST
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 529/633 x86/dumpstack: Fix misleading instruction pointer error message
In reply to Greg Kroah-HartmanFrom: Mark Mossberg <[email protected]>
[ Upstream commit 238c91115cd05c71447ea071624a4c9fe661f970 ]
Printing "Bad RIP value" if copy_code() fails can be misleading for userspace pointers, since copy_code() can fail if the instruction pointer is valid but the code is paged out. This is because copy_code() calls copy_from_user_nmi() for userspace pointers, which disables page fault handling.
This is reproducible in OOM situations, where it's plausible that the code may be reclaimed in the time between entry into the kernel and when this message is printed. This leaves a misleading log in dmesg that suggests instruction pointer corruption has occurred, which may alarm users.
Change the message to state the error condition more precisely.
[ bp: Massage a bit. ]
--- arch/x86/kernel/dumpstack.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/x86/kernel/dumpstack.c +2 -1
@@ -115,7 +115,8 @@ void show_opcodes(struct pt_regs *regs, const char *loglvl)unsigned long prologue = regs->ip -PROLOGUE_SIZE ;if (copy_code (regs, opcodes, prologue,sizeof (opcodes))) { -printk ("%sCode: Bad RIP value.\n" , loglvl); +printk ("%sCode: Unable to access opcode bytes at RIP 0x%lx.\n" , + loglvl, prologue); }else { printk("%sCode: %" __stringify(PROLOGUE_SIZE) "ph <%02x> %" __stringify(EPILOGUE_SIZE) "ph\n", loglvl, opcodes,
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 530/633 crypto: ccp - fix error handling
In reply to Greg Kroah-HartmanFrom: Pavel Machek <[email protected]>
[ Upstream commit e356c49c6cf0db3f00e1558749170bd56e47652d ]
Fix resource leak in error handling.
--- drivers/crypto/ccp/ccp-ops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/ccp/ccp-ops.c +1 -1
@@ -1746,7 +1746,7 @@ ccp_run_sha_cmd(struct ccp_cmd_queue *cmd_q, struct ccp_cmd *cmd)break ;default : ret = -EINVAL ; - goto e_ctx; + goto e_data; } }else {/* Stash the context */
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 531/633 x86/asm: Replace __force_order with a memory clobber
In reply to Greg Kroah-HartmanFrom: Arvind Sankar <[email protected]>
[ Upstream commit aa5cacdc29d76a005cbbee018a47faa6e724dd2d ]
The CRn accessor functions use __force_order as a dummy operand to prevent the compiler from reordering CRn reads/writes with respect to each other.
The fact that the asm is volatile should be enough to prevent this:
volatile asm statements should be executed in program order. However GCC 4.9.x and 5.x have a bug that might result in reordering. This was fixed in 8.1, 7.3 and 6.5. Versions prior to these, including 5.x and 4.9.x, may reorder volatile asm statements with respect to each other.
There are some issues with __force_order as implemented:
- It is used only as an input operand for the write functions, and hence doesn't do anything additional to prevent reordering writes.
- It allows memory accesses to be cached/reordered across write functions, but CRn writes affect the semantics of memory accesses, so this could be dangerous.
- __force_order is not actually defined in the kernel proper, but the LLVM toolchain can in some cases require a definition: LLVM (as well as GCC 4.9) requires it for PIE code, which is why the compressed kernel has a definition, but also the clang integrated assembler may consider the address of __force_order to be significant, resulting in a reference that requires a definition.
Fix this by:
- Using a memory clobber for the write functions to additionally prevent caching/reordering memory accesses across CRn writes.
- Using a dummy input operand with an arbitrary constant address for the read functions, instead of a global variable. This will prevent reads from being reordered across writes, while allowing memory loads to be cached/reordered across CRn reads, which should be safe.
--- arch/x86/boot/compressed/pgtable_64.c | 9 --------- arch/x86/include/asm/special_insns.h | 28 ++++++++++++++------------- arch/x86/kernel/cpu/common.c | 4 ++-- 3 files changed, 17 insertions(+), 24 deletions(-)
arch/x86/boot/compressed/pgtable_64.c +0 -9
@@ -5,15 +5,6 @@#include "pgtable.h" #include "../string.h" -/* -* __force_order is used by special_insns.h asm code to force instruction -* serialization. -* -* It is not referenced from the code, but GCC < 5 with -fPIE would fail -* due to an undefined symbol. Define it to make these ancient GCCs work. -*/ -unsigned long __force_order; -#define BIOS_START_MIN 0x20000U/* 128K, less than this is insane */ #define BIOS_START_MAX 0x9f000U/* 640K, absolute maximum */
arch/x86/include/asm/special_insns.h +15 -13
@@ -11,45 +11,47 @@#include <linux/jump_label.h> /* -* Volatile isn't enough to prevent the compiler from reordering the -* read/write functions for the control registers and messing everything up. -* A memory clobber would solve the problem, but would prevent reordering of -* all loads stores around it, which can hurt performance. Solution is to -* use a variable and mimic reads and writes to it to enforce serialization +* The compiler should not reorder volatile asm statements with respect to each +* other: they should execute in program order. However GCC 4.9.x and 5.x have +* a bug (which was fixed in 8.1, 7.3 and 6.5) where they might reorder +* volatile asm. The write functions are not affected since they have memory +* clobbers preventing reordering. To prevent reads from being reordered with +* respect to writes, use a dummy memory operand. */ -extern unsigned long __force_order; + +#define __FORCE_ORDER "m"(*(unsigned int *)0x1000UL)void native_write_cr0 (unsigned long val);static inline unsigned long native_read_cr0 (void ) {unsigned long val; - asmvolatile ("mov %%cr0,%0\n\t" :"=r" (val),"=m" (__force_order)); + asm volatile("mov %%cr0,%0\n\t" : "=r" (val) : __FORCE_ORDER);return val; }static __always_inline unsigned long native_read_cr2 (void ) {unsigned long val; - asmvolatile ("mov %%cr2,%0\n\t" :"=r" (val),"=m" (__force_order)); + asm volatile("mov %%cr2,%0\n\t" : "=r" (val) : __FORCE_ORDER);return val; } static __always_inline void native_write_cr2(unsigned long val) { - asmvolatile ("mov %0,%%cr2" : :"r" (val),"m" (__force_order)); + asmvolatile ("mov %0,%%cr2" : :"r" (val) :"memory" ); }static inline unsigned long __native_read_cr3 (void ) {unsigned long val; - asmvolatile ("mov %%cr3,%0\n\t" :"=r" (val),"=m" (__force_order)); + asm volatile("mov %%cr3,%0\n\t" : "=r" (val) : __FORCE_ORDER);return val; }static inline void native_write_cr3 (unsigned long val) { - asmvolatile ("mov %0,%%cr3" : :"r" (val),"m" (__force_order)); + asmvolatile ("mov %0,%%cr3" : :"r" (val) :"memory" ); }static inline unsigned long native_read_cr4 (void )
@@ -64,10 +66,10 @@ static inline unsigned long native_read_cr4(void) asm volatile("1: mov %%cr4, %0\n" "2:\n" _ASM_EXTABLE(1b, 2b) - : "=r" (val), "=m" (__force_order) : "0" (0)); + : "=r" (val) : "0" (0), __FORCE_ORDER); #else/* CR4 always exists on x86_64. */ - asmvolatile ("mov %%cr4,%0\n\t" :"=r" (val),"=m" (__force_order)); + asm volatile("mov %%cr4,%0\n\t" : "=r" (val) : __FORCE_ORDER);#endif return val; }
arch/x86/kernel/cpu/common.c +2 -2
@@ -358,7 +358,7 @@ void native_write_cr0(unsigned long val)unsigned long bits_missing =0 ; set_register: - asmvolatile ("mov %0,%%cr0" :"+r" (val),"+m" (__force_order)); + asmvolatile ("mov %0,%%cr0" :"+r" (val) : :"memory" );if (static_branch_likely (&cr_pinning)) {if (unlikely ((val &X86_CR0_WP ) !=X86_CR0_WP )) {
@@ -377,7 +377,7 @@ void native_write_cr4(unsigned long val)unsigned long bits_changed =0 ; set_register: - asmvolatile ("mov %0,%%cr4" :"+r" (val),"+m" (cr4_pinned_bits)); + asmvolatile ("mov %0,%%cr4" :"+r" (val) : :"memory" );if (static_branch_likely (&cr_pinning)) {if (unlikely ((val & cr4_pinned_mask) != cr4_pinned_bits)) {
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 532/633 x86/mce: Add Skylake quirk for patrol scrub reported errors
In reply to Greg Kroah-HartmanFrom: Borislav Petkov <[email protected]>
[ Upstream commit fd258dc4442c5c1c069c6b5b42bfe7d10cddda95 ]
The patrol scrubber in Skylake and Cascade Lake systems can be configured to report uncorrected errors using a special signature in the machine check bank and to signal using CMCI instead of machine check.
Update the severity calculation mechanism to allow specifying the model, minimum stepping and range of machine check bank numbers.
Add a new rule to detect the special signature (on model 0x55, stepping
Quoted 1 line
=4 in any of the memory controller banks).
[ bp: Rewrite it.
aegl: Productize it. ]
--- arch/x86/kernel/cpu/mce/severity.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-)
arch/x86/kernel/cpu/mce/severity.c +26 -2
@@ -9,9 +9,11 @@#include <linux/seq_file.h> #include <linux/init.h> #include <linux/debugfs.h> -#include <asm/mce.h> #include <linux/uaccess.h> +#include <asm/mce.h> +#include <asm/intel-family.h> +#include "internal.h" /*
@@ -40,9 +42,14 @@ static struct severity {unsigned char context;unsigned char excp;unsigned char covered; +unsigned char cpu_model; +unsigned char cpu_minstepping; +unsigned char bank_lo, bank_hi;char *msg; } severities[] = { #define MCESEV(s, m, c...) { .sev = MCE_ ## s ## _SEVERITY, .msg = m, ## c } +#define BANK_RANGE (l, h) .bank_lo = l, .bank_hi = h +#define MODEL_STEPPING (m, s) .cpu_model = m, .cpu_minstepping = s#define KERNEL .context = IN_KERNEL#define USER .context = IN_USER#define KERNEL_RECOV .context = IN_KERNEL_RECOV
@@ -97,7 +104,6 @@ static struct severity {KEEP ,"Corrected error" ,NOSER ,BITCLR (MCI_STATUS_UC ) ), -/* * known AO MCACODs reported via MCE or CMC: *
@@ -113,6 +119,18 @@ static struct severity { AO, "Action optional: last level cache writeback error", SER, MASK(MCI_UC_AR|MCACOD, MCI_STATUS_UC|MCACOD_L3WB) ), +/* +* Quirk for Skylake/Cascade Lake. Patrol scrubber may be configured +* to report uncorrected errors using CMCI with a special signature. +* UC=0, MSCOD=0x0010, MCACOD=binary(000X 0000 1100 XXXX) reported +* in one of the memory controller banks. +* Set severity to "AO" for same action as normal patrol scrub error. +*/ +MCESEV ( +AO ,"Uncorrected Patrol Scrub Error" , +SER ,MASK (MCI_STATUS_UC |MCI_ADDR |0xffffeff0 ,MCI_ADDR |0x001000c0 ), +MODEL_STEPPING (INTEL_FAM6_SKYLAKE_X ,4 ),BANK_RANGE (13 ,18 ) + ),/* ignore OVER for UCNA */ MCESEV(
@@ -324,6 +342,12 @@ static int mce_severity_intel(struct mce *m, int tolerant, char **msg, bool is_econtinue ;if (s->excp && excp != s->excp)continue ; +if (s->cpu_model && boot_cpu_data.x86_model != s->cpu_model) +continue ; +if (s->cpu_minstepping && boot_cpu_data.x86_stepping < s->cpu_minstepping) +continue ; +if (s->bank_lo && (m->bank < s->bank_lo || m->bank > s->bank_hi)) +continue ;if (msg) *msg = s->msg; s->covered =1 ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 533/633 media: firewire: fix memory leak
In reply to Greg Kroah-HartmanFrom: Pavel Machek <[email protected]>
[ Upstream commit b28e32798c78a346788d412f1958f36bb760ec03 ]
Fix memory leak in node_probe.
--- drivers/media/firewire/firedtv-fw.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/media/firewire/firedtv-fw.c +4 -2
@@ -272,8 +272,10 @@ static int node_probe(struct fw_unit *unit, const struct ieee1394_device_id *id) name_len =fw_csr_string (unit->directory,CSR_MODEL , name,sizeof (name)); -if (name_len <0 ) -return name_len; +if (name_len <0 ) { + err = name_len; + goto fail_free; + }for (i =ARRAY_SIZE (model_names); --i; )if (strlen (model_names[i]) <= name_len &&strncmp (name, model_names[i], name_len) ==0 )
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 534/633 media: ati_remote: sanity check for both endpoints
In reply to Greg Kroah-HartmanFrom: Oliver Neukum <[email protected]>
[ Upstream commit a8be80053ea74bd9c3f9a3810e93b802236d6498 ]
If you do sanity checks, you should do them for both endpoints. Hence introduce checking for endpoint type for the output endpoint, too.
--- drivers/media/rc/ati_remote.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/media/rc/ati_remote.c +4 -0
@@ -835,6 +835,10 @@ static int ati_remote_probe(struct usb_interface *interface,err ("%s: endpoint_in message size==0? \n" , __func__);return -ENODEV ; } +if (!usb_endpoint_is_int_out (endpoint_out)) { +err ("%s: Unexpected endpoint_out\n" , __func__); +return -ENODEV ; + } ati_remote =kzalloc (sizeof (struct ati_remote ),GFP_KERNEL ); rc_dev =rc_allocate_device (RC_DRIVER_SCANCODE );
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 535/633 media: st-delta: Fix reference count leak in delta_run_work
In reply to Greg Kroah-HartmanFrom: Aditya Pakki <[email protected]>
[ Upstream commit 57cc666d36adc7b45e37ba4cd7bc4e44ec4c43d7 ]
delta_run_work() calls delta_get_sync() that increments the reference counter. In case of failure, decrement the reference count by calling delta_put_autosuspend().
--- drivers/media/platform/sti/delta/delta-v4l2.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/media/platform/sti/delta/delta-v4l2.c +3 -1
@@ -954,8 +954,10 @@ static void delta_run_work(struct work_struct *work)/* enable the hardware */ if (!dec->pm) { ret =delta_get_sync (ctx); -if (ret) +if (ret) { +delta_put_autosuspend (ctx); goto err; + } }/* decode this access unit */
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 536/633 media: sti: Fix reference count leaks
In reply to Greg Kroah-HartmanFrom: Qiushi Wu <[email protected]>
[ Upstream commit 6f4432bae9f2d12fc1815b5e26cc07e69bcad0df ]
pm_runtime_get_sync() increments the runtime PM usage counter even when it returns an error code, causing incorrect ref count if pm_runtime_put_noidle() is not called in error handling paths. Thus call pm_runtime_put_noidle() if pm_runtime_get_sync() fails.
--- drivers/media/platform/sti/hva/hva-hw.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/media/platform/sti/hva/hva-hw.c +2 -0
@@ -272,6 +272,7 @@ static unsigned long int hva_hw_get_ip_version(struct hva_dev *hva)if (pm_runtime_get_sync (dev) <0 ) {dev_err (dev,"%s failed to get pm_runtime\n" ,HVA_PREFIX ); +pm_runtime_put_noidle (dev);mutex_unlock (&hva->protect_mutex);return -EFAULT ; }
@@ -553,6 +554,7 @@ void hva_hw_dump_regs(struct hva_dev *hva, struct seq_file *s)if (pm_runtime_get_sync (dev) <0 ) {seq_puts (s,"Cannot wake up IP\n" ); +pm_runtime_put_noidle (dev);mutex_unlock (&hva->protect_mutex);return ; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 537/633 media: exynos4-is: Fix several reference count leaks due to pm_runtime_get_sync
In reply to Greg Kroah-HartmanFrom: Qiushi Wu <[email protected]>
[ Upstream commit 7ef64ceea0008c17e94a8a2c60c5d6d46f481996 ]
On calling pm_runtime_get_sync() the reference count of the device is incremented. In case of failure, decrement the reference count before returning the error.
--- drivers/media/platform/exynos4-is/fimc-isp.c | 4 +++- drivers/media/platform/exynos4-is/fimc-lite.c | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/media/platform/exynos4-is/fimc-isp.c +3 -1
@@ -305,8 +305,10 @@ static int fimc_isp_subdev_s_power(struct v4l2_subdev *sd, int on)if (on) { ret =pm_runtime_get_sync (&is->pdev->dev); -if (ret <0 ) +if (ret <0 ) { +pm_runtime_put (&is->pdev->dev);return ret; + }set_bit (IS_ST_PWR_ON , &is->state); ret =fimc_is_start_firmware (is);
drivers/media/platform/exynos4-is/fimc-lite.c +1 -1
@@ -470,7 +470,7 @@ static int fimc_lite_open(struct file *file)set_bit (ST_FLITE_IN_USE , &fimc->state); ret =pm_runtime_get_sync (&fimc->pdev->dev);if (ret <0 ) - goto unlock; + goto err_pm; ret =v4l2_fh_open (file);if (ret <0 )
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 538/633 media: exynos4-is: Fix a reference count leak due to pm_runtime_get_sync
In reply to Greg Kroah-HartmanFrom: Qiushi Wu <[email protected]>
[ Upstream commit c47f7c779ef0458a58583f00c9ed71b7f5a4d0a2 ]
On calling pm_runtime_get_sync() the reference count of the device is incremented. In case of failure, decrement the reference count before returning the error.
--- drivers/media/platform/exynos4-is/media-dev.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/media/platform/exynos4-is/media-dev.c +3 -1
@@ -484,8 +484,10 @@ static int fimc_md_register_sensor_entities(struct fimc_md *fmd)return -ENXIO ; ret =pm_runtime_get_sync (fmd->pmf); -if (ret <0 ) +if (ret <0 ) { +pm_runtime_put (fmd->pmf);return ret; + } fmd->num_sensors =0 ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 539/633 media: exynos4-is: Fix a reference count leak
In reply to Greg Kroah-HartmanFrom: Qiushi Wu <[email protected]>
[ Upstream commit 64157b2cb1940449e7df2670e85781c690266588 ]
pm_runtime_get_sync() increments the runtime PM usage counter even when it returns an error code, causing incorrect ref count if pm_runtime_put_noidle() is not called in error handling paths. Thus call pm_runtime_put_noidle() if pm_runtime_get_sync() fails.
--- drivers/media/platform/exynos4-is/mipi-csis.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/media/platform/exynos4-is/mipi-csis.c +3 -1
@@ -510,8 +510,10 @@ static int s5pcsis_s_stream(struct v4l2_subdev *sd, int enable)if (enable) {s5pcsis_clear_counters (state); ret =pm_runtime_get_sync (&state->pdev->dev); -if (ret && ret !=1 ) +if (ret && ret !=1 ) { +pm_runtime_put_noidle (&state->pdev->dev);return ret; + } }mutex_lock (&state->lock);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 540/633 media: vsp1: Fix runtime PM imbalance on error
In reply to Greg Kroah-HartmanFrom: Dinghao Liu <[email protected]>
[ Upstream commit 98fae901c8883640202802174a4bd70a1b9118bd ]
pm_runtime_get_sync() increments the runtime PM usage counter even when it returns an error code. Thus a pairing decrement is needed on the error handling path to keep the counter balanced.
--- drivers/media/platform/vsp1/vsp1_drv.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/media/platform/vsp1/vsp1_drv.c +8 -3
@@ -562,7 +562,12 @@ int vsp1_device_get(struct vsp1_device *vsp1)int ret; ret =pm_runtime_get_sync (vsp1->dev); -return ret <0 ? ret :0 ; +if (ret <0 ) { +pm_runtime_put_noidle (vsp1->dev); +return ret; + } + +return 0 ; }/*
@@ -845,12 +850,12 @@ static int vsp1_probe(struct platform_device *pdev)/* Configure device parameters based on the version register. */ pm_runtime_enable (&pdev->dev); - ret =pm_runtime_get_sync (&pdev->dev); + ret =vsp1_device_get (vsp1);if (ret <0 ) goto done; vsp1->version =vsp1_read (vsp1,VI6_IP_VERSION ); -pm_runtime_put_sync (&pdev->dev); +vsp1_device_put (vsp1);for (i =0 ; i <ARRAY_SIZE (vsp1_device_infos); ++i) { if ((vsp1->version & VI6_IP_VERSION_MODEL_MASK) ==
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 541/633 media: platform: s3c-camif: Fix runtime PM imbalance on error
In reply to Greg Kroah-HartmanFrom: Dinghao Liu <[email protected]>
[ Upstream commit dafa3605fe60d5a61239d670919b2a36e712481e ]
pm_runtime_get_sync() increments the runtime PM usage counter even when it returns an error code. Thus a pairing decrement is needed on the error handling path to keep the counter balanced.
Also, call pm_runtime_disable() when pm_runtime_get_sync() returns an error code.
--- drivers/media/platform/s3c-camif/camif-core.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/media/platform/s3c-camif/camif-core.c +2 -3
@@ -464,7 +464,7 @@ static int s3c_camif_probe(struct platform_device *pdev) ret =camif_media_dev_init (camif);if (ret <0 ) - goto err_alloc; + goto err_pm; ret =camif_register_sensor (camif);if (ret <0 )
@@ -498,10 +498,9 @@ static int s3c_camif_probe(struct platform_device *pdev)media_device_unregister (&camif->media_dev);media_device_cleanup (&camif->media_dev);camif_unregister_media_entities (camif); -err_alloc: +err_pm:pm_runtime_put (dev);pm_runtime_disable (dev); -err_pm:camif_clk_put (camif); err_clk:s3c_camif_unregister_subdev (camif);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 542/633 media: platform: sti: hva: Fix runtime PM imbalance on error
In reply to Greg Kroah-HartmanFrom: Dinghao Liu <[email protected]>
[ Upstream commit d912a1d9e9afe69c6066c1ceb6bfc09063074075 ]
pm_runtime_get_sync() increments the runtime PM usage counter even when it returns an error code. Thus a pairing decrement is needed on the error handling path to keep the counter balanced.
--- drivers/media/platform/sti/hva/hva-hw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/sti/hva/hva-hw.c +1 -1
@@ -389,7 +389,7 @@ int hva_hw_probe(struct platform_device *pdev, struct hva_dev *hva) ret =pm_runtime_get_sync (dev);if (ret <0 ) {dev_err (dev,"%s failed to set PM\n" ,HVA_PREFIX ); - goto err_clk; + goto err_pm; }/* check IP hardware version */
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 543/633 media: bdisp: Fix runtime PM imbalance on error
In reply to Greg Kroah-HartmanFrom: Dinghao Liu <[email protected]>
[ Upstream commit dbd2f2dc025f9be8ae063e4f270099677238f620 ]
pm_runtime_get_sync() increments the runtime PM usage counter even when it returns an error code. Thus a pairing decrement is needed on the error handling path to keep the counter balanced.
--- drivers/media/platform/sti/bdisp/bdisp-v4l2.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/media/platform/sti/bdisp/bdisp-v4l2.c +1 -2
@@ -1371,7 +1371,7 @@ static int bdisp_probe(struct platform_device *pdev) ret =pm_runtime_get_sync (dev);if (ret <0 ) {dev_err (dev,"failed to set PM\n" ); - goto err_dbg; + goto err_pm; }/* Filters */
@@ -1399,7 +1399,6 @@ static int bdisp_probe(struct platform_device *pdev)bdisp_hw_free_filters (bdisp->dev); err_pm:pm_runtime_put (dev); -err_dbg:bdisp_debugfs_remove (bdisp); err_v4l2:v4l2_device_unregister (&bdisp->v4l2_dev);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 544/633 media: media/pci: prevent memory leak in bttv_probe
In reply to Greg Kroah-HartmanFrom: Xiaolong Huang <[email protected]>
[ Upstream commit 7b817585b730665126b45df5508dd69526448bc8 ]
In bttv_probe if some functions such as pci_enable_device, pci_set_dma_mask and request_mem_region fails the allocated
memory for btv should be released.
--- drivers/media/pci/bt8xx/bttv-driver.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/media/pci/bt8xx/bttv-driver.c +10 -3
@@ -4013,11 +4013,13 @@ static int bttv_probe(struct pci_dev *dev, const struct pci_device_id *pci_id) btv->id = dev->device;if (pci_enable_device (dev)) {pr_warn ("%d: Can't enable device\n" , btv->c.nr); -return -EIO ; + result = -EIO ; + goto free_mem; }if (pci_set_dma_mask (dev,DMA_BIT_MASK (32 ))) {pr_warn ("%d: No suitable DMA available\n" , btv->c.nr); -return -EIO ; + result = -EIO ; + goto free_mem; } if (!request_mem_region(pci_resource_start(dev,0), pci_resource_len(dev,0),
@@ -4025,7 +4027,8 @@ static int bttv_probe(struct pci_dev *dev, const struct pci_device_id *pci_id)pr_warn ("%d: can't request iomem (0x%llx)\n" , btv->c.nr, (unsigned long long )pci_resource_start (dev,0 )); -return -EBUSY ; + result = -EBUSY ; + goto free_mem; }pci_set_master (dev);pci_set_command (dev);
@@ -4211,6 +4214,10 @@ static int bttv_probe(struct pci_dev *dev, const struct pci_device_id *pci_id)release_mem_region (pci_resource_start (btv->c.pci,0 ),pci_resource_len (btv->c.pci,0 ));pci_disable_device (btv->c.pci); + +free_mem: + bttvs[btv->c.nr] =NULL ; +kfree (btv);return result; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 545/633 x86/mce: Annotate mce_rd/wrmsrl() with noinstr
In reply to Greg Kroah-HartmanFrom: Borislav Petkov <[email protected]>
[ Upstream commit e100777016fdf6ec3a9d7c1773b15a2b5eca6c55 ]
They do get called from the #MC handler which is already marked "noinstr".
Commit
e2def7d49d08 ("x86/mce: Make mce_rdmsrl() panic on an inaccessible MSR")
already got rid of the instrumentation in the MSR accessors, fix the annotation now too, in order to get rid of:
vmlinux.o: warning: objtool: do_machine_check()+0x4a: call to mce_rdmsrl() leaves .noinstr.text section
--- arch/x86/kernel/cpu/mce/core.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-)
arch/x86/kernel/cpu/mce/core.c +21 -6
@@ -371,16 +371,25 @@ static int msr_to_offset(u32 msr) }/* MSR access wrappers used for error injection */ -static u64 mce_rdmsrl (u32 msr) +static noinstr u64 mce_rdmsrl(u32 msr) {u64 v;if (__this_cpu_read (injectm.finished)) { -int offset =msr_to_offset (msr); +int offset; +u64 ret; +instrumentation_begin (); + + offset =msr_to_offset (msr);if (offset <0 ) -return 0 ; -return *(u64 *)((char *)this_cpu_ptr (&injectm) + offset); + ret =0 ; +else + ret = *(u64 *)((char *)this_cpu_ptr (&injectm) + offset); + +instrumentation_end (); + +return ret; }if (rdmsrl_safe (msr, &v)) {
@@ -396,13 +405,19 @@ static u64 mce_rdmsrl(u32 msr)return v; } -static void mce_wrmsrl (u32 msr,u64 v) +static noinstr void mce_wrmsrl(u32 msr, u64 v) {if (__this_cpu_read (injectm.finished)) { -int offset =msr_to_offset (msr); +int offset; +instrumentation_begin (); + + offset =msr_to_offset (msr);if (offset >=0 ) *(u64 *)((char *)this_cpu_ptr (&injectm) + offset) = v; + +instrumentation_end (); +return ; }wrmsrl (msr, v);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 546/633 crypto: hisilicon - fixed memory allocation error
In reply to Greg Kroah-HartmanFrom: Longfang Liu <[email protected]>
[ Upstream commit 24efcec2919afa7d56f848c83a605b46c8042a53 ]
1. Fix the bug of 'mac' memory leak as allocating 'pbuf' failing.
2. Fix the bug of 'qps' leak as allocating 'qp_ctx' failing.
--- drivers/crypto/hisilicon/sec2/sec_crypto.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
drivers/crypto/hisilicon/sec2/sec_crypto.c +12 -4
@@ -332,11 +332,14 @@ static int sec_alg_resource_alloc(struct sec_ctx *ctx, ret =sec_alloc_pbuf_resource (dev, res);if (ret) {dev_err (dev,"fail to alloc pbuf dma resource!\n" ); - goto alloc_fail; + goto alloc_pbuf_fail; } }return 0 ; +alloc_pbuf_fail: +if (ctx->alg_type ==SEC_AEAD ) +sec_free_mac_resource (dev, qp_ctx->res); alloc_fail:sec_free_civ_resource (dev, res);
@@ -447,8 +450,10 @@ static int sec_ctx_base_init(struct sec_ctx *ctx) ctx->fake_req_limit =QM_Q_DEPTH >>1 ; ctx->qp_ctx =kcalloc (sec->ctx_q_num,sizeof (struct sec_qp_ctx ),GFP_KERNEL ); -if (!ctx->qp_ctx) -return -ENOMEM ; +if (!ctx->qp_ctx) { + ret = -ENOMEM ; + goto err_destroy_qps; + }for (i =0 ; i < sec->ctx_q_num; i++) { ret =sec_create_qp_ctx (&sec->qm, ctx, i,0 );
@@ -457,12 +462,15 @@ static int sec_ctx_base_init(struct sec_ctx *ctx) }return 0 ; + err_sec_release_qp_ctx:for (i = i -1 ; i >=0 ; i--)sec_release_qp_ctx (ctx, &ctx->qp_ctx[i]); -sec_destroy_qps (ctx->qps, sec->ctx_q_num);kfree (ctx->qp_ctx); +err_destroy_qps: +sec_destroy_qps (ctx->qps, sec->ctx_q_num); +return ret; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 547/633 spi: fsi: Fix clock running too fast
In reply to Greg Kroah-HartmanFrom: Brad Bishop <[email protected]>
[ Upstream commit 0b546bbe9474ff23e6843916ad6d567f703b2396 ]
Use a clock divider tuned to a 200MHz FSI bus frequency (the maximum). Use of the previous divider at 200MHz results in corrupt data from endpoint devices. Ideally the clock divider would be calculated from the FSI clock, but that would require some significant work on the FSI driver. With FSI frequencies slower than 200MHz, the SPI clock will simply run slower, but safely.
--- drivers/spi/spi-fsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spi-fsi.c +1 -1
@@ -403,7 +403,7 @@ static int fsi_spi_transfer_init(struct fsi_spi *ctx)u64 status =0ULL ;u64 wanted_clock_cfg =SPI_FSI_CLOCK_CFG_ECC_DISABLE |SPI_FSI_CLOCK_CFG_SCK_NO_DEL | -FIELD_PREP (SPI_FSI_CLOCK_CFG_SCK_DIV ,4 ); +FIELD_PREP (SPI_FSI_CLOCK_CFG_SCK_DIV ,19 ); end = jiffies +msecs_to_jiffies (SPI_FSI_INIT_TIMEOUT_MS ); do {
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 548/633 x86/mce: Make mce_rdmsrl() panic on an inaccessible MSR
In reply to Greg Kroah-HartmanFrom: Borislav Petkov <[email protected]>
[ Upstream commit e2def7d49d0812ea40a224161b2001b2e815dce2 ]
If an exception needs to be handled while reading an MSR - which is in most of the cases caused by a #GP on a non-existent MSR - then this is most likely the incarnation of a BIOS or a hardware bug. Such bug violates the architectural guarantee that MCA banks are present with all MSRs belonging to them.
The proper fix belongs in the hardware/firmware - not in the kernel.
Handling an #MC exception which is raised while an NMI is being handled would cause the nasty NMI nesting issue because of the shortcoming of IRET of reenabling NMIs when executed. And the machine is in an #MC context already so <Deity> be at its side.
Tracing MSR accesses while in #MC is another no-no due to tracing being inherently a bad idea in atomic context:
vmlinux.o: warning: objtool: do_machine_check()+0x4a: call to mce_rdmsrl() leaves .noinstr.text section
so remove all that "additional" functionality from mce_rdmsrl() and provide it with a special exception handler which panics the machine when that MSR is not accessible.
The exception handler prints a human-readable message explaining what the panic reason is but, what is more, it panics while in the #GP handler and latter won't have executed an IRET, thus opening the NMI nesting issue in the case when the #MC has happened while handling an NMI. (#MC itself won't be reenabled until MCG_STATUS hasn't been cleared).
--- arch/x86/kernel/cpu/mce/core.c | 72 +++++++++++++++++++++++++----- arch/x86/kernel/cpu/mce/internal.h | 10 +++++ 2 files changed, 70 insertions(+), 12 deletions(-)
arch/x86/kernel/cpu/mce/core.c +60 -12
@@ -370,10 +370,28 @@ static int msr_to_offset(u32 msr)return -1 ; } +__visible bool ex_handler_rdmsr_fault(const struct exception_table_entry *fixup, +struct pt_regs *regs,int trapnr, +unsigned long error_code, +unsigned long fault_addr) +{ +pr_emerg ("MSR access error: RDMSR from 0x%x at rIP: 0x%lx (%pS)\n" , + (unsigned int )regs->cx, regs->ip, (void *)regs->ip); + +show_stack_regs (regs); + +panic ("MCA architectural violation!\n" ); + +while (true) +cpu_relax (); + +return true; +} +/* MSR access wrappers used for error injection */ static noinstr u64 mce_rdmsrl(u32 msr) { -u64 v; +DECLARE_ARGS (val, low, high);if (__this_cpu_read (injectm.finished)) {int offset;
@@ -392,21 +410,43 @@ static noinstr u64 mce_rdmsrl(u32 msr)return ret; } -if (rdmsrl_safe (msr, &v)) { -WARN_ONCE (1 ,"mce: Unable to read MSR 0x%x!\n" , msr); -/* -* Return zero in case the access faulted. This should -* not happen normally but can happen if the CPU does -* something weird, or if the code is buggy. -*/ - v =0 ; - } +/* +* RDMSR on MCA MSRs should not fault. If they do, this is very much an +* architectural violation and needs to be reported to hw vendor. Panic +* the box to not allow any further progress. +*/ + asm volatile("1: rdmsr\n" + "2:\n" + _ASM_EXTABLE_HANDLE(1b, 2b, ex_handler_rdmsr_fault) + : EAX_EDX_RET(val, low, high) : "c" (msr)); -return v; + +return EAX_EDX_VAL (val, low, high); +} + +__visible bool ex_handler_wrmsr_fault(const struct exception_table_entry *fixup, +struct pt_regs *regs,int trapnr, +unsigned long error_code, +unsigned long fault_addr) +{ +pr_emerg ("MSR access error: WRMSR to 0x%x (tried to write 0x%08x%08x) at rIP: 0x%lx (%pS)\n" , + (unsigned int )regs->cx, (unsigned int )regs->dx, (unsigned int )regs->ax, + regs->ip, (void *)regs->ip); + +show_stack_regs (regs); + +panic ("MCA architectural violation!\n" ); + +while (true) +cpu_relax (); + +return true; } static noinstr void mce_wrmsrl(u32 msr, u64 v) { +u32 low, high; +if (__this_cpu_read (injectm.finished)) {int offset;
@@ -420,7 +460,15 @@ static noinstr void mce_wrmsrl(u32 msr, u64 v)return ; } -wrmsrl (msr, v); + + low = (u32 )v; + high = (u32)(v >>32 ); + +/* See comment in mce_rdmsrl() */ + asm volatile("1: wrmsr\n" + "2:\n" + _ASM_EXTABLE_HANDLE(1b, 2b, ex_handler_wrmsr_fault) + : : "c" (msr), "a"(low), "d" (high) : "memory"); }/*
arch/x86/kernel/cpu/mce/internal.h +10 -0
@@ -185,4 +185,14 @@ extern bool amd_filter_mce(struct mce *m);static inline bool amd_filter_mce (struct mce *m) {return false; };#endif +__visible bool ex_handler_rdmsr_fault(const struct exception_table_entry *fixup, +struct pt_regs *regs,int trapnr, +unsigned long error_code, +unsigned long fault_addr); + +__visible bool ex_handler_wrmsr_fault(const struct exception_table_entry *fixup, +struct pt_regs *regs,int trapnr, +unsigned long error_code, +unsigned long fault_addr); +#endif /* __X86_MCE_INTERNAL_H__ */
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 549/633 media: uvcvideo: Ensure all probed info is returned to v4l2
In reply to Greg Kroah-HartmanFrom: Adam Goode <[email protected]>
[ Upstream commit 8a652a17e3c005dcdae31b6c8fdf14382a29cbbe ]
bFrameIndex and bFormatIndex can be negotiated by the camera during probing, resulting in the camera choosing a different format than expected. v4l2 can already accommodate such changes, but the code was not updating the proper fields.
Without such a change, v4l2 would potentially interpret the payload incorrectly, causing corrupted output. This was happening on the Elgato HD60 S+, which currently always renegotiates to format 1.
As an aside, the Elgato firmware is buggy and should not be renegotating, but it is still a valid thing for the camera to do. Both macOS and Windows will properly probe and read uncorrupted images from this camera.
With this change, both qv4l2 and chromium can now read uncorrupted video from the Elgato HD60 S+.
[Add blank lines, remove periods at the of messages]
--- drivers/media/usb/uvc/uvc_v4l2.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)
drivers/media/usb/uvc/uvc_v4l2.c +30 -0
@@ -247,11 +247,41 @@ static int uvc_v4l2_try_format(struct uvc_streaming *stream,if (ret <0 ) goto done; +/* After the probe, update fmt with the values returned from +* negotiation with the device. +*/ +for (i =0 ; i < stream->nformats; ++i) { +if (probe->bFormatIndex == stream->format[i].index) { + format = &stream->format[i]; +break ; + } + } + +if (i == stream->nformats) { +uvc_trace (UVC_TRACE_FORMAT ,"Unknown bFormatIndex %u\n" , + probe->bFormatIndex); +return -EINVAL ; + } + +for (i =0 ; i < format->nframes; ++i) { +if (probe->bFrameIndex == format->frame[i].bFrameIndex) { + frame = &format->frame[i]; +break ; + } + } + +if (i == format->nframes) { +uvc_trace (UVC_TRACE_FORMAT ,"Unknown bFrameIndex %u\n" , + probe->bFrameIndex); +return -EINVAL ; + } + fmt->fmt.pix.width = frame->wWidth; fmt->fmt.pix.height = frame->wHeight; fmt->fmt.pix.field =V4L2_FIELD_NONE ; fmt->fmt.pix.bytesperline =uvc_v4l2_get_bytesperline (format, frame); fmt->fmt.pix.sizeimage = probe->dwMaxVideoFrameSize; + fmt->fmt.pix.pixelformat = format->fcc; fmt->fmt.pix.colorspace = format->colorspace;if (uvc_format !=NULL )
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 550/633 mmc: sdio: Check for CISTPL_VERS_1 buffer size
In reply to Greg Kroah-HartmanFrom: Pali Rohár <[email protected]>
[ Upstream commit 8ebe2607965d3e2dc02029e8c7dd35fbe508ffd0 ]
Before parsing CISTPL_VERS_1 structure check that its size is at least two bytes to prevent buffer overflow.
--- drivers/mmc/core/sdio_cis.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/mmc/core/sdio_cis.c +3 -0
@@ -26,6 +26,9 @@ static int cistpl_vers_1(struct mmc_card *card, struct sdio_func *func,unsigned i, nr_strings;char **buffer, *string; +if (size <2 ) +return 0 ; +/* Find all null-terminated (including zero length) strings in the TPLLV1_INFO field. Trailing garbage is ignored. */ buf +=2 ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 551/633 media: saa7134: avoid a shift overflow
In reply to Greg Kroah-HartmanFrom: Mauro Carvalho Chehab <[email protected]>
[ Upstream commit 15a36aae1ec1c1f17149b6113b92631791830740 ]
As reported by smatch:
drivers/media/pci/saa7134//saa7134-tvaudio.c:686 saa_dsp_writel() warn: should 'reg << 2' be a 64 bit type?
On a 64-bits Kernel, the shift might be bigger than 32 bits.
In real, this should never happen, but let's shut up the warning.
--- drivers/media/pci/saa7134/saa7134-tvaudio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/media/pci/saa7134/saa7134-tvaudio.c +2 -1
@@ -683,7 +683,8 @@ int saa_dsp_writel(struct saa7134_dev *dev, int reg, u32 value) {int err; -audio_dbg (2 ,"dsp write reg 0x%x = 0x%06x\n" , reg <<2 , value); +audio_dbg (2 ,"dsp write reg 0x%x = 0x%06x\n" , + (reg <<2 ) &0xffffffff , value); err =saa_dsp_wait_bit (dev,SAA7135_DSP_RWSTATE_WRR );if (err <0 )return err;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 552/633 media: atomisp: fix memleak in ia_css_stream_create
In reply to Greg Kroah-HartmanFrom: Dinghao Liu <[email protected]>
[ Upstream commit c1bca5b5ced0cbd779d56f60cdbc9f5e6f6449fe ]
When aspect_ratio_crop_init() fails, curr_stream needs to be freed just like what we've done in the following error paths. However, current code is returning directly and ends up leaking memory.
--- drivers/staging/media/atomisp/pci/sh_css.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/atomisp/pci/sh_css.c +1 -1
@@ -9521,7 +9521,7 @@ ia_css_stream_create(const struct ia_css_stream_config *stream_config,if (err) {IA_CSS_LEAVE_ERR (err); -return err; + goto ERR; }#endif for (i =0 ; i < num_pipes; i++)
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 553/633 media: venus: fixes for list corruption
In reply to Greg Kroah-HartmanFrom: Vikash Garodia <[email protected]>
[ Upstream commit e1c69c4eef61ffe295b747992c6fd849e6cd747d ]
There are few list handling issues while adding and deleting node in the registered buf list in the driver.
1. list addition - buffer added into the list during buf_init while not deleted during cleanup.
2. list deletion - In capture streamoff, the list was reinitialized. As a result, if any node was present in the list, it would lead to issue while cleaning up that node during buf_cleanup.
Corresponding call traces below:
[ 165.751014] Call trace: [ 165.753541] __list_add_valid+0x58/0x88 [ 165.757532] venus_helper_vb2_buf_init+0x74/0xa8 [venus_core] [ 165.763450] vdec_buf_init+0x34/0xb4 [venus_dec] [ 165.768271] __buf_prepare+0x598/0x8a0 [videobuf2_common] [ 165.773820] vb2_core_qbuf+0xb4/0x334 [videobuf2_common] [ 165.779298] vb2_qbuf+0x78/0xb8 [videobuf2_v4l2] [ 165.784053] v4l2_m2m_qbuf+0x80/0xf8 [v4l2_mem2mem] [ 165.789067] v4l2_m2m_ioctl_qbuf+0x2c/0x38 [v4l2_mem2mem] [ 165.794624] v4l_qbuf+0x48/0x58
[ 1797.556001] Call trace: [ 1797.558516] __list_del_entry_valid+0x88/0x9c [ 1797.562989] vdec_buf_cleanup+0x54/0x228 [venus_dec] [ 1797.568088] __buf_prepare+0x270/0x8a0 [videobuf2_common] [ 1797.573625] vb2_core_qbuf+0xb4/0x338 [videobuf2_common] [ 1797.579082] vb2_qbuf+0x78/0xb8 [videobuf2_v4l2] [ 1797.583830] v4l2_m2m_qbuf+0x80/0xf8 [v4l2_mem2mem] [ 1797.588843] v4l2_m2m_ioctl_qbuf+0x2c/0x38 [v4l2_mem2mem] [ 1797.594389] v4l_qbuf+0x48/0x58
--- drivers/media/platform/qcom/venus/vdec.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/media/platform/qcom/venus/vdec.c +8 -2
@@ -1088,8 +1088,6 @@ static int vdec_stop_capture(struct venus_inst *inst)break ; } -INIT_LIST_HEAD (&inst->registeredbufs); -return ret; }
@@ -1189,6 +1187,14 @@ static int vdec_buf_init(struct vb2_buffer *vb)static void vdec_buf_cleanup (struct vb2_buffer *vb) {struct venus_inst *inst =vb2_get_drv_priv (vb->vb2_queue); +struct vb2_v4l2_buffer *vbuf =to_vb2_v4l2_buffer (vb); +struct venus_buffer *buf =to_venus_buffer (vbuf); + +mutex_lock (&inst->lock); +if (vb->type ==V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE ) +if (!list_empty (&inst->registeredbufs)) +list_del_init (&buf->reg_list); +mutex_unlock (&inst->lock); inst->buf_count--;if (!inst->buf_count)
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 554/633 fs: dlm: fix configfs memory leak
In reply to Greg Kroah-HartmanFrom: Alexander Aring <[email protected]>
[ Upstream commit 3d2825c8c6105b0f36f3ff72760799fa2e71420e ]
This patch fixes the following memory detected by kmemleak and umount gfs2 filesystem which removed the last lockspace:
unreferenced object 0xffff9264f482f600 (size 192):
comm "dlm_controld", pid 325, jiffies 4294690276 (age 48.136s) hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 6e 6f 64 65 73 00 00 00 ........nodes...
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<00000000060481d7>] make_space+0x41/0x130
[<000000008d905d46>] configfs_mkdir+0x1a2/0x5f0
[<00000000729502cf>] vfs_mkdir+0x155/0x210
[<000000000369bcf1>] do_mkdirat+0x6d/0x110
[<00000000cc478a33>] do_syscall_64+0x33/0x40
[<00000000ce9ccf01>] entry_SYSCALL_64_after_hwframe+0x44/0xa9The patch just remembers the "nodes" entry pointer in space as I think it's created as subdirectory when parent "spaces" is created. In function drop_space() we will lost the pointer reference to nds because configfs_remove_default_groups(). However as this subdirectory is always available when "spaces" exists it will just be freed when "spaces" will be freed.
--- fs/dlm/config.c | 3 +++ 1 file changed, 3 insertions(+)
fs/dlm/config.c +3 -0
@@ -216,6 +216,7 @@ struct dlm_space {struct list_head members;struct mutex members_lock;int members_count; +struct dlm_nodes *nds; };struct dlm_comms {
@@ -424,6 +425,7 @@ static struct config_group *make_space(struct config_group *g, const char *name)INIT_LIST_HEAD (&sp->members);mutex_init (&sp->members_lock); sp->members_count =0 ; + sp->nds = nds;return &sp->group; fail:
@@ -445,6 +447,7 @@ static void drop_space(struct config_group *g, struct config_item *i)static void release_space (struct config_item *i) {struct dlm_space *sp =config_item_to_space (i); +kfree (sp->nds);kfree (sp); }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 555/633 media: venus: core: Fix error handling in probe
In reply to Greg Kroah-HartmanFrom: Rajendra Nayak <[email protected]>
[ Upstream commit 98cd831088c64aa8fe7e1d2a8bb94b6faba0462b ]
Post a successful pm_ops->core_get, an error in probe should exit by doing a pm_ops->core_put which seems to be missing. So fix it.
--- drivers/media/platform/qcom/venus/core.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
drivers/media/platform/qcom/venus/core.c +10 -5
@@ -224,13 +224,15 @@ static int venus_probe(struct platform_device *pdev) ret =dma_set_mask_and_coherent (dev, core->res->dma_mask);if (ret) -return ret; + goto err_core_put;if (!dev->dma_parms) { dev->dma_parms =devm_kzalloc (dev,sizeof (*dev->dma_parms),GFP_KERNEL ); -if (!dev->dma_parms) -return -ENOMEM ; +if (!dev->dma_parms) { + ret = -ENOMEM ; + goto err_core_put; + } }dma_set_max_seg_size (dev,DMA_BIT_MASK (32 ));
@@ -242,11 +244,11 @@ static int venus_probe(struct platform_device *pdev)IRQF_TRIGGER_HIGH |IRQF_ONESHOT , "venus", core);if (ret) -return ret; + goto err_core_put; ret =hfi_create (core, &venus_core_ops);if (ret) -return ret; + goto err_core_put;pm_runtime_enable (dev);
@@ -302,6 +304,9 @@ static int venus_probe(struct platform_device *pdev)pm_runtime_set_suspended (dev);pm_runtime_disable (dev);hfi_destroy (core); +err_core_put: +if (core->pm_ops->core_put) + core->pm_ops->core_put (dev);return ret; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 556/633 media: venus: core: Fix runtime PM imbalance in venus_probe
In reply to Greg Kroah-HartmanFrom: Dinghao Liu <[email protected]>
[ Upstream commit bbe516e976fce538db96bd2b7287df942faa14a3 ]
pm_runtime_get_sync() increments the runtime PM usage counter even when it returns an error code. Thus a pairing decrement is needed on the error handling path to keep the counter balanced. For other error paths after this call, things are the same.
Fix this by adding pm_runtime_put_noidle() after 'err_runtime_disable' label. But in this case, the error path after pm_runtime_put_sync() will decrease PM usage counter twice. Thus add an extra pm_runtime_get_noresume() in this path to balance PM counter.
--- drivers/media/platform/qcom/venus/core.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/media/platform/qcom/venus/core.c +4 -1
@@ -289,8 +289,10 @@ static int venus_probe(struct platform_device *pdev) goto err_core_deinit; ret =pm_runtime_put_sync (dev); -if (ret) +if (ret) { +pm_runtime_get_noresume (dev); goto err_dev_unregister; + }return 0 ;
@@ -301,6 +303,7 @@ static int venus_probe(struct platform_device *pdev) err_venus_shutdown:venus_shutdown (core); err_runtime_disable: +pm_runtime_put_noidle (dev);pm_runtime_set_suspended (dev);pm_runtime_disable (dev);hfi_destroy (core);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 557/633 ntfs: add check for mft record size in superblock
In reply to Greg Kroah-HartmanFrom: Rustam Kovhaev <[email protected]>
[ Upstream commit 4f8c94022f0bc3babd0a124c0a7dcdd7547bd94e ]
Number of bytes allocated for mft record should be equal to the mft record size stored in ntfs superblock as reported by syzbot, userspace might trigger out-of-bounds read by dereferencing ctx->attr in ntfs_attr_find()
--- fs/ntfs/inode.c | 6 ++++++ 1 file changed, 6 insertions(+)
fs/ntfs/inode.c +6 -0
@@ -1809,6 +1809,12 @@ int ntfs_read_inode_mount(struct inode *vi)brelse (bh); } +if (le32_to_cpu (m->bytes_allocated) != vol->mft_record_size) { +ntfs_error (sb,"Incorrect mft record size %u in superblock, should be %u." , +le32_to_cpu (m->bytes_allocated), vol->mft_record_size); + goto err_out; + } +/* Apply the mst fixups. */ if (post_read_mst_fixup ((NTFS_RECORD *)m, vol->mft_record_size)) {/* FIXME: Try to use the $MFTMirr now. */
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 558/633 ip_gre: set dev->hard_header_len and dev->needed_headroom properly
In reply to Greg Kroah-HartmanFrom: Cong Wang <[email protected]>
[ Upstream commit fdafed459998e2be0e877e6189b24cb7a0183224 ]
GRE tunnel has its own header_ops, ipgre_header_ops, and sets it conditionally. When it is set, it assumes the outer IP header is already created before ipgre_xmit().
This is not true when we send packets through a raw packet socket, where L2 headers are supposed to be constructed by user. Packet socket calls dev_validate_header() to validate the header. But GRE tunnel does not set dev->hard_header_len, so that check can be simply bypassed, therefore uninit memory could be passed down to ipgre_xmit(). Similar for dev->needed_headroom.
dev->hard_header_len is supposed to be the length of the header created by dev->header_ops->create(), so it should be used whenever header_ops is set, and dev->needed_headroom should be used when it is not set.
--- net/ipv4/ip_gre.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
net/ipv4/ip_gre.c +11 -4
@@ -625,9 +625,7 @@ static netdev_tx_t ipgre_xmit(struct sk_buff *skb, }if (dev->header_ops) { -/* Need space for new headers */ -if (skb_cow_head (skb, dev->needed_headroom - - (tunnel->hlen +sizeof (struct iphdr )))) +if (skb_cow_head (skb,0 )) goto free_skb; tnl_params = (const struct iphdr *)skb->data;
@@ -748,7 +746,11 @@ static void ipgre_link_update(struct net_device *dev, bool set_mtu) len = tunnel->tun_hlen - len; tunnel->hlen = tunnel->hlen + len; - dev->needed_headroom = dev->needed_headroom + len; +if (dev->header_ops) + dev->hard_header_len += len; +else + dev->needed_headroom += len; +if (set_mtu) dev->mtu =max_t (int, dev->mtu - len,68 );
@@ -944,6 +946,7 @@ static void __gre_tunnel_init(struct net_device *dev) tunnel->parms.iph.protocol =IPPROTO_GRE ; tunnel->hlen = tunnel->tun_hlen + tunnel->encap_hlen; + dev->needed_headroom = tunnel->hlen +sizeof (tunnel->parms.iph); dev->features |=GRE_FEATURES ; dev->hw_features |=GRE_FEATURES ;
@@ -987,10 +990,14 @@ static int ipgre_tunnel_init(struct net_device *dev)return -EINVAL ; dev->flags =IFF_BROADCAST ; dev->header_ops = &ipgre_header_ops; + dev->hard_header_len = tunnel->hlen +sizeof (*iph); + dev->needed_headroom = 0; }#endif }else if (!tunnel->collect_md) { dev->header_ops = &ipgre_header_ops; + dev->hard_header_len = tunnel->hlen +sizeof (*iph); + dev->needed_headroom =0 ; }return ip_tunnel_init (dev);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 559/633 mac80211: handle lack of sband->bitrates in rates
In reply to Greg Kroah-HartmanFrom: Thomas Pedersen <[email protected]>
[ Upstream commit 8b783d104e7f40684333d2ec155fac39219beb2f ]
Even though a driver or mac80211 shouldn't produce a legacy bitrate if sband->bitrates doesn't exist, don't crash if that is the case either.
This fixes a kernel panic if station dump is run before last_rate can be updated with a data frame when sband->bitrates is missing (eg. in S1G bands).
--- net/mac80211/cfg.c | 3 ++- net/mac80211/sta_info.c | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-)
net/mac80211/cfg.c +2 -1
@@ -709,7 +709,8 @@ void sta_set_rate_info_tx(struct sta_info *sta,u16 brate; sband =ieee80211_get_sband (sta->sdata); -if (sband) { +WARN_ON_ONCE (sband && !sband->bitrates); +if (sband && sband->bitrates) { brate = sband->bitrates[rate->idx].bitrate; rinfo->legacy =DIV_ROUND_UP (brate,1 << shift); }
net/mac80211/sta_info.c +4 -0
@@ -2122,6 +2122,10 @@ static void sta_stats_decode_rate(struct ieee80211_local *local, u32 rate,int rate_idx =STA_STATS_GET (LEGACY_IDX , rate); sband = local->hw.wiphy->bands[band]; + +if (WARN_ON_ONCE (!sband->bitrates)) +break ; + brate = sband->bitrates[rate_idx].bitrate;if (rinfo->bw ==RATE_INFO_BW_5 ) shift =2 ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 560/633 staging: wfx: fix handling of MMIC error
In reply to Greg Kroah-HartmanFrom: Jérôme Pouiller <[email protected]>
[ Upstream commit 8d350c14ee5eb62ecd40b0991248bfbce511954d ]
As expected, when the device detect a MMIC error, it returns a specific status. However, it also strip IV from the frame (don't ask me why).
So, with the current code, mac80211 detects a corrupted frame and it drops it before it handle the MMIC error. The expected behavior would be to detect MMIC error then to renegotiate the EAP session.
So, this patch correctly informs mac80211 that IV is not available. So, mac80211 correctly takes into account the MMIC error.
--- drivers/staging/wfx/data_rx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/wfx/data_rx.c +1 -1
@@ -80,7 +80,7 @@ void wfx_rx_cb(struct wfx_vif *wvif, goto drop;if (arg->status ==HIF_STATUS_RX_FAIL_MIC ) - hdr->flag |=RX_FLAG_MMIC_ERROR ; + hdr->flag |=RX_FLAG_MMIC_ERROR |RX_FLAG_IV_STRIPPED ;else if (arg->status) goto drop;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 561/633 libbpf: Close map fd if init map slots failed
In reply to Greg Kroah-HartmanFrom: Hangbin Liu <[email protected]>
[ Upstream commit a0f2b7acb4b1d29127ff99c714233b973afd1411 ]
Previously we forgot to close the map fd if bpf_map_update_elem() failed during map slot init, which will leak map fd.
Let's move map slot initialization to new function init_map_slots() to simplify the code. And close the map fd if init slot failed.
--- tools/lib/bpf/libbpf.c | 55 ++++++++++++++++++++++++++---------------- 1 file changed, 34 insertions(+), 21 deletions(-)
tools/lib/bpf/libbpf.c +34 -21
@@ -3677,6 +3677,36 @@ static int bpf_object__create_map(struct bpf_object *obj, struct bpf_map *map)return 0 ; } +static int init_map_slots (struct bpf_map *map) +{ +const struct bpf_map *targ_map; +unsigned int i; +int fd, err; + +for (i =0 ; i < map->init_slots_sz; i++) { +if (!map->init_slots[i]) +continue ; + + targ_map = map->init_slots[i]; + fd =bpf_map__fd (targ_map); + err =bpf_map_update_elem (map->fd, &i, &fd,0 ); +if (err) { + err = -errno; +pr_warn ("map '%s': failed to initialize slot [%d] to map '%s' fd=%d: %d\n" , + map->name, i, targ_map->name, + fd, err); +return err; + } +pr_debug ("map '%s': slot [%d] set to map '%s' fd=%d\n" , + map->name, i, targ_map->name, fd); + } + +zfree (&map->init_slots); + map->init_slots_sz =0 ; + +return 0 ; +} +static int bpf_object__create_maps (struct bpf_object *obj) {
@@ -3719,28 +3749,11 @@ bpf_object__create_maps(struct bpf_object *obj) }if (map->init_slots_sz) { -for (j =0 ; j < map->init_slots_sz; j++) { -const struct bpf_map *targ_map; -int fd; - -if (!map->init_slots[j]) -continue ; - - targ_map = map->init_slots[j]; - fd =bpf_map__fd (targ_map); - err =bpf_map_update_elem (map->fd, &j, &fd,0 ); -if (err) { - err = -errno; -pr_warn ("map '%s': failed to initialize slot [%d] to map '%s' fd=%d: %d\n" , - map->name, j, targ_map->name, - fd, err); - goto err_out; - } -pr_debug ("map '%s': slot [%d] set to map '%s' fd=%d\n" , - map->name, j, targ_map->name, fd); + err =init_map_slots (map); +if (err <0 ) { +zclose (map->fd); + goto err_out; } -zfree (&map->init_slots); - map->init_slots_sz =0 ; }if (map->pin_path && !map->pinned) {
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 562/633 bpf: Use raw_spin_trylock() for pcpu_freelist_push/pop in NMI
In reply to Greg Kroah-HartmanFrom: Song Liu <[email protected]>
[ Upstream commit 39d8f0d1026a990604770a658708f5845f7dbec0 ]
Recent improvements in LOCKDEP highlighted a potential A-A deadlock with pcpu_freelist in NMI:
./tools/testing/selftests/bpf/test_progs -t stacktrace_build_id_nmi
[ 18.984807] ================================
[ 18.984807] WARNING: inconsistent lock state
[ 18.984808] 5.9.0-rc6-01771-g1466de1330e1 #2967 Not tainted
[ 18.984809] --------------------------------
[ 18.984809] inconsistent {INITIAL USE} -> {IN-NMI} usage.
[ 18.984810] test_progs/1990 [HC2[2]:SC0[0]:HE0:SE1] takes:
[ 18.984810] ffffe8ffffc219c0 (&head->lock){....}-{2:2}, at: __pcpu_freelist_pop+0xe3/0x180
[ 18.984813] {INITIAL USE} state was registered at:
[ 18.984814] lock_acquire+0x175/0x7c0
[ 18.984814] _raw_spin_lock+0x2c/0x40
[ 18.984815] __pcpu_freelist_pop+0xe3/0x180
[ 18.984815] pcpu_freelist_pop+0x31/0x40
[ 18.984816] htab_map_alloc+0xbbf/0xf40
[ 18.984816] __do_sys_bpf+0x5aa/0x3ed0
[ 18.984817] do_syscall_64+0x2d/0x40
[ 18.984818] entry_SYSCALL_64_after_hwframe+0x44/0xa9
[ 18.984818] irq event stamp: 12
[...]
[ 18.984822] other info that might help us debug this:
[ 18.984823] Possible unsafe locking scenario:
[ 18.984823]
[ 18.984824] CPU0
[ 18.984824] ----
[ 18.984824] lock(&head->lock);
[ 18.984826] <Interrupt>
[ 18.984826] lock(&head->lock);
[ 18.984827]
[ 18.984828] *** DEADLOCK ***
[ 18.984828]
[ 18.984829] 2 locks held by test_progs/1990:
[...]
[ 18.984838] <NMI>
[ 18.984838] dump_stack+0x9a/0xd0
[ 18.984839] lock_acquire+0x5c9/0x7c0
[ 18.984839] ? lock_release+0x6f0/0x6f0
[ 18.984840] ? __pcpu_freelist_pop+0xe3/0x180
[ 18.984840] _raw_spin_lock+0x2c/0x40
[ 18.984841] ? __pcpu_freelist_pop+0xe3/0x180
[ 18.984841] __pcpu_freelist_pop+0xe3/0x180
[ 18.984842] pcpu_freelist_pop+0x17/0x40
[ 18.984842] ? lock_release+0x6f0/0x6f0
[ 18.984843] __bpf_get_stackid+0x534/0xaf0
[ 18.984843] bpf_prog_1fd9e30e1438d3c5_oncpu+0x73/0x350
[ 18.984844] bpf_overflow_handler+0x12f/0x3f0This is because pcpu_freelist_head.lock is accessed in both NMI and non-NMI context. Fix this issue by using raw_spin_trylock() in NMI.
Since NMI interrupts non-NMI context, when NMI context tries to lock the raw_spinlock, non-NMI context of the same CPU may already have locked a lock and is blocked from unlocking the lock. For a system with N CPUs, there could be N NMIs at the same time, and they may block N non-NMI raw_spinlocks. This is tricky for pcpu_freelist_push(), where unlike _pop(), failing _push() means leaking memory. This issue is more likely to trigger in non-SMP system.
Fix this issue with an extra list, pcpu_freelist.extralist. The extralist is primarily used to take _push() when raw_spin_trylock() failed on all the per CPU lists. It should be empty most of the time. The following table summarizes the behavior of pcpu_freelist in NMI and non-NMI:
non-NMI pop(): use _lock(); check per CPU lists first;
if all per CPU lists are empty, check extralist; if extralist is empty, return NULL.
non-NMI push(): use _lock(); only push to per CPU lists.
NMI pop(): use _trylock(); check per CPU lists first;
if all per CPU lists are locked or empty, check extralist; if extralist is locked or empty, return NULL.
NMI push(): use _trylock(); check per CPU lists first;
if all per CPU lists are locked; try push to extralist; if extralist is also locked, keep trying on per CPU lists.
--- kernel/bpf/percpu_freelist.c | 101 +++++++++++++++++++++++++++++++++-- kernel/bpf/percpu_freelist.h | 1 + 2 files changed, 97 insertions(+), 5 deletions(-)
kernel/bpf/percpu_freelist.c +96 -5
@@ -17,6 +17,8 @@ int pcpu_freelist_init(struct pcpu_freelist *s)raw_spin_lock_init (&head->lock); head->first =NULL ; } +raw_spin_lock_init (&s->extralist.lock); + s->extralist.first =NULL ;return 0 ; }
@@ -40,12 +42,50 @@ static inline void ___pcpu_freelist_push(struct pcpu_freelist_head *head,raw_spin_unlock (&head->lock); } +static inline bool pcpu_freelist_try_push_extra (struct pcpu_freelist *s, +struct pcpu_freelist_node *node) +{ +if (!raw_spin_trylock (&s->extralist.lock)) +return false; + +pcpu_freelist_push_node (&s->extralist, node); +raw_spin_unlock (&s->extralist.lock); +return true; +} + +static inline void ___pcpu_freelist_push_nmi (struct pcpu_freelist *s, +struct pcpu_freelist_node *node) +{ +int cpu, orig_cpu; + + orig_cpu = cpu =raw_smp_processor_id (); +while (1 ) { +struct pcpu_freelist_head *head; + + head =per_cpu_ptr (s->freelist, cpu); +if (raw_spin_trylock (&head->lock)) { +pcpu_freelist_push_node (head, node); +raw_spin_unlock (&head->lock); +return ; + } + cpu =cpumask_next (cpu, cpu_possible_mask); +if (cpu >= nr_cpu_ids) + cpu =0 ; + +/* cannot lock any per cpu lock, try extralist */ +if (cpu == orig_cpu && +pcpu_freelist_try_push_extra (s, node)) +return ; + } +} +void __pcpu_freelist_push (struct pcpu_freelist *s,struct pcpu_freelist_node *node) { -struct pcpu_freelist_head *head =this_cpu_ptr (s->freelist); - -___pcpu_freelist_push (head, node); +if (in_nmi ()) +___pcpu_freelist_push_nmi (s, node); +else +___pcpu_freelist_push (this_cpu_ptr (s->freelist), node); } void pcpu_freelist_push(struct pcpu_freelist *s,
@@ -81,7 +121,7 @@ void pcpu_freelist_populate(struct pcpu_freelist *s, void *buf, u32 elem_size, } } -struct pcpu_freelist_node *__pcpu_freelist_pop (struct pcpu_freelist *s) +static struct pcpu_freelist_node *___pcpu_freelist_pop (struct pcpu_freelist *s) {struct pcpu_freelist_head *head;struct pcpu_freelist_node *node;
@@ -102,8 +142,59 @@ struct pcpu_freelist_node *__pcpu_freelist_pop(struct pcpu_freelist *s)if (cpu >= nr_cpu_ids) cpu =0 ;if (cpu == orig_cpu) -return NULL ; +break ; + } + +/* per cpu lists are all empty, try extralist */ +raw_spin_lock (&s->extralist.lock); + node = s->extralist.first; +if (node) + s->extralist.first = node->next; +raw_spin_unlock (&s->extralist.lock); +return node; +} + +static struct pcpu_freelist_node * +___pcpu_freelist_pop_nmi (struct pcpu_freelist *s) +{ +struct pcpu_freelist_head *head; +struct pcpu_freelist_node *node; +int orig_cpu, cpu; + + orig_cpu = cpu =raw_smp_processor_id (); +while (1 ) { + head =per_cpu_ptr (s->freelist, cpu); +if (raw_spin_trylock (&head->lock)) { + node = head->first; +if (node) { + head->first = node->next; +raw_spin_unlock (&head->lock); +return node; + } +raw_spin_unlock (&head->lock); + } + cpu =cpumask_next (cpu, cpu_possible_mask); +if (cpu >= nr_cpu_ids) + cpu =0 ; +if (cpu == orig_cpu) +break ; } + +/* cannot pop from per cpu lists, try extralist */ +if (!raw_spin_trylock (&s->extralist.lock)) +return NULL ; + node = s->extralist.first; +if (node) + s->extralist.first = node->next; +raw_spin_unlock (&s->extralist.lock); +return node; +} + +struct pcpu_freelist_node *__pcpu_freelist_pop (struct pcpu_freelist *s) +{ +if (in_nmi ()) +return ___pcpu_freelist_pop_nmi (s); +return ___pcpu_freelist_pop (s); }struct pcpu_freelist_node *pcpu_freelist_pop (struct pcpu_freelist *s)
kernel/bpf/percpu_freelist.h +1 -0
@@ -13,6 +13,7 @@ struct pcpu_freelist_head {struct pcpu_freelist {struct pcpu_freelist_head __percpu *freelist; +struct pcpu_freelist_head extralist; };struct pcpu_freelist_node {
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 563/633 PM: hibernate: remove the bogus call to get_gendisk() in software_resume()
In reply to Greg Kroah-HartmanFrom: Christoph Hellwig <[email protected]>
[ Upstream commit 428805c0c5e76ef643b1fbc893edfb636b3d8aef ]
get_gendisk grabs a reference on the disk and file operation, so this code will leak both of them while having absolutely no use for the gendisk itself.
This effectively reverts commit 2df83fa4bce421f ("PM / Hibernate: Use get_gendisk to verify partition if resume_file is integer format")
--- kernel/power/hibernate.c | 11 ----------- 1 file changed, 11 deletions(-)
kernel/power/hibernate.c +0 -11
@@ -851,17 +851,6 @@ static int software_resume(void)/* Check if the device is there */ swsusp_resume_device =name_to_dev_t (resume_file); - -/* -* name_to_dev_t is ineffective to verify parition if resume_file is in -* integer format. (e.g. major:minor) -*/ -if (isdigit (resume_file[0 ]) && resume_wait) { -int partno; -while (!get_gendisk (swsusp_resume_device, &partno)) -msleep (10 ); - } -if (!swsusp_resume_device) {/* * Some device discovery might still be in progress; we need
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 564/633 scsi: mvumi: Fix error return in mvumi_io_attach()
In reply to Greg Kroah-HartmanFrom: Jing Xiangfeng <[email protected]>
[ Upstream commit 055f15ab2cb4a5cbc4c0a775ef3d0066e0fa9b34 ]
Return PTR_ERR() from the error handling case instead of 0.
--- drivers/scsi/mvumi.c | 1 + 1 file changed, 1 insertion(+)
drivers/scsi/mvumi.c +1 -0
@@ -2425,6 +2425,7 @@ static int mvumi_io_attach(struct mvumi_hba *mhba)if (IS_ERR (mhba->dm_thread)) {dev_err (&mhba->pdev->dev,"failed to create device scan thread\n" ); + ret =PTR_ERR (mhba->dm_thread);mutex_unlock (&mhba->sas_discovery_mutex); goto fail_create_thread; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 565/633 scsi: target: core: Add CONTROL field for trace events
In reply to Greg Kroah-HartmanFrom: Roman Bolshakov <[email protected]>
[ Upstream commit 7010645ba7256992818b518163f46bd4cdf8002a ]
trace-cmd report doesn't show events from target subsystem because scsi_command_size() leaks through event format string:
[target:target_sequencer_start] function scsi_command_size not defined [target:target_cmd_complete] function scsi_command_size not defined
Addition of scsi_command_size() to plugin_scsi.c in trace-cmd doesn't help because an expression is used inside TP_printk(). trace-cmd event parser doesn't understand minus sign inside [ ]:
Error: expected ']' but read '-'
Rather than duplicating kernel code in plugin_scsi.c, provide a dedicated field for CONTROL byte.
--- include/scsi/scsi_common.h | 7 +++++++ include/trace/events/target.h | 12 ++++++------ 2 files changed, 13 insertions(+), 6 deletions(-)
include/scsi/scsi_common.h +7 -0
@@ -25,6 +25,13 @@ scsi_command_size(const unsigned char *cmnd) scsi_varlen_cdb_length(cmnd) : COMMAND_SIZE(cmnd[0]); } +static inline unsigned char +scsi_command_control (const unsigned char *cmnd) +{ +return (cmnd[0 ] ==VARIABLE_LENGTH_CMD ) ? + cmnd[1 ] : cmnd[COMMAND_SIZE (cmnd[0 ]) -1 ]; +} +/* Returns a human-readable name for the device */ extern const char *scsi_device_type (unsigned type);
include/trace/events/target.h +6 -6
@@ -141,6 +141,7 @@ TRACE_EVENT(target_sequencer_start, __field( unsigned int, opcode ) __field( unsigned int, data_length ) __field( unsigned int, task_attribute ) + __field( unsigned char, control ) __array( unsigned char, cdb, TCM_MAX_COMMAND_SIZE ) __string( initiator, cmd->se_sess->se_node_acl->initiatorname ) ),
@@ -151,6 +152,7 @@ TRACE_EVENT(target_sequencer_start, __entry->opcode = cmd->t_task_cdb[0 ]; __entry->data_length = cmd->data_length; __entry->task_attribute = cmd->sam_task_attr; + __entry->control =scsi_command_control (cmd->t_task_cdb);memcpy (__entry->cdb, cmd->t_task_cdb,TCM_MAX_COMMAND_SIZE );__assign_str (initiator, cmd->se_sess->se_node_acl->initiatorname); ),
@@ -160,9 +162,7 @@ TRACE_EVENT(target_sequencer_start, __entry->tag,show_opcode_name (__entry->opcode), __entry->data_length,__print_hex (__entry->cdb,16 ),show_task_attribute_name (__entry->task_attribute), -scsi_command_size (__entry->cdb) <=16 ? - __entry->cdb[scsi_command_size (__entry->cdb) -1 ] : - __entry->cdb[1 ] + __entry->control ) );
@@ -178,6 +178,7 @@ TRACE_EVENT(target_cmd_complete, __field( unsigned int, opcode ) __field( unsigned int, data_length ) __field( unsigned int, task_attribute ) + __field( unsigned char, control ) __field( unsigned char, scsi_status ) __field( unsigned char, sense_length ) __array( unsigned char, cdb, TCM_MAX_COMMAND_SIZE )
@@ -191,6 +192,7 @@ TRACE_EVENT(target_cmd_complete, __entry->opcode = cmd->t_task_cdb[0 ]; __entry->data_length = cmd->data_length; __entry->task_attribute = cmd->sam_task_attr; + __entry->control =scsi_command_control (cmd->t_task_cdb); __entry->scsi_status = cmd->scsi_status; __entry->sense_length = cmd->scsi_status ==SAM_STAT_CHECK_CONDITION ?min (18 , ((u8 *) cmd->sense_buffer)[SPC_ADD_SENSE_LEN_OFFSET ] +8 ) :0 ;
@@ -208,9 +210,7 @@ TRACE_EVENT(target_cmd_complete,show_opcode_name (__entry->opcode), __entry->data_length,__print_hex (__entry->cdb,16 ),show_task_attribute_name (__entry->task_attribute), -scsi_command_size (__entry->cdb) <=16 ? - __entry->cdb[scsi_command_size (__entry->cdb) -1 ] : - __entry->cdb[1 ] + __entry->control ) );
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 566/633 mic: vop: copy data to kernel space then write to io memory
In reply to Greg Kroah-HartmanFrom: Sherry Sun <[email protected]>
[ Upstream commit 675f0ad4046946e80412896436164d172cd92238 ]
Read and write io memory should address align on ARCH ARM. Change to use memcpy_toio to avoid kernel panic caused by the address un-align issue.
--- drivers/misc/mic/vop/vop_vringh.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)
drivers/misc/mic/vop/vop_vringh.c +14 -6
@@ -602,6 +602,7 @@ static int vop_virtio_copy_from_user(struct vop_vdev *vdev, void __user *ubuf,size_t partlen;bool dma =VOP_USE_DMA && vi->dma_ch;int err =0 ; +size_t offset =0 ;if (dma) { dma_alignment =1 << vi->dma_ch->device->copy_align;
@@ -655,13 +656,20 @@ static int vop_virtio_copy_from_user(struct vop_vdev *vdev, void __user *ubuf,* We are copying to IO below and should ideally use something * like copy_from_user_toio(..) if it existed. */ -if (copy_from_user ((void __force *)dbuf, ubuf, len)) { - err = -EFAULT ; -dev_err (vop_dev (vdev),"%s %d err %d\n" , - __func__, __LINE__, err); - goto err; +while (len) { + partlen =min_t (size_t, len,VOP_INT_DMA_BUF_SIZE ); + +if (copy_from_user (vvr->buf, ubuf + offset, partlen)) { + err = -EFAULT ; +dev_err (vop_dev (vdev),"%s %d err %d\n" , + __func__, __LINE__, err); + goto err; + } +memcpy_toio (dbuf + offset, vvr->buf, partlen); + offset += partlen; + vdev->out_bytes += partlen; + len -= partlen; } - vdev->out_bytes += len; err =0 ; err: vpdev->hw_ops->unmap (vpdev, dbuf);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 567/633 misc: vop: add round_up(x,4) for vring_size to avoid kernel panic
In reply to Greg Kroah-HartmanFrom: Sherry Sun <[email protected]>
[ Upstream commit cc1a2679865a94b83804822996eed010a50a7c1d ]
Since struct _mic_vring_info and vring are allocated together and follow vring, if the vring_size() is not four bytes aligned, which will cause the start address of struct _mic_vring_info is not four byte aligned. For example, when vring entries is 128, the vring_size() will be 5126 bytes. The _mic_vring_info struct layout in ddr looks like:0x90002400: 00000000 00390000 EE010000 0000C0FF
Here 0x39 is the avail_idx member, and 0xC0FFEE01 is the magic member.
When EP use ioread32(magic) to reads the magic in RC's share memory, it will cause kernel panic on ARM64 platform due to the cross-byte io read. Here read magic in user space use le32toh(vr0->info->magic) will meet the same issue.
So add round_up(x,4) for vring_size, then the struct _mic_vring_info will store in this way:0x90002400: 00000000 00000000 00000039 C0FFEE01
Which will avoid kernel panic when read magic in struct _mic_vring_info.
--- drivers/misc/mic/vop/vop_main.c | 2 +- drivers/misc/mic/vop/vop_vringh.c | 4 ++-- samples/mic/mpssd/mpssd.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-)
drivers/misc/mic/vop/vop_main.c +1 -1
@@ -320,7 +320,7 @@ static struct virtqueue *vop_find_vq(struct virtio_device *dev,/* First assign the vring's allocated in host memory */ vqconfig =_vop_vq_config (vdev->desc) + index;memcpy_fromio (&config, vqconfig,sizeof (config)); - _vr_size =vring_size (le16_to_cpu (config.num),MIC_VIRTIO_RING_ALIGN ); + _vr_size =round_up (vring_size (le16_to_cpu (config.num),MIC_VIRTIO_RING_ALIGN ),4 ); vr_size =PAGE_ALIGN (_vr_size +sizeof (struct _mic_vring_info )); va = vpdev->hw_ops->remap (vpdev,le64_to_cpu (config.address), vr_size);if (!va)
drivers/misc/mic/vop/vop_vringh.c +2 -2
@@ -296,7 +296,7 @@ static int vop_virtio_add_device(struct vop_vdev *vdev, num =le16_to_cpu (vqconfig[i].num);mutex_init (&vvr->vr_mutex); - vr_size =PAGE_ALIGN (vring_size (num,MIC_VIRTIO_RING_ALIGN ) + + vr_size =PAGE_ALIGN (round_up (vring_size (num,MIC_VIRTIO_RING_ALIGN ),4 ) +sizeof (struct _mic_vring_info )); vr->va = (void *) __get_free_pages(GFP_KERNEL | __GFP_ZERO,
@@ -308,7 +308,7 @@ static int vop_virtio_add_device(struct vop_vdev *vdev, goto err; } vr->len = vr_size; - vr->info = vr->va +vring_size (num,MIC_VIRTIO_RING_ALIGN ); + vr->info = vr->va +round_up (vring_size (num,MIC_VIRTIO_RING_ALIGN ),4 ); vr->info->magic =cpu_to_le32 (MIC_MAGIC + vdev->virtio_id + i); vr_addr =dma_map_single (&vpdev->dev, vr->va, vr_size,DMA_BIDIRECTIONAL );
samples/mic/mpssd/mpssd.c +2 -2
@@ -403,9 +403,9 @@ mic_virtio_copy(struct mic_info *mic, int fd,static inline unsigned _vring_size (unsigned int num,unsigned long align) { -return ((sizeof (struct vring_desc ) * num +sizeof (__u16) * (3 + num) +return _ALIGN_UP (((sizeof (struct vring_desc ) * num +sizeof (__u16) * (3 + num) + align -1 ) & ~(align -1 )) - +sizeof (__u16) *3 +sizeof (struct vring_used_elem ) * num; + +sizeof (__u16) *3 +sizeof (struct vring_used_elem ) * num,4 ); }/*
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 568/633 usb: dwc3: Add splitdisable quirk for Hisilicon Kirin Soc
In reply to Greg Kroah-HartmanFrom: Yu Chen <[email protected]>
[ Upstream commit f580170f135af14e287560d94045624d4242d712 ]
SPLIT_BOUNDARY_DISABLE should be set for DesignWare USB3 DRD Core of Hisilicon Kirin Soc when dwc3 core act as host.
[mchehab: dropped a dev_dbg() as only traces are now allowwed on this driver]
--- drivers/usb/dwc3/core.c | 25 +++++++++++++++++++++++++ drivers/usb/dwc3/core.h | 7 +++++++ 2 files changed, 32 insertions(+)
drivers/usb/dwc3/core.c +25 -0
@@ -119,6 +119,7 @@ static void __dwc3_set_mode(struct work_struct *work)struct dwc3 *dwc =work_to_dwc (work);unsigned long flags;int ret; +u32 reg;if (dwc->dr_mode !=USB_DR_MODE_OTG )return ;
@@ -172,6 +173,11 @@ static void __dwc3_set_mode(struct work_struct *work)otg_set_vbus (dwc->usb2_phy->otg, true);phy_set_mode (dwc->usb2_generic_phy,PHY_MODE_USB_HOST );phy_set_mode (dwc->usb3_generic_phy,PHY_MODE_USB_HOST ); +if (dwc->dis_split_quirk) { + reg =dwc3_readl (dwc->regs,DWC3_GUCTL3 ); + reg |=DWC3_GUCTL3_SPLITDISABLE ; +dwc3_writel (dwc->regs,DWC3_GUCTL3 , reg); + } }break ;case DWC3_GCTL_PRTCAP_DEVICE :
@@ -1350,6 +1356,9 @@ static void dwc3_get_properties(struct dwc3 *dwc) dwc->dis_metastability_quirk =device_property_read_bool (dev,"snps,dis_metastability_quirk" ); + dwc->dis_split_quirk =device_property_read_bool (dev, +"snps,dis-split-quirk" ); + dwc->lpm_nyet_threshold = lpm_nyet_threshold; dwc->tx_de_emphasis = tx_de_emphasis;
@@ -1867,10 +1876,26 @@ static int dwc3_resume(struct device *dev) return 0; } + +static void dwc3_complete (struct device *dev) +{ +struct dwc3 *dwc =dev_get_drvdata (dev); +u32 reg; + +if (dwc->current_dr_role ==DWC3_GCTL_PRTCAP_HOST && + dwc->dis_split_quirk) { + reg =dwc3_readl (dwc->regs,DWC3_GUCTL3 ); + reg |=DWC3_GUCTL3_SPLITDISABLE ; +dwc3_writel (dwc->regs,DWC3_GUCTL3 , reg); + } +} +#else +#define dwc3_complete NULL#endif /* CONFIG_PM_SLEEP */ static const struct dev_pm_ops dwc3_dev_pm_ops = {SET_SYSTEM_SLEEP_PM_OPS (dwc3_suspend, dwc3_resume) + .complete = dwc3_complete,SET_RUNTIME_PM_OPS (dwc3_runtime_suspend, dwc3_runtime_resume, dwc3_runtime_idle) };
drivers/usb/dwc3/core.h +7 -0
@@ -138,6 +138,7 @@#define DWC3_GEVNTCOUNT (n) (0xc40c + ((n) * 0x10))#define DWC3_GHWPARAMS8 0xc600 +#define DWC3_GUCTL3 0xc60c#define DWC3_GFLADJ 0xc630/* Device Registers */
@@ -380,6 +381,9 @@/* Global User Control Register 2 */ #define DWC3_GUCTL2_RST_ACTBITLATER BIT(14) +/* Global User Control Register 3 */ +#define DWC3_GUCTL3_SPLITDISABLE BIT(14) +/* Device Configuration Register */ #define DWC3_DCFG_DEVADDR (addr) ((addr) << 3)#define DWC3_DCFG_DEVADDR_MASK DWC3_DCFG_DEVADDR(0x7f)
@@ -1052,6 +1056,7 @@ struct dwc3_scratchpad_array {* 2 - No de-emphasis * 3 - Reserved * @dis_metastability_quirk: set to disable metastability quirk. +* @dis_split_quirk: set to disable split boundary. * @imod_interval: set the interrupt moderation interval in 250ns * increments or 0 to disable. */
@@ -1245,6 +1250,8 @@ struct dwc3 { unsigned dis_metastability_quirk:1; + unsigned dis_split_quirk:1; +u16 imod_interval; };
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 569/633 usb: gadget: function: printer: fix use-after-free in __lock_acquire
In reply to Greg Kroah-HartmanFrom: Zqiang <[email protected]>
[ Upstream commit e8d5f92b8d30bb4ade76494490c3c065e12411b1 ]
Fix this by increase object reference count.
BUG: KASAN: use-after-free in __lock_acquire+0x3fd4/0x4180 kernel/locking/lockdep.c:3831 Read of size 8 at addr ffff8880683b0018 by task syz-executor.0/3377 CPU: 1 PID: 3377 Comm: syz-executor.0 Not tainted 5.6.11 #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0xce/0x128 lib/dump_stack.c:118 print_address_description.constprop.4+0x21/0x3c0 mm/kasan/report.c:374 __kasan_report+0x131/0x1b0 mm/kasan/report.c:506 kasan_report+0x12/0x20 mm/kasan/common.c:641 __asan_report_load8_noabort+0x14/0x20 mm/kasan/generic_report.c:135 __lock_acquire+0x3fd4/0x4180 kernel/locking/lockdep.c:3831 lock_acquire+0x127/0x350 kernel/locking/lockdep.c:4488 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0x35/0x50 kernel/locking/spinlock.c:159 printer_ioctl+0x4a/0x110 drivers/usb/gadget/function/f_printer.c:723 vfs_ioctl fs/ioctl.c:47 [inline] ksys_ioctl+0xfb/0x130 fs/ioctl.c:763 __do_sys_ioctl fs/ioctl.c:772 [inline] __se_sys_ioctl fs/ioctl.c:770 [inline] __x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:770 do_syscall_64+0x9e/0x510 arch/x86/entry/common.c:294 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x4531a9 Code: ed 60 fc ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 89 f8 48
89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 bb 60 fc ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007fd14ad72c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 000000000073bfa8 RCX: 00000000004531a9
RDX: fffffffffffffff9 RSI: 000000000000009e RDI: 0000000000000003
RBP: 0000000000000003 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000004bbd61
R13: 00000000004d0a98 R14: 00007fd14ad736d4 R15: 00000000ffffffff
Allocated by task 2393: save_stack+0x21/0x90 mm/kasan/common.c:72 set_track mm/kasan/common.c:80 [inline] __kasan_kmalloc.constprop.3+0xa7/0xd0 mm/kasan/common.c:515 kasan_kmalloc+0x9/0x10 mm/kasan/common.c:529 kmem_cache_alloc_trace+0xfa/0x2d0 mm/slub.c:2813 kmalloc include/linux/slab.h:555 [inline] kzalloc include/linux/slab.h:669 [inline] gprinter_alloc+0xa1/0x870 drivers/usb/gadget/function/f_printer.c:1416 usb_get_function+0x58/0xc0 drivers/usb/gadget/functions.c:61 config_usb_cfg_link+0x1ed/0x3e0 drivers/usb/gadget/configfs.c:444 configfs_symlink+0x527/0x11d0 fs/configfs/symlink.c:202 vfs_symlink+0x33d/0x5b0 fs/namei.c:4201 do_symlinkat+0x11b/0x1d0 fs/namei.c:4228 __do_sys_symlinkat fs/namei.c:4242 [inline] __se_sys_symlinkat fs/namei.c:4239 [inline] __x64_sys_symlinkat+0x73/0xb0 fs/namei.c:4239 do_syscall_64+0x9e/0x510 arch/x86/entry/common.c:294 entry_SYSCALL_64_after_hwframe+0x49/0xbe Freed by task 3368: save_stack+0x21/0x90 mm/kasan/common.c:72 set_track mm/kasan/common.c:80 [inline] kasan_set_free_info mm/kasan/common.c:337 [inline] __kasan_slab_free+0x135/0x190 mm/kasan/common.c:476 kasan_slab_free+0xe/0x10 mm/kasan/common.c:485 slab_free_hook mm/slub.c:1444 [inline] slab_free_freelist_hook mm/slub.c:1477 [inline] slab_free mm/slub.c:3034 [inline] kfree+0xf7/0x410 mm/slub.c:3995 gprinter_free+0x49/0xd0 drivers/usb/gadget/function/f_printer.c:1353 usb_put_function+0x38/0x50 drivers/usb/gadget/functions.c:87 config_usb_cfg_unlink+0x2db/0x3b0 drivers/usb/gadget/configfs.c:485 configfs_unlink+0x3b9/0x7f0 fs/configfs/symlink.c:250 vfs_unlink+0x287/0x570 fs/namei.c:4073 do_unlinkat+0x4f9/0x620 fs/namei.c:4137 __do_sys_unlink fs/namei.c:4184 [inline] __se_sys_unlink fs/namei.c:4182 [inline] __x64_sys_unlink+0x42/0x50 fs/namei.c:4182 do_syscall_64+0x9e/0x510 arch/x86/entry/common.c:294 entry_SYSCALL_64_after_hwframe+0x49/0xbe The buggy address belongs to the object at ffff8880683b0000 which belongs to the cache kmalloc-1k of size 1024 The buggy address is located 24 bytes inside of 1024-byte region [ffff8880683b0000, ffff8880683b0400) The buggy address belongs to the page: page:ffffea0001a0ec00 refcount:1 mapcount:0 mapping:ffff88806c00e300 index:0xffff8880683b1800 compound_mapcount: 0 flags: 0x100000000010200(slab|head) raw: 0100000000010200 0000000000000000 0000000600000001 ffff88806c00e300 raw: ffff8880683b1800 000000008010000a 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected
--- drivers/usb/gadget/function/f_printer.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
drivers/usb/gadget/function/f_printer.c +14 -2
@@ -31,6 +31,7 @@#include <linux/types.h> #include <linux/ctype.h> #include <linux/cdev.h> +#include <linux/kref.h> #include <asm/byteorder.h> #include <linux/io.h>
@@ -64,7 +65,7 @@ struct printer_dev {struct usb_gadget *gadget;s8 interface;struct usb_ep *in_ep, *out_ep; - +struct kref kref;struct list_head rx_reqs;/* List of free RX structs */ struct list_head rx_reqs_active;/* List of Active RX xfers */ struct list_head rx_buffers;/* List of completed xfers */
@@ -218,6 +219,13 @@ static inline struct usb_endpoint_descriptor *ep_desc(struct usb_gadget *gadget,/*-------------------------------------------------------------------------*/ +static void printer_dev_free (struct kref *kref) +{ + struct printer_dev *dev = container_of(kref, struct printer_dev, kref); + +kfree (dev); +} +static struct usb_request *printer_req_alloc (struct usb_ep *ep,unsigned len,gfp_t gfp_flags) {
@@ -348,6 +356,7 @@ printer_open(struct inode *inode, struct file *fd)spin_unlock_irqrestore (&dev->lock, flags); +kref_get (&dev->kref);DBG (dev,"printer_open returned %x\n" , ret);return ret; }
@@ -365,6 +374,7 @@ printer_close(struct inode *inode, struct file *fd) dev->printer_status &= ~PRINTER_SELECTED ;spin_unlock_irqrestore (&dev->lock, flags); +kref_put (&dev->kref, printer_dev_free);DBG (dev,"printer_close\n" );return 0 ;
@@ -1350,7 +1360,8 @@ static void gprinter_free(struct usb_function *f)struct f_printer_opts *opts; opts = container_of(f->fi, struct f_printer_opts, func_inst); -kfree (dev); + +kref_put (&dev->kref, printer_dev_free);mutex_lock (&opts->lock); --opts->refcnt;mutex_unlock (&opts->lock);
@@ -1419,6 +1430,7 @@ static struct usb_function *gprinter_alloc(struct usb_function_instance *fi)return ERR_PTR (-ENOMEM ); } +kref_init (&dev->kref); ++opts->refcnt; dev->minor = opts->minor; dev->pnp_string = opts->pnp_string;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 570/633 rtw88: pci: Power cycle device during shutdown
In reply to Greg Kroah-HartmanFrom: Kai-Heng Feng <[email protected]>
[ Upstream commit 44492e70adc8086c42d3745d21d591657a427f04 ]
There are reports that 8822CE fails to work rtw88 with "failed to read DBI register" error. Also I have a system with 8723DE which freezes the whole system when the rtw88 is probing the device.
According to [1], platform firmware may not properly power manage the device during shutdown. I did some expirements and putting the device to D3 can workaround the issue.
So let's power cycle the device by putting the device to D3 at shutdown to prevent the issue from happening.
[1] https://bugzilla.kernel.org/show_bug.cgi?id=206411#c9
--- drivers/net/wireless/realtek/rtw88/pci.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/wireless/realtek/rtw88/pci.c +2 -0
@@ -1599,6 +1599,8 @@ void rtw_pci_shutdown(struct pci_dev *pdev)if (chip->ops->shutdown) chip->ops->shutdown (rtwdev); + +pci_set_power_state (pdev, PCI_D3hot); }EXPORT_SYMBOL (rtw_pci_shutdown);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 571/633 udf: Limit sparing table size
In reply to Greg Kroah-HartmanFrom: Jan Kara <[email protected]>
[ Upstream commit 44ac6b829c4e173fdf6df18e6dd86aecf9a3dc99 ]
Although UDF standard allows it, we don't support sparing table larger than a single block. Check it during mount so that we don't try to access memory beyond end of buffer.
--- fs/udf/super.c | 6 ++++++ 1 file changed, 6 insertions(+)
fs/udf/super.c +6 -0
@@ -1353,6 +1353,12 @@ static int udf_load_sparable_map(struct super_block *sb, (int)spm->numSparingTables);return -EIO ; } +if (le32_to_cpu (spm->sizeSparingTable) > sb->s_blocksize) { +udf_err (sb,"error loading logical volume descriptor: " +"Too big sparing table size (%u)\n" , +le32_to_cpu (spm->sizeSparingTable)); +return -EIO ; + }for (i =0 ; i < spm->numSparingTables; i++) { loc =le32_to_cpu (spm->locSparingTable[i]);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 572/633 udf: Avoid accessing uninitialized data on failed inode read
In reply to Greg Kroah-HartmanFrom: Jan Kara <[email protected]>
[ Upstream commit 044e2e26f214e5ab26af85faffd8d1e4ec066931 ]
When we fail to read inode, some data accessed in udf_evict_inode() may be uninitialized. Move the accesses to !is_bad_inode() branch.
--- fs/udf/inode.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-)
fs/udf/inode.c +14 -11
@@ -139,21 +139,24 @@ void udf_evict_inode(struct inode *inode)struct udf_inode_info *iinfo =UDF_I (inode);int want_delete =0 ; -if (!inode->i_nlink && !is_bad_inode (inode)) { - want_delete =1 ; -udf_setsize (inode,0 ); -udf_update_inode (inode,IS_SYNC (inode)); +if (!is_bad_inode (inode)) { +if (!inode->i_nlink) { + want_delete =1 ; +udf_setsize (inode,0 ); +udf_update_inode (inode,IS_SYNC (inode)); + } +if (iinfo->i_alloc_type !=ICBTAG_FLAG_AD_IN_ICB && + inode->i_size != iinfo->i_lenExtents) { +udf_warn (inode->i_sb, +"Inode %lu (mode %o) has inode size %llu different from extent length %llu. Filesystem need not be standards compliant.\n" , + inode->i_ino, inode->i_mode, + (unsigned long long )inode->i_size, + (unsigned long long )iinfo->i_lenExtents); + } }truncate_inode_pages_final (&inode->i_data);invalidate_inode_buffers (inode);clear_inode (inode); -if (iinfo->i_alloc_type !=ICBTAG_FLAG_AD_IN_ICB && - inode->i_size != iinfo->i_lenExtents) { -udf_warn (inode->i_sb,"Inode %lu (mode %o) has inode size %llu different from extent length %llu. Filesystem need not be standards compliant.\n" , - inode->i_ino, inode->i_mode, - (unsigned long long )inode->i_size, - (unsigned long long )iinfo->i_lenExtents); - }kfree (iinfo->i_ext.i_data); iinfo->i_ext.i_data =NULL ;udf_clear_extent_cache (inode);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 573/633 rtw88: increse the size of rx buffer size
In reply to Greg Kroah-HartmanFrom: Tzu-En Huang <[email protected]>
[ Upstream commit ee755732b7a16af018daa77d9562d2493fb7092f ]
The vht capability of MAX_MPDU_LENGTH is 11454 in rtw88; however, the rx buffer size for each packet is 8192. When receiving packets that are larger than rx buffer size, it will leads to rx buffer ring overflow.
--- drivers/net/wireless/realtek/rtw88/pci.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/realtek/rtw88/pci.h +2 -2
@@ -9,8 +9,8 @@#define RTK_BEQ_TX_DESC_NUM 256#define RTK_MAX_RX_DESC_NUM 512 -/* 8K + rx desc size */ -#define RTK_PCI_RX_BUF_SIZE (8192 + 24) +/* 11K + rx desc size */ +#define RTK_PCI_RX_BUF_SIZE (11454 + 24)#define RTK_PCI_CTRL 0x300#define BIT_RST_TRXDMA_INTF BIT(20)
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 574/633 selftests/bpf: Fix overflow tests to reflect iter size increase
In reply to Greg Kroah-HartmanFrom: Alan Maguire <[email protected]>
[ Upstream commit eb58bbf2e5c7917aa30bf8818761f26bbeeb2290 ]
bpf iter size increase to PAGE_SIZE << 3 means overflow tests assuming page size need to be bumped also.
--- tools/testing/selftests/bpf/prog_tests/bpf_iter.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
tools/testing/selftests/bpf/prog_tests/bpf_iter.c +7 -7
@@ -249,7 +249,7 @@ static void test_overflow(bool test_e2big_overflow, bool ret1)struct bpf_map_info map_info = {};struct bpf_iter_test_kern4 *skel;struct bpf_link *link; -__u32 page_size; +__u32 iter_size;char *buf; skel =bpf_iter_test_kern4__open ();
@@ -271,19 +271,19 @@ static void test_overflow(bool test_e2big_overflow, bool ret1) "map_creation failed: %s\n", strerror(errno))) goto free_map1; -/* bpf_seq_printf kernel buffer is one page, so one map +/* bpf_seq_printf kernel buffer is 8 pages, so one map * bpf_seq_write will mostly fill it, and the other map * will partially fill and then trigger overflow and need * bpf_seq_read restart. */ - page_size =sysconf (_SC_PAGE_SIZE); + iter_size =sysconf (_SC_PAGE_SIZE) <<3 ;if (test_e2big_overflow) { - skel->rodata->print_len = (page_size +8 ) /8 ; - expected_read_len =2 * (page_size +8 ); + skel->rodata->print_len = (iter_size +8 ) /8 ; + expected_read_len =2 * (iter_size +8 ); }else if (!ret1) { - skel->rodata->print_len = (page_size -8 ) /8 ; - expected_read_len =2 * (page_size -8 ); + skel->rodata->print_len = (iter_size -8 ) /8 ; + expected_read_len =2 * (iter_size -8 ); }else { skel->rodata->print_len =1 ; expected_read_len =2 *8 ;
Signature · 1 line
2.25.1
Re: [PATCH 5.8 574/633] selftests/bpf: Fix overflow tests to reflect iter size increase
Quoted 7 lines · Greg Kroah-Hartman
From: Alan Maguire <[email protected]>
[ Upstream commit
eb58bbf2e5c7917aa30bf8818761f26bbeeb2290]bpf iter size increase to
PAGE_SIZE<< 3 means overflow tests assuming page size need to be bumped also.
Alexei can correct me if I've got this wrong but I don't believe it's a stable backport candidate.
This selftests change should only be relevant when the BPF iterator size has been bumped up as it was in
af65320 bpf: Bump iter seq size to support BTF representation of large data structures
...so I don't _think_ this commit belongs in stable unless the above commit is backported also (and unless I'm missing something I don't see a burning reason to do that currently).
Backporting this alone will likely induce bpf test failures. Apologies if the "Fix" in the title was misleading; it should probably have been "Update" to reflect the fact it's not fixing an existing bug but rather updating the test to operate correctly in the context of other changes in the for-next patch series it was part of.
Thanks!
Alan
Sasha Levin
maintainerRe: [PATCH 5.8 574/633] selftests/bpf: Fix overflow tests to reflect iter size increase
Quoted 23 lines · Alan Maguire
Quoted 7 lines · Greg Kroah-Hartman
From: Alan Maguire <[email protected]>
[ Upstream commit
eb58bbf2e5c7917aa30bf8818761f26bbeeb2290]bpf iter size increase to
PAGE_SIZE<< 3 means overflow tests assuming page size need to be bumped also.Alexei can correct me if I've got this wrong but I don't believe it's a stable backport candidate.
This selftests change should only be relevant when the BPF iterator size has been bumped up as it was in
af65320 bpf: Bump iter seq size to support BTF representation of large data structures
...so I don't _think_ this commit belongs in stable unless the above commit is backported also (and unless I'm missing something I don't see a burning reason to do that currently).
Quoted 6 lines
Backporting this alone will likely induce bpf test failures. Apologies if the "Fix" in the title was misleading; it should probably have been "Update" to reflect the fact it's not fixing an existing bug but rather updating the test to operate correctly in the context of other changes in the for-next patch series it was part of.
I'll drop it, thanks!
Signature · 2 lines
Thanks, Sasha
Greg Kroah-Hartman
maintainerPATCH 575/633 USB: cdc-acm: handle broken union descriptors
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
[ Upstream commit 960c7339de27c6d6fec13b54880501c3576bb08d ]
Handle broken union functional descriptors where the master-interface doesn't exist or where its class is of neither Communication or Data type (as required by the specification) by falling back to "combined-interface" probing.
Note that this still allows for handling union descriptors with switched interfaces.
This specifically makes the Whistler radio scanners TRX series devices work with the driver without adding further quirks to the device-id table.
--- drivers/usb/class/cdc-acm.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/usb/class/cdc-acm.c +12 -0
@@ -1243,9 +1243,21 @@ static int acm_probe(struct usb_interface *intf, } } }else { +int class =-1 ; + data_intf_num = union_header->bSlaveInterface0; control_interface =usb_ifnum_to_if (usb_dev, union_header->bMasterInterface0); data_interface =usb_ifnum_to_if (usb_dev, data_intf_num); + +if (control_interface) + class = control_interface->cur_altsetting->desc.bInterfaceClass; + +if (class !=USB_CLASS_COMM && class !=USB_CLASS_CDC_DATA ) { +dev_dbg (&intf->dev,"Broken union descriptor, assuming single interface\n" ); + combined_interfaces =1 ; + control_interface = data_interface = intf; + goto look_for_collapsed_interface; + } }if (!control_interface || !data_interface) {
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 576/633 usb: dwc3: simple: add support for Hikey 970
In reply to Greg Kroah-HartmanFrom: Mauro Carvalho Chehab <[email protected]>
[ Upstream commit b68d9251561f33661e53dd618f1cafe7ec9ec3c2 ]
This binding driver is needed for Hikey 970 to work, as otherwise a Serror is produced:
[ 1.837458] SError Interrupt on CPU0, code 0xbf000002 -- SError
[ 1.837462] CPU: 0 PID: 74 Comm: kworker/0:1 Not tainted 5.8.0+ #205
[ 1.837463] Hardware name: HiKey970 (DT)
[ 1.837465] Workqueue: events deferred_probe_work_func
[ 1.837467] pstate: 20000005 (nzCv daif -PAN -UAO BTYPE=--)
[ 1.837468] pc : _raw_spin_unlock_irqrestore+0x18/0x50
[ 1.837469] lr : regmap_unlock_spinlock+0x14/0x20
[ 1.837470] sp : ffff8000124dba60
[ 1.837471] x29: ffff8000124dba60 x28: 0000000000000000
[ 1.837474] x27: ffff0001b7e854c8 x26: ffff80001204ea18
[ 1.837476] x25: 0000000000000005 x24: ffff800011f918f8
[ 1.837479] x23: ffff800011fbb588 x22: ffff0001b7e40e00
[ 1.837481] x21: 0000000000000100 x20: 0000000000000000
[ 1.837483] x19: ffff0001b767ec00 x18: 00000000ff10c000
[ 1.837485] x17: 0000000000000002 x16: 0000b0740fdb9950
[ 1.837488] x15: ffff8000116c1198 x14: ffffffffffffffff
[ 1.837490] x13: 0000000000000030 x12: 0101010101010101
[ 1.837493] x11: 0000000000000020 x10: ffff0001bf17d130
[ 1.837495] x9 : 0000000000000000 x8 : ffff0001b6938080
[ 1.837497] x7 : 0000000000000000 x6 : 000000000000003f
[ 1.837500] x5 : 0000000000000000 x4 : 0000000000000000
[ 1.837502] x3 : ffff80001096a880 x2 : 0000000000000000
[ 1.837505] x1 : ffff0001b7e40e00 x0 : 0000000100000001
[ 1.837507] Kernel panic - not syncing: Asynchronous SError Interrupt
[ 1.837509] CPU: 0 PID: 74 Comm: kworker/0:1 Not tainted 5.8.0+ #205
[ 1.837510] Hardware name: HiKey970 (DT)
[ 1.837511] Workqueue: events deferred_probe_work_func
[ 1.837513] Call trace:
[ 1.837514] dump_backtrace+0x0/0x1e0
[ 1.837515] show_stack+0x18/0x24
[ 1.837516] dump_stack+0xc0/0x11c
[ 1.837517] panic+0x15c/0x324
[ 1.837518] nmi_panic+0x8c/0x90
[ 1.837519] arm64_serror_panic+0x78/0x84
[ 1.837520] do_serror+0x158/0x15c
[ 1.837521] el1_error+0x84/0x100
[ 1.837522] _raw_spin_unlock_irqrestore+0x18/0x50
[ 1.837523] regmap_write+0x58/0x80
[ 1.837524] hi3660_reset_deassert+0x28/0x34
[ 1.837526] reset_control_deassert+0x50/0x260
[ 1.837527] reset_control_deassert+0xf4/0x260
[ 1.837528] dwc3_probe+0x5dc/0xe6c
[ 1.837529] platform_drv_probe+0x54/0xb0
[ 1.837530] really_probe+0xe0/0x490
[ 1.837531] driver_probe_device+0xf4/0x160
[ 1.837532] __device_attach_driver+0x8c/0x114
[ 1.837533] bus_for_each_drv+0x78/0xcc
[ 1.837534] __device_attach+0x108/0x1a0
[ 1.837535] device_initial_probe+0x14/0x20
[ 1.837537] bus_probe_device+0x98/0xa0
[ 1.837538] deferred_probe_work_func+0x88/0xe0
[ 1.837539] process_one_work+0x1cc/0x350
[ 1.837540] worker_thread+0x2c0/0x470
[ 1.837541] kthread+0x154/0x160
[ 1.837542] ret_from_fork+0x10/0x30
[ 1.837569] SMP: stopping secondary CPUs
[ 1.837570] Kernel Offset: 0x1d0000 from 0xffff800010000000
[ 1.837571] PHYS_OFFSET: 0x0
[ 1.837572] CPU features: 0x240002,20882004
[ 1.837573] Memory Limit: none--- drivers/usb/dwc3/dwc3-of-simple.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/dwc3/dwc3-of-simple.c +1 -0
@@ -176,6 +176,7 @@ static const struct of_device_id of_dwc3_simple_match[] = { { .compatible = "cavium,octeon-7130-usb-uctl" }, { .compatible = "sprd,sc9860-dwc3" }, { .compatible = "allwinner,sun50i-h6-dwc3" }, + { .compatible = "hisilicon,hi3670-dwc3" }, {/* Sentinel */ } };MODULE_DEVICE_TABLE (of, of_dwc3_simple_match);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 577/633 habanalabs: cast to u64 before shift > 31 bits
In reply to Greg Kroah-HartmanFrom: Oded Gabbay <[email protected]>
[ Upstream commit f763946aefe67b3ea58696b75a930ba1ed886a83 ]
When shifting a boolean variable by more than 31 bits and putting the result into a u64 variable, we need to cast the boolean into unsigned 64 bits to prevent possible overflow.
--- drivers/misc/habanalabs/gaudi/gaudi.c | 8 +++++--- drivers/misc/habanalabs/goya/goya.c | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-)
drivers/misc/habanalabs/gaudi/gaudi.c +5 -3
@@ -6285,7 +6285,7 @@ static bool gaudi_is_device_idle(struct hl_device *hdev, u32 *mask, is_idle &= is_eng_idle;if (mask) - *mask |= !is_eng_idle << + *mask |= ((u64 ) !is_eng_idle) << (GAUDI_ENGINE_ID_DMA_0 + dma_id);if (s) seq_printf(s, fmt, dma_id,
@@ -6308,7 +6308,8 @@ static bool gaudi_is_device_idle(struct hl_device *hdev, u32 *mask, is_idle &= is_eng_idle;if (mask) - *mask |= !is_eng_idle << (GAUDI_ENGINE_ID_TPC_0 + i); + *mask |= ((u64 ) !is_eng_idle) << + (GAUDI_ENGINE_ID_TPC_0 + i);if (s) seq_printf(s, fmt, i, is_eng_idle ? "Y" : "N",
@@ -6336,7 +6337,8 @@ static bool gaudi_is_device_idle(struct hl_device *hdev, u32 *mask, is_idle &= is_eng_idle;if (mask) - *mask |= !is_eng_idle << (GAUDI_ENGINE_ID_MME_0 + i); + *mask |= ((u64 ) !is_eng_idle) << + (GAUDI_ENGINE_ID_MME_0 + i);if (s) {if (!is_slave) seq_printf(s, fmt, i,
drivers/misc/habanalabs/goya/goya.c +5 -3
@@ -5098,7 +5098,8 @@ static bool goya_is_device_idle(struct hl_device *hdev, u32 *mask, is_idle &= is_eng_idle;if (mask) - *mask |= !is_eng_idle << (GOYA_ENGINE_ID_DMA_0 + i); + *mask |= ((u64 ) !is_eng_idle) << + (GOYA_ENGINE_ID_DMA_0 + i);if (s)seq_printf (s, dma_fmt, i, is_eng_idle ?"Y" :"N" , qm_glbl_sts0, dma_core_sts0);
@@ -5121,7 +5122,8 @@ static bool goya_is_device_idle(struct hl_device *hdev, u32 *mask, is_idle &= is_eng_idle;if (mask) - *mask |= !is_eng_idle << (GOYA_ENGINE_ID_TPC_0 + i); + *mask |= ((u64 ) !is_eng_idle) << + (GOYA_ENGINE_ID_TPC_0 + i);if (s)seq_printf (s, fmt, i, is_eng_idle ?"Y" :"N" , qm_glbl_sts0, cmdq_glbl_sts0, tpc_cfg_sts);
@@ -5141,7 +5143,7 @@ static bool goya_is_device_idle(struct hl_device *hdev, u32 *mask, is_idle &= is_eng_idle;if (mask) - *mask |= !is_eng_idle <<GOYA_ENGINE_ID_MME_0 ; + *mask |= ((u64 ) !is_eng_idle) <<GOYA_ENGINE_ID_MME_0 ;if (s) {seq_printf (s, fmt,0 , is_eng_idle ?"Y" :"N" , qm_glbl_sts0, cmdq_glbl_sts0, mme_arch_sts);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 578/633 can: flexcan: flexcan_chip_stop(): add error handling and propagate error value
In reply to Greg Kroah-HartmanFrom: Joakim Zhang <[email protected]>
[ Upstream commit 9ad02c7f4f279504bdd38ab706fdc97d5f2b2a9c ]
This patch implements error handling and propagates the error value of flexcan_chip_stop(). This function will be called from flexcan_suspend() in an upcoming patch in some SoCs which support LPSR mode.
Add a new function flexcan_chip_stop_disable_on_error() that tries to disable the chip even in case of errors.
--- drivers/net/can/flexcan.c | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-)
drivers/net/can/flexcan.c +28 -6
@@ -1260,18 +1260,23 @@ static int flexcan_chip_start(struct net_device *dev)return err; } -/* flexcan_chip_stop +/* __flexcan_chip_stop * -* this functions is entered with clocks enabled +* this function is entered with clocks enabled */ -static void flexcan_chip_stop (struct net_device *dev) +static int __flexcan_chip_stop (struct net_device *dev,bool disable_on_error) {struct flexcan_priv *priv =netdev_priv (dev);struct flexcan_regs __iomem *regs = priv->regs; +int err;/* freeze + disable module */ -flexcan_chip_freeze (priv); -flexcan_chip_disable (priv); + err =flexcan_chip_freeze (priv); +if (err && !disable_on_error) +return err; + err =flexcan_chip_disable (priv); +if (err && !disable_on_error) + goto out_chip_unfreeze;/* Disable all interrupts */ priv->write (0 , ®s->imask2);
@@ -1281,6 +1286,23 @@ static void flexcan_chip_stop(struct net_device *dev)flexcan_transceiver_disable (priv); priv->can.state =CAN_STATE_STOPPED ; + +return 0 ; + + out_chip_unfreeze: +flexcan_chip_unfreeze (priv); + +return err; +} + +static inline int flexcan_chip_stop_disable_on_error (struct net_device *dev) +{ +return __flexcan_chip_stop (dev, true); +} + +static inline int flexcan_chip_stop (struct net_device *dev) +{ +return __flexcan_chip_stop (dev, false); }static int flexcan_open (struct net_device *dev)
@@ -1362,7 +1384,7 @@ static int flexcan_close(struct net_device *dev)netif_stop_queue (dev);can_rx_offload_disable (&priv->offload); -flexcan_chip_stop (dev); +flexcan_chip_stop_disable_on_error (dev);can_rx_offload_del (&priv->offload);free_irq (dev->irq, dev);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 579/633 HID: multitouch: Lenovo X1 Tablet Gen3 trackpoint and buttons
In reply to Greg Kroah-HartmanFrom: Mikael Wikström <[email protected]>
[ Upstream commit 140958da9ab53a7df9e9ccc7678ea64655279ac1 ]
One more device that needs 40d5bb87 to resolve regression for the trackpoint and three mouse buttons on the type cover of the Lenovo X1 Tablet Gen3.
It is probably also needed for the Lenovo X1 Tablet Gen2 with PID 0x60a3
--- drivers/hid/hid-ids.h | 1 + drivers/hid/hid-multitouch.c | 6 ++++++ 2 files changed, 7 insertions(+)
drivers/hid/hid-ids.h +1 -0
@@ -726,6 +726,7 @@#define USB_DEVICE_ID_LENOVO_SCROLLPOINT_OPTICAL 0x6049#define USB_DEVICE_ID_LENOVO_TPPRODOCK 0x6067#define USB_DEVICE_ID_LENOVO_X1_COVER 0x6085 +#define USB_DEVICE_ID_LENOVO_X1_TAB3 0x60b5#define USB_DEVICE_ID_LENOVO_PIXART_USB_MOUSE_608D 0x608d#define USB_DEVICE_ID_LENOVO_PIXART_USB_MOUSE_6019 0x6019#define USB_DEVICE_ID_LENOVO_PIXART_USB_MOUSE_602E 0x602e
drivers/hid/hid-multitouch.c +6 -0
@@ -1973,6 +1973,12 @@ static const struct hid_device_id mt_devices[] = { HID_DEVICE(BUS_I2C, HID_GROUP_GENERIC, USB_VENDOR_ID_LG, I2C_DEVICE_ID_LG_7010) }, +/* Lenovo X1 TAB Gen 3 */ + { .driver_data = MT_CLS_WIN_8_FORCE_MULTI_INPUT, +HID_DEVICE (BUS_USB ,HID_GROUP_MULTITOUCH_WIN_8 , +USB_VENDOR_ID_LENOVO , + USB_DEVICE_ID_LENOVO_X1_TAB3) }, + /* MosArt panels */ { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE, MT_USB_DEVICE(USB_VENDOR_ID_ASUS,
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 580/633 ath9k: hif_usb: fix race condition between usb_get_urb() and usb_kill_anchored_urbs()
In reply to Greg Kroah-HartmanFrom: Brooke Basile <[email protected]>
[ Upstream commit 03fb92a432ea5abe5909bca1455b7e44a9380480 ]
Calls to usb_kill_anchored_urbs() after usb_kill_urb() on multiprocessor systems create a race condition in which usb_kill_anchored_urbs() deallocates the URB before the completer callback is called in usb_kill_urb(), resulting in a use-after-free.
To fix this, add proper lock protection to usb_kill_urb() calls that can possibly run concurrently with usb_kill_anchored_urbs().
--- drivers/net/wireless/ath/ath9k/hif_usb.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
drivers/net/wireless/ath/ath9k/hif_usb.c +19 -0
@@ -449,10 +449,19 @@ static void hif_usb_stop(void *hif_handle)spin_unlock_irqrestore (&hif_dev->tx.tx_lock, flags);/* The pending URBs have to be canceled. */ +spin_lock_irqsave (&hif_dev->tx.tx_lock, flags);list_for_each_entry_safe (tx_buf, tx_buf_tmp, &hif_dev->tx.tx_pending, list) { +usb_get_urb (tx_buf->urb); +spin_unlock_irqrestore (&hif_dev->tx.tx_lock, flags);usb_kill_urb (tx_buf->urb); +list_del (&tx_buf->list); +usb_free_urb (tx_buf->urb); +kfree (tx_buf->buf); +kfree (tx_buf); +spin_lock_irqsave (&hif_dev->tx.tx_lock, flags); } +spin_unlock_irqrestore (&hif_dev->tx.tx_lock, flags);usb_kill_anchored_urbs (&hif_dev->mgmt_submitted); }
@@ -762,27 +771,37 @@ static void ath9k_hif_usb_dealloc_tx_urbs(struct hif_device_usb *hif_dev)struct tx_buf *tx_buf =NULL , *tx_buf_tmp =NULL ;unsigned long flags; +spin_lock_irqsave (&hif_dev->tx.tx_lock, flags);list_for_each_entry_safe (tx_buf, tx_buf_tmp, &hif_dev->tx.tx_buf, list) { +usb_get_urb (tx_buf->urb); +spin_unlock_irqrestore (&hif_dev->tx.tx_lock, flags);usb_kill_urb (tx_buf->urb);list_del (&tx_buf->list);usb_free_urb (tx_buf->urb);kfree (tx_buf->buf);kfree (tx_buf); +spin_lock_irqsave (&hif_dev->tx.tx_lock, flags); } +spin_unlock_irqrestore (&hif_dev->tx.tx_lock, flags);spin_lock_irqsave (&hif_dev->tx.tx_lock, flags); hif_dev->tx.flags |=HIF_USB_TX_FLUSH ;spin_unlock_irqrestore (&hif_dev->tx.tx_lock, flags); +spin_lock_irqsave (&hif_dev->tx.tx_lock, flags);list_for_each_entry_safe (tx_buf, tx_buf_tmp, &hif_dev->tx.tx_pending, list) { +usb_get_urb (tx_buf->urb); +spin_unlock_irqrestore (&hif_dev->tx.tx_lock, flags);usb_kill_urb (tx_buf->urb);list_del (&tx_buf->list);usb_free_urb (tx_buf->urb);kfree (tx_buf->buf);kfree (tx_buf); +spin_lock_irqsave (&hif_dev->tx.tx_lock, flags); } +spin_unlock_irqrestore (&hif_dev->tx.tx_lock, flags);usb_kill_anchored_urbs (&hif_dev->mgmt_submitted); }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 581/633 drm/panfrost: add Amlogic GPU integration quirks
In reply to Greg Kroah-HartmanFrom: Neil Armstrong <[email protected]>
[ Upstream commit afcd0c7d3d4c22afc8befcfc906db6ce3058d3ee ]
This adds the required GPU quirks, including the quirk in the PWR registers at the GPU reset time and the IOMMU quirk for shareability issues observed on G52 in Amlogic G12B SoCs.
--- drivers/gpu/drm/panfrost/panfrost_drv.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/gpu/drm/panfrost/panfrost_drv.c +11 -0
@@ -667,7 +667,18 @@ static const struct panfrost_compatible default_data = { .pm_domain_names = NULL, }; +static const struct panfrost_compatible amlogic_data = { + .num_supplies =ARRAY_SIZE (default_supplies), + .supply_names = default_supplies, + .vendor_quirk = panfrost_gpu_amlogic_quirk, +}; +static const struct of_device_id dt_match[] = { +/* Set first to probe before the generic compatibles */ + { .compatible ="amlogic,meson-gxm-mali" , + .data = &amlogic_data, }, + { .compatible ="amlogic,meson-g12a-mali" , + .data = &amlogic_data, }, { .compatible ="arm,mali-t604" , .data = &default_data, }, { .compatible ="arm,mali-t624" , .data = &default_data, }, { .compatible ="arm,mali-t628" , .data = &default_data, },
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 582/633 drm/panfrost: add amlogic reset quirk callback
In reply to Greg Kroah-HartmanFrom: Neil Armstrong <[email protected]>
[ Upstream commit 110003002291525bb209f47e6dbf121a63249a97 ]
The T820, G31 & G52 GPUs integrated by Amlogic in the respective GXM, G12A/SM1 & G12B SoCs needs a quirk in the PWR registers at the GPU reset time.
Since the Amlogic's integration of the GPU cores with the SoC is not publicly documented we do not know what does these values, but they permit having a fully functional GPU running with Panfrost.
--- drivers/gpu/drm/panfrost/panfrost_gpu.c | 11 +++++++++++ drivers/gpu/drm/panfrost/panfrost_gpu.h | 2 ++ drivers/gpu/drm/panfrost/panfrost_regs.h | 4 ++++ 3 files changed, 17 insertions(+)
drivers/gpu/drm/panfrost/panfrost_gpu.c +11 -0
@@ -75,6 +75,17 @@ int panfrost_gpu_soft_reset(struct panfrost_device *pfdev)return 0 ; } +void panfrost_gpu_amlogic_quirk (struct panfrost_device *pfdev) +{ +/* +* The Amlogic integrated Mali-T820, Mali-G31 & Mali-G52 needs +* these undocumented bits in GPU_PWR_OVERRIDE1 to be set in order +* to operate correctly. +*/ +gpu_write (pfdev,GPU_PWR_KEY ,GPU_PWR_KEY_UNLOCK ); +gpu_write (pfdev,GPU_PWR_OVERRIDE1 ,0xfff | (0x20 <<16 )); +} +static void panfrost_gpu_init_quirks (struct panfrost_device *pfdev) {u32 quirks =0 ;
drivers/gpu/drm/panfrost/panfrost_gpu.h +2 -0
@@ -16,4 +16,6 @@ int panfrost_gpu_soft_reset(struct panfrost_device *pfdev);void panfrost_gpu_power_on (struct panfrost_device *pfdev);void panfrost_gpu_power_off (struct panfrost_device *pfdev); +void panfrost_gpu_amlogic_quirk (struct panfrost_device *pfdev); +#endif
drivers/gpu/drm/panfrost/panfrost_regs.h +4 -0
@@ -51,6 +51,10 @@#define GPU_STATUS 0x34#define GPU_STATUS_PRFCNT_ACTIVE BIT(2)#define GPU_LATEST_FLUSH_ID 0x38 +#define GPU_PWR_KEY 0x50/* (WO) Power manager key register */ +#define GPU_PWR_KEY_UNLOCK 0x2968A819 +#define GPU_PWR_OVERRIDE0 0x54/* (RW) Power manager override settings */ +#define GPU_PWR_OVERRIDE1 0x58/* (RW) Power manager override settings */ #define GPU_FAULT_STATUS 0x3C#define GPU_FAULT_ADDRESS_LO 0x40#define GPU_FAULT_ADDRESS_HI 0x44
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 583/633 drm/panfrost: add support for vendor quirk
In reply to Greg Kroah-HartmanFrom: Neil Armstrong <[email protected]>
[ Upstream commit 91e89097b86f566636ea5a7329c79d5521be46d2 ]
The T820, G31 & G52 GPUs integrated by Amlogic in the respective GXM, G12A/SM1 & G12B SoCs needs a quirk in the PWR registers after each reset.
This adds a callback in the device compatible struct of permit this.
--- drivers/gpu/drm/panfrost/panfrost_device.h | 3 +++ drivers/gpu/drm/panfrost/panfrost_gpu.c | 4 ++++ 2 files changed, 7 insertions(+)
drivers/gpu/drm/panfrost/panfrost_device.h +3 -0
@@ -69,6 +69,9 @@ struct panfrost_compatible {int num_pm_domains;/* Only required if num_pm_domains > 1. */ const char *const *pm_domain_names; + +/* Vendor implementation quirks callback */ +void (*vendor_quirk)(struct panfrost_device *pfdev); };struct panfrost_device {
drivers/gpu/drm/panfrost/panfrost_gpu.c +4 -0
@@ -146,6 +146,10 @@ static void panfrost_gpu_init_quirks(struct panfrost_device *pfdev)if (quirks)gpu_write (pfdev,GPU_JM_CONFIG , quirks); + +/* Here goes platform specific quirks */ +if (pfdev->comp->vendor_quirk) + pfdev->comp->vendor_quirk (pfdev); }#define MAX_HW_REVS 6
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 584/633 bpf: Limit callers stack depth 256 for subprogs with tailcalls
In reply to Greg Kroah-HartmanFrom: Maciej Fijalkowski <[email protected]>
[ Upstream commit 7f6e4312e15a5c370e84eaa685879b6bdcc717e4 ]
Protect against potential stack overflow that might happen when bpf2bpf calls get combined with tailcalls. Limit the caller's stack depth for such case down to 256 so that the worst case scenario would result in 8k stack size (32 which is tailcall limit * 256 = 8k).
--- include/linux/bpf_verifier.h | 1 + kernel/bpf/verifier.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+)
include/linux/bpf_verifier.h +1 -0
@@ -358,6 +358,7 @@ struct bpf_subprog_info {u32 start;/* insn idx of function entry point */ u32 linfo_idx;/* The idx to the main_prog->aux->linfo */ u16 stack_depth;/* max. stack depth used by this function */ +bool has_tail_call; };/* single container for all structs
kernel/bpf/verifier.c +29 -0
@@ -1470,6 +1470,10 @@ static int check_subprogs(struct bpf_verifier_env *env)for (i =0 ; i < insn_cnt; i++) {u8 code = insn[i].code; +if (code == (BPF_JMP |BPF_CALL ) && + insn[i].imm == BPF_FUNC_tail_call && + insn[i].src_reg !=BPF_PSEUDO_CALL ) + subprog[cur_subprog].has_tail_call = true;if (BPF_CLASS (code) !=BPF_JMP &&BPF_CLASS (code) !=BPF_JMP32 ) goto next;if (BPF_OP (code) ==BPF_EXIT ||BPF_OP (code) ==BPF_CALL )
@@ -2951,6 +2955,31 @@ static int check_max_stack_depth(struct bpf_verifier_env *env)int ret_prog[MAX_CALL_FRAMES ]; process_func: +/* protect against potential stack overflow that might happen when +* bpf2bpf calls get combined with tailcalls. Limit the caller's stack +* depth for such case down to 256 so that the worst case scenario +* would result in 8k stack size (32 which is tailcall limit * 256 = +* 8k). +* +* To get the idea what might happen, see an example: +* func1 -> sub rsp, 128 +* subfunc1 -> sub rsp, 256 +* tailcall1 -> add rsp, 256 +* func2 -> sub rsp, 192 (total stack size = 128 + 192 = 320) +* subfunc2 -> sub rsp, 64 +* subfunc22 -> sub rsp, 128 +* tailcall2 -> add rsp, 128 +* func3 -> sub rsp, 32 (total stack size 128 + 192 + 64 + 32 = 416) +* +* tailcall will unwind the current stack frame but it will not get rid +* of caller's stack as shown on the example above. +*/ +if (idx && subprog[idx].has_tail_call && depth >=256 ) { +verbose (env, +"tail_calls are not allowed when call stack of previous frames is %d bytes. Too large\n" , + depth); +return -EACCES ; + }/* round up to 32-bytes, since this is granularity * of interpreter stack size */
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 585/633 misc: rtsx: Fix memory leak in rtsx_pci_probe
In reply to Greg Kroah-HartmanFrom: Keita Suzuki <[email protected]>
[ Upstream commit bc28369c6189009b66d9619dd9f09bd8c684bb98 ]
When mfd_add_devices() fail, pcr->slots should also be freed. However, the current implementation does not free the member, leading to a memory leak.
Fix this by adding a new goto label that frees pcr->slots.
--- drivers/misc/cardreader/rtsx_pcr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/misc/cardreader/rtsx_pcr.c +3 -1
@@ -1536,12 +1536,14 @@ static int rtsx_pci_probe(struct pci_dev *pcidev, ret =mfd_add_devices (&pcidev->dev, pcr->id, rtsx_pcr_cells,ARRAY_SIZE (rtsx_pcr_cells),NULL ,0 ,NULL );if (ret <0 ) - goto disable_irq; + goto free_slots;schedule_delayed_work (&pcr->idle_work,msecs_to_jiffies (200 ));return 0 ; +free_slots: +kfree (pcr->slots); disable_irq:free_irq (pcr->irq, (void *)pcr); disable_msi:
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 586/633 reiserfs: only call unlock_new_inode() if I_NEW
In reply to Greg Kroah-HartmanFrom: Eric Biggers <[email protected]>
[ Upstream commit 8859bf2b1278d064a139e3031451524a49a56bd0 ]
unlock_new_inode() is only meant to be called after a new inode has already been inserted into the hash table. But reiserfs_new_inode() can call it even before it has inserted the inode, triggering the WARNING in unlock_new_inode(). Fix this by only calling unlock_new_inode() if the inode has the I_NEW flag set, indicating that it's in the table.
This addresses the syzbot report "WARNING in unlock_new_inode"
(https://syzkaller.appspot.com/bug?extid=187510916eb6a14598f7).
--- fs/reiserfs/inode.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/reiserfs/inode.c +2 -1
@@ -2159,7 +2159,8 @@ int reiserfs_new_inode(struct reiserfs_transaction_handle *th, out_inserted_sd:clear_nlink (inode); th->t_trans_id =0 ;/* so the caller can't use this handle later */ -unlock_new_inode (inode);/* OK to do even if we hadn't locked it */ +if (inode->i_state &I_NEW ) +unlock_new_inode (inode);iput (inode);return err; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 587/633 opp: Prevent memory leak in dev_pm_opp_attach_genpd()
In reply to Greg Kroah-HartmanFrom: Viresh Kumar <[email protected]>
[ Upstream commit cb60e9602cce1593eb1e9cdc8ee562815078a354 ]
If dev_pm_opp_attach_genpd() is called multiple times (once for each CPU sharing the table), then it would result in unwanted behavior like memory leak, attaching the domain multiple times, etc.
Handle that by checking and returning earlier if the domains are already attached. Now that dev_pm_opp_detach_genpd() can get called multiple times as well, we need to protect that too.
Note that the virtual device pointers aren't returned in this case, as they may become unavailable to some callers during the middle of the operation.
--- drivers/opp/core.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/opp/core.c +6 -0
@@ -1918,6 +1918,9 @@ static void _opp_detach_genpd(struct opp_table *opp_table) {int index; +if (!opp_table->genpd_virt_devs) +return ; +for (index =0 ; index < opp_table->required_opp_count; index++) {if (!opp_table->genpd_virt_devs[index])continue ;
@@ -1964,6 +1967,9 @@ struct opp_table *dev_pm_opp_attach_genpd(struct device *dev,if (!opp_table)return ERR_PTR (-ENOMEM ); +if (opp_table->genpd_virt_devs) +return opp_table; +/* * If the genpd's OPP table isn't already initialized, parsing of the * required-opps fail for dev. We should retry this after genpd's OPP
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 588/633 xfs: make sure the rt allocator doesnt run off the end
In reply to Greg Kroah-HartmanFrom: Darrick J. Wong <[email protected]>
[ Upstream commit 2a6ca4baed620303d414934aa1b7b0a8e7bab05f ]
There's an overflow bug in the realtime allocator. If the rt volume is large enough to handle a single allocation request that is larger than the maximum bmap extent length and the rt bitmap ends exactly on a bitmap block boundary, it's possible that the near allocator will try to check the freeness of a range that extends past the end of the bitmap. This fails with a corruption error and shuts down the fs.
Therefore, constrain maxlen so that the range scan cannot run off the end of the rt bitmap.
--- fs/xfs/xfs_rtalloc.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
fs/xfs/xfs_rtalloc.c +11 -0
@@ -247,6 +247,9 @@ xfs_rtallocate_extent_block( end =XFS_BLOCKTOBIT (mp, bbno +1 ) -1 ; i <= end; i++) { +/* Make sure we don't scan off the end of the rt volume. */ + maxlen =min (mp->m_sb.sb_rextents, i + maxlen) - i; +/* * See if there's a free extent of maxlen starting at i. * If it's not so then next will contain the first non-free.
@@ -442,6 +445,14 @@ xfs_rtallocate_extent_near(*/ if (bno >= mp->m_sb.sb_rextents) bno = mp->m_sb.sb_rextents -1 ; + +/* Make sure we don't run off the end of the rt volume. */ + maxlen =min (mp->m_sb.sb_rextents, bno + maxlen) - bno; +if (maxlen < minlen) { + *rtblock =NULLRTBLOCK ; +return 0 ; + } +/* * Try the exact allocation first. */
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 589/633 usb: ohci: Default to per-port over-current protection
In reply to Greg Kroah-HartmanFrom: Hamish Martin <[email protected]>
[ Upstream commit b77d2a0a223bc139ee8904991b2922d215d02636 ]
Some integrated OHCI controller hubs do not expose all ports of the hub to pins on the SoC. In some cases the unconnected ports generate spurious over-current events. For example the Broadcom 56060/Ranger 2 SoC contains a nominally 3 port hub but only the first port is wired.
Default behaviour for ohci-platform driver is to use global over-current protection mode (AKA "ganged"). This leads to the spurious over-current events affecting all ports in the hub.
We now alter the default to use per-port over-current protection.
This patch results in the following configuration changes depending on quirks:
- For quirk OHCI_QUIRK_SUPERIO no changes. These systems remain set up for ganged power switching and no over-current protection.
- For quirk OHCI_QUIRK_AMD756 or OHCI_QUIRK_HUB_POWER power switching remains at none, while over-current protection is now guaranteed to be set to per-port rather than the previous behaviour where it was either none or global over-current protection depending on the value at function entry.
--- drivers/usb/host/ohci-hcd.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
drivers/usb/host/ohci-hcd.c +10 -6
@@ -673,20 +673,24 @@ static int ohci_run (struct ohci_hcd *ohci)/* handle root hub init quirks ... */ val =roothub_a (ohci); - val &= ~(RH_A_PSM |RH_A_OCPM ); +/* Configure for per-port over-current protection by default */ + val &= ~RH_A_NOCP ; + val |=RH_A_OCPM ;if (ohci->flags &OHCI_QUIRK_SUPERIO ) { -/* NSC 87560 and maybe others */ +/* NSC 87560 and maybe others. +* Ganged power switching, no over-current protection. +*/ val |=RH_A_NOCP ; - val &= ~(RH_A_POTPGT |RH_A_NPS ); -ohci_writel (ohci, val, &ohci->regs->roothub.a); + val &= ~(RH_A_POTPGT |RH_A_NPS |RH_A_PSM |RH_A_OCPM ); }else if ((ohci->flags &OHCI_QUIRK_AMD756 ) || (ohci->flags &OHCI_QUIRK_HUB_POWER )) {/* hub power always on; required for AMD-756 and some -* Mac platforms. ganged overcurrent reporting, if any. +* Mac platforms. */ val |=RH_A_NPS ; -ohci_writel (ohci, val, &ohci->regs->roothub.a); } +ohci_writel (ohci, val, &ohci->regs->roothub.a); +ohci_writel (ohci,RH_HS_LPSC , &ohci->regs->roothub.status);ohci_writel (ohci, (val &RH_A_NPS ) ?0 :RH_B_PPCM , &ohci->regs->roothub.b);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 590/633 drm: fix double free for gbo in drm_gem_vram_init and drm_gem_vram_create
In reply to Greg Kroah-HartmanFrom: Jia Yang <[email protected]>
[ Upstream commit da62cb7230f0871c30dc9789071f63229158d261 ]
I got a use-after-free report when doing some fuzz test:
If ttm_bo_init() fails, the "gbo" and "gbo->bo.base" will be freed by ttm_buffer_object_destroy() in ttm_bo_init(). But then drm_gem_vram_create() and drm_gem_vram_init() will free "gbo" and "gbo->bo.base" again.
BUG: KMSAN: use-after-free in drm_vma_offset_remove+0xb3/0x150 CPU: 0 PID: 24282 Comm: syz-executor.1 Tainted: G B W 5.7.0-rc4-msan #2 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Ubuntu-1.8.2-1ubuntu1 04/01/2014 Call Trace: __dump_stack dump_stack+0x1c9/0x220 kmsan_report+0xf7/0x1e0 __msan_warning+0x58/0xa0 drm_vma_offset_remove+0xb3/0x150 drm_gem_free_mmap_offset drm_gem_object_release+0x159/0x180 drm_gem_vram_init drm_gem_vram_create+0x7c5/0x990 drm_gem_vram_fill_create_dumb drm_gem_vram_driver_dumb_create+0x238/0x590 drm_mode_create_dumb drm_mode_create_dumb_ioctl+0x41d/0x450 drm_ioctl_kernel+0x5a4/0x710 drm_ioctl+0xc6f/0x1240 vfs_ioctl ksys_ioctl __do_sys_ioctl __se_sys_ioctl+0x2e9/0x410 __x64_sys_ioctl+0x4a/0x70 do_syscall_64+0xb8/0x160 entry_SYSCALL_64_after_hwframe+0x44/0xa9 RIP: 0033:0x4689b9 Code: fd e0 fa ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 cb e0 fa ff c3 66 2e 0f 1f 84 00 00 00 00 RSP: 002b:00007f368fa4dc98 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 000000000076bf00 RCX: 00000000004689b9 RDX: 0000000020000240 RSI: 00000000c02064b2 RDI: 0000000000000003 RBP: 0000000000000004 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00000000004d17e0 R14: 00007f368fa4e6d4 R15: 000000000076bf0c
Uninit was created at:
kmsan_save_stack_with_flags
kmsan_internal_poison_shadow+0x66/0xd0 kmsan_slab_free+0x6e/0xb0 slab_free_freelist_hook slab_free kfree+0x571/0x30a0 drm_gem_vram_destroy ttm_buffer_object_destroy+0xc8/0x130 ttm_bo_release kref_put ttm_bo_put+0x117d/0x23e0 ttm_bo_init_reserved+0x11c0/0x11d0 ttm_bo_init+0x289/0x3f0 drm_gem_vram_init drm_gem_vram_create+0x775/0x990 drm_gem_vram_fill_create_dumb drm_gem_vram_driver_dumb_create+0x238/0x590 drm_mode_create_dumb drm_mode_create_dumb_ioctl+0x41d/0x450 drm_ioctl_kernel+0x5a4/0x710 drm_ioctl+0xc6f/0x1240 vfs_ioctl ksys_ioctl __do_sys_ioctl __se_sys_ioctl+0x2e9/0x410 __x64_sys_ioctl+0x4a/0x70 do_syscall_64+0xb8/0x160 entry_SYSCALL_64_after_hwframe+0x44/0xa9
If ttm_bo_init() fails, the "gbo" will be freed by ttm_buffer_object_destroy() in ttm_bo_init(). But then drm_gem_vram_create() and drm_gem_vram_init() will free "gbo" again.
--- drivers/gpu/drm/drm_gem_vram_helper.c | 28 +++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-)
drivers/gpu/drm/drm_gem_vram_helper.c +16 -12
@@ -175,6 +175,10 @@ static void drm_gem_vram_placement(struct drm_gem_vram_object *gbo, } } +/* +* Note that on error, drm_gem_vram_init will free the buffer object. +*/ +static int drm_gem_vram_init (struct drm_device *dev,struct drm_gem_vram_object *gbo,size_t size,unsigned long pg_align)
@@ -184,15 +188,19 @@ static int drm_gem_vram_init(struct drm_device *dev,int ret;size_t acc_size; -if (WARN_ONCE (!vmm,"VRAM MM not initialized" )) +if (WARN_ONCE (!vmm,"VRAM MM not initialized" )) { +kfree (gbo);return -EINVAL ; + } bdev = &vmm->bdev; gbo->bo.base.funcs = &drm_gem_vram_object_funcs; ret =drm_gem_object_init (dev, &gbo->bo.base, size); -if (ret) +if (ret) { +kfree (gbo);return ret; + } acc_size =ttm_bo_dma_acc_size (bdev, size,sizeof (*gbo));
@@ -203,13 +211,13 @@ static int drm_gem_vram_init(struct drm_device *dev, &gbo->placement, pg_align, false, acc_size, NULL, NULL, ttm_buffer_object_destroy);if (ret) - goto err_drm_gem_object_release; +/* +* A failing ttm_bo_init will call ttm_buffer_object_destroy +* to release gbo->bo.base and kfree gbo. +*/ +return ret;return 0 ; - -err_drm_gem_object_release: -drm_gem_object_release (&gbo->bo.base); -return ret; }/**
@@ -243,13 +251,9 @@ struct drm_gem_vram_object *drm_gem_vram_create(struct drm_device *dev, ret =drm_gem_vram_init (dev, gbo, size, pg_align);if (ret <0 ) - goto err_kfree; +return ERR_PTR (ret);return gbo; - -err_kfree: -kfree (gbo); -return ERR_PTR (ret); }EXPORT_SYMBOL (drm_gem_vram_create);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 591/633 Bluetooth: Only mark socket zapped after unlocking
In reply to Greg Kroah-HartmanFrom: Abhishek Pandit-Subedi <[email protected]>
[ Upstream commit 20ae4089d0afeb24e9ceb026b996bfa55c983cc2 ]
Since l2cap_sock_teardown_cb doesn't acquire the channel lock before setting the socket as zapped, it could potentially race with l2cap_sock_release which frees the socket. Thus, wait until the cleanup is complete before marking the socket as zapped.
This race was reproduced on a JBL GO speaker after the remote device rejected L2CAP connection due to resource unavailability.
Here is a dmesg log with debug logs from a repro of this bug:
[ 3465.424086] Bluetooth: hci_core.c:hci_acldata_packet() hci0 len 16 handle 0x0003 flags 0x0002 [ 3465.424090] Bluetooth: hci_conn.c:hci_conn_enter_active_mode() hcon 00000000cfedd07d mode 0 [ 3465.424094] Bluetooth: l2cap_core.c:l2cap_recv_acldata() conn 000000007eae8952 len 16 flags 0x2 [ 3465.424098] Bluetooth: l2cap_core.c:l2cap_recv_frame() len 12, cid 0x0001 [ 3465.424102] Bluetooth: l2cap_core.c:l2cap_raw_recv() conn 000000007eae8952 [ 3465.424175] Bluetooth: l2cap_core.c:l2cap_sig_channel() code 0x03 len 8 id 0x0c [ 3465.424180] Bluetooth: l2cap_core.c:l2cap_connect_create_rsp() dcid 0x0045 scid 0x0000 result 0x02 status 0x00 [ 3465.424189] Bluetooth: l2cap_core.c:l2cap_chan_put() chan 000000006acf9bff orig refcnt 4 [ 3465.424196] Bluetooth: l2cap_core.c:l2cap_chan_del() chan 000000006acf9bff, conn 000000007eae8952, err 111, state BT_CONNECT [ 3465.424203] Bluetooth: l2cap_sock.c:l2cap_sock_teardown_cb() chan 000000006acf9bff state BT_CONNECT [ 3465.424221] Bluetooth: l2cap_core.c:l2cap_chan_put() chan 000000006acf9bff orig refcnt 3 [ 3465.424226] Bluetooth: hci_core.h:hci_conn_drop() hcon 00000000cfedd07d orig refcnt 6 [ 3465.424234] BUG: spinlock bad magic on CPU#2, kworker/u17:0/159 [ 3465.425626] Bluetooth: hci_sock.c:hci_sock_sendmsg() sock 000000002bb0cb64 sk 00000000a7964053 [ 3465.430330] lock: 0xffffff804410aac0, .magic: 00000000, .owner: <none>/-1, .owner_cpu: 0 [ 3465.430332] Causing a watchdog bite!
--- net/bluetooth/l2cap_sock.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
net/bluetooth/l2cap_sock.c +4 -3
@@ -1521,8 +1521,6 @@ static void l2cap_sock_teardown_cb(struct l2cap_chan *chan, int err) parent =bt_sk (sk)->parent; -sock_set_flag (sk,SOCK_ZAPPED ); -switch (chan->state) {case BT_OPEN :case BT_BOUND :
@@ -1549,8 +1547,11 @@ static void l2cap_sock_teardown_cb(struct l2cap_chan *chan, int err)break ; } -release_sock (sk); + +/* Only zap after cleanup to avoid use after free race */ +sock_set_flag (sk,SOCK_ZAPPED ); + } static void l2cap_sock_state_change_cb(struct l2cap_chan *chan, int state,
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 592/633 drm/msm/a6xx: fix a potential overflow issue
In reply to Greg Kroah-HartmanFrom: Zhenzhong Duan <[email protected]>
[ Upstream commit 08d3ab4b46339bc6f97e83b54a3fb4f8bf8f4cd9 ]
It's allocating an array of a6xx_gpu_state_obj structure rathor than its pointers.
This patch fix it.
--- drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c +1 -1
@@ -864,7 +864,7 @@ static void a6xx_get_indexed_registers(struct msm_gpu *gpu,int i; a6xx_state->indexed_regs =state_kcalloc (a6xx_state, count, -sizeof (a6xx_state->indexed_regs)); +sizeof (*a6xx_state->indexed_regs));if (!a6xx_state->indexed_regs)return ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 593/633 iomap: fix WARN_ON_ONCE() from unprivileged users
In reply to Greg Kroah-HartmanFrom: Qian Cai <[email protected]>
[ Upstream commit a805c111650cdba6ee880f528abdd03c1af82089 ]
It is trivial to trigger a WARN_ON_ONCE(1) in iomap_dio_actor() by unprivileged users which would taint the kernel, or worse - panic if panic_on_warn or panic_on_taint is set. Hence, just convert it to pr_warn_ratelimited() to let users know their workloads are racing. Thank Dave Chinner for the initial analysis of the racing reproducers.
--- fs/iomap/direct-io.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
fs/iomap/direct-io.c +10 -0
@@ -387,6 +387,16 @@ iomap_dio_actor(struct inode *inode, loff_t pos, loff_t length,return iomap_dio_bio_actor (inode, pos, length, dio, iomap);case IOMAP_INLINE :return iomap_dio_inline_actor (inode, pos, length, dio, iomap); +case IOMAP_DELALLOC : +/* +* DIO is not serialised against mmap() access at all, and so +* if the page_mkwrite occurs between the writeback and the +* iomap_apply() call in the DIO path, then it will see the +* DELALLOC block that the page-mkwrite allocated. +*/ +pr_warn_ratelimited ("Direct I/O collision with buffered writes! File: %pD4 Comm: %.20s\n" , + dio->iocb->ki_filp, current->comm); +return -EIO ;default :WARN_ON_ONCE (1 );return -EIO ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 594/633 scsi: ibmvfc: Fix error return in ibmvfc_probe()
In reply to Greg Kroah-HartmanFrom: Jing Xiangfeng <[email protected]>
[ Upstream commit 5e48a084f4e824e1b624d3fd7ddcf53d2ba69e53 ]
Fix to return error code PTR_ERR() from the error handling case instead of 0.
--- drivers/scsi/ibmvscsi/ibmvfc.c | 1 + 1 file changed, 1 insertion(+)
drivers/scsi/ibmvscsi/ibmvfc.c +1 -0
@@ -4928,6 +4928,7 @@ static int ibmvfc_probe(struct vio_dev *vdev, const struct vio_device_id *id)if (IS_ERR (vhost->work_thread)) {dev_err (dev,"Couldn't create kernel thread: %ld\n" ,PTR_ERR (vhost->work_thread)); + rc =PTR_ERR (vhost->work_thread); goto free_host_mem; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 595/633 scsi: qla2xxx: Warn if done() or free() are called on an already freed srb
In reply to Greg Kroah-HartmanFrom: Daniel Wagner <[email protected]>
[ Upstream commit c0014f94218ea3a312f6235febea0d626c5f2154 ]
Emit a warning when ->done or ->free are called on an already freed srb. There is a hidden use-after-free bug in the driver which corrupts the srb memory pool which originates from the cleanup callbacks.
An extensive search didn't bring any lights on the real problem. The initial fix was to set both pointers to NULL and try to catch invalid accesses. But instead the memory corruption was gone and the driver didn't crash. Since not all calling places check for NULL pointer, add explicitly default handlers. With this we workaround the memory corruption and add a debug help.
--- drivers/scsi/qla2xxx/qla_init.c | 10 ++++++++++ drivers/scsi/qla2xxx/qla_inline.h | 5 +++++ 2 files changed, 15 insertions(+)
drivers/scsi/qla2xxx/qla_init.c +10 -0
@@ -63,6 +63,16 @@ void qla2x00_sp_free(srb_t *sp)qla2x00_rel_sp (sp); } +void qla2xxx_rel_done_warning (srb_t *sp,int res) +{ +WARN_ONCE (1 ,"Calling done() of an already freed srb %p object\n" , sp); +} + +void qla2xxx_rel_free_warning (srb_t *sp) +{ +WARN_ONCE (1 ,"Calling free() of an already freed srb %p object\n" , sp); +} +/* Asynchronous Login/Logout Routines -------------------------------------- */ unsigned long
drivers/scsi/qla2xxx/qla_inline.h +5 -0
@@ -207,10 +207,15 @@ qla2xxx_get_qpair_sp(scsi_qla_host_t *vha, struct qla_qpair *qpair,return sp; } +void qla2xxx_rel_done_warning (srb_t *sp,int res); +void qla2xxx_rel_free_warning (srb_t *sp); +static inline void qla2xxx_rel_qpair_sp (struct qla_qpair *qpair,srb_t *sp) { sp->qpair =NULL ; + sp->done = qla2xxx_rel_done_warning; + sp->free = qla2xxx_rel_free_warning;mempool_free (sp, qpair->srb_mempool);QLA_QPAIR_MARK_NOT_BUSY (qpair); }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 596/633 selftests/bpf: Fix test_sysctl_loop{1, 2} failure due to clang change
In reply to Greg Kroah-HartmanFrom: Yonghong Song <[email protected]>
[ Upstream commit 7fb5eefd76394cfefb380724a87ca40b47d44405 ]
Andrii reported that with latest clang, when building selftests, we have
error likes:
error: progs/test_sysctl_loop1.c:23:16: in function sysctl_tcp_mem i32 (%struct.bpf_sysctl*):
Looks like the BPF stack limit of 512 bytes is exceeded.
Please move large on stack variables into BPF per-cpu array map.
The error is triggered by the following LLVM patch:
https://reviews.llvm.org/D87134
For example, the following code is from test_sysctl_loop1.c:
static __always_inline int is_tcp_mem(struct bpf_sysctl *ctx)
{
volatile char tcp_mem_name[] = "net/ipv4/tcp_mem/very_very_very_very_long_pointless_string";
... }
Without the above LLVM patch, the compiler did optimization to load the string (59 bytes long) with 7 64bit loads, 1 8bit load and 1 16bit load, occupying 64 byte stack size.
With the above LLVM patch, the compiler only uses 8bit loads, but subregister is 32bit. So stack requirements become 4 * 59 = 236 bytes. Together with other stuff on the stack, total stack size exceeds 512 bytes, hence compiler complains and quits.
To fix the issue, removing "volatile" key word or changing "volatile" to "const"/"static const" does not work, the string is put in .rodata.str1.1 section, which libbpf did not process it and errors out with
libbpf: elf: skipping unrecognized data section(6) .rodata.str1.1
libbpf: prog 'sysctl_tcp_mem': bad map relo against '.L__const.is_tcp_mem.tcp_mem_name'
in section '.rodata.str1.1'
Defining the string const as global variable can fix the issue as it puts the string constant in '.rodata' section which is recognized by libbpf. In the future, when libbpf can process '.rodata.str*.*' properly, the global definition can be changed back to local definition.
Defining tcp_mem_name as a global, however, triggered a verifier failure.
./test_progs -n 7/21
libbpf: load bpf program failed: Permission denied
libbpf: -- BEGIN DUMP LOG ---
libbpf:
invalid stack off=0 size=1
verification time 6975 usec
stack depth 160+64
processed 889 insns (limit 1000000) max_states_per_insn 4 total_states 14 peak_states 14 mark_read 10
libbpf: -- END LOG --
libbpf: failed to load program 'sysctl_tcp_mem'
libbpf: failed to load object 'test_sysctl_loop2.o' test_bpf_verif_scale:FAIL:114
#7/21 test_sysctl_loop2.o:FAIL
This actually exposed a bpf program bug. In test_sysctl_loop{1,2}, we have code like
const char tcp_mem_name[] = "<...long string...>";
...
char name[64];
...
for (i = 0; i < sizeof(tcp_mem_name); ++i)
if (name[i] != tcp_mem_name[i])
return 0;In the above code, if sizeof(tcp_mem_name) > 64, name[i] access may be out of bound. The sizeof(tcp_mem_name) is 59 for test_sysctl_loop1.c and 79 for test_sysctl_loop2.c.
Without promotion-to-global change, old compiler generates code where the overflowed stack access is actually filled with valid value, so hiding the bpf program bug. With promotion-to-global change, the code is different, more specifically, the previous loading constants to stack is gone, and "name" occupies stack[-64:0] and overflow access triggers a verifier error. To fix the issue, adjust "name" buffer size properly.
--- tools/testing/selftests/bpf/progs/test_sysctl_loop1.c | 4 ++-- tools/testing/selftests/bpf/progs/test_sysctl_loop2.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
tools/testing/selftests/bpf/progs/test_sysctl_loop1.c +2 -2
@@ -18,11 +18,11 @@#define MAX_ULONG_STR_LEN 7#define MAX_VALUE_STR_LEN (TCP_MEM_LOOPS * MAX_ULONG_STR_LEN) +const char tcp_mem_name[] ="net/ipv4/tcp_mem/very_very_very_very_long_pointless_string" ; static __always_inline int is_tcp_mem(struct bpf_sysctl *ctx) { -volatile char tcp_mem_name[] ="net/ipv4/tcp_mem/very_very_very_very_long_pointless_string" ;unsigned char i; -char name[64 ]; +char name[sizeof (tcp_mem_name)];int ret;memset (name,0 ,sizeof (name));
tools/testing/selftests/bpf/progs/test_sysctl_loop2.c +2 -2
@@ -18,11 +18,11 @@#define MAX_ULONG_STR_LEN 7#define MAX_VALUE_STR_LEN (TCP_MEM_LOOPS * MAX_ULONG_STR_LEN) +const char tcp_mem_name[] ="net/ipv4/tcp_mem/very_very_very_very_long_pointless_string_to_stress_byte_loop" ;static __attribute__((noinline))int is_tcp_mem (struct bpf_sysctl *ctx) { -volatile char tcp_mem_name[] ="net/ipv4/tcp_mem/very_very_very_very_long_pointless_string_to_stress_byte_loop" ;unsigned char i; -char name[64 ]; +char name[sizeof (tcp_mem_name)];int ret;memset (name,0 ,sizeof (name));
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 597/633 brcmsmac: fix memory leak in wlc_phy_attach_lcnphy
In reply to Greg Kroah-HartmanFrom: Keita Suzuki <[email protected]>
[ Upstream commit f4443293d741d1776b86ed1dd8c4e4285d0775fc ]
When wlc_phy_txpwr_srom_read_lcnphy fails in wlc_phy_attach_lcnphy, the allocated pi->u.pi_lcnphy is leaked, since struct brcms_phy will be freed in the caller function.
Fix this by calling wlc_phy_detach_lcnphy in the error handler of wlc_phy_txpwr_srom_read_lcnphy before returning.
--- .../net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_lcn.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_lcn.c +3 -1
@@ -5065,8 +5065,10 @@ bool wlc_phy_attach_lcnphy(struct brcms_phy *pi) pi->pi_fptr.radioloftget = wlc_lcnphy_get_radio_loft; pi->pi_fptr.detach = wlc_phy_detach_lcnphy; -if (!wlc_phy_txpwr_srom_read_lcnphy (pi)) +if (!wlc_phy_txpwr_srom_read_lcnphy (pi)) { +kfree (pi->u.pi_lcnphy);return false; + }if (LCNREV_IS (pi->pubpi.phy_rev,1 )) {if (pi_lcn->lcnphy_tempsense_option ==3 ) {
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 598/633 rtl8xxxu: prevent potential memory leak
In reply to Greg Kroah-HartmanFrom: Chris Chiu <[email protected]>
[ Upstream commit 86279456a4d47782398d3cb8193f78f672e36cac ]
Free the skb if usb_submit_urb fails on rx_urb. And free the urb no matter usb_submit_urb succeeds or not in rtl8xxxu_submit_int_urb.
--- drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +9 -1
@@ -5795,7 +5795,6 @@ static int rtl8xxxu_submit_int_urb(struct ieee80211_hw *hw) ret =usb_submit_urb (urb,GFP_KERNEL );if (ret) {usb_unanchor_urb (urb); -usb_free_urb (urb); goto error; }
@@ -5804,6 +5803,7 @@ static int rtl8xxxu_submit_int_urb(struct ieee80211_hw *hw)rtl8xxxu_write32 (priv,REG_USB_HIMR , val32); error: +usb_free_urb (urb);return ret; }
@@ -6318,6 +6318,7 @@ static int rtl8xxxu_start(struct ieee80211_hw *hw)struct rtl8xxxu_priv *priv = hw->priv;struct rtl8xxxu_rx_urb *rx_urb;struct rtl8xxxu_tx_urb *tx_urb; +struct sk_buff *skb;unsigned long flags;int ret, i;
@@ -6368,6 +6369,13 @@ static int rtl8xxxu_start(struct ieee80211_hw *hw) rx_urb->hw = hw; ret =rtl8xxxu_submit_rx_urb (priv, rx_urb); +if (ret) { +if (ret != -ENOMEM ) { + skb = (struct sk_buff *)rx_urb->urb.context; +dev_kfree_skb (skb); + } +rtl8xxxu_queue_rx_urb (priv, rx_urb); + } }schedule_delayed_work (&priv->ra_watchdog,2 *HZ );
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 599/633 Fix use after free in get_capset_info callback.
In reply to Greg Kroah-HartmanFrom: Doug Horn <[email protected]>
[ Upstream commit e219688fc5c3d0d9136f8d29d7e0498388f01440 ]
If a response to virtio_gpu_cmd_get_capset_info takes longer than five seconds to return, the callback will access freed kernel memory in vg->capsets.
--- drivers/gpu/drm/virtio/virtgpu_kms.c | 2 ++ drivers/gpu/drm/virtio/virtgpu_vq.c | 10 +++++++--- 2 files changed, 9 insertions(+), 3 deletions(-)
drivers/gpu/drm/virtio/virtgpu_kms.c +2 -0
@@ -80,8 +80,10 @@ static void virtio_gpu_get_capsets(struct virtio_gpu_device *vgdev, vgdev->capsets[i].id > 0, 5 * HZ);if (ret ==0 ) {DRM_ERROR ("timed out waiting for cap set %d\n" , i); +spin_lock (&vgdev->display_info_lock);kfree (vgdev->capsets); vgdev->capsets =NULL ; +spin_unlock (&vgdev->display_info_lock);return ; } DRM_INFO("cap set %d: id %d, max-version %d, max-size %d\n",
drivers/gpu/drm/virtio/virtgpu_vq.c +7 -3
@@ -684,9 +684,13 @@ static void virtio_gpu_cmd_get_capset_info_cb(struct virtio_gpu_device *vgdev,int i =le32_to_cpu (cmd->capset_index);spin_lock (&vgdev->display_info_lock); - vgdev->capsets[i].id =le32_to_cpu (resp->capset_id); - vgdev->capsets[i].max_version =le32_to_cpu (resp->capset_max_version); - vgdev->capsets[i].max_size =le32_to_cpu (resp->capset_max_size); +if (vgdev->capsets) { + vgdev->capsets[i].id =le32_to_cpu (resp->capset_id); + vgdev->capsets[i].max_version =le32_to_cpu (resp->capset_max_version); + vgdev->capsets[i].max_size =le32_to_cpu (resp->capset_max_size); + }else { +DRM_ERROR ("invalid capset memory." ); + }spin_unlock (&vgdev->display_info_lock);wake_up (&vgdev->resp_wq); }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 600/633 HID: ite: Add USB id match for Acer One S1003 keyboard dock
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit 5bf2f2f331ad812c9b7eea6e14a3ea328acbffc0 ]
The Acer One S1003 2-in-1 keyboard dock uses a Synaptics S910xx touchpad which is connected to an ITE 8910 USB keyboard controller chip.
This keyboard has the same quirk for its rfkill / airplane mode hotkey as other keyboards with ITE keyboard chips, it only sends a single release event when pressed and released, it never sends a press event.
This commit adds this keyboards USB id to the hid-ite id-table, fixing the rfkill key not working on this keyboard. Note that like for the Acer Aspire Switch 10 (SW5-012) the id-table entry matches on the HID_GROUP_GENERIC generic group so that hid-ite only binds to the keyboard interface and the mouse/touchpad interface is left untouched so that hid-multitouch can bind to it.
--- drivers/hid/hid-ids.h | 1 + drivers/hid/hid-ite.c | 4 ++++ 2 files changed, 5 insertions(+)
drivers/hid/hid-ids.h +1 -0
@@ -1123,6 +1123,7 @@#define USB_DEVICE_ID_SYNAPTICS_DELL_K12A 0x2819#define USB_DEVICE_ID_SYNAPTICS_ACER_SWITCH5_012 0x2968#define USB_DEVICE_ID_SYNAPTICS_TP_V103 0x5710 +#define USB_DEVICE_ID_SYNAPTICS_ACER_ONE_S1003 0x73f5#define USB_DEVICE_ID_SYNAPTICS_ACER_SWITCH5 0x81a7#define USB_VENDOR_ID_TEXAS_INSTRUMENTS 0x2047
drivers/hid/hid-ite.c +4 -0
@@ -44,6 +44,10 @@ static const struct hid_device_id ite_devices[] = { {HID_DEVICE (BUS_USB ,HID_GROUP_GENERIC ,USB_VENDOR_ID_SYNAPTICS , USB_DEVICE_ID_SYNAPTICS_ACER_SWITCH5_012) }, +/* ITE8910 USB kbd ctlr, with Synaptics touchpad connected to it. */ + { HID_DEVICE(BUS_USB, HID_GROUP_GENERIC, +USB_VENDOR_ID_SYNAPTICS , + USB_DEVICE_ID_SYNAPTICS_ACER_ONE_S1003) }, { } };MODULE_DEVICE_TABLE (hid, ite_devices);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 601/633 scsi: qedf: Return SUCCESS if stale rport is encountered
In reply to Greg Kroah-HartmanFrom: Saurav Kashyap <[email protected]>
[ Upstream commit 10aff62fab263ad7661780816551420cea956ebb ]
If SUCCESS is not returned, error handling will escalate. Return SUCCESS similar to other conditions in this function.
--- drivers/scsi/qedf/qedf_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/qedf/qedf_main.c +1 -1
@@ -704,7 +704,7 @@ static int qedf_eh_abort(struct scsi_cmnd *sc_cmd) rdata = fcport->rdata;if (!rdata || !kref_get_unless_zero (&rdata->kref)) {QEDF_ERR (&qedf->dbg_ctx,"stale rport, sc_cmd=%p\n" , sc_cmd); - rc =1 ; + rc =SUCCESS ; goto out; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 602/633 scsi: qedi: Mark all connections for recovery on link down event
In reply to Greg Kroah-HartmanFrom: Nilesh Javali <[email protected]>
[ Upstream commit 4118879be3755b38171063dfd4a57611d4b20a83 ]
For short time cable pulls, the in-flight I/O to the firmware is never cleaned up, resulting in the behaviour of stale I/O completion causing list_del corruption and soft lockup of the system.
On link down event, mark all the connections for recovery, causing cleanup of all the in-flight I/O immediately.
--- drivers/scsi/qedi/qedi_main.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/scsi/qedi/qedi_main.c +10 -0
@@ -1127,6 +1127,15 @@ static void qedi_schedule_recovery_handler(void *dev)schedule_delayed_work (&qedi->recovery_work,0 ); } +static void qedi_set_conn_recovery (struct iscsi_cls_session *cls_session) +{ +struct iscsi_session *session = cls_session->dd_data; +struct iscsi_conn *conn = session->leadconn; +struct qedi_conn *qedi_conn = conn->dd_data; + +qedi_start_conn_recovery (qedi_conn->qedi, qedi_conn); +} +static void qedi_link_update (void *dev,struct qed_link_output *link) {struct qedi_ctx *qedi = (struct qedi_ctx *)dev;
@@ -1138,6 +1147,7 @@ static void qedi_link_update(void *dev, struct qed_link_output *link)QEDI_INFO (&qedi->dbg_ctx,QEDI_LOG_INFO ,"Link Down event.\n" );atomic_set (&qedi->link_state,QEDI_LINK_DOWN ); +iscsi_host_for_each_session (qedi->shost, qedi_set_conn_recovery); } }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 603/633 scsi: qedi: Protect active command list to avoid list corruption
In reply to Greg Kroah-HartmanFrom: Nilesh Javali <[email protected]>
[ Upstream commit c0650e28448d606c84f76c34333dba30f61de993 ]
Protect active command list for non-I/O commands like login response, logout response, text response, and recovery cleanup of active list to avoid list corruption.
--- drivers/scsi/qedi/qedi_fw.c | 8 ++++++++ drivers/scsi/qedi/qedi_iscsi.c | 2 ++ 2 files changed, 10 insertions(+)
drivers/scsi/qedi/qedi_fw.c +8 -0
@@ -59,6 +59,7 @@ static void qedi_process_logout_resp(struct qedi_ctx *qedi,"Freeing tid=0x%x for cid=0x%x\n" , cmd->task_id, qedi_conn->iscsi_conn_id); +spin_lock (&qedi_conn->list_lock);if (likely (cmd->io_cmd_in_list)) { cmd->io_cmd_in_list = false;list_del_init (&cmd->io_cmd);
@@ -69,6 +70,7 @@ static void qedi_process_logout_resp(struct qedi_ctx *qedi, cmd->task_id, qedi_conn->iscsi_conn_id, &cmd->io_cmd); } +spin_unlock (&qedi_conn->list_lock); cmd->state =RESPONSE_RECEIVED ;qedi_clear_task_idx (qedi, cmd->task_id);
@@ -122,6 +124,7 @@ static void qedi_process_text_resp(struct qedi_ctx *qedi,"Freeing tid=0x%x for cid=0x%x\n" , cmd->task_id, qedi_conn->iscsi_conn_id); +spin_lock (&qedi_conn->list_lock);if (likely (cmd->io_cmd_in_list)) { cmd->io_cmd_in_list = false;list_del_init (&cmd->io_cmd);
@@ -132,6 +135,7 @@ static void qedi_process_text_resp(struct qedi_ctx *qedi, cmd->task_id, qedi_conn->iscsi_conn_id, &cmd->io_cmd); } +spin_unlock (&qedi_conn->list_lock); cmd->state =RESPONSE_RECEIVED ;qedi_clear_task_idx (qedi, cmd->task_id);
@@ -222,11 +226,13 @@ static void qedi_process_tmf_resp(struct qedi_ctx *qedi, tmf_hdr = (struct iscsi_tm *)qedi_cmd->task->hdr; +spin_lock (&qedi_conn->list_lock);if (likely (qedi_cmd->io_cmd_in_list)) { qedi_cmd->io_cmd_in_list = false;list_del_init (&qedi_cmd->io_cmd); qedi_conn->active_cmd_count--; } +spin_unlock (&qedi_conn->list_lock); if (((tmf_hdr->flags & ISCSI_FLAG_TM_FUNC_MASK) == ISCSI_TM_FUNC_LOGICAL_UNIT_RESET) ||
@@ -288,11 +294,13 @@ static void qedi_process_login_resp(struct qedi_ctx *qedi,ISCSI_LOGIN_RESPONSE_HDR_DATA_SEG_LEN_MASK ; qedi_conn->gen_pdu.resp_wr_ptr = qedi_conn->gen_pdu.resp_buf + pld_len; +spin_lock (&qedi_conn->list_lock);if (likely (cmd->io_cmd_in_list)) { cmd->io_cmd_in_list = false;list_del_init (&cmd->io_cmd); qedi_conn->active_cmd_count--; } +spin_unlock (&qedi_conn->list_lock);memset (task_ctx,'\0' ,sizeof (*task_ctx));
drivers/scsi/qedi/qedi_iscsi.c +2 -0
@@ -975,11 +975,13 @@ static void qedi_cleanup_active_cmd_list(struct qedi_conn *qedi_conn) {struct qedi_cmd *cmd, *cmd_tmp; +spin_lock (&qedi_conn->list_lock);list_for_each_entry_safe (cmd, cmd_tmp, &qedi_conn->active_cmd_list, io_cmd) {list_del_init (&cmd->io_cmd); qedi_conn->active_cmd_count--; } +spin_unlock (&qedi_conn->list_lock); }static void qedi_ep_disconnect (struct iscsi_endpoint *ep)
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 604/633 scsi: qedi: Fix list_del corruption while removing active I/O
In reply to Greg Kroah-HartmanFrom: Nilesh Javali <[email protected]>
[ Upstream commit 28b35d17f9f8573d4646dd8df08917a4076a6b63 ]
While aborting the I/O, the firmware cleanup task timed out and driver deleted the I/O from active command list. Some time later the firmware sent the cleanup task response and driver again deleted the I/O from active command list causing firmware to send completion for non-existent I/O and list_del corruption of active command list.
Add fix to check if I/O is present before deleting it from the active command list to ensure firmware sends valid I/O completion and protect against list_del corruption.
--- drivers/scsi/qedi/qedi_fw.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/scsi/qedi/qedi_fw.c +11 -4
@@ -825,8 +825,11 @@ static void qedi_process_cmd_cleanup_resp(struct qedi_ctx *qedi,qedi_clear_task_idx (qedi_conn->qedi, rtid);spin_lock (&qedi_conn->list_lock); -list_del_init (&dbg_cmd->io_cmd); - qedi_conn->active_cmd_count--; +if (likely (dbg_cmd->io_cmd_in_list)) { + dbg_cmd->io_cmd_in_list = false; +list_del_init (&dbg_cmd->io_cmd); + qedi_conn->active_cmd_count--; + }spin_unlock (&qedi_conn->list_lock); qedi_cmd->state =CLEANUP_RECV ;wake_up_interruptible (&qedi_conn->wait_queue);
@@ -1244,6 +1247,7 @@ int qedi_cleanup_all_io(struct qedi_ctx *qedi, struct qedi_conn *qedi_conn, qedi_conn->cmd_cleanup_req++;qedi_iscsi_cleanup_task (ctask, true); + cmd->io_cmd_in_list = false;list_del_init (&cmd->io_cmd); qedi_conn->active_cmd_count--; QEDI_WARN(&qedi->dbg_ctx,
@@ -1455,8 +1459,11 @@ static void qedi_tmf_work(struct work_struct *work)spin_unlock_bh (&qedi_conn->tmf_work_lock);spin_lock (&qedi_conn->list_lock); -list_del_init (&cmd->io_cmd); - qedi_conn->active_cmd_count--; +if (likely (cmd->io_cmd_in_list)) { + cmd->io_cmd_in_list = false; +list_del_init (&cmd->io_cmd); + qedi_conn->active_cmd_count--; + }spin_unlock (&qedi_conn->list_lock);clear_bit (QEDI_CONN_FW_CLEANUP , &qedi_conn->flags);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 605/633 fbmem: add margin check to fb_check_caps()
In reply to Greg Kroah-HartmanFrom: George Kennedy <[email protected]>
[ Upstream commit a49145acfb975d921464b84fe00279f99827d816 ]
A fb_ioctl() FBIOPUT_VSCREENINFO call with invalid xres setting or yres setting in struct fb_var_screeninfo will result in a
KASAN: vmalloc-out-of-bounds failure in bitfill_aligned() as
the margins are being cleared. The margins are cleared in chunks and if the xres setting or yres setting is a value of zero upto the chunk size, the failure will occur.
Add a margin check to validate xres and yres settings.
--- drivers/video/fbdev/core/fbmem.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/video/fbdev/core/fbmem.c +4 -0
@@ -1006,6 +1006,10 @@ fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var)return 0 ; } +/* bitfill_aligned() assumes that it's at least 8x8 */ +if (var->xres <8 || var->yres <8 ) +return -EINVAL ; + ret = info->fbops->fb_check_var (var, info);if (ret)
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 606/633 tty: ipwireless: fix error handling
In reply to Greg Kroah-HartmanFrom: Tong Zhang <[email protected]>
[ Upstream commit db332356222d9429731ab9395c89cca403828460 ]
ipwireless_send_packet() can only return 0 on success and -ENOMEM on error, the caller should check non zero for error condition
--- drivers/tty/ipwireless/network.c | 4 ++-- drivers/tty/ipwireless/tty.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/tty/ipwireless/network.c +2 -2
@@ -117,7 +117,7 @@ static int ipwireless_ppp_start_xmit(struct ppp_channel *ppp_channel, skb->len, notify_packet_sent, network); -if (ret ==-1 ) { +if (ret <0 ) {skb_pull (skb,2 );return 0 ; }
@@ -134,7 +134,7 @@ static int ipwireless_ppp_start_xmit(struct ppp_channel *ppp_channel, notify_packet_sent, network);kfree (buf); -if (ret ==-1 ) +if (ret <0 )return 0 ; }kfree_skb (skb);
drivers/tty/ipwireless/tty.c +1 -1
@@ -218,7 +218,7 @@ static int ipw_write(struct tty_struct *linux_tty, ret =ipwireless_send_packet (tty->hardware,IPW_CHANNEL_RAS , buf, count, ipw_write_packet_sent_callback, tty); -if (ret ==-1 ) { +if (ret <0 ) {mutex_unlock (&tty->ipw_tty_mutex);return 0 ; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 607/633 Bluetooth: btusb: Fix memleak in btusb_mtk_submit_wmt_recv_urb
In reply to Greg Kroah-HartmanFrom: Dinghao Liu <[email protected]>
[ Upstream commit d33fe77bdf75806d785dabf90d21d962122e5296 ]
When kmalloc() on buf fails, urb should be freed just like when kmalloc() on dr fails.
--- drivers/bluetooth/btusb.c | 1 + 1 file changed, 1 insertion(+)
drivers/bluetooth/btusb.c +1 -0
@@ -2849,6 +2849,7 @@ static int btusb_mtk_submit_wmt_recv_urb(struct hci_dev *hdev) buf =kmalloc (size,GFP_KERNEL );if (!buf) {kfree (dr); +usb_free_urb (urb);return -ENOMEM ; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 608/633 ipvs: Fix uninit-value in do_ip_vs_set_ctl()
In reply to Greg Kroah-HartmanFrom: Peilin Ye <[email protected]>
[ Upstream commit c5a8a8498eed1c164afc94f50a939c1a10abf8ad ]
do_ip_vs_set_ctl() is referencing uninitialized stack value when len is zero. Fix it.
--- net/netfilter/ipvs/ip_vs_ctl.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
net/netfilter/ipvs/ip_vs_ctl.c +4 -3
@@ -2471,6 +2471,10 @@ do_ip_vs_set_ctl(struct sock *sk, int cmd, void __user *user, unsigned int len)/* Set timeout values for (tcp tcpfin udp) */ ret =ip_vs_set_timeout (ipvs, (struct ip_vs_timeout_user *)arg); goto out_unlock; + }else if (!len) { +/* No more commands with len == 0 below */ + ret = -EINVAL ; + goto out_unlock; } usvc_compat = (struct ip_vs_service_user *)arg;
@@ -2547,9 +2551,6 @@ do_ip_vs_set_ctl(struct sock *sk, int cmd, void __user *user, unsigned int len)break ;case IP_VS_SO_SET_DELDEST : ret =ip_vs_del_dest (svc, &udest); -break ; -default : - ret = -EINVAL ; } out_unlock:
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 609/633 reiserfs: Fix memory leak in reiserfs_parse_options()
In reply to Greg Kroah-HartmanFrom: Jan Kara <[email protected]>
[ Upstream commit e9d4709fcc26353df12070566970f080e651f0c9 ]
When a usrjquota or grpjquota mount option is used multiple times, we will leak memory allocated for the file name. Make sure the last setting is used and all the previous ones are properly freed.
--- fs/reiserfs/super.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
fs/reiserfs/super.c +4 -4
@@ -1258,6 +1258,10 @@ static int reiserfs_parse_options(struct super_block *s, "turned on.");return 0 ; } +if (qf_names[qtype] != +REISERFS_SB (s)->s_qf_names[qtype]) +kfree (qf_names[qtype]); + qf_names[qtype] =NULL ; if (*arg) { /* Some filename specified? */ if (REISERFS_SB(s)->s_qf_names[qtype] && strcmp(REISERFS_SB(s)->s_qf_names[qtype],
@@ -1287,10 +1291,6 @@ static int reiserfs_parse_options(struct super_block *s,else *mount_options |=1 <<REISERFS_GRPQUOTA ; }else { -if (qf_names[qtype] != -REISERFS_SB (s)->s_qf_names[qtype]) -kfree (qf_names[qtype]); - qf_names[qtype] =NULL ;if (qtype ==USRQUOTA ) *mount_options &= ~(1 <<REISERFS_USRQUOTA );else
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 610/633 s390/qeth: strictly order bridge address events
In reply to Greg Kroah-HartmanFrom: Julian Wiedmann <[email protected]>
[ Upstream commit 9d6a569a4cbab5a8b4c959d4e312daeecb7c9f09 ]
The current code for bridge address events has two shortcomings in its control sequence:
1. after disabling address events via PNSO, we don't flush the remaining events from the event_wq. So if the feature is re-enabled fast enough, stale events could leak over.
2. PNSO and the events' arrival via the READ ccw device are unordered. So even if we flushed the workqueue, it's difficult to say whether the READ device might produce more events onto the workqueue afterwards.
Fix this by
1. explicitly fencing off the events when we no longer care, in the READ device's event handler. This ensures that once we flush the workqueue, it doesn't get additional address events.
2. Flush the workqueue after disabling the events & fencing them off. As the code that triggers the flush will typically hold the sbp_lock, we need to rework the worker code to avoid a deadlock here in case of a 'notifications-stopped' event. In case of lock contention, requeue such an event with a delay. We'll eventually aquire the lock, or spot that the feature has been disabled and the event can thus be discarded.
This leaves the theoretical race that a stale event could arrive _after_ we re-enabled ourselves to receive events again. Such an event would be impossible to distinguish from a 'good' event, nothing we can do about it.
--- drivers/s390/net/qeth_core.h | 6 ++++ drivers/s390/net/qeth_l2_main.c | 53 ++++++++++++++++++++++++++++----- drivers/s390/net/qeth_l2_sys.c | 1 + 3 files changed, 52 insertions(+), 8 deletions(-)
drivers/s390/net/qeth_core.h +6 -0
@@ -680,6 +680,11 @@ struct qeth_card_blkt {int inter_packet_jumbo; }; +enum qeth_pnso_mode { +QETH_PNSO_NONE , +QETH_PNSO_BRIDGEPORT , +}; +#define QETH_BROADCAST_WITH_ECHO 0x01#define QETH_BROADCAST_WITHOUT_ECHO 0x02struct qeth_card_info {
@@ -696,6 +701,7 @@ struct qeth_card_info {/* no bitfield, we take a pointer on these two: */ u8 has_lp2lp_cso_v6;u8 has_lp2lp_cso_v4; +enum qeth_pnso_mode pnso_mode;enum qeth_card_types type;enum qeth_link_types link_type;int broadcast_capable;
drivers/s390/net/qeth_l2_main.c +45 -8
117 lines not on this page · raw message
drivers/s390/net/qeth_l2_sys.c +1 -0
@@ -157,6 +157,7 @@ static ssize_t qeth_bridgeport_hostnotification_store(struct device *dev, rc = -EBUSY ; else if (qeth_card_hw_is_reachable(card)) { rc =qeth_bridgeport_an_set (card, enable); +/* sbp_lock ensures ordering vs notifications-stopped events */ if (!rc) card->options.sbp.hostnotification = enable; } else
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 611/633 mwifiex: dont call del_timer_sync() on uninitialized timer
In reply to Greg Kroah-HartmanFrom: Tetsuo Handa <[email protected]>
[ Upstream commit 621a3a8b1c0ecf16e1e5667ea5756a76a082b738 ]
syzbot is reporting that del_timer_sync() is called from mwifiex_usb_cleanup_tx_aggr() from mwifiex_unregister_dev() without checking timer_setup() from mwifiex_usb_tx_init() was called [1].
Ganapathi Bhat proposed a possibly cleaner fix, but it seems that that fix was forgotten [2].
"grep -FrB1 'del_timer' drivers/ | grep -FA1 '.function)'" says that currently there are 28 locations which call del_timer[_sync]() only if that timer's function field was initialized (because timer_setup() sets that timer's function field). Therefore, let's use same approach here.
[1] https://syzkaller.appspot.com/bug?id=26525f643f454dd7be0078423e3cdb0d57744959
[2] https://lkml.kernel.org/r/CA+ASDXMHt2gq9Hy+iP_BYkWXsSreWdp3_bAfMkNcuqJ3K+-jbQ@mail.gmail.com
--- drivers/net/wireless/marvell/mwifiex/usb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/marvell/mwifiex/usb.c +2 -1
@@ -1353,7 +1353,8 @@ static void mwifiex_usb_cleanup_tx_aggr(struct mwifiex_adapter *adapter) skb_dequeue(&port->tx_aggr.aggr_list)))mwifiex_write_data_complete (adapter, skb_tmp,0 ,-1 ); -del_timer_sync (&port->tx_aggr.timer_cnxt.hold_timer); +if (port->tx_aggr.timer_cnxt.hold_timer.function) +del_timer_sync (&port->tx_aggr.timer_cnxt.hold_timer); port->tx_aggr.timer_cnxt.is_hold_timer_set = false; port->tx_aggr.timer_cnxt.hold_tmo_msecs =0 ; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 612/633 ALSA: hda/ca0132 - Add AE-7 microphone selection commands.
In reply to Greg Kroah-HartmanFrom: Connor McAdams <[email protected]>
[ Upstream commit ed93f9750c6c2ed371347d0aac3dcd31cb9cf256 ]
Add AE-7 quirk data for setting of microphone. The AE-7 has no front panel connector, so only rear-mic/line-in have new commands.
--- sound/pci/hda/patch_ca0132.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-)
sound/pci/hda/patch_ca0132.c +21 -1
@@ -4675,6 +4675,15 @@ static int ca0132_alt_select_in(struct hda_codec *codec)ca0113_mmio_command_set (codec,0x30 ,0x28 ,0x00 ); tmp =FLOAT_THREE ;break ; +case QUIRK_AE7 : +ca0113_mmio_command_set (codec,0x30 ,0x28 ,0x00 ); + tmp =FLOAT_THREE ; +chipio_set_conn_rate (codec,MEM_CONNID_MICIN2 , +SR_96_000 ); +chipio_set_conn_rate (codec,MEM_CONNID_MICOUT2 , +SR_96_000 ); +dspio_set_uint_param (codec,0x80 ,0x01 ,FLOAT_ZERO ); +break ;default : tmp =FLOAT_ONE ;break ;
@@ -4720,6 +4729,14 @@ static int ca0132_alt_select_in(struct hda_codec *codec)case QUIRK_AE5 :ca0113_mmio_command_set (codec,0x30 ,0x28 ,0x00 );break ; +case QUIRK_AE7 : +ca0113_mmio_command_set (codec,0x30 ,0x28 ,0x3f ); +chipio_set_conn_rate (codec,MEM_CONNID_MICIN2 , +SR_96_000 ); +chipio_set_conn_rate (codec,MEM_CONNID_MICOUT2 , +SR_96_000 ); +dspio_set_uint_param (codec,0x80 ,0x01 ,FLOAT_ZERO ); +break ;default :break ; }
@@ -4729,7 +4746,10 @@ static int ca0132_alt_select_in(struct hda_codec *codec)if (ca0132_quirk (spec) ==QUIRK_R3DI )chipio_set_conn_rate (codec,0x0F ,SR_96_000 ); - tmp =FLOAT_ZERO ; +if (ca0132_quirk (spec) ==QUIRK_AE7 ) + tmp =FLOAT_THREE ; +else + tmp =FLOAT_ZERO ;dspio_set_uint_param (codec,0x80 ,0x00 , tmp);switch (ca0132_quirk (spec)) {
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 613/633 ALSA: hda/ca0132 - Add new quirk ID for SoundBlaster AE-7.
In reply to Greg Kroah-HartmanFrom: Connor McAdams <[email protected]>
[ Upstream commit 620f08eea6d6961b789af3fa3ea86725c8c93ece ]
Add a new PCI subsystem ID for the SoundBlaster AE-7 card.
--- sound/pci/hda/patch_ca0132.c | 2 ++ 1 file changed, 2 insertions(+)
sound/pci/hda/patch_ca0132.c +2 -0
@@ -1065,6 +1065,7 @@ enum {QUIRK_R3DI ,QUIRK_R3D ,QUIRK_AE5 , + QUIRK_AE7, };#ifdef CONFIG_PCI
@@ -1184,6 +1185,7 @@ static const struct snd_pci_quirk ca0132_quirks[] = {SND_PCI_QUIRK (0x1102 ,0x0013 ,"Recon3D" ,QUIRK_R3D ),SND_PCI_QUIRK (0x1102 ,0x0018 ,"Recon3D" ,QUIRK_R3D ),SND_PCI_QUIRK (0x1102 ,0x0051 ,"Sound Blaster AE-5" ,QUIRK_AE5 ), + SND_PCI_QUIRK(0x1102, 0x0081, "Sound Blaster AE-7", QUIRK_AE7), {} };
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 614/633 ASoC: SOF: Add topology filename override based on dmi data match
In reply to Greg Kroah-HartmanFrom: Sathyanarayana Nujella <[email protected]>
[ Upstream commit 5253a73d567dcd75e62834ff5f502ea9470e5722 ]
Add topology filename override based on system DMI data matching, typically to account for a different hardware layout.
In ACPI based systems, the tplg_filename is pre-defined in an ACPI machine table. When a DMI quirk is detected, the sof_pdata->tplg_filename is not set with the hard-coded ACPI value, and instead is set with the DMI-specific filename.
--- sound/soc/sof/intel/hda.c | 8 +++++++- sound/soc/sof/sof-pci-dev.c | 24 ++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-)
sound/soc/sof/intel/hda.c +7 -1
@@ -1179,7 +1179,13 @@ void hda_machine_select(struct snd_sof_dev *sdev) mach =snd_soc_acpi_find_machine (desc->machines);if (mach) { - sof_pdata->tplg_filename = mach->sof_tplg_filename; +/* +* If tplg file name is overridden, use it instead of +* the one set in mach table +*/ +if (!sof_pdata->tplg_filename) + sof_pdata->tplg_filename = mach->sof_tplg_filename; + sof_pdata->machine = mach;if (mach->link_mask) {
sound/soc/sof/sof-pci-dev.c +24 -0
@@ -35,8 +35,28 @@ static int sof_pci_debug;module_param_named (sof_pci_debug, sof_pci_debug, int,0444 );MODULE_PARM_DESC (sof_pci_debug,"SOF PCI debug options (0x0 all off)" ); +static const char *sof_override_tplg_name; +#define SOF_PCI_DISABLE_PM_RUNTIME BIT(0) +static int sof_tplg_cb (const struct dmi_system_id *id) +{ + sof_override_tplg_name = id->driver_data; +return 1 ; +} + +static const struct dmi_system_id sof_tplg_table[] = { + { + .callback = sof_tplg_cb, + .matches = { +DMI_MATCH (DMI_PRODUCT_FAMILY ,"Google_Volteer" ), +DMI_MATCH (DMI_PRODUCT_NAME ,"Terrador" ), + }, + .driver_data ="sof-tgl-rt5682-ssp0-max98373-ssp2.tplg" , + }, + {} +}; +static const struct dmi_system_id community_key_platforms[] = { { .ident ="Up Squared" ,
@@ -347,6 +367,10 @@ static int sof_pci_probe(struct pci_dev *pci, sof_pdata->tplg_filename_prefix = sof_pdata->desc->default_tplg_path; +dmi_check_system (sof_tplg_table); +if (sof_override_tplg_name) + sof_pdata->tplg_filename = sof_override_tplg_name; +#if IS_ENABLED (CONFIG_SND_SOC_SOF_PROBE_WORK_QUEUE )/* set callback to enable runtime_pm */ sof_pdata->sof_probe_complete = sof_pci_probe_complete;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 615/633 ASoC: Intel: sof_rt5682: override quirk data for tgl_max98373_rt5682
In reply to Greg Kroah-HartmanFrom: Sathyanarayana Nujella <[email protected]>
[ Upstream commit 3e1734b64ce786c54dc98adcfe67941e6011d735 ]
A Chrome System based on tgl_max98373_rt5682 has different SSP interface configurations. Using DMI data of this variant DUT, override quirk data.
--- sound/soc/intel/boards/sof_rt5682.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
sound/soc/intel/boards/sof_rt5682.c +13 -0
@@ -118,6 +118,19 @@ static const struct dmi_system_id sof_rt5682_quirk_table[] = { .driver_data = (void *)(SOF_RT5682_MCLK_EN | SOF_RT5682_SSP_CODEC(0)), }, + { + .callback = sof_rt5682_quirk_cb, + .matches = { + DMI_MATCH(DMI_PRODUCT_FAMILY, "Google_Volteer"), + DMI_MATCH(DMI_PRODUCT_NAME, "Terrador"), + }, + .driver_data = (void *)(SOF_RT5682_MCLK_EN | + SOF_RT5682_SSP_CODEC(0) | + SOF_SPEAKER_AMP_PRESENT | + SOF_MAX98373_SPEAKER_AMP_PRESENT | + SOF_RT5682_SSP_AMP(2) | + SOF_RT5682_NUM_HDMIDEV(4)), + }, {} };
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 616/633 scsi: smartpqi: Avoid crashing kernel for controller issues
In reply to Greg Kroah-HartmanFrom: Kevin Barnett <[email protected]>
[ Upstream commit 9e68cccc8ef7206f0bccd590378d0dca8f9b4f57 ]
Eliminate kernel panics when getting invalid responses from controller. Take controller offline instead of causing kernel panics.
--- drivers/scsi/smartpqi/smartpqi.h | 2 +- drivers/scsi/smartpqi/smartpqi_init.c | 101 +++++++++++++++++--------- 2 files changed, 68 insertions(+), 35 deletions(-)
drivers/scsi/smartpqi/smartpqi.h +1 -1
@@ -359,7 +359,7 @@ struct pqi_event_response {struct pqi_iu_header header;u8 event_type; u8 reserved2 : 7; - u8 request_acknowlege : 1; + u8 request_acknowledge : 1;__le16 event_id;__le32 additional_event_id;union {
drivers/scsi/smartpqi/smartpqi_init.c +67 -34
191 lines not on this page · raw message
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 617/633 brcm80211: fix possible memleak in brcmf_proto_msgbuf_attach
In reply to Greg Kroah-HartmanFrom: Wang Yufen <[email protected]>
[ Upstream commit 6c151410d5b57e6bb0d91a735ac511459539a7bf ]
When brcmf_proto_msgbuf_attach fail and msgbuf->txflow_wq != NULL, we should destroy the workqueue.
--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c +2 -0
@@ -1619,6 +1619,8 @@ int brcmf_proto_msgbuf_attach(struct brcmf_pub *drvr)BRCMF_TX_IOCTL_MAX_MSG_SIZE , msgbuf->ioctbuf, msgbuf->ioctbuf_handle); +if (msgbuf->txflow_wq) +destroy_workqueue (msgbuf->txflow_wq);kfree (msgbuf); }return -ENOMEM ;
Signature · 1 line
2.25.1