5.19.2-rc1 review
Subsystems (12)
Greg Kroah-Hartman
maintainerPATCH 1129/1157 ext4: fix race when reusing xattr blocks
In reply to Greg Kroah-HartmanFrom: Jan Kara <[email protected]>
[ Upstream commit 65f8b80053a1b2fd602daa6814e62d6fa90e5e9b ]
When ext4_xattr_block_set() decides to remove xattr block the following race can happen:
CPU1 CPU2ext4_xattr_block_set() ext4_xattr_release_block()
new_bh = ext4_xattr_block_cache_find()
lock_buffer(bh);
ref = le32_to_cpu(BHDR(bh)->h_refcount);
if (ref == 1) {
...
mb_cache_entry_delete();
unlock_buffer(bh);
ext4_free_blocks();
...
ext4_forget(..., bh, ...);
jbd2_journal_revoke(..., bh); ext4_journal_get_write_access(..., new_bh, ...)
do_get_write_access()
jbd2_journal_cancel_revoke(..., new_bh);Later the code in ext4_xattr_block_set() finds out the block got freed and cancels reusal of the block but the revoke stays canceled and so in case of block reuse and journal replay the filesystem can get corrupted. If the race works out slightly differently, we can also hit assertions in the jbd2 code.
Fix the problem by making sure that once matching mbcache entry is found, code dropping the last xattr block reference (or trying to modify xattr block in place) waits until the mbcache entry reference is dropped. This way code trying to reuse xattr block is protected from someone trying to drop the last reference to xattr block.
--- fs/ext4/xattr.c | 67 +++++++++++++++++++++++++++++++++---------------- 1 file changed, 45 insertions(+), 22 deletions(-)
fs/ext4/xattr.c +45 -22
@@ -439,9 +439,16 @@ static int ext4_xattr_inode_iget(struct inode *parent, unsigned long ea_ino,/* Remove entry from mbcache when EA inode is getting evicted */ void ext4_evict_ea_inode (struct inode *inode) { -if (EA_INODE_CACHE (inode)) -mb_cache_entry_delete (EA_INODE_CACHE (inode), -ext4_xattr_inode_get_hash (inode), inode->i_ino); +struct mb_cache_entry *oe; + +if (!EA_INODE_CACHE (inode)) +return ; +/* Wait for entry to get unused so that we can remove it */ +while ((oe =mb_cache_entry_delete_or_get (EA_INODE_CACHE (inode), +ext4_xattr_inode_get_hash (inode), inode->i_ino))) { +mb_cache_entry_wait_unused (oe); +mb_cache_entry_put (EA_INODE_CACHE (inode), oe); + } } static int
@@ -1229,6 +1236,7 @@ ext4_xattr_release_block(handle_t *handle, struct inode *inode,if (error) goto out; +retry_ref:lock_buffer (bh); hash =le32_to_cpu (BHDR (bh)->h_hash); ref =le32_to_cpu (BHDR (bh)->h_refcount);
@@ -1238,9 +1246,18 @@ ext4_xattr_release_block(handle_t *handle, struct inode *inode,* This must happen under buffer lock for * ext4_xattr_block_set() to reliably detect freed block */ -if (ea_block_cache) -mb_cache_entry_delete (ea_block_cache, hash, - bh->b_blocknr); +if (ea_block_cache) { +struct mb_cache_entry *oe; + + oe =mb_cache_entry_delete_or_get (ea_block_cache, hash, + bh->b_blocknr); +if (oe) { +unlock_buffer (bh); +mb_cache_entry_wait_unused (oe); +mb_cache_entry_put (ea_block_cache, oe); + goto retry_ref; + } + }get_bh (bh);unlock_buffer (bh);
@@ -1867,9 +1884,20 @@ ext4_xattr_block_set(handle_t *handle, struct inode *inode,* ext4_xattr_block_set() to reliably detect modified * block */ -if (ea_block_cache) -mb_cache_entry_delete (ea_block_cache, hash, - bs->bh->b_blocknr); +if (ea_block_cache) { +struct mb_cache_entry *oe; + + oe =mb_cache_entry_delete_or_get (ea_block_cache, + hash, bs->bh->b_blocknr); +if (oe) { +/* +* Xattr block is getting reused. Leave +* it alone. +*/ +mb_cache_entry_put (ea_block_cache, oe); + goto clone_block; + } + }ea_bdebug (bs->bh,"modifying in-place" ); error =ext4_xattr_set_entry (i, s, handle, inode, true/* is_block */ );
@@ -1885,6 +1913,7 @@ ext4_xattr_block_set(handle_t *handle, struct inode *inode, goto cleanup; goto inserted; } +clone_block:unlock_buffer (bs->bh);ea_bdebug (bs->bh,"cloning" ); s->base =kmemdup (BHDR (bs->bh), bs->bh->b_size,GFP_NOFS );
@@ -1990,18 +2019,13 @@ ext4_xattr_block_set(handle_t *handle, struct inode *inode,lock_buffer (new_bh);/* * We have to be careful about races with -* freeing, rehashing or adding references to -* xattr block. Once we hold buffer lock xattr -* block's state is stable so we can check -* whether the block got freed / rehashed or -* not. Since we unhash mbcache entry under -* buffer lock when freeing / rehashing xattr -* block, checking whether entry is still -* hashed is reliable. Same rules hold for -* e_reusable handling. +* adding references to xattr block. Once we +* hold buffer lock xattr block's state is +* stable so we can check the additional +* reference fits. */ -if (hlist_bl_unhashed (&ce->e_hash_list) || - !ce->e_reusable) { + ref =le32_to_cpu (BHDR (new_bh)->h_refcount) +1 ; +if (ref >EXT4_XATTR_REFCOUNT_MAX ) {/* * Undo everything and check mbcache * again.
@@ -2016,9 +2040,8 @@ ext4_xattr_block_set(handle_t *handle, struct inode *inode, new_bh =NULL ; goto inserted; } - ref =le32_to_cpu (BHDR (new_bh)->h_refcount) +1 ;BHDR (new_bh)->h_refcount =cpu_to_le32 (ref); -if (ref >=EXT4_XATTR_REFCOUNT_MAX ) +if (ref ==EXT4_XATTR_REFCOUNT_MAX ) ce->e_reusable =0 ;ea_bdebug (new_bh,"reusing; refcount now=%d" , ref);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 1130/1157 KEYS: asymmetric: enforce SM2 signature use pkey algo
In reply to Greg Kroah-HartmanFrom: Tianjia Zhang <[email protected]>
[ Upstream commit 0815291a8fd66cdcf7db1445d4d99b0d16065829 ]
The signature verification of SM2 needs to add the Za value and recalculate sig->digest, which requires the detection of the pkey_algo in public_key_verify_signature(). As Eric Biggers said, the pkey_algo field in sig is attacker-controlled and should be use pkey->pkey_algo instead of sig->pkey_algo, and secondly, if sig->pkey_algo is NULL, it will also cause signature verification failure.
The software_key_determine_akcipher() already forces the algorithms are matched, so the SM3 algorithm is enforced in the SM2 signature, although this has been checked, we still avoid using any algorithm information in the signature as input.
--- crypto/asymmetric_keys/public_key.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
crypto/asymmetric_keys/public_key.c +5 -2
@@ -304,6 +304,10 @@ static int cert_sig_digest_update(const struct public_key_signature *sig,BUG_ON (!sig->data); +/* SM2 signatures always use the SM3 hash algorithm */ +if (!sig->hash_algo ||strcmp (sig->hash_algo,"sm3" ) !=0 ) +return -EINVAL ; + ret =sm2_compute_z_digest (tfm_pkey,SM2_DEFAULT_USERID ,SM2_DEFAULT_USERID_LEN , dgst);if (ret)
@@ -414,8 +418,7 @@ int public_key_verify_signature(const struct public_key *pkey,if (ret) goto error_free_key; -if (sig->pkey_algo &&strcmp (sig->pkey_algo,"sm2" ) ==0 && - sig->data_size) { +if (strcmp (pkey->pkey_algo,"sm2" ) ==0 && sig->data_size) { ret =cert_sig_digest_update (sig, tfm);if (ret) goto error_free_key;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 1131/1157 tpm: eventlog: Fix section mismatch for DEBUG_SECTION_MISMATCH
In reply to Greg Kroah-HartmanFrom: Huacai Chen <[email protected]>
[ Upstream commit bed4593645366ad7362a3aa7bc0d100d8d8236a8 ]
If DEBUG_SECTION_MISMATCH enabled, __calc_tpm2_event_size() will not be inlined, this cause section mismatch like this:
WARNING: modpost: vmlinux.o(.text.unlikely+0xe30c): Section mismatch in reference from the variable L0 to the function .init.text:early_ioremap() The function L0() references
the function __init early_memremap().
This is often because L0 lacks a __init
annotation or the annotation of early_ioremap is wrong.
Fix it by using __always_inline instead of inline for the called-once function __calc_tpm2_event_size().
--- include/linux/tpm_eventlog.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/tpm_eventlog.h +1 -1
@@ -157,7 +157,7 @@ struct tcg_algorithm_info {* Return: size of the event on success, 0 on failure */ -static inline int __calc_tpm2_event_size (struct tcg_pcr_event2_head *event, +static __always_inline int __calc_tpm2_event_size(struct tcg_pcr_event2_head *event,struct tcg_pcr_event *event_header,bool do_mapping) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 1132/1157 tpm: Add check for Failure mode for TPM2 modules
In reply to Greg Kroah-HartmanFrom: Mårten Lindahl <[email protected]>
[ Upstream commit 863ed94c589fcd1984f4e3080f069d30508044bb ]
In commit 0aa698787aa2 ("tpm: Add Upgrade/Reduced mode support for TPM2 modules") it was said that:
"If the TPM is in Failure mode, it will successfully respond to both tpm2_do_selftest() and tpm2_startup() calls. Although, will fail to answer to tpm2_get_cc_attrs_tbl(). Use this fact to conclude that TPM is in Failure mode."
But a check was never added in the commit when calling tpm2_get_cc_attrs_tbl() to conclude that the TPM is in Failure mode. This commit corrects this by adding a check.
--- drivers/char/tpm/tpm2-cmd.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/char/tpm/tpm2-cmd.c +6 -0
@@ -752,6 +752,12 @@ int tpm2_auto_startup(struct tpm_chip *chip) } rc =tpm2_get_cc_attrs_tbl (chip); +if (rc ==TPM2_RC_FAILURE || (rc <0 && rc != -ENOMEM )) { +dev_info (&chip->dev, +"TPM in field failure mode, requires firmware upgrade\n" ); + chip->flags |=TPM_CHIP_FLAG_FIRMWARE_UPGRADE ; + rc =0 ; + } out:/*
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 1133/1157 xen-blkback: fix persistent grants negotiation
In reply to Greg Kroah-HartmanFrom: SeongJae Park <[email protected]>
commit fc9be616bb8f3ed9cf560308f86904f5c06be205 upstream.
Persistent grants feature can be used only when both backend and the frontend supports the feature. The feature was always supported by 'blkback', but commit aac8a70db24b ("xen-blkback: add a parameter for disabling of persistent grants") has introduced a parameter for disabling it runtime.
To avoid the parameter be updated while being used by 'blkback', the commit caches the parameter into 'vbd->feature_gnt_persistent' in 'xen_vbd_create()', and then check if the guest also supports the feature and finally updates the field in 'connect_ring()'.
However, 'connect_ring()' could be called before 'xen_vbd_create()', so later execution of 'xen_vbd_create()' can wrongly overwrite 'true' to 'vbd->feature_gnt_persistent'. As a result, 'blkback' could try to use 'persistent grants' feature even if the guest doesn't support the feature.
This commit fixes the issue by moving the parameter value caching to 'xen_blkif_alloc()', which allocates the 'blkif'. Because the struct embeds 'vbd' object, which will be used by 'connect_ring()' later, this should be called before 'connect_ring()' and therefore this should be the right and safe place to do the caching.
--- drivers/block/xen-blkback/xenbus.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
drivers/block/xen-blkback/xenbus.c +7 -8
@@ -157,6 +157,11 @@ static int xen_blkif_alloc_rings(structreturn 0 ; } +/* Enable the persistent grants feature. */ +static bool feature_persistent = true; +module_param (feature_persistent, bool,0644 ); +MODULE_PARM_DESC (feature_persistent,"Enables the persistent grants feature" ); +static struct xen_blkif *xen_blkif_alloc (domid_t domid) {struct xen_blkif *blkif;
@@ -181,6 +186,8 @@ static struct xen_blkif *xen_blkif_alloc__module_get (THIS_MODULE );INIT_WORK (&blkif->free_work, xen_blkif_deferred_free); + blkif->vbd.feature_gnt_persistent = feature_persistent; +return blkif; }
@@ -472,12 +479,6 @@ static void xen_vbd_free(struct xen_vbd vbd->bdev =NULL ; } -/* Enable the persistent grants feature. */ -static bool feature_persistent = true; -module_param (feature_persistent, bool,0644 ); -MODULE_PARM_DESC (feature_persistent, -"Enables the persistent grants feature" ); -static int xen_vbd_create (struct xen_blkif *blkif,blkif_vdev_t handle,unsigned major,unsigned minor,int readonly,int cdrom)
@@ -520,8 +521,6 @@ static int xen_vbd_create(struct xen_blkif (bdev_max_secure_erase_sectors (bdev)) vbd->discard_secure = true; - vbd->feature_gnt_persistent = feature_persistent; -pr_debug ("Successful creation of handle=%04x (dom=%u)\n" , handle, blkif->domid);return 0 ;
Greg Kroah-Hartman
maintainerPATCH 1134/1157 xen-blkback: Apply feature_persistent parameter when connect
In reply to Greg Kroah-HartmanFrom: Maximilian Heyne <[email protected]>
commit e94c6101e151b019b8babc518ac2a6ada644a5a1 upstream.
In some use cases[1], the backend is created while the frontend doesn't support the persistent grants feature, but later the frontend can be changed to support the feature and reconnect. In the past, 'blkback' enabled the persistent grants feature since it unconditionally checked if frontend supports the persistent grants feature for every connect ('connect_ring()') and decided whether it should use persistent grans or not.
However, commit aac8a70db24b ("xen-blkback: add a parameter for disabling of persistent grants") has mistakenly changed the behavior. It made the frontend feature support check to not be repeated once it shown the 'feature_persistent' as 'false', or the frontend doesn't support persistent grants.
This commit changes the behavior of the parameter to make effect for every connect, so that the previous workflow can work again as expected.
--- Documentation/ABI/testing/sysfs-driver-xen-blkback | 2 +- drivers/block/xen-blkback/xenbus.c | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-)
Documentation/ABI/testing/sysfs-driver-xen-blkback +1 -1
@@ -42,5 +42,5 @@ KernelVersion: 5.10 Contact: Maximilian Heyne <[email protected]> Description: Whether to enable the persistent grants feature or not. Note - that this option only takes effect on newly created backends. + that this option only takes effect on newly connected backends. The default is Y (enable).
drivers/block/xen-blkback/xenbus.c +3 -6
@@ -186,8 +186,6 @@ static struct xen_blkif *xen_blkif_alloc__module_get (THIS_MODULE );INIT_WORK (&blkif->free_work, xen_blkif_deferred_free); - blkif->vbd.feature_gnt_persistent = feature_persistent; -return blkif; }
@@ -1086,10 +1084,9 @@ static int connect_ring(struct backend_ixenbus_dev_fatal (dev, err,"unknown fe protocol %s" , protocol);return -ENOSYS ; } -if (blkif->vbd.feature_gnt_persistent) - blkif->vbd.feature_gnt_persistent = -xenbus_read_unsigned (dev->otherend, -"feature-persistent" ,0 ); + + blkif->vbd.feature_gnt_persistent = feature_persistent && +xenbus_read_unsigned (dev->otherend,"feature-persistent" ,0 ); blkif->vbd.overflow_max_grants =0 ;
Greg Kroah-Hartman
maintainerPATCH 1135/1157 xen-blkfront: Apply feature_persistent parameter when connect
In reply to Greg Kroah-HartmanFrom: SeongJae Park <[email protected]>
commit 402c43ea6b34a1b371ffeed9adf907402569eaf5 upstream.
In some use cases[1], the backend is created while the frontend doesn't support the persistent grants feature, but later the frontend can be changed to support the feature and reconnect. In the past, 'blkback' enabled the persistent grants feature since it unconditionally checked if frontend supports the persistent grants feature for every connect ('connect_ring()') and decided whether it should use persistent grans or not.
However, commit aac8a70db24b ("xen-blkback: add a parameter for disabling of persistent grants") has mistakenly changed the behavior. It made the frontend feature support check to not be repeated once it shown the 'feature_persistent' as 'false', or the frontend doesn't support persistent grants.
Similar behavioral change has made on 'blkfront' by commit 74a852479c68 ("xen-blkfront: add a parameter for disabling of persistent grants"). This commit changes the behavior of the parameter to make effect for every connect, so that the previous behavior of 'blkfront' can be restored.
--- Documentation/ABI/testing/sysfs-driver-xen-blkfront | 2 +- drivers/block/xen-blkfront.c | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-)
Documentation/ABI/testing/sysfs-driver-xen-blkfront +1 -1
@@ -15,5 +15,5 @@ KernelVersion: 5.10 Contact: Maximilian Heyne <[email protected]> Description: Whether to enable the persistent grants feature or not. Note - that this option only takes effect on newly created frontends. + that this option only takes effect on newly connected frontends. The default is Y (enable).
drivers/block/xen-blkfront.c +1 -3
@@ -1988,8 +1988,6 @@ static int blkfront_probe(struct xenbus_ info->vdevice = vdevice; info->connected =BLKIF_STATE_DISCONNECTED ; - info->feature_persistent = feature_persistent; -/* Front end dir is a number, which is used as the id. */ info->handle =simple_strtoul (strrchr (dev->nodename,'/' )+1 ,NULL ,0 );dev_set_drvdata (&dev->dev, info);
@@ -2283,7 +2281,7 @@ static void blkfront_gather_backend_featif (xenbus_read_unsigned (info->xbdev->otherend,"feature-discard" ,0 ))blkfront_setup_discard (info); -if (info->feature_persistent) +if (feature_persistent) info->feature_persistent = !!xenbus_read_unsigned (info->xbdev->otherend,"feature-persistent" ,0 );
Greg Kroah-Hartman
maintainerPATCH 1136/1157 powerpc: Fix eh field when calling lwarx on PPC32
In reply to Greg Kroah-HartmanFrom: Christophe Leroy <[email protected]>
commit 18db466a9a306406dab3b134014d9f6ed642471c upstream.
Commit 9401f4e46cf6 ("powerpc: Use lwarx/ldarx directly instead of PPC_LWARX/LDARX macros") properly handled the eh field of lwarx in asm/bitops.h but failed to clear it for PPC32 in asm/simple_spinlock.h
So, do as in arch_atomic_try_cmpxchg_lock(), set it to 1 if PPC64 but set it to 0 if PPC32. For that use IS_ENABLED(CONFIG_PPC64) which returns 1 when CONFIG_PPC64 is set and 0 otherwise.
--- arch/powerpc/include/asm/simple_spinlock.h | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
arch/powerpc/include/asm/simple_spinlock.h +9 -6
@@ -48,10 +48,11 @@ static inline int arch_spin_is_locked(arstatic inline unsigned long __arch_spin_trylock (arch_spinlock_t *lock) {unsigned long tmp, token; +unsigned int eh =IS_ENABLED (CONFIG_PPC64 ); token =LOCK_TOKEN ; __asm__ __volatile__( -"1: lwarx %0,0,%2,1\n\ +"1: lwarx %0,0,%2,%[eh]\n\ cmpwi 0,%0,0\n\ bne- 2f\n\ stwcx. %1,0,%2\n\
@@ -59,7 +60,7 @@ static inline unsigned long __arch_spin_ PPC_ACQUIRE_BARRIER "2:" : "=&r" (tmp) - : "r" (token), "r" (&lock->slock) + : "r" (token), "r" (&lock->slock), [eh] "n" (eh) : "cr0", "memory"); return tmp;
@@ -156,9 +157,10 @@ static inline void arch_spin_unlock(archstatic inline long __arch_read_trylock (arch_rwlock_t *rw) {long tmp; +unsigned int eh =IS_ENABLED (CONFIG_PPC64 ); __asm__ __volatile__( -"1: lwarx %0,0,%1,1\n" +"1: lwarx %0,0,%1,%[eh]\n" __DO_SIGN_EXTEND" addic. %0,%0,1\n\ ble- 2f\n"
@@ -166,7 +168,7 @@ static inline long __arch_read_trylock(a bne- 1b\n" PPC_ACQUIRE_BARRIER "2:" : "=&r" (tmp) - : "r" (&rw->lock) + : "r" (&rw->lock), [eh] "n" (eh) : "cr0", "xer", "memory");return tmp;
@@ -179,17 +181,18 @@ static inline long __arch_read_trylock(astatic inline long __arch_write_trylock (arch_rwlock_t *rw) {long tmp, token; +unsigned int eh =IS_ENABLED (CONFIG_PPC64 ); token =WRLOCK_TOKEN ; __asm__ __volatile__( -"1: lwarx %0,0,%2,1\n\ +"1: lwarx %0,0,%2,%[eh]\n\ cmpwi 0,%0,0\n\ bne- 2f\n" " stwcx. %1,0,%2\n\ bne- 1b\n" PPC_ACQUIRE_BARRIER "2:" :"=&r" (tmp) - :"r" (token),"r" (&rw->lock) + :"r" (token),"r" (&rw->lock), [eh]"n" (eh) :"cr0" ,"memory" );return tmp;
Greg Kroah-Hartman
maintainerPATCH 1137/1157 powerpc64/ftrace: Fix ftrace for clang builds
In reply to Greg Kroah-HartmanFrom: Naveen N. Rao <[email protected]>
commit cb928ac192128c842f4c1cfc8b6780b95719d65f upstream.
Clang doesn't support -mprofile-kernel ABI, so guard the checks against CONFIG_DYNAMIC_FTRACE_WITH_REGS, rather than the elf ABI version.
--- arch/powerpc/kernel/trace/ftrace.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/powerpc/kernel/trace/ftrace.c +4 -4
@@ -392,11 +392,11 @@ int ftrace_make_nop(struct module *mod,*/ static bool expected_nop_sequence (void *ip,ppc_inst_t op0,ppc_inst_t op1) { -if (IS_ENABLED (CONFIG_PPC64_ELF_ABI_V1 )) +if (IS_ENABLED (CONFIG_DYNAMIC_FTRACE_WITH_REGS )) +return ppc_inst_equal (op0,ppc_inst (PPC_RAW_NOP ())); +else return ppc_inst_equal (op0,ppc_inst (PPC_RAW_BRANCH (8 ))) &&ppc_inst_equal (op1,ppc_inst (PPC_INST_LD_TOC )); -else -return ppc_inst_equal (op0,ppc_inst (PPC_RAW_NOP ())); } static int
@@ -411,7 +411,7 @@ __ftrace_make_call(struct dyn_ftrace *reif (copy_inst_from_kernel_nofault (op, ip))return -EFAULT ; -if (IS_ENABLED (CONFIG_PPC64_ELF_ABI_V1 ) && +if (!IS_ENABLED (CONFIG_DYNAMIC_FTRACE_WITH_REGS ) &©_inst_from_kernel_nofault (op +1 , ip +4 ))return -EFAULT ;
Greg Kroah-Hartman
maintainerPATCH 1138/1157 net_sched: cls_route: remove from list when handle is 0
In reply to Greg Kroah-HartmanFrom: Thadeu Lima de Souza Cascardo <[email protected]>
commit 9ad36309e2719a884f946678e0296be10f0bb4c1 upstream.
When a route filter is replaced and the old filter has a 0 handle, the old one won't be removed from the hashtable, while it will still be freed.
The test was there since before commit 1109c00547fc ("net: sched: RCU cls_route"), when a new filter was not allocated when there was an old one. The old filter was reused and the reinserting would only be necessary if an old filter was replaced. That was still wrong for the same case where the old handle was 0.
Remove the old filter from the list independently from its handle value.
This fixes CVE-2022-2588, also reported as ZDI-CAN-17440.
--- net/sched/cls_route.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/sched/cls_route.c +1 -1
@@ -526,7 +526,7 @@ static int route4_change(struct net *netrcu_assign_pointer (f->next, f1);rcu_assign_pointer (*fp, f); -if (fold && fold->handle && f->handle != fold->handle) { +if (fold) { th =to_hash (fold->handle); h =from_hash (fold->handle >>16 ); b =rtnl_dereference (head->table[th]);
Greg Kroah-Hartman
maintainerPATCH 1139/1157 Revert "drm/bridge: anx7625: Use DPI bus type"
In reply to Greg Kroah-HartmanFrom: Robert Foss <[email protected]>
commit 61922beba36adea8702fe8069b309c806f6608af upstream.
This reverts commit a77c2af0994e24ee36c7ffb6dc852770bdf06fb1.
This patch depends on the patches just aplied to the media tree, and will not build without them, which leaves drm-misc-next in a broken state. Let's revert the two latter patches until rc1 has been branched, and rc1 has been backmerged into drm-misc-next.
--- drivers/gpu/drm/bridge/analogix/anx7625.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/bridge/analogix/anx7625.c +4 -4
@@ -1623,14 +1623,14 @@ static int anx7625_parse_dt(struct devicanx7625_get_swing_setting (dev, pdata); - pdata->is_dpi =0 ;/* default dsi mode */ + pdata->is_dpi =1 ;/* default dpi mode */ pdata->mipi_host_node =of_graph_get_remote_node (np,0 ,0 );if (!pdata->mipi_host_node) {DRM_DEV_ERROR (dev,"fail to get internal panel.\n" );return -ENODEV ; } - bus_type =0 ; + bus_type =V4L2_FWNODE_BUS_TYPE_PARALLEL ; mipi_lanes =MAX_LANES_SUPPORT ; ep0 =of_graph_get_endpoint_by_regs (np,0 ,0 );if (ep0) {
@@ -1640,8 +1640,8 @@ static int anx7625_parse_dt(struct devic mipi_lanes =of_property_count_u32_elems (ep0,"data-lanes" ); } -if (bus_type ==V4L2_FWNODE_BUS_TYPE_DPI )/* bus type is DPI */ - pdata->is_dpi =1 ; +if (bus_type ==V4L2_FWNODE_BUS_TYPE_PARALLEL )/* bus type is Parallel(DSI) */ + pdata->is_dpi =0 ; pdata->mipi_lanes = mipi_lanes;if (pdata->mipi_lanes >MAX_LANES_SUPPORT || pdata->mipi_lanes <=0 )
Greg Kroah-Hartman
maintainerPATCH 1140/1157 tcp: fix over estimation in sk_forced_mem_schedule()
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
commit c4ee118561a0f74442439b7b5b486db1ac1ddfeb upstream.
sk_forced_mem_schedule() has a bug similar to ones fixed in commit 7c80b038d23e ("net: fix sk_wmem_schedule() and sk_rmem_schedule() errors")
While this bug has little chance to trigger in old kernels, we need to fix it before the following patch.
--- net/ipv4/tcp_output.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
net/ipv4/tcp_output.c +4 -3
@@ -3369,11 +3369,12 @@ void tcp_xmit_retransmit_queue(struct so*/ void sk_forced_mem_schedule (struct sock *sk,int size) { -int amt; +int delta, amt; -if (size <= sk->sk_forward_alloc) + delta = size - sk->sk_forward_alloc; +if (delta <=0 )return ; - amt =sk_mem_pages (size); + amt =sk_mem_pages (delta); sk->sk_forward_alloc += amt *SK_MEM_QUANTUM ;sk_memory_allocated_add (sk, amt);
Greg Kroah-Hartman
maintainerPATCH 1141/1157 crypto: lib/blake2s - reduce stack frame usage in self test
In reply to Greg Kroah-HartmanFrom: Jason A. Donenfeld <[email protected]>
commit d6c14da474bf260d73953fbf7992c98d9112aec7 upstream.
Using 3 blocks here doesn't give us much more than using 2, and it causes a stack frame size warning on certain compiler/config/arch combinations:
lib/crypto/blake2s-selftest.c: In function 'blake2s_selftest':
Quoted 1 line
Quoted 1 line
lib/crypto/blake2s-selftest.c:632:1: warning: the frame size of 1088 bytes is larger than 1024 bytes [-Wframe-larger-than=]
632 | }
| ^So this patch just reduces the block from 3 to 2, which makes the warning go away.
--- lib/crypto/blake2s-selftest.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
lib/crypto/blake2s-selftest.c +3 -3
@@ -593,7 +593,7 @@ bool __init blake2s_selftest(void)enum {TEST_ALIGNMENT =16 };u8 unaligned_block[BLAKE2S_BLOCK_SIZE +TEST_ALIGNMENT -1 ]__aligned(TEST_ALIGNMENT) ; -u8 blocks[BLAKE2S_BLOCK_SIZE *3 ]; +u8 blocks[BLAKE2S_BLOCK_SIZE *2 ];struct blake2s_state state1, state2;get_random_bytes (blocks,sizeof (blocks));
@@ -603,8 +603,8 @@ bool __init blake2s_selftest(void) defined(CONFIG_CRYPTO_ARCH_HAVE_LIB_BLAKE2S) memcpy(&state1, &state, sizeof(state1));memcpy (&state2, &state,sizeof (state2)); -blake2s_compress (&state1, blocks,3 ,BLAKE2S_BLOCK_SIZE ); -blake2s_compress_generic (&state2, blocks,3 ,BLAKE2S_BLOCK_SIZE ); +blake2s_compress (&state1, blocks,2 ,BLAKE2S_BLOCK_SIZE ); +blake2s_compress_generic (&state2, blocks,2 ,BLAKE2S_BLOCK_SIZE );if (memcmp (&state1, &state2,sizeof (state1))) {pr_err ("blake2s random compress self-test %d: FAIL\n" , i +1 );
Greg Kroah-Hartman
maintainerPATCH 1142/1157 raw: remove unused variables from raw6_icmp_error()
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
commit c4fceb46add65481ef0dfb79cad24c3c269b4cad upstream.
saddr and daddr are set but not used.
--- net/ipv6/raw.c | 3 --- 1 file changed, 3 deletions(-)
net/ipv6/raw.c +0 -3
@@ -332,7 +332,6 @@ static void rawv6_err(struct sock *sk, svoid raw6_icmp_error (struct sk_buff *skb,int nexthdr,u8 type,u8 code,int inner_offset,__be32 info) { -const struct in6_addr *saddr, *daddr;struct net *net =dev_net (skb->dev);struct hlist_nulls_head *hlist;struct hlist_nulls_node *hnode;
@@ -345,8 +344,6 @@ void raw6_icmp_error(struct sk_buff *skbhlist_nulls_for_each_entry (sk, hnode, hlist, sk_nulls_node) {/* Note: ipv6_hdr(skb) != skb->data */ const struct ipv6hdr *ip6h = (const struct ipv6hdr *)skb->data; - saddr = &ip6h->saddr; - daddr = &ip6h->daddr;if (!raw_v6_match (net, sk, nexthdr, &ip6h->saddr, &ip6h->daddr,inet6_iif (skb),inet6_iif (skb)))
Greg Kroah-Hartman
maintainerPATCH 1143/1157 raw: fix a typo in raw_icmp_error()
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
commit 97a4d46b1516250d640c1ae0c9e7129d160d6a1c upstream.
I accidentally broke IPv4 traceroute, by swapping iph->saddr and iph->daddr.
Probably because raw_icmp_error() and raw_v4_input() use different order for iph->saddr and iph->daddr.
--- net/ipv4/raw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/raw.c +1 -1
@@ -278,7 +278,7 @@ void raw_icmp_error(struct sk_buff *skb,hlist_nulls_for_each_entry (sk, hnode, hlist, sk_nulls_node) { iph = (const struct iphdr *)skb->data;if (!raw_v4_match (net, sk, iph->protocol, - iph->saddr, iph->daddr, dif, sdif)) + iph->daddr, iph->saddr, dif, sdif))continue ;raw_err (sk, skb, info); }
Greg Kroah-Hartman
maintainerPATCH 1144/1157 Revert "mwifiex: fix sleep in atomic context bugs caused by dev_coredumpv"
In reply to Greg Kroah-HartmanFrom: Greg Kroah-Hartman <[email protected]>
commit 5f8954e099b8ae96e7de1bb95950e00c85bedd40 upstream.
This reverts commit a52ed4866d2b90dd5e4ae9dabd453f3ed8fa3cbc as it causes build problems in linux-next. It needs to be reintroduced in a way that can allow the api to evolve and not require a "flag day" to catch all users.
--- drivers/net/wireless/marvell/mwifiex/init.c | 9 ++++----- drivers/net/wireless/marvell/mwifiex/main.h | 3 +-- drivers/net/wireless/marvell/mwifiex/sta_event.c | 6 +++--- 3 files changed, 8 insertions(+), 10 deletions(-)
drivers/net/wireless/marvell/mwifiex/init.c +4 -5
@@ -63,10 +63,9 @@ static void wakeup_timer_fn(struct timer adapter->if_ops.card_reset (adapter); } -static void fw_dump_work (struct work_struct *work) +static void fw_dump_timer_fn (struct timer_list *t) { -struct mwifiex_adapter *adapter = - container_of(work, struct mwifiex_adapter, devdump_work.work); +struct mwifiex_adapter *adapter =from_timer (adapter, t, devdump_timer);mwifiex_upload_device_dump (adapter); }
@@ -322,7 +321,7 @@ static void mwifiex_init_adapter(struct adapter->active_scan_triggered = false;timer_setup (&adapter->wakeup_timer, wakeup_timer_fn,0 ); adapter->devdump_len =0 ; -INIT_DELAYED_WORK (&adapter->devdump_work, fw_dump_work); +timer_setup (&adapter->devdump_timer, fw_dump_timer_fn,0 ); }/*
@@ -401,7 +400,7 @@ static void mwifiex_adapter_cleanup(struct mwifiex_adapter *adapter) {del_timer (&adapter->wakeup_timer); -cancel_delayed_work_sync (&adapter->devdump_work); +del_timer_sync (&adapter->devdump_timer);mwifiex_cancel_all_pending_cmd (adapter);wake_up_interruptible (&adapter->cmd_wait_q.wait);wake_up_interruptible (&adapter->hs_activate_wait_q);
drivers/net/wireless/marvell/mwifiex/main.h +1 -2
@@ -49,7 +49,6 @@#include <linux/pm_runtime.h> #include <linux/slab.h> #include <linux/of_irq.h> -#include <linux/workqueue.h> #include "decl.h" #include "ioctl.h"
@@ -1056,7 +1055,7 @@ struct mwifiex_adapter {/* Device dump data/length */ void *devdump_data;int devdump_len; -struct delayed_work devdump_work; +struct timer_list devdump_timer;bool ignore_btcoex_events; };
drivers/net/wireless/marvell/mwifiex/sta_event.c +3 -3
@@ -623,8 +623,8 @@ mwifiex_fw_dump_info_event(struct mwifie* transmission event get lost, in this cornel case, * user would still get partial of the dump. */ -schedule_delayed_work (&adapter->devdump_work, -msecs_to_jiffies (MWIFIEX_TIMER_10S )); +mod_timer (&adapter->devdump_timer, + jiffies +msecs_to_jiffies (MWIFIEX_TIMER_10S )); }/* Overflow check */
@@ -643,7 +643,7 @@ mwifiex_fw_dump_info_event(struct mwifiereturn ; upload_dump: -cancel_delayed_work_sync (&adapter->devdump_work); +del_timer_sync (&adapter->devdump_timer);mwifiex_upload_device_dump (adapter); }
Greg Kroah-Hartman
maintainerPATCH 1145/1157 Revert "devcoredump: remove the useless gfp_t parameter in dev_coredumpv and dev_coredumpm"
In reply to Greg Kroah-HartmanFrom: Greg Kroah-Hartman <[email protected]>
commit 38a523a2946d3a0961d141d477a1ee2b1f3bdbb1 upstream.
This reverts commit 77515ebaf01920e2db49e04672ef669a7c2907f2 as it causes build problems in linux-next. It needs to be reintroduced in a way that can allow the api to evolve and not require a "flag day" to catch all users.
--- drivers/base/devcoredump.c | 16 +++++++++------ drivers/bluetooth/btmrvl_sdio.c | 2 - drivers/bluetooth/hci_qca.c | 2 - drivers/gpu/drm/etnaviv/etnaviv_dump.c | 2 - drivers/gpu/drm/msm/disp/msm_disp_snapshot.c | 4 +-- drivers/gpu/drm/msm/msm_gpu.c | 4 +-- drivers/media/platform/qcom/venus/core.c | 2 - drivers/net/can/spi/mcp251xfd/mcp251xfd-dump.c | 2 - drivers/net/wireless/ath/ath10k/coredump.c | 2 - drivers/net/wireless/ath/wil6210/wil_crash_dump.c | 2 - drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.c | 2 - drivers/net/wireless/intel/iwlwifi/fw/dbg.c | 6 +++-- drivers/net/wireless/marvell/mwifiex/main.c | 3 +- drivers/net/wireless/mediatek/mt76/mt7615/mac.c | 3 +- drivers/net/wireless/mediatek/mt76/mt7921/mac.c | 3 +- drivers/net/wireless/realtek/rtw88/main.c | 2 - drivers/net/wireless/realtek/rtw89/ser.c | 2 - drivers/remoteproc/qcom_q6v5_mss.c | 2 - drivers/remoteproc/remoteproc_coredump.c | 8 +++---- include/drm/drm_print.h | 2 - include/linux/devcoredump.h | 13 ++++++------ sound/soc/intel/avs/apl.c | 2 - sound/soc/intel/avs/skl.c | 2 - sound/soc/intel/catpt/dsp.c | 2 - 24 files changed, 50 insertions(+), 40 deletions(-)
drivers/base/devcoredump.c +10 -6
@@ -173,13 +173,15 @@ static void devcd_freev(void *data)* @dev: the struct device for the crashed device * @data: vmalloc data containing the device coredump * @datalen: length of the data +* @gfp: allocation flags * * This function takes ownership of the vmalloc'ed data and will free * it when it is no longer used. See dev_coredumpm() for more information. */ -void dev_coredumpv (struct device *dev,void *data,size_t datalen) +void dev_coredumpv (struct device *dev,void *data,size_t datalen, +gfp_t gfp) { -dev_coredumpm (dev,NULL , data, datalen, devcd_readv, devcd_freev); +dev_coredumpm (dev,NULL , data, datalen, gfp, devcd_readv, devcd_freev); }EXPORT_SYMBOL_GPL (dev_coredumpv);
@@ -234,6 +236,7 @@ static ssize_t devcd_read_from_sgtable(c* @owner: the module that contains the read/free functions, use %THIS_MODULE * @data: data cookie for the @read/@free functions * @datalen: length of the data +* @gfp: allocation flags * @read: function to read from the given buffer * @free: function to free the given buffer *
@@ -243,7 +246,7 @@ static ssize_t devcd_read_from_sgtable(c* function will be called to free the data. */ void dev_coredumpm (struct device *dev,struct module *owner, -void *data,size_t datalen, +void *data,size_t datalen,gfp_t gfp,ssize_t (*read)(char *buffer,loff_t offset,size_t count,void *data,size_t datalen),void (*free)(void *data))
@@ -265,7 +268,7 @@ void dev_coredumpm(struct device *dev, sif (!try_module_get (owner)) goto free; - devcd =kzalloc (sizeof (*devcd),GFP_KERNEL ); + devcd =kzalloc (sizeof (*devcd), gfp);if (!devcd) goto put_module;
@@ -315,6 +318,7 @@ EXPORT_SYMBOL_GPL(dev_coredumpm);* @dev: the struct device for the crashed device * @table: the dump data * @datalen: length of the data +* @gfp: allocation flags * * Creates a new device coredump for the given device. If a previous one hasn't * been read yet, the new coredump is discarded. The data lifetime is determined
@@ -322,9 +326,9 @@ EXPORT_SYMBOL_GPL(dev_coredumpm);* it will free the data. */ void dev_coredumpsg (struct device *dev,struct scatterlist *table, -size_t datalen) +size_t datalen,gfp_t gfp) { -dev_coredumpm (dev,NULL , table, datalen, devcd_read_from_sgtable, +dev_coredumpm (dev,NULL , table, datalen, gfp, devcd_read_from_sgtable, devcd_free_sgtable); }EXPORT_SYMBOL_GPL (dev_coredumpsg);
drivers/bluetooth/btmrvl_sdio.c +1 -1
@@ -1515,7 +1515,7 @@ done:/* fw_dump_data will be free in device coredump release function * after 5 min */ -dev_coredumpv (&card->func->dev, fw_dump_data, fw_dump_len); +dev_coredumpv (&card->func->dev, fw_dump_data, fw_dump_len,GFP_KERNEL );BT_INFO ("== btmrvl firmware dump to /sys/class/devcoredump end" ); }
drivers/bluetooth/hci_qca.c +1 -1
@@ -1120,7 +1120,7 @@ static void qca_controller_memdump(struc qca_memdump->ram_dump_size); memdump_buf = qca_memdump->memdump_buf_head;dev_coredumpv (&hu->serdev->dev, memdump_buf, - qca_memdump->received_dump); + qca_memdump->received_dump,GFP_KERNEL );cancel_delayed_work (&qca->ctrl_memdump_timeout);kfree (qca->qca_memdump); qca->qca_memdump =NULL ;
drivers/gpu/drm/etnaviv/etnaviv_dump.c +1 -1
@@ -225,5 +225,5 @@ void etnaviv_core_dump(struct etnaviv_geetnaviv_core_dump_header (&iter,ETDUMP_BUF_END , iter.data); -dev_coredumpv (gpu->dev, iter.start, iter.data - iter.start); +dev_coredumpv (gpu->dev, iter.start, iter.data - iter.start,GFP_KERNEL ); }
drivers/gpu/drm/msm/disp/msm_disp_snapshot.c +2 -2
@@ -74,8 +74,8 @@ static void _msm_disp_snapshot_work(stru* If there is a codedump pending for the device, the dev_coredumpm() * will also free new coredump state. */ -dev_coredumpm (disp_state->dev,THIS_MODULE , disp_state,0 , - disp_devcoredump_read, msm_disp_state_free); +dev_coredumpm (disp_state->dev,THIS_MODULE , disp_state,0 ,GFP_KERNEL , + disp_devcoredump_read, msm_disp_state_free); }void msm_disp_snapshot_state (struct drm_device *drm_dev)
drivers/gpu/drm/msm/msm_gpu.c +2 -2
@@ -299,8 +299,8 @@ static void msm_gpu_crashstate_capture(s gpu->crashstate = state;/* FIXME: Release the crashstate if this errors out? */ -dev_coredumpm (gpu->dev->dev,THIS_MODULE , gpu,0 , - msm_gpu_devcoredump_read, msm_gpu_devcoredump_free); +dev_coredumpm (gpu->dev->dev,THIS_MODULE , gpu,0 ,GFP_KERNEL , + msm_gpu_devcoredump_read, msm_gpu_devcoredump_free); }#else static void msm_gpu_crashstate_capture(struct msm_gpu *gpu,
drivers/media/platform/qcom/venus/core.c +1 -1
@@ -49,7 +49,7 @@ static void venus_coredump(struct venus_memcpy (data, mem_va, mem_size);memunmap (mem_va); -dev_coredumpv (dev, data, mem_size); +dev_coredumpv (dev, data, mem_size,GFP_KERNEL ); }static void venus_event_notify (struct venus_core *core,u32 event)
drivers/net/can/spi/mcp251xfd/mcp251xfd-dump.c +1 -1
@@ -281,5 +281,5 @@ void mcp251xfd_dump(const struct mcp251xmcp251xfd_dump_end (priv, &iter);dev_coredumpv (&priv->spi->dev, iter.start, - iter.data - iter.start); + iter.data - iter.start,GFP_KERNEL ); }
drivers/net/wireless/ath/ath10k/coredump.c +1 -1
@@ -1607,7 +1607,7 @@ int ath10k_coredump_submit(struct ath10kreturn -ENODATA ; } -dev_coredumpv (ar->dev, dump,le32_to_cpu (dump->len)); +dev_coredumpv (ar->dev, dump,le32_to_cpu (dump->len),GFP_KERNEL );return 0 ; }
drivers/net/wireless/ath/wil6210/wil_crash_dump.c +1 -1
@@ -117,6 +117,6 @@ void wil_fw_core_dump(struct wil6210_pri/* fw_dump_data will be free in device coredump release function * after 5 min */ -dev_coredumpv (wil_to_dev (wil), fw_dump_data, fw_dump_size); +dev_coredumpv (wil_to_dev (wil), fw_dump_data, fw_dump_size,GFP_KERNEL );wil_info (wil,"fw core dumped, size %d bytes\n" , fw_dump_size); }
drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.c +1 -1
@@ -37,7 +37,7 @@ int brcmf_debug_create_memdump(struct brreturn err; } -dev_coredumpv (bus->dev, dump, len + ramsize); +dev_coredumpv (bus->dev, dump, len + ramsize,GFP_KERNEL );return 0 ; }
drivers/net/wireless/intel/iwlwifi/fw/dbg.c +4 -2
@@ -2601,7 +2601,8 @@ static void iwl_fw_error_dump(struct iwl fw_error_dump.trans_ptr->data, fw_error_dump.trans_ptr->len, fw_error_dump.fwrt_len); -dev_coredumpsg (fwrt->trans->dev, sg_dump_data, file_len); +dev_coredumpsg (fwrt->trans->dev, sg_dump_data, file_len, +GFP_KERNEL ); }vfree (fw_error_dump.fwrt_ptr);vfree (fw_error_dump.trans_ptr);
@@ -2646,7 +2647,8 @@ static void iwl_fw_error_ini_dump(struct entry->data, entry->size, offs); offs += entry->size; } -dev_coredumpsg (fwrt->trans->dev, sg_dump_data, file_len); +dev_coredumpsg (fwrt->trans->dev, sg_dump_data, file_len, +GFP_KERNEL ); }iwl_dump_ini_list_free (&dump_list); }
drivers/net/wireless/marvell/mwifiex/main.c +2 -1
@@ -1115,7 +1115,8 @@ void mwifiex_upload_device_dump(struct m*/ mwifiex_dbg (adapter,MSG ,"== mwifiex dump information to /sys/class/devcoredump start\n" ); -dev_coredumpv (adapter->dev, adapter->devdump_data, adapter->devdump_len); +dev_coredumpv (adapter->dev, adapter->devdump_data, adapter->devdump_len, +GFP_KERNEL );mwifiex_dbg (adapter,MSG ,"== mwifiex dump information to /sys/class/devcoredump end\n" );
drivers/net/wireless/mediatek/mt76/mt7615/mac.c +2 -1
@@ -2422,5 +2422,6 @@ void mt7615_coredump_work(struct work_stdev_kfree_skb (skb); } -dev_coredumpv (dev->mt76.dev, dump,MT76_CONNAC_COREDUMP_SZ ); +dev_coredumpv (dev->mt76.dev, dump,MT76_CONNAC_COREDUMP_SZ , +GFP_KERNEL ); }
drivers/net/wireless/mediatek/mt76/mt7921/mac.c +2 -1
@@ -1419,7 +1419,8 @@ void mt7921_coredump_work(struct work_st }if (dump) -dev_coredumpv (dev->mt76.dev, dump,MT76_CONNAC_COREDUMP_SZ ); +dev_coredumpv (dev->mt76.dev, dump,MT76_CONNAC_COREDUMP_SZ , +GFP_KERNEL );mt7921_reset (&dev->mt76); }
drivers/net/wireless/realtek/rtw88/main.c +1 -1
@@ -414,7 +414,7 @@ static void rtw_fwcd_dump(struct rtw_dev* framework. Note that a new dump will be discarded if a previous one * hasn't been released yet. */ -dev_coredumpv (rtwdev->dev, desc->data, desc->size); +dev_coredumpv (rtwdev->dev, desc->data, desc->size,GFP_KERNEL ); }static void rtw_fwcd_free (struct rtw_dev *rtwdev,bool free_self)
drivers/net/wireless/realtek/rtw89/ser.c +1 -1
@@ -127,7 +127,7 @@ static void rtw89_ser_cd_send(struct rtw* will be discarded if a previous one hasn't been released by * framework yet. */ -dev_coredumpv (rtwdev->dev, buf,sizeof (*buf)); +dev_coredumpv (rtwdev->dev, buf,sizeof (*buf),GFP_KERNEL ); } static void rtw89_ser_cd_free(struct rtw89_dev *rtwdev,
drivers/remoteproc/qcom_q6v5_mss.c +1 -1
@@ -597,7 +597,7 @@ static void q6v5_dump_mba_logs(struct q6 data =vmalloc (MBA_LOG_SIZE );if (data) {memcpy (data, mba_region,MBA_LOG_SIZE ); -dev_coredumpv (&rproc->dev, data,MBA_LOG_SIZE ); +dev_coredumpv (&rproc->dev, data,MBA_LOG_SIZE ,GFP_KERNEL ); }memunmap (mba_region); }
drivers/remoteproc/remoteproc_coredump.c +4 -4
@@ -309,7 +309,7 @@ void rproc_coredump(struct rproc *rproc) phdr +=elf_size_of_phdr (class); }if (dump_conf ==RPROC_COREDUMP_ENABLED ) { -dev_coredumpv (&rproc->dev, data, data_size); +dev_coredumpv (&rproc->dev, data, data_size,GFP_KERNEL );return ; }
@@ -318,7 +318,7 @@ void rproc_coredump(struct rproc *rproc) dump_state.header = data;init_completion (&dump_state.dump_done); -dev_coredumpm (&rproc->dev,NULL , &dump_state, data_size, +dev_coredumpm (&rproc->dev,NULL , &dump_state, data_size,GFP_KERNEL , rproc_coredump_read, rproc_coredump_free);/*
@@ -449,7 +449,7 @@ void rproc_coredump_using_sections(struc }if (dump_conf ==RPROC_COREDUMP_ENABLED ) { -dev_coredumpv (&rproc->dev, data, data_size); +dev_coredumpv (&rproc->dev, data, data_size,GFP_KERNEL );return ; }
@@ -458,7 +458,7 @@ void rproc_coredump_using_sections(struc dump_state.header = data;init_completion (&dump_state.dump_done); -dev_coredumpm (&rproc->dev,NULL , &dump_state, data_size, +dev_coredumpm (&rproc->dev,NULL , &dump_state, data_size,GFP_KERNEL , rproc_coredump_read, rproc_coredump_free);/* Wait until the dump is read and free is called. Data is freed
include/drm/drm_print.h +1 -1
@@ -162,7 +162,7 @@ struct drm_print_iterator {* void makecoredump(...) * { * ... -* dev_coredumpm(dev, THIS_MODULE, data, 0, +* dev_coredumpm(dev, THIS_MODULE, data, 0, GFP_KERNEL, * coredump_read, ...) * } *
include/linux/devcoredump.h +7 -6
@@ -52,26 +52,27 @@ static inline void _devcd_free_sgtable(s#ifdef CONFIG_DEV_COREDUMP -void dev_coredumpv (struct device *dev,void *data,size_t datalen); +void dev_coredumpv (struct device *dev,void *data,size_t datalen, +gfp_t gfp);void dev_coredumpm (struct device *dev,struct module *owner, -void *data,size_t datalen, +void *data,size_t datalen,gfp_t gfp,ssize_t (*read)(char *buffer,loff_t offset,size_t count,void *data,size_t datalen),void (*free)(void *data));void dev_coredumpsg (struct device *dev,struct scatterlist *table, -size_t datalen); +size_t datalen,gfp_t gfp);#else static inline void dev_coredumpv (struct device *dev,void *data, -size_t datalen) +size_t datalen,gfp_t gfp) {vfree (data); }static inline void dev_coredumpm (struct device *dev,struct module *owner, -void *data,size_t datalen, +void *data,size_t datalen,gfp_t gfp,ssize_t (*read)(char *buffer,loff_t offset,size_t count,void *data,size_t datalen),void (*free)(void *data))
@@ -80,7 +81,7 @@ dev_coredumpm(struct device *dev, struct }static inline void dev_coredumpsg (struct device *dev,struct scatterlist *table, -size_t datalen) +size_t datalen,gfp_t gfp) {_devcd_free_sgtable (table); }
sound/soc/intel/avs/apl.c +1 -1
@@ -164,7 +164,7 @@ static int apl_coredump(struct avs_dev * }while (offset < msg->ext.coredump.stack_dump_size); exit: -dev_coredumpv (adev->dev, dump, dump_size); +dev_coredumpv (adev->dev, dump, dump_size,GFP_KERNEL );return 0 ; }
sound/soc/intel/avs/skl.c +1 -1
@@ -88,7 +88,7 @@ static int skl_coredump(struct avs_dev *return -ENOMEM ;memcpy_fromio (dump,avs_sram_addr (adev,AVS_FW_REGS_WINDOW ),AVS_FW_REGS_SIZE ); -dev_coredumpv (adev->dev, dump,AVS_FW_REGS_SIZE ); +dev_coredumpv (adev->dev, dump,AVS_FW_REGS_SIZE ,GFP_KERNEL );return 0 ; }
sound/soc/intel/catpt/dsp.c +1 -1
@@ -539,7 +539,7 @@ int catpt_coredump(struct catpt_dev *cde pos +=CATPT_DMA_REGS_SIZE ; } -dev_coredumpv (cdev->dev, dump, dump_size); +dev_coredumpv (cdev->dev, dump, dump_size,GFP_KERNEL );return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 1146/1157 mptcp: refine memory scheduling
In reply to Greg Kroah-HartmanFrom: Paolo Abeni <[email protected]>
commit 69d93daec026cdda98e29e8edb12534bfa5b1a9b upstream.
Similar to commit 7c80b038d23e ("net: fix sk_wmem_schedule() and sk_rmem_schedule() errors"), let the MPTCP receive path schedule exactly the required amount of memory.
--- net/mptcp/protocol.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/mptcp/protocol.c +2 -1
@@ -323,9 +323,10 @@ static bool mptcp_rmem_schedule(struct sstruct mptcp_sock *msk =mptcp_sk (sk);int amt, amount; -if (size < msk->rmem_fwd_alloc) +if (size <= msk->rmem_fwd_alloc)return true; + size -= msk->rmem_fwd_alloc; amt =sk_mem_pages (size); amount = amt <<SK_MEM_QUANTUM_SHIFT ; msk->rmem_fwd_alloc += amount;
Greg Kroah-Hartman
maintainerPATCH 1147/1157 wifi: cfg80211: handle IBSS in channel switch
In reply to Greg Kroah-HartmanFrom: Johannes Berg <[email protected]>
commit 77e7b6ba78edf817bddfa97fadb15a971992b1ee upstream.
Prior to commit 7b0a0e3c3a88 ("wifi: cfg80211: do some rework towards MLO link APIs") the interface type didn't really matter here, but now we need to handle all of the possible cases. Add IBSS ("ADHOC") and handle it.
--- net/wireless/nl80211.c | 3 +++ 1 file changed, 3 insertions(+)
net/wireless/nl80211.c +3 -0
@@ -18294,6 +18294,9 @@ void cfg80211_ch_switch_notify(struct necase NL80211_IFTYPE_P2P_GO : wdev->links[link_id].ap.chandef = *chandef;break ; +case NL80211_IFTYPE_ADHOC : + wdev->u.ibss.chandef = *chandef; +break ;default :WARN_ON (1 );break ;
Greg Kroah-Hartman
maintainerPATCH 1148/1157 wifi: nl80211: hold wdev mutex for tid config
In reply to Greg Kroah-HartmanFrom: Johannes Berg <[email protected]>
commit 206bbcf76121664e95a42e1c014c3fe168d07a3d upstream.
We need wdev_chandef() in this code, which now requires the wdev mutex due to the per-link nature. Hold it here to make sure we can access the link.
--- net/wireless/nl80211.c | 3 +++ 1 file changed, 3 insertions(+)
net/wireless/nl80211.c +3 -0
@@ -15285,6 +15285,8 @@ static int nl80211_set_tid_config(structif (info->attrs[NL80211_ATTR_MAC ]) tid_config->peer =nla_data (info->attrs[NL80211_ATTR_MAC ]); +wdev_lock (dev->ieee80211_ptr); +nla_for_each_nested (tid, info->attrs[NL80211_ATTR_TID_CONFIG ], rem_conf) { ret = nla_parse_nested(attrs, NL80211_TID_CONFIG_ATTR_MAX,
@@ -15306,6 +15308,7 @@ static int nl80211_set_tid_config(struct bad_tid_conf:kfree (tid_config); +wdev_unlock (dev->ieee80211_ptr);return ret; }
Greg Kroah-Hartman
maintainerPATCH 1149/1157 wifi: nl80211: relax wdev mutex check in wdev_chandef()
In reply to Greg Kroah-HartmanFrom: Johannes Berg <[email protected]>
commit 31177127e067eb73d5ca46ce32a410e41333d42f upstream.
In many cases we might get here from driver code that's not really set up to care about the locking, and for the non-MLO cases we really don't care so much about it. So relax the checking here for now, perhaps we should even remove it completely since we might not really care if we point to an invalid link's chandef and can require the caller to check the link validity first.
--- net/wireless/chan.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
net/wireless/chan.c +11 -1
@@ -1433,7 +1433,17 @@ EXPORT_SYMBOL(cfg80211_any_usable_channestruct cfg80211_chan_def *wdev_chandef (struct wireless_dev *wdev,unsigned int link_id) { -ASSERT_WDEV_LOCK (wdev); +/* +* We need to sort out the locking here - in some cases +* where we get here we really just don't care (yet) +* about the valid links, but in others we do. But we +* get here with various driver cases, so we cannot +* easily require the wdev mutex. +*/ +if (link_id || wdev->valid_links &BIT (0 )) { +ASSERT_WDEV_LOCK (wdev); +WARN_ON (!(wdev->valid_links &BIT (link_id))); + }switch (wdev->iftype) {case NL80211_IFTYPE_MESH_POINT :
Greg Kroah-Hartman
maintainerPATCH 1150/1157 wifi: nl80211: acquire wdev mutex earlier in start_ap
In reply to Greg Kroah-HartmanFrom: Johannes Berg <[email protected]>
commit c2653990d5729a445296d6d04395be5dea8e282e upstream.
We need to hold the wdev mutex already in order to call nl80211_parse_tx_bitrate_mask(), so acquire it earlier.
--- net/wireless/nl80211.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-)
net/wireless/nl80211.c +13 -12
@@ -5747,18 +5747,20 @@ static int nl80211_start_ap(struct sk_bu goto out; } +wdev_lock (wdev); +if (info->attrs[NL80211_ATTR_TX_RATES ]) { err =nl80211_parse_tx_bitrate_mask (info, info->attrs,NL80211_ATTR_TX_RATES , ¶ms->beacon_rate, dev, false, link_id);if (err) - goto out; + goto out_unlock; err =validate_beacon_tx_rate (rdev, params->chandef.chan->band, ¶ms->beacon_rate);if (err) - goto out; + goto out_unlock; }if (info->attrs[NL80211_ATTR_SMPS_MODE ]) {
@@ -5771,19 +5773,19 @@ static int nl80211_start_ap(struct sk_buif (!(rdev->wiphy.features &NL80211_FEATURE_STATIC_SMPS )) { err = -EINVAL ; - goto out; + goto out_unlock; }break ;case NL80211_SMPS_DYNAMIC :if (!(rdev->wiphy.features &NL80211_FEATURE_DYNAMIC_SMPS )) { err = -EINVAL ; - goto out; + goto out_unlock; }break ;default : err = -EINVAL ; - goto out; + goto out_unlock; } }else { params->smps_mode =NL80211_SMPS_OFF ;
@@ -5792,7 +5794,7 @@ static int nl80211_start_ap(struct sk_bu params->pbss =nla_get_flag (info->attrs[NL80211_ATTR_PBSS ]);if (params->pbss && !rdev->wiphy.bands[NL80211_BAND_60GHZ ]) { err = -EOPNOTSUPP ; - goto out; + goto out_unlock; }if (info->attrs[NL80211_ATTR_ACL_POLICY ]) {
@@ -5800,7 +5802,7 @@ static int nl80211_start_ap(struct sk_buif (IS_ERR (params->acl)) { err =PTR_ERR (params->acl); params->acl =NULL ; - goto out; + goto out_unlock; } }
@@ -5812,7 +5814,7 @@ static int nl80211_start_ap(struct sk_bu info->attrs[NL80211_ATTR_HE_OBSS_PD ], ¶ms->he_obss_pd);if (err) - goto out; + goto out_unlock; }if (info->attrs[NL80211_ATTR_FILS_DISCOVERY ]) {
@@ -5820,7 +5822,7 @@ static int nl80211_start_ap(struct sk_bu info->attrs[NL80211_ATTR_FILS_DISCOVERY ], params);if (err) - goto out; + goto out_unlock; }if (info->attrs[NL80211_ATTR_UNSOL_BCAST_PROBE_RESP ]) {
@@ -5828,7 +5830,7 @@ static int nl80211_start_ap(struct sk_bu rdev, info->attrs[NL80211_ATTR_UNSOL_BCAST_PROBE_RESP ], params);if (err) - goto out; + goto out_unlock; }if (info->attrs[NL80211_ATTR_MBSSID_CONFIG ]) {
@@ -5839,7 +5841,7 @@ static int nl80211_start_ap(struct sk_bu params->beacon.mbssid_ies->cnt : 0);if (err) - goto out; + goto out_unlock; }nl80211_calculate_ap_params (params);
@@ -5850,7 +5852,6 @@ static int nl80211_start_ap(struct sk_buelse if (info->attrs[NL80211_ATTR_EXTERNAL_AUTH_SUPPORT ]) params->flags |=NL80211_AP_SETTINGS_EXTERNAL_AUTH_SUPPORT ; -wdev_lock (wdev);if (wdev->conn_owner_nlportid && info->attrs[NL80211_ATTR_SOCKET_OWNER ] && wdev->conn_owner_nlportid != info->snd_portid) {
Greg Kroah-Hartman
maintainerPATCH 1151/1157 wifi: cfg80211: remove chandef check in cfg80211_cac_event()
In reply to Greg Kroah-HartmanFrom: Johannes Berg <[email protected]>
commit d6f671c8a339d5b655acfacb8be6918c744fbabf upstream.
The current check only worked for AP mode, but we can do radar detection in mesh as well (for example). We could try to check this using wdev_chandef(), but we also don't really care since the chandef is passed in and we have no need to use it anymore (since we added the argument in commit d2859df5e7f0 ("cfg80211/mac80211: DFS setup chandef for cac event")).
--- net/wireless/mlme.c | 3 --- 1 file changed, 3 deletions(-)
net/wireless/mlme.c +0 -3
@@ -955,9 +955,6 @@ void cfg80211_cac_event(struct net_devicif (WARN_ON (!wdev->cac_started && event !=NL80211_RADAR_CAC_STARTED ))return ; -if (WARN_ON (!wdev->links[0 ].ap.chandef.chan)) -return ; -switch (event) {case NL80211_RADAR_CAC_FINISHED : timeout = wdev->cac_start_time +
Greg Kroah-Hartman
maintainerPATCH 1152/1157 tracing: Use a copy of the va_list for __assign_vstr()
In reply to Greg Kroah-HartmanFrom: Steven Rostedt (Google) <[email protected]>
commit 3a2dcbaf4d31023106975d6ae75b6df080c454cb upstream.
If an instance of tracing enables the same trace event as another instance, or the top level instance, or even perf, then the va_list passed into some tracepoints can be used more than once.
As va_list can only be traversed once, this can cause issues:
# cat /sys/kernel/tracing/instances/qla2xxx/trace
cat-56106 [012] ..... 2419873.470098: ql_dbg_log: qla2xxx [0000:05:00.0]-1054:14: Entered (null).
cat-56106 [012] ..... 2419873.470101: ql_dbg_log: qla2xxx [0000:05:00.0]-1000:14: Entered ×+<96>²Ü<98>^H.
cat-56106 [012] ..... 2419873.470102: ql_dbg_log: qla2xxx [0000:05:00.0]-1006:14: Prepare to issue mbox cmd=0xde589000. # cat /sys/kernel/tracing/trace
cat-56106 [012] ..... 2419873.470097: ql_dbg_log: qla2xxx [0000:05:00.0]-1054:14: Entered qla2x00_get_firmware_state.
cat-56106 [012] ..... 2419873.470100: ql_dbg_log: qla2xxx [0000:05:00.0]-1000:14: Entered qla2x00_mailbox_command.
cat-56106 [012] ..... 2419873.470102: ql_dbg_log: qla2xxx [0000:05:00.0]-1006:14: Prepare to issue mbox cmd=0x69.The instance version is corrupted because the top level instance iterated the va_list first.
Use va_copy() in the __assign_vstr() macro to make sure that each trace event for each use case gets a fresh va_list.
--- include/trace/stages/stage6_event_callback.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
include/trace/stages/stage6_event_callback.h +6 -1
@@ -40,7 +40,12 @@#undef __assign_vstr#define __assign_vstr (dst, fmt, va) \ - vsnprintf(__get_str(dst), TRACE_EVENT_STR_MAX, fmt, *(va)) + do { \ + va_list __cp_va; \ + va_copy(__cp_va, *(va)); \ + vsnprintf(__get_str(dst), TRACE_EVENT_STR_MAX, fmt, __cp_va); \ + va_end(__cp_va); \ + } while (0)#undef __bitmask#define __bitmask (item, nr_bits) __dynamic_array(unsigned long, item, -1)
Greg Kroah-Hartman
maintainerPATCH 1153/1157 net: dsa: felix: fix min gate len calculation for tc when its first gate is closed
In reply to Greg Kroah-HartmanFrom: Vladimir Oltean <[email protected]>
commit 7e4babffa6f340a74c820d44d44d16511e666424 upstream.
min_gate_len[tc] is supposed to track the shortest interval of continuously open gates for a traffic class. For example, in the following case:
TC 76543210
t0 00000001b 200000 ns
t1 00000010b 200000 ns
min_gate_len[0] and min_gate_len[1] should be 200000, while min_gate_len[2-7] should be 0.
However what happens is that min_gate_len[0] is 200000, but min_gate_len[1] ends up being 0 (despite gate_len[1] being 200000 at the point where the logic detects the gate close event for TC 1).
The problem is that the code considers a "gate close" event whenever it sees that there is a 0 for that TC (essentially it's level rather than edge triggered). By doing that, any time a gate is seen as closed without having been open prior, gate_len, which is 0, will be written into min_gate_len. Once min_gate_len becomes 0, it's impossible for it to track anything higher than that (the length of actually open intervals).
To fix this, we make the writing to min_gate_len[tc] be edge-triggered, which avoids writes for gates that are closed in consecutive intervals. However what this does is it makes us need to special-case the permanently closed gates at the end.
--- drivers/net/dsa/ocelot/felix_vsc9959.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
drivers/net/dsa/ocelot/felix_vsc9959.c +14 -1
@@ -1136,6 +1136,7 @@ static void vsc9959_tas_min_gate_lengths {struct tc_taprio_sched_entry *entry;u64 gate_len[OCELOT_NUM_TC ]; +u8 gates_ever_opened =0 ;int tc, i, n;/* Initialize arrays */
@@ -1163,16 +1164,28 @@ static void vsc9959_tas_min_gate_lengthsfor (tc =0 ; tc <OCELOT_NUM_TC ; tc++) {if (entry->gate_mask &BIT (tc)) { gate_len[tc] += entry->interval; + gates_ever_opened |=BIT (tc); }else {/* Gate closes now, record a potential new * minimum and reinitialize length */ -if (min_gate_len[tc] > gate_len[tc]) +if (min_gate_len[tc] > gate_len[tc] && + gate_len[tc]) min_gate_len[tc] = gate_len[tc]; gate_len[tc] =0 ; } } } + +/* min_gate_len[tc] actually tracks minimum *open* gate time, so for +* permanently closed gates, min_gate_len[tc] will still be U64_MAX. +* Therefore they are currently indistinguishable from permanently +* open gates. Overwrite the gate len with 0 when we know they're +* actually permanently closed, i.e. after the loop above. +*/ +for (tc =0 ; tc <OCELOT_NUM_TC ; tc++) +if (!(gates_ever_opened &BIT (tc))) + min_gate_len[tc] =0 ; }/* Update QSYS_PORT_MAX_SDU to make sure the static guard bands added by the
Greg Kroah-Hartman
maintainerPATCH 1154/1157 Revert "s390/smp: enforce lowcore protection on CPU restart"
In reply to Greg Kroah-HartmanFrom: Alexander Gordeev <[email protected]>
commit 953503751a426413ea8aee2299ae3ee971b70d9b upstream.
This reverts commit 6f5c672d17f583b081e283927f5040f726c54598.
This breaks normal crash dump when CPU0 is offline.
--- arch/s390/kernel/setup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/s390/kernel/setup.c +1 -1
@@ -508,8 +508,8 @@ static void __init setup_lowcore_dat_on( S390_lowcore.svc_new_psw.mask |=PSW_MASK_DAT ; S390_lowcore.program_new_psw.mask |=PSW_MASK_DAT ; S390_lowcore.io_new_psw.mask |=PSW_MASK_DAT ; -__ctl_set_bit (0 ,28 );__ctl_store (S390_lowcore.cregs_save_area,0 ,15 ); +__ctl_set_bit (0 ,28 );put_abs_lowcore (restart_flags,RESTART_FLAG_CTLREGS );put_abs_lowcore (program_new_psw, lc->program_new_psw);for (cr =0 ; cr <ARRAY_SIZE (lc->cregs_save_area); cr++)
Greg Kroah-Hartman
maintainerPATCH 1155/1157 powerpc/kexec: Fix build failure from uninitialised variable
In reply to Greg Kroah-HartmanFrom: Russell Currey <[email protected]>
commit 83ee9f23763a432a4077bf20624ee35de87bce99 upstream.
clang 14 won't build because ret is uninitialised and can be returned if both prop and fdtprop are NULL. Drop the ret variable and return an error in that failure case.
--- arch/powerpc/kexec/file_load_64.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
arch/powerpc/kexec/file_load_64.c +5 -5
@@ -1043,17 +1043,17 @@ static int copy_property(void *fdt, int const char *propname) {const void *prop, *fdtprop; -int len =0 , fdtlen =0 , ret; +int len =0 , fdtlen =0 ; prop =of_get_property (dn, propname, &len); fdtprop =fdt_getprop (fdt, node_offset, propname, &fdtlen);if (fdtprop && !prop) - ret =fdt_delprop (fdt, node_offset, propname); +return fdt_delprop (fdt, node_offset, propname);else if (prop) - ret =fdt_setprop (fdt, node_offset, propname, prop, len); - -return ret; +return fdt_setprop (fdt, node_offset, propname, prop, len); +else +return -FDT_ERR_NOTFOUND ; }static int update_pci_dma_nodes (void *fdt,const char *dmapropname)
Greg Kroah-Hartman
maintainerPATCH 1156/1157 io_uring: mem-account pbuf buckets
In reply to Greg Kroah-HartmanFrom: Pavel Begunkov <[email protected]>
commit cc18cc5e82033d406f54144ad6f8092206004684 upstream.
Potentially, someone may create as many pbuf bucket as there are indexes in an xarray without any other restrictions bounding our memory usage, put memory needed for the buckets under memory accounting.
--- io_uring/io_uring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
io_uring/io_uring.c +1 -1
@@ -5520,7 +5520,7 @@ static int io_provide_buffers(struct io_ bl =io_buffer_get_list (ctx, p->bgid);if (unlikely (!bl)) { - bl =kzalloc (sizeof (*bl),GFP_KERNEL ); + bl =kzalloc (sizeof (*bl),GFP_KERNEL_ACCOUNT );if (!bl) { ret = -ENOMEM ; goto err;
Greg Kroah-Hartman
maintainerPATCH 1157/1157 Bluetooth: L2CAP: Fix l2cap_global_chan_by_psm regression
In reply to Greg Kroah-HartmanFrom: Luiz Augusto von Dentz <[email protected]>
commit 332f1795ca202489c665a75e62e18ff6284de077 upstream.
The patch d0be8347c623: "Bluetooth: L2CAP: Fix use-after-free caused by l2cap_chan_put" from Jul 21, 2022, leads to the following Smatch static checker warning:
net/bluetooth/l2cap_core.c:1977 l2cap_global_chan_by_psm()
error: we previously assumed 'c' could be null (see line 1996)
--- net/bluetooth/l2cap_core.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
net/bluetooth/l2cap_core.c +6 -7
@@ -1969,11 +1969,11 @@ static struct l2cap_chan *l2cap_global_c bdaddr_t *dst, u8 link_type) { -struct l2cap_chan *c, *c1 =NULL ; +struct l2cap_chan *c, *tmp, *c1 =NULL ;read_lock (&chan_list_lock); -list_for_each_entry (c, &chan_list, global_l) { +list_for_each_entry_safe (c, tmp, &chan_list, global_l) {if (state && c->state != state)continue ;
@@ -1992,11 +1992,10 @@ static struct l2cap_chan *l2cap_global_c dst_match = !bacmp (&c->dst, dst);if (src_match && dst_match) { c =l2cap_chan_hold_unless_zero (c); -if (!c) -continue ; - -read_unlock (&chan_list_lock); -return c; +if (c) { +read_unlock (&chan_list_lock); +return c; + } }/* Closest match */
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.19.2 release. There are 1157 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 17 Aug 2022 18:01:29 +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.19.2-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.19.y
and the diffstat can be found below.thanks,
greg k-h
The arm64 clang-14 allmodconfig failed on stable-rc 5.19. This build failure got fixed on the mainline tree two weeks ago.
* arm64, build
- clang-12-allmodconfig
- clang-13-allmodconfig
- clang-14-allmodconfig
- clang-nightly-allmodconfig
make --silent --keep-going --jobs=8 O=/home/tuxbuild/.cache/tuxmake/builds/2/build LLVM=1 LLVM_IAS=1 ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- 'HOSTCC=sccache clang' 'CC=sccache clang' allmodconfig
make --silent --keep-going --jobs=8 O=/home/tuxbuild/.cache/tuxmake/builds/2/build LLVM=1 LLVM_IAS=1 ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- 'HOSTCC=sccache clang' 'CC=sccache clang'sound/soc/intel/avs/path.c:815:18: error: stack frame size (2192) exceeds limit (2048) in 'avs_path_create' [-Werror,-Wframe-larger-than]
struct avs_path *avs_path_create(struct avs_dev *adev, u32 dma_id,
^
1 error generated.
make[5]: *** [/builds/linux/scripts/Makefile.build:249:sound/soc/intel/avs/path.o] Error 1
Steps to reproduce:
-------------------------
# See https://docs.tuxmake.org/ for complete documentation. # Original tuxmake command with fragments listed below.
# tuxmake --runtime podman --target-arch arm64 --toolchain clang-14 --kconfig allmodconfig LLVM=1 LLVM_IAS=1
tuxmake --runtime podman --target-arch arm64 --toolchain clang-14 --kconfig https://builds.tuxbuild.com/2DPEiUmdALSZq7DeNthZFYoPLaN/config
LLVM=1 LLVM_IAS=1
--
Linaro LKFT
https://lkft.linaro.org
Greg Kroah-Hartman
maintainerQuoted 54 lines · Naresh Kamboju
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.19.2 release. There are 1157 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 17 Aug 2022 18:01:29 +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.19.2-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.19.y
and the diffstat can be found below.thanks,
greg k-h
The arm64 clang-14 allmodconfig failed on stable-rc 5.19. This build failure got fixed on the mainline tree two weeks ago.
* arm64, build
- clang-12-allmodconfig
- clang-13-allmodconfig
- clang-14-allmodconfig
- clang-nightly-allmodconfigmake --silent --keep-going --jobs=8 O=/home/tuxbuild/.cache/tuxmake/builds/2/build LLVM=1 LLVM_IAS=1 ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- 'HOSTCC=sccache clang' 'CC=sccache clang' allmodconfig
make --silent --keep-going --jobs=8 O=/home/tuxbuild/.cache/tuxmake/builds/2/build LLVM=1 LLVM_IAS=1 ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- 'HOSTCC=sccache clang' 'CC=sccache clang'sound/soc/intel/avs/path.c:815:18: error: stack frame size (2192) exceeds limit (2048) in 'avs_path_create' [-Werror,-Wframe-larger-than]
structavs_path*avs_path_create(structavs_dev*adev, u32dma_id,^1 error generated.
make[5]: *** [/builds/linux/scripts/Makefile.build:249:sound/soc/intel/avs/path.o] Error 1Steps to reproduce:
-------------------------
# See https://docs.tuxmake.org/ for complete documentation. # Original tuxmake command with fragments listed below.
Quoted 6 lines
# tuxmake --runtime podman --target-arch arm64 --toolchain clang-14 --kconfig allmodconfig LLVM=1 LLVM_IAS=1tuxmake --runtime podman --target-arch arm64 --toolchain clang-14 --kconfig https://builds.tuxbuild.com/2DPEiUmdALSZq7DeNthZFYoPLaN/config
LLVM=1 LLVM_IAS=1
What is the commit on mainline that resolved this issue?
thanks,
greg k-h
Naresh Kamboju
Reviewed-by Cezary RojewskiQuoted 59 lines · Greg Kroah-Hartman
Quoted 57 lines · Naresh Kamboju
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.19.2 release. There are 1157 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 17 Aug 2022 18:01:29 +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.19.2-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.19.y
and the diffstat can be found below.thanks,
greg k-h
The arm64 clang-14 allmodconfig failed on stable-rc 5.19. This build failure got fixed on the mainline tree two weeks ago.
* arm64, build
- clang-12-allmodconfig
- clang-13-allmodconfig
- clang-14-allmodconfig
- clang-nightly-allmodconfigmake --silent --keep-going --jobs=8 O=/home/tuxbuild/.cache/tuxmake/builds/2/build LLVM=1 LLVM_IAS=1 ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- 'HOSTCC=sccache clang' 'CC=sccache clang' allmodconfig
make --silent --keep-going --jobs=8 O=/home/tuxbuild/.cache/tuxmake/builds/2/build LLVM=1 LLVM_IAS=1 ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- 'HOSTCC=sccache clang' 'CC=sccache clang'sound/soc/intel/avs/path.c:815:18: error: stack frame size (2192) exceeds limit (2048) in 'avs_path_create' [-Werror,-Wframe-larger-than]
structavs_path*avs_path_create(structavs_dev*adev, u32dma_id,^1 error generated.
make[5]: *** [/builds/linux/scripts/Makefile.build:249:sound/soc/intel/avs/path.o] Error 1Steps to reproduce:
-------------------------
# See https://docs.tuxmake.org/ for complete documentation. # Original tuxmake command with fragments listed below.# tuxmake --runtime podman --target-arch arm64 --toolchain clang-14 --kconfig allmodconfig LLVM=1 LLVM_IAS=1
Quoted 5 lines
Quoted 3 lines
tuxmake --runtime podman --target-arch arm64 --toolchain clang-14 --kconfig https://builds.tuxbuild.com/2DPEiUmdALSZq7DeNthZFYoPLaN/config
LLVM=1 LLVM_IAS=1What is the commit on mainline that resolved this issue?
commit 1e744351bcb9c4cee81300de5a6097100d835386
Author: Amadeusz Sławiński <[email protected]> Date: Fri Jul 22 13:19:59 2022 +0200
ASoC: Intel: avs: Use lookup table to create modules
As reported by Nathan, when building avs driver using clang with:
CONFIG_COMPILE_TEST=y
CONFIG_FORTIFY_SOURCE=y
CONFIG_KASAN=y
CONFIG_PCI=y
CONFIG_SOUND=y
CONFIG_SND=y
CONFIG_SND_SOC=y
CONFIG_SND_SOC_INTEL_AVS=y
there are reports of too big stack use, like:
sound/soc/intel/avs/path.c:815:18: error: stack frame size
(2176) exceeds limit (2048) in 'avs_path_create' [-Werror,-Wframe-larger-than]
struct avs_path *avs_path_create(struct avs_dev *adev, u32 dma_id,
^
1 error generated.
This is apparently caused by inlining many calls to guid_equal which inlines fortified memcpy, using 2 size_t variables.
Instead of hardcoding many calls to guid_equal, use lookup table with one call, this improves stack usage.
- Naresh
Greg Kroah-Hartman
maintainerQuoted 97 lines · Naresh Kamboju
Quoted 59 lines · Greg Kroah-Hartman
Quoted 57 lines · Naresh Kamboju
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.19.2 release. There are 1157 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 17 Aug 2022 18:01:29 +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.19.2-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.19.y
and the diffstat can be found below.thanks,
greg k-h
The arm64 clang-14 allmodconfig failed on stable-rc 5.19. This build failure got fixed on the mainline tree two weeks ago.
* arm64, build
- clang-12-allmodconfig
- clang-13-allmodconfig
- clang-14-allmodconfig
- clang-nightly-allmodconfigmake --silent --keep-going --jobs=8 O=/home/tuxbuild/.cache/tuxmake/builds/2/build LLVM=1 LLVM_IAS=1 ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- 'HOSTCC=sccache clang' 'CC=sccache clang' allmodconfig
make --silent --keep-going --jobs=8 O=/home/tuxbuild/.cache/tuxmake/builds/2/build LLVM=1 LLVM_IAS=1 ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- 'HOSTCC=sccache clang' 'CC=sccache clang'sound/soc/intel/avs/path.c:815:18: error: stack frame size (2192) exceeds limit (2048) in 'avs_path_create' [-Werror,-Wframe-larger-than]
structavs_path*avs_path_create(structavs_dev*adev, u32dma_id,^1 error generated.
make[5]: *** [/builds/linux/scripts/Makefile.build:249:sound/soc/intel/avs/path.o] Error 1Steps to reproduce:
-------------------------
# See https://docs.tuxmake.org/ for complete documentation. # Original tuxmake command with fragments listed below.# tuxmake --runtime podman --target-arch arm64 --toolchain clang-14 --kconfig allmodconfig LLVM=1 LLVM_IAS=1Quoted 5 lines
Quoted 3 lines
tuxmake --runtime podman --target-arch arm64 --toolchain clang-14 --kconfig https://builds.tuxbuild.com/2DPEiUmdALSZq7DeNthZFYoPLaN/config
LLVM=1 LLVM_IAS=1What is the commit on mainline that resolved this issue?
commit
1e744351bcb9c4cee81300de5a6097100d835386Author: Amadeusz Sławiński <[email protected]> Date: Fri Jul 22 13:19:59 2022 +0200ASoC: Intel: avs: Use lookup table to create modules
As reported by Nathan, when building avs driver using clang with:
CONFIG_COMPILE_TEST=y
CONFIG_FORTIFY_SOURCE=y
CONFIG_KASAN=y
CONFIG_PCI=y
CONFIG_SOUND=y
CONFIG_SND=y
CONFIG_SND_SOC=y
CONFIG_SND_SOC_INTEL_AVS=ythere are reports of too big stack use, like:
sound/soc/intel/avs/path.c:815:18: error: stack frame size
(2176) exceeds limit (2048) in 'avs_path_create' [-Werror,-Wframe-larger-than]
structavs_path*avs_path_create(structavs_dev*adev, u32dma_id,
^
1 error generated.This is apparently caused by inlining many calls to
guid_equalwhich inlines fortified memcpy, using 2size_tvariables.Instead of hardcoding many calls to
guid_equal, use lookup table with one call, this improves stack usage.
Quoted 8 lines
Signed-off-by Amadeusz Sławiński <[email protected]>Reported-by Nathan Chancellor <[email protected]>Build-tested-by Nathan Chancellor <[email protected]>Reviewed-by Cezary Rojewski <[email protected]>Signed-off-by Mark Brown <[email protected]>
Thanks, now queued up to the 5.19 queue.
greg k-h
Quoted 5 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.19.2 release. There are 1157 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.
Successfully cross-compiled for arm64 (bcm2711_defconfig, GCC 10.2.0) and powerpc (ps3_defconfig, GCC 12.1.0).
Signature · 1 line
An old man doll... just what I always wanted! - Clara
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.19.2 release. There are 1157 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 17 Aug 2022 18:01:29 +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.19.2-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.19.y
and the diffstat can be found below.thanks,
greg k-h
Built and booted successfully on RISC-V RV64 (HiFive Unmatched).