5.10.110-rc1 review
Subsystems (9)
Greg Kroah-Hartman
maintainerPATCH 466/599 PM: core: keep irq flags in device_pm_check_callbacks()
In reply to Greg Kroah-HartmanFrom: Dmitry Baryshkov <[email protected]>
[ Upstream commit 524bb1da785a7ae43dd413cd392b5071c6c367f8 ]
The function device_pm_check_callbacks() can be called under the spin lock (in the reported case it happens from genpd_add_device() -> dev_pm_domain_set(), when the genpd uses spinlocks rather than mutexes.
However this function uncoditionally uses spin_lock_irq() / spin_unlock_irq(), thus not preserving the CPU flags. Use the irqsave/irqrestore instead.
The backtrace for the reference:
[ 2.752010] ------------[ cut here ]------------ [ 2.756769] raw_local_irq_restore() called with IRQs enabled [ 2.762596] WARNING: CPU: 4 PID: 1 at kernel/locking/irqflag-debug.c:10 warn_bogus_irq_restore+0x34/0x50 [ 2.772338] Modules linked in: [ 2.775487] CPU: 4 PID: 1 Comm: swapper/0 Tainted: G S 5.17.0-rc6-00384-ge330d0d82eff-dirty #684 [ 2.781384] Freeing initrd memory: 46024K [ 2.785839] pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) [ 2.785841] pc : warn_bogus_irq_restore+0x34/0x50 [ 2.785844] lr : warn_bogus_irq_restore+0x34/0x50 [ 2.785846] sp : ffff80000805b7d0 [ 2.785847] x29: ffff80000805b7d0 x28: 0000000000000000 x27: 0000000000000002 [ 2.785850] x26: ffffd40e80930b18 x25: ffff7ee2329192b8 x24: ffff7edfc9f60800 [ 2.785853] x23: ffffd40e80930b18 x22: ffffd40e80930d30 x21: ffff7edfc0dffa00 [ 2.785856] x20: ffff7edfc09e3768 x19: 0000000000000000 x18: ffffffffffffffff [ 2.845775] x17: 6572206f74206465 x16: 6c696166203a3030 x15: ffff80008805b4f7 [ 2.853108] x14: 0000000000000000 x13: ffffd40e809550b0 x12: 00000000000003d8 [ 2.860441] x11: 0000000000000148 x10: ffffd40e809550b0 x9 : ffffd40e809550b0 [ 2.867774] x8 : 00000000ffffefff x7 : ffffd40e809ad0b0 x6 : ffffd40e809ad0b0 [ 2.875107] x5 : 000000000000bff4 x4 : 0000000000000000 x3 : 0000000000000000 [ 2.882440] x2 : 0000000000000000 x1 : 0000000000000000 x0 : ffff7edfc03a8000 [ 2.889774] Call trace: [ 2.892290] warn_bogus_irq_restore+0x34/0x50 [ 2.896770] _raw_spin_unlock_irqrestore+0x94/0xa0 [ 2.901690] genpd_unlock_spin+0x20/0x30 [ 2.905724] genpd_add_device+0x100/0x2d0 [ 2.909850] __genpd_dev_pm_attach+0xa8/0x23c [ 2.914329] genpd_dev_pm_attach_by_id+0xc4/0x190 [ 2.919167] genpd_dev_pm_attach_by_name+0x3c/0xd0 [ 2.924086] dev_pm_domain_attach_by_name+0x24/0x30 [ 2.929102] psci_dt_attach_cpu+0x24/0x90 [ 2.933230] psci_cpuidle_probe+0x2d4/0x46c [ 2.937534] platform_probe+0x68/0xe0 [ 2.941304] really_probe.part.0+0x9c/0x2fc [ 2.945605] __driver_probe_device+0x98/0x144 [ 2.950085] driver_probe_device+0x44/0x15c [ 2.954385] __device_attach_driver+0xb8/0x120 [ 2.958950] bus_for_each_drv+0x78/0xd0 [ 2.962896] __device_attach+0xd8/0x180 [ 2.966843] device_initial_probe+0x14/0x20 [ 2.971144] bus_probe_device+0x9c/0xa4 [ 2.975092] device_add+0x380/0x88c [ 2.978679] platform_device_add+0x114/0x234 [ 2.983067] platform_device_register_full+0x100/0x190 [ 2.988344] psci_idle_init+0x6c/0xb0 [ 2.992113] do_one_initcall+0x74/0x3a0 [ 2.996060] kernel_init_freeable+0x2fc/0x384 [ 3.000543] kernel_init+0x28/0x130 [ 3.004132] ret_from_fork+0x10/0x20 [ 3.007817] irq event stamp: 319826 [ 3.011404] hardirqs last enabled at (319825): [<ffffd40e7eda0268>] __up_console_sem+0x78/0x84 [ 3.020332] hardirqs last disabled at (319826): [<ffffd40e7fd6d9d8>] el1_dbg+0x24/0x8c [ 3.028458] softirqs last enabled at (318312): [<ffffd40e7ec90410>] _stext+0x410/0x588 [ 3.036678] softirqs last disabled at (318299): [<ffffd40e7ed1bf68>] __irq_exit_rcu+0x158/0x174 [ 3.045607] ---[ end trace 0000000000000000 ]---
--- drivers/base/power/main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/base/power/main.c +4 -2
@@ -1994,7 +1994,9 @@ static bool pm_ops_is_empty(const struct dev_pm_ops *ops)void device_pm_check_callbacks (struct device *dev) { -spin_lock_irq (&dev->power.lock); +unsigned long flags; + +spin_lock_irqsave (&dev->power.lock, flags); dev->power.no_pm_callbacks = (!dev->bus || (pm_ops_is_empty (dev->bus->pm) && !dev->bus->suspend && !dev->bus->resume)) &&
@@ -2003,7 +2005,7 @@ void device_pm_check_callbacks(struct device *dev) (!dev->pm_domain ||pm_ops_is_empty (&dev->pm_domain->ops)) && (!dev->driver || (pm_ops_is_empty (dev->driver->pm) && !dev->driver->suspend && !dev->driver->resume)); -spin_unlock_irq (&dev->power.lock); +spin_unlock_irqrestore (&dev->power.lock, flags); }bool dev_pm_skip_suspend (struct device *dev)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 467/599 parisc: Fix handling off probe non-access faults
In reply to Greg Kroah-HartmanFrom: John David Anglin <[email protected]>
[ Upstream commit e00b0a2ab8ec019c344e53bfc76e31c18bb587b7 ]
Currently, the parisc kernel does not fully support non-access TLB fault handling for probe instructions. In the fast path, we set the target register to zero if it is not a shadowed register. The slow path is not implemented, so we call do_page_fault. The architecture indicates that non-access faults should not cause a page fault from disk.
This change adds to code to provide non-access fault support for probe instructions. It also modifies the handling of faults on userspace so that if the address lies in a valid VMA and the access type matches that for the VMA, the probe target register is set to one. Otherwise, the target register is set to zero.
This was done to make probe instructions more useful for userspace. Probe instructions are not very useful if they set the target register to zero whenever a page is not present in memory. Nominally, the purpose of the probe instruction is determine whether read or write access to a given address is allowed.
This fixes a problem in function pointer comparison noticed in the glibc testsuite (stdio-common/tst-vfprintf-user-type). The same problem is likely in glibc (_dl_lookup_address).
V2 adds flush and lpa instruction support to handle_nadtlb_fault.
--- arch/parisc/include/asm/traps.h | 1 + arch/parisc/kernel/traps.c | 2 + arch/parisc/mm/fault.c | 89 +++++++++++++++++++++++++++++++++ 3 files changed, 92 insertions(+)
arch/parisc/include/asm/traps.h +1 -0
@@ -17,6 +17,7 @@ void die_if_kernel(char *str, struct pt_regs *regs, long err);const char *trap_name (unsigned long code);void do_page_fault (struct pt_regs *regs,unsigned long code,unsigned long address); +int handle_nadtlb_fault (struct pt_regs *regs);#endif #endif
arch/parisc/kernel/traps.c +2 -0
@@ -661,6 +661,8 @@ void notrace handle_interruption(int code, struct pt_regs *regs)by hand. Technically we need to emulate: fdc,fdce,pdc,"fic,4f",prober,probeir,probew, probeiw */ +if (code ==17 &&handle_nadtlb_fault (regs)) +return ; fault_address = regs->ior; fault_space = regs->isr;break ;
arch/parisc/mm/fault.c +89 -0
92 lines not on this page · raw message
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 468/599 nvme-tcp: lockdep: annotate in-kernel sockets
In reply to Greg Kroah-HartmanFrom: Chris Leech <[email protected]>
[ Upstream commit 841aee4d75f18fdfb53935080b03de0c65e9b92c ]
Put NVMe/TCP sockets in their own class to avoid some lockdep warnings. Sockets created by nvme-tcp are not exposed to user-space, and will not trigger certain code paths that the general socket API exposes.
Lockdep complains about a circular dependency between the socket and filesystem locks, because setsockopt can trigger a page fault with a socket lock held, but nvme-tcp sends requests on the socket while file system locks are held.
======================================================
WARNING: possible circular locking dependency detected 5.15.0-rc3 #1 Not tainted
------------------------------------------------------
fio/1496 is trying to acquire lock:
(sk_lock-AF_INET){+.+.}-{0:0}, at: tcp_sendpage+0x23/0x80
but task is already holding lock:
(&xfs_dir_ilock_class/5){+.+.}-{3:3}, at: xfs_ilock+0xcf/0x290 [xfs]
which lock already depends on the new lock.
other info that might help us debug this:
chain exists of:
sk_lock-AF_INET --> sb_internal --> &xfs_dir_ilock_class/5
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(&xfs_dir_ilock_class/5);
lock(sb_internal);
lock(&xfs_dir_ilock_class/5); lock(sk_lock-AF_INET);
*** DEADLOCK ***
6 locks held by fio/1496:
#0: (sb_writers#13){.+.+}-{0:0}, at: path_openat+0x9fc/0xa20
#1: (&inode->i_sb->s_type->i_mutex_dir_key){++++}-{3:3}, at: path_openat+0x296/0xa20 #2: (sb_internal){.+.+}-{0:0}, at: xfs_trans_alloc_icreate+0x41/0xd0 [xfs] #3: (&xfs_dir_ilock_class/5){+.+.}-{3:3}, at: xfs_ilock+0xcf/0x290 [xfs] #4: (hctx->srcu){....}-{0:0}, at: hctx_lock+0x51/0xd0
#5: (&queue->send_mutex){+.+.}-{3:3}, at: nvme_tcp_queue_rq+0x33e/0x380 [nvme_tcp]
This annotation lets lockdep analyze nvme-tcp controlled sockets independently of what the user-space sockets API does.
--- drivers/nvme/host/tcp.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+)
drivers/nvme/host/tcp.c +40 -0
@@ -30,6 +30,44 @@ static int so_priority;module_param (so_priority, int,0644 );MODULE_PARM_DESC (so_priority,"nvme tcp socket optimize priority" ); +#ifdef CONFIG_DEBUG_LOCK_ALLOC +/* lockdep can detect a circular dependency of the form +* sk_lock -> mmap_lock (page fault) -> fs locks -> sk_lock +* because dependencies are tracked for both nvme-tcp and user contexts. Using +* a separate class prevents lockdep from conflating nvme-tcp socket use with +* user-space socket API use. +*/ +static struct lock_class_key nvme_tcp_sk_key[2 ]; +static struct lock_class_key nvme_tcp_slock_key[2 ]; + +static void nvme_tcp_reclassify_socket (struct socket *sock) +{ +struct sock *sk = sock->sk; + +if (WARN_ON_ONCE (!sock_allow_reclassification (sk))) +return ; + +switch (sk->sk_family) { +case AF_INET : +sock_lock_init_class_and_name (sk,"slock-AF_INET-NVME" , + &nvme_tcp_slock_key[0 ], +"sk_lock-AF_INET-NVME" , + &nvme_tcp_sk_key[0 ]); +break ; +case AF_INET6 : +sock_lock_init_class_and_name (sk,"slock-AF_INET6-NVME" , + &nvme_tcp_slock_key[1 ], +"sk_lock-AF_INET6-NVME" , + &nvme_tcp_sk_key[1 ]); +break ; +default : +WARN_ON_ONCE (1 ); + } +} +#else +static void nvme_tcp_reclassify_socket (struct socket *sock) { } +#endif +enum nvme_tcp_send_state {NVME_TCP_SEND_CMD_PDU =0 ,NVME_TCP_SEND_H2C_PDU ,
@@ -1422,6 +1460,8 @@ static int nvme_tcp_alloc_queue(struct nvme_ctrl *nctrl, goto err_destroy_mutex; } +nvme_tcp_reclassify_socket (queue->sock); +/* Single syn retry */ tcp_sock_set_syncnt (queue->sock->sk,1 );
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 469/599 spi: tegra20: Use of_device_get_match_data()
In reply to Greg Kroah-HartmanFrom: Minghao Chi <[email protected]>
[ Upstream commit c9839acfcbe20ce43d363c2a9d0772472d9921c0 ]
Use of_device_get_match_data() to simplify the code.
--- drivers/spi/spi-tegra20-slink.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/spi/spi-tegra20-slink.c +1 -7
@@ -1006,14 +1006,8 @@ static int tegra_slink_probe(struct platform_device *pdev)struct resource *r;int ret, spi_irq;const struct tegra_slink_chip_data *cdata =NULL ; -const struct of_device_id *match; - match =of_match_device (tegra_slink_of_match, &pdev->dev); -if (!match) { -dev_err (&pdev->dev,"Error: No device match found\n" ); -return -ENODEV ; - } - cdata = match->data; + cdata =of_device_get_match_data (&pdev->dev); master =spi_alloc_master (&pdev->dev,sizeof (*tspi));if (!master) {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 470/599 locking/lockdep: Iterate lock_classes directly when reading lockdep files
In reply to Greg Kroah-HartmanFrom: Waiman Long <[email protected]>
[ Upstream commit fb7275acd6fb988313dddd8d3d19efa70d9015ad ]
When dumping lock_classes information via /proc/lockdep, we can't take the lockdep lock as the lock hold time is indeterminate. Iterating over all_lock_classes without holding lock can be dangerous as there is a slight chance that it may branch off to other lists leading to infinite loop or even access invalid memory if changes are made to all_lock_classes list in parallel.
To avoid this problem, iteration of lock classes is now done directly on the lock_classes array itself. The lock_classes_in_use bitmap is checked to see if the lock class is being used. To avoid iterating the full array all the times, a new max_lock_class_idx value is added to track the maximum lock_class index that is currently being used.
We can theoretically take the lockdep lock for iterating all_lock_classes when other lockdep files (lockdep_stats and lock_stat) are accessed as the lock hold time will be shorter for them. For consistency, they are also modified to iterate the lock_classes array directly.
--- kernel/locking/lockdep.c | 14 +++++--- kernel/locking/lockdep_internals.h | 6 ++-- kernel/locking/lockdep_proc.c | 51 +++++++++++++++++++++++++----- 3 files changed, 56 insertions(+), 15 deletions(-)
kernel/locking/lockdep.c +9 -5
@@ -182,11 +182,9 @@ static DECLARE_BITMAP(list_entries_in_use, MAX_LOCKDEP_ENTRIES);static struct hlist_head lock_keys_hash[KEYHASH_SIZE ];unsigned long nr_lock_classes;unsigned long nr_zapped_classes; -#ifndef CONFIG_DEBUG_LOCKDEP -static -#endif +unsigned long max_lock_class_idx;struct lock_class lock_classes[MAX_LOCKDEP_KEYS ]; -static DECLARE_BITMAP(lock_classes_in_use, MAX_LOCKDEP_KEYS); +DECLARE_BITMAP (lock_classes_in_use,MAX_LOCKDEP_KEYS );static inline struct lock_class *hlock_class (struct held_lock *hlock) {
@@ -337,7 +335,7 @@ static inline void lock_release_holdtime(struct held_lock *hlock)* elements. These elements are linked together by the lock_entry member in * struct lock_class. */ -LIST_HEAD (all_lock_classes); +static LIST_HEAD (all_lock_classes);static LIST_HEAD (free_lock_classes);/**
@@ -1239,6 +1237,7 @@ register_lock_class(struct lockdep_map *lock, unsigned int subclass, int force)struct lockdep_subclass_key *key;struct hlist_head *hash_head;struct lock_class *class; +int idx;DEBUG_LOCKS_WARN_ON (!irqs_disabled ());
@@ -1304,6 +1303,9 @@ register_lock_class(struct lockdep_map *lock, unsigned int subclass, int force)* of classes. */ list_move_tail (&class->lock_entry, &all_lock_classes); + idx = class - lock_classes; +if (idx > max_lock_class_idx) + max_lock_class_idx = idx;if (verbose (class)) {graph_unlock ();
@@ -5919,6 +5921,8 @@ static void zap_class(struct pending_free *pf, struct lock_class *class)WRITE_ONCE (class->name,NULL ); nr_lock_classes--;__clear_bit (class - lock_classes, lock_classes_in_use); +if (class - lock_classes == max_lock_class_idx) + max_lock_class_idx--; }else {WARN_ONCE (true,"%s() failed for class %s\n" , __func__, class->name);
kernel/locking/lockdep_internals.h +4 -2
@@ -121,7 +121,6 @@ static const unsigned long LOCKF_USED_IN_IRQ_READ =#define MAX_LOCKDEP_CHAIN_HLOCKS (MAX_LOCKDEP_CHAINS*5) -extern struct list_head all_lock_classes;extern struct lock_chain lock_chains[];#define LOCK_USAGE_CHARS (2*XXX_LOCK_USAGE_STATES + 1)
@@ -151,6 +150,10 @@ extern unsigned int nr_large_chain_blocks;extern unsigned int max_lockdep_depth;extern unsigned int max_bfs_queue_depth; +extern unsigned long max_lock_class_idx; + +extern struct lock_class lock_classes[MAX_LOCKDEP_KEYS ]; +extern unsigned long lock_classes_in_use[];#ifdef CONFIG_PROVE_LOCKING extern unsigned long lockdep_count_forward_deps (struct lock_class *);
@@ -205,7 +208,6 @@ struct lockdep_stats { }; DECLARE_PER_CPU(struct lockdep_stats, lockdep_stats); -extern struct lock_class lock_classes[MAX_LOCKDEP_KEYS ];#define __debug_atomic_inc (ptr) \ this_cpu_inc(lockdep_stats.ptr);
kernel/locking/lockdep_proc.c +43 -8
117 lines not on this page · raw message
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 471/599 ext4: correct cluster len and clusters changed accounting in ext4_mb_mark_bb
In reply to Greg Kroah-HartmanFrom: Ritesh Harjani <[email protected]>
[ Upstream commit a5c0e2fdf7cea535ba03259894dc184e5a4c2800 ]
ext4_mb_mark_bb() currently wrongly calculates cluster len (clen) and flex_group->free_clusters. This patch fixes that.
Identified based on code review of ext4_mb_mark_bb() function.
--- fs/ext4/mballoc.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-)
fs/ext4/mballoc.c +12 -7
@@ -3320,10 +3320,11 @@ void ext4_mb_mark_bb(struct super_block *sb, ext4_fsblk_t block,struct ext4_sb_info *sbi =EXT4_SB (sb);ext4_group_t group;ext4_grpblk_t blkoff; -int i, clen, err; +int i, err;int already; +unsigned int clen, clen_changed; - clen =EXT4_B2C (sbi, len); + clen =EXT4_NUM_B2C (sbi, len);ext4_get_group_no_and_offset (sb, block, &group, &blkoff); bitmap_bh =ext4_read_block_bitmap (sb, group);
@@ -3344,6 +3345,7 @@ void ext4_mb_mark_bb(struct super_block *sb, ext4_fsblk_t block,if (!mb_test_bit (blkoff + i, bitmap_bh->b_data) == !state) already++; + clen_changed = clen - already;if (state)ext4_set_bits (bitmap_bh->b_data, blkoff, clen);else
@@ -3356,9 +3358,9 @@ void ext4_mb_mark_bb(struct super_block *sb, ext4_fsblk_t block, group, gdp)); }if (state) - clen =ext4_free_group_clusters (sb, gdp) - clen + already; + clen =ext4_free_group_clusters (sb, gdp) - clen_changed;else - clen =ext4_free_group_clusters (sb, gdp) + clen - already; + clen =ext4_free_group_clusters (sb, gdp) + clen_changed;ext4_free_group_clusters_set (sb, gdp, clen);ext4_block_bitmap_csum_set (sb, group, gdp, bitmap_bh);
@@ -3368,10 +3370,13 @@ void ext4_mb_mark_bb(struct super_block *sb, ext4_fsblk_t block,if (sbi->s_log_groups_per_flex) {ext4_group_t flex_group =ext4_flex_group (sbi, group); +struct flex_groups *fg =sbi_array_rcu_deref (sbi, + s_flex_groups, flex_group); -atomic64_sub (len, - &sbi_array_rcu_deref (sbi, s_flex_groups, - flex_group)->free_clusters); +if (state) +atomic64_sub (clen_changed, &fg->free_clusters); +else +atomic64_add (clen_changed, &fg->free_clusters); } err =ext4_handle_dirty_metadata (NULL ,NULL , bitmap_bh);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 472/599 ext4: fix ext4_mb_mark_bb() with flex_bg with fast_commit
In reply to Greg Kroah-HartmanFrom: Ritesh Harjani <[email protected]>
[ Upstream commit bfdc502a4a4c058bf4cbb1df0c297761d528f54d ]
In case of flex_bg feature (which is by default enabled), extents for any given inode might span across blocks from two different block group. ext4_mb_mark_bb() only reads the buffer_head of block bitmap once for the starting block group, but it fails to read it again when the extent length boundary overflows to another block group. Then in this below loop it accesses memory beyond the block group bitmap buffer_head and results into a data abort.
for (i = 0; i < clen; i++) if (!mb_test_bit(blkoff + i, bitmap_bh->b_data) == !state) already++;
This patch adds this functionality for checking block group boundary in ext4_mb_mark_bb() and update the buffer_head(bitmap_bh) for every different block group.
w/o this patch, I was easily able to hit a data access abort using Power platform.
<...>
[ 74.327662] EXT4-fs error (device loop3): ext4_mb_generate_buddy:1141: group 11, block bitmap and bg descriptor inconsistent: 21248 vs 23294 free clusters
[ 74.533214] EXT4-fs (loop3): shut down requested (2)
[ 74.536705] Aborting journal on device loop3-8.
[ 74.702705] BUG: Unable to handle kernel data access on read at 0xc00000005e980000
[ 74.703727] Faulting instruction address: 0xc0000000007bffb8
cpu 0xd: Vector: 300 (Data Access) at [c000000015db7060]
pc: c0000000007bffb8: ext4_mb_mark_bb+0x198/0x5a0
lr: c0000000007bfeec: ext4_mb_mark_bb+0xcc/0x5a0
sp: c000000015db7300
msr: 800000000280b033
dar: c00000005e980000
dsisr: 40000000
current = 0xc000000027af6880
paca = 0xc00000003ffd5200 irqmask: 0x03 irq_happened: 0x01
pid = 5167, comm = mount<...>
enter ? for help
[c000000015db7380] c000000000782708 ext4_ext_clear_bb+0x378/0x410 [c000000015db7400] c000000000813f14 ext4_fc_replay+0x1794/0x2000 [c000000015db7580] c000000000833f7c do_one_pass+0xe9c/0x12a0 [c000000015db7710] c000000000834504 jbd2_journal_recover+0x184/0x2d0 [c000000015db77c0] c000000000841398 jbd2_journal_load+0x188/0x4a0 [c000000015db7880] c000000000804de8 ext4_fill_super+0x2638/0x3e10 [c000000015db7a40] c0000000005f8404 get_tree_bdev+0x2b4/0x350 [c000000015db7ae0] c0000000007ef058 ext4_get_tree+0x28/0x40 [c000000015db7b00] c0000000005f6344 vfs_get_tree+0x44/0x100 [c000000015db7b70] c00000000063c408 path_mount+0xdd8/0xe70 [c000000015db7c40] c00000000063c8f0 sys_mount+0x450/0x550 [c000000015db7d50] c000000000035770 system_call_exception+0x4a0/0x4e0 [c000000015db7e10] c00000000000c74c system_call_common+0xec/0x250
--- fs/ext4/mballoc.c | 131 +++++++++++++++++++++++++++------------------- 1 file changed, 76 insertions(+), 55 deletions(-)
fs/ext4/mballoc.c +76 -55
@@ -3322,72 +3322,93 @@ void ext4_mb_mark_bb(struct super_block *sb, ext4_fsblk_t block,ext4_grpblk_t blkoff;int i, err;int already; -unsigned int clen, clen_changed; +unsigned int clen, clen_changed, thisgrp_len; - clen =EXT4_NUM_B2C (sbi, len); - -ext4_get_group_no_and_offset (sb, block, &group, &blkoff); - bitmap_bh =ext4_read_block_bitmap (sb, group); -if (IS_ERR (bitmap_bh)) { - err =PTR_ERR (bitmap_bh); - bitmap_bh =NULL ; - goto out_err; - } - - err = -EIO ; - gdp =ext4_get_group_desc (sb, group, &gdp_bh); -if (!gdp) - goto out_err; +while (len >0 ) { +ext4_get_group_no_and_offset (sb, block, &group, &blkoff); -ext4_lock_group (sb, group); - already =0 ; -for (i =0 ; i < clen; i++) -if (!mb_test_bit (blkoff + i, bitmap_bh->b_data) == !state) - already++; - - clen_changed = clen - already; -if (state) -ext4_set_bits (bitmap_bh->b_data, blkoff, clen); -else -mb_test_and_clear_bits (bitmap_bh->b_data, blkoff, clen); -if (ext4_has_group_desc_csum (sb) && - (gdp->bg_flags &cpu_to_le16 (EXT4_BG_BLOCK_UNINIT ))) { - gdp->bg_flags &=cpu_to_le16 (~EXT4_BG_BLOCK_UNINIT ); -ext4_free_group_clusters_set (sb, gdp, -ext4_free_clusters_after_init (sb, - group, gdp)); - } -if (state) - clen =ext4_free_group_clusters (sb, gdp) - clen_changed; -else - clen =ext4_free_group_clusters (sb, gdp) + clen_changed; +/* +* Check to see if we are freeing blocks across a group +* boundary. +* In case of flex_bg, this can happen that (block, len) may +* span across more than one group. In that case we need to +* get the corresponding group metadata to work with. +* For this we have goto again loop. +*/ + thisgrp_len = min_t(unsigned int, (unsigned int)len, +EXT4_BLOCKS_PER_GROUP (sb) -EXT4_C2B (sbi, blkoff)); + clen =EXT4_NUM_B2C (sbi, thisgrp_len); -ext4_free_group_clusters_set (sb, gdp, clen); -ext4_block_bitmap_csum_set (sb, group, gdp, bitmap_bh); -ext4_group_desc_csum_set (sb, group, gdp); + bitmap_bh =ext4_read_block_bitmap (sb, group); +if (IS_ERR (bitmap_bh)) { + err =PTR_ERR (bitmap_bh); + bitmap_bh =NULL ; +break ; + } -ext4_unlock_group (sb, group); + err = -EIO ; + gdp =ext4_get_group_desc (sb, group, &gdp_bh); +if (!gdp) +break ; -if (sbi->s_log_groups_per_flex) { -ext4_group_t flex_group =ext4_flex_group (sbi, group); -struct flex_groups *fg =sbi_array_rcu_deref (sbi, - s_flex_groups, flex_group); +ext4_lock_group (sb, group); + already =0 ; +for (i =0 ; i < clen; i++) +if (!mb_test_bit (blkoff + i, bitmap_bh->b_data) == + !state) + already++; + clen_changed = clen - already;if (state) -atomic64_sub (clen_changed, &fg->free_clusters); +ext4_set_bits (bitmap_bh->b_data, blkoff, clen);else -atomic64_add (clen_changed, &fg->free_clusters); +mb_test_and_clear_bits (bitmap_bh->b_data, blkoff, clen); +if (ext4_has_group_desc_csum (sb) && + (gdp->bg_flags &cpu_to_le16 (EXT4_BG_BLOCK_UNINIT ))) { + gdp->bg_flags &=cpu_to_le16 (~EXT4_BG_BLOCK_UNINIT ); +ext4_free_group_clusters_set (sb, gdp, +ext4_free_clusters_after_init (sb, group, gdp)); + } +if (state) + clen =ext4_free_group_clusters (sb, gdp) - clen_changed; +else + clen =ext4_free_group_clusters (sb, gdp) + clen_changed; + +ext4_free_group_clusters_set (sb, gdp, clen); +ext4_block_bitmap_csum_set (sb, group, gdp, bitmap_bh); +ext4_group_desc_csum_set (sb, group, gdp); + +ext4_unlock_group (sb, group); + +if (sbi->s_log_groups_per_flex) { +ext4_group_t flex_group =ext4_flex_group (sbi, group); +struct flex_groups *fg =sbi_array_rcu_deref (sbi, + s_flex_groups, flex_group); + +if (state) +atomic64_sub (clen_changed, &fg->free_clusters); +else +atomic64_add (clen_changed, &fg->free_clusters); + + } + + err =ext4_handle_dirty_metadata (NULL ,NULL , bitmap_bh); +if (err) +break ; +sync_dirty_buffer (bitmap_bh); + err =ext4_handle_dirty_metadata (NULL ,NULL , gdp_bh); +sync_dirty_buffer (gdp_bh); +if (err) +break ; + + block += thisgrp_len; + len -= thisgrp_len; +brelse (bitmap_bh); +BUG_ON (len <0 ); } - err =ext4_handle_dirty_metadata (NULL ,NULL , bitmap_bh);if (err) - goto out_err; -sync_dirty_buffer (bitmap_bh); - err =ext4_handle_dirty_metadata (NULL ,NULL , gdp_bh); -sync_dirty_buffer (gdp_bh); - -out_err: -brelse (bitmap_bh); +brelse (bitmap_bh); }/*
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 473/599 ext4: dont BUG if someone dirty pages without asking ext4 first
In reply to Greg Kroah-HartmanFrom: Theodore Ts'o <[email protected]>
[ Upstream commit cc5095747edfb054ca2068d01af20be3fcc3634f ]
[un]pin_user_pages_remote is dirtying pages without properly warning the file system in advance. A related race was noted by Jan Kara in 2018[1]; however, more recently instead of it being a very hard-to-hit race, it could be reliably triggered by process_vm_writev(2) which was discovered by Syzbot[2].
This is technically a bug in mm/gup.c, but arguably ext4 is fragile in that if some other kernel subsystem dirty pages without properly notifying the file system using page_mkwrite(), ext4 will BUG, while other file systems will not BUG (although data will still be lost).
So instead of crashing with a BUG, issue a warning (since there may be potential data loss) and just mark the page as clean to avoid unprivileged denial of service attacks until the problem can be properly fixed. More discussion and background can be found in the thread starting at [2].
[1] https://lore.kernel.org/linux-mm/[email protected]
[2] https://lore.kernel.org/r/[email protected]
--- fs/ext4/inode.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
fs/ext4/inode.c +25 -0
@@ -2023,6 +2023,15 @@ static int ext4_writepage(struct page *page,else len =PAGE_SIZE ; +/* Should never happen but for bugs in other kernel subsystems */ +if (!page_has_buffers (page)) { +ext4_warning_inode (inode, +"page %lu does not have buffers attached" , page->index); +ClearPageDirty (page); +unlock_page (page); +return 0 ; + } + page_bufs =page_buffers (page);/* * We cannot do block allocation or other extent handling in this
@@ -2626,6 +2635,22 @@ static int mpage_prepare_extent_to_map(struct mpage_da_data *mpd)wait_on_page_writeback (page);BUG_ON (PageWriteback (page)); +/* +* Should never happen but for buggy code in +* other subsystems that call +* set_page_dirty() without properly warning +* the file system first. See [1] for more +* information. +* +* [1] https://lore.kernel.org/linux-mm/[email protected] +*/ +if (!page_has_buffers (page)) { +ext4_warning_inode (mpd->inode,"page %lu does not have buffers attached" , page->index); +ClearPageDirty (page); +unlock_page (page); +continue ; + } +if (mpd->map.m_len ==0 ) mpd->first_page = page->index; mpd->next_page = page->index +1 ;
Signature · 1 line
2.34.1
syzbot
syzbotRe: [PATCH 5.10 473/599] ext4: dont BUG if someone dirty pages without asking ext4 first
I see the command but can't find the corresponding bug. The email is sent to [email protected] address but the HASH does not correspond to any known bug. Please double check the…
Quoted 81 lines
From: Theodore Ts'o <[email protected]>
[ Upstream commit
cc5095747edfb054ca2068d01af20be3fcc3634f][un]pin_user_pages_remote is dirtying pages without properly warning the file system in advance. A related race was noted by Jan Kara in 2018[1]; however, more recently instead of it being a very hard-to-hit race, it could be reliably triggered by
process_vm_writev(2)which was discovered by Syzbot[2].This is technically a bug in
mm/gup.c, but arguably ext4 is fragile in that if some other kernel subsystem dirty pages without properly notifying the file system usingpage_mkwrite(), ext4 will BUG, while other file systems will not BUG (although data will still be lost).So instead of crashing with a BUG, issue a warning (since there may be potential data loss) and just mark the page as clean to avoid unprivileged denial of service attacks until the problem can be properly fixed. More discussion and background can be found in the thread starting at [2].
[1] https://lore.kernel.org/linux-mm/[email protected]
[2] https://lore.kernel.org/r/[email protected]Reported-by Lee Jones <[email protected]>Signed-off-by Theodore Ts'o <[email protected]>Signed-off-by Sasha Levin <[email protected]>--- fs/ext4/inode.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)fs/ext4/inode.c +25
-0@@ -2023,6 +2023,15 @@ static int ext4_writepage(struct page *page,else len =PAGE_SIZE ; +/* Should never happen but for bugs in other kernel subsystems */ +if (!page_has_buffers (page)) { +ext4_warning_inode (inode, +"page %lu does not have buffers attached" , page->index); +ClearPageDirty (page); +unlock_page (page); +return 0 ; + } + page_bufs =page_buffers (page);/* * We cannot do block allocation or other extent handling in this @@ -2626,6 +2635,22 @@ static int mpage_prepare_extent_to_map(struct mpage_da_data *mpd)wait_on_page_writeback (page);BUG_ON (PageWriteback (page)); +/* +* Should never happen but for buggy code in +* other subsystems that call +* set_page_dirty() without properly warning +* the file system first. See [1] for more +* information. +* +* [1] https://lore.kernel.org/linux-mm/[email protected] +*/ +if (!page_has_buffers (page)) { +ext4_warning_inode (mpd->inode,"page %lu does not have buffers attached" , page->index); +ClearPageDirty (page); +unlock_page (page); +continue ; + } +if (mpd->map.m_len ==0 ) mpd->first_page = page->index; mpd->next_page = page->index +1 ;Signature · 1 line
2.34.1
I see the command but can't find the corresponding bug. The email is sent to [email protected] address but the HASH does not correspond to any known bug. Please double check the address.
Greg Kroah-Hartman
maintainerPATCH 474/599 f2fs: fix to do sanity check on curseg->alloc_type
In reply to Greg Kroah-HartmanFrom: Chao Yu <[email protected]>
[ Upstream commit f41ee8b91c00770d718be2ff4852a80017ae9ab3 ]
As Wenqing Liu reported in bugzilla:
https://bugzilla.kernel.org/show_bug.cgi?id=215657
- Overview
UBSAN: array-index-out-of-bounds in fs/f2fs/segment.c:3460:2 when mount and operate a corrupted image
- Reproduce
tested on kernel 5.17-rc4, 5.17-rc6
1. mkdir test_crash
2. cd test_crash
3. unzip tmp2.zip
4. mkdir mnt
5. ./single_test.sh f2fs 2
- Kernel dump
[ 46.434454] loop0: detected capacity change from 0 to 131072 [ 46.529839] F2FS-fs (loop0): Mounted with checkpoint version = 7548c2d9 [ 46.738319] ================================================================================ [ 46.738412] UBSAN: array-index-out-of-bounds in fs/f2fs/segment.c:3460:2 [ 46.738475] index 231 is out of range for type 'unsigned int [2]' [ 46.738539] CPU: 2 PID: 939 Comm: umount Not tainted 5.17.0-rc6 #1 [ 46.738547] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.13.0-1ubuntu1.1 04/01/2014 [ 46.738551] Call Trace: [ 46.738556] <TASK> [ 46.738563] dump_stack_lvl+0x47/0x5c [ 46.738581] ubsan_epilogue+0x5/0x50 [ 46.738592] __ubsan_handle_out_of_bounds+0x68/0x80 [ 46.738604] f2fs_allocate_data_block+0xdff/0xe60 [f2fs] [ 46.738819] do_write_page+0xef/0x210 [f2fs] [ 46.738934] f2fs_do_write_node_page+0x3f/0x80 [f2fs] [ 46.739038] __write_node_page+0x2b7/0x920 [f2fs] [ 46.739162] f2fs_sync_node_pages+0x943/0xb00 [f2fs] [ 46.739293] f2fs_write_checkpoint+0x7bb/0x1030 [f2fs] [ 46.739405] kill_f2fs_super+0x125/0x150 [f2fs] [ 46.739507] deactivate_locked_super+0x60/0xc0 [ 46.739517] deactivate_super+0x70/0xb0 [ 46.739524] cleanup_mnt+0x11a/0x200 [ 46.739532] __cleanup_mnt+0x16/0x20 [ 46.739538] task_work_run+0x67/0xa0 [ 46.739547] exit_to_user_mode_prepare+0x18c/0x1a0 [ 46.739559] syscall_exit_to_user_mode+0x26/0x40 [ 46.739568] do_syscall_64+0x46/0xb0 [ 46.739584] entry_SYSCALL_64_after_hwframe+0x44/0xae
The root cause is we missed to do sanity check on curseg->alloc_type, result in out-of-bound accessing on sbi->block_count[] array, fix it.
--- fs/f2fs/segment.c | 7 +++++++ 1 file changed, 7 insertions(+)
fs/f2fs/segment.c +7 -0
@@ -4650,6 +4650,13 @@ static int sanity_check_curseg(struct f2fs_sb_info *sbi)sanity_check_seg_type (sbi, curseg->seg_type); +if (curseg->alloc_type !=LFS && curseg->alloc_type !=SSR ) { +f2fs_err (sbi, +"Current segment has invalid alloc_type:%d" , + curseg->alloc_type); +return -EFSCORRUPTED ; + } +if (f2fs_test_bit (blkofs, se->cur_valid_map)) goto out;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 475/599 NFSD: Fix nfsd_breaker_owns_lease() return values
In reply to Greg Kroah-HartmanFrom: Chuck Lever <[email protected]>
[ Upstream commit 50719bf3442dd6cd05159e9c98d020b3919ce978 ]
These have been incorrect since the function was introduced.
A proper kerneldoc comment is added since this function, though static, is part of an external interface.
--- fs/nfsd/nfs4state.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
fs/nfsd/nfs4state.c +10 -2
@@ -4607,6 +4607,14 @@ nfsd_break_deleg_cb(struct file_lock *fl)return ret; } +/** +* nfsd_breaker_owns_lease - Check if lease conflict was resolved +* @fl: Lock state to check +* +* Return values: +* %true: Lease conflict was resolved +* %false: Lease conflict was not resolved. +*/ static bool nfsd_breaker_owns_lease (struct file_lock *fl) {struct nfs4_delegation *dl = fl->fl_owner;
@@ -4614,11 +4622,11 @@ static bool nfsd_breaker_owns_lease(struct file_lock *fl)struct nfs4_client *clp;if (!i_am_nfsd ()) -return NULL ; +return false; rqst =kthread_data (current);/* Note rq_prog == NFS_ACL_PROGRAM is also possible: */ if (rqst->rq_prog !=NFS_PROGRAM || rqst->rq_vers <4 ) -return NULL ; +return false; clp = *(rqst->rq_lease_breaker);return dl->dl_stid.sc_client == clp; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 476/599 f2fs: compress: fix to print raw data size in error path of lz4 decompression
In reply to Greg Kroah-HartmanFrom: Chao Yu <[email protected]>
[ Upstream commit d284af43f703760e261b1601378a0c13a19d5f1f ]
In lz4_decompress_pages(), if size of decompressed data is not equal to expected one, we should print the size rather than size of target buffer for decompressed data, fix it.
--- fs/f2fs/compress.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
fs/f2fs/compress.c +2 -3
@@ -286,10 +286,9 @@ static int lz4_decompress_pages(struct decompress_io_ctx *dic) }if (ret !=PAGE_SIZE << dic->log_cluster_size) { -printk_ratelimited ("%sF2FS-fs (%s): lz4 invalid rlen:%zu, " +printk_ratelimited ("%sF2FS-fs (%s): lz4 invalid ret:%d, " "expected:%lu\n" ,KERN_ERR , -F2FS_I_SB (dic->inode)->sb->s_id, - dic->rlen, +F2FS_I_SB (dic->inode)->sb->s_id, ret,PAGE_SIZE << dic->log_cluster_size);return -EIO ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 477/599 ntfs: add sanity check on allocation size
In reply to Greg Kroah-HartmanFrom: Dongliang Mu <[email protected]>
[ Upstream commit 714fbf2647b1a33d914edd695d4da92029c7e7c0 ]
ntfs_read_inode_mount invokes ntfs_malloc_nofs with zero allocation size. It triggers one BUG in the __ntfs_malloc function.
Fix this by adding sanity check on ni->attr_list_size.
--- fs/ntfs/inode.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/ntfs/inode.c +4 -0
@@ -1881,6 +1881,10 @@ int ntfs_read_inode_mount(struct inode *vi) }/* Now allocate memory for the attribute list. */ ni->attr_list_size = (u32 )ntfs_attr_size (a); +if (!ni->attr_list_size) { +ntfs_error (sb,"Attr_list_size is zero" ); + goto put_err_out; + } ni->attr_list =ntfs_malloc_nofs (ni->attr_list_size);if (!ni->attr_list) { ntfs_error(sb, "Not enough memory to allocate buffer "
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 478/599 media: staging: media: zoran: move videodev alloc
In reply to Greg Kroah-HartmanFrom: Corentin Labbe <[email protected]>
[ Upstream commit 82e3a496eb56da0b9f29fdc5b63cedb3289e91de ]
Move some code out of zr36057_init() and create new functions for handling zr->video_dev. This permit to ease code reading and fix a zr->video_dev memory leak.
--- drivers/staging/media/zoran/zoran.h | 2 +- drivers/staging/media/zoran/zoran_card.c | 80 ++++++++++++++-------- drivers/staging/media/zoran/zoran_driver.c | 5 +- 3 files changed, 54 insertions(+), 33 deletions(-)
drivers/staging/media/zoran/zoran.h +1 -1
@@ -314,6 +314,6 @@ static inline struct zoran *to_zoran(struct v4l2_device *v4l2_dev)#endif -int zoran_queue_init (struct zoran *zr,struct vb2_queue *vq); +int zoran_queue_init (struct zoran *zr,struct vb2_queue *vq,int dir);void zoran_queue_exit (struct zoran *zr);int zr_set_buf (struct zoran *zr);
drivers/staging/media/zoran/zoran_card.c +50 -30
115 lines not on this page · raw message
drivers/staging/media/zoran/zoran_driver.c +3 -2
@@ -1006,7 +1006,7 @@ static const struct vb2_ops zr_video_qops = { .wait_finish = vb2_ops_wait_finish, }; -int zoran_queue_init (struct zoran *zr,struct vb2_queue *vq) +int zoran_queue_init (struct zoran *zr,struct vb2_queue *vq,int dir) {int err;
@@ -1014,7 +1014,8 @@ int zoran_queue_init(struct zoran *zr, struct vb2_queue *vq)INIT_LIST_HEAD (&zr->queued_bufs); vq->dev = &zr->pci_dev->dev; - vq->type =V4L2_BUF_TYPE_VIDEO_CAPTURE ; + vq->type = dir; + vq->io_modes =VB2_USERPTR |VB2_DMABUF |VB2_MMAP |VB2_READ |VB2_WRITE ; vq->drv_priv = zr; vq->buf_struct_size =sizeof (struct zr_buffer );
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 479/599 media: staging: media: zoran: calculate the right buffer number for zoran_reap_stat_com
In reply to Greg Kroah-HartmanFrom: Corentin Labbe <[email protected]>
[ Upstream commit e3b86f4e558cea9eed71d894df2f19b10d60a207 ]
On the case tmp_dcim=1, the index of buffer is miscalculated. This generate a NULL pointer dereference later.
So let's fix the calcul and add a check to prevent this to reappear.
--- drivers/staging/media/zoran/zoran_device.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/staging/media/zoran/zoran_device.c +6 -1
@@ -879,7 +879,7 @@ static void zoran_reap_stat_com(struct zoran *zr)if (zr->jpg_settings.tmp_dcm ==1 ) i = (zr->jpg_dma_tail - zr->jpg_err_shift) &BUZ_MASK_STAT_COM ;else - i = ((zr->jpg_dma_tail - zr->jpg_err_shift) &1 ) *2 +1 ; + i = ((zr->jpg_dma_tail - zr->jpg_err_shift) &1 ) *2 ; stat_com =le32_to_cpu (zr->stat_com[i]);if ((stat_com &1 ) ==0 ) {
@@ -891,6 +891,11 @@ static void zoran_reap_stat_com(struct zoran *zr) size = (stat_com &GENMASK (22 ,1 )) >>1 ; buf = zr->inuse[i]; +if (!buf) { +spin_unlock_irqrestore (&zr->queued_bufs_lock, flags); +pci_err (zr->pci_dev,"No buffer at slot %d\n" , i); +return ; + } buf->vbuf.vb2_buf.timestamp =ktime_get_ns ();if (zr->codec_mode ==BUZ_MODE_MOTION_COMPRESS ) {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 480/599 media: staging: media: zoran: fix various V4L2 compliance errors
In reply to Greg Kroah-HartmanFrom: Hans Verkuil <[email protected]>
[ Upstream commit 914941827aad5ecddf9bf3a6dee67fbec1af1fff ]
This fixes several issues found with 'v4l2-compliance -s':
1) read()/write() is supported, but not reported in the capabilities
2) S_STD(G_STD()) failed: setting the same standard should just return 0.
3) G_PARM failed to set readbuffers.
4) different field values in the format vs. what v4l2_buffer reported.
5) zero the sequence number when starting streaming.
6) drop VB_USERPTR: makes no sense with dma_contig streaming.
--- drivers/staging/media/zoran/zoran_card.c | 2 +- drivers/staging/media/zoran/zoran_driver.c | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-)
drivers/staging/media/zoran/zoran_card.c +1 -1
@@ -810,7 +810,7 @@ static int zoran_init_video_device(struct zoran *zr, struct video_device *video_ *video_dev = zoran_template; video_dev->v4l2_dev = &zr->v4l2_dev; video_dev->lock = &zr->lock; - video_dev->device_caps =V4L2_CAP_STREAMING | dir; + video_dev->device_caps =V4L2_CAP_STREAMING |V4L2_CAP_READWRITE | dir;strscpy (video_dev->name,ZR_DEVNAME (zr),sizeof (video_dev->name));/*
drivers/staging/media/zoran/zoran_driver.c +10 -3
@@ -255,8 +255,6 @@ static int zoran_querycap(struct file *file, void *__fh, struct v4l2_capabilitystrscpy (cap->card,ZR_DEVNAME (zr),sizeof (cap->card));strscpy (cap->driver,"zoran" ,sizeof (cap->driver));snprintf (cap->bus_info,sizeof (cap->bus_info),"PCI:%s" ,pci_name (zr->pci_dev)); - cap->device_caps = zr->video_dev->device_caps; - cap->capabilities = cap->device_caps |V4L2_CAP_DEVICE_CAPS ;return 0 ; }
@@ -582,6 +580,9 @@ static int zoran_s_std(struct file *file, void *__fh, v4l2_std_id std)struct zoran *zr =video_drvdata (file);int res =0 ; +if (zr->norm == std) +return 0 ; +if (zr->running !=ZORAN_MAP_MODE_NONE )return -EBUSY ;
@@ -737,6 +738,7 @@ static int zoran_g_parm(struct file *file, void *priv, struct v4l2_streamparm *pif (parm->type !=V4L2_BUF_TYPE_VIDEO_CAPTURE )return -EINVAL ; + parm->parm.capture.readbuffers =9 ;return 0 ; }
@@ -867,6 +869,10 @@ int zr_set_buf(struct zoran *zr) vbuf = &buf->vbuf; buf->vbuf.field =V4L2_FIELD_INTERLACED ; +if (BUZ_MAX_HEIGHT < (zr->v4l_settings.height *2 )) + buf->vbuf.field =V4L2_FIELD_INTERLACED ; +else + buf->vbuf.field =V4L2_FIELD_TOP ;vb2_set_plane_payload (&buf->vbuf.vb2_buf,0 , zr->buffer_size);vb2_buffer_done (&buf->vbuf.vb2_buf,VB2_BUF_STATE_DONE ); zr->inuse[0 ] =NULL ;
@@ -926,6 +932,7 @@ static int zr_vb2_start_streaming(struct vb2_queue *vq, unsigned int count) zr->stat_com[j] =cpu_to_le32 (1 ); zr->inuse[j] =NULL ; } + zr->vbseq =0 ;if (zr->map_mode !=ZORAN_MAP_MODE_RAW ) {pci_info (zr->pci_dev,"START JPG\n" );
@@ -1016,7 +1023,7 @@ int zoran_queue_init(struct zoran *zr, struct vb2_queue *vq, int dir) vq->dev = &zr->pci_dev->dev; vq->type = dir; - vq->io_modes =VB2_USERPTR |VB2_DMABUF |VB2_MMAP |VB2_READ |VB2_WRITE ; + vq->io_modes =VB2_DMABUF |VB2_MMAP |VB2_READ |VB2_WRITE ; vq->drv_priv = zr; vq->buf_struct_size =sizeof (struct zr_buffer ); vq->ops = &zr_video_qops;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 481/599 media: ir_toy: free before error exiting
In reply to Greg Kroah-HartmanFrom: Peiwei Hu <[email protected]>
[ Upstream commit 52cdb013036391d9d87aba5b4fc49cdfc6ea4b23 ]
Fix leak in error path.
--- drivers/media/rc/ir_toy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/rc/ir_toy.c +1 -1
@@ -429,7 +429,7 @@ static int irtoy_probe(struct usb_interface *intf, err =usb_submit_urb (irtoy->urb_in,GFP_KERNEL );if (err !=0 ) {dev_err (irtoy->dev,"fail to submit in urb: %d\n" , err); -return err; + goto free_rcdev; } err =irtoy_setup (irtoy);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 482/599 ASoC: SOF: Intel: hda: Remove link assignment limitation
In reply to Greg Kroah-HartmanFrom: Ranjani Sridharan <[email protected]>
[ Upstream commit 2ce0d008dcc59f9c01f43277b9f9743af7b01dad ]
The limitation to assign a link DMA channel for a BE iff the corresponding host DMA channel is assigned to a connected FE is only applicable if the PROCEN_FMT_QUIRK is set. So, remove it for platforms that do not enable the quirk.
Complements: a792bfc1c2bc ("ASoC: SOF: Intel: hda-stream: limit PROCEN workaround")
--- sound/soc/sof/intel/hda-dai.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
sound/soc/sof/intel/hda-dai.c +13 -0
@@ -58,6 +58,8 @@ static struct hdac_ext_stream * {struct snd_soc_pcm_runtime *rtd =asoc_substream_to_rtd (substream);struct sof_intel_hda_stream *hda_stream; +const struct sof_intel_dsp_desc *chip; +struct snd_sof_dev *sdev;struct hdac_ext_stream *res =NULL ;struct hdac_stream *stream =NULL ;
@@ -76,9 +78,20 @@ static struct hdac_ext_stream *continue ; hda_stream =hstream_to_sof_hda_stream (hstream); + sdev = hda_stream->sdev; + chip =get_chip_info (sdev->pdata);/* check if link is available */ if (!hstream->link_locked) { +/* +* choose the first available link for platforms that do not have the +* PROCEN_FMT_QUIRK set. +*/ +if (!(chip->quirks &SOF_INTEL_PROCEN_FMT_QUIRK )) { + res = hstream; +break ; + } +if (stream->opened) {/* * check if the stream tag matches the stream
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 483/599 video: fbdev: nvidiafb: Use strscpy() to prevent buffer overflow
In reply to Greg Kroah-HartmanFrom: Tim Gardner <[email protected]>
[ Upstream commit 37a1a2e6eeeb101285cd34e12e48a881524701aa ]
Coverity complains of a possible buffer overflow. However, given the 'static' scope of nvidia_setup_i2c_bus() it looks like that can't happen after examiniing the call sites.
CID 19036 (#1 of 1): Copy into fixed size buffer (STRING_OVERFLOW)
1. fixed_size_dest: You might overrun the 48-character fixed-size string chan->adapter.name by copying name without checking the length.
2. parameter_as_source: Note: This defect has an elevated risk because the source argument is a parameter of the current function.
89 strcpy(chan->adapter.name, name);
Fix this warning by using strscpy() which will silence the warning and prevent any future buffer overflows should the names used to identify the channel become much longer.
--- drivers/video/fbdev/nvidia/nv_i2c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/fbdev/nvidia/nv_i2c.c +1 -1
@@ -86,7 +86,7 @@ static int nvidia_setup_i2c_bus(struct nvidia_i2c_chan *chan, const char *name, {int rc; -strcpy (chan->adapter.name, name); +strscpy (chan->adapter.name, name,sizeof (chan->adapter.name)); chan->adapter.owner =THIS_MODULE ; chan->adapter.class = i2c_class; chan->adapter.algo_data = &chan->algo;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 484/599 video: fbdev: w100fb: Reset global state
In reply to Greg Kroah-HartmanFrom: Evgeny Novikov <[email protected]>
[ Upstream commit 8738ddcac644964ae128ccd3d80d48773c8d528e ]
w100fb_probe() did not reset the global state to its initial state. This can result in invocation of iounmap() even when there was not the appropriate successful call of ioremap(). For instance, this may be the case if first probe fails after two successful ioremap() while second probe fails when first ioremap() fails. The similar issue is with w100fb_remove(). The patch fixes both bugs.
Found by Linux Driver Verification project (linuxtesting.org).
--- drivers/video/fbdev/w100fb.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
drivers/video/fbdev/w100fb.c +12 -3
@@ -770,12 +770,18 @@ static int w100fb_probe(struct platform_device *pdev)fb_dealloc_cmap (&info->cmap);kfree (info->pseudo_palette); } -if (remapped_fbuf !=NULL ) +if (remapped_fbuf !=NULL ) {iounmap (remapped_fbuf); -if (remapped_regs !=NULL ) + remapped_fbuf =NULL ; + } +if (remapped_regs !=NULL ) {iounmap (remapped_regs); -if (remapped_base !=NULL ) + remapped_regs =NULL ; + } +if (remapped_base !=NULL ) {iounmap (remapped_base); + remapped_base =NULL ; + }if (info)framebuffer_release (info);return err;
@@ -795,8 +801,11 @@ static int w100fb_remove(struct platform_device *pdev)fb_dealloc_cmap (&info->cmap);iounmap (remapped_base); + remapped_base =NULL ;iounmap (remapped_regs); + remapped_regs =NULL ;iounmap (remapped_fbuf); + remapped_fbuf =NULL ;framebuffer_release (info);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 485/599 video: fbdev: cirrusfb: check pixclock to avoid divide by zero
In reply to Greg Kroah-HartmanFrom: George Kennedy <[email protected]>
[ Upstream commit 5c6f402bdcf9e7239c6bc7087eda71ac99b31379 ]
Do a sanity check on pixclock value to avoid divide by zero.
If the pixclock value is zero, the cirrusfb driver will round up pixclock to get the derived frequency as close to maxclock as possible.
Syzkaller reported a divide error in cirrusfb_check_pixclock.
divide error: 0000 [#1] SMP KASAN PTI
CPU: 0 PID: 14938 Comm: cirrusfb_test Not tainted 5.15.0-rc6 #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.11.0-2 RIP: 0010:cirrusfb_check_var+0x6f1/0x1260 Call Trace: fb_set_var+0x398/0xf90 do_fb_ioctl+0x4b8/0x6f0 fb_ioctl+0xeb/0x130 __x64_sys_ioctl+0x19d/0x220 do_syscall_64+0x3a/0x80 entry_SYSCALL_64_after_hwframe+0x44/0xae
--- drivers/video/fbdev/cirrusfb.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/video/fbdev/cirrusfb.c +8 -8
@@ -469,7 +469,7 @@ static int cirrusfb_check_mclk(struct fb_info *info, long freq)return 0 ; } -static int cirrusfb_check_pixclock (const struct fb_var_screeninfo *var, +static int cirrusfb_check_pixclock (struct fb_var_screeninfo *var,struct fb_info *info) {long freq;
@@ -478,9 +478,7 @@ static int cirrusfb_check_pixclock(const struct fb_var_screeninfo *var,unsigned maxclockidx = var->bits_per_pixel >>3 ;/* convert from ps to kHz */ - freq =PICOS2KHZ (var->pixclock); - -dev_dbg (info->device,"desired pixclock: %ld kHz\n" , freq); + freq =PICOS2KHZ (var->pixclock ? :1 ); maxclock = cirrusfb_board_info[cinfo->btype].maxclock[maxclockidx]; cinfo->multiplexing =0 ;
@@ -488,11 +486,13 @@ static int cirrusfb_check_pixclock(const struct fb_var_screeninfo *var,/* If the frequency is greater than we can support, we might be able * to use multiplexing for the video mode */ if (freq > maxclock) { -dev_err (info->device, -"Frequency greater than maxclock (%ld kHz)\n" , - maxclock); -return -EINVAL ; + var->pixclock =KHZ2PICOS (maxclock); + +while ((freq =PICOS2KHZ (var->pixclock)) > maxclock) + var->pixclock++; } +dev_dbg (info->device,"desired pixclock: %ld kHz\n" , freq); +/* * Additional constraint: 8bpp uses DAC clock doubling to allow maximum * pixel clock
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 486/599 video: fbdev: omapfb: acx565akm: replace snprintf with sysfs_emit
In reply to Greg Kroah-HartmanFrom: Yang Guang <[email protected]>
[ Upstream commit 24565bc4115961db7ee64fcc7ad2a7437c0d0a49 ]
coccinelle report:./drivers/video/fbdev/omap2/omapfb/displays/panel-sony-acx565akm.c:
479:9-17: WARNING: use scnprintf or sprintf
Use sysfs_emit instead of scnprintf or sprintf makes more sense.
--- .../video/fbdev/omap2/omapfb/displays/panel-sony-acx565akm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/fbdev/omap2/omapfb/displays/panel-sony-acx565akm.c +1 -1
@@ -476,7 +476,7 @@ static ssize_t show_cabc_available_modes(struct device *dev,int i;if (!ddata->has_cabc) -return snprintf (buf,PAGE_SIZE ,"%s\n" , cabc_modes[0 ]); +return sysfs_emit (buf,"%s\n" , cabc_modes[0 ]);for (i =0 , len =0 ; len <PAGE_SIZE && i <ARRAY_SIZE (cabc_modes); i++)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 487/599 ARM: dts: qcom: fix gic_irq_domain_translate warnings for msm8960
In reply to Greg Kroah-HartmanFrom: David Heidelberg <[email protected]>
[ Upstream commit 6f7e221e7a5cfc3299616543fce42b36e631497b ]
IRQ types blindly copied from very similar APQ8064.
Fixes warnings as:
WARNING: CPU: 0 PID: 1 at drivers/irqchip/irq-gic.c:1080 gic_irq_domain_translate+0x118/0x120
...
--- arch/arm/boot/dts/qcom-msm8960.dtsi | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
arch/arm/boot/dts/qcom-msm8960.dtsi +5 -3
@@ -146,7 +146,9 @@ reg = <0x108000 0x1000>; qcom,ipc = <&l2cc 0x8 2>; - interrupts = <0 19 0>, <0 21 0>, <0 22 0>; + interrupts = <GIC_SPI 19 IRQ_TYPE_EDGE_RISING>, + <GIC_SPI 21 IRQ_TYPE_EDGE_RISING>, + <GIC_SPI 22 IRQ_TYPE_EDGE_RISING>; interrupt-names = "ack", "err", "wakeup"; regulators {
@@ -192,7 +194,7 @@ compatible = "qcom,msm-uartdm-v1.3", "qcom,msm-uartdm"; reg = <0x16440000 0x1000>, <0x16400000 0x1000>; - interrupts = <0 154 0x0>; + interrupts = <GIC_SPI 154 IRQ_TYPE_LEVEL_HIGH>; clocks = <&gcc GSBI5_UART_CLK>, <&gcc GSBI5_H_CLK>; clock-names = "core", "iface"; status = "disabled";
@@ -318,7 +320,7 @@ #address-cells = <1>; #size-cells = <0>; reg = <0x16080000 0x1000>; - interrupts = <0 147 0>; + interrupts = <GIC_SPI 147 IRQ_TYPE_LEVEL_HIGH>; spi-max-frequency = <24000000>; cs-gpios = <&msmgpio 8 0>;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 488/599 ARM: dts: bcm2837: Add the missing L1/L2 cache information
In reply to Greg Kroah-HartmanFrom: Richard Schleich <[email protected]>
[ Upstream commit bdf8762da268d2a34abf517c36528413906e9cd5 ]
This patch fixes the kernel warning "cacheinfo: Unable to detect cache hierarchy for CPU 0" for the bcm2837 on newer kernel versions.
--- arch/arm/boot/dts/bcm2837.dtsi | 49 ++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+)
arch/arm/boot/dts/bcm2837.dtsi +49 -0
@@ -40,12 +40,26 @@ #size-cells = <0>; enable-method = "brcm,bcm2836-smp"; // for ARM 32-bit + /* Source for d/i-cache-line-size and d/i-cache-sets + * https://developer.arm.com/documentation/ddi0500/e/level-1-memory-system + * /about-the-l1-memory-system?lang=en + * + * Source for d/i-cache-size + * https://magpi.raspberrypi.com/articles/raspberry-pi-3-specs-benchmarks + */ cpu0: cpu@0 { device_type = "cpu"; compatible = "arm,cortex-a53"; reg = <0>; enable-method = "spin-table"; cpu-release-addr = <0x0 0x000000d8>; + d-cache-size = <0x8000>; + d-cache-line-size = <64>; + d-cache-sets = <128>; // 32KiB(size)/64(line-size)=512ways/4-way set + i-cache-size = <0x8000>; + i-cache-line-size = <64>; + i-cache-sets = <256>; // 32KiB(size)/64(line-size)=512ways/2-way set + next-level-cache = <&l2>; }; cpu1: cpu@1 {
@@ -54,6 +68,13 @@ reg = <1>; enable-method = "spin-table"; cpu-release-addr = <0x0 0x000000e0>; + d-cache-size = <0x8000>; + d-cache-line-size = <64>; + d-cache-sets = <128>; // 32KiB(size)/64(line-size)=512ways/4-way set + i-cache-size = <0x8000>; + i-cache-line-size = <64>; + i-cache-sets = <256>; // 32KiB(size)/64(line-size)=512ways/2-way set + next-level-cache = <&l2>; }; cpu2: cpu@2 {
@@ -62,6 +83,13 @@ reg = <2>; enable-method = "spin-table"; cpu-release-addr = <0x0 0x000000e8>; + d-cache-size = <0x8000>; + d-cache-line-size = <64>; + d-cache-sets = <128>; // 32KiB(size)/64(line-size)=512ways/4-way set + i-cache-size = <0x8000>; + i-cache-line-size = <64>; + i-cache-sets = <256>; // 32KiB(size)/64(line-size)=512ways/2-way set + next-level-cache = <&l2>; }; cpu3: cpu@3 {
@@ -70,6 +98,27 @@ reg = <3>; enable-method = "spin-table"; cpu-release-addr = <0x0 0x000000f0>; + d-cache-size = <0x8000>; + d-cache-line-size = <64>; + d-cache-sets = <128>; // 32KiB(size)/64(line-size)=512ways/4-way set + i-cache-size = <0x8000>; + i-cache-line-size = <64>; + i-cache-sets = <256>; // 32KiB(size)/64(line-size)=512ways/2-way set + next-level-cache = <&l2>; + }; + + /* Source for cache-line-size + cache-sets + * https://developer.arm.com/documentation/ddi0500 + * /e/level-2-memory-system/about-the-l2-memory-system?lang=en + * Source for cache-size + * https://datasheets.raspberrypi.com/cm/cm1-and-cm3-datasheet.pdf + */ + l2: l2-cache0 { + compatible = "cache"; + cache-size = <0x80000>; + cache-line-size = <64>; + cache-sets = <512>; // 512KiB(size)/64(line-size)=8192ways/16-way set + cache-level = <2>; }; }; };
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 489/599 ASoC: madera: Add dependencies on MFD
In reply to Greg Kroah-HartmanFrom: Charles Keepax <[email protected]>
[ Upstream commit ec29170c724ca30305fc3a19ba2ee73ecac65509 ]
The Madera CODECs use regmap_irq functions but nothing ensures that regmap_irq is built into the kernel. Add dependencies on the ASoC symbols for the relevant MFD component. There is no point in building the ASoC driver if the MFD doesn't support it and the MFD part contains the necessary dependencies to ensure everything is built into the kernel.
--- sound/soc/codecs/Kconfig | 5 +++++ 1 file changed, 5 insertions(+)
sound/soc/codecs/Kconfig +5 -0
@@ -659,6 +659,7 @@ config SND_SOC_CS4349 config SND_SOC_CS47L15 tristate + depends on MFD_CS47L15 config SND_SOC_CS47L24 tristate
@@ -666,15 +667,19 @@ config SND_SOC_CS47L24 config SND_SOC_CS47L35 tristate + depends on MFD_CS47L35 config SND_SOC_CS47L85 tristate + depends on MFD_CS47L85 config SND_SOC_CS47L90 tristate + depends on MFD_CS47L90 config SND_SOC_CS47L92 tristate + depends on MFD_CS47L92 # Cirrus Logic Quad-Channel ADC config SND_SOC_CS53L30
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 490/599 media: atomisp_gmin_platform: Add DMI quirk to not turn AXP ELDO2 regulator off on some boards
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit 2c39a01154ea57d596470afa1d278e3be3b37f6a ]
The TrekStor SurfTab duo W1 10.1 has a hw bug where turning eldo2 back on after having turned it off causes the CPLM3218 ambient-light-sensor on the front camera sensor's I2C bus to crash, hanging the bus.
Add a DMI quirk table for systems on which to leave eldo2 on.
Note an alternative fix is to turn off the CPLM3218 ambient-light-sensor as long as the camera sensor is being used, this is what Windows seems to do as a workaround (based on analyzing the DSDT). But that is not easy to do cleanly under Linux.
--- .../media/atomisp/pci/atomisp_gmin_platform.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c +18 -0
@@ -729,6 +729,21 @@ static int axp_regulator_set(struct device *dev, struct gmin_subdev *gs,return 0 ; } +/* +* Some boards contain a hw-bug where turning eldo2 back on after having turned +* it off causes the CPLM3218 ambient-light-sensor on the image-sensor's I2C bus +* to crash, hanging the bus. Do not turn eldo2 off on these systems. +*/ +static const struct dmi_system_id axp_leave_eldo2_on_ids[] = { + { + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"TrekStor" ), +DMI_MATCH (DMI_PRODUCT_NAME ,"SurfTab duo W1 10.1 (VT4)" ), + }, + }, + { } +}; +static int axp_v1p8_on (struct device *dev,struct gmin_subdev *gs) {int ret;
@@ -763,6 +778,9 @@ static int axp_v1p8_off(struct device *dev, struct gmin_subdev *gs)if (ret)return ret; +if (dmi_check_system (axp_leave_eldo2_on_ids)) +return 0 ; + ret =axp_regulator_set (dev, gs, gs->eldo2_sel_reg, gs->eldo2_1p8v,ELDO_CTRL_REG , gs->eldo2_ctrl_shift, false);return ret;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 491/599 media: atomisp: fix dummy_ptr check to avoid duplicate active_bo
In reply to Greg Kroah-HartmanFrom: Tsuchiya Yuto <[email protected]>
[ Upstream commit 127efdbc51fe6064336c0452ce9c910b3e107cf0 ]
The dummy_ptr check in hmm_init() [1] results in the following "hmm_init Failed to create sysfs" error exactly once every two times on atomisp reload by rmmod/insmod (although atomisp module loads and works fine regardless of this error):
[ 140.230662] sysfs: cannot create duplicate filename '/devices/pci0000:00/0000:00:03.0/active_bo' [ 140.230668] CPU: 1 PID: 2502 Comm: insmod Tainted: G C OE 5.15.0-rc4-1-surface-mainline #1 b8acf6eb64994414b2e20bad312a7a2c45f748f9 [ 140.230675] Hardware name: OEMB OEMB/OEMB, BIOS 1.51116.238 03/09/2015 [ 140.230678] Call Trace: [ 140.230687] dump_stack_lvl+0x46/0x5a [ 140.230702] sysfs_warn_dup.cold+0x17/0x24 [ 140.230710] sysfs_add_file_mode_ns+0x160/0x170 [ 140.230717] internal_create_group+0x126/0x390 [ 140.230723] hmm_init+0x5c/0x70 [atomisp 7a6a680bf400629363d2a6f58fd10e7299678b99] [ 140.230811] atomisp_pci_probe.cold+0x1136/0x148e [atomisp 7a6a680bf400629363d2a6f58fd10e7299678b99] [ 140.230875] local_pci_probe+0x45/0x80 [ 140.230882] ? pci_match_device+0xd7/0x130 [ 140.230887] pci_device_probe+0xfa/0x1b0 [ 140.230892] really_probe+0x1f5/0x3f0 [ 140.230899] __driver_probe_device+0xfe/0x180 [ 140.230903] driver_probe_device+0x1e/0x90 [ 140.230908] __driver_attach+0xc0/0x1c0 [ 140.230912] ? __device_attach_driver+0xe0/0xe0 [ 140.230915] ? __device_attach_driver+0xe0/0xe0 [ 140.230919] bus_for_each_dev+0x89/0xd0 [ 140.230924] bus_add_driver+0x12b/0x1e0 [ 140.230929] driver_register+0x8f/0xe0 [ 140.230933] ? 0xffffffffc153f000 [ 140.230937] do_one_initcall+0x57/0x220 [ 140.230945] do_init_module+0x5c/0x260 [ 140.230952] load_module+0x24bd/0x26a0 [ 140.230962] ? __do_sys_finit_module+0xae/0x110 [ 140.230966] __do_sys_finit_module+0xae/0x110 [ 140.230972] do_syscall_64+0x5c/0x80 [ 140.230979] ? syscall_exit_to_user_mode+0x23/0x40 [ 140.230983] ? do_syscall_64+0x69/0x80 [ 140.230988] ? exc_page_fault+0x72/0x170 [ 140.230991] entry_SYSCALL_64_after_hwframe+0x44/0xae [ 140.230997] RIP: 0033:0x7f7fd5d8718d [ 140.231003] Code: b4 0c 00 0f 05 eb a9 66 0f 1f 44 00 00 f3 0f 1e fa 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d b3 6c 0c 00 f7 d8 64 89 01 48 [ 140.231006] RSP: 002b:00007ffefc25f0e8 EFLAGS: 00000246 ORIG_RAX: 0000000000000139 [ 140.231012] RAX: ffffffffffffffda RBX: 000055ac3edcd7f0 RCX: 00007f7fd5d8718d [ 140.231015] RDX: 0000000000000000 RSI: 000055ac3d723270 RDI: 0000000000000003 [ 140.231017] RBP: 0000000000000000 R08: 0000000000000000 R09: 00007f7fd5e52380 [ 140.231019] R10: 0000000000000003 R11: 0000000000000246 R12: 000055ac3d723270 [ 140.231021] R13: 0000000000000000 R14: 000055ac3edd06e0 R15: 0000000000000000 [ 140.231038] atomisp-isp2 0000:00:03.0: hmm_init Failed to create sysfs
The problem is that dummy_ptr == 0 is a valid value. So, change the logic which checks if dummy_ptr was allocated.
At this point, atomisp now gives WARN_ON() in hmm_free() [2] on atomisp reload by rmmod/insmod. Again, the check is wrong there.
So, change both checks for mmgr_EXCEPTION, which is the error value when HMM allocation fails, and initialize dummy_ptr with such value.
[1] added on commit
d9ab83953fa7 ("media: atomisp: don't cause a warn if probe failed")
[2] added on commit
b83cc378dfc4 ("atomisp: clean up the hmm init/cleanup indirections")
--- drivers/staging/media/atomisp/pci/hmm/hmm.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/staging/media/atomisp/pci/hmm/hmm.c +4 -3
@@ -39,7 +39,7 @@struct hmm_bo_device bo_device;struct hmm_pool dynamic_pool;struct hmm_pool reserved_pool; -static ia_css_ptr dummy_ptr; +static ia_css_ptr dummy_ptr = mmgr_EXCEPTION;static bool hmm_initialized;struct _hmm_mem_stat hmm_mem_stat;
@@ -209,7 +209,7 @@ int hmm_init(void)void hmm_cleanup (void ) { -if (!dummy_ptr) +if (dummy_ptr == mmgr_EXCEPTION)return ;sysfs_remove_group (&atomisp_dev->kobj, atomisp_attribute_group);
@@ -288,7 +288,8 @@ void hmm_free(ia_css_ptr virt)dev_dbg (atomisp_dev,"%s: free 0x%08x\n" , __func__, virt); -WARN_ON (!virt); +if (WARN_ON (virt == mmgr_EXCEPTION)) +return ; bo =hmm_bo_device_search_start (&bo_device, (unsigned int )virt);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 492/599 ARM: ftrace: avoid redundant loads or clobbering IP
In reply to Greg Kroah-HartmanFrom: Ard Biesheuvel <[email protected]>
[ Upstream commit d11967870815b5ab89843980e35aab616c97c463 ]
Tweak the ftrace return paths to avoid redundant loads of SP, as well as unnecessary clobbering of IP.
This also fixes the inconsistency of using MOV to perform a function return, which is sub-optimal on recent micro-architectures but more importantly, does not perform an interworking return, unlike compiler generated function returns in Thumb2 builds.
Let's fix this by popping PC from the stack like most ordinary code does.
--- arch/arm/kernel/entry-ftrace.S | 51 +++++++++++++++------------------- 1 file changed, 22 insertions(+), 29 deletions(-)
arch/arm/kernel/entry-ftrace.S +22 -29
@@ -22,10 +22,7 @@ * mcount can be thought of as a function called in the middle of a subroutine * call. As such, it needs to be transparent for both the caller and the * callee: the original lr needs to be restored when leaving mcount, and no - * registers should be clobbered. (In the __gnu_mcount_nc implementation, we - * clobber the ip register. This is OK because the ARM calling convention - * allows it to be clobbered in subroutines and doesn't use it to hold - * parameters.) + * registers should be clobbered. * * When using dynamic ftrace, we patch out the mcount call by a "pop {lr}" * instead of the __gnu_mcount_nc call (see arch/arm/kernel/ftrace.c).
@@ -70,26 +67,25 @@ .macro __ftrace_regs_caller - sub sp, sp, #8 @ space for PC and CPSR OLD_R0, + str lr, [sp, #-8]! @ store LR as PC and make space for CPSR/OLD_R0, @ OLD_R0 will overwrite previous LR - add ip, sp, #12 @ move in IP the value of SP as it was - @ before the push {lr} of the mcount mechanism + ldr lr, [sp, #8] @ get previous LR - str lr, [sp, #0] @ store LR instead of PC + str r0, [sp, #8] @ write r0 as OLD_R0 over previous LR - ldr lr, [sp, #8] @ get previous LR + str lr, [sp, #-4]! @ store previous LR as LR - str r0, [sp, #8] @ write r0 as OLD_R0 over previous LR + add lr, sp, #16 @ move in LR the value of SP as it was + @ before the push {lr} of the mcount mechanism - stmdb sp!, {ip, lr} - stmdb sp!, {r0-r11, lr} + push {r0-r11, ip, lr} @ stack content at this point: @ 0 4 48 52 56 60 64 68 72 - @ R0 | R1 | ... | LR | SP + 4 | previous LR | LR | PSR | OLD_R0 | + @ R0 | R1 | ... | IP | SP + 4 | previous LR | LR | PSR | OLD_R0 | - mov r3, sp @ struct pt_regs* + mov r3, sp @ struct pt_regs* ldr r2, =function_trace_op ldr r2, [r2] @ pointer to the current
@@ -112,11 +108,9 @@ ftrace_graph_regs_call: #endif @ pop saved regs - ldmia sp!, {r0-r12} @ restore r0 through r12 - ldr ip, [sp, #8] @ restore PC - ldr lr, [sp, #4] @ restore LR - ldr sp, [sp, #0] @ restore SP - mov pc, ip @ return + pop {r0-r11, ip, lr} @ restore r0 through r12 + ldr lr, [sp], #4 @ restore LR + ldr pc, [sp], #12 .endm #ifdef CONFIG_FUNCTION_GRAPH_TRACER
@@ -132,11 +126,9 @@ ftrace_graph_regs_call: bl prepare_ftrace_return @ pop registers saved in ftrace_regs_caller - ldmia sp!, {r0-r12} @ restore r0 through r12 - ldr ip, [sp, #8] @ restore PC - ldr lr, [sp, #4] @ restore LR - ldr sp, [sp, #0] @ restore SP - mov pc, ip @ return + pop {r0-r11, ip, lr} @ restore r0 through r12 + ldr lr, [sp], #4 @ restore LR + ldr pc, [sp], #12 .endm #endif
@@ -202,16 +194,17 @@ ftrace_graph_call\suffix: .endm .macro mcount_exit - ldmia sp!, {r0-r3, ip, lr} - ret ip + ldmia sp!, {r0-r3} + ldr lr, [sp, #4] + ldr pc, [sp], #8 .endm ENTRY(__gnu_mcount_nc) UNWIND(.fnstart) #ifdef CONFIG_DYNAMIC_FTRACE - mov ip, lr - ldmia sp!, {lr} - ret ip + push {lr} + ldr lr, [sp, #4] + ldr pc, [sp], #8 #else __mcount #endif
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 493/599 ARM: dts: imx7: Use audio_mclk_post_div instead audio_mclk_root_clk
In reply to Greg Kroah-HartmanFrom: Abel Vesa <[email protected]>
[ Upstream commit 4cb7df64c732b2b9918424095c11660c2a8c4a33 ]
The audio_mclk_root_clk was added as a gate with the CCGR121 (0x4790), but according to the reference manual, there is no such gate. Moreover, the consumer driver of the mentioned clock might gate it and leave the ECSPI2 (the true owner of that gate) hanging. So lets use the audio_mclk_post_div, which is the parent.
--- arch/arm/boot/dts/imx7-colibri.dtsi | 4 ++-- arch/arm/boot/dts/imx7-mba7.dtsi | 2 +- arch/arm/boot/dts/imx7d-nitrogen7.dts | 2 +- arch/arm/boot/dts/imx7d-pico-hobbit.dts | 4 ++-- arch/arm/boot/dts/imx7d-pico-pi.dts | 4 ++-- arch/arm/boot/dts/imx7d-sdb.dts | 4 ++-- arch/arm/boot/dts/imx7s-warp.dts | 4 ++-- 7 files changed, 12 insertions(+), 12 deletions(-)
arch/arm/boot/dts/imx7-colibri.dtsi +2 -2
@@ -40,7 +40,7 @@ dailink_master: simple-audio-card,codec { sound-dai = <&codec>; - clocks = <&clks IMX7D_AUDIO_MCLK_ROOT_CLK>; + clocks = <&clks IMX7D_AUDIO_MCLK_ROOT_DIV>; }; }; };
@@ -293,7 +293,7 @@ compatible = "fsl,sgtl5000"; #sound-dai-cells = <0>; reg = <0x0a>; - clocks = <&clks IMX7D_AUDIO_MCLK_ROOT_CLK>; + clocks = <&clks IMX7D_AUDIO_MCLK_ROOT_DIV>; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_sai1_mclk>; VDDA-supply = <®_module_3v3_avdd>;
arch/arm/boot/dts/imx7-mba7.dtsi +1 -1
@@ -250,7 +250,7 @@ tlv320aic32x4: audio-codec@18 { compatible = "ti,tlv320aic32x4"; reg = <0x18>; - clocks = <&clks IMX7D_AUDIO_MCLK_ROOT_CLK>; + clocks = <&clks IMX7D_AUDIO_MCLK_ROOT_DIV>; clock-names = "mclk"; ldoin-supply = <®_audio_3v3>; iov-supply = <®_audio_3v3>;
arch/arm/boot/dts/imx7d-nitrogen7.dts +1 -1
@@ -288,7 +288,7 @@ codec: wm8960@1a { compatible = "wlf,wm8960"; reg = <0x1a>; - clocks = <&clks IMX7D_AUDIO_MCLK_ROOT_CLK>; + clocks = <&clks IMX7D_AUDIO_MCLK_ROOT_DIV>; clock-names = "mclk"; wlf,shared-lrclk; };
arch/arm/boot/dts/imx7d-pico-hobbit.dts +2 -2
@@ -31,7 +31,7 @@ dailink_master: simple-audio-card,codec { sound-dai = <&sgtl5000>; - clocks = <&clks IMX7D_AUDIO_MCLK_ROOT_CLK>; + clocks = <&clks IMX7D_AUDIO_MCLK_ROOT_DIV>; }; }; };
@@ -41,7 +41,7 @@ #sound-dai-cells = <0>; reg = <0x0a>; compatible = "fsl,sgtl5000"; - clocks = <&clks IMX7D_AUDIO_MCLK_ROOT_CLK>; + clocks = <&clks IMX7D_AUDIO_MCLK_ROOT_DIV>; VDDA-supply = <®_2p5v>; VDDIO-supply = <®_vref_1v8>; };
arch/arm/boot/dts/imx7d-pico-pi.dts +2 -2
@@ -31,7 +31,7 @@ dailink_master: simple-audio-card,codec { sound-dai = <&sgtl5000>; - clocks = <&clks IMX7D_AUDIO_MCLK_ROOT_CLK>; + clocks = <&clks IMX7D_AUDIO_MCLK_ROOT_DIV>; }; }; };
@@ -41,7 +41,7 @@ #sound-dai-cells = <0>; reg = <0x0a>; compatible = "fsl,sgtl5000"; - clocks = <&clks IMX7D_AUDIO_MCLK_ROOT_CLK>; + clocks = <&clks IMX7D_AUDIO_MCLK_ROOT_DIV>; VDDA-supply = <®_2p5v>; VDDIO-supply = <®_vref_1v8>; };
arch/arm/boot/dts/imx7d-sdb.dts +2 -2
@@ -378,14 +378,14 @@ codec: wm8960@1a { compatible = "wlf,wm8960"; reg = <0x1a>; - clocks = <&clks IMX7D_AUDIO_MCLK_ROOT_CLK>; + clocks = <&clks IMX7D_AUDIO_MCLK_ROOT_DIV>; clock-names = "mclk"; wlf,shared-lrclk; wlf,hp-cfg = <2 2 3>; wlf,gpio-cfg = <1 3>; assigned-clocks = <&clks IMX7D_AUDIO_MCLK_ROOT_SRC>, <&clks IMX7D_PLL_AUDIO_POST_DIV>, - <&clks IMX7D_AUDIO_MCLK_ROOT_CLK>; + <&clks IMX7D_AUDIO_MCLK_ROOT_DIV>; assigned-clock-parents = <&clks IMX7D_PLL_AUDIO_POST_DIV>; assigned-clock-rates = <0>, <884736000>, <12288000>; };
arch/arm/boot/dts/imx7s-warp.dts +2 -2
@@ -75,7 +75,7 @@ dailink_master: simple-audio-card,codec { sound-dai = <&codec>; - clocks = <&clks IMX7D_AUDIO_MCLK_ROOT_CLK>; + clocks = <&clks IMX7D_AUDIO_MCLK_ROOT_DIV>; }; }; };
@@ -232,7 +232,7 @@ #sound-dai-cells = <0>; reg = <0x0a>; compatible = "fsl,sgtl5000"; - clocks = <&clks IMX7D_AUDIO_MCLK_ROOT_CLK>; + clocks = <&clks IMX7D_AUDIO_MCLK_ROOT_DIV>; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_sai1_mclk>; VDDA-supply = <&vgen4_reg>;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 494/599 arm64: defconfig: build imx-sdma as a module
In reply to Greg Kroah-HartmanFrom: Marcel Ziswiler <[email protected]>
[ Upstream commit e95622289f263662240544a9f0009b25c19e64d4 ]
This avoids firmware load error and sysfs fallback reported as follows:
[ 0.199448] imx-sdma 302c0000.dma-controller: Direct firmware load for imx/sdma/sdma-imx7d.bin failed with error -2 [ 0.199487] imx-sdma 302c0000.dma-controller: Falling back to sysfs fallback for: imx/sdma/sdma-imx7d.bin
--- arch/arm64/configs/defconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/configs/defconfig +1 -1
@@ -837,7 +837,7 @@ CONFIG_DMADEVICES=y CONFIG_DMA_BCM2835=y CONFIG_DMA_SUN6I=m CONFIG_FSL_EDMA=y -CONFIG_IMX_SDMA=y +CONFIG_IMX_SDMA=m CONFIG_K3_DMA=y CONFIG_MV_XOR=y CONFIG_MV_XOR_V2=y
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 495/599 video: fbdev: omapfb: panel-dsi-cm: Use sysfs_emit() instead of snprintf()
In reply to Greg Kroah-HartmanFrom: Jing Yao <[email protected]>
[ Upstream commit f63658a59c3d439c8ad7b290f8ec270980e0f384 ]
Use sysfs_emit instead of scnprintf, snprintf or sprintf.
--- drivers/video/fbdev/omap2/omapfb/displays/panel-dsi-cm.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/video/fbdev/omap2/omapfb/displays/panel-dsi-cm.c +4 -4
@@ -409,7 +409,7 @@ static ssize_t dsicm_num_errors_show(struct device *dev,if (r)return r; -return snprintf (buf,PAGE_SIZE ,"%d\n" , errors); +return sysfs_emit (buf,"%d\n" , errors); } static ssize_t dsicm_hw_revision_show(struct device *dev,
@@ -439,7 +439,7 @@ static ssize_t dsicm_hw_revision_show(struct device *dev,if (r)return r; -return snprintf (buf,PAGE_SIZE ,"%02x.%02x.%02x\n" , id1, id2, id3); +return sysfs_emit (buf,"%02x.%02x.%02x\n" , id1, id2, id3); } static ssize_t dsicm_store_ulps(struct device *dev,
@@ -487,7 +487,7 @@ static ssize_t dsicm_show_ulps(struct device *dev, t = ddata->ulps_enabled;mutex_unlock (&ddata->lock); -return snprintf (buf,PAGE_SIZE ,"%u\n" , t); +return sysfs_emit (buf,"%u\n" , t); } static ssize_t dsicm_store_ulps_timeout(struct device *dev,
@@ -532,7 +532,7 @@ static ssize_t dsicm_show_ulps_timeout(struct device *dev, t = ddata->ulps_timeout;mutex_unlock (&ddata->lock); -return snprintf (buf,PAGE_SIZE ,"%u\n" , t); +return sysfs_emit (buf,"%u\n" , t); } static DEVICE_ATTR(num_dsi_errors, S_IRUGO, dsicm_num_errors_show, NULL);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 496/599 video: fbdev: omapfb: panel-tpo-td043mtea1: Use sysfs_emit() instead of snprintf()
In reply to Greg Kroah-HartmanFrom: Jing Yao <[email protected]>
[ Upstream commit c07a039cbb96748f54c02995bae8131cc9a73b0a ]
Use sysfs_emit instead of scnprintf, snprintf or sprintf.
--- .../video/fbdev/omap2/omapfb/displays/panel-tpo-td043mtea1.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/video/fbdev/omap2/omapfb/displays/panel-tpo-td043mtea1.c +2 -2
@@ -169,7 +169,7 @@ static ssize_t tpo_td043_vmirror_show(struct device *dev, {struct panel_drv_data *ddata =dev_get_drvdata (dev); -return snprintf (buf,PAGE_SIZE ,"%d\n" , ddata->vmirror); +return sysfs_emit (buf,"%d\n" , ddata->vmirror); } static ssize_t tpo_td043_vmirror_store(struct device *dev,
@@ -199,7 +199,7 @@ static ssize_t tpo_td043_mode_show(struct device *dev, {struct panel_drv_data *ddata =dev_get_drvdata (dev); -return snprintf (buf,PAGE_SIZE ,"%d\n" , ddata->mode); +return sysfs_emit (buf,"%d\n" , ddata->mode); } static ssize_t tpo_td043_mode_store(struct device *dev,
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 497/599 video: fbdev: udlfb: replace snprintf in show functions with sysfs_emit
In reply to Greg Kroah-HartmanFrom: Jing Yao <[email protected]>
[ Upstream commit 81a998288956d09d7a7a2303d47e4d60ad55c401 ]
Use sysfs_emit instead of scnprintf, snprintf or sprintf.
--- drivers/video/fbdev/udlfb.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/video/fbdev/udlfb.c +4 -4
@@ -1426,7 +1426,7 @@ static ssize_t metrics_bytes_rendered_show(struct device *fbdev, struct device_attribute *a, char *buf) { struct fb_info *fb_info = dev_get_drvdata(fbdev);struct dlfb_data *dlfb = fb_info->par; -return snprintf (buf,PAGE_SIZE ,"%u\n" , +return sysfs_emit (buf,"%u\n" ,atomic_read (&dlfb->bytes_rendered)); }
@@ -1434,7 +1434,7 @@ static ssize_t metrics_bytes_identical_show(struct device *fbdev, struct device_attribute *a, char *buf) { struct fb_info *fb_info = dev_get_drvdata(fbdev);struct dlfb_data *dlfb = fb_info->par; -return snprintf (buf,PAGE_SIZE ,"%u\n" , +return sysfs_emit (buf,"%u\n" ,atomic_read (&dlfb->bytes_identical)); }
@@ -1442,7 +1442,7 @@ static ssize_t metrics_bytes_sent_show(struct device *fbdev, struct device_attribute *a, char *buf) { struct fb_info *fb_info = dev_get_drvdata(fbdev);struct dlfb_data *dlfb = fb_info->par; -return snprintf (buf,PAGE_SIZE ,"%u\n" , +return sysfs_emit (buf,"%u\n" ,atomic_read (&dlfb->bytes_sent)); }
@@ -1450,7 +1450,7 @@ static ssize_t metrics_cpu_kcycles_used_show(struct device *fbdev, struct device_attribute *a, char *buf) { struct fb_info *fb_info = dev_get_drvdata(fbdev);struct dlfb_data *dlfb = fb_info->par; -return snprintf (buf,PAGE_SIZE ,"%u\n" , +return sysfs_emit (buf,"%u\n" ,atomic_read (&dlfb->cpu_kcycles_used)); }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 498/599 ARM: dts: bcm2711: Add the missing L1/L2 cache information
In reply to Greg Kroah-HartmanFrom: Richard Schleich <[email protected]>
[ Upstream commit 618682b350990f8f1bee718949c4b3858711eb58 ]
This patch fixes the kernel warning "cacheinfo: Unable to detect cache hierarchy for CPU 0" for the bcm2711 on newer kernel versions.
--- arch/arm/boot/dts/bcm2711.dtsi | 50 ++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+)
arch/arm/boot/dts/bcm2711.dtsi +50 -0
@@ -433,12 +433,26 @@ #size-cells = <0>; enable-method = "brcm,bcm2836-smp"; // for ARM 32-bit + /* Source for d/i-cache-line-size and d/i-cache-sets + * https://developer.arm.com/documentation/100095/0003 + * /Level-1-Memory-System/About-the-L1-memory-system?lang=en + * Source for d/i-cache-size + * https://www.raspberrypi.com/documentation/computers + * /processors.html#bcm2711 + */ cpu0: cpu@0 { device_type = "cpu"; compatible = "arm,cortex-a72"; reg = <0>; enable-method = "spin-table"; cpu-release-addr = <0x0 0x000000d8>; + d-cache-size = <0x8000>; + d-cache-line-size = <64>; + d-cache-sets = <256>; // 32KiB(size)/64(line-size)=512ways/2-way set + i-cache-size = <0xc000>; + i-cache-line-size = <64>; + i-cache-sets = <256>; // 48KiB(size)/64(line-size)=768ways/3-way set + next-level-cache = <&l2>; }; cpu1: cpu@1 {
@@ -447,6 +461,13 @@ reg = <1>; enable-method = "spin-table"; cpu-release-addr = <0x0 0x000000e0>; + d-cache-size = <0x8000>; + d-cache-line-size = <64>; + d-cache-sets = <256>; // 32KiB(size)/64(line-size)=512ways/2-way set + i-cache-size = <0xc000>; + i-cache-line-size = <64>; + i-cache-sets = <256>; // 48KiB(size)/64(line-size)=768ways/3-way set + next-level-cache = <&l2>; }; cpu2: cpu@2 {
@@ -455,6 +476,13 @@ reg = <2>; enable-method = "spin-table"; cpu-release-addr = <0x0 0x000000e8>; + d-cache-size = <0x8000>; + d-cache-line-size = <64>; + d-cache-sets = <256>; // 32KiB(size)/64(line-size)=512ways/2-way set + i-cache-size = <0xc000>; + i-cache-line-size = <64>; + i-cache-sets = <256>; // 48KiB(size)/64(line-size)=768ways/3-way set + next-level-cache = <&l2>; }; cpu3: cpu@3 {
@@ -463,6 +491,28 @@ reg = <3>; enable-method = "spin-table"; cpu-release-addr = <0x0 0x000000f0>; + d-cache-size = <0x8000>; + d-cache-line-size = <64>; + d-cache-sets = <256>; // 32KiB(size)/64(line-size)=512ways/2-way set + i-cache-size = <0xc000>; + i-cache-line-size = <64>; + i-cache-sets = <256>; // 48KiB(size)/64(line-size)=768ways/3-way set + next-level-cache = <&l2>; + }; + + /* Source for d/i-cache-line-size and d/i-cache-sets + * https://developer.arm.com/documentation/100095/0003 + * /Level-2-Memory-System/About-the-L2-memory-system?lang=en + * Source for d/i-cache-size + * https://www.raspberrypi.com/documentation/computers + * /processors.html#bcm2711 + */ + l2: l2-cache0 { + compatible = "cache"; + cache-size = <0x100000>; + cache-line-size = <64>; + cache-sets = <1024>; // 1MiB(size)/64(line-size)=16384ways/16-way set + cache-level = <2>; }; };
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 499/599 ASoC: soc-core: skip zero num_dai component in searching dai name
In reply to Greg Kroah-HartmanFrom: Shengjiu Wang <[email protected]>
[ Upstream commit f7d344a2bd5ec81fbd1ce76928fd059e57ec9bea ]
In the case like dmaengine which's not a dai but as a component, the num_dai is zero, dmaengine component has the same component_of_node as cpu dai, when cpu dai component is not ready, but dmaengine component is ready, try to get cpu dai name, the snd_soc_get_dai_name() return -EINVAL, not -EPROBE_DEFER, that cause below error:
asoc-simple-card <card name>: parse error -22
asoc-simple-card: probe of <card name> failed with error -22
The sound card failed to probe.
So this patch fixes the issue above by skipping the zero num_dai component in searching dai name.
--- sound/soc/soc-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/soc-core.c +1 -1
@@ -3020,7 +3020,7 @@ int snd_soc_get_dai_name(struct of_phandle_args *args,for_each_component (pos) { component_of_node =soc_component_to_node (pos); -if (component_of_node != args->np) +if (component_of_node != args->np || !pos->num_dai)continue ; ret =snd_soc_component_of_xlate_dai_name (pos, args, dai_name);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 500/599 media: cx88-mpeg: clear interrupt status register before streaming video
In reply to Greg Kroah-HartmanFrom: Daniel González Cabanelas <[email protected]>
[ Upstream commit 56cb61f70e547e1b0cdfe6ff5a1f1ce6242e6d96 ]
Some cx88 video cards may have transport stream status interrupts set to 1 from cold start, causing errors like this:
cx88xx: cx88_print_irqbits: core:irq mpeg [0x100000] ts_err?*
cx8802: cx8802_mpeg_irq: mpeg:general errors: 0x00100000
According to CX2388x datasheet, the interrupt status register should be cleared before enabling IRQs to stream video.
Fix it by clearing the Transport Stream Interrupt Status register.
--- drivers/media/pci/cx88/cx88-mpeg.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/media/pci/cx88/cx88-mpeg.c +3 -0
@@ -162,6 +162,9 @@ int cx8802_start_dma(struct cx8802_dev *dev,cx_write (MO_TS_GPCNTRL ,GP_COUNT_CONTROL_RESET ); q->count =0 ; +/* clear interrupt status register */ +cx_write (MO_TS_INTSTAT ,0x1f1111 ); +/* enable irqs */ dprintk (1 ,"setting the interrupt mask\n" );cx_set (MO_PCI_INTMSK , core->pci_irqmask |PCI_INT_TSINT );
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 501/599 uaccess: fix type mismatch warnings from access_ok()
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 23fc539e81295b14b50c6ccc5baeb4f3d59d822d ]
On some architectures, access_ok() does not do any argument type checking, so replacing the definition with a generic one causes a few warnings for harmless issues that were never caught before.
Fix the ones that I found either through my own test builds or that were reported by the 0-day bot.
--- arch/arc/kernel/process.c | 2 +- arch/arm/kernel/swp_emulate.c | 2 +- arch/arm/kernel/traps.c | 2 +- arch/csky/kernel/perf_callchain.c | 2 +- arch/csky/kernel/signal.c | 2 +- arch/nios2/kernel/signal.c | 20 +++++++++++--------- arch/powerpc/lib/sstep.c | 4 ++-- arch/riscv/kernel/perf_callchain.c | 4 ++-- arch/sparc/kernel/signal_32.c | 2 +- lib/test_lockup.c | 4 ++-- 10 files changed, 23 insertions(+), 21 deletions(-)
arch/arc/kernel/process.c +1 -1
@@ -43,7 +43,7 @@ SYSCALL_DEFINE0(arc_gettls)return task_thread_info (current)->thr_ptr; } -SYSCALL_DEFINE3(arc_usr_cmpxchg, int *, uaddr, int, expected, int, new) +SYSCALL_DEFINE3(arc_usr_cmpxchg, int __user *, uaddr, int, expected, int, new) {struct pt_regs *regs =current_pt_regs ();u32 uval;
arch/arm/kernel/swp_emulate.c +1 -1
@@ -195,7 +195,7 @@ static int swp_handler(struct pt_regs *regs, unsigned int instr) destreg, EXTRACT_REG_NUM(instr, RT2_OFFSET), data);/* Check access in reasonable access range for both SWP and SWPB */ -if (!access_ok ((address & ~3 ),4 )) { +if (!access_ok ((void __user *)(address & ~3 ),4 )) {pr_debug ("SWP{B} emulation: access to %p not allowed!\n" , (void *)address); res = -EFAULT ;
arch/arm/kernel/traps.c +1 -1
@@ -589,7 +589,7 @@ do_cache_op(unsigned long start, unsigned long end, int flags)if (end < start || flags)return -EINVAL ; -if (!access_ok (start, end - start)) +if (!access_ok ((void __user *)start, end - start))return -EFAULT ;return __do_cache_op (start, end);
arch/csky/kernel/perf_callchain.c +1 -1
@@ -49,7 +49,7 @@ static unsigned long user_backtrace(struct perf_callchain_entry_ctx *entry, {struct stackframe buftail;unsigned long lr =0 ; -unsigned long *user_frame_tail = (unsigned long *)fp; +unsigned long __user *user_frame_tail = (unsigned long __user *)fp;/* Check accessibility of one struct frame_tail beyond */ if (!access_ok (user_frame_tail,sizeof (buftail)))
arch/csky/kernel/signal.c +1 -1
@@ -136,7 +136,7 @@ static inline void __user *get_sigframe(struct ksignal *ksig,static int setup_rt_frame (struct ksignal *ksig,sigset_t *set,struct pt_regs *regs) { -struct rt_sigframe *frame; +struct rt_sigframe __user *frame;int err =0 ;struct csky_vdso *vdso = current->mm->context.vdso;
arch/nios2/kernel/signal.c +11 -9
@@ -36,10 +36,10 @@ struct rt_sigframe {static inline int rt_restore_ucontext (struct pt_regs *regs,struct switch_stack *sw, -struct ucontext *uc,int *pr2) +struct ucontext __user *uc,int *pr2) {int temp; -unsigned long *gregs = uc->uc_mcontext.gregs; +unsigned long __user *gregs = uc->uc_mcontext.gregs;int err;/* Always make any pending restarted system calls return -EINTR */
@@ -102,10 +102,11 @@ asmlinkage int do_rt_sigreturn(struct switch_stack *sw) {struct pt_regs *regs = (struct pt_regs *)(sw +1 );/* Verify, can we follow the stack back */ -struct rt_sigframe *frame = (struct rt_sigframe *) regs->sp; +struct rt_sigframe __user *frame;sigset_t set;int rval; + frame = (struct rt_sigframe __user *) regs->sp;if (!access_ok (frame,sizeof (*frame))) goto badframe;
@@ -124,10 +125,10 @@ asmlinkage int do_rt_sigreturn(struct switch_stack *sw)return 0 ; } -static inline int rt_setup_ucontext (struct ucontext *uc,struct pt_regs *regs) +static inline int rt_setup_ucontext (struct ucontext __user *uc,struct pt_regs *regs) {struct switch_stack *sw = (struct switch_stack *)regs -1 ; -unsigned long *gregs = uc->uc_mcontext.gregs; +unsigned long __user *gregs = uc->uc_mcontext.gregs;int err =0 ; err |=__put_user (MCONTEXT_VERSION , &uc->uc_mcontext.version);
@@ -162,8 +163,9 @@ static inline int rt_setup_ucontext(struct ucontext *uc, struct pt_regs *regs)return err; } -static inline void *get_sigframe (struct ksignal *ksig,struct pt_regs *regs, -size_t frame_size) +static inline void __user *get_sigframe (struct ksignal *ksig, +struct pt_regs *regs, +size_t frame_size) {unsigned long usp;
@@ -174,13 +176,13 @@ static inline void *get_sigframe(struct ksignal *ksig, struct pt_regs *regs, usp =sigsp (usp, ksig);/* Verify, is it 32 or 64 bit aligned */ -return (void *)((usp - frame_size) &-8UL ); +return (void __user *)((usp - frame_size) &-8UL ); }static int setup_rt_frame (struct ksignal *ksig,sigset_t *set,struct pt_regs *regs) { -struct rt_sigframe *frame; +struct rt_sigframe __user *frame;int err =0 ; frame =get_sigframe (ksig, regs,sizeof (*frame));
arch/powerpc/lib/sstep.c +2 -2
@@ -108,9 +108,9 @@ static nokprobe_inline long address_ok(struct pt_regs *regs, {if (!user_mode (regs))return 1 ; -if (__access_ok (ea, nb)) +if (access_ok ((void __user *)ea, nb))return 1 ; -if (__access_ok (ea,1 )) +if (access_ok ((void __user *)ea,1 ))/* Access overlaps the end of the user region */ regs->dar =TASK_SIZE_MAX -1 ;else
arch/riscv/kernel/perf_callchain.c +2 -2
@@ -19,8 +19,8 @@ static unsigned long user_backtrace(struct perf_callchain_entry_ctx *entry, {struct stackframe buftail;unsigned long ra =0 ; -unsigned long *user_frame_tail = - (unsigned long *)(fp -sizeof (struct stackframe )); +unsigned long __user *user_frame_tail = + (unsigned long __user *)(fp -sizeof (struct stackframe ));/* Check accessibility of one struct frame_tail beyond */ if (!access_ok (user_frame_tail,sizeof (buftail)))
arch/sparc/kernel/signal_32.c +1 -1
@@ -65,7 +65,7 @@ struct rt_signal_frame {*/ static inline bool invalid_frame_pointer (void __user *fp,int fplen) { -if ((((unsigned long ) fp) &15 ) || !__access_ok ((unsigned long )fp, fplen)) +if ((((unsigned long ) fp) &15 ) || !access_ok (fp, fplen))return true;return false;
lib/test_lockup.c +2 -2
@@ -417,8 +417,8 @@ static bool test_kernel_ptr(unsigned long addr, int size)return false;/* should be at least readable kernel address */ -if (access_ok (ptr,1 ) || -access_ok (ptr + size -1 ,1 ) || +if (access_ok ((void __user *)ptr,1 ) || +access_ok ((void __user *)ptr + size -1 ,1 ) ||get_kernel_nofault (buf, ptr) ||get_kernel_nofault (buf, ptr + size -1 )) {pr_err ("invalid kernel ptr: %#lx\n" , addr);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 502/599 lib/test_lockup: fix kernel pointer check for separate address spaces
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 5a06fcb15b43d1f7bf740c672950122331cb5655 ]
test_kernel_ptr() uses access_ok() to figure out if a given address points to user space instead of kernel space. However on architectures that set CONFIG_ALTERNATE_USER_ADDRESS_SPACE, a pointer can be valid for both, and the check always fails because access_ok() returns true.
Make the check for user space pointers conditional on the type of address space layout.
--- lib/test_lockup.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
lib/test_lockup.c +8 -3
@@ -417,9 +417,14 @@ static bool test_kernel_ptr(unsigned long addr, int size)return false;/* should be at least readable kernel address */ -if (access_ok ((void __user *)ptr,1 ) || -access_ok ((void __user *)ptr + size -1 ,1 ) || -get_kernel_nofault (buf, ptr) || +if (!IS_ENABLED (CONFIG_ALTERNATE_USER_ADDRESS_SPACE ) && + (access_ok ((void __user *)ptr,1 ) || +access_ok ((void __user *)ptr + size -1 ,1 ))) { +pr_err ("user space ptr invalid in kernel: %#lx\n" , addr); +return true; + } + +if (get_kernel_nofault (buf, ptr) ||get_kernel_nofault (buf, ptr + size -1 )) {pr_err ("invalid kernel ptr: %#lx\n" , addr);return true;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 503/599 ARM: tegra: tamonten: Fix I2C3 pad setting
In reply to Greg Kroah-HartmanFrom: Richard Leitner <[email protected]>
[ Upstream commit 0092c25b541a5422d7e71892a13c55ee91abc34b ]
This patch fixes the tristate configuration for i2c3 function assigned to the dtf pins on the Tamonten Tegra20 SoM.
--- arch/arm/boot/dts/tegra20-tamonten.dtsi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm/boot/dts/tegra20-tamonten.dtsi +3 -3
@@ -183,8 +183,8 @@ }; conf_ata { nvidia,pins = "ata", "atb", "atc", "atd", "ate", - "cdev1", "cdev2", "dap1", "dtb", "gma", - "gmb", "gmc", "gmd", "gme", "gpu7", + "cdev1", "cdev2", "dap1", "dtb", "dtf", + "gma", "gmb", "gmc", "gmd", "gme", "gpu7", "gpv", "i2cp", "irrx", "irtx", "pta", "rm", "slxa", "slxk", "spia", "spib", "uac";
@@ -203,7 +203,7 @@ }; conf_crtp { nvidia,pins = "crtp", "dap2", "dap3", "dap4", - "dtc", "dte", "dtf", "gpu", "sdio1", + "dtc", "dte", "gpu", "sdio1", "slxc", "slxd", "spdi", "spdo", "spig", "uda"; nvidia,pull = <TEGRA_PIN_PULL_NONE>;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 504/599 ARM: mmp: Fix failure to remove sram device
In reply to Greg Kroah-HartmanFrom: Uwe Kleine-König <[email protected]>
[ Upstream commit 4036b29a146b2749af3bb213b003eb69f3e5ecc4 ]
Make sure in .probe() to set driver data before the function is left to make it possible in .remove() to undo the actions done.
This fixes a potential memory leak and stops returning an error code in .remove() that is ignored by the driver core anyhow.
--- arch/arm/mach-mmp/sram.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-)
arch/arm/mach-mmp/sram.c +12 -10
@@ -72,6 +72,8 @@ static int sram_probe(struct platform_device *pdev)if (!info)return -ENOMEM ; +platform_set_drvdata (pdev, info); + res =platform_get_resource (pdev,IORESOURCE_MEM ,0 );if (res ==NULL ) {dev_err (&pdev->dev,"no memory resource defined\n" );
@@ -107,8 +109,6 @@ static int sram_probe(struct platform_device *pdev)list_add (&info->node, &sram_bank_list);mutex_unlock (&sram_lock); -platform_set_drvdata (pdev, info); -dev_info (&pdev->dev,"initialized\n" );return 0 ;
@@ -127,17 +127,19 @@ static int sram_remove(struct platform_device *pdev)struct sram_bank_info *info; info =platform_get_drvdata (pdev); -if (info ==NULL ) -return -ENODEV ; -mutex_lock (&sram_lock); -list_del (&info->node); -mutex_unlock (&sram_lock); +if (info->sram_size) { +mutex_lock (&sram_lock); +list_del (&info->node); +mutex_unlock (&sram_lock); + +gen_pool_destroy (info->gpool); +iounmap (info->sram_virt); +kfree (info->pool_name); + } -gen_pool_destroy (info->gpool); -iounmap (info->sram_virt); -kfree (info->pool_name);kfree (info); +return 0 ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 505/599 video: fbdev: sm712fb: Fix crash in smtcfb_write()
In reply to Greg Kroah-HartmanFrom: Zheyu Ma <[email protected]>
[ Upstream commit 4f01d09b2bbfbcb47b3eb305560a7f4857a32260 ]
When the sm712fb driver writes three bytes to the framebuffer, the driver will crash:
BUG: unable to handle page fault for address: ffffc90001ffffff
RIP: 0010:smtcfb_write+0x454/0x5b0
Call Trace:
vfs_write+0x291/0xd60
? do_sys_openat2+0x27d/0x350
? __fget_light+0x54/0x340
ksys_write+0xce/0x190
do_syscall_64+0x43/0x90
entry_SYSCALL_64_after_hwframe+0x44/0xaeFix it by removing the open-coded endianness fixup-code.
--- drivers/video/fbdev/sm712fb.c | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-)
drivers/video/fbdev/sm712fb.c +4 -17
@@ -1119,7 +1119,7 @@ static ssize_t smtcfb_write(struct fb_in count = total_size - p; } - buffer =kmalloc ((count >PAGE_SIZE ) ?PAGE_SIZE : count,GFP_KERNEL ); + buffer =kmalloc (PAGE_SIZE ,GFP_KERNEL );if (!buffer)return -ENOMEM ;
@@ -1137,24 +1137,11 @@ static ssize_t smtcfb_write(struct fb_inbreak ; } -for (i = c >>2 ; i--;) { -fb_writel (big_swap (*src), dst++); +for (i = (c +3 ) >>2 ; i--;) { +fb_writel (big_swap (*src), dst); + dst++; src++; } -if (c &3 ) { -u8 *src8 = (u8 *)src; -u8 __iomem *dst8 = (u8 __iomem *)dst; - -for (i = c &3 ; i--;) { -if (i &1 ) { -fb_writeb (*src8++, ++dst8); - }else { -fb_writeb (*src8++, --dst8); - dst8 +=2 ; - } - } - dst = (u32 __iomem *)dst8; - } *ppos += c; buf += c;
Greg Kroah-Hartman
maintainerPATCH 506/599 media: Revert "media: em28xx: add missing em28xx_close_extension"
In reply to Greg Kroah-HartmanFrom: Pavel Skripkin <[email protected]>
[ Upstream commit fde18c3bac3f964d8333ae53b304d8fee430502b ]
This reverts commit 2c98b8a3458df03abdc6945bbef67ef91d181938.
Reverted patch causes problems with Hauppauge WinTV dualHD as Maximilian reported [1]. Since quick solution didn't come up let's just revert it to make this device work with upstream kernels.
--- drivers/media/usb/em28xx/em28xx-cards.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/media/usb/em28xx/em28xx-cards.c +1 -4
@@ -4095,11 +4095,8 @@ static void em28xx_usb_disconnect(struct usb_interface *intf)em28xx_close_extension (dev); -if (dev->dev_next) { -em28xx_close_extension (dev->dev_next); +if (dev->dev_next)em28xx_release_resources (dev->dev_next); - } -em28xx_release_resources (dev);if (dev->dev_next) {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 507/599 media: hdpvr: initialize dev->worker at hdpvr_register_videodev
In reply to Greg Kroah-HartmanFrom: Dongliang Mu <[email protected]>
[ Upstream commit 07922937e9a580825f9965c46fd15e23ba5754b6 ]
hdpvr_register_videodev is responsible to initialize a worker in hdpvr_device. However, the worker is only initialized at hdpvr_start_streaming other than hdpvr_register_videodev. When hdpvr_probe does not initialize its worker, the hdpvr_disconnect will encounter one WARN in flush_work.The stack trace is as follows:
hdpvr_disconnect+0xb8/0xf2 drivers/media/usb/hdpvr/hdpvr-core.c:425 usb_unbind_interface+0xbf/0x3a0 drivers/usb/core/driver.c:458 __device_release_driver drivers/base/dd.c:1206 [inline] device_release_driver_internal+0x22a/0x230 drivers/base/dd.c:1237 bus_remove_device+0x108/0x160 drivers/base/bus.c:529 device_del+0x1fe/0x510 drivers/base/core.c:3592 usb_disable_device+0xd1/0x1d0 drivers/usb/core/message.c:1419 usb_disconnect+0x109/0x330 drivers/usb/core/hub.c:2228
Fix this by moving the initialization of dev->worker to the starting of hdpvr_register_videodev
--- drivers/media/usb/hdpvr/hdpvr-video.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/media/usb/hdpvr/hdpvr-video.c +3 -1
@@ -308,7 +308,6 @@ static int hdpvr_start_streaming(struct hdpvr_device *dev) dev->status =STATUS_STREAMING ; -INIT_WORK (&dev->worker, hdpvr_transmit_buffers);schedule_work (&dev->worker); v4l2_dbg(MSG_BUFFER, hdpvr_debug, &dev->v4l2_dev,
@@ -1165,6 +1164,9 @@ int hdpvr_register_videodev(struct hdpvr_device *dev, struct device *parent,bool ac3 = dev->flags &HDPVR_FLAG_AC3_CAP ;int res; +// initialize dev->worker +INIT_WORK (&dev->worker, hdpvr_transmit_buffers); + dev->cur_std =V4L2_STD_525_60 ; dev->width =720 ; dev->height =480 ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 508/599 tracing: Have TRACE_DEFINE_ENUM affect trace event types as well
In reply to Greg Kroah-HartmanFrom: Steven Rostedt (Google) <[email protected]>
[ Upstream commit b3bc8547d3be60898818885f5bf22d0a62e2eb48 ]
The macro TRACE_DEFINE_ENUM is used to convert enums in the kernel to their actual value when they are exported to user space via the trace event format file.
Currently only the enums in the "print fmt" (TP_printk in the TRACE_EVENT macro) have the enums converted. But the enums can be used to denote array size:
field:unsigned int fc_ineligible_rc[EXT4_FC_REASON_MAX]; offset:12; size:36; signed:0;
The EXT4_FC_REASON_MAX has no meaning to userspace but it needs to know that information to know how to parse the array.
Have the array indexes also be parsed as well.
--- kernel/trace/trace_events.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
kernel/trace/trace_events.c +28 -0
@@ -2417,6 +2417,33 @@ static void update_event_printk(struct trace_event_call *call, } } +static void update_event_fields (struct trace_event_call *call, +struct trace_eval_map *map) +{ +struct ftrace_event_field *field; +struct list_head *head; +char *ptr; +int len =strlen (map->eval_string); + + head =trace_get_fields (call); +list_for_each_entry (field, head, link) { + ptr =strchr (field->type,'[' ); +if (!ptr) +continue ; + ptr++; + +if (!isalpha (*ptr) && *ptr !='_' ) +continue ; + +if (strncmp (map->eval_string, ptr, len) !=0 ) +continue ; + + ptr =eval_replace (ptr, map, len); +/* enum/sizeof string smaller than value */ +WARN_ON_ONCE (!ptr); + } +} +void trace_event_eval_update (struct trace_eval_map **map,int len) {struct trace_event_call *call, *p;
@@ -2452,6 +2479,7 @@ void trace_event_eval_update(struct trace_eval_map **map, int len) first = false; }update_event_printk (call, map[i]); +update_event_fields (call, map[i]); } } }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 509/599 mmc: host: Return an error when ->enable_sdio_irq() ops is missing
In reply to Greg Kroah-HartmanFrom: Ulf Hansson <[email protected]>
[ Upstream commit d6c9219ca1139b74541b2a98cee47a3426d754a9 ]
Even if the current WARN() notifies the user that something is severely wrong, we can still end up in a PANIC() when trying to invoke the missing ->enable_sdio_irq() ops. Therefore, let's also return an error code and prevent the host from being added.
While at it, move the code into a separate function to prepare for subsequent changes and for further host caps validations.
--- drivers/mmc/core/host.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
drivers/mmc/core/host.c +13 -2
@@ -513,6 +513,16 @@ struct mmc_host *mmc_alloc_host(int extra, struct device *dev)EXPORT_SYMBOL (mmc_alloc_host); +static int mmc_validate_host_caps (struct mmc_host *host) +{ +if (host->caps &MMC_CAP_SDIO_IRQ && !host->ops->enable_sdio_irq) { +dev_warn (host->parent,"missing ->enable_sdio_irq() ops\n" ); +return -EINVAL ; + } + +return 0 ; +} +/** * mmc_add_host - initialise host hardware * @host: mmc host
@@ -525,8 +535,9 @@ int mmc_add_host(struct mmc_host *host) {int err; -WARN_ON ((host->caps &MMC_CAP_SDIO_IRQ ) && - !host->ops->enable_sdio_irq); + err =mmc_validate_host_caps (host); +if (err) +return err; err =device_add (&host->class_dev);if (err)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 510/599 media: atomisp: fix bad usage at error handling logic
In reply to Greg Kroah-HartmanFrom: Mauro Carvalho Chehab <[email protected]>
[ Upstream commit fc0b582c858ed73f94c8f3375c203ea46f1f7402 ]
As warned by sparse:
atomisp: drivers/staging/media/atomisp/pci/atomisp_acc.c:508 atomisp_acc_load_extensions() warn: iterator used outside loop: 'acc_fw'
The acc_fw interactor is used outside the loop, at the error handling logic. On most cases, this is actually safe there, but, if atomisp_css_set_acc_parameters() has an error, an attempt to use it will pick an invalid value for acc_fw.
--- .../staging/media/atomisp/pci/atomisp_acc.c | 28 +++++++++++++------ 1 file changed, 19 insertions(+), 9 deletions(-)
drivers/staging/media/atomisp/pci/atomisp_acc.c +19 -9
@@ -439,6 +439,18 @@ int atomisp_acc_s_mapped_arg(struct atomisp_sub_device *asd,return 0 ; } +static void atomisp_acc_unload_some_extensions (struct atomisp_sub_device *asd, +int i, +struct atomisp_acc_fw *acc_fw) +{ +while (--i >=0 ) { +if (acc_fw->flags & acc_flag_to_pipe[i].flag) { +atomisp_css_unload_acc_extension (asd, acc_fw->fw, + acc_flag_to_pipe[i].pipe_id); + } + } +} +/* * Appends the loaded acceleration binary extensions to the * current ISP mode. Must be called just before sh_css_start().
@@ -477,16 +489,20 @@ int atomisp_acc_load_extensions(struct atomisp_sub_device *asd) acc_fw->fw, acc_flag_to_pipe[i].pipe_id, acc_fw->type); -if (ret) +if (ret) { +atomisp_acc_unload_some_extensions (asd, i, acc_fw); goto error; + } ext_loaded = true; } } ret =atomisp_css_set_acc_parameters (acc_fw); -if (ret <0 ) +if (ret <0 ) { +atomisp_acc_unload_some_extensions (asd, i, acc_fw); goto error; + } }if (!ext_loaded)
@@ -495,6 +511,7 @@ int atomisp_acc_load_extensions(struct atomisp_sub_device *asd) ret =atomisp_css_update_stream (asd);if (ret) {dev_err (isp->dev,"%s: update stream failed.\n" , __func__); +atomisp_acc_unload_extensions (asd); goto error; }
@@ -502,13 +519,6 @@ int atomisp_acc_load_extensions(struct atomisp_sub_device *asd)return 0 ; error: -while (--i >=0 ) { -if (acc_fw->flags & acc_flag_to_pipe[i].flag) { -atomisp_css_unload_acc_extension (asd, acc_fw->fw, - acc_flag_to_pipe[i].pipe_id); - } - } -list_for_each_entry_continue_reverse (acc_fw, &asd->acc.fw, list) {if (acc_fw->type !=ATOMISP_ACC_FW_LOAD_TYPE_OUTPUT && acc_fw->type !=ATOMISP_ACC_FW_LOAD_TYPE_VIEWFINDER )
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 511/599 ALSA: hda/realtek: Add alc256-samsung-headphone fixup
In reply to Greg Kroah-HartmanFrom: Matt Kramer <[email protected]>
[ Upstream commit ef248d9bd616b04df8be25539a4dc5db4b6c56f4 ]
This fixes the near-silence of the headphone jack on the ALC256-based Samsung Galaxy Book Flex Alpha (NP730QCJ). The magic verbs were found through trial and error, using known ALC298 hacks as inspiration. The fixup is auto-enabled only when the NP730QCJ is detected. It can be manually enabled using model=alc256-samsung-headphone.
--- Documentation/sound/hd-audio/models.rst | 4 ++++ sound/pci/hda/patch_realtek.c | 11 +++++++++++ 2 files changed, 15 insertions(+)
Documentation/sound/hd-audio/models.rst +4 -0
@@ -261,6 +261,10 @@ alc-sense-combo huawei-mbx-stereo Enable initialization verbs for Huawei MBX stereo speakers; might be risky, try this at your own risk +alc298-samsung-headphone + Samsung laptops with ALC298 +alc256-samsung-headphone + Samsung laptops with ALC256 ALC66x/67x/892 ==============
sound/pci/hda/patch_realtek.c +11 -0
@@ -6762,6 +6762,7 @@ enum {ALC236_FIXUP_HP_MUTE_LED ,ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF ,ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET , +ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET ,ALC295_FIXUP_ASUS_MIC_NO_PRESENCE ,ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS , ALC269VC_FIXUP_ACER_HEADSET_MIC,
@@ -8083,6 +8084,14 @@ static const struct hda_fixup alc269_fixups[] = { { } }, }, + [ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = { + .type = HDA_FIXUP_VERBS, + .v.verbs = (const struct hda_verb[]) { + { 0x20, AC_VERB_SET_COEF_INDEX, 0x08}, + { 0x20, AC_VERB_SET_PROC_COEF, 0x2fcf}, + { } + }, + }, [ALC295_FIXUP_ASUS_MIC_NO_PRESENCE] = { .type = HDA_FIXUP_PINS, .v.pins = (const struct hda_pintbl[]) {
@@ -8835,6 +8844,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x144d ,0xc740 ,"Samsung Ativ book 8 (NP870Z5G)" ,ALC269_FIXUP_ATIV_BOOK_8 ),SND_PCI_QUIRK (0x144d ,0xc812 ,"Samsung Notebook Pen S (NT950SBE-X58)" ,ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET ),SND_PCI_QUIRK (0x144d ,0xc830 ,"Samsung Galaxy Book Ion (NT950XCJ-X716A)" ,ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET ), +SND_PCI_QUIRK (0x144d ,0xc832 ,"Samsung Galaxy Book Flex Alpha (NP730QCJ)" ,ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET ),SND_PCI_QUIRK (0x1458 ,0xfa53 ,"Gigabyte BXBT-2807" ,ALC283_FIXUP_HEADSET_MIC ),SND_PCI_QUIRK (0x1462 ,0xb120 ,"MSI Cubi MS-B120" ,ALC283_FIXUP_HEADSET_MIC ), SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC),
@@ -9177,6 +9187,7 @@ static const struct hda_model_fixup alc269_fixup_models[] = { {.id = ALC298_FIXUP_HUAWEI_MBX_STEREO, .name = "huawei-mbx-stereo"}, {.id = ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE, .name = "alc256-medion-headset"}, {.id = ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, .name = "alc298-samsung-headphone"}, + {.id = ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, .name = "alc256-samsung-headphone"}, {.id = ALC255_FIXUP_XIAOMI_HEADSET_MIC, .name = "alc255-xiaomi-headset"}, {.id = ALC274_FIXUP_HP_MIC, .name = "alc274-hp-mic-detect"}, {.id = ALC245_FIXUP_HP_X360_AMP, .name = "alc245-hp-x360-amp"},
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 512/599 KVM: x86/mmu: Check for present SPTE when clearing dirty bit in TDP MMU
In reply to Greg Kroah-HartmanFrom: Sean Christopherson <[email protected]>
commit 3354ef5a592d219364cf442c2f784ce7ad7629fd upstream.
Explicitly check for present SPTEs when clearing dirty bits in the TDP MMU. This isn't strictly required for correctness, as setting the dirty bit in a defunct SPTE will not change the SPTE from !PRESENT to PRESENT. However, the guarded MMU_WARN_ON() in spte_ad_need_write_protect() would complain if anyone actually turned on KVM's MMU debugging.
Message-Id: <[email protected]>
--- arch/x86/kvm/mmu/tdp_mmu.c | 3 +++ 1 file changed, 3 insertions(+)
arch/x86/kvm/mmu/tdp_mmu.c +3 -0
@@ -902,6 +902,9 @@ static bool clear_dirty_gfn_range(structif (tdp_mmu_iter_cond_resched (kvm, &iter, false))continue ; +if (!is_shadow_present_pte (iter.old_spte)) +continue ; +if (spte_ad_need_write_protect (iter.old_spte)) {if (is_writable_pte (iter.old_spte)) new_spte = iter.old_spte & ~PT_WRITABLE_MASK ;
Greg Kroah-Hartman
maintainerPATCH 513/599 powerpc/kasan: Fix early region not updated correctly
In reply to Greg Kroah-HartmanFrom: Chen Jingwen <[email protected]>
commit dd75080aa8409ce10d50fb58981c6b59bf8707d3 upstream.
The shadow's page table is not updated when PTE_RPN_SHIFT is 24 and PAGE_SHIFT is 12. It not only causes false positives but also false negative as shown the following text.
Fix it by bringing the logic of kasan_early_shadow_page_entry here.
1. False Positive:
==================================================================
BUG: KASAN: vmalloc-out-of-bounds in pcpu_alloc+0x508/0xa50
Write of size 16 at addr f57f3be0 by task swapper/0/1
CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.15.0-12267-gdebe436e77c7 #1
Call Trace:
[c80d1c20] [c07fe7b8] dump_stack_lvl+0x4c/0x6c (unreliable)
[c80d1c40] [c02ff668] print_address_description.constprop.0+0x88/0x300
[c80d1c70] [c02ff45c] kasan_report+0x1ec/0x200
[c80d1cb0] [c0300b20] kasan_check_range+0x160/0x2f0
[c80d1cc0] [c03018a4] memset+0x34/0x90
[c80d1ce0] [c0280108] pcpu_alloc+0x508/0xa50
[c80d1d40] [c02fd7bc] __kmem_cache_create+0xfc/0x570
[c80d1d70] [c0283d64] kmem_cache_create_usercopy+0x274/0x3e0
[c80d1db0] [c2036580] init_sd+0xc4/0x1d0
[c80d1de0] [c00044a0] do_one_initcall+0xc0/0x33c
[c80d1eb0] [c2001624] kernel_init_freeable+0x2c8/0x384
[c80d1ef0] [c0004b14] kernel_init+0x24/0x170
[c80d1f10] [c001b26c] ret_from_kernel_thread+0x5c/0x64
Memory state around the buggy address:
f57f3a80: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
f57f3b00: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
>f57f3b80: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
^
f57f3c00: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
f57f3c80: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
==================================================================2. False Negative (with KASAN tests):
==================================================================
Before fix:
ok 45 - kmalloc_double_kzfree
# vmalloc_oob: EXPECTATION FAILED at lib/test_kasan.c:1039 KASAN failure expected in "((volatile char *)area)[3100]", but none occurred not ok 46 - vmalloc_oob
not ok 1 - kasan
==================================================================
After fix:
ok 1 - kasan
--- arch/powerpc/mm/kasan/kasan_init_32.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arch/powerpc/mm/kasan/kasan_init_32.c +1 -2
@@ -83,13 +83,12 @@ void __init kasan_update_early_region(unsigned long k_start, unsigned long k_end, pte_t pte) {unsigned long k_cur; -phys_addr_t pa =__pa (kasan_early_shadow_page);for (k_cur = k_start; k_cur != k_end; k_cur +=PAGE_SIZE ) {pmd_t *pmd =pmd_off_k (k_cur);pte_t *ptep =pte_offset_kernel (pmd, k_cur); -if ((pte_val (*ptep) &PTE_RPN_MASK ) != pa) +if (pte_page (*ptep) !=virt_to_page (lm_alias (kasan_early_shadow_page)))continue ;__set_pte_at (&init_mm, k_cur, ptep, pte,0 );
Greg Kroah-Hartman
maintainerPATCH 514/599 powerpc/lib/sstep: Fix sthcx instruction
In reply to Greg Kroah-HartmanFrom: Anders Roxell <[email protected]>
commit a633cb1edddaa643fadc70abc88f89a408fa834a upstream.
Looks like there been a copy paste mistake when added the instruction 'stbcx' twice and one was probably meant to be 'sthcx'. Changing to 'sthcx' from 'stbcx'.
--- arch/powerpc/lib/sstep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/lib/sstep.c +1 -1
@@ -3187,7 +3187,7 @@ int emulate_loadstore(struct pt_regs *re__put_user_asmx (op->val, ea, err,"stbcx." , cr);break ;case 2 : -__put_user_asmx (op->val, ea, err,"stbcx." , cr); +__put_user_asmx (op->val, ea, err,"sthcx." , cr);break ;#endif case 4 :
Greg Kroah-Hartman
maintainerPATCH 515/599 powerpc/lib/sstep: Fix build errors with newer binutils
In reply to Greg Kroah-HartmanFrom: Anders Roxell <[email protected]>
commit 8219d31effa7be5dbc7ff915d7970672e028c701 upstream.
Building tinyconfig with gcc (Debian 11.2.0-16) and assembler (Debian 2.37.90.20220207) the following build error shows up:
{standard input}: Assembler messages:
{standard input}:10576: Error: unrecognized opcode: stbcx.' {standard input}:10680: Error: unrecognized opcode: lharx' {standard input}:10694: Error: unrecognized opcode: `lbarx'
Rework to add assembler directives [1] around the instruction. The problem with this might be that we can trick a power6 into single-stepping through an stbcx. for instance, and it will execute that in kernel mode.
[1] https://sourceware.org/binutils/docs/as/PowerPC_002dPseudo.html#PowerPC_002dPseudo
--- arch/powerpc/lib/sstep.c | 6 ++++++ 1 file changed, 6 insertions(+)
arch/powerpc/lib/sstep.c +6 -0
@@ -949,7 +949,10 @@ NOKPROBE_SYMBOL(emulate_dcbz);#define __put_user_asmx (x, addr, err, op, cr) \ __asm__ __volatile__( \ + ".machine push\n" \ + ".machine power8\n" \ "1: " op " %2,0,%3\n" \ + ".machine pop\n" \ " mfcr %1\n" \ "2:\n" \ ".section .fixup,\"ax\"\n" \
@@ -962,7 +965,10 @@ NOKPROBE_SYMBOL(emulate_dcbz);#define __get_user_asmx (x, addr, err, op) \ __asm__ __volatile__( \ + ".machine push\n" \ + ".machine power8\n" \ "1: "op" %1,0,%2\n" \ + ".machine pop\n" \ "2:\n" \ ".section .fixup,\"ax\"\n" \ "3: li %0,%3\n" \
Greg Kroah-Hartman
maintainerPATCH 516/599 powerpc: Fix build errors with newer binutils
In reply to Greg Kroah-HartmanFrom: Anders Roxell <[email protected]>
commit 8667d0d64dd1f84fd41b5897fd87fa9113ae05e3 upstream.
Building tinyconfig with gcc (Debian 11.2.0-16) and assembler (Debian 2.37.90.20220207) the following build error shows up:
{standard input}: Assembler messages:
{standard input}:1190: Error: unrecognized opcode: stbcix' {standard input}:1433: Error: unrecognized opcode: lwzcix' {standard input}:1453: Error: unrecognized opcode: stbcix' {standard input}:1460: Error: unrecognized opcode: stwcix' {standard input}:1596: Error: unrecognized opcode: `stbcix'
...
Rework to add assembler directives [1] around the instruction. Going through them one by one shows that the changes should be safe. Like __get_user_atomic_128_aligned() is only called in p9_hmi_special_emu(), which according to the name is specific to power9. And __raw_rm_read*() are only called in things that are powernv or book3s_hv specific.
[1] https://sourceware.org/binutils/docs/as/PowerPC_002dPseudo.html#PowerPC_002dPseudo
--- arch/powerpc/include/asm/io.h | 40 ++++++++++++++++++++++++++++------- arch/powerpc/include/asm/uaccess.h | 3 ++ arch/powerpc/platforms/powernv/rng.c | 6 ++++- 3 files changed, 40 insertions(+), 9 deletions(-)
arch/powerpc/include/asm/io.h +32 -8
@@ -344,25 +344,37 @@ static inline void __raw_writeq_be(unsig*/ static inline void __raw_rm_writeb (u8 val,volatile void __iomem *paddr) { - __asm__ __volatile__("stbcix %0,0,%1" + __asm__ __volatile__(".machine push; \ +.machine power6; \ +stbcix %0,0,%1; \ +.machine pop;" : :"r" (val),"r" (paddr) :"memory" ); }static inline void __raw_rm_writew (u16 val,volatile void __iomem *paddr) { - __asm__ __volatile__("sthcix %0,0,%1" + __asm__ __volatile__(".machine push; \ +.machine power6; \ +sthcix %0,0,%1; \ +.machine pop;" : :"r" (val),"r" (paddr) :"memory" ); }static inline void __raw_rm_writel (u32 val,volatile void __iomem *paddr) { - __asm__ __volatile__("stwcix %0,0,%1" + __asm__ __volatile__(".machine push; \ +.machine power6; \ +stwcix %0,0,%1; \ +.machine pop;" : :"r" (val),"r" (paddr) :"memory" ); }static inline void __raw_rm_writeq (u64 val,volatile void __iomem *paddr) { - __asm__ __volatile__("stdcix %0,0,%1" + __asm__ __volatile__(".machine push; \ +.machine power6; \ +stdcix %0,0,%1; \ +.machine pop;" : :"r" (val),"r" (paddr) :"memory" ); }
@@ -374,7 +386,10 @@ static inline void __raw_rm_writeq_be(u6static inline u8 __raw_rm_readb (volatile void __iomem *paddr) {u8 ret; - __asm__ __volatile__("lbzcix %0,0, %1" + __asm__ __volatile__(".machine push; \ +.machine power6; \ +lbzcix %0,0, %1; \ +.machine pop;" :"=r" (ret) :"r" (paddr) :"memory" );return ret; }
@@ -382,7 +397,10 @@ static inline u8 __raw_rm_readb(volatilestatic inline u16 __raw_rm_readw (volatile void __iomem *paddr) {u16 ret; - __asm__ __volatile__("lhzcix %0,0, %1" + __asm__ __volatile__(".machine push; \ +.machine power6; \ +lhzcix %0,0, %1; \ +.machine pop;" :"=r" (ret) :"r" (paddr) :"memory" );return ret; }
@@ -390,7 +408,10 @@ static inline u16 __raw_rm_readw(volatilstatic inline u32 __raw_rm_readl (volatile void __iomem *paddr) {u32 ret; - __asm__ __volatile__("lwzcix %0,0, %1" + __asm__ __volatile__(".machine push; \ +.machine power6; \ +lwzcix %0,0, %1; \ +.machine pop;" :"=r" (ret) :"r" (paddr) :"memory" );return ret; }
@@ -398,7 +419,10 @@ static inline u32 __raw_rm_readl(volatilstatic inline u64 __raw_rm_readq (volatile void __iomem *paddr) {u64 ret; - __asm__ __volatile__("ldcix %0,0, %1" + __asm__ __volatile__(".machine push; \ +.machine power6; \ +ldcix %0,0, %1; \ +.machine pop;" :"=r" (ret) :"r" (paddr) :"memory" );return ret; }
arch/powerpc/include/asm/uaccess.h +3 -0
@@ -229,8 +229,11 @@ extern long __get_user_bad(void);*/ #define __get_user_atomic_128_aligned (kaddr, uaddr, err) \ __asm__ __volatile__( \ + ".machine push\n" \ + ".machine altivec\n" \ "1: lvx 0,0,%1 # get user\n" \ " stvx 0,0,%2 # put kernel\n" \ + ".machine pop\n" \ "2:\n" \ ".section .fixup,\"ax\"\n" \ "3: li %0,%3\n" \
arch/powerpc/platforms/powernv/rng.c +5 -1
@@ -43,7 +43,11 @@ static unsigned long rng_whiten(struct punsigned long parity;/* Calculate the parity of the value */ - asm ("popcntd %0,%1" :"=r" (parity) :"r" (val)); + asm (".machine push; \ +.machine power7; \ +popcntd %0,%1; \ +.machine pop;" + :"=r" (parity) :"r" (val));/* xor our value with the previous mask */ val ^= rng->mask;
Greg Kroah-Hartman
maintainerPATCH 517/599 scsi: qla2xxx: Fix stuck session in gpdb
In reply to Greg Kroah-HartmanFrom: Quinn Tran <[email protected]>
commit 725d3a0d31a51c0debf970011e05f585e805165b upstream.
Fix stuck sessions in get port database. When a thread is in the process of re-establishing a session, a flag is set to prevent multiple threads / triggers from doing the same task. This flag was left on, where any attempt to relogin was locked out. Clear this flag, if the attempt has failed.
--- drivers/scsi/qla2xxx/qla_init.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/scsi/qla2xxx/qla_init.c +3 -3
@@ -1316,9 +1316,9 @@ int qla24xx_async_gpdb(struct scsi_qla_hif (!vha->flags.online || (fcport->flags &FCF_ASYNC_SENT ) || fcport->loop_id ==FC_NO_LOOP_ID ) {ql_log (ql_log_warn, vha,0xffff , -"%s: %8phC - not sending command.\n" , - __func__, fcport->port_name); -return rval; +"%s: %8phC online %d flags %x - not sending command.\n" , + __func__, fcport->port_name, vha->flags.online, fcport->flags); + goto done; } sp =qla2x00_get_sp (vha, fcport,GFP_KERNEL );
Greg Kroah-Hartman
maintainerPATCH 518/599 scsi: qla2xxx: Fix scheduling while atomic
In reply to Greg Kroah-HartmanFrom: Quinn Tran <[email protected]>
commit afd438ff874ca40b74321b3fa19bd61adfd7ca0c upstream.
The driver makes a call into midlayer (fc_remote_port_delete) which can put the thread to sleep. The thread that originates the call is in interrupt context. The combination of the two trigger a crash. Schedule the call in non-interrupt context where it is more safe.
kernel: BUG: scheduling while atomic: swapper/7/0/0x00010000 kernel: Call Trace: kernel: <IRQ> kernel: dump_stack+0x66/0x81 kernel: __schedule_bug.cold.90+0x5/0x1d kernel: __schedule+0x7af/0x960 kernel: schedule+0x28/0x80 kernel: schedule_timeout+0x26d/0x3b0 kernel: wait_for_completion+0xb4/0x140 kernel: ? wake_up_q+0x70/0x70 kernel: __wait_rcu_gp+0x12c/0x160 kernel: ? sdev_evt_alloc+0xc0/0x180 [scsi_mod] kernel: synchronize_sched+0x6c/0x80 kernel: ? call_rcu_bh+0x20/0x20 kernel: ? __bpf_trace_rcu_invoke_callback+0x10/0x10 kernel: sdev_evt_alloc+0xfd/0x180 [scsi_mod] kernel: starget_for_each_device+0x85/0xb0 [scsi_mod] kernel: ? scsi_init_io+0x360/0x3d0 [scsi_mod] kernel: scsi_init_io+0x388/0x3d0 [scsi_mod] kernel: device_for_each_child+0x54/0x90 kernel: fc_remote_port_delete+0x70/0xe0 [scsi_transport_fc] kernel: qla2x00_schedule_rport_del+0x62/0xf0 [qla2xxx] kernel: qla2x00_mark_device_lost+0x9c/0xd0 [qla2xxx] kernel: qla24xx_handle_plogi_done_event+0x55f/0x570 [qla2xxx] kernel: qla2x00_async_login_sp_done+0xd2/0x100 [qla2xxx] kernel: qla24xx_logio_entry+0x13a/0x3c0 [qla2xxx] kernel: qla24xx_process_response_queue+0x306/0x400 [qla2xxx] kernel: qla24xx_msix_rsp_q+0x3f/0xb0 [qla2xxx] kernel: __handle_irq_event_percpu+0x40/0x180 kernel: handle_irq_event_percpu+0x30/0x80 kernel: handle_irq_event+0x36/0x60
--- drivers/scsi/qla2xxx/qla_init.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/scsi/qla2xxx/qla_init.c +1 -6
@@ -2114,12 +2114,7 @@ qla24xx_handle_plogi_done_event(struct sql_dbg (ql_dbg_disc, vha,0x20eb ,"%s %d %8phC cmd error %x\n" , __func__, __LINE__, ea->fcport->port_name, ea->data[1 ]); - ea->fcport->flags &= ~FCF_ASYNC_SENT ; -qla2x00_set_fcport_disc_state (ea->fcport,DSC_LOGIN_FAILED ); -if (ea->data[1 ] &QLA_LOGIO_LOGIN_RETRIED ) -set_bit (RELOGIN_NEEDED , &vha->dpc_flags); -else -qla2x00_mark_device_lost (vha, ea->fcport,1 ); +qlt_schedule_sess_for_deletion (ea->fcport);break ;case MBS_LOOP_ID_USED :/* data[1] = IO PARAM 1 = nport ID */
Greg Kroah-Hartman
maintainerPATCH 519/599 scsi: qla2xxx: Fix wrong FDMI data for 64G adapter
In reply to Greg Kroah-HartmanFrom: Bikash Hazarika <[email protected]>
commit 1cfbbacbee2d6ea3816386a483e3c7a96e5bd657 upstream.
Corrected transmission speed mask values for FC.
Supported Speed: 16 32 20 Gb/s ===> Should be 64 instead of 20
Supported Speed: 16G 32G 48G ===> Should be 64G instead of 48G
--- drivers/scsi/qla2xxx/qla_def.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/scsi/qla2xxx/qla_def.h +5 -1
@@ -2796,7 +2796,11 @@ struct ct_fdmi2_hba_attributes {#define FDMI_PORT_SPEED_8GB 0x10#define FDMI_PORT_SPEED_16GB 0x20#define FDMI_PORT_SPEED_32GB 0x40 -#define FDMI_PORT_SPEED_64GB 0x80 +#define FDMI_PORT_SPEED_20GB 0x80 +#define FDMI_PORT_SPEED_40GB 0x100 +#define FDMI_PORT_SPEED_128GB 0x200 +#define FDMI_PORT_SPEED_64GB 0x400 +#define FDMI_PORT_SPEED_256GB 0x800#define FDMI_PORT_SPEED_UNKNOWN 0x8000#define FC_CLASS_2 0x04
Greg Kroah-Hartman
maintainerPATCH 520/599 scsi: qla2xxx: Fix warning for missing error code
In reply to Greg Kroah-HartmanFrom: Nilesh Javali <[email protected]>
commit 14cb838d245ae0d523b2f7804af5a02c22e79f5a upstream.
Fix smatch-reported warning message:
drivers/scsi/qla2xxx/qla_target.c:3324 qlt_xmit_response() warn: missing error code 'res'
--- drivers/scsi/qla2xxx/qla_target.c | 1 + 1 file changed, 1 insertion(+)
drivers/scsi/qla2xxx/qla_target.c +1 -0
@@ -3256,6 +3256,7 @@ int qlt_xmit_response(struct qla_tgt_cmd"RESET-RSP online/active/old-count/new-count = %d/%d/%d/%d.\n" , vha->flags.online,qla2x00_reset_active (vha), cmd->reset_count, qpair->chip_reset); + res =0 ; goto out_unmap_unlock; }
Greg Kroah-Hartman
maintainerPATCH 521/599 scsi: qla2xxx: Fix device reconnect in loop topology
In reply to Greg Kroah-HartmanFrom: Arun Easi <[email protected]>
commit 8ad4be3d15cf144b5834bdb00d5bbe4050938dc7 upstream.
A device logout in loop topology initiates a device connection teardown which loses the FW device handle. In loop topo, the device handle is not regrabbed leading to device login failures and eventually to loss of the device. Fix this by taking the main login path that does it.
--- drivers/scsi/qla2xxx/qla_init.c | 15 +++++++++++++++ drivers/scsi/qla2xxx/qla_os.c | 5 +++++ 2 files changed, 20 insertions(+)
drivers/scsi/qla2xxx/qla_init.c +15 -0
@@ -953,6 +953,9 @@ static void qla24xx_handle_gnl_done_evenset_bit (RELOGIN_NEEDED , &vha->dpc_flags); }break ; +case ISP_CFG_NL : +qla24xx_fcport_handle_login (vha, fcport); +break ;default :break ; }
@@ -1480,6 +1483,11 @@ static void qla_chk_n2n_b4_login(structu8 login =0 ;int rc; +ql_dbg (ql_dbg_disc, vha,0x307b , +"%s %8phC DS %d LS %d lid %d retries=%d\n" , + __func__, fcport->port_name, fcport->disc_state, + fcport->fw_login_state, fcport->loop_id, fcport->login_retry); +if (qla_tgt_mode_enabled (vha))return ;
@@ -5377,6 +5385,13 @@ qla2x00_configure_local_loop(scsi_qla_homemcpy (fcport->node_name, new_fcport->node_name,WWN_SIZE ); fcport->scan_state =QLA_FCPORT_FOUND ; +if (fcport->login_retry ==0 ) { + fcport->login_retry = vha->hw->login_retry_count; +ql_dbg (ql_dbg_disc, vha,0x2135 , +"Port login retry %8phN, lid 0x%04x retry cnt=%d.\n" , + fcport->port_name, fcport->loop_id, + fcport->login_retry); + } found++;break ; }
drivers/scsi/qla2xxx/qla_os.c +5 -0
@@ -5391,6 +5391,11 @@ void qla2x00_relogin(struct scsi_qla_hos ea.fcport = fcport;qla24xx_handle_relogin_event (vha, &ea); }else if (vha->hw->current_topology == +ISP_CFG_NL && +IS_QLA2XXX_MIDTYPE (vha->hw)) { + (void )qla24xx_fcport_handle_login (vha, + fcport); + }else if (vha->hw->current_topology ==ISP_CFG_NL ) { fcport->login_retry--; status =
Greg Kroah-Hartman
maintainerPATCH 522/599 scsi: qla2xxx: Add devids and conditionals for 28xx
In reply to Greg Kroah-HartmanFrom: Joe Carnuccio <[email protected]>
commit 0d6a536cb1fcabb6c3e9c94871c8d0b29bb5813b upstream.
This is an update to the original 28xx adapter enablement. Add a bunch of conditionals that are applicable for 28xx.
--- drivers/scsi/qla2xxx/qla_attr.c | 7 ++----- drivers/scsi/qla2xxx/qla_init.c | 8 +++----- drivers/scsi/qla2xxx/qla_mbx.c | 14 +++++++++++--- drivers/scsi/qla2xxx/qla_os.c | 3 +-- drivers/scsi/qla2xxx/qla_sup.c | 4 ++-- drivers/scsi/qla2xxx/qla_target.c | 3 +-- 6 files changed, 20 insertions(+), 19 deletions(-)
drivers/scsi/qla2xxx/qla_attr.c +2 -5
@@ -555,7 +555,7 @@ qla2x00_sysfs_read_vpd(struct file *filpif (!capable (CAP_SYS_ADMIN ))return -EINVAL ; -if (IS_NOCACHE_VPD_TYPE (ha)) +if (!IS_NOCACHE_VPD_TYPE (ha)) goto skip; faddr = ha->flt_region_vpd <<2 ;
@@ -739,7 +739,7 @@ qla2x00_sysfs_write_reset(struct file *fql_log (ql_log_info, vha,0x706f ,"Issuing MPI reset.\n" ); -if (IS_QLA83XX (ha) ||IS_QLA27XX (ha) ||IS_QLA28XX (ha)) { +if (IS_QLA83XX (ha)) {uint32_t idc_control;qla83xx_idc_lock (vha,0 );
@@ -1050,9 +1050,6 @@ qla2x00_free_sysfs_attr(scsi_qla_host_tcontinue ;if (iter->type ==3 && !(IS_CNA_CAPABLE (ha)))continue ; -if (iter->type ==0x27 && - (!IS_QLA27XX (ha) || !IS_QLA28XX (ha))) -continue ;sysfs_remove_bin_file (&host->shost_gendev.kobj, iter->attr);
drivers/scsi/qla2xxx/qla_init.c +3 -5
@@ -3322,7 +3322,7 @@ qla2x00_alloc_fw_dump(scsi_qla_host_t *v mem_size = (ha->fw_memory_size -0x11000 +1 ) *sizeof (uint16_t ); }else if (IS_FWI2_CAPABLE (ha)) { -if (IS_QLA83XX (ha) ||IS_QLA27XX (ha) ||IS_QLA28XX (ha)) +if (IS_QLA83XX (ha)) fixed_size = offsetof(struct qla83xx_fw_dump , ext_mem);else if (IS_QLA81XX (ha)) fixed_size = offsetof(struct qla81xx_fw_dump , ext_mem);
@@ -3334,8 +3334,7 @@ qla2x00_alloc_fw_dump(scsi_qla_host_t *v mem_size = (ha->fw_memory_size -0x100000 +1 ) *sizeof (uint32_t );if (ha->mqenable) { -if (!IS_QLA83XX (ha) && !IS_QLA27XX (ha) && - !IS_QLA28XX (ha)) +if (!IS_QLA83XX (ha)) mq_size =sizeof (struct qla2xxx_mq_chain );/* * Allocate maximum buffer size for all queues - Q0.
@@ -3896,8 +3895,7 @@ enable_82xx_npiv: ha->fw_major_version, ha->fw_minor_version, ha->fw_subminor_version); -if (IS_QLA83XX (ha) ||IS_QLA27XX (ha) || -IS_QLA28XX (ha)) { +if (IS_QLA83XX (ha)) { ha->flags.fac_supported =0 ; rval =QLA_SUCCESS ; }
drivers/scsi/qla2xxx/qla_mbx.c +11 -3
@@ -9,6 +9,12 @@#include <linux/delay.h> #include <linux/gfp.h> +#ifdef CONFIG_PPC +#define IS_PPCARCH true +#else +#define IS_PPCARCH false +#endif + static struct mb_cmd_name { uint16_t cmd; const char *str;
@@ -698,6 +704,9 @@ again: vha->min_supported_speed = nv->min_supported_speed; } + +if (IS_PPCARCH ) + mcp->mb[11 ] |=BIT_4 ; }if (ha->flags.exlogins_enabled)
@@ -2984,8 +2993,7 @@ qla2x00_get_resource_cnts(scsi_qla_host_ ha->orig_fw_iocb_count = mcp->mb[10 ];if (ha->flags.npiv_supported) ha->max_npiv_vports = mcp->mb[11 ]; -if (IS_QLA81XX (ha) ||IS_QLA83XX (ha) ||IS_QLA27XX (ha) || -IS_QLA28XX (ha)) +if (IS_QLA81XX (ha) ||IS_QLA83XX (ha)) ha->fw_max_fcf_count = mcp->mb[12 ]; }
@@ -5546,7 +5554,7 @@ qla2x00_get_data_rate(scsi_qla_host_t *v mcp->out_mb =MBX_1 |MBX_0 ; mcp->in_mb =MBX_2 |MBX_1 |MBX_0 ;if (IS_QLA83XX (ha) ||IS_QLA27XX (ha) ||IS_QLA28XX (ha)) - mcp->in_mb |=MBX_3 ; + mcp->in_mb |=MBX_4 |MBX_3 ; mcp->tov =MBX_TOV_SECONDS ; mcp->flags =0 ; rval =qla2x00_mailbox_command (vha, mcp);
drivers/scsi/qla2xxx/qla_os.c +1 -2
@@ -3673,8 +3673,7 @@ qla2x00_unmap_iobases(struct qla_hw_dataif (ha->mqiobase)iounmap (ha->mqiobase); -if ((IS_QLA83XX (ha) ||IS_QLA27XX (ha) ||IS_QLA28XX (ha)) && - ha->msixbase) +if (ha->msixbase)iounmap (ha->msixbase); } }
drivers/scsi/qla2xxx/qla_sup.c +2 -2
@@ -844,7 +844,7 @@ qla2xxx_get_flt_info(scsi_qla_host_t *vh ha->flt_region_nvram = start;break ;case FLT_REG_IMG_PRI_27XX : -if (IS_QLA27XX (ha) && !IS_QLA28XX (ha)) +if (IS_QLA27XX (ha) ||IS_QLA28XX (ha)) ha->flt_region_img_status_pri = start;break ;case FLT_REG_IMG_SEC_27XX :
@@ -1356,7 +1356,7 @@ next: flash_data_addr(ha, faddr), le32_to_cpu(*dwptr));if (ret) {ql_dbg (ql_dbg_user, vha,0x7006 , -"Failed slopw write %x (%x)\n" , faddr, *dwptr); +"Failed slow write %x (%x)\n" , faddr, *dwptr);break ; } }
drivers/scsi/qla2xxx/qla_target.c +1 -2
@@ -7077,8 +7077,7 @@ qlt_probe_one_stage1(struct scsi_qla_hosif (!QLA_TGT_MODE_ENABLED ())return ; -if ((ql2xenablemsix ==0 ) ||IS_QLA83XX (ha) ||IS_QLA27XX (ha) || -IS_QLA28XX (ha)) { +if (ha->mqenable ||IS_QLA83XX (ha) ||IS_QLA27XX (ha) ||IS_QLA28XX (ha)) {ISP_ATIO_Q_IN (base_vha) = &ha->mqiobase->isp25mq.atio_q_in;ISP_ATIO_Q_OUT (base_vha) = &ha->mqiobase->isp25mq.atio_q_out; }else {
Greg Kroah-Hartman
maintainerPATCH 523/599 scsi: qla2xxx: Check for firmware dump already collected
In reply to Greg Kroah-HartmanFrom: Joe Carnuccio <[email protected]>
commit cfbafad7c6032d449a5a07f2d273acd2437bbc6a upstream.
While allocating firmware dump, check if dump is already collected and do not re-allocate the buffer.
--- drivers/scsi/qla2xxx/qla_init.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/scsi/qla2xxx/qla_init.c +8 -0
@@ -3312,6 +3312,14 @@ qla2x00_alloc_fw_dump(scsi_qla_host_t *vstruct rsp_que *rsp = ha->rsp_q_map[0 ];struct qla2xxx_fw_dump *fw_dump; +if (ha->fw_dump) { +ql_dbg (ql_dbg_init, vha,0x00bd , +"Firmware dump already allocated.\n" ); +return ; + } + + ha->fw_dumped =0 ; + ha->fw_dump_cap_flags =0 ; dump_size = fixed_size = mem_size = eft_size = fce_size = mq_size =0 ; req_q_size = rsp_q_size =0 ;
Greg Kroah-Hartman
maintainerPATCH 524/599 scsi: qla2xxx: Suppress a kernel complaint in qla_create_qpair()
In reply to Greg Kroah-HartmanFrom: Saurav Kashyap <[email protected]>
commit a60447e7d451df42c7bde43af53b34f10f34f469 upstream.
[ 12.323788] BUG: using smp_processor_id() in preemptible [00000000] code: systemd-udevd/1020 [ 12.332297] caller is qla2xxx_create_qpair+0x32a/0x5d0 [qla2xxx] [ 12.338417] CPU: 7 PID: 1020 Comm: systemd-udevd Tainted: G I --------- --- 5.14.0-29.el9.x86_64 #1 [ 12.348827] Hardware name: Dell Inc. PowerEdge R610/0F0XJ6, BIOS 6.6.0 05/22/2018 [ 12.356356] Call Trace: [ 12.358821] dump_stack_lvl+0x34/0x44 [ 12.362514] check_preemption_disabled+0xd9/0xe0 [ 12.367164] qla2xxx_create_qpair+0x32a/0x5d0 [qla2xxx] [ 12.372481] qla2x00_probe_one+0xa3a/0x1b80 [qla2xxx] [ 12.377617] ? _raw_spin_lock_irqsave+0x19/0x40 [ 12.384284] local_pci_probe+0x42/0x80 [ 12.390162] ? pci_match_device+0xd7/0x110 [ 12.396366] pci_device_probe+0xfd/0x1b0 [ 12.402372] really_probe+0x1e7/0x3e0 [ 12.408114] __driver_probe_device+0xfe/0x180 [ 12.414544] driver_probe_device+0x1e/0x90 [ 12.420685] __driver_attach+0xc0/0x1c0 [ 12.426536] ? __device_attach_driver+0xe0/0xe0 [ 12.433061] ? __device_attach_driver+0xe0/0xe0 [ 12.439538] bus_for_each_dev+0x78/0xc0 [ 12.445294] bus_add_driver+0x12b/0x1e0 [ 12.451021] driver_register+0x8f/0xe0 [ 12.456631] ? 0xffffffffc07bc000 [ 12.461773] qla2x00_module_init+0x1be/0x229 [qla2xxx] [ 12.468776] do_one_initcall+0x44/0x200 [ 12.474401] ? load_module+0xad3/0xba0 [ 12.479908] ? kmem_cache_alloc_trace+0x45/0x410 [ 12.486268] do_init_module+0x5c/0x280 [ 12.491730] __do_sys_init_module+0x12e/0x1b0 [ 12.497785] do_syscall_64+0x3b/0x90 [ 12.503029] entry_SYSCALL_64_after_hwframe+0x44/0xae [ 12.509764] RIP: 0033:0x7f554f73ab2e
--- drivers/scsi/qla2xxx/qla_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/qla2xxx/qla_init.c +1 -1
@@ -9143,7 +9143,7 @@ struct qla_qpair *qla2xxx_create_qpair(s qpair->rsp->req = qpair->req; qpair->rsp->qpair = qpair;/* init qpair to this cpu. Will adjust at run time. */ -qla_cpu_update (qpair,smp_processor_id ()); +qla_cpu_update (qpair,raw_smp_processor_id ());if (IS_T10_PI_CAPABLE (ha) && ql2xenabledif) {if (ha->fw_attributes &BIT_4 )
Greg Kroah-Hartman
maintainerPATCH 525/599 scsi: qla2xxx: Fix disk failure to rediscover
In reply to Greg Kroah-HartmanFrom: Quinn Tran <[email protected]>
commit 6a45c8e137d4e2c72eecf1ac7cf64f2fdfcead99 upstream.
User experienced some of the LUN failed to get rediscovered after long cable pull test. The issue is triggered by a race condition between driver setting session online state vs starting the LUN scan process at the same time. Current code set the online state after notifying the session is available. In this case, trigger to start the LUN scan process happened before driver could set the session in online state. LUN scan ends up with failure due to the session online check was failing.
Set the online state before reporting of the availability of the session.
--- drivers/scsi/qla2xxx/qla_init.c | 5 +++-- drivers/scsi/qla2xxx/qla_nvme.c | 5 +++++ 2 files changed, 8 insertions(+), 2 deletions(-)
drivers/scsi/qla2xxx/qla_init.c +3 -2
@@ -5531,6 +5531,8 @@ qla2x00_reg_remote_port(scsi_qla_host_tif (atomic_read (&fcport->state) ==FCS_ONLINE )return ; +qla2x00_set_fcport_state (fcport,FCS_ONLINE ); + rport_ids.node_name =wwn_to_u64 (fcport->node_name); rport_ids.port_name =wwn_to_u64 (fcport->port_name); rport_ids.port_id = fcport->d_id.b.domain << 16 |
@@ -5631,6 +5633,7 @@ qla2x00_update_fcport(scsi_qla_host_t *vqla2x00_reg_remote_port (vha, fcport);break ;case MODE_TARGET : +qla2x00_set_fcport_state (fcport,FCS_ONLINE );if (!vha->vha_tgt.qla_tgt->tgt_stop && !vha->vha_tgt.qla_tgt->tgt_stopped)qlt_fc_port_added (vha, fcport);
@@ -5645,8 +5648,6 @@ qla2x00_update_fcport(scsi_qla_host_t *vbreak ; } -qla2x00_set_fcport_state (fcport,FCS_ONLINE ); -if (IS_IIDMA_CAPABLE (vha->hw) && vha->hw->flags.gpsc_supported) {if (fcport->id_changed) { fcport->id_changed =0 ;
drivers/scsi/qla2xxx/qla_nvme.c +5 -0
@@ -35,6 +35,11 @@ int qla_nvme_register_remote(struct scsi (fcport->nvme_flag & NVME_FLAG_REGISTERED))return 0 ; +if (atomic_read (&fcport->state) ==FCS_ONLINE ) +return 0 ; + +qla2x00_set_fcport_state (fcport,FCS_ONLINE ); + fcport->nvme_flag &= ~NVME_FLAG_RESETTING ;memset (&req,0 ,sizeof (struct nvme_fc_port_info ));
Greg Kroah-Hartman
maintainerPATCH 526/599 scsi: qla2xxx: Fix incorrect reporting of task management failure
In reply to Greg Kroah-HartmanFrom: Quinn Tran <[email protected]>
commit 58ca5999e0367d131de82a75257fbfd5aed0195d upstream.
User experienced no task management error while target device is responding with error. The RSP_CODE field in the status IOCB is in little endian. Driver assumes it's big endian and it picked up erroneous data.
Convert the data back to big endian as is on the wire.
--- drivers/scsi/qla2xxx/qla_isr.c | 1 + 1 file changed, 1 insertion(+)
drivers/scsi/qla2xxx/qla_isr.c +1 -0
@@ -2248,6 +2248,7 @@ qla24xx_tm_iocb_entry(scsi_qla_host_t *v iocb->u.tmf.data =QLA_FUNCTION_FAILED ; }else if ((le16_to_cpu (sts->scsi_status) &SS_RESPONSE_INFO_LEN_VALID )) { +host_to_fcp_swap (sts->data,sizeof (sts->data));if (le32_to_cpu (sts->rsp_data_len) <4 ) { ql_log(ql_log_warn, fcport->vha, 0x503b, "Async-%s error - hdl=%x not enough response(%d).\n",
Greg Kroah-Hartman
maintainerPATCH 527/599 scsi: qla2xxx: Fix hang due to session stuck
In reply to Greg Kroah-HartmanFrom: Quinn Tran <[email protected]>
commit c02aada06d19a215c8291bd968a99a270e96f734 upstream.
User experienced device lost. The log shows Get port data base command was queued up, failed, and requeued again. Every time it is requeued, it set the FCF_ASYNC_ACTIVE. This prevents any recovery code from occurring because driver thinks a recovery is in progress for this session. In essence, this session is hung. The reason it gets into this place is the session deletion got in front of this call due to link perturbation.
Break the requeue cycle and exit. The session deletion code will trigger a session relogin.
--- drivers/scsi/qla2xxx/qla_def.h | 4 ++++ drivers/scsi/qla2xxx/qla_init.c | 19 +++++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-)
drivers/scsi/qla2xxx/qla_def.h +4 -0
@@ -5175,4 +5175,8 @@ struct sff_8247_a0 {#include "qla_gbl.h" #include "qla_dbg.h" #include "qla_inline.h" + +#define IS_SESSION_DELETED (_fcport) (_fcport->disc_state == DSC_DELETE_PEND || \ + _fcport->disc_state == DSC_DELETED) +#endif
drivers/scsi/qla2xxx/qla_init.c +17 -2
@@ -570,6 +570,14 @@ qla2x00_async_adisc(struct scsi_qla_hoststruct srb_iocb *lio;int rval =QLA_FUNCTION_FAILED ; +if (IS_SESSION_DELETED (fcport)) { +ql_log (ql_log_warn, vha,0xffff , +"%s: %8phC is being delete - not sending command.\n" , + __func__, fcport->port_name); + fcport->flags &= ~FCF_ASYNC_ACTIVE ; +return rval; + } +if (!vha->flags.online || (fcport->flags &FCF_ASYNC_SENT ))return rval;
@@ -1316,8 +1324,15 @@ int qla24xx_async_gpdb(struct scsi_qla_hstruct port_database_24xx *pd;struct qla_hw_data *ha = vha->hw; -if (!vha->flags.online || (fcport->flags &FCF_ASYNC_SENT ) || - fcport->loop_id ==FC_NO_LOOP_ID ) { +if (IS_SESSION_DELETED (fcport)) { +ql_log (ql_log_warn, vha,0xffff , +"%s: %8phC is being delete - not sending command.\n" , + __func__, fcport->port_name); + fcport->flags &= ~FCF_ASYNC_ACTIVE ; +return rval; + } + +if (!vha->flags.online || fcport->flags &FCF_ASYNC_SENT ) {ql_log (ql_log_warn, vha,0xffff ,"%s: %8phC online %d flags %x - not sending command.\n" , __func__, fcport->port_name, vha->flags.online, fcport->flags);
Greg Kroah-Hartman
maintainerPATCH 528/599 scsi: qla2xxx: Fix missed DMA unmap for NVMe ls requests
In reply to Greg Kroah-HartmanFrom: Arun Easi <[email protected]>
commit c85ab7d9e27a80e48d5b7d7fb2fe2b0fdb2de523 upstream.
At NVMe ELS request time, request structure is DMA mapped and never unmapped. Fix this by calling the unmap on ELS completion.
--- drivers/scsi/qla2xxx/qla_nvme.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
drivers/scsi/qla2xxx/qla_nvme.c +17 -0
@@ -170,6 +170,18 @@ out:qla2xxx_rel_qpair_sp (sp->qpair, sp); } +static void qla_nvme_ls_unmap (struct srb *sp,struct nvmefc_ls_req *fd) +{ +if (sp->flags &SRB_DMA_VALID ) { +struct srb_iocb *nvme = &sp->u.iocb_cmd; +struct qla_hw_data *ha = sp->fcport->vha->hw; + +dma_unmap_single (&ha->pdev->dev, nvme->u.nvme.cmd_dma, + fd->rqstlen,DMA_TO_DEVICE ); + sp->flags &= ~SRB_DMA_VALID ; + } +} +static void qla_nvme_release_ls_cmd_kref (struct kref *kref) { struct srb *sp = container_of(kref, struct srb, cmd_kref);
@@ -186,6 +198,8 @@ static void qla_nvme_release_ls_cmd_krefspin_unlock_irqrestore (&priv->cmd_lock, flags); fd = priv->fd; + +qla_nvme_ls_unmap (sp, fd); fd->done (fd, priv->comp_status); out:qla2x00_rel_sp (sp);
@@ -332,6 +346,8 @@ static int qla_nvme_ls_req(struct nvme_fdma_sync_single_for_device (&ha->pdev->dev, nvme->u.nvme.cmd_dma, fd->rqstlen,DMA_TO_DEVICE ); + sp->flags |=SRB_DMA_VALID ; + rval =qla2x00_start_sp (sp);if (rval !=QLA_SUCCESS ) { ql_log(ql_log_warn, vha, 0x700e,
@@ -339,6 +355,7 @@ static int qla_nvme_ls_req(struct nvme_fwake_up (&sp->nvme_ls_waitq); sp->priv =NULL ; priv->sp =NULL ; +qla_nvme_ls_unmap (sp, fd);qla2x00_rel_sp (sp);return rval; }
Greg Kroah-Hartman
maintainerPATCH 529/599 scsi: qla2xxx: Fix N2N inconsistent PLOGI
In reply to Greg Kroah-HartmanFrom: Quinn Tran <[email protected]>
commit c13ce47c64ea8f14e77eecb40d1e7c2ac667f898 upstream.
For N2N topology, ELS Passthrough is used to send PLOGI. On failure of ELS pass through PLOGI, driver flipped over to using LLIOCB PLOGI for N2N. This is not consistent. Delete the session to restart the connection where ELS pass through PLOGI would be used consistently.
--- drivers/scsi/qla2xxx/qla_iocb.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/scsi/qla2xxx/qla_iocb.c +3 -5
@@ -2910,6 +2910,7 @@ static void qla2x00_els_dcmd2_sp_done(srset_bit (ISP_ABORT_NEEDED , &vha->dpc_flags);qla2xxx_wake_dpc (vha); +break ; } fallthrough;default :
@@ -2919,9 +2920,7 @@ static void qla2x00_els_dcmd2_sp_done(sr fw_status[0], fw_status[1], fw_status[2]); fcport->flags &= ~FCF_ASYNC_SENT ; -qla2x00_set_fcport_disc_state (fcport, -DSC_LOGIN_FAILED ); -set_bit (RELOGIN_NEEDED , &vha->dpc_flags); +qlt_schedule_sess_for_deletion (fcport);break ; }break ;
@@ -2933,8 +2932,7 @@ static void qla2x00_els_dcmd2_sp_done(sr fw_status[0], fw_status[1], fw_status[2]); sp->fcport->flags &= ~FCF_ASYNC_SENT ; -qla2x00_set_fcport_disc_state (fcport,DSC_LOGIN_FAILED ); -set_bit (RELOGIN_NEEDED , &vha->dpc_flags); +qlt_schedule_sess_for_deletion (fcport);break ; }
Greg Kroah-Hartman
maintainerPATCH 530/599 scsi: qla2xxx: Reduce false trigger to login
In reply to Greg Kroah-HartmanFrom: Quinn Tran <[email protected]>
commit d2646eed7b19a206912f49101178cbbaa507256c upstream.
While a session is in the middle of a relogin, a late RSCN can be delivered from switch. RSCN trigger fabric scan where the scan logic can trigger another session login while a login is in progress. Reduce the extra trigger to prevent multiple logins to the same session.
--- drivers/scsi/qla2xxx/qla_init.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/scsi/qla2xxx/qla_init.c +3 -2
@@ -1560,7 +1560,8 @@ int qla24xx_fcport_handle_login(struct s fcport->conflict, fcport->last_rscn_gen, fcport->rscn_gen, fcport->login_gen, fcport->loop_id, fcport->scan_state); -if (fcport->scan_state !=QLA_FCPORT_FOUND ) +if (fcport->scan_state !=QLA_FCPORT_FOUND || + fcport->disc_state ==DSC_DELETE_PEND )return 0 ; if ((fcport->loop_id != FC_NO_LOOP_ID) &&
@@ -1581,7 +1582,7 @@ int qla24xx_fcport_handle_login(struct sif (vha->host->active_mode ==MODE_TARGET && !N2N_TOPO (vha->hw))return 0 ; -if (fcport->flags &FCF_ASYNC_SENT ) { +if (fcport->flags & (FCF_ASYNC_SENT |FCF_ASYNC_ACTIVE )) {set_bit (RELOGIN_NEEDED , &vha->dpc_flags);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 531/599 scsi: qla2xxx: Use correct feature type field during RFF_ID processing
In reply to Greg Kroah-HartmanFrom: Manish Rangankar <[email protected]>
commit a7e05f7a1bcbe4ee055479242de46c5c16ab03b1 upstream.
During SNS Register FC-4 Features (RFF_ID) the initiator driver was sending incorrect type field for NVMe supported device. Use correct feature type field.
--- drivers/scsi/qla2xxx/qla_gs.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/scsi/qla2xxx/qla_gs.c +2 -3
@@ -676,8 +676,7 @@ qla2x00_rff_id(scsi_qla_host_t *vha, u8return (QLA_SUCCESS ); } -return qla_async_rffid (vha, &vha->d_id,qlt_rff_id (vha), -FC4_TYPE_FCP_SCSI ); +return qla_async_rffid (vha, &vha->d_id,qlt_rff_id (vha), type); } static int qla_async_rffid(scsi_qla_host_t *vha, port_id_t *d_id,
@@ -727,7 +726,7 @@ static int qla_async_rffid(scsi_qla_host/* Prepare CT arguments -- port_id, FC-4 feature, FC-4 type */ ct_req->req.rff_id.port_id =port_id_to_be_id (*d_id); ct_req->req.rff_id.fc4_feature = fc4feature; - ct_req->req.rff_id.fc4_type = fc4type;/* SCSI - FCP */ + ct_req->req.rff_id.fc4_type = fc4type;/* SCSI-FCP or FC-NVMe */ sp->u.iocb_cmd.u.ctarg.req_size =RFF_ID_REQ_SIZE ; sp->u.iocb_cmd.u.ctarg.rsp_size =RFF_ID_RSP_SIZE ;
Greg Kroah-Hartman
maintainerPATCH 532/599 platform: chrome: Split trace include file
In reply to Greg Kroah-HartmanFrom: Gwendal Grignou <[email protected]>
commit eabd9a3807e17e211690e6c40f1405b427b64c48 upstream.
cros_ec_trace.h defined 5 tracing events, 2 for cros_ec_proto and 3 for cros_ec_sensorhub_ring.
These 2 files are in different kernel modules, the traces are defined twice in the kernel which leads to problem enabling only some traces.
Move sensorhub traces from cros_ec_trace.h to cros_ec_sensorhub_trace.h and enable them only in cros_ec_sensorhub kernel module.
Check we can now enable any single traces: without this patch, we can only enable all sensorhub traces or none.
--- drivers/platform/chrome/Makefile | 3 drivers/platform/chrome/cros_ec_sensorhub_ring.c | 3 drivers/platform/chrome/cros_ec_sensorhub_trace.h | 123 ++++++++++++++++++++++ drivers/platform/chrome/cros_ec_trace.h | 95 ---------------- 4 files changed, 127 insertions(+), 97 deletions(-) create mode 100644 drivers/platform/chrome/cros_ec_sensorhub_trace.h
drivers/platform/chrome/Makefile +2 -1
@@ -2,6 +2,7 @@ # tell define_trace.h where to find the cros ec trace header CFLAGS_cros_ec_trace.o:= -I$(src) +CFLAGS_cros_ec_sensorhub_ring.o:= -I$(src) obj-$(CONFIG_CHROMEOS_LAPTOP) += chromeos_laptop.o obj-$(CONFIG_CHROMEOS_PSTORE) += chromeos_pstore.o
@@ -20,7 +21,7 @@ obj-$(CONFIG_CROS_EC_CHARDEV) += cros_e obj-$(CONFIG_CROS_EC_LIGHTBAR) += cros_ec_lightbar.o obj-$(CONFIG_CROS_EC_VBC) += cros_ec_vbc.o obj-$(CONFIG_CROS_EC_DEBUGFS) += cros_ec_debugfs.o -cros-ec-sensorhub-objs := cros_ec_sensorhub.o cros_ec_sensorhub_ring.o cros_ec_trace.o +cros-ec-sensorhub-objs := cros_ec_sensorhub.o cros_ec_sensorhub_ring.o obj-$(CONFIG_CROS_EC_SENSORHUB) += cros-ec-sensorhub.o obj-$(CONFIG_CROS_EC_SYSFS) += cros_ec_sysfs.o obj-$(CONFIG_CROS_USBPD_LOGGER) += cros_usbpd_logger.o
drivers/platform/chrome/cros_ec_sensorhub_ring.c +2 -1
@@ -17,7 +17,8 @@#include <linux/sort.h> #include <linux/slab.h> -#include "cros_ec_trace.h" +#define CREATE_TRACE_POINTS +#include "cros_ec_sensorhub_trace.h" /* Precision of fixed point for the m values from the filter */ #define M_PRECISION BIT(23)
drivers/platform/chrome/cros_ec_sensorhub_trace.h new file +123 -0
123 lines not on this page · raw message
drivers/platform/chrome/cros_ec_trace.h +0 -95
107 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 533/599 KVM: x86: Forbid VMM to set SYNIC/STIMER MSRs when SynIC wasnt activated
In reply to Greg Kroah-HartmanFrom: Vitaly Kuznetsov <[email protected]>
commit b1e34d325397a33d97d845e312d7cf2a8b646b44 upstream.
Setting non-zero values to SYNIC/STIMER MSRs activates certain features, this should not happen when KVM_CAP_HYPERV_SYNIC{,2} was not activated.
Note, it would've been better to forbid writing anything to SYNIC/STIMER MSRs, including zeroes, however, at least QEMU tries clearing HV_X64_MSR_STIMER0_CONFIG without SynIC. HV_X64_MSR_EOM MSR is somewhat 'special' as writing zero there triggers an action, this also should not happen when SynIC wasn't activated.
Message-Id: <[email protected]>
--- arch/x86/kvm/hyperv.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
arch/x86/kvm/hyperv.c +6 -3
@@ -207,7 +207,7 @@ static int synic_set_msr(struct kvm_vcpustruct kvm_vcpu *vcpu =synic_to_vcpu (synic);int ret; -if (!synic->active && !host) +if (!synic->active && (!host || data))return 1 ;trace_kvm_hv_synic_set_msr (vcpu->vcpu_id, msr, data, host);
@@ -253,6 +253,9 @@ static int synic_set_msr(struct kvm_vcpucase HV_X64_MSR_EOM : {int i; +if (!synic->active) +break ; +for (i =0 ; i <ARRAY_SIZE (synic->sint); i++)kvm_hv_notify_acked_sint (vcpu, i);break ;
@@ -636,7 +639,7 @@ static int stimer_set_config(struct kvm_struct kvm_vcpu *vcpu =stimer_to_vcpu (stimer);struct kvm_vcpu_hv_synic *synic =vcpu_to_synic (vcpu); -if (!synic->active && !host) +if (!synic->active && (!host || config))return 1 ; trace_kvm_hv_stimer_set_config(stimer_to_vcpu(stimer)->vcpu_id,
@@ -660,7 +663,7 @@ static int stimer_set_count(struct kvm_vstruct kvm_vcpu *vcpu =stimer_to_vcpu (stimer);struct kvm_vcpu_hv_synic *synic =vcpu_to_synic (vcpu); -if (!synic->active && !host) +if (!synic->active && (!host || count))return 1 ; trace_kvm_hv_stimer_set_count(stimer_to_vcpu(stimer)->vcpu_id,
Greg Kroah-Hartman
maintainerPATCH 534/599 KVM: Prevent module exit until all VMs are freed
In reply to Greg Kroah-HartmanFrom: David Matlack <[email protected]>
commit 5f6de5cbebee925a612856fce6f9182bb3eee0db upstream.
Tie the lifetime the KVM module to the lifetime of each VM via kvm.users_count. This way anything that grabs a reference to the VM via kvm_get_kvm() cannot accidentally outlive the KVM module.
Prior to this commit, the lifetime of the KVM module was tied to the lifetime of /dev/kvm file descriptors, VM file descriptors, and vCPU file descriptors by their respective file_operations "owner" field. This approach is insufficient because references grabbed via kvm_get_kvm() do not prevent closing any of the aforementioned file descriptors.
This fixes a long standing theoretical bug in KVM that at least affects async page faults. kvm_setup_async_pf() grabs a reference via kvm_get_kvm(), and drops it in an asynchronous work callback. Nothing prevents the VM file descriptor from being closed and the KVM module from being unloaded before this callback runs.
Message-Id: <[email protected]>
--- virt/kvm/kvm_main.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
virt/kvm/kvm_main.c +13 -0
@@ -114,6 +114,8 @@ EXPORT_SYMBOL_GPL(kvm_debugfs_dir);static int kvm_debugfs_num_entries;static const struct file_operations stat_fops_per_vm; +static struct file_operations kvm_chardev_ops; +static long kvm_vcpu_ioctl (struct file *file,unsigned int ioctl,unsigned long arg);#ifdef CONFIG_KVM_COMPAT
@@ -818,6 +820,16 @@ static struct kvm *kvm_create_vm(unsignepreempt_notifier_inc (); +/* +* When the fd passed to this ioctl() is opened it pins the module, +* but try_module_get() also prevents getting a reference if the module +* is in MODULE_STATE_GOING (e.g. if someone ran "rmmod --wait"). +*/ +if (!try_module_get (kvm_chardev_ops.owner)) { + r = -ENODEV ; + goto out_err; + } +return kvm; out_err:
@@ -896,6 +908,7 @@ static void kvm_destroy_vm(struct kvm *kpreempt_notifier_dec ();hardware_disable_all ();mmdrop (mm); +module_put (kvm_chardev_ops.owner); }void kvm_get_kvm (struct kvm *kvm)
Greg Kroah-Hartman
maintainerPATCH 535/599 KVM: x86: fix sending PV IPI
In reply to Greg Kroah-HartmanFrom: Li RongQing <[email protected]>
commit c15e0ae42c8e5a61e9aca8aac920517cf7b3e94e upstream.
If apic_id is less than min, and (max - apic_id) is greater than KVM_IPI_CLUSTER_SIZE, then the third check condition is satisfied but the new apic_id does not fit the bitmask. In this case __send_ipi_mask should send the IPI.
This is mostly theoretical, but it can happen if the apic_ids on three iterations of the loop are for example 1, KVM_IPI_CLUSTER_SIZE, 0.
Message-Id: <[email protected]>
--- arch/x86/kernel/kvm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/kvm.c +1 -1
@@ -532,7 +532,7 @@ static void __send_ipi_mask(const struct }else if (apic_id < min && max - apic_id <KVM_IPI_CLUSTER_SIZE ) { ipi_bitmap <<= min - apic_id; min = apic_id; - }else if (apic_id < min +KVM_IPI_CLUSTER_SIZE ) { + }else if (apic_id > min && apic_id < min +KVM_IPI_CLUSTER_SIZE ) { max = apic_id < max ? max : apic_id; }else { ret = kvm_hypercall4(KVM_HC_SEND_IPI, (unsigned long)ipi_bitmap,
Greg Kroah-Hartman
maintainerPATCH 536/599 KVM: SVM: fix panic on out-of-bounds guest IRQ
In reply to Greg Kroah-HartmanFrom: Yi Wang <[email protected]>
commit a80ced6ea514000d34bf1239d47553de0d1ee89e upstream.
As guest_irq is coming from KVM_IRQFD API call, it may trigger crash in svm_update_pi_irte() due to out-of-bounds:
crash> bt
PID: 22218 TASK: ffff951a6ad74980 CPU: 73 COMMAND: "vcpu8"
#0 [ffffb1ba6707fa40] machine_kexec at ffffffff8565b397 #1 [ffffb1ba6707fa90] __crash_kexec at ffffffff85788a6d #2 [ffffb1ba6707fb58] crash_kexec at ffffffff8578995d #3 [ffffb1ba6707fb70] oops_end at ffffffff85623c0d #4 [ffffb1ba6707fb90] no_context at ffffffff856692c9 #5 [ffffb1ba6707fbf8] exc_page_fault at ffffffff85f95b51 #6 [ffffb1ba6707fc50] asm_exc_page_fault at ffffffff86000ace
[exception RIP: svm_update_pi_irte+227]
RIP: ffffffffc0761b53 RSP: ffffb1ba6707fd08 RFLAGS: 00010086
RAX: ffffb1ba6707fd78 RBX: ffffb1ba66d91000 RCX: 0000000000000001
RDX: 00003c803f63f1c0 RSI: 000000000000019a RDI: ffffb1ba66db2ab8
RBP: 000000000000019a R8: 0000000000000040 R9: ffff94ca41b82200
R10: ffffffffffffffcf R11: 0000000000000001 R12: 0000000000000001
R13: 0000000000000001 R14: ffffffffffffffcf R15: 000000000000005f
ORIG_RAX: ffffffffffffffff CS: 0010 SS: 0018
#7 [ffffb1ba6707fdb8] kvm_irq_routing_update at ffffffffc09f19a1 [kvm]
#8 [ffffb1ba6707fde0] kvm_set_irq_routing at ffffffffc09f2133 [kvm]
#9 [ffffb1ba6707fe18] kvm_vm_ioctl at ffffffffc09ef544 [kvm]
RIP: 00007f143c36488b RSP: 00007f143a4e04b8 RFLAGS: 00000246
RAX: ffffffffffffffda RBX: 00007f05780041d0 RCX: 00007f143c36488b
RDX: 00007f05780041d0 RSI: 000000004008ae6a RDI: 0000000000000020
RBP: 00000000000004e8 R8: 0000000000000008 R9: 00007f05780041e0
R10: 00007f0578004560 R11: 0000000000000246 R12: 00000000000004e0
R13: 000000000000001a R14: 00007f1424001c60 R15: 00007f0578003bc0
ORIG_RAX: 0000000000000010 CS: 0033 SS: 002bVmx have been fix this in commit 3a8b0677fc61 (KVM: VMX: Do not BUG() on out-of-bounds guest IRQ), so we can just copy source from that to fix this.
Message-Id: <[email protected]>
--- arch/x86/kvm/svm/avic.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
arch/x86/kvm/svm/avic.c +8 -2
@@ -806,7 +806,7 @@ int svm_update_pi_irte(struct kvm *kvm, {struct kvm_kernel_irq_routing_entry *e;struct kvm_irq_routing_table *irq_rt; -int idx, ret = -EINVAL ; +int idx, ret =0 ;if (!kvm_arch_has_assigned_device (kvm) || !irq_remapping_cap (IRQ_POSTING_CAP ))
@@ -817,7 +817,13 @@ int svm_update_pi_irte(struct kvm *kvm, idx =srcu_read_lock (&kvm->irq_srcu); irq_rt =srcu_dereference (kvm->irq_routing, &kvm->irq_srcu); -WARN_ON (guest_irq >= irq_rt->nr_rt_entries); + +if (guest_irq >= irq_rt->nr_rt_entries || +hlist_empty (&irq_rt->map[guest_irq])) { +pr_warn_once ("no route for guest_irq %u/%u (broken user space?)\n" , + guest_irq, irq_rt->nr_rt_entries); + goto out; + }hlist_for_each_entry (e, &irq_rt->map[guest_irq], link) {struct vcpu_data vcpu_info;
Greg Kroah-Hartman
maintainerPATCH 537/599 ASoC: SOF: Intel: Fix NULL ptr dereference when ENOMEM
In reply to Greg Kroah-HartmanFrom: Ammar Faizi <[email protected]>
commit b7fb0ae09009d076964afe4c1a2bde1ee2bd88a9 upstream.
Do not call snd_dma_free_pages() when snd_dma_alloc_pages() returns -ENOMEM because it leads to a NULL pointer dereference bug.
The dmesg says:
[ T1387] sof-audio-pci-intel-tgl 0000:00:1f.3: error: memory alloc failed: -12
[ T1387] BUG: kernel NULL pointer dereference, address: 0000000000000000
[ T1387] #PF: supervisor read access in kernel mode
[ T1387] #PF: error_code(0x0000) - not-present page
[ T1387] PGD 0 P4D 0
[ T1387] Oops: 0000 [#1] PREEMPT SMP NOPTI
[ T1387] CPU: 6 PID: 1387 Comm: alsa-sink-HDA A Tainted: G W 5.17.0-rc4-superb-owl-00055-g80d47f5de5e3
[ T1387] Hardware name: HP HP Laptop 14s-dq2xxx/87FD, BIOS F.15 09/15/2021
[ T1387] RIP: 0010:dma_free_noncontiguous+0x37/0x80
[ T1387] Code: [... snip ...]
[ T1387] RSP: 0000:ffffc90002b87770 EFLAGS: 00010246
[ T1387] RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000
[ T1387] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff888101db30d0
[ T1387] RBP: 00000000fffffff4 R08: 0000000000000000 R09: 0000000000000000
[ T1387] R10: 0000000000000000 R11: ffffc90002b874d0 R12: 0000000000000001
[ T1387] R13: 0000000000058000 R14: ffff888105260c68 R15: ffff888105260828
[ T1387] FS: 00007f42e2ffd640(0000) GS:ffff888466b80000(0000) knlGS:0000000000000000
[ T1387] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ T1387] CR2: 0000000000000000 CR3: 000000014acf0003 CR4: 0000000000770ee0
[ T1387] PKRU: 55555554
[ T1387] Call Trace:
[ T1387] <TASK>
[ T1387] cl_stream_prepare+0x10a/0x120 [snd_sof_intel_hda_common 146addf995b9279ae7f509621078cccbe4f875e1] [... snip ...]
[ T1387] </TASK>
--- sound/soc/sof/intel/hda-loader.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
sound/soc/sof/intel/hda-loader.c +6 -5
@@ -47,7 +47,7 @@ static struct hdac_ext_stream *cl_stream ret =snd_dma_alloc_pages (SNDRV_DMA_TYPE_DEV_SG , &pci->dev, size, dmab);if (ret <0 ) {dev_err (sdev->dev,"error: memory alloc failed: %x\n" , ret); - goto error; + goto out_put; } hstream->period_bytes =0 ;/* initialize period_bytes */
@@ -58,22 +58,23 @@ static struct hdac_ext_stream *cl_stream ret =hda_dsp_iccmax_stream_hw_params (sdev, dsp_stream, dmab,NULL );if (ret <0 ) {dev_err (sdev->dev,"error: iccmax stream prepare failed: %x\n" , ret); - goto error; + goto out_free; } }else { ret =hda_dsp_stream_hw_params (sdev, dsp_stream, dmab,NULL );if (ret <0 ) {dev_err (sdev->dev,"error: hdac prepare failed: %x\n" , ret); - goto error; + goto out_free; }hda_dsp_stream_spib_config (sdev, dsp_stream,HDA_DSP_SPIB_ENABLE , size); }return dsp_stream; -error: -hda_dsp_stream_put (sdev, direction, hstream->stream_tag); +out_free:snd_dma_free_pages (dmab); +out_put: +hda_dsp_stream_put (sdev, direction, hstream->stream_tag);return ERR_PTR (ret); }
Greg Kroah-Hartman
maintainerPATCH 538/599 ubifs: rename_whiteout: Fix double free for whiteout_ui->data
In reply to Greg Kroah-HartmanFrom: Zhihao Cheng <[email protected]>
commit 40a8f0d5e7b3999f096570edab71c345da812e3e upstream.
'whiteout_ui->data' will be freed twice if space budget fail for rename whiteout operation as following process:
rename_whiteout
dev = kmalloc
whiteout_ui->data = dev
kfree(whiteout_ui->data) // Free first time
iput(whiteout)
ubifs_free_inode
kfree(ui->data) // Double free!KASAN reports:
==================================================================
BUG: KASAN: double-free or invalid-free in ubifs_free_inode+0x4f/0x70 Call Trace: kfree+0x117/0x490 ubifs_free_inode+0x4f/0x70 [ubifs] i_callback+0x30/0x60 rcu_do_batch+0x366/0xac0 __do_softirq+0x133/0x57f Allocated by task 1506: kmem_cache_alloc_trace+0x3c2/0x7a0 do_rename+0x9b7/0x1150 [ubifs] ubifs_rename+0x106/0x1f0 [ubifs] do_syscall_64+0x35/0x80 Freed by task 1506: kfree+0x117/0x490 do_rename.cold+0x53/0x8a [ubifs] ubifs_rename+0x106/0x1f0 [ubifs] do_syscall_64+0x35/0x80 The buggy address belongs to the object at ffff88810238bed8 which
belongs to the cache kmalloc-8 of size 8
==================================================================
Let ubifs_free_inode() free 'whiteout_ui->data'. BTW, delete unused assignment 'whiteout_ui->data_len = 0', process 'ubifs_evict_inode() -> ubifs_jnl_delete_inode() -> ubifs_jnl_write_inode()' doesn't need it (because 'inc_nlink(whiteout)' won't be excuted by 'goto out_release',
and the nlink of whiteout inode is 0).
--- fs/ubifs/dir.c | 2 -- 1 file changed, 2 deletions(-)
fs/ubifs/dir.c +0 -2
@@ -1423,8 +1423,6 @@ static int do_rename(struct inode *old_d err =ubifs_budget_space (c, &wht_req);if (err) { -kfree (whiteout_ui->data); - whiteout_ui->data_len =0 ;iput (whiteout); goto out_release; }
Greg Kroah-Hartman
maintainerPATCH 539/599 ubifs: Fix deadlock in concurrent rename whiteout and inode writeback
In reply to Greg Kroah-HartmanFrom: Zhihao Cheng <[email protected]>
commit afd427048047e8efdedab30e8888044e2be5aa9c upstream.
Following hung tasks:
[ 77.028764] task:kworker/u8:4 state:D stack: 0 pid: 132 [ 77.028820] Call Trace: [ 77.029027] schedule+0x8c/0x1b0 [ 77.029067] mutex_lock+0x50/0x60 [ 77.029074] ubifs_write_inode+0x68/0x1f0 [ubifs] [ 77.029117] __writeback_single_inode+0x43c/0x570 [ 77.029128] writeback_sb_inodes+0x259/0x740 [ 77.029148] wb_writeback+0x107/0x4d0 [ 77.029163] wb_workfn+0x162/0x7b0
[ 92.390442] task:aa state:D stack: 0 pid: 1506 [ 92.390448] Call Trace: [ 92.390458] schedule+0x8c/0x1b0 [ 92.390461] wb_wait_for_completion+0x82/0xd0 [ 92.390469] __writeback_inodes_sb_nr+0xb2/0x110 [ 92.390472] writeback_inodes_sb_nr+0x14/0x20 [ 92.390476] ubifs_budget_space+0x705/0xdd0 [ubifs] [ 92.390503] do_rename.cold+0x7f/0x187 [ubifs] [ 92.390549] ubifs_rename+0x8b/0x180 [ubifs] [ 92.390571] vfs_rename+0xdb2/0x1170 [ 92.390580] do_renameat2+0x554/0x770
, are caused by concurrent rename whiteout and inode writeback processes:
rename_whiteout(Thread 1) wb_workfn(Thread2)ubifs_rename
do_rename
lock_4_inodes (Hold ui_mutex)
ubifs_budget_space
make_free_space
shrink_liability
__writeback_inodes_sb_nr
bdi_split_work_to_wbs (Queue new wb work)
wb_do_writeback(wb work)
__writeback_single_inode
ubifs_write_inode
LOCK(ui_mutex)
↑
wb_wait_for_completion (Wait wb work) <-- deadlock!
Reproducer (Detail program in [Link]):
1. SYS_renameat2("/mp/dir/file", "/mp/dir/whiteout", RENAME_WHITEOUT)
2. Consume out of space before kernel(mdelay) doing budget for whiteout
Fix it by doing whiteout space budget before locking ubifs inodes. BTW, it also fixes wrong goto tag 'out_release' in whiteout budget error handling path(It should at least recover dir i_size and unlock 4 ubifs inodes).
--- fs/ubifs/dir.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-)
fs/ubifs/dir.c +15 -10
@@ -1322,6 +1322,7 @@ static int do_rename(struct inode *old_dif (flags &RENAME_WHITEOUT ) {union ubifs_dev_desc *dev =NULL ; +struct ubifs_budget_req wht_req; dev =kmalloc (sizeof (union ubifs_dev_desc ),GFP_NOFS );if (!dev) {
@@ -1343,6 +1344,20 @@ static int do_rename(struct inode *old_d whiteout_ui->data = dev; whiteout_ui->data_len =ubifs_encode_dev (dev,MKDEV (0 ,0 ));ubifs_assert (c, !whiteout_ui->dirty); + +memset (&wht_req,0 ,sizeof (struct ubifs_budget_req )); + wht_req.dirtied_ino =1 ; + wht_req.dirtied_ino_d =ALIGN (whiteout_ui->data_len,8 ); +/* +* To avoid deadlock between space budget (holds ui_mutex and +* waits wb work) and writeback work(waits ui_mutex), do space +* budget before ubifs inodes locked. +*/ + err =ubifs_budget_space (c, &wht_req); +if (err) { +iput (whiteout); + goto out_release; + } }lock_4_inodes (old_dir, new_dir, new_inode, whiteout);
@@ -1417,16 +1432,6 @@ static int do_rename(struct inode *old_d }if (whiteout) { -struct ubifs_budget_req wht_req = { .dirtied_ino =1 , - .dirtied_ino_d = \ -ALIGN (ubifs_inode (whiteout)->data_len,8 ) }; - - err =ubifs_budget_space (c, &wht_req); -if (err) { -iput (whiteout); - goto out_release; - } -inc_nlink (whiteout);mark_inode_dirty (whiteout);
Greg Kroah-Hartman
maintainerPATCH 540/599 ubifs: Add missing iput if do_tmpfile() failed in rename whiteout
In reply to Greg Kroah-HartmanFrom: Zhihao Cheng <[email protected]>
commit 716b4573026bcbfa7b58ed19fe15554bac66b082 upstream.
whiteout inode should be put when do_tmpfile() failed if inode has been initialized. Otherwise we will get following warning during umount:
UBIFS error (ubi0:0 pid 1494): ubifs_assert_failed [ubifs]: UBIFS assert failed: c->bi.dd_growth == 0, in fs/ubifs/super.c:1930
VFS: Busy inodes after unmount of ubifs. Self-destruct in 5 seconds.
--- fs/ubifs/dir.c | 2 ++ 1 file changed, 2 insertions(+)
fs/ubifs/dir.c +2 -0
@@ -431,6 +431,8 @@ out_inode:make_bad_inode (inode);if (!instantiated)iput (inode); +else if (whiteout) +iput (*whiteout); out_budg:ubifs_release_budget (c, &req);if (!instantiated)
Greg Kroah-Hartman
maintainerPATCH 541/599 ubifs: setflags: Make dirtied_ino_d 8 bytes aligned
In reply to Greg Kroah-HartmanFrom: Zhihao Cheng <[email protected]>
commit 1b83ec057db16b4d0697dc21ef7a9743b6041f72 upstream.
Make 'ui->data_len' aligned with 8 bytes before it is assigned to dirtied_ino_d. Since 8871d84c8f8b0c6b("ubifs: convert to fileattr") applied, 'setflags()' only affects regular files and directories, only xattr inode, symlink inode and special inode(pipe/char_dev/block_dev) have none- zero 'ui->data_len' field, so assertion '!(req->dirtied_ino_d & 7)' cannot fail in ubifs_budget_space(). To avoid assertion fails in future evolution(eg. setflags can operate special inodes), it's better to make dirtied_ino_d 8 bytes aligned, after all aligned size is still zero for regular files.
--- fs/ubifs/ioctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ubifs/ioctl.c +1 -1
@@ -107,7 +107,7 @@ static int setflags(struct inode *inode,struct ubifs_inode *ui =ubifs_inode (inode);struct ubifs_info *c = inode->i_sb->s_fs_info;struct ubifs_budget_req req = { .dirtied_ino =1 , - .dirtied_ino_d = ui->data_len }; + .dirtied_ino_d =ALIGN (ui->data_len,8 ) }; err =ubifs_budget_space (c, &req);if (err)
Greg Kroah-Hartman
maintainerPATCH 542/599 ubifs: Fix read out-of-bounds in ubifs_wbuf_write_nolock()
In reply to Greg Kroah-HartmanFrom: Zhihao Cheng <[email protected]>
commit 4f2262a334641e05f645364d5ade1f565c85f20b upstream.
Function ubifs_wbuf_write_nolock() may access buf out of bounds in following process:
ubifs_wbuf_write_nolock():
aligned_len = ALIGN(len, 8); // Assume len = 4089, aligned_len = 4096
if (aligned_len <= wbuf->avail) ... // Not satisfy
if (wbuf->used) {
ubifs_leb_write() // Fill some data in avail wbuf
len -= wbuf->avail; // len is still not 8-bytes aligned
aligned_len -= wbuf->avail;
}
n = aligned_len >> c->max_write_shift;
if (n) {
n <<= c->max_write_shift;
err = ubifs_leb_write(c, wbuf->lnum, buf + written,
wbuf->offs, n);
// n > len, read out of bounds less than 8(n-len) bytes}
, which can be catched by KASAN:
=========================================================
BUG: KASAN: slab-out-of-bounds in ecc_sw_hamming_calculate+0x1dc/0x7d0
Read of size 4 at addr ffff888105594ff8 by task kworker/u8:4/128
Workqueue: writeback wb_workfn (flush-ubifs_0_0)
Call Trace:
kasan_report.cold+0x81/0x165
nand_write_page_swecc+0xa9/0x160
ubifs_leb_write+0xf2/0x1b0 [ubifs]
ubifs_wbuf_write_nolock+0x421/0x12c0 [ubifs]
write_head+0xdc/0x1c0 [ubifs]
ubifs_jnl_write_inode+0x627/0x960 [ubifs]
wb_workfn+0x8af/0xb80Function ubifs_wbuf_write_nolock() accepts that parameter 'len' is not 8 bytes aligned, the 'len' represents the true length of buf (which is allocated in 'ubifs_jnl_xxx', eg. ubifs_jnl_write_inode), so ubifs_wbuf_write_nolock() must handle the length read from 'buf' carefully to write leb safely.
Fetch a reproducer in [Link].
--- fs/ubifs/io.c | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-)
fs/ubifs/io.c +30 -4
@@ -846,16 +846,42 @@ int ubifs_wbuf_write_nolock(struct ubifs*/ n = aligned_len >> c->max_write_shift;if (n) { - n <<= c->max_write_shift; +int m = n -1 ; +dbg_io ("write %d bytes to LEB %d:%d" , n, wbuf->lnum, wbuf->offs); - err =ubifs_leb_write (c, wbuf->lnum, buf + written, - wbuf->offs, n); + +if (m) { +/* '(n-1)<<c->max_write_shift < len' is always true. */ + m <<= c->max_write_shift; + err =ubifs_leb_write (c, wbuf->lnum, buf + written, + wbuf->offs, m); +if (err) + goto out; + wbuf->offs += m; + aligned_len -= m; + len -= m; + written += m; + } + +/* +* The non-written len of buf may be less than 'n' because +* parameter 'len' is not 8 bytes aligned, so here we read +* min(len, n) bytes from buf. +*/ + n =1 << c->max_write_shift; +memcpy (wbuf->buf, buf + written,min (len, n)); +if (n > len) { +ubifs_assert (c, n - len <8 ); +ubifs_pad (c, wbuf->buf + len, n - len); + } + + err =ubifs_leb_write (c, wbuf->lnum, wbuf->buf, wbuf->offs, n);if (err) goto out; wbuf->offs += n; aligned_len -= n; - len -= n; + len -=min (len, n); written += n; }
Greg Kroah-Hartman
maintainerPATCH 543/599 ubifs: Fix to add refcount once page is set private
In reply to Greg Kroah-HartmanFrom: Zhihao Cheng <[email protected]>
commit 3b67db8a6ca83e6ff90b756d3da0c966f61cd37b upstream.
MM defined the rule [1] very clearly that once page was set with PG_private flag, we should increment the refcount in that page, also main flows like pageout(), migrate_page() will assume there is one additional page reference count if page_has_private() returns true. Otherwise, we may get a BUG in page migration:
page:0000000080d05b9d refcount:-1 mapcount:0 mapping:000000005f4d82a8 index:0xe2 pfn:0x14c12
aops:ubifs_file_address_operations [ubifs] ino:8f1 dentry name:"f30e"
flags: 0x1fffff80002405(locked|uptodate|owner_priv_1|private|node=0| zone=1|lastcpupid=0x1fffff)
page dumped because: VM_BUG_ON_PAGE(page_count(page) != 0)
------------[ cut here ]------------
kernel BUG at include/linux/page_ref.h:184!
invalid opcode: 0000 [#1] SMP
CPU: 3 PID: 38 Comm: kcompactd0 Not tainted 5.15.0-rc5
RIP: 0010:migrate_page_move_mapping+0xac3/0xe70
Call Trace:
ubifs_migrate_page+0x22/0xc0 [ubifs]
move_to_new_page+0xb4/0x600
migrate_pages+0x1523/0x1cc0
compact_zone+0x8c5/0x14b0
kcompactd+0x2bc/0x560
kthread+0x18c/0x1e0
ret_from_fork+0x1f/0x30Before the time, we should make clean a concept, what does refcount means in page gotten from grab_cache_page_write_begin(). There are 2 situations:
Situation 1: refcount is 3, page is created by __page_cache_alloc.
TYPE_A - the write process is using this page
TYPE_B - page is assigned to one certain mapping by calling
__add_to_page_cache_locked()
TYPE_C - page is added into pagevec list corresponding current cpu by
calling lru_cache_add()
Situation 2: refcount is 2, page is gotten from the mapping's tree
TYPE_B - page has been assigned to one certain mapping TYPE_A - the write process is using this page (by calling
page_cache_get_speculative())
Filesystem releases one refcount by calling put_page() in xxx_write_end(), the released refcount corresponds to TYPE_A (write task is using it). If there are any processes using a page, page migration process will skip the page by judging whether expected_page_refs() equals to page refcount.
The BUG is caused by following process:
PA(cpu 0) kcompactd(cpu 1)
compact_zoneubifs_write_begin
page_a = grab_cache_page_write_begin
add_to_page_cache_lru
lru_cache_add
pagevec_add // put page into cpu 0's pagevec
(refcnf = 3, for page creation process)ubifs_write_end
SetPagePrivate(page_a) // doesn't increase page count ! unlock_page(page_a)
put_page(page_a) // refcnt = 2
[...]
PB(cpu 0)filemap_read
filemap_get_pages
add_to_page_cache_lru
lru_cache_add
__pagevec_lru_add // traverse all pages in cpu 0's pagevec
__pagevec_lru_add_fn
SetPageLRU(page_a)
isolate_migratepages
isolate_migratepages_block
get_page_unless_zero(page_a) // refcnt = 3
list_add(page_a, from_list)
migrate_pages(from_list)
__unmap_and_move
move_to_new_page
ubifs_migrate_page(page_a)
migrate_page_move_mapping
expected_page_refs get 3
(migration[1] + mapping[1] + private[1])
release_pages
put_page_testzero(page_a) // refcnt = 3
page_ref_freeze // refcnt = 0
page_ref_dec_and_test(0 - 1 = -1)
page_ref_unfreeze
VM_BUG_ON_PAGE(-1 != 0, page)
UBIFS doesn't increase the page refcount after setting private flag, which leads to page migration task believes the page is not used by any other processes, so the page is migrated. This causes concurrent accessing on page refcount between put_page() called by other process(eg. read process calls lru_cache_add) and page_ref_unfreeze() called by migration task.
Actually zhangjun has tried to fix this problem [2] by recalculating page refcnt in ubifs_migrate_page(). It's better to follow MM rules [1], because just like Kirill suggested in [2], we need to check all users of page_has_private() helper. Like f2fs does in [3], fix it by adding/deleting refcount when setting/clearing private for a page. BTW, according to [4], we set 'page->private' as 1 because ubifs just simply SetPagePrivate(). And, [5] provided a common helper to set/clear page private, ubifs can use this helper following the example of iomap, afs, btrfs, etc.
Jump [6] to find a reproducer.
[1] https://lore.kernel.org/lkml/[email protected]
[2] https://www.spinics.net/lists/linux-mtd/msg04018.html
[3] http://lkml.iu.edu/hypermail/linux/kernel/1903.0/03313.html
[4] https://lore.kernel.org/linux-f2fs-devel/[email protected]
[5] https://lore.kernel.org/all/[email protected]
[6] https://bugzilla.kernel.org/show_bug.cgi?id=214961
--- fs/ubifs/file.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
fs/ubifs/file.c +7 -7
@@ -570,7 +570,7 @@ static int ubifs_write_end(struct file * }if (!PagePrivate (page)) { -SetPagePrivate (page); +attach_page_private (page, (void *)1 );atomic_long_inc (&c->dirty_pg_cnt);__set_page_dirty_nobuffers (page); }
@@ -947,7 +947,7 @@ static int do_writepage(struct page *pagrelease_existing_page_budget (c);atomic_long_dec (&c->dirty_pg_cnt); -ClearPagePrivate (page); +detach_page_private (page);ClearPageChecked (page);kunmap (page);
@@ -1303,7 +1303,7 @@ static void ubifs_invalidatepage(structrelease_existing_page_budget (c);atomic_long_dec (&c->dirty_pg_cnt); -ClearPagePrivate (page); +detach_page_private (page);ClearPageChecked (page); }
@@ -1470,8 +1470,8 @@ static int ubifs_migrate_page(struct addreturn rc;if (PagePrivate (page)) { -ClearPagePrivate (page); -SetPagePrivate (newpage); +detach_page_private (page); +attach_page_private (newpage, (void *)1 ); }if (mode !=MIGRATE_SYNC_NO_COPY )
@@ -1495,7 +1495,7 @@ static int ubifs_releasepage(struct pagereturn 0 ;ubifs_assert (c,PagePrivate (page));ubifs_assert (c,0 ); -ClearPagePrivate (page); +detach_page_private (page);ClearPageChecked (page);return 1 ; }
@@ -1566,7 +1566,7 @@ static vm_fault_t ubifs_vm_page_mkwrite(else {if (!PageChecked (page))ubifs_convert_page_budget (c); -SetPagePrivate (page); +attach_page_private (page, (void *)1 );atomic_long_inc (&c->dirty_pg_cnt);__set_page_dirty_nobuffers (page); }
Greg Kroah-Hartman
maintainerPATCH 544/599 ubifs: rename_whiteout: correct old_dir size computing
In reply to Greg Kroah-HartmanFrom: Baokun Li <[email protected]>
commit 705757274599e2e064dd3054aabc74e8af31a095 upstream.
When renaming the whiteout file, the old whiteout file is not deleted. Therefore, we add the old dentry size to the old dir like XFS. Otherwise, an error may be reported due to fscki->calc_sz != fscki->size in check_indes.
--- fs/ubifs/dir.c | 3 +++ 1 file changed, 3 insertions(+)
fs/ubifs/dir.c +3 -0
@@ -1360,6 +1360,9 @@ static int do_rename(struct inode *old_diput (whiteout); goto out_release; } + +/* Add the old_dentry size to the old_dir size. */ + old_sz -=CALC_DENT_SIZE (fname_len (&old_nm)); }lock_4_inodes (old_dir, new_dir, new_inode, whiteout);
Greg Kroah-Hartman
maintainerPATCH 545/599 wireguard: queueing: use CFI-safe ptr_ring cleanup function
In reply to Greg Kroah-HartmanFrom: Jason A. Donenfeld <[email protected]>
commit ec59f128a9bd4255798abb1e06ac3b442f46ef68 upstream.
We make too nuanced use of ptr_ring to entirely move to the skb_array wrappers, but we at least should avoid the naughty function pointer cast when cleaning up skbs. Otherwise RAP/CFI will honk at us. This patch uses the __skb_array_destroy_skb wrapper for the cleanup, rather than directly providing kfree_skb, which is what other drivers in the same situation do too.
--- drivers/net/wireguard/queueing.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireguard/queueing.c +2 -1
@@ -4,6 +4,7 @@*/ #include "queueing.h" +#include <linux/skb_array.h> struct multicore_worker __percpu *wg_packet_percpu_multicore_worker_alloc (work_func_t function,void *ptr)
@@ -42,7 +43,7 @@ void wg_packet_queue_free(struct crypt_q {free_percpu (queue->worker);WARN_ON (!purge && !__ptr_ring_empty (&queue->ring)); -ptr_ring_cleanup (&queue->ring, purge ? (void (*)(void *))kfree_skb :NULL ); +ptr_ring_cleanup (&queue->ring, purge ? __skb_array_destroy_skb :NULL ); }#define NEXT (skb) ((skb)->prev)
Greg Kroah-Hartman
maintainerPATCH 546/599 wireguard: socket: free skb in send6 when ipv6 is disabled
In reply to Greg Kroah-HartmanFrom: Wang Hai <[email protected]>
commit bbbf962d9460194993ee1943a793a0a0af4a7fbf upstream.
I got a memory leak report:
unreferenced object 0xffff8881191fc040 (size 232):
comm "kworker/u17:0", pid 23193, jiffies 4295238848 (age 3464.870s) hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<ffffffff814c3ef4>] slab_post_alloc_hook+0x84/0x3b0
[<ffffffff814c8977>] kmem_cache_alloc_node+0x167/0x340
[<ffffffff832974fb>] __alloc_skb+0x1db/0x200
[<ffffffff82612b5d>] wg_socket_send_buffer_to_peer+0x3d/0xc0
[<ffffffff8260e94a>] wg_packet_send_handshake_initiation+0xfa/0x110
[<ffffffff8260ec81>] wg_packet_handshake_send_worker+0x21/0x30
[<ffffffff8119c558>] process_one_work+0x2e8/0x770
[<ffffffff8119ca2a>] worker_thread+0x4a/0x4b0
[<ffffffff811a88e0>] kthread+0x120/0x160
[<ffffffff8100242f>] ret_from_fork+0x1f/0x30In function wg_socket_send_buffer_as_reply_to_skb() or wg_socket_send_ buffer_to_peer(), the semantics of send6() is required to free skb. But when CONFIG_IPV6 is disable, kfree_skb() is missing. This patch adds it to fix this bug.
--- drivers/net/wireguard/socket.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireguard/socket.c +1 -0
@@ -160,6 +160,7 @@ out:rcu_read_unlock_bh ();return ret;#else +kfree_skb (skb);return -EAFNOSUPPORT ;#endif }
Greg Kroah-Hartman
maintainerPATCH 547/599 wireguard: socket: ignore v6 endpoints when ipv6 is disabled
In reply to Greg Kroah-HartmanFrom: Jason A. Donenfeld <[email protected]>
commit 77fc73ac89be96ec8f39e8efa53885caa7cb3645 upstream.
The previous commit fixed a memory leak on the send path in the event that IPv6 is disabled at compile time, but how did a packet even arrive there to begin with? It turns out we have previously allowed IPv6 endpoints even when IPv6 support is disabled at compile time. This is awkward and inconsistent. Instead, let's just ignore all things IPv6, the same way we do other malformed endpoints, in the case where IPv6 is disabled.
--- drivers/net/wireguard/socket.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireguard/socket.c +2 -2
@@ -242,7 +242,7 @@ int wg_socket_endpoint_from_skb(struct e endpoint->addr4.sin_addr.s_addr =ip_hdr (skb)->saddr; endpoint->src4.s_addr =ip_hdr (skb)->daddr; endpoint->src_if4 = skb->skb_iif; - }else if (skb->protocol ==htons (ETH_P_IPV6 )) { + }else if (IS_ENABLED (CONFIG_IPV6 ) && skb->protocol ==htons (ETH_P_IPV6 )) { endpoint->addr6.sin6_family =AF_INET6 ; endpoint->addr6.sin6_port =udp_hdr (skb)->source; endpoint->addr6.sin6_addr =ipv6_hdr (skb)->saddr;
@@ -285,7 +285,7 @@ void wg_socket_set_peer_endpoint(struct peer->endpoint.addr4 = endpoint->addr4; peer->endpoint.src4 = endpoint->src4; peer->endpoint.src_if4 = endpoint->src_if4; - }else if (endpoint->addr.sa_family ==AF_INET6 ) { + }else if (IS_ENABLED (CONFIG_IPV6 ) && endpoint->addr.sa_family ==AF_INET6 ) { peer->endpoint.addr6 = endpoint->addr6; peer->endpoint.src6 = endpoint->src6; }else {
Greg Kroah-Hartman
maintainerPATCH 548/599 XArray: Fix xas_create_range() when multi-order entry present
In reply to Greg Kroah-HartmanFrom: Matthew Wilcox (Oracle) <[email protected]>
commit 3e3c658055c002900982513e289398a1aad4a488 upstream.
If there is already an entry present that is of order >= XA_CHUNK_SHIFT when we call xas_create_range(), xas_create_range() will misinterpret that entry as a node and dereference xa_node->parent, generally leading to a crash that looks something like this:
general protection fault, probably for non-canonical address 0xdffffc0000000001: 0000 [#1] PREEMPT SMP KASAN KASAN: null-ptr-deref in range [0x0000000000000008-0x000000000000000f] CPU: 0 PID: 32 Comm: khugepaged Not tainted 5.17.0-rc8-syzkaller-00003-g56e337f2cf13 #0 RIP: 0010:xa_parent_locked include/linux/xarray.h:1207 [inline] RIP: 0010:xas_create_range+0x2d9/0x6e0 lib/xarray.c:725
It's deterministically reproducable once you know what the problem is, but producing it in a live kernel requires khugepaged to hit a race. While the problem has been present since xas_create_range() was introduced, I'm not aware of a way to hit it before the page cache was converted to use multi-index entries.
--- lib/test_xarray.c | 22 ++++++++++++++++++++++ lib/xarray.c | 2 ++ 2 files changed, 24 insertions(+)
lib/test_xarray.c +22 -0
@@ -1463,6 +1463,25 @@ unlock:XA_BUG_ON (xa, !xa_empty (xa)); } +static noinline void check_create_range_5(struct xarray *xa, +unsigned long index,unsigned int order) +{ +XA_STATE_ORDER (xas, xa, index, order); +unsigned int i; + +xa_store_order (xa, index, order,xa_mk_index (index),GFP_KERNEL ); + +for (i =0 ; i < order +10 ; i++) { +do { +xas_lock (&xas); +xas_create_range (&xas); +xas_unlock (&xas); + }while (xas_nomem (&xas,GFP_KERNEL )); + } + +xa_destroy (xa); +} + static noinline void check_create_range(struct xarray *xa) {unsigned int order;
@@ -1490,6 +1509,9 @@ static noinline void check_create_range(check_create_range_4 (xa, (3U << order) +1 , order);check_create_range_4 (xa, (3U << order) -1 , order);check_create_range_4 (xa, (1U <<24 ) +1 , order); + +check_create_range_5 (xa,0 , order); +check_create_range_5 (xa, (1U << order), order); }check_create_range_3 ();
lib/xarray.c +2 -0
@@ -722,6 +722,8 @@ void xas_create_range(struct xa_state *xfor (;;) {struct xa_node *node = xas->xa_node; +if (node->shift >= shift) +break ; xas->xa_node =xa_parent_locked (xas->xa, node); xas->xa_offset = node->offset -1 ;if (node->offset !=0 )
Greg Kroah-Hartman
maintainerPATCH 549/599 can: mcba_usb: mcba_usb_start_xmit(): fix double dev_kfree_skb in error path
In reply to Greg Kroah-HartmanFrom: Hangyu Hua <[email protected]>
commit 04c9b00ba83594a29813d6b1fb8fdc93a3915174 upstream.
There is no need to call dev_kfree_skb() when usb_submit_urb() fails because can_put_echo_skb() deletes original skb and can_free_echo_skb() deletes the cloned skb.
--- drivers/net/can/usb/mcba_usb.c | 1 - 1 file changed, 1 deletion(-)
drivers/net/can/usb/mcba_usb.c +0 -1
@@ -368,7 +368,6 @@ static netdev_tx_t mcba_usb_start_xmit(s xmit_failed:can_free_echo_skb (priv->netdev, ctx->ndx);mcba_usb_free_ctx (ctx); -dev_kfree_skb (skb); stats->tx_dropped++;return NETDEV_TX_OK ;
Greg Kroah-Hartman
maintainerPATCH 550/599 can: mcba_usb: properly check endpoint type
In reply to Greg Kroah-HartmanFrom: Pavel Skripkin <[email protected]>
commit 136bed0bfd3bc9c95c88aafff2d22ecb3a919f23 upstream.
Syzbot reported warning in usb_submit_urb() which is caused by wrong endpoint type. We should check that in endpoint is actually present to prevent this warning.
Found pipes are now saved to struct mcba_priv and code uses them directly instead of making pipes in place.
Fail log:
| usb 5-1: BOGUS urb xfer, pipe 3 != type 1 | WARNING: CPU: 1 PID: 49 at drivers/usb/core/urb.c:502 usb_submit_urb+0xed2/0x18a0 drivers/usb/core/urb.c:502 | Modules linked in: | CPU: 1 PID: 49 Comm: kworker/1:2 Not tainted 5.17.0-rc6-syzkaller-00184-g38f80f42147f #0 | Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.14.0-2 04/01/2014 | Workqueue: usb_hub_wq hub_event | RIP: 0010:usb_submit_urb+0xed2/0x18a0 drivers/usb/core/urb.c:502 | ... | Call Trace: | <TASK> | mcba_usb_start drivers/net/can/usb/mcba_usb.c:662 [inline] | mcba_usb_probe+0x8a3/0xc50 drivers/net/can/usb/mcba_usb.c:858 | usb_probe_interface+0x315/0x7f0 drivers/usb/core/driver.c:396 | call_driver_probe drivers/base/dd.c:517 [inline]
--- drivers/net/can/usb/mcba_usb.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-)
drivers/net/can/usb/mcba_usb.c +16 -10
@@ -33,10 +33,6 @@#define MCBA_USB_RX_BUFF_SIZE 64#define MCBA_USB_TX_BUFF_SIZE (sizeof(struct mcba_usb_msg)) -/* MCBA endpoint numbers */ -#define MCBA_USB_EP_IN 1 -#define MCBA_USB_EP_OUT 1 -/* Microchip command id */ #define MBCA_CMD_RECEIVE_MESSAGE 0xE3#define MBCA_CMD_I_AM_ALIVE_FROM_CAN 0xF5
@@ -84,6 +80,8 @@ struct mcba_priv {atomic_t free_ctx_cnt;void *rxbuf[MCBA_MAX_RX_URBS ];dma_addr_t rxbuf_dma[MCBA_MAX_RX_URBS ]; +int rx_pipe; +int tx_pipe; };/* CAN frame */
@@ -272,10 +270,8 @@ static netdev_tx_t mcba_usb_xmit(structmemcpy (buf, usb_msg,MCBA_USB_TX_BUFF_SIZE ); -usb_fill_bulk_urb (urb, priv->udev, -usb_sndbulkpipe (priv->udev,MCBA_USB_EP_OUT ), buf, -MCBA_USB_TX_BUFF_SIZE , mcba_usb_write_bulk_callback, - ctx); +usb_fill_bulk_urb (urb, priv->udev, priv->tx_pipe, buf,MCBA_USB_TX_BUFF_SIZE , + mcba_usb_write_bulk_callback, ctx); urb->transfer_flags |=URB_NO_TRANSFER_DMA_MAP ;usb_anchor_urb (urb, &priv->tx_submitted);
@@ -610,7 +606,7 @@ static void mcba_usb_read_bulk_callback( resubmit_urb:usb_fill_bulk_urb (urb, priv->udev, -usb_rcvbulkpipe (priv->udev,MCBA_USB_EP_OUT ), + priv->rx_pipe, urb->transfer_buffer,MCBA_USB_RX_BUFF_SIZE , mcba_usb_read_bulk_callback, priv);
@@ -655,7 +651,7 @@ static int mcba_usb_start(struct mcba_pr urb->transfer_dma = buf_dma;usb_fill_bulk_urb (urb, priv->udev, -usb_rcvbulkpipe (priv->udev,MCBA_USB_EP_IN ), + priv->rx_pipe, buf,MCBA_USB_RX_BUFF_SIZE , mcba_usb_read_bulk_callback, priv); urb->transfer_flags |=URB_NO_TRANSFER_DMA_MAP ;
@@ -809,6 +805,13 @@ static int mcba_usb_probe(struct usb_intstruct mcba_priv *priv;int err;struct usb_device *usbdev =interface_to_usbdev (intf); +struct usb_endpoint_descriptor *in, *out; + + err =usb_find_common_endpoints (intf->cur_altsetting, &in, &out,NULL ,NULL ); +if (err) { +dev_err (&intf->dev,"Can't find endpoints\n" ); +return err; + } netdev =alloc_candev (sizeof (struct mcba_priv ),MCBA_MAX_TX_URBS );if (!netdev) {
@@ -854,6 +857,9 @@ static int mcba_usb_probe(struct usb_int goto cleanup_free_candev; } + priv->rx_pipe =usb_rcvbulkpipe (priv->udev, in->bEndpointAddress); + priv->tx_pipe =usb_sndbulkpipe (priv->udev, out->bEndpointAddress); +devm_can_led_init (netdev);/* Start USB dev only if we have successfully registered CAN device */
Greg Kroah-Hartman
maintainerPATCH 551/599 can: mcp251xfd: mcp251xfd_register_get_dev_id(): fix return of error value
In reply to Greg Kroah-HartmanFrom: Tom Rix <[email protected]>
commit fa7b514d2b2894e052b8e94c7a29feb98e90093f upstream.
Clang static analysis reports this issue:
| mcp251xfd-core.c:1813:7: warning: The left operand | of '&' is a garbage value | FIELD_GET(MCP251XFD_REG_DEVID_ID_MASK, dev_id), | ^ ~~~~~~
dev_id is set in a successful call to mcp251xfd_register_get_dev_id(). Though the status of calls made by mcp251xfd_register_get_dev_id() are checked and handled, their status' are not returned. So return err.
--- drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c +1 -1
@@ -2578,7 +2578,7 @@ mcp251xfd_register_get_dev_id(const stru out_kfree_buf_rx:kfree (buf_rx); -return 0 ; +return err; }#define MCP251XFD_QUIRK_ACTIVE (quirk) \
Greg Kroah-Hartman
maintainerPATCH 552/599 XArray: Update the LRU list in xas_split()
In reply to Greg Kroah-HartmanFrom: Matthew Wilcox (Oracle) <[email protected]>
commit 3ed4bb77156da0bc732847c8c9df92454c1fbeea upstream.
When splitting a value entry, we may need to add the new nodes to the LRU list and remove the parent node from the LRU list. The WARN_ON checks in shadow_lru_isolate() catch this oversight. This bug was latent until we stopped splitting folios in shrink_page_list() with commit 820c4e2e6f51 ("mm/vmscan: Free non-shmem folios without splitting them"). That allows the creation of large shadow entries, and subsequently when trying to page in a small page, we will split the large shadow entry in __filemap_add_folio().
--- lib/xarray.c | 2 ++ 1 file changed, 2 insertions(+)
lib/xarray.c +2 -0
@@ -1080,6 +1080,7 @@ void xas_split(struct xa_state *xas, voi xa_mk_node(child));if (xa_is_value (curr)) values--; +xas_update (xas, child); }else {unsigned int canon = offset - xas->xa_sibs;
@@ -1094,6 +1095,7 @@ void xas_split(struct xa_state *xas, voi } while (offset-- > xas->xa_offset); node->nr_values += values; +xas_update (xas, node); }EXPORT_SYMBOL_GPL (xas_split);#endif
Greg Kroah-Hartman
maintainerPATCH 553/599 rtc: check if __rtc_read_time was successful
In reply to Greg Kroah-HartmanFrom: Tom Rix <[email protected]>
commit 915593a7a663b2ad08b895a5f3ba8b19d89d4ebf upstream.
Clang static analysis reports this issue interface.c:810:8: warning: Passed-by-value struct
argument contains uninitialized data
now = rtc_tm_to_ktime(tm);
^~~~~~~~~~~~~~~~~~~tm is set by a successful call to __rtc_read_time() but its return status is not checked. Check if it was successful before setting the enabled flag. Move the decl of err to function scope.
--- drivers/rtc/interface.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/rtc/interface.c +5 -2
@@ -807,9 +807,13 @@ static int rtc_timer_enqueue(struct rtc_struct timerqueue_node *next =timerqueue_getnext (&rtc->timerqueue);struct rtc_time tm;ktime_t now; +int err; + + err =__rtc_read_time (rtc, &tm); +if (err) +return err; timer->enabled =1 ; -__rtc_read_time (rtc, &tm); now =rtc_tm_to_ktime (tm);/* Skip over expired timers */
@@ -823,7 +827,6 @@ static int rtc_timer_enqueue(struct rtc_trace_rtc_timer_enqueue (timer);if (!next ||ktime_before (timer->node.expires, next->expires)) {struct rtc_wkalrm alarm; -int err; alarm.time =rtc_ktime_to_tm (timer->node.expires); alarm.enabled =1 ;
Greg Kroah-Hartman
maintainerPATCH 554/599 gfs2: Make sure FITRIM minlen is rounded up to fs block size
In reply to Greg Kroah-HartmanFrom: Andrew Price <[email protected]>
commit 27ca8273fda398638ca994a207323a85b6d81190 upstream.
Per fstrim(8) we must round up the minlen argument to the fs block size. The current calculation doesn't take into account devices that have a discard granularity and requested minlen less than 1 fs block, so the value can get shifted away to zero in the translation to fs blocks.
The zero minlen passed to gfs2_rgrp_send_discards() then allows sb_issue_discard() to be called with nr_sects == 0 which returns -EINVAL and results in gfs2_rgrp_send_discards() returning -EIO.
Make sure minlen is never < 1 fs block by taking the max of the requested minlen and the fs block size before comparing to the device's discard granularity and shifting to fs blocks.
--- fs/gfs2/rgrp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/gfs2/rgrp.c +2 -1
@@ -1389,7 +1389,8 @@ int gfs2_fitrim(struct file *filp, void start = r.start >> bs_shift; end = start + (r.len >> bs_shift); - minlen =max_t (u64, r.minlen, + minlen =max_t (u64, r.minlen, sdp->sd_sb.sb_bsize); + minlen =max_t (u64, minlen, q->limits.discard_granularity) >> bs_shift;if (end <= start || minlen > sdp->sd_max_rg_data)
Greg Kroah-Hartman
maintainerPATCH 555/599 net: hns3: fix software vlan talbe of vlan 0 inconsistent with hardware
In reply to Greg Kroah-HartmanFrom: Guangbin Huang <[email protected]>
commit 7ed258f12ec5ce855f15cdfb5710361dc82fe899 upstream.
When user delete vlan 0, as driver will not delete vlan 0 for hardware in function hclge_set_vlan_filter_hw(), so vlan 0 in software vlan talbe should not be deleted.
--- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +3 -3
@@ -9197,11 +9197,11 @@ int hclge_set_vlan_filter(struct hnae3_h }if (!ret) { -if (is_kill) -hclge_rm_vport_vlan_table (vport, vlan_id, false); -else +if (!is_kill)hclge_add_vport_vlan_table (vport, vlan_id, writen_to_tbl); +else if (is_kill && vlan_id !=0 ) +hclge_rm_vport_vlan_table (vport, vlan_id, false); }else if (is_kill) {/* when remove hw vlan filter failed, record the vlan id, * and try to remove it from hw later, to be consistence
Greg Kroah-Hartman
maintainerPATCH 556/599 rxrpc: Fix call timer start racing with call destruction
In reply to Greg Kroah-HartmanFrom: David Howells <[email protected]>
commit 4a7f62f91933c8ae5308f9127fd8ea48188b6bc3 upstream.
The rxrpc_call struct has a timer used to handle various timed events relating to a call. This timer can get started from the packet input routines that are run in softirq mode with just the RCU read lock held. Unfortunately, because only the RCU read lock is held - and neither ref or other lock is taken - the call can start getting destroyed at the same time a packet comes in addressed to that call. This causes the timer - which was already stopped - to get restarted. Later, the timer dispatch code may then oops if the timer got deallocated first.
Fix this by trying to take a ref on the rxrpc_call struct and, if successful, passing that ref along to the timer. If the timer was already running, the ref is discarded.
The timer completion routine can then pass the ref along to the call's work item when it queues it. If the timer or work item where already queued/running, the extra ref is discarded.
--- include/trace/events/rxrpc.h | 8 +++++++- net/rxrpc/ar-internal.h | 15 +++++++-------- net/rxrpc/call_event.c | 2 +- net/rxrpc/call_object.c | 40 +++++++++++++++++++++++++++++++++++----- 4 files changed, 50 insertions(+), 15 deletions(-)
include/trace/events/rxrpc.h +7 -1
@@ -83,12 +83,15 @@ enum rxrpc_call_trace { rxrpc_call_error, rxrpc_call_got, rxrpc_call_got_kernel, + rxrpc_call_got_timer, rxrpc_call_got_userid, rxrpc_call_new_client, rxrpc_call_new_service, rxrpc_call_put, rxrpc_call_put_kernel, rxrpc_call_put_noqueue, + rxrpc_call_put_notimer, + rxrpc_call_put_timer, rxrpc_call_put_userid, rxrpc_call_queued, rxrpc_call_queued_ref,
@@ -278,12 +281,15 @@ enum rxrpc_tx_point { EM(rxrpc_call_error, "*E*") \ EM(rxrpc_call_got, "GOT") \ EM(rxrpc_call_got_kernel, "Gke") \ + EM(rxrpc_call_got_timer, "GTM") \ EM(rxrpc_call_got_userid, "Gus") \ EM(rxrpc_call_new_client, "NWc") \ EM(rxrpc_call_new_service, "NWs") \ EM(rxrpc_call_put, "PUT") \ EM(rxrpc_call_put_kernel, "Pke") \ - EM(rxrpc_call_put_noqueue, "PNQ") \ + EM(rxrpc_call_put_noqueue, "PnQ") \ + EM(rxrpc_call_put_notimer, "PnT") \ + EM(rxrpc_call_put_timer, "PTM") \ EM(rxrpc_call_put_userid, "Pus") \ EM(rxrpc_call_queued, "QUE") \EM (rxrpc_call_queued_ref,"QUR" ) \
net/rxrpc/ar-internal.h +7 -8
@@ -760,14 +760,12 @@ void rxrpc_propose_ACK(struct rxrpc_call enum rxrpc_propose_ack_trace);void rxrpc_process_call (struct work_struct *); -static inline void rxrpc_reduce_call_timer (struct rxrpc_call *call, -unsigned long expire_at, -unsigned long now, -enum rxrpc_timer_trace why) -{ -trace_rxrpc_timer (call, why, now); -timer_reduce (&call->timer, expire_at); -} +void rxrpc_reduce_call_timer (struct rxrpc_call *call, +unsigned long expire_at, +unsigned long now, +enum rxrpc_timer_trace why); + +void rxrpc_delete_call_timer (struct rxrpc_call *call);/* * call_object.c
@@ -791,6 +789,7 @@ void rxrpc_release_calls_on_socket(strucbool __rxrpc_queue_call (struct rxrpc_call *);bool rxrpc_queue_call (struct rxrpc_call *);void rxrpc_see_call (struct rxrpc_call *); +bool rxrpc_try_get_call (struct rxrpc_call *call,enum rxrpc_call_trace op);void rxrpc_get_call (struct rxrpc_call *,enum rxrpc_call_trace );void rxrpc_put_call (struct rxrpc_call *,enum rxrpc_call_trace );void rxrpc_cleanup_call (struct rxrpc_call *);
net/rxrpc/call_event.c +1 -1
@@ -310,7 +310,7 @@ recheck_state: }if (call->state ==RXRPC_CALL_COMPLETE ) { -del_timer_sync (&call->timer); +rxrpc_delete_call_timer (call); goto out_put; }
net/rxrpc/call_object.c +35 -5
@@ -53,10 +53,30 @@ static void rxrpc_call_timer_expired(strif (call->state <RXRPC_CALL_COMPLETE ) {trace_rxrpc_timer (call, rxrpc_timer_expired, jiffies); -rxrpc_queue_call (call); +__rxrpc_queue_call (call); + }else { +rxrpc_put_call (call, rxrpc_call_put); + } +} + +void rxrpc_reduce_call_timer (struct rxrpc_call *call, +unsigned long expire_at, +unsigned long now, +enum rxrpc_timer_trace why) +{ +if (rxrpc_try_get_call (call, rxrpc_call_got_timer)) { +trace_rxrpc_timer (call, why, now); +if (timer_reduce (&call->timer, expire_at)) +rxrpc_put_call (call, rxrpc_call_put_notimer); } } +void rxrpc_delete_call_timer (struct rxrpc_call *call) +{ +if (del_timer_sync (&call->timer)) +rxrpc_put_call (call, rxrpc_call_put_timer); +} +static struct lock_class_key rxrpc_call_user_mutex_lock_class_key;/*
@@ -463,6 +483,17 @@ void rxrpc_see_call(struct rxrpc_call *c } } +bool rxrpc_try_get_call (struct rxrpc_call *call,enum rxrpc_call_trace op) +{ +const void *here =__builtin_return_address (0 ); +int n =atomic_fetch_add_unless (&call->usage,1 ,0 ); + +if (n ==0 ) +return false; +trace_rxrpc_call (call->debug_id, op, n, here,NULL ); +return true; +} +/* * Note the addition of a ref on a call. */
@@ -510,8 +541,7 @@ void rxrpc_release_call(struct rxrpc_socspin_unlock_bh (&call->lock);rxrpc_put_call_slot (call); - -del_timer_sync (&call->timer); +rxrpc_delete_call_timer (call);/* Make sure we don't get any more notifications */ write_lock_bh (&rx->recvmsg_lock);
@@ -618,6 +648,8 @@ static void rxrpc_destroy_call(struct wo struct rxrpc_call *call = container_of(work, struct rxrpc_call, processor);struct rxrpc_net *rxnet = call->rxnet; +rxrpc_delete_call_timer (call); +rxrpc_put_connection (call->conn);rxrpc_put_peer (call->peer);kfree (call->rxtx_buffer);
@@ -652,8 +684,6 @@ void rxrpc_cleanup_call(struct rxrpc_calmemset (&call->sock_node,0xcd ,sizeof (call->sock_node)); -del_timer_sync (&call->timer); - ASSERTCMP(call->state, ==, RXRPC_CALL_COMPLETE);ASSERT (test_bit (RXRPC_CALL_RELEASED , &call->flags));
Greg Kroah-Hartman
maintainerPATCH 557/599 mailbox: imx: fix wakeup failure from freeze mode
In reply to Greg Kroah-HartmanFrom: Robin Gong <[email protected]>
commit 892cb524ae8a27bf5e42f711318371acd9a9f74a upstream.
Since IRQF_NO_SUSPEND used for imx mailbox driver, that means this irq can't be used for wakeup source so that can't wakeup from freeze mode. Add pm_system_wakeup() to wakeup from freeze mode.
--- drivers/mailbox/imx-mailbox.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/mailbox/imx-mailbox.c +9 -0
@@ -13,6 +13,7 @@#include <linux/module.h> #include <linux/of_device.h> #include <linux/pm_runtime.h> +#include <linux/suspend.h> #include <linux/slab.h> #define IMX_MU_xSR_GIPn (x) BIT(28 + (3 - (x)))
@@ -66,6 +67,7 @@ struct imx_mu_priv {const struct imx_mu_dcfg *dcfg;struct clk *clk;int irq; +bool suspend;u32 xcr;
@@ -277,6 +279,9 @@ static irqreturn_t imx_mu_isr(int irq, vreturn IRQ_NONE ; } +if (priv->suspend) +pm_system_wakeup (); +return IRQ_HANDLED ; }
@@ -326,6 +331,8 @@ static int imx_mu_startup(struct mbox_chbreak ; } + priv->suspend = true; +return 0 ; }
@@ -543,6 +550,8 @@ static int imx_mu_probe(struct platform_clk_disable_unprepare (priv->clk); + priv->suspend = false; +return 0 ; disable_runtime_pm:
Greg Kroah-Hartman
maintainerPATCH 558/599 crypto: arm/aes-neonbs-cbc - Select generic cbc and aes
In reply to Greg Kroah-HartmanFrom: Herbert Xu <[email protected]>
commit c8bd296cca3434b13b28b074eaeb78a23284de77 upstream.
The algorithm __cbc-aes-neonbs requires a fallback so we need to select the config options for them or otherwise it will fail to register on boot-up.
--- arch/arm/crypto/Kconfig | 2 ++ 1 file changed, 2 insertions(+)
arch/arm/crypto/Kconfig +2 -0
@@ -83,6 +83,8 @@ config CRYPTO_AES_ARM_BS depends on KERNEL_MODE_NEON select CRYPTO_SKCIPHER select CRYPTO_LIB_AES + select CRYPTO_AES + select CRYPTO_CBC select CRYPTO_SIMD help Use a faster and more secure NEON based implementation of AES in CBC,
Greg Kroah-Hartman
maintainerPATCH 559/599 watch_queue: Free the page array when watch_queue is dismantled
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
commit b490207017ba237d97b735b2aa66dc241ccd18f5 upstream.
Commit 7ea1a0124b6d ("watch_queue: Free the alloc bitmap when the watch_queue is torn down") took care of the bitmap, but not the page array.
BUG: memory leak
unreferenced object 0xffff88810d9bc140 (size 32):
comm "syz-executor335", pid 3603, jiffies 4294946994 (age 12.840s)
hex dump (first 32 bytes):
40 a7 40 04 00 ea ff ff 00 00 00 00 00 00 00 00 @.@.............
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
kmalloc_array include/linux/slab.h:621 [inline]
kcalloc include/linux/slab.h:652 [inline]
watch_queue_set_size+0x12f/0x2e0 kernel/watch_queue.c:251
pipe_ioctl+0x82/0x140 fs/pipe.c:632
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:874 [inline]
__se_sys_ioctl fs/ioctl.c:860 [inline]
__x64_sys_ioctl+0xfc/0x140 fs/ioctl.c:860
do_syscall_x64 arch/x86/entry/common.c:50 [inline]--- kernel/watch_queue.c | 1 + 1 file changed, 1 insertion(+)
kernel/watch_queue.c +1 -0
@@ -373,6 +373,7 @@ static void __put_watch_queue(struct krefor (i =0 ; i < wqueue->nr_pages; i++)__free_page (wqueue->notes[i]); +kfree (wqueue->notes);bitmap_free (wqueue->notes_bitmap); wfilter =rcu_access_pointer (wqueue->filter);
Greg Kroah-Hartman
maintainerPATCH 560/599 pinctrl: pinconf-generic: Print arguments for bias-pull-*
In reply to Greg Kroah-HartmanFrom: Chen-Yu Tsai <[email protected]>
commit 188e5834b930acd03ad3cf7c5e7aa24db9665a29 upstream.
The bias-pull-* properties, or PIN_CONFIG_BIAS_PULL_* pin config parameters, accept optional arguments in ohms denoting the strength of the pin bias.
Print these values out in debugfs as well.
--- drivers/pinctrl/pinconf-generic.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/pinctrl/pinconf-generic.c +3 -3
@@ -30,10 +30,10 @@ static const struct pin_config_item confPCONFDUMP (PIN_CONFIG_BIAS_BUS_HOLD ,"input bias bus hold" ,NULL , false),PCONFDUMP (PIN_CONFIG_BIAS_DISABLE ,"input bias disabled" ,NULL , false),PCONFDUMP (PIN_CONFIG_BIAS_HIGH_IMPEDANCE ,"input bias high impedance" ,NULL , false), -PCONFDUMP (PIN_CONFIG_BIAS_PULL_DOWN ,"input bias pull down" ,NULL , false), +PCONFDUMP (PIN_CONFIG_BIAS_PULL_DOWN ,"input bias pull down" ,"ohms" , true),PCONFDUMP (PIN_CONFIG_BIAS_PULL_PIN_DEFAULT , -"input bias pull to pin specific state" ,NULL , false), -PCONFDUMP (PIN_CONFIG_BIAS_PULL_UP ,"input bias pull up" ,NULL , false), +"input bias pull to pin specific state" ,"ohms" , true), +PCONFDUMP (PIN_CONFIG_BIAS_PULL_UP ,"input bias pull up" ,"ohms" , true),PCONFDUMP (PIN_CONFIG_DRIVE_OPEN_DRAIN ,"output drive open drain" ,NULL , false),PCONFDUMP (PIN_CONFIG_DRIVE_OPEN_SOURCE ,"output drive open source" ,NULL , false), PCONFDUMP(PIN_CONFIG_DRIVE_PUSH_PULL, "output drive push pull", NULL, false),
Greg Kroah-Hartman
maintainerPATCH 561/599 watchdog: rti-wdt: Add missing pm_runtime_disable() in probe function
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
commit d055ef3a2c6919cff504ae3b710c96318d545fd2 upstream.
If the probe fails, we should use pm_runtime_disable() to balance pm_runtime_enable().
--- drivers/watchdog/rti_wdt.c | 1 + 1 file changed, 1 insertion(+)
drivers/watchdog/rti_wdt.c +1 -0
@@ -229,6 +229,7 @@ static int rti_wdt_probe(struct platform ret =pm_runtime_get_sync (dev);if (ret) {pm_runtime_put_noidle (dev); +pm_runtime_disable (&pdev->dev);return dev_err_probe (dev, ret,"runtime pm failed\n" ); }
Greg Kroah-Hartman
maintainerPATCH 562/599 pinctrl: nuvoton: npcm7xx: Rename DS() macro to DSTR()
In reply to Greg Kroah-HartmanFrom: Jonathan Neuschäfer <[email protected]>
commit 603501c16431c56f74eaef1ee1390f60a30c2187 upstream.
The name "DS" is defined in arch/x86/um/shared/sysdep/ptrace_64.h, which results in a compiler warning when build-testing on ARCH=um. Rename this driver's "DS" macro to DSTR so avoid this collision.
--- drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c | 156 +++++++++++++++--------------- 1 file changed, 78 insertions(+), 78 deletions(-)
drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c +78 -78
@@ -904,7 +904,7 @@ static struct npcm7xx_func npcm7xx_funcs#define DRIVE_STRENGTH_HI_SHIFT 12#define DRIVE_STRENGTH_MASK 0x0000FF00 -#define DS (lo, hi) (((lo) << DRIVE_STRENGTH_LO_SHIFT) | \ +#define DSTR (lo, hi) (((lo) << DRIVE_STRENGTH_LO_SHIFT) | \ ((hi) << DRIVE_STRENGTH_HI_SHIFT))#define DSLO (x) (((x) >> DRIVE_STRENGTH_LO_SHIFT) & 0xF)#define DSHI (x) (((x) >> DRIVE_STRENGTH_HI_SHIFT) & 0xF)
@@ -924,31 +924,31 @@ struct npcm7xx_pincfg {static const struct npcm7xx_pincfg pincfg[] = {/* PIN FUNCTION 1 FUNCTION 2 FUNCTION 3 FLAGS */ NPCM7XX_PINCFG (0 , iox1,MFSEL1 ,30 , none,NONE ,0 , none,NONE ,0 ,0 ), -NPCM7XX_PINCFG (1 , iox1,MFSEL1 ,30 , none,NONE ,0 , none,NONE ,0 ,DS (8 ,12 )), -NPCM7XX_PINCFG (2 , iox1,MFSEL1 ,30 , none,NONE ,0 , none,NONE ,0 ,DS (8 ,12 )), +NPCM7XX_PINCFG (1 , iox1,MFSEL1 ,30 , none,NONE ,0 , none,NONE ,0 ,DSTR (8 ,12 )), +NPCM7XX_PINCFG (2 , iox1,MFSEL1 ,30 , none,NONE ,0 , none,NONE ,0 ,DSTR (8 ,12 )),NPCM7XX_PINCFG (3 , iox1,MFSEL1 ,30 , none,NONE ,0 , none,NONE ,0 ,0 ),NPCM7XX_PINCFG (4 , iox2,MFSEL3 ,14 , smb1d,I2CSEGSEL ,7 , none,NONE ,0 ,SLEW ),NPCM7XX_PINCFG (5 , iox2,MFSEL3 ,14 , smb1d,I2CSEGSEL ,7 , none,NONE ,0 ,SLEW ),NPCM7XX_PINCFG (6 , iox2,MFSEL3 ,14 , smb2d,I2CSEGSEL ,10 , none,NONE ,0 ,SLEW ),NPCM7XX_PINCFG (7 , iox2,MFSEL3 ,14 , smb2d,I2CSEGSEL ,10 , none,NONE ,0 ,SLEW ), -NPCM7XX_PINCFG (8 , lkgpo1,FLOCKR1 ,4 , none,NONE ,0 , none,NONE ,0 ,DS (8 ,12 )), -NPCM7XX_PINCFG (9 , lkgpo2,FLOCKR1 ,8 , none,NONE ,0 , none,NONE ,0 ,DS (8 ,12 )), -NPCM7XX_PINCFG (10 , ioxh,MFSEL3 ,18 , none,NONE ,0 , none,NONE ,0 ,DS (8 ,12 )), -NPCM7XX_PINCFG (11 , ioxh,MFSEL3 ,18 , none,NONE ,0 , none,NONE ,0 ,DS (8 ,12 )), +NPCM7XX_PINCFG (8 , lkgpo1,FLOCKR1 ,4 , none,NONE ,0 , none,NONE ,0 ,DSTR (8 ,12 )), +NPCM7XX_PINCFG (9 , lkgpo2,FLOCKR1 ,8 , none,NONE ,0 , none,NONE ,0 ,DSTR (8 ,12 )), +NPCM7XX_PINCFG (10 , ioxh,MFSEL3 ,18 , none,NONE ,0 , none,NONE ,0 ,DSTR (8 ,12 )), +NPCM7XX_PINCFG (11 , ioxh,MFSEL3 ,18 , none,NONE ,0 , none,NONE ,0 ,DSTR (8 ,12 )),NPCM7XX_PINCFG (12 , gspi,MFSEL1 ,24 , smb5b,I2CSEGSEL ,19 , none,NONE ,0 ,SLEW ),NPCM7XX_PINCFG (13 , gspi,MFSEL1 ,24 , smb5b,I2CSEGSEL ,19 , none,NONE ,0 ,SLEW ),NPCM7XX_PINCFG (14 , gspi,MFSEL1 ,24 , smb5c,I2CSEGSEL ,20 , none,NONE ,0 ,SLEW ),NPCM7XX_PINCFG (15 , gspi,MFSEL1 ,24 , smb5c,I2CSEGSEL ,20 , none,NONE ,0 ,SLEW ), -NPCM7XX_PINCFG (16 , lkgpo0,FLOCKR1 ,0 , none,NONE ,0 , none,NONE ,0 ,DS (8 ,12 )), -NPCM7XX_PINCFG (17 , pspi2,MFSEL3 ,13 , smb4den,I2CSEGSEL ,23 , none,NONE ,0 ,DS (8 ,12 )), -NPCM7XX_PINCFG (18 , pspi2,MFSEL3 ,13 , smb4b,I2CSEGSEL ,14 , none,NONE ,0 ,DS (8 ,12 )), -NPCM7XX_PINCFG (19 , pspi2,MFSEL3 ,13 , smb4b,I2CSEGSEL ,14 , none,NONE ,0 ,DS (8 ,12 )), +NPCM7XX_PINCFG (16 , lkgpo0,FLOCKR1 ,0 , none,NONE ,0 , none,NONE ,0 ,DSTR (8 ,12 )), +NPCM7XX_PINCFG (17 , pspi2,MFSEL3 ,13 , smb4den,I2CSEGSEL ,23 , none,NONE ,0 ,DSTR (8 ,12 )), +NPCM7XX_PINCFG (18 , pspi2,MFSEL3 ,13 , smb4b,I2CSEGSEL ,14 , none,NONE ,0 ,DSTR (8 ,12 )), +NPCM7XX_PINCFG (19 , pspi2,MFSEL3 ,13 , smb4b,I2CSEGSEL ,14 , none,NONE ,0 ,DSTR (8 ,12 )),NPCM7XX_PINCFG (20 , smb4c,I2CSEGSEL ,15 , smb15,MFSEL3 ,8 , none,NONE ,0 ,0 ),NPCM7XX_PINCFG (21 , smb4c,I2CSEGSEL ,15 , smb15,MFSEL3 ,8 , none,NONE ,0 ,0 ),NPCM7XX_PINCFG (22 , smb4d,I2CSEGSEL ,16 , smb14,MFSEL3 ,7 , none,NONE ,0 ,0 ),NPCM7XX_PINCFG (23 , smb4d,I2CSEGSEL ,16 , smb14,MFSEL3 ,7 , none,NONE ,0 ,0 ), -NPCM7XX_PINCFG (24 , ioxh,MFSEL3 ,18 , none,NONE ,0 , none,NONE ,0 ,DS (8 ,12 )), -NPCM7XX_PINCFG (25 , ioxh,MFSEL3 ,18 , none,NONE ,0 , none,NONE ,0 ,DS (8 ,12 )), +NPCM7XX_PINCFG (24 , ioxh,MFSEL3 ,18 , none,NONE ,0 , none,NONE ,0 ,DSTR (8 ,12 )), +NPCM7XX_PINCFG (25 , ioxh,MFSEL3 ,18 , none,NONE ,0 , none,NONE ,0 ,DSTR (8 ,12 )),NPCM7XX_PINCFG (26 , smb5,MFSEL1 ,2 , none,NONE ,0 , none,NONE ,0 ,0 ),NPCM7XX_PINCFG (27 , smb5,MFSEL1 ,2 , none,NONE ,0 , none,NONE ,0 ,0 ),NPCM7XX_PINCFG (28 , smb4,MFSEL1 ,1 , none,NONE ,0 , none,NONE ,0 ,0 ),
@@ -964,12 +964,12 @@ static const struct npcm7xx_pincfg pincfNPCM7XX_PINCFG (39 , smb3b,I2CSEGSEL ,11 , none,NONE ,0 , none,NONE ,0 ,SLEW ),NPCM7XX_PINCFG (40 , smb3b,I2CSEGSEL ,11 , none,NONE ,0 , none,NONE ,0 ,SLEW ),NPCM7XX_PINCFG (41 , bmcuart0a,MFSEL1 ,9 , none,NONE ,0 , none,NONE ,0 ,0 ), -NPCM7XX_PINCFG (42 , bmcuart0a,MFSEL1 ,9 , none,NONE ,0 , none,NONE ,0 ,DS (2 ,4 ) |GPO ), +NPCM7XX_PINCFG (42 , bmcuart0a,MFSEL1 ,9 , none,NONE ,0 , none,NONE ,0 ,DSTR (2 ,4 ) |GPO ),NPCM7XX_PINCFG (43 , uart1,MFSEL1 ,10 , jtag2,MFSEL4 ,0 , bmcuart1,MFSEL3 ,24 ,0 ),NPCM7XX_PINCFG (44 , uart1,MFSEL1 ,10 , jtag2,MFSEL4 ,0 , bmcuart1,MFSEL3 ,24 ,0 ),NPCM7XX_PINCFG (45 , uart1,MFSEL1 ,10 , jtag2,MFSEL4 ,0 , none,NONE ,0 ,0 ), -NPCM7XX_PINCFG (46 , uart1,MFSEL1 ,10 , jtag2,MFSEL4 ,0 , none,NONE ,0 ,DS (2 ,8 )), -NPCM7XX_PINCFG (47 , uart1,MFSEL1 ,10 , jtag2,MFSEL4 ,0 , none,NONE ,0 ,DS (2 ,8 )), +NPCM7XX_PINCFG (46 , uart1,MFSEL1 ,10 , jtag2,MFSEL4 ,0 , none,NONE ,0 ,DSTR (2 ,8 )), +NPCM7XX_PINCFG (47 , uart1,MFSEL1 ,10 , jtag2,MFSEL4 ,0 , none,NONE ,0 ,DSTR (2 ,8 )),NPCM7XX_PINCFG (48 , uart2,MFSEL1 ,11 , bmcuart0b,MFSEL4 ,1 , none,NONE ,0 ,GPO ),NPCM7XX_PINCFG (49 , uart2,MFSEL1 ,11 , bmcuart0b,MFSEL4 ,1 , none,NONE ,0 ,0 ), NPCM7XX_PINCFG(50, uart2, MFSEL1, 11, none, NONE, 0, none, NONE, 0, 0),
@@ -979,8 +979,8 @@ static const struct npcm7xx_pincfg pincfNPCM7XX_PINCFG (54 , uart2,MFSEL1 ,11 , none,NONE ,0 , none,NONE ,0 ,0 ),NPCM7XX_PINCFG (55 , uart2,MFSEL1 ,11 , none,NONE ,0 , none,NONE ,0 ,0 ),NPCM7XX_PINCFG (56 , r1err,MFSEL1 ,12 , none,NONE ,0 , none,NONE ,0 ,0 ), -NPCM7XX_PINCFG (57 , r1md,MFSEL1 ,13 , none,NONE ,0 , none,NONE ,0 ,DS (2 ,4 )), -NPCM7XX_PINCFG (58 , r1md,MFSEL1 ,13 , none,NONE ,0 , none,NONE ,0 ,DS (2 ,4 )), +NPCM7XX_PINCFG (57 , r1md,MFSEL1 ,13 , none,NONE ,0 , none,NONE ,0 ,DSTR (2 ,4 )), +NPCM7XX_PINCFG (58 , r1md,MFSEL1 ,13 , none,NONE ,0 , none,NONE ,0 ,DSTR (2 ,4 )),NPCM7XX_PINCFG (59 , smb3d,I2CSEGSEL ,13 , none,NONE ,0 , none,NONE ,0 ,0 ),NPCM7XX_PINCFG (60 , smb3d,I2CSEGSEL ,13 , none,NONE ,0 , none,NONE ,0 ,0 ), NPCM7XX_PINCFG(61, uart1, MFSEL1, 10, none, NONE, 0, none, NONE, 0, GPO),
@@ -1003,19 +1003,19 @@ static const struct npcm7xx_pincfg pincfNPCM7XX_PINCFG (77 , fanin13,MFSEL2 ,13 , none,NONE ,0 , none,NONE ,0 ,0 ),NPCM7XX_PINCFG (78 , fanin14,MFSEL2 ,14 , none,NONE ,0 , none,NONE ,0 ,0 ),NPCM7XX_PINCFG (79 , fanin15,MFSEL2 ,15 , none,NONE ,0 , none,NONE ,0 ,0 ), -NPCM7XX_PINCFG (80 , pwm0,MFSEL2 ,16 , none,NONE ,0 , none,NONE ,0 ,DS (4 ,8 )), -NPCM7XX_PINCFG (81 , pwm1,MFSEL2 ,17 , none,NONE ,0 , none,NONE ,0 ,DS (4 ,8 )), -NPCM7XX_PINCFG (82 , pwm2,MFSEL2 ,18 , none,NONE ,0 , none,NONE ,0 ,DS (4 ,8 )), -NPCM7XX_PINCFG (83 , pwm3,MFSEL2 ,19 , none,NONE ,0 , none,NONE ,0 ,DS (4 ,8 )), -NPCM7XX_PINCFG (84 , r2,MFSEL1 ,14 , none,NONE ,0 , none,NONE ,0 ,DS (8 ,12 ) |SLEW ), -NPCM7XX_PINCFG (85 , r2,MFSEL1 ,14 , none,NONE ,0 , none,NONE ,0 ,DS (8 ,12 ) |SLEW ), -NPCM7XX_PINCFG (86 , r2,MFSEL1 ,14 , none,NONE ,0 , none,NONE ,0 ,DS (8 ,12 ) |SLEW ), +NPCM7XX_PINCFG (80 , pwm0,MFSEL2 ,16 , none,NONE ,0 , none,NONE ,0 ,DSTR (4 ,8 )), +NPCM7XX_PINCFG (81 , pwm1,MFSEL2 ,17 , none,NONE ,0 , none,NONE ,0 ,DSTR (4 ,8 )), +NPCM7XX_PINCFG (82 , pwm2,MFSEL2 ,18 , none,NONE ,0 , none,NONE ,0 ,DSTR (4 ,8 )), +NPCM7XX_PINCFG (83 , pwm3,MFSEL2 ,19 , none,NONE ,0 , none,NONE ,0 ,DSTR (4 ,8 )), +NPCM7XX_PINCFG (84 , r2,MFSEL1 ,14 , none,NONE ,0 , none,NONE ,0 ,DSTR (8 ,12 ) |SLEW ), +NPCM7XX_PINCFG (85 , r2,MFSEL1 ,14 , none,NONE ,0 , none,NONE ,0 ,DSTR (8 ,12 ) |SLEW ), +NPCM7XX_PINCFG (86 , r2,MFSEL1 ,14 , none,NONE ,0 , none,NONE ,0 ,DSTR (8 ,12 ) |SLEW ),NPCM7XX_PINCFG (87 , r2,MFSEL1 ,14 , none,NONE ,0 , none,NONE ,0 ,0 ),NPCM7XX_PINCFG (88 , r2,MFSEL1 ,14 , none,NONE ,0 , none,NONE ,0 ,0 ),NPCM7XX_PINCFG (89 , r2,MFSEL1 ,14 , none,NONE ,0 , none,NONE ,0 ,0 ),NPCM7XX_PINCFG (90 , r2err,MFSEL1 ,15 , none,NONE ,0 , none,NONE ,0 ,0 ), -NPCM7XX_PINCFG (91 , r2md,MFSEL1 ,16 , none,NONE ,0 , none,NONE ,0 ,DS (2 ,4 )), -NPCM7XX_PINCFG (92 , r2md,MFSEL1 ,16 , none,NONE ,0 , none,NONE ,0 ,DS (2 ,4 )), +NPCM7XX_PINCFG (91 , r2md,MFSEL1 ,16 , none,NONE ,0 , none,NONE ,0 ,DSTR (2 ,4 )), +NPCM7XX_PINCFG (92 , r2md,MFSEL1 ,16 , none,NONE ,0 , none,NONE ,0 ,DSTR (2 ,4 )),NPCM7XX_PINCFG (93 , ga20kbc,MFSEL1 ,17 , smb5d,I2CSEGSEL ,21 , none,NONE ,0 ,0 ),NPCM7XX_PINCFG (94 , ga20kbc,MFSEL1 ,17 , smb5d,I2CSEGSEL ,21 , none,NONE ,0 ,0 ), NPCM7XX_PINCFG(95, lpc, NONE, 0, espi, MFSEL4, 8, gpio, MFSEL1, 26, 0),
@@ -1061,34 +1061,34 @@ static const struct npcm7xx_pincfg pincfNPCM7XX_PINCFG (133 , smb10,MFSEL4 ,13 , none,NONE ,0 , none,NONE ,0 ,0 ),NPCM7XX_PINCFG (134 , smb11,MFSEL4 ,14 , none,NONE ,0 , none,NONE ,0 ,0 ),NPCM7XX_PINCFG (135 , smb11,MFSEL4 ,14 , none,NONE ,0 , none,NONE ,0 ,0 ), -NPCM7XX_PINCFG (136 , sd1,MFSEL3 ,12 , none,NONE ,0 , none,NONE ,0 ,DS (8 ,12 ) |SLEW ), -NPCM7XX_PINCFG (137 , sd1,MFSEL3 ,12 , none,NONE ,0 , none,NONE ,0 ,DS (8 ,12 ) |SLEW ), -NPCM7XX_PINCFG (138 , sd1,MFSEL3 ,12 , none,NONE ,0 , none,NONE ,0 ,DS (8 ,12 ) |SLEW ), -NPCM7XX_PINCFG (139 , sd1,MFSEL3 ,12 , none,NONE ,0 , none,NONE ,0 ,DS (8 ,12 ) |SLEW ), -NPCM7XX_PINCFG (140 , sd1,MFSEL3 ,12 , none,NONE ,0 , none,NONE ,0 ,DS (8 ,12 ) |SLEW ), +NPCM7XX_PINCFG (136 , sd1,MFSEL3 ,12 , none,NONE ,0 , none,NONE ,0 ,DSTR (8 ,12 ) |SLEW ), +NPCM7XX_PINCFG (137 , sd1,MFSEL3 ,12 , none,NONE ,0 , none,NONE ,0 ,DSTR (8 ,12 ) |SLEW ), +NPCM7XX_PINCFG (138 , sd1,MFSEL3 ,12 , none,NONE ,0 , none,NONE ,0 ,DSTR (8 ,12 ) |SLEW ), +NPCM7XX_PINCFG (139 , sd1,MFSEL3 ,12 , none,NONE ,0 , none,NONE ,0 ,DSTR (8 ,12 ) |SLEW ), +NPCM7XX_PINCFG (140 , sd1,MFSEL3 ,12 , none,NONE ,0 , none,NONE ,0 ,DSTR (8 ,12 ) |SLEW ),NPCM7XX_PINCFG (141 , sd1,MFSEL3 ,12 , none,NONE ,0 , none,NONE ,0 ,0 ), -NPCM7XX_PINCFG (142 , sd1,MFSEL3 ,12 , none,NONE ,0 , none,NONE ,0 ,DS (8 ,12 ) |SLEW ), +NPCM7XX_PINCFG (142 , sd1,MFSEL3 ,12 , none,NONE ,0 , none,NONE ,0 ,DSTR (8 ,12 ) |SLEW ),NPCM7XX_PINCFG (143 , sd1,MFSEL3 ,12 , sd1pwr,MFSEL4 ,5 , none,NONE ,0 ,0 ), -NPCM7XX_PINCFG (144 , pwm4,MFSEL2 ,20 , none,NONE ,0 , none,NONE ,0 ,DS (4 ,8 )), -NPCM7XX_PINCFG (145 , pwm5,MFSEL2 ,21 , none,NONE ,0 , none,NONE ,0 ,DS (4 ,8 )), -NPCM7XX_PINCFG (146 , pwm6,MFSEL2 ,22 , none,NONE ,0 , none,NONE ,0 ,DS (4 ,8 )), -NPCM7XX_PINCFG (147 , pwm7,MFSEL2 ,23 , none,NONE ,0 , none,NONE ,0 ,DS (4 ,8 )), -NPCM7XX_PINCFG (148 , mmc8,MFSEL3 ,11 , none,NONE ,0 , none,NONE ,0 ,DS (8 ,12 ) |SLEW ), -NPCM7XX_PINCFG (149 , mmc8,MFSEL3 ,11 , none,NONE ,0 , none,NONE ,0 ,DS (8 ,12 ) |SLEW ), -NPCM7XX_PINCFG (150 , mmc8,MFSEL3 ,11 , none,NONE ,0 , none,NONE ,0 ,DS (8 ,12 ) |SLEW ), -NPCM7XX_PINCFG (151 , mmc8,MFSEL3 ,11 , none,NONE ,0 , none,NONE ,0 ,DS (8 ,12 ) |SLEW ), -NPCM7XX_PINCFG (152 , mmc,MFSEL3 ,10 , none,NONE ,0 , none,NONE ,0 ,DS (8 ,12 ) |SLEW ), +NPCM7XX_PINCFG (144 , pwm4,MFSEL2 ,20 , none,NONE ,0 , none,NONE ,0 ,DSTR (4 ,8 )), +NPCM7XX_PINCFG (145 , pwm5,MFSEL2 ,21 , none,NONE ,0 , none,NONE ,0 ,DSTR (4 ,8 )), +NPCM7XX_PINCFG (146 , pwm6,MFSEL2 ,22 , none,NONE ,0 , none,NONE ,0 ,DSTR (4 ,8 )), +NPCM7XX_PINCFG (147 , pwm7,MFSEL2 ,23 , none,NONE ,0 , none,NONE ,0 ,DSTR (4 ,8 )), +NPCM7XX_PINCFG (148 , mmc8,MFSEL3 ,11 , none,NONE ,0 , none,NONE ,0 ,DSTR (8 ,12 ) |SLEW ), +NPCM7XX_PINCFG (149 , mmc8,MFSEL3 ,11 , none,NONE ,0 , none,NONE ,0 ,DSTR (8 ,12 ) |SLEW ), +NPCM7XX_PINCFG (150 , mmc8,MFSEL3 ,11 , none,NONE ,0 , none,NONE ,0 ,DSTR (8 ,12 ) |SLEW ), +NPCM7XX_PINCFG (151 , mmc8,MFSEL3 ,11 , none,NONE ,0 , none,NONE ,0 ,DSTR (8 ,12 ) |SLEW ), +NPCM7XX_PINCFG (152 , mmc,MFSEL3 ,10 , none,NONE ,0 , none,NONE ,0 ,DSTR (8 ,12 ) |SLEW ),NPCM7XX_PINCFG (153 , mmcwp,FLOCKR1 ,24 , none,NONE ,0 , none,NONE ,0 ,0 ),/* Z1/A1 */ -NPCM7XX_PINCFG (154 , mmc,MFSEL3 ,10 , none,NONE ,0 , none,NONE ,0 ,DS (8 ,12 ) |SLEW ), +NPCM7XX_PINCFG (154 , mmc,MFSEL3 ,10 , none,NONE ,0 , none,NONE ,0 ,DSTR (8 ,12 ) |SLEW ),NPCM7XX_PINCFG (155 , mmccd,MFSEL3 ,25 , mmcrst,MFSEL4 ,6 , none,NONE ,0 ,0 ),/* Z1/A1 */ -NPCM7XX_PINCFG (156 , mmc,MFSEL3 ,10 , none,NONE ,0 , none,NONE ,0 ,DS (8 ,12 ) |SLEW ), -NPCM7XX_PINCFG (157 , mmc,MFSEL3 ,10 , none,NONE ,0 , none,NONE ,0 ,DS (8 ,12 ) |SLEW ), -NPCM7XX_PINCFG (158 , mmc,MFSEL3 ,10 , none,NONE ,0 , none,NONE ,0 ,DS (8 ,12 ) |SLEW ), -NPCM7XX_PINCFG (159 , mmc,MFSEL3 ,10 , none,NONE ,0 , none,NONE ,0 ,DS (8 ,12 ) |SLEW ), - -NPCM7XX_PINCFG (160 , clkout,MFSEL1 ,21 , none,NONE ,0 , none,NONE ,0 ,DS (8 ,12 ) |SLEW ), -NPCM7XX_PINCFG (161 , lpc,NONE ,0 , espi,MFSEL4 ,8 , gpio,MFSEL1 ,26 ,DS (8 ,12 )), -NPCM7XX_PINCFG (162 , serirq,NONE ,0 , gpio,MFSEL1 ,31 , none,NONE ,0 ,DS (8 ,12 )), +NPCM7XX_PINCFG (156 , mmc,MFSEL3 ,10 , none,NONE ,0 , none,NONE ,0 ,DSTR (8 ,12 ) |SLEW ), +NPCM7XX_PINCFG (157 , mmc,MFSEL3 ,10 , none,NONE ,0 , none,NONE ,0 ,DSTR (8 ,12 ) |SLEW ), +NPCM7XX_PINCFG (158 , mmc,MFSEL3 ,10 , none,NONE ,0 , none,NONE ,0 ,DSTR (8 ,12 ) |SLEW ), +NPCM7XX_PINCFG (159 , mmc,MFSEL3 ,10 , none,NONE ,0 , none,NONE ,0 ,DSTR (8 ,12 ) |SLEW ), + +NPCM7XX_PINCFG (160 , clkout,MFSEL1 ,21 , none,NONE ,0 , none,NONE ,0 ,DSTR (8 ,12 ) |SLEW ), +NPCM7XX_PINCFG (161 , lpc,NONE ,0 , espi,MFSEL4 ,8 , gpio,MFSEL1 ,26 ,DSTR (8 ,12 )), +NPCM7XX_PINCFG (162 , serirq,NONE ,0 , gpio,MFSEL1 ,31 , none,NONE ,0 ,DSTR (8 ,12 )),NPCM7XX_PINCFG (163 , lpc,NONE ,0 , espi,MFSEL4 ,8 , gpio,MFSEL1 ,26 ,0 ),NPCM7XX_PINCFG (164 , lpc,NONE ,0 , espi,MFSEL4 ,8 , gpio,MFSEL1 ,26 ,SLEWLPC ), NPCM7XX_PINCFG(165, lpc, NONE, 0, espi, MFSEL4, 8, gpio, MFSEL1, 26, SLEWLPC),
@@ -1101,25 +1101,25 @@ static const struct npcm7xx_pincfg pincfNPCM7XX_PINCFG (172 , smb6,MFSEL3 ,1 , none,NONE ,0 , none,NONE ,0 ,0 ),NPCM7XX_PINCFG (173 , smb7,MFSEL3 ,2 , none,NONE ,0 , none,NONE ,0 ,0 ),NPCM7XX_PINCFG (174 , smb7,MFSEL3 ,2 , none,NONE ,0 , none,NONE ,0 ,0 ), -NPCM7XX_PINCFG (175 , pspi1,MFSEL3 ,4 , faninx,MFSEL3 ,3 , none,NONE ,0 ,DS (8 ,12 )), -NPCM7XX_PINCFG (176 , pspi1,MFSEL3 ,4 , faninx,MFSEL3 ,3 , none,NONE ,0 ,DS (8 ,12 )), -NPCM7XX_PINCFG (177 , pspi1,MFSEL3 ,4 , faninx,MFSEL3 ,3 , none,NONE ,0 ,DS (8 ,12 )), -NPCM7XX_PINCFG (178 , r1,MFSEL3 ,9 , none,NONE ,0 , none,NONE ,0 ,DS (8 ,12 ) |SLEW ), -NPCM7XX_PINCFG (179 , r1,MFSEL3 ,9 , none,NONE ,0 , none,NONE ,0 ,DS (8 ,12 ) |SLEW ), -NPCM7XX_PINCFG (180 , r1,MFSEL3 ,9 , none,NONE ,0 , none,NONE ,0 ,DS (8 ,12 ) |SLEW ), +NPCM7XX_PINCFG (175 , pspi1,MFSEL3 ,4 , faninx,MFSEL3 ,3 , none,NONE ,0 ,DSTR (8 ,12 )), +NPCM7XX_PINCFG (176 , pspi1,MFSEL3 ,4 , faninx,MFSEL3 ,3 , none,NONE ,0 ,DSTR (8 ,12 )), +NPCM7XX_PINCFG (177 , pspi1,MFSEL3 ,4 , faninx,MFSEL3 ,3 , none,NONE ,0 ,DSTR (8 ,12 )), +NPCM7XX_PINCFG (178 , r1,MFSEL3 ,9 , none,NONE ,0 , none,NONE ,0 ,DSTR (8 ,12 ) |SLEW ), +NPCM7XX_PINCFG (179 , r1,MFSEL3 ,9 , none,NONE ,0 , none,NONE ,0 ,DSTR (8 ,12 ) |SLEW ), +NPCM7XX_PINCFG (180 , r1,MFSEL3 ,9 , none,NONE ,0 , none,NONE ,0 ,DSTR (8 ,12 ) |SLEW ),NPCM7XX_PINCFG (181 , r1,MFSEL3 ,9 , none,NONE ,0 , none,NONE ,0 ,0 ),NPCM7XX_PINCFG (182 , r1,MFSEL3 ,9 , none,NONE ,0 , none,NONE ,0 ,0 ), -NPCM7XX_PINCFG (183 , spi3,MFSEL4 ,16 , none,NONE ,0 , none,NONE ,0 ,DS (8 ,12 ) |SLEW ), -NPCM7XX_PINCFG (184 , spi3,MFSEL4 ,16 , none,NONE ,0 , none,NONE ,0 ,DS (8 ,12 ) |SLEW |GPO ), -NPCM7XX_PINCFG (185 , spi3,MFSEL4 ,16 , none,NONE ,0 , none,NONE ,0 ,DS (8 ,12 ) |SLEW |GPO ), -NPCM7XX_PINCFG (186 , spi3,MFSEL4 ,16 , none,NONE ,0 , none,NONE ,0 ,DS (8 ,12 )), -NPCM7XX_PINCFG (187 , spi3cs1,MFSEL4 ,17 , none,NONE ,0 , none,NONE ,0 ,DS (8 ,12 )), -NPCM7XX_PINCFG (188 , spi3quad,MFSEL4 ,20 , spi3cs2,MFSEL4 ,18 , none,NONE ,0 ,DS (8 ,12 ) |SLEW ), -NPCM7XX_PINCFG (189 , spi3quad,MFSEL4 ,20 , spi3cs3,MFSEL4 ,19 , none,NONE ,0 ,DS (8 ,12 ) |SLEW ), -NPCM7XX_PINCFG (190 , gpio,FLOCKR1 ,20 , nprd_smi,NONE ,0 , none,NONE ,0 ,DS (2 ,4 )), -NPCM7XX_PINCFG (191 , none,NONE ,0 , none,NONE ,0 , none,NONE ,0 ,DS (8 ,12 )),/* XX */ +NPCM7XX_PINCFG (183 , spi3,MFSEL4 ,16 , none,NONE ,0 , none,NONE ,0 ,DSTR (8 ,12 ) |SLEW ), +NPCM7XX_PINCFG (184 , spi3,MFSEL4 ,16 , none,NONE ,0 , none,NONE ,0 ,DSTR (8 ,12 ) |SLEW |GPO ), +NPCM7XX_PINCFG (185 , spi3,MFSEL4 ,16 , none,NONE ,0 , none,NONE ,0 ,DSTR (8 ,12 ) |SLEW |GPO ), +NPCM7XX_PINCFG (186 , spi3,MFSEL4 ,16 , none,NONE ,0 , none,NONE ,0 ,DSTR (8 ,12 )), +NPCM7XX_PINCFG (187 , spi3cs1,MFSEL4 ,17 , none,NONE ,0 , none,NONE ,0 ,DSTR (8 ,12 )), +NPCM7XX_PINCFG (188 , spi3quad,MFSEL4 ,20 , spi3cs2,MFSEL4 ,18 , none,NONE ,0 ,DSTR (8 ,12 ) |SLEW ), +NPCM7XX_PINCFG (189 , spi3quad,MFSEL4 ,20 , spi3cs3,MFSEL4 ,19 , none,NONE ,0 ,DSTR (8 ,12 ) |SLEW ), +NPCM7XX_PINCFG (190 , gpio,FLOCKR1 ,20 , nprd_smi,NONE ,0 , none,NONE ,0 ,DSTR (2 ,4 )), +NPCM7XX_PINCFG (191 , none,NONE ,0 , none,NONE ,0 , none,NONE ,0 ,DSTR (8 ,12 )),/* XX */ -NPCM7XX_PINCFG (192 , none,NONE ,0 , none,NONE ,0 , none,NONE ,0 ,DS (8 ,12 )),/* XX */ +NPCM7XX_PINCFG (192 , none,NONE ,0 , none,NONE ,0 , none,NONE ,0 ,DSTR (8 ,12 )),/* XX */ NPCM7XX_PINCFG (193 , r1,MFSEL3 ,9 , none,NONE ,0 , none,NONE ,0 ,0 ),NPCM7XX_PINCFG (194 , smb0b,I2CSEGSEL ,0 , none,NONE ,0 , none,NONE ,0 ,0 ), NPCM7XX_PINCFG(195, smb0b, I2CSEGSEL, 0, none, NONE, 0, none, NONE, 0, 0),
@@ -1130,11 +1130,11 @@ static const struct npcm7xx_pincfg pincfNPCM7XX_PINCFG (200 , r2,MFSEL1 ,14 , none,NONE ,0 , none,NONE ,0 ,0 ),NPCM7XX_PINCFG (201 , r1,MFSEL3 ,9 , none,NONE ,0 , none,NONE ,0 ,0 ),NPCM7XX_PINCFG (202 , smb0c,I2CSEGSEL ,1 , none,NONE ,0 , none,NONE ,0 ,0 ), -NPCM7XX_PINCFG (203 , faninx,MFSEL3 ,3 , none,NONE ,0 , none,NONE ,0 ,DS (8 ,12 )), +NPCM7XX_PINCFG (203 , faninx,MFSEL3 ,3 , none,NONE ,0 , none,NONE ,0 ,DSTR (8 ,12 )),NPCM7XX_PINCFG (204 , ddc,NONE ,0 , gpio,MFSEL3 ,22 , none,NONE ,0 ,SLEW ),NPCM7XX_PINCFG (205 , ddc,NONE ,0 , gpio,MFSEL3 ,22 , none,NONE ,0 ,SLEW ), -NPCM7XX_PINCFG (206 , ddc,NONE ,0 , gpio,MFSEL3 ,22 , none,NONE ,0 ,DS (4 ,8 )), -NPCM7XX_PINCFG (207 , ddc,NONE ,0 , gpio,MFSEL3 ,22 , none,NONE ,0 ,DS (4 ,8 )), +NPCM7XX_PINCFG (206 , ddc,NONE ,0 , gpio,MFSEL3 ,22 , none,NONE ,0 ,DSTR (4 ,8 )), +NPCM7XX_PINCFG (207 , ddc,NONE ,0 , gpio,MFSEL3 ,22 , none,NONE ,0 ,DSTR (4 ,8 )),NPCM7XX_PINCFG (208 , rg2,MFSEL4 ,24 , ddr,MFSEL3 ,26 , none,NONE ,0 ,0 ),NPCM7XX_PINCFG (209 , rg2,MFSEL4 ,24 , ddr,MFSEL3 ,26 , none,NONE ,0 ,0 ), NPCM7XX_PINCFG(210, rg2, MFSEL4, 24, ddr, MFSEL3, 26, none, NONE, 0, 0),
@@ -1146,20 +1146,20 @@ static const struct npcm7xx_pincfg pincfNPCM7XX_PINCFG (216 , rg2mdio,MFSEL4 ,23 , ddr,MFSEL3 ,26 , none,NONE ,0 ,0 ),NPCM7XX_PINCFG (217 , rg2mdio,MFSEL4 ,23 , ddr,MFSEL3 ,26 , none,NONE ,0 ,0 ),NPCM7XX_PINCFG (218 , wdog1,MFSEL3 ,19 , none,NONE ,0 , none,NONE ,0 ,0 ), -NPCM7XX_PINCFG (219 , wdog2,MFSEL3 ,20 , none,NONE ,0 , none,NONE ,0 ,DS (4 ,8 )), +NPCM7XX_PINCFG (219 , wdog2,MFSEL3 ,20 , none,NONE ,0 , none,NONE ,0 ,DSTR (4 ,8 )),NPCM7XX_PINCFG (220 , smb12,MFSEL3 ,5 , none,NONE ,0 , none,NONE ,0 ,0 ),NPCM7XX_PINCFG (221 , smb12,MFSEL3 ,5 , none,NONE ,0 , none,NONE ,0 ,0 ),NPCM7XX_PINCFG (222 , smb13,MFSEL3 ,6 , none,NONE ,0 , none,NONE ,0 ,0 ),NPCM7XX_PINCFG (223 , smb13,MFSEL3 ,6 , none,NONE ,0 , none,NONE ,0 ,0 ),NPCM7XX_PINCFG (224 , spix,MFSEL4 ,27 , none,NONE ,0 , none,NONE ,0 ,SLEW ), -NPCM7XX_PINCFG (225 , spix,MFSEL4 ,27 , none,NONE ,0 , none,NONE ,0 ,DS (8 ,12 ) |SLEW |GPO ), -NPCM7XX_PINCFG (226 , spix,MFSEL4 ,27 , none,NONE ,0 , none,NONE ,0 ,DS (8 ,12 ) |SLEW |GPO ), -NPCM7XX_PINCFG (227 , spix,MFSEL4 ,27 , none,NONE ,0 , none,NONE ,0 ,DS (8 ,12 ) |SLEW ), -NPCM7XX_PINCFG (228 , spixcs1,MFSEL4 ,28 , none,NONE ,0 , none,NONE ,0 ,DS (8 ,12 ) |SLEW ), -NPCM7XX_PINCFG (229 , spix,MFSEL4 ,27 , none,NONE ,0 , none,NONE ,0 ,DS (8 ,12 ) |SLEW ), -NPCM7XX_PINCFG (230 , spix,MFSEL4 ,27 , none,NONE ,0 , none,NONE ,0 ,DS (8 ,12 ) |SLEW ), -NPCM7XX_PINCFG (231 , clkreq,MFSEL4 ,9 , none,NONE ,0 , none,NONE ,0 ,DS (8 ,12 )), +NPCM7XX_PINCFG (225 , spix,MFSEL4 ,27 , none,NONE ,0 , none,NONE ,0 ,DSTR (8 ,12 ) |SLEW |GPO ), +NPCM7XX_PINCFG (226 , spix,MFSEL4 ,27 , none,NONE ,0 , none,NONE ,0 ,DSTR (8 ,12 ) |SLEW |GPO ), +NPCM7XX_PINCFG (227 , spix,MFSEL4 ,27 , none,NONE ,0 , none,NONE ,0 ,DSTR (8 ,12 ) |SLEW ), +NPCM7XX_PINCFG (228 , spixcs1,MFSEL4 ,28 , none,NONE ,0 , none,NONE ,0 ,DSTR (8 ,12 ) |SLEW ), +NPCM7XX_PINCFG (229 , spix,MFSEL4 ,27 , none,NONE ,0 , none,NONE ,0 ,DSTR (8 ,12 ) |SLEW ), +NPCM7XX_PINCFG (230 , spix,MFSEL4 ,27 , none,NONE ,0 , none,NONE ,0 ,DSTR (8 ,12 ) |SLEW ), +NPCM7XX_PINCFG (231 , clkreq,MFSEL4 ,9 , none,NONE ,0 , none,NONE ,0 ,DSTR (8 ,12 )),NPCM7XX_PINCFG (253 , none,NONE ,0 , none,NONE ,0 , none,NONE ,0 ,GPI ),/* SDHC1 power */ NPCM7XX_PINCFG (254 , none,NONE ,0 , none,NONE ,0 , none,NONE ,0 ,GPI ),/* SDHC2 power */ NPCM7XX_PINCFG(255, none, NONE, 0, none, NONE, 0, none, NONE, 0, GPI), /* DACOSEL */
Greg Kroah-Hartman
maintainerPATCH 563/599 pinctrl: nuvoton: npcm7xx: Use %zu printk format for ARRAY_SIZE()
In reply to Greg Kroah-HartmanFrom: Jonathan Neuschäfer <[email protected]>
commit 9d0f18bca3b557ae5d2128661ac06d33b3f45c0a upstream.
When compile-testing on 64-bit architectures, GCC complains about the mismatch of types between the %d format specifier and value returned by ARRAY_LENGTH(). Use %zu, which is correct everywhere.
--- drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c +1 -1
@@ -1560,7 +1560,7 @@ static int npcm7xx_get_groups_count(stru {struct npcm7xx_pinctrl *npcm =pinctrl_dev_get_drvdata (pctldev); -dev_dbg (npcm->dev,"group size: %d\n" ,ARRAY_SIZE (npcm7xx_groups)); +dev_dbg (npcm->dev,"group size: %zu\n" ,ARRAY_SIZE (npcm7xx_groups));return ARRAY_SIZE (npcm7xx_groups); }
Greg Kroah-Hartman
maintainerPATCH 564/599 ASoC: mediatek: mt6358: add missing EXPORT_SYMBOLs
In reply to Greg Kroah-HartmanFrom: Jiaxin Yu <[email protected]>
commit a7663c89f4193dbf717572e46e5a3251940dbdc8 upstream.
Fixes the following build errors when mt6358 is configured as module:
Quoted 4 lines
Quoted 4 lines
ERROR: modpost: "
mt6358_set_mtkaif_protocol" [sound/soc/mediatek/mt8186/mt8186-mt6366-rt1019-rt5682s.ko] undefined!
ERROR: modpost: "mt6358_set_mtkaif_protocol" [sound/soc/mediatek/mt8186/mt8186-mt6366-da7219-max98357.ko] undefined!
--- sound/soc/codecs/mt6358.c | 4 ++++ 1 file changed, 4 insertions(+)
sound/soc/codecs/mt6358.c +4 -0
@@ -107,6 +107,7 @@ int mt6358_set_mtkaif_protocol(struct sn priv->mtkaif_protocol = mtkaif_protocol;return 0 ; } +EXPORT_SYMBOL_GPL (mt6358_set_mtkaif_protocol);static void playback_gpio_set (struct mt6358_priv *priv) {
@@ -273,6 +274,7 @@ int mt6358_mtkaif_calibration_enable(str 1 << RG_AUD_PAD_TOP_DAT_MISO_LOOPBACK_SFT);return 0 ; } +EXPORT_SYMBOL_GPL (mt6358_mtkaif_calibration_enable);int mt6358_mtkaif_calibration_disable (struct snd_soc_component *cmpnt) {
@@ -296,6 +298,7 @@ int mt6358_mtkaif_calibration_disable(stcapture_gpio_reset (priv);return 0 ; } +EXPORT_SYMBOL_GPL (mt6358_mtkaif_calibration_disable);int mt6358_set_mtkaif_calibration_phase (struct snd_soc_component *cmpnt,int phase_1,int phase_2)
@@ -310,6 +313,7 @@ int mt6358_set_mtkaif_calibration_phase( phase_2 << RG_AUD_PAD_TOP_PHASE_MODE2_SFT);return 0 ; } +EXPORT_SYMBOL_GPL (mt6358_set_mtkaif_calibration_phase);/* dl pga gain */ enum {
Greg Kroah-Hartman
maintainerPATCH 565/599 ubi: Fix race condition between ctrl_cdev_ioctl and ubi_cdev_ioctl
In reply to Greg Kroah-HartmanFrom: Baokun Li <[email protected]>
commit 3cbf0e392f173ba0ce425968c8374a6aa3e90f2e upstream.
Hulk Robot reported a KASAN report about use-after-free:
==================================================================
BUG: KASAN: use-after-free in __list_del_entry_valid+0x13d/0x160 Read of size 8 at addr ffff888035e37d98 by task ubiattach/1385 [...] Call Trace: klist_dec_and_del+0xa7/0x4a0 klist_put+0xc7/0x1a0 device_del+0x4d4/0xed0 cdev_device_del+0x1a/0x80 ubi_attach_mtd_dev+0x2951/0x34b0 [ubi] ctrl_cdev_ioctl+0x286/0x2f0 [ubi] Allocated by task 1414: device_add+0x60a/0x18b0 cdev_device_add+0x103/0x170 ubi_create_volume+0x1118/0x1a10 [ubi] ubi_cdev_ioctl+0xb7f/0x1ba0 [ubi] Freed by task 1385: cdev_device_del+0x1a/0x80 ubi_remove_volume+0x438/0x6c0 [ubi] ubi_cdev_ioctl+0xbf4/0x1ba0 [ubi] [...] ==================================================================
The lock held by ctrl_cdev_ioctl is ubi_devices_mutex, but the lock held by ubi_cdev_ioctl is ubi->device_mutex. Therefore, the two locks can be concurrent.
ctrl_cdev_ioctl contains two operations: ubi_attach and ubi_detach. ubi_detach is bug-free because it uses reference counting to prevent concurrency. However, uif_init and uif_close in ubi_attach may race with ubi_cdev_ioctl.
uif_init will race with ubi_cdev_ioctl as in the following stack.
cpu1 cpu2 cpu3
_______________________|________________________|______________________ ctrl_cdev_ioctl
ubi_attach_mtd_dev
uif_init
ubi_cdev_ioctl
ubi_create_volume
cdev_device_add
ubi_add_volume
// sysfs exist
kill_volumes
ubi_cdev_ioctl
ubi_remove_volume
cdev_device_del
// first free
ubi_free_volume
cdev_del
// double free cdev_device_del
And uif_close will race with ubi_cdev_ioctl as in the following stack.
cpu1 cpu2 cpu3
_______________________|________________________|______________________ ctrl_cdev_ioctl
ubi_attach_mtd_dev
uif_init
ubi_cdev_ioctl
ubi_create_volume
cdev_device_add
ubi_debugfs_init_dev
//error goto out_uif;
uif_close
kill_volumes
ubi_cdev_ioctl
ubi_remove_volume
cdev_device_del
// first free
ubi_free_volume
// double freeThe cause of this problem is that commit 714fb87e8bc0 make device "available" before it becomes accessible via sysfs. Therefore, we roll back the modification. We will fix the race condition between ubi device creation and udev by removing ubi_get_device in vol_attribute_show and dev_attribute_show.This avoids accessing uninitialized ubi_devices[ubi_num].
ubi_get_device is used to prevent devices from being deleted during sysfs execution. However, now kernfs ensures that devices will not be deleted before all reference counting are released. The key process is shown in the following stack.
device_del
device_remove_attrs
device_remove_groups
sysfs_remove_groups
sysfs_remove_group
remove_files
kernfs_remove_by_name
kernfs_remove_by_name_ns
__kernfs_remove
kernfs_drain
--- drivers/mtd/ubi/build.c | 9 +-------- drivers/mtd/ubi/vmt.c | 8 +------- 2 files changed, 2 insertions(+), 15 deletions(-)
drivers/mtd/ubi/build.c +1 -8
@@ -350,9 +350,6 @@ static ssize_t dev_attribute_show(struct* we still can use 'ubi->ubi_num'. */ ubi = container_of(dev, struct ubi_device, dev); - ubi =ubi_get_device (ubi->ubi_num); -if (!ubi) -return -ENODEV ;if (attr == &dev_eraseblock_size) ret =sprintf (buf,"%d\n" , ubi->leb_size);
@@ -381,7 +378,6 @@ static ssize_t dev_attribute_show(structelse ret = -EINVAL ; -ubi_put_device (ubi);return ret; }
@@ -980,9 +976,6 @@ int ubi_attach_mtd_dev(struct mtd_info * goto out_detach; } -/* Make device "available" before it becomes accessible via sysfs */ - ubi_devices[ubi_num] = ubi; - err =uif_init (ubi);if (err) goto out_detach;
@@ -1027,6 +1020,7 @@ int ubi_attach_mtd_dev(struct mtd_info *wake_up_process (ubi->bgt_thread);spin_unlock (&ubi->wl_lock); + ubi_devices[ubi_num] = ubi;ubi_notify_all (ubi,UBI_VOLUME_ADDED ,NULL );return ubi_num;
@@ -1035,7 +1029,6 @@ out_debugfs: out_uif:uif_close (ubi); out_detach: - ubi_devices[ubi_num] =NULL ;ubi_wl_close (ubi);ubi_free_all_volumes (ubi);vfree (ubi->vtbl);
drivers/mtd/ubi/vmt.c +1 -7
@@ -56,16 +56,11 @@ static ssize_t vol_attribute_show(struct {int ret; struct ubi_volume *vol = container_of(dev, struct ubi_volume, dev); -struct ubi_device *ubi; - - ubi =ubi_get_device (vol->ubi->ubi_num); -if (!ubi) -return -ENODEV ; +struct ubi_device *ubi = vol->ubi;spin_lock (&ubi->volumes_lock);if (!ubi->volumes[vol->vol_id]) {spin_unlock (&ubi->volumes_lock); -ubi_put_device (ubi);return -ENODEV ; }/* Take a reference to prevent volume removal */
@@ -103,7 +98,6 @@ static ssize_t vol_attribute_show(struct vol->ref_count -=1 ;ubi_assert (vol->ref_count >=0 );spin_unlock (&ubi->volumes_lock); -ubi_put_device (ubi);return ret; }
Greg Kroah-Hartman
maintainerPATCH 566/599 ARM: iop32x: offset IRQ numbers by 1
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
commit 9d67412f24cc3a2c05f35f7c856addb07a2960ce upstream.
iop32x is one of the last platforms to use IRQ 0, and this has apparently stopped working in a 2014 cleanup without anyone noticing. This interrupt is used for the DMA engine, so most likely this has not actually worked in the past 7 years, but it's also not essential for using this board.
I'm splitting out this change from my GENERIC_IRQ_MULTI_HANDLER conversion so it can be backported if anyone cares.
--- arch/arm/mach-iop32x/include/mach/entry-macro.S | 2 arch/arm/mach-iop32x/include/mach/irqs.h | 2 arch/arm/mach-iop32x/irq.c | 6 +- arch/arm/mach-iop32x/irqs.h | 60 ++++++++++++------------ 4 files changed, 37 insertions(+), 33 deletions(-)
arch/arm/mach-iop32x/include/mach/entry-macro.S +1 -1
@@ -20,7 +20,7 @@ mrc p6, 0, \irqstat, c8, c0, 0 @ Read IINTSRC cmp \irqstat, #0 clzne \irqnr, \irqstat - rsbne \irqnr, \irqnr, #31 + rsbne \irqnr, \irqnr, #32 .endm .macro arch_ret_to_user, tmp1, tmp2
arch/arm/mach-iop32x/include/mach/irqs.h +1 -1
@@ -9,6 +9,6 @@#ifndef __IRQS_H#define __IRQS_H -#define NR_IRQS 32 +#define NR_IRQS 33#endif
arch/arm/mach-iop32x/irq.c +3 -3
@@ -32,14 +32,14 @@ static void intstr_write(u32 val)static void iop32x_irq_mask (struct irq_data *d) { - iop32x_mask &= ~(1 << d->irq); + iop32x_mask &= ~(1 << (d->irq -1 ));intctl_write (iop32x_mask); }static void iop32x_irq_unmask (struct irq_data *d) { - iop32x_mask |=1 << d->irq; + iop32x_mask |=1 << (d->irq -1 );intctl_write (iop32x_mask); }
@@ -65,7 +65,7 @@ void __init iop32x_init_irq(void) machine_is_em7210()) *IOP3XX_PCIIRSR =0x0f ; -for (i =0 ; i <NR_IRQS ; i++) { +for (i =1 ; i <NR_IRQS ; i++) {irq_set_chip_and_handler (i, &ext_chip, handle_level_irq);irq_clear_status_flags (i,IRQ_NOREQUEST |IRQ_NOPROBE ); }
arch/arm/mach-iop32x/irqs.h +32 -28
68 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 567/599 io_uring: fix memory leak of uid in files registration
In reply to Greg Kroah-HartmanFrom: Pavel Begunkov <[email protected]>
commit c86d18f4aa93e0e66cda0e55827cd03eea6bc5f8 upstream.
When there are no files for __io_sqe_files_scm() to process in the range, it'll free everything and return. However, it forgets to put uid.
--- fs/io_uring.c | 1 + 1 file changed, 1 insertion(+)
fs/io_uring.c +1 -0
@@ -7350,6 +7350,7 @@ static int __io_sqe_files_scm(struct io_fput (fpl->fp[i]); }else {kfree_skb (skb); +free_uid (fpl->user);kfree (fpl); }
Greg Kroah-Hartman
maintainerPATCH 568/599 riscv module: remove (NOLOAD)
In reply to Greg Kroah-HartmanFrom: Fangrui Song <[email protected]>
commit 60210a3d86dc57ce4a76a366e7841dda746a33f7 upstream.
On ELF, (NOLOAD) sets the section type to SHT_NOBITS[1]. It is conceptually inappropriate for .plt, .got, and .got.plt sections which are always SHT_PROGBITS.
In GNU ld, if PLT entries are needed, .plt will be SHT_PROGBITS anyway and (NOLOAD) will be essentially ignored. In ld.lld, since
https://reviews.llvm.org/D118840 ("[ELF] Support (TYPE=<value>) to customize the output section type"), ld.lld will report a section type mismatch error (later changed to a warning). Just remove (NOLOAD) to fix the warning.
[1] https://lld.llvm.org/ELF/linker_script.html As of today, "The section should be marked as not loadable" on
https://sourceware.org/binutils/docs/ld/Output-Section-Type.html is outdated for ELF.
--- arch/riscv/include/asm/module.lds.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/riscv/include/asm/module.lds.h +3 -3
@@ -2,8 +2,8 @@/* Copyright (C) 2017 Andes Technology Corporation */ #ifdef CONFIG_MODULE_SECTIONS SECTIONS { - .plt (NOLOAD) : { BYTE(0) } - .got (NOLOAD) : { BYTE(0) } - .got.plt (NOLOAD) : { BYTE(0) } + .plt : { BYTE(0) } + .got : { BYTE(0) } + .got.plt : { BYTE(0) } } #endif
Greg Kroah-Hartman
maintainerPATCH 569/599 ACPI: CPPC: Avoid out of bounds access when parsing _CPC data
In reply to Greg Kroah-HartmanFrom: Rafael J. Wysocki <[email protected]>
commit 40d8abf364bcab23bc715a9221a3c8623956257b upstream.
If the NumEntries field in the _CPC return package is less than 2, do not attempt to access the "Revision" element of that package, because it may not be present then.
--- drivers/acpi/cppc_acpi.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/acpi/cppc_acpi.c +5 -0
@@ -719,6 +719,11 @@ int acpi_cppc_processor_probe(struct acp cpc_obj = &out_obj->package.elements[0 ];if (cpc_obj->type ==ACPI_TYPE_INTEGER ) { num_ent = cpc_obj->integer.value; +if (num_ent <=1 ) { +pr_debug ("Unexpected _CPC NumEntries value (%d) for CPU:%d\n" , + num_ent, pr->id); + goto out_free; + } }else {pr_debug ("Unexpected entry type(%d) for NumEntries\n" , cpc_obj->type);
Greg Kroah-Hartman
maintainerPATCH 570/599 platform/chrome: cros_ec_typec: Check for EC device
In reply to Greg Kroah-HartmanFrom: Prashant Malani <[email protected]>
commit ffebd90532728086007038986900426544e3df4e upstream.
The Type C ACPI device on older Chromebooks is not generated correctly (since their EC firmware doesn't support the new commands required). In such cases, the crafted ACPI device doesn't have an EC parent, and it is therefore not useful (it shouldn't be generated in the first place since the EC firmware doesn't support any of the Type C commands).
To handle devices which use these older firmware revisions, check for the parent EC device handle, and fail the probe if it's not found.
--- drivers/platform/chrome/cros_ec_typec.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/platform/chrome/cros_ec_typec.c +6 -0
@@ -712,7 +712,13 @@ static int cros_typec_probe(struct platfreturn -ENOMEM ; typec->dev = dev; + typec->ec =dev_get_drvdata (pdev->dev.parent); +if (!typec->ec) { +dev_err (dev,"couldn't find parent EC device\n" ); +return -ENODEV ; + } +platform_set_drvdata (pdev, typec); ret =cros_typec_get_cmd_version (typec);
Greg Kroah-Hartman
maintainerPATCH 571/599 can: isotp: restore accidentally removed MSG_PEEK feature
In reply to Greg Kroah-HartmanFrom: Oliver Hartkopp <[email protected]>
[ Upstream commit e382fea8ae54f5bb62869c6b69b33993d43adeca ]
In commit 42bf50a1795a ("can: isotp: support MSG_TRUNC flag when reading from socket") a new check for recvmsg flags has been introduced that only checked for the flags that are handled in isotp_recvmsg() itself.
This accidentally removed the MSG_PEEK feature flag which is processed later in the call chain in __skb_try_recv_from_queue().
Add MSG_PEEK to the set of valid flags to restore the feature.
--- net/can/isotp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/can/isotp.c +1 -1
@@ -1007,7 +1007,7 @@ static int isotp_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,int noblock = flags &MSG_DONTWAIT ;int ret =0 ; -if (flags & ~(MSG_DONTWAIT |MSG_TRUNC )) +if (flags & ~(MSG_DONTWAIT |MSG_TRUNC |MSG_PEEK ))return -EINVAL ;if (!so->bound)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 572/599 proc: bootconfig: Add null pointer check
In reply to Greg Kroah-HartmanFrom: Lv Ruyi <[email protected]>
commit bed5b60bf67ccd8957b8c0558fead30c4a3f5d3f upstream.
kzalloc is a memory allocation function which can return NULL when some internal memory errors happen. It is safer to add null pointer check.
--- fs/proc/bootconfig.c | 2 ++ 1 file changed, 2 insertions(+)
fs/proc/bootconfig.c +2 -0
@@ -32,6 +32,8 @@ static int __init copy_xbc_key_value_lisint ret =0 ; key =kzalloc (XBC_KEYLEN_MAX ,GFP_KERNEL ); +if (!key) +return -ENOMEM ;xbc_for_each_key_value (leaf, val) { ret =xbc_node_compose_key (leaf, key,XBC_KEYLEN_MAX );
Greg Kroah-Hartman
maintainerPATCH 573/599 staging: mt7621-dts: fix pinctrl-0 items to be size-1 items on ethernet
In reply to Greg Kroah-HartmanFrom: Arınç ÜNAL <[email protected]>
commit 25e4f5220efead592c83200241e098e757d37e1f upstream.
Fix pinctrl-0 items under the ethernet node to be size-1 items. Current notation would be used on specifications with non-zero cells.
--- drivers/staging/mt7621-dts/mt7621.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/mt7621-dts/mt7621.dtsi +1 -1
@@ -413,7 +413,7 @@ mediatek,ethsys = <ðsys>; pinctrl-names = "default"; - pinctrl-0 = <&rgmii1_pins &rgmii2_pins &mdio_pins>; + pinctrl-0 = <&mdio_pins>, <&rgmii1_pins>, <&rgmii2_pins>; gmac0: mac@0 { compatible = "mediatek,eth-mac";
Greg Kroah-Hartman
maintainerPATCH 574/599 ASoC: soc-compress: Change the check for codec_dai
In reply to Greg Kroah-HartmanFrom: Jiasheng Jiang <[email protected]>
commit ccb4214f7f2a8b75acf493f31128e464ee1a3536 upstream.
It should be better to reverse the check on codec_dai and returned early in order to be easier to understand.
--- sound/soc/soc-compress.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)
sound/soc/soc-compress.c +11 -8
@@ -766,16 +766,19 @@ int snd_soc_new_compress(struct snd_soc_return -EINVAL ; } -/* check client and interface hw capabilities */ -if (codec_dai) { -if (snd_soc_dai_stream_valid (codec_dai,SNDRV_PCM_STREAM_PLAYBACK ) && -snd_soc_dai_stream_valid (cpu_dai,SNDRV_PCM_STREAM_PLAYBACK )) - playback =1 ; -if (snd_soc_dai_stream_valid (codec_dai,SNDRV_PCM_STREAM_CAPTURE ) && -snd_soc_dai_stream_valid (cpu_dai,SNDRV_PCM_STREAM_CAPTURE )) - capture =1 ; +if (!codec_dai) { +dev_err (rtd->card->dev,"Missing codec\n" ); +return -EINVAL ; } +/* check client and interface hw capabilities */ +if (snd_soc_dai_stream_valid (codec_dai,SNDRV_PCM_STREAM_PLAYBACK ) && +snd_soc_dai_stream_valid (cpu_dai,SNDRV_PCM_STREAM_PLAYBACK )) + playback =1 ; +if (snd_soc_dai_stream_valid (codec_dai,SNDRV_PCM_STREAM_CAPTURE ) && +snd_soc_dai_stream_valid (cpu_dai,SNDRV_PCM_STREAM_CAPTURE )) + capture =1 ; +/* * Compress devices are unidirectional so only one of the directions * should be set, check for that (xor)
Greg Kroah-Hartman
maintainerPATCH 575/599 batman-adv: Check ptr for NULL before reducing its refcnt
In reply to Greg Kroah-HartmanFrom: Sven Eckelmann <[email protected]>
commit 6340dcbd619450c1bb55eb999e554e4f0e6dab0a upstream.
The commit b37a46683739 ("netdevice: add the case if dev is NULL") changed the way how the NULL check for net_devices have to be handled when trying to reduce its reference counter. Before this commit, it was the responsibility of the caller to check whether the object is NULL or not. But it was changed to behave more like kfree. Now the callee has to handle the NULL-case.
The batman-adv code was scanned via cocinelle for similar places. These were changed to use the paradigm
@@
identifier E, T, R, C;
identifier put;
@@
void put(struct T *E)
{
+ if (!E)
+ return;
kref_put(&E->C, R);
}Functions which were used in other sources files were moved to the header to allow the compiler to inline the NULL check and the kref_put call.
--- net/batman-adv/bridge_loop_avoidance.c | 6 ++ net/batman-adv/distributed-arp-table.c | 3 + net/batman-adv/gateway_client.c | 12 ---- net/batman-adv/gateway_client.h | 16 +++++ net/batman-adv/hard-interface.h | 3 + net/batman-adv/network-coding.c | 6 ++ net/batman-adv/originator.c | 72 ++---------------------- net/batman-adv/originator.h | 96 ++++++++++++++++++++++++++++++--- net/batman-adv/soft-interface.c | 15 ----- net/batman-adv/soft-interface.h | 16 +++++ net/batman-adv/tp_meter.c | 3 + net/batman-adv/translation-table.c | 22 +++---- net/batman-adv/translation-table.h | 18 +++++- net/batman-adv/tvlv.c | 6 ++ 14 files changed, 181 insertions(+), 113 deletions(-)
net/batman-adv/bridge_loop_avoidance.c +6 -0
@@ -164,6 +164,9 @@ static void batadv_backbone_gw_release(s*/ static void batadv_backbone_gw_put (struct batadv_bla_backbone_gw *backbone_gw) { +if (!backbone_gw) +return ; +kref_put (&backbone_gw->refcount, batadv_backbone_gw_release); }
@@ -199,6 +202,9 @@ static void batadv_claim_release(struct*/ static void batadv_claim_put (struct batadv_bla_claim *claim) { +if (!claim) +return ; +kref_put (&claim->refcount, batadv_claim_release); }
net/batman-adv/distributed-arp-table.c +3 -0
@@ -128,6 +128,9 @@ static void batadv_dat_entry_release(str*/ static void batadv_dat_entry_put (struct batadv_dat_entry *dat_entry) { +if (!dat_entry) +return ; +kref_put (&dat_entry->refcount, batadv_dat_entry_release); }
net/batman-adv/gateway_client.c +1 -11
@@ -60,7 +60,7 @@* after rcu grace period * @ref: kref pointer of the gw_node */ -static void batadv_gw_node_release (struct kref *ref) +void batadv_gw_node_release (struct kref *ref) {struct batadv_gw_node *gw_node;
@@ -71,16 +71,6 @@ static void batadv_gw_node_release(struc }/** -* batadv_gw_node_put() - decrement the gw_node refcounter and possibly release -* it -* @gw_node: gateway node to free -*/ -void batadv_gw_node_put (struct batadv_gw_node *gw_node) -{ -kref_put (&gw_node->refcount, batadv_gw_node_release); -} - -/** * batadv_gw_get_selected_gw_node() - Get currently selected gateway * @bat_priv: the bat priv with all the soft interface information *
net/batman-adv/gateway_client.h +15 -1
@@ -9,6 +9,7 @@#include "main.h" +#include <linux/kref.h> #include <linux/netlink.h> #include <linux/seq_file.h> #include <linux/skbuff.h>
@@ -28,7 +29,7 @@ void batadv_gw_node_update(struct batadvvoid batadv_gw_node_delete (struct batadv_priv *bat_priv,struct batadv_orig_node *orig_node);void batadv_gw_node_free (struct batadv_priv *bat_priv); -void batadv_gw_node_put (struct batadv_gw_node *gw_node); +void batadv_gw_node_release (struct kref *ref);struct batadv_gw_node *batadv_gw_get_selected_gw_node (struct batadv_priv *bat_priv);int batadv_gw_client_seq_print_text (struct seq_file *seq,void *offset);
@@ -40,4 +41,17 @@ batadv_gw_dhcp_recipient_get(struct sk_bstruct batadv_gw_node *batadv_gw_node_get (struct batadv_priv *bat_priv,struct batadv_orig_node *orig_node); +/** +* batadv_gw_node_put() - decrement the gw_node refcounter and possibly release +* it +* @gw_node: gateway node to free +*/ +static inline void batadv_gw_node_put (struct batadv_gw_node *gw_node) +{ +if (!gw_node) +return ; + +kref_put (&gw_node->refcount, batadv_gw_node_release); +} +#endif /* _NET_BATMAN_ADV_GATEWAY_CLIENT_H_ */
net/batman-adv/hard-interface.h +3 -0
@@ -113,6 +113,9 @@ int batadv_hardif_no_broadcast(struct ba*/ static inline void batadv_hardif_put (struct batadv_hard_iface *hard_iface) { +if (!hard_iface) +return ; +kref_put (&hard_iface->refcount, batadv_hardif_release); }
net/batman-adv/network-coding.c +6 -0
@@ -222,6 +222,9 @@ static void batadv_nc_node_release(struc*/ static void batadv_nc_node_put (struct batadv_nc_node *nc_node) { +if (!nc_node) +return ; +kref_put (&nc_node->refcount, batadv_nc_node_release); }
@@ -246,6 +249,9 @@ static void batadv_nc_path_release(struc*/ static void batadv_nc_path_put (struct batadv_nc_path *nc_path) { +if (!nc_path) +return ; +kref_put (&nc_path->refcount, batadv_nc_path_release); }
net/batman-adv/originator.c +6 -66
140 lines not on this page · raw message
net/batman-adv/originator.h +89 -7
139 lines not on this page · raw message
net/batman-adv/soft-interface.c +1 -14
@@ -512,7 +512,7 @@ out:* after rcu grace period * @ref: kref pointer of the vlan object */ -static void batadv_softif_vlan_release (struct kref *ref) +void batadv_softif_vlan_release (struct kref *ref) {struct batadv_softif_vlan *vlan;
@@ -526,19 +526,6 @@ static void batadv_softif_vlan_release(s }/** -* batadv_softif_vlan_put() - decrease the vlan object refcounter and -* possibly release it -* @vlan: the vlan object to release -*/ -void batadv_softif_vlan_put (struct batadv_softif_vlan *vlan) -{ -if (!vlan) -return ; - -kref_put (&vlan->refcount, batadv_softif_vlan_release); -} - -/** * batadv_softif_vlan_get() - get the vlan object for a specific vid * @bat_priv: the bat priv with all the soft interface information * @vid: the identifier of the vlan object to retrieve
net/batman-adv/soft-interface.h +15 -1
@@ -9,6 +9,7 @@#include "main.h" +#include <linux/kref.h> #include <linux/netdevice.h> #include <linux/skbuff.h> #include <linux/types.h>
@@ -24,8 +25,21 @@ void batadv_softif_destroy_sysfs(structbool batadv_softif_is_valid (const struct net_device *net_dev);extern struct rtnl_link_ops batadv_link_ops;int batadv_softif_create_vlan (struct batadv_priv *bat_priv,unsigned short vid); -void batadv_softif_vlan_put (struct batadv_softif_vlan *softif_vlan); +void batadv_softif_vlan_release (struct kref *ref);struct batadv_softif_vlan *batadv_softif_vlan_get (struct batadv_priv *bat_priv,unsigned short vid); +/** +* batadv_softif_vlan_put() - decrease the vlan object refcounter and +* possibly release it +* @vlan: the vlan object to release +*/ +static inline void batadv_softif_vlan_put (struct batadv_softif_vlan *vlan) +{ +if (!vlan) +return ; + +kref_put (&vlan->refcount, batadv_softif_vlan_release); +} +#endif /* _NET_BATMAN_ADV_SOFT_INTERFACE_H_ */
net/batman-adv/tp_meter.c +3 -0
@@ -357,6 +357,9 @@ static void batadv_tp_vars_release(struc*/ static void batadv_tp_vars_put (struct batadv_tp_vars *tp_vars) { +if (!tp_vars) +return ; +kref_put (&tp_vars->refcount, batadv_tp_vars_release); }
net/batman-adv/translation-table.c +10 -12
@@ -248,6 +248,9 @@ static void batadv_tt_local_entry_releasstatic void batadv_tt_local_entry_put (struct batadv_tt_local_entry *tt_local_entry) { +if (!tt_local_entry) +return ; +kref_put (&tt_local_entry->common.refcount, batadv_tt_local_entry_release); }
@@ -271,7 +274,7 @@ static void batadv_tt_global_entry_free_* queue for free after rcu grace period * @ref: kref pointer of the nc_node */ -static void batadv_tt_global_entry_release (struct kref *ref) +void batadv_tt_global_entry_release (struct kref *ref) {struct batadv_tt_global_entry *tt_global_entry;
@@ -284,17 +287,6 @@ static void batadv_tt_global_entry_relea }/** -* batadv_tt_global_entry_put() - decrement the tt_global_entry refcounter and -* possibly release it -* @tt_global_entry: tt_global_entry to be free'd -*/ -void batadv_tt_global_entry_put (struct batadv_tt_global_entry *tt_global_entry) -{ -kref_put (&tt_global_entry->common.refcount, - batadv_tt_global_entry_release); -} - -/** * batadv_tt_global_hash_count() - count the number of orig entries * @bat_priv: the bat priv with all the soft interface information * @addr: the mac address of the client to count entries for
@@ -453,6 +445,9 @@ static void batadv_tt_orig_list_entry_restatic void batadv_tt_orig_list_entry_put (struct batadv_tt_orig_list_entry *orig_entry) { +if (!orig_entry) +return ; +kref_put (&orig_entry->refcount, batadv_tt_orig_list_entry_release); }
@@ -2818,6 +2813,9 @@ static void batadv_tt_req_node_release(s*/ static void batadv_tt_req_node_put (struct batadv_tt_req_node *tt_req_node) { +if (!tt_req_node) +return ; +kref_put (&tt_req_node->refcount, batadv_tt_req_node_release); }
net/batman-adv/translation-table.h +17 -1
@@ -9,6 +9,7 @@#include "main.h" +#include <linux/kref.h> #include <linux/netdevice.h> #include <linux/netlink.h> #include <linux/seq_file.h>
@@ -31,7 +32,7 @@ void batadv_tt_global_del_orig(struct bastruct batadv_tt_global_entry *batadv_tt_global_hash_find (struct batadv_priv *bat_priv,const u8 *addr,unsigned short vid); -void batadv_tt_global_entry_put (struct batadv_tt_global_entry *tt_global_entry); +void batadv_tt_global_entry_release (struct kref *ref);int batadv_tt_global_hash_count (struct batadv_priv *bat_priv,const u8 *addr,unsigned short vid); struct batadv_orig_node *batadv_transtable_search(struct batadv_priv *bat_priv,
@@ -58,4 +59,19 @@ bool batadv_tt_global_is_isolated(structint batadv_tt_cache_init (void );void batadv_tt_cache_destroy (void ); +/** +* batadv_tt_global_entry_put() - decrement the tt_global_entry refcounter and +* possibly release it +* @tt_global_entry: tt_global_entry to be free'd +*/ +static inline void +batadv_tt_global_entry_put (struct batadv_tt_global_entry *tt_global_entry) +{ +if (!tt_global_entry) +return ; + +kref_put (&tt_global_entry->common.refcount, + batadv_tt_global_entry_release); +} +#endif /* _NET_BATMAN_ADV_TRANSLATION_TABLE_H_ */
net/batman-adv/tvlv.c +6 -0
@@ -50,6 +50,9 @@ static void batadv_tvlv_handler_release(*/ static void batadv_tvlv_handler_put (struct batadv_tvlv_handler *tvlv_handler) { +if (!tvlv_handler) +return ; +kref_put (&tvlv_handler->refcount, batadv_tvlv_handler_release); }
@@ -106,6 +109,9 @@ static void batadv_tvlv_container_releas*/ static void batadv_tvlv_container_put (struct batadv_tvlv_container *tvlv) { +if (!tvlv) +return ; +kref_put (&tvlv->refcount, batadv_tvlv_container_release); }
Greg Kroah-Hartman
maintainerPATCH 576/599 mm/mmap: return 1 from stack_guard_gap __setup() handler
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
commit e6d094936988910ce6e8197570f2753898830081 upstream.
__setup() handlers should return 1 if the command line option is handled and 0 if not (or maybe never return 0; it just pollutes init's environment). This prevents:
Unknown kernel command line parameters \ "BOOT_IMAGE=/boot/bzImage-517rc5 stack_guard_gap=100", will be \ passed to user space.
Run /sbin/init as init process
with arguments:
/sbin/init
with environment:
HOME=/
TERM=linux
BOOT_IMAGE=/boot/bzImage-517rc5
stack_guard_gap=100Return 1 to indicate that the boot option has been handled.
Note that there is no warning message if someone enters:
stack_guard_gap=anything_invalid
and 'val' and stack_guard_gap are both set to 0 due to the use of simple_strtoul(). This could be improved by using kstrtoxxx() and checking for an error.
It appears that having stack_guard_gap == 0 is valid (if unexpected) since using "stack_guard_gap=0" on the kernel command line does that.
--- mm/mmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/mmap.c +1 -1
@@ -2577,7 +2577,7 @@ static int __init cmdline_parse_stack_guif (!*endptr) stack_guard_gap = val <<PAGE_SHIFT ; -return 0 ; +return 1 ; }__setup ("stack_guard_gap=" , cmdline_parse_stack_guard_gap);
Greg Kroah-Hartman
maintainerPATCH 577/599 ARM: 9187/1: JIVE: fix return value of __setup handler
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
commit 8b2360c7157b462c4870d447d1e65d30ef31f9aa upstream.
__setup() handlers should return 1 to obsolete_checksetup() in init/main.c to indicate that the boot option has been handled. A return of 0 causes the boot option/value to be listed as an Unknown kernel parameter and added to init's (limited) argument or environment strings. Also, error return codes don't mean anything to obsolete_checksetup() -- only non-zero (usually 1) or zero. So return 1 from jive_mtdset().
--- arch/arm/mach-s3c/mach-jive.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm/mach-s3c/mach-jive.c +3 -3
@@ -236,11 +236,11 @@ static int __init jive_mtdset(char *optiunsigned long set;if (options ==NULL || options[0 ] =='\0' ) -return 0 ; +return 1 ;if (kstrtoul (options,10 , &set)) {printk (KERN_ERR "failed to parse mtdset=%s\n" , options); -return 0 ; +return 1 ; }switch (set) {
@@ -255,7 +255,7 @@ static int __init jive_mtdset(char *opti "using default.", set); } -return 0 ; +return 1 ; }/* parse the mtdset= option given to the kernel command line */
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Greg Kroah-Hartman
maintainerPATCH 578/599 mm/memcontrol: return 1 from cgroup.memory __setup() handler
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
commit 460a79e18842caca6fa0c415de4a3ac1e671ac50 upstream.
__setup() handlers should return 1 if the command line option is handled and 0 if not (or maybe never return 0; it just pollutes init's environment).
The only reason that this particular __setup handler does not pollute init's environment is that the setup string contains a '.', as in "cgroup.memory". This causes init/main.c::unknown_boottoption() to consider it to be an "Unused module parameter" and ignore it. (This is for parsing of loadable module parameters any time after kernel init.) Otherwise the string "cgroup.memory=whatever" would be added to init's environment strings.
Instead of relying on this '.' quirk, just return 1 to indicate that the boot option has been handled.
Note that there is no warning message if someone enters:
cgroup.memory=anything_invalid
--- mm/memcontrol.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/memcontrol.c +1 -1
@@ -7124,7 +7124,7 @@ static int __init cgroup_memory(char *s)if (!strcmp (token,"nokmem" )) cgroup_memory_nokmem = true; } -return 0 ; +return 1 ; }__setup ("cgroup.memory=" , cgroup_memory);
Greg Kroah-Hartman
maintainerPATCH 579/599 mm/usercopy: return 1 from hardened_usercopy __setup() handler
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
commit 05fe3c103f7e6b8b4fca8a7001dfc9ed4628085b upstream.
__setup() handlers should return 1 if the command line option is handled and 0 if not (or maybe never return 0; it just pollutes init's environment). This prevents:
Unknown kernel command line parameters \ "BOOT_IMAGE=/boot/bzImage-517rc5 hardened_usercopy=off", will be \ passed to user space.
Run /sbin/init as init process
with arguments:
/sbin/init
with environment:
HOME=/
TERM=linux
BOOT_IMAGE=/boot/bzImage-517rc5
hardened_usercopy=offor
hardened_usercopy=on
but when "hardened_usercopy=foo" is used, there is no Unknown kernel command line parameter.
Return 1 to indicate that the boot option has been handled. Print a warning if strtobool() returns an error on the option string, but do not mark this as in unknown command line option and do not cause init's environment to be polluted with this string.
--- mm/usercopy.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
mm/usercopy.c +4 -1
@@ -294,7 +294,10 @@ static bool enable_checks __initdata = tstatic int __init parse_hardened_usercopy (char *str) { -return strtobool (str, &enable_checks); +if (strtobool (str, &enable_checks)) +pr_warn ("Invalid option string for hardened_usercopy: '%s'\n" , + str); +return 1 ; }__setup ("hardened_usercopy=" , parse_hardened_usercopy);
Greg Kroah-Hartman
maintainerPATCH 580/599 bpf: Adjust BPF stack helper functions to accommodate skip > 0
In reply to Greg Kroah-HartmanFrom: Namhyung Kim <[email protected]>
commit ee2a098851bfbe8bcdd964c0121f4246f00ff41e upstream.
Let's say that the caller has storage for num_elem stack frames. Then, the BPF stack helper functions walk the stack for only num_elem frames. This means that if skip > 0, one keeps only 'num_elem - skip' frames.
This is because it sets init_nr in the perf_callchain_entry to the end of the buffer to save num_elem entries only. I believe it was because the perf callchain code unwound the stack frames until it reached the global max size (sysctl_perf_event_max_stack).
However it now has perf_callchain_entry_ctx.max_stack to limit the iteration locally. This simplifies the code to handle init_nr in the BPF callstack entries and removes the confusion with the perf_event's __PERF_SAMPLE_CALLCHAIN_EARLY which sets init_nr to 0.
Also change the comment on bpf_get_stack() in the header file to be more explicit what the return value means.
--- include/uapi/linux/bpf.h | 8 +++--- kernel/bpf/stackmap.c | 56 ++++++++++++++++++++--------------------------- 2 files changed, 28 insertions(+), 36 deletions(-)
include/uapi/linux/bpf.h +4 -4
@@ -2163,8 +2163,8 @@ union bpf_attr {* * # sysctl kernel.perf_event_max_stack=<new value> * Return -* A non-negative value equal to or less than *size* on success, -* or a negative error in case of failure. +* The non-negative copied *buf* length equal to or less than +* *size* on success, or a negative error in case of failure. * * long bpf_skb_load_bytes_relative(const void *skb, u32 offset, void *to, u32 len, u32 start_header) * Description
@@ -3448,8 +3448,8 @@ union bpf_attr {* * # sysctl kernel.perf_event_max_stack=<new value> * Return -* A non-negative value equal to or less than *size* on success, -* or a negative error in case of failure. +* The non-negative copied *buf* length equal to or less than +* *size* on success, or a negative error in case of failure. * * long bpf_load_hdr_opt(struct bpf_sock_ops *skops, void *searchby_res, u32 len, u64 flags) * Description
kernel/bpf/stackmap.c +24 -32
127 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 581/599 bpf: Fix comment for helper bpf_current_task_under_cgroup()
In reply to Greg Kroah-HartmanFrom: Hengqi Chen <[email protected]>
commit 58617014405ad5c9f94f464444f4972dabb71ca7 upstream.
Fix the descriptions of the return values of helper bpf_current_task_under_cgroup().
--- include/uapi/linux/bpf.h | 4 ++-- tools/include/uapi/linux/bpf.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
include/uapi/linux/bpf.h +2 -2
@@ -1490,8 +1490,8 @@ union bpf_attr {* Return * The return value depends on the result of the test, and can be: * -* * 0, if current task belongs to the cgroup2. -* * 1, if current task does not belong to the cgroup2. +* * 1, if current task belongs to the cgroup2. +* * 0, if current task does not belong to the cgroup2. * * A negative error code, if an error occurred. * * long bpf_skb_change_tail(struct sk_buff *skb, u32 len, u64 flags)
tools/include/uapi/linux/bpf.h +2 -2
@@ -1490,8 +1490,8 @@ union bpf_attr {* Return * The return value depends on the result of the test, and can be: * -* * 0, if current task belongs to the cgroup2. -* * 1, if current task does not belong to the cgroup2. +* * 1, if current task belongs to the cgroup2. +* * 0, if current task does not belong to the cgroup2. * * A negative error code, if an error occurred. * * long bpf_skb_change_tail(struct sk_buff *skb, u32 len, u64 flags)
Greg Kroah-Hartman
maintainerPATCH 582/599 dt-bindings: mtd: nand-controller: Fix the reg property description
In reply to Greg Kroah-HartmanFrom: Miquel Raynal <[email protected]>
commit 93f2ec9e401276fb4ea9903194a5bfcf175f9a2c upstream.
The reg property of a NAND device always references the chip-selects. The ready/busy lines are described in the nand-rb property. I believe this was a harmless copy/paste error during the conversion to yaml.
--- Documentation/devicetree/bindings/mtd/nand-controller.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/devicetree/bindings/mtd/nand-controller.yaml +1 -1
@@ -44,7 +44,7 @@ patternProperties: properties: reg: description: - Contains the native Ready/Busy IDs. + Contains the chip-select IDs. nand-ecc-mode: description:
Greg Kroah-Hartman
maintainerPATCH 583/599 dt-bindings: mtd: nand-controller: Fix a comment in the examples
In reply to Greg Kroah-HartmanFrom: Miquel Raynal <[email protected]>
commit 0e7f1b557974ce297e5e4c9d4245720fbb489886 upstream.
The controller properties should be in the controller 'parent' node, while properties in the children nodes are specific to the NAND *chip*. This error was already present during the yaml conversion.
--- Documentation/devicetree/bindings/mtd/nand-controller.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/devicetree/bindings/mtd/nand-controller.yaml +1 -1
@@ -174,6 +174,6 @@ examples: nand-ecc-mode = "soft"; nand-ecc-algo = "bch"; - /* controller specific properties */ + /* NAND chip specific properties */ }; };
Greg Kroah-Hartman
maintainerPATCH 584/599 dt-bindings: spi: mxic: The interrupt property is not mandatory
In reply to Greg Kroah-HartmanFrom: Miquel Raynal <[email protected]>
commit 90c204d3195a795f77f5bce767e311dd1c59ca17 upstream.
The interrupt property is not mandatory at all, this property should not be part of the required properties list, so move it into the optional properties list.
--- Documentation/devicetree/bindings/spi/spi-mxic.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/spi/spi-mxic.txt +3 -1
@@ -8,11 +8,13 @@ Required properties: - reg: should contain 2 entries, one for the registers and one for the direct mapping area - reg-names: should contain "regs" and "dirmap" -- interrupts: interrupt line connected to the SPI controller - clock-names: should contain "ps_clk", "send_clk" and "send_dly_clk" - clocks: should contain 3 entries for the "ps_clk", "send_clk" and "send_dly_clk" clocks +Optional properties: +- interrupts: interrupt line connected to the SPI controller + Example: spi@43c30000 {
Greg Kroah-Hartman
maintainerPATCH 585/599 ubi: fastmap: Return error code if memory allocation fails in add_aeb()
In reply to Greg Kroah-HartmanFrom: Zhihao Cheng <[email protected]>
commit c3c07fc25f37c157fde041b3a0c3dfcb1590cbce upstream.
Abort fastmap scanning and return error code if memory allocation fails in add_aeb(). Otherwise ubi will get wrong peb statistics information after scanning.
--- drivers/mtd/ubi/fastmap.c | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-)
drivers/mtd/ubi/fastmap.c +19 -9
@@ -468,7 +468,9 @@ static int scan_pool(struct ubi_device *if (err ==UBI_IO_FF_BITFLIPS ) scrub =1 ; -add_aeb (ai, free, pnum, ec, scrub); + ret =add_aeb (ai, free, pnum, ec, scrub); +if (ret) + goto out;continue ; }else if (err ==0 || err ==UBI_IO_BITFLIPS ) {dbg_bld ("Found non empty PEB:%i in pool" , pnum);
@@ -638,8 +640,10 @@ static int ubi_attach_fastmap(struct ubiif (fm_pos >= fm_size) goto fail_bad; -add_aeb (ai, &ai->free,be32_to_cpu (fmec->pnum), -be32_to_cpu (fmec->ec),0 ); + ret =add_aeb (ai, &ai->free,be32_to_cpu (fmec->pnum), +be32_to_cpu (fmec->ec),0 ); +if (ret) + goto fail; }/* read EC values from used list */
@@ -649,8 +653,10 @@ static int ubi_attach_fastmap(struct ubiif (fm_pos >= fm_size) goto fail_bad; -add_aeb (ai, &used,be32_to_cpu (fmec->pnum), -be32_to_cpu (fmec->ec),0 ); + ret =add_aeb (ai, &used,be32_to_cpu (fmec->pnum), +be32_to_cpu (fmec->ec),0 ); +if (ret) + goto fail; }/* read EC values from scrub list */
@@ -660,8 +666,10 @@ static int ubi_attach_fastmap(struct ubiif (fm_pos >= fm_size) goto fail_bad; -add_aeb (ai, &used,be32_to_cpu (fmec->pnum), -be32_to_cpu (fmec->ec),1 ); + ret =add_aeb (ai, &used,be32_to_cpu (fmec->pnum), +be32_to_cpu (fmec->ec),1 ); +if (ret) + goto fail; }/* read EC values from erase list */
@@ -671,8 +679,10 @@ static int ubi_attach_fastmap(struct ubiif (fm_pos >= fm_size) goto fail_bad; -add_aeb (ai, &ai->erase,be32_to_cpu (fmec->pnum), -be32_to_cpu (fmec->ec),1 ); + ret =add_aeb (ai, &ai->erase,be32_to_cpu (fmec->pnum), +be32_to_cpu (fmec->ec),1 ); +if (ret) + goto fail; } ai->mean_ec =div_u64 (ai->ec_sum, ai->ec_count);
Greg Kroah-Hartman
maintainerPATCH 586/599 ASoC: topology: Allow TLV control to be either read or write
In reply to Greg Kroah-HartmanFrom: Amadeusz Sławiński <[email protected]>
commit feb00b736af64875560f371fe7f58b0b7f239046 upstream.
There is no reason to force readwrite access on TLV controls. It can be either read, write or both. This is further evidenced in code where it performs following checks:
if ((k->access & SNDRV_CTL_ELEM_ACCESS_TLV_READ) && !sbe->get)
return -EINVAL;
if ((k->access & SNDRV_CTL_ELEM_ACCESS_TLV_WRITE) && !sbe->put)
return -EINVAL;--- sound/soc/soc-topology.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
sound/soc/soc-topology.c +2 -1
@@ -578,7 +578,8 @@ static int soc_tplg_kcontrol_bind_io(strif (le32_to_cpu (hdr->ops.info) ==SND_SOC_TPLG_CTL_BYTES && k->iface &SNDRV_CTL_ELEM_IFACE_MIXER - && k->access &SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE + && (k->access &SNDRV_CTL_ELEM_ACCESS_TLV_READ + || k->access &SNDRV_CTL_ELEM_ACCESS_TLV_WRITE ) && k->access &SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK ) {struct soc_bytes_ext *sbe;struct snd_soc_tplg_bytes_control *be;
Greg Kroah-Hartman
maintainerPATCH 587/599 ARM: dts: spear1340: Update serial node properties
In reply to Greg Kroah-HartmanFrom: Kuldeep Singh <[email protected]>
commit 583d6b0062640def86f3265aa1042ecb6672516e upstream.
Reorder dma and dma-names property for serial node to make it compliant with bindings.
--- arch/arm/boot/dts/spear1340.dtsi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm/boot/dts/spear1340.dtsi +3 -3
@@ -136,9 +136,9 @@ reg = <0xb4100000 0x1000>; interrupts = <0 105 0x4>; status = "disabled"; - dmas = <&dwdma0 12 0 1>, - <&dwdma0 13 1 0>; - dma-names = "tx", "rx"; + dmas = <&dwdma0 13 0 1>, + <&dwdma0 12 1 0>; + dma-names = "rx", "tx"; }; thermal@e07008c4 {
Greg Kroah-Hartman
maintainerPATCH 588/599 ARM: dts: spear13xx: Update SPI dma properties
In reply to Greg Kroah-HartmanFrom: Kuldeep Singh <[email protected]>
commit 31d3687d6017c7ce6061695361598d9cda70807a upstream.
Reorder dmas and dma-names property for spi controller node to make it compliant with bindings.
--- arch/arm/boot/dts/spear13xx.dtsi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm/boot/dts/spear13xx.dtsi +3 -3
@@ -284,9 +284,9 @@ #size-cells = <0>; interrupts = <0 31 0x4>; status = "disabled"; - dmas = <&dwdma0 4 0 0>, - <&dwdma0 5 0 0>; - dma-names = "tx", "rx"; + dmas = <&dwdma0 5 0 0>, + <&dwdma0 4 0 0>; + dma-names = "rx", "tx"; }; rtc@e0580000 {
Greg Kroah-Hartman
maintainerPATCH 589/599 um: Fix uml_mconsole stop/go
In reply to Greg Kroah-HartmanFrom: Anton Ivanov <[email protected]>
commit 1a3a6a2a035bb6c3a7ef4c788d8fd69a7b2d6284 upstream.
Moving to an EPOLL based IRQ controller broke uml_mconsole stop/go commands. This fixes it and restores stop/go functionality.
--- arch/um/drivers/mconsole_kern.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/um/drivers/mconsole_kern.c +2 -1
@@ -223,7 +223,7 @@ void mconsole_go(struct mc_request *req)void mconsole_stop (struct mc_request *req) { -deactivate_fd (req->originating_fd,MCONSOLE_IRQ ); +block_signals ();os_set_fd_block (req->originating_fd,1 );mconsole_reply (req,"stopped" ,0 ,0 );for (;;) {
@@ -246,6 +246,7 @@ void mconsole_stop(struct mc_request *re }os_set_fd_block (req->originating_fd,0 );mconsole_reply (req,"" ,0 ,0 ); +unblock_signals (); }static DEFINE_SPINLOCK (mc_devices_lock);
Greg Kroah-Hartman
maintainerPATCH 590/599 docs: sysctl/kernel: add missing bit to panic_print
In reply to Greg Kroah-HartmanFrom: Guilherme G. Piccoli <[email protected]>
commit a1ff1de00db21ecb956213f046b79741b64c6b65 upstream.
Patch series "Some improvements on panic_print".
This is a mix of a documentation fix with some additions to the "panic_print" syscall / parameter. The goal here is being able to collect all CPUs backtraces during a panic event and also to enable "panic_print" in a kdump event - details of the reasoning and design choices in the patches.
This patch (of 3):
Commit de6da1e8bcf0 ("panic: add an option to replay all the printk message in buffer") added a new bit to the sysctl/kernel parameter "panic_print", but the documentation was added only in kernel-parameters.txt, not in the sysctl guide.
Fix it here by adding bit 5 to sysctl admin-guide documentation.
--- Documentation/admin-guide/sysctl/kernel.rst | 1 + 1 file changed, 1 insertion(+)
Documentation/admin-guide/sysctl/kernel.rst +1 -0
@@ -787,6 +787,7 @@ bit 1 print system memory info bit 2 print timer info bit 3 print locks info if ``CONFIG_LOCKDEP`` is on bit 4 print ftrace buffer +bit 5 print all printk messages in buffer ===== ============================================ So for example to print tasks and memory info on panic, user can::
Greg Kroah-Hartman
maintainerPATCH 591/599 openvswitch: Fixed nd target mask field in the flow dump.
In reply to Greg Kroah-HartmanFrom: Martin Varghese <[email protected]>
commit f19c44452b58a84d95e209b847f5495d91c9983a upstream.
IPv6 nd target mask was not getting populated in flow dump.
In the function __ovs_nla_put_key the icmp code mask field was checked instead of icmp code key field to classify the flow as neighbour discovery.
ufid:bdfbe3e5-60c2-43b0-a5ff-dfcac1c37328, recirc_id(0),dp_hash(0/0), skb_priority(0/0),in_port(ovs-nm1),skb_mark(0/0),ct_state(0/0), ct_zone(0/0),ct_mark(0/0),ct_label(0/0), eth(src=00:00:00:00:00:00/00:00:00:00:00:00, dst=00:00:00:00:00:00/00:00:00:00:00:00),eth_type(0x86dd), ipv6(src=::/::,dst=::/::,label=0/0,proto=58,tclass=0/0,hlimit=0/0,frag=no), icmpv6(type=135,code=0),
nd(target=2001::2/::,
sll=00:00:00:00:00:00/00:00:00:00:00:00, tll=00:00:00:00:00:00/00:00:00:00:00:00),
packets:10, bytes:860, used:0.504s, dp:ovs, actions:ovs-nm2
--- net/openvswitch/flow_netlink.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/openvswitch/flow_netlink.c +2 -2
@@ -2201,8 +2201,8 @@ static int __ovs_nla_put_key(const struc icmpv6_key->icmpv6_type =ntohs (output->tp.src); icmpv6_key->icmpv6_code =ntohs (output->tp.dst); -if (icmpv6_key->icmpv6_type ==NDISC_NEIGHBOUR_SOLICITATION || - icmpv6_key->icmpv6_type ==NDISC_NEIGHBOUR_ADVERTISEMENT ) { +if (swkey->tp.src ==htons (NDISC_NEIGHBOUR_SOLICITATION ) || + swkey->tp.src ==htons (NDISC_NEIGHBOUR_ADVERTISEMENT )) {struct ovs_key_nd *nd_key; nla =nla_reserve (skb,OVS_KEY_ATTR_ND ,sizeof (*nd_key));
Greg Kroah-Hartman
maintainerPATCH 592/599 KVM: x86/mmu: do compare-and-exchange of gPTE via the user address
In reply to Greg Kroah-HartmanFrom: Paolo Bonzini <[email protected]>
commit 2a8859f373b0a86f0ece8ec8312607eacf12485d upstream.
FNAME(cmpxchg_gpte) is an inefficient mess. It is at least decent if it can go through get_user_pages_fast(), but if it cannot then it tries to use memremap(); that is not just terribly slow, it is also wrong because it assumes that the VM_PFNMAP VMA is contiguous.
The right way to do it would be to do the same thing as hva_to_pfn_remapped() does since commit add6a0cd1c5b ("KVM: MMU: try to fix up page faults before giving up", 2016-07-05), using follow_pte() and fixup_user_fault() to determine the correct address to use for memremap(). To do this, one could for example extract hva_to_pfn() for use outside virt/kvm/kvm_main.c. But really there is no reason to do that either, because there is already a perfectly valid address to do the cmpxchg() on, only it is a userspace address. That means doing user_access_begin()/user_access_end() and writing the code in assembly to handle exceptions correctly. Worse, the guest PTE can be 8-byte even on i686 so there is the extra complication of using cmpxchg8b to account for. But at least it is an efficient mess.
(Thanks to Linus for suggesting improvement on the inline assembly).
--- arch/x86/kvm/mmu/paging_tmpl.h | 77 +++++++++++++++++++---------------------- 1 file changed, 37 insertions(+), 40 deletions(-)
arch/x86/kvm/mmu/paging_tmpl.h +37 -40
@@ -34,9 +34,8 @@#define PT_HAVE_ACCESSED_DIRTY (mmu) true#ifdef CONFIG_X86_64 #define PT_MAX_FULL_LEVELS PT64_ROOT_MAX_LEVEL -#define CMPXCHG cmpxchg +#define CMPXCHG "cmpxchgq"#else -#define CMPXCHG cmpxchg64#define PT_MAX_FULL_LEVELS 2#endif #elif PTTYPE ==32
@@ -52,7 +51,7 @@#define PT_GUEST_DIRTY_SHIFT PT_DIRTY_SHIFT#define PT_GUEST_ACCESSED_SHIFT PT_ACCESSED_SHIFT#define PT_HAVE_ACCESSED_DIRTY (mmu) true -#define CMPXCHG cmpxchg +#define CMPXCHG "cmpxchgl"#elif PTTYPE ==PTTYPE_EPT #define pt_element_t u64#define guest_walker guest_walkerEPT
@@ -65,7 +64,9 @@#define PT_GUEST_DIRTY_SHIFT 9#define PT_GUEST_ACCESSED_SHIFT 8#define PT_HAVE_ACCESSED_DIRTY (mmu) ((mmu)->ept_ad) -#define CMPXCHG cmpxchg64 +#ifdef CONFIG_X86_64 +#define CMPXCHG "cmpxchgq" +#endif #define PT_MAX_FULL_LEVELS PT64_ROOT_MAX_LEVEL#else #error Invalid PTTYPE value
@@ -147,43 +148,39 @@ static int FNAME(cmpxchg_gpte)(struct kv pt_element_t __user *ptep_user, unsigned index, pt_element_t orig_pte, pt_element_t new_pte) { - int npages; -pt_element_t ret; -pt_element_t *table; -struct page *page; - - npages =get_user_pages_fast ((unsigned long )ptep_user,1 ,FOLL_WRITE , &page); -if (likely (npages ==1 )) { - table =kmap_atomic (page); - ret =CMPXCHG (&table[index], orig_pte, new_pte); -kunmap_atomic (table); - -kvm_release_page_dirty (page); - }else { -struct vm_area_struct *vma; -unsigned long vaddr = (unsigned long )ptep_user &PAGE_MASK ; -unsigned long pfn; -unsigned long paddr; - -mmap_read_lock (current->mm); - vma =find_vma_intersection (current->mm, vaddr, vaddr +PAGE_SIZE ); -if (!vma || !(vma->vm_flags &VM_PFNMAP )) { -mmap_read_unlock (current->mm); -return -EFAULT ; - } - pfn = ((vaddr - vma->vm_start) >>PAGE_SHIFT ) + vma->vm_pgoff; - paddr = pfn <<PAGE_SHIFT ; - table =memremap (paddr,PAGE_SIZE ,MEMREMAP_WB ); -if (!table) { -mmap_read_unlock (current->mm); -return -EFAULT ; - } - ret =CMPXCHG (&table[index], orig_pte, new_pte); -memunmap (table); -mmap_read_unlock (current->mm); - } + int r = -EFAULT; + +if (!user_access_begin (ptep_user,sizeof (pt_element_t))) +return -EFAULT ; + +#ifdef CMPXCHG + asmvolatile ("1:" LOCK_PREFIX CMPXCHG " %[new], %[ptr]\n" +"mov $0, %[r]\n" +"setnz %b[r]\n" +"2:" + _ASM_EXTABLE_UA(1b, 2b) + : [ptr] "+m" (*ptep_user), + [old] "+a" (orig_pte), + [r] "+q" (r) + : [new] "r" (new_pte) + : "memory"); +#else + asmvolatile ("1:" LOCK_PREFIX "cmpxchg8b %[ptr]\n" +"movl $0, %[r]\n" +"jz 2f\n" +"incl %[r]\n" +"2:" + _ASM_EXTABLE_UA(1b, 2b) + : [ptr] "+m" (*ptep_user), + [old] "+A" (orig_pte), + [r] "+rm" (r) + : [new_lo] "b" ((u32)new_pte), + [new_hi] "c" ((u32)(new_pte >> 32)) + : "memory"); +#endif -return (ret != orig_pte); +user_access_end (); +return r; } static bool FNAME(prefetch_invalid_gpte)(struct kvm_vcpu *vcpu,
Greg Kroah-Hartman
maintainerPATCH 593/599 can: m_can: m_can_tx_handler(): fix use after free of skb
In reply to Greg Kroah-HartmanFrom: Marc Kleine-Budde <[email protected]>
commit 2e8e79c416aae1de224c0f1860f2e3350fa171f8 upstream.
can_put_echo_skb() will clone skb then free the skb. Move the can_put_echo_skb() for the m_can version 3.0.x directly before the start of the xmit in hardware, similar to the 3.1.x branch.
--- drivers/net/can/m_can/m_can.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/can/m_can/m_can.c +3 -2
@@ -1491,8 +1491,6 @@ static netdev_tx_t m_can_tx_handler(struM_CAN_FIFO_DATA (i /4 ), *(u32 *)(cf->data + i)); -can_put_echo_skb (skb, dev,0 ); -if (cdev->can.ctrlmode &CAN_CTRLMODE_FD ) { cccr =m_can_read (cdev,M_CAN_CCCR ); cccr &= ~(CCCR_CMR_MASK <<CCCR_CMR_SHIFT );
@@ -1509,6 +1507,9 @@ static netdev_tx_t m_can_tx_handler(strum_can_write (cdev,M_CAN_CCCR , cccr); }m_can_write (cdev,M_CAN_TXBTIE ,0x1 ); + +can_put_echo_skb (skb, dev,0 ); +m_can_write (cdev,M_CAN_TXBAR ,0x1 );/* End of xmit function for version 3.0.x */ }else {
Greg Kroah-Hartman
maintainerPATCH 594/599 can: usb_8dev: usb_8dev_start_xmit(): fix double dev_kfree_skb() in error path
In reply to Greg Kroah-HartmanFrom: Hangyu Hua <[email protected]>
commit 3d3925ff6433f98992685a9679613a2cc97f3ce2 upstream.
There is no need to call dev_kfree_skb() when usb_submit_urb() fails because can_put_echo_skb() deletes original skb and can_free_echo_skb() deletes the cloned skb.
--- drivers/net/can/usb/usb_8dev.c | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-)
drivers/net/can/usb/usb_8dev.c +14 -16
@@ -670,9 +670,20 @@ static netdev_tx_t usb_8dev_start_xmit(satomic_inc (&priv->active_tx_urbs); err =usb_submit_urb (urb,GFP_ATOMIC ); -if (unlikely (err)) - goto failed; -else if (atomic_read (&priv->active_tx_urbs) >=MAX_TX_URBS ) +if (unlikely (err)) { +can_free_echo_skb (netdev, context->echo_index); + +usb_unanchor_urb (urb); +usb_free_coherent (priv->udev, size, buf, urb->transfer_dma); + +atomic_dec (&priv->active_tx_urbs); + +if (err == -ENODEV ) +netif_device_detach (netdev); +else +netdev_warn (netdev,"failed tx_urb %d\n" , err); + stats->tx_dropped++; + }else if (atomic_read (&priv->active_tx_urbs) >=MAX_TX_URBS )/* Slow down tx path */ netif_stop_queue (netdev);
@@ -691,19 +702,6 @@ nofreecontext:return NETDEV_TX_BUSY ; -failed: -can_free_echo_skb (netdev, context->echo_index); - -usb_unanchor_urb (urb); -usb_free_coherent (priv->udev, size, buf, urb->transfer_dma); - -atomic_dec (&priv->active_tx_urbs); - -if (err == -ENODEV ) -netif_device_detach (netdev); -else -netdev_warn (netdev,"failed tx_urb %d\n" , err); - nomembuf:usb_free_urb (urb);
Greg Kroah-Hartman
maintainerPATCH 595/599 coredump: Snapshot the vmas in do_coredump
In reply to Greg Kroah-HartmanFrom: Eric W. Biederman <[email protected]>
commit 95c5436a4883841588dae86fb0b9325f47ba5ad3 upstream.
Move the call of dump_vma_snapshot and kvfree(vma_meta) out of the individual coredump routines into do_coredump itself. This makes the code less error prone and easier to maintain.
Make the vma snapshot available to the coredump routines in struct coredump_params. This makes it easier to change and update what is captures in the vma snapshot and will be needed for fixing fill_file_notes.
--- fs/binfmt_elf.c | 20 +++++++------------- fs/binfmt_elf_fdpic.c | 18 ++++++------------ fs/coredump.c | 41 +++++++++++++++++++++++------------------ include/linux/binfmts.h | 3 +++ include/linux/coredump.h | 3 --- 5 files changed, 39 insertions(+), 46 deletions(-)
fs/binfmt_elf.c +7 -13
@@ -2166,8 +2166,7 @@ static void fill_extnum_info(struct elfhstatic int elf_core_dump (struct coredump_params *cprm) {int has_dumped =0 ; -int vma_count, segs, i; -size_t vma_data_size; +int segs, i;struct elfhdr elf;loff_t offset =0 , dataoff;struct elf_note_info info = { };
@@ -2175,16 +2174,12 @@ static int elf_core_dump(struct coredumpstruct elf_shdr *shdr4extnum =NULL ;Elf_Half e_phnum;elf_addr_t e_shoff; -struct core_vma_metadata *vma_meta; - -if (dump_vma_snapshot (cprm, &vma_count, &vma_meta, &vma_data_size)) -return 0 ;/* * The number of segs are recored into ELF header as 16bit value. * Please check DEFAULT_MAX_MAP_COUNT definition when you modify here. */ - segs = vma_count +elf_core_extra_phdrs (); + segs = cprm->vma_count +elf_core_extra_phdrs ();/* for notes section */ segs++;
@@ -2222,7 +2217,7 @@ static int elf_core_dump(struct coredump dataoff = offset =roundup (offset,ELF_EXEC_PAGESIZE ); - offset += vma_data_size; + offset += cprm->vma_data_size; offset +=elf_core_extra_data_size (); e_shoff = offset;
@@ -2242,8 +2237,8 @@ static int elf_core_dump(struct coredump goto end_coredump;/* Write program headers for segments dump */ -for (i =0 ; i < vma_count; i++) { -struct core_vma_metadata *meta = vma_meta + i; +for (i =0 ; i < cprm->vma_count; i++) { +struct core_vma_metadata *meta = cprm->vma_meta + i;struct elf_phdr phdr; phdr.p_type =PT_LOAD ;
@@ -2280,8 +2275,8 @@ static int elf_core_dump(struct coredumpif (!dump_skip (cprm, dataoff - cprm->pos)) goto end_coredump; -for (i =0 ; i < vma_count; i++) { -struct core_vma_metadata *meta = vma_meta + i; +for (i =0 ; i < cprm->vma_count; i++) { +struct core_vma_metadata *meta = cprm->vma_meta + i;if (!dump_user_range (cprm, meta->start, meta->dump_size)) goto end_coredump;
@@ -2299,7 +2294,6 @@ static int elf_core_dump(struct coredump end_coredump:free_note_info (&info);kfree (shdr4extnum); -kvfree (vma_meta);kfree (phdr4note);return has_dumped; }
fs/binfmt_elf_fdpic.c +6 -12
@@ -1479,7 +1479,7 @@ static bool elf_fdpic_dump_segments(strustatic int elf_fdpic_core_dump (struct coredump_params *cprm) {int has_dumped =0 ; -int vma_count, segs; +int segs;int i;struct elfhdr *elf =NULL ;loff_t offset =0 , dataoff;
@@ -1494,8 +1494,6 @@ static int elf_fdpic_core_dump(struct coelf_addr_t e_shoff;struct core_thread *ct;struct elf_thread_status *tmp; -struct core_vma_metadata *vma_meta =NULL ; -size_t vma_data_size;/* alloc memory for large data structures: too large to be on stack */ elf =kmalloc (sizeof (*elf),GFP_KERNEL );
@@ -1505,9 +1503,6 @@ static int elf_fdpic_core_dump(struct coif (!psinfo) goto end_coredump; -if (dump_vma_snapshot (cprm, &vma_count, &vma_meta, &vma_data_size)) - goto end_coredump; -for (ct = current->mm->core_state->dumper.next; ct; ct = ct->next) { tmp = elf_dump_thread_status(cprm->siginfo->si_signo,
@@ -1527,7 +1522,7 @@ static int elf_fdpic_core_dump(struct co tmp->next = thread_list; thread_list = tmp; - segs = vma_count +elf_core_extra_phdrs (); + segs = cprm->vma_count +elf_core_extra_phdrs ();/* for notes section */ segs++;
@@ -1572,7 +1567,7 @@ static int elf_fdpic_core_dump(struct co/* Page-align dumped data */ dataoff = offset =roundup (offset,ELF_EXEC_PAGESIZE ); - offset += vma_data_size; + offset += cprm->vma_data_size; offset +=elf_core_extra_data_size (); e_shoff = offset;
@@ -1592,8 +1587,8 @@ static int elf_fdpic_core_dump(struct co goto end_coredump;/* write program headers for segments dump */ -for (i =0 ; i < vma_count; i++) { -struct core_vma_metadata *meta = vma_meta + i; +for (i =0 ; i < cprm->vma_count; i++) { +struct core_vma_metadata *meta = cprm->vma_meta + i;struct elf_phdr phdr;size_t sz;
@@ -1643,7 +1638,7 @@ static int elf_fdpic_core_dump(struct coif (!dump_skip (cprm, dataoff - cprm->pos)) goto end_coredump; -if (!elf_fdpic_dump_segments (cprm, vma_meta, vma_count)) +if (!elf_fdpic_dump_segments (cprm, cprm->vma_meta, cprm->vma_count)) goto end_coredump;if (!elf_core_write_extra_data (cprm))
@@ -1667,7 +1662,6 @@ end_coredump: thread_list = thread_list->next;kfree (tmp); } -kvfree (vma_meta);kfree (phdr4note);kfree (elf);kfree (psinfo);
fs/coredump.c +23 -18
100 lines not on this page · raw message
include/linux/binfmts.h +3 -0
@@ -82,6 +82,9 @@ struct coredump_params {unsigned long mm_flags;loff_t written;loff_t pos; +int vma_count; +size_t vma_data_size; +struct core_vma_metadata *vma_meta; };/*
include/linux/coredump.h +0 -3
@@ -24,9 +24,6 @@ extern int dump_align(struct coredump_paextern void dump_truncate (struct coredump_params *cprm);int dump_user_range (struct coredump_params *cprm,unsigned long start,unsigned long len); -int dump_vma_snapshot (struct coredump_params *cprm,int *vma_count, -struct core_vma_metadata **vma_meta, -size_t *vma_data_size_ptr);#ifdef CONFIG_COREDUMP extern void do_coredump (const kernel_siginfo_t *siginfo);#else
Greg Kroah-Hartman
maintainerPATCH 596/599 coredump: Remove the WARN_ON in dump_vma_snapshot
In reply to Greg Kroah-HartmanFrom: Eric W. Biederman <[email protected]>
commit 49c1866348f364478a0c4d3dd13fd08bb82d3a5b upstream.
The condition is impossible and to the best of my knowledge has never triggered.
We are in deep trouble if that conditions happens and we walk past the end of our allocated array.
So delete the WARN_ON and the code that makes it look like the kernel can handle the case of walking past the end of it's vma_meta array.
--- fs/coredump.c | 6 ------ 1 file changed, 6 deletions(-)
fs/coredump.c +0 -6
@@ -1128,12 +1128,6 @@ static bool dump_vma_snapshot(struct cormmap_write_unlock (mm); -if (WARN_ON (i != cprm->vma_count)) { -kvfree (cprm->vma_meta); -return false; - } - -for (i =0 ; i < cprm->vma_count; i++) {struct core_vma_metadata *m = cprm->vma_meta + i;
Greg Kroah-Hartman
maintainerPATCH 597/599 coredump/elf: Pass coredump_params into fill_note_info
In reply to Greg Kroah-HartmanFrom: Eric W. Biederman <[email protected]>
commit 9ec7d3230717b4fe9b6c7afeb4811909c23fa1d7 upstream.
Instead of individually passing cprm->siginfo and cprm->regs into fill_note_info pass all of struct coredump_params.
This is preparation to allow fill_files_note to use the existing vma snapshot.
--- fs/binfmt_elf.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
fs/binfmt_elf.c +8 -8
@@ -1797,7 +1797,7 @@ static int fill_thread_core_info(structstatic int fill_note_info (struct elfhdr *elf,int phdrs,struct elf_note_info *info, -const kernel_siginfo_t *siginfo,struct pt_regs *regs) +struct coredump_params *cprm) {struct task_struct *dump_task = current;const struct user_regset_view *view =task_user_regset_view (dump_task);
@@ -1869,7 +1869,7 @@ static int fill_note_info(struct elfhdr* Now fill in each thread's information. */ for (t = info->thread; t !=NULL ; t = t->next) -if (!fill_thread_core_info (t, view, siginfo->si_signo, &info->size)) +if (!fill_thread_core_info (t, view, cprm->siginfo->si_signo, &info->size))return 0 ;/*
@@ -1878,7 +1878,7 @@ static int fill_note_info(struct elfhdrfill_psinfo (psinfo, dump_task->group_leader, dump_task->mm); info->size +=notesize (&info->psinfo); -fill_siginfo_note (&info->signote, &info->csigdata, siginfo); +fill_siginfo_note (&info->signote, &info->csigdata, cprm->siginfo); info->size +=notesize (&info->signote);fill_auxv_note (&info->auxv, current->mm);
@@ -2026,7 +2026,7 @@ static int elf_note_info_init(struct elfstatic int fill_note_info (struct elfhdr *elf,int phdrs,struct elf_note_info *info, -const kernel_siginfo_t *siginfo,struct pt_regs *regs) +struct coredump_params *cprm) {struct core_thread *ct;struct elf_thread_status *ets;
@@ -2069,7 +2069,7 @@ static int fill_note_info(struct elfhdrfill_note (info->notes +1 ,"CORE" ,NT_PRPSINFO ,sizeof (*info->psinfo), info->psinfo); -fill_siginfo_note (info->notes +2 , &info->csigdata, siginfo); +fill_siginfo_note (info->notes +2 , &info->csigdata, cprm->siginfo);fill_auxv_note (info->notes +3 , current->mm); info->numnote =4 ;
@@ -2079,8 +2079,8 @@ static int fill_note_info(struct elfhdr }/* Try to dump the FPU. */ - info->prstatus->pr_fpvalid =elf_core_copy_task_fpregs (current, regs, - info->fpu); + info->prstatus->pr_fpvalid = +elf_core_copy_task_fpregs (current, cprm->regs, info->fpu);if (info->prstatus->pr_fpvalid)fill_note (info->notes + info->numnote++,"CORE" ,NT_PRFPREG ,sizeof (*info->fpu), info->fpu);
@@ -2193,7 +2193,7 @@ static int elf_core_dump(struct coredump* Collect all the non-memory information about the process for the * notes. This also sets up the file header. */ -if (!fill_note_info (&elf, e_phnum, &info, cprm->siginfo, cprm->regs)) +if (!fill_note_info (&elf, e_phnum, &info, cprm)) goto end_coredump; has_dumped =1 ;
Greg Kroah-Hartman
maintainerPATCH 598/599 coredump: Use the vma snapshot in fill_files_note
In reply to Greg Kroah-HartmanFrom: Eric W. Biederman <[email protected]>
commit 390031c942116d4733310f0684beb8db19885fe6 upstream.
Matthew Wilcox reported that there is a missing mmap_lock in file_files_note that could possibly lead to a user after free.
Solve this by using the existing vma snapshot for consistency and to avoid the need to take the mmap_lock anywhere in the coredump code except for dump_vma_snapshot.
Update the dump_vma_snapshot to capture vm_pgoff and vm_file that are neeeded by fill_files_note.
Add free_vma_snapshot to free the captured values of vm_file.
--- fs/binfmt_elf.c | 24 ++++++++++++------------ fs/coredump.c | 22 +++++++++++++++++++++- include/linux/coredump.h | 2 ++ 3 files changed, 35 insertions(+), 13 deletions(-)
fs/binfmt_elf.c +12 -12
@@ -1613,17 +1613,16 @@ static void fill_siginfo_note(struct mem* long file_ofs * followed by COUNT filenames in ASCII: "FILE1" NUL "FILE2" NUL... */ -static int fill_files_note (struct memelfnote *note) +static int fill_files_note (struct memelfnote *note,struct coredump_params *cprm) { -struct mm_struct *mm = current->mm; -struct vm_area_struct *vma;unsigned count, size, names_ofs, remaining, n;user_long_t *data;user_long_t *start_end_ofs;char *name_base, *name_curpos; +int i;/* *Estimated* file count and total data size needed */ - count = mm->map_count; + count = cprm->vma_count;if (count >UINT_MAX /64 )return -EINVAL ; size = count *64 ;
@@ -1645,11 +1644,12 @@ static int fill_files_note(struct memelf name_base = name_curpos = ((char *)data) + names_ofs; remaining = size - names_ofs; count =0 ; -for (vma = mm->mmap; vma !=NULL ; vma = vma->vm_next) { +for (i =0 ; i < cprm->vma_count; i++) { +struct core_vma_metadata *m = &cprm->vma_meta[i];struct file *file;const char *filename; - file = vma->vm_file; + file = m->file;if (!file)continue ; filename =file_path (file, name_curpos, remaining);
@@ -1669,9 +1669,9 @@ static int fill_files_note(struct memelfmemmove (name_curpos, filename, n); name_curpos += n; - *start_end_ofs++ = vma->vm_start; - *start_end_ofs++ = vma->vm_end; - *start_end_ofs++ = vma->vm_pgoff; + *start_end_ofs++ = m->start; + *start_end_ofs++ = m->end; + *start_end_ofs++ = m->pgoff; count++; }
@@ -1682,7 +1682,7 @@ static int fill_files_note(struct memelf* Count usually is less than mm->map_count, * we need to move filenames down. */ - n = mm->map_count - count; + n = cprm->vma_count - count;if (n !=0 ) {unsigned shift_bytes = n *3 *sizeof (data[0 ]); memmove(name_base - shift_bytes, name_base,
@@ -1884,7 +1884,7 @@ static int fill_note_info(struct elfhdrfill_auxv_note (&info->auxv, current->mm); info->size +=notesize (&info->auxv); -if (fill_files_note (&info->files) ==0 ) +if (fill_files_note (&info->files, cprm) ==0 ) info->size +=notesize (&info->files);return 1 ;
@@ -2073,7 +2073,7 @@ static int fill_note_info(struct elfhdrfill_auxv_note (info->notes +3 , current->mm); info->numnote =4 ; -if (fill_files_note (info->notes + info->numnote) ==0 ) { +if (fill_files_note (info->notes + info->numnote, cprm) ==0 ) { info->notes_files = info->notes + info->numnote; info->numnote++; }
fs/coredump.c +21 -1
@@ -54,6 +54,7 @@#include <trace/events/sched.h> static bool dump_vma_snapshot (struct coredump_params *cprm); +static void free_vma_snapshot (struct coredump_params *cprm);int core_uses_pid;unsigned int core_pipe_limit;
@@ -816,7 +817,7 @@ void do_coredump(const kernel_siginfo_tfile_start_write (cprm.file); core_dumped = binfmt->core_dump (&cprm);file_end_write (cprm.file); -kvfree (cprm.vma_meta); +free_vma_snapshot (&cprm); }if (ispipe && core_pipe_limit)wait_for_dump_helpers (cprm.file);
@@ -1088,6 +1089,20 @@ static struct vm_area_struct *next_vma(sreturn gate_vma; } +static void free_vma_snapshot (struct coredump_params *cprm) +{ +if (cprm->vma_meta) { +int i; +for (i =0 ; i < cprm->vma_count; i++) { +struct file *file = cprm->vma_meta[i].file; +if (file) +fput (file); + } +kvfree (cprm->vma_meta); + cprm->vma_meta =NULL ; + } +} +/* * Under the mmap_lock, take a snapshot of relevant information about the task's * VMAs.
@@ -1124,6 +1139,11 @@ static bool dump_vma_snapshot(struct cor m->end = vma->vm_end; m->flags = vma->vm_flags; m->dump_size =vma_dump_size (vma, cprm->mm_flags); + m->pgoff = vma->vm_pgoff; + + m->file = vma->vm_file; +if (m->file) +get_file (m->file); }mmap_write_unlock (mm);
include/linux/coredump.h +2 -0
@@ -11,6 +11,8 @@ struct core_vma_metadata {unsigned long start, end;unsigned long flags;unsigned long dump_size; +unsigned long pgoff; +struct file *file; };/*
Greg Kroah-Hartman
maintainerPATCH 599/599 arm64: Do not defer reserve_crashkernel() for platforms with no DMA memory zones
In reply to Greg Kroah-HartmanFrom: Vijay Balakrishna <[email protected]>
commit 031495635b4668f94e964e037ca93d0d38bfde58 upstream.
The following patches resulted in deferring crash kernel reservation to mem_init(), mainly aimed at platforms with DMA memory zones (no IOMMU), in particular Raspberry Pi 4.
commit 1a8e1cef7603 ("arm64: use both ZONE_DMA and ZONE_DMA32")
commit 8424ecdde7df ("arm64: mm: Set ZONE_DMA size based on devicetree's dma-ranges") commit 0a30c53573b0 ("arm64: mm: Move reserve_crashkernel() into mem_init()") commit 2687275a5843 ("arm64: Force NO_BLOCK_MAPPINGS if crashkernel reservation is required")
Above changes introduced boot slowdown due to linear map creation for all the memory banks with NO_BLOCK_MAPPINGS, see discussion[1]. The proposed changes restore crash kernel reservation to earlier behavior thus avoids slow boot, particularly for platforms with IOMMU (no DMA memory zones).
Tested changes to confirm no ~150ms boot slowdown on our SoC with IOMMU and 8GB memory. Also tested with ZONE_DMA and/or ZONE_DMA32 configs to confirm no regression to deferring scheme of crash kernel memory reservation. In both cases successfully collected kernel crash dump.
[1] https://lore.kernel.org/all/[email protected]/
--- arch/arm64/mm/init.c | 36 ++++++++++++++++++++++++++++++++---- arch/arm64/mm/mmu.c | 32 +++++++++++++++++++++++++++++++- 2 files changed, 63 insertions(+), 5 deletions(-)
arch/arm64/mm/init.c +32 -4
@@ -58,8 +58,34 @@ EXPORT_SYMBOL(memstart_addr);* unless restricted on specific platforms (e.g. 30-bit on Raspberry Pi 4). * In such case, ZONE_DMA32 covers the rest of the 32-bit addressable memory, * otherwise it is empty. +* +* Memory reservation for crash kernel either done early or deferred +* depending on DMA memory zones configs (ZONE_DMA) -- +* +* In absence of ZONE_DMA configs arm64_dma_phys_limit initialized +* here instead of max_zone_phys(). This lets early reservation of +* crash kernel memory which has a dependency on arm64_dma_phys_limit. +* Reserving memory early for crash kernel allows linear creation of block +* mappings (greater than page-granularity) for all the memory bank rangs. +* In this scheme a comparatively quicker boot is observed. +* +* If ZONE_DMA configs are defined, crash kernel memory reservation +* is delayed until DMA zone memory range size initilazation performed in +* zone_sizes_init(). The defer is necessary to steer clear of DMA zone +* memory range to avoid overlap allocation. So crash kernel memory boundaries +* are not known when mapping all bank memory ranges, which otherwise means +* not possible to exclude crash kernel range from creating block mappings +* so page-granularity mappings are created for the entire memory range. +* Hence a slightly slower boot is observed. +* +* Note: Page-granularity mapppings are necessary for crash kernel memory +* range for shrinking its size via /sys/kernel/kexec_crash_size interface. */ -phys_addr_t arm64_dma_phys_limit__ro_after_init ; +#if IS_ENABLED (CONFIG_ZONE_DMA ) ||IS_ENABLED (CONFIG_ZONE_DMA32 ) +phys_addr_t __ro_after_init arm64_dma_phys_limit; +#else +phys_addr_t __ro_after_init arm64_dma_phys_limit =PHYS_MASK +1 ; +#endif #ifdef CONFIG_KEXEC_CORE /*
@@ -210,8 +236,6 @@ static void __init zone_sizes_init(unsigif (!arm64_dma_phys_limit) arm64_dma_phys_limit = dma32_phys_limit;#endif -if (!arm64_dma_phys_limit) - arm64_dma_phys_limit =PHYS_MASK +1 ; max_zone_pfns[ZONE_NORMAL ] = max;free_area_init (max_zone_pfns);
@@ -407,6 +431,9 @@ void __init arm64_memblock_init(void)reserve_elfcorehdr (); +if (!IS_ENABLED (CONFIG_ZONE_DMA ) && !IS_ENABLED (CONFIG_ZONE_DMA32 )) +reserve_crashkernel (); + high_memory =__va (memblock_end_of_DRAM () -1 ) +1 ; }
@@ -451,7 +478,8 @@ void __init bootmem_init(void)* request_standard_resources() depends on crashkernel's memory being * reserved, so do it here. */ -reserve_crashkernel (); +if (IS_ENABLED (CONFIG_ZONE_DMA ) ||IS_ENABLED (CONFIG_ZONE_DMA32 )) +reserve_crashkernel ();memblock_dump_all (); }
arch/arm64/mm/mmu.c +31 -1
@@ -501,7 +501,7 @@ static void __init map_mem(pgd_t *pgdp)int flags =0 ;u64 i; -if (rodata_full || crash_mem_map ||debug_pagealloc_enabled ()) +if (rodata_full ||debug_pagealloc_enabled ()) flags =NO_BLOCK_MAPPINGS |NO_CONT_MAPPINGS ;/*
@@ -512,6 +512,17 @@ static void __init map_mem(pgd_t *pgdp)*/ memblock_mark_nomap (kernel_start, kernel_end - kernel_start); +#ifdef CONFIG_KEXEC_CORE +if (crash_mem_map) { +if (IS_ENABLED (CONFIG_ZONE_DMA ) || +IS_ENABLED (CONFIG_ZONE_DMA32 )) + flags |=NO_BLOCK_MAPPINGS |NO_CONT_MAPPINGS ; +else if (crashk_res.end) +memblock_mark_nomap (crashk_res.start, +resource_size (&crashk_res)); + } +#endif +/* map all the memory banks */ for_each_mem_range (i, &start, &end) {if (start >= end)
@@ -538,6 +549,25 @@ static void __init map_mem(pgd_t *pgdp)__map_memblock (pgdp, kernel_start, kernel_end,PAGE_KERNEL ,NO_CONT_MAPPINGS );memblock_clear_nomap (kernel_start, kernel_end - kernel_start); + +/* +* Use page-level mappings here so that we can shrink the region +* in page granularity and put back unused memory to buddy system +* through /sys/kernel/kexec_crash_size interface. +*/ +#ifdef CONFIG_KEXEC_CORE +if (crash_mem_map && + !IS_ENABLED (CONFIG_ZONE_DMA ) && !IS_ENABLED (CONFIG_ZONE_DMA32 )) { +if (crashk_res.end) { +__map_memblock (pgdp, crashk_res.start, + crashk_res.end +1 , +PAGE_KERNEL , +NO_BLOCK_MAPPINGS |NO_CONT_MAPPINGS ); +memblock_clear_nomap (crashk_res.start, +resource_size (&crashk_res)); + } + } +#endif }void mark_rodata_ro (void )
Quoted 7 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.10.110 release. There are 599 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 Thu, 07 Apr 2022 07:01:33 +0000. Anything received after that time might be too late.
5.10.110-rc1 compiled and booted with no errors or regressions on my x86_64 test system.
Cheers,
Slade
Hi!
Quoted 4 lines
This is the start of the stable review cycle for the 5.10.110 release. There are 599 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.
CIP testing did not find any problems here:
https://gitlab.com/cip-project/cip-testing/linux-stable-rc-ci/-/tree/linux-5.10.y
Best regards,
Pavel
Signature · 2 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.10.110 release. There are 599 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 Thu, 07 Apr 2022 07:01:33 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.10.110-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.10.y
and the diffstat can be found below.thanks,
greg k-h
On ARCH_BRCMSTB using 32-bit and 64-bit ARM kernels:
Signature · 1 line
Florian
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.10.110 release. There are 599 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 Thu, 07 Apr 2022 07:01:33 +0000. Anything received after that time might be too late.
Building um:defconfig ... failed
Building csky:defconfig ... failed
Building microblaze:mmu_defconfig ... failed
------
Error log:
fs/binfmt_elf.c: In function 'fill_note_info':fs/binfmt_elf.c:2050:45: error: 'siginfo' undeclared (first use in this function)
2050 | sz = elf_dump_thread_status(siginfo->si_signo, ets);
| ^~~~~~~fs/binfmt_elf.c:2050:45: note: each undeclared identifier is reported only once for each function it appears in fs/binfmt_elf.c:2056:53: error: 'regs' undeclared (first use in this function)
2056 | elf_core_copy_regs(&info->prstatus->pr_reg, regs);
| ^~~~
Build just started, so there are likely going to be more failures.
Guenter
Greg Kroah-Hartman
maintainerQuoted 25 lines · Guenter Roeck
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.10.110 release. There are 599 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 Thu, 07 Apr 2022 07:01:33 +0000. Anything received after that time might be too late.
Building um:defconfig ... failed
Building csky:defconfig ... failed
Building microblaze:mmu_defconfig ... failed
------
Error log:
fs/binfmt_elf.c: In function 'fill_note_info':fs/binfmt_elf.c:2050:45: error: 'siginfo' undeclared (first use in this function)
2050 | sz =elf_dump_thread_status(siginfo->si_signo, ets);
| ^~~~~~~fs/binfmt_elf.c:2050:45: note: each undeclared identifier is reported only once for each function it appears infs/binfmt_elf.c:2056:53: error: 'regs' undeclared (first use in this function)
2056 |elf_core_copy_regs(&info->prstatus->pr_reg, regs);
| ^~~~
Quoted 1 line
Build just started, so there are likely going to be more failures.
Thanks, I missed this in my backport. Now should be fixed up, I'll push out a -rc2 after this goes through some local build tests.
greg k-h
Hi Greg,
Quoted 7 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.10.110 release. There are 599 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 Thu, 07 Apr 2022 07:01:33 +0000. Anything received after that time might be too late.
My tests are still running, but it failed to boot on my test laptop. The trace is:
[ 2.194098] BUG: unable to handle page fault for address: ffffffffc0778fb5 [ 2.194791] #PF: supervisor write access in kernel mode [ 2.195166] #PF: error_code(0x0003) - permissions violation [ 2.195558] PGD 1bac14067 P4D 1bac14067 PUD 1bac16067 PMD 10aab8067 PTE 8000000110976061 [ 2.196124] Oops: 0003 [#1] SMP PTI [ 2.196374] CPU: 5 PID: 217 Comm: modprobe Not tainted 5.10.110-rc1+ #33 [ 2.196846] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014 [ 2.197712] RIP: 0010:number+0x1d6/0x340 [ 2.198025] Code: 83 c3 01 89 c8 44 29 d8 39 c2 7e ea 45 85 c9 0f 88 72 01 00 00 4d 63 c9 4a 8d 54 0c 18 4b 8d 44 0b 01 4c 39 db 76 06 0f b6 0a <41> 88 0b 49 83 c3 01 48 83 ea 01 49 39 c3 75 e8 83 ed 01 0f 88 3c [ 2.199654] RSP: 0018:ffffb61a4030fb08 EFLAGS: 00010206 [ 2.200126] RAX: ffffffffc0778fb7 RBX: ffffffffc0778fb8 RCX: 0000000000000031 [ 2.200630] RDX: ffffb61a4030fb21 RSI: 000000000000000a RDI: 0000000000000000 [ 2.201131] RBP: 00000000fffffffb R08: 0000000000ffff0a R09: 0000000000000001 [ 2.201635] R10: 3e2d434552202c29 R11: ffffffffc0778fb5 R12: 0000000000000020 [ 2.202140] R13: 0000000000000000 R14: 000000000000000a R15: 0000000000000000 [ 2.202641] FS: 00007fad7aa99580(0000) GS:ffff8c9537d40000(0000) knlGS:0000000000000000 [ 2.203212] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 2.203618] CR2: ffffffffc0778fb5 CR3: 000000011060c001 CR4: 0000000000370ee0 [ 2.204149] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 2.204682] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 2.205182] Call Trace: [ 2.205371] ? cpumask_next+0x17/0x20 [ 2.205636] ? kvm_smp_send_call_func_ipi+0x1e/0x60 [ 2.205986] vsnprintf+0x363/0x560 [ 2.206233] snprintf+0x49/0x60 [ 2.206461] eval_replace+0x46/0x80 [ 2.206712] trace_event_eval_update+0x263/0x360 [ 2.207057] trace_module_notify+0x44/0x50 [ 2.207352] blocking_notifier_call_chain_robust+0x64/0xd0 [ 2.207774] ? mutex_lock+0xe/0x30 [ 2.208020] load_module+0x209c/0x28e0 [ 2.208291] ? __do_sys_finit_module+0xb1/0x110 [ 2.208613] __do_sys_finit_module+0xb1/0x110 [ 2.208926] do_syscall_64+0x33/0x80 [ 2.209184] entry_SYSCALL_64_after_hwframe+0x44/0xa9 [ 2.209552] RIP: 0033:0x7fad7abb4f79 [ 2.209810] Code: 48 8d 3d da db 0d 00 0f 05 eb a5 66 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d c7 9e 0d 00 f7 d8 64 89 01 48 [ 2.211162] RSP: 002b:00007ffd607603c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000139 [ 2.212293] RAX: ffffffffffffffda RBX: 0000557e2325bc20 RCX: 00007fad7abb4f79 [ 2.213374] RDX: 0000000000000000 RSI: 0000557e2193c260 RDI: 0000000000000004 [ 2.214495] RBP: 0000000000040000 R08: 0000000000000000 R09: 0000557e2325c620 [ 2.215743] R10: 0000000000000004 R11: 0000000000000246 R12: 0000557e2193c260 [ 2.216994] R13: 0000000000000000 R14: 0000557e2325bcb0 R15: 0000557e2325bc20 [ 2.218219] Modules linked in: ext4(+) crc32c_generic crc16 mbcache jbd2 sd_mod bochs_drm t10_pi drm_vram_helper crc_t10dif drm_ttm_helper sr_mod crct10dif_generic cdrom ttm xhci_pci ata_generic drm_kms_helper xhci_hcd cec ata_piix libata rc_core usbcore crct10dif_pclmul crct10dif_common crc32_pclmul psmouse drm crc32c_intel usb_common i2c_piix4 e1000 scsi_mod floppy button [ 2.222206] CR2: ffffffffc0778fb5 [ 2.223103] ---[ end trace 036356107aad6aa1 ]---
Did a bisect and the bisect log is:
# bad: [45fdcc9dc72a44448666a2bcff4030a659e29e46] Linux 5.10.110-rc1
# good: [d9c5818a0bc09e4cc9fe663edb69e4d6cdae4f70] Linux 5.10.109
git bisect start 'HEAD' 'v5.10.109'
# good: [93a35ab24592dfddafdb9f184e9399aad6d88a18] drm/amd/display: Add affected crtcs to atomic state for dsc mst unplug git bisect good 93a35ab24592dfddafdb9f184e9399aad6d88a18
# good: [c8816508edf3558f597bd20a01403b060d690700] regulator: rpi-panel: Handle I2C errors/timing to the Atmel git bisect good c8816508edf3558f597bd20a01403b060d690700
# bad: [5e7fb97064ee7794db7ac938583c3d095980e55f] scsi: qla2xxx: Fix disk failure to rediscover
git bisect bad 5e7fb97064ee7794db7ac938583c3d095980e55f
# good: [3d65639a786b4587e64fb813a79a8f27b83dcaab] ARM: dts: qcom: fix gic_irq_domain_translate warnings for msm8960 git bisect good 3d65639a786b4587e64fb813a79a8f27b83dcaab
# good: [8bb857ae514a06d96a6ca81ff306acf5783d6cc6] media: Revert "media: em28xx: add missing em28xx_close_extension" git bisect good 8bb857ae514a06d96a6ca81ff306acf5783d6cc6
# bad: [0042f52f784f847927f1ff234b3f97dd97ad8e48] powerpc/lib/sstep: Fix build errors with newer binutils git bisect bad 0042f52f784f847927f1ff234b3f97dd97ad8e48
# bad: [690ee20444960ce5592465bce043ac5cd4ef8028] media: atomisp: fix bad usage at error handling logic git bisect bad 690ee20444960ce5592465bce043ac5cd4ef8028
# bad: [93fe2389e6fd4c545920f6bd013b36f9328b636e] tracing: Have TRACE_DEFINE_ENUM affect trace event types as well git bisect bad 93fe2389e6fd4c545920f6bd013b36f9328b636e
# good: [1fe212d441b683685c2900bd4353f53f7f608db9] media: hdpvr: initialize dev->worker at hdpvr_register_videodev git bisect good 1fe212d441b683685c2900bd4353f53f7f608db9
# first bad commit: [93fe2389e6fd4c545920f6bd013b36f9328b636e] tracing: Have TRACE_DEFINE_ENUM affect trace event types as well
And, reverting 93fe2389e6fd4c545920f6bd013b36f9328b636e on top of v5.10.110-rc1 fixed the problem.
--
Regards
Sudip
Greg Kroah-Hartman
maintainerQuoted 83 lines · Sudip Mukherjee
Hi Greg,
Quoted 7 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.10.110 release. There are 599 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 Thu, 07 Apr 2022 07:01:33 +0000. Anything received after that time might be too late.
My tests are still running, but it failed to boot on my test laptop. The trace is:
[ 2.194098] BUG: unable to handle page fault for address: ffffffffc0778fb5 [ 2.194791] #PF: supervisor write access in kernel mode [ 2.195166] #PF: error_code(0x0003) - permissions violation [ 2.195558] PGD 1bac14067 P4D 1bac14067 PUD 1bac16067 PMD 10aab8067 PTE 8000000110976061 [ 2.196124] Oops: 0003 [#1] SMP PTI [ 2.196374] CPU: 5 PID: 217 Comm: modprobe Not tainted 5.10.110-rc1+ #33 [ 2.196846] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014 [ 2.197712] RIP: 0010:number+0x1d6/0x340 [ 2.198025] Code: 83 c3 01 89 c8 44 29 d8 39 c2 7e ea 45 85 c9 0f 88 72 01 00 00 4d 63 c9 4a 8d 54 0c 18 4b 8d 44 0b 01 4c 39 db 76 06 0f b6 0a <41> 88 0b 49 83 c3 01 48 83 ea 01 49 39 c3 75 e8 83 ed 01 0f 88 3c [ 2.199654] RSP: 0018:ffffb61a4030fb08 EFLAGS: 00010206 [ 2.200126] RAX: ffffffffc0778fb7 RBX: ffffffffc0778fb8 RCX: 0000000000000031 [ 2.200630] RDX: ffffb61a4030fb21 RSI: 000000000000000a RDI: 0000000000000000 [ 2.201131] RBP: 00000000fffffffb R08: 0000000000ffff0a R09: 0000000000000001 [ 2.201635] R10: 3e2d434552202c29 R11: ffffffffc0778fb5 R12: 0000000000000020 [ 2.202140] R13: 0000000000000000 R14: 000000000000000a R15: 0000000000000000 [ 2.202641] FS: 00007fad7aa99580(0000) GS:ffff8c9537d40000(0000) knlGS:0000000000000000 [ 2.203212] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 2.203618] CR2: ffffffffc0778fb5 CR3: 000000011060c001 CR4: 0000000000370ee0 [ 2.204149] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 2.204682] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 2.205182] Call Trace: [ 2.205371] ? cpumask_next+0x17/0x20 [ 2.205636] ? kvm_smp_send_call_func_ipi+0x1e/0x60 [ 2.205986] vsnprintf+0x363/0x560 [ 2.206233] snprintf+0x49/0x60 [ 2.206461] eval_replace+0x46/0x80 [ 2.206712] trace_event_eval_update+0x263/0x360 [ 2.207057] trace_module_notify+0x44/0x50 [ 2.207352] blocking_notifier_call_chain_robust+0x64/0xd0 [ 2.207774] ? mutex_lock+0xe/0x30 [ 2.208020] load_module+0x209c/0x28e0 [ 2.208291] ? __do_sys_finit_module+0xb1/0x110 [ 2.208613] __do_sys_finit_module+0xb1/0x110 [ 2.208926] do_syscall_64+0x33/0x80 [ 2.209184] entry_SYSCALL_64_after_hwframe+0x44/0xa9 [ 2.209552] RIP: 0033:0x7fad7abb4f79 [ 2.209810] Code: 48 8d 3d da db 0d 00 0f 05 eb a5 66 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d c7 9e 0d 00 f7 d8 64 89 01 48 [ 2.211162] RSP: 002b:00007ffd607603c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000139 [ 2.212293] RAX: ffffffffffffffda RBX: 0000557e2325bc20 RCX: 00007fad7abb4f79 [ 2.213374] RDX: 0000000000000000 RSI: 0000557e2193c260 RDI: 0000000000000004 [ 2.214495] RBP: 0000000000040000 R08: 0000000000000000 R09: 0000557e2325c620 [ 2.215743] R10: 0000000000000004 R11: 0000000000000246 R12: 0000557e2193c260 [ 2.216994] R13: 0000000000000000 R14: 0000557e2325bcb0 R15: 0000557e2325bc20 [ 2.218219] Modules linked in: ext4(+) crc32c_generic crc16 mbcache jbd2 sd_mod bochs_drm t10_pi drm_vram_helper crc_t10dif drm_ttm_helper sr_mod crct10dif_generic cdrom ttm xhci_pci ata_generic drm_kms_helper xhci_hcd cec ata_piix libata rc_core usbcore crct10dif_pclmul crct10dif_common crc32_pclmul psmouse drm crc32c_intel usb_common i2c_piix4 e1000 scsi_mod floppy button [ 2.222206] CR2: ffffffffc0778fb5 [ 2.223103] ---[ end trace 036356107aad6aa1 ]---Did a bisect and the bisect log is:
# bad: [45fdcc9dc72a44448666a2bcff4030a659e29e46] Linux 5.10.110-rc1
# good: [d9c5818a0bc09e4cc9fe663edb69e4d6cdae4f70] Linux 5.10.109
git bisect start 'HEAD' 'v5.10.109'
# good: [93a35ab24592dfddafdb9f184e9399aad6d88a18] drm/amd/display: Add affected crtcs to atomic state for dsc mst unplug git bisect good93a35ab24592dfddafdb9f184e9399aad6d88a18
# good: [c8816508edf3558f597bd20a01403b060d690700] regulator: rpi-panel: Handle I2C errors/timing to the Atmel git bisect goodc8816508edf3558f597bd20a01403b060d690700
# bad: [5e7fb97064ee7794db7ac938583c3d095980e55f] scsi: qla2xxx: Fix disk failure to rediscover
git bisect bad5e7fb97064ee7794db7ac938583c3d095980e55f
# good: [3d65639a786b4587e64fb813a79a8f27b83dcaab] ARM: dts: qcom: fixgic_irq_domain_translatewarnings for msm8960 git bisect good3d65639a786b4587e64fb813a79a8f27b83dcaab
# good: [8bb857ae514a06d96a6ca81ff306acf5783d6cc6] media: Revert "media: em28xx: add missingem28xx_close_extension" git bisect good8bb857ae514a06d96a6ca81ff306acf5783d6cc6
# bad: [0042f52f784f847927f1ff234b3f97dd97ad8e48] powerpc/lib/sstep: Fix build errors with newer binutils git bisect bad0042f52f784f847927f1ff234b3f97dd97ad8e48
# bad: [690ee20444960ce5592465bce043ac5cd4ef8028] media: atomisp: fix bad usage at error handling logic git bisect bad690ee20444960ce5592465bce043ac5cd4ef8028
# bad: [93fe2389e6fd4c545920f6bd013b36f9328b636e] tracing: HaveTRACE_DEFINE_ENUMaffect trace event types as well git bisect bad93fe2389e6fd4c545920f6bd013b36f9328b636e
# good: [1fe212d441b683685c2900bd4353f53f7f608db9] media: hdpvr: initializedev->workerathdpvr_register_videodevgit bisect good1fe212d441b683685c2900bd4353f53f7f608db9
Quoted 4 lines
# first bad commit: [93fe2389e6fd4c545920f6bd013b36f9328b636e] tracing: Have TRACE_DEFINE_ENUM affect trace event types as wellAnd, reverting
93fe2389e6fd4c545920f6bd013b36f9328b636eon top of v5.10.110-rc1 fixed the problem.
Now dropped, thanks.
greg k-h
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.10.110 release. There are 599 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 Thu, 07 Apr 2022 07:01:33 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.10.110-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.10.y
and the diffstat can be found below.thanks,
greg k-h
Build failed on my system. The following is the problem commit. There are no changes to the config between 5.15.32 and this build.
Ranjani Sridharan <[email protected]>
ASoC: SOF: Intel: hda: Remove link assignment limitation
sound/soc/sof/intel/hda-dai.c: In function ‘hda_link_stream_assign’:sound/soc/sof/intel/hda-dai.c:82:24: error: implicit declaration of function ‘get_chip_info’; did you mean ‘get_group_info’? [-Werror=implicit-function-declaration]
82 | chip = get_chip_info(sdev->pdata);
| ^~~~~~~~~~~~~
| get_group_infosound/soc/sof/intel/hda-dai.c:82:22: warning: assignment to ‘const struct sof_intel_dsp_desc *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
82 | chip = get_chip_info(sdev->pdata);
| ^sound/soc/sof/intel/hda-dai.c:90:35: error: ‘const struct sof_intel_dsp_desc’ has no member named ‘quirks’
90 | if (!(chip->quirks & SOF_INTEL_PROCEN_FMT_QUIRK)) {
| ^~sound/soc/sof/intel/hda-dai.c:90:46: error: ‘SOF_INTEL_PROCEN_FMT_QUIRK’ undeclared (first use in this function)
90 | if (!(chip->quirks & SOF_INTEL_PROCEN_FMT_QUIRK)) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~sound/soc/sof/intel/hda-dai.c:90:46: note: each undeclared identifier is reported only once for each function it appears in
cc1: some warnings being treated as errors
thanks,
-- Shuah
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.10.110 release. There are 599 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 Thu, 07 Apr 2022 07:01:33 +0000. Anything received after that time might be too late.
Build results:
total: 161 pass: 150 fail: 11 Failed builds: alpha:defconfig alpha:allmodconfig csky:defconfig m68k:defconfig m68k:allmodconfig m68k:sun3_defconfig m68k_nommu:m5475evb_defconfig microblaze:mmu_defconfig nds32:defconfig nds32:allmodconfig um:defconfig Qemu test results: total: 477 pass: 448 fail: 29 Failed tests: <all alpha> q800:m68040:mac_defconfig:initrd q800:m68040:mac_defconfig:rootfs <all microblaze> <all s390>
Compile error:
fs/binfmt_elf.c: In function 'fill_note_info':fs/binfmt_elf.c:2050:45: error: 'siginfo' undeclared (first use in this function) fs/binfmt_elf.c:2056:53: error: 'regs' undeclared (first use in this function)
s390 tests crashed. Other failed qemu tests did not compile.
[ 7.385841] Unable to handle kernel pointer dereference in virtual kernel address space [ 7.385946] Failing address: 0000000001002000 TEID: 0000000001002407 [ 7.386007] Fault in home space mode while using kernel ASCE. [ 7.386610] AS:0000000001874007 R3:000000001ffec007 S:000000001ffe8800 P:000000000100231d [ 7.387430] Oops: 0004 ilc:3 [#1] SMP [ 7.387557] Modules linked in: [ 7.387902] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.10.110-rc1-00600-g45fdcc9dc72a #1 [ 7.387944] Hardware name: QEMU 3906 QEMU (KVM/Linux) [ 7.388043] Krnl PSW : 0704e00180000000 00000000008f0726 (number+0x25e/0x3c0) [ 7.388159] R:0 T:1 IO:1 EX:1 Key:0 M:1 W:0 P:0 AS:3 CC:2 PM:0 RI:0 EA:3 [ 7.388227] Krnl GPRS: 0000000000000058 0000000001002dc9 0000000000000002 00000000fffffffb [ 7.388268] 000003e00000bb11 000003e001002dc8 0000000000000000 0000000000000000 [ 7.388309] 0000000000000020 000003e000000001 0000000001002dca 0000000001002dc7 [ 7.388350] 000000000309c100 000003e00000bb10 00000000008f087a 000003e00000ba48 [ 7.388832] Krnl Code: 00000000008f0716: f0c84112b001 srp 274(13,%r4),1(%r11),8 [ 7.388832] 00000000008f071c: 41202001 la %r2,1(%r2) [ 7.388832] #00000000008f0720: ecab0006c065 clgrj %r10,%r11,12,00000000008f072c [ 7.388832] >00000000008f0726: d200b0004000 mvc 0(1,%r11),0(%r4) [ 7.388832] 00000000008f072c: 41b0b001 la %r11,1(%r11) [ 7.388832] 00000000008f0730: a74bffff aghi %r4,-1 [ 7.388832] 00000000008f0734: a727fff6 brctg %r2,00000000008f0720 [ 7.388832] 00000000008f0738: a73affff ahi %r3,-1 [ 7.389230] Call Trace: [ 7.389303] [<00000000008f0726>] number+0x25e/0x3c0 [ 7.389351] ([<00000000008f087a>] number+0x3b2/0x3c0) [ 7.389389] [<00000000008f5bd8>] vsnprintf+0x4b0/0x7c8 [ 7.389425] [<00000000008f5f98>] snprintf+0x40/0x50 [ 7.389464] [<000000000028b0aa>] eval_replace+0x62/0xc0 [ 7.389507] [<000000000028f6f4>] trace_event_eval_update+0x204/0x240 [ 7.389547] [<0000000001413a40>] tracer_init_tracefs+0x168/0x2d0 [ 7.389585] [<0000000000100982>] do_one_initcall+0x72/0x2b0 [ 7.389623] [<0000000001400434>] do_initcalls+0x124/0x148 [ 7.389660] [<00000000014006fe>] kernel_init_freeable+0x226/0x268 [ 7.389699] [<0000000000d6d202>] kernel_init+0x22/0x150 [ 7.389737] [<0000000000d7b858>] ret_from_fork+0x28/0x2c [ 7.389782] INFO: lockdep is turned off. [ 7.389822] Last Breaking-Event-Address: [ 7.389862] [<00000000008f06ec>] number+0x224/0x3c0 [ 7.390089] Kernel panic - not syncing: Fatal exception: panic_on_oops
Guenter
Quoted 11 lines · Guenter Roeck
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.10.110 release. There are 599 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 Thu, 07 Apr 2022 07:01:33 +0000. Anything received after that time might be too late.
s390 tests crashed. Other failed qemu tests did not compile.
Bisect points to commit 93fe2389e6fd ("tracing: Have TRACE_DEFINE_ENUM affect trace event types as well"). Bisect log attached. Reverting the offending patch fixes the problem. Copying Steven for comments/input.
Guenter
---
# bad: [45fdcc9dc72a44448666a2bcff4030a659e29e46] Linux 5.10.110-rc1
# good: [d9c5818a0bc09e4cc9fe663edb69e4d6cdae4f70] Linux 5.10.109
git bisect start 'HEAD' 'v5.10.109'
# good: [93a35ab24592dfddafdb9f184e9399aad6d88a18] drm/amd/display: Add affected crtcs to atomic state for dsc mst unplug git bisect good 93a35ab24592dfddafdb9f184e9399aad6d88a18
# good: [c8816508edf3558f597bd20a01403b060d690700] regulator: rpi-panel: Handle I2C errors/timing to the Atmel git bisect good c8816508edf3558f597bd20a01403b060d690700
# bad: [5e7fb97064ee7794db7ac938583c3d095980e55f] scsi: qla2xxx: Fix disk failure to rediscover
git bisect bad 5e7fb97064ee7794db7ac938583c3d095980e55f
# good: [3d65639a786b4587e64fb813a79a8f27b83dcaab] ARM: dts: qcom: fix gic_irq_domain_translate warnings for msm8960 git bisect good 3d65639a786b4587e64fb813a79a8f27b83dcaab
# good: [8bb857ae514a06d96a6ca81ff306acf5783d6cc6] media: Revert "media: em28xx: add missing em28xx_close_extension" git bisect good 8bb857ae514a06d96a6ca81ff306acf5783d6cc6
# bad: [0042f52f784f847927f1ff234b3f97dd97ad8e48] powerpc/lib/sstep: Fix build errors with newer binutils git bisect bad 0042f52f784f847927f1ff234b3f97dd97ad8e48
# bad: [690ee20444960ce5592465bce043ac5cd4ef8028] media: atomisp: fix bad usage at error handling logic git bisect bad 690ee20444960ce5592465bce043ac5cd4ef8028
# bad: [93fe2389e6fd4c545920f6bd013b36f9328b636e] tracing: Have TRACE_DEFINE_ENUM affect trace event types as well git bisect bad 93fe2389e6fd4c545920f6bd013b36f9328b636e
# good: [1fe212d441b683685c2900bd4353f53f7f608db9] media: hdpvr: initialize dev->worker at hdpvr_register_videodev git bisect good 1fe212d441b683685c2900bd4353f53f7f608db9
# first bad commit: [93fe2389e6fd4c545920f6bd013b36f9328b636e] tracing: Have TRACE_DEFINE_ENUM affect trace event types as well
Quoted 5 lines · On Tue, 5 Apr 2022 19:30:25 -0700 Guenter Roeck <[email protected]> wrote:
Quoted 1 line
s390 tests crashed. Other failed qemu tests did not compile.
Bisect points to commit
93fe2389e6fd("tracing: HaveTRACE_DEFINE_ENUMaffect trace event types as well"). Bisect log attached. Reverting the offending patch fixes the problem. Copying Steven for comments/input.
Do you have this commit?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=795301d3c2899
-- Steve
Quoted 5 lines · On Tue, 5 Apr 2022 22:52:12 -0400 Steven Rostedt <[email protected]> wrote:
Quoted 2 lines · On Tue, 5 Apr 2022 19:30:25 -0700 Guenter Roeck <[email protected]> wrote:
Quoted 1 line
s390 tests crashed. Other failed qemu tests did not compile.
Quoted 8 lines
Quoted 3 lines
Bisect points to commit
93fe2389e6fd("tracing: HaveTRACE_DEFINE_ENUMaffect trace event types as well"). Bisect log attached. Reverting the offending patch fixes the problem. Copying Steven for comments/input.Do you have this commit?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=795301d3c2899
OK, I see what happened. I wrote that patch because a new event appeared that used enums in the field format that gets exposed to user space. This patch is only needed for events that do that. Which until this release, nothing did.
That patch was then flagged as something to backport (but it was never tagged as stable, so this was one of the "AUTOSEL" backports). And it should have only been backported if any of these new events were also backported. Otherwise, the patch is useless.
When this patch was in linux-next, it caused s390 and powerpc to crash. I found the issue and fixed it with the linked patch above, and even added a "Fixes" tag to tie the two commits together.
Both of problem patch and the fix went into mainline in the same pull request.
Here's a thought, if you decide to backport a patch to stable, and you see that there's another commit with a "Fixes" tag to the automatically selected commit. DO NOT BACKPORT IF THE FIXES PATCH FAILS TO GO BACK TOO!
This never should have been backported without the fix. Please revert that patch for any stable release that the fixes patch fails to apply.
-- Steve
Quoted 3 lines · On Tue, 5 Apr 2022 23:08:12 -0400 Steven Rostedt <[email protected]> wrote:
Here's a thought, if you decide to backport a patch to stable, and you see that there's another commit with a "Fixes" tag to the automatically selected commit. DO NOT BACKPORT IF THE FIXES PATCH FAILS TO GO BACK TOO!
Seriously. This should be the case for *all* backported patches, not just the AUTOSEL ones.
Otherwise you are backporting a commit to "stable" that is KNOWN TO BE BROKEN!
-- Steve
Greg Kroah-Hartman
maintainerQuoted 7 lines · Steven Rostedt
Quoted 3 lines · On Tue, 5 Apr 2022 23:08:12 -0400 Steven Rostedt <[email protected]> wrote:
Here's a thought, if you decide to backport a patch to stable, and you see that there's another commit with a "Fixes" tag to the automatically selected commit. DO NOT BACKPORT IF THE FIXES PATCH FAILS TO GO BACK TOO!
Quoted 5 lines
Seriously. This should be the case for *all* backported patches, not just the AUTOSEL ones.
Otherwise you are backporting a commit to "stable" that is KNOWN TO BE BROKEN!
My scripts usually do catch this, let me go see what went wrong...
Greg Kroah-Hartman
maintainerQuoted 8 lines · Greg Kroah-Hartman
Quoted 7 lines · Steven Rostedt
Quoted 3 lines · On Tue, 5 Apr 2022 23:08:12 -0400 Steven Rostedt <[email protected]> wrote:
Here's a thought, if you decide to backport a patch to stable, and you see that there's another commit with a "Fixes" tag to the automatically selected commit. DO NOT BACKPORT IF THE FIXES PATCH FAILS TO GO BACK TOO!
Quoted 7 lines
Quoted 5 lines
Seriously. This should be the case for *all* backported patches, not just the AUTOSEL ones.
Otherwise you are backporting a commit to "stable" that is KNOWN TO BE BROKEN!
My scripts usually do catch this, let me go see what went wrong...
Ok, my fault, my scripts _did_ catch this, but I ignored it as it was filled with other noise. I've now queued this commit up.
thanks for catching this and sorry for missing it the first time around.
greg k-h