6.1.80-rc1 review
Subsystems (11)
Greg Kroah-Hartman
maintainerPATCH 157/195 bpf: Fix racing between bpf_timer_cancel_and_free and bpf_timer_cancel
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin KaFai Lau <[email protected]>
[ Upstream commit 0281b919e175bb9c3128bd3872ac2903e9436e3f ]
The following race is possible between bpf_timer_cancel_and_free and bpf_timer_cancel. It will lead a UAF on the timer->timer.
bpf_timer_cancel(); spin_lock(); t = timer->time; spin_unlock(); bpf_timer_cancel_and_free(); spin_lock(); t = timer->timer; timer->timer = NULL; spin_unlock(); hrtimer_cancel(&t->timer); kfree(t); /* UAF on t */ hrtimer_cancel(&t->timer);
In bpf_timer_cancel_and_free, this patch frees the timer->timer after a rcu grace period. This requires a rcu_head addition to the "struct bpf_hrtimer". Another kfree(t) happens in bpf_timer_init, this does not need a kfree_rcu because it is still under the spin_lock and timer->timer has not been visible by others yet.
In bpf_timer_cancel, rcu_read_lock() is added because this helper can be used in a non rcu critical section context (e.g. from a sleepable bpf prog). Other timer->timer usages in helpers.c have been audited, bpf_timer_cancel() is the only place where timer->timer is used outside of the spin_lock.
Another solution considered is to mark a t->flag in bpf_timer_cancel and clear it after hrtimer_cancel() is done. In bpf_timer_cancel_and_free, it busy waits for the flag to be cleared before kfree(t). This patch goes with a straight forward solution and frees timer->timer after a rcu grace period.
--- kernel/bpf/helpers.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
kernel/bpf/helpers.c +4 -1
@@ -1091,6 +1091,7 @@ struct bpf_hrtimer {struct bpf_prog *prog;void __rcu *callback_fn;void *value; +struct rcu_head rcu; };/* the actual struct hidden inside uapi struct bpf_timer */
@@ -1312,6 +1313,7 @@ BPF_CALL_1(bpf_timer_cancel, struct bpf_timer_kern *, timer)if (in_nmi ())return -EOPNOTSUPP ; +rcu_read_lock ();__bpf_spin_lock_irqsave (&timer->lock); t = timer->timer;if (!t) {
@@ -1333,6 +1335,7 @@ BPF_CALL_1(bpf_timer_cancel, struct bpf_timer_kern *, timer)* if it was running. */ ret = ret ?:hrtimer_cancel (&t->timer); +rcu_read_unlock ();return ret; }
@@ -1387,7 +1390,7 @@ void bpf_timer_cancel_and_free(void *val)*/ if (this_cpu_read (hrtimer_running) != t)hrtimer_cancel (&t->timer); -kfree (t); +kfree_rcu (t, rcu); } BPF_CALL_2(bpf_kptr_xchg, void *, map_value, void *, ptr)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 158/195 afs: Increase buffer size in afs_update_volume_status()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniil Dulov <[email protected]>
[ Upstream commit 6ea38e2aeb72349cad50e38899b0ba6fbcb2af3d ]
The max length of volume->vid value is 20 characters. So increase idbuf[] size up to 24 to avoid overflow.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
[DH: Actually, it's 20 + NUL, so increase it to 24 and use snprintf()]
--- fs/afs/volume.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/afs/volume.c +2 -2
@@ -341,7 +341,7 @@ static int afs_update_volume_status(struct afs_volume *volume, struct key *key) {struct afs_server_list *new, *old, *discard;struct afs_vldb_entry *vldb; -char idbuf[16 ]; +char idbuf[24 ];int ret, idsz;_enter ("" );
@@ -349,7 +349,7 @@ static int afs_update_volume_status(struct afs_volume *volume, struct key *key)/* We look up an ID by passing it as a decimal string in the * operation's name parameter. */ - idsz =sprintf (idbuf,"%llu" , volume->vid); + idsz =snprintf (idbuf,sizeof (idbuf),"%llu" , volume->vid); vldb =afs_vl_lookup_vldb (volume->cell, key, idbuf, idsz);if (IS_ERR (vldb)) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 159/195 ipv6: sr: fix possible use-after-free and null-ptr-deref
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vasiliy Kovalev <[email protected]>
[ Upstream commit 5559cea2d5aa3018a5f00dd2aca3427ba09b386b ]
The pernet operations structure for the subsystem must be registered before registering the generic netlink family.
--- net/ipv6/seg6.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-)
net/ipv6/seg6.c +11 -9
@@ -512,22 +512,24 @@ int __init seg6_init(void) {int err; - err =genl_register_family (&seg6_genl_family); + err =register_pernet_subsys (&ip6_segments_ops);if (err) goto out; - err =register_pernet_subsys (&ip6_segments_ops); + err =genl_register_family (&seg6_genl_family);if (err) - goto out_unregister_genl; + goto out_unregister_pernet;#ifdef CONFIG_IPV6_SEG6_LWTUNNEL err =seg6_iptunnel_init ();if (err) - goto out_unregister_pernet; + goto out_unregister_genl; err =seg6_local_init (); -if (err) - goto out_unregister_pernet; +if (err) { +seg6_iptunnel_exit (); + goto out_unregister_genl; + }#endif #ifdef CONFIG_IPV6_SEG6_HMAC
@@ -548,11 +550,11 @@ int __init seg6_init(void)#endif #endif #ifdef CONFIG_IPV6_SEG6_LWTUNNEL -out_unregister_pernet: -unregister_pernet_subsys (&ip6_segments_ops); -#endif out_unregister_genl:genl_unregister_family (&seg6_genl_family); +#endif +out_unregister_pernet: +unregister_pernet_subsys (&ip6_segments_ops); goto out; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 160/195 net: dev: Convert sa_data to flexible array in struct sockaddr
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kees Cook <[email protected]>
[ Upstream commit b5f0de6df6dce8d641ef58ef7012f3304dffb9a1 ]
One of the worst offenders of "fake flexible arrays" is struct sockaddr, as it is the classic example of why GCC and Clang have been traditionally forced to treat all trailing arrays as fake flexible arrays: in the distant misty past, sa_data became too small, and code started just treating it as a flexible array, even though it was fixed-size. The special case by the compiler is specifically that sizeof(sa->sa_data) and FORTIFY_SOURCE (which uses __builtin_object_size(sa->sa_data, 1)) do not agree (14 and -1 respectively), which makes FORTIFY_SOURCE treat it as a flexible array.
However, the coming -fstrict-flex-arrays compiler flag will remove these special cases so that FORTIFY_SOURCE can gain coverage over all the trailing arrays in the kernel that are _not_ supposed to be treated as a flexible array. To deal with this change, convert sa_data to a true flexible array. To keep the structure size the same, move sa_data into a union with a newly introduced sa_data_min with the original size. The result is that FORTIFY_SOURCE can continue to have no idea how large sa_data may actually be, but anything using sizeof(sa->sa_data) must switch to sizeof(sa->sa_data_min).
Stable-dep-of: a7d6027790ac ("arp: Prevent overflow in arp_req_get().")
--- include/linux/socket.h | 5 ++++- net/core/dev.c | 2 +- net/core/dev_ioctl.c | 2 +- net/packet/af_packet.c | 10 +++++----- 4 files changed, 11 insertions(+), 8 deletions(-)
include/linux/socket.h +4 -1
@@ -33,7 +33,10 @@ typedef __kernel_sa_family_t sa_family_t;struct sockaddr {sa_family_t sa_family;/* address family, AF_xxx */ -char sa_data[14 ];/* 14 bytes of protocol address */ +union { +char sa_data_min[14 ];/* Minimum 14 bytes of protocol address */ + DECLARE_FLEX_ARRAY(char, sa_data); + }; };struct linger {
net/core/dev.c +1 -1
@@ -8861,7 +8861,7 @@ EXPORT_SYMBOL(dev_set_mac_address_user);int dev_get_mac_address (struct sockaddr *sa,struct net *net,char *dev_name) { -size_t size =sizeof (sa->sa_data); +size_t size =sizeof (sa->sa_data_min);struct net_device *dev;int ret =0 ;
net/core/dev_ioctl.c +1 -1
@@ -342,7 +342,7 @@ static int dev_ifsioc(struct net *net, struct ifreq *ifr, void __user *data,if (ifr->ifr_hwaddr.sa_family != dev->type)return -EINVAL ;memcpy (dev->broadcast, ifr->ifr_hwaddr.sa_data, -min (sizeof (ifr->ifr_hwaddr.sa_data), +min (sizeof (ifr->ifr_hwaddr.sa_data_min), (size_t )dev->addr_len));call_netdevice_notifiers (NETDEV_CHANGEADDR , dev);return 0 ;
net/packet/af_packet.c +5 -5
@@ -3284,7 +3284,7 @@ static int packet_bind_spkt(struct socket *sock, struct sockaddr *uaddr, int addr_len) {struct sock *sk = sock->sk; -char name[sizeof (uaddr->sa_data) +1 ]; +char name[sizeof (uaddr->sa_data_min) +1 ];/* * Check legality
@@ -3295,8 +3295,8 @@ static int packet_bind_spkt(struct socket *sock, struct sockaddr *uaddr,/* uaddr->sa_data comes from the userspace, it's not guaranteed to be * zero-terminated. */ -memcpy (name, uaddr->sa_data,sizeof (uaddr->sa_data)); - name[sizeof (uaddr->sa_data)] =0 ; +memcpy (name, uaddr->sa_data,sizeof (uaddr->sa_data_min)); + name[sizeof (uaddr->sa_data_min)] =0 ;return packet_do_bind (sk, name,0 ,0 ); }
@@ -3566,11 +3566,11 @@ static int packet_getname_spkt(struct socket *sock, struct sockaddr *uaddr,return -EOPNOTSUPP ; uaddr->sa_family =AF_PACKET ; -memset (uaddr->sa_data,0 ,sizeof (uaddr->sa_data)); +memset (uaddr->sa_data,0 ,sizeof (uaddr->sa_data_min));rcu_read_lock (); dev =dev_get_by_index_rcu (sock_net (sk),READ_ONCE (pkt_sk (sk)->ifindex));if (dev) -strscpy (uaddr->sa_data, dev->name,sizeof (uaddr->sa_data)); +strscpy (uaddr->sa_data, dev->name,sizeof (uaddr->sa_data_min));rcu_read_unlock ();return sizeof (*uaddr);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 161/195 arm64/sme: Restore SME registers on exit from suspend
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Brown <[email protected]>
[ Upstream commit 9533864816fb4a6207c63b7a98396351ce1a9fae ]
The fields in SMCR_EL1 and SMPRI_EL1 reset to an architecturally UNKNOWN value. Since we do not otherwise manage the traps configured in this register at runtime we need to reconfigure them after a suspend in case nothing else was kind enough to preserve them for us.
The vector length will be restored as part of restoring the SME state for the next SME using task.
--- arch/arm64/include/asm/fpsimd.h | 2 ++ arch/arm64/kernel/fpsimd.c | 14 ++++++++++++++ arch/arm64/kernel/suspend.c | 3 +++ 3 files changed, 19 insertions(+)
arch/arm64/include/asm/fpsimd.h +2 -0
@@ -343,6 +343,7 @@ extern void sme_alloc(struct task_struct *task, bool flush);extern unsigned int sme_get_vl (void );extern int sme_set_current_vl (unsigned long arg);extern int sme_get_current_vl (void ); +extern void sme_suspend_exit (void );/* * Return how many bytes of memory are required to store the full SME
@@ -372,6 +373,7 @@ static inline int sme_max_vl(void) { return 0; }static inline int sme_max_virtualisable_vl (void ) {return 0 ; }static inline int sme_set_current_vl (unsigned long arg) {return -EINVAL ; }static inline int sme_get_current_vl (void ) {return -EINVAL ; } +static inline void sme_suspend_exit (void ) { }static inline size_t za_state_size (struct task_struct const *task) {
arch/arm64/kernel/fpsimd.c +14 -0
@@ -1347,6 +1347,20 @@ void __init sme_setup(void) get_sme_default_vl()); } +void sme_suspend_exit (void ) +{ +u64 smcr =0 ; + +if (!system_supports_sme ()) +return ; + +if (system_supports_fa64 ()) + smcr |= SMCR_ELx_FA64; + +write_sysreg_s (smcr,SYS_SMCR_EL1 ); +write_sysreg_s (0 ,SYS_SMPRI_EL1 ); +} +#endif /* CONFIG_ARM64_SME */ static void sve_init_regs (void )
arch/arm64/kernel/suspend.c +3 -0
@@ -11,6 +11,7 @@#include <asm/daifflags.h> #include <asm/debug-monitors.h> #include <asm/exec.h> +#include <asm/fpsimd.h> #include <asm/mte.h> #include <asm/memory.h> #include <asm/mmu_context.h>
@@ -77,6 +78,8 @@ void notrace __cpu_suspend_exit(void)*/ spectre_v4_enable_mitigation (NULL ); +sme_suspend_exit (); +/* Restore additional feature-specific configuration */ ptrauth_suspend_exit (); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 162/195 platform/x86: thinkpad_acpi: Only update profile if successfully converted
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mario Limonciello <[email protected]>
[ Upstream commit 427c70dec738318b7f71e1b9d829ff0e9771d493 ]
Randomly a Lenovo Z13 will trigger a kernel warning traceback from this condition:
``` if (WARN_ON((profile < 0) || (profile >= ARRAY_SIZE(profile_names)))) ```
This happens because thinkpad-acpi always assumes that convert_dytc_to_profile() successfully updated the profile. On the contrary a condition can occur that when dytc_profile_refresh() is called the profile doesn't get updated as there is a -EOPNOTSUPP branch.
Catch this situation and avoid updating the profile. Also log this into dynamic debugging in case any other modes should be added in the future.
--- drivers/platform/x86/thinkpad_acpi.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/platform/x86/thinkpad_acpi.c +3 -2
@@ -10511,6 +10511,7 @@ static int convert_dytc_to_profile(int funcmode, int dytcmode,return 0 ;default :/* Unknown function */ +pr_debug ("unknown function 0x%x\n" , funcmode);return -EOPNOTSUPP ; }return 0 ;
@@ -10696,8 +10697,8 @@ static void dytc_profile_refresh(void)return ; perfmode = (output >>DYTC_GET_MODE_BIT ) &0xF ; -convert_dytc_to_profile (funcmode, perfmode, &profile); -if (profile != dytc_current_profile) { + err =convert_dytc_to_profile (funcmode, perfmode, &profile); +if (!err && profile != dytc_current_profile) { dytc_current_profile = profile;platform_profile_notify (); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 163/195 octeontx2-af: Consider the action set by PF
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Subbaraya Sundeep <[email protected]>
[ Upstream commit 3b1ae9b71c2a97f848b00fb085a2bd29bddbe8d9 ]
AF reserves MCAM entries for each PF, VF present in the system and populates the entry with DMAC and action with default RSS so that basic packet I/O works. Since PF/VF is not aware of the RSS action installed by AF, AF only fixup the actions of the rules installed by PF/VF with corresponding default RSS action. This worked well for rules installed by PF/VF for features like RX VLAN offload and DMAC filters but rules involving action like drop/forward to queue are also getting modified by AF. Hence fix it by setting the default RSS action only if requested by PF/VF.
--- drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c +4 -0
@@ -437,6 +437,10 @@ static void npc_fixup_vf_rule(struct rvu *rvu, struct npc_mcam *mcam,return ; } +/* AF modifies given action iff PF/VF has requested for it */ +if ((entry->action &0xFULL ) !=NIX_RX_ACTION_DEFAULT ) +return ; +/* copy VF default entry action to the VF mcam entry */ rx_action =npc_get_default_entry_action (rvu, mcam, blkaddr, target_func);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 164/195 s390: use the correct count for __iowrite64_copy()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jason Gunthorpe <[email protected]>
[ Upstream commit 723a2cc8d69d4342b47dfddbfe6c19f1b135f09b ]
The signature for __iowrite64_copy() requires the number of 64 bit quantities, not bytes. Multiple by 8 to get to a byte length before invoking zpci_memcpy_toio()
--- arch/s390/pci/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/s390/pci/pci.c +1 -1
@@ -241,7 +241,7 @@ resource_size_t pcibios_align_resource(void *data, const struct resource *res,/* combine single writes by using store-block insn */ void __iowrite64_copy (void __iomem *to,const void *from,size_t count) { -zpci_memcpy_toio (to, from, count); +zpci_memcpy_toio (to, from, count *8 ); }static void __iomem *__ioremap (phys_addr_t addr,size_t size,pgprot_t prot)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 165/195 bpf, sockmap: Fix NULL pointer dereference in sk_psock_verdict_data_ready()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shigeru Yoshida <[email protected]>
[ Upstream commit 4cd12c6065dfcdeba10f49949bffcf383b3952d8 ]
syzbot reported the following NULL pointer dereference issue [1]:
BUG: kernel NULL pointer dereference, address: 0000000000000000 [...] RIP: 0010:0x0 [...] Call Trace: <TASK> sk_psock_verdict_data_ready+0x232/0x340 net/core/skmsg.c:1230 unix_stream_sendmsg+0x9b4/0x1230 net/unix/af_unix.c:2293 sock_sendmsg_nosec net/socket.c:730 [inline] __sock_sendmsg+0x221/0x270 net/socket.c:745 ____sys_sendmsg+0x525/0x7d0 net/socket.c:2584 ___sys_sendmsg net/socket.c:2638 [inline] __sys_sendmsg+0x2b0/0x3a0 net/socket.c:2667 do_syscall_64+0xf9/0x240 entry_SYSCALL_64_after_hwframe+0x6f/0x77
If sk_psock_verdict_data_ready() and sk_psock_stop_verdict() are called concurrently, psock->saved_data_ready can be NULL, causing the above issue.
This patch fixes this issue by calling the appropriate data ready function using the sk_psock_data_ready() helper and protecting it from concurrency with sk->sk_callback_lock.
--- net/core/skmsg.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
net/core/skmsg.c +5 -2
@@ -1217,8 +1217,11 @@ static void sk_psock_verdict_data_ready(struct sock *sk)rcu_read_lock (); psock =sk_psock (sk); -if (psock) - psock->saved_data_ready (sk); +if (psock) { +read_lock_bh (&sk->sk_callback_lock); +sk_psock_data_ready (sk, psock); +read_unlock_bh (&sk->sk_callback_lock); + }rcu_read_unlock (); } }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 166/195 tls: break out of main loop when PEEK gets a non-data record
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sabrina Dubroca <[email protected]>
[ Upstream commit 10f41d0710fc81b7af93fa6106678d57b1ff24a7 ]
PEEK needs to leave decrypted records on the rx_list so that we can receive them later on, so it jumps back into the async code that queues the skb. Unfortunately that makes us skip the TLS_RECORD_TYPE_DATA check at the bottom of the main loop, so if two records of the same (non-DATA) type are queued, we end up merging them.
Add the same record type check, and make it unlikely to not penalize the async fastpath. Async decrypt only applies to data record, so this check is only needed for PEEK.
process_rx_list also has similar issues.
--- net/tls/tls_sw.c | 2 ++ 1 file changed, 2 insertions(+)
net/tls/tls_sw.c +2 -0
@@ -2137,6 +2137,8 @@ int tls_sw_recvmsg(struct sock *sk, decrypted += chunk; len -= chunk;__skb_queue_tail (&ctx->rx_list, skb); +if (unlikely (control !=TLS_RECORD_TYPE_DATA )) +break ;continue ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 167/195 tls: stop recv() if initial process_rx_list gave us non-DATA
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sabrina Dubroca <[email protected]>
[ Upstream commit fdfbaec5923d9359698cbb286bc0deadbb717504 ]
If we have a non-DATA record on the rx_list and another record of the same type still on the queue, we will end up merging them:
- process_rx_list copies the non-DATA record
- we start the loop and process the first available record since it's of the same type
- we break out of the loop since the record was not DATA
Just check the record type and jump to the end in case process_rx_list did some work.
--- net/tls/tls_sw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/tls/tls_sw.c +1 -1
@@ -2044,7 +2044,7 @@ int tls_sw_recvmsg(struct sock *sk, goto end; copied = err; -if (len <= copied) +if (len <= copied || (copied && control !=TLS_RECORD_TYPE_DATA )) goto end; target =sock_rcvlowat (sk, flags &MSG_WAITALL , len);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 168/195 tls: dont skip over different type records from the rx_list
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sabrina Dubroca <[email protected]>
[ Upstream commit ec823bf3a479d42c589dc0f28ef4951c49cd2d2a ]
If we queue 3 records:
- record 1, type DATA
- record 2, some other type
- record 3, type DATA
and do a recv(PEEK), the rx_list will contain the first two records.
The next large recv will walk through the rx_list and copy data from record 1, then stop because record 2 is a different type. Since we haven't filled up our buffer, we will process the next available record. It's also DATA, so we can merge it with the current read.
We shouldn't do that, since there was a record in between that we ignored.
Add a flag to let process_rx_list inform tls_sw_recvmsg that it had more data available.
--- net/tls/tls_sw.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-)
net/tls/tls_sw.c +14 -8
@@ -1845,7 +1845,8 @@ static int process_rx_list(struct tls_sw_context_rx *ctx,u8 *control, size_t skip, size_t len, - bool is_peek) + bool is_peek, + bool *more) { struct sk_buff *skb = skb_peek(&ctx->rx_list);struct tls_msg *tlm;
@@ -1858,7 +1859,7 @@ static int process_rx_list(struct tls_sw_context_rx *ctx, err =tls_record_content_type (msg, tlm, control);if (err <=0 ) - goto out; + goto more;if (skip < rxm->full_len)break ;
@@ -1876,12 +1877,12 @@ static int process_rx_list(struct tls_sw_context_rx *ctx, err =tls_record_content_type (msg, tlm, control);if (err <=0 ) - goto out; + goto more; err =skb_copy_datagram_msg (skb, rxm->offset + skip, msg, chunk);if (err <0 ) - goto out; + goto more; len = len - chunk; copied = copied + chunk;
@@ -1917,6 +1918,10 @@ static int process_rx_list(struct tls_sw_context_rx *ctx, out:return copied ? : err; +more: +if (more) + *more = true; + goto out; } static bool
@@ -2020,6 +2025,7 @@ int tls_sw_recvmsg(struct sock *sk,int target, err;bool is_kvec =iov_iter_is_kvec (&msg->msg_iter);bool is_peek = flags &MSG_PEEK ; +bool rx_more = false;bool released = true;bool bpf_strp_enabled;bool zc_capable;
@@ -2039,12 +2045,12 @@ int tls_sw_recvmsg(struct sock *sk, goto end;/* Process pending decrypted records. It must be non-zero-copy */ - err =process_rx_list (ctx, msg, &control,0 , len, is_peek); + err =process_rx_list (ctx, msg, &control,0 , len, is_peek, &rx_more);if (err <0 ) goto end; copied = err; -if (len <= copied || (copied && control !=TLS_RECORD_TYPE_DATA )) +if (len <= copied || (copied && control !=TLS_RECORD_TYPE_DATA ) || rx_more) goto end; target =sock_rcvlowat (sk, flags &MSG_WAITALL , len);
@@ -2203,10 +2209,10 @@ int tls_sw_recvmsg(struct sock *sk,/* Drain records from the rx_list & copy if required */ if (is_peek || is_kvec) err =process_rx_list (ctx, msg, &control, copied, - decrypted, is_peek); + decrypted, is_peek,NULL );else err =process_rx_list (ctx, msg, &control,0 , - async_copy_bytes, is_peek); + async_copy_bytes, is_peek,NULL ); } copied += decrypted;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 169/195 netfilter: nf_tables: set dormant flag on hook register failure
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Westphal <[email protected]>
[ Upstream commit bccebf64701735533c8db37773eeacc6566cc8ec ]
We need to set the dormant flag again if we fail to register the hooks.
During memory pressure hook registration can fail and we end up with a table marked as active but no registered hooks.
On table/base chain deletion, nf_tables will attempt to unregister the hook again which yields a warn splat from the nftables core.
--- net/netfilter/nf_tables_api.c | 1 + 1 file changed, 1 insertion(+)
net/netfilter/nf_tables_api.c +1 -0
@@ -1245,6 +1245,7 @@ static int nf_tables_updtable(struct nft_ctx *ctx)return 0 ; err_register_hooks: + ctx->table->flags |=NFT_TABLE_F_DORMANT ;nft_trans_destroy (trans);return ret; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 170/195 netfilter: flowtable: simplify route logic
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pablo Neira Ayuso <[email protected]>
[ Upstream commit fa502c86566680ac62bc28ec883a069bf7a2aa5e ]
Grab reference to dst from skbuff earlier to simplify route caching.
Stable-dep-of: 9e0f0430389b ("netfilter: nft_flow_offload: reset dst in route object after setting up flow")
--- include/net/netfilter/nf_flow_table.h | 4 ++-- net/netfilter/nf_flow_table_core.c | 24 +++--------------------- net/netfilter/nft_flow_offload.c | 12 ++++++++---- 3 files changed, 13 insertions(+), 27 deletions(-)
include/net/netfilter/nf_flow_table.h +2 -2
@@ -274,8 +274,8 @@ nf_flow_table_offload_del_cb(struct nf_flowtable *flow_table, flow_table->type->put (flow_table); } -int flow_offload_route_init (struct flow_offload *flow, -const struct nf_flow_route *route); +void flow_offload_route_init (struct flow_offload *flow, +const struct nf_flow_route *route);int flow_offload_add (struct nf_flowtable *flow_table,struct flow_offload *flow); void flow_offload_refresh(struct nf_flowtable *flow_table,
net/netfilter/nf_flow_table_core.c +3 -21
@@ -125,9 +125,6 @@ static int flow_offload_fill_route(struct flow_offload *flow,break ;case FLOW_OFFLOAD_XMIT_XFRM :case FLOW_OFFLOAD_XMIT_NEIGH : -if (!dst_hold_safe (route->tuple[dir].dst)) -return -1 ; - flow_tuple->dst_cache = dst; flow_tuple->dst_cookie =flow_offload_dst_cookie (flow_tuple);break ;
@@ -148,27 +145,12 @@ static void nft_flow_dst_release(struct flow_offload *flow,dst_release (flow->tuplehash[dir].tuple.dst_cache); } -int flow_offload_route_init (struct flow_offload *flow, +void flow_offload_route_init (struct flow_offload *flow,const struct nf_flow_route *route) { -int err; - - err =flow_offload_fill_route (flow, route,FLOW_OFFLOAD_DIR_ORIGINAL ); -if (err <0 ) -return err; - - err =flow_offload_fill_route (flow, route,FLOW_OFFLOAD_DIR_REPLY ); -if (err <0 ) - goto err_route_reply; - +flow_offload_fill_route (flow, route,FLOW_OFFLOAD_DIR_ORIGINAL ); +flow_offload_fill_route (flow, route,FLOW_OFFLOAD_DIR_REPLY ); flow->type =NF_FLOW_OFFLOAD_ROUTE ; - -return 0 ; - -err_route_reply: -nft_flow_dst_release (flow,FLOW_OFFLOAD_DIR_ORIGINAL ); - -return err; }EXPORT_SYMBOL_GPL (flow_offload_route_init);
net/netfilter/nft_flow_offload.c +8 -4
@@ -250,9 +250,14 @@ static int nft_flow_route(const struct nft_pktinfo *pkt,break ; } +if (!dst_hold_safe (this_dst)) +return -ENOENT ; +nf_route (nft_net (pkt), &other_dst, &fl, false,nft_pf (pkt)); -if (!other_dst) +if (!other_dst) { +dst_release (this_dst);return -ENOENT ; + }nft_default_forward_path (route, this_dst, dir);nft_default_forward_path (route, other_dst, !dir);
@@ -349,8 +354,7 @@ static void nft_flow_offload_eval(const struct nft_expr *expr,if (!flow) goto err_flow_alloc; -if (flow_offload_route_init (flow, &route) <0 ) - goto err_flow_add; +flow_offload_route_init (flow, &route);if (tcph) { ct->proto.tcp.seen[0 ].flags |=IP_CT_TCP_FLAG_BE_LIBERAL ;
@@ -361,12 +365,12 @@ static void nft_flow_offload_eval(const struct nft_expr *expr,if (ret <0 ) goto err_flow_add; -dst_release (route.tuple[!dir].dst);return ; err_flow_add:flow_offload_free (flow); err_flow_alloc: +dst_release (route.tuple[dir].dst);dst_release (route.tuple[!dir].dst); err_flow_route:clear_bit (IPS_OFFLOAD_BIT , &ct->status);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 171/195 netfilter: nft_flow_offload: reset dst in route object after setting up flow
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pablo Neira Ayuso <[email protected]>
[ Upstream commit 9e0f0430389be7696396c62f037be4bf72cf93e3 ]
dst is transferred to the flow object, route object does not own it anymore. Reset dst in route object, otherwise if flow_offload_add() fails, error path releases dst twice, leading to a refcount underflow.
--- include/net/netfilter/nf_flow_table.h | 2 +- net/netfilter/nf_flow_table_core.c | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-)
include/net/netfilter/nf_flow_table.h +1 -1
@@ -275,7 +275,7 @@ nf_flow_table_offload_del_cb(struct nf_flowtable *flow_table, }void flow_offload_route_init (struct flow_offload *flow, -const struct nf_flow_route *route); +struct nf_flow_route *route);int flow_offload_add (struct nf_flowtable *flow_table,struct flow_offload *flow); void flow_offload_refresh(struct nf_flowtable *flow_table,
net/netfilter/nf_flow_table_core.c +13 -3
@@ -87,12 +87,22 @@ static u32 flow_offload_dst_cookie(struct flow_offload_tuple *flow_tuple)return 0 ; } +static struct dst_entry *nft_route_dst_fetch (struct nf_flow_route *route, +enum flow_offload_tuple_dir dir) +{ +struct dst_entry *dst = route->tuple[dir].dst; + + route->tuple[dir].dst =NULL ; + +return dst; +} +static int flow_offload_fill_route (struct flow_offload *flow, -const struct nf_flow_route *route, +struct nf_flow_route *route,enum flow_offload_tuple_dir dir) {struct flow_offload_tuple *flow_tuple = &flow->tuplehash[dir].tuple; -struct dst_entry *dst = route->tuple[dir].dst; +struct dst_entry *dst =nft_route_dst_fetch (route, dir);int i, j =0 ;switch (flow_tuple->l3proto) {
@@ -146,7 +156,7 @@ static void nft_flow_dst_release(struct flow_offload *flow, }void flow_offload_route_init (struct flow_offload *flow, -const struct nf_flow_route *route) +struct nf_flow_route *route) {flow_offload_fill_route (flow, route,FLOW_OFFLOAD_DIR_ORIGINAL );flow_offload_fill_route (flow, route,FLOW_OFFLOAD_DIR_REPLY );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 172/195 netfilter: nft_flow_offload: release dst in case direct xmit path is used
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pablo Neira Ayuso <[email protected]>
[ Upstream commit 8762785f459be1cfe6fcf7285c123aad6a3703f0 ]
Direct xmit does not use it since it calls dev_queue_xmit() to send packets, hence it calls dst_release().
kmemleak reports:
unreferenced object 0xffff88814f440900 (size 184):
comm "softirq", pid 0, jiffies 4294951896 hex dump (first 32 bytes):
00 60 5b 04 81 88 ff ff 00 e6 e8 82 ff ff ff ff .`[.............
21 0b 50 82 ff ff ff ff 00 00 00 00 00 00 00 00 !.P.............
backtrace (crc cb2bf5d6):
[<000000003ee17107>] kmem_cache_alloc+0x286/0x340
[<0000000021a5de2c>] dst_alloc+0x43/0xb0
[<00000000f0671159>] rt_dst_alloc+0x2e/0x190
[<00000000fe5092c9>] __mkroute_output+0x244/0x980
[<000000005fb96fb0>] ip_route_output_flow+0xc0/0x160
[<0000000045367433>] nf_ip_route+0xf/0x30
[<0000000085da1d8e>] nf_route+0x2d/0x60
[<00000000d1ecd1cb>] nft_flow_route+0x171/0x6a0 [nft_flow_offload]
[<00000000d9b2fb60>] nft_flow_offload_eval+0x4e8/0x700 [nft_flow_offload]
[<000000009f447dbb>] expr_call_ops_eval+0x53/0x330 [nf_tables]
[<00000000072e1be6>] nft_do_chain+0x17c/0x840 [nf_tables]
[<00000000d0551029>] nft_do_chain_inet+0xa1/0x210 [nf_tables]
[<0000000097c9d5c6>] nf_hook_slow+0x5b/0x160
[<0000000005eccab1>] ip_forward+0x8b6/0x9b0
[<00000000553a269b>] ip_rcv+0x221/0x230
[<00000000412872e5>] __netif_receive_skb_one_core+0xfe/0x110--- net/netfilter/nf_flow_table_core.c | 1 + 1 file changed, 1 insertion(+)
net/netfilter/nf_flow_table_core.c +1 -0
@@ -132,6 +132,7 @@ static int flow_offload_fill_route(struct flow_offload *flow, ETH_ALEN); flow_tuple->out.ifidx = route->tuple[dir].out.ifindex; flow_tuple->out.hw_ifidx = route->tuple[dir].out.hw_ifindex; +dst_release (dst);break ;case FLOW_OFFLOAD_XMIT_XFRM :case FLOW_OFFLOAD_XMIT_NEIGH :
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 173/195 netfilter: nf_tables: rename function to destroy hook list
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pablo Neira Ayuso <[email protected]>
[ Upstream commit cdc32546632354305afdcf399a5431138a31c9e0 ]
Rename nft_flowtable_hooks_destroy() by nft_hooks_destroy() to prepare for netdev chain device updates.
Stable-dep-of: d472e9853d7b ("netfilter: nf_tables: register hooks last when adding new chain/flowtable")
--- net/netfilter/nf_tables_api.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
net/netfilter/nf_tables_api.c +4 -4
@@ -7938,7 +7938,7 @@ static int nft_register_flowtable_net_hooks(struct net *net,return err; } -static void nft_flowtable_hooks_destroy (struct list_head *hook_list) +static void nft_hooks_destroy (struct list_head *hook_list) {struct nft_hook *hook, *next;
@@ -8123,7 +8123,7 @@ static int nf_tables_newflowtable(struct sk_buff *skb, &flowtable->hook_list, flowtable);if (err <0 ) { -nft_flowtable_hooks_destroy (&flowtable->hook_list); +nft_hooks_destroy (&flowtable->hook_list); goto err4; }
@@ -8893,7 +8893,7 @@ static void nft_commit_release(struct nft_trans *trans)break ;case NFT_MSG_DELFLOWTABLE :if (nft_trans_flowtable_update (trans)) -nft_flowtable_hooks_destroy (&nft_trans_flowtable_hooks (trans)); +nft_hooks_destroy (&nft_trans_flowtable_hooks (trans));else nf_tables_flowtable_destroy (nft_trans_flowtable (trans));break ;
@@ -9850,7 +9850,7 @@ static void nf_tables_abort_release(struct nft_trans *trans)break ;case NFT_MSG_NEWFLOWTABLE :if (nft_trans_flowtable_update (trans)) -nft_flowtable_hooks_destroy (&nft_trans_flowtable_hooks (trans)); +nft_hooks_destroy (&nft_trans_flowtable_hooks (trans));else nf_tables_flowtable_destroy (nft_trans_flowtable (trans));break ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 174/195 netfilter: nf_tables: register hooks last when adding new chain/flowtable
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pablo Neira Ayuso <[email protected]>
[ Upstream commit d472e9853d7b46a6b094224d131d09ccd3a03daf ]
Register hooks last when adding chain/flowtable to ensure that packets do not walk over datastructure that is being released in the error path without waiting for the rcu grace period.
--- net/netfilter/nf_tables_api.c | 78 ++++++++++++++++++----------------- 1 file changed, 40 insertions(+), 38 deletions(-)
net/netfilter/nf_tables_api.c +40 -38
@@ -686,15 +686,16 @@ static int nft_delobj(struct nft_ctx *ctx, struct nft_object *obj)return err; } -static int nft_trans_flowtable_add (struct nft_ctx *ctx,int msg_type, -struct nft_flowtable *flowtable) +static struct nft_trans * +nft_trans_flowtable_add (struct nft_ctx *ctx,int msg_type, +struct nft_flowtable *flowtable) {struct nft_trans *trans; trans =nft_trans_alloc (ctx, msg_type,sizeof (struct nft_trans_flowtable ));if (trans ==NULL ) -return -ENOMEM ; +return ERR_PTR (-ENOMEM );if (msg_type ==NFT_MSG_NEWFLOWTABLE )nft_activate_next (ctx->net, flowtable);
@@ -703,22 +704,22 @@ static int nft_trans_flowtable_add(struct nft_ctx *ctx, int msg_type,nft_trans_flowtable (trans) = flowtable;nft_trans_commit_list_add_tail (ctx->net, trans); -return 0 ; +return trans; }static int nft_delflowtable (struct nft_ctx *ctx,struct nft_flowtable *flowtable) { -int err; +struct nft_trans *trans; - err =nft_trans_flowtable_add (ctx,NFT_MSG_DELFLOWTABLE , flowtable); -if (err <0 ) -return err; + trans =nft_trans_flowtable_add (ctx,NFT_MSG_DELFLOWTABLE , flowtable); +if (IS_ERR (trans)) +return PTR_ERR (trans);nft_deactivate_next (ctx->net, flowtable);nft_use_dec (&ctx->table->use); -return err; +return 0 ; }static void __nft_reg_track_clobber (struct nft_regs_track *track,u8 dreg)
@@ -2459,19 +2460,15 @@ static int nf_tables_addchain(struct nft_ctx *ctx, u8 family, u8 genmask,RCU_INIT_POINTER (chain->blob_gen_0, blob);RCU_INIT_POINTER (chain->blob_gen_1, blob); - err =nf_tables_register_hook (net, table, chain); -if (err <0 ) - goto err_destroy_chain; -if (!nft_use_inc (&table->use)) { err = -EMFILE ; - goto err_use; + goto err_destroy_chain; } trans =nft_trans_chain_add (ctx,NFT_MSG_NEWCHAIN );if (IS_ERR (trans)) { err =PTR_ERR (trans); - goto err_unregister_hook; + goto err_trans; }nft_trans_chain_policy (trans) =NFT_CHAIN_POLICY_UNSET ;
@@ -2479,17 +2476,22 @@ static int nf_tables_addchain(struct nft_ctx *ctx, u8 family, u8 genmask,nft_trans_chain_policy (trans) = policy; err =nft_chain_add (table, chain); -if (err <0 ) { -nft_trans_destroy (trans); - goto err_unregister_hook; - } +if (err <0 ) + goto err_chain_add; + +/* This must be LAST to ensure no packets are walking over this chain. */ + err =nf_tables_register_hook (net, table, chain); +if (err <0 ) + goto err_register_hook;return 0 ; -err_unregister_hook: +err_register_hook: +nft_chain_del (chain); +err_chain_add: +nft_trans_destroy (trans); +err_trans:nft_use_dec_restore (&table->use); -err_use: -nf_tables_unregister_hook (net, table, chain); err_destroy_chain:nf_tables_chain_destroy (ctx);
@@ -8031,9 +8033,9 @@ static int nf_tables_newflowtable(struct sk_buff *skb,u8 family = info->nfmsg->nfgen_family;const struct nf_flowtable_type *type;struct nft_flowtable *flowtable; -struct nft_hook *hook, *next;struct net *net = info->net;struct nft_table *table; +struct nft_trans *trans;struct nft_ctx ctx;int err;
@@ -8113,34 +8115,34 @@ static int nf_tables_newflowtable(struct sk_buff *skb, err =nft_flowtable_parse_hook (&ctx, nla[NFTA_FLOWTABLE_HOOK ], &flowtable_hook, flowtable, true);if (err <0 ) - goto err4; + goto err_flowtable_parse_hooks;list_splice (&flowtable_hook.list, &flowtable->hook_list); flowtable->data.priority = flowtable_hook.priority; flowtable->hooknum = flowtable_hook.num; + trans =nft_trans_flowtable_add (&ctx,NFT_MSG_NEWFLOWTABLE , flowtable); +if (IS_ERR (trans)) { + err =PTR_ERR (trans); + goto err_flowtable_trans; + } + +/* This must be LAST to ensure no packets are walking over this flowtable. */ err =nft_register_flowtable_net_hooks (ctx.net, table, &flowtable->hook_list, flowtable); -if (err <0 ) { -nft_hooks_destroy (&flowtable->hook_list); - goto err4; - } - - err =nft_trans_flowtable_add (&ctx,NFT_MSG_NEWFLOWTABLE , flowtable);if (err <0 ) - goto err5; + goto err_flowtable_hooks;list_add_tail_rcu (&flowtable->list, &table->flowtables);return 0 ; -err5: -list_for_each_entry_safe (hook, next, &flowtable->hook_list, list) { -nft_unregister_flowtable_hook (net, flowtable, hook); -list_del_rcu (&hook->list); -kfree_rcu (hook, rcu); - } -err4: + +err_flowtable_hooks: +nft_trans_destroy (trans); +err_flowtable_trans: +nft_hooks_destroy (&flowtable->hook_list); +err_flowtable_parse_hooks: flowtable->data.type->free (&flowtable->data); err3:module_put (type->owner);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 175/195 netfilter: nf_tables: use kzalloc for hook allocation
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Westphal <[email protected]>
[ Upstream commit 195e5f88c2e48330ba5483e0bad2de3b3fad484f ]
KMSAN reports unitialized variable when registering the hook,
reg->hook_ops_type == NF_HOOK_OP_BPF)
~~~~~~~~~~~ undefined
This is a small structure, just use kzalloc to make sure this won't happen again when new fields get added to nf_hook_ops.
--- net/netfilter/nf_tables_api.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/netfilter/nf_tables_api.c +1 -1
@@ -2059,7 +2059,7 @@ static struct nft_hook *nft_netdev_hook_alloc(struct net *net,struct nft_hook *hook;int err; - hook =kmalloc (sizeof (struct nft_hook ),GFP_KERNEL_ACCOUNT ); + hook =kzalloc (sizeof (struct nft_hook ),GFP_KERNEL_ACCOUNT );if (!hook) { err = -ENOMEM ; goto err_hook_alloc;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 176/195 net: mctp: put sock on tag allocation failure
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeremy Kerr <[email protected]>
[ Upstream commit 9990889be14288d4f1743e4768222d5032a79c27 ]
We may hold an extra reference on a socket if a tag allocation fails: we optimistically allocate the sk_key, and take a ref there, but do not drop if we end up not using the allocated key.
Ensure we're dropping the sock on this failure by doing a proper unref rather than directly kfree()ing.
--- net/mctp/route.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/mctp/route.c +1 -1
@@ -663,7 +663,7 @@ struct mctp_sk_key *mctp_alloc_local_tag(struct mctp_sock *msk,spin_unlock_irqrestore (&mns->keys_lock, flags);if (!tagbits) { -kfree (key); +mctp_key_unref (key);return ERR_PTR (-EBUSY ); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 177/195 net: sparx5: Add spinlock for frame transmission from CPU
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Horatiu Vultur <[email protected]>
[ Upstream commit 603ead96582d85903baec2d55f021b8dac5c25d2 ]
Both registers used when doing manual injection or fdma injection are shared between all the net devices of the switch. It was noticed that when having two process which each of them trying to inject frames on different ethernet ports, that the HW started to behave strange, by sending out more frames then expected. When doing fdma injection it is required to set the frame in the DCB and then make sure that the next pointer of the last DCB is invalid. But because there is no locks for this, then easily this pointer between the DCB can be broken and then it would create a loop of DCBs. And that means that the HW will continuously transmit these frames in a loop. Until the SW will break this loop.
Therefore to fix this issue, add a spin lock for when accessing the registers for manual or fdma injection.
--- drivers/net/ethernet/microchip/sparx5/sparx5_main.c | 1 + drivers/net/ethernet/microchip/sparx5/sparx5_main.h | 1 + drivers/net/ethernet/microchip/sparx5/sparx5_packet.c | 2 ++ 3 files changed, 4 insertions(+)
drivers/net/ethernet/microchip/sparx5/sparx5_main.c +1 -0
@@ -744,6 +744,7 @@ static int mchp_sparx5_probe(struct platform_device *pdev)platform_set_drvdata (pdev, sparx5); sparx5->pdev = pdev; sparx5->dev = &pdev->dev; +spin_lock_init (&sparx5->tx_lock);/* Do switch core reset if available */ reset =devm_reset_control_get_optional_shared (&pdev->dev,"switch" );
drivers/net/ethernet/microchip/sparx5/sparx5_main.h +1 -0
@@ -278,6 +278,7 @@ struct sparx5 {int xtr_irq;/* Frame DMA */ int fdma_irq; +spinlock_t tx_lock;/* lock for frame transmission */ struct sparx5_rx rx;struct sparx5_tx tx;/* PTP */
drivers/net/ethernet/microchip/sparx5/sparx5_packet.c +2 -0
@@ -244,10 +244,12 @@ netdev_tx_t sparx5_port_xmit_impl(struct sk_buff *skb, struct net_device *dev) }skb_tx_timestamp (skb); +spin_lock (&sparx5->tx_lock);if (sparx5->fdma_irq >0 ) ret =sparx5_fdma_xmit (sparx5, ifh, skb);else ret =sparx5_inject (sparx5, ifh, skb, dev); +spin_unlock (&sparx5->tx_lock);if (ret == -EBUSY ) goto busy;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 178/195 phonet: take correct lock to peek at the RX queue
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rémi Denis-Courmont <[email protected]>
[ Upstream commit 3b2d9bc4d4acdf15a876eae2c0d83149250e85ba ]
The receive queue is protected by its embedded spin-lock, not the socket lock, so we need the former lock here (and only that one).
--- net/phonet/datagram.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/phonet/datagram.c +2 -2
@@ -35,10 +35,10 @@ static int pn_ioctl(struct sock *sk, intswitch (cmd) {case SIOCINQ : -lock_sock (sk); +spin_lock_bh (&sk->sk_receive_queue.lock); skb =skb_peek (&sk->sk_receive_queue); answ = skb ? skb->len :0 ; -release_sock (sk); +spin_unlock_bh (&sk->sk_receive_queue.lock);return put_user (answ, (int __user *)arg);case SIOCPNADDRESOURCE :
Greg Kroah-Hartman
maintainerPATCH 179/195 phonet/pep: fix racy skb_queue_empty() use
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rémi Denis-Courmont <[email protected]>
[ Upstream commit 7d2a894d7f487dcb894df023e9d3014cf5b93fe5 ]
The receive queues are protected by their respective spin-lock, not the socket lock. This could lead to skb_peek() unexpectedly returning NULL or a pointer to an already dequeued socket buffer.
--- net/phonet/pep.c | 41 ++++++++++++++++++++++++++++++++--------- 1 file changed, 32 insertions(+), 9 deletions(-)
net/phonet/pep.c +32 -9
@@ -917,6 +917,37 @@ static int pep_sock_enable(struct sock *return 0 ; } +static unsigned int pep_first_packet_length (struct sock *sk) +{ +struct pep_sock *pn =pep_sk (sk); +struct sk_buff_head *q; +struct sk_buff *skb; +unsigned int len =0 ; +bool found = false; + +if (sock_flag (sk,SOCK_URGINLINE )) { + q = &pn->ctrlreq_queue; +spin_lock_bh (&q->lock); + skb =skb_peek (q); +if (skb) { + len = skb->len; + found = true; + } +spin_unlock_bh (&q->lock); + } + +if (likely (!found)) { + q = &sk->sk_receive_queue; +spin_lock_bh (&q->lock); + skb =skb_peek (q); +if (skb) + len = skb->len; +spin_unlock_bh (&q->lock); + } + +return len; +} +static int pep_ioctl (struct sock *sk,int cmd,unsigned long arg) {struct pep_sock *pn =pep_sk (sk);
@@ -930,15 +961,7 @@ static int pep_ioctl(struct sock *sk, inbreak ; } -lock_sock (sk); -if (sock_flag (sk,SOCK_URGINLINE ) && - !skb_queue_empty (&pn->ctrlreq_queue)) - answ =skb_peek (&pn->ctrlreq_queue)->len; -else if (!skb_queue_empty (&sk->sk_receive_queue)) - answ =skb_peek (&sk->sk_receive_queue)->len; -else - answ =0 ; -release_sock (sk); + answ =pep_first_packet_length (sk); ret =put_user (answ, (int __user *)arg);break ;
Greg Kroah-Hartman
maintainerPATCH 180/195 Fix write to cloned skb in ipv6_hop_ioam()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Justin Iurman <[email protected]>
[ Upstream commit f198d933c2e4f8f89e0620fbaf1ea7eac384a0eb ]
ioam6_fill_trace_data() writes inside the skb payload without ensuring it's writeable (e.g., not cloned). This function is called both from the input and output path. The output path (ioam6_iptunnel) already does the check. This commit provides a fix for the input path, inside ipv6_hop_ioam(). It also updates ip6_parse_tlv() to refresh the network header pointer ("nh") when returning from ipv6_hop_ioam().
--- net/ipv6/exthdrs.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
net/ipv6/exthdrs.c +10 -0
@@ -180,6 +180,8 @@ static bool ip6_parse_tlv(bool hopbyhop,case IPV6_TLV_IOAM :if (!ipv6_hop_ioam (skb, off))return false; + + nh =skb_network_header (skb);break ;case IPV6_TLV_JUMBO :if (!ipv6_hop_jumbo (skb, off))
@@ -974,6 +976,14 @@ static bool ipv6_hop_ioam(struct sk_buff *skb, int optoff)if (!skb_valid_dst (skb))ip6_route_input (skb); +/* About to mangle packet header */ +if (skb_ensure_writable (skb, optoff +2 + hdr->opt_len)) + goto drop; + +/* Trace pointer may have changed */ + trace = (struct ioam6_trace_hdr *)(skb_network_header (skb) + + optoff +sizeof (*hdr)); +ioam6_fill_trace_data (skb, ns, trace, true);break ;default :
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 181/195 net: phy: realtek: Fix rtl8211f_config_init() for RTL8211F(D)(I)-VD-CG PHY
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Siddharth Vadapalli <[email protected]>
[ Upstream commit 3489182b11d35f1944c1245fc9c4867cf622c50f ]
Commit bb726b753f75 ("net: phy: realtek: add support for RTL8211F(D)(I)-VD-CG") extended support of the driver from the existing support for RTL8211F(D)(I)-CG PHY to the newer RTL8211F(D)(I)-VD-CG PHY.
While that commit indicated that the RTL8211F_PHYCR2 register is not supported by the "VD-CG" PHY model and therefore updated the corresponding section in rtl8211f_config_init() to be invoked conditionally, the call to "genphy_soft_reset()" was left as-is, when it should have also been invoked conditionally. This is because the call to "genphy_soft_reset()" was first introduced by the commit 0a4355c2b7f8 ("net: phy: realtek: add dt property to disable CLKOUT clock") since the RTL8211F guide indicates that a PHY reset should be issued after setting bits in the PHYCR2 register.
As the PHYCR2 register is not applicable to the "VD-CG" PHY model, fix the rtl8211f_config_init() function by invoking "genphy_soft_reset()" conditionally based on the presence of the "PHYCR2" register.
--- drivers/net/phy/realtek.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/phy/realtek.c +3 -1
@@ -414,9 +414,11 @@ static int rtl8211f_config_init(struct phy_device *phydev) ERR_PTR(ret));return ret; } + +return genphy_soft_reset (phydev); } -return genphy_soft_reset (phydev); +return 0 ; }static int rtl821x_resume (struct phy_device *phydev)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 182/195 drm/syncobj: call drm_syncobj_fence_add_wait when WAIT_AVAILABLE flag is set
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Erik Kurzinger <[email protected]>
[ Upstream commit 3c43177ffb54ea5be97505eb8e2690e99ac96bc9 ]
When waiting for a syncobj timeline point whose fence has not yet been submitted with the WAIT_FOR_SUBMIT flag, a callback is registered using drm_syncobj_fence_add_wait and the thread is put to sleep until the timeout expires. If the fence is submitted before then, drm_syncobj_add_point will wake up the sleeping thread immediately which will proceed to wait for the fence to be signaled.
However, if the WAIT_AVAILABLE flag is used instead, drm_syncobj_fence_add_wait won't get called, meaning the waiting thread will always sleep for the full timeout duration, even if the fence gets submitted earlier. If it turns out that the fence *has* been submitted by the time it eventually wakes up, it will still indicate to userspace that the wait completed successfully (it won't return -ETIME), but it will have taken much longer than it should have.
To fix this, we must call drm_syncobj_fence_add_wait if *either* the WAIT_FOR_SUBMIT flag or the WAIT_AVAILABLE flag is set. The only difference being that with WAIT_FOR_SUBMIT we will also wait for the fence to be signaled after it has been submitted while with WAIT_AVAILABLE we will return immediately.
IGT test patch: https://lists.freedesktop.org/archives/igt-dev/2024-January/067537.html
v1 -> v2: adjust lockdep_assert_none_held_once condition
(cherry picked from commit 8c44ea81634a4a337df70a32621a5f3791be23df)
--- drivers/gpu/drm/drm_syncobj.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_syncobj.c +4 -2
@@ -980,7 +980,8 @@ static signed long drm_syncobj_array_wait_timeout(struct drm_syncobj **syncobjs,uint64_t *points;uint32_t signaled_count, i; -if (flags &DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT ) +if (flags & (DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT | +DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE ))lockdep_assert_none_held_once (); points =kmalloc_array (count,sizeof (*points),GFP_KERNEL );
@@ -1049,7 +1050,8 @@ static signed long drm_syncobj_array_wait_timeout(struct drm_syncobj **syncobjs,* fallthough and try a 0 timeout wait! */ -if (flags &DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT ) { +if (flags & (DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT | +DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE )) {for (i =0 ; i < count; ++i)drm_syncobj_fence_add_wait (syncobjs[i], &entries[i]); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 183/195 drm/amd/display: Fix memory leak in dm_sw_fini()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Armin Wolf <[email protected]>
[ Upstream commit bae67893578d608e35691dcdfa90c4957debf1d3 ]
After destroying dmub_srv, the memory associated with it is not freed, causing a memory leak:
unreferenced object 0xffff896302b45800 (size 1024):
comm "(udev-worker)", pid 222, jiffies 4294894636 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 (crc 6265fd77):
[<ffffffff993495ed>] kmalloc_trace+0x29d/0x340
[<ffffffffc0ea4a94>] dm_dmub_sw_init+0xb4/0x450 [amdgpu]
[<ffffffffc0ea4e55>] dm_sw_init+0x15/0x2b0 [amdgpu]
[<ffffffffc0ba8557>] amdgpu_device_init+0x1417/0x24e0 [amdgpu]
[<ffffffffc0bab285>] amdgpu_driver_load_kms+0x15/0x190 [amdgpu]
[<ffffffffc0ba09c7>] amdgpu_pci_probe+0x187/0x4e0 [amdgpu]
[<ffffffff9968fd1e>] local_pci_probe+0x3e/0x90
[<ffffffff996918a3>] pci_device_probe+0xc3/0x230
[<ffffffff99805872>] really_probe+0xe2/0x480
[<ffffffff99805c98>] __driver_probe_device+0x78/0x160
[<ffffffff99805daf>] driver_probe_device+0x1f/0x90
[<ffffffff9980601e>] __driver_attach+0xce/0x1c0
[<ffffffff99803170>] bus_for_each_dev+0x70/0xc0
[<ffffffff99804822>] bus_add_driver+0x112/0x210
[<ffffffff99807245>] driver_register+0x55/0x100
[<ffffffff990012d1>] do_one_initcall+0x41/0x300Fix this by freeing dmub_srv after destroying it.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1 -0
@@ -2255,6 +2255,7 @@ static int dm_sw_fini(void *handle)if (adev->dm.dmub_srv) {dmub_srv_destroy (adev->dm.dmub_srv); +kfree (adev->dm.dmub_srv); adev->dm.dmub_srv =NULL ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 184/195 i2c: imx: when being a target, mark the last read as processed
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Corey Minyard <[email protected]>
[ Upstream commit 87aec499368d488c20292952d6d4be7cb9e49c5e ]
When being a target, NAK from the controller means that all bytes have been transferred. So, the last byte needs also to be marked as 'processed'. Otherwise index registers of backends may not increase.
--- drivers/i2c/busses/i2c-imx.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/i2c/busses/i2c-imx.c +5 -0
@@ -804,6 +804,11 @@ static irqreturn_t i2c_imx_slave_handle(struct imx_i2c_struct *i2c_imx, ctl &= ~I2CR_MTX ;imx_i2c_write_reg (ctl, i2c_imx,IMX_I2C_I2CR );imx_i2c_read_reg (i2c_imx,IMX_I2C_I2DR ); + +/* flag the last byte as processed */ +i2c_imx_slave_event (i2c_imx, +I2C_SLAVE_READ_PROCESSED , &value); +i2c_imx_slave_finish_op (i2c_imx);return IRQ_HANDLED ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 185/195 erofs: simplify compression configuration parser
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gao Xiang <[email protected]>
commit efb4fb02cef3ab410b603c8f0e1c67f61d55f542 upstream.
Move erofs_load_compr_cfgs() into decompressor.c as well as introduce a callback instead of a hard-coded switch for each algorithm for simplicity.
Stable-dep-of: 118a8cf504d7 ("erofs: fix inconsistent per-file compression format")
--- fs/erofs/compress.h | 4 ++ fs/erofs/decompressor.c | 60 ++++++++++++++++++++++++++++++++++- fs/erofs/decompressor_lzma.c | 4 +- fs/erofs/internal.h | 28 +--------------- fs/erofs/super.c | 72 +++++-------------------------------------- 5 files changed, 76 insertions(+), 92 deletions(-)
fs/erofs/compress.h +4 -0
@@ -21,6 +21,8 @@ struct z_erofs_decompress_req { };struct z_erofs_decompressor { +int (*config)(struct super_block *sb,struct erofs_super_block *dsb, +void *data,int size);int (*decompress)(struct z_erofs_decompress_req *rq,struct page **pagepool);char *name;
@@ -93,6 +95,8 @@ int z_erofs_decompress(struct z_erofs_de struct page **pagepool);/* prototypes for specific algorithms */ +int z_erofs_load_lzma_config (struct super_block *sb, +struct erofs_super_block *dsb,void *data,int size);int z_erofs_lzma_decompress (struct z_erofs_decompress_req *rq,struct page **pagepool);#endif
fs/erofs/decompressor.c +57 -3
85 lines not on this page · raw message
fs/erofs/decompressor_lzma.c +2 -2
@@ -72,10 +72,10 @@ int z_erofs_lzma_init(void) }int z_erofs_load_lzma_config (struct super_block *sb, -struct erofs_super_block *dsb, -struct z_erofs_lzma_cfgs *lzma,int size) +struct erofs_super_block *dsb,void *data,int size) {static DEFINE_MUTEX (lzma_resize_mutex); +struct z_erofs_lzma_cfgs *lzma = data;unsigned int dict_size, i;struct z_erofs_lzma *strm, *head =NULL ;int err;
fs/erofs/internal.h +3 -25
@@ -471,6 +471,8 @@ struct erofs_map_dev {/* data.c */ extern const struct file_operations erofs_file_fops; +void *erofs_read_metadata (struct super_block *sb,struct erofs_buf *buf, +erofs_off_t *offset,int *lengthp);void erofs_unmap_metabuf (struct erofs_buf *buf);void erofs_put_metabuf (struct erofs_buf *buf); void *erofs_bread(struct erofs_buf *buf, struct inode *inode,
@@ -565,9 +567,7 @@ void z_erofs_exit_zip_subsystem(void);int erofs_try_to_free_all_cached_pages (struct erofs_sb_info *sbi,struct erofs_workgroup *egrp);int erofs_try_to_free_cached_page (struct page *page); -int z_erofs_load_lz4_config (struct super_block *sb, -struct erofs_super_block *dsb, -struct z_erofs_lz4_cfgs *lz4,int len); +int z_erofs_parse_cfgs (struct super_block *sb,struct erofs_super_block *dsb);#else static inline void erofs_shrinker_register (struct super_block *sb) {}static inline void erofs_shrinker_unregister (struct super_block *sb) {}
@@ -575,36 +575,14 @@ static inline int erofs_init_shrinker(vostatic inline void erofs_exit_shrinker (void ) {}static inline int z_erofs_init_zip_subsystem (void ) {return 0 ; }static inline void z_erofs_exit_zip_subsystem (void ) {} -static inline int z_erofs_load_lz4_config (struct super_block *sb, -struct erofs_super_block *dsb, -struct z_erofs_lz4_cfgs *lz4,int len) -{ -if (lz4 || dsb->u1.lz4_max_distance) { -erofs_err (sb,"lz4 algorithm isn't enabled" ); -return -EINVAL ; - } -return 0 ; -}#endif /* !CONFIG_EROFS_FS_ZIP */ #ifdef CONFIG_EROFS_FS_ZIP_LZMA int z_erofs_lzma_init (void );void z_erofs_lzma_exit (void ); -int z_erofs_load_lzma_config (struct super_block *sb, -struct erofs_super_block *dsb, -struct z_erofs_lzma_cfgs *lzma,int size);#else static inline int z_erofs_lzma_init (void ) {return 0 ; }static inline int z_erofs_lzma_exit (void ) {return 0 ; } -static inline int z_erofs_load_lzma_config (struct super_block *sb, -struct erofs_super_block *dsb, -struct z_erofs_lzma_cfgs *lzma,int size) { -if (lzma) { -erofs_err (sb,"lzma algorithm isn't enabled" ); -return -EINVAL ; - } -return 0 ; -}#endif /* !CONFIG_EROFS_FS_ZIP */ /* flags for erofs_fscache_register_cookie() */
fs/erofs/super.c +10 -62
92 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 186/195 erofs: fix inconsistent per-file compression format
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gao Xiang <[email protected]>
commit 118a8cf504d7dfa519562d000f423ee3ca75d2c4 upstream.
EROFS can select compression algorithms on a per-file basis, and each per-file compression algorithm needs to be marked in the on-disk superblock for initialization.
However, syzkaller can generate inconsistent crafted images that use an unsupported algorithmtype for specific inodes, e.g. use MicroLZMA algorithmtype even it's not set in sbi->available_compr_algs. This can lead to an unexpected "BUG: kernel NULL pointer dereference" if the corresponding decompressor isn't built-in.
Fix this by checking against sbi->available_compr_algs for each m_algorithmformat request. Incorrect !erofs_sb_has_compr_cfgs preset bitmap is now fixed together since it was harmless previously.
--- fs/erofs/decompressor.c | 2 +- fs/erofs/zmap.c | 23 +++++++++++++---------- 2 files changed, 14 insertions(+), 11 deletions(-)
fs/erofs/decompressor.c +1 -1
@@ -396,7 +396,7 @@ int z_erofs_parse_cfgs(struct super_blocint size, ret =0 ;if (!erofs_sb_has_compr_cfgs (sbi)) { - sbi->available_compr_algs =Z_EROFS_COMPRESSION_LZ4 ; + sbi->available_compr_algs =1 <<Z_EROFS_COMPRESSION_LZ4 ;return z_erofs_load_lz4_config (sb, dsb,NULL ,0 ); }
fs/erofs/zmap.c +13 -10
@@ -610,7 +610,7 @@ static int z_erofs_do_map_blocks(struct .map = map, };int err =0 ; -unsigned int lclusterbits, endoff; +unsigned int lclusterbits, endoff, afmt;unsigned long initial_lcn;unsigned long long ofs, end;
@@ -700,17 +700,20 @@ static int z_erofs_do_map_blocks(struct err = -EFSCORRUPTED ; goto unmap_out; } -if (vi->z_advise &Z_EROFS_ADVISE_INTERLACED_PCLUSTER ) - map->m_algorithmformat = -Z_EROFS_COMPRESSION_INTERLACED ; -else - map->m_algorithmformat = -Z_EROFS_COMPRESSION_SHIFTED ; - }else if (m.headtype ==Z_EROFS_VLE_CLUSTER_TYPE_HEAD2 ) { - map->m_algorithmformat = vi->z_algorithmtype[1 ]; + afmt = vi->z_advise &Z_EROFS_ADVISE_INTERLACED_PCLUSTER ? +Z_EROFS_COMPRESSION_INTERLACED : +Z_EROFS_COMPRESSION_SHIFTED ; }else { - map->m_algorithmformat = vi->z_algorithmtype[0 ]; + afmt = m.headtype ==Z_EROFS_VLE_CLUSTER_TYPE_HEAD2 ? + vi->z_algorithmtype[1 ] : vi->z_algorithmtype[0 ]; +if (!(EROFS_I_SB (inode)->available_compr_algs & (1 << afmt))) { +erofs_err (inode->i_sb,"inconsistent algorithmtype %u for nid %llu" , + afmt, vi->nid); + err = -EFSCORRUPTED ; + goto unmap_out; + } } + map->m_algorithmformat = afmt; if ((flags & EROFS_GET_BLOCKS_FIEMAP) || ((flags & EROFS_GET_BLOCKS_READMORE) &&
Greg Kroah-Hartman
maintainerPATCH 187/195 mm/damon/reclaim: fix quota stauts loss due to online tunings
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: SeongJae Park <[email protected]>
commit 1b0ca4e4ff10a2c8402e2cf70132c683e1c772e4 upstream.
Patch series "mm/damon: fix quota status loss due to online tunings".
DAMON_RECLAIM and DAMON_LRU_SORT is not preserving internal quota status when applying new user parameters, and hence could cause temporal quota accuracy degradation. Fix it by preserving the status.
This patch (of 2):
For online parameters change, DAMON_RECLAIM creates new scheme based on latest values of the parameters and replaces the old scheme with the new one. When creating it, the internal status of the quota of the old scheme is not preserved. As a result, charging of the quota starts from zero after the online tuning. The data that collected to estimate the throughput of the scheme's action is also reset, and therefore the estimation should start from the scratch again. Because the throughput estimation is being used to convert the time quota to the effective size quota, this could result in temporal time quota inaccuracy. It would be recovered over time, though. In short, the quota accuracy could be temporarily degraded after online parameters update.
Fix the problem by checking the case and copying the internal fields for the status.
--- mm/damon/reclaim.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)
mm/damon/reclaim.c +17 -1
@@ -141,9 +141,20 @@ static struct damos *damon_reclaim_new_s &damon_reclaim_wmarks); } +static void damon_reclaim_copy_quota_status (struct damos_quota *dst, +struct damos_quota *src) +{ + dst->total_charged_sz = src->total_charged_sz; + dst->total_charged_ns = src->total_charged_ns; + dst->charged_sz = src->charged_sz; + dst->charged_from = src->charged_from; + dst->charge_target_from = src->charge_target_from; + dst->charge_addr_from = src->charge_addr_from; +} +static int damon_reclaim_apply_parameters (void ) { -struct damos *scheme; +struct damos *scheme, *old_scheme;int err =0 ; err =damon_set_attrs (ctx, &damon_reclaim_mon_attrs);
@@ -154,6 +165,11 @@ static int damon_reclaim_apply_parameter scheme =damon_reclaim_new_scheme ();if (!scheme)return -ENOMEM ; +if (!list_empty (&ctx->schemes)) { +damon_for_each_scheme (old_scheme, ctx) +damon_reclaim_copy_quota_status (&scheme->quota, + &old_scheme->quota); + }damon_set_schemes (ctx, &scheme,1 ); return damon_set_region_biggest_system_ram_default(target,
Greg Kroah-Hartman
maintainerPATCH 188/195 fs/aio: Restrict kiocb_set_cancel_fn() to I/O submitted via libaio
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bart Van Assche <[email protected]>
commit b820de741ae48ccf50dd95e297889c286ff4f760 upstream.
If kiocb_set_cancel_fn() is called for I/O submitted via io_uring, the following kernel warning appears:
WARNING: CPU: 3 PID: 368 at fs/aio.c:598 kiocb_set_cancel_fn+0x9c/0xa8 Call trace: kiocb_set_cancel_fn+0x9c/0xa8 ffs_epfile_read_iter+0x144/0x1d0 io_read+0x19c/0x498 io_issue_sqe+0x118/0x27c io_submit_sqes+0x25c/0x5fc __arm64_sys_io_uring_enter+0x104/0xab0 invoke_syscall+0x58/0x11c el0_svc_common+0xb4/0xf4 do_el0_svc+0x2c/0xb0 el0_svc+0x2c/0xa4 el0t_64_sync_handler+0x68/0xb4 el0t_64_sync+0x1a4/0x1a8
Fix this by setting the IOCB_AIO_RW flag for read and write I/O that is submitted by libaio.
--- fs/aio.c | 9 ++++++++- include/linux/fs.h | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-)
fs/aio.c +8 -1
@@ -595,6 +595,13 @@ void kiocb_set_cancel_fn(struct kiocb *istruct kioctx *ctx = req->ki_ctx;unsigned long flags; +/* +* kiocb didn't come from aio or is neither a read nor a write, hence +* ignore it. +*/ +if (!(iocb->ki_flags &IOCB_AIO_RW )) +return ; +if (WARN_ON_ONCE (!list_empty (&req->ki_list)))return ;
@@ -1476,7 +1483,7 @@ static int aio_prep_rw(struct kiocb *req req->ki_complete = aio_complete_rw; req->private =NULL ; req->ki_pos = iocb->aio_offset; - req->ki_flags = req->ki_filp->f_iocb_flags; + req->ki_flags = req->ki_filp->f_iocb_flags |IOCB_AIO_RW ;if (iocb->aio_flags &IOCB_FLAG_RESFD ) req->ki_flags |=IOCB_EVENTFD ;if (iocb->aio_flags &IOCB_FLAG_IOPRIO ) {
include/linux/fs.h +2 -0
@@ -337,6 +337,8 @@ enum rw_hint {#define IOCB_NOIO (1 << 20)/* can use bio alloc cache */ #define IOCB_ALLOC_CACHE (1 << 21) +/* kiocb is a read or write operation submitted by fs/aio.c. */ +#define IOCB_AIO_RW (1 << 23)struct kiocb {struct file *ki_filp;
Greg Kroah-Hartman
maintainerPATCH 189/195 mm: zswap: fix missing folio cleanup in writeback race path
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yosry Ahmed <[email protected]>
commit e3b63e966cac0bf78aaa1efede1827a252815a1d upstream.
In zswap_writeback_entry(), after we get a folio from __read_swap_cache_async(), we grab the tree lock again to check that the swap entry was not invalidated and recycled. If it was, we delete the folio we just added to the swap cache and exit.
However, __read_swap_cache_async() returns the folio locked when it is newly allocated, which is always true for this path, and the folio is ref'd. Make sure to unlock and put the folio before returning.
This was discovered by code inspection, probably because this path handles a race condition that should not happen often, and the bug would not crash the system, it will only strand the folio indefinitely.
--- mm/zswap.c | 2 ++ 1 file changed, 2 insertions(+)
mm/zswap.c +2 -0
@@ -1013,6 +1013,8 @@ static int zswap_writeback_entry(structif (zswap_rb_search (&tree->rbroot, entry->offset) != entry) {spin_unlock (&tree->lock);delete_from_swap_cache (page_folio (page)); +unlock_page (page); +put_page (page); ret = -ENOMEM ; goto fail; }
Greg Kroah-Hartman
maintainerPATCH 190/195 mptcp: userspace pm send RM_ADDR for ID 0
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geliang Tang <[email protected]>
commit 84c531f54ad9a124a924c9505d74e33d16965146 upstream.
This patch adds the ability to send RM_ADDR for local ID 0. Check whether id 0 address is removed, if not, put id 0 into a removing list, pass it to mptcp_pm_remove_addr() to remove id 0 address.
There is no reason not to allow the userspace to remove the initial address (ID 0). This special case was not taken into account not letting the userspace to delete all addresses as announced.
--- net/mptcp/pm_userspace.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+)
net/mptcp/pm_userspace.c +39 -0
@@ -222,6 +222,40 @@ int mptcp_nl_cmd_announce(struct sk_buffreturn err; } +static int mptcp_userspace_pm_remove_id_zero_address (struct mptcp_sock *msk, +struct genl_info *info) +{ +struct mptcp_rm_list list = { .nr =0 }; +struct mptcp_subflow_context *subflow; +struct sock *sk = (struct sock *)msk; +bool has_id_0 = false; +int err = -EINVAL ; + +lock_sock (sk); +mptcp_for_each_subflow (msk, subflow) { +if (subflow->local_id ==0 ) { + has_id_0 = true; +break ; + } + } +if (!has_id_0) { +GENL_SET_ERR_MSG (info,"address with id 0 not found" ); + goto remove_err; + } + + list.ids[list.nr++] =0 ; + +spin_lock_bh (&msk->pm.lock); +mptcp_pm_remove_addr (msk, &list); +spin_unlock_bh (&msk->pm.lock); + + err =0 ; + +remove_err: +release_sock (sk); +return err; +} +int mptcp_nl_cmd_remove (struct sk_buff *skb,struct genl_info *info) {struct nlattr *token = info->attrs[MPTCP_PM_ATTR_TOKEN ];
@@ -253,6 +287,11 @@ int mptcp_nl_cmd_remove(struct sk_buff * goto remove_err; } +if (id_val ==0 ) { + err =mptcp_userspace_pm_remove_id_zero_address (msk, info); + goto remove_err; + } +lock_sock ((struct sock *)msk);list_for_each_entry (entry, &msk->pm.userspace_pm_local_addr_list, list) {
Greg Kroah-Hartman
maintainerPATCH 191/195 mptcp: add needs_id for netlink appending addr
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geliang Tang <[email protected]>
commit 584f3894262634596532cf43a5e782e34a0ce374 upstream.
Just the same as userspace PM, a new parameter needs_id is added for in-kernel PM mptcp_pm_nl_append_new_local_addr() too.
Add a new helper mptcp_pm_has_addr_attr_id() to check whether an address ID is set from PM or not.
In mptcp_pm_nl_get_local_id(), needs_id is always true, but in mptcp_pm_nl_add_addr_doit(), pass mptcp_pm_has_addr_attr_id() to needs_it.
--- net/mptcp/pm_netlink.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-)
net/mptcp/pm_netlink.c +19 -5
@@ -900,7 +900,8 @@ static void __mptcp_pm_release_addr_entr }static int mptcp_pm_nl_append_new_local_addr (struct pm_nl_pernet *pernet, -struct mptcp_pm_addr_entry *entry) +struct mptcp_pm_addr_entry *entry, +bool needs_id) {struct mptcp_pm_addr_entry *cur, *del_entry =NULL ;unsigned int addr_max;
@@ -942,7 +943,7 @@ static int mptcp_pm_nl_append_new_local_ } } -if (!entry->addr.id) { +if (!entry->addr.id && needs_id) { find_next: entry->addr.id = find_next_zero_bit(pernet->id_bitmap, MPTCP_PM_MAX_ADDR_ID + 1,
@@ -953,7 +954,7 @@ find_next: } } -if (!entry->addr.id) +if (!entry->addr.id && needs_id) goto out;__set_bit (entry->addr.id, pernet->id_bitmap);
@@ -1095,7 +1096,7 @@ int mptcp_pm_nl_get_local_id(struct mptc entry->ifindex =0 ; entry->flags =MPTCP_PM_ADDR_FLAG_IMPLICIT ; entry->lsk =NULL ; - ret =mptcp_pm_nl_append_new_local_addr (pernet, entry); + ret =mptcp_pm_nl_append_new_local_addr (pernet, entry, true);if (ret <0 )kfree (entry);
@@ -1311,6 +1312,18 @@ next:return 0 ; } +static bool mptcp_pm_has_addr_attr_id (const struct nlattr *attr, +struct genl_info *info) +{ +struct nlattr *tb[MPTCP_PM_ADDR_ATTR_MAX +1 ]; + +if (!nla_parse_nested_deprecated (tb,MPTCP_PM_ADDR_ATTR_MAX , attr, + mptcp_pm_addr_policy, info->extack) && + tb[MPTCP_PM_ADDR_ATTR_ID ]) +return true; +return false; +} +static int mptcp_nl_cmd_add_addr (struct sk_buff *skb,struct genl_info *info) {struct nlattr *attr = info->attrs[MPTCP_PM_ATTR_ADDR ];
@@ -1352,7 +1365,8 @@ static int mptcp_nl_cmd_add_addr(struct goto out_free; } } - ret =mptcp_pm_nl_append_new_local_addr (pernet, entry); + ret =mptcp_pm_nl_append_new_local_addr (pernet, entry, + !mptcp_pm_has_addr_attr_id (attr, info));if (ret <0 ) {GENL_SET_ERR_MSG (info,"too many addresses or duplicate one" ); goto out_free;
Greg Kroah-Hartman
maintainerPATCH 192/195 ata: ahci: add identifiers for ASM2116 series adapters
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Szuying Chen <[email protected]>
commit 3bf6141060948e27b62b13beb216887f2e54591e upstream.
Add support for PCIe SATA adapter cards based on Asmedia 2116 controllers. These cards can provide up to 10 SATA ports on PCIe card.
--- drivers/ata/ahci.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/ata/ahci.c +5 -0
@@ -613,6 +613,11 @@ static const struct pci_device_id ahci_p { PCI_VDEVICE(ASMEDIA, 0x0621), board_ahci }, /* ASM1061R */ { PCI_VDEVICE(ASMEDIA, 0x0622), board_ahci }, /* ASM1062R */ { PCI_VDEVICE(ASMEDIA, 0x0624), board_ahci }, /* ASM1062+JMB575 */ + { PCI_VDEVICE(ASMEDIA, 0x1062), board_ahci }, /* ASM1062A */ + { PCI_VDEVICE(ASMEDIA, 0x1064), board_ahci }, /* ASM1064 */ + { PCI_VDEVICE(ASMEDIA, 0x1164), board_ahci }, /* ASM1164 */ + { PCI_VDEVICE(ASMEDIA, 0x1165), board_ahci }, /* ASM1165 */ + { PCI_VDEVICE(ASMEDIA, 0x1166), board_ahci }, /* ASM1166 *//* * Samsung SSDs found on some macbooks. NCQ times out if MSI is
Greg Kroah-Hartman
maintainerPATCH 193/195 ahci: Extend ASM1061 43-bit DMA address quirk to other ASM106x parts
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lennert Buytenhek <[email protected]>
commit 51af8f255bdaca6d501afc0d085b808f67b44d91 upstream.
ASMedia have confirmed that all ASM106x parts currently listed in ahci_pci_tbl[] suffer from the 43-bit DMA address limitation that we ran into on the ASM1061, and therefore, we need to apply the quirk added by commit 20730e9b2778 ("ahci: add 43-bit DMA address quirk for ASMedia ASM1061 controllers") to the other supported ASM106x parts as well.
--- drivers/ata/ahci.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/ata/ahci.c +5 -5
@@ -606,13 +606,13 @@ static const struct pci_device_id ahci_p { PCI_VDEVICE(PROMISE, 0x3781), board_ahci }, /* FastTrak TX8660 ahci-mode *//* ASMedia */ - { PCI_VDEVICE(ASMEDIA, 0x0601), board_ahci }, /* ASM1060 */ - { PCI_VDEVICE(ASMEDIA, 0x0602), board_ahci }, /* ASM1060 */ + { PCI_VDEVICE(ASMEDIA, 0x0601), board_ahci_43bit_dma }, /* ASM1060 */ + { PCI_VDEVICE(ASMEDIA, 0x0602), board_ahci_43bit_dma }, /* ASM1060 */ { PCI_VDEVICE(ASMEDIA, 0x0611), board_ahci_43bit_dma }, /* ASM1061 */ { PCI_VDEVICE(ASMEDIA, 0x0612), board_ahci_43bit_dma }, /* ASM1061/1062 */ - { PCI_VDEVICE(ASMEDIA, 0x0621), board_ahci }, /* ASM1061R */ - { PCI_VDEVICE(ASMEDIA, 0x0622), board_ahci }, /* ASM1062R */ - { PCI_VDEVICE(ASMEDIA, 0x0624), board_ahci }, /* ASM1062+JMB575 */ + { PCI_VDEVICE(ASMEDIA, 0x0621), board_ahci_43bit_dma }, /* ASM1061R */ + { PCI_VDEVICE(ASMEDIA, 0x0622), board_ahci_43bit_dma }, /* ASM1062R */ + { PCI_VDEVICE(ASMEDIA, 0x0624), board_ahci_43bit_dma }, /* ASM1062+JMB575 */ { PCI_VDEVICE(ASMEDIA, 0x1062), board_ahci }, /* ASM1062A */ { PCI_VDEVICE(ASMEDIA, 0x1064), board_ahci }, /* ASM1064 */ { PCI_VDEVICE(ASMEDIA, 0x1164), board_ahci }, /* ASM1164 */
Greg Kroah-Hartman
maintainerPATCH 194/195 arp: Prevent overflow in arp_req_get().
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <[email protected]>
commit a7d6027790acea24446ddd6632d394096c0f4667 upstream.
syzkaller reported an overflown write in arp_req_get(). [0]
When ioctl(SIOCGARP) is issued, arp_req_get() looks up an neighbour entry and copies neigh->ha to struct arpreq.arp_ha.sa_data.
The arp_ha here is struct sockaddr, not struct sockaddr_storage, so the sa_data buffer is just 14 bytes.
In the splat below, 2 bytes are overflown to the next int field, arp_flags. We initialise the field just after the memcpy(), so it's not a problem.
However, when dev->addr_len is greater than 22 (e.g. MAX_ADDR_LEN), arp_netmask is overwritten, which could be set as htonl(0xFFFFFFFFUL) in arp_ioctl() before calling arp_req_get().
To avoid the overflow, let's limit the max length of memcpy().
Note that commit b5f0de6df6dc ("net: dev: Convert sa_data to flexible array in struct sockaddr") just silenced syzkaller.
[0]:
memcpy: detected field-spanning write (size 16) of single field "r->arp_ha.sa_data" at net/ipv4/arp.c:1128 (size 14)
WARNING: CPU: 0 PID: 144638 at net/ipv4/arp.c:1128 arp_req_get+0x411/0x4a0 net/ipv4/arp.c:1128 Modules linked in: CPU: 0 PID: 144638 Comm: syz-executor.4 Not tainted 6.1.74 #31 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.0-debian-1.16.0-5 04/01/2014 RIP: 0010:arp_req_get+0x411/0x4a0 net/ipv4/arp.c:1128 Code: fd ff ff e8 41 42 de fb b9 0e 00 00 00 4c 89 fe 48 c7 c2 20 6d ab 87 48 c7 c7 80 6d ab 87 c6 05 25 af 72 04 01 e8 5f 8d ad fb <0f> 0b e9 6c fd ff ff e8 13 42 de fb be 03 00 00 00 4c 89 e7 e8 a6 RSP: 0018:ffffc900050b7998 EFLAGS: 00010286 RAX: 0000000000000000 RBX: ffff88803a815000 RCX: 0000000000000000 RDX: 0000000000000000 RSI: ffffffff8641a44a RDI: 0000000000000001 RBP: ffffc900050b7a98 R08: 0000000000000001 R09: 0000000000000000 R10: 0000000000000000 R11: 203a7970636d656d R12: ffff888039c54000 R13: 1ffff92000a16f37 R14: ffff88803a815084 R15: 0000000000000010 FS: 00007f172bf306c0(0000) GS:ffff88805aa00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f172b3569f0 CR3: 0000000057f12005 CR4: 0000000000770ef0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 PKRU: 55555554 Call Trace: <TASK> arp_ioctl+0x33f/0x4b0 net/ipv4/arp.c:1261 inet_ioctl+0x314/0x3a0 net/ipv4/af_inet.c:981 sock_do_ioctl+0xdf/0x260 net/socket.c:1204 sock_ioctl+0x3ef/0x650 net/socket.c:1321 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:870 [inline] __se_sys_ioctl fs/ioctl.c:856 [inline] __x64_sys_ioctl+0x18e/0x220 fs/ioctl.c:856 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x37/0x90 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x64/0xce RIP: 0033:0x7f172b262b8d Code: 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 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 c7 c1 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f172bf300b8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 00007f172b3abf80 RCX: 00007f172b262b8d RDX: 0000000020000000 RSI: 0000000000008954 RDI: 0000000000000003 RBP: 00007f172b2d3493 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007f172b3abf80 R15: 00007f172bf10000 </TASK>
--- net/ipv4/arp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/ipv4/arp.c +2 -1
@@ -1125,7 +1125,8 @@ static int arp_req_get(struct arpreq *r,if (neigh) {if (!(READ_ONCE (neigh->nud_state) &NUD_NOARP )) {read_lock_bh (&neigh->lock); -memcpy (r->arp_ha.sa_data, neigh->ha, dev->addr_len); +memcpy (r->arp_ha.sa_data, neigh->ha, +min (dev->addr_len, (unsigned char )sizeof (r->arp_ha.sa_data_min))); r->arp_flags =arp_state_to_flags (neigh);read_unlock_bh (&neigh->lock); r->arp_ha.sa_family = dev->type;
Greg Kroah-Hartman
maintainerPATCH 195/195 fs/ntfs3: Enhance the attribute size check
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Edward Lo <[email protected]>
commit 4f082a7531223a438c757bb20e304f4c941c67a8 upstream.
This combines the overflow and boundary check so that all attribute size will be properly examined while enumerating them.
[ 169.181521] BUG: KASAN: slab-out-of-bounds in run_unpack+0x2e3/0x570 [ 169.183161] Read of size 1 at addr ffff8880094b6240 by task mount/247 [ 169.184046] [ 169.184925] CPU: 0 PID: 247 Comm: mount Not tainted 6.0.0-rc7+ #3 [ 169.185908] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014 [ 169.187066] Call Trace: [ 169.187492] <TASK> [ 169.188049] dump_stack_lvl+0x49/0x63 [ 169.188495] print_report.cold+0xf5/0x689 [ 169.188964] ? run_unpack+0x2e3/0x570 [ 169.189331] kasan_report+0xa7/0x130 [ 169.189714] ? run_unpack+0x2e3/0x570 [ 169.190079] __asan_load1+0x51/0x60 [ 169.190634] run_unpack+0x2e3/0x570 [ 169.191290] ? run_pack+0x840/0x840 [ 169.191569] ? run_lookup_entry+0xb3/0x1f0 [ 169.192443] ? mi_enum_attr+0x20a/0x230 [ 169.192886] run_unpack_ex+0xad/0x3e0 [ 169.193276] ? run_unpack+0x570/0x570 [ 169.193557] ? ni_load_mi+0x80/0x80 [ 169.193889] ? debug_smp_processor_id+0x17/0x20 [ 169.194236] ? mi_init+0x4a/0x70 [ 169.194496] attr_load_runs_vcn+0x166/0x1c0 [ 169.194851] ? attr_data_write_resident+0x250/0x250 [ 169.195188] mi_read+0x133/0x2c0 [ 169.195481] ntfs_iget5+0x277/0x1780 [ 169.196017] ? call_rcu+0x1c7/0x330 [ 169.196392] ? ntfs_get_block_bmap+0x70/0x70 [ 169.196708] ? evict+0x223/0x280 [ 169.197014] ? __kmalloc+0x33/0x540 [ 169.197305] ? wnd_init+0x15b/0x1b0 [ 169.197599] ntfs_fill_super+0x1026/0x1ba0 [ 169.197994] ? put_ntfs+0x1d0/0x1d0 [ 169.198299] ? vsprintf+0x20/0x20 [ 169.198583] ? mutex_unlock+0x81/0xd0 [ 169.198930] ? set_blocksize+0x95/0x150 [ 169.199269] get_tree_bdev+0x232/0x370 [ 169.199750] ? put_ntfs+0x1d0/0x1d0 [ 169.200094] ntfs_fs_get_tree+0x15/0x20 [ 169.200431] vfs_get_tree+0x4c/0x130 [ 169.200714] path_mount+0x654/0xfe0 [ 169.201067] ? putname+0x80/0xa0 [ 169.201358] ? finish_automount+0x2e0/0x2e0 [ 169.201965] ? putname+0x80/0xa0 [ 169.202445] ? kmem_cache_free+0x1c4/0x440 [ 169.203075] ? putname+0x80/0xa0 [ 169.203414] do_mount+0xd6/0xf0 [ 169.203719] ? path_mount+0xfe0/0xfe0 [ 169.203977] ? __kasan_check_write+0x14/0x20 [ 169.204382] __x64_sys_mount+0xca/0x110 [ 169.204711] do_syscall_64+0x3b/0x90 [ 169.205059] entry_SYSCALL_64_after_hwframe+0x63/0xcd [ 169.205571] RIP: 0033:0x7f67a80e948a [ 169.206327] Code: 48 8b 0d 11 fa 2a 00 f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 49 89 ca b8 a5 00 00 008 [ 169.208296] RSP: 002b:00007ffddf020f58 EFLAGS: 00000202 ORIG_RAX: 00000000000000a5 [ 169.209253] RAX: ffffffffffffffda RBX: 000055e2547a6060 RCX: 00007f67a80e948a [ 169.209777] RDX: 000055e2547a6260 RSI: 000055e2547a62e0 RDI: 000055e2547aeaf0 [ 169.210342] RBP: 0000000000000000 R08: 000055e2547a6280 R09: 0000000000000020 [ 169.210843] R10: 00000000c0ed0000 R11: 0000000000000202 R12: 000055e2547aeaf0 [ 169.211307] R13: 000055e2547a6260 R14: 0000000000000000 R15: 00000000ffffffff [ 169.211913] </TASK> [ 169.212304] [ 169.212680] Allocated by task 0: [ 169.212963] (stack is not available) [ 169.213200] [ 169.213472] The buggy address belongs to the object at ffff8880094b5e00 [ 169.213472] which belongs to the cache UDP of size 1152 [ 169.214095] The buggy address is located 1088 bytes inside of [ 169.214095] 1152-byte region [ffff8880094b5e00, ffff8880094b6280) [ 169.214639] [ 169.215004] The buggy address belongs to the physical page: [ 169.215766] page:000000002e324c8c refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x94b4 [ 169.218412] head:000000002e324c8c order:2 compound_mapcount:0 compound_pincount:0 [ 169.219078] flags: 0xfffffc0010200(slab|head|node=0|zone=1|lastcpupid=0x1fffff) [ 169.220272] raw: 000fffffc0010200 0000000000000000 dead000000000122 ffff888002409b40 [ 169.221006] raw: 0000000000000000 00000000800c000c 00000001ffffffff 0000000000000000 [ 169.222320] page dumped because: kasan: bad access detected [ 169.222922] [ 169.223119] Memory state around the buggy address: [ 169.224056] ffff8880094b6100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ 169.224908] ffff8880094b6180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ 169.225677] >ffff8880094b6200: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ 169.226445] ^ [ 169.227055] ffff8880094b6280: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ 169.227638] ffff8880094b6300: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
--- fs/ntfs3/record.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
fs/ntfs3/record.c +2 -7
@@ -226,11 +226,6 @@ struct ATTRIB *mi_enum_attr(struct mft_ireturn NULL ; } -if (off + asize < off) { -/* overflow check */ -return NULL ; - } - attr =Add2Ptr (attr, asize); off += asize; }
@@ -253,8 +248,8 @@ struct ATTRIB *mi_enum_attr(struct mft_iif ((t32 &0xf ) || (t32 >0x100 ))return NULL ; -/* Check boundary. */ -if (off + asize > used) +/* Check overflow and boundary. */ +if (off + asize < off || off + asize > used)return NULL ;/* Check size of attribute. */
Hello,
Quoted 5 lines · On Tue, 27 Feb 2024 14:24:21 +0100 Greg Kroah-Hartman…
This is the start of the stable review cycle for the 6.1.80 release. There are 195 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.
Quoted 8 lines
Responses should be made by Thu, 29 Feb 2024 13:15:36 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.1.80-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.1.y
and the diffstat can be found below.
This rc kernel passes DAMON functionality test[1] on my test machine. Attaching the test results summary below. Please note that I retrieved the kernel from linux-stable-rc tree[2].
[1] https://github.com/awslabs/damon-tests/tree/next/corr
[2] 8b73abf80c8e ("Linux 6.1.80-rc1")
Thanks,
SJ
[...]
---
ok 1 selftests: damon: debugfs_attrs.sh
ok 2 selftests: damon: debugfs_schemes.sh
ok 3 selftests: damon: debugfs_target_ids.sh
ok 4 selftests: damon: debugfs_empty_targets.sh
ok 5 selftests: damon: debugfs_huge_count_read_write.sh
ok 6 selftests: damon: debugfs_duplicate_context_creation.sh
ok 7 selftests: damon: sysfs.sh
ok 1 selftests: damon-tests: kunit.sh
ok 2 selftests: damon-tests: huge_count_read_write.sh
ok 3 selftests: damon-tests: buffer_overflow.sh
ok 4 selftests: damon-tests: rm_contexts.sh
ok 5 selftests: damon-tests: record_null_deref.sh
ok 6 selftests: damon-tests: dbgfs_target_ids_read_before_terminate_race.sh ok 7 selftests: damon-tests: dbgfs_target_ids_pid_leak.sh
ok 8 selftests: damon-tests: damo_tests.sh
ok 9 selftests: damon-tests: masim-record.sh
ok 10 selftests: damon-tests: build_i386.sh
ok 11 selftests: damon-tests: build_arm64.sh
ok 12 selftests: damon-tests: build_m68k.sh
ok 13 selftests: damon-tests: build_i386_idle_flag.sh
ok 14 selftests: damon-tests: build_i386_highpte.sh
ok 15 selftests: damon-tests: build_nomemcg.sh
[33m
[92mPASS [39m
Hi!
Quoted 4 lines
This is the start of the stable review cycle for the 6.1.80 release. There are 195 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-6.1.y
Best regards,
Pavel
Signature · 2 lines
DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Quoted 9 lines
This is the start of the stable review cycle for the 6.1.80 release. There are 195 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, 29 Feb 2024 13:15:36 +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/v6.x/stable-review/patch-6.1.80-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.1.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my x86_64 and ARM64 test systems. No errors or regressions.
Thanks.
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.1.80 release. There are 195 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, 29 Feb 2024 13:15:36 +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/v6.x/stable-review/patch-6.1.80-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.1.y
and the diffstat can be found below.thanks,
greg k-h
On ARCH_BRCMSTB using 32-bit and 64-bit ARM kernels, build tested on BMIPS_GENERIC:
Signature · 1 line
Florian
Quoted 7 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.1.80 release. There are 195 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, 29 Feb 2024 13:15:36 +0000. Anything received after that time might be too late.
No regressions found on WSL (x86 and arm64).
Built, booted, and reviewed dmesg.
Thank you. :)
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.1.80 release. There are 195 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, 29 Feb 2024 13:15:36 +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/v6.x/stable-review/patch-6.1.80-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.1.y
and the diffstat can be found below.thanks,
greg k-h
Results from Linaro’s test farm.
No regressions on arm64, arm, x86_64, and i386.
## Build
* kernel: 6.1.80-rc1
* git: https://gitlab.com/Linaro/lkft/mirrors/stable/linux-stable-rc
* git branch: linux-6.1.y
* git commit: 8b73abf80c8ee1f8776dd96ae9a3ade68848024b
* git describe: v6.1.79-196-g8b73abf80c8e
* test details:
https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-6.1.y/build/v6.1.79-196-g8b73abf80c8e
## Test Regressions (compared to v6.1.79)
## Metric Regressions (compared to v6.1.79)
## Test Fixes (compared to v6.1.79)
## Metric Fixes (compared to v6.1.79)
## Test result summary
total: 147985, pass: 125712, fail: 2533, skip: 19591, xfail: 149
## Build Summary
* arc: 5 total, 5 passed, 0 failed
* arm: 135 total, 135 passed, 0 failed
* arm64: 38 total, 38 passed, 0 failed
* i386: 29 total, 29 passed, 0 failed
* mips: 24 total, 24 passed, 0 failed
* parisc: 3 total, 3 passed, 0 failed
* powerpc: 34 total, 32 passed, 2 failed
* riscv: 9 total, 9 passed, 0 failed
* s390: 12 total, 12 passed, 0 failed
* sh: 10 total, 10 passed, 0 failed
* sparc: 6 total, 6 passed, 0 failed
* x86_64: 33 total, 33 passed, 0 failed
## Test suites summary
* boot
* kselftest-android
* kselftest-arm64
* kselftest-breakpoints
* kselftest-capabilities
* kselftest-cgroup
* kselftest-clone3
* kselftest-core
* kselftest-cpu-hotplug
* kselftest-cpufreq
* kselftest-drivers-dma-buf
* kselftest-efivarfs
* kselftest-exec
* kselftest-filesystems
* kselftest-filesystems-binderfs
* kselftest-filesystems-epoll
* kselftest-firmware
* kselftest-fpu
* kselftest-ftrace
* kselftest-futex
* kselftest-gpio
* kselftest-intel_pstate
* kselftest-ipc
* kselftest-ir
* kselftest-kcmp
* kselftest-kexec
* kselftest-kvm
* kselftest-lib
* kselftest-livepatch
* kselftest-membarrier
* kselftest-memfd
* kselftest-memory-hotplug
* kselftest-mincore
* kselftest-mm
* kselftest-mount
* kselftest-mqueue
* kselftest-net
* kselftest-net-forwarding
* kselftest-net-mptcp
* kselftest-netfilter
* kselftest-nsfs
* kselftest-openat2
* kselftest-pid_namespace
* kselftest-pidfd
* kselftest-proc
* kselftest-pstore
* kselftest-ptrace
* kselftest-rseq
* kselftest-rtc
* kselftest-seccomp
* kselftest-sigaltstack
* kselftest-size
* kselftest-splice
* kselftest-static_keys
* kselftest-sync
* kselftest-sysctl
* kselftest-tc-testing
* kselftest-timens
* kselftest-timers
* kselftest-tmpfs
* kselftest-tpm2
* kselftest-user
* kselftest-user_events
* kselftest-vDSO
* kselftest-watchdog
* kselftest-x86
* kselftest-zram
* kunit
* kvm-unit-tests
* libgpiod
* log-parser-boot
* log-parser-test
* ltp-cap_bounds
* ltp-commands
* ltp-containers
* ltp-controllers
* ltp-cpuhotplug
* ltp-crypto
* ltp-cve
* ltp-dio
* ltp-fcntl-locktests
* ltp-filecaps
* ltp-fs
* ltp-fs_bind
* ltp-fs_perms_simple
* ltp-hugetlb
* ltp-io
* ltp-ipc
* ltp-math
* ltp-mm
* ltp-nptl
* ltp-pty
* ltp-sched
* ltp-securebits
* ltp-smoke
* ltp-smoketest
* ltp-syscalls
* ltp-tracing
* perf
* rcutorture
--
Linaro LKFT
https://lkft.linaro.org
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.1.80 release. There are 195 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, 29 Feb 2024 13:15:36 +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/v6.x/stable-review/patch-6.1.80-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.1.y
and the diffstat can be found below.thanks,
greg k-h
All tests passing for Tegra ...
Test results for stable-v6.1:
10 builds: 10 pass, 0 fail
26 boots: 26 pass, 0 fail
106 tests: 106 pass, 0 failLinux version: 6.1.80-rc1-g8b73abf80c8e
Boards tested: tegra124-jetson-tk1, tegra186-p2771-0000,
tegra194-p2972-0000, tegra194-p3509-0000+p3668-0000,
tegra20-ventana, tegra210-p2371-2180,
tegra210-p3450-0000, tegra30-cardhu-a04Jon
Hi Greg,
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.1.80 release. There are 195 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, 29 Feb 2024 13:15:36 +0000. Anything received after that time might be too late.
Quoted 7 lines
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.1.80-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.1.y
and the diffstat can be found below.thanks,
I tested 6.1.80-rc1 (8b73abf80c8e) on Kalray kvx arch (not upstream yet) and everything looks good!
It ran on real hw (k200, k200lp and k300 boards), on qemu as well as on our internal instruction set simulator (ISS).
Tests were run on several interfaces/drivers (usb, qsfp ethernet, eMMC, PCIe endpoint+RC, SPI, remoteproc, uart, iommu). LTP and uClibc-ng testsuites are also run without any regression.
Everything looks fine to us.
Thanks a lot!
Signature · 1 line
Yann
Quoted 4 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.1.80 release. There are 195 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.
Cheers,
Conor.
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.1.80 release. There are 195 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, 29 Feb 2024 13:15:36 +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/v6.x/stable-review/patch-6.1.80-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.1.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.1.80 release. There are 195 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, 29 Feb 2024 13:15:36 +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/v6.x/stable-review/patch-6.1.80-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.1.y
and the diffstat can be found below.thanks,
greg k-h
Built and booted successfully on RISC-V RV64 (HiFive Unmatched).
Quoted 5 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.1.80 release. There are 195 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.
Quoted 9 lines
Responses should be made by Thu, 29 Feb 2024 13:15:36 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.1.80-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.1.y
and the diffstat can be found below.
KernelCI report for this week :-
## stable-rc HEAD for linux-6.1.y:
Date: 2024-02-26
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/log/?h=464eaec6e9f75f94cc520a865be2ba1eabdd2986
## Build failures:
No build failures seen for the stable-rc/linux-6.1.y commit head \o/
## Boot failures:
No **new** boot failures seen for the stable-rc/linux-6.1.y commit head \o/
Thanks,
Shreeya Patel