Skip to contentSkip to conversation

4.19.270-rc1 review

PATCH In review Greg Kroah-Hartman 6 participants 528 messages Jan 16, 2023 – Jan 22, 2023 Page 1 of 4

Subsystems (7)
lore
Share & tools
lore
author maintainer
#1 lore raw

PATCH 1/521 mm/khugepaged: fix GUP-fast interaction by sending IPI

In reply to Greg Kroah-Hartman

From: Jann Horn <[email protected]>

commit 2ba99c5e08812494bc57f319fb562f527d9bacd8 upstream.

Since commit 70cbc3cc78a99 ("mm: gup: fix the fast GUP race against THP collapse"), the lockless_pages_from_mm() fastpath rechecks the pmd_t to ensure that the page table was not removed by khugepaged in between.

However, lockless_pages_from_mm() still requires that the page table is not concurrently freed. Fix it by sending IPIs (if the architecture uses semi-RCU-style page table freeing) before freeing/reusing page tables.

[manual backport: two of the three places in khugepaged that can free ptes were refactored into a common helper between 5.15 and 6.0; TLB flushing was refactored between 5.4 and 5.10;
TLB flushing was refactored between 4.19 and 5.4;
pmd collapse for PTE-mapped THP was only added in 5.4; ugly hack needed in <=4.19 for s390 and arm]

---
 include/asm-generic/tlb.h |    6 ++++++
 mm/khugepaged.c           |   15 +++++++++++++++
 mm/memory.c               |    5 +++++
 3 files changed, 26 insertions(+)
include/asm-generic/tlb.h +6 -0
@@ -61,6 +61,12 @@ struct mmu_table_batch {
 extern void tlb_table_flush(struct mmu_gather *tlb);
 extern void tlb_remove_table(struct mmu_gather *tlb, void *table);
 
+void tlb_remove_table_sync_one(void);
+
+#else
+
+static inline void tlb_remove_table_sync_one(void) { }
+
 #endif
 
 /*
mm/khugepaged.c +15 -0
@@ -23,6 +23,19 @@
 #include <asm/pgalloc.h>
 #include "internal.h"
 
+/* gross hack for <=4.19 stable */
+#if defined(CONFIG_S390) || defined(CONFIG_ARM)
+static void tlb_remove_table_smp_sync(void *arg)
+{
+        /* Simply deliver the interrupt */
+}
+
+static void tlb_remove_table_sync_one(void)
+{
+        smp_call_function(tlb_remove_table_smp_sync, NULL, 1);
+}
+#endif
+
 enum scan_result {
 	SCAN_FAIL,
 	SCAN_SUCCEED,
@@ -1045,6 +1058,7 @@ static void collapse_huge_page(struct mm
 	_pmd = pmdp_collapse_flush(vma, address, pmd);
 	spin_unlock(pmd_ptl);
 	mmu_notifier_invalidate_range_end(mm, mmun_start, mmun_end);
+	tlb_remove_table_sync_one();
 
 	spin_lock(pte_ptl);
 	isolated = __collapse_huge_page_isolate(vma, address, pte);
@@ -1294,6 +1308,7 @@ static void retract_page_tables(struct a
 				_pmd = pmdp_collapse_flush(vma, addr, pmd);
 				spin_unlock(ptl);
 				mm_dec_nr_ptes(mm);
+				tlb_remove_table_sync_one();
 				pte_free(mm, pmd_pgtable(_pmd));
 			}
 			up_write(&mm->mmap_sem);
mm/memory.c +5 -0
@@ -362,6 +362,11 @@ static void tlb_remove_table_smp_sync(vo
 	/* Simply deliver the interrupt */
 }
 
+void tlb_remove_table_sync_one(void)
+{
+	smp_call_function(tlb_remove_table_smp_sync, NULL, 1);
+}
+
 static void tlb_remove_table_one(void *table)
 {
 	/*
author maintainer
#2 lore raw

PATCH 2/521 mm/khugepaged: invoke MMU notifiers in shmem/file collapse paths

In reply to Greg Kroah-Hartman

From: Jann Horn <[email protected]>

commit f268f6cf875f3220afc77bdd0bf1bb136eb54db9 upstream.

Any codepath that zaps page table entries must invoke MMU notifiers to ensure that secondary MMUs (like KVM) don't keep accessing pages which aren't mapped anymore. Secondary MMUs don't hold their own references to pages that are mirrored over, so failing to notify them can lead to page use-after-free.

I'm marking this as addressing an issue introduced in commit f3f0e1d2150b ("khugepaged: add support of collapse for tmpfs/shmem pages"), but most of the security impact of this only came in commit 27e1f8273113 ("khugepaged:
enable collapse pmd for pte-mapped THP"), which actually omitted flushes for the removal of present PTEs, not just for the removal of empty page tables.

[manual backport: this code was refactored from two copies into a common helper between 5.15 and 6.0;
pmd collapse for PTE-mapped THP was only added in 5.4;
MMU notifier API changed between 4.19 and 5.4]

---
 mm/khugepaged.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
mm/khugepaged.c +8 -1
@@ -1303,13 +1303,20 @@ static void retract_page_tables(struct a
 		 */
 		if (down_write_trylock(&mm->mmap_sem)) {
 			if (!khugepaged_test_exit(mm)) {
-				spinlock_t *ptl = pmd_lock(mm, pmd);
+				spinlock_t *ptl;
+				unsigned long end = addr + HPAGE_PMD_SIZE;
+
+				mmu_notifier_invalidate_range_start(mm, addr,
+								    end);
+				ptl = pmd_lock(mm, pmd);
 				/* assume page table is clear */
 				_pmd = pmdp_collapse_flush(vma, addr, pmd);
 				spin_unlock(ptl);
 				mm_dec_nr_ptes(mm);
 				tlb_remove_table_sync_one();
 				pte_free(mm, pmd_pgtable(_pmd));
+				mmu_notifier_invalidate_range_end(mm, addr,
+								  end);
 			}
 			up_write(&mm->mmap_sem);
 		}
author maintainer
#3 lore raw

PATCH 3/521 block: unhash blkdev part inode when the part is deleted

In reply to Greg Kroah-Hartman

From: Ming Lei <[email protected]>

v5.11 changes the blkdev lookup mechanism completely since commit 22ae8ce8b892 ("block: simplify bdev/disk lookup in blkdev_get"), and small part of the change is to unhash part bdev inode when deleting partition. Turns out this kind of change does fix one nasty issue in case of BLOCK_EXT_MAJOR:

1) when one partition is deleted & closed, disk_put_part() is always called before bdput(bdev), see blkdev_put(); so the part's devt can be freed & re-used before the inode is dropped

2) then new partition with same devt can be created just before the inode in 1) is dropped, then the old inode/bdev structurein 1) is re-used for this new partition, this way causes use-after-free and kernel panic.

It isn't possible to backport the whole big patchset of "merge struct block_device and struct hd_struct v4" for addressing this issue.

https://lore.kernel.org/linux-block/[email protected]/

So fixes it by unhashing part bdev in delete_partition(), and this way is actually aligned with v5.11+'s behavior.

Backported from the following 5.10.y commit:

5f2f77560591 ("block: unhash blkdev part inode when the part is deleted")

---
 block/partition-generic.c |    7 +++++++
 1 file changed, 7 insertions(+)
block/partition-generic.c +7 -0
@@ -276,6 +276,7 @@ void delete_partition(struct gendisk *di
 	struct disk_part_tbl *ptbl =
 		rcu_dereference_protected(disk->part_tbl, 1);
 	struct hd_struct *part;
+	struct block_device *bdev;
 
 	if (partno >= ptbl->len)
 		return;
@@ -296,6 +297,12 @@ void delete_partition(struct gendisk *di
 	 * "in-use" until we really free the gendisk.
 	 */
 	blk_invalidate_devt(part_devt(part));
+
+	bdev = bdget(part_devt(part));
+	if (bdev) {
+		remove_inode_hash(bdev->bd_inode);
+		bdput(bdev);
+	}
 	hd_struct_kill(part);
 }
 
author maintainer
#4 lore raw

PATCH 4/521 nfp: fix use-after-free in area_cache_get()

In reply to Greg Kroah-Hartman

From: Jialiang Wang <[email protected]>

commit 02e1a114fdb71e59ee6770294166c30d437bf86a upstream.

area_cache_get() is used to distribute cache->area and set cache->id,
and if cache->id is not 0 and cache->area->kref refcount is 0, it will release the cache->area by nfp_cpp_area_release(). area_cache_get() set cache->id before cpp->op->area_init() and nfp_cpp_area_acquire().

But if area_init() or nfp_cpp_area_acquire() fails, the cache->id is
is already set but the refcount is not increased as expected. At this time, calling the nfp_cpp_area_release() will cause use-after-free.

To avoid the use-after-free, set cache->id after area_init() and
nfp_cpp_area_acquire() complete successfully.

Note: This vulnerability is triggerable by providing emulated device
equipped with specified configuration.

 BUG: KASAN: use-after-free in nfp6000_area_init (drivers/net/ethernet/netronome/nfp/nfpcore/nfp6000_pcie.c:760)
  Write of size 4 at addr ffff888005b7f4a0 by task swapper/0/1

 Call Trace:
  <TASK>
 nfp6000_area_init (drivers/net/ethernet/netronome/nfp/nfpcore/nfp6000_pcie.c:760)
 area_cache_get.constprop.8 (drivers/net/ethernet/netronome/nfp/nfpcore/nfp_cppcore.c:884)

 Allocated by task 1:
 nfp_cpp_area_alloc_with_name (drivers/net/ethernet/netronome/nfp/nfpcore/nfp_cppcore.c:303)
 nfp_cpp_area_cache_add (drivers/net/ethernet/netronome/nfp/nfpcore/nfp_cppcore.c:802)
 nfp6000_init (drivers/net/ethernet/netronome/nfp/nfpcore/nfp6000_pcie.c:1230)
 nfp_cpp_from_operations (drivers/net/ethernet/netronome/nfp/nfpcore/nfp_cppcore.c:1215)
 nfp_pci_probe (drivers/net/ethernet/netronome/nfp/nfp_main.c:744)

 Freed by task 1:
 kfree (mm/slub.c:4562)
 area_cache_get.constprop.8 (drivers/net/ethernet/netronome/nfp/nfpcore/nfp_cppcore.c:873)
 nfp_cpp_read (drivers/net/ethernet/netronome/nfp/nfpcore/nfp_cppcore.c:924 drivers/net/ethernet/netronome/nfp/nfpcore/nfp_cppcore.c:973)
 nfp_cpp_readl (drivers/net/ethernet/netronome/nfp/nfpcore/nfp_cpplib.c:48)
---
 drivers/net/ethernet/netronome/nfp/nfpcore/nfp_cppcore.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/netronome/nfp/nfpcore/nfp_cppcore.c +2 -1
@@ -874,7 +874,6 @@ area_cache_get(struct nfp_cpp *cpp, u32
 	}
 
 	/* Adjust the start address to be cache size aligned */
-	cache->id = id;
 	cache->addr = addr & ~(u64)(cache->size - 1);
 
 	/* Re-init to the new ID and address */
@@ -894,6 +893,8 @@ area_cache_get(struct nfp_cpp *cpp, u32
 		return NULL;
 	}
 
+	cache->id = id;
+
 exit:
 	/* Adjust offset */
 	*offset = addr - cache->addr;
author maintainer
#5 lore raw

PATCH 5/521 ASoC: ops: Check bounds for second channel in snd_soc_put_volsw_sx()

In reply to Greg Kroah-Hartman

From: Mark Brown <[email protected]>

[ Upstream commit 97eea946b93961fffd29448dcda7398d0d51c4b2 ]

The bounds checks in snd_soc_put_volsw_sx() are only being applied to the first channel, meaning it is possible to write out of bounds values to the second channel in stereo controls. Add appropriate checks.

---
 sound/soc/soc-ops.c | 6 ++++++
 1 file changed, 6 insertions(+)
sound/soc/soc-ops.c +6 -0
index 2faf95d4bb75..fbd46a737652 100644
@@ -460,6 +460,12 @@ int snd_soc_put_volsw_sx(struct snd_kcontrol *kcontrol,
 	if (snd_soc_volsw_is_stereo(mc)) {
 		val_mask = mask << rshift;
 		val2 = (ucontrol->value.integer.value[1] + min) & mask;
+
+		if (mc->platform_max && val2 > mc->platform_max)
+			return -EINVAL;
+		if (val2 > max)
+			return -EINVAL;
+
 		val2 = val2 << rshift;
 
 		err = snd_soc_component_update_bits(component, reg2, val_mask,
Signature · 1 line
2.35.1

Greg Kroah-Hartman

author maintainer
#0 lore raw

cover 4.19.270-rc1 review

This is the start of the stable review cycle for the 4.19.270 release. There are 521 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.

Responses should be made by Wed, 18 Jan 2023 15:47:28 +0000. Anything received after that time might be too late.

The whole patch series can be found in one patch at:

	https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.19.270-rc1.gz

or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.19.y
and the diffstat can be found below.

thanks,

greg k-h

-------------
Pseudo-Shortlog of commits:

Greg Kroah-Hartman <[email protected]>

    Linux 4.19.270-rc1

Jon Hunter <[email protected]>
serial: tegra: Only print FIFO error message when an error occurs

Frederic Barrat <[email protected]>
powerpc/powernv/eeh: Fix oops when probing cxl devices

Kailang Yang <[email protected]>
ALSA: hda/realtek - Fixed one of HP ALC671 platform Headset Mic supported

Takashi Iwai <[email protected]>
ALSA: hda/realtek - Fix inverted bass GPIO pin on Acer 8951G

Mahesh Salgaonkar <[email protected]>
pseries/eeh: Fix the kdump kernel crash during eeh_pseries_init

Dmitry Osipenko <[email protected]>
tty: serial: tegra: Handle RX transfer in PIO mode if DMA wasn't started

Ferry Toth <[email protected]>
Revert "usb: ulpi: defer ulpi_register on ulpi_read_id timeout"

Johan Hovold <[email protected]>
efi: fix NULL-deref in init error path

Mark Rutland <[email protected]>
arm64: cmpxchg_double*: hazard against entire exchange variable

Rob Clark <[email protected]>
drm/virtio: Fix GEM handle creation UAF

Peter Newman <[email protected]>
x86/resctrl: Fix task CLOSID/RMID update race

Reinette Chatre <[email protected]>

    x86/resctrl: Use task_curr() instead of task_struct->on_cpu to prevent unnecessary IPI

Christophe JAILLET <[email protected]>
iommu/mediatek-v1: Fix an error handling path in mtk_iommu_v1_probe()

Yong Wu <[email protected]>
iommu/mediatek-v1: Add error handle for mtk_iommu_probe

Rahul Rameshbabu <[email protected]>
net/mlx5: Fix ptp max frequency adjustment range

Eran Ben Elisha <[email protected]>
net/mlx5: Rename ptp clock info

Minsuk Kang <[email protected]>
nfc: pn533: Wait for out_urb's completion in pn533_usb_send_frame()

Roger Pau Monne <[email protected]>
hvc/xen: lock console list traversal

Ricardo Ribalda <[email protected]>
regulator: da9211: Use irq handler when ready

Eliav Farber <[email protected]>
EDAC/device: Fix period calculation in edac_device_reset_delay_period()

Peter Zijlstra <[email protected]>
x86/boot: Avoid using Intel mnemonics in AT&T syntax asm

Gavrilov Ilia <[email protected]>
netfilter: ipset: Fix overflow before widen in the bitmap_ip_create() function.

Eric Whitney <[email protected]>
ext4: fix delayed allocation bug in ext4_clu_mapped for bigalloc + inline

Eric Whitney <[email protected]>
ext4: fix reserved cluster accounting at delayed write time

Eric Whitney <[email protected]>
ext4: add new pending reservation mechanism

Eric Whitney <[email protected]>
ext4: generalize extents status tree search functions

Ye Bin <[email protected]>
ext4: fix uninititialized value in 'ext4_evict_inode'

Baokun Li <[email protected]>
ext4: fix use-after-free in ext4_orphan_cleanup

zhengliang <[email protected]>
ext4: lost matching-pair of trace in ext4_truncate

Baokun Li <[email protected]>
ext4: fix bug_on in __es_tree_search caused by bad quota inode

Jan Kara <[email protected]>
quota: Factor out setup of quota inode

Ferry Toth <[email protected]>
usb: ulpi: defer ulpi_register on ulpi_read_id timeout

Steven Rostedt <[email protected]>
kest.pl: Fix grub2 menu handling for rebooting

Libo Chen <[email protected]>
ktest.pl: Fix incorrect reboot for grub2bls

Masayoshi Mizuma <[email protected]>
ktest: introduce grub2bls REBOOT_TYPE option

Masayoshi Mizuma <[email protected]>
ktest: cleanup get_grub_index

Masayoshi Mizuma <[email protected]>
ktest: introduce _get_grub_index

Masayoshi Mizuma <[email protected]>
ktest: Add support for meta characters in GRUB_MENU

Edward Pacman <[email protected]>
ALSA: hda/realtek: Add quirk for Lenovo TianYi510Pro-14IOB

Kailang Yang <[email protected]>
ALSA: hda/realtek - ALC897 headset MIC no sound

Kailang Yang <[email protected]>
ALSA: hda/realtek - Add headset Mic support for Lenovo ALC897 platform

Hui Wang <[email protected]>
ALSA: hda/realtek: Fix the mic type detection issue for ASUS G551JW

Jeremy Szu <[email protected]>
ALSA: hda/realtek - The front Mic on a HP machine doesn't work

Jian-Hong Pan <[email protected]>
ALSA: hda/realtek - Enable the headset of Acer N50-600 with ALC662

Jian-Hong Pan <[email protected]>
ALSA: hda/realtek - Enable headset mic of Acer X2660G with ALC662

Kailang Yang <[email protected]>
ALSA: hda/realtek - Add Headset Mic supported for HP cPC

Takashi Iwai <[email protected]>
ALSA: hda/realtek - More constifications

Sergey Bostandzhyan <[email protected]>
Add Acer Aspire Ethos 8951G model quirk

Kai Vehmanen <[email protected]>
ALSA: hda/hdmi: fix failures at PCM open on Intel ICL and later

Michael Walle <[email protected]>
wifi: wilc1000: sdio: fix module autoloading

Herbert Xu <[email protected]>
ipv6: raw: Deduct extension header length in rawv6_push_pending_frames

Hans de Goede <[email protected]>

    platform/x86: sony-laptop: Don't turn off 0x153 keyboard backlight during probe

Volker Lendecke <[email protected]>
cifs: Fix uninitialized memory read for smb311 posix symlink create

Clement Lecigne <[email protected]>
ALSA: pcm: Move rwsem lock inside snd_ctl_elem_read to prevent UAF

Paolo Abeni <[email protected]>
net/ulp: prevent ULP without clone op from entering the LISTEN status

Heiko Carstens <[email protected]>
s390/percpu: add READ_ONCE() to arch_this_cpu_to_op_simple()

Adrian Hunter <[email protected]>
perf auxtrace: Fix address filter duplicate symbol selection

Jonathan Corbet <[email protected]>
docs: Fix the docs build with Sphinx 6.0

Frederick Lawler <[email protected]>
net: sched: disallow noqueue for qdisc classes

Isaac J. Manjarres <[email protected]>
driver core: Fix bus_type.match() error handling in __driver_attach()

Helge Deller <[email protected]>
parisc: Align parisc MADV_XXX constants with all other architectures

Jan Kara <[email protected]>

    mbcache: Avoid nesting of cache->c_list_lock under bit locks

Linus Torvalds <[email protected]>
hfs/hfsplus: avoid WARN_ON() for sanity check, use proper error handling

Arnd Bergmann <[email protected]>
hfs/hfsplus: use WARN_ON for sanity check

Eric Biggers <[email protected]>
ext4: don't allow journal inode to have encrypt flag

Ben Dooks <[email protected]>
riscv: uaccess: fix type of 0 variable on error in get_user()

Jeff Layton <[email protected]>
nfsd: fix handling of readdir in v4root vs. mount upcall timeout

Rodrigo Branco <[email protected]>
x86/bugs: Flush IBP in ib_prctl_set()

Hans de Goede <[email protected]>
ASoC: Intel: bytcr_rt5640: Add quirk for the Advantech MICA-071 tablet

Jan Kara <[email protected]>
udf: Fix extension of the last extent in the file

Zhengchao Shao <[email protected]>
caif: fix memory leak in cfctrl_linkup_request()

Szymon Heidrich <[email protected]>
usb: rndis_host: Secure rndis_query check against int overflow

Jamal Hadi Salim <[email protected]>
net: sched: atm: dont intepret cls results when asked to drop

Maor Gottlieb <[email protected]>
RDMA/mlx5: Fix validation of max_rd_atomic caps for DC

Miaoqian Lin <[email protected]>
net: phy: xgmiitorgmii: Fix refcount leak in xgmiitorgmii_probe

Jiguang Xiao <[email protected]>
net: amd-xgbe: add missed tasklet_kill

Miaoqian Lin <[email protected]>
nfc: Fix potential resource leaks

Daniil Tatianin <[email protected]>

    qlcnic: prevent ->dcb use-after-free on qlcnic_dcb_enable() failure

Jakub Kicinski <[email protected]>
bpf: pull before calling skb_postpull_rcsum()

minoura makoto <[email protected]>
SUNRPC: ensure the matching upcall is in-flight upon downcall

Jan Kara <[email protected]>
ext4: fix deadlock due to mbcache entry corruption

Jan Kara <[email protected]>
mbcache: automatically delete entries from cache on freeing

Jan Kara <[email protected]>
ext4: fix race when reusing xattr blocks

Jan Kara <[email protected]>
ext4: unindent codeblock in ext4_xattr_block_set()

Jan Kara <[email protected]>
ext4: remove EA inode entry from mbcache on inode eviction

Jan Kara <[email protected]>
mbcache: add functions to delete entry if unused

Jan Kara <[email protected]>
mbcache: don't reclaim used entries

Shuqi Zhang <[email protected]>
ext4: use kmemdup() to replace kmalloc + memcpy

Baokun Li <[email protected]>
ext4: correct inconsistent error msg in nojournal mode

Jason Yan <[email protected]>
ext4: goto right label 'failed_mount3a'

John Stultz <[email protected]>
driver core: Set deferred_probe_timeout to a longer default if CONFIG_MODULES is set

Guo Ren <[email protected]>
riscv: stacktrace: Fixup ftrace_graph_ret_addr retp argument

Chen Huang <[email protected]>
riscv/stacktrace: Fix stack output without ra on the stack top

Christoph Hellwig <[email protected]>
riscv: remove unreachable !HAVE_FUNCTION_GRAPH_RET_ADDR_PTR code

Biju Das <[email protected]>
ravb: Fix "failed to switch device to config mode" message during unbind

Masami Hiramatsu (Google) <[email protected]>
perf probe: Fix to get the DW_AT_decl_file and DW_AT_call_file as unsinged data

Masami Hiramatsu (Google) <[email protected]>
perf probe: Use dwarf_attr_integrate as generic DWARF attr accessor

Luo Meng <[email protected]>
dm thin: resume even if in FAIL mode

Smitha T Murthy <[email protected]>
media: s5p-mfc: Fix in register read and write for H264

Smitha T Murthy <[email protected]>
media: s5p-mfc: Clear workbit to handle error condition

Smitha T Murthy <[email protected]>
media: s5p-mfc: Fix to handle reference queue during finishing

Sasha Levin <[email protected]>
btrfs: replace strncpy() with strscpy()

Filipe Manana <[email protected]>
btrfs: send: avoid unnecessary backref lookups when finding clone source

Alex Deucher <[email protected]>
drm/amdgpu: make display pinning more flexible (v2)

Ye Bin <[email protected]>
ext4: allocate extended attribute value in vmalloc area

Jan Kara <[email protected]>
ext4: avoid unaccounted block allocation when expanding inode

Jan Kara <[email protected]>
ext4: initialize quota before expanding inode in setproject ioctl

Ye Bin <[email protected]>
ext4: fix inode leak in ext4_xattr_inode_create() on an error path

Jan Kara <[email protected]>
ext4: avoid BUG_ON when creating xattrs

Luís Henriques <[email protected]>
ext4: fix error code return to user-space in ext4_get_branch()

Baokun Li <[email protected]>
ext4: fix corruption when online resizing a 1K bigalloc fs

Ye Bin <[email protected]>
ext4: init quota for 'old.inode' in 'ext4_rename'

Baokun Li <[email protected]>
ext4: fix bug_on in __es_tree_search caused by bad boot loader inode

Baokun Li <[email protected]>
ext4: add helper to check quota inums

Gaosheng Cui <[email protected]>
ext4: fix undefined behavior in bit shift for ext4_check_flag_values

Baokun Li <[email protected]>
ext4: add inode table check in __ext4_get_inode_loc to aovid possible infinite loop

Zack Rusin <[email protected]>
drm/vmwgfx: Validate the box size for the snooped cursor

Simon Ser <[email protected]>
drm/connector: send hotplug uevent on connector cleanup

Wang Weiyang <[email protected]>
device_cgroup: Roll back to original exceptions after copy failure

Shang XiaoJing <[email protected]>
parisc: led: Fix potential null-ptr-deref in start_task()

Kim Phillips <[email protected]>
iommu/amd: Fix ivrs_acpihid cmdline parsing code

Corentin Labbe <[email protected]>
crypto: n2 - add missing hash statesize

Sascha Hauer <[email protected]>
PCI/sysfs: Fix double free in error path

Michael S. Tsirkin <[email protected]>
PCI: Fix pci_device_is_present() for VFs by checking PF

Dan Carpenter <[email protected]>
ipmi: fix use after free in _ipmi_destroy_user()

Huaxin Lu <[email protected]>
ima: Fix a potential NULL pointer access in ima_restore_measurement_list

Zhang Yuchen <[email protected]>
ipmi: fix long wait in unload when IPMI disconnect

Florian-Ewald Mueller <[email protected]>
md/bitmap: Fix bitmap chunk size overflow issues

Paulo Alcantara <[email protected]>
cifs: fix confusing debug message

Takashi Iwai <[email protected]>
media: dvb-core: Fix UAF due to refcount races at releasing

Keita Suzuki <[email protected]>
media: dvb-core: Fix double free in dvb_register_device()

Nick Desaulniers <[email protected]>
ARM: 9256/1: NWFPE: avoid compiler-generated __aeabi_uldivmod

Yang Jihong <[email protected]>
tracing: Fix infinite loop in tracing_read_pipe on overflowed print_trace_line

Ashok Raj <[email protected]>
x86/microcode/intel: Do not retry microcode reloading on the APs

Mike Snitzer <[email protected]>
dm cache: set needs_check flag after aborting metadata

Luo Meng <[email protected]>
dm cache: Fix UAF in destroy()

Luo Meng <[email protected]>
dm thin: Fix UAF in run_timer_softirq()

Zhihao Cheng <[email protected]>

    dm thin: Use last transaction's pmd->root when commit failed

Mike Snitzer <[email protected]>
dm cache: Fix ABBA deadlock between shrink_slab and dm_cache_metadata_abort

Wang Yufen <[email protected]>
binfmt: Fix error return code in load_elf_fdpic_binary()

Eric W. Biederman <[email protected]>
binfmt: Move install_exec_creds after setup_new_exec to match binfmt_elf

Mickaël Salaün <[email protected]>
selftests: Use optional USERCFLAGS and USERLDFLAGS

Jason A. Donenfeld <[email protected]>
ARM: ux500: do not directly dereference __iomem

Steven Rostedt <[email protected]>
ktest.pl minconfig: Unset configs instead of just removing them

Manivannan Sadhasivam <[email protected]>
soc: qcom: Select REMAP_MMIO for LLCC driver

Jason A. Donenfeld <[email protected]>
media: stv0288: use explicitly signed char

Chuck Lever <[email protected]>
SUNRPC: Don't leak netobj memory when gss_read_proxy_verf() fails

Hanjun Guo <[email protected]>
tpm: tpm_tis: Add the missed acpi_put_table() to fix memory leak

Hanjun Guo <[email protected]>
tpm: tpm_crb: Add the missed acpi_put_table() to fix memory leak

Deren Wu <[email protected]>
mmc: vub300: fix warning - do not call blocking ops when !TASK_RUNNING

Mikulas Patocka <[email protected]>
md: fix a crash in mempool_free

Christian Brauner <[email protected]>
pnode: terminate at peers of source

Artem Egorkine <[email protected]>
ALSA: line6: fix stack overflow in line6_midi_transmit

Artem Egorkine <[email protected]>
ALSA: line6: correct midi status byte when receiving data from podxt

Zhang Tianci <[email protected]>
ovl: Use ovl mounter's fsuid and fsgid in ovl_link()

Aditya Garg <[email protected]>
hfsplus: fix bug causing custom uid and gid being unable to be assigned with mount

Terry Junge <[email protected]>
HID: plantronics: Additional PIDs for double volume key presses quirk

Nathan Lynch <[email protected]>
powerpc/rtas: avoid scheduling in rtas_os_term()

Nathan Lynch <[email protected]>
powerpc/rtas: avoid device tree lookups in rtas_os_term()

Adam Vodopjan <[email protected]>
ata: ahci: Fix PCS quirk application for suspend

Lin Ma <[email protected]>
media: dvbdev: fix refcnt bug

Lin Ma <[email protected]>
media: dvbdev: fix build warning due to comments

Rickard x Andersson <[email protected]>
gcov: add support for checksum field

Nuno Sá <[email protected]>
iio: adc: ad_sigma_delta: do not use internal iio_dev lock

Roberto Sassu <[email protected]>
reiserfs: Add missing calls to reiserfs_security_free()

Jason Gerecke <[email protected]>
HID: wacom: Ensure bootloader PID is usable in hidraw mode

Ferry Toth <[email protected]>
usb: dwc3: core: defer probe on ulpi_read_id timeout

John Stultz <[email protected]>
pstore: Make sure CONFIG_PSTORE_PMSG selects CONFIG_RT_MUTEXES

Yang Jihong <[email protected]>
perf debug: Set debug_peo_args and redirect_to_stderr variable to correct values in perf_quiet_option()

John Stultz <[email protected]>
pstore: Switch pmsg_lock to an rt_mutex to avoid priority inversion

Hans de Goede <[email protected]>
ASoC: rt5670: Remove unbalanced pm_runtime_put()

Wang Jingjin <[email protected]>
ASoC: rockchip: spdif: Add missing clk_disable_unprepare() in rk_spdif_runtime_resume()

Marek Szyprowski <[email protected]>
ASoC: wm8994: Fix potential deadlock

Wang Jingjin <[email protected]>
ASoC: rockchip: pdm: Add missing clk_disable_unprepare() in rockchip_pdm_runtime_resume()

Wang Yufen <[email protected]>

    ASoC: mediatek: mt8173-rt5650-rt5514: fix refcount leak in mt8173_rt5650_rt5514_dev_probe()

Zhang Xiaoxu <[email protected]>
orangefs: Fix kmemleak in orangefs_prepare_debugfs_help_string()

Nathan Chancellor <[email protected]>
drm/sti: Fix return type of sti_{dvo,hda,hdmi}_connector_mode_valid()

Nathan Chancellor <[email protected]>
drm/fsl-dcu: Fix return type of fsl_dcu_drm_connector_mode_valid()

Xiu Jianfeng <[email protected]>
clk: st: Fix memory leak in st_of_quadfs_setup()

Shigeru Yoshida <[email protected]>

    media: si470x: Fix use-after-free in si470x_int_in_callback()

Kunihiko Hayashi <[email protected]>
mmc: f-sdh30: Add quirks for broken timeout clock capability

Rui Zhang <[email protected]>
regulator: core: fix use_count leakage when handling boot-on

Ye Bin <[email protected]>
blk-mq: fix possible memleak when register 'hctx' failed

Mazin Al Haddad <[email protected]>
media: dvb-usb: fix memory leak in dvb_usb_adapter_init()

Lin Ma <[email protected]>
media: dvbdev: adopts refcnt to avoid UAF

Yan Lei <[email protected]>
media: dvb-frontends: fix leak of memory fw

Stanislav Fomichev <[email protected]>
ppp: associate skb with a device at tx

Schspa Shi <[email protected]>
mrp: introduce active flags to prevent UAF when applicant uninit

Jiang Li <[email protected]>
md/raid1: stop mdx_raid1 thread when raid1 array run failed

Li Zhong <[email protected]>
drivers/md/md-bitmap: check the return value of md_bitmap_get_counter()

Ville Syrjälä <[email protected]>
drm/sti: Use drm_mode_copy()

Nathan Chancellor <[email protected]>
s390/lcs: Fix return type of lcs_start_xmit()

Nathan Chancellor <[email protected]>
s390/netiucv: Fix return type of netiucv_tx()

Nathan Chancellor <[email protected]>
s390/ctcm: Fix return type of ctc{mp,}m_tx()

Nathan Chancellor <[email protected]>
drm/amdgpu: Fix type of second parameter in trans_msg() callback

Kees Cook <[email protected]>
igb: Do not free q_vector unless new one was allocated

Minsuk Kang <[email protected]>
wifi: brcmfmac: Fix potential shift-out-of-bounds in brcmf_fw_alloc_request()

Nathan Chancellor <[email protected]>
hamradio: baycom_epp: Fix return type of baycom_send_packet()

Nathan Chancellor <[email protected]>
net: ethernet: ti: Fix return type of netcp_ndo_start_xmit()

Stanislav Fomichev <[email protected]>

    bpf: make sure skb->len != 0 when redirecting to a tunneling device

Zhang Yuchen <[email protected]>
ipmi: fix memleak when unload ipmi driver

Amadeusz Sławiński <[email protected]>
ASoC: codecs: rt298: Add quirk for KBL-R RVP platform

Shigeru Yoshida <[email protected]>

    wifi: ar5523: Fix use-after-free on ar5523_cmd() timed out

Fedor Pchelkin <[email protected]>
wifi: ath9k: verify the expected usb_endpoints are present

ZhangPeng <[email protected]>
hfs: fix OOB Read in __hfs_brec_find

Zheng Yejian <[email protected]>
acct: fix potential integer overflow in encode_comp_t()

Ryusuke Konishi <[email protected]>
nilfs2: fix shift-out-of-bounds/overflow in nilfs_sb2_bad_offset()

Rafael J. Wysocki <[email protected]>
ACPICA: Fix error code path in acpi_ds_call_control_method()

Hoi Pok Wu <[email protected]>
fs: jfs: fix shift-out-of-bounds in dbDiscardAG

Shigeru Yoshida <[email protected]>
udf: Avoid double brelse() in udf_rename()

Dongliang Mu <[email protected]>
fs: jfs: fix shift-out-of-bounds in dbAllocAG

Liu Shixin <[email protected]>
binfmt_misc: fix shift-out-of-bounds in check_special_flags

Eric Dumazet <[email protected]>
net: stream: purge sk_error_queue in sk_stream_kill_queues()

Christophe JAILLET <[email protected]>
myri10ge: Fix an error handling path in myri10ge_probe()

David Howells <[email protected]>
rxrpc: Fix missing unlock in rxrpc_do_sendmsg()

Cong Wang <[email protected]>
net_sched: reject TCF_EM_SIMPLE case for complex ematch module

Subash Abhinov Kasiviswanathan <[email protected]>
skbuff: Account for tail adjustment during pull operations

Eelco Chaudron <[email protected]>
openvswitch: Fix flow lookup to use unmasked key

GUO Zihua <[email protected]>
rtc: mxc_v2: Add missing clk_disable_unprepare()

Li Zetao <[email protected]>
r6040: Fix kmemleak in probe and remove

Minsuk Kang <[email protected]>
nfc: pn533: Clear nfc_target before being used

Yang Yingliang <[email protected]>
mISDN: hfcmulti: don't call dev_kfree_skb/kfree_skb() under spin_lock_irqsave()

Yang Yingliang <[email protected]>
mISDN: hfcpci: don't call dev_kfree_skb/kfree_skb() under spin_lock_irqsave()

Yang Yingliang <[email protected]>
mISDN: hfcsusb: don't call dev_kfree_skb/kfree_skb() under spin_lock_irqsave()

Dan Aloni <[email protected]>
nfsd: under NFSv4.1, fix double svc_xprt_put on rpc_create failure

Gaosheng Cui <[email protected]>
rtc: st-lpc: Add missing clk_disable_unprepare in st_rtc_probe()

Nathan Lynch <[email protected]>
powerpc/pseries/eeh: use correct API for error log size

Haowen Bai <[email protected]>
powerpc/eeh: Drop redundant spinlock initialization

Oliver O'Halloran <[email protected]>

    powerpc/pseries: Stop using eeh_ops->init()

Wen Xiong <[email protected]>
powerpc/pseries: PCIE PHB reset

Sam Bobroff <[email protected]>
powerpc/eeh: Fix pseries_eeh_configure_bridge()

Sam Bobroff <[email protected]>
powerpc/eeh: EEH for pSeries hot plug

Sam Bobroff <[email protected]>
powerpc/eeh: Improve debug messages around device addition

Yuan Can <[email protected]>
remoteproc: qcom_q6v5_pas: Fix missing of_node_put() in adsp_alloc_memory_region()

Bjorn Andersson <[email protected]>
remoteproc: qcom: Rename Hexagon v5 PAS driver

Miaoqian Lin <[email protected]>
selftests/powerpc: Fix resource leaks

Kajol Jain <[email protected]>
powerpc/hv-gpci: Fix hv_gpci event list

Yang Yingliang <[email protected]>
powerpc/83xx/mpc832x_rdb: call platform_device_put() in error case in of_fsl_spi_probe()

Nicholas Piggin <[email protected]>
powerpc/perf: callchain validate kernel stack pointer bounds

Yang Yingliang <[email protected]>
powerpc/xive: add missing iounmap() in error path in xive_spapr_populate_irq_data()

Miaoqian Lin <[email protected]>
cxl: Fix refcount leak in cxl_calc_capp_routing

Christophe JAILLET <[email protected]>
powerpc/52xx: Fix a resource leak in an error handling path

Xie Shaowen <[email protected]>
macintosh/macio-adb: check the return value of ioremap()

Yang Yingliang <[email protected]>
macintosh: fix possible memory leak in macio_add_one_device()

Yuan Can <[email protected]>
iommu/fsl_pamu: Fix resource leak in fsl_pamu_probe()

Yang Yingliang <[email protected]>
iommu/amd: Fix pci device refcount leak in ppr_notifier()

Stefan Eichenberger <[email protected]>
rtc: snvs: Allow a time difference on clock register read

Rafael J. Wysocki <[email protected]>
rtc: cmos: Disable ACPI RTC event on removal

Rafael J. Wysocki <[email protected]>
rtc: cmos: Rename ACPI-related functions

Rafael J. Wysocki <[email protected]>
rtc: cmos: Eliminate forward declarations of some functions

Rafael J. Wysocki <[email protected]>
rtc: cmos: Call rtc_wake_setup() from cmos_do_probe()

Rafael J. Wysocki <[email protected]>
rtc: cmos: Call cmos_wake_setup() from cmos_do_probe()

Alexandre Belloni <[email protected]>
rtc: cmos: fix build on non-ACPI platforms

Rafael J. Wysocki <[email protected]>
rtc: cmos: Fix wake alarm breakage

Rafael J. Wysocki <[email protected]>
rtc: cmos: Fix event handler registration ordering issue

Rafael J. Wysocki <[email protected]>
rtc: rtc-cmos: Do not check ACPI_FADT_LOW_POWER_S0

Andy Shevchenko <[email protected]>
rtc: cmos: Refactor code by using the new dmi_get_bios_year() helper

Matt Redfearn <[email protected]>
include/uapi/linux/swab: Fix potentially missing __always_inline

Yuan Can <[email protected]>
HSI: omap_ssi_core: Fix error handling in ssi_init()

Ajay Kaher <[email protected]>
perf symbol: correction while adjusting symbol

Zeng Heng <[email protected]>
power: supply: fix residue sysfs file in error handle route of __power_supply_register()

Yang Yingliang <[email protected]>
HSI: omap_ssi_core: fix possible memory leak in ssi_probe()

Yang Yingliang <[email protected]>
HSI: omap_ssi_core: fix unbalanced pm_runtime_disable()

Christophe JAILLET <[email protected]>
fbdev: uvesafb: Fixes an error handling path in uvesafb_probe()

Xiongfeng Wang <[email protected]>
fbdev: vermilion: decrease reference count in error path

Shang XiaoJing <[email protected]>
fbdev: via: Fix error in via_core_init()

Yang Yingliang <[email protected]>
fbdev: pm2fb: fix missing pci_disable_device()

Andy Shevchenko <[email protected]>
fbdev: ssd1307fb: Drop optional dependency

Shang XiaoJing <[email protected]>
samples: vfio-mdev: Fix missing pci_disable_device() in mdpy_fb_probe()

Zheng Yejian <[email protected]>
tracing/hist: Fix issue of losting command info in error_log

Jiasheng Jiang <[email protected]>
usb: storage: Add check for kcalloc

Zheyu Ma <[email protected]>
i2c: ismt: Fix an out-of-bounds bug in ismt_access()

Yang Yingliang <[email protected]>
i2c: mux: reg: check return value after calling platform_get_resource()

Dejin Zheng <[email protected]>
drivers: provide devm_platform_get_and_ioremap_resource()

Bartosz Golaszewski <[email protected]>
drivers: provide devm_platform_ioremap_resource()

Chen Zhongjin <[email protected]>
vme: Fix error not catched in fake_init()

YueHaibing <[email protected]>
staging: rtl8192e: Fix potential use-after-free in rtllib_rx_Monitor()

Dan Carpenter <[email protected]>

    staging: rtl8192u: Fix use after free in ieee80211_rx()

Hui Tang <[email protected]>
i2c: pxa-pci: fix missing pci_disable_device() on error in ce4100_i2c_probe

Yang Yingliang <[email protected]>
chardev: fix error handling in cdev_device_add()

Yang Yingliang <[email protected]>
mcb: mcb-parse: fix error handing in chameleon_parse_gdd()

Zhengchao Shao <[email protected]>
drivers: mcb: fix resource leak in mcb_probe()

John Keeping <[email protected]>
usb: gadget: f_hid: fix refcount leak on error path

John Keeping <[email protected]>
usb: gadget: f_hid: fix f_hidg lifetime vs cdev

Maxim Devaev <[email protected]>
usb: gadget: f_hid: optional SETUP/SET_REPORT mode

Yang Yingliang <[email protected]>
cxl: fix possible null-ptr-deref in cxl_pci_init_afu|adapter()

Yang Yingliang <[email protected]>
cxl: fix possible null-ptr-deref in cxl_guest_init_afu|adapter()

Zheng Wang <[email protected]>
misc: sgi-gru: fix use-after-free error in gru_set_context_option, gru_fault and gru_handle_user_call_os

ruanjinjie <[email protected]>
misc: tifm: fix possible memory leak in tifm_7xx1_switch_media()

Zhengchao Shao <[email protected]>
test_firmware: fix memory leak in test_firmware_init()

Yuan Can <[email protected]>
serial: sunsab: Fix error handling in sunsab_init()

Gabriel Somlo <[email protected]>
serial: altera_uart: fix locking in polling mode

Jiri Slaby <[email protected]>
tty: serial: altera_uart_{r,t}x_chars() need only uart_port

Jiri Slaby <[email protected]>
tty: serial: clean up stop-tx part in altera_uart_tx_chars()

Xiongfeng Wang <[email protected]>
serial: pch: Fix PCI device refcount leak in pch_request_dma()

delisun <[email protected]>
serial: pl011: Do not clear RX FIFO & RX interrupt in unthrottle.

Jiamei Xie <[email protected]>
serial: amba-pl011: avoid SBSA UART accessing DMACR register

Sven Peter <[email protected]>

    usb: typec: Check for ops->exit instead of ops->enter in altmode_exit

Gaosheng Cui <[email protected]>
staging: vme_user: Fix possible UAF in tsi148_dma_list_add

Linus Walleij <[email protected]>
usb: fotg210-udc: Fix ages old endianness issues

Rafael Mendonca <[email protected]>
uio: uio_dmem_genirq: Fix deadlock between irq config and handling

Rafael Mendonca <[email protected]>
uio: uio_dmem_genirq: Fix missing unlock in irq configuration

Rafael Mendonca <[email protected]>
vfio: platform: Do not pass return buffer to ACPI _RST method

Yang Yingliang <[email protected]>
class: fix possible memory leak in __class_register()

Kartik <[email protected]>
serial: tegra: Read DMA status before terminating

Dmitry Osipenko <[email protected]>
tty: serial: tegra: Activate RX DMA transfer by request

Krishna Yarlagadda <[email protected]>
serial: tegra: Add PIO mode support

Krishna Yarlagadda <[email protected]>
serial: tegra: report clk rate errors

Krishna Yarlagadda <[email protected]>
serial: tegra: add support to adjust baud rate

Krishna Yarlagadda <[email protected]>
serial: tegra: add support to use 8 bytes trigger

Krishna Yarlagadda <[email protected]>
serial: tegra: set maximum num of uart ports to 8

Krishna Yarlagadda <[email protected]>
serial: tegra: check for FIFO mode enabled status

Ahung Cheng <[email protected]>
serial: tegra: avoid reg access when clk disabled

Yang Yingliang <[email protected]>
drivers: dio: fix possible memory leak in dio_init()

Dragos Tatulea <[email protected]>
IB/IPoIB: Fix queue count inconsistency for PKEY child interfaces

Xiongfeng Wang <[email protected]>
hwrng: geode - Fix PCI device refcount leak

Xiongfeng Wang <[email protected]>
hwrng: amd - Fix PCI device refcount leak

Gaosheng Cui <[email protected]>

    crypto: img-hash - Fix variable dereferenced before check 'hdev->req'

Zhang Xiaoxu <[email protected]>
orangefs: Fix sysfs not cleanup when dev init failed

Wang Yufen <[email protected]>
RDMA/hfi1: Fix error return code in parse_platform_config()

Gaosheng Cui <[email protected]>
scsi: snic: Fix possible UAF in snic_tgt_create()

Chen Zhongjin <[email protected]>
scsi: fcoe: Fix transport not deattached when fcoe_if_init() fails

Shang XiaoJing <[email protected]>
scsi: ipr: Fix WARNING in ipr_init()

Yang Yingliang <[email protected]>
scsi: fcoe: Fix possible name leak when device_register() fails

Yang Yingliang <[email protected]>
scsi: hpsa: Fix possible memory leak in hpsa_add_sas_device()

Yang Yingliang <[email protected]>
scsi: hpsa: Fix error handling in hpsa_add_sas_host()

Yang Yingliang <[email protected]>
scsi: mpt3sas: Fix possible resource leaks in mpt3sas_transport_port_add()

Joe Perches <[email protected]>
scsi: mpt3sas: Convert uses of pr_<level> with MPT3SAS_FMT to ioc_<level>

Joe Perches <[email protected]>
scsi: mpt3sas: Add ioc_<level> logging macros

Zhang Yiqun <[email protected]>
crypto: tcrypt - Fix multibuffer skcipher speed test mem leak

Yuan Can <[email protected]>
scsi: hpsa: Fix possible memory leak in hpsa_init_one()

Don Brace <[email protected]>
scsi: hpsa: use local workqueues instead of system workqueues

Zhang Xiaoxu <[email protected]>
RDMA/rxe: Fix NULL-ptr-deref in rxe_qp_do_cleanup() when socket create failed

Uwe Kleine-König <[email protected]>
crypto: ccree - Make cc_debugfs_global_fini() available for module init function

Xiongfeng Wang <[email protected]>
RDMA/hfi: Decrease PCI device reference count in error path

Zeng Heng <[email protected]>
PCI: Check for alloc failure in pci_request_irq()

Harshit Mogalapalli <[email protected]>
scsi: scsi_debug: Fix a warning in resp_write_scat()

Mark Zhang <[email protected]>
RDMA/nldev: Return "-EAGAIN" if the cm_id isn't from expected port

Dongdong Zhang <[email protected]>
f2fs: fix normal discard process

John Johansen <[email protected]>
apparmor: Fix abi check to include v8 abi

John Johansen <[email protected]>
apparmor: fix lockdep warning when removing a namespace

Gaosheng Cui <[email protected]>
apparmor: fix a memleak in multi_transaction_new()

Piergiorgio Beruto <[email protected]>
stmmac: fix potential division by 0

Yang Yingliang <[email protected]>
Bluetooth: RFCOMM: don't call kfree_skb() under spin_lock_irqsave()

Yang Yingliang <[email protected]>
Bluetooth: hci_core: don't call kfree_skb() under spin_lock_irqsave()

Yang Yingliang <[email protected]>
Bluetooth: hci_bcsp: don't call kfree_skb() under spin_lock_irqsave()

Yang Yingliang <[email protected]>
Bluetooth: hci_h5: don't call kfree_skb() under spin_lock_irqsave()

Yang Yingliang <[email protected]>
Bluetooth: hci_qca: don't call kfree_skb() under spin_lock_irqsave()

Yang Yingliang <[email protected]>
Bluetooth: btusb: don't call kfree_skb() under spin_lock_irqsave()

Eric Pilmore <[email protected]>
ntb_netdev: Use dev_kfree_skb_any() in interrupt context

Jerry Ray <[email protected]>
net: lan9303: Fix read error execution path

Tom Lendacky <[email protected]>
net: amd-xgbe: Check only the minimum speed for active/passive cables

Tom Lendacky <[email protected]>
net: amd-xgbe: Fix logic around active and passive cables

Yang Yingliang <[email protected]>
net: amd: lance: don't call dev_kfree_skb() under spin_lock_irqsave()

Yang Yingliang <[email protected]>
hamradio: don't call dev_kfree_skb() under spin_lock_irqsave()

Yang Yingliang <[email protected]>
net: ethernet: dnet: don't call dev_kfree_skb() under spin_lock_irqsave()

Yang Yingliang <[email protected]>
net: emaclite: don't call dev_kfree_skb() under spin_lock_irqsave()

Yang Yingliang <[email protected]>
net: apple: bmac: don't call dev_kfree_skb() under spin_lock_irqsave()

Yang Yingliang <[email protected]>
net: apple: mace: don't call dev_kfree_skb() under spin_lock_irqsave()

Hangbin Liu <[email protected]>
net/tunnel: wait until all sk_user_data reader finish before releasing the sock

Li Zetao <[email protected]>
net: farsync: Fix kmemleak when rmmods farsync

Yang Yingliang <[email protected]>
ethernet: s2io: don't call dev_kfree_skb() under spin_lock_irqsave()

Yuan Can <[email protected]>
drivers: net: qlcnic: Fix potential memory leak in qlcnic_sriov_init()

Yongqiang Liu <[email protected]>
net: defxx: Fix missing err handling in dfx_init()

Artem Chernyshev <[email protected]>
net: vmw_vsock: vmci: Check memcpy_from_msg()

Dinh Nguyen <[email protected]>
clk: socfpga: use clk_hw_register for a5/c5

Lee Jones <[email protected]>
clk: socfpga: clk-pll: Remove unused variable 'rc'

Yang Jihong <[email protected]>
blktrace: Fix output non-blktrace event when blk_classic option enabled

Wang Yufen <[email protected]>
wifi: brcmfmac: Fix error return code in brcmf_sdio_download_firmware()

Chris Chiu <[email protected]>
rtl8xxxu: add enumeration for channel bandwidth

Bitterblue Smith <[email protected]>
wifi: rtl8xxxu: Add __packed to struct rtl8723bu_c2h

Xiu Jianfeng <[email protected]>
clk: samsung: Fix memory leak in _samsung_clk_register_pll()

Jiasheng Jiang <[email protected]>
media: coda: Add check for kmalloc

Jiasheng Jiang <[email protected]>
media: coda: Add check for dcoda_iram_alloc

Liang He <[email protected]>
media: c8sectpfe: Add of_node_put() when breaking out of loop

Yang Yingliang <[email protected]>
mmc: mmci: fix return value check of mmc_add_host()

Yang Yingliang <[email protected]>
mmc: wbsd: fix return value check of mmc_add_host()

Yang Yingliang <[email protected]>
mmc: via-sdmmc: fix return value check of mmc_add_host()

Yang Yingliang <[email protected]>
mmc: meson-gx: fix return value check of mmc_add_host()

Yang Yingliang <[email protected]>
mmc: atmel-mci: fix return value check of mmc_add_host()

Yang Yingliang <[email protected]>
mmc: wmt-sdmmc: fix return value check of mmc_add_host()

Yang Yingliang <[email protected]>
mmc: vub300: fix return value check of mmc_add_host()

Yang Yingliang <[email protected]>
mmc: toshsd: fix return value check of mmc_add_host()

Yang Yingliang <[email protected]>
mmc: rtsx_usb_sdmmc: fix return value check of mmc_add_host()

Yang Yingliang <[email protected]>
mmc: mxcmmc: fix return value check of mmc_add_host()

Yang Yingliang <[email protected]>
mmc: moxart: fix return value check of mmc_add_host()

Trond Myklebust <[email protected]>
NFSv4.x: Fail client initialisation if state manager thread can't run

Wang ShaoBo <[email protected]>
SUNRPC: Fix missing release socket in rpc_sockname()

Gaosheng Cui <[email protected]>
ALSA: mts64: fix possible null-ptr-defer in snd_mts64_interrupt

Liu Shixin <[email protected]>
media: saa7164: fix missing pci_disable_device()

Yang Yingliang <[email protected]>
regulator: core: fix module refcount leak in set_supply()

Chen Zhongjin <[email protected]>
wifi: cfg80211: Fix not unregister reg_pdev when load_builtin_regdb_keys() fails

Zhengchao Shao <[email protected]>

    wifi: mac80211: fix memory leak in ieee80211_if_add()

Dan Carpenter <[email protected]>
bonding: uninitialized variable in bond_miimon_inspect()

Zhang Qilong <[email protected]>
ASoC: pcm512x: Fix PM disable depth imbalance in pcm512x_probe

Xiongfeng Wang <[email protected]>
drm/amdgpu: Fix PCI device refcount leak in amdgpu_atrm_get_bios()

Xiongfeng Wang <[email protected]>
drm/radeon: Fix PCI device refcount leak in radeon_atrm_get_bios()

Liu Shixin <[email protected]>
ALSA: asihpi: fix missing pci_disable_device()

Trond Myklebust <[email protected]>
NFSv4: Fix a deadlock between nfs4_open_recover_helper() and delegreturn

Trond Myklebust <[email protected]>
NFSv4.2: Fix a memory stomp in decode_attr_security_label

Zhang Zekun <[email protected]>
drm/tegra: Add missing clk_disable_unprepare() in tegra_dc_probe()

Aakarsh Jain <[email protected]>
media: s5p-mfc: Add variant data for MFC v7 hardware for Exynos 3250 SoC

Baisong Zhong <[email protected]>

    media: dvb-usb: az6027: fix null-ptr-deref in az6027_i2c_xfer()

Chen Zhongjin <[email protected]>
media: dvb-core: Fix ignored return value in dvb_register_frontend()

ZhangPeng <[email protected]>
pinctrl: pinconf-generic: add missing of_node_put()

Gautam Menghani <[email protected]>
media: imon: fix a race condition in send_packet()

Wang ShaoBo <[email protected]>
drbd: remove call to memset before free device/resource/connection

Zheng Yongjun <[email protected]>
mtd: maps: pxa2xx-flash: fix memory leak in probe

Maor Gottlieb <[email protected]>
bonding: Export skip slave logic to function

Xiu Jianfeng <[email protected]>
clk: rockchip: Fix memory leak in rockchip_clk_register_pll()

Baisong Zhong <[email protected]>
ALSA: seq: fix undefined behavior in bit shift for SNDRV_SEQ_FILTER_USE_EVENT

Marcus Folkesson <[email protected]>
HID: hid-sensor-custom: set fixed size for custom attributes

Yuan Can <[email protected]>
media: platform: exynos4-is: Fix error handling in fimc_md_init()

Yang Yingliang <[email protected]>
media: solo6x10: fix possible memory leak in solo_sysfs_init()

Douglas Anderson <[email protected]>
Input: elants_i2c - properly handle the reset GPIO when power is off

Hui Tang <[email protected]>
mtd: lpddr2_nvm: Fix possible null-ptr-deref

Xiu Jianfeng <[email protected]>
wifi: ath10k: Fix return value in ath10k_pci_init()

Xiu Jianfeng <[email protected]>
ima: Fix misuse of dereference of pointer in template_desc_init_fields()

Yang Yingliang <[email protected]>
regulator: core: fix unbalanced of node refcount in regulator_dev_lookup()

Zeng Heng <[email protected]>
ASoC: pxa: fix null-pointer dereference in filter()

Hanjun Guo <[email protected]>
drm/radeon: Add the missed acpi_put_table() to fix memory leak

David Howells <[email protected]>
net, proc: Provide PROC_FS=n fallback for proc_create_net_single_write()

Vladimir Zapolskiy <[email protected]>
media: camss: Clean up received buffers on failed start of streaming

Marek Vasut <[email protected]>
wifi: rsi: Fix handling of 802.3 EAPOL frames sent via control port

Zhang Xiaoxu <[email protected]>
mtd: Fix device name leak when register device failed in add_mtd_device()

Liu Shixin <[email protected]>
media: vivid: fix compose size exceed boundary

Jonathan Neuschäfer <[email protected]>
spi: Update reference to struct spi_controller

Jimmy Assarsson <[email protected]>
can: kvaser_usb: Compare requested bittiming parameters with actual parameters in do_set_{,data}_bittiming

Jimmy Assarsson <[email protected]>
can: kvaser_usb: Add struct kvaser_usb_busparams

Anssi Hannula <[email protected]>
can: kvaser_usb_leaf: Fix bogus restart events

Anssi Hannula <[email protected]>
can: kvaser_usb_leaf: Fix wrong CAN state after stopping

Anssi Hannula <[email protected]>
can: kvaser_usb_leaf: Fix improved state not being reported

Anssi Hannula <[email protected]>
can: kvaser_usb_leaf: Set Warning state even without bus errors

Jimmy Assarsson <[email protected]>
can: kvaser_usb: kvaser_usb_leaf: Handle CMD_ERROR_EVENT

Jimmy Assarsson <[email protected]>
can: kvaser_usb: kvaser_usb_leaf: Rename {leaf,usbcan}_cmd_error_event to {leaf,usbcan}_cmd_can_error_event

Jimmy Assarsson <[email protected]>
can: kvaser_usb: kvaser_usb_leaf: Get capabilities from device

Vincent Mailhol <[email protected]>
can: kvaser_usb: do not increase tx statistics when sending error message frames

Ricardo Ribalda <[email protected]>
media: i2c: ad5820: Fix error path

Junlin Yang <[email protected]>
pata_ipx4xx_cf: Fix unsigned comparison with less than zero

Bitterblue Smith <[email protected]>
wifi: rtl8xxxu: Fix reading the vendor of combo chips

Fedor Pchelkin <[email protected]>
wifi: ath9k: hif_usb: Fix use-after-free in ath9k_hif_usb_reg_in_cb()

Fedor Pchelkin <[email protected]>
wifi: ath9k: hif_usb: fix memory leak of urbs in ath9k_hif_usb_dealloc_tx_urbs()

Cai Xinchen <[email protected]>
rapidio: devices: fix missing put_device in mport_cdev_open

ZhangPeng <[email protected]>
hfs: Fix OOB Write in hfs_asc2mac

Gavrilov Ilia <[email protected]>
relay: fix type mismatch when allocating memory in relay_create_buf()

Zhang Qilong <[email protected]>
eventfd: change int to __u64 in eventfd_signal() ifndef CONFIG_EVENTFD

Wang Weiyang <[email protected]>
rapidio: fix possible UAF when kfifo_alloc() fails

Chen Zhongjin <[email protected]>
fs: sysv: Fix sysv_nblocks() returns wrong value

Anastasia Belova <[email protected]>
MIPS: BCM63xx: Add check for NULL for clk in clk_enable

Yu Liao <[email protected]>
platform/x86: mxm-wmi: fix memleak in mxm_wmi_call_mx[ds|mx]()

Rafael J. Wysocki <[email protected]>
PM: runtime: Do not call __rpm_callback() from rpm_idle()

Ulf Hansson <[email protected]>
PM: runtime: Improve path in rpm_idle() when no callback

Harshit Mogalapalli <[email protected]>
xen/privcmd: Fix a possible warning in privcmd_ioctl_mmap_resource()

Xiu Jianfeng <[email protected]>
x86/xen: Fix memory leak in xen_init_lock_cpu()

Xiu Jianfeng <[email protected]>
x86/xen: Fix memory leak in xen_smp_intr_init{_pv}()

Juergen Gross <[email protected]>
xen/events: only register debug interrupt for 2-level events

Oleg Nesterov <[email protected]>

    uprobes/x86: Allow to probe a NOP instruction with 0x66 prefix

Li Zetao <[email protected]>
ACPICA: Fix use-after-free in acpi_ut_copy_ipackage_to_ipackage()

Geert Uytterhoeven <[email protected]>
clocksource/drivers/sh_cmt: Make sure channel clock supply is enabled

Yang Yingliang <[email protected]>
rapidio: rio: fix possible name leak in rio_register_mport()

Yang Yingliang <[email protected]>
rapidio: fix possible name leaks when rio_add_device() fails

Akinobu Mita <[email protected]>
debugfs: fix error when writing negative value to atomic_t debugfs file

Akinobu Mita <[email protected]>
lib/notifier-error-inject: fix error when writing -errno to debugfs file

Akinobu Mita <[email protected]>
libfs: add DEFINE_SIMPLE_ATTRIBUTE_SIGNED for signed value

Xiongfeng Wang <[email protected]>
cpufreq: amd_freq_sensitivity: Add missing pci_dev_put()

Shang XiaoJing <[email protected]>
irqchip: gic-pm: Use pm_runtime_resume_and_get() in gic_probe()

Xiongfeng Wang <[email protected]>
perf/x86/intel/uncore: Fix reference count leak in hswep_has_limit_sbox()

Yang Yingliang <[email protected]>
PNP: fix name memory leak in pnp_alloc_dev()

Yang Yingliang <[email protected]>
MIPS: vpe-cmp: fix possible memory leak while module exiting

Yang Yingliang <[email protected]>
MIPS: vpe-mt: fix possible memory leak while module exiting

Shang XiaoJing <[email protected]>
ocfs2: fix memory leak in ocfs2_stack_glue_init()

Alexey Dobriyan <[email protected]>
proc: fixup uptime selftest

Barnabás Pőcze <[email protected]>
timerqueue: Use rb_entry_safe() in timerqueue_getnext()

Chen Zhongjin <[email protected]>
perf: Fix possible memleak in pmu_dev_alloc()

Yipeng Zou <[email protected]>
selftests/ftrace: event_triggers: wait longer for test_event_enable

Ondrej Mosnacek <[email protected]>
fs: don't audit the capability check in simple_xattr_list()

Al Viro <[email protected]>
alpha: fix syscall entry in !AUDUT_SYSCALL case

Ulf Hansson <[email protected]>
cpuidle: dt: Return the correct numbers of parsed idle states

Michael Kelley <[email protected]>
tpm/tpm_crb: Fix error message in __crb_relinquish_locality()

Stephen Boyd <[email protected]>
pstore: Avoid kcore oops by vmap()ing with VM_IOREMAP

Doug Brown <[email protected]>
ARM: mmp: fix timer_read delay

Wang Yufen <[email protected]>
pstore/ram: Fix error return code in ramoops_probe()

Pali Rohár <[email protected]>
ARM: dts: turris-omnia: Add switch port 6 node

Pali Rohár <[email protected]>
ARM: dts: turris-omnia: Add ethernet aliases

Pali Rohár <[email protected]>
ARM: dts: armada-39x: Fix assigned-addresses for every PCIe Root Port

Pali Rohár <[email protected]>
ARM: dts: armada-38x: Fix assigned-addresses for every PCIe Root Port

Pali Rohár <[email protected]>
ARM: dts: armada-375: Fix assigned-addresses for every PCIe Root Port

Pali Rohár <[email protected]>
ARM: dts: armada-xp: Fix assigned-addresses for every PCIe Root Port

Pali Rohár <[email protected]>
ARM: dts: armada-370: Fix assigned-addresses for every PCIe Root Port

Pali Rohár <[email protected]>
ARM: dts: dove: Fix assigned-addresses for every PCIe Root Port

AngeloGioacchino Del Regno <[email protected]>
arm64: dts: mediatek: mt6797: Fix 26M oscillator unit name

AngeloGioacchino Del Regno <[email protected]>
arm64: dts: mt2712-evb: Fix vproc fixed regulators unit names

AngeloGioacchino Del Regno <[email protected]>
arm64: dts: mt2712e: Fix unit address for pinctrl node

AngeloGioacchino Del Regno <[email protected]>
arm64: dts: mt2712e: Fix unit_address_vs_reg warning for oscillators

Yuan Can <[email protected]>
perf: arm_dsu: Fix hotplug callback leak in dsu_pmu_init()

Zhang Qilong <[email protected]>
soc: ti: smartreflex: Fix PM disable depth imbalance in omap_sr_probe

Kory Maincent <[email protected]>
arm: dts: spear600: Fix clcd interrupt

Chen Jiahao <[email protected]>
drivers: soc: ti: knav_qmss_queue: Mark knav_acc_firmwares as static

Luca Weiss <[email protected]>
ARM: dts: qcom: apq8064: fix coresight compatible

Ivaylo Dimitrov <[email protected]>
usb: musb: remove extra check in musb_gadget_vbus_draw

Rasmus Villemoes <[email protected]>
net: loopback: use NET_NAME_PREDICTABLE for name_assign_type

Sungwoo Kim <[email protected]>
Bluetooth: L2CAP: Fix u8 overflow

Tony Nguyen <[email protected]>
igb: Initialize mailbox message for VF reset

Johan Hovold <[email protected]>
USB: serial: f81534: fix division by zero on line-speed change

Bruno Thomsen <[email protected]>

    USB: serial: cp210x: add Kamstrup RF sniffer PIDs

Duke Xin <[email protected]>
USB: serial: option: add Quectel EM05-G modem

Szymon Heidrich <[email protected]>
usb: gadget: uvc: Prevent buffer overflow in setup handler

Jan Kara <[email protected]>
udf: Fix extending file within last block

Jan Kara <[email protected]>
udf: Do not bother looking for prealloc extents if i_lenExtents matches i_size

Jan Kara <[email protected]>
udf: Fix preallocation discarding at indirect extent boundary

Jan Kara <[email protected]>
udf: Discard preallocation before extending file with a hole

Tony Jones <[email protected]>
perf script python: Remove explicit shebang from tests/attr.c

Charles Keepax <[email protected]>
ASoC: ops: Correct bounds check for second channel on SX controls

Yasushi SHOJI <[email protected]>
can: mcba_usb: Fix termination command argument

Heiko Schocher <[email protected]>
can: sja1000: fix size of OCR_MODE_MASK define

Ricardo Ribalda <[email protected]>
pinctrl: meditatek: Startup with the IRQs disabled

Mark Brown <[email protected]>
ASoC: ops: Check bounds for second channel in snd_soc_put_volsw_sx()

Jialiang Wang <[email protected]>
nfp: fix use-after-free in area_cache_get()

Ming Lei <[email protected]>
block: unhash blkdev part inode when the part is deleted

Jann Horn <[email protected]>
mm/khugepaged: invoke MMU notifiers in shmem/file collapse paths

Jann Horn <[email protected]>
mm/khugepaged: fix GUP-fast interaction by sending IPI

-------------

Diffstat:

 Documentation/driver-api/spi.rst                   |    4 +-
 Documentation/fault-injection/fault-injection.txt  |    4 +-
 Documentation/sphinx/load_config.py                |    6 +-
 Makefile                                           |    4 +-
 arch/alpha/kernel/entry.S                          |    4 +-
 arch/arm/boot/dts/armada-370.dtsi                  |    2 +-
 arch/arm/boot/dts/armada-375.dtsi                  |    2 +-
 arch/arm/boot/dts/armada-380.dtsi                  |    4 +-
 arch/arm/boot/dts/armada-385-turris-omnia.dts      |   18 +-
 arch/arm/boot/dts/armada-385.dtsi                  |    6 +-
 arch/arm/boot/dts/armada-39x.dtsi                  |    6 +-
 arch/arm/boot/dts/armada-xp-mv78230.dtsi           |    8 +-
 arch/arm/boot/dts/armada-xp-mv78260.dtsi           |   16 +-
 arch/arm/boot/dts/dove.dtsi                        |    2 +-
 arch/arm/boot/dts/qcom-apq8064.dtsi                |    2 +-
 arch/arm/boot/dts/spear600.dtsi                    |    2 +-
 arch/arm/mach-mmp/time.c                           |   11 +-
 arch/arm/nwfpe/Makefile                            |    6 +
 arch/arm64/boot/dts/mediatek/mt2712-evb.dts        |    4 +-
 arch/arm64/boot/dts/mediatek/mt2712e.dtsi          |   22 +-
 arch/arm64/boot/dts/mediatek/mt6797.dtsi           |    2 +-
 arch/arm64/include/asm/atomic_ll_sc.h              |    2 +-
 arch/arm64/include/asm/atomic_lse.h                |    2 +-
 arch/mips/bcm63xx/clk.c                            |    2 +
 arch/mips/kernel/vpe-cmp.c                         |    4 +-
 arch/mips/kernel/vpe-mt.c                          |    4 +-
 arch/parisc/include/uapi/asm/mman.h                |   17 +-
 arch/parisc/kernel/sys_parisc.c                    |   27 +
 arch/parisc/kernel/syscall_table.S                 |    2 +-
 arch/powerpc/kernel/eeh.c                          |    6 +-
 arch/powerpc/kernel/rtas.c                         |   20 +-
 arch/powerpc/perf/callchain.c                      |    1 +
 arch/powerpc/perf/hv-gpci-requests.h               |    4 +
 arch/powerpc/perf/hv-gpci.c                        |   33 +-
 arch/powerpc/perf/hv-gpci.h                        |    1 +
 arch/powerpc/perf/req-gen/perf.h                   |   20 +
 arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c      |    1 +
 arch/powerpc/platforms/83xx/mpc832x_rdb.c          |    2 +-
 arch/powerpc/platforms/powernv/eeh-powernv.c       |   53 +-
 arch/powerpc/platforms/pseries/eeh_pseries.c       |  398 ++++--
 arch/powerpc/sysdev/xive/spapr.c                   |    1 +
 arch/riscv/include/asm/uaccess.h                   |    2 +-
 arch/riscv/kernel/stacktrace.c                     |   16 +-
 arch/s390/include/asm/percpu.h                     |    2 +-
 arch/x86/boot/bioscall.S                           |    4 +-
 arch/x86/events/intel/uncore_snbep.c               |    1 +
 arch/x86/ia32/ia32_aout.c                          |    3 +-
 arch/x86/kernel/cpu/bugs.c                         |    2 +
 arch/x86/kernel/cpu/intel_rdt_rdtgroup.c           |   26 +-
 arch/x86/kernel/cpu/microcode/intel.c              |    8 +-
 arch/x86/kernel/uprobes.c                          |    4 +-
 arch/x86/xen/smp.c                                 |   41 +-
 arch/x86/xen/smp_pv.c                              |   12 +-
 arch/x86/xen/spinlock.c                            |    6 +-
 arch/x86/xen/xen-ops.h                             |    2 +
 block/blk-mq-sysfs.c                               |   11 +-
 block/partition-generic.c                          |    7 +
 crypto/tcrypt.c                                    |    9 -
 drivers/acpi/acpica/dsmethod.c                     |   10 +-
 drivers/acpi/acpica/utcopy.c                       |    7 -
 drivers/ata/ahci.c                                 |   32 +-
 drivers/ata/pata_ixp4xx_cf.c                       |    2 +-
 drivers/base/class.c                               |    5 +
 drivers/base/dd.c                                  |   17 +-
 drivers/base/platform.c                            |   40 +
 drivers/base/power/runtime.c                       |   18 +-
 drivers/block/drbd/drbd_main.c                     |    3 -
 drivers/bluetooth/btusb.c                          |    6 +-
 drivers/bluetooth/hci_bcsp.c                       |    2 +-
 drivers/bluetooth/hci_h5.c                         |    2 +-
 drivers/bluetooth/hci_qca.c                        |    2 +-
 drivers/char/hw_random/amd-rng.c                   |   18 +-
 drivers/char/hw_random/geode-rng.c                 |   36 +-
 drivers/char/ipmi/ipmi_msghandler.c                |   12 +-
 drivers/char/ipmi/ipmi_si_intf.c                   |   27 +-
 drivers/char/tpm/tpm_crb.c                         |   31 +-
 drivers/char/tpm/tpm_tis.c                         |    9 +-
 drivers/clk/rockchip/clk-pll.c                     |    1 +
 drivers/clk/samsung/clk-pll.c                      |    1 +
 drivers/clk/socfpga/clk-gate.c                     |   11 +-
 drivers/clk/socfpga/clk-periph.c                   |    8 +-
 drivers/clk/socfpga/clk-pll.c                      |   17 +-
 drivers/clk/st/clkgen-fsyn.c                       |    5 +-
 drivers/clocksource/sh_cmt.c                       |   16 +-
 drivers/cpufreq/amd_freq_sensitivity.c             |    2 +
 drivers/cpuidle/dt_idle_states.c                   |    2 +-
 drivers/crypto/ccree/cc_debugfs.c                  |    2 +-
 drivers/crypto/img-hash.c                          |    8 +-
 drivers/crypto/n2_core.c                           |    6 +
 drivers/dio/dio.c                                  |    8 +
 drivers/edac/edac_device.c                         |   17 +-
 drivers/edac/edac_module.h                         |    2 +-
 drivers/firmware/efi/efi.c                         |    9 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c           |    1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c         |    3 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h           |    5 +-
 drivers/gpu/drm/drm_connector.c                    |    3 +
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c          |    5 +-
 drivers/gpu/drm/radeon/radeon_bios.c               |   19 +-
 drivers/gpu/drm/sti/sti_dvo.c                      |    7 +-
 drivers/gpu/drm/sti/sti_hda.c                      |    7 +-
 drivers/gpu/drm/sti/sti_hdmi.c                     |    7 +-
 drivers/gpu/drm/tegra/dc.c                         |    4 +-
 drivers/gpu/drm/virtio/virtgpu_ioctl.c             |   10 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c                |    3 +-
 drivers/hid/hid-ids.h                              |    3 +
 drivers/hid/hid-plantronics.c                      |    9 +
 drivers/hid/hid-sensor-custom.c                    |    2 +-
 drivers/hid/wacom_sys.c                            |    8 +
 drivers/hid/wacom_wac.c                            |    4 +
 drivers/hid/wacom_wac.h                            |    1 +
 drivers/hsi/controllers/omap_ssi_core.c            |   14 +-
 drivers/i2c/busses/i2c-ismt.c                      |    3 +
 drivers/i2c/busses/i2c-pxa-pci.c                   |   10 +-
 drivers/i2c/muxes/i2c-mux-reg.c                    |    5 +-
 drivers/iio/adc/ad_sigma_delta.c                   |    8 +-
 drivers/infiniband/core/nldev.c                    |    2 +-
 drivers/infiniband/hw/hfi1/affinity.c              |    2 +
 drivers/infiniband/hw/hfi1/firmware.c              |    6 +
 drivers/infiniband/hw/mlx5/qp.c                    |   49 +-
 drivers/infiniband/sw/rxe/rxe_qp.c                 |    6 +-
 drivers/infiniband/ulp/ipoib/ipoib_netlink.c       |    7 +
 drivers/input/touchscreen/elants_i2c.c             |    9 +-
 drivers/iommu/amd_iommu_init.c                     |    7 +
 drivers/iommu/amd_iommu_v2.c                       |    1 +
 drivers/iommu/fsl_pamu.c                           |    2 +-
 drivers/iommu/mtk_iommu_v1.c                       |   26 +-
 drivers/irqchip/irq-gic-pm.c                       |    2 +-
 drivers/isdn/hardware/mISDN/hfcmulti.c             |   19 +-
 drivers/isdn/hardware/mISDN/hfcpci.c               |   13 +-
 drivers/isdn/hardware/mISDN/hfcsusb.c              |   12 +-
 drivers/macintosh/macio-adb.c                      |    4 +
 drivers/macintosh/macio_asic.c                     |    2 +-
 drivers/mcb/mcb-core.c                             |    4 +-
 drivers/mcb/mcb-parse.c                            |    2 +-
 drivers/md/dm-cache-metadata.c                     |   54 +-
 drivers/md/dm-cache-target.c                       |   11 +-
 drivers/md/dm-thin-metadata.c                      |    9 +
 drivers/md/dm-thin.c                               |   18 +-
 drivers/md/md-bitmap.c                             |   47 +-
 drivers/md/md.c                                    |    9 +-
 drivers/md/raid1.c                                 |    1 +
 drivers/media/dvb-core/dmxdev.c                    |    8 +
 drivers/media/dvb-core/dvb_ca_en50221.c            |    2 +-
 drivers/media/dvb-core/dvb_frontend.c              |   10 +-
 drivers/media/dvb-core/dvbdev.c                    |   33 +-
 drivers/media/dvb-frontends/bcm3510.c              |    1 +
 drivers/media/dvb-frontends/stv0288.c              |    5 +-
 drivers/media/i2c/ad5820.c                         |   10 +-
 drivers/media/pci/saa7164/saa7164-core.c           |    4 +-
 drivers/media/pci/solo6x10/solo6x10-core.c         |    1 +
 drivers/media/platform/coda/coda-bit.c             |   14 +-
 drivers/media/platform/exynos4-is/fimc-core.c      |    2 +-
 drivers/media/platform/exynos4-is/media-dev.c      |    6 +-
 drivers/media/platform/qcom/camss/camss-video.c    |    3 +-
 drivers/media/platform/s5p-mfc/s5p_mfc.c           |   17 +-
 drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c      |    4 +-
 drivers/media/platform/s5p-mfc/s5p_mfc_enc.c       |   12 +-
 drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c    |   14 +-
 .../media/platform/sti/c8sectpfe/c8sectpfe-core.c  |    1 +
 drivers/media/platform/vivid/vivid-vid-cap.c       |    1 +
 drivers/media/radio/si470x/radio-si470x-usb.c      |    4 +-
 drivers/media/rc/imon.c                            |    6 +-
 drivers/media/usb/dvb-usb/az6027.c                 |    4 +
 drivers/media/usb/dvb-usb/dvb-usb-init.c           |    4 +-
 drivers/misc/cxl/guest.c                           |   24 +-
 drivers/misc/cxl/pci.c                             |   21 +-
 drivers/misc/sgi-gru/grufault.c                    |   13 +-
 drivers/misc/sgi-gru/grumain.c                     |   22 +-
 drivers/misc/sgi-gru/grutables.h                   |    2 +-
 drivers/misc/tifm_7xx1.c                           |    2 +-
 drivers/mmc/host/atmel-mci.c                       |    9 +-
 drivers/mmc/host/meson-gx-mmc.c                    |    4 +-
 drivers/mmc/host/mmci.c                            |    4 +-
 drivers/mmc/host/moxart-mmc.c                      |    4 +-
 drivers/mmc/host/mxcmmc.c                          |    4 +-
 drivers/mmc/host/rtsx_usb_sdmmc.c                  |   11 +-
 drivers/mmc/host/sdhci_f_sdh30.c                   |    3 +
 drivers/mmc/host/toshsd.c                          |    6 +-
 drivers/mmc/host/via-sdmmc.c                       |    4 +-
 drivers/mmc/host/vub300.c                          |   13 +-
 drivers/mmc/host/wbsd.c                            |   12 +-
 drivers/mmc/host/wmt-sdmmc.c                       |    6 +-
 drivers/mtd/lpddr/lpddr2_nvm.c                     |    2 +
 drivers/mtd/maps/pxa2xx-flash.c                    |    2 +
 drivers/mtd/mtdcore.c                              |    4 +-
 drivers/net/bonding/bond_main.c                    |   49 +-
 drivers/net/can/usb/kvaser_usb/kvaser_usb.h        |   30 +-
 drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c   |  115 +-
 drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c  |  167 ++-
 drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c   |  437 +++++-
 drivers/net/can/usb/mcba_usb.c                     |   10 +-
 drivers/net/dsa/lan9303-core.c                     |    4 +-
 drivers/net/ethernet/amd/atarilance.c              |    2 +-
 drivers/net/ethernet/amd/lance.c                   |    2 +-
 drivers/net/ethernet/amd/xgbe/xgbe-drv.c           |    3 +
 drivers/net/ethernet/amd/xgbe/xgbe-i2c.c           |    4 +-
 drivers/net/ethernet/amd/xgbe/xgbe-mdio.c          |    4 +-
 drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c        |   23 +-
 drivers/net/ethernet/apple/bmac.c                  |    2 +-
 drivers/net/ethernet/apple/mace.c                  |    2 +-
 drivers/net/ethernet/dnet.c                        |    4 +-
 drivers/net/ethernet/intel/igb/igb_main.c          |   10 +-
 .../net/ethernet/mellanox/mlx5/core/lib/clock.c    |    4 +-
 drivers/net/ethernet/myricom/myri10ge/myri10ge.c   |    1 +
 drivers/net/ethernet/neterion/s2io.c               |    2 +-
 .../ethernet/netronome/nfp/nfpcore/nfp_cppcore.c   |    3 +-
 .../net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c  |    8 +-
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_dcb.h    |   10 +-
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c   |    8 +-
 .../ethernet/qlogic/qlcnic/qlcnic_sriov_common.c   |    2 +
 drivers/net/ethernet/rdc/r6040.c                   |    5 +-
 drivers/net/ethernet/renesas/ravb_main.c           |    2 +-
 .../net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c  |    3 +-
 drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.h   |    2 +-
 drivers/net/ethernet/ti/netcp_core.c               |    2 +-
 drivers/net/ethernet/xilinx/xilinx_emaclite.c      |    2 +-
 drivers/net/fddi/defxx.c                           |   22 +-
 drivers/net/hamradio/baycom_epp.c                  |    2 +-
 drivers/net/hamradio/scc.c                         |    6 +-
 drivers/net/loopback.c                             |    2 +-
 drivers/net/ntb_netdev.c                           |    4 +-
 drivers/net/phy/xilinx_gmii2rgmii.c                |    1 +
 drivers/net/ppp/ppp_generic.c                      |    2 +
 drivers/net/usb/rndis_host.c                       |    3 +-
 drivers/net/wan/farsync.c                          |    2 +
 drivers/net/wireless/ath/ar5523/ar5523.c           |    6 +
 drivers/net/wireless/ath/ath10k/pci.c              |   20 +-
 drivers/net/wireless/ath/ath9k/hif_usb.c           |   46 +-
 .../broadcom/brcm80211/brcmfmac/firmware.c         |    5 +
 .../wireless/broadcom/brcm80211/brcmfmac/pcie.c    |    2 +-
 .../wireless/broadcom/brcm80211/brcmfmac/sdio.c    |    1 +
 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h   |   11 +-
 .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c  |   18 +-
 drivers/net/wireless/rsi/rsi_91x_core.c            |    4 +-
 drivers/net/wireless/rsi/rsi_91x_hal.c             |    6 +-
 drivers/nfc/pn533/pn533.c                          |    4 +
 drivers/nfc/pn533/usb.c                            |   44 +-
 drivers/parisc/led.c                               |    3 +
 drivers/pci/irq.c                                  |    2 +
 drivers/pci/pci-sysfs.c                            |   13 +-
 drivers/pci/pci.c                                  |    2 +
 drivers/perf/arm_dsu_pmu.c                         |    6 +-
 drivers/pinctrl/mediatek/mtk-eint.c                |    9 +-
 drivers/pinctrl/pinconf-generic.c                  |    4 +-
 drivers/platform/x86/mxm-wmi.c                     |    8 +-
 drivers/platform/x86/sony-laptop.c                 |   21 +-
 drivers/pnp/core.c                                 |    4 +-
 drivers/power/avs/smartreflex.c                    |    1 +
 drivers/power/supply/power_supply_core.c           |    2 +-
 drivers/rapidio/devices/rio_mport_cdev.c           |   15 +-
 drivers/rapidio/rio-scan.c                         |    8 +-
 drivers/rapidio/rio.c                              |    9 +-
 drivers/regulator/core.c                           |   10 +-
 drivers/regulator/da9211-regulator.c               |   11 +-
 drivers/remoteproc/Kconfig                         |   27 +-
 drivers/remoteproc/Makefile                        |    2 +-
 .../{qcom_adsp_pil.c => qcom_q6v5_pas.c}           |    5 +-
 drivers/rtc/rtc-cmos.c                             |  366 ++---
 drivers/rtc/rtc-mxc_v2.c                           |    4 +-
 drivers/rtc/rtc-snvs.c                             |   16 +-
 drivers/rtc/rtc-st-lpc.c                           |    1 +
 drivers/s390/net/ctcm_main.c                       |   11 +-
 drivers/s390/net/lcs.c                             |    8 +-
 drivers/s390/net/netiucv.c                         |    9 +-
 drivers/scsi/fcoe/fcoe.c                           |    1 +
 drivers/scsi/fcoe/fcoe_sysfs.c                     |   19 +-
 drivers/scsi/hpsa.c                                |   31 +-
 drivers/scsi/hpsa.h                                |    1 +
 drivers/scsi/ipr.c                                 |   10 +-
 drivers/scsi/mpt3sas/mpt3sas_base.c                | 1065 +++++++--------
 drivers/scsi/mpt3sas/mpt3sas_base.h                |    9 +
 drivers/scsi/mpt3sas/mpt3sas_config.c              |   48 +-
 drivers/scsi/mpt3sas/mpt3sas_ctl.c                 |  493 +++----
 drivers/scsi/mpt3sas/mpt3sas_scsih.c               | 1425 +++++++++-----------
 drivers/scsi/mpt3sas/mpt3sas_transport.c           |  315 ++---
 drivers/scsi/mpt3sas/mpt3sas_trigger_diag.c        |  101 +-
 drivers/scsi/mpt3sas/mpt3sas_warpdrive.c           |   70 +-
 drivers/scsi/scsi_debug.c                          |    2 +-
 drivers/scsi/snic/snic_disc.c                      |    3 +
 drivers/soc/qcom/Kconfig                           |    1 +
 drivers/soc/ti/knav_qmss_queue.c                   |    2 +-
 drivers/soc/ux500/ux500-soc-id.c                   |   10 +-
 drivers/staging/rtl8192e/rtllib_rx.c               |    2 +-
 drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c  |    4 +-
 drivers/staging/wilc1000/wilc_sdio.c               |    1 +
 drivers/tty/hvc/hvc_xen.c                          |   46 +-
 drivers/tty/serial/altera_uart.c                   |   21 +-
 drivers/tty/serial/amba-pl011.c                    |   14 +-
 drivers/tty/serial/pch_uart.c                      |    4 +
 drivers/tty/serial/serial-tegra.c                  |  388 +++++-
 drivers/tty/serial/sunsab.c                        |    8 +-
 drivers/uio/uio_dmem_genirq.c                      |   13 +-
 drivers/usb/dwc3/core.c                            |    7 +-
 drivers/usb/gadget/function/f_hid.c                |  271 +++-
 drivers/usb/gadget/function/f_uvc.c                |    5 +-
 drivers/usb/gadget/function/u_hid.h                |    1 +
 drivers/usb/gadget/udc/fotg210-udc.c               |   12 +-
 drivers/usb/musb/musb_gadget.c                     |    2 -
 drivers/usb/serial/cp210x.c                        |    2 +
 drivers/usb/serial/f81534.c                        |   12 +-
 drivers/usb/serial/option.c                        |    3 +
 drivers/usb/storage/alauda.c                       |    2 +
 drivers/usb/typec/bus.c                            |    2 +-
 drivers/vfio/platform/vfio_platform_common.c       |    3 +-
 drivers/video/fbdev/Kconfig                        |    1 -
 drivers/video/fbdev/pm2fb.c                        |    9 +-
 drivers/video/fbdev/uvesafb.c                      |    1 +
 drivers/video/fbdev/vermilion/vermilion.c          |    4 +-
 drivers/video/fbdev/via/via-core.c                 |    9 +-
 drivers/vme/bridges/vme_fake.c                     |    2 +
 drivers/vme/bridges/vme_tsi148.c                   |    1 +
 drivers/xen/events/events_base.c                   |   10 +-
 drivers/xen/privcmd.c                              |    2 +-
 fs/binfmt_aout.c                                   |    2 +-
 fs/binfmt_elf_fdpic.c                              |    7 +-
 fs/binfmt_flat.c                                   |    3 +-
 fs/binfmt_misc.c                                   |    8 +-
 fs/btrfs/ioctl.c                                   |    9 +-
 fs/btrfs/rcu-string.h                              |    6 +-
 fs/btrfs/send.c                                    |   11 +-
 fs/char_dev.c                                      |    2 +-
 fs/cifs/connect.c                                  |    4 +-
 fs/cifs/link.c                                     |    1 +
 fs/debugfs/file.c                                  |   28 +-
 fs/ext4/ext4.h                                     |   10 +-
 fs/ext4/extents.c                                  |  139 +-
 fs/ext4/extents_status.c                           |  389 +++++-
 fs/ext4/extents_status.h                           |   76 +-
 fs/ext4/indirect.c                                 |    9 +-
 fs/ext4/inode.c                                    |  132 +-
 fs/ext4/ioctl.c                                    |   10 +-
 fs/ext4/namei.c                                    |    3 +
 fs/ext4/resize.c                                   |    6 +-
 fs/ext4/super.c                                    |   58 +-
 fs/ext4/xattr.c                                    |  182 +--
 fs/ext4/xattr.h                                    |    1 +
 fs/f2fs/segment.c                                  |    2 +-
 fs/hfs/inode.c                                     |   13 +-
 fs/hfs/trans.c                                     |    2 +-
 fs/hfsplus/hfsplus_fs.h                            |    2 +
 fs/hfsplus/inode.c                                 |   16 +-
 fs/hfsplus/options.c                               |    4 +
 fs/jfs/jfs_dmap.c                                  |   27 +-
 fs/libfs.c                                         |   22 +-
 fs/mbcache.c                                       |  121 +-
 fs/nfs/nfs4proc.c                                  |   19 +-
 fs/nfs/nfs4state.c                                 |    2 +
 fs/nfs/nfs4xdr.c                                   |   10 +-
 fs/nfsd/nfs4callback.c                             |    4 +-
 fs/nfsd/nfs4xdr.c                                  |   11 +
 fs/nilfs2/the_nilfs.c                              |   31 +-
 fs/ocfs2/stackglue.c                               |    8 +-
 fs/orangefs/orangefs-debugfs.c                     |    3 +
 fs/orangefs/orangefs-mod.c                         |    8 +-
 fs/overlayfs/dir.c                                 |   46 +-
 fs/pnode.c                                         |    2 +-
 fs/pstore/Kconfig                                  |    1 +
 fs/pstore/pmsg.c                                   |    7 +-
 fs/pstore/ram.c                                    |    2 +
 fs/pstore/ram_core.c                               |    6 +-
 fs/quota/dquot.c                                   |  110 +-
 fs/reiserfs/namei.c                                |    4 +
 fs/reiserfs/xattr_security.c                       |    2 +-
 fs/sysv/itree.c                                    |    2 +-
 fs/udf/inode.c                                     |   76 +-
 fs/udf/namei.c                                     |    8 +-
 fs/udf/truncate.c                                  |   48 +-
 fs/xattr.c                                         |    2 +-
 include/asm-generic/tlb.h                          |    6 +
 include/linux/can/platform/sja1000.h               |    2 +-
 include/linux/debugfs.h                            |   19 +-
 include/linux/eventfd.h                            |    2 +-
 include/linux/fs.h                                 |   12 +-
 include/linux/mbcache.h                            |   41 +-
 include/linux/platform_device.h                    |    6 +
 include/linux/proc_fs.h                            |    2 +
 include/linux/quotaops.h                           |    2 +
 include/linux/sunrpc/rpc_pipe_fs.h                 |    5 +
 include/linux/timerqueue.h                         |    2 +-
 include/media/dvbdev.h                             |   32 +-
 include/net/mrp.h                                  |    1 +
 include/trace/events/ext4.h                        |   39 +-
 include/uapi/linux/swab.h                          |    2 +-
 include/uapi/sound/asequencer.h                    |    8 +-
 kernel/acct.c                                      |    2 +
 kernel/events/core.c                               |    8 +-
 kernel/gcov/gcc_4_7.c                              |    5 +
 kernel/relay.c                                     |    4 +-
 kernel/trace/blktrace.c                            |    3 +-
 kernel/trace/trace.c                               |   15 +-
 kernel/trace/trace_events_hist.c                   |    2 +-
 lib/notifier-error-inject.c                        |    2 +-
 lib/test_firmware.c                                |    1 +
 mm/khugepaged.c                                    |   24 +-
 mm/memory.c                                        |    5 +
 net/802/mrp.c                                      |   18 +-
 net/bluetooth/hci_core.c                           |    2 +-
 net/bluetooth/l2cap_core.c                         |    3 +-
 net/bluetooth/rfcomm/core.c                        |    2 +-
 net/caif/cfctrl.c                                  |    6 +-
 net/core/filter.c                                  |   11 +-
 net/core/skbuff.c                                  |    3 +
 net/core/stream.c                                  |    6 +
 net/ipv4/inet_connection_sock.c                    |   16 +-
 net/ipv4/udp_tunnel.c                              |    1 +
 net/ipv6/raw.c                                     |    4 +
 net/mac80211/iface.c                               |    1 +
 net/netfilter/ipset/ip_set_bitmap_ip.c             |    4 +-
 net/nfc/netlink.c                                  |   52 +-
 net/openvswitch/datapath.c                         |   25 +-
 net/rxrpc/sendmsg.c                                |    2 +-
 net/sched/ematch.c                                 |    2 +
 net/sched/sch_api.c                                |    8 +-
 net/sched/sch_atm.c                                |    5 +-
 net/sunrpc/auth_gss/auth_gss.c                     |   19 +-
 net/sunrpc/auth_gss/svcauth_gss.c                  |    9 +-
 net/sunrpc/clnt.c                                  |    2 +-
 net/vmw_vsock/vmci_transport.c                     |    6 +-
 net/wireless/reg.c                                 |    4 +-
 samples/vfio-mdev/mdpy-fb.c                        |    8 +-
 security/apparmor/apparmorfs.c                     |    4 +-
 security/apparmor/policy.c                         |    2 +-
 security/apparmor/policy_unpack.c                  |    2 +-
 security/device_cgroup.c                           |   33 +-
 security/integrity/ima/ima_template.c              |    9 +-
 sound/core/control_compat.c                        |    4 +
 sound/drivers/mts64.c                              |    3 +
 sound/pci/asihpi/hpioctl.c                         |    2 +-
 sound/pci/hda/patch_hdmi.c                         |   36 +-
 sound/pci/hda/patch_realtek.c                      |  350 ++++-
 sound/soc/codecs/pcm512x.c                         |    8 +-
 sound/soc/codecs/rt298.c                           |    7 +
 sound/soc/codecs/rt5670.c                          |    2 -
 sound/soc/codecs/wm8994.c                          |    5 +
 sound/soc/intel/boards/bytcr_rt5640.c              |   15 +
 sound/soc/mediatek/mt8173/mt8173-rt5650-rt5514.c   |    7 +-
 sound/soc/pxa/mmp-pcm.c                            |    2 +-
 sound/soc/rockchip/rockchip_pdm.c                  |    1 +
 sound/soc/rockchip/rockchip_spdif.c                |    1 +
 sound/soc/soc-ops.c                                |    9 +-
 sound/usb/line6/driver.c                           |    3 +-
 sound/usb/line6/midi.c                             |    6 +-
 sound/usb/line6/midibuf.c                          |   25 +-
 sound/usb/line6/midibuf.h                          |    5 +-
 sound/usb/line6/pod.c                              |    3 +-
 tools/arch/parisc/include/uapi/asm/mman.h          |   12 +-
 tools/perf/bench/bench.h                           |   12 -
 tools/perf/tests/attr.py                           |    1 -
 tools/perf/util/auxtrace.c                         |    2 +-
 tools/perf/util/debug.c                            |    4 +
 tools/perf/util/dwarf-aux.c                        |   23 +-
 tools/perf/util/symbol-elf.c                       |    2 +-
 tools/testing/ktest/ktest.pl                       |  102 +-
 .../ftrace/test.d/ftrace/func_event_triggers.tc    |   15 +-
 tools/testing/selftests/lib.mk                     |    5 +
 .../selftests/powerpc/dscr/dscr_sysfs_test.c       |    5 +-
 tools/testing/selftests/proc/proc-uptime-002.c     |    3 +-
 458 files changed, 7143 insertions(+), 4041 deletions(-)
author maintainer
#7 lore raw

PATCH 7/521 can: sja1000: fix size of OCR_MODE_MASK define

From: Heiko Schocher <[email protected]>

[ Upstream commit 26e8f6a75248247982458e8237b98c9fb2ffcf9d ]

bitfield mode in ocr register has only 2 bits not 3, so correct the OCR_MODE_MASK define.

---
 include/linux/can/platform/sja1000.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/can/platform/sja1000.h +1 -1
index 5755ae5a4712..6a869682c120 100644
@@ -14,7 +14,7 @@
 #define OCR_MODE_TEST     0x01
 #define OCR_MODE_NORMAL   0x02
 #define OCR_MODE_CLOCK    0x03
-#define OCR_MODE_MASK     0x07
+#define OCR_MODE_MASK     0x03
 #define OCR_TX0_INVERT    0x04
 #define OCR_TX0_PULLDOWN  0x08
 #define OCR_TX0_PULLUP    0x10
Signature · 1 line
2.35.1
author maintainer
#16 lore raw

PATCH 16/521 USB: serial: option: add Quectel EM05-G modem

In reply to Greg Kroah-Hartman

From: Duke Xin <[email protected]>

commit f0052d7a1edb3d8921b4e154aa8c46c4845b3714 upstream.

The EM05-G modem has 2 USB configurations that are configurable via the AT command AT+QCFG="usbnet",[ 0 | 2 ] which make the modem enumerate with the following interfaces, respectively:

"RMNET" : AT + DIAG + NMEA + Modem + QMI
"MBIM" : MBIM + AT + DIAG + NMEA + Modem

The detailed description of the USB configuration for each mode as follows:

RMNET Mode
--------------

T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 21 Spd=480  MxCh= 0
D:  Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
P:  Vendor=2c7c ProdID=0311 Rev= 3.18
S:  Manufacturer=Quectel
S:  Product=Quectel EM05-G
C:* #Ifs= 5 Cfg#= 1 Atr=a0 MxPwr=500mA
I:* If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
E:  Ad=83(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
E:  Ad=85(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
E:  Ad=87(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 6 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
E:  Ad=89(I) Atr=03(Int.) MxPS=   8 Ivl=32ms
E:  Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms

MBIM Mode
--------------

T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 16 Spd=480  MxCh= 0
D:  Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
P:  Vendor=2c7c ProdID=0311 Rev= 3.18
S:  Manufacturer=Quectel
S:  Product=Quectel EM05-G
C:* #Ifs= 6 Cfg#= 1 Atr=a0 MxPwr=500mA
A:  FirstIf#= 0 IfCount= 2 Cls=02(comm.) Sub=0e Prot=00
I:* If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
E:  Ad=83(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
E:  Ad=85(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
E:  Ad=87(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 0 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=0e Prot=00 Driver=cdc_mbim
E:  Ad=89(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
I:  If#= 1 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
I:* If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
E:  Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
---
 drivers/usb/serial/option.c |    3 +++
 1 file changed, 3 insertions(+)
drivers/usb/serial/option.c +3 -0
@@ -255,6 +255,7 @@ static void option_instat_callback(struc
 #define QUECTEL_PRODUCT_EP06			0x0306
 #define QUECTEL_PRODUCT_EM05G			0x030a
 #define QUECTEL_PRODUCT_EM060K			0x030b
+#define QUECTEL_PRODUCT_EM05G_SG		0x0311
 #define QUECTEL_PRODUCT_EM12			0x0512
 #define QUECTEL_PRODUCT_RM500Q			0x0800
 #define QUECTEL_PRODUCT_RM520N			0x0801
@@ -1160,6 +1161,8 @@ static const struct usb_device_id option
 	{ USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EP06, 0xff, 0, 0) },
 	{ USB_DEVICE_INTERFACE_CLASS(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM05G, 0xff),
 	  .driver_info = RSVD(6) | ZLP },
+	{ USB_DEVICE_INTERFACE_CLASS(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM05G_SG, 0xff),
+	  .driver_info = RSVD(6) | ZLP },
 	{ USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM060K, 0xff, 0x00, 0x40) },
 	{ USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM060K, 0xff, 0xff, 0x30) },
 	{ USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM060K, 0xff, 0xff, 0x40) },
author maintainer
#17 lore raw

PATCH 17/521 USB: serial: cp210x: add Kamstrup RF sniffer PIDs

In reply to Greg Kroah-Hartman

From: Bruno Thomsen <[email protected]>

commit e88906b169ebcb8046e8f0ad76edd09ab41cfdfe upstream.

The RF sniffers are based on cp210x where the RF frontends are based on a different USB stack.

RF sniffers can analyze packets meta data including power level and perform packet injection.

Can be used to perform RF frontend self-test when connected to a concentrator, ex. arch/arm/boot/dts/imx7d-flex-concentrator.dts

---
 drivers/usb/serial/cp210x.c |    2 ++
 1 file changed, 2 insertions(+)
drivers/usb/serial/cp210x.c +2 -0
@@ -196,6 +196,8 @@ static const struct usb_device_id id_tab
 	{ USB_DEVICE(0x16DC, 0x0015) }, /* W-IE-NE-R Plein & Baus GmbH CML Control, Monitoring and Data Logger */
 	{ USB_DEVICE(0x17A8, 0x0001) }, /* Kamstrup Optical Eye/3-wire */
 	{ USB_DEVICE(0x17A8, 0x0005) }, /* Kamstrup M-Bus Master MultiPort 250D */
+	{ USB_DEVICE(0x17A8, 0x0011) }, /* Kamstrup 444 MHz RF sniffer */
+	{ USB_DEVICE(0x17A8, 0x0013) }, /* Kamstrup 870 MHz RF sniffer */
 	{ USB_DEVICE(0x17A8, 0x0101) }, /* Kamstrup 868 MHz wM-Bus C-Mode Meter Reader (Int Ant) */
 	{ USB_DEVICE(0x17A8, 0x0102) }, /* Kamstrup 868 MHz wM-Bus C-Mode Meter Reader (Ext Ant) */
 	{ USB_DEVICE(0x17F4, 0xAAAA) }, /* Wavesense Jazz blood glucose meter */
author maintainer
#18 lore raw

PATCH 18/521 USB: serial: f81534: fix division by zero on line-speed change

In reply to Greg Kroah-Hartman

From: Johan Hovold <[email protected]>

commit 188c9c2e0c7f4ae864113f80c40bafb394062271 upstream.

The driver leaves the line speed unchanged in case a requested speed is not supported. Make sure to handle the case where the current speed is B0 (hangup) without dividing by zero when determining the clock source.

Fixes 3aacac02f385 ("USB: serial: f81534: add high baud rate support")
Cc Ji-Ze Hong (Peter Hong) <[email protected]>
---
 drivers/usb/serial/f81534.c |   12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/usb/serial/f81534.c +7 -5
@@ -538,9 +538,6 @@ static int f81534_submit_writer(struct u
 
 static u32 f81534_calc_baud_divisor(u32 baudrate, u32 clockrate)
 {
-	if (!baudrate)
-		return 0;
-
 	/* Round to nearest divisor */
 	return DIV_ROUND_CLOSEST(clockrate, baudrate);
 }
@@ -570,9 +567,14 @@ static int f81534_set_port_config(struct
 	u32 baud_list[] = {baudrate, old_baudrate, F81534_DEFAULT_BAUD_RATE};
 
 	for (i = 0; i < ARRAY_SIZE(baud_list); ++i) {
-		idx = f81534_find_clk(baud_list[i]);
+		baudrate = baud_list[i];
+		if (baudrate == 0) {
+			tty_encode_baud_rate(tty, 0, 0);
+			return 0;
+		}
+
+		idx = f81534_find_clk(baudrate);
 		if (idx >= 0) {
-			baudrate = baud_list[i];
 			tty_encode_baud_rate(tty, baudrate, baudrate);
 			break;
 		}
author maintainer
#19 lore raw

PATCH 19/521 igb: Initialize mailbox message for VF reset

In reply to Greg Kroah-Hartman

From: Tony Nguyen <[email protected]>

commit de5dc44370fbd6b46bd7f1a1e00369be54a041c8 upstream.

When a MAC address is not assigned to the VF, that portion of the message sent to the VF is not set. The memory, however, is allocated from the stack meaning that information may be leaked to the VM. Initialize the message buffer to 0 so that no information is passed to the VM in this case.

---
 drivers/net/ethernet/intel/igb/igb_main.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/igb/igb_main.c +1 -1
@@ -7165,7 +7165,7 @@ static void igb_vf_reset_msg(struct igb_
 {
 	struct e1000_hw *hw = &adapter->hw;
 	unsigned char *vf_mac = adapter->vf_data[vf].vf_mac_addresses;
-	u32 reg, msgbuf[3];
+	u32 reg, msgbuf[3] = {};
 	u8 *addr = (u8 *)(&msgbuf[1]);
 
 	/* process all the same items cleared in a function level reset */
author maintainer
#20 lore raw

PATCH 20/521 Bluetooth: L2CAP: Fix u8 overflow

In reply to Greg Kroah-Hartman

From: Sungwoo Kim <[email protected]>

[ Upstream commit bcd70260ef56e0aee8a4fc6cd214a419900b0765 ]

By keep sending L2CAP_CONF_REQ packets, chan->num_conf_rsp increases multiple times and eventually it will wrap around the maximum number (i.e., 255).
This patch prevents this by adding a boundary check with L2CAP_MAX_CONF_RSP

Btmon log:
Bluetooth monitor ver 5.64
= Note: Linux version 6.1.0-rc2 (x86_64) 0.264594
= Note: Bluetooth subsystem version 2.22 0.264636
@ MGMT Open: btmon (privileged) version 1.22 {0x0001} 0.272191
= New Index: 00:00:00:00:00:00 (Primary,Virtual,hci0) [hci0] 13.877604
@ RAW Open: 9496 (privileged) version 2.22 {0x0002} 13.890741
= Open Index: 00:00:00:00:00:00 [hci0] 13.900426
(...)

Quoted 1 line

ACL Data RX: Handle 200 flags 0x00 dlen 1033 #32 [hci0] 14.273106

        invalid packet size (12 != 1033)
        08 00 01 00 02 01 04 00 01 10 ff ff              ............
Quoted 1 line

ACL Data RX: Handle 200 flags 0x00 dlen 1547 #33 [hci0] 14.273561

        invalid packet size (14 != 1547)
        0a 00 01 00 04 01 06 00 40 00 00 00 00 00        ........@.....
Quoted 1 line

ACL Data RX: Handle 200 flags 0x00 dlen 2061 #34 [hci0] 14.274390

        invalid packet size (16 != 2061)
        0c 00 01 00 04 01 08 00 40 00 00 00 00 00 00 04  ........@.......
Quoted 1 line

ACL Data RX: Handle 200 flags 0x00 dlen 2061 #35 [hci0] 14.274932

        invalid packet size (16 != 2061)
        0c 00 01 00 04 01 08 00 40 00 00 00 07 00 03 00  ........@.......

= bluetoothd: Bluetooth daemon 5.43 14.401828

Quoted 1 line

ACL Data RX: Handle 200 flags 0x00 dlen 1033 #36 [hci0] 14.275753

        invalid packet size (12 != 1033)
        08 00 01 00 04 01 04 00 40 00 00 00              ........@...
---
 net/bluetooth/l2cap_core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
net/bluetooth/l2cap_core.c +2 -1
index fd6cd47a6c5a..fd95631205a6 100644
@@ -4193,7 +4193,8 @@ static inline int l2cap_config_req(struct l2cap_conn *conn,
 
 	chan->ident = cmd->ident;
 	l2cap_send_cmd(conn, cmd->ident, L2CAP_CONF_RSP, len, rsp);
-	chan->num_conf_rsp++;
+	if (chan->num_conf_rsp < L2CAP_CONF_MAX_CONF_RSP)
+		chan->num_conf_rsp++;
 
 	/* Reset config buffer. */
 	chan->conf_len = 0;
Signature · 1 line
2.35.1
author maintainer
#21 lore raw

PATCH 21/521 net: loopback: use NET_NAME_PREDICTABLE for name_assign_type

In reply to Greg Kroah-Hartman

From: Rasmus Villemoes <[email protected]>

[ Upstream commit 31d929de5a112ee1b977a89c57de74710894bbbf ]

When the name_assign_type attribute was introduced (commit 685343fc3ba6, "net: add name_assign_type netdev attribute"), the loopback device was explicitly mentioned as one which would make use of NET_NAME_PREDICTABLE:

The name_assign_type attribute gives hints where the interface name of a given net-device comes from. These values are currently defined:
...
NET_NAME_PREDICTABLE:
The ifname has been assigned by the kernel in a predictable way that is guaranteed to avoid reuse and always be the same for a given device. Examples include statically created devices like the loopback device [...]

Switch to that so that reading /sys/class/net/lo/name_assign_type produces something sensible instead of returning -EINVAL.

---
 drivers/net/loopback.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/loopback.c +1 -1
index d192936b76cf..7863918592db 100644
@@ -210,7 +210,7 @@ static __net_init int loopback_net_init(struct net *net)
 	int err;
 
 	err = -ENOMEM;
-	dev = alloc_netdev(0, "lo", NET_NAME_UNKNOWN, loopback_setup);
+	dev = alloc_netdev(0, "lo", NET_NAME_PREDICTABLE, loopback_setup);
 	if (!dev)
 		goto out;
 
Signature · 1 line
2.35.1
author maintainer
#22 lore raw

PATCH 22/521 usb: musb: remove extra check in musb_gadget_vbus_draw

In reply to Greg Kroah-Hartman

From: Ivaylo Dimitrov <[email protected]>

[ Upstream commit ecec4b20d29c3d6922dafe7d2555254a454272d2 ]

The checks for musb->xceiv and musb->xceiv->set_power duplicate those in usb_phy_set_power(), so there is no need of them. Moreover, not calling usb_phy_set_power() results in usb_phy_set_charger_current() not being called, so current USB config max current is not propagated through USB charger framework and charger drivers may try to draw more current than allowed or possible.

Fix that by removing those extra checks and calling usb_phy_set_power() directly.

Tested on Motorola Droid4 and Nokia N900

---
 drivers/usb/musb/musb_gadget.c | 2 --
 1 file changed, 2 deletions(-)
drivers/usb/musb/musb_gadget.c +0 -2
index 8e83995fc3bd..b8fc818c154a 100644
@@ -1629,8 +1629,6 @@ static int musb_gadget_vbus_draw(struct usb_gadget *gadget, unsigned mA)
 {
 	struct musb	*musb = gadget_to_musb(gadget);
 
-	if (!musb->xceiv->set_power)
-		return -EOPNOTSUPP;
 	return usb_phy_set_power(musb->xceiv, mA);
 }
 
Signature · 1 line
2.35.1
author maintainer
#23 lore raw

PATCH 23/521 ARM: dts: qcom: apq8064: fix coresight compatible

In reply to Greg Kroah-Hartman

From: Luca Weiss <[email protected]>

[ Upstream commit a42b1ee868361f1cb0492f1bdaefb43e0751e468 ]

There's a typo missing the arm, prefix of arm,coresight-etb10. Fix it to make devicetree validation happier.

---
 arch/arm/boot/dts/qcom-apq8064.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/qcom-apq8064.dtsi +1 -1
index 00daa844bf8c..3b9d70eadeb9 100644
@@ -1604,7 +1604,7 @@ wifi {
 		};
 
 		etb@1a01000 {
-			compatible = "coresight-etb10", "arm,primecell";
+			compatible = "arm,coresight-etb10", "arm,primecell";
 			reg = <0x1a01000 0x1000>;
 
 			clocks = <&rpmcc RPM_QDSS_CLK>;
Signature · 1 line
2.35.1
author maintainer
#24 lore raw

PATCH 24/521 drivers: soc: ti: knav_qmss_queue: Mark knav_acc_firmwares as static

In reply to Greg Kroah-Hartman

From: Chen Jiahao <[email protected]>

[ Upstream commit adf85adc2a7199b41e7a4da083bd17274a3d6969 ]

There is a sparse warning shown below:

drivers/soc/ti/knav_qmss_queue.c:70:12: warning: symbol 'knav_acc_firmwares' was not declared. Should it be static?

Since 'knav_acc_firmwares' is only called within knav_qmss_queue.c, mark it as static to fix the warning.

Fixes 96ee19becc3b ("soc: ti: add firmware file name as part of the driver")
---
 drivers/soc/ti/knav_qmss_queue.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soc/ti/knav_qmss_queue.c +1 -1
index 9f5ce52e6c16..b264c36b2c0e 100644
@@ -72,7 +72,7 @@ static DEFINE_MUTEX(knav_dev_lock);
  * Newest followed by older ones. Search is done from start of the array
  * until a firmware file is found.
  */
-const char *knav_acc_firmwares[] = {"ks2_qmss_pdsp_acc48.bin"};
+static const char * const knav_acc_firmwares[] = {"ks2_qmss_pdsp_acc48.bin"};
 
 static bool device_ready;
 bool knav_qmss_device_ready(void)
Signature · 1 line
2.35.1
author maintainer
#25 lore raw

PATCH 25/521 arm: dts: spear600: Fix clcd interrupt

In reply to Greg Kroah-Hartman

From: Kory Maincent <[email protected]>

[ Upstream commit 0336e2ce34e7a89832b6c214f924eb7bc58940be ]

Interrupt 12 of the Interrupt controller belongs to the SMI controller, the right one for the display controller is the interrupt 13.

Fixes 8113ba917dfa ("ARM: SPEAr: DT: Update device nodes")
---
 arch/arm/boot/dts/spear600.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/spear600.dtsi +1 -1
index 00166eb9be86..ca07e73e1f27 100644
@@ -53,7 +53,7 @@ clcd: clcd@fc200000 {
 			compatible = "arm,pl110", "arm,primecell";
 			reg = <0xfc200000 0x1000>;
 			interrupt-parent = <&vic1>;
-			interrupts = <12>;
+			interrupts = <13>;
 			status = "disabled";
 		};
 
Signature · 1 line
2.35.1
author maintainer
#8 lore raw

PATCH 8/521 can: mcba_usb: Fix termination command argument

In reply to Greg Kroah-Hartman

From: Yasushi SHOJI <[email protected]>

[ Upstream commit 1a8e3bd25f1e789c8154e11ea24dc3ec5a4c1da0 ]

Microchip USB Analyzer can activate the internal termination resistors by setting the "termination" option ON, or OFF to to deactivate them. As I've observed, both with my oscilloscope and captured USB packets below, you must send "0" to turn it ON, and "1" to turn it OFF.

Quoted 1 line

From the schematics in the user's guide, I can confirm that you must

drive the CAN_RES signal LOW "0" to activate the resistors.

Reverse the argument value of usb_msg.termination to fix this.

These are the two commands sequence, ON then OFF.

Quoted 7 lines
No.     Time           Source                Destination           Protocol Length Info
      1 0.000000       host                  1.3.1                 USB      46     URB_BULK out

Frame 1: 46 bytes on wire (368 bits), 46 bytes captured (368 bits) USB URB
Leftover Capture Data: a80000000000000000000000000000000000a8

Quoted 6 lines
No.     Time           Source                Destination           Protocol Length Info
      2 4.372547       host                  1.3.1                 USB      46     URB_BULK out

Frame 2: 46 bytes on wire (368 bits), 46 bytes captured (368 bits) USB URB
Leftover Capture Data: a80100000000000000000000000000000000a9

---
 drivers/net/can/usb/mcba_usb.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/net/can/usb/mcba_usb.c +7 -3
index ea1de06009d6..093458fbde68 100644
@@ -58,6 +58,10 @@
 #define MCBA_VER_REQ_USB 1
 #define MCBA_VER_REQ_CAN 2
 
+/* Drive the CAN_RES signal LOW "0" to activate R24 and R25 */
+#define MCBA_VER_TERMINATION_ON 0
+#define MCBA_VER_TERMINATION_OFF 1
+
 #define MCBA_SIDL_EXID_MASK 0x8
 #define MCBA_DLC_MASK 0xf
 #define MCBA_DLC_RTR_MASK 0x40
@@ -480,7 +484,7 @@ static void mcba_usb_process_ka_usb(struct mcba_priv *priv,
 		priv->usb_ka_first_pass = false;
 	}
 
-	if (msg->termination_state)
+	if (msg->termination_state == MCBA_VER_TERMINATION_ON)
 		priv->can.termination = MCBA_TERMINATION_ENABLED;
 	else
 		priv->can.termination = MCBA_TERMINATION_DISABLED;
@@ -800,9 +804,9 @@ static int mcba_set_termination(struct net_device *netdev, u16 term)
 	};
 
 	if (term == MCBA_TERMINATION_ENABLED)
-		usb_msg.termination = 1;
+		usb_msg.termination = MCBA_VER_TERMINATION_ON;
 	else
-		usb_msg.termination = 0;
+		usb_msg.termination = MCBA_VER_TERMINATION_OFF;
 
 	mcba_usb_xmit_cmd(priv, (struct mcba_usb_msg *)&usb_msg);
 
Signature · 1 line
2.35.1
author maintainer
#26 lore raw

PATCH 26/521 soc: ti: smartreflex: Fix PM disable depth imbalance in omap_sr_probe

In reply to Greg Kroah-Hartman

From: Zhang Qilong <[email protected]>

[ Upstream commit 69460e68eb662064ab4188d4e129ff31c1f23ed9 ]

The pm_runtime_enable will increase power disable depth. Thus a pairing decrement is needed on the error handling path to keep it balanced according to context.

Fixes 984aa6dbf4ca ("OMAP3: PM: Adding smartreflex driver support.")
---
 drivers/power/avs/smartreflex.c | 1 +
 1 file changed, 1 insertion(+)
drivers/power/avs/smartreflex.c +1 -0
index 8760477d0e8a..5ac122cd25b8 100644
@@ -984,6 +984,7 @@ static int omap_sr_probe(struct platform_device *pdev)
 err_debugfs:
 	debugfs_remove_recursive(sr_info->dbg_dir);
 err_list_del:
+	pm_runtime_disable(&pdev->dev);
 	list_del(&sr_info->node);
 
 	pm_runtime_put_sync(&pdev->dev);
Signature · 1 line
2.35.1
author maintainer
#27 lore raw

PATCH 27/521 perf: arm_dsu: Fix hotplug callback leak in dsu_pmu_init()

In reply to Greg Kroah-Hartman

From: Yuan Can <[email protected]>

[ Upstream commit facafab7611f7b872c6b9eeaff53461ef11f482e ]

dsu_pmu_init() won't remove the callback added by cpuhp_setup_state_multi() when platform_driver_register() failed. Remove the callback by cpuhp_remove_multi_state() in fail path.

Similar to the handling of arm_ccn_init() in commit 26242b330093 ("bus:
arm-ccn: Prevent hotplug callback leak")

---
 drivers/perf/arm_dsu_pmu.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/perf/arm_dsu_pmu.c +5 -1
index 660cb8ac886a..961533ba33e7 100644
@@ -823,7 +823,11 @@ static int __init dsu_pmu_init(void)
 	if (ret < 0)
 		return ret;
 	dsu_pmu_cpuhp_state = ret;
-	return platform_driver_register(&dsu_pmu_driver);
+	ret = platform_driver_register(&dsu_pmu_driver);
+	if (ret)
+		cpuhp_remove_multi_state(dsu_pmu_cpuhp_state);
+
+	return ret;
 }
 
 static void __exit dsu_pmu_exit(void)
Signature · 1 line
2.35.1
author maintainer
#28 lore raw

PATCH 28/521 arm64: dts: mt2712e: Fix unit_address_vs_reg warning for oscillators

In reply to Greg Kroah-Hartman

From: AngeloGioacchino Del Regno <[email protected]>

[ Upstream commit e4495a0a8b3d84816c9a46edf3ce060bbf267475 ]

Rename the fixed-clock oscillators to remove the unit address.

This solves unit_address_vs_reg warnings.

Fixes 5d4839709c8e ("arm64: dts: mt2712: Add clock controller device nodes")
---
 arch/arm64/boot/dts/mediatek/mt2712e.dtsi | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
arch/arm64/boot/dts/mediatek/mt2712e.dtsi +10 -10
index 75cc0f7cc088..b002bfd85be0 100644
@@ -158,70 +158,70 @@ sys_clk: dummyclk {
 		#clock-cells = <0>;
 	};
 
-	clk26m: oscillator@0 {
+	clk26m: oscillator-26m {
 		compatible = "fixed-clock";
 		#clock-cells = <0>;
 		clock-frequency = <26000000>;
 		clock-output-names = "clk26m";
 	};
 
-	clk32k: oscillator@1 {
+	clk32k: oscillator-32k {
 		compatible = "fixed-clock";
 		#clock-cells = <0>;
 		clock-frequency = <32768>;
 		clock-output-names = "clk32k";
 	};
 
-	clkfpc: oscillator@2 {
+	clkfpc: oscillator-50m {
 		compatible = "fixed-clock";
 		#clock-cells = <0>;
 		clock-frequency = <50000000>;
 		clock-output-names = "clkfpc";
 	};
 
-	clkaud_ext_i_0: oscillator@3 {
+	clkaud_ext_i_0: oscillator-aud0 {
 		compatible = "fixed-clock";
 		#clock-cells = <0>;
 		clock-frequency = <6500000>;
 		clock-output-names = "clkaud_ext_i_0";
 	};
 
-	clkaud_ext_i_1: oscillator@4 {
+	clkaud_ext_i_1: oscillator-aud1 {
 		compatible = "fixed-clock";
 		#clock-cells = <0>;
 		clock-frequency = <196608000>;
 		clock-output-names = "clkaud_ext_i_1";
 	};
 
-	clkaud_ext_i_2: oscillator@5 {
+	clkaud_ext_i_2: oscillator-aud2 {
 		compatible = "fixed-clock";
 		#clock-cells = <0>;
 		clock-frequency = <180633600>;
 		clock-output-names = "clkaud_ext_i_2";
 	};
 
-	clki2si0_mck_i: oscillator@6 {
+	clki2si0_mck_i: oscillator-i2s0 {
 		compatible = "fixed-clock";
 		#clock-cells = <0>;
 		clock-frequency = <30000000>;
 		clock-output-names = "clki2si0_mck_i";
 	};
 
-	clki2si1_mck_i: oscillator@7 {
+	clki2si1_mck_i: oscillator-i2s1 {
 		compatible = "fixed-clock";
 		#clock-cells = <0>;
 		clock-frequency = <30000000>;
 		clock-output-names = "clki2si1_mck_i";
 	};
 
-	clki2si2_mck_i: oscillator@8 {
+	clki2si2_mck_i: oscillator-i2s2 {
 		compatible = "fixed-clock";
 		#clock-cells = <0>;
 		clock-frequency = <30000000>;
 		clock-output-names = "clki2si2_mck_i";
 	};
 
-	clktdmin_mclk_i: oscillator@9 {
+	clktdmin_mclk_i: oscillator-mclk {
 		compatible = "fixed-clock";
 		#clock-cells = <0>;
 		clock-frequency = <30000000>;
Signature · 1 line
2.35.1
author maintainer
#29 lore raw

PATCH 29/521 arm64: dts: mt2712e: Fix unit address for pinctrl node

In reply to Greg Kroah-Hartman

From: AngeloGioacchino Del Regno <[email protected]>

[ Upstream commit 1d4516f53a611b362db7ba7a8889923d469f57e1 ]

The unit address for the pinctrl node is (0x)1000b000 and not (0x)10005000, which is the syscfg_pctl_a address instead.

This fixes the following warning:
arch/arm64/boot/dts/mediatek/mt2712e.dtsi:264.40-267.4: Warning (unique_unit_address): /syscfg_pctl_a@10005000: duplicate unit-address (also used in node /pinctrl@10005000)

Fixes f0c64340b748 ("arm64: dts: mt2712: add pintcrl device node.")
---
 arch/arm64/boot/dts/mediatek/mt2712e.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/mediatek/mt2712e.dtsi +1 -1
index b002bfd85be0..9acbd82fb44b 100644
@@ -264,7 +264,7 @@ syscfg_pctl_a: syscfg_pctl_a@10005000 {
 		reg = <0 0x10005000 0 0x1000>;
 	};
 
-	pio: pinctrl@10005000 {
+	pio: pinctrl@1000b000 {
 		compatible = "mediatek,mt2712-pinctrl";
 		reg = <0 0x1000b000 0 0x1000>;
 		mediatek,pctl-regmap = <&syscfg_pctl_a>;
Signature · 1 line
2.35.1
author maintainer
#30 lore raw

PATCH 30/521 arm64: dts: mt2712-evb: Fix vproc fixed regulators unit names

In reply to Greg Kroah-Hartman

From: AngeloGioacchino Del Regno <[email protected]>

[ Upstream commit 377063156893bf6c088309ac799fe5c6dce2822d ]

Update the names to regulator-vproc-buck{0,1} to fix unit_addres_vs_reg warnings for those.

Fixes f75dd8bdd344 ("arm64: dts: mediatek: add mt2712 cpufreq related device nodes")
---
 arch/arm64/boot/dts/mediatek/mt2712-evb.dts | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/mediatek/mt2712-evb.dts +2 -2
index 4ce9d6ca0bf7..424c22a266c4 100644
@@ -25,14 +25,14 @@ chosen {
 		stdout-path = "serial0:921600n8";
 	};
 
-	cpus_fixed_vproc0: fixedregulator@0 {
+	cpus_fixed_vproc0: regulator-vproc-buck0 {
 		compatible = "regulator-fixed";
 		regulator-name = "vproc_buck0";
 		regulator-min-microvolt = <1000000>;
 		regulator-max-microvolt = <1000000>;
 	};
 
-	cpus_fixed_vproc1: fixedregulator@1 {
+	cpus_fixed_vproc1: regulator-vproc-buck1 {
 		compatible = "regulator-fixed";
 		regulator-name = "vproc_buck1";
 		regulator-min-microvolt = <1000000>;
Signature · 1 line
2.35.1
author maintainer
#31 lore raw

PATCH 31/521 arm64: dts: mediatek: mt6797: Fix 26M oscillator unit name

In reply to Greg Kroah-Hartman

From: AngeloGioacchino Del Regno <[email protected]>

[ Upstream commit 5f535cc583759c9c60d4cc9b8d221762e2d75387 ]

Update its unit name to oscillator-26m and remove the unneeded unit address to fix a unit_address_vs_reg warning.

---
 arch/arm64/boot/dts/mediatek/mt6797.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/mediatek/mt6797.dtsi +1 -1
index 4beaa71107d7..ebe1b5343966 100644
@@ -101,7 +101,7 @@ cpu9: cpu@201 {
 		};
 	};
 
-	clk26m: oscillator@0 {
+	clk26m: oscillator-26m {
 		compatible = "fixed-clock";
 		#clock-cells = <0>;
 		clock-frequency = <26000000>;
Signature · 1 line
2.35.1
author maintainer
#32 lore raw

PATCH 32/521 ARM: dts: dove: Fix assigned-addresses for every PCIe Root Port

In reply to Greg Kroah-Hartman

From: Pali Rohár <[email protected]>

[ Upstream commit dcc7d8c72b64a479b8017e4332d99179deb8802d ]

BDF of resource in DT assigned-addresses property of Marvell PCIe Root Port (PCI-to-PCI bridge) should match BDF in address part in that DT node name as specified resource belongs to Marvell PCIe Root Port itself.

Fixes 74ecaa403a74 ("ARM: dove: add PCIe controllers to SoC DT")
---
 arch/arm/boot/dts/dove.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/dove.dtsi +1 -1
index 250ad0535e8c..c677d1a74a90 100644
@@ -129,7 +129,7 @@ pcie0: pcie@1 {
 			pcie1: pcie@2 {
 				device_type = "pci";
 				status = "disabled";
-				assigned-addresses = <0x82002800 0 0x80000 0 0x2000>;
+				assigned-addresses = <0x82001000 0 0x80000 0 0x2000>;
 				reg = <0x1000 0 0 0 0>;
 				clocks = <&gate_clk 5>;
 				marvell,pcie-port = <1>;
Signature · 1 line
2.35.1
author maintainer
#33 lore raw

PATCH 33/521 ARM: dts: armada-370: Fix assigned-addresses for every PCIe Root Port

In reply to Greg Kroah-Hartman

From: Pali Rohár <[email protected]>

[ Upstream commit d9208b0fa2e803d16b28d91bf1d46b7ee9ea13c6 ]

BDF of resource in DT assigned-addresses property of Marvell PCIe Root Port (PCI-to-PCI bridge) should match BDF in address part in that DT node name as specified resource belongs to Marvell PCIe Root Port itself.

Fixes a09a0b7c6ff1 ("arm: mvebu: add PCIe Device Tree informations for Armada 370")
---
 arch/arm/boot/dts/armada-370.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/armada-370.dtsi +1 -1
index 46e6d3ed8f35..c042c416a94a 100644
@@ -74,7 +74,7 @@ pcie0: pcie@1,0 {
 
 			pcie2: pcie@2,0 {
 				device_type = "pci";
-				assigned-addresses = <0x82002800 0 0x80000 0 0x2000>;
+				assigned-addresses = <0x82001000 0 0x80000 0 0x2000>;
 				reg = <0x1000 0 0 0 0>;
 				#address-cells = <3>;
 				#size-cells = <2>;
Signature · 1 line
2.35.1
author maintainer
#34 lore raw

PATCH 34/521 ARM: dts: armada-xp: Fix assigned-addresses for every PCIe Root Port

In reply to Greg Kroah-Hartman

From: Pali Rohár <[email protected]>

[ Upstream commit eab276787f456cbea89fabea110fe0728673d308 ]

BDF of resource in DT assigned-addresses property of Marvell PCIe Root Port (PCI-to-PCI bridge) should match BDF in address part in that DT node name as specified resource belongs to Marvell PCIe Root Port itself.

Fixes 9d8f44f02d4a ("arm: mvebu: add PCIe Device Tree informations for Armada XP")
Fixes 12b69a599745 ("ARM: mvebu: second PCIe unit of Armada XP mv78230 is only x1 capable")
Fixes 2163e61c92d9 ("ARM: mvebu: fix second and third PCIe unit of Armada XP mv78260")
---
 arch/arm/boot/dts/armada-xp-mv78230.dtsi |  8 ++++----
 arch/arm/boot/dts/armada-xp-mv78260.dtsi | 16 ++++++++--------
 2 files changed, 12 insertions(+), 12 deletions(-)
arch/arm/boot/dts/armada-xp-mv78230.dtsi +4 -4
index 8558bf6bb54c..d55fe162fc7f 100644
@@ -97,7 +97,7 @@ pcie1: pcie@1,0 {
 
 			pcie2: pcie@2,0 {
 				device_type = "pci";
-				assigned-addresses = <0x82000800 0 0x44000 0 0x2000>;
+				assigned-addresses = <0x82001000 0 0x44000 0 0x2000>;
 				reg = <0x1000 0 0 0 0>;
 				#address-cells = <3>;
 				#size-cells = <2>;
@@ -115,7 +115,7 @@ pcie2: pcie@2,0 {
 
 			pcie3: pcie@3,0 {
 				device_type = "pci";
-				assigned-addresses = <0x82000800 0 0x48000 0 0x2000>;
+				assigned-addresses = <0x82001800 0 0x48000 0 0x2000>;
 				reg = <0x1800 0 0 0 0>;
 				#address-cells = <3>;
 				#size-cells = <2>;
@@ -133,7 +133,7 @@ pcie3: pcie@3,0 {
 
 			pcie4: pcie@4,0 {
 				device_type = "pci";
-				assigned-addresses = <0x82000800 0 0x4c000 0 0x2000>;
+				assigned-addresses = <0x82002000 0 0x4c000 0 0x2000>;
 				reg = <0x2000 0 0 0 0>;
 				#address-cells = <3>;
 				#size-cells = <2>;
@@ -151,7 +151,7 @@ pcie4: pcie@4,0 {
 
 			pcie5: pcie@5,0 {
 				device_type = "pci";
-				assigned-addresses = <0x82000800 0 0x80000 0 0x2000>;
+				assigned-addresses = <0x82002800 0 0x80000 0 0x2000>;
 				reg = <0x2800 0 0 0 0>;
 				#address-cells = <3>;
 				#size-cells = <2>;
arch/arm/boot/dts/armada-xp-mv78260.dtsi +8 -8
index 2d85fe8ac327..fdcc81819940 100644
@@ -112,7 +112,7 @@ pcie1: pcie@1,0 {
 
 			pcie2: pcie@2,0 {
 				device_type = "pci";
-				assigned-addresses = <0x82000800 0 0x44000 0 0x2000>;
+				assigned-addresses = <0x82001000 0 0x44000 0 0x2000>;
 				reg = <0x1000 0 0 0 0>;
 				#address-cells = <3>;
 				#size-cells = <2>;
@@ -130,7 +130,7 @@ pcie2: pcie@2,0 {
 
 			pcie3: pcie@3,0 {
 				device_type = "pci";
-				assigned-addresses = <0x82000800 0 0x48000 0 0x2000>;
+				assigned-addresses = <0x82001800 0 0x48000 0 0x2000>;
 				reg = <0x1800 0 0 0 0>;
 				#address-cells = <3>;
 				#size-cells = <2>;
@@ -148,7 +148,7 @@ pcie3: pcie@3,0 {
 
 			pcie4: pcie@4,0 {
 				device_type = "pci";
-				assigned-addresses = <0x82000800 0 0x4c000 0 0x2000>;
+				assigned-addresses = <0x82002000 0 0x4c000 0 0x2000>;
 				reg = <0x2000 0 0 0 0>;
 				#address-cells = <3>;
 				#size-cells = <2>;
@@ -166,7 +166,7 @@ pcie4: pcie@4,0 {
 
 			pcie5: pcie@5,0 {
 				device_type = "pci";
-				assigned-addresses = <0x82000800 0 0x80000 0 0x2000>;
+				assigned-addresses = <0x82002800 0 0x80000 0 0x2000>;
 				reg = <0x2800 0 0 0 0>;
 				#address-cells = <3>;
 				#size-cells = <2>;
@@ -184,7 +184,7 @@ pcie5: pcie@5,0 {
 
 			pcie6: pcie@6,0 {
 				device_type = "pci";
-				assigned-addresses = <0x82000800 0 0x84000 0 0x2000>;
+				assigned-addresses = <0x82003000 0 0x84000 0 0x2000>;
 				reg = <0x3000 0 0 0 0>;
 				#address-cells = <3>;
 				#size-cells = <2>;
@@ -202,7 +202,7 @@ pcie6: pcie@6,0 {
 
 			pcie7: pcie@7,0 {
 				device_type = "pci";
-				assigned-addresses = <0x82000800 0 0x88000 0 0x2000>;
+				assigned-addresses = <0x82003800 0 0x88000 0 0x2000>;
 				reg = <0x3800 0 0 0 0>;
 				#address-cells = <3>;
 				#size-cells = <2>;
@@ -220,7 +220,7 @@ pcie7: pcie@7,0 {
 
 			pcie8: pcie@8,0 {
 				device_type = "pci";
-				assigned-addresses = <0x82000800 0 0x8c000 0 0x2000>;
+				assigned-addresses = <0x82004000 0 0x8c000 0 0x2000>;
 				reg = <0x4000 0 0 0 0>;
 				#address-cells = <3>;
 				#size-cells = <2>;
@@ -238,7 +238,7 @@ pcie8: pcie@8,0 {
 
 			pcie9: pcie@9,0 {
 				device_type = "pci";
-				assigned-addresses = <0x82000800 0 0x42000 0 0x2000>;
+				assigned-addresses = <0x82004800 0 0x42000 0 0x2000>;
 				reg = <0x4800 0 0 0 0>;
 				#address-cells = <3>;
 				#size-cells = <2>;
Signature · 1 line
2.35.1
author maintainer
#35 lore raw

PATCH 35/521 ARM: dts: armada-375: Fix assigned-addresses for every PCIe Root Port

In reply to Greg Kroah-Hartman

From: Pali Rohár <[email protected]>

[ Upstream commit 823956d2436f70ced74c0fe8ab99facd8abfc060 ]

BDF of resource in DT assigned-addresses property of Marvell PCIe Root Port (PCI-to-PCI bridge) should match BDF in address part in that DT node name as specified resource belongs to Marvell PCIe Root Port itself.

Fixes 4de59085091f ("ARM: mvebu: add Device Tree description of the Armada 375 SoC")
---
 arch/arm/boot/dts/armada-375.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/armada-375.dtsi +1 -1
index 2932a29ae272..230f6dd876a2 100644
@@ -584,7 +584,7 @@ pcie0: pcie@1,0 {
 
 			pcie1: pcie@2,0 {
 				device_type = "pci";
-				assigned-addresses = <0x82000800 0 0x44000 0 0x2000>;
+				assigned-addresses = <0x82001000 0 0x44000 0 0x2000>;
 				reg = <0x1000 0 0 0 0>;
 				#address-cells = <3>;
 				#size-cells = <2>;
Signature · 1 line
2.35.1
author maintainer
#9 lore raw

PATCH 9/521 ASoC: ops: Correct bounds check for second channel on SX controls

In reply to Greg Kroah-Hartman

From: Charles Keepax <[email protected]>

commit f33bcc506050f89433a52a3052054d4ebd37b1c1 upstream.

Currently the check against the max value for the control is being applied after the value has had the minimum applied and been masked. But the max value simply indicates the number of volume levels on an SX control, and as such should just be applied on the raw value.

Fixes 97eea946b939 ("ASoC: ops: Check bounds for second channel in snd_soc_put_volsw_sx()")
---
 sound/soc/soc-ops.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
sound/soc/soc-ops.c +3 -2
@@ -458,14 +458,15 @@ int snd_soc_put_volsw_sx(struct snd_kcon
 		return err;
 
 	if (snd_soc_volsw_is_stereo(mc)) {
-		val_mask = mask << rshift;
-		val2 = (ucontrol->value.integer.value[1] + min) & mask;
+		val2 = ucontrol->value.integer.value[1];
 
 		if (mc->platform_max && val2 > mc->platform_max)
 			return -EINVAL;
 		if (val2 > max)
 			return -EINVAL;
 
+		val_mask = mask << rshift;
+		val2 = (val2 + min) & mask;
 		val2 = val2 << rshift;
 
 		err = snd_soc_component_update_bits(component, reg2, val_mask,
author maintainer
#36 lore raw

PATCH 36/521 ARM: dts: armada-38x: Fix assigned-addresses for every PCIe Root Port

In reply to Greg Kroah-Hartman

From: Pali Rohár <[email protected]>

[ Upstream commit 44f47b7a8fa4678ce4c38ea74837e4996b9df6d6 ]

BDF of resource in DT assigned-addresses property of Marvell PCIe Root Port (PCI-to-PCI bridge) should match BDF in address part in that DT node name as specified resource belongs to Marvell PCIe Root Port itself.

Fixes 0d3d96ab0059 ("ARM: mvebu: add Device Tree description of the Armada 380/385 SoCs")
---
 arch/arm/boot/dts/armada-380.dtsi | 4 ++--
 arch/arm/boot/dts/armada-385.dtsi | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)
arch/arm/boot/dts/armada-380.dtsi +2 -2
index cff1269f3fbf..7146cc8f082a 100644
@@ -79,7 +79,7 @@ pcie@1,0 {
 			/* x1 port */
 			pcie@2,0 {
 				device_type = "pci";
-				assigned-addresses = <0x82000800 0 0x40000 0 0x2000>;
+				assigned-addresses = <0x82001000 0 0x40000 0 0x2000>;
 				reg = <0x1000 0 0 0 0>;
 				#address-cells = <3>;
 				#size-cells = <2>;
@@ -98,7 +98,7 @@ pcie@2,0 {
 			/* x1 port */
 			pcie@3,0 {
 				device_type = "pci";
-				assigned-addresses = <0x82000800 0 0x44000 0 0x2000>;
+				assigned-addresses = <0x82001800 0 0x44000 0 0x2000>;
 				reg = <0x1800 0 0 0 0>;
 				#address-cells = <3>;
 				#size-cells = <2>;
arch/arm/boot/dts/armada-385.dtsi +3 -3
index f0022d10c715..f081f7cb66e5 100644
@@ -84,7 +84,7 @@ pcie1: pcie@1,0 {
 			/* x1 port */
 			pcie2: pcie@2,0 {
 				device_type = "pci";
-				assigned-addresses = <0x82000800 0 0x40000 0 0x2000>;
+				assigned-addresses = <0x82001000 0 0x40000 0 0x2000>;
 				reg = <0x1000 0 0 0 0>;
 				#address-cells = <3>;
 				#size-cells = <2>;
@@ -103,7 +103,7 @@ pcie2: pcie@2,0 {
 			/* x1 port */
 			pcie3: pcie@3,0 {
 				device_type = "pci";
-				assigned-addresses = <0x82000800 0 0x44000 0 0x2000>;
+				assigned-addresses = <0x82001800 0 0x44000 0 0x2000>;
 				reg = <0x1800 0 0 0 0>;
 				#address-cells = <3>;
 				#size-cells = <2>;
@@ -125,7 +125,7 @@ pcie3: pcie@3,0 {
 			 */
 			pcie4: pcie@4,0 {
 				device_type = "pci";
-				assigned-addresses = <0x82000800 0 0x48000 0 0x2000>;
+				assigned-addresses = <0x82002000 0 0x48000 0 0x2000>;
 				reg = <0x2000 0 0 0 0>;
 				#address-cells = <3>;
 				#size-cells = <2>;
Signature · 1 line
2.35.1
author maintainer
#37 lore raw

PATCH 37/521 ARM: dts: armada-39x: Fix assigned-addresses for every PCIe Root Port

In reply to Greg Kroah-Hartman

From: Pali Rohár <[email protected]>

[ Upstream commit 69236d2391b4d7324b11c3252921571577892e7b ]

BDF of resource in DT assigned-addresses property of Marvell PCIe Root Port (PCI-to-PCI bridge) should match BDF in address part in that DT node name as specified resource belongs to Marvell PCIe Root Port itself.

Fixes 538da83ddbea ("ARM: mvebu: add Device Tree files for Armada 39x SoC and board")
---
 arch/arm/boot/dts/armada-39x.dtsi | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm/boot/dts/armada-39x.dtsi +3 -3
index f0c949831efb..f589112e7697 100644
@@ -456,7 +456,7 @@ pcie@1,0 {
 			/* x1 port */
 			pcie@2,0 {
 				device_type = "pci";
-				assigned-addresses = <0x82000800 0 0x40000 0 0x2000>;
+				assigned-addresses = <0x82001000 0 0x40000 0 0x2000>;
 				reg = <0x1000 0 0 0 0>;
 				#address-cells = <3>;
 				#size-cells = <2>;
@@ -475,7 +475,7 @@ pcie@2,0 {
 			/* x1 port */
 			pcie@3,0 {
 				device_type = "pci";
-				assigned-addresses = <0x82000800 0 0x44000 0 0x2000>;
+				assigned-addresses = <0x82001800 0 0x44000 0 0x2000>;
 				reg = <0x1800 0 0 0 0>;
 				#address-cells = <3>;
 				#size-cells = <2>;
@@ -497,7 +497,7 @@ pcie@3,0 {
 			 */
 			pcie@4,0 {
 				device_type = "pci";
-				assigned-addresses = <0x82000800 0 0x48000 0 0x2000>;
+				assigned-addresses = <0x82002000 0 0x48000 0 0x2000>;
 				reg = <0x2000 0 0 0 0>;
 				#address-cells = <3>;
 				#size-cells = <2>;
Signature · 1 line
2.35.1
author maintainer
#10 lore raw

PATCH 10/521 perf script python: Remove explicit shebang from tests/attr.c

In reply to Greg Kroah-Hartman

From: Tony Jones <[email protected]>

commit d72eadbc1d2866fc047edd4535ffb0298fe240be upstream.

tests/attr.c invokes attr.py via an explicit invocation of Python ($PYTHON) so there is therefore no need for an explicit shebang.

Also most distros follow pep-0394 which recommends that /usr/bin/python refer only to v2 and so may not exist on the system (if PYTHON=python3).

---
 tools/perf/tests/attr.py |    1 -
 1 file changed, 1 deletion(-)
tools/perf/tests/attr.py +0 -1
@@ -1,4 +1,3 @@
-#! /usr/bin/python
 # SPDX-License-Identifier: GPL-2.0
 
 import os
author maintainer
#11 lore raw

PATCH 11/521 udf: Discard preallocation before extending file with a hole

In reply to Greg Kroah-Hartman

From: Jan Kara <[email protected]>

commit 16d0556568148bdcaa45d077cac9f8f7077cf70a upstream.

When extending file with a hole, we tried to preserve existing preallocation for the file. However that is not very useful and complicates code because the previous extent may need to be rounded to block boundary as well (which we forgot to do thus causing data corruption for sequence like:

xfs_io -f -c "pwrite 0x75e63 11008" -c "truncate 0x7b24b" \
-c "truncate 0xabaa3" -c "pwrite 0xac70b 22954" \
-c "pwrite 0x93a43 11358" -c "pwrite 0xb8e65 52211" file

with 512-byte block size. Just discard preallocation before extending file to simplify things and also fix this data corruption.

---
 fs/udf/inode.c |   46 ++++++++++++++++++----------------------------
 1 file changed, 18 insertions(+), 28 deletions(-)
fs/udf/inode.c +18 -28
@@ -434,6 +434,12 @@ static int udf_get_block(struct inode *i
 		iinfo->i_next_alloc_goal++;
 	}
 
+	/*
+	 * Block beyond EOF and prealloc extents? Just discard preallocation
+	 * as it is not useful and complicates things.
+	 */
+	if (((loff_t)block) << inode->i_blkbits > iinfo->i_lenExtents)
+		udf_discard_prealloc(inode);
 	udf_clear_extent_cache(inode);
 	phys = inode_getblk(inode, block, &err, &new);
 	if (!phys)
@@ -483,8 +489,6 @@ static int udf_do_extend_file(struct ino
 	uint32_t add;
 	int count = 0, fake = !(last_ext->extLength & UDF_EXTENT_LENGTH_MASK);
 	struct super_block *sb = inode->i_sb;
-	struct kernel_lb_addr prealloc_loc = {};
-	uint32_t prealloc_len = 0;
 	struct udf_inode_info *iinfo;
 	int err;
 
@@ -505,19 +509,6 @@ static int udf_do_extend_file(struct ino
 			~(sb->s_blocksize - 1);
 	}
 
-	/* Last extent are just preallocated blocks? */
-	if ((last_ext->extLength & UDF_EXTENT_FLAG_MASK) ==
-						EXT_NOT_RECORDED_ALLOCATED) {
-		/* Save the extent so that we can reattach it to the end */
-		prealloc_loc = last_ext->extLocation;
-		prealloc_len = last_ext->extLength;
-		/* Mark the extent as a hole */
-		last_ext->extLength = EXT_NOT_RECORDED_NOT_ALLOCATED |
-			(last_ext->extLength & UDF_EXTENT_LENGTH_MASK);
-		last_ext->extLocation.logicalBlockNum = 0;
-		last_ext->extLocation.partitionReferenceNum = 0;
-	}
-
 	/* Can we merge with the previous extent? */
 	if ((last_ext->extLength & UDF_EXTENT_FLAG_MASK) ==
 					EXT_NOT_RECORDED_NOT_ALLOCATED) {
@@ -545,7 +536,7 @@ static int udf_do_extend_file(struct ino
 		 * more extents, we may need to enter possible following
 		 * empty indirect extent.
 		 */
-		if (new_block_bytes || prealloc_len)
+		if (new_block_bytes)
 			udf_next_aext(inode, last_pos, &tmploc, &tmplen, 0);
 	}
 
@@ -579,17 +570,6 @@ static int udf_do_extend_file(struct ino
 	}
 
 out:
-	/* Do we have some preallocated blocks saved? */
-	if (prealloc_len) {
-		err = udf_add_aext(inode, last_pos, &prealloc_loc,
-				   prealloc_len, 1);
-		if (err)
-			return err;
-		last_ext->extLocation = prealloc_loc;
-		last_ext->extLength = prealloc_len;
-		count++;
-	}
-
 	/* last_pos should point to the last written extent... */
 	if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_SHORT)
 		last_pos->offset -= sizeof(struct short_ad);
@@ -642,8 +622,17 @@ static int udf_extend_file(struct inode
 	else
 		BUG();
 
+	/*
+	 * When creating hole in file, just don't bother with preserving
+	 * preallocation. It likely won't be very useful anyway.
+	 */
+	udf_discard_prealloc(inode);
+
 	etype = inode_bmap(inode, first_block, &epos, &eloc, &elen, &offset);
 	within_final_block = (etype != -1);
+	/* We don't expect extents past EOF... */
+	WARN_ON_ONCE(etype != -1 &&
+		     elen > ((loff_t)offset + 1) << inode->i_blkbits);
 
 	if ((!epos.bh && epos.offset == udf_file_entry_alloc_offset(inode)) ||
 	    (epos.bh && epos.offset == sizeof(struct allocExtDesc))) {
@@ -772,10 +761,11 @@ static sector_t inode_getblk(struct inod
 		goto out_free;
 	}
 
-	/* Are we beyond EOF? */
+	/* Are we beyond EOF and preallocated extent? */
 	if (etype == -1) {
 		int ret;
 		loff_t hole_len;
+
 		isBeyondEOF = true;
 		if (count) {
 			if (c)
author maintainer
#12 lore raw

PATCH 12/521 udf: Fix preallocation discarding at indirect extent boundary

In reply to Greg Kroah-Hartman

From: Jan Kara <[email protected]>

commit cfe4c1b25dd6d2f056afc00b7c98bcb3dd0b1fc3 upstream.

When preallocation extent is the first one in the extent block, the code would corrupt extent tree header instead. Fix the problem and use udf_delete_aext() for deleting extent to avoid some code duplication.

---
 fs/udf/truncate.c |   45 +++++++++++++--------------------------------
 1 file changed, 13 insertions(+), 32 deletions(-)
fs/udf/truncate.c +13 -32
@@ -120,60 +120,41 @@ void udf_truncate_tail_extent(struct ino
 
 void udf_discard_prealloc(struct inode *inode)
 {
-	struct extent_position epos = { NULL, 0, {0, 0} };
+	struct extent_position epos = {};
+	struct extent_position prev_epos = {};
 	struct kernel_lb_addr eloc;
 	uint32_t elen;
 	uint64_t lbcount = 0;
 	int8_t etype = -1, netype;
-	int adsize;
 	struct udf_inode_info *iinfo = UDF_I(inode);
 
 	if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB ||
 	    inode->i_size == iinfo->i_lenExtents)
 		return;
 
-	if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_SHORT)
-		adsize = sizeof(struct short_ad);
-	else if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_LONG)
-		adsize = sizeof(struct long_ad);
-	else
-		adsize = 0;
-
 	epos.block = iinfo->i_location;
 
 	/* Find the last extent in the file */
-	while ((netype = udf_next_aext(inode, &epos, &eloc, &elen, 1)) != -1) {
-		etype = netype;
+	while ((netype = udf_next_aext(inode, &epos, &eloc, &elen, 0)) != -1) {
+		brelse(prev_epos.bh);
+		prev_epos = epos;
+		if (prev_epos.bh)
+			get_bh(prev_epos.bh);
+
+		etype = udf_next_aext(inode, &epos, &eloc, &elen, 1);
 		lbcount += elen;
 	}
 	if (etype == (EXT_NOT_RECORDED_ALLOCATED >> 30)) {
-		epos.offset -= adsize;
 		lbcount -= elen;
-		extent_trunc(inode, &epos, &eloc, etype, elen, 0);
-		if (!epos.bh) {
-			iinfo->i_lenAlloc =
-				epos.offset -
-				udf_file_entry_alloc_offset(inode);
-			mark_inode_dirty(inode);
-		} else {
-			struct allocExtDesc *aed =
-				(struct allocExtDesc *)(epos.bh->b_data);
-			aed->lengthAllocDescs =
-				cpu_to_le32(epos.offset -
-					    sizeof(struct allocExtDesc));
-			if (!UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_STRICT) ||
-			    UDF_SB(inode->i_sb)->s_udfrev >= 0x0201)
-				udf_update_tag(epos.bh->b_data, epos.offset);
-			else
-				udf_update_tag(epos.bh->b_data,
-					       sizeof(struct allocExtDesc));
-			mark_buffer_dirty_inode(epos.bh, inode);
-		}
+		udf_delete_aext(inode, prev_epos);
+		udf_free_blocks(inode->i_sb, inode, &eloc, 0,
+				DIV_ROUND_UP(elen, 1 << inode->i_blkbits));
 	}
 	/* This inode entry is in-memory only and thus we don't have to mark
 	 * the inode dirty */
 	iinfo->i_lenExtents = lbcount;
 	brelse(epos.bh);
+	brelse(prev_epos.bh);
 }
 
 static void udf_update_alloc_ext_desc(struct inode *inode,
author maintainer
#13 lore raw

PATCH 13/521 udf: Do not bother looking for prealloc extents if i_lenExtents matches i_size

In reply to Greg Kroah-Hartman

From: Jan Kara <[email protected]>

commit 6ad53f0f71c52871202a7bf096feb2c59db33fc5 upstream.

If rounded block-rounded i_lenExtents matches block rounded i_size, there are no preallocation extents. Do not bother walking extent linked list.

---
 fs/udf/truncate.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
fs/udf/truncate.c +2 -1
@@ -127,9 +127,10 @@ void udf_discard_prealloc(struct inode *
 	uint64_t lbcount = 0;
 	int8_t etype = -1, netype;
 	struct udf_inode_info *iinfo = UDF_I(inode);
+	int bsize = 1 << inode->i_blkbits;
 
 	if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB ||
-	    inode->i_size == iinfo->i_lenExtents)
+	    ALIGN(inode->i_size, bsize) == ALIGN(iinfo->i_lenExtents, bsize))
 		return;
 
 	epos.block = iinfo->i_location;
author maintainer
#14 lore raw

PATCH 14/521 udf: Fix extending file within last block

In reply to Greg Kroah-Hartman

From: Jan Kara <[email protected]>

commit 1f3868f06855c97a4954c99b36f3fc9eb8f60326 upstream.

When extending file within last block it can happen that the extent is already rounded to the blocksize and thus contains the offset we want to grow up to. In such case we would mistakenly expand the last extent and make it one block longer than it should be, exposing unallocated block in a file and causing data corruption. Fix the problem by properly detecting this case and bailing out.

---
 fs/udf/inode.c |   32 +++++++++++++++++---------------
 1 file changed, 17 insertions(+), 15 deletions(-)
fs/udf/inode.c +17 -15
@@ -585,13 +585,17 @@ out:
 static void udf_do_extend_final_block(struct inode *inode,
 				      struct extent_position *last_pos,
 				      struct kernel_long_ad *last_ext,
-				      uint32_t final_block_len)
+				      uint32_t new_elen)
 {
-	struct super_block *sb = inode->i_sb;
 	uint32_t added_bytes;
 
-	added_bytes = final_block_len -
-		      (last_ext->extLength & (sb->s_blocksize - 1));
+	/*
+	 * Extent already large enough? It may be already rounded up to block
+	 * size...
+	 */
+	if (new_elen <= (last_ext->extLength & UDF_EXTENT_LENGTH_MASK))
+		return;
+	added_bytes = (last_ext->extLength & UDF_EXTENT_LENGTH_MASK) - new_elen;
 	last_ext->extLength += added_bytes;
 	UDF_I(inode)->i_lenExtents += added_bytes;
 
@@ -608,12 +612,12 @@ static int udf_extend_file(struct inode
 	int8_t etype;
 	struct super_block *sb = inode->i_sb;
 	sector_t first_block = newsize >> sb->s_blocksize_bits, offset;
-	unsigned long partial_final_block;
+	loff_t new_elen;
 	int adsize;
 	struct udf_inode_info *iinfo = UDF_I(inode);
 	struct kernel_long_ad extent;
 	int err = 0;
-	int within_final_block;
+	bool within_last_ext;
 
 	if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_SHORT)
 		adsize = sizeof(struct short_ad);
@@ -629,9 +633,9 @@ static int udf_extend_file(struct inode
 	udf_discard_prealloc(inode);
 
 	etype = inode_bmap(inode, first_block, &epos, &eloc, &elen, &offset);
-	within_final_block = (etype != -1);
+	within_last_ext = (etype != -1);
 	/* We don't expect extents past EOF... */
-	WARN_ON_ONCE(etype != -1 &&
+	WARN_ON_ONCE(within_last_ext &&
 		     elen > ((loff_t)offset + 1) << inode->i_blkbits);
 
 	if ((!epos.bh && epos.offset == udf_file_entry_alloc_offset(inode)) ||
@@ -648,19 +652,17 @@ static int udf_extend_file(struct inode
 		extent.extLength |= etype << 30;
 	}
 
-	partial_final_block = newsize & (sb->s_blocksize - 1);
+	new_elen = ((loff_t)offset << inode->i_blkbits) |
+					(newsize & (sb->s_blocksize - 1));
 
 	/* File has extent covering the new size (could happen when extending
 	 * inside a block)?
 	 */
-	if (within_final_block) {
+	if (within_last_ext) {
 		/* Extending file within the last file block */
-		udf_do_extend_final_block(inode, &epos, &extent,
-					  partial_final_block);
+		udf_do_extend_final_block(inode, &epos, &extent, new_elen);
 	} else {
-		loff_t add = ((loff_t)offset << sb->s_blocksize_bits) |
-			     partial_final_block;
-		err = udf_do_extend_file(inode, &epos, &extent, add);
+		err = udf_do_extend_file(inode, &epos, &extent, new_elen);
 	}
 
 	if (err < 0)
author maintainer
#15 lore raw

PATCH 15/521 usb: gadget: uvc: Prevent buffer overflow in setup handler

In reply to Greg Kroah-Hartman

From: Szymon Heidrich <[email protected]>

commit 4c92670b16727365699fe4b19ed32013bab2c107 upstream.

Setup function uvc_function_setup permits control transfer requests with up to 64 bytes of payload (UVC_MAX_REQUEST_SIZE), data stage handler for OUT transfer uses memcpy to copy req->actual bytes to uvc_event->data.data array of size 60. This may result in an overflow of 4 bytes.

---
 drivers/usb/gadget/function/f_uvc.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/usb/gadget/function/f_uvc.c +3 -2
@@ -219,8 +219,9 @@ uvc_function_ep0_complete(struct usb_ep
 
 		memset(&v4l2_event, 0, sizeof(v4l2_event));
 		v4l2_event.type = UVC_EVENT_DATA;
-		uvc_event->data.length = req->actual;
-		memcpy(&uvc_event->data.data, req->buf, req->actual);
+		uvc_event->data.length = min_t(unsigned int, req->actual,
+			sizeof(uvc_event->data.data));
+		memcpy(&uvc_event->data.data, req->buf, uvc_event->data.length);
 		v4l2_event_queue(&uvc->vdev, &v4l2_event);
 	}
 }
author maintainer
#6 lore raw

PATCH 6/521 pinctrl: meditatek: Startup with the IRQs disabled

In reply to Greg Kroah-Hartman

From: Ricardo Ribalda <[email protected]>

[ Upstream commit 11780e37565db4dd064d3243ca68f755c13f65b4 ]

If the system is restarted via kexec(), the peripherals do not start with a known state.

If the previous system had enabled an IRQs we will receive unexected IRQs that can lock the system.

[   28.109251] watchdog: BUG: soft lockup - CPU#0 stuck for 26s!
[swapper/0:0]
[   28.109263] Modules linked in:
[   28.109273] CPU: 0 PID: 0 Comm: swapper/0 Not tainted
5.15.79-14458-g4b9edf7b1ac6 #1 9f2e76613148af94acccd64c609a552fb4b4354b
[   28.109284] Hardware name: Google Elm (DT)
[   28.109290] pstate: 40400005 (nZcv daif +PAN -UAO -TCO -DIT -SSBS
		BTYPE=--)
[   28.109298] pc : __do_softirq+0xa0/0x388
[   28.109309] lr : __do_softirq+0x70/0x388
[   28.109316] sp : ffffffc008003ee0
[   28.109321] x29: ffffffc008003f00 x28: 000000000000000a x27:
0000000000000080
[   28.109334] x26: 0000000000000001 x25: ffffffefa7b350c0 x24:
ffffffefa7b47480
[   28.109346] x23: ffffffefa7b3d000 x22: 0000000000000000 x21:
ffffffefa7b0fa40
[   28.109358] x20: ffffffefa7b005b0 x19: ffffffefa7b47480 x18:
0000000000065b6b
[   28.109370] x17: ffffffefa749c8b0 x16: 000000000000018c x15:
00000000000001b8
[   28.109382] x14: 00000000000d3b6b x13: 0000000000000006 x12:
0000000000057e91
[   28.109394] x11: 0000000000000000 x10: 0000000000000000 x9 :
ffffffefa7b47480
[   28.109406] x8 : 00000000000000e0 x7 : 000000000f424000 x6 :
0000000000000000
[   28.109418] x5 : ffffffefa7dfaca0 x4 : ffffffefa7dfadf0 x3 :
000000000000000f
[   28.109429] x2 : 0000000000000000 x1 : 0000000000000100 x0 :
0000000001ac65c5
[   28.109441] Call trace:
[   28.109447]  __do_softirq+0xa0/0x388
[   28.109454]  irq_exit+0xc0/0xe0
[   28.109464]  handle_domain_irq+0x68/0x90
[   28.109473]  gic_handle_irq+0xac/0xf0
[   28.109480]  call_on_irq_stack+0x28/0x50
[   28.109488]  do_interrupt_handler+0x44/0x58
[   28.109496]  el1_interrupt+0x30/0x58
[   28.109506]  el1h_64_irq_handler+0x18/0x24
[   28.109512]  el1h_64_irq+0x7c/0x80
[   28.109519]  arch_local_irq_enable+0xc/0x18
[   28.109529]  default_idle_call+0x40/0x140
[   28.109539]  do_idle+0x108/0x290
[   28.109547]  cpu_startup_entry+0x2c/0x30
[   28.109554]  rest_init+0xe8/0xf8
[   28.109562]  arch_call_rest_init+0x18/0x24
[   28.109571]  start_kernel+0x338/0x42c
[   28.109578]  __primary_switched+0xbc/0xc4
[   28.109588] Kernel panic - not syncing: softlockup: hung tasks
---
 drivers/pinctrl/mediatek/mtk-eint.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/pinctrl/mediatek/mtk-eint.c +6 -3
index 564cfaee129d..55e3305ede81 100644
@@ -277,12 +277,15 @@ static struct irq_chip mtk_eint_irq_chip = {
 
 static unsigned int mtk_eint_hw_init(struct mtk_eint *eint)
 {
-	void __iomem *reg = eint->base + eint->regs->dom_en;
+	void __iomem *dom_en = eint->base + eint->regs->dom_en;
+	void __iomem *mask_set = eint->base + eint->regs->mask_set;
 	unsigned int i;
 
 	for (i = 0; i < eint->hw->ap_num; i += 32) {
-		writel(0xffffffff, reg);
-		reg += 4;
+		writel(0xffffffff, dom_en);
+		writel(0xffffffff, mask_set);
+		dom_en += 4;
+		mask_set += 4;
 	}
 
 	return 0;
Signature · 1 line
2.35.1
author maintainer
#39 lore raw

PATCH 39/521 ARM: dts: turris-omnia: Add switch port 6 node

In reply to Greg Kroah-Hartman

From: Pali Rohár <[email protected]>

[ Upstream commit f87db2005f73876602211af0ee156817019b6bda ]

Switch port 6 is connected to eth0, so add appropriate device tree node for it.

Fixes 26ca8b52d6e1 ("ARM: dts: add support for Turris Omnia")
---
 arch/arm/boot/dts/armada-385-turris-omnia.dts | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
arch/arm/boot/dts/armada-385-turris-omnia.dts +11 -1
index c0a026ac7be8..320c759b4090 100644
@@ -297,7 +297,17 @@ fixed-link {
 				};
 			};
 
-			/* port 6 is connected to eth0 */
+			ports@6 {
+				reg = <6>;
+				label = "cpu";
+				ethernet = <&eth0>;
+				phy-mode = "rgmii-id";
+
+				fixed-link {
+					speed = <1000>;
+					full-duplex;
+				};
+			};
 		};
 	};
 };
Signature · 1 line
2.35.1
author maintainer
#48 lore raw

PATCH 48/521 perf: Fix possible memleak in pmu_dev_alloc()

In reply to Greg Kroah-Hartman

From: Chen Zhongjin <[email protected]>

[ Upstream commit e8d7a90c08ce963c592fb49845f2ccc606a2ac21 ]

In pmu_dev_alloc(), when dev_set_name() failed, it will goto free_dev and call put_device(pmu->dev) to release it.
However pmu->dev->release is assigned after this, which makes warning and memleak.
Call dev_set_name() after pmu->dev->release = pmu_dev_release to fix it.

Device '(null)' does not have a release() function...

  WARNING: CPU: 2 PID: 441 at drivers/base/core.c:2332 device_release+0x1b9/0x240
  ...
  Call Trace:
    <TASK>
    kobject_put+0x17f/0x460
    put_device+0x20/0x30
    pmu_dev_alloc+0x152/0x400
    perf_pmu_register+0x96b/0xee0
    ...
  kmemleak: 1 new suspected memory leaks (see /sys/kernel/debug/kmemleak)
  unreferenced object 0xffff888014759000 (size 2048):
    comm "modprobe", pid 441, jiffies 4294931444 (age 38.332s)
    backtrace:
      [<0000000005aed3b4>] kmalloc_trace+0x27/0x110
      [<000000006b38f9b8>] pmu_dev_alloc+0x50/0x400
      [<00000000735f17be>] perf_pmu_register+0x96b/0xee0
      [<00000000e38477f1>] 0xffffffffc0ad8603
      [<000000004e162216>] do_one_initcall+0xd0/0x4e0
      ...
---
 kernel/events/core.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
kernel/events/core.c +5 -3
index ba66ea3ca705..668e5492e4c4 100644
@@ -9682,13 +9682,15 @@ static int pmu_dev_alloc(struct pmu *pmu)
 
 	pmu->dev->groups = pmu->attr_groups;
 	device_initialize(pmu->dev);
-	ret = dev_set_name(pmu->dev, "%s", pmu->name);
-	if (ret)
-		goto free_dev;
 
 	dev_set_drvdata(pmu->dev, pmu);
 	pmu->dev->bus = &pmu_bus;
 	pmu->dev->release = pmu_dev_release;
+
+	ret = dev_set_name(pmu->dev, "%s", pmu->name);
+	if (ret)
+		goto free_dev;
+
 	ret = device_add(pmu->dev);
 	if (ret)
 		goto free_dev;
Signature · 1 line
2.35.1
author maintainer
#49 lore raw

PATCH 49/521 timerqueue: Use rb_entry_safe() in timerqueue_getnext()

In reply to Greg Kroah-Hartman

From: Barnabás Pőcze <[email protected]>

[ Upstream commit 2f117484329b233455ee278f2d9b0a4356835060 ]

When timerqueue_getnext() is called on an empty timer queue, it will use rb_entry() on a NULL pointer, which is invalid. Fix that by using rb_entry_safe() which handles NULL pointers.

This has not caused any issues so far because the offset of the rb_node member in timerqueue_node is 0, so rb_entry() is essentially a no-op.

Fixes 511885d7061e ("lib/timerqueue: Rely on rbtree semantics for next timer")
---
 include/linux/timerqueue.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/timerqueue.h +1 -1
index aff122f1062a..e1a843cb16d4 100644
@@ -35,7 +35,7 @@ struct timerqueue_node *timerqueue_getnext(struct timerqueue_head *head)
 {
 	struct rb_node *leftmost = rb_first_cached(&head->rb_root);
 
-	return rb_entry(leftmost, struct timerqueue_node, node);
+	return rb_entry_safe(leftmost, struct timerqueue_node, node);
 }
 
 static inline void timerqueue_init(struct timerqueue_node *node)
Signature · 1 line
2.35.1
author maintainer
#50 lore raw

PATCH 50/521 proc: fixup uptime selftest

In reply to Greg Kroah-Hartman

From: Alexey Dobriyan <[email protected]>

[ Upstream commit 5cc81d5c81af0dee54da9a67a3ebe4be076a13db ]

syscall(3) returns -1 and sets errno on error, unlike "syscall" instruction.

Systems which have <= 32/64 CPUs are unaffected. Test won't bounce to all CPUs before completing if there are more of them.

---
 tools/testing/selftests/proc/proc-uptime-002.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tools/testing/selftests/proc/proc-uptime-002.c +2 -1
index e7ceabed7f51..7d0aa22bdc12 100644
@@ -17,6 +17,7 @@
 // while shifting across CPUs.
 #undef NDEBUG
 #include <assert.h>
+#include <errno.h>
 #include <unistd.h>
 #include <sys/syscall.h>
 #include <stdlib.h>
@@ -54,7 +55,7 @@ int main(void)
 		len += sizeof(unsigned long);
 		free(m);
 		m = malloc(len);
-	} while (sys_sched_getaffinity(0, len, m) == -EINVAL);
+	} while (sys_sched_getaffinity(0, len, m) == -1 && errno == EINVAL);
 
 	fd = open("/proc/uptime", O_RDONLY);
 	assert(fd >= 0);
Signature · 1 line
2.35.1
author maintainer
#51 lore raw

PATCH 51/521 ocfs2: fix memory leak in ocfs2_stack_glue_init()

In reply to Greg Kroah-Hartman

From: Shang XiaoJing <[email protected]>

[ Upstream commit 13b6269dd022aaa69ca8d1df374ab327504121cf ]

ocfs2_table_header should be free in ocfs2_stack_glue_init() if ocfs2_sysfs_init() failed, otherwise kmemleak will report memleak.

BUG: memory leak
unreferenced object 0xffff88810eeb5800 (size 128):
  comm "modprobe", pid 4507, jiffies 4296182506 (age 55.888s)
  hex dump (first 32 bytes):
    c0 40 14 a0 ff ff ff ff 00 00 00 00 01 00 00 00  .@..............
    01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  backtrace:
    [<000000001e59e1cd>] __register_sysctl_table+0xca/0xef0
    [<00000000c04f70f7>] 0xffffffffa0050037
    [<000000001bd12912>] do_one_initcall+0xdb/0x480
    [<0000000064f766c9>] do_init_module+0x1cf/0x680
    [<000000002ba52db0>] load_module+0x6441/0x6f20
    [<000000009772580d>] __do_sys_finit_module+0x12f/0x1c0
    [<00000000380c1f22>] do_syscall_64+0x3f/0x90
    [<000000004cf473bc>] entry_SYSCALL_64_after_hwframe+0x63/0xcd
Fixes 3878f110f71a ("ocfs2: Move the hb_ctl_path sysctl into the stack glue.")
Cc Mark Fasheh <[email protected]>
Cc Joel Becker <[email protected]>
Cc Junxiao Bi <[email protected]>
Cc Changwei Ge <[email protected]>
Cc Gang He <[email protected]>
Cc Jun Piao <[email protected]>
---
 fs/ocfs2/stackglue.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
fs/ocfs2/stackglue.c +7 -1
index e7eb08ac4215..10d691530d83 100644
@@ -715,6 +715,8 @@ static struct ctl_table_header *ocfs2_table_header;
 
 static int __init ocfs2_stack_glue_init(void)
 {
+	int ret;
+
 	strcpy(cluster_stack_name, OCFS2_STACK_PLUGIN_O2CB);
 
 	ocfs2_table_header = register_sysctl_table(ocfs2_root_table);
@@ -724,7 +726,11 @@ static int __init ocfs2_stack_glue_init(void)
 		return -ENOMEM; /* or something. */
 	}
 
-	return ocfs2_sysfs_init();
+	ret = ocfs2_sysfs_init();
+	if (ret)
+		unregister_sysctl_table(ocfs2_table_header);
+
+	return ret;
 }
 
 static void __exit ocfs2_stack_glue_exit(void)
Signature · 1 line
2.35.1
author maintainer
#52 lore raw

PATCH 52/521 MIPS: vpe-mt: fix possible memory leak while module exiting

In reply to Greg Kroah-Hartman

From: Yang Yingliang <[email protected]>

[ Upstream commit 5822e8cc84ee37338ab0bdc3124f6eec04dc232d ]

Afer commit 1fa5ae857bb1 ("driver core: get rid of struct device's bus_id string array"), the name of device is allocated dynamically, it need be freed when module exiting, call put_device() to give up reference, so that it can be freed in kobject_cleanup() when the refcount hit to 0. The vpe_device is static, so remove kfree() from vpe_device_release().

Fixes 1fa5ae857bb1 ("driver core: get rid of struct device's bus_id string array")
---
 arch/mips/kernel/vpe-mt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/mips/kernel/vpe-mt.c +2 -2
index 2e003b11a098..9fd7cd48ea1d 100644
@@ -313,7 +313,6 @@ ATTRIBUTE_GROUPS(vpe);
 
 static void vpe_device_release(struct device *cd)
 {
-	kfree(cd);
 }
 
 static struct class vpe_class = {
@@ -497,6 +496,7 @@ int __init vpe_module_init(void)
 	device_del(&vpe_device);
 
 out_class:
+	put_device(&vpe_device);
 	class_unregister(&vpe_class);
 
 out_chrdev:
@@ -509,7 +509,7 @@ void __exit vpe_module_exit(void)
 {
 	struct vpe *v, *n;
 
-	device_del(&vpe_device);
+	device_unregister(&vpe_device);
 	class_unregister(&vpe_class);
 	unregister_chrdev(major, VPE_MODULE_NAME);
 
Signature · 1 line
2.35.1
author maintainer
#53 lore raw

PATCH 53/521 MIPS: vpe-cmp: fix possible memory leak while module exiting

In reply to Greg Kroah-Hartman

From: Yang Yingliang <[email protected]>

[ Upstream commit c5ed1fe0801f0c66b0fbce2785239a5664629057 ]

dev_set_name() allocates memory for name, it need be freed when module exiting, call put_device() to give up reference, so that it can be freed in kobject_cleanup() when the refcount hit to 0. The vpe_device is static, so remove kfree() from vpe_device_release().

Fixes 17a1d523aa58 ("MIPS: APRP: Add VPE loader support for CMP platforms.")
---
 arch/mips/kernel/vpe-cmp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/mips/kernel/vpe-cmp.c +2 -2
index 9268ebc0f61e..903c07bdc92d 100644
@@ -75,7 +75,6 @@ ATTRIBUTE_GROUPS(vpe);
 
 static void vpe_device_release(struct device *cd)
 {
-	kfree(cd);
 }
 
 static struct class vpe_class = {
@@ -157,6 +156,7 @@ int __init vpe_module_init(void)
 	device_del(&vpe_device);
 
 out_class:
+	put_device(&vpe_device);
 	class_unregister(&vpe_class);
 
 out_chrdev:
@@ -169,7 +169,7 @@ void __exit vpe_module_exit(void)
 {
 	struct vpe *v, *n;
 
-	device_del(&vpe_device);
+	device_unregister(&vpe_device);
 	class_unregister(&vpe_class);
 	unregister_chrdev(major, VPE_MODULE_NAME);
 
Signature · 1 line
2.35.1
author maintainer
#54 lore raw

PATCH 54/521 PNP: fix name memory leak in pnp_alloc_dev()

In reply to Greg Kroah-Hartman

From: Yang Yingliang <[email protected]>

[ Upstream commit 110d7b0325c55ff3620073ba4201845f59e22ebf ]

After commit 1fa5ae857bb1 ("driver core: get rid of struct device's bus_id string array"), the name of device is allocated dynamically, move dev_set_name() after pnp_add_id() to avoid memory leak.

Fixes 1fa5ae857bb1 ("driver core: get rid of struct device's bus_id string array")
---
 drivers/pnp/core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pnp/core.c +2 -2
index 3bf18d718975..131b925b820d 100644
@@ -160,14 +160,14 @@ struct pnp_dev *pnp_alloc_dev(struct pnp_protocol *protocol, int id,
 	dev->dev.coherent_dma_mask = dev->dma_mask;
 	dev->dev.release = &pnp_release_device;
 
-	dev_set_name(&dev->dev, "%02x:%02x", dev->protocol->number, dev->number);
-
 	dev_id = pnp_add_id(dev, pnpid);
 	if (!dev_id) {
 		kfree(dev);
 		return NULL;
 	}
 
+	dev_set_name(&dev->dev, "%02x:%02x", dev->protocol->number, dev->number);
+
 	return dev;
 }
 
Signature · 1 line
2.35.1
author maintainer
#55 lore raw

PATCH 55/521 perf/x86/intel/uncore: Fix reference count leak in hswep_has_limit_sbox()

In reply to Greg Kroah-Hartman

From: Xiongfeng Wang <[email protected]>

[ Upstream commit 1ff9dd6e7071a561f803135c1d684b13c7a7d01d ]

pci_get_device() will increase the reference count for the returned 'dev'. We need to call pci_dev_put() to decrease the reference count. Since 'dev' is only used in pci_read_config_dword(), let's add pci_dev_put() right after it.

Fixes 9d480158ee86 ("perf/x86/intel/uncore: Remove uncore extra PCI dev HSWEP_PCI_PCU_3")
---
 arch/x86/events/intel/uncore_snbep.c | 1 +
 1 file changed, 1 insertion(+)
arch/x86/events/intel/uncore_snbep.c +1 -0
index 2bf1170f7afd..34da6d27d839 100644
@@ -2699,6 +2699,7 @@ static bool hswep_has_limit_sbox(unsigned int device)
 		return false;
 
 	pci_read_config_dword(dev, HSWEP_PCU_CAPID4_OFFET, &capid4);
+	pci_dev_put(dev);
 	if (!hswep_get_chop(capid4))
 		return true;
 
Signature · 1 line
2.35.1
author maintainer
#56 lore raw

PATCH 56/521 irqchip: gic-pm: Use pm_runtime_resume_and_get() in gic_probe()

In reply to Greg Kroah-Hartman

From: Shang XiaoJing <[email protected]>

[ Upstream commit f9ee20c85b3a3ba0afd3672630ec4f93d339f015 ]

gic_probe() calls pm_runtime_get_sync() and added fail path as rpm_put to put usage_counter. However, pm_runtime_get_sync() will increment usage_counter even it failed. Fix it by replacing it with pm_runtime_resume_and_get() to keep usage counter balanced.

Fixes 9c8edddfc992 ("irqchip/gic: Add platform driver for non-root GICs that require RPM")
---
 drivers/irqchip/irq-gic-pm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/irqchip/irq-gic-pm.c +1 -1
index ecafd295c31c..21c5decfc55b 100644
@@ -112,7 +112,7 @@ static int gic_probe(struct platform_device *pdev)
 
 	pm_runtime_enable(dev);
 
-	ret = pm_runtime_get_sync(dev);
+	ret = pm_runtime_resume_and_get(dev);
 	if (ret < 0)
 		goto rpm_disable;
 
Signature · 1 line
2.35.1
author maintainer
#57 lore raw

PATCH 57/521 cpufreq: amd_freq_sensitivity: Add missing pci_dev_put()

In reply to Greg Kroah-Hartman

From: Xiongfeng Wang <[email protected]>

[ Upstream commit 91fda1f88c0968f1491ab150bb01690525af150a ]

pci_get_device() will increase the reference count for the returned pci_dev. We need to use pci_dev_put() to decrease the reference count after using pci_get_device(). Let's add it.

Fixes 59a3b3a8db16 ("cpufreq: AMD: Ignore the check for ProcFeedback in ST/CZ")
---
 drivers/cpufreq/amd_freq_sensitivity.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/cpufreq/amd_freq_sensitivity.c +2 -0
index 4b4f128c3488..cacd4c67d9be 100644
@@ -122,6 +122,8 @@ static int __init amd_freq_sensitivity_init(void)
 	if (!pcidev) {
 		if (!static_cpu_has(X86_FEATURE_PROC_FEEDBACK))
 			return -ENODEV;
+	} else {
+		pci_dev_put(pcidev);
 	}
 
 	if (rdmsrl_safe(MSR_AMD64_FREQ_SENSITIVITY_ACTUAL, &val))
Signature · 1 line
2.35.1
author maintainer
#40 lore raw

PATCH 40/521 pstore/ram: Fix error return code in ramoops_probe()

In reply to Greg Kroah-Hartman

From: Wang Yufen <[email protected]>

[ Upstream commit e1fce564900f8734edf15b87f028c57e14f6e28d ]

In the if (dev_of_node(dev) && !pdata) path, the "err" may be assigned a value of 0, so the error return code -EINVAL may be incorrectly set to 0. To fix set valid return code before calling to goto.

Fixes 35da60941e44 ("pstore/ram: add Device Tree bindings")
---
 fs/pstore/ram.c | 2 ++
 1 file changed, 2 insertions(+)
fs/pstore/ram.c +2 -0
index bafbab2dd039..33294dee7d7f 100644
@@ -753,6 +753,7 @@ static int ramoops_probe(struct platform_device *pdev)
 	/* Make sure we didn't get bogus platform data pointer. */
 	if (!pdata) {
 		pr_err("NULL platform data\n");
+		err = -EINVAL;
 		goto fail_out;
 	}
 
@@ -760,6 +761,7 @@ static int ramoops_probe(struct platform_device *pdev)
 			!pdata->ftrace_size && !pdata->pmsg_size)) {
 		pr_err("The memory size and the record/console size must be "
 			"non-zero\n");
+		err = -EINVAL;
 		goto fail_out;
 	}
 
Signature · 1 line
2.35.1
author maintainer
#58 lore raw

PATCH 58/521 libfs: add DEFINE_SIMPLE_ATTRIBUTE_SIGNED for signed value

In reply to Greg Kroah-Hartman

From: Akinobu Mita <[email protected]>

[ Upstream commit 2e41f274f9aa71cdcc69dc1f26a3f9304a651804 ]

Patch series "fix error when writing negative value to simple attribute files".

The simple attribute files do not accept a negative value since the commit 488dac0c9237 ("libfs: fix error cast of negative value in simple_attr_write()"), but some attribute files want to accept a negative value.

This patch (of 3):

The simple attribute files do not accept a negative value since the commit 488dac0c9237 ("libfs: fix error cast of negative value in simple_attr_write()"), so we have to use a 64-bit value to write a negative value.

This adds DEFINE_SIMPLE_ATTRIBUTE_SIGNED for a signed value.

Fixes 488dac0c9237 ("libfs: fix error cast of negative value in simple_attr_write()")
Cc Alexander Viro <[email protected]>
Cc Jonathan Corbet <[email protected]>
Cc Oscar Salvador <[email protected]>
Cc Rafael J. Wysocki <[email protected]>
Cc Shuah Khan <[email protected]>
Cc Wei Yongjun <[email protected]>
Cc Yicong Yang <[email protected]>
---
 fs/libfs.c         | 22 +++++++++++++++++++---
 include/linux/fs.h | 12 ++++++++++--
 2 files changed, 29 insertions(+), 5 deletions(-)
fs/libfs.c +19 -3
index be57e64834e5..fd5f6c106059 100644
@@ -864,8 +864,8 @@ ssize_t simple_attr_read(struct file *file, char __user *buf,
 EXPORT_SYMBOL_GPL(simple_attr_read);
 
 /* interpret the buffer as a number to call the set function with */
-ssize_t simple_attr_write(struct file *file, const char __user *buf,
-			  size_t len, loff_t *ppos)
+static ssize_t simple_attr_write_xsigned(struct file *file, const char __user *buf,
+			  size_t len, loff_t *ppos, bool is_signed)
 {
 	struct simple_attr *attr;
 	unsigned long long val;
@@ -886,7 +886,10 @@ ssize_t simple_attr_write(struct file *file, const char __user *buf,
 		goto out;
 
 	attr->set_buf[size] = '\0';
-	ret = kstrtoull(attr->set_buf, 0, &val);
+	if (is_signed)
+		ret = kstrtoll(attr->set_buf, 0, &val);
+	else
+		ret = kstrtoull(attr->set_buf, 0, &val);
 	if (ret)
 		goto out;
 	ret = attr->set(attr->data, val);
@@ -896,8 +899,21 @@ ssize_t simple_attr_write(struct file *file, const char __user *buf,
 	mutex_unlock(&attr->mutex);
 	return ret;
 }
+
+ssize_t simple_attr_write(struct file *file, const char __user *buf,
+			  size_t len, loff_t *ppos)
+{
+	return simple_attr_write_xsigned(file, buf, len, ppos, false);
+}
 EXPORT_SYMBOL_GPL(simple_attr_write);
 
+ssize_t simple_attr_write_signed(struct file *file, const char __user *buf,
+			  size_t len, loff_t *ppos)
+{
+	return simple_attr_write_xsigned(file, buf, len, ppos, true);
+}
+EXPORT_SYMBOL_GPL(simple_attr_write_signed);
+
 /**
  * generic_fh_to_dentry - generic helper for the fh_to_dentry export operation
  * @sb:		filesystem to do the file handle conversion on
include/linux/fs.h +10 -2
index 86f884e78b6b..95b8ef09b76c 100644
@@ -3353,7 +3353,7 @@ void simple_transaction_set(struct file *file, size_t n);
  * All attributes contain a text representation of a numeric value
  * that are accessed with the get() and set() functions.
  */
-#define DEFINE_SIMPLE_ATTRIBUTE(__fops, __get, __set, __fmt)		\
+#define DEFINE_SIMPLE_ATTRIBUTE_XSIGNED(__fops, __get, __set, __fmt, __is_signed)	\
 static int __fops ## _open(struct inode *inode, struct file *file)	\
 {									\
 	__simple_attr_check_format(__fmt, 0ull);			\
@@ -3364,10 +3364,16 @@ static const struct file_operations __fops = {				\
 	.open	 = __fops ## _open,					\
 	.release = simple_attr_release,					\
 	.read	 = simple_attr_read,					\
-	.write	 = simple_attr_write,					\
+	.write	 = (__is_signed) ? simple_attr_write_signed : simple_attr_write,	\
 	.llseek	 = generic_file_llseek,					\
 }
 
+#define DEFINE_SIMPLE_ATTRIBUTE(__fops, __get, __set, __fmt)		\
+	DEFINE_SIMPLE_ATTRIBUTE_XSIGNED(__fops, __get, __set, __fmt, false)
+
+#define DEFINE_SIMPLE_ATTRIBUTE_SIGNED(__fops, __get, __set, __fmt)	\
+	DEFINE_SIMPLE_ATTRIBUTE_XSIGNED(__fops, __get, __set, __fmt, true)
+
 static inline __printf(1, 2)
 void __simple_attr_check_format(const char *fmt, ...)
 {
@@ -3382,6 +3388,8 @@ ssize_t simple_attr_read(struct file *file, char __user *buf,
 			 size_t len, loff_t *ppos);
 ssize_t simple_attr_write(struct file *file, const char __user *buf,
 			  size_t len, loff_t *ppos);
+ssize_t simple_attr_write_signed(struct file *file, const char __user *buf,
+				 size_t len, loff_t *ppos);
 
 struct ctl_table;
 int proc_nr_files(struct ctl_table *table, int write,
Signature · 1 line
2.35.1
author maintainer
#59 lore raw

PATCH 59/521 lib/notifier-error-inject: fix error when writing -errno to debugfs file

In reply to Greg Kroah-Hartman

From: Akinobu Mita <[email protected]>

[ Upstream commit f883c3edd2c432a2931ec8773c70a570115a50fe ]

The simple attribute files do not accept a negative value since the commit 488dac0c9237 ("libfs: fix error cast of negative value in simple_attr_write()").

This restores the previous behaviour by using newly introduced DEFINE_SIMPLE_ATTRIBUTE_SIGNED instead of DEFINE_SIMPLE_ATTRIBUTE.

Fixes 488dac0c9237 ("libfs: fix error cast of negative value in simple_attr_write()")
Cc Alexander Viro <[email protected]>
Cc Jonathan Corbet <[email protected]>
Cc Oscar Salvador <[email protected]>
Cc Rafael J. Wysocki <[email protected]>
Cc Shuah Khan <[email protected]>
Cc Wei Yongjun <[email protected]>
Cc Yicong Yang <[email protected]>
---
 lib/notifier-error-inject.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/notifier-error-inject.c +1 -1
index eb4a04afea80..125ea8ce23a4 100644
@@ -14,7 +14,7 @@ static int debugfs_errno_get(void *data, u64 *val)
 	return 0;
 }
 
-DEFINE_SIMPLE_ATTRIBUTE(fops_errno, debugfs_errno_get, debugfs_errno_set,
+DEFINE_SIMPLE_ATTRIBUTE_SIGNED(fops_errno, debugfs_errno_get, debugfs_errno_set,
 			"%lld\n");
 
 static struct dentry *debugfs_create_errno(const char *name, umode_t mode,
Signature · 1 line
2.35.1
author maintainer
#60 lore raw

PATCH 60/521 debugfs: fix error when writing negative value to atomic_t debugfs file

In reply to Greg Kroah-Hartman

From: Akinobu Mita <[email protected]>

[ Upstream commit d472cf797c4e268613dbce5ec9b95d0bcae19ecb ]

The simple attribute files do not accept a negative value since the commit 488dac0c9237 ("libfs: fix error cast of negative value in simple_attr_write()"), so we have to use a 64-bit value to write a negative value for a debugfs file created by debugfs_create_atomic_t().

This restores the previous behaviour by introducing DEFINE_DEBUGFS_ATTRIBUTE_SIGNED for a signed value.

Fixes 488dac0c9237 ("libfs: fix error cast of negative value in simple_attr_write()")
Cc Alexander Viro <[email protected]>
Cc Jonathan Corbet <[email protected]>
Cc Oscar Salvador <[email protected]>
Cc Rafael J. Wysocki <[email protected]>
Cc Shuah Khan <[email protected]>
Cc Wei Yongjun <[email protected]>
Cc Yicong Yang <[email protected]>
---
 .../fault-injection/fault-injection.txt       |  4 +--
 fs/debugfs/file.c                             | 28 +++++++++++++++----
 include/linux/debugfs.h                       | 19 +++++++++++--
 3 files changed, 41 insertions(+), 10 deletions(-)
Documentation/fault-injection/fault-injection.txt +2 -2
index 4d1b7b4ccfaf..b2b86147bafe 100644
@@ -71,8 +71,8 @@ configuration of fault-injection capabilities.
 
 - /sys/kernel/debug/fail*/times:
 
-	specifies how many times failures may happen at most.
-	A value of -1 means "no limit".
+	specifies how many times failures may happen at most. A value of -1
+	means "no limit".
 
 - /sys/kernel/debug/fail*/space:
 
fs/debugfs/file.c +22 -6
index 4fce1da7db23..a57d080d2ba5 100644
@@ -330,8 +330,8 @@ ssize_t debugfs_attr_read(struct file *file, char __user *buf,
 }
 EXPORT_SYMBOL_GPL(debugfs_attr_read);
 
-ssize_t debugfs_attr_write(struct file *file, const char __user *buf,
-			 size_t len, loff_t *ppos)
+static ssize_t debugfs_attr_write_xsigned(struct file *file, const char __user *buf,
+			 size_t len, loff_t *ppos, bool is_signed)
 {
 	struct dentry *dentry = F_DENTRY(file);
 	ssize_t ret;
@@ -339,12 +339,28 @@ ssize_t debugfs_attr_write(struct file *file, const char __user *buf,
 	ret = debugfs_file_get(dentry);
 	if (unlikely(ret))
 		return ret;
-	ret = simple_attr_write(file, buf, len, ppos);
+	if (is_signed)
+		ret = simple_attr_write_signed(file, buf, len, ppos);
+	else
+		ret = simple_attr_write(file, buf, len, ppos);
 	debugfs_file_put(dentry);
 	return ret;
 }
+
+ssize_t debugfs_attr_write(struct file *file, const char __user *buf,
+			 size_t len, loff_t *ppos)
+{
+	return debugfs_attr_write_xsigned(file, buf, len, ppos, false);
+}
 EXPORT_SYMBOL_GPL(debugfs_attr_write);
 
+ssize_t debugfs_attr_write_signed(struct file *file, const char __user *buf,
+			 size_t len, loff_t *ppos)
+{
+	return debugfs_attr_write_xsigned(file, buf, len, ppos, true);
+}
+EXPORT_SYMBOL_GPL(debugfs_attr_write_signed);
+
 static struct dentry *debugfs_create_mode_unsafe(const char *name, umode_t mode,
 					struct dentry *parent, void *value,
 					const struct file_operations *fops,
@@ -742,11 +758,11 @@ static int debugfs_atomic_t_get(void *data, u64 *val)
 	*val = atomic_read((atomic_t *)data);
 	return 0;
 }
-DEFINE_DEBUGFS_ATTRIBUTE(fops_atomic_t, debugfs_atomic_t_get,
+DEFINE_DEBUGFS_ATTRIBUTE_SIGNED(fops_atomic_t, debugfs_atomic_t_get,
 			debugfs_atomic_t_set, "%lld\n");
-DEFINE_DEBUGFS_ATTRIBUTE(fops_atomic_t_ro, debugfs_atomic_t_get, NULL,
+DEFINE_DEBUGFS_ATTRIBUTE_SIGNED(fops_atomic_t_ro, debugfs_atomic_t_get, NULL,
 			"%lld\n");
-DEFINE_DEBUGFS_ATTRIBUTE(fops_atomic_t_wo, NULL, debugfs_atomic_t_set,
+DEFINE_DEBUGFS_ATTRIBUTE_SIGNED(fops_atomic_t_wo, NULL, debugfs_atomic_t_set,
 			"%lld\n");
 
 /**
include/linux/debugfs.h +17 -2
index 2a4638bb4033..6ebc269e48ac 100644
@@ -39,7 +39,7 @@ struct debugfs_regset32 {
 
 extern struct dentry *arch_debugfs_dir;
 
-#define DEFINE_DEBUGFS_ATTRIBUTE(__fops, __get, __set, __fmt)		\
+#define DEFINE_DEBUGFS_ATTRIBUTE_XSIGNED(__fops, __get, __set, __fmt, __is_signed)	\
 static int __fops ## _open(struct inode *inode, struct file *file)	\
 {									\
 	__simple_attr_check_format(__fmt, 0ull);			\
@@ -50,10 +50,16 @@ static const struct file_operations __fops = {				\
 	.open	 = __fops ## _open,					\
 	.release = simple_attr_release,					\
 	.read	 = debugfs_attr_read,					\
-	.write	 = debugfs_attr_write,					\
+	.write	 = (__is_signed) ? debugfs_attr_write_signed : debugfs_attr_write,	\
 	.llseek  = no_llseek,						\
 }
 
+#define DEFINE_DEBUGFS_ATTRIBUTE(__fops, __get, __set, __fmt)		\
+	DEFINE_DEBUGFS_ATTRIBUTE_XSIGNED(__fops, __get, __set, __fmt, false)
+
+#define DEFINE_DEBUGFS_ATTRIBUTE_SIGNED(__fops, __get, __set, __fmt)	\
+	DEFINE_DEBUGFS_ATTRIBUTE_XSIGNED(__fops, __get, __set, __fmt, true)
+
 typedef struct vfsmount *(*debugfs_automount_t)(struct dentry *, void *);
 
 #if defined(CONFIG_DEBUG_FS)
@@ -96,6 +102,8 @@ ssize_t debugfs_attr_read(struct file *file, char __user *buf,
 			size_t len, loff_t *ppos);
 ssize_t debugfs_attr_write(struct file *file, const char __user *buf,
 			size_t len, loff_t *ppos);
+ssize_t debugfs_attr_write_signed(struct file *file, const char __user *buf,
+			size_t len, loff_t *ppos);
 
 struct dentry *debugfs_rename(struct dentry *old_dir, struct dentry *old_dentry,
                 struct dentry *new_dir, const char *new_name);
@@ -246,6 +254,13 @@ static inline ssize_t debugfs_attr_write(struct file *file,
 	return -ENODEV;
 }
 
+static inline ssize_t debugfs_attr_write_signed(struct file *file,
+					const char __user *buf,
+					size_t len, loff_t *ppos)
+{
+	return -ENODEV;
+}
+
 static inline struct dentry *debugfs_rename(struct dentry *old_dir, struct dentry *old_dentry,
                 struct dentry *new_dir, char *new_name)
 {
Signature · 1 line
2.35.1
author maintainer
#61 lore raw

PATCH 61/521 rapidio: fix possible name leaks when rio_add_device() fails

In reply to Greg Kroah-Hartman

From: Yang Yingliang <[email protected]>

[ Upstream commit f9574cd48679926e2a569e1957a5a1bcc8a719ac ]

Patch series "rapidio: fix three possible memory leaks".

This patchset fixes three name leaks in error handling.
- patch #1 fixes two name leaks while rio_add_device() fails.
- patch #2 fixes a name leak while rio_register_mport() fails.

This patch (of 2):

If rio_add_device() returns error, the name allocated by dev_set_name() need be freed. It should use put_device() to give up the reference in the error path, so that the name can be freed in kobject_cleanup(), and the 'rdev' can be freed in rio_release_dev().

Fixes e8de370188d0 ("rapidio: add mport char device driver")
Fixes 1fa5ae857bb1 ("driver core: get rid of struct device's bus_id string array")
Cc Alexandre Bounine <[email protected]>
Cc Matt Porter <[email protected]>
---
 drivers/rapidio/devices/rio_mport_cdev.c | 7 +++++--
 drivers/rapidio/rio-scan.c               | 8 ++++++--
 2 files changed, 11 insertions(+), 4 deletions(-)
drivers/rapidio/devices/rio_mport_cdev.c +5 -2
index a136a7ae7714..01eb1a594ce6 100644
@@ -1809,8 +1809,11 @@ static int rio_mport_add_riodev(struct mport_cdev_priv *priv,
 		rio_init_dbell_res(&rdev->riores[RIO_DOORBELL_RESOURCE],
 				   0, 0xffff);
 	err = rio_add_device(rdev);
-	if (err)
-		goto cleanup;
+	if (err) {
+		put_device(&rdev->dev);
+		return err;
+	}
+
 	rio_dev_get(rdev);
 
 	return 0;
drivers/rapidio/rio-scan.c +6 -2
index fd7b517132ac..d2ddc173c5bd 100644
@@ -460,8 +460,12 @@ static struct rio_dev *rio_setup_device(struct rio_net *net,
 				   0, 0xffff);
 
 	ret = rio_add_device(rdev);
-	if (ret)
-		goto cleanup;
+	if (ret) {
+		if (rswitch)
+			kfree(rswitch->route_table);
+		put_device(&rdev->dev);
+		return NULL;
+	}
 
 	rio_dev_get(rdev);
 
Signature · 1 line
2.35.1
author maintainer
#62 lore raw

PATCH 62/521 rapidio: rio: fix possible name leak in rio_register_mport()

In reply to Greg Kroah-Hartman

From: Yang Yingliang <[email protected]>

[ Upstream commit e92a216d16bde65d21a3227e0fb2aa0794576525 ]

If device_register() returns error, the name allocated by dev_set_name() need be freed. It should use put_device() to give up the reference in the error path, so that the name can be freed in kobject_cleanup(), and list_del() is called to delete the port from rio_mports.

Fixes 2aaf308b95b2 ("rapidio: rework device hierarchy and introduce mport class of devices")
Cc Alexandre Bounine <[email protected]>
Cc Matt Porter <[email protected]>
---
 drivers/rapidio/rio.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/rapidio/rio.c +7 -2
index 83406696c7aa..4304142d8700 100644
@@ -2271,11 +2271,16 @@ int rio_register_mport(struct rio_mport *port)
 	atomic_set(&port->state, RIO_DEVICE_RUNNING);
 
 	res = device_register(&port->dev);
-	if (res)
+	if (res) {
 		dev_err(&port->dev, "RIO: mport%d registration failed ERR=%d\n",
 			port->id, res);
-	else
+		mutex_lock(&rio_mport_list_lock);
+		list_del(&port->node);
+		mutex_unlock(&rio_mport_list_lock);
+		put_device(&port->dev);
+	} else {
 		dev_dbg(&port->dev, "RIO: registered mport%d\n", port->id);
+	}
 
 	return res;
 }
Signature · 1 line
2.35.1
author maintainer
#63 lore raw

PATCH 63/521 clocksource/drivers/sh_cmt: Make sure channel clock supply is enabled

In reply to Greg Kroah-Hartman

From: Geert Uytterhoeven <[email protected]>

[ Upstream commit 2a97d55333e4299f32c98cca6dc5c4db1c5855fc ]

The Renesas Compare Match Timer 0 and 1 (CMT0/1) variants have a register to control the clock supply to the individual channels. Currently the driver does not touch this register, and relies on the documented initial value, which has the clock supply enabled for all channels present.

However, when Linux starts on the APE6-EVM development board, only the clock supply to the first CMT1 channel is enabled. Hence the first channel (used as a clockevent) works, while the second channel (used as a clocksource) does not. Note that the default system clocksource is the Cortex-A15 architectured timer, and the user needs to manually switch to the CMT1 clocksource to trigger the broken behavior.

Fix this by removing the fragile dependency on implicit reset and/or boot loader state, and by enabling the clock supply explicitly for all channels used instead. This requires postponing the clk_disable() call, else the timer's registers cannot be accessed in sh_cmt_setup_channel().

---
 drivers/clocksource/sh_cmt.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
drivers/clocksource/sh_cmt.c +13 -3
index 7a6d4c4c0feb..0ca8819acc4d 100644
@@ -239,6 +239,8 @@ static const struct sh_cmt_info sh_cmt_info[] = {
 #define CMCNT 1 /* channel register */
 #define CMCOR 2 /* channel register */
 
+#define CMCLKE	0x1000	/* CLK Enable Register (R-Car Gen2) */
+
 static inline u32 sh_cmt_read_cmstr(struct sh_cmt_channel *ch)
 {
 	if (ch->iostart)
@@ -856,6 +858,7 @@ static int sh_cmt_setup_channel(struct sh_cmt_channel *ch, unsigned int index,
 				unsigned int hwidx, bool clockevent,
 				bool clocksource, struct sh_cmt_device *cmt)
 {
+	u32 value;
 	int ret;
 
 	/* Skip unused channels. */
@@ -885,6 +888,11 @@ static int sh_cmt_setup_channel(struct sh_cmt_channel *ch, unsigned int index,
 		ch->iostart = cmt->mapbase + ch->hwidx * 0x100;
 		ch->ioctrl = ch->iostart + 0x10;
 		ch->timer_bit = 0;
+
+		/* Enable the clock supply to the channel */
+		value = ioread32(cmt->mapbase + CMCLKE);
+		value |= BIT(hwidx);
+		iowrite32(value, cmt->mapbase + CMCLKE);
 		break;
 	}
 
@@ -991,12 +999,10 @@ static int sh_cmt_setup(struct sh_cmt_device *cmt, struct platform_device *pdev)
 	else
 		cmt->rate = clk_get_rate(cmt->clk) / 8;
 
-	clk_disable(cmt->clk);
-
 	/* Map the memory resource(s). */
 	ret = sh_cmt_map_memory(cmt);
 	if (ret < 0)
-		goto err_clk_unprepare;
+		goto err_clk_disable;
 
 	/* Allocate and setup the channels. */
 	cmt->num_channels = hweight8(cmt->hw_channels);
@@ -1024,6 +1030,8 @@ static int sh_cmt_setup(struct sh_cmt_device *cmt, struct platform_device *pdev)
 		mask &= ~(1 << hwidx);
 	}
 
+	clk_disable(cmt->clk);
+
 	platform_set_drvdata(pdev, cmt);
 
 	return 0;
@@ -1031,6 +1039,8 @@ static int sh_cmt_setup(struct sh_cmt_device *cmt, struct platform_device *pdev)
 err_unmap:
 	kfree(cmt->channels);
 	iounmap(cmt->mapbase);
+err_clk_disable:
+	clk_disable(cmt->clk);
 err_clk_unprepare:
 	clk_unprepare(cmt->clk);
 err_clk_put:
Signature · 1 line
2.35.1
author maintainer
#64 lore raw

PATCH 64/521 ACPICA: Fix use-after-free in acpi_ut_copy_ipackage_to_ipackage()

In reply to Greg Kroah-Hartman

From: Li Zetao <[email protected]>

[ Upstream commit 470188b09e92d83c5a997f25f0e8fb8cd2bc3469 ]

There is an use-after-free reported by KASAN:

  BUG: KASAN: use-after-free in acpi_ut_remove_reference+0x3b/0x82
  Read of size 1 at addr ffff888112afc460 by task modprobe/2111
  CPU: 0 PID: 2111 Comm: modprobe Not tainted 6.1.0-rc7-dirty
  Hardware name: QEMU Standard PC (i440FX + PIIX, 1996),
  Call Trace:
   <TASK>
   kasan_report+0xae/0xe0
   acpi_ut_remove_reference+0x3b/0x82
   acpi_ut_copy_iobject_to_iobject+0x3be/0x3d5
   acpi_ds_store_object_to_local+0x15d/0x3a0
   acpi_ex_store+0x78d/0x7fd
   acpi_ex_opcode_1A_1T_1R+0xbe4/0xf9b
   acpi_ps_parse_aml+0x217/0x8d5
   ...
   </TASK>

The root cause of the problem is that the acpi_operand_object is freed when acpi_ut_walk_package_tree() fails in acpi_ut_copy_ipackage_to_ipackage(), lead to repeated release in acpi_ut_copy_iobject_to_iobject(). The problem was introduced by "8aa5e56eeb61" commit, this commit is to fix memory leak in acpi_ut_copy_iobject_to_iobject(), repeatedly adding remove operation, lead to "acpi_operand_object" used after free.

Fix it by removing acpi_ut_remove_reference() in acpi_ut_copy_ipackage_to_ipackage(). acpi_ut_copy_ipackage_to_ipackage() is called to copy an internal package object into another internal package object, when it fails, the memory of acpi_operand_object should be freed by the caller.

Fixes 8aa5e56eeb61 ("ACPICA: Utilities: Fix memory leak in acpi_ut_copy_iobject_to_iobject")
---
 drivers/acpi/acpica/utcopy.c | 7 -------
 1 file changed, 7 deletions(-)
drivers/acpi/acpica/utcopy.c +0 -7
index a872ed7879ca..056c1741c1e3 100644
@@ -916,13 +916,6 @@ acpi_ut_copy_ipackage_to_ipackage(union acpi_operand_object *source_obj,
 	status = acpi_ut_walk_package_tree(source_obj, dest_obj,
 					   acpi_ut_copy_ielement_to_ielement,
 					   walk_state);
-	if (ACPI_FAILURE(status)) {
-
-		/* On failure, delete the destination package object */
-
-		acpi_ut_remove_reference(dest_obj);
-	}
-
 	return_ACPI_STATUS(status);
 }
 
Signature · 1 line
2.35.1
author maintainer
#65 lore raw

PATCH 65/521 uprobes/x86: Allow to probe a NOP instruction with 0x66 prefix

In reply to Greg Kroah-Hartman

From: Oleg Nesterov <[email protected]>

[ Upstream commit cefa72129e45313655d53a065b8055aaeb01a0c9 ]

Intel ICC -hotpatch inserts 2-byte "0x66 0x90" NOP at the start of each function to reserve extra space for hot-patching, and currently it is not possible to probe these functions because branch_setup_xol_ops() wrongly rejects NOP with REP prefix as it treats them like word-sized branch instructions.

---
 arch/x86/kernel/uprobes.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
arch/x86/kernel/uprobes.c +3 -1
index ae9e806a11de..3b87bca027b4 100644
@@ -735,8 +735,9 @@ static int branch_setup_xol_ops(struct arch_uprobe *auprobe, struct insn *insn)
 	switch (opc1) {
 	case 0xeb:	/* jmp 8 */
 	case 0xe9:	/* jmp 32 */
-	case 0x90:	/* prefix* + nop; same as jmp with .offs = 0 */
 		break;
+	case 0x90:	/* prefix* + nop; same as jmp with .offs = 0 */
+		goto setup;
 
 	case 0xe8:	/* call relative */
 		branch_clear_offset(auprobe, insn);
@@ -765,6 +766,7 @@ static int branch_setup_xol_ops(struct arch_uprobe *auprobe, struct insn *insn)
 			return -ENOTSUPP;
 	}
 
+setup:
 	auprobe->branch.opc1 = opc1;
 	auprobe->branch.ilen = insn->length;
 	auprobe->branch.offs = insn->immediate.value;
Signature · 1 line
2.35.1
author maintainer
#66 lore raw

PATCH 66/521 xen/events: only register debug interrupt for 2-level events

In reply to Greg Kroah-Hartman

From: Juergen Gross <[email protected]>

[ Upstream commit d04b1ae5a9b0c868dda8b4b34175ef08f3cb9e93 ]

xen_debug_interrupt() is specific to 2-level event handling. So don't register it with fifo event handling being active.

Stable-dep-of: 69143f60868b ("x86/xen: Fix memory leak in xen_smp_intr_init{_pv}()")

---
 arch/x86/xen/smp.c               | 19 +++++++++++--------
 arch/x86/xen/xen-ops.h           |  2 ++
 drivers/xen/events/events_base.c | 10 ++++++----
 3 files changed, 19 insertions(+), 12 deletions(-)
arch/x86/xen/smp.c +11 -8
index 7a43b2ae19f1..63a3605b2225 100644
@@ -88,14 +88,17 @@ int xen_smp_intr_init(unsigned int cpu)
 	per_cpu(xen_callfunc_irq, cpu).irq = rc;
 	per_cpu(xen_callfunc_irq, cpu).name = callfunc_name;
 
-	debug_name = kasprintf(GFP_KERNEL, "debug%d", cpu);
-	rc = bind_virq_to_irqhandler(VIRQ_DEBUG, cpu, xen_debug_interrupt,
-				     IRQF_PERCPU | IRQF_NOBALANCING,
-				     debug_name, NULL);
-	if (rc < 0)
-		goto fail;
-	per_cpu(xen_debug_irq, cpu).irq = rc;
-	per_cpu(xen_debug_irq, cpu).name = debug_name;
+	if (!xen_fifo_events) {
+		debug_name = kasprintf(GFP_KERNEL, "debug%d", cpu);
+		rc = bind_virq_to_irqhandler(VIRQ_DEBUG, cpu,
+					     xen_debug_interrupt,
+					     IRQF_PERCPU | IRQF_NOBALANCING,
+					     debug_name, NULL);
+		if (rc < 0)
+			goto fail;
+		per_cpu(xen_debug_irq, cpu).irq = rc;
+		per_cpu(xen_debug_irq, cpu).name = debug_name;
+	}
 
 	callfunc_name = kasprintf(GFP_KERNEL, "callfuncsingle%d", cpu);
 	rc = bind_ipi_to_irqhandler(XEN_CALL_FUNCTION_SINGLE_VECTOR,
arch/x86/xen/xen-ops.h +2 -0
index 2f111f47ba98..9faec8543237 100644
@@ -30,6 +30,8 @@ extern struct start_info *xen_start_info;
 extern struct shared_info xen_dummy_shared_info;
 extern struct shared_info *HYPERVISOR_shared_info;
 
+extern bool xen_fifo_events;
+
 void xen_setup_mfn_list_list(void);
 void xen_build_mfn_list_list(void);
 void xen_setup_machphys_mapping(void);
drivers/xen/events/events_base.c +6 -4
index d138027034fd..b6b3131cb079 100644
@@ -2100,8 +2100,8 @@ void xen_callback_vector(void)
 void xen_callback_vector(void) {}
 #endif
 
-static bool fifo_events = true;
-module_param(fifo_events, bool, 0);
+bool xen_fifo_events = true;
+module_param_named(fifo_events, xen_fifo_events, bool, 0);
 
 static int xen_evtchn_cpu_prepare(unsigned int cpu)
 {
@@ -2130,10 +2130,12 @@ void __init xen_init_IRQ(void)
 	int ret = -EINVAL;
 	unsigned int evtchn;
 
-	if (fifo_events)
+	if (xen_fifo_events)
 		ret = xen_evtchn_fifo_init();
-	if (ret < 0)
+	if (ret < 0) {
 		xen_evtchn_2l_init();
+		xen_fifo_events = false;
+	}
 
 	xen_cpu_init_eoi(smp_processor_id());
 
Signature · 1 line
2.35.1
author maintainer
#67 lore raw

PATCH 67/521 x86/xen: Fix memory leak in xen_smp_intr_init{_pv}()

In reply to Greg Kroah-Hartman

From: Xiu Jianfeng <[email protected]>

[ Upstream commit 69143f60868b3939ddc89289b29db593b647295e ]

These local variables @{resched|pmu|callfunc...}_name saves the new string allocated by kasprintf(), and when bind_{v}ipi_to_irqhandler() fails, it goes to the @fail tag, and calls xen_smp_intr_free{_pv}() to free resource, however the new string is not saved, which cause a memory leak issue. fix it.

---
 arch/x86/xen/smp.c    | 24 ++++++++++++------------
 arch/x86/xen/smp_pv.c | 12 ++++++------
 2 files changed, 18 insertions(+), 18 deletions(-)
arch/x86/xen/smp.c +12 -12
index 63a3605b2225..a1cc855c539c 100644
@@ -32,30 +32,30 @@ static irqreturn_t xen_reschedule_interrupt(int irq, void *dev_id)
 
 void xen_smp_intr_free(unsigned int cpu)
 {
+	kfree(per_cpu(xen_resched_irq, cpu).name);
+	per_cpu(xen_resched_irq, cpu).name = NULL;
 	if (per_cpu(xen_resched_irq, cpu).irq >= 0) {
 		unbind_from_irqhandler(per_cpu(xen_resched_irq, cpu).irq, NULL);
 		per_cpu(xen_resched_irq, cpu).irq = -1;
-		kfree(per_cpu(xen_resched_irq, cpu).name);
-		per_cpu(xen_resched_irq, cpu).name = NULL;
 	}
+	kfree(per_cpu(xen_callfunc_irq, cpu).name);
+	per_cpu(xen_callfunc_irq, cpu).name = NULL;
 	if (per_cpu(xen_callfunc_irq, cpu).irq >= 0) {
 		unbind_from_irqhandler(per_cpu(xen_callfunc_irq, cpu).irq, NULL);
 		per_cpu(xen_callfunc_irq, cpu).irq = -1;
-		kfree(per_cpu(xen_callfunc_irq, cpu).name);
-		per_cpu(xen_callfunc_irq, cpu).name = NULL;
 	}
+	kfree(per_cpu(xen_debug_irq, cpu).name);
+	per_cpu(xen_debug_irq, cpu).name = NULL;
 	if (per_cpu(xen_debug_irq, cpu).irq >= 0) {
 		unbind_from_irqhandler(per_cpu(xen_debug_irq, cpu).irq, NULL);
 		per_cpu(xen_debug_irq, cpu).irq = -1;
-		kfree(per_cpu(xen_debug_irq, cpu).name);
-		per_cpu(xen_debug_irq, cpu).name = NULL;
 	}
+	kfree(per_cpu(xen_callfuncsingle_irq, cpu).name);
+	per_cpu(xen_callfuncsingle_irq, cpu).name = NULL;
 	if (per_cpu(xen_callfuncsingle_irq, cpu).irq >= 0) {
 		unbind_from_irqhandler(per_cpu(xen_callfuncsingle_irq, cpu).irq,
 				       NULL);
 		per_cpu(xen_callfuncsingle_irq, cpu).irq = -1;
-		kfree(per_cpu(xen_callfuncsingle_irq, cpu).name);
-		per_cpu(xen_callfuncsingle_irq, cpu).name = NULL;
 	}
 }
 
@@ -65,6 +65,7 @@ int xen_smp_intr_init(unsigned int cpu)
 	char *resched_name, *callfunc_name, *debug_name;
 
 	resched_name = kasprintf(GFP_KERNEL, "resched%d", cpu);
+	per_cpu(xen_resched_irq, cpu).name = resched_name;
 	rc = bind_ipi_to_irqhandler(XEN_RESCHEDULE_VECTOR,
 				    cpu,
 				    xen_reschedule_interrupt,
@@ -74,9 +75,9 @@ int xen_smp_intr_init(unsigned int cpu)
 	if (rc < 0)
 		goto fail;
 	per_cpu(xen_resched_irq, cpu).irq = rc;
-	per_cpu(xen_resched_irq, cpu).name = resched_name;
 
 	callfunc_name = kasprintf(GFP_KERNEL, "callfunc%d", cpu);
+	per_cpu(xen_callfunc_irq, cpu).name = callfunc_name;
 	rc = bind_ipi_to_irqhandler(XEN_CALL_FUNCTION_VECTOR,
 				    cpu,
 				    xen_call_function_interrupt,
@@ -86,10 +87,10 @@ int xen_smp_intr_init(unsigned int cpu)
 	if (rc < 0)
 		goto fail;
 	per_cpu(xen_callfunc_irq, cpu).irq = rc;
-	per_cpu(xen_callfunc_irq, cpu).name = callfunc_name;
 
 	if (!xen_fifo_events) {
 		debug_name = kasprintf(GFP_KERNEL, "debug%d", cpu);
+		per_cpu(xen_debug_irq, cpu).name = debug_name;
 		rc = bind_virq_to_irqhandler(VIRQ_DEBUG, cpu,
 					     xen_debug_interrupt,
 					     IRQF_PERCPU | IRQF_NOBALANCING,
@@ -97,10 +98,10 @@ int xen_smp_intr_init(unsigned int cpu)
 		if (rc < 0)
 			goto fail;
 		per_cpu(xen_debug_irq, cpu).irq = rc;
-		per_cpu(xen_debug_irq, cpu).name = debug_name;
 	}
 
 	callfunc_name = kasprintf(GFP_KERNEL, "callfuncsingle%d", cpu);
+	per_cpu(xen_callfuncsingle_irq, cpu).name = callfunc_name;
 	rc = bind_ipi_to_irqhandler(XEN_CALL_FUNCTION_SINGLE_VECTOR,
 				    cpu,
 				    xen_call_function_single_interrupt,
@@ -110,7 +111,6 @@ int xen_smp_intr_init(unsigned int cpu)
 	if (rc < 0)
 		goto fail;
 	per_cpu(xen_callfuncsingle_irq, cpu).irq = rc;
-	per_cpu(xen_callfuncsingle_irq, cpu).name = callfunc_name;
 
 	return 0;
 
arch/x86/xen/smp_pv.c +6 -6
index e8248e8a04ca..75807c2a1e17 100644
@@ -94,18 +94,18 @@ asmlinkage __visible void cpu_bringup_and_idle(void)
 
 void xen_smp_intr_free_pv(unsigned int cpu)
 {
+	kfree(per_cpu(xen_irq_work, cpu).name);
+	per_cpu(xen_irq_work, cpu).name = NULL;
 	if (per_cpu(xen_irq_work, cpu).irq >= 0) {
 		unbind_from_irqhandler(per_cpu(xen_irq_work, cpu).irq, NULL);
 		per_cpu(xen_irq_work, cpu).irq = -1;
-		kfree(per_cpu(xen_irq_work, cpu).name);
-		per_cpu(xen_irq_work, cpu).name = NULL;
 	}
 
+	kfree(per_cpu(xen_pmu_irq, cpu).name);
+	per_cpu(xen_pmu_irq, cpu).name = NULL;
 	if (per_cpu(xen_pmu_irq, cpu).irq >= 0) {
 		unbind_from_irqhandler(per_cpu(xen_pmu_irq, cpu).irq, NULL);
 		per_cpu(xen_pmu_irq, cpu).irq = -1;
-		kfree(per_cpu(xen_pmu_irq, cpu).name);
-		per_cpu(xen_pmu_irq, cpu).name = NULL;
 	}
 }
 
@@ -115,6 +115,7 @@ int xen_smp_intr_init_pv(unsigned int cpu)
 	char *callfunc_name, *pmu_name;
 
 	callfunc_name = kasprintf(GFP_KERNEL, "irqwork%d", cpu);
+	per_cpu(xen_irq_work, cpu).name = callfunc_name;
 	rc = bind_ipi_to_irqhandler(XEN_IRQ_WORK_VECTOR,
 				    cpu,
 				    xen_irq_work_interrupt,
@@ -124,10 +125,10 @@ int xen_smp_intr_init_pv(unsigned int cpu)
 	if (rc < 0)
 		goto fail;
 	per_cpu(xen_irq_work, cpu).irq = rc;
-	per_cpu(xen_irq_work, cpu).name = callfunc_name;
 
 	if (is_xen_pmu) {
 		pmu_name = kasprintf(GFP_KERNEL, "pmu%d", cpu);
+		per_cpu(xen_pmu_irq, cpu).name = pmu_name;
 		rc = bind_virq_to_irqhandler(VIRQ_XENPMU, cpu,
 					     xen_pmu_irq_handler,
 					     IRQF_PERCPU|IRQF_NOBALANCING,
@@ -135,7 +136,6 @@ int xen_smp_intr_init_pv(unsigned int cpu)
 		if (rc < 0)
 			goto fail;
 		per_cpu(xen_pmu_irq, cpu).irq = rc;
-		per_cpu(xen_pmu_irq, cpu).name = pmu_name;
 	}
 
 	return 0;
Signature · 1 line
2.35.1
author maintainer
#41 lore raw

PATCH 41/521 ARM: mmp: fix timer_read delay

In reply to Greg Kroah-Hartman

From: Doug Brown <[email protected]>

[ Upstream commit e348b4014c31041e13ff370669ba3348c4d385e3 ]

timer_read() was using an empty 100-iteration loop to wait for the TMR_CVWR register to capture the latest timer counter value. The delay wasn't long enough. This resulted in CPU idle time being extremely underreported on PXA168 with CONFIG_NO_HZ_IDLE=y.

Switch to the approach used in the vendor kernel, which implements the capture delay by reading TMR_CVWR a few times instead.

Fixes 49cbe78637eb ("[ARM] pxa: add base support for Marvell's PXA168 processor line")
---
 arch/arm/mach-mmp/time.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
arch/arm/mach-mmp/time.c +7 -4
index 96ad1db0b04b..edd280e75546 100644
@@ -52,18 +52,21 @@
 static void __iomem *mmp_timer_base = TIMERS_VIRT_BASE;
 
 /*
- * FIXME: the timer needs some delay to stablize the counter capture
+ * Read the timer through the CVWR register. Delay is required after requesting
+ * a read. The CR register cannot be directly read due to metastability issues
+ * documented in the PXA168 software manual.
  */
 static inline uint32_t timer_read(void)
 {
-	int delay = 100;
+	uint32_t val;
+	int delay = 3;
 
 	__raw_writel(1, mmp_timer_base + TMR_CVWR(1));
 
 	while (delay--)
-		cpu_relax();
+		val = __raw_readl(mmp_timer_base + TMR_CVWR(1));
 
-	return __raw_readl(mmp_timer_base + TMR_CVWR(1));
+	return val;
 }
 
 static u64 notrace mmp_read_sched_clock(void)
Signature · 1 line
2.35.1
author maintainer
#68 lore raw

PATCH 68/521 x86/xen: Fix memory leak in xen_init_lock_cpu()

In reply to Greg Kroah-Hartman

From: Xiu Jianfeng <[email protected]>

[ Upstream commit ca84ce153d887b1dc8b118029976cc9faf2a9b40 ]

In xen_init_lock_cpu(), the @name has allocated new string by kasprintf(), if bind_ipi_to_irqhandler() fails, it should be freed, otherwise may lead to a memory leak issue, fix it.

---
 arch/x86/xen/spinlock.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/x86/xen/spinlock.c +3 -3
index 6fffb86a32ad..e6cf1b430fd0 100644
@@ -83,6 +83,7 @@ void xen_init_lock_cpu(int cpu)
 	     cpu, per_cpu(lock_kicker_irq, cpu));
 
 	name = kasprintf(GFP_KERNEL, "spinlock%d", cpu);
+	per_cpu(irq_name, cpu) = name;
 	irq = bind_ipi_to_irqhandler(XEN_SPIN_UNLOCK_VECTOR,
 				     cpu,
 				     dummy_handler,
@@ -93,7 +94,6 @@ void xen_init_lock_cpu(int cpu)
 	if (irq >= 0) {
 		disable_irq(irq); /* make sure it's never delivered */
 		per_cpu(lock_kicker_irq, cpu) = irq;
-		per_cpu(irq_name, cpu) = name;
 	}
 
 	printk("cpu %d spinlock event irq %d\n", cpu, irq);
@@ -106,6 +106,8 @@ void xen_uninit_lock_cpu(int cpu)
 	if (!xen_pvspin)
 		return;
 
+	kfree(per_cpu(irq_name, cpu));
+	per_cpu(irq_name, cpu) = NULL;
 	/*
 	 * When booting the kernel with 'mitigations=auto,nosmt', the secondary
 	 * CPUs are not activated, and lock_kicker_irq is not initialized.
@@ -116,8 +118,6 @@ void xen_uninit_lock_cpu(int cpu)
 
 	unbind_from_irqhandler(irq, NULL);
 	per_cpu(lock_kicker_irq, cpu) = -1;
-	kfree(per_cpu(irq_name, cpu));
-	per_cpu(irq_name, cpu) = NULL;
 }
 
 PV_CALLEE_SAVE_REGS_THUNK(xen_vcpu_stolen);
Signature · 1 line
2.35.1
author maintainer
#42 lore raw

PATCH 42/521 pstore: Avoid kcore oops by vmap()ing with VM_IOREMAP

In reply to Greg Kroah-Hartman

From: Stephen Boyd <[email protected]>

[ Upstream commit e6b842741b4f39007215fd7e545cb55aa3d358a2 ]

An oops can be induced by running 'cat /proc/kcore > /dev/null' on devices using pstore with the ram backend because kmap_atomic() assumes lowmem pages are accessible with __va().

 Unable to handle kernel paging request at virtual address ffffff807ff2b000
 Mem abort info:
 ESR = 0x96000006
 EC = 0x25: DABT (current EL), IL = 32 bits
 SET = 0, FnV = 0
 EA = 0, S1PTW = 0
 FSC = 0x06: level 2 translation fault
 Data abort info:
 ISV = 0, ISS = 0x00000006
 CM = 0, WnR = 0
 swapper pgtable: 4k pages, 39-bit VAs, pgdp=0000000081d87000
 [ffffff807ff2b000] pgd=180000017fe18003, p4d=180000017fe18003, pud=180000017fe18003, pmd=0000000000000000
 Internal error: Oops: 96000006 [#1] PREEMPT SMP
 Modules linked in: dm_integrity
 CPU: 7 PID: 21179 Comm: perf Not tainted 5.15.67-10882-ge4eb2eb988cd #1 baa443fb8e8477896a370b31a821eb2009f9bfba
 Hardware name: Google Lazor (rev3 - 8) (DT)
 pstate: a0400009 (NzCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
 pc : __memcpy+0x110/0x260
 lr : vread+0x194/0x294
 sp : ffffffc013ee39d0
 x29: ffffffc013ee39f0 x28: 0000000000001000 x27: ffffff807ff2b000
 x26: 0000000000001000 x25: ffffffc0085a2000 x24: ffffff802d4b3000
 x23: ffffff80f8a60000 x22: ffffff802d4b3000 x21: ffffffc0085a2000
 x20: ffffff8080b7bc68 x19: 0000000000001000 x18: 0000000000000000
 x17: 0000000000000000 x16: 0000000000000000 x15: ffffffd3073f2e60
 x14: ffffffffad588000 x13: 0000000000000000 x12: 0000000000000001
 x11: 00000000000001a2 x10: 00680000fff2bf0b x9 : 03fffffff807ff2b
 x8 : 0000000000000001 x7 : 0000000000000000 x6 : 0000000000000000
 x5 : ffffff802d4b4000 x4 : ffffff807ff2c000 x3 : ffffffc013ee3a78
 x2 : 0000000000001000 x1 : ffffff807ff2b000 x0 : ffffff802d4b3000
 Call trace:
 __memcpy+0x110/0x260
 read_kcore+0x584/0x778
 proc_reg_read+0xb4/0xe4

During early boot, memblock reserves the pages for the ramoops reserved memory node in DT that would otherwise be part of the direct lowmem mapping. Pstore's ram backend reuses those reserved pages to change the memory type (writeback or non-cached) by passing the pages to vmap() (see pfn_to_page() usage in persistent_ram_vmap() for more details) with specific flags. When read_kcore() starts iterating over the vmalloc region, it runs over the virtual address that vmap() returned for ramoops. In aligned_vread() the virtual address is passed to vmalloc_to_page() which returns the page struct for the reserved lowmem area. That lowmem page is passed to kmap_atomic(), which effectively calls page_to_virt() that assumes a lowmem page struct must be directly accessible with __va() and friends. These pages are mapped via vmap() though, and the lowmem mapping was never made, so accessing them via the lowmem virtual address oopses like above.

Let's side-step this problem by passing VM_IOREMAP to vmap(). This will tell vread() to not include the ramoops region in the kcore. Instead the area will look like a bunch of zeros. The alternative is to teach kmap() about vmalloc areas that intersect with lowmem. Presumably such a change isn't a one-liner, and there isn't much interest in inspecting the ramoops region in kcore files anyway, so the most expedient route is taken for now.

Cc Brian Geffon <[email protected]>
Cc Mike Rapoport <[email protected]>
Cc Andrew Morton <[email protected]>
Fixes 404a6043385d ("staging: android: persistent_ram: handle reserving and mapping memory")
---
 fs/pstore/ram_core.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
fs/pstore/ram_core.c +5 -1
index 3c777ec80d47..60dff7180412 100644
@@ -426,7 +426,11 @@ static void *persistent_ram_vmap(phys_addr_t start, size_t size,
 		phys_addr_t addr = page_start + i * PAGE_SIZE;
 		pages[i] = pfn_to_page(addr >> PAGE_SHIFT);
 	}
-	vaddr = vmap(pages, page_count, VM_MAP, prot);
+	/*
+	 * VM_IOREMAP used here to bypass this region during vread()
+	 * and kmap_atomic() (i.e. kcore) to avoid __va() failures.
+	 */
+	vaddr = vmap(pages, page_count, VM_MAP | VM_IOREMAP, prot);
 	kfree(pages);
 
 	/*
Signature · 1 line
2.35.1
author maintainer
#43 lore raw

PATCH 43/521 tpm/tpm_crb: Fix error message in __crb_relinquish_locality()

In reply to Greg Kroah-Hartman

From: Michael Kelley <[email protected]>

[ Upstream commit f5264068071964b56dc02c9dab3d11574aaca6ff ]

The error message in __crb_relinquish_locality() mentions requestAccess instead of Relinquish. Fix it.

Fixes 888d867df441 ("tpm: cmd_ready command can be issued only after granting locality")
---
 drivers/char/tpm/tpm_crb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/char/tpm/tpm_crb.c +1 -1
index 20f27100708b..101c71c78e2f 100644
@@ -256,7 +256,7 @@ static int __crb_relinquish_locality(struct device *dev,
 	iowrite32(CRB_LOC_CTRL_RELINQUISH, &priv->regs_h->loc_ctrl);
 	if (!crb_wait_for_reg_32(&priv->regs_h->loc_state, mask, value,
 				 TPM2_TIMEOUT_C)) {
-		dev_warn(dev, "TPM_LOC_STATE_x.requestAccess timed out\n");
+		dev_warn(dev, "TPM_LOC_STATE_x.Relinquish timed out\n");
 		return -ETIME;
 	}
 
Signature · 1 line
2.35.1
author maintainer
#44 lore raw

PATCH 44/521 cpuidle: dt: Return the correct numbers of parsed idle states

In reply to Greg Kroah-Hartman

From: Ulf Hansson <[email protected]>

[ Upstream commit ee3c2c8ad6ba6785f14a60e4081d7c82e88162a2 ]

While we correctly skips to initialize an idle state from a disabled idle state node in DT, the returned value from dt_init_idle_driver() don't get adjusted accordingly. Instead the number of found idle state nodes are returned, while the callers are expecting the number of successfully initialized idle states from DT.

This leads to cpuidle drivers unnecessarily continues to initialize their idle state specific data. Moreover, in the case when all idle states have been disabled in DT, we would end up registering a cpuidle driver, rather than relying on the default arch specific idle call.

Fixes 9f14da345599 ("drivers: cpuidle: implement DT based idle states infrastructure")
---
 drivers/cpuidle/dt_idle_states.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cpuidle/dt_idle_states.c +1 -1
index 53342b7f1010..ea3c59d3fdad 100644
@@ -224,6 +224,6 @@ int dt_init_idle_driver(struct cpuidle_driver *drv,
 	 * also be 0 on platforms with missing DT idle states or legacy DT
 	 * configuration predating the DT idle states bindings.
 	 */
-	return i;
+	return state_idx - start_idx;
 }
 EXPORT_SYMBOL_GPL(dt_init_idle_driver);
Signature · 1 line
2.35.1
author maintainer
#45 lore raw

PATCH 45/521 alpha: fix syscall entry in !AUDUT_SYSCALL case

In reply to Greg Kroah-Hartman

From: Al Viro <[email protected]>

[ Upstream commit f7b2431a6d22f7a91c567708e071dfcd6d66db14 ]

We only want to take the slow path if SYSCALL_TRACE or SYSCALL_AUDIT is set; on !AUDIT_SYSCALL configs the current tree hits it whenever _any_ thread flag (including NEED_RESCHED, NOTIFY_SIGNAL, etc.) happens to be set.

Fixes a9302e843944 "alpha: Enable system-call auditing support"
---
 arch/alpha/kernel/entry.S | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
arch/alpha/kernel/entry.S +3 -1
index c64806a2daf5..ebe52200a9dc 100644
@@ -469,8 +469,10 @@ entSys:
 #ifdef CONFIG_AUDITSYSCALL
 	lda     $6, _TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT
 	and     $3, $6, $3
-#endif
 	bne     $3, strace
+#else
+	blbs    $3, strace		/* check for SYSCALL_TRACE in disguise */
+#endif
 	beq	$4, 1f
 	ldq	$27, 0($5)
 1:	jsr	$26, ($27), alpha_ni_syscall
Signature · 1 line
2.35.1
author maintainer
#46 lore raw

PATCH 46/521 fs: dont audit the capability check in simple_xattr_list()

In reply to Greg Kroah-Hartman

From: Ondrej Mosnacek <[email protected]>

[ Upstream commit e7eda157c4071cd1e69f4b1687b0fbe1ae5e6f46 ]

The check being unconditional may lead to unwanted denials reported by LSMs when a process has the capability granted by DAC, but denied by an LSM. In the case of SELinux such denials are a problem, since they can't be effectively filtered out via the policy and when not silenced, they produce noise that may hide a true problem or an attack.

Checking for the capability only if any trusted xattr is actually present wouldn't really address the issue, since calling listxattr(2) on such node on its own doesn't indicate an explicit attempt to see the trusted xattrs. Additionally, it could potentially leak the presence of trusted xattrs to an unprivileged user if they can check for the denials (e.g. through dmesg).

Therefore, it's best (and simplest) to keep the check unconditional and instead use ns_capable_noaudit() that will silence any associated LSM denials.

---
 fs/xattr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/xattr.c +1 -1
index 470ee0af3200..5c3407e18e15 100644
@@ -1012,7 +1012,7 @@ static int xattr_list_one(char **buffer, ssize_t *remaining_size,
 ssize_t simple_xattr_list(struct inode *inode, struct simple_xattrs *xattrs,
 			  char *buffer, size_t size)
 {
-	bool trusted = capable(CAP_SYS_ADMIN);
+	bool trusted = ns_capable_noaudit(&init_user_ns, CAP_SYS_ADMIN);
 	struct simple_xattr *xattr;
 	ssize_t remaining_size = size;
 	int err = 0;
Signature · 1 line
2.35.1
author maintainer
#47 lore raw

PATCH 47/521 selftests/ftrace: event_triggers: wait longer for test_event_enable

In reply to Greg Kroah-Hartman

From: Yipeng Zou <[email protected]>

[ Upstream commit a1d6cd88c8973cfb08ee85722488b1d6d5d16327 ]

In some platform, the schedule event may came slowly, delay 100ms can't cover it.

I was notice that on my board which running in low cpu_freq,and this selftests allways gose fail.

So maybe we can check more times here to wait longer.

Fixes 43bb45da82f9 ("selftests: ftrace: Add a selftest to test event enable/disable func trigger")
---
 .../ftrace/test.d/ftrace/func_event_triggers.tc   | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
tools/testing/selftests/ftrace/test.d/ftrace/func_event_triggers.tc +11 -4
index 6fed4cf2db81..79d614f1fe8e 100644
@@ -45,11 +45,18 @@ cnt_trace() {
 
 test_event_enabled() {
     val=$1
+    check_times=10		# wait for 10 * SLEEP_TIME at most
 
-    e=`cat $EVENT_ENABLE`
-    if [ "$e" != $val ]; then
-	fail "Expected $val but found $e"
-    fi
+    while [ $check_times -ne 0 ]; do
+	e=`cat $EVENT_ENABLE`
+	if [ "$e" == $val ]; then
+	    return 0
+	fi
+	sleep $SLEEP_TIME
+	check_times=$((check_times - 1))
+    done
+
+    fail "Expected $val but found $e"
 }
 
 run_enable_disable() {
Signature · 1 line
2.35.1
author maintainer
#38 lore raw

PATCH 38/521 ARM: dts: turris-omnia: Add ethernet aliases

In reply to Greg Kroah-Hartman

From: Pali Rohár <[email protected]>

[ Upstream commit f1f3e530c59a7e8c5f06172f4c28b945a6b4bfb8 ]

This allows bootloader to correctly pass MAC addresses used by bootloader to individual interfaces into kernel device tree.

Fixes 26ca8b52d6e1 ("ARM: dts: add support for Turris Omnia")
---
 arch/arm/boot/dts/armada-385-turris-omnia.dts | 6 ++++++
 1 file changed, 6 insertions(+)
arch/arm/boot/dts/armada-385-turris-omnia.dts +6 -0
index 92e08486ec81..c0a026ac7be8 100644
@@ -22,6 +22,12 @@ chosen {
 		stdout-path = &uart0;
 	};
 
+	aliases {
+		ethernet0 = &eth0;
+		ethernet1 = &eth1;
+		ethernet2 = &eth2;
+	};
+
 	memory {
 		device_type = "memory";
 		reg = <0x00000000 0x40000000>; /* 1024 MB */
Signature · 1 line
2.35.1
author maintainer
#70 lore raw

PATCH 70/521 PM: runtime: Improve path in rpm_idle() when no callback

In reply to Greg Kroah-Hartman

From: Ulf Hansson <[email protected]>

[ Upstream commit 5a2bd1b1c64e1ac5627db3767ac465f18606315c ]

When pm_runtime_no_callbacks() has been called for a struct device to set the dev->power.no_callbacks flag for it, it enables rpm_idle() to take a slightly quicker path by assuming that a ->runtime_idle() callback would have returned 0 to indicate success.

A device that does not have the dev->power.no_callbacks flag set for it, may still be missing a corresponding ->runtime_idle() callback, in which case the slower path in rpm_idle() is taken. Let's improve the behaviour for this case, by aligning code to the quicker path.

Stable-dep-of: bc80c2e438dc ("PM: runtime: Do not call __rpm_callback() from rpm_idle()")

---
 drivers/base/power/runtime.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/base/power/runtime.c +5 -5
index eaae4adf9ce4..8a018e6d7976 100644
@@ -403,7 +403,10 @@ static int rpm_idle(struct device *dev, int rpmflags)
 	/* Pending requests need to be canceled. */
 	dev->power.request = RPM_REQ_NONE;
 
-	if (dev->power.no_callbacks)
+	callback = RPM_GET_CALLBACK(dev, runtime_idle);
+
+	/* If no callback assume success. */
+	if (!callback || dev->power.no_callbacks)
 		goto out;
 
 	/* Carry out an asynchronous or a synchronous idle notification. */
@@ -419,10 +422,7 @@ static int rpm_idle(struct device *dev, int rpmflags)
 
 	dev->power.idle_notification = true;
 
-	callback = RPM_GET_CALLBACK(dev, runtime_idle);
-
-	if (callback)
-		retval = __rpm_callback(callback, dev);
+	retval = __rpm_callback(callback, dev);
 
 	dev->power.idle_notification = false;
 	wake_up_all(&dev->power.wait_queue);
Signature · 1 line
2.35.1
author maintainer
#79 lore raw

PATCH 79/521 rapidio: devices: fix missing put_device in mport_cdev_open

In reply to Greg Kroah-Hartman

From: Cai Xinchen <[email protected]>

[ Upstream commit d5b6e6eba3af11cb2a2791fa36a2524990fcde1a ]

When kfifo_alloc fails, the refcount of chdev->dev is left incremental. We should use put_device(&chdev->dev) to decrease the ref count of chdev->dev to avoid refcount leak.

Fixes e8de370188d0 ("rapidio: add mport char device driver")
Cc Alexandre Bounine <[email protected]>
Cc Dan Carpenter <[email protected]>
Cc Jakob Koschel <[email protected]>
Cc John Hubbard <[email protected]>
Cc Matt Porter <[email protected]>
Cc Wang Weiyang <[email protected]>
Cc Yang Yingliang <[email protected]>
---
 drivers/rapidio/devices/rio_mport_cdev.c | 1 +
 1 file changed, 1 insertion(+)
drivers/rapidio/devices/rio_mport_cdev.c +1 -0
index 1f4114b23f5a..ee19c511adce 100644
@@ -1917,6 +1917,7 @@ static int mport_cdev_open(struct inode *inode, struct file *filp)
 			  sizeof(struct rio_event) * MPORT_EVENT_DEPTH,
 			  GFP_KERNEL);
 	if (ret < 0) {
+		put_device(&chdev->dev);
 		dev_err(&chdev->dev, DRV_NAME ": kfifo_alloc failed\n");
 		ret = -ENOMEM;
 		goto err_fifo;
Signature · 1 line
2.35.1
author maintainer
#80 lore raw

PATCH 80/521 wifi: ath9k: hif_usb: fix memory leak of urbs in ath9k_hif_usb_dealloc_tx_urbs()

In reply to Greg Kroah-Hartman

From: Fedor Pchelkin <[email protected]>

[ Upstream commit c2a94de38c74e86f49124ac14f093d6a5c377a90 ]

Syzkaller reports a long-known leak of urbs in
ath9k_hif_usb_dealloc_tx_urbs().

The cause of the leak is that usb_get_urb() is called but usb_free_urb() (or usb_put_urb()) is not called inside usb_kill_urb() as urb->dev or urb->ep fields have not been initialized and usb_kill_urb() returns immediately.

The patch removes trying to kill urbs located in hif_dev->tx.tx_buf because hif_dev->tx.tx_buf is not supposed to contain urbs which are in pending state (the pending urbs are stored in hif_dev->tx.tx_pending). The tx.tx_lock is acquired so there should not be any changes in the list.

Found by Linux Verification Center (linuxtesting.org) with Syzkaller.

Fixes 03fb92a432ea ("ath9k: hif_usb: fix race condition between usb_get_urb() and usb_kill_anchored_urbs()")
---
 drivers/net/wireless/ath/ath9k/hif_usb.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/net/wireless/ath/ath9k/hif_usb.c +0 -4
index c8c7afe0e343..4290753a2002 100644
@@ -781,14 +781,10 @@ static void ath9k_hif_usb_dealloc_tx_urbs(struct hif_device_usb *hif_dev)
 	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);
 
Signature · 1 line
2.35.1
author maintainer
#81 lore raw

PATCH 81/521 wifi: ath9k: hif_usb: Fix use-after-free in ath9k_hif_usb_reg_in_cb()

In reply to Greg Kroah-Hartman

From: Fedor Pchelkin <[email protected]>

[ Upstream commit dd95f2239fc846795fc926787c3ae0ca701c9840 ]

It is possible that skb is freed in ath9k_htc_rx_msg(), then usb_submit_urb() fails and we try to free skb again. It causes use-after-free bug. Moreover, if alloc_skb() fails, urb->context becomes NULL but rx_buf is not freed and there can be a memory leak.

The patch removes unnecessary nskb and makes skb processing more clear: it is supposed that ath9k_htc_rx_msg() either frees old skb or passes its managing to another callback function.

Found by Linux Verification Center (linuxtesting.org) with Syzkaller.

---
 drivers/net/wireless/ath/ath9k/hif_usb.c | 28 +++++++++++++-----------
 1 file changed, 15 insertions(+), 13 deletions(-)
drivers/net/wireless/ath/ath9k/hif_usb.c +15 -13
index 4290753a2002..d872459c51cc 100644
@@ -709,14 +709,13 @@ static void ath9k_hif_usb_reg_in_cb(struct urb *urb)
 	struct rx_buf *rx_buf = (struct rx_buf *)urb->context;
 	struct hif_device_usb *hif_dev = rx_buf->hif_dev;
 	struct sk_buff *skb = rx_buf->skb;
-	struct sk_buff *nskb;
 	int ret;
 
 	if (!skb)
 		return;
 
 	if (!hif_dev)
-		goto free;
+		goto free_skb;
 
 	switch (urb->status) {
 	case 0:
@@ -725,7 +724,7 @@ static void ath9k_hif_usb_reg_in_cb(struct urb *urb)
 	case -ECONNRESET:
 	case -ENODEV:
 	case -ESHUTDOWN:
-		goto free;
+		goto free_skb;
 	default:
 		skb_reset_tail_pointer(skb);
 		skb_trim(skb, 0);
@@ -736,25 +735,27 @@ static void ath9k_hif_usb_reg_in_cb(struct urb *urb)
 	if (likely(urb->actual_length != 0)) {
 		skb_put(skb, urb->actual_length);
 
-		/* Process the command first */
+		/*
+		 * Process the command first.
+		 * skb is either freed here or passed to be
+		 * managed to another callback function.
+		 */
 		ath9k_htc_rx_msg(hif_dev->htc_handle, skb,
 				 skb->len, USB_REG_IN_PIPE);
 
-
-		nskb = alloc_skb(MAX_REG_IN_BUF_SIZE, GFP_ATOMIC);
-		if (!nskb) {
+		skb = alloc_skb(MAX_REG_IN_BUF_SIZE, GFP_ATOMIC);
+		if (!skb) {
 			dev_err(&hif_dev->udev->dev,
 				"ath9k_htc: REG_IN memory allocation failure\n");
-			urb->context = NULL;
-			return;
+			goto free_rx_buf;
 		}
 
-		rx_buf->skb = nskb;
+		rx_buf->skb = skb;
 
 		usb_fill_int_urb(urb, hif_dev->udev,
 				 usb_rcvintpipe(hif_dev->udev,
 						 USB_REG_IN_PIPE),
-				 nskb->data, MAX_REG_IN_BUF_SIZE,
+				 skb->data, MAX_REG_IN_BUF_SIZE,
 				 ath9k_hif_usb_reg_in_cb, rx_buf, 1);
 	}
 
@@ -763,12 +764,13 @@ static void ath9k_hif_usb_reg_in_cb(struct urb *urb)
 	ret = usb_submit_urb(urb, GFP_ATOMIC);
 	if (ret) {
 		usb_unanchor_urb(urb);
-		goto free;
+		goto free_skb;
 	}
 
 	return;
-free:
+free_skb:
 	kfree_skb(skb);
+free_rx_buf:
 	kfree(rx_buf);
 	urb->context = NULL;
 }
Signature · 1 line
2.35.1
author maintainer
#82 lore raw

PATCH 82/521 wifi: rtl8xxxu: Fix reading the vendor of combo chips

In reply to Greg Kroah-Hartman

From: Bitterblue Smith <[email protected]>

[ Upstream commit 6f103aeb5e985ac08f3a4a049a2c17294f40cff9 ]

The wifi + bluetooth combo chips (RTL8723AU and RTL8723BU) read the chip vendor from the wrong register because the val32 variable gets overwritten. Add one more variable to avoid this.

This had no real effect on RTL8723BU. It may have had an effect on RTL8723AU.

Fixes 26f1fad29ad9 ("New driver: rtl8xxxu (mac80211)")
---
 .../wireless/realtek/rtl8xxxu/rtl8xxxu_core.c    | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +8 -8
index 38f06ee98b35..fb8545f79fa6 100644
@@ -1614,18 +1614,18 @@ static void rtl8xxxu_print_chipinfo(struct rtl8xxxu_priv *priv)
 static int rtl8xxxu_identify_chip(struct rtl8xxxu_priv *priv)
 {
 	struct device *dev = &priv->udev->dev;
-	u32 val32, bonding;
+	u32 val32, bonding, sys_cfg;
 	u16 val16;
 
-	val32 = rtl8xxxu_read32(priv, REG_SYS_CFG);
-	priv->chip_cut = (val32 & SYS_CFG_CHIP_VERSION_MASK) >>
+	sys_cfg = rtl8xxxu_read32(priv, REG_SYS_CFG);
+	priv->chip_cut = (sys_cfg & SYS_CFG_CHIP_VERSION_MASK) >>
 		SYS_CFG_CHIP_VERSION_SHIFT;
-	if (val32 & SYS_CFG_TRP_VAUX_EN) {
+	if (sys_cfg & SYS_CFG_TRP_VAUX_EN) {
 		dev_info(dev, "Unsupported test chip\n");
 		return -ENOTSUPP;
 	}
 
-	if (val32 & SYS_CFG_BT_FUNC) {
+	if (sys_cfg & SYS_CFG_BT_FUNC) {
 		if (priv->chip_cut >= 3) {
 			sprintf(priv->chip_name, "8723BU");
 			priv->rtl_chip = RTL8723B;
@@ -1647,7 +1647,7 @@ static int rtl8xxxu_identify_chip(struct rtl8xxxu_priv *priv)
 		if (val32 & MULTI_GPS_FUNC_EN)
 			priv->has_gps = 1;
 		priv->is_multi_func = 1;
-	} else if (val32 & SYS_CFG_TYPE_ID) {
+	} else if (sys_cfg & SYS_CFG_TYPE_ID) {
 		bonding = rtl8xxxu_read32(priv, REG_HPON_FSM);
 		bonding &= HPON_FSM_BONDING_MASK;
 		if (priv->fops->tx_desc_size ==
@@ -1695,7 +1695,7 @@ static int rtl8xxxu_identify_chip(struct rtl8xxxu_priv *priv)
 	case RTL8188E:
 	case RTL8192E:
 	case RTL8723B:
-		switch (val32 & SYS_CFG_VENDOR_EXT_MASK) {
+		switch (sys_cfg & SYS_CFG_VENDOR_EXT_MASK) {
 		case SYS_CFG_VENDOR_ID_TSMC:
 			sprintf(priv->chip_vendor, "TSMC");
 			break;
@@ -1712,7 +1712,7 @@ static int rtl8xxxu_identify_chip(struct rtl8xxxu_priv *priv)
 		}
 		break;
 	default:
-		if (val32 & SYS_CFG_VENDOR_ID) {
+		if (sys_cfg & SYS_CFG_VENDOR_ID) {
 			sprintf(priv->chip_vendor, "UMC");
 			priv->vendor_umc = 1;
 		} else {
Signature · 1 line
2.35.1
author maintainer
#83 lore raw

PATCH 83/521 pata_ipx4xx_cf: Fix unsigned comparison with less than zero

In reply to Greg Kroah-Hartman

From: Junlin Yang <[email protected]>

[ Upstream commit c38ae56ee034623c59e39c0130ca0dec086c1a39 ]

The return from the call to platform_get_irq() is int, it can be a negative error code, however this is being assigned to an unsigned int variable 'irq', so making 'irq' an int, and change the position to keep the code format.

./drivers/ata/pata_ixp4xx_cf.c:168:5-8:
WARNING: Unsigned expression compared with zero: irq > 0

---
 drivers/ata/pata_ixp4xx_cf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ata/pata_ixp4xx_cf.c +1 -1
index 867621f8c387..8c34c64e4d51 100644
@@ -139,12 +139,12 @@ static void ixp4xx_setup_port(struct ata_port *ap,
 
 static int ixp4xx_pata_probe(struct platform_device *pdev)
 {
-	unsigned int irq;
 	struct resource *cs0, *cs1;
 	struct ata_host *host;
 	struct ata_port *ap;
 	struct ixp4xx_pata_data *data = dev_get_platdata(&pdev->dev);
 	int ret;
+	int irq;
 
 	cs0 = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	cs1 = platform_get_resource(pdev, IORESOURCE_MEM, 1);
Signature · 1 line
2.35.1
author maintainer
#84 lore raw

PATCH 84/521 media: i2c: ad5820: Fix error path

In reply to Greg Kroah-Hartman

From: Ricardo Ribalda <[email protected]>

[ Upstream commit 9fce241660f37d9e95e93c0ae6fba8cfefa5797b ]

Error path seems to be swaped. Fix the order and provide some meaningful names.

Fixes bee3d5115611 ("[media] ad5820: Add driver for auto-focus coil")
---
 drivers/media/i2c/ad5820.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/media/i2c/ad5820.c +5 -5
index 034ebf754007..c2a6d1d5217a 100644
@@ -321,18 +321,18 @@ static int ad5820_probe(struct i2c_client *client,
 
 	ret = media_entity_pads_init(&coil->subdev.entity, 0, NULL);
 	if (ret < 0)
-		goto cleanup2;
+		goto clean_mutex;
 
 	ret = v4l2_async_register_subdev(&coil->subdev);
 	if (ret < 0)
-		goto cleanup;
+		goto clean_entity;
 
 	return ret;
 
-cleanup2:
-	mutex_destroy(&coil->power_lock);
-cleanup:
+clean_entity:
 	media_entity_cleanup(&coil->subdev.entity);
+clean_mutex:
+	mutex_destroy(&coil->power_lock);
 	return ret;
 }
 
Signature · 1 line
2.35.1
author maintainer
#85 lore raw

PATCH 85/521 can: kvaser_usb: do not increase tx statistics when sending error message frames

In reply to Greg Kroah-Hartman

From: Vincent Mailhol <[email protected]>

[ Upstream commit 0b0ce2c67795672115ac6ca28351a78799cd114b ]

The CAN error message frames (i.e. error skb) are an interface specific to socket CAN. The payload of the CAN error message frames does not correspond to any actual data sent on the wire. Only an error flag and a delimiter are transmitted when an error occurs (c.f. ISO 11898-1 section 10.4.4.2 "Error flag").

For this reason, it makes no sense to increment the tx_packets and tx_bytes fields of struct net_device_stats when sending an error message frame because no actual payload will be transmitted on the wire.

N.B. Sending error message frames is a very specific feature which, at the moment, is only supported by the Kvaser Hydra hardware. Please refer to [1] for more details on the topic.

[1] https://lore.kernel.org/linux-can/CAMZ6RqK0rTNg3u3mBpZOoY51jLZ-et-J01tY6-+mWsM4meVw-A@mail.gmail.com/t/#u

---
 drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c +6 -1
index 45d278724883..9588efbfae71 100644
@@ -293,6 +293,7 @@ struct kvaser_cmd {
 #define KVASER_USB_HYDRA_CF_FLAG_OVERRUN	BIT(1)
 #define KVASER_USB_HYDRA_CF_FLAG_REMOTE_FRAME	BIT(4)
 #define KVASER_USB_HYDRA_CF_FLAG_EXTENDED_ID	BIT(5)
+#define KVASER_USB_HYDRA_CF_FLAG_TX_ACK		BIT(6)
 /* CAN frame flags. Used in ext_rx_can and ext_tx_can */
 #define KVASER_USB_HYDRA_CF_FLAG_OSM_NACK	BIT(12)
 #define KVASER_USB_HYDRA_CF_FLAG_ABL		BIT(13)
@@ -1099,6 +1100,7 @@ static void kvaser_usb_hydra_tx_acknowledge(const struct kvaser_usb *dev,
 	struct kvaser_usb_net_priv *priv;
 	unsigned long irq_flags;
 	bool one_shot_fail = false;
+	bool is_err_frame = false;
 	u16 transid = kvaser_usb_hydra_get_cmd_transid(cmd);
 
 	priv = kvaser_usb_hydra_net_priv_from_cmd(dev, cmd);
@@ -1117,10 +1119,13 @@ static void kvaser_usb_hydra_tx_acknowledge(const struct kvaser_usb *dev,
 			kvaser_usb_hydra_one_shot_fail(priv, cmd_ext);
 			one_shot_fail = true;
 		}
+
+		is_err_frame = flags & KVASER_USB_HYDRA_CF_FLAG_TX_ACK &&
+			       flags & KVASER_USB_HYDRA_CF_FLAG_ERROR_FRAME;
 	}
 
 	context = &priv->tx_contexts[transid % dev->max_tx_urbs];
-	if (!one_shot_fail) {
+	if (!one_shot_fail && !is_err_frame) {
 		struct net_device_stats *stats = &priv->netdev->stats;
 
 		stats->tx_packets++;
Signature · 1 line
2.35.1
author maintainer
#86 lore raw

PATCH 86/521 can: kvaser_usb: kvaser_usb_leaf: Get capabilities from device

In reply to Greg Kroah-Hartman

From: Jimmy Assarsson <[email protected]>

[ Upstream commit 35364f5b41a4917fe94a3f393d149b63ec583297 ]

Use the CMD_GET_CAPABILITIES_REQ command to query the device for certain capabilities. We are only interested in LISTENONLY mode and wither the device reports CAN error counters.

---
 .../net/can/usb/kvaser_usb/kvaser_usb_leaf.c  | 144 +++++++++++++++++-
 1 file changed, 143 insertions(+), 1 deletion(-)
drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c +143 -1
index 15380cc08ee6..26f32828f905 100644
@@ -73,6 +73,8 @@
 #define CMD_TX_ACKNOWLEDGE		50
 #define CMD_CAN_ERROR_EVENT		51
 #define CMD_FLUSH_QUEUE_REPLY		68
+#define CMD_GET_CAPABILITIES_REQ	95
+#define CMD_GET_CAPABILITIES_RESP	96
 
 #define CMD_LEAF_LOG_MESSAGE		106
 
@@ -82,6 +84,8 @@
 #define KVASER_USB_LEAF_SWOPTION_FREQ_32_MHZ_CLK BIT(5)
 #define KVASER_USB_LEAF_SWOPTION_FREQ_24_MHZ_CLK BIT(6)
 
+#define KVASER_USB_LEAF_SWOPTION_EXT_CAP BIT(12)
+
 /* error factors */
 #define M16C_EF_ACKE			BIT(0)
 #define M16C_EF_CRCE			BIT(1)
@@ -277,6 +281,28 @@ struct leaf_cmd_log_message {
 	u8 data[8];
 } __packed;
 
+/* Sub commands for cap_req and cap_res */
+#define KVASER_USB_LEAF_CAP_CMD_LISTEN_MODE 0x02
+#define KVASER_USB_LEAF_CAP_CMD_ERR_REPORT 0x05
+struct kvaser_cmd_cap_req {
+	__le16 padding0;
+	__le16 cap_cmd;
+	__le16 padding1;
+	__le16 channel;
+} __packed;
+
+/* Status codes for cap_res */
+#define KVASER_USB_LEAF_CAP_STAT_OK 0x00
+#define KVASER_USB_LEAF_CAP_STAT_NOT_IMPL 0x01
+#define KVASER_USB_LEAF_CAP_STAT_UNAVAIL 0x02
+struct kvaser_cmd_cap_res {
+	__le16 padding;
+	__le16 cap_cmd;
+	__le16 status;
+	__le32 mask;
+	__le32 value;
+} __packed;
+
 struct kvaser_cmd {
 	u8 len;
 	u8 id;
@@ -294,6 +320,8 @@ struct kvaser_cmd {
 			struct leaf_cmd_chip_state_event chip_state_event;
 			struct leaf_cmd_error_event error_event;
 			struct leaf_cmd_log_message log_message;
+			struct kvaser_cmd_cap_req cap_req;
+			struct kvaser_cmd_cap_res cap_res;
 		} __packed leaf;
 
 		union {
@@ -323,6 +351,7 @@ static const u8 kvaser_usb_leaf_cmd_sizes_leaf[] = {
 	[CMD_LEAF_LOG_MESSAGE]		= kvaser_fsize(u.leaf.log_message),
 	[CMD_CHIP_STATE_EVENT]		= kvaser_fsize(u.leaf.chip_state_event),
 	[CMD_CAN_ERROR_EVENT]		= kvaser_fsize(u.leaf.error_event),
+	[CMD_GET_CAPABILITIES_RESP]	= kvaser_fsize(u.leaf.cap_res),
 	/* ignored events: */
 	[CMD_FLUSH_QUEUE_REPLY]		= CMD_SIZE_ANY,
 };
@@ -607,6 +636,9 @@ static void kvaser_usb_leaf_get_software_info_leaf(struct kvaser_usb *dev,
 	dev->fw_version = le32_to_cpu(softinfo->fw_version);
 	dev->max_tx_urbs = le16_to_cpu(softinfo->max_outstanding_tx);
 
+	if (sw_options & KVASER_USB_LEAF_SWOPTION_EXT_CAP)
+		dev->card_data.capabilities |= KVASER_USB_CAP_EXT_CAP;
+
 	if (dev->driver_info->quirks & KVASER_USB_QUIRK_IGNORE_CLK_FREQ) {
 		/* Firmware expects bittiming parameters calculated for 16MHz
 		 * clock, regardless of the actual clock
@@ -694,6 +726,116 @@ static int kvaser_usb_leaf_get_card_info(struct kvaser_usb *dev)
 	return 0;
 }
 
+static int kvaser_usb_leaf_get_single_capability(struct kvaser_usb *dev,
+						 u16 cap_cmd_req, u16 *status)
+{
+	struct kvaser_usb_dev_card_data *card_data = &dev->card_data;
+	struct kvaser_cmd *cmd;
+	u32 value = 0;
+	u32 mask = 0;
+	u16 cap_cmd_res;
+	int err;
+	int i;
+
+	cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
+	if (!cmd)
+		return -ENOMEM;
+
+	cmd->id = CMD_GET_CAPABILITIES_REQ;
+	cmd->u.leaf.cap_req.cap_cmd = cpu_to_le16(cap_cmd_req);
+	cmd->len = CMD_HEADER_LEN + sizeof(struct kvaser_cmd_cap_req);
+
+	err = kvaser_usb_send_cmd(dev, cmd, cmd->len);
+	if (err)
+		goto end;
+
+	err = kvaser_usb_leaf_wait_cmd(dev, CMD_GET_CAPABILITIES_RESP, cmd);
+	if (err)
+		goto end;
+
+	*status = le16_to_cpu(cmd->u.leaf.cap_res.status);
+
+	if (*status != KVASER_USB_LEAF_CAP_STAT_OK)
+		goto end;
+
+	cap_cmd_res = le16_to_cpu(cmd->u.leaf.cap_res.cap_cmd);
+	switch (cap_cmd_res) {
+	case KVASER_USB_LEAF_CAP_CMD_LISTEN_MODE:
+	case KVASER_USB_LEAF_CAP_CMD_ERR_REPORT:
+		value = le32_to_cpu(cmd->u.leaf.cap_res.value);
+		mask = le32_to_cpu(cmd->u.leaf.cap_res.mask);
+		break;
+	default:
+		dev_warn(&dev->intf->dev, "Unknown capability command %u\n",
+			 cap_cmd_res);
+		break;
+	}
+
+	for (i = 0; i < dev->nchannels; i++) {
+		if (BIT(i) & (value & mask)) {
+			switch (cap_cmd_res) {
+			case KVASER_USB_LEAF_CAP_CMD_LISTEN_MODE:
+				card_data->ctrlmode_supported |=
+						CAN_CTRLMODE_LISTENONLY;
+				break;
+			case KVASER_USB_LEAF_CAP_CMD_ERR_REPORT:
+				card_data->capabilities |=
+						KVASER_USB_CAP_BERR_CAP;
+				break;
+			}
+		}
+	}
+
+end:
+	kfree(cmd);
+
+	return err;
+}
+
+static int kvaser_usb_leaf_get_capabilities_leaf(struct kvaser_usb *dev)
+{
+	int err;
+	u16 status;
+
+	if (!(dev->card_data.capabilities & KVASER_USB_CAP_EXT_CAP)) {
+		dev_info(&dev->intf->dev,
+			 "No extended capability support. Upgrade device firmware.\n");
+		return 0;
+	}
+
+	err = kvaser_usb_leaf_get_single_capability(dev,
+						    KVASER_USB_LEAF_CAP_CMD_LISTEN_MODE,
+						    &status);
+	if (err)
+		return err;
+	if (status)
+		dev_info(&dev->intf->dev,
+			 "KVASER_USB_LEAF_CAP_CMD_LISTEN_MODE failed %u\n",
+			 status);
+
+	err = kvaser_usb_leaf_get_single_capability(dev,
+						    KVASER_USB_LEAF_CAP_CMD_ERR_REPORT,
+						    &status);
+	if (err)
+		return err;
+	if (status)
+		dev_info(&dev->intf->dev,
+			 "KVASER_USB_LEAF_CAP_CMD_ERR_REPORT failed %u\n",
+			 status);
+
+	return 0;
+}
+
+static int kvaser_usb_leaf_get_capabilities(struct kvaser_usb *dev)
+{
+	int err = 0;
+
+	if (dev->driver_info->family == KVASER_LEAF)
+		err = kvaser_usb_leaf_get_capabilities_leaf(dev);
+
+	return err;
+}
+
 static void kvaser_usb_leaf_tx_acknowledge(const struct kvaser_usb *dev,
 					   const struct kvaser_cmd *cmd)
 {
@@ -1490,7 +1632,7 @@ const struct kvaser_usb_dev_ops kvaser_usb_leaf_dev_ops = {
 	.dev_get_software_info = kvaser_usb_leaf_get_software_info,
 	.dev_get_software_details = NULL,
 	.dev_get_card_info = kvaser_usb_leaf_get_card_info,
-	.dev_get_capabilities = NULL,
+	.dev_get_capabilities = kvaser_usb_leaf_get_capabilities,
 	.dev_set_opt_mode = kvaser_usb_leaf_set_opt_mode,
 	.dev_start_chip = kvaser_usb_leaf_start_chip,
 	.dev_stop_chip = kvaser_usb_leaf_stop_chip,
Signature · 1 line
2.35.1
author maintainer
#87 lore raw

PATCH 87/521 can: kvaser_usb: kvaser_usb_leaf: Rename {leaf,usbcan}_cmd_error_event to {leaf,usbcan}_cmd_can_error_event

In reply to Greg Kroah-Hartman

From: Jimmy Assarsson <[email protected]>

[ Upstream commit 7ea56128dbf904a3359bcf9289cccdfa3c85c7e8 ]

Prepare for handling CMD_ERROR_EVENT. Rename struct {leaf,usbcan}_cmd_error_event to {leaf,usbcan}_cmd_can_error_event.

---
 .../net/can/usb/kvaser_usb/kvaser_usb_leaf.c  | 38 +++++++++----------
 1 file changed, 19 insertions(+), 19 deletions(-)
drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c +19 -19
index 26f32828f905..4f3d1150b2b2 100644
@@ -233,7 +233,7 @@ struct kvaser_cmd_tx_acknowledge_header {
 	u8 tid;
 } __packed;
 
-struct leaf_cmd_error_event {
+struct leaf_cmd_can_error_event {
 	u8 tid;
 	u8 flags;
 	__le16 time[3];
@@ -245,7 +245,7 @@ struct leaf_cmd_error_event {
 	u8 error_factor;
 } __packed;
 
-struct usbcan_cmd_error_event {
+struct usbcan_cmd_can_error_event {
 	u8 tid;
 	u8 padding;
 	u8 tx_errors_count_ch0;
@@ -318,7 +318,7 @@ struct kvaser_cmd {
 			struct leaf_cmd_softinfo softinfo;
 			struct leaf_cmd_rx_can rx_can;
 			struct leaf_cmd_chip_state_event chip_state_event;
-			struct leaf_cmd_error_event error_event;
+			struct leaf_cmd_can_error_event can_error_event;
 			struct leaf_cmd_log_message log_message;
 			struct kvaser_cmd_cap_req cap_req;
 			struct kvaser_cmd_cap_res cap_res;
@@ -328,7 +328,7 @@ struct kvaser_cmd {
 			struct usbcan_cmd_softinfo softinfo;
 			struct usbcan_cmd_rx_can rx_can;
 			struct usbcan_cmd_chip_state_event chip_state_event;
-			struct usbcan_cmd_error_event error_event;
+			struct usbcan_cmd_can_error_event can_error_event;
 		} __packed usbcan;
 
 		struct kvaser_cmd_tx_can tx_can;
@@ -350,7 +350,7 @@ static const u8 kvaser_usb_leaf_cmd_sizes_leaf[] = {
 	[CMD_RX_EXT_MESSAGE]		= kvaser_fsize(u.leaf.rx_can),
 	[CMD_LEAF_LOG_MESSAGE]		= kvaser_fsize(u.leaf.log_message),
 	[CMD_CHIP_STATE_EVENT]		= kvaser_fsize(u.leaf.chip_state_event),
-	[CMD_CAN_ERROR_EVENT]		= kvaser_fsize(u.leaf.error_event),
+	[CMD_CAN_ERROR_EVENT]		= kvaser_fsize(u.leaf.can_error_event),
 	[CMD_GET_CAPABILITIES_RESP]	= kvaser_fsize(u.leaf.cap_res),
 	/* ignored events: */
 	[CMD_FLUSH_QUEUE_REPLY]		= CMD_SIZE_ANY,
@@ -365,7 +365,7 @@ static const u8 kvaser_usb_leaf_cmd_sizes_usbcan[] = {
 	[CMD_RX_STD_MESSAGE]		= kvaser_fsize(u.usbcan.rx_can),
 	[CMD_RX_EXT_MESSAGE]		= kvaser_fsize(u.usbcan.rx_can),
 	[CMD_CHIP_STATE_EVENT]		= kvaser_fsize(u.usbcan.chip_state_event),
-	[CMD_CAN_ERROR_EVENT]		= kvaser_fsize(u.usbcan.error_event),
+	[CMD_CAN_ERROR_EVENT]		= kvaser_fsize(u.usbcan.can_error_event),
 	/* ignored events: */
 	[CMD_USBCAN_CLOCK_OVERFLOW_EVENT] = CMD_SIZE_ANY,
 };
@@ -1137,11 +1137,11 @@ static void kvaser_usb_leaf_usbcan_rx_error(const struct kvaser_usb *dev,
 
 	case CMD_CAN_ERROR_EVENT:
 		es.channel = 0;
-		es.status = cmd->u.usbcan.error_event.status_ch0;
-		es.txerr = cmd->u.usbcan.error_event.tx_errors_count_ch0;
-		es.rxerr = cmd->u.usbcan.error_event.rx_errors_count_ch0;
+		es.status = cmd->u.usbcan.can_error_event.status_ch0;
+		es.txerr = cmd->u.usbcan.can_error_event.tx_errors_count_ch0;
+		es.rxerr = cmd->u.usbcan.can_error_event.rx_errors_count_ch0;
 		es.usbcan.other_ch_status =
-			cmd->u.usbcan.error_event.status_ch1;
+			cmd->u.usbcan.can_error_event.status_ch1;
 		kvaser_usb_leaf_usbcan_conditionally_rx_error(dev, &es);
 
 		/* The USBCAN firmware supports up to 2 channels.
@@ -1149,13 +1149,13 @@ static void kvaser_usb_leaf_usbcan_rx_error(const struct kvaser_usb *dev,
 		 */
 		if (dev->nchannels == MAX_USBCAN_NET_DEVICES) {
 			es.channel = 1;
-			es.status = cmd->u.usbcan.error_event.status_ch1;
+			es.status = cmd->u.usbcan.can_error_event.status_ch1;
 			es.txerr =
-				cmd->u.usbcan.error_event.tx_errors_count_ch1;
+				cmd->u.usbcan.can_error_event.tx_errors_count_ch1;
 			es.rxerr =
-				cmd->u.usbcan.error_event.rx_errors_count_ch1;
+				cmd->u.usbcan.can_error_event.rx_errors_count_ch1;
 			es.usbcan.other_ch_status =
-				cmd->u.usbcan.error_event.status_ch0;
+				cmd->u.usbcan.can_error_event.status_ch0;
 			kvaser_usb_leaf_usbcan_conditionally_rx_error(dev, &es);
 		}
 		break;
@@ -1172,11 +1172,11 @@ static void kvaser_usb_leaf_leaf_rx_error(const struct kvaser_usb *dev,
 
 	switch (cmd->id) {
 	case CMD_CAN_ERROR_EVENT:
-		es.channel = cmd->u.leaf.error_event.channel;
-		es.status = cmd->u.leaf.error_event.status;
-		es.txerr = cmd->u.leaf.error_event.tx_errors_count;
-		es.rxerr = cmd->u.leaf.error_event.rx_errors_count;
-		es.leaf.error_factor = cmd->u.leaf.error_event.error_factor;
+		es.channel = cmd->u.leaf.can_error_event.channel;
+		es.status = cmd->u.leaf.can_error_event.status;
+		es.txerr = cmd->u.leaf.can_error_event.tx_errors_count;
+		es.rxerr = cmd->u.leaf.can_error_event.rx_errors_count;
+		es.leaf.error_factor = cmd->u.leaf.can_error_event.error_factor;
 		break;
 	case CMD_LEAF_LOG_MESSAGE:
 		es.channel = cmd->u.leaf.log_message.channel;
Signature · 1 line
2.35.1
author maintainer
#88 lore raw

PATCH 88/521 can: kvaser_usb: kvaser_usb_leaf: Handle CMD_ERROR_EVENT

In reply to Greg Kroah-Hartman

From: Jimmy Assarsson <[email protected]>

[ Upstream commit b24cb2d169e0c9dce664a959e1f2aa9781285dc9 ]

The device will send an error event command, to indicate certain errors. This indicates a misbehaving driver, and should never occur.

---
 .../net/can/usb/kvaser_usb/kvaser_usb_leaf.c  | 99 +++++++++++++++++++
 1 file changed, 99 insertions(+)
drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c +99 -0
index 4f3d1150b2b2..3c3e78992b55 100644
@@ -69,6 +69,7 @@
 #define CMD_GET_CARD_INFO_REPLY		35
 #define CMD_GET_SOFTWARE_INFO		38
 #define CMD_GET_SOFTWARE_INFO_REPLY	39
+#define CMD_ERROR_EVENT			45
 #define CMD_FLUSH_QUEUE			48
 #define CMD_TX_ACKNOWLEDGE		50
 #define CMD_CAN_ERROR_EVENT		51
@@ -257,6 +258,28 @@ struct usbcan_cmd_can_error_event {
 	__le16 time;
 } __packed;
 
+/* CMD_ERROR_EVENT error codes */
+#define KVASER_USB_LEAF_ERROR_EVENT_TX_QUEUE_FULL 0x8
+#define KVASER_USB_LEAF_ERROR_EVENT_PARAM 0x9
+
+struct leaf_cmd_error_event {
+	u8 tid;
+	u8 error_code;
+	__le16 timestamp[3];
+	__le16 padding;
+	__le16 info1;
+	__le16 info2;
+} __packed;
+
+struct usbcan_cmd_error_event {
+	u8 tid;
+	u8 error_code;
+	__le16 info1;
+	__le16 info2;
+	__le16 timestamp;
+	__le16 padding;
+} __packed;
+
 struct kvaser_cmd_ctrl_mode {
 	u8 tid;
 	u8 channel;
@@ -320,6 +343,7 @@ struct kvaser_cmd {
 			struct leaf_cmd_chip_state_event chip_state_event;
 			struct leaf_cmd_can_error_event can_error_event;
 			struct leaf_cmd_log_message log_message;
+			struct leaf_cmd_error_event error_event;
 			struct kvaser_cmd_cap_req cap_req;
 			struct kvaser_cmd_cap_res cap_res;
 		} __packed leaf;
@@ -329,6 +353,7 @@ struct kvaser_cmd {
 			struct usbcan_cmd_rx_can rx_can;
 			struct usbcan_cmd_chip_state_event chip_state_event;
 			struct usbcan_cmd_can_error_event can_error_event;
+			struct usbcan_cmd_error_event error_event;
 		} __packed usbcan;
 
 		struct kvaser_cmd_tx_can tx_can;
@@ -352,6 +377,7 @@ static const u8 kvaser_usb_leaf_cmd_sizes_leaf[] = {
 	[CMD_CHIP_STATE_EVENT]		= kvaser_fsize(u.leaf.chip_state_event),
 	[CMD_CAN_ERROR_EVENT]		= kvaser_fsize(u.leaf.can_error_event),
 	[CMD_GET_CAPABILITIES_RESP]	= kvaser_fsize(u.leaf.cap_res),
+	[CMD_ERROR_EVENT]		= kvaser_fsize(u.leaf.error_event),
 	/* ignored events: */
 	[CMD_FLUSH_QUEUE_REPLY]		= CMD_SIZE_ANY,
 };
@@ -366,6 +392,7 @@ static const u8 kvaser_usb_leaf_cmd_sizes_usbcan[] = {
 	[CMD_RX_EXT_MESSAGE]		= kvaser_fsize(u.usbcan.rx_can),
 	[CMD_CHIP_STATE_EVENT]		= kvaser_fsize(u.usbcan.chip_state_event),
 	[CMD_CAN_ERROR_EVENT]		= kvaser_fsize(u.usbcan.can_error_event),
+	[CMD_ERROR_EVENT]		= kvaser_fsize(u.usbcan.error_event),
 	/* ignored events: */
 	[CMD_USBCAN_CLOCK_OVERFLOW_EVENT] = CMD_SIZE_ANY,
 };
@@ -1308,6 +1335,74 @@ static void kvaser_usb_leaf_rx_can_msg(const struct kvaser_usb *dev,
 	netif_rx(skb);
 }
 
+static void kvaser_usb_leaf_error_event_parameter(const struct kvaser_usb *dev,
+						  const struct kvaser_cmd *cmd)
+{
+	u16 info1 = 0;
+
+	switch (dev->driver_info->family) {
+	case KVASER_LEAF:
+		info1 = le16_to_cpu(cmd->u.leaf.error_event.info1);
+		break;
+	case KVASER_USBCAN:
+		info1 = le16_to_cpu(cmd->u.usbcan.error_event.info1);
+		break;
+	}
+
+	/* info1 will contain the offending cmd_no */
+	switch (info1) {
+	case CMD_SET_CTRL_MODE:
+		dev_warn(&dev->intf->dev,
+			 "CMD_SET_CTRL_MODE error in parameter\n");
+		break;
+
+	case CMD_SET_BUS_PARAMS:
+		dev_warn(&dev->intf->dev,
+			 "CMD_SET_BUS_PARAMS error in parameter\n");
+		break;
+
+	default:
+		dev_warn(&dev->intf->dev,
+			 "Unhandled parameter error event cmd_no (%u)\n",
+			 info1);
+		break;
+	}
+}
+
+static void kvaser_usb_leaf_error_event(const struct kvaser_usb *dev,
+					const struct kvaser_cmd *cmd)
+{
+	u8 error_code = 0;
+
+	switch (dev->driver_info->family) {
+	case KVASER_LEAF:
+		error_code = cmd->u.leaf.error_event.error_code;
+		break;
+	case KVASER_USBCAN:
+		error_code = cmd->u.usbcan.error_event.error_code;
+		break;
+	}
+
+	switch (error_code) {
+	case KVASER_USB_LEAF_ERROR_EVENT_TX_QUEUE_FULL:
+		/* Received additional CAN message, when firmware TX queue is
+		 * already full. Something is wrong with the driver.
+		 * This should never happen!
+		 */
+		dev_err(&dev->intf->dev,
+			"Received error event TX_QUEUE_FULL\n");
+		break;
+	case KVASER_USB_LEAF_ERROR_EVENT_PARAM:
+		kvaser_usb_leaf_error_event_parameter(dev, cmd);
+		break;
+
+	default:
+		dev_warn(&dev->intf->dev,
+			 "Unhandled error event (%d)\n", error_code);
+		break;
+	}
+}
+
 static void kvaser_usb_leaf_start_chip_reply(const struct kvaser_usb *dev,
 					     const struct kvaser_cmd *cmd)
 {
@@ -1386,6 +1481,10 @@ static void kvaser_usb_leaf_handle_command(const struct kvaser_usb *dev,
 		kvaser_usb_leaf_tx_acknowledge(dev, cmd);
 		break;
 
+	case CMD_ERROR_EVENT:
+		kvaser_usb_leaf_error_event(dev, cmd);
+		break;
+
 	/* Ignored commands */
 	case CMD_USBCAN_CLOCK_OVERFLOW_EVENT:
 		if (dev->driver_info->family != KVASER_USBCAN)
Signature · 1 line
2.35.1
author maintainer
#71 lore raw

PATCH 71/521 PM: runtime: Do not call __rpm_callback() from rpm_idle()

In reply to Greg Kroah-Hartman

From: Rafael J. Wysocki <[email protected]>

[ Upstream commit bc80c2e438dcbfcf748452ec0f7ad5b79ff3ad88 ]

Calling __rpm_callback() from rpm_idle() after adding device links support to the former is a clear mistake.

Not only it causes rpm_idle() to carry out unnecessary actions, but it is also against the assumption regarding the stability of PM-runtime status across __rpm_callback() invocations, because rpm_suspend() and rpm_resume() may run in parallel with __rpm_callback() when it is called by rpm_idle() and the device's PM-runtime status can be updated by any of them.

---
 drivers/base/power/runtime.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/base/power/runtime.c +11 -1
index 8a018e6d7976..911bb8a4bf6d 100644
@@ -422,7 +422,17 @@ static int rpm_idle(struct device *dev, int rpmflags)
 
 	dev->power.idle_notification = true;
 
-	retval = __rpm_callback(callback, dev);
+	if (dev->power.irq_safe)
+		spin_unlock(&dev->power.lock);
+	else
+		spin_unlock_irq(&dev->power.lock);
+
+	retval = callback(dev);
+
+	if (dev->power.irq_safe)
+		spin_lock(&dev->power.lock);
+	else
+		spin_lock_irq(&dev->power.lock);
 
 	dev->power.idle_notification = false;
 	wake_up_all(&dev->power.wait_queue);
Signature · 1 line
2.35.1
author maintainer
#89 lore raw

PATCH 89/521 can: kvaser_usb_leaf: Set Warning state even without bus errors

In reply to Greg Kroah-Hartman

From: Anssi Hannula <[email protected]>

[ Upstream commit df1b7af2761b935f63b4a53e789d41ed859edf61 ]

kvaser_usb_leaf_rx_error_update_can_state() sets error state according to error counters when the hardware does not indicate a specific state directly.

However, this is currently gated behind a check for M16C_STATE_BUS_ERROR which does not always seem to be set when error counters are increasing, and may not be set when error counters are decreasing.

This causes the CAN_STATE_ERROR_WARNING state to not be set in some cases even when appropriate.

Change the code to set error state from counters even without M16C_STATE_BUS_ERROR.

The Error-Passive case seems superfluous as it is already set via M16C_STATE_BUS_PASSIVE flag above, but it is kept for now.

Tested with 0bfd:0124 Kvaser Mini PCI Express 2xHS FW 4.18.778.

---
 .../net/can/usb/kvaser_usb/kvaser_usb_leaf.c  | 20 ++++++++-----------
 1 file changed, 8 insertions(+), 12 deletions(-)
drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c +8 -12
index 3c3e78992b55..b43631eaccf1 100644
@@ -965,20 +965,16 @@ kvaser_usb_leaf_rx_error_update_can_state(struct kvaser_usb_net_priv *priv,
 		new_state = CAN_STATE_BUS_OFF;
 	} else if (es->status & M16C_STATE_BUS_PASSIVE) {
 		new_state = CAN_STATE_ERROR_PASSIVE;
-	} else if (es->status & M16C_STATE_BUS_ERROR) {
+	} else if ((es->status & M16C_STATE_BUS_ERROR) &&
+		   cur_state >= CAN_STATE_BUS_OFF) {
 		/* Guard against spurious error events after a busoff */
-		if (cur_state < CAN_STATE_BUS_OFF) {
-			if (es->txerr >= 128 || es->rxerr >= 128)
-				new_state = CAN_STATE_ERROR_PASSIVE;
-			else if (es->txerr >= 96 || es->rxerr >= 96)
-				new_state = CAN_STATE_ERROR_WARNING;
-			else if (cur_state > CAN_STATE_ERROR_ACTIVE)
-				new_state = CAN_STATE_ERROR_ACTIVE;
-		}
-	}
-
-	if (!es->status)
+	} else if (es->txerr >= 128 || es->rxerr >= 128) {
+		new_state = CAN_STATE_ERROR_PASSIVE;
+	} else if (es->txerr >= 96 || es->rxerr >= 96) {
+		new_state = CAN_STATE_ERROR_WARNING;
+	} else {
 		new_state = CAN_STATE_ERROR_ACTIVE;
+	}
 
 	if (new_state != cur_state) {
 		tx_state = (es->txerr >= es->rxerr) ? new_state : 0;
Signature · 1 line
2.35.1
author maintainer
#90 lore raw

PATCH 90/521 can: kvaser_usb_leaf: Fix improved state not being reported

In reply to Greg Kroah-Hartman

From: Anssi Hannula <[email protected]>

[ Upstream commit 8d21f5927ae604881f98587fabf6753f88730968 ]

The tested 0bfd:0017 Kvaser Memorator Professional HS/HS FW 2.0.50 and 0bfd:0124 Kvaser Mini PCI Express 2xHS FW 4.18.778 do not seem to send any unsolicited events when error counters decrease or when the device transitions from ERROR_PASSIVE to ERROR_ACTIVE (or WARNING).

This causes the interface to e.g. indefinitely stay in the ERROR_PASSIVE state.

Fix that by asking for chip state (inc. counters) event every 0.5 secs when error counters are non-zero.

Since there are non-error-counter devices, also always poll in ERROR_PASSIVE even if the counters show zero.

---
 drivers/net/can/usb/kvaser_usb/kvaser_usb.h   |  7 +++
 .../net/can/usb/kvaser_usb/kvaser_usb_core.c  | 19 +++++-
 .../net/can/usb/kvaser_usb/kvaser_usb_leaf.c  | 58 +++++++++++++++++++
 3 files changed, 81 insertions(+), 3 deletions(-)
drivers/net/can/usb/kvaser_usb/kvaser_usb.h +7 -0
index 62958f04a2f2..1f4583f1dae2 100644
@@ -104,6 +104,9 @@ struct kvaser_usb_net_priv {
 	struct can_priv can;
 	struct can_berr_counter bec;
 
+	/* subdriver-specific data */
+	void *sub_priv;
+
 	struct kvaser_usb *dev;
 	struct net_device *netdev;
 	int channel;
@@ -125,6 +128,8 @@ struct kvaser_usb_net_priv {
  *
  * @dev_setup_endpoints:	setup USB in and out endpoints
  * @dev_init_card:		initialize card
+ * @dev_init_channel:		initialize channel
+ * @dev_remove_channel:		uninitialize channel
  * @dev_get_software_info:	get software info
  * @dev_get_software_details:	get software details
  * @dev_get_card_info:		get card info
@@ -146,6 +151,8 @@ struct kvaser_usb_dev_ops {
 				    struct can_berr_counter *bec);
 	int (*dev_setup_endpoints)(struct kvaser_usb *dev);
 	int (*dev_init_card)(struct kvaser_usb *dev);
+	int (*dev_init_channel)(struct kvaser_usb_net_priv *priv);
+	void (*dev_remove_channel)(struct kvaser_usb_net_priv *priv);
 	int (*dev_get_software_info)(struct kvaser_usb *dev);
 	int (*dev_get_software_details)(struct kvaser_usb *dev);
 	int (*dev_get_card_info)(struct kvaser_usb *dev);
drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c +16 -3
index 379df22d5123..e00afb94ec6c 100644
@@ -645,6 +645,7 @@ static const struct net_device_ops kvaser_usb_netdev_ops = {
 
 static void kvaser_usb_remove_interfaces(struct kvaser_usb *dev)
 {
+	const struct kvaser_usb_dev_ops *ops = dev->driver_info->ops;
 	int i;
 
 	for (i = 0; i < dev->nchannels; i++) {
@@ -660,6 +661,9 @@ static void kvaser_usb_remove_interfaces(struct kvaser_usb *dev)
 		if (!dev->nets[i])
 			continue;
 
+		if (ops->dev_remove_channel)
+			ops->dev_remove_channel(dev->nets[i]);
+
 		free_candev(dev->nets[i]->netdev);
 	}
 }
@@ -728,17 +732,26 @@ static int kvaser_usb_init_one(struct kvaser_usb *dev, int channel)
 
 	dev->nets[channel] = priv;
 
+	if (ops->dev_init_channel) {
+		err = ops->dev_init_channel(priv);
+		if (err)
+			goto err;
+	}
+
 	err = register_candev(netdev);
 	if (err) {
 		dev_err(&dev->intf->dev, "Failed to register CAN device\n");
-		free_candev(netdev);
-		dev->nets[channel] = NULL;
-		return err;
+		goto err;
 	}
 
 	netdev_dbg(netdev, "device registered\n");
 
 	return 0;
+
+err:
+	free_candev(netdev);
+	dev->nets[channel] = NULL;
+	return err;
 }
 
 static int kvaser_usb_probe(struct usb_interface *intf,
drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c +58 -0

122 lines not on this page · raw message

Signature · 1 line
2.35.1
author maintainer
#91 lore raw

PATCH 91/521 can: kvaser_usb_leaf: Fix wrong CAN state after stopping

In reply to Greg Kroah-Hartman

From: Anssi Hannula <[email protected]>

[ Upstream commit a11249acf802341294557895d8e5f6aef080253f ]

0bfd:0124 Kvaser Mini PCI Express 2xHS FW 4.18.778 sends a CMD_CHIP_STATE_EVENT indicating bus-off after stopping the device, causing a stopped device to appear as CAN_STATE_BUS_OFF instead of CAN_STATE_STOPPED.

Fix that by not handling error events on stopped devices.

---
 drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c +4 -0
index 6d45ae6f2a08..52ac6446634d 100644
@@ -1049,6 +1049,10 @@ static void kvaser_usb_leaf_rx_error(const struct kvaser_usb *dev,
 	leaf = priv->sub_priv;
 	stats = &priv->netdev->stats;
 
+	/* Ignore e.g. state change to bus-off reported just after stopping */
+	if (!netif_running(priv->netdev))
+		return;
+
 	/* Update all of the CAN interface's state and error counters before
 	 * trying any memory allocation that can actually fail with -ENOMEM.
 	 *
Signature · 1 line
2.35.1
author maintainer
#92 lore raw

PATCH 92/521 can: kvaser_usb_leaf: Fix bogus restart events

In reply to Greg Kroah-Hartman

From: Anssi Hannula <[email protected]>

[ Upstream commit 90904d326269a38fe5dd895fb2db7c03199654c4 ]

When auto-restart is enabled, the kvaser_usb_leaf driver considers transition from any state >= CAN_STATE_BUS_OFF as a bus-off recovery event (restart).

However, these events may occur at interface startup time before kvaser_usb_open() has set the state to CAN_STATE_ERROR_ACTIVE, causing restarts counter to increase and CAN_ERR_RESTARTED to be sent despite no actual restart having occurred.

Fix that by making the auto-restart condition checks more strict so that they only trigger when the interface was actually in the BUS_OFF state.

---
 drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c +3 -3
index 52ac6446634d..d1877ff2ff71 100644
@@ -899,7 +899,7 @@ static void kvaser_usb_leaf_tx_acknowledge(const struct kvaser_usb *dev,
 	context = &priv->tx_contexts[tid % dev->max_tx_urbs];
 
 	/* Sometimes the state change doesn't come after a bus-off event */
-	if (priv->can.restart_ms && priv->can.state >= CAN_STATE_BUS_OFF) {
+	if (priv->can.restart_ms && priv->can.state == CAN_STATE_BUS_OFF) {
 		struct sk_buff *skb;
 		struct can_frame *cf;
 
@@ -1002,7 +1002,7 @@ kvaser_usb_leaf_rx_error_update_can_state(struct kvaser_usb_net_priv *priv,
 	}
 
 	if (priv->can.restart_ms &&
-	    cur_state >= CAN_STATE_BUS_OFF &&
+	    cur_state == CAN_STATE_BUS_OFF &&
 	    new_state < CAN_STATE_BUS_OFF)
 		priv->can.can_stats.restarts++;
 
@@ -1092,7 +1092,7 @@ static void kvaser_usb_leaf_rx_error(const struct kvaser_usb *dev,
 		}
 
 		if (priv->can.restart_ms &&
-		    old_state >= CAN_STATE_BUS_OFF &&
+		    old_state == CAN_STATE_BUS_OFF &&
 		    new_state < CAN_STATE_BUS_OFF) {
 			cf->can_id |= CAN_ERR_RESTARTED;
 			netif_carrier_on(priv->netdev);
Signature · 1 line
2.35.1
author maintainer
#93 lore raw

PATCH 93/521 can: kvaser_usb: Add struct kvaser_usb_busparams

In reply to Greg Kroah-Hartman

From: Jimmy Assarsson <[email protected]>

[ Upstream commit 00e5786177649c1e3110f9454fdd34e336597265 ]

Add struct kvaser_usb_busparams containing the busparameters used in CMD_{SET,GET}_BUSPARAMS* commands.

---
 drivers/net/can/usb/kvaser_usb/kvaser_usb.h   |  8 +++++
 .../net/can/usb/kvaser_usb/kvaser_usb_hydra.c | 32 +++++++------------
 .../net/can/usb/kvaser_usb/kvaser_usb_leaf.c  | 18 ++++-------
 3 files changed, 27 insertions(+), 31 deletions(-)
drivers/net/can/usb/kvaser_usb/kvaser_usb.h +8 -0
index 1f4583f1dae2..cb8018723748 100644
@@ -76,6 +76,14 @@ struct kvaser_usb_tx_urb_context {
 	int dlc;
 };
 
+struct kvaser_usb_busparams {
+	__le32 bitrate;
+	u8 tseg1;
+	u8 tseg2;
+	u8 sjw;
+	u8 nsamples;
+} __packed;
+
 struct kvaser_usb {
 	struct usb_device *udev;
 	struct usb_interface *intf;
drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c +12 -20
index 9588efbfae71..72c37dc50b6b 100644
@@ -193,17 +193,9 @@ struct kvaser_cmd_chip_state_event {
 #define KVASER_USB_HYDRA_BUS_MODE_CANFD_ISO	0x01
 #define KVASER_USB_HYDRA_BUS_MODE_NONISO	0x02
 struct kvaser_cmd_set_busparams {
-	__le32 bitrate;
-	u8 tseg1;
-	u8 tseg2;
-	u8 sjw;
-	u8 nsamples;
+	struct kvaser_usb_busparams busparams_arb;
 	u8 reserved0[4];
-	__le32 bitrate_d;
-	u8 tseg1_d;
-	u8 tseg2_d;
-	u8 sjw_d;
-	u8 nsamples_d;
+	struct kvaser_usb_busparams busparams_data;
 	u8 canfd_mode;
 	u8 reserved1[7];
 } __packed;
@@ -1515,11 +1507,11 @@ static int kvaser_usb_hydra_set_bittiming(struct net_device *netdev)
 		return -ENOMEM;
 
 	cmd->header.cmd_no = CMD_SET_BUSPARAMS_REQ;
-	cmd->set_busparams_req.bitrate = cpu_to_le32(bt->bitrate);
-	cmd->set_busparams_req.sjw = (u8)sjw;
-	cmd->set_busparams_req.tseg1 = (u8)tseg1;
-	cmd->set_busparams_req.tseg2 = (u8)tseg2;
-	cmd->set_busparams_req.nsamples = 1;
+	cmd->set_busparams_req.busparams_arb.bitrate = cpu_to_le32(bt->bitrate);
+	cmd->set_busparams_req.busparams_arb.sjw = (u8)sjw;
+	cmd->set_busparams_req.busparams_arb.tseg1 = (u8)tseg1;
+	cmd->set_busparams_req.busparams_arb.tseg2 = (u8)tseg2;
+	cmd->set_busparams_req.busparams_arb.nsamples = 1;
 
 	kvaser_usb_hydra_set_cmd_dest_he
 		(cmd, dev->card_data.hydra.channel_to_he[priv->channel]);
@@ -1549,11 +1541,11 @@ static int kvaser_usb_hydra_set_data_bittiming(struct net_device *netdev)
 		return -ENOMEM;
 
 	cmd->header.cmd_no = CMD_SET_BUSPARAMS_FD_REQ;
-	cmd->set_busparams_req.bitrate_d = cpu_to_le32(dbt->bitrate);
-	cmd->set_busparams_req.sjw_d = (u8)sjw;
-	cmd->set_busparams_req.tseg1_d = (u8)tseg1;
-	cmd->set_busparams_req.tseg2_d = (u8)tseg2;
-	cmd->set_busparams_req.nsamples_d = 1;
+	cmd->set_busparams_req.busparams_data.bitrate = cpu_to_le32(dbt->bitrate);
+	cmd->set_busparams_req.busparams_data.sjw = (u8)sjw;
+	cmd->set_busparams_req.busparams_data.tseg1 = (u8)tseg1;
+	cmd->set_busparams_req.busparams_data.tseg2 = (u8)tseg2;
+	cmd->set_busparams_req.busparams_data.nsamples = 1;
 
 	if (priv->can.ctrlmode & CAN_CTRLMODE_FD) {
 		if (priv->can.ctrlmode & CAN_CTRLMODE_FD_NON_ISO)
drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c +7 -11
index d1877ff2ff71..1e2f727a1efb 100644
@@ -163,11 +163,7 @@ struct usbcan_cmd_softinfo {
 struct kvaser_cmd_busparams {
 	u8 tid;
 	u8 channel;
-	__le32 bitrate;
-	u8 tseg1;
-	u8 tseg2;
-	u8 sjw;
-	u8 no_samp;
+	struct kvaser_usb_busparams busparams;
 } __packed;
 
 struct kvaser_cmd_tx_can {
@@ -1703,15 +1699,15 @@ static int kvaser_usb_leaf_set_bittiming(struct net_device *netdev)
 	cmd->len = CMD_HEADER_LEN + sizeof(struct kvaser_cmd_busparams);
 	cmd->u.busparams.channel = priv->channel;
 	cmd->u.busparams.tid = 0xff;
-	cmd->u.busparams.bitrate = cpu_to_le32(bt->bitrate);
-	cmd->u.busparams.sjw = bt->sjw;
-	cmd->u.busparams.tseg1 = bt->prop_seg + bt->phase_seg1;
-	cmd->u.busparams.tseg2 = bt->phase_seg2;
+	cmd->u.busparams.busparams.bitrate = cpu_to_le32(bt->bitrate);
+	cmd->u.busparams.busparams.sjw = bt->sjw;
+	cmd->u.busparams.busparams.tseg1 = bt->prop_seg + bt->phase_seg1;
+	cmd->u.busparams.busparams.tseg2 = bt->phase_seg2;
 
 	if (priv->can.ctrlmode & CAN_CTRLMODE_3_SAMPLES)
-		cmd->u.busparams.no_samp = 3;
+		cmd->u.busparams.busparams.nsamples = 3;
 	else
-		cmd->u.busparams.no_samp = 1;
+		cmd->u.busparams.busparams.nsamples = 1;
 
 	rc = kvaser_usb_send_cmd(dev, cmd, cmd->len);
 
Signature · 1 line
2.35.1
author maintainer
#94 lore raw

PATCH 94/521 can: kvaser_usb: Compare requested bittiming parameters with actual parameters in do_set_{,data}_bittiming

In reply to Greg Kroah-Hartman

From: Jimmy Assarsson <[email protected]>

[ Upstream commit 39d3df6b0ea80f9b515c632ca07b39b1c156edee ]

The device will respond with a CMD_ERROR_EVENT command, with error_code KVASER_USB_{LEAF,HYDRA}_ERROR_EVENT_PARAM, if the CMD_SET_BUSPARAMS_REQ contains invalid bittiming parameters.
However, this command does not contain any channel reference.

To check if the CMD_SET_BUSPARAMS_REQ was successful, redback and compare the requested bittiming parameters with the device reported parameters.

Fixes 080f40a6fa28 ("can: kvaser_usb: Add support for Kvaser CAN/USB devices")
Fixes aec5fb2268b7 ("can: kvaser_usb: Add support for Kvaser USB hydra family")
---
 drivers/net/can/usb/kvaser_usb/kvaser_usb.h   |  15 +-
 .../net/can/usb/kvaser_usb/kvaser_usb_core.c  |  96 ++++++++++-
 .../net/can/usb/kvaser_usb/kvaser_usb_hydra.c | 150 +++++++++++++++---
 .../net/can/usb/kvaser_usb/kvaser_usb_leaf.c  |  64 ++++++--
 4 files changed, 284 insertions(+), 41 deletions(-)
drivers/net/can/usb/kvaser_usb/kvaser_usb.h +12 -3
index cb8018723748..5699531f8787 100644
@@ -119,9 +119,12 @@ struct kvaser_usb_net_priv {
 	struct net_device *netdev;
 	int channel;
 
-	struct completion start_comp, stop_comp, flush_comp;
+	struct completion start_comp, stop_comp, flush_comp,
+			  get_busparams_comp;
 	struct usb_anchor tx_submitted;
 
+	struct kvaser_usb_busparams busparams_nominal, busparams_data;
+
 	spinlock_t tx_contexts_lock; /* lock for active_tx_contexts */
 	int active_tx_contexts;
 	struct kvaser_usb_tx_urb_context tx_contexts[];
@@ -131,7 +134,9 @@ struct kvaser_usb_net_priv {
  * struct kvaser_usb_dev_ops - Device specific functions
  * @dev_set_mode:		used for can.do_set_mode
  * @dev_set_bittiming:		used for can.do_set_bittiming
+ * @dev_get_busparams:		readback arbitration busparams
  * @dev_set_data_bittiming:	used for can.do_set_data_bittiming
+ * @dev_get_data_busparams:	readback data busparams
  * @dev_get_berr_counter:	used for can.do_get_berr_counter
  *
  * @dev_setup_endpoints:	setup USB in and out endpoints
@@ -153,8 +158,12 @@ struct kvaser_usb_net_priv {
  */
 struct kvaser_usb_dev_ops {
 	int (*dev_set_mode)(struct net_device *netdev, enum can_mode mode);
-	int (*dev_set_bittiming)(struct net_device *netdev);
-	int (*dev_set_data_bittiming)(struct net_device *netdev);
+	int (*dev_set_bittiming)(const struct net_device *netdev,
+				 const struct kvaser_usb_busparams *busparams);
+	int (*dev_get_busparams)(struct kvaser_usb_net_priv *priv);
+	int (*dev_set_data_bittiming)(const struct net_device *netdev,
+				      const struct kvaser_usb_busparams *busparams);
+	int (*dev_get_data_busparams)(struct kvaser_usb_net_priv *priv);
 	int (*dev_get_berr_counter)(const struct net_device *netdev,
 				    struct can_berr_counter *bec);
 	int (*dev_setup_endpoints)(struct kvaser_usb *dev);
drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c +90 -6

126 lines not on this page · raw message

drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c +129 -21

240 lines not on this page · raw message

drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c +53 -11

115 lines not on this page · raw message

Signature · 1 line
2.35.1
author maintainer
#95 lore raw

PATCH 95/521 spi: Update reference to struct spi_controller

In reply to Greg Kroah-Hartman

From: Jonathan Neuschäfer <[email protected]>

[ Upstream commit bf585ccee22faf469d82727cf375868105b362f7 ]

struct spi_master has been renamed to struct spi_controller. Update the reference in spi.rst to make it clickable again.

Fixes 8caab75fd2c2 ("spi: Generalize SPI "master" to "controller"")
---
 Documentation/driver-api/spi.rst | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Documentation/driver-api/spi.rst +2 -2
index f64cb666498a..f28887045049 100644
@@ -25,8 +25,8 @@ hardware, which may be as simple as a set of GPIO pins or as complex as
 a pair of FIFOs connected to dual DMA engines on the other side of the
 SPI shift register (maximizing throughput). Such drivers bridge between
 whatever bus they sit on (often the platform bus) and SPI, and expose
-the SPI side of their device as a :c:type:`struct spi_master
-<spi_master>`. SPI devices are children of that master,
+the SPI side of their device as a :c:type:`struct spi_controller
+<spi_controller>`. SPI devices are children of that master,
 represented as a :c:type:`struct spi_device <spi_device>` and
 manufactured from :c:type:`struct spi_board_info
 <spi_board_info>` descriptors which are usually provided by
Signature · 1 line
2.35.1
author maintainer
#96 lore raw

PATCH 96/521 media: vivid: fix compose size exceed boundary

In reply to Greg Kroah-Hartman

From: Liu Shixin <[email protected]>

[ Upstream commit 94a7ad9283464b75b12516c5512541d467cefcf8 ]

syzkaller found a bug:

 BUG: unable to handle page fault for address: ffffc9000a3b1000
 #PF: supervisor write access in kernel mode
 #PF: error_code(0x0002) - not-present page
 PGD 100000067 P4D 100000067 PUD 10015f067 PMD 1121ca067 PTE 0
 Oops: 0002 [#1] PREEMPT SMP
 CPU: 0 PID: 23489 Comm: vivid-000-vid-c Not tainted 6.1.0-rc1+ #512
 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-1ubuntu1.1 04/01/2014
 RIP: 0010:memcpy_erms+0x6/0x10
[...]
 Call Trace:
  <TASK>
  ? tpg_fill_plane_buffer+0x856/0x15b0
  vivid_fillbuff+0x8ac/0x1110
  vivid_thread_vid_cap_tick+0x361/0xc90
  vivid_thread_vid_cap+0x21a/0x3a0
  kthread+0x143/0x180
  ret_from_fork+0x1f/0x30
  </TASK>

This is because we forget to check boundary after adjust compose->height int V4L2_SEL_TGT_CROP case. Add v4l2_rect_map_inside() to fix this problem for this case.

Fixes ef834f7836ec ("[media] vivid: add the video capture and output parts")
---
 drivers/media/platform/vivid/vivid-vid-cap.c | 1 +
 1 file changed, 1 insertion(+)
drivers/media/platform/vivid/vivid-vid-cap.c +1 -0
index 48f2c9c96fc9..ded48b7ad774 100644
@@ -923,6 +923,7 @@ int vivid_vid_cap_s_selection(struct file *file, void *fh, struct v4l2_selection
 			if (dev->has_compose_cap) {
 				v4l2_rect_set_min_size(compose, &min_rect);
 				v4l2_rect_set_max_size(compose, &max_rect);
+				v4l2_rect_map_inside(compose, &fmt);
 			}
 			dev->fmt_cap_rect = fmt;
 			tpg_s_buf_height(&dev->tpg, fmt.height);
Signature · 1 line
2.35.1
author maintainer
#97 lore raw

PATCH 97/521 mtd: Fix device name leak when register device failed in add_mtd_device()

In reply to Greg Kroah-Hartman

From: Zhang Xiaoxu <[email protected]>

[ Upstream commit 895d68a39481a75c680aa421546931fb11942fa6 ]

There is a kmemleak when register device failed:
unreferenced object 0xffff888101aab550 (size 8):

    comm "insmod", pid 3922, jiffies 4295277753 (age 925.408s)
    hex dump (first 8 bytes):
      6d 74 64 30 00 88 ff ff                          mtd0....
    backtrace:
      [<00000000bde26724>] __kmalloc_node_track_caller+0x4e/0x150
      [<000000003c32b416>] kvasprintf+0xb0/0x130
      [<000000001f7a8f15>] kobject_set_name_vargs+0x2f/0xb0
      [<000000006e781163>] dev_set_name+0xab/0xe0
      [<00000000e30d0c78>] add_mtd_device+0x4bb/0x700
      [<00000000f3d34de7>] mtd_device_parse_register+0x2ac/0x3f0
      [<00000000c0d88488>] 0xffffffffa0238457
      [<00000000b40d0922>] 0xffffffffa02a008f
      [<0000000023d17b9d>] do_one_initcall+0x87/0x2a0
      [<00000000770f6ca6>] do_init_module+0xdf/0x320
      [<000000007b6768fe>] load_module+0x2f98/0x3330
      [<00000000346bed5a>] __do_sys_finit_module+0x113/0x1b0
      [<00000000674c2290>] do_syscall_64+0x35/0x80
      [<000000004c6a8d97>] entry_SYSCALL_64_after_hwframe+0x46/0xb0

If register device failed, should call put_device() to give up the reference.

---
 drivers/mtd/mtdcore.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/mtd/mtdcore.c +3 -1
index a0b1a7814e2e..90d9c0e93157 100644
@@ -567,8 +567,10 @@ int add_mtd_device(struct mtd_info *mtd)
 	dev_set_drvdata(&mtd->dev, mtd);
 	of_node_get(mtd_get_of_node(mtd));
 	error = device_register(&mtd->dev);
-	if (error)
+	if (error) {
+		put_device(&mtd->dev);
 		goto fail_added;
+	}
 
 	if (!IS_ERR_OR_NULL(dfs_dir_mtd)) {
 		mtd->dbg.dfs_dir = debugfs_create_dir(dev_name(&mtd->dev), dfs_dir_mtd);
Signature · 1 line
2.35.1
author maintainer
#98 lore raw

PATCH 98/521 wifi: rsi: Fix handling of 802.3 EAPOL frames sent via control port

In reply to Greg Kroah-Hartman

From: Marek Vasut <[email protected]>

[ Upstream commit b8f6efccbb9dc0ff5dee7e20d69a4747298ee603 ]

When using wpa_supplicant v2.10, this driver is no longer able to associate with any AP and fails in the EAPOL 4-way handshake while sending the 2/4 message to the AP. The problem is not present in wpa_supplicant v2.9 or older. The problem stems from HostAP commit 144314eaa ("wpa_supplicant: Send EAPOL frames over nl80211 where available") which changes the way EAPOL frames are sent, from them being send at L2 frames to them being sent via nl80211 control port.

An EAPOL frame sent as L2 frame is passed to the WiFi driver with skb->protocol ETH_P_PAE, while EAPOL frame sent via nl80211 control port has skb->protocol set to ETH_P_802_3 . The later happens in ieee80211_tx_control_port(), where the EAPOL frame is encapsulated into 802.3 frame.

The rsi_91x driver handles ETH_P_PAE EAPOL frames as high-priority frames and sends them via highest-priority transmit queue, while the ETH_P_802_3 frames are sent as regular frames. The EAPOL 4-way handshake frames must be sent as highest-priority, otherwise the 4-way handshake times out.

Therefore, to fix this problem, inspect the skb control flags and if flag IEEE80211_TX_CTRL_PORT_CTRL_PROTO is set, assume this is an EAPOL frame and transmit the frame via high-priority queue just like other ETH_P_PAE frames.

Fixes 0eb42586cf87 ("rsi: data packet descriptor enhancements")
---
 drivers/net/wireless/rsi/rsi_91x_core.c | 4 +++-
 drivers/net/wireless/rsi/rsi_91x_hal.c  | 6 +++++-
 2 files changed, 8 insertions(+), 2 deletions(-)
drivers/net/wireless/rsi/rsi_91x_core.c +3 -1
index c6c29034b2ea..a939b552a8e4 100644
@@ -466,7 +466,9 @@ void rsi_core_xmit(struct rsi_common *common, struct sk_buff *skb)
 							      tid, 0);
 			}
 		}
-		if (skb->protocol == cpu_to_be16(ETH_P_PAE)) {
+
+		if (IEEE80211_SKB_CB(skb)->control.flags &
+		    IEEE80211_TX_CTRL_PORT_CTRL_PROTO) {
 			q_num = MGMT_SOFT_Q;
 			skb->priority = q_num;
 		}
drivers/net/wireless/rsi/rsi_91x_hal.c +5 -1
index 2cb7cca4ec2d..b445a52fbfbd 100644
@@ -152,12 +152,16 @@ int rsi_prepare_data_desc(struct rsi_common *common, struct sk_buff *skb)
 	u8 header_size;
 	u8 vap_id = 0;
 	u8 dword_align_bytes;
+	bool tx_eapol;
 	u16 seq_num;
 
 	info = IEEE80211_SKB_CB(skb);
 	vif = info->control.vif;
 	tx_params = (struct skb_info *)info->driver_data;
 
+	tx_eapol = IEEE80211_SKB_CB(skb)->control.flags &
+		   IEEE80211_TX_CTRL_PORT_CTRL_PROTO;
+
 	header_size = FRAME_DESC_SZ + sizeof(struct rsi_xtended_desc);
 	if (header_size > skb_headroom(skb)) {
 		rsi_dbg(ERR_ZONE, "%s: Unable to send pkt\n", __func__);
@@ -221,7 +225,7 @@ int rsi_prepare_data_desc(struct rsi_common *common, struct sk_buff *skb)
 		}
 	}
 
-	if (skb->protocol == cpu_to_be16(ETH_P_PAE)) {
+	if (tx_eapol) {
 		rsi_dbg(INFO_ZONE, "*** Tx EAPOL ***\n");
 
 		data_desc->frame_info = cpu_to_le16(RATE_INFO_ENABLE);
Signature · 1 line
2.35.1
author maintainer
#72 lore raw

PATCH 72/521 platform/x86: mxm-wmi: fix memleak in mxm_wmi_call_mx[ds|mx]()

In reply to Greg Kroah-Hartman

From: Yu Liao <[email protected]>

[ Upstream commit 727cc0147f5066e359aca65cc6cc5e6d64cc15d8 ]

The ACPI buffer memory (out.pointer) returned by wmi_evaluate_method() is not freed after the call, so it leads to memory leak.

The method results in ACPI buffer is not used, so just pass NULL to wmi_evaluate_method() which fixes the memory leak.

---
 drivers/platform/x86/mxm-wmi.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/platform/x86/mxm-wmi.c +2 -6
index 35d8b9a939f9..9c1893a703e6 100644
@@ -48,13 +48,11 @@ int mxm_wmi_call_mxds(int adapter)
 		.xarg = 1,
 	};
 	struct acpi_buffer input = { (acpi_size)sizeof(args), &args };
-	struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
 	acpi_status status;
 
 	printk("calling mux switch %d\n", adapter);
 
-	status = wmi_evaluate_method(MXM_WMMX_GUID, 0x0, adapter, &input,
-				     &output);
+	status = wmi_evaluate_method(MXM_WMMX_GUID, 0x0, adapter, &input, NULL);
 
 	if (ACPI_FAILURE(status))
 		return status;
@@ -73,13 +71,11 @@ int mxm_wmi_call_mxmx(int adapter)
 		.xarg = 1,
 	};
 	struct acpi_buffer input = { (acpi_size)sizeof(args), &args };
-	struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
 	acpi_status status;
 
 	printk("calling mux switch %d\n", adapter);
 
-	status = wmi_evaluate_method(MXM_WMMX_GUID, 0x0, adapter, &input,
-				     &output);
+	status = wmi_evaluate_method(MXM_WMMX_GUID, 0x0, adapter, &input, NULL);
 
 	if (ACPI_FAILURE(status))
 		return status;
Signature · 1 line
2.35.1
author maintainer
#99 lore raw

PATCH 99/521 media: camss: Clean up received buffers on failed start of streaming

In reply to Greg Kroah-Hartman

From: Vladimir Zapolskiy <[email protected]>

[ Upstream commit c8f3582345e6a69da65ab588f7c4c2d1685b0e80 ]

It is required to return the received buffers, if streaming can not be started. For instance media_pipeline_start() may fail with EPIPE, if a link validation between entities is not passed, and in such a case a user gets a kernel warning:

  WARNING: CPU: 1 PID: 520 at drivers/media/common/videobuf2/videobuf2-core.c:1592 vb2_start_streaming+0xec/0x160
  <snip>
  Call trace:
   vb2_start_streaming+0xec/0x160
   vb2_core_streamon+0x9c/0x1a0
   vb2_ioctl_streamon+0x68/0xbc
   v4l_streamon+0x30/0x3c
   __video_do_ioctl+0x184/0x3e0
   video_usercopy+0x37c/0x7b0
   video_ioctl2+0x24/0x40
   v4l2_ioctl+0x4c/0x70

The fix is to correct the error path in video_start_streaming() of camss.

Fixes 0ac2586c410f ("media: camss: Add files which handle the video device nodes")
---
 drivers/media/platform/qcom/camss/camss-video.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/media/platform/qcom/camss/camss-video.c +2 -1
index e81ebeb0506e..23701ec8d7de 100644
@@ -438,7 +438,7 @@ static int video_start_streaming(struct vb2_queue *q, unsigned int count)
 
 	ret = media_pipeline_start(&vdev->entity, &video->pipe);
 	if (ret < 0)
-		return ret;
+		goto flush_buffers;
 
 	ret = video_check_format(video);
 	if (ret < 0)
@@ -467,6 +467,7 @@ static int video_start_streaming(struct vb2_queue *q, unsigned int count)
 error:
 	media_pipeline_stop(&vdev->entity);
 
+flush_buffers:
 	video->ops->flush_buffers(video, VB2_BUF_STATE_QUEUED);
 
 	return ret;
Signature · 1 line
2.35.1
author maintainer
#73 lore raw

PATCH 73/521 MIPS: BCM63xx: Add check for NULL for clk in clk_enable

In reply to Greg Kroah-Hartman

From: Anastasia Belova <[email protected]>

[ Upstream commit ee9ef11bd2a59c2fefaa0959e5efcdf040d7c654 ]

Check clk for NULL before calling clk_enable_unlocked where clk is dereferenced. There is such check in other implementations of clk_enable.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes e7300d04bd08 ("MIPS: BCM63xx: Add support for the Broadcom BCM63xx family of SOCs.")
---
 arch/mips/bcm63xx/clk.c | 2 ++
 1 file changed, 2 insertions(+)
arch/mips/bcm63xx/clk.c +2 -0
index dcfa0ea912fe..f183c45503ce 100644
@@ -361,6 +361,8 @@ static struct clk clk_periph = {
  */
 int clk_enable(struct clk *clk)
 {
+	if (!clk)
+		return 0;
 	mutex_lock(&clocks_mutex);
 	clk_enable_unlocked(clk);
 	mutex_unlock(&clocks_mutex);
Signature · 1 line
2.35.1
author maintainer
#74 lore raw

PATCH 74/521 fs: sysv: Fix sysv_nblocks() returns wrong value

In reply to Greg Kroah-Hartman

From: Chen Zhongjin <[email protected]>

[ Upstream commit e0c49bd2b4d3cd1751491eb2d940bce968ac65e9 ]

sysv_nblocks() returns 'blocks' rather than 'res', which only counting the number of triple-indirect blocks and causing sysv_getattr() gets a wrong result.

[AV: this is actually a sysv counterpart of minixfs fix - 0fcd426de9d0 "[PATCH] minix block usage counting fix" in historical tree; mea culpa, should've thought to check fs/sysv back then...]

Fixes 1da177e4c3f4 ("Linux-2.6.12-rc2")
---
 fs/sysv/itree.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/sysv/itree.c +1 -1
index bcb67b0cabe7..31f66053e239 100644
@@ -438,7 +438,7 @@ static unsigned sysv_nblocks(struct super_block *s, loff_t size)
 		res += blocks;
 		direct = 1;
 	}
-	return blocks;
+	return res;
 }
 
 int sysv_getattr(const struct path *path, struct kstat *stat,
Signature · 1 line
2.35.1
author maintainer
#75 lore raw

PATCH 75/521 rapidio: fix possible UAF when kfifo_alloc() fails

In reply to Greg Kroah-Hartman

From: Wang Weiyang <[email protected]>

[ Upstream commit 02d7d89f816951e0862147d751b1150d67aaebdd ]

If kfifo_alloc() fails in mport_cdev_open(), goto err_fifo and just free priv. But priv is still in the chdev->file_list, then list traversal may cause UAF. This fixes the following smatch warning:

drivers/rapidio/devices/rio_mport_cdev.c:1930 mport_cdev_open() warn: '&priv->list' not removed from list

Fixes e8de370188d0 ("rapidio: add mport char device driver")
Cc Alexandre Bounine <[email protected]>
Cc Dan Carpenter <[email protected]>
Cc Jakob Koschel <[email protected]>
Cc John Hubbard <[email protected]>
Cc Matt Porter <[email protected]>
Cc Yang Yingliang <[email protected]>
---
 drivers/rapidio/devices/rio_mport_cdev.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/rapidio/devices/rio_mport_cdev.c +3 -4
index 01eb1a594ce6..1f4114b23f5a 100644
@@ -1909,10 +1909,6 @@ static int mport_cdev_open(struct inode *inode, struct file *filp)
 
 	priv->md = chdev;
 
-	mutex_lock(&chdev->file_mutex);
-	list_add_tail(&priv->list, &chdev->file_list);
-	mutex_unlock(&chdev->file_mutex);
-
 	INIT_LIST_HEAD(&priv->db_filters);
 	INIT_LIST_HEAD(&priv->pw_filters);
 	spin_lock_init(&priv->fifo_lock);
@@ -1931,6 +1927,9 @@ static int mport_cdev_open(struct inode *inode, struct file *filp)
 	spin_lock_init(&priv->req_lock);
 	mutex_init(&priv->dma_lock);
 #endif
+	mutex_lock(&chdev->file_mutex);
+	list_add_tail(&priv->list, &chdev->file_list);
+	mutex_unlock(&chdev->file_mutex);
 
 	filp->private_data = priv;
 	goto out;
Signature · 1 line
2.35.1
author maintainer
#76 lore raw

PATCH 76/521 eventfd: change int to __u64 in eventfd_signal() ifndef CONFIG_EVENTFD

In reply to Greg Kroah-Hartman

From: Zhang Qilong <[email protected]>

[ Upstream commit fd4e60bf0ef8eb9edcfa12dda39e8b6ee9060492 ]

Commit ee62c6b2dc93 ("eventfd: change int to __u64 in eventfd_signal()") forgot to change int to __u64 in the CONFIG_EVENTFD=n stub function.

Fixes ee62c6b2dc93 ("eventfd: change int to __u64 in eventfd_signal()")
Cc Dylan Yudaken <[email protected]>
Cc Jens Axboe <[email protected]>
Cc Sha Zhengju <[email protected]>
---
 include/linux/eventfd.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/eventfd.h +1 -1
index dc4fd8a6644d..3482f9365a4d 100644
@@ -61,7 +61,7 @@ static inline struct eventfd_ctx *eventfd_ctx_fdget(int fd)
 	return ERR_PTR(-ENOSYS);
 }
 
-static inline int eventfd_signal(struct eventfd_ctx *ctx, int n)
+static inline int eventfd_signal(struct eventfd_ctx *ctx, __u64 n)
 {
 	return -ENOSYS;
 }
Signature · 1 line
2.35.1
author maintainer
#77 lore raw

PATCH 77/521 relay: fix type mismatch when allocating memory in relay_create_buf()

In reply to Greg Kroah-Hartman

From: Gavrilov Ilia <[email protected]>

[ Upstream commit 4d8586e04602fe42f0a782d2005956f8b6302678 ]

The 'padding' field of the 'rchan_buf' structure is an array of 'size_t' elements, but the memory is allocated for an array of 'size_t *' elements.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes b86ff981a825 ("[PATCH] relay: migrate from relayfs to a generic relay API")
Cc Colin Ian King <[email protected]>
Cc Jens Axboe <[email protected]>
---
 kernel/relay.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/relay.c +2 -2
index 735cb208f023..b7aa7df43955 100644
@@ -163,13 +163,13 @@ static struct rchan_buf *relay_create_buf(struct rchan *chan)
 {
 	struct rchan_buf *buf;
 
-	if (chan->n_subbufs > KMALLOC_MAX_SIZE / sizeof(size_t *))
+	if (chan->n_subbufs > KMALLOC_MAX_SIZE / sizeof(size_t))
 		return NULL;
 
 	buf = kzalloc(sizeof(struct rchan_buf), GFP_KERNEL);
 	if (!buf)
 		return NULL;
-	buf->padding = kmalloc_array(chan->n_subbufs, sizeof(size_t *),
+	buf->padding = kmalloc_array(chan->n_subbufs, sizeof(size_t),
 				     GFP_KERNEL);
 	if (!buf->padding)
 		goto free_buf;
Signature · 1 line
2.35.1
author maintainer
#78 lore raw

PATCH 78/521 hfs: Fix OOB Write in hfs_asc2mac

In reply to Greg Kroah-Hartman

From: ZhangPeng <[email protected]>

[ Upstream commit c53ed55cb275344086e32a7080a6b19cb183650b ]

Syzbot reported a OOB Write bug:

loop0: detected capacity change from 0 to 64
==================================================================

BUG: KASAN: slab-out-of-bounds in hfs_asc2mac+0x467/0x9a0
fs/hfs/trans.c:133
Write of size 1 at addr ffff88801848314e by task syz-executor391/3632

Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1b1/0x28e lib/dump_stack.c:106
 print_address_description+0x74/0x340 mm/kasan/report.c:284
 print_report+0x107/0x1f0 mm/kasan/report.c:395
 kasan_report+0xcd/0x100 mm/kasan/report.c:495
 hfs_asc2mac+0x467/0x9a0 fs/hfs/trans.c:133
 hfs_cat_build_key+0x92/0x170 fs/hfs/catalog.c:28
 hfs_lookup+0x1ab/0x2c0 fs/hfs/dir.c:31
 lookup_open fs/namei.c:3391 [inline]
 open_last_lookups fs/namei.c:3481 [inline]
 path_openat+0x10e6/0x2df0 fs/namei.c:3710
 do_filp_open+0x264/0x4f0 fs/namei.c:3740

If in->len is much larger than HFS_NAMELEN(31) which is the maximum length of an HFS filename, a OOB write could occur in hfs_asc2mac(). In that case, when the dst reaches the boundary, the srclen is still greater than 0, which causes a OOB write.
Fix this by adding a check on dstlen in while() before writing to dst address.

---
 fs/hfs/trans.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/hfs/trans.c +1 -1
index 39f5e343bf4d..fdb0edb8a607 100644
@@ -109,7 +109,7 @@ void hfs_asc2mac(struct super_block *sb, struct hfs_name *out, const struct qstr
 	if (nls_io) {
 		wchar_t ch;
 
-		while (srclen > 0) {
+		while (srclen > 0 && dstlen > 0) {
 			size = nls_io->char2uni(src, srclen, &ch);
 			if (size < 0) {
 				ch = '?';
Signature · 1 line
2.35.1
author maintainer
#69 lore raw

PATCH 69/521 xen/privcmd: Fix a possible warning in privcmd_ioctl_mmap_resource()

In reply to Greg Kroah-Hartman

From: Harshit Mogalapalli <[email protected]>

[ Upstream commit 8b997b2bb2c53b76a6db6c195930e9ab8e4b0c79 ]

As 'kdata.num' is user-controlled data, if user tries to allocate memory larger than(>=) MAX_ORDER, then kcalloc() will fail, it creates a stack trace and messes up dmesg with a warning.

Call trace:

-> privcmd_ioctl
--> privcmd_ioctl_mmap_resource

Add __GFP_NOWARN in order to avoid too large allocation warning. This is detected by static analysis using smatch.

---
 drivers/xen/privcmd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/xen/privcmd.c +1 -1
index 74ff28fda64d..15ece1041d17 100644
@@ -785,7 +785,7 @@ static long privcmd_ioctl_mmap_resource(struct file *file,
 		goto out;
 	}
 
-	pfns = kcalloc(kdata.num, sizeof(*pfns), GFP_KERNEL);
+	pfns = kcalloc(kdata.num, sizeof(*pfns), GFP_KERNEL | __GFP_NOWARN);
 	if (!pfns) {
 		rc = -ENOMEM;
 		goto out;
Signature · 1 line
2.35.1
author maintainer
#101 lore raw

PATCH 101/521 drm/radeon: Add the missed acpi_put_table() to fix memory leak

In reply to Greg Kroah-Hartman

From: Hanjun Guo <[email protected]>

[ Upstream commit 10276a20be1115e1f76c189330da2992df980eee ]

When the radeon driver reads the bios information from ACPI table in radeon_acpi_vfct_bios(), it misses to call acpi_put_table() to release the ACPI memory after the init, so add acpi_put_table() properly to fix the memory leak.

v2: fix text formatting (Alex)

Fixes 268ba0a99f89 ("drm/radeon: implement ACPI VFCT vbios fetch (v3)")
---
 drivers/gpu/drm/radeon/radeon_bios.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)
drivers/gpu/drm/radeon/radeon_bios.c +11 -7
index dd0528cf9818..8154d2d7fe9e 100644
@@ -608,13 +608,14 @@ static bool radeon_acpi_vfct_bios(struct radeon_device *rdev)
 	acpi_size tbl_size;
 	UEFI_ACPI_VFCT *vfct;
 	unsigned offset;
+	bool r = false;
 
 	if (!ACPI_SUCCESS(acpi_get_table("VFCT", 1, &hdr)))
 		return false;
 	tbl_size = hdr->length;
 	if (tbl_size < sizeof(UEFI_ACPI_VFCT)) {
 		DRM_ERROR("ACPI VFCT table present but broken (too short #1)\n");
-		return false;
+		goto out;
 	}
 
 	vfct = (UEFI_ACPI_VFCT *)hdr;
@@ -627,13 +628,13 @@ static bool radeon_acpi_vfct_bios(struct radeon_device *rdev)
 		offset += sizeof(VFCT_IMAGE_HEADER);
 		if (offset > tbl_size) {
 			DRM_ERROR("ACPI VFCT image header truncated\n");
-			return false;
+			goto out;
 		}
 
 		offset += vhdr->ImageLength;
 		if (offset > tbl_size) {
 			DRM_ERROR("ACPI VFCT image truncated\n");
-			return false;
+			goto out;
 		}
 
 		if (vhdr->ImageLength &&
@@ -645,15 +646,18 @@ static bool radeon_acpi_vfct_bios(struct radeon_device *rdev)
 			rdev->bios = kmemdup(&vbios->VbiosContent,
 					     vhdr->ImageLength,
 					     GFP_KERNEL);
+			if (rdev->bios)
+				r = true;
 
-			if (!rdev->bios)
-				return false;
-			return true;
+			goto out;
 		}
 	}
 
 	DRM_ERROR("ACPI VFCT table present but broken (too short #2)\n");
-	return false;
+
+out:
+	acpi_put_table(hdr);
+	return r;
 }
 #else
 static inline bool radeon_acpi_vfct_bios(struct radeon_device *rdev)
Signature · 1 line
2.35.1
author maintainer
#110 lore raw

PATCH 110/521 HID: hid-sensor-custom: set fixed size for custom attributes

In reply to Greg Kroah-Hartman

From: Marcus Folkesson <[email protected]>

[ Upstream commit 9d013910df22de91333a0acc81d1dbb115bd76f6 ]

This is no bugfix (so no Fixes: tag is necessary) as it is taken care of in hid_sensor_custom_add_attributes().

The motivation for this patch is that:
hid_sensor_custom_field.attr_name and hid_sensor_custom_field.attrs
has the size of HID_CUSTOM_TOTAL_ATTRS and used in same context.

We compare against HID_CUSTOM_TOTAL_ATTRS when
looping through hid_custom_attrs.

We will silent the smatch error:
hid_sensor_custom_add_attributes() error: buffer overflow 'hid_custom_attrs' 8 <= 10

---
 drivers/hid/hid-sensor-custom.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/hid-sensor-custom.c +1 -1
index bb012bc032e0..a0c30863e1e0 100644
@@ -67,7 +67,7 @@ struct hid_sensor_sample {
 	u32 raw_len;
 } __packed;
 
-static struct attribute hid_custom_attrs[] = {
+static struct attribute hid_custom_attrs[HID_CUSTOM_TOTAL_ATTRS] = {
 	{.name = "name", .mode = S_IRUGO},
 	{.name = "units", .mode = S_IRUGO},
 	{.name = "unit-expo", .mode = S_IRUGO},
Signature · 1 line
2.35.1
author maintainer
#111 lore raw

PATCH 111/521 ALSA: seq: fix undefined behavior in bit shift for SNDRV_SEQ_FILTER_USE_EVENT

In reply to Greg Kroah-Hartman

From: Baisong Zhong <[email protected]>

[ Upstream commit cf59e1e4c79bf741905484cdb13c130b53576a16 ]

Shifting signed 32-bit value by 31 bits is undefined, so changing significant bit to unsigned. The UBSAN warning calltrace like below:

UBSAN: shift-out-of-bounds in sound/core/seq/seq_clientmgr.c:509:22
left shift of 1 by 31 places cannot be represented in type 'int'
...
Call Trace:
 <TASK>
 dump_stack_lvl+0x8d/0xcf
 ubsan_epilogue+0xa/0x44
 __ubsan_handle_shift_out_of_bounds+0x1e7/0x208
 snd_seq_deliver_single_event.constprop.21+0x191/0x2f0
 snd_seq_deliver_event+0x1a2/0x350
 snd_seq_kernel_client_dispatch+0x8b/0xb0
 snd_seq_client_notify_subscription+0x72/0xa0
 snd_seq_ioctl_subscribe_port+0x128/0x160
 snd_seq_kernel_client_ctl+0xce/0xf0
 snd_seq_oss_create_client+0x109/0x15b
 alsa_seq_oss_init+0x11c/0x1aa
 do_one_initcall+0x80/0x440
 kernel_init_freeable+0x370/0x3c3
 kernel_init+0x1b/0x190
 ret_from_fork+0x1f/0x30
 </TASK>
---
 include/uapi/sound/asequencer.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
include/uapi/sound/asequencer.h +4 -4
index a75e14edc957..dbd60f48b4b0 100644
@@ -344,10 +344,10 @@ typedef int __bitwise snd_seq_client_type_t;
 #define	KERNEL_CLIENT	((__force snd_seq_client_type_t) 2)
                         
 	/* event filter flags */
-#define SNDRV_SEQ_FILTER_BROADCAST	(1<<0)	/* accept broadcast messages */
-#define SNDRV_SEQ_FILTER_MULTICAST	(1<<1)	/* accept multicast messages */
-#define SNDRV_SEQ_FILTER_BOUNCE		(1<<2)	/* accept bounce event in error */
-#define SNDRV_SEQ_FILTER_USE_EVENT	(1<<31)	/* use event filter */
+#define SNDRV_SEQ_FILTER_BROADCAST	(1U<<0)	/* accept broadcast messages */
+#define SNDRV_SEQ_FILTER_MULTICAST	(1U<<1)	/* accept multicast messages */
+#define SNDRV_SEQ_FILTER_BOUNCE		(1U<<2)	/* accept bounce event in error */
+#define SNDRV_SEQ_FILTER_USE_EVENT	(1U<<31)	/* use event filter */
 
 struct snd_seq_client_info {
 	int client;			/* client number to inquire */
Signature · 1 line
2.35.1
author maintainer
#112 lore raw

PATCH 112/521 clk: rockchip: Fix memory leak in rockchip_clk_register_pll()

In reply to Greg Kroah-Hartman

From: Xiu Jianfeng <[email protected]>

[ Upstream commit 739a6a6bbdb793bd57938cb24aa5a6df89983546 ]

If clk_register() fails, @pll->rate_table may have allocated memory by kmemdup(), so it needs to be freed, otherwise will cause memory leak issue, this patch fixes it.

Fixes 90c590254051 ("clk: rockchip: add clock type for pll clocks and pll used on rk3066")
---
 drivers/clk/rockchip/clk-pll.c | 1 +
 1 file changed, 1 insertion(+)
drivers/clk/rockchip/clk-pll.c +1 -0
index dd0433d4753e..77aff5defac6 100644
@@ -972,6 +972,7 @@ struct clk *rockchip_clk_register_pll(struct rockchip_clk_provider *ctx,
 	return mux_clk;
 
 err_pll:
+	kfree(pll->rate_table);
 	clk_unregister(mux_clk);
 	mux_clk = pll_clk;
 err_mux:
Signature · 1 line
2.35.1
author maintainer
#113 lore raw

PATCH 113/521 bonding: Export skip slave logic to function

In reply to Greg Kroah-Hartman

From: Maor Gottlieb <[email protected]>

[ Upstream commit 119d48fd4298594beccf4f2ecd00627826ce2646 ]

As a preparation for following change that add array of all slaves, extract code that skip slave to function.

---
 drivers/net/bonding/bond_main.c | 47 ++++++++++++++++++---------------
 1 file changed, 26 insertions(+), 21 deletions(-)
drivers/net/bonding/bond_main.c +26 -21
index cab5c1cc9fe9..85efa0e0ee2c 100644
@@ -3993,6 +3993,29 @@ static void bond_slave_arr_handler(struct work_struct *work)
 	bond_slave_arr_work_rearm(bond, 1);
 }
 
+static void bond_skip_slave(struct bond_up_slave *slaves,
+			    struct slave *skipslave)
+{
+	int idx;
+
+	/* Rare situation where caller has asked to skip a specific
+	 * slave but allocation failed (most likely!). BTW this is
+	 * only possible when the call is initiated from
+	 * __bond_release_one(). In this situation; overwrite the
+	 * skipslave entry in the array with the last entry from the
+	 * array to avoid a situation where the xmit path may choose
+	 * this to-be-skipped slave to send a packet out.
+	 */
+	for (idx = 0; slaves && idx < slaves->count; idx++) {
+		if (skipslave == slaves->arr[idx]) {
+			slaves->arr[idx] =
+				slaves->arr[slaves->count - 1];
+			slaves->count--;
+			break;
+		}
+	}
+}
+
 /* Build the usable slaves array in control path for modes that use xmit-hash
  * to determine the slave interface -
  * (a) BOND_MODE_8023AD
@@ -4063,27 +4086,9 @@ int bond_update_slave_arr(struct bonding *bond, struct slave *skipslave)
 	if (old_arr)
 		kfree_rcu(old_arr, rcu);
 out:
-	if (ret != 0 && skipslave) {
-		int idx;
-
-		/* Rare situation where caller has asked to skip a specific
-		 * slave but allocation failed (most likely!). BTW this is
-		 * only possible when the call is initiated from
-		 * __bond_release_one(). In this situation; overwrite the
-		 * skipslave entry in the array with the last entry from the
-		 * array to avoid a situation where the xmit path may choose
-		 * this to-be-skipped slave to send a packet out.
-		 */
-		old_arr = rtnl_dereference(bond->slave_arr);
-		for (idx = 0; old_arr != NULL && idx < old_arr->count; idx++) {
-			if (skipslave == old_arr->arr[idx]) {
-				old_arr->arr[idx] =
-				    old_arr->arr[old_arr->count-1];
-				old_arr->count--;
-				break;
-			}
-		}
-	}
+	if (ret != 0 && skipslave)
+		bond_skip_slave(rtnl_dereference(bond->slave_arr), skipslave);
+
 	return ret;
 }
 
Signature · 1 line
2.35.1
author maintainer
#114 lore raw

PATCH 114/521 mtd: maps: pxa2xx-flash: fix memory leak in probe

In reply to Greg Kroah-Hartman

From: Zheng Yongjun <[email protected]>

[ Upstream commit 2399401feee27c639addc5b7e6ba519d3ca341bf ]

Free 'info' upon remapping error to avoid a memory leak.

Fixes e644f7d62894 ("[MTD] MAPS: Merge Lubbock and Mainstone drivers into common PXA2xx driver")
[<[email protected]>: Reword the commit log]
---
 drivers/mtd/maps/pxa2xx-flash.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/mtd/maps/pxa2xx-flash.c +2 -0
index 2cde28ed95c9..59d2fe1f46e1 100644
@@ -69,6 +69,7 @@ static int pxa2xx_flash_probe(struct platform_device *pdev)
 	if (!info->map.virt) {
 		printk(KERN_WARNING "Failed to ioremap %s\n",
 		       info->map.name);
+		kfree(info);
 		return -ENOMEM;
 	}
 	info->map.cached =
@@ -91,6 +92,7 @@ static int pxa2xx_flash_probe(struct platform_device *pdev)
 		iounmap((void *)info->map.virt);
 		if (info->map.cached)
 			iounmap(info->map.cached);
+		kfree(info);
 		return -EIO;
 	}
 	info->mtd->dev.parent = &pdev->dev;
Signature · 1 line
2.35.1
author maintainer
#115 lore raw

PATCH 115/521 drbd: remove call to memset before free device/resource/connection

In reply to Greg Kroah-Hartman

From: Wang ShaoBo <[email protected]>

[ Upstream commit 6e7b854e4c1b02dba00760dfa79d8dbf6cce561e ]

This revert c2258ffc56f2 ("drbd: poison free'd device, resource and connection structs"), add memset is odd here for debugging, there are some methods to accurately show what happened, such as kdump.

---
 drivers/block/drbd/drbd_main.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/block/drbd/drbd_main.c +0 -3
index 3ae718aa6b39..1ff5af6c4f3f 100644
@@ -2258,7 +2258,6 @@ void drbd_destroy_device(struct kref *kref)
 		kref_put(&peer_device->connection->kref, drbd_destroy_connection);
 		kfree(peer_device);
 	}
-	memset(device, 0xfd, sizeof(*device));
 	kfree(device);
 	kref_put(&resource->kref, drbd_destroy_resource);
 }
@@ -2351,7 +2350,6 @@ void drbd_destroy_resource(struct kref *kref)
 	idr_destroy(&resource->devices);
 	free_cpumask_var(resource->cpu_mask);
 	kfree(resource->name);
-	memset(resource, 0xf2, sizeof(*resource));
 	kfree(resource);
 }
 
@@ -2748,7 +2746,6 @@ void drbd_destroy_connection(struct kref *kref)
 	drbd_free_socket(&connection->data);
 	kfree(connection->int_dig_in);
 	kfree(connection->int_dig_vv);
-	memset(connection, 0xfc, sizeof(*connection));
 	kfree(connection);
 	kref_put(&resource->kref, drbd_destroy_resource);
 }
Signature · 1 line
2.35.1
author maintainer
#116 lore raw

PATCH 116/521 media: imon: fix a race condition in send_packet()

In reply to Greg Kroah-Hartman

From: Gautam Menghani <[email protected]>

[ Upstream commit 813ceef062b53d68f296aa3cb944b21a091fabdb ]

The function send_packet() has a race condition as follows:

func send_packet()
{
// do work
call usb_submit_urb()
mutex_unlock()
wait_for_event_interruptible() <-- lock gone
mutex_lock()
}

func vfd_write()
{
mutex_lock()
call send_packet() <- prev call is not completed mutex_unlock()
}

When the mutex is unlocked and the function send_packet() waits for the call to complete, vfd_write() can start another call, which leads to the "URB submitted while active" warning in usb_submit_urb(). Fix this by removing the mutex_unlock() call in send_packet() and using mutex_lock_interruptible().

Fixes 21677cfc562a ("V4L/DVB: ir-core: add imon driver")
Reported-by [email protected]
---
 drivers/media/rc/imon.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/media/rc/imon.c +3 -3
index 6b10363fb6f0..99bb7380ee0e 100644
@@ -613,15 +613,14 @@ static int send_packet(struct imon_context *ictx)
 		pr_err_ratelimited("error submitting urb(%d)\n", retval);
 	} else {
 		/* Wait for transmission to complete (or abort) */
-		mutex_unlock(&ictx->lock);
 		retval = wait_for_completion_interruptible(
 				&ictx->tx.finished);
 		if (retval) {
 			usb_kill_urb(ictx->tx_urb);
 			pr_err_ratelimited("task interrupted\n");
 		}
-		mutex_lock(&ictx->lock);
 
+		ictx->tx.busy = false;
 		retval = ictx->tx.status;
 		if (retval)
 			pr_err_ratelimited("packet tx failed (%d)\n", retval);
@@ -928,7 +927,8 @@ static ssize_t vfd_write(struct file *file, const char __user *buf,
 		return -ENODEV;
 	}
 
-	mutex_lock(&ictx->lock);
+	if (mutex_lock_interruptible(&ictx->lock))
+		return -ERESTARTSYS;
 
 	if (!ictx->dev_present_intf0) {
 		pr_err_ratelimited("no iMON device present\n");
Signature · 1 line
2.35.1
author maintainer
#117 lore raw

PATCH 117/521 pinctrl: pinconf-generic: add missing of_node_put()

In reply to Greg Kroah-Hartman

From: ZhangPeng <[email protected]>

[ Upstream commit 5ead93289815a075d43c415e35c8beafafb801c9 ]

of_node_put() needs to be called when jumping out of the loop, since for_each_available_child_of_node() will increase the refcount of node.

Fixes c7289500e29d ("pinctrl: pinconf-generic: scan also referenced phandle node")
---
 drivers/pinctrl/pinconf-generic.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/pinctrl/pinconf-generic.c +3 -1
index 55b56440a5a8..7e946c54681a 100644
@@ -390,8 +390,10 @@ int pinconf_generic_dt_node_to_map(struct pinctrl_dev *pctldev,
 	for_each_available_child_of_node(np_config, np) {
 		ret = pinconf_generic_dt_subnode_to_map(pctldev, np, map,
 					&reserved_maps, num_maps, type);
-		if (ret < 0)
+		if (ret < 0) {
+			of_node_put(np);
 			goto exit;
+		}
 	}
 	return 0;
 
Signature · 1 line
2.35.1
author maintainer
#118 lore raw

PATCH 118/521 media: dvb-core: Fix ignored return value in dvb_register_frontend()

In reply to Greg Kroah-Hartman

From: Chen Zhongjin <[email protected]>

[ Upstream commit a574359e2e71ce16be212df3a082ed60a4bd2c5f ]

In dvb_register_frontend(), dvb_register_device() is possible to fail but its return value is ignored.

It will cause use-after-free when module is removed, because in dvb_unregister_frontend() it tries to unregister a not registered device.

BUG: KASAN: use-after-free in dvb_remove_device+0x18b/0x1f0 [dvb_core]
Read of size 4 at addr ffff88800dff4824 by task rmmod/428
CPU: 3 PID: 428 Comm: rmmod
Call Trace:
 <TASK>
 ...
 dvb_remove_device+0x18b/0x1f0 [dvb_core]
 dvb_unregister_frontend+0x7b/0x130 [dvb_core]
 vidtv_bridge_remove+0x6e/0x160 [dvb_vidtv_bridge]
 ...

Fix this by catching return value of dvb_register_device(). However the fe->refcount can't be put to zero immediately, because there are still modules calling dvb_frontend_detach() when dvb_register_frontend() fails.

---
 drivers/media/dvb-core/dvb_frontend.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/media/dvb-core/dvb_frontend.c +7 -1
index 8a61150ee249..1768c1b515b3 100644
@@ -2956,6 +2956,7 @@ int dvb_register_frontend(struct dvb_adapter *dvb,
 		.name = fe->ops.info.name,
 #endif
 	};
+	int ret;
 
 	dev_dbg(dvb->device, "%s:\n", __func__);
 
@@ -2989,8 +2990,13 @@ int dvb_register_frontend(struct dvb_adapter *dvb,
 		 "DVB: registering adapter %i frontend %i (%s)...\n",
 		 fe->dvb->num, fe->id, fe->ops.info.name);
 
-	dvb_register_device(fe->dvb, &fepriv->dvbdev, &dvbdev_template,
+	ret = dvb_register_device(fe->dvb, &fepriv->dvbdev, &dvbdev_template,
 			    fe, DVB_DEVICE_FRONTEND, 0);
+	if (ret) {
+		dvb_frontend_put(fe);
+		mutex_unlock(&frontend_mutex);
+		return ret;
+	}
 
 	/*
 	 * Initialize the cache to the proper values according with the
Signature · 1 line
2.35.1
author maintainer
#119 lore raw

PATCH 119/521 media: dvb-usb: az6027: fix null-ptr-deref in az6027_i2c_xfer()

In reply to Greg Kroah-Hartman

From: Baisong Zhong <[email protected]>

[ Upstream commit 0ed554fd769a19ea8464bb83e9ac201002ef74ad ]

Wei Chen reports a kernel bug as blew:

general protection fault, probably for non-canonical address
KASAN: null-ptr-deref in range [0x0000000000000010-0x0000000000000017]
...
Call Trace:
<TASK>
__i2c_transfer+0x77e/0x1930 drivers/i2c/i2c-core-base.c:2109
i2c_transfer+0x1d5/0x3d0 drivers/i2c/i2c-core-base.c:2170
i2cdev_ioctl_rdwr+0x393/0x660 drivers/i2c/i2c-dev.c:297
i2cdev_ioctl+0x75d/0x9f0 drivers/i2c/i2c-dev.c:458
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:870 [inline]
__se_sys_ioctl+0xfb/0x170 fs/ioctl.c:856
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3d/0x90 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7fd834a8bded

In az6027_i2c_xfer(), if msg[i].addr is 0x99, a null-ptr-deref will caused when accessing msg[i].buf. For msg[i].len is 0 and msg[i].buf is null.

Fix this by checking msg[i].len in az6027_i2c_xfer().

---
 drivers/media/usb/dvb-usb/az6027.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/media/usb/dvb-usb/az6027.c +4 -0
index 990719727dc3..7d71ac7811eb 100644
@@ -978,6 +978,10 @@ static int az6027_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], int n
 		if (msg[i].addr == 0x99) {
 			req = 0xBE;
 			index = 0;
+			if (msg[i].len < 1) {
+				i = -EOPNOTSUPP;
+				break;
+			}
 			value = msg[i].buf[0] & 0x00ff;
 			length = 1;
 			az6027_usb_out_op(d, req, value, index, data, length);
Signature · 1 line
2.35.1
author maintainer
#102 lore raw

PATCH 102/521 ASoC: pxa: fix null-pointer dereference in filter()

In reply to Greg Kroah-Hartman

From: Zeng Heng <[email protected]>

[ Upstream commit ec7bf231aaa1bdbcb69d23bc50c753c80fb22429 ]

kasprintf() would return NULL pointer when kmalloc() fail to allocate. Need to check the return pointer before calling strcmp().

Fixes 7a824e214e25 ("ASoC: mmp: add audio dma support")
---
 sound/soc/pxa/mmp-pcm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/pxa/mmp-pcm.c +1 -1
index d2d4652de32c..5969aa66410d 100644
@@ -90,7 +90,7 @@ static bool filter(struct dma_chan *chan, void *param)
 
 	devname = kasprintf(GFP_KERNEL, "%s.%d", dma_data->dma_res->name,
 		dma_data->ssp_id);
-	if ((strcmp(dev_name(chan->device->dev), devname) == 0) &&
+	if (devname && (strcmp(dev_name(chan->device->dev), devname) == 0) &&
 		(chan->chan_id == dma_data->dma_res->start)) {
 		found = true;
 	}
Signature · 1 line
2.35.1
author maintainer
#120 lore raw

PATCH 120/521 media: s5p-mfc: Add variant data for MFC v7 hardware for Exynos 3250 SoC

In reply to Greg Kroah-Hartman

From: Aakarsh Jain <[email protected]>

[ Upstream commit f50ebe10f5d8092c37e2bd430c78e03bf38b1e20 ]

Commit 5441e9dafdfc6dc40 ("[media] s5p-mfc: Core support for MFC v7") which adds mfc v7 support for Exynos3250 and use the same compatible string as used by Exynos5240 but both the IPs are a bit different in terms of IP clock.
Add variant driver data based on the new compatible string "samsung,exynos3250-mfc" for Exynos3250 SoC.

Fixes 5441e9dafdfc ("[media] s5p-mfc: Core support for MFC v7")
---
 drivers/media/platform/s5p-mfc/s5p_mfc.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)
drivers/media/platform/s5p-mfc/s5p_mfc.c +15 -2
index 0fc101bc58d6..684aa8491a38 100644
@@ -1574,8 +1574,18 @@ static struct s5p_mfc_variant mfc_drvdata_v7 = {
 	.port_num	= MFC_NUM_PORTS_V7,
 	.buf_size	= &buf_size_v7,
 	.fw_name[0]     = "s5p-mfc-v7.fw",
-	.clk_names	= {"mfc", "sclk_mfc"},
-	.num_clocks	= 2,
+	.clk_names	= {"mfc"},
+	.num_clocks	= 1,
+};
+
+static struct s5p_mfc_variant mfc_drvdata_v7_3250 = {
+	.version        = MFC_VERSION_V7,
+	.version_bit    = MFC_V7_BIT,
+	.port_num       = MFC_NUM_PORTS_V7,
+	.buf_size       = &buf_size_v7,
+	.fw_name[0]     = "s5p-mfc-v7.fw",
+	.clk_names      = {"mfc", "sclk_mfc"},
+	.num_clocks     = 2,
 };
 
 static struct s5p_mfc_buf_size_v6 mfc_buf_size_v8 = {
@@ -1645,6 +1655,9 @@ static const struct of_device_id exynos_mfc_match[] = {
 	}, {
 		.compatible = "samsung,mfc-v7",
 		.data = &mfc_drvdata_v7,
+	}, {
+		.compatible = "samsung,exynos3250-mfc",
+		.data = &mfc_drvdata_v7_3250,
 	}, {
 		.compatible = "samsung,mfc-v8",
 		.data = &mfc_drvdata_v8,
Signature · 1 line
2.35.1
author maintainer
#121 lore raw

PATCH 121/521 drm/tegra: Add missing clk_disable_unprepare() in tegra_dc_probe()

In reply to Greg Kroah-Hartman

From: Zhang Zekun <[email protected]>

[ Upstream commit 7ad4384d53c67672a8720cdc2ef638d7d1710ab8 ]

Add the missing clk_disable_unprepare() before return from tegra_dc_probe() in the error handling path.

Fixes f68ba6912bd2 ("drm/tegra: dc: Link DC1 to DC0 on Tegra20")
---
 drivers/gpu/drm/tegra/dc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/tegra/dc.c +3 -1
index 03adb4cf325b..6c8b59a26675 100644
@@ -2376,8 +2376,10 @@ static int tegra_dc_probe(struct platform_device *pdev)
 	usleep_range(2000, 4000);
 
 	err = reset_control_assert(dc->rst);
-	if (err < 0)
+	if (err < 0) {
+		clk_disable_unprepare(dc->clk);
 		return err;
+	}
 
 	usleep_range(2000, 4000);
 
Signature · 1 line
2.35.1
author maintainer
#122 lore raw

PATCH 122/521 NFSv4.2: Fix a memory stomp in decode_attr_security_label

In reply to Greg Kroah-Hartman

From: Trond Myklebust <[email protected]>

[ Upstream commit 43c1031f7110967c240cb6e922adcfc4b8899183 ]

We must not change the value of label->len if it is zero, since that indicates we stored a label.

Fixes b4487b935452 ("nfs: Fix getxattr kernel panic and memory overflow")
---
 fs/nfs/nfs4xdr.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
fs/nfs/nfs4xdr.c +4 -6
index 56e48642c43e..f0021e3b8efd 100644
@@ -4277,12 +4277,10 @@ static int decode_attr_security_label(struct xdr_stream *xdr, uint32_t *bitmap,
 		if (unlikely(!p))
 			goto out_overflow;
 		if (len < NFS4_MAXLABELLEN) {
-			if (label) {
-				if (label->len) {
-					if (label->len < len)
-						return -ERANGE;
-					memcpy(label->label, p, len);
-				}
+			if (label && label->len) {
+				if (label->len < len)
+					return -ERANGE;
+				memcpy(label->label, p, len);
 				label->len = len;
 				label->pi = pi;
 				label->lfs = lfs;
Signature · 1 line
2.35.1
author maintainer
#123 lore raw

PATCH 123/521 NFSv4: Fix a deadlock between nfs4_open_recover_helper() and delegreturn

In reply to Greg Kroah-Hartman

From: Trond Myklebust <[email protected]>

[ Upstream commit 51069e4aef6257b0454057359faed0ab0c9af083 ]

If we're asked to recover open state while a delegation return is outstanding, then the state manager thread cannot use a cached open, so if the server returns a delegation, we can end up deadlocked behind the pending delegreturn.
To avoid this problem, let's just ask the server not to give us a delegation unless we're explicitly reclaiming one.

Fixes be36e185bd26 ("NFSv4: nfs4_open_recover_helper() must set share access")
---
 fs/nfs/nfs4proc.c | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)
fs/nfs/nfs4proc.c +12 -7
index 9a0f48f7f2b8..250fa88303fa 100644
@@ -1980,18 +1980,18 @@ static struct nfs4_opendata *nfs4_open_recoverdata_alloc(struct nfs_open_context
 }
 
 static int nfs4_open_recover_helper(struct nfs4_opendata *opendata,
-		fmode_t fmode)
+				    fmode_t fmode)
 {
 	struct nfs4_state *newstate;
+	struct nfs_server *server = NFS_SB(opendata->dentry->d_sb);
+	int openflags = opendata->o_arg.open_flags;
 	int ret;
 
 	if (!nfs4_mode_match_open_stateid(opendata->state, fmode))
 		return 0;
-	opendata->o_arg.open_flags = 0;
 	opendata->o_arg.fmode = fmode;
-	opendata->o_arg.share_access = nfs4_map_atomic_open_share(
-			NFS_SB(opendata->dentry->d_sb),
-			fmode, 0);
+	opendata->o_arg.share_access =
+		nfs4_map_atomic_open_share(server, fmode, openflags);
 	memset(&opendata->o_res, 0, sizeof(opendata->o_res));
 	memset(&opendata->c_res, 0, sizeof(opendata->c_res));
 	nfs4_init_opendata_res(opendata);
@@ -2569,10 +2569,15 @@ static int _nfs4_open_expired(struct nfs_open_context *ctx, struct nfs4_state *s
 	struct nfs4_opendata *opendata;
 	int ret;
 
-	opendata = nfs4_open_recoverdata_alloc(ctx, state,
-			NFS4_OPEN_CLAIM_FH);
+	opendata = nfs4_open_recoverdata_alloc(ctx, state, NFS4_OPEN_CLAIM_FH);
 	if (IS_ERR(opendata))
 		return PTR_ERR(opendata);
+	/*
+	 * We're not recovering a delegation, so ask for no delegation.
+	 * Otherwise the recovery thread could deadlock with an outstanding
+	 * delegation return.
+	 */
+	opendata->o_arg.open_flags = O_DIRECT;
 	ret = nfs4_open_recover(opendata, state);
 	if (ret == -ESTALE)
 		d_drop(ctx->dentry);
Signature · 1 line
2.35.1
author maintainer
#124 lore raw

PATCH 124/521 ALSA: asihpi: fix missing pci_disable_device()

In reply to Greg Kroah-Hartman

From: Liu Shixin <[email protected]>

[ Upstream commit 9d86515c3d4c0564a0c31a2df87d735353a1971e ]

pci_disable_device() need be called while module exiting, switch to use pcim_enable(), pci_disable_device() will be called in pcim_release().

Fixes 3285ea10e9b0 ("ALSA: asihpi - Interrelated HPI tidy up.")
---
 sound/pci/asihpi/hpioctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/pci/asihpi/hpioctl.c +1 -1
index 3f06986fbecf..d8c244a5dce0 100644
@@ -359,7 +359,7 @@ int asihpi_adapter_probe(struct pci_dev *pci_dev,
 		pci_dev->device, pci_dev->subsystem_vendor,
 		pci_dev->subsystem_device, pci_dev->devfn);
 
-	if (pci_enable_device(pci_dev) < 0) {
+	if (pcim_enable_device(pci_dev) < 0) {
 		dev_err(&pci_dev->dev,
 			"pci_enable_device failed, disabling device\n");
 		return -EIO;
Signature · 1 line
2.35.1
author maintainer
#125 lore raw

PATCH 125/521 drm/radeon: Fix PCI device refcount leak in radeon_atrm_get_bios()

In reply to Greg Kroah-Hartman

From: Xiongfeng Wang <[email protected]>

[ Upstream commit 725a521a18734f65de05b8d353b5bd0d3ca4c37a ]

As comment of pci_get_class() says, it returns a pci_device with its refcount increased and decreased the refcount for the input parameter @from if it is not NULL.

If we break the loop in radeon_atrm_get_bios() with 'pdev' not NULL, we need to call pci_dev_put() to decrease the refcount. Add the missing pci_dev_put() to avoid refcount leak.

Fixes d8ade3526b2a ("drm/radeon: handle non-VGA class pci devices with ATRM")
Fixes c61e2775873f ("drm/radeon: split ATRM support out from the ATPX handler (v3)")
---
 drivers/gpu/drm/radeon/radeon_bios.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/radeon/radeon_bios.c +1 -0
index 8154d2d7fe9e..0246edecc61f 100644
@@ -223,6 +223,7 @@ static bool radeon_atrm_get_bios(struct radeon_device *rdev)
 
 	if (!found)
 		return false;
+	pci_dev_put(pdev);
 
 	rdev->bios = kmalloc(size, GFP_KERNEL);
 	if (!rdev->bios) {
Signature · 1 line
2.35.1
author maintainer
#126 lore raw

PATCH 126/521 drm/amdgpu: Fix PCI device refcount leak in amdgpu_atrm_get_bios()

In reply to Greg Kroah-Hartman

From: Xiongfeng Wang <[email protected]>

[ Upstream commit ca54639c7752edf1304d92ff4d0c049d4efc9ba0 ]

As comment of pci_get_class() says, it returns a pci_device with its refcount increased and decreased the refcount for the input parameter @from if it is not NULL.

If we break the loop in amdgpu_atrm_get_bios() with 'pdev' not NULL, we need to call pci_dev_put() to decrease the refcount. Add the missing pci_dev_put() to avoid refcount leak.

Fixes d38ceaf99ed0 ("drm/amdgpu: add core driver (v4)")
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c +1 -0
index 6cf3dd5edffd..c1e2e9912bf0 100644
@@ -312,6 +312,7 @@ static bool amdgpu_atrm_get_bios(struct amdgpu_device *adev)
 
 	if (!found)
 		return false;
+	pci_dev_put(pdev);
 
 	adev->bios = kmalloc(size, GFP_KERNEL);
 	if (!adev->bios) {
Signature · 1 line
2.35.1
author maintainer
#127 lore raw

PATCH 127/521 ASoC: pcm512x: Fix PM disable depth imbalance in pcm512x_probe

In reply to Greg Kroah-Hartman

From: Zhang Qilong <[email protected]>

[ Upstream commit 97b801be6f8e53676b9f2b105f54e35c745c1b22 ]

The pm_runtime_enable will increase power disable depth. Thus a pairing decrement is needed on the error handling path to keep it balanced according to context. We fix it by going to err_pm instead of err_clk.

Fixes f086ba9d5389c ("ASoC: pcm512x: Support mastering BCLK/LRCLK using the PLL")
---
 sound/soc/codecs/pcm512x.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
sound/soc/codecs/pcm512x.c +4 -4
index 5272c81641c1..310cfceab41f 100644
@@ -1471,7 +1471,7 @@ int pcm512x_probe(struct device *dev, struct regmap *regmap)
 			if (val > 6) {
 				dev_err(dev, "Invalid pll-in\n");
 				ret = -EINVAL;
-				goto err_clk;
+				goto err_pm;
 			}
 			pcm512x->pll_in = val;
 		}
@@ -1480,7 +1480,7 @@ int pcm512x_probe(struct device *dev, struct regmap *regmap)
 			if (val > 6) {
 				dev_err(dev, "Invalid pll-out\n");
 				ret = -EINVAL;
-				goto err_clk;
+				goto err_pm;
 			}
 			pcm512x->pll_out = val;
 		}
@@ -1489,12 +1489,12 @@ int pcm512x_probe(struct device *dev, struct regmap *regmap)
 			dev_err(dev,
 				"Error: both pll-in and pll-out, or none\n");
 			ret = -EINVAL;
-			goto err_clk;
+			goto err_pm;
 		}
 		if (pcm512x->pll_in && pcm512x->pll_in == pcm512x->pll_out) {
 			dev_err(dev, "Error: pll-in == pll-out\n");
 			ret = -EINVAL;
-			goto err_clk;
+			goto err_pm;
 		}
 	}
 #endif
Signature · 1 line
2.35.1
author maintainer
#128 lore raw

PATCH 128/521 bonding: uninitialized variable in bond_miimon_inspect()

In reply to Greg Kroah-Hartman

From: Dan Carpenter <[email protected]>

[ Upstream commit e5214f363dabca240446272dac54d404501ad5e5 ]

The "ignore_updelay" variable needs to be initialized to false.

Fixes f8a65ab2f3ff ("bonding: fix link recovery in mode 2 when updelay is nonzero")
---
 drivers/net/bonding/bond_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/bonding/bond_main.c +1 -1
index 85efa0e0ee2c..4e4adacb5c2c 100644
@@ -2096,10 +2096,10 @@ static int bond_slave_info_query(struct net_device *bond_dev, struct ifslave *in
 /* called with rcu_read_lock() */
 static int bond_miimon_inspect(struct bonding *bond)
 {
+	bool ignore_updelay = false;
 	int link_state, commit = 0;
 	struct list_head *iter;
 	struct slave *slave;
-	bool ignore_updelay;
 
 	ignore_updelay = !rcu_dereference(bond->curr_active_slave);
 
Signature · 1 line
2.35.1
author maintainer
#129 lore raw

PATCH 129/521 wifi: mac80211: fix memory leak in ieee80211_if_add()

In reply to Greg Kroah-Hartman

From: Zhengchao Shao <[email protected]>

[ Upstream commit 13e5afd3d773c6fc6ca2b89027befaaaa1ea7293 ]

When register_netdevice() failed in ieee80211_if_add(), ndev->tstats isn't released. Fix it.

Fixes 5a490510ba5f ("mac80211: use per-CPU TX/RX statistics")
---
 net/mac80211/iface.c | 1 +
 1 file changed, 1 insertion(+)
net/mac80211/iface.c +1 -0
index 358028a09ce4..5d252d144cb9 100644
@@ -1888,6 +1888,7 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name,
 
 		ret = register_netdevice(ndev);
 		if (ret) {
+			ieee80211_if_free(ndev);
 			free_netdev(ndev);
 			return ret;
 		}
Signature · 1 line
2.35.1
author maintainer
#103 lore raw

PATCH 103/521 regulator: core: fix unbalanced of node refcount in regulator_dev_lookup()

In reply to Greg Kroah-Hartman

From: Yang Yingliang <[email protected]>

[ Upstream commit f2b41b748c19962b82709d9f23c6b2b0ce9d2f91 ]

I got the the following report:

OF: ERROR: memory leak, expected refcount 1 instead of 2, of_node_get()/of_node_put() unbalanced - destroy cset entry:
attach overlay node /i2c/pmic@62/regulators/exten

In of_get_regulator(), the node is returned from of_parse_phandle() with refcount incremented, after using it, of_node_put() need be called.

Fixes 69511a452e6d ("regulator: map consumer regulator based on device tree")
---
 drivers/regulator/core.c | 1 +
 1 file changed, 1 insertion(+)
drivers/regulator/core.c +1 -0
index 045075cd256c..07982143ec18 100644
@@ -1541,6 +1541,7 @@ static struct regulator_dev *regulator_dev_lookup(struct device *dev,
 		node = of_get_regulator(dev, supply);
 		if (node) {
 			r = of_find_regulator_by_node(node);
+			of_node_put(node);
 			if (r)
 				return r;
 
Signature · 1 line
2.35.1
author maintainer
#130 lore raw

PATCH 130/521 wifi: cfg80211: Fix not unregister reg_pdev when load_builtin_regdb_keys() fails

In reply to Greg Kroah-Hartman

From: Chen Zhongjin <[email protected]>

[ Upstream commit 833a9fd28c9b7ccb39a334721379e992dc1c0c89 ]

In regulatory_init_db(), when it's going to return a error, reg_pdev should be unregistered. When load_builtin_regdb_keys() fails it doesn't do it and makes cfg80211 can't be reload with report:

sysfs: cannot create duplicate filename '/devices/platform/regulatory.0'
...

 <TASK>
 dump_stack_lvl+0x79/0x9b
 sysfs_warn_dup.cold+0x1c/0x29
 sysfs_create_dir_ns+0x22d/0x290
 kobject_add_internal+0x247/0x800
 kobject_add+0x135/0x1b0
 device_add+0x389/0x1be0
 platform_device_add+0x28f/0x790
 platform_device_register_full+0x376/0x4b0
 regulatory_init+0x9a/0x4b2 [cfg80211]
 cfg80211_init+0x84/0x113 [cfg80211]
 ...
Fixes 90a53e4432b1 ("cfg80211: implement regdb signature checking")
---
 net/wireless/reg.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
net/wireless/reg.c +3 -1
index 07d053603e3a..beba41f8a178 100644
@@ -3918,8 +3918,10 @@ static int __init regulatory_init_db(void)
 		return -EINVAL;
 
 	err = load_builtin_regdb_keys();
-	if (err)
+	if (err) {
+		platform_device_unregister(reg_pdev);
 		return err;
+	}
 
 	/* We always try to get an update for the static regdomain */
 	err = regulatory_hint_core(cfg80211_world_regdom->alpha2);
Signature · 1 line
2.35.1
author maintainer
#131 lore raw

PATCH 131/521 regulator: core: fix module refcount leak in set_supply()

In reply to Greg Kroah-Hartman

From: Yang Yingliang <[email protected]>

[ Upstream commit da46ee19cbd8344d6860816b4827a7ce95764867 ]

If create_regulator() fails in set_supply(), the module refcount needs be put to keep refcount balanced.

Fixes e2c09ae7a74d ("regulator: core: Increase refcount for regulator supply's module")
---
 drivers/regulator/core.c | 1 +
 1 file changed, 1 insertion(+)
drivers/regulator/core.c +1 -0
index 07982143ec18..9cf438a37eeb 100644
@@ -1241,6 +1241,7 @@ static int set_supply(struct regulator_dev *rdev,
 
 	rdev->supply = create_regulator(supply_rdev, &rdev->dev, "SUPPLY");
 	if (rdev->supply == NULL) {
+		module_put(supply_rdev->owner);
 		err = -ENOMEM;
 		return err;
 	}
Signature · 1 line
2.35.1
author maintainer
#104 lore raw

PATCH 104/521 ima: Fix misuse of dereference of pointer in template_desc_init_fields()

In reply to Greg Kroah-Hartman

From: Xiu Jianfeng <[email protected]>

[ Upstream commit 25369175ce84813dd99d6604e710dc2491f68523 ]

The input parameter @fields is type of struct ima_template_field ***, so when allocates array memory for @fields, the size of element should be sizeof(**field) instead of sizeof(*field).

Actually the original code would not cause any runtime error, but it's better to make it logically right.

Fixes adf53a778a0a ("ima: new templates management mechanism")
---
 security/integrity/ima/ima_template.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
security/integrity/ima/ima_template.c +2 -2
index 4dfdccce497b..13567e555130 100644
@@ -196,11 +196,11 @@ static int template_desc_init_fields(const char *template_fmt,
 	}
 
 	if (fields && num_fields) {
-		*fields = kmalloc_array(i, sizeof(*fields), GFP_KERNEL);
+		*fields = kmalloc_array(i, sizeof(**fields), GFP_KERNEL);
 		if (*fields == NULL)
 			return -ENOMEM;
 
-		memcpy(*fields, found_fields, i * sizeof(*fields));
+		memcpy(*fields, found_fields, i * sizeof(**fields));
 		*num_fields = i;
 	}
 
Signature · 1 line
2.35.1
author maintainer
#105 lore raw

PATCH 105/521 wifi: ath10k: Fix return value in ath10k_pci_init()

In reply to Greg Kroah-Hartman

From: Xiu Jianfeng <[email protected]>

[ Upstream commit 2af7749047d8d6ad43feff69f555a13a6a6c2831 ]

This driver is attempting to register to support two different buses. if either of these is successful then ath10k_pci_init() should return 0 so that hardware attached to the successful bus can be probed and supported. only if both of these are unsuccessful should ath10k_pci_init() return an errno.

Fixes 0b523ced9a3c ("ath10k: add basic skeleton to support ahb")
---
 drivers/net/wireless/ath/ath10k/pci.c | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)
drivers/net/wireless/ath/ath10k/pci.c +12 -8
index caece8339a50..92757495c73b 100644
@@ -3739,18 +3739,22 @@ static struct pci_driver ath10k_pci_driver = {
 
 static int __init ath10k_pci_init(void)
 {
-	int ret;
+	int ret1, ret2;
 
-	ret = pci_register_driver(&ath10k_pci_driver);
-	if (ret)
+	ret1 = pci_register_driver(&ath10k_pci_driver);
+	if (ret1)
 		printk(KERN_ERR "failed to register ath10k pci driver: %d\n",
-		       ret);
+		       ret1);
 
-	ret = ath10k_ahb_init();
-	if (ret)
-		printk(KERN_ERR "ahb init failed: %d\n", ret);
+	ret2 = ath10k_ahb_init();
+	if (ret2)
+		printk(KERN_ERR "ahb init failed: %d\n", ret2);
 
-	return ret;
+	if (ret1 && ret2)
+		return ret1;
+
+	/* registered to at least one bus */
+	return 0;
 }
 module_init(ath10k_pci_init);
 
Signature · 1 line
2.35.1
author maintainer
#106 lore raw

PATCH 106/521 mtd: lpddr2_nvm: Fix possible null-ptr-deref

In reply to Greg Kroah-Hartman

From: Hui Tang <[email protected]>

[ Upstream commit 6bdd45d795adf9e73b38ced5e7f750cd199499ff ]

It will cause null-ptr-deref when resource_size(add_range) invoked, if platform_get_resource() returns NULL.

Fixes 96ba9dd65788 ("mtd: lpddr: add driver for LPDDR2-NVM PCM memories")
---
 drivers/mtd/lpddr/lpddr2_nvm.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/mtd/lpddr/lpddr2_nvm.c +2 -0
index 90e6cb64db69..b004d3213a66 100644
@@ -442,6 +442,8 @@ static int lpddr2_nvm_probe(struct platform_device *pdev)
 
 	/* lpddr2_nvm address range */
 	add_range = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (!add_range)
+		return -ENODEV;
 
 	/* Populate map_info data structure */
 	*map = (struct map_info) {
Signature · 1 line
2.35.1
author maintainer
#107 lore raw

PATCH 107/521 Input: elants_i2c - properly handle the reset GPIO when power is off

In reply to Greg Kroah-Hartman

From: Douglas Anderson <[email protected]>

[ Upstream commit a85fbd6498441694475716a4d5c65f9d3e073faf ]

As can be seen in elants_i2c_power_off(), we want the reset GPIO asserted when power is off. The reset GPIO is active low so we need the reset line logic low when power is off to avoid leakage.

We have a problem, though, at probe time. At probe time we haven't powered the regulators on yet but we have:

  devm_gpiod_get(&client->dev, "reset", GPIOD_OUT_LOW);

While that _looks_ right, it turns out that it's not. The GPIOD_OUT_LOW doesn't mean to init the GPIO to low. It means init the GPIO to "not asserted". Since this is an active low GPIO that inits it to be high.

Let's fix this to properly init the GPIO. Now after both probe and power off the state of the GPIO is consistent (it's "asserted" or level low).

Once we fix this, we can see that at power on time we no longer to assert the reset GPIO as the first thing. The reset GPIO is _always_ asserted before powering on. Let's fix powering on to account for this.

---
 drivers/input/touchscreen/elants_i2c.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/input/touchscreen/elants_i2c.c +3 -6
index adfae2d88707..83e9bded87d9 100644
@@ -1082,14 +1082,12 @@ static int elants_i2c_power_on(struct elants_data *ts)
 	if (IS_ERR_OR_NULL(ts->reset_gpio))
 		return 0;
 
-	gpiod_set_value_cansleep(ts->reset_gpio, 1);
-
 	error = regulator_enable(ts->vcc33);
 	if (error) {
 		dev_err(&ts->client->dev,
 			"failed to enable vcc33 regulator: %d\n",
 			error);
-		goto release_reset_gpio;
+		return error;
 	}
 
 	error = regulator_enable(ts->vccio);
@@ -1098,7 +1096,7 @@ static int elants_i2c_power_on(struct elants_data *ts)
 			"failed to enable vccio regulator: %d\n",
 			error);
 		regulator_disable(ts->vcc33);
-		goto release_reset_gpio;
+		return error;
 	}
 
 	/*
@@ -1107,7 +1105,6 @@ static int elants_i2c_power_on(struct elants_data *ts)
 	 */
 	udelay(ELAN_POWERON_DELAY_USEC);
 
-release_reset_gpio:
 	gpiod_set_value_cansleep(ts->reset_gpio, 0);
 	if (error)
 		return error;
@@ -1215,7 +1212,7 @@ static int elants_i2c_probe(struct i2c_client *client,
 		return error;
 	}
 
-	ts->reset_gpio = devm_gpiod_get(&client->dev, "reset", GPIOD_OUT_LOW);
+	ts->reset_gpio = devm_gpiod_get(&client->dev, "reset", GPIOD_OUT_HIGH);
 	if (IS_ERR(ts->reset_gpio)) {
 		error = PTR_ERR(ts->reset_gpio);
 
Signature · 1 line
2.35.1
author maintainer
#108 lore raw

PATCH 108/521 media: solo6x10: fix possible memory leak in solo_sysfs_init()

In reply to Greg Kroah-Hartman

From: Yang Yingliang <[email protected]>

[ Upstream commit 7f5866dd96d95b74e439f6ee17b8abd8195179fb ]

If device_register() returns error in solo_sysfs_init(), the name allocated by dev_set_name() need be freed. As comment of device_register() says, it should use put_device() to give up the reference in the error path. So fix this by calling put_device(), then the name can be freed in kobject_cleanup().

Fixes dcae5dacbce5 ("[media] solo6x10: sync to latest code from Bluecherry's git repo")
---
 drivers/media/pci/solo6x10/solo6x10-core.c | 1 +
 1 file changed, 1 insertion(+)
drivers/media/pci/solo6x10/solo6x10-core.c +1 -0
index 19ffd2ed3cc7..d3bca099b78b 100644
@@ -429,6 +429,7 @@ static int solo_sysfs_init(struct solo_dev *solo_dev)
 		     solo_dev->nr_chans);
 
 	if (device_register(dev)) {
+		put_device(dev);
 		dev->parent = NULL;
 		return -ENOMEM;
 	}
Signature · 1 line
2.35.1
author maintainer
#109 lore raw

PATCH 109/521 media: platform: exynos4-is: Fix error handling in fimc_md_init()

In reply to Greg Kroah-Hartman

From: Yuan Can <[email protected]>

[ Upstream commit b434422c45282a0573d8123239abc41fa72665d4 ]

A problem about modprobe s5p_fimc failed is triggered with the following log given:

 [  272.075275] Error: Driver 'exynos4-fimc' is already registered, aborting...
 modprobe: ERROR: could not insert 's5p_fimc': Device or resource busy

The reason is that fimc_md_init() returns platform_driver_register() directly without checking its return value, if platform_driver_register() failed, it returns without unregister fimc_driver, resulting the s5p_fimc can never be installed later.
A simple call graph is shown as below:

fimc_md_init()
fimc_register_driver() # register fimc_driver
platform_driver_register()
platform_driver_register()
driver_register()
bus_add_driver()
dev = kzalloc(...) # OOM happened

   # return without unregister fimc_driver

Fix by unregister fimc_driver when platform_driver_register() returns error.

Fixes d3953223b090 ("[media] s5p-fimc: Add the media device driver")
---
 drivers/media/platform/exynos4-is/fimc-core.c | 2 +-
 drivers/media/platform/exynos4-is/media-dev.c | 6 +++++-
 2 files changed, 6 insertions(+), 2 deletions(-)
drivers/media/platform/exynos4-is/fimc-core.c +1 -1
index d8d8c9902b19..cc8bc41b7db7 100644
@@ -1255,7 +1255,7 @@ int __init fimc_register_driver(void)
 	return platform_driver_register(&fimc_driver);
 }
 
-void __exit fimc_unregister_driver(void)
+void fimc_unregister_driver(void)
 {
 	platform_driver_unregister(&fimc_driver);
 }
drivers/media/platform/exynos4-is/media-dev.c +5 -1
index 3261dc72cc61..03171f2cf296 100644
@@ -1566,7 +1566,11 @@ static int __init fimc_md_init(void)
 	if (ret)
 		return ret;
 
-	return platform_driver_register(&fimc_md_driver);
+	ret = platform_driver_register(&fimc_md_driver);
+	if (ret)
+		fimc_unregister_driver();
+
+	return ret;
 }
 
 static void __exit fimc_md_exit(void)
Signature · 1 line
2.35.1
author maintainer
#100 lore raw

PATCH 100/521 net, proc: Provide PROC_FS=n fallback for proc_create_net_single_write()

In reply to Greg Kroah-Hartman

From: David Howells <[email protected]>

[ Upstream commit c3d96f690a790074b508fe183a41e36a00cd7ddd ]

Provide a CONFIG_PROC_FS=n fallback for proc_create_net_single_write().

Also provide a fallback for proc_create_net_data_write().

Fixes 564def71765c ("proc: Add a way to make network proc files writable")
cc Marc Dionne <[email protected]>
---
 include/linux/proc_fs.h | 2 ++
 1 file changed, 2 insertions(+)
include/linux/proc_fs.h +2 -0
index 5141657a0f7f..c16352fbbe1f 100644
@@ -117,8 +117,10 @@ static inline void proc_remove(struct proc_dir_entry *de) {}
 static inline int remove_proc_subtree(const char *name, struct proc_dir_entry *parent) { return 0; }
 
 #define proc_create_net_data(name, mode, parent, ops, state_size, data) ({NULL;})
+#define proc_create_net_data_write(name, mode, parent, ops, write, state_size, data) ({NULL;})
 #define proc_create_net(name, mode, parent, state_size, ops) ({NULL;})
 #define proc_create_net_single(name, mode, parent, show, data) ({NULL;})
+#define proc_create_net_single_write(name, mode, parent, show, write, data) ({NULL;})
 
 #endif /* CONFIG_PROC_FS */
 
Signature · 1 line
2.35.1
author maintainer
#133 lore raw

PATCH 133/521 ALSA: mts64: fix possible null-ptr-defer in snd_mts64_interrupt

In reply to Greg Kroah-Hartman

From: Gaosheng Cui <[email protected]>

[ Upstream commit cf2ea3c86ad90d63d1c572b43e1ca9276b0357ad ]

I got a null-ptr-defer error report when I do the following tests on the qemu platform:

make defconfig and CONFIG_PARPORT=m, CONFIG_PARPORT_PC=m, CONFIG_SND_MTS64=m

Then making test scripts:
cat>test_mod1.sh<<EOF
modprobe snd-mts64
modprobe snd-mts64
EOF

Executing the script, perhaps several times, we will get a null-ptr-defer report, as follow:

syzkaller:~# ./test_mod.sh
snd_mts64: probe of snd_mts64.0 failed with error -5
modprobe: ERROR: could not insert 'snd_mts64': No such device
 BUG: kernel NULL pointer dereference, address: 0000000000000000
 #PF: supervisor write access in kernel mode
 #PF: error_code(0x0002) - not-present page
 PGD 0 P4D 0
 Oops: 0002 [#1] PREEMPT SMP PTI
 CPU: 0 PID: 205 Comm: modprobe Not tainted 6.1.0-rc8-00588-g76dcd734eca2 #6
 Call Trace:
  <IRQ>
  snd_mts64_interrupt+0x24/0xa0 [snd_mts64]
  parport_irq_handler+0x37/0x50 [parport]
  __handle_irq_event_percpu+0x39/0x190
  handle_irq_event_percpu+0xa/0x30
  handle_irq_event+0x2f/0x50
  handle_edge_irq+0x99/0x1b0
  __common_interrupt+0x5d/0x100
  common_interrupt+0xa0/0xc0
  </IRQ>
  <TASK>
  asm_common_interrupt+0x22/0x40
 RIP: 0010:_raw_write_unlock_irqrestore+0x11/0x30
  parport_claim+0xbd/0x230 [parport]
  snd_mts64_probe+0x14a/0x465 [snd_mts64]
  platform_probe+0x3f/0xa0
  really_probe+0x129/0x2c0
  __driver_probe_device+0x6d/0xc0
  driver_probe_device+0x1a/0xa0
  __device_attach_driver+0x7a/0xb0
  bus_for_each_drv+0x62/0xb0
  __device_attach+0xe4/0x180
  bus_probe_device+0x82/0xa0
  device_add+0x550/0x920
  platform_device_add+0x106/0x220
  snd_mts64_attach+0x2e/0x80 [snd_mts64]
  port_check+0x14/0x20 [parport]
  bus_for_each_dev+0x6e/0xc0
  __parport_register_driver+0x7c/0xb0 [parport]
  snd_mts64_module_init+0x31/0x1000 [snd_mts64]
  do_one_initcall+0x3c/0x1f0
  do_init_module+0x46/0x1c6
  load_module+0x1d8d/0x1e10
  __do_sys_finit_module+0xa2/0xf0
  do_syscall_64+0x37/0x90
  entry_SYSCALL_64_after_hwframe+0x63/0xcd
  </TASK>
 Kernel panic - not syncing: Fatal exception in interrupt
 Rebooting in 1 seconds..

The mts wa not initialized during interrupt, we add check for mts to fix this bug.

Fixes 68ab801e32bb ("[ALSA] Add snd-mts64 driver for ESI Miditerminal 4140")
---
 sound/drivers/mts64.c | 3 +++
 1 file changed, 3 insertions(+)
sound/drivers/mts64.c +3 -0
index b68e71ca7abd..7dceb1e1c3b4 100644
@@ -830,6 +830,9 @@ static void snd_mts64_interrupt(void *private)
 	u8 status, data;
 	struct snd_rawmidi_substream *substream;
 
+	if (!mts)
+		return;
+
 	spin_lock(&mts->lock);
 	ret = mts64_read(mts->pardev->port);
 	data = ret & 0x00ff;
Signature · 1 line
2.35.1
author maintainer
#142 lore raw

PATCH 142/521 mmc: atmel-mci: fix return value check of mmc_add_host()

In reply to Greg Kroah-Hartman

From: Yang Yingliang <[email protected]>

[ Upstream commit 9e6e8c43726673ca2abcaac87640b9215fd72f4c ]

mmc_add_host() may return error, if we ignore its return value, it will lead two issues:
1. The memory that allocated in mmc_alloc_host() is leaked.
2. In the remove() path, mmc_remove_host() will be called to delete device, but it's not added yet, it will lead a kernel crash because of null-ptr-deref in device_del().

So fix this by checking the return value and calling mmc_free_host() in the error path.

Fixes 7d2be0749a59 ("atmel-mci: Driver for Atmel on-chip MMC controllers")
---
 drivers/mmc/host/atmel-mci.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/mmc/host/atmel-mci.c +6 -3
index fbc56ee99682..d40bab3d9f4a 100644
@@ -2262,6 +2262,7 @@ static int atmci_init_slot(struct atmel_mci *host,
 {
 	struct mmc_host			*mmc;
 	struct atmel_mci_slot		*slot;
+	int ret;
 
 	mmc = mmc_alloc_host(sizeof(struct atmel_mci_slot), &host->pdev->dev);
 	if (!mmc)
@@ -2342,11 +2343,13 @@ static int atmci_init_slot(struct atmel_mci *host,
 
 	host->slot[id] = slot;
 	mmc_regulator_get_supply(mmc);
-	mmc_add_host(mmc);
+	ret = mmc_add_host(mmc);
+	if (ret) {
+		mmc_free_host(mmc);
+		return ret;
+	}
 
 	if (gpio_is_valid(slot->detect_pin)) {
-		int ret;
-
 		timer_setup(&slot->detect_timer, atmci_detect_change, 0);
 
 		ret = request_irq(gpio_to_irq(slot->detect_pin),
Signature · 1 line
2.35.1
author maintainer
#143 lore raw

PATCH 143/521 mmc: meson-gx: fix return value check of mmc_add_host()

In reply to Greg Kroah-Hartman

From: Yang Yingliang <[email protected]>

[ Upstream commit 90935f16f2650ab7416fa2ffbe5c28cb39cf3f1e ]

mmc_add_host() may return error, if we ignore its return value, it will lead two issues:
1. The memory that allocated in mmc_alloc_host() is leaked.
2. In the remove() path, mmc_remove_host() will be called to delete device, but it's not added yet, it will lead a kernel crash because of null-ptr-deref in device_del().

Fix this by checking the return value and goto error path which will call mmc_free_host().

Fixes 51c5d8447bd7 ("MMC: meson: initial support for GX platforms")
---
 drivers/mmc/host/meson-gx-mmc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/mmc/host/meson-gx-mmc.c +3 -1
index 72f34a58928c..dba98c2886f2 100644
@@ -1370,7 +1370,9 @@ static int meson_mmc_probe(struct platform_device *pdev)
 	}
 
 	mmc->ops = &meson_mmc_ops;
-	mmc_add_host(mmc);
+	ret = mmc_add_host(mmc);
+	if (ret)
+		goto err_free_irq;
 
 	return 0;
 
Signature · 1 line
2.35.1
author maintainer
#144 lore raw

PATCH 144/521 mmc: via-sdmmc: fix return value check of mmc_add_host()

In reply to Greg Kroah-Hartman

From: Yang Yingliang <[email protected]>

[ Upstream commit e4e46fb61e3bb4628170810d3f2b996b709b90d9 ]

mmc_add_host() may return error, if we ignore its return value, it will lead two issues:
1. The memory that allocated in mmc_alloc_host() is leaked.
2. In the remove() path, mmc_remove_host() will be called to delete device, but it's not added yet, it will lead a kernel crash because of null-ptr-deref in device_del().

Fix this by checking the return value and goto error path which will call mmc_free_host().

Fixes f0bf7f61b840 ("mmc: Add new via-sdmmc host controller driver")
---
 drivers/mmc/host/via-sdmmc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/mmc/host/via-sdmmc.c +3 -1
index 1b66466d2ed4..b78e96b5289b 100644
@@ -1166,7 +1166,9 @@ static int via_sd_probe(struct pci_dev *pcidev,
 	    pcidev->subsystem_device == 0x3891)
 		sdhost->quirks = VIA_CRDR_QUIRK_300MS_PWRDELAY;
 
-	mmc_add_host(mmc);
+	ret = mmc_add_host(mmc);
+	if (ret)
+		goto unmap;
 
 	return 0;
 
Signature · 1 line
2.35.1
author maintainer
#145 lore raw

PATCH 145/521 mmc: wbsd: fix return value check of mmc_add_host()

In reply to Greg Kroah-Hartman

From: Yang Yingliang <[email protected]>

[ Upstream commit dc5b9b50fc9d1334407e316e6e29a5097ef833bd ]

mmc_add_host() may return error, if we ignore its return value, it will lead two issues:
1. The memory that allocated in mmc_alloc_host() is leaked.
2. In the remove() path, mmc_remove_host() will be called to delete device, but it's not added yet, it will lead a kernel crash because of null-ptr-deref in device_del().

So fix this by checking the return value and goto error path which will call mmc_free_host(), besides, other resources also need be released.

---
 drivers/mmc/host/wbsd.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/mmc/host/wbsd.c +11 -1
index 1e54bbf13d75..9b15431d961c 100644
@@ -1706,7 +1706,17 @@ static int wbsd_init(struct device *dev, int base, int irq, int dma,
 	 */
 	wbsd_init_device(host);
 
-	mmc_add_host(mmc);
+	ret = mmc_add_host(mmc);
+	if (ret) {
+		if (!pnp)
+			wbsd_chip_poweroff(host);
+
+		wbsd_release_resources(host);
+		wbsd_free_mmc(dev);
+
+		mmc_free_host(mmc);
+		return ret;
+	}
 
 	pr_info("%s: W83L51xD", mmc_hostname(mmc));
 	if (host->chip_id != 0)
Signature · 1 line
2.35.1
author maintainer
#146 lore raw

PATCH 146/521 mmc: mmci: fix return value check of mmc_add_host()

In reply to Greg Kroah-Hartman

From: Yang Yingliang <[email protected]>

[ Upstream commit b38a20f29a49ae04d23750d104b25400b792b98c ]

mmc_add_host() may return error, if we ignore its return value, it will lead two issues:
1. The memory that allocated in mmc_alloc_host() is leaked.
2. In the remove() path, mmc_remove_host() will be called to delete device, but it's not added yet, it will lead a kernel crash because of null-ptr-deref in device_del().

So fix this by checking the return value and goto error path which will call mmc_free_host().

---
 drivers/mmc/host/mmci.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/mmc/host/mmci.c +3 -1
index fa6268c0f123..434ba4a39ded 100644
@@ -1808,7 +1808,9 @@ static int mmci_probe(struct amba_device *dev,
 	pm_runtime_set_autosuspend_delay(&dev->dev, 50);
 	pm_runtime_use_autosuspend(&dev->dev);
 
-	mmc_add_host(mmc);
+	ret = mmc_add_host(mmc);
+	if (ret)
+		goto clk_disable;
 
 	pm_runtime_put(&dev->dev);
 	return 0;
Signature · 1 line
2.35.1
author maintainer
#147 lore raw

PATCH 147/521 media: c8sectpfe: Add of_node_put() when breaking out of loop

In reply to Greg Kroah-Hartman

From: Liang He <[email protected]>

[ Upstream commit 63ff05a1ad242a5a0f897921c87b70d601bda59c ]

In configure_channels(), we should call of_node_put() when breaking out of for_each_child_of_node() which will automatically increase and decrease the refcount.

Fixes c5f5d0f99794 ("[media] c8sectpfe: STiH407/10 Linux DVB demux support")
---
 drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c | 1 +
 1 file changed, 1 insertion(+)
drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c +1 -0
index 3c05b3dc49ec..98c14565bbfd 100644
@@ -943,6 +943,7 @@ static int configure_channels(struct c8sectpfei *fei)
 		if (ret) {
 			dev_err(fei->dev,
 				"configure_memdma_and_inputblock failed\n");
+			of_node_put(child);
 			goto err_unmap;
 		}
 		index++;
Signature · 1 line
2.35.1
author maintainer
#148 lore raw

PATCH 148/521 media: coda: Add check for dcoda_iram_alloc

In reply to Greg Kroah-Hartman

From: Jiasheng Jiang <[email protected]>

[ Upstream commit 6b8082238fb8bb20f67e46388123e67a5bbc558d ]

As the coda_iram_alloc may return NULL pointer, it should be better to check the return value
in order to avoid NULL poineter dereference, same as the others.

Fixes b313bcc9a467 ("[media] coda: simplify IRAM setup")
---
 drivers/media/platform/coda/coda-bit.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/platform/coda/coda-bit.c +2 -2
index c3eaddced721..57b62076b1ba 100644
@@ -670,7 +670,7 @@ static void coda_setup_iram(struct coda_ctx *ctx)
 		/* Only H.264BP and H.263P3 are considered */
 		iram_info->buf_dbk_y_use = coda_iram_alloc(iram_info, w64);
 		iram_info->buf_dbk_c_use = coda_iram_alloc(iram_info, w64);
-		if (!iram_info->buf_dbk_c_use)
+		if (!iram_info->buf_dbk_y_use || !iram_info->buf_dbk_c_use)
 			goto out;
 		iram_info->axi_sram_use |= dbk_bits;
 
@@ -694,7 +694,7 @@ static void coda_setup_iram(struct coda_ctx *ctx)
 
 		iram_info->buf_dbk_y_use = coda_iram_alloc(iram_info, w128);
 		iram_info->buf_dbk_c_use = coda_iram_alloc(iram_info, w128);
-		if (!iram_info->buf_dbk_c_use)
+		if (!iram_info->buf_dbk_y_use || !iram_info->buf_dbk_c_use)
 			goto out;
 		iram_info->axi_sram_use |= dbk_bits;
 
Signature · 1 line
2.35.1
author maintainer
#149 lore raw

PATCH 149/521 media: coda: Add check for kmalloc

In reply to Greg Kroah-Hartman

From: Jiasheng Jiang <[email protected]>

[ Upstream commit 6e5e5defdb8b0186312c2f855ace175aee6daf9b ]

As the kmalloc may return NULL pointer,
it should be better to check the return value
in order to avoid NULL poineter dereference,
same as the others.

Fixes cb1d3a336371 ("[media] coda: add CODA7541 JPEG support")
---
 drivers/media/platform/coda/coda-bit.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/media/platform/coda/coda-bit.c +8 -2
index 57b62076b1ba..e73bf8e14f33 100644
@@ -901,10 +901,16 @@ static int coda_start_encoding(struct coda_ctx *ctx)
 	}
 
 	if (dst_fourcc == V4L2_PIX_FMT_JPEG) {
-		if (!ctx->params.jpeg_qmat_tab[0])
+		if (!ctx->params.jpeg_qmat_tab[0]) {
 			ctx->params.jpeg_qmat_tab[0] = kmalloc(64, GFP_KERNEL);
-		if (!ctx->params.jpeg_qmat_tab[1])
+			if (!ctx->params.jpeg_qmat_tab[0])
+				return -ENOMEM;
+		}
+		if (!ctx->params.jpeg_qmat_tab[1]) {
 			ctx->params.jpeg_qmat_tab[1] = kmalloc(64, GFP_KERNEL);
+			if (!ctx->params.jpeg_qmat_tab[1])
+				return -ENOMEM;
+		}
 		coda_set_jpeg_compression_quality(ctx, ctx->params.jpeg_quality);
 	}
 
Signature · 1 line
2.35.1
author maintainer
#150 lore raw

PATCH 150/521 clk: samsung: Fix memory leak in _samsung_clk_register_pll()

In reply to Greg Kroah-Hartman

From: Xiu Jianfeng <[email protected]>

[ Upstream commit 5174e5b0d1b669a489524192b6adcbb3c54ebc72 ]

If clk_register() fails, @pll->rate_table may have allocated memory by kmemdup(), so it needs to be freed, otherwise will cause memory leak issue, this patch fixes it.

Fixes 3ff6e0d8d64d ("clk: samsung: Add support to register rate_table for samsung plls")
---
 drivers/clk/samsung/clk-pll.c | 1 +
 1 file changed, 1 insertion(+)
drivers/clk/samsung/clk-pll.c +1 -0
index 1c4c7a3039f1..8cbf0f2cf196 100644
@@ -1392,6 +1392,7 @@ static void __init _samsung_clk_register_pll(struct samsung_clk_provider *ctx,
 	if (ret) {
 		pr_err("%s: failed to register pll clock %s : %d\n",
 			__func__, pll_clk->name, ret);
+		kfree(pll->rate_table);
 		kfree(pll);
 		return;
 	}
Signature · 1 line
2.35.1
author maintainer
#151 lore raw

PATCH 151/521 wifi: rtl8xxxu: Add __packed to struct rtl8723bu_c2h

In reply to Greg Kroah-Hartman

From: Bitterblue Smith <[email protected]>

[ Upstream commit dd469a754afdb782ba3033cee102147493dc39f4 ]

This struct is used to access a sequence of bytes received from the wifi chip. It must not have any padding bytes between the members.

This doesn't change anything on my system, possibly because currently none of the members need more than byte alignment.

Fixes b2b43b7837ba ("rtl8xxxu: Initial functionality to handle C2H events for 8723bu")
---
 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h +1 -1
index bd28deff9b8c..7eef3f7c36ad 100644
@@ -1186,7 +1186,7 @@ struct rtl8723bu_c2h {
 			u8 dummy3_0;
 		} __packed ra_report;
 	};
-};
+} __packed;
 
 struct rtl8xxxu_fileops;
 
Signature · 1 line
2.35.1
author maintainer
#134 lore raw

PATCH 134/521 SUNRPC: Fix missing release socket in rpc_sockname()

In reply to Greg Kroah-Hartman

From: Wang ShaoBo <[email protected]>

[ Upstream commit 50fa355bc0d75911fe9d5072a5ba52cdb803aff7 ]

socket dynamically created is not released when getting an unintended address family type in rpc_sockname(), direct to out_release for calling sock_release().

Fixes 2e738fdce22f ("SUNRPC: Add API to acquire source address")
---
 net/sunrpc/clnt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/sunrpc/clnt.c +1 -1
index 0d7d149b1b1b..1946bd13d5df 100644
@@ -1267,7 +1267,7 @@ static int rpc_sockname(struct net *net, struct sockaddr *sap, size_t salen,
 		break;
 	default:
 		err = -EAFNOSUPPORT;
-		goto out;
+		goto out_release;
 	}
 	if (err < 0) {
 		dprintk("RPC:       can't bind UDP socket (%d)\n", err);
Signature · 1 line
2.35.1
author maintainer
#152 lore raw

PATCH 152/521 rtl8xxxu: add enumeration for channel bandwidth

In reply to Greg Kroah-Hartman

From: Chris Chiu <[email protected]>

[ Upstream commit a66b8b4108f178f34394681232c7df07e9b0f6be ]

There's a data field in H2C and C2H commands which is used to carry channel bandwidth information. Add enumeration to make it more descriptive in code.

---
 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h      | 9 +++++++++
 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 2 +-
 2 files changed, 10 insertions(+), 1 deletion(-)
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h +9 -0
index 7eef3f7c36ad..921a226b18f8 100644
@@ -1136,6 +1136,15 @@ enum bt_mp_oper_opcode_8723b {
 	BT_MP_OP_ENABLE_CFO_TRACKING = 0x24,
 };
 
+enum rtl8xxxu_bw_mode {
+	RTL8XXXU_CHANNEL_WIDTH_20 = 0,
+	RTL8XXXU_CHANNEL_WIDTH_40 = 1,
+	RTL8XXXU_CHANNEL_WIDTH_80 = 2,
+	RTL8XXXU_CHANNEL_WIDTH_160 = 3,
+	RTL8XXXU_CHANNEL_WIDTH_80_80 = 4,
+	RTL8XXXU_CHANNEL_WIDTH_MAX = 5,
+};
+
 struct rtl8723bu_c2h {
 	u8 id;
 	u8 seq;
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +1 -1
index fb8545f79fa6..c3c8382dd0ba 100644
@@ -4333,7 +4333,7 @@ void rtl8xxxu_gen2_update_rate_mask(struct rtl8xxxu_priv *priv,
 				    u32 ramask, int sgi)
 {
 	struct h2c_cmd h2c;
-	u8 bw = 0;
+	u8 bw = RTL8XXXU_CHANNEL_WIDTH_20;
 
 	memset(&h2c, 0, sizeof(struct h2c_cmd));
 
Signature · 1 line
2.35.1
author maintainer
#153 lore raw

PATCH 153/521 wifi: brcmfmac: Fix error return code in brcmf_sdio_download_firmware()

In reply to Greg Kroah-Hartman

From: Wang Yufen <[email protected]>

[ Upstream commit c2f2924bc7f9ea75ef8d95863e710168f8196256 ]

Fix to return a negative error code instead of 0 when brcmf_chip_set_active() fails. In addition, change the return value for brcmf_pcie_exit_download_state() to keep consistent.

Fixes d380ebc9b6fb ("brcmfmac: rename chip download functions")
---
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 2 +-
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +1 -1
index a21529d2ccab..6ee04af85e9d 100644
@@ -612,7 +612,7 @@ static int brcmf_pcie_exit_download_state(struct brcmf_pciedev_info *devinfo,
 	}
 
 	if (!brcmf_chip_set_active(devinfo->ci, resetintr))
-		return -EINVAL;
+		return -EIO;
 	return 0;
 }
 
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +1 -0
index 0a96c1071e5b..6eb1daf51301 100644
@@ -3337,6 +3337,7 @@ static int brcmf_sdio_download_firmware(struct brcmf_sdio *bus,
 	/* Take arm out of reset */
 	if (!brcmf_chip_set_active(bus->ci, rstvec)) {
 		brcmf_err("error getting out of ARM core reset\n");
+		bcmerror = -EIO;
 		goto err;
 	}
 
Signature · 1 line
2.35.1
author maintainer
#154 lore raw

PATCH 154/521 blktrace: Fix output non-blktrace event when blk_classic option enabled

In reply to Greg Kroah-Hartman

From: Yang Jihong <[email protected]>

[ Upstream commit f596da3efaf4130ff61cd029558845808df9bf99 ]

When the blk_classic option is enabled, non-blktrace events must be filtered out. Otherwise, events of other types are output in the blktrace classic format, which is unexpected.

The problem can be triggered in the following ways:

  # echo 1 > /sys/kernel/debug/tracing/options/blk_classic
  # echo 1 > /sys/kernel/debug/tracing/events/enable
  # echo blk > /sys/kernel/debug/tracing/current_tracer
  # cat /sys/kernel/debug/tracing/trace_pipe
---
 kernel/trace/blktrace.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/trace/blktrace.c +2 -1
index 75ea1a5be31a..113cbe1a20aa 100644
@@ -1594,7 +1594,8 @@ blk_trace_event_print_binary(struct trace_iterator *iter, int flags,
 
 static enum print_line_t blk_tracer_print_line(struct trace_iterator *iter)
 {
-	if (!(blk_tracer_flags.val & TRACE_BLK_OPT_CLASSIC))
+	if ((iter->ent->type != TRACE_BLK) ||
+	    !(blk_tracer_flags.val & TRACE_BLK_OPT_CLASSIC))
 		return TRACE_TYPE_UNHANDLED;
 
 	return print_one_line(iter, true);
Signature · 1 line
2.35.1
author maintainer
#155 lore raw

PATCH 155/521 clk: socfpga: clk-pll: Remove unused variable rc

In reply to Greg Kroah-Hartman

From: Lee Jones <[email protected]>

[ Upstream commit 75fddccbca32349570b2d53955982b4117fa5515 ]

Fixes the following W=1 kernel build warning(s):

drivers/clk/socfpga/clk-pll.c: In function ‘__socfpga_pll_init’:
drivers/clk/socfpga/clk-pll.c:83:6: warning: variable ‘rc’ set but not used [-Wunused-but-set-variable]

---
 drivers/clk/socfpga/clk-pll.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/clk/socfpga/clk-pll.c +1 -2
index b4b44e9b5901..973c4713d085 100644
@@ -90,7 +90,6 @@ static __init struct clk *__socfpga_pll_init(struct device_node *node,
 	const char *parent_name[SOCFPGA_MAX_PARENTS];
 	struct clk_init_data init;
 	struct device_node *clkmgr_np;
-	int rc;
 
 	of_property_read_u32(node, "reg", &reg);
 
@@ -123,7 +122,7 @@ static __init struct clk *__socfpga_pll_init(struct device_node *node,
 		kfree(pll_clk);
 		return NULL;
 	}
-	rc = of_clk_add_provider(node, of_clk_src_simple_get, clk);
+	of_clk_add_provider(node, of_clk_src_simple_get, clk);
 	return clk;
 }
 
Signature · 1 line
2.35.1
author maintainer
#156 lore raw

PATCH 156/521 clk: socfpga: use clk_hw_register for a5/c5

In reply to Greg Kroah-Hartman

From: Dinh Nguyen <[email protected]>

[ Upstream commit 2c2b9c6067170de2a63e7e3d9f5bb205b870de7c ]

As recommended by Stephen Boyd, convert the cyclone5/arria5 clock driver to use the clk_hw registration method.

---
 drivers/clk/socfpga/clk-gate.c   | 11 +++++++----
 drivers/clk/socfpga/clk-periph.c |  8 ++++----
 drivers/clk/socfpga/clk-pll.c    | 18 +++++++++++-------
 3 files changed, 22 insertions(+), 15 deletions(-)
drivers/clk/socfpga/clk-gate.c +7 -4
index 14918896811d..139b009eda82 100644
@@ -183,12 +183,13 @@ static void __init __socfpga_gate_init(struct device_node *node,
 	u32 div_reg[3];
 	u32 clk_phase[2];
 	u32 fixed_div;
-	struct clk *clk;
+	struct clk_hw *hw_clk;
 	struct socfpga_gate_clk *socfpga_clk;
 	const char *clk_name = node->name;
 	const char *parent_name[SOCFPGA_MAX_PARENTS];
 	struct clk_init_data init;
 	int rc;
+	int err;
 
 	socfpga_clk = kzalloc(sizeof(*socfpga_clk), GFP_KERNEL);
 	if (WARN_ON(!socfpga_clk))
@@ -237,12 +238,14 @@ static void __init __socfpga_gate_init(struct device_node *node,
 	init.parent_names = parent_name;
 	socfpga_clk->hw.hw.init = &init;
 
-	clk = clk_register(NULL, &socfpga_clk->hw.hw);
-	if (WARN_ON(IS_ERR(clk))) {
+	hw_clk = &socfpga_clk->hw.hw;
+
+	err = clk_hw_register(NULL, hw_clk);
+	if (err) {
 		kfree(socfpga_clk);
 		return;
 	}
-	rc = of_clk_add_provider(node, of_clk_src_simple_get, clk);
+	rc = of_clk_add_provider(node, of_clk_src_simple_get, hw_clk);
 	if (WARN_ON(rc))
 		return;
 }
drivers/clk/socfpga/clk-periph.c +4 -4
index 52c883ea7706..912c3059cbe4 100644
@@ -61,7 +61,7 @@ static __init void __socfpga_periph_init(struct device_node *node,
 	const struct clk_ops *ops)
 {
 	u32 reg;
-	struct clk *clk;
+	struct clk_hw *hw_clk;
 	struct socfpga_periph_clk *periph_clk;
 	const char *clk_name = node->name;
 	const char *parent_name[SOCFPGA_MAX_PARENTS];
@@ -104,13 +104,13 @@ static __init void __socfpga_periph_init(struct device_node *node,
 	init.parent_names = parent_name;
 
 	periph_clk->hw.hw.init = &init;
+	hw_clk = &periph_clk->hw.hw;
 
-	clk = clk_register(NULL, &periph_clk->hw.hw);
-	if (WARN_ON(IS_ERR(clk))) {
+	if (clk_hw_register(NULL, hw_clk)) {
 		kfree(periph_clk);
 		return;
 	}
-	rc = of_clk_add_provider(node, of_clk_src_simple_get, clk);
+	rc = of_clk_add_provider(node, of_clk_src_simple_get, hw_clk);
 }
 
 void __init socfpga_periph_init(struct device_node *node)
drivers/clk/socfpga/clk-pll.c +11 -7
index 973c4713d085..7bde8ca45d4b 100644
@@ -80,16 +80,18 @@ static struct clk_ops clk_pll_ops = {
 	.get_parent = clk_pll_get_parent,
 };
 
-static __init struct clk *__socfpga_pll_init(struct device_node *node,
+static __init struct clk_hw *__socfpga_pll_init(struct device_node *node,
 	const struct clk_ops *ops)
 {
 	u32 reg;
-	struct clk *clk;
+	struct clk_hw *hw_clk;
 	struct socfpga_pll *pll_clk;
 	const char *clk_name = node->name;
 	const char *parent_name[SOCFPGA_MAX_PARENTS];
 	struct clk_init_data init;
 	struct device_node *clkmgr_np;
+	int rc;
+	int err;
 
 	of_property_read_u32(node, "reg", &reg);
 
@@ -117,13 +119,15 @@ static __init struct clk *__socfpga_pll_init(struct device_node *node,
 	clk_pll_ops.enable = clk_gate_ops.enable;
 	clk_pll_ops.disable = clk_gate_ops.disable;
 
-	clk = clk_register(NULL, &pll_clk->hw.hw);
-	if (WARN_ON(IS_ERR(clk))) {
+	hw_clk = &pll_clk->hw.hw;
+
+	err = clk_hw_register(NULL, hw_clk);
+	if (err) {
 		kfree(pll_clk);
-		return NULL;
+		return ERR_PTR(err);
 	}
-	of_clk_add_provider(node, of_clk_src_simple_get, clk);
-	return clk;
+	rc = of_clk_add_provider(node, of_clk_src_simple_get, hw_clk);
+	return hw_clk;
 }
 
 void __init socfpga_pll_init(struct device_node *node)
Signature · 1 line
2.35.1
author maintainer
#157 lore raw

PATCH 157/521 net: vmw_vsock: vmci: Check memcpy_from_msg()

In reply to Greg Kroah-Hartman

From: Artem Chernyshev <[email protected]>

[ Upstream commit 44aa5a6dba8283bfda28b1517af4de711c5652a4 ]

vmci_transport_dgram_enqueue() does not check the return value of memcpy_from_msg(). If memcpy_from_msg() fails, it is possible that uninitialized memory contents are sent unintentionally instead of user's message in the datagram to the destination. Return with an error if memcpy_from_msg() fails.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes 0f7db23a07af ("vmci_transport: switch ->enqeue_dgram, ->enqueue_stream and ->dequeue_stream to msghdr")
---
 net/vmw_vsock/vmci_transport.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
net/vmw_vsock/vmci_transport.c +5 -1
index 42ab3e2ac060..2a8127f245e8 100644
@@ -1733,7 +1733,11 @@ static int vmci_transport_dgram_enqueue(
 	if (!dg)
 		return -ENOMEM;
 
-	memcpy_from_msg(VMCI_DG_PAYLOAD(dg), msg, len);
+	err = memcpy_from_msg(VMCI_DG_PAYLOAD(dg), msg, len);
+	if (err) {
+		kfree(dg);
+		return err;
+	}
 
 	dg->dst = vmci_make_handle(remote_addr->svm_cid,
 				   remote_addr->svm_port);
Signature · 1 line
2.35.1
author maintainer
#158 lore raw

PATCH 158/521 net: defxx: Fix missing err handling in dfx_init()

In reply to Greg Kroah-Hartman

From: Yongqiang Liu <[email protected]>

[ Upstream commit ae18dcdff0f8d7e84cd3fd9f496518b5e72d185d ]

When eisa_driver_register() or tc_register_driver() failed, the modprobe defxx would fail with some err log as follows:

Error: Driver 'defxx' is already registered, aborting...

Fix this issue by adding err hanling in dfx_init().

Fixes e89a2cfb7d7b5 ("[TC] defxx: TURBOchannel support")
---
 drivers/net/fddi/defxx.c | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)
drivers/net/fddi/defxx.c +18 -4
index 3b48c890540a..7f14aad1c240 100644
@@ -3844,10 +3844,24 @@ static int dfx_init(void)
 	int status;
 
 	status = pci_register_driver(&dfx_pci_driver);
-	if (!status)
-		status = eisa_driver_register(&dfx_eisa_driver);
-	if (!status)
-		status = tc_register_driver(&dfx_tc_driver);
+	if (status)
+		goto err_pci_register;
+
+	status = eisa_driver_register(&dfx_eisa_driver);
+	if (status)
+		goto err_eisa_register;
+
+	status = tc_register_driver(&dfx_tc_driver);
+	if (status)
+		goto err_tc_register;
+
+	return 0;
+
+err_tc_register:
+	eisa_driver_unregister(&dfx_eisa_driver);
+err_eisa_register:
+	pci_unregister_driver(&dfx_pci_driver);
+err_pci_register:
 	return status;
 }
 
Signature · 1 line
2.35.1
author maintainer
#159 lore raw

PATCH 159/521 drivers: net: qlcnic: Fix potential memory leak in qlcnic_sriov_init()

In reply to Greg Kroah-Hartman

From: Yuan Can <[email protected]>

[ Upstream commit 01de1123322e4fe1bbd0fcdf0982511b55519c03 ]

If vp alloc failed in qlcnic_sriov_init(), all previously allocated vp needs to be freed.

Fixes f197a7aa6288 ("qlcnic: VF-PF communication channel implementation")
---
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c +2 -0
index 98275f18a87b..d28c4436f965 100644
@@ -222,6 +222,8 @@ int qlcnic_sriov_init(struct qlcnic_adapter *adapter, int num_vfs)
 	return 0;
 
 qlcnic_destroy_async_wq:
+	while (i--)
+		kfree(sriov->vf_info[i].vp);
 	destroy_workqueue(bc->bc_async_wq);
 
 qlcnic_destroy_trans_wq:
Signature · 1 line
2.35.1
author maintainer
#160 lore raw

PATCH 160/521 ethernet: s2io: dont call dev_kfree_skb() under spin_lock_irqsave()

In reply to Greg Kroah-Hartman

From: Yang Yingliang <[email protected]>

[ Upstream commit 6cee96e09df54ae17784c0f38a49e0ed8229b825 ]

It is not allowed to call kfree_skb() or consume_skb() from hardware interrupt context or with hardware interrupts being disabled.

It should use dev_kfree_skb_irq() or dev_consume_skb_irq() instead. The difference between them is free reason, dev_kfree_skb_irq() means the SKB is dropped in error and dev_consume_skb_irq() means the SKB is consumed in normal.

In this case, dev_kfree_skb() is called in free_tx_buffers() to drop the SKBs in tx buffers, when the card is down, so replace it with dev_kfree_skb_irq() here.

Fixes 1da177e4c3f4 ("Linux-2.6.12-rc2")
---
 drivers/net/ethernet/neterion/s2io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/neterion/s2io.c +1 -1
index 0a8483c615d4..b42f81d0c6f0 100644
@@ -2375,7 +2375,7 @@ static void free_tx_buffers(struct s2io_nic *nic)
 			skb = s2io_txdl_getskb(&mac_control->fifos[i], txdp, j);
 			if (skb) {
 				swstats->mem_freed += skb->truesize;
-				dev_kfree_skb(skb);
+				dev_kfree_skb_irq(skb);
 				cnt++;
 			}
 		}
Signature · 1 line
2.35.1
author maintainer
#161 lore raw

PATCH 161/521 net: farsync: Fix kmemleak when rmmods farsync

In reply to Greg Kroah-Hartman

From: Li Zetao <[email protected]>

[ Upstream commit 2f623aaf9f31de968dea6169849706a2f9be444c ]

There are two memory leaks reported by kmemleak:

unreferenced object 0xffff888114b20200 (size 128):

    comm "modprobe", pid 4846, jiffies 4295146524 (age 401.345s)
    hex dump (first 32 bytes):
      e0 62 57 09 81 88 ff ff e0 62 57 09 81 88 ff ff  .bW......bW.....
      01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    backtrace:
      [<ffffffff815bcd82>] kmalloc_trace+0x22/0x60
      [<ffffffff83d35c78>] __hw_addr_add_ex+0x198/0x6c0
      [<ffffffff83d3989d>] dev_addr_init+0x13d/0x230
      [<ffffffff83d1063d>] alloc_netdev_mqs+0x10d/0xe50
      [<ffffffff82b4a06e>] alloc_hdlcdev+0x2e/0x80
      [<ffffffffa016a741>] fst_add_one+0x601/0x10e0 [farsync]
      ...

unreferenced object 0xffff88810b85b000 (size 1024):

    comm "modprobe", pid 4846, jiffies 4295146523 (age 401.346s)
    hex dump (first 32 bytes):
      00 00 b0 02 00 c9 ff ff 00 70 0a 00 00 c9 ff ff  .........p......
      00 00 00 f2 00 00 00 f3 0a 00 00 00 02 00 00 00  ................
    backtrace:
      [<ffffffff815bcd82>] kmalloc_trace+0x22/0x60
      [<ffffffffa016a294>] fst_add_one+0x154/0x10e0 [farsync]
      [<ffffffff82060e83>] local_pci_probe+0xd3/0x170
      ...

The root cause is traced to the netdev and fst_card_info are not freed when removes one fst in fst_remove_one(), which may trigger oom if repeated insmod and rmmod module.

Fix it by adding free_netdev() and kfree() in fst_remove_one(), just as the operations on the error handling path in fst_add_one().

Fixes 1da177e4c3f4 ("Linux-2.6.12-rc2")
---
 drivers/net/wan/farsync.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/wan/farsync.c +2 -0
index 2a3f0f1a2b0a..bc249f81c80d 100644
@@ -2617,6 +2617,7 @@ fst_remove_one(struct pci_dev *pdev)
 	for (i = 0; i < card->nports; i++) {
 		struct net_device *dev = port_to_dev(&card->ports[i]);
 		unregister_hdlc_device(dev);
+		free_netdev(dev);
 	}
 
 	fst_disable_intr(card);
@@ -2637,6 +2638,7 @@ fst_remove_one(struct pci_dev *pdev)
 				    card->tx_dma_handle_card);
 	}
 	fst_card_array[card->card_no] = NULL;
+	kfree(card);
 }
 
 static struct pci_driver fst_driver = {
Signature · 1 line
2.35.1
author maintainer
#135 lore raw

PATCH 135/521 NFSv4.x: Fail client initialisation if state manager thread cant run

In reply to Greg Kroah-Hartman

From: Trond Myklebust <[email protected]>

[ Upstream commit b4e4f66901658fae0614dea5bf91062a5387eda7 ]

If the state manager thread fails to start, then we should just mark the client initialisation as failed so that other processes or threads don't get stuck in nfs_wait_client_init_complete().

Fixes 4697bd5e9419 ("NFSv4: Fix a race in the net namespace mount notification")
---
 fs/nfs/nfs4state.c | 2 ++
 1 file changed, 2 insertions(+)
fs/nfs/nfs4state.c +2 -0
index 5ab021f87ecf..b9fbd01ef4cf 100644
@@ -1247,6 +1247,8 @@ void nfs4_schedule_state_manager(struct nfs_client *clp)
 	if (IS_ERR(task)) {
 		printk(KERN_ERR "%s: kthread_run: %ld\n",
 			__func__, PTR_ERR(task));
+		if (!nfs_client_init_is_complete(clp))
+			nfs_mark_client_ready(clp, PTR_ERR(task));
 		nfs4_clear_state_manager_bit(clp);
 		nfs_put_client(clp);
 		module_put(THIS_MODULE);
Signature · 1 line
2.35.1
author maintainer
#162 lore raw

PATCH 162/521 net/tunnel: wait until all sk_user_data reader finish before releasing the sock

In reply to Greg Kroah-Hartman

From: Hangbin Liu <[email protected]>

[ Upstream commit 3cf7203ca620682165706f70a1b12b5194607dce ]

There is a race condition in vxlan that when deleting a vxlan device during receiving packets, there is a possibility that the sock is released after getting vxlan_sock vs from sk_user_data. Then in later vxlan_ecn_decapsulate(), vxlan_get_sk_family() we will got NULL pointer dereference. e.g.

#0 [ffffa25ec6978a38] machine_kexec at ffffffff8c669757 #1 [ffffa25ec6978a90] __crash_kexec at ffffffff8c7c0a4d #2 [ffffa25ec6978b58] crash_kexec at ffffffff8c7c1c48 #3 [ffffa25ec6978b60] oops_end at ffffffff8c627f2b #4 [ffffa25ec6978b80] page_fault_oops at ffffffff8c678fcb #5 [ffffa25ec6978bd8] exc_page_fault at ffffffff8d109542 #6 [ffffa25ec6978c00] asm_exc_page_fault at ffffffff8d200b62

      [exception RIP: vxlan_ecn_decapsulate+0x3b]
      RIP: ffffffffc1014e7b  RSP: ffffa25ec6978cb0  RFLAGS: 00010246
      RAX: 0000000000000008  RBX: ffff8aa000888000  RCX: 0000000000000000
      RDX: 000000000000000e  RSI: ffff8a9fc7ab803e  RDI: ffff8a9fd1168700
      RBP: ffff8a9fc7ab803e   R8: 0000000000700000   R9: 00000000000010ae
      R10: ffff8a9fcb748980  R11: 0000000000000000  R12: ffff8a9fd1168700
      R13: ffff8aa000888000  R14: 00000000002a0000  R15: 00000000000010ae
      ORIG_RAX: ffffffffffffffff  CS: 0010  SS: 0018

#7 [ffffa25ec6978ce8] vxlan_rcv at ffffffffc10189cd [vxlan] #8 [ffffa25ec6978d90] udp_queue_rcv_one_skb at ffffffff8cfb6507 #9 [ffffa25ec6978dc0] udp_unicast_rcv_skb at ffffffff8cfb6e45
#10 [ffffa25ec6978dc8] __udp4_lib_rcv at ffffffff8cfb8807 #11 [ffffa25ec6978e20] ip_protocol_deliver_rcu at ffffffff8cf76951 #12 [ffffa25ec6978e48] ip_local_deliver at ffffffff8cf76bde #13 [ffffa25ec6978ea0] __netif_receive_skb_one_core at ffffffff8cecde9b #14 [ffffa25ec6978ec8] process_backlog at ffffffff8cece139 #15 [ffffa25ec6978f00] __napi_poll at ffffffff8ceced1a
#16 [ffffa25ec6978f28] net_rx_action at ffffffff8cecf1f3 #17 [ffffa25ec6978fa0] __softirqentry_text_start at ffffffff8d4000ca #18 [ffffa25ec6978ff0] do_softirq at ffffffff8c6fbdc3

Reproducer: https://github.com/Mellanox/ovs-tests/blob/master/test-ovs-vxlan-remove-tunnel-during-traffic.sh

Fix this by waiting for all sk_user_data reader to finish before releasing the sock.

Fixes 6a93cc905274 ("udp-tunnel: Add a few more UDP tunnel APIs")
---
 net/ipv4/udp_tunnel.c | 1 +
 1 file changed, 1 insertion(+)
net/ipv4/udp_tunnel.c +1 -0
index 6539ff15e9a3..d03d74388870 100644
@@ -186,6 +186,7 @@ EXPORT_SYMBOL_GPL(udp_tunnel_xmit_skb);
 void udp_tunnel_sock_release(struct socket *sock)
 {
 	rcu_assign_sk_user_data(sock->sk, NULL);
+	synchronize_rcu();
 	kernel_sock_shutdown(sock, SHUT_RDWR);
 	sock_release(sock);
 }
Signature · 1 line
2.35.1