clk: sunxi-ng: v3s: Fix TCON reset de-assert bit
Subsystems (15)
Sasha Levin
maintainerPATCH 1/60 clk: sunxi-ng: v3s: Fix TCON reset de-assert bit
From: Paul Kocialkowski <[email protected]>
[ Upstream commit 5c59801f7018acba11b12de59017a3fcdcf7421d ]
According to the datasheet and the reference code from Allwinner, the bit used to de-assert the TCON reset is bit 4, not bit 3.
Fix it in the V3s CCU driver.
--- drivers/clk/sunxi-ng/ccu-sun8i-v3s.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/sunxi-ng/ccu-sun8i-v3s.c +1 -1
@@ -542,7 +542,7 @@ static struct ccu_reset_map sun8i_v3s_ccu_resets[] = { [RST_BUS_OHCI0] = { 0x2c0, BIT(29) }, [RST_BUS_VE] = { 0x2c4, BIT(0) }, - [RST_BUS_TCON0] = { 0x2c4, BIT(3) }, + [RST_BUS_TCON0] = { 0x2c4, BIT(4) }, [RST_BUS_CSI] = { 0x2c4, BIT(8) }, [RST_BUS_DE] = { 0x2c4, BIT(12) }, [RST_BUS_DBG] = { 0x2c4, BIT(31) },
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 2/60 kallsyms: Handle too long symbols in kallsyms.c
From: Eugene Loh <[email protected]>
[ Upstream commit 6db2983cd8064808141ccefd75218f5b4345ffae ]
When checking for symbols with excessively long names, account for null terminating character.
--- scripts/kallsyms.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/kallsyms.c +2 -2
@@ -118,8 +118,8 @@ static int read_symbol(FILE *in, struct sym_entry *s)fprintf (stderr,"Read error or end of file.\n" );return -1 ; } -if (strlen (sym) >KSYM_NAME_LEN ) { -fprintf (stderr,"Symbol %s too long for kallsyms (%zu vs %d).\n" +if (strlen (sym) >=KSYM_NAME_LEN ) { +fprintf (stderr,"Symbol %s too long for kallsyms (%zu >= %d).\n" "Please increase KSYM_NAME_LEN both in kernel and kallsyms.c\n" , sym,strlen (sym),KSYM_NAME_LEN );return -1 ;
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 3/60 clk: sunxi: A31: Fix wrong AHB gate number
In reply to Sasha LevinFrom: Andre Przywara <[email protected]>
[ Upstream commit ee0b27a3a4da0b0ed2318aa092f8856896e9450b ]
According to the manual the gate clock for MMC3 is at bit 11, and NAND1 is controlled by bit 12.
Fix the gate bit definitions in the clock driver.
--- drivers/clk/sunxi-ng/ccu-sun6i-a31.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/clk/sunxi-ng/ccu-sun6i-a31.c +2 -2
@@ -264,9 +264,9 @@ static SUNXI_CCU_GATE(ahb1_mmc1_clk, "ahb1-mmc1", "ahb1", static SUNXI_CCU_GATE(ahb1_mmc2_clk, "ahb1-mmc2", "ahb1", 0x060, BIT(10), 0); static SUNXI_CCU_GATE(ahb1_mmc3_clk, "ahb1-mmc3", "ahb1", - 0x060, BIT(12), 0); + 0x060, BIT(11), 0); static SUNXI_CCU_GATE(ahb1_nand1_clk, "ahb1-nand1", "ahb1", - 0x060, BIT(13), 0); + 0x060, BIT(12), 0); static SUNXI_CCU_GATE(ahb1_nand0_clk, "ahb1-nand0", "ahb1", 0x060, BIT(13), 0); static SUNXI_CCU_GATE(ahb1_sdram_clk, "ahb1-sdram", "ahb1",
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 4/60 esp: Skip TX bytes accounting when sending from a request socket
In reply to Sasha LevinFrom: Martin Willi <[email protected]>
[ Upstream commit 09db51241118aeb06e1c8cd393b45879ce099b36 ]
On ESP output, sk_wmem_alloc is incremented for the added padding if a socket is associated to the skb. When replying with TCP SYNACKs over IPsec, the associated sk is a casted request socket, only. Increasing sk_wmem_alloc on a request socket results in a write at an arbitrary struct offset. In the best case, this produces the following WARNING:
WARNING: CPU: 1 PID: 0 at lib/refcount.c:102 esp_output_head+0x2e4/0x308 [esp4] refcount_t: addition on 0; use-after-free. CPU: 1 PID: 0 Comm: swapper/1 Not tainted 5.0.0-rc3 #2 Hardware name: Marvell Armada 380/385 (Device Tree)
[...]
[<bf0ff354>] (esp_output_head [esp4]) from [<bf1006a4>] (esp_output+0xb8/0x180 [esp4]) [<bf1006a4>] (esp_output [esp4]) from [<c05dee64>] (xfrm_output_resume+0x558/0x664) [<c05dee64>] (xfrm_output_resume) from [<c05d07b0>] (xfrm4_output+0x44/0xc4) [<c05d07b0>] (xfrm4_output) from [<c05956bc>] (tcp_v4_send_synack+0xa8/0xe8) [<c05956bc>] (tcp_v4_send_synack) from [<c0586ad8>] (tcp_conn_request+0x7f4/0x948) [<c0586ad8>] (tcp_conn_request) from [<c058c404>] (tcp_rcv_state_process+0x2a0/0xe64) [<c058c404>] (tcp_rcv_state_process) from [<c05958ac>] (tcp_v4_do_rcv+0xf0/0x1f4) [<c05958ac>] (tcp_v4_do_rcv) from [<c0598a4c>] (tcp_v4_rcv+0xdb8/0xe20) [<c0598a4c>] (tcp_v4_rcv) from [<c056eb74>] (ip_protocol_deliver_rcu+0x2c/0x2dc) [<c056eb74>] (ip_protocol_deliver_rcu) from [<c056ee6c>] (ip_local_deliver_finish+0x48/0x54) [<c056ee6c>] (ip_local_deliver_finish) from [<c056eecc>] (ip_local_deliver+0x54/0xec) [<c056eecc>] (ip_local_deliver) from [<c056efac>] (ip_rcv+0x48/0xb8) [<c056efac>] (ip_rcv) from [<c0519c2c>] (__netif_receive_skb_one_core+0x50/0x6c) [...]
The issue triggers only when not using TCP syncookies, as for syncookies no socket is associated.
--- net/ipv4/esp4.c | 2 +- net/ipv6/esp6.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
net/ipv4/esp4.c +1 -1
@@ -325,7 +325,7 @@ int esp_output_head(struct xfrm_state *x, struct sk_buff *skb, struct esp_info * skb->len += tailen; skb->data_len += tailen; skb->truesize += tailen; -if (sk) +if (sk &&sk_fullsock (sk))refcount_add (tailen, &sk->sk_wmem_alloc); goto out;
net/ipv6/esp6.c +1 -1
@@ -293,7 +293,7 @@ int esp6_output_head(struct xfrm_state *x, struct sk_buff *skb, struct esp_info skb->len += tailen; skb->data_len += tailen; skb->truesize += tailen; -if (sk) +if (sk &&sk_fullsock (sk))refcount_add (tailen, &sk->sk_wmem_alloc); goto out;
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 5/60 ARM: 8824/1: fix a migrating irq bug when hotplug cpu
In reply to Sasha LevinFrom: Dietmar Eggemann <[email protected]>
[ Upstream commit 1b5ba350784242eb1f899bcffd95d2c7cff61e84 ]
Arm TC2 fails cpu hotplug stress test.
This issue was tracked down to a missing copy of the new affinity cpumask for the vexpress-spc interrupt into struct irq_common_data.affinity when the interrupt is migrated in migrate_one_irq().
Fix it by replacing the arm specific hotplug cpu migration with the generic irq code.
This is the counterpart implementation to commit 217d453d473c ("arm64:
fix a migrating irq bug when hotplug cpu").
Tested with cpu hotplug stress test on Arm TC2 (multi_v7_defconfig plus CONFIG_ARM_BIG_LITTLE_CPUFREQ=y and CONFIG_ARM_VEXPRESS_SPC_CPUFREQ=y). The vexpress-spc interrupt (irq=22) on this board is affine to CPU0. Its affinity cpumask now changes correctly e.g. from 0 to 1-4 when CPU0 is hotplugged out.
--- arch/arm/Kconfig | 1 + arch/arm/include/asm/irq.h | 1 - arch/arm/kernel/irq.c | 62 -------------------------------------- arch/arm/kernel/smp.c | 2 +- 4 files changed, 2 insertions(+), 64 deletions(-)
arch/arm/Kconfig +1 -0
@@ -1443,6 +1443,7 @@ config NR_CPUS config HOTPLUG_CPU bool "Support for hot-pluggable CPUs" depends on SMP + select GENERIC_IRQ_MIGRATION help Say Y here to experiment with turning CPUs off and on. CPUs can be controlled through /sys/devices/system/cpu.
arch/arm/include/asm/irq.h +0 -1
@@ -25,7 +25,6 @@#ifndef __ASSEMBLY__struct irqaction ;struct pt_regs ; -extern void migrate_irqs (void );extern void asm_do_IRQ (unsigned int ,struct pt_regs *);void handle_IRQ (unsigned int ,struct pt_regs *);
arch/arm/kernel/irq.c +0 -62
71 lines not on this page · raw message
arch/arm/kernel/smp.c +1 -1
@@ -254,7 +254,7 @@ int __cpu_disable(void)/* * OK - migrate IRQs away from this CPU */ -migrate_irqs (); +irq_migrate_all_off_this_cpu ();/* * Flush user cache and TLB mappings, and then remove this CPU
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 6/60 bpf: Fix narrow load on a bpf_sock returned from sk_lookup()
In reply to Sasha LevinFrom: Martin KaFai Lau <[email protected]>
[ Upstream commit d623876646be119439999a229a2c3ce30fd197fb ]
By adding this test to test_verifier:
{
"reference tracking: access sk->src_ip4 (narrow load)",
.insns = {
BPF_SK_LOOKUP,
BPF_MOV64_REG(BPF_REG_6, BPF_REG_0),
BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0, 3),
BPF_LDX_MEM(BPF_H, BPF_REG_2, BPF_REG_0, offsetof(struct bpf_sock, src_ip4) + 2),
BPF_MOV64_REG(BPF_REG_1, BPF_REG_6),
BPF_EMIT_CALL(BPF_FUNC_sk_release),
BPF_EXIT_INSN(),
},
.prog_type = BPF_PROG_TYPE_SCHED_CLS,
.result = ACCEPT,
},The above test loads 2 bytes from sk->src_ip4 where sk is obtained by bpf_sk_lookup_tcp().
It hits an internal verifier error from convert_ctx_accesses():
[root@arch-fb-vm1 bpf]# ./test_verifier 665 665
Failed to load prog 'Invalid argument'!
0: (b7) r2 = 0
1: (63) *(u32 *)(r10 -8) = r2
2: (7b) *(u64 *)(r10 -16) = r2
3: (7b) *(u64 *)(r10 -24) = r2
4: (7b) *(u64 *)(r10 -32) = r2
5: (7b) *(u64 *)(r10 -40) = r2
6: (7b) *(u64 *)(r10 -48) = r2
7: (bf) r2 = r10
8: (07) r2 += -48
9: (b7) r3 = 36
10: (b7) r4 = 0
11: (b7) r5 = 0
12: (85) call bpf_sk_lookup_tcp#84
13: (bf) r6 = r0
14: (15) if r0 == 0x0 goto pc+3
R0=sock(id=1,off=0,imm=0) R6=sock(id=1,off=0,imm=0) R10=fp0,call_-1 fp-8=????0000 fp-16=0000mmmm fp-24=mmmmmmmm fp-32=mmmmmmmm fp-40=mmmmmmmm fp-48=mmmmmmmm refs=1
15: (69) r2 = *(u16 *)(r0 +26)
16: (bf) r1 = r6
17: (85) call bpf_sk_release#86
18: (95) exit
from 14 to 18: safe
processed 20 insns (limit 131072), stack depth 48
bpf verifier is misconfigured
Summary: 0 PASSED, 0 SKIPPED, 1 FAILED
The bpf_sock_is_valid_access() is expecting src_ip4 can be narrowly loaded (meaning load any 1 or 2 bytes of the src_ip4) by marking info->ctx_field_size. However, this marked ctx_field_size is not used. This patch fixes it.
Due to the recent refactoring in test_verifier, this new test will be added to the bpf-next branch (together with the bpf_tcp_sock patchset) to avoid merge conflict.
--- kernel/bpf/verifier.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
kernel/bpf/verifier.c +7 -4
@@ -1533,12 +1533,13 @@ static int check_flow_keys_access(struct bpf_verifier_env *env, int off,return 0 ; } -static int check_sock_access (struct bpf_verifier_env *env,u32 regno,int off, -int size,enum bpf_access_type t) +static int check_sock_access (struct bpf_verifier_env *env,int insn_idx, +u32 regno,int off,int size, +enum bpf_access_type t) {struct bpf_reg_state *regs =cur_regs (env);struct bpf_reg_state *reg = ®s[regno]; -struct bpf_insn_access_aux info; +struct bpf_insn_access_aux info = {};if (reg->smin_value <0 ) { verbose(env, "R%d min value is negative, either use unsigned index or do a if (index >=0) check.\n",
@@ -1552,6 +1553,8 @@ static int check_sock_access(struct bpf_verifier_env *env, u32 regno, int off,return -EACCES ; } + env->insn_aux_data[insn_idx].ctx_field_size = info.ctx_field_size; +return 0 ; }
@@ -1948,7 +1951,7 @@ static int check_mem_access(struct bpf_verifier_env *env, int insn_idx, u32 regnverbose (env,"cannot write into socket\n" );return -EACCES ; } - err =check_sock_access (env, regno, off, size, t); + err =check_sock_access (env, insn_idx, regno, off, size, t);if (!err && value_regno >=0 )mark_reg_unknown (env, regs, value_regno); }else {
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 7/60 bpf: only adjust gso_size on bytestream protocols
In reply to Sasha LevinFrom: Willem de Bruijn <[email protected]>
[ Upstream commit b90efd2258749e04e1b3f71ef0d716f2ac2337e0 ]
bpf_skb_change_proto and bpf_skb_adjust_room change skb header length. For GSO packets they adjust gso_size to maintain the same MTU.
The gso size can only be safely adjusted on bytestream protocols. Commit d02f51cbcf12 ("bpf: fix bpf_skb_adjust_net/bpf_skb_proto_xlat to deal with gso sctp skbs") excluded SKB_GSO_SCTP.
Since then type SKB_GSO_UDP_L4 has been added, whose contents are one gso_size unit per datagram. Also exclude these.
Move from a blacklist to a whitelist check to future proof against additional such new GSO types, e.g., for fraglist based GRO.
--- include/linux/skbuff.h | 6 ++++++ net/core/filter.c | 12 ++++-------- 2 files changed, 10 insertions(+), 8 deletions(-)
include/linux/skbuff.h +6 -0
@@ -4118,6 +4118,12 @@ static inline bool skb_is_gso_sctp(const struct sk_buff *skb)return skb_shinfo (skb)->gso_type &SKB_GSO_SCTP ; } +static inline bool skb_is_gso_tcp (const struct sk_buff *skb) +{ +return skb_is_gso (skb) && +skb_shinfo (skb)->gso_type & (SKB_GSO_TCPV4 |SKB_GSO_TCPV6 ); +} +static inline void skb_gso_reset (struct sk_buff *skb) {skb_shinfo (skb)->gso_size =0 ;
net/core/filter.c +4 -8
@@ -2624,8 +2624,7 @@ static int bpf_skb_proto_4_to_6(struct sk_buff *skb)u32 off =skb_mac_header_len (skb);int ret; -/* SCTP uses GSO_BY_FRAGS, thus cannot adjust it. */ -if (skb_is_gso (skb) &&unlikely (skb_is_gso_sctp (skb))) +if (!skb_is_gso_tcp (skb))return -ENOTSUPP ; ret =skb_cow (skb, len_diff);
@@ -2666,8 +2665,7 @@ static int bpf_skb_proto_6_to_4(struct sk_buff *skb)u32 off =skb_mac_header_len (skb);int ret; -/* SCTP uses GSO_BY_FRAGS, thus cannot adjust it. */ -if (skb_is_gso (skb) &&unlikely (skb_is_gso_sctp (skb))) +if (!skb_is_gso_tcp (skb))return -ENOTSUPP ; ret =skb_unclone (skb,GFP_ATOMIC );
@@ -2792,8 +2790,7 @@ static int bpf_skb_net_grow(struct sk_buff *skb, u32 len_diff)u32 off =skb_mac_header_len (skb) +bpf_skb_net_base_len (skb);int ret; -/* SCTP uses GSO_BY_FRAGS, thus cannot adjust it. */ -if (skb_is_gso (skb) &&unlikely (skb_is_gso_sctp (skb))) +if (!skb_is_gso_tcp (skb))return -ENOTSUPP ; ret =skb_cow (skb, len_diff);
@@ -2822,8 +2819,7 @@ static int bpf_skb_net_shrink(struct sk_buff *skb, u32 len_diff)u32 off =skb_mac_header_len (skb) +bpf_skb_net_base_len (skb);int ret; -/* SCTP uses GSO_BY_FRAGS, thus cannot adjust it. */ -if (skb_is_gso (skb) &&unlikely (skb_is_gso_sctp (skb))) +if (!skb_is_gso_tcp (skb))return -ENOTSUPP ; ret =skb_unclone (skb,GFP_ATOMIC );
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 8/60 bpf: fix lockdep false positive in stackmap
In reply to Sasha LevinFrom: Alexei Starovoitov <[email protected]>
[ Upstream commit 3defaf2f15b2bfd86c6664181ac009e91985f8ac ]
Lockdep warns about false positive:
[ 11.211460] ------------[ cut here ]------------ [ 11.211936] DEBUG_LOCKS_WARN_ON(depth <= 0) [ 11.211985] WARNING: CPU: 0 PID: 141 at ../kernel/locking/lockdep.c:3592 lock_release+0x1ad/0x280 [ 11.213134] Modules linked in: [ 11.214954] RIP: 0010:lock_release+0x1ad/0x280 [ 11.223508] Call Trace: [ 11.223705] <IRQ> [ 11.223874] ? __local_bh_enable+0x7a/0x80 [ 11.224199] up_read+0x1c/0xa0 [ 11.224446] do_up_read+0x12/0x20 [ 11.224713] irq_work_run_list+0x43/0x70 [ 11.225030] irq_work_run+0x26/0x50 [ 11.225310] smp_irq_work_interrupt+0x57/0x1f0 [ 11.225662] irq_work_interrupt+0xf/0x20
since rw_semaphore is released in a different task vs task that locked the sema. It is expected behavior.
Fix the warning with up_read_non_owner() and rwsem_release() annotation.
--- kernel/bpf/stackmap.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
kernel/bpf/stackmap.c +7 -1
@@ -44,7 +44,7 @@ static void do_up_read(struct irq_work *entry)struct stack_map_irq_work *work; work = container_of(entry, struct stack_map_irq_work, irq_work); -up_read (work->sem); +up_read_non_owner (work->sem); work->sem =NULL ; }
@@ -338,6 +338,12 @@ static void stack_map_get_build_id_offset(struct bpf_stack_build_id *id_offs, }else { work->sem = ¤t->mm->mmap_sem;irq_work_queue (&work->irq_work); +/* +* The irq_work will release the mmap_sem with +* up_read_non_owner(). The rwsem_release() is called +* here to release the lock from lockdep's perspective. +*/ +rwsem_release (¤t->mm->mmap_sem.dep_map,1 , _RET_IP_); } }
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 9/60 af_key: unconditionally clone on broadcast
In reply to Sasha LevinFrom: Sean Tranchetti <[email protected]>
[ Upstream commit fc2d5cfdcfe2ab76b263d91429caa22451123085 ]
Attempting to avoid cloning the skb when broadcasting by inflating the refcount with sock_hold/sock_put while under RCU lock is dangerous and violates RCU principles. It leads to subtle race conditions when attempting to free the SKB, as we may reference sockets that have already been freed by the stack.
Unable to handle kernel paging request at virtual address 6b6b6b6b6b6c4b [006b6b6b6b6b6c4b] address between user and kernel address ranges Internal error: Oops: 96000004 [#1] PREEMPT SMP task: fffffff78f65b380 task.stack: ffffff8049a88000 pc : sock_rfree+0x38/0x6c lr : skb_release_head_state+0x6c/0xcc Process repro (pid: 7117, stack limit = 0xffffff8049a88000) Call trace: sock_rfree+0x38/0x6c skb_release_head_state+0x6c/0xcc skb_release_all+0x1c/0x38 __kfree_skb+0x1c/0x30 kfree_skb+0xd0/0xf4 pfkey_broadcast+0x14c/0x18c pfkey_sendmsg+0x1d8/0x408 sock_sendmsg+0x44/0x60 ___sys_sendmsg+0x1d0/0x2a8 __sys_sendmsg+0x64/0xb4 SyS_sendmsg+0x34/0x4c el0_svc_naked+0x34/0x38 Kernel panic - not syncing: Fatal exception
--- net/key/af_key.c | 40 +++++++++++++++------------------------- 1 file changed, 15 insertions(+), 25 deletions(-)
net/key/af_key.c +15 -25
@@ -196,30 +196,22 @@ static int pfkey_release(struct socket *sock)return 0 ; } -static int pfkey_broadcast_one (struct sk_buff *skb,struct sk_buff **skb2, -gfp_t allocation,struct sock *sk) +static int pfkey_broadcast_one (struct sk_buff *skb,gfp_t allocation, +struct sock *sk) {int err = -ENOBUFS ; -sock_hold (sk); -if (*skb2 ==NULL ) { -if (refcount_read (&skb->users) !=1 ) { - *skb2 =skb_clone (skb, allocation); - }else { - *skb2 = skb; -refcount_inc (&skb->users); - } - } -if (*skb2 !=NULL ) { -if (atomic_read (&sk->sk_rmem_alloc) <= sk->sk_rcvbuf) { -skb_set_owner_r (*skb2, sk); -skb_queue_tail (&sk->sk_receive_queue, *skb2); - sk->sk_data_ready (sk); - *skb2 =NULL ; - err =0 ; - } +if (atomic_read (&sk->sk_rmem_alloc) > sk->sk_rcvbuf) +return err; + + skb =skb_clone (skb, allocation); + +if (skb) { +skb_set_owner_r (skb, sk); +skb_queue_tail (&sk->sk_receive_queue, skb); + sk->sk_data_ready (sk); + err =0 ; } -sock_put (sk);return err; }
@@ -234,7 +226,6 @@ static int pfkey_broadcast(struct sk_buff *skb, gfp_t allocation, {struct netns_pfkey *net_pfkey =net_generic (net, pfkey_net_id);struct sock *sk; -struct sk_buff *skb2 =NULL ;int err = -ESRCH ;/* XXX Do we need something like netlink_overrun? I think
@@ -253,7 +244,7 @@ static int pfkey_broadcast(struct sk_buff *skb, gfp_t allocation,* socket. */ if (pfk->promisc) -pfkey_broadcast_one (skb, &skb2,GFP_ATOMIC , sk); +pfkey_broadcast_one (skb,GFP_ATOMIC , sk);/* the exact target will be processed later */ if (sk == one_sk)
@@ -268,7 +259,7 @@ static int pfkey_broadcast(struct sk_buff *skb, gfp_t allocation,continue ; } - err2 =pfkey_broadcast_one (skb, &skb2,GFP_ATOMIC , sk); + err2 =pfkey_broadcast_one (skb,GFP_ATOMIC , sk);/* Error is cleared after successful sending to at least one * registered KM */
@@ -278,9 +269,8 @@ static int pfkey_broadcast(struct sk_buff *skb, gfp_t allocation,rcu_read_unlock ();if (one_sk !=NULL ) - err =pfkey_broadcast_one (skb, &skb2, allocation, one_sk); + err =pfkey_broadcast_one (skb, allocation, one_sk); -kfree_skb (skb2);kfree_skb (skb);return err; }
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 10/60 ARM: 8835/1: dma-mapping: Clear DMA ops on teardown
In reply to Sasha LevinFrom: Robin Murphy <[email protected]>
[ Upstream commit fc67e6f120a388b611d94cc40baf99a5cc56b283 ]
Installing the appropriate non-IOMMU DMA ops in arm_iommu_detch_device() serves the case where IOMMU-aware drivers choose to control their own mapping but still make DMA API calls, however it also affects the case when the arch code itself tears down the mapping upon driver unbinding, where the ops now get left in place and can inhibit arch_setup_dma_ops() on subsequent re-probe attempts.
Fix the latter case by making sure that arch_teardown_dma_ops() cleans up whenever the ops were automatically installed by its counterpart.
--- arch/arm/mm/dma-mapping.c | 2 ++ 1 file changed, 2 insertions(+)
arch/arm/mm/dma-mapping.c +2 -0
@@ -2399,4 +2399,6 @@ void arch_teardown_dma_ops(struct device *dev)return ;arm_teardown_iommu_dma_ops (dev); +/* Let arch_setup_dma_ops() start again from scratch upon re-probe */ +set_dma_ops (dev,NULL ); }
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 11/60 sh: fix build error for invisible CONFIG_BUILTIN_DTB_SOURCE
In reply to Sasha LevinFrom: Masahiro Yamada <[email protected]>
[ Upstream commit 207a369e3c085799e7836221f64e7a7329985fb6 ]
I fixed a similar build error in commit 1b1e4ee86e00 ("sh: fix build error for empty CONFIG_BUILTIN_DTB_SOURCE"), but it came back again.
Since commit 37c8a5fafa3b ("kbuild: consolidate Devicetree dtb build rules"), the combination of CONFIG_OF_EARLY_FLATTREE=y and CONFIG_USE_BUILTIN_DTB=n results in the following build error:
make[1]: *** No rule to make target 'arch/sh/boot/dts/.dtb.o', needed by 'arch/sh/boot/dts/built-in.a'. Stop.
Prior to that commit, there was only one path to descend into arch/sh/boot/dts/, and arch/sh/Makefile correctly guards it with CONFIG_USE_BUILTIN_DTB:
core-$(CONFIG_USE_BUILTIN_DTB) += arch/sh/boot/dts/
Now, there is another path to descend there from the top Makefile when CONFIG_OF_EARLY_FLATTREE=y. If CONFIG_USE_BUILTIN_DTB is disabled, CONFIG_BUILTIN_DTB_SOURCE is invisible instead of defined as "".
Add obj-$(CONFIG_USE_BUILTIN_DTB) guard to avoid the attempt to build the non-existing file.
--- arch/sh/boot/dts/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/sh/boot/dts/Makefile +1 -1
@@ -1,3 +1,3 @@ ifneq ($(CONFIG_BUILTIN_DTB_SOURCE),"") -obj-y += $(patsubst "%",%,$(CONFIG_BUILTIN_DTB_SOURCE)).dtb.o +obj-$(CONFIG_USE_BUILTIN_DTB) += $(patsubst "%",%,$(CONFIG_BUILTIN_DTB_SOURCE)).dtb.o endif
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 12/60 assoc_array: Fix shortcut creation
In reply to Sasha LevinFrom: David Howells <[email protected]>
[ Upstream commit bb2ba2d75a2d673e76ddaf13a9bd30d6a8b1bb08 ]
Fix the creation of shortcuts for which the length of the index key value is an exact multiple of the machine word size. The problem is that the code that blanks off the unused bits of the shortcut value malfunctions if the number of bits in the last word equals machine word size. This is due to the "<<" operator being given a shift of zero in this case, and so the mask that should be all zeros is all ones instead. This causes the subsequent masking operation to clear everything rather than clearing nothing.
Ordinarily, the presence of the hash at the beginning of the tree index key makes the issue very hard to test for, but in this case, it was encountered due to a development mistake that caused the hash output to be either 0 (keyring) or 1 (non-keyring) only. This made it susceptible to the keyctl/unlink/valid test in the keyutils package.
The fix is simply to skip the blanking if the shift would be 0. For example, an index key that is 64 bits long would produce a 0 shift and thus a 'blank' of all 1s. This would then be inverted and AND'd onto the index_key, incorrectly clearing the entire last word.
--- lib/assoc_array.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
lib/assoc_array.c +5 -3
@@ -768,9 +768,11 @@ all_leaves_cluster_together: new_s0->index_key[i] = ops->get_key_chunk (index_key, i *ASSOC_ARRAY_KEY_CHUNK_SIZE ); - blank =ULONG_MAX << (level &ASSOC_ARRAY_KEY_CHUNK_MASK ); -pr_devel ("blank off [%zu] %d: %lx\n" , keylen -1 , level, blank); - new_s0->index_key[keylen -1 ] &= ~blank; +if (level &ASSOC_ARRAY_KEY_CHUNK_MASK ) { + blank =ULONG_MAX << (level &ASSOC_ARRAY_KEY_CHUNK_MASK ); +pr_devel ("blank off [%zu] %d: %lx\n" , keylen -1 , level, blank); + new_s0->index_key[keylen -1 ] &= ~blank; + }/* This now reduces to a node splitting exercise for which we'll need * to regenerate the disparity table.
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 13/60 keys: Fix dependency loop between construction record and auth key
In reply to Sasha LevinFrom: David Howells <[email protected]>
[ Upstream commit 822ad64d7e46a8e2c8b8a796738d7b657cbb146d ]
In the request_key() upcall mechanism there's a dependency loop by which if a key type driver overrides the ->request_key hook and the userspace side manages to lose the authorisation key, the auth key and the internal construction record (struct key_construction) can keep each other pinned.
Fix this by the following changes:
(1) Killing off the construction record and using the auth key instead.
(2) Including the operation name in the auth key payload and making the payload available outside of security/keys/.
(3) The ->request_key hook is given the authkey instead of the cons record and operation name.
Changes (2) and (3) allow the auth key to naturally be cleaned up if the keyring it is in is destroyed or cleared or the auth key is unlinked.
--- fs/nfs/nfs4idmap.c | 31 ++++++------ include/keys/request_key_auth-type.h | 36 ++++++++++++++ include/linux/key-type.h | 22 +++------ security/keys/internal.h | 13 +---- security/keys/keyctl.c | 1 + security/keys/process_keys.c | 1 + security/keys/request_key.c | 72 +++++++++++----------------- security/keys/request_key_auth.c | 16 ++++--- 8 files changed, 100 insertions(+), 92 deletions(-) create mode 100644 include/keys/request_key_auth-type.h
fs/nfs/nfs4idmap.c +17 -14
@@ -44,6 +44,7 @@#include <linux/keyctl.h> #include <linux/key-type.h> #include <keys/user-type.h> +#include <keys/request_key_auth-type.h> #include <linux/module.h> #include "internal.h"
@@ -59,7 +60,7 @@ static struct key_type key_type_id_resolver_legacy;struct idmap_legacy_upcalldata {struct rpc_pipe_msg pipe_msg;struct idmap_msg idmap_msg; -struct key_construction *key_cons; +struct key *authkey;struct idmap *idmap; };
@@ -384,7 +385,7 @@ static const match_table_t nfs_idmap_tokens = { { Opt_find_err, NULL } }; -static int nfs_idmap_legacy_upcall (struct key_construction *,const char *,void *); +static int nfs_idmap_legacy_upcall (struct key *,void *);static ssize_t idmap_pipe_downcall (struct file *,const char __user *,size_t );static void idmap_release_pipe (struct inode *);
@@ -549,11 +550,12 @@ nfs_idmap_prepare_pipe_upcall(struct idmap *idmap,static void nfs_idmap_complete_pipe_upcall_locked (struct idmap *idmap,int ret) { -struct key_construction *cons = idmap->idmap_upcall_data->key_cons; +struct key *authkey = idmap->idmap_upcall_data->authkey;kfree (idmap->idmap_upcall_data); idmap->idmap_upcall_data =NULL ; -complete_request_key (cons, ret); +complete_request_key (authkey, ret); +key_put (authkey); } static void
@@ -563,15 +565,14 @@ nfs_idmap_abort_pipe_upcall(struct idmap *idmap, int ret)nfs_idmap_complete_pipe_upcall_locked (idmap, ret); } -static int nfs_idmap_legacy_upcall (struct key_construction *cons, -const char *op, -void *aux) +static int nfs_idmap_legacy_upcall (struct key *authkey,void *aux) {struct idmap_legacy_upcalldata *data; +struct request_key_auth *rka =get_request_key_auth (authkey);struct rpc_pipe_msg *msg;struct idmap_msg *im;struct idmap *idmap = (struct idmap *)aux; -struct key *key = cons->key; +struct key *key = rka->target_key;int ret = -ENOKEY ;if (!aux)
@@ -586,7 +587,7 @@ static int nfs_idmap_legacy_upcall(struct key_construction *cons, msg = &data->pipe_msg; im = &data->idmap_msg; data->idmap = idmap; - data->key_cons = cons; + data->authkey =key_get (authkey); ret =nfs_idmap_prepare_message (key->description, idmap, im, msg);if (ret <0 )
@@ -604,7 +605,7 @@ static int nfs_idmap_legacy_upcall(struct key_construction *cons, out2:kfree (data); out1: -complete_request_key (cons, ret); +complete_request_key (authkey, ret);return ret; }
@@ -651,9 +652,10 @@ out:static ssize_t idmap_pipe_downcall (struct file *filp,const char __user *src,size_t mlen) { +struct request_key_auth *rka;struct rpc_inode *rpci =RPC_I (file_inode (filp));struct idmap *idmap = (struct idmap *)rpci->private; -struct key_construction *cons; +struct key *authkey;struct idmap_msg im;size_t namelen_in;int ret = -ENOKEY ;
@@ -665,7 +667,8 @@ idmap_pipe_downcall(struct file *filp, const char __user *src, size_t mlen)if (idmap->idmap_upcall_data =NULL ) goto out_noupcall; - cons = idmap->idmap_upcall_data->key_cons; + authkey = idmap->idmap_upcall_data->authkey; + rka =get_request_key_auth (authkey);if (mlen !=sizeof (im)) { ret = -ENOSPC ;
@@ -690,9 +693,9 @@ idmap_pipe_downcall(struct file *filp, const char __user *src, size_t mlen) ret =nfs_idmap_read_and_verify_message (&im, &idmap->idmap_upcall_data->idmap_msg, - cons->key, cons->authkey); + rka->target_key, authkey);if (ret >=0 ) { -key_set_timeout (cons->key, nfs_idmap_cache_timeout); +key_set_timeout (rka->target_key, nfs_idmap_cache_timeout); ret = mlen; }
include/keys/request_key_auth-type.h new file +36 -0
@@ -0,0 +1,36 @@ +/* request_key authorisation token key type +* +* Copyright (C) 2005 Red Hat, Inc. All Rights Reserved. +* Written by David Howells ([email protected]) +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public Licence +* as published by the Free Software Foundation; either version +* 2 of the Licence, or (at your option) any later version. +*/ + +#ifndef _KEYS_REQUEST_KEY_AUTH_TYPE_H +#define _KEYS_REQUEST_KEY_AUTH_TYPE_H + +#include <linux/key.h> + +/* +* Authorisation record for request_key(). +*/ +struct request_key_auth { +struct key *target_key; +struct key *dest_keyring; +const struct cred *cred; +void *callout_info; +size_t callout_len; +pid_t pid; +char op[8 ]; +} __randomize_layout; + +static inline struct request_key_auth *get_request_key_auth (const struct key *key) +{ +return key->payload.data[0 ]; +} + + +#endif /* _KEYS_REQUEST_KEY_AUTH_TYPE_H */
include/linux/key-type.h +6 -16
@@ -20,15 +20,6 @@struct kernel_pkey_query ;struct kernel_pkey_params ; -/* -* key under-construction record -* - passed to the request_key actor if supplied -*/ -struct key_construction { -struct key *key;/* key being constructed */ -struct key *authkey;/* authorisation for key being constructed */ -}; -/* * Pre-parsed payload, used by key add, update and instantiate. *
@@ -50,8 +41,7 @@ struct key_preparsed_payload {time64_t expiry;/* Expiry time of key */ } __randomize_layout; -typedef int (*request_key_actor_t )(struct key_construction *key, -const char *op,void *aux); +typedef int (*request_key_actor_t )(struct key *auth_key,void *aux);/* * Preparsed matching criterion.
@@ -181,20 +171,20 @@ extern int key_instantiate_and_link(struct key *key,const void *data, size_t datalen, struct key *keyring, - struct key *instkey); + struct key *authkey);extern int key_reject_and_link (struct key *key,unsigned timeout,unsigned error,struct key *keyring, -struct key *instkey); -extern void complete_request_key (struct key_construction *cons,int error); +struct key *authkey); +extern void complete_request_key (struct key *authkey,int error);static inline int key_negate_and_link (struct key *key,unsigned timeout,struct key *keyring, -struct key *instkey) +struct key *authkey) { -return key_reject_and_link (key, timeout,ENOKEY , keyring, instkey); +return key_reject_and_link (key, timeout,ENOKEY , keyring, authkey); }extern int generic_key_instantiate (struct key *key,struct key_preparsed_payload *prep);
security/keys/internal.h +1 -12
@@ -188,20 +188,9 @@ static inline int key_permission(const key_ref_t key_ref, unsigned perm)return key_task_permission (key_ref,current_cred (), perm); } -/* -* Authorisation record for request_key(). -*/ -struct request_key_auth { -struct key *target_key; -struct key *dest_keyring; -const struct cred *cred; -void *callout_info; -size_t callout_len; -pid_t pid; -} __randomize_layout; -extern struct key_type key_type_request_key_auth;extern struct key *request_key_auth_new (struct key *target, +const char *op,const void *callout_info,size_t callout_len,struct key *dest_keyring);
security/keys/keyctl.c +1 -0
@@ -26,6 +26,7 @@#include <linux/security.h> #include <linux/uio.h> #include <linux/uaccess.h> +#include <keys/request_key_auth-type.h> #include "internal.h" #define KEY_MAX_DESC_SIZE 4096
security/keys/process_keys.c +1 -0
@@ -20,6 +20,7 @@#include <linux/security.h> #include <linux/user_namespace.h> #include <linux/uaccess.h> +#include <keys/request_key_auth-type.h> #include "internal.h" /* Session keyring create vs join semaphore */
security/keys/request_key.c +29 -43
144 lines not on this page · raw message
index 6797843154f0..5e515791ccd1 100644
security/keys/request_key_auth.c +9 -7
@@ -18,7 +18,7 @@#include <linux/slab.h> #include <linux/uaccess.h> #include "internal.h" -#include <keys/user-type.h> +#include <keys/request_key_auth-type.h> static int request_key_auth_preparse (struct key_preparsed_payload *);static void request_key_auth_free_preparse (struct key_preparsed_payload *);
@@ -69,7 +69,7 @@ static int request_key_auth_instantiate(struct key *key,static void request_key_auth_describe (const struct key *key,struct seq_file *m) { -struct request_key_auth *rka = key->payload.data[0 ]; +struct request_key_auth *rka =get_request_key_auth (key);seq_puts (m,"key:" );seq_puts (m, key->description);
@@ -84,7 +84,7 @@ static void request_key_auth_describe(const struct key *key,static long request_key_auth_read (const struct key *key,char __user *buffer,size_t buflen) { -struct request_key_auth *rka = key->payload.data[0 ]; +struct request_key_auth *rka =get_request_key_auth (key);size_t datalen;long ret;
@@ -110,7 +110,7 @@ static long request_key_auth_read(const struct key *key,*/ static void request_key_auth_revoke (struct key *key) { -struct request_key_auth *rka = key->payload.data[0 ]; +struct request_key_auth *rka =get_request_key_auth (key);kenter ("{%d}" , key->serial);
@@ -137,7 +137,7 @@ static void free_request_key_auth(struct request_key_auth *rka)*/ static void request_key_auth_destroy (struct key *key) { -struct request_key_auth *rka = key->payload.data[0 ]; +struct request_key_auth *rka =get_request_key_auth (key);kenter ("{%d}" , key->serial);
@@ -148,8 +148,9 @@ static void request_key_auth_destroy(struct key *key)* Create an authorisation token for /sbin/request-key or whoever to gain * access to the caller's security data. */ -struct key *request_key_auth_new (struct key *target,const void *callout_info, -size_t callout_len,struct key *dest_keyring) +struct key *request_key_auth_new (struct key *target,const char *op, +const void *callout_info,size_t callout_len, +struct key *dest_keyring) {struct request_key_auth *rka, *irka;const struct cred *cred = current->cred;
@@ -167,6 +168,7 @@ struct key *request_key_auth_new(struct key *target, const void *callout_info,if (!rka->callout_info) goto error_free_rka; rka->callout_len = callout_len; +strlcpy (rka->op, op,sizeof (rka->op));/* see if the calling process is already servicing the key request of * another process */
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 14/60 scsi: libiscsi: Fix race between iscsi_xmit_task and iscsi_complete_task
In reply to Sasha LevinFrom: Anoob Soman <[email protected]>
[ Upstream commit 79edd00dc6a96644d76b4a1cb97d94d49e026768 ]
When a target sends Check Condition, whilst initiator is busy xmiting re-queued data, could lead to race between iscsi_complete_task() and iscsi_xmit_task() and eventually crashing with the following kernel backtrace.
[3326150.987523] ALERT: BUG: unable to handle kernel NULL pointer dereference at 0000000000000078 [3326150.987549] ALERT: IP: [<ffffffffa05ce70d>] iscsi_xmit_task+0x2d/0xc0 [libiscsi] [3326150.987571] WARN: PGD 569c8067 PUD 569c9067 PMD 0 [3326150.987582] WARN: Oops: 0002 [#1] SMP [3326150.987593] WARN: Modules linked in: tun nfsv3 nfs fscache dm_round_robin [3326150.987762] WARN: CPU: 2 PID: 8399 Comm: kworker/u32:1 Tainted: G O 4.4.0+2 #1 [3326150.987774] WARN: Hardware name: Dell Inc. PowerEdge R720/0W7JN5, BIOS 2.5.4 01/22/2016 [3326150.987790] WARN: Workqueue: iscsi_q_13 iscsi_xmitworker [libiscsi] [3326150.987799] WARN: task: ffff8801d50f3800 ti: ffff8801f5458000 task.ti: ffff8801f5458000 [3326150.987810] WARN: RIP: e030:[<ffffffffa05ce70d>] [<ffffffffa05ce70d>] iscsi_xmit_task+0x2d/0xc0 [libiscsi] [3326150.987825] WARN: RSP: e02b:ffff8801f545bdb0 EFLAGS: 00010246 [3326150.987831] WARN: RAX: 00000000ffffffc3 RBX: ffff880282d2ab20 RCX: ffff88026b6ac480 [3326150.987842] WARN: RDX: 0000000000000000 RSI: 00000000fffffe01 RDI: ffff880282d2ab20 [3326150.987852] WARN: RBP: ffff8801f545bdc8 R08: 0000000000000000 R09: 0000000000000008 [3326150.987862] WARN: R10: 0000000000000000 R11: 000000000000fe88 R12: 0000000000000000 [3326150.987872] WARN: R13: ffff880282d2abe8 R14: ffff880282d2abd8 R15: ffff880282d2ac08 [3326150.987890] WARN: FS: 00007f5a866b4840(0000) GS:ffff88028a640000(0000) knlGS:0000000000000000 [3326150.987900] WARN: CS: e033 DS: 0000 ES: 0000 CR0: 0000000080050033 [3326150.987907] WARN: CR2: 0000000000000078 CR3: 0000000070244000 CR4: 0000000000042660 [3326150.987918] WARN: Stack: [3326150.987924] WARN: ffff880282d2ad58 ffff880282d2ab20 ffff880282d2abe8 ffff8801f545be18 [3326150.987938] WARN: ffffffffa05cea90 ffff880282d2abf8 ffff88026b59cc80 ffff88026b59cc00 [3326150.987951] WARN: ffff88022acf32c0 ffff880289491800 ffff880255a80800 0000000000000400 [3326150.987964] WARN: Call Trace: [3326150.987975] WARN: [<ffffffffa05cea90>] iscsi_xmitworker+0x2f0/0x360 [libiscsi] [3326150.987988] WARN: [<ffffffff8108862c>] process_one_work+0x1fc/0x3b0 [3326150.987997] WARN: [<ffffffff81088f95>] worker_thread+0x2a5/0x470 [3326150.988006] WARN: [<ffffffff8159cad8>] ? __schedule+0x648/0x870 [3326150.988015] WARN: [<ffffffff81088cf0>] ? rescuer_thread+0x300/0x300 [3326150.988023] WARN: [<ffffffff8108ddf5>] kthread+0xd5/0xe0 [3326150.988031] WARN: [<ffffffff8108dd20>] ? kthread_stop+0x110/0x110 [3326150.988040] WARN: [<ffffffff815a0bcf>] ret_from_fork+0x3f/0x70 [3326150.988048] WARN: [<ffffffff8108dd20>] ? kthread_stop+0x110/0x110 [3326150.988127] ALERT: RIP [<ffffffffa05ce70d>] iscsi_xmit_task+0x2d/0xc0 [libiscsi] [3326150.988138] WARN: RSP <ffff8801f545bdb0> [3326150.988144] WARN: CR2: 0000000000000078 [3326151.020366] WARN: ---[ end trace 1c60974d4678d81b ]---
Commit 6f8830f5bbab ("scsi: libiscsi: add lock around task lists to fix list corruption regression") introduced "taskqueuelock" to fix list corruption during the race, but this wasn't enough.
Re-setting of conn->task to NULL, could race with iscsi_xmit_task(). iscsi_complete_task()
{
....
if (conn->task == task)
conn->task = NULL;
}conn->task in iscsi_xmit_task() could be NULL and so will be task. __iscsi_get_task(task) will crash (NullPtr de-ref), trying to access refcount.
iscsi_xmit_task()
{
struct iscsi_task *task = conn->task;
__iscsi_get_task(task);
}This commit will take extra conn->session->back_lock in iscsi_xmit_task() to ensure iscsi_xmit_task() waits for iscsi_complete_task(), if iscsi_complete_task() wins the race. If iscsi_xmit_task() wins the race, iscsi_xmit_task() increments task->refcount
(__iscsi_get_task) ensuring iscsi_complete_task() will not iscsi_free_task().
--- drivers/scsi/libiscsi.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/scsi/libiscsi.c +6 -0
@@ -1449,7 +1449,13 @@ static int iscsi_xmit_task(struct iscsi_conn *conn)if (test_bit (ISCSI_SUSPEND_BIT , &conn->suspend_tx))return -ENODATA ; +spin_lock_bh (&conn->session->back_lock); +if (conn->task ==NULL ) { +spin_unlock_bh (&conn->session->back_lock); +return -ENODATA ; + }__iscsi_get_task (task); +spin_unlock_bh (&conn->session->back_lock);spin_unlock_bh (&conn->session->frwd_lock); rc = conn->session->tt->xmit_task (task);spin_lock_bh (&conn->session->frwd_lock);
Signature · 8 lines
2.19.1 -- You received this message because you are subscribed to the Google Groups "open-iscsi" group. To unsubscribe from this group and stop receiving emails from it, send an email to open-iscsi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected] To post to this group, send email to open-iscsi-/JYPxA39Uh5TLH3MbocFF+G/[email protected] Visit this group at https://groups.google.com/group/open-iscsi. For more options, visit https://groups.google.com/d/optout.
Sasha Levin
maintainerPATCH 15/60 net: systemport: Fix reception of BPDUs
In reply to Sasha LevinFrom: Florian Fainelli <[email protected]>
[ Upstream commit a40061ea2e39494104602b3048751341bda374a1 ]
SYSTEMPORT has its RXCHK parser block that attempts to validate the packet structures, unfortunately setting the L2 header check bit will cause Bridge PDUs (BPDUs) to be incorrectly rejected because they look like LLC/SNAP packets with a non-IPv4 or non-IPv6 Ethernet Type.
--- drivers/net/ethernet/broadcom/bcmsysport.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/ethernet/broadcom/bcmsysport.c +4 -0
@@ -134,6 +134,10 @@ static void bcm_sysport_set_rx_csum(struct net_device *dev, priv->rx_chk_en = !!(wanted &NETIF_F_RXCSUM ); reg =rxchk_readl (priv,RXCHK_CONTROL ); +/* Clear L2 header checks, which would prevent BPDUs +* from being received. +*/ + reg &= ~RXCHK_L2_HDR_DIS ;if (priv->rx_chk_en) reg |=RXCHK_EN ;else
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 16/60 net: dsa: bcm_sf2: Do not assume DSA master supports WoL
In reply to Sasha LevinFrom: Florian Fainelli <[email protected]>
[ Upstream commit c3152ec4c0691e351f35a2f63347a464b5f35151 ]
We assume in the bcm_sf2 driver that the DSA master network device supports ethtool_ops::{get,set}_wol operations, which is not a given. Avoid de-referencing potentially non-existent function pointers and check them as we should.
--- drivers/net/dsa/bcm_sf2.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/net/dsa/bcm_sf2.c +6 -4
@@ -723,10 +723,11 @@ static void bcm_sf2_sw_get_wol(struct dsa_switch *ds, int port, {struct net_device *p = ds->ports[port].cpu_dp->master;struct bcm_sf2_priv *priv =bcm_sf2_to_priv (ds); -struct ethtool_wolinfo pwol; +struct ethtool_wolinfo pwol = { };/* Get the parent device WoL settings */ - p->ethtool_ops->get_wol (p, &pwol); +if (p->ethtool_ops->get_wol) + p->ethtool_ops->get_wol (p, &pwol);/* Advertise the parent device supported settings */ wol->supported = pwol.supported;
@@ -747,9 +748,10 @@ static int bcm_sf2_sw_set_wol(struct dsa_switch *ds, int port,struct net_device *p = ds->ports[port].cpu_dp->master;struct bcm_sf2_priv *priv =bcm_sf2_to_priv (ds);s8 cpu_port = ds->ports[port].cpu_dp->index; -struct ethtool_wolinfo pwol; +struct ethtool_wolinfo pwol = { }; - p->ethtool_ops->get_wol (p, &pwol); +if (p->ethtool_ops->get_wol) + p->ethtool_ops->get_wol (p, &pwol);if (wol->wolopts & ~pwol.supported)return -EINVAL ;
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 17/60 pinctrl: meson: meson8b: fix the sdxc_a data 1..3 pins
In reply to Sasha LevinFrom: Martin Blumenstingl <[email protected]>
[ Upstream commit c17abcfa93bf0be5e48bb011607d237ac2bfc839 ]
Fix the mismatch between the "sdxc_d13_1_a" pin group definition from meson8b_cbus_groups and the entry in sdxc_a_groups ("sdxc_d0_13_1_a"). This makes it possible to use "sdxc_d13_1_a" in device-tree files to route the MMC data 1..3 pins to GPIOX_1..3.
--- drivers/pinctrl/meson/pinctrl-meson8b.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/meson/pinctrl-meson8b.c +1 -1
@@ -665,7 +665,7 @@ static const char * const sd_a_groups[] = {static const char *const sdxc_a_groups[] = {"sdxc_d0_0_a" ,"sdxc_d13_0_a" ,"sdxc_d47_a" ,"sdxc_clk_a" , -"sdxc_cmd_a" ,"sdxc_d0_1_a" ,"sdxc_d0_13_1_a" +"sdxc_cmd_a" ,"sdxc_d0_1_a" ,"sdxc_d13_1_a" };static const char *const pcm_a_groups[] = {
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 18/60 qmi_wwan: apply SET_DTR quirk to Sierra WP7607
In reply to Sasha LevinFrom: Beniamino Galvani <[email protected]>
[ Upstream commit 97dc47a1308a3af46a09b1546cfb869f2e382a81 ]
The 1199:68C0 USB ID is reused by Sierra WP7607 which requires the DTR quirk to be detected. Apply QMI_QUIRK_SET_DTR unconditionally as already done for other IDs shared between different devices.
--- drivers/net/usb/qmi_wwan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/usb/qmi_wwan.c +2 -2
@@ -1208,8 +1208,8 @@ static const struct usb_device_id products[] = { {QMI_FIXED_INTF(0x114f, 0x68a2, 8)}, /* Sierra Wireless MC7750 */ {QMI_FIXED_INTF(0x1199, 0x68a2, 8)}, /* Sierra Wireless MC7710 in QMI mode */ {QMI_FIXED_INTF(0x1199, 0x68a2, 19)}, /* Sierra Wireless MC7710 in QMI mode */ - {QMI_FIXED_INTF(0x1199, 0x68c0, 8)}, /* Sierra Wireless MC7304/MC7354 */ - {QMI_FIXED_INTF(0x1199, 0x68c0, 10)}, /* Sierra Wireless MC7304/MC7354 */ + {QMI_QUIRK_SET_DTR(0x1199, 0x68c0, 8)}, /* Sierra Wireless MC7304/MC7354, WP76xx */ + {QMI_QUIRK_SET_DTR(0x1199, 0x68c0, 10)},/* Sierra Wireless MC7304/MC7354 */ {QMI_FIXED_INTF(0x1199, 0x901c, 8)}, /* Sierra Wireless EM7700 */ {QMI_FIXED_INTF(0x1199, 0x901f, 8)}, /* Sierra Wireless EM7355 */ {QMI_FIXED_INTF(0x1199, 0x9041, 8)}, /* Sierra Wireless MC7305/MC7355 */
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 19/60 net: mv643xx_eth: disable clk on error path in mv643xx_eth_shared_probe()
In reply to Sasha LevinFrom: Alexey Khoroshilov <[email protected]>
[ Upstream commit e928b5d6b75e239feb9c6d5488974b6646a0ebc8 ]
If mv643xx_eth_shared_of_probe() fails, mv643xx_eth_shared_probe() leaves clk enabled.
Found by Linux Driver Verification project (linuxtesting.org).
--- drivers/net/ethernet/marvell/mv643xx_eth.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/net/ethernet/marvell/mv643xx_eth.c +6 -1
@@ -2886,7 +2886,7 @@ static int mv643xx_eth_shared_probe(struct platform_device *pdev) ret =mv643xx_eth_shared_of_probe (pdev);if (ret) -return ret; + goto err_put_clk; pd =dev_get_platdata (&pdev->dev); msp->tx_csum_limit = (pd != NULL && pd->tx_csum_limit) ?
@@ -2894,6 +2894,11 @@ static int mv643xx_eth_shared_probe(struct platform_device *pdev)infer_hw_params (msp);return 0 ; + +err_put_clk: +if (!IS_ERR (msp->clk)) +clk_disable_unprepare (msp->clk); +return ret; }static int mv643xx_eth_shared_remove (struct platform_device *pdev)
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 20/60 xfrm: Fix inbound traffic via XFRM interfaces across network namespaces
In reply to Sasha LevinFrom: Tobias Brunner <[email protected]>
[ Upstream commit 660899ddf06ae8bb5bbbd0a19418b739375430c5 ]
After moving an XFRM interface to another namespace it stays associated with the original namespace (net in struct xfrm_if and the list keyed with xfrmi_net_id), allowing processes in the new namespace to use SAs/policies that were created in the original namespace. For instance, this allows a keying daemon in one namespace to establish IPsec SAs for other namespaces without processes there having access to the keys or IKE credentials.
This worked fine for outbound traffic, however, for inbound traffic the lookup for the interfaces and the policies used the incorrect namespace (the one the XFRM interface was moved to).
--- net/xfrm/xfrm_interface.c | 4 ++-- net/xfrm/xfrm_policy.c | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-)
net/xfrm/xfrm_interface.c +2 -2
@@ -76,10 +76,10 @@ static struct xfrm_if *xfrmi_decode_session(struct sk_buff *skb)int ifindex;struct xfrm_if *xi; -if (!skb->dev) +if (!secpath_exists (skb) || !skb->dev)return NULL ; - xfrmn =net_generic (dev_net (skb->dev), xfrmi_net_id); + xfrmn =net_generic (xs_net (xfrm_input_state (skb)), xfrmi_net_id); ifindex = skb->dev->ifindex;for_each_xfrmi_rcu (xfrmn->xfrmi[0 ], xi) {
net/xfrm/xfrm_policy.c +3 -1
@@ -2340,8 +2340,10 @@ int __xfrm_policy_check(struct sock *sk, int dir, struct sk_buff *skb,if (ifcb) { xi = ifcb->decode_session (skb); -if (xi) +if (xi) { if_id = xi->p.if_id; + net = xi->net; + } }rcu_read_unlock ();
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 21/60 arm64: fix SSBS sanitization
In reply to Sasha LevinFrom: Mark Rutland <[email protected]>
[ Upstream commit f54dada8274643e3ff4436df0ea124aeedc43cae ]
In valid_user_regs() we treat SSBS as a RES0 bit, and consequently it is unexpectedly cleared when we restore a sigframe or fiddle with GPRs via ptrace.
This patch fixes valid_user_regs() to account for this, updating the function to refer to the latest ARM ARM (ARM DDI 0487D.a). For AArch32 tasks, SSBS appears in bit 23 of SPSR_EL1, matching its position in the AArch32-native PSR format, and we don't need to translate it as we have to for DIT.
There are no other bit assignments that we need to account for today. As the recent documentation describes the DIT bit, we can drop our comment regarding DIT.
While removing SSBS from the RES0 masks, existing inconsistent whitespace is corrected.
--- arch/arm64/kernel/ptrace.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
arch/arm64/kernel/ptrace.c +8 -7
@@ -1664,19 +1664,20 @@ void syscall_trace_exit(struct pt_regs *regs) }/* -* SPSR_ELx bits which are always architecturally RES0 per ARM DDI 0487C.a -* We also take into account DIT (bit 24), which is not yet documented, and -* treat PAN and UAO as RES0 bits, as they are meaningless at EL0, and may be -* allocated an EL0 meaning in future. +* SPSR_ELx bits which are always architecturally RES0 per ARM DDI 0487D.a. +* We permit userspace to set SSBS (AArch64 bit 12, AArch32 bit 23) which is +* not described in ARM DDI 0487D.a. +* We treat PAN and UAO as RES0 bits, as they are meaningless at EL0, and may +* be allocated an EL0 meaning in future. * Userspace cannot use these until they have an architectural meaning. * Note that this follows the SPSR_ELx format, not the AArch32 PSR format. * We also reserve IL for the kernel; SS is handled dynamically. */ #define SPSR_EL1_AARCH64_RES0_BITS \ - (GENMASK_ULL(63,32) | GENMASK_ULL(27, 25) | GENMASK_ULL(23, 22) | \ - GENMASK_ULL(20, 10) | GENMASK_ULL(5, 5)) + (GENMASK_ULL(63, 32) | GENMASK_ULL(27, 25) | GENMASK_ULL(23, 22) | \ + GENMASK_ULL(20, 13) | GENMASK_ULL(11, 10) | GENMASK_ULL(5, 5))#define SPSR_EL1_AARCH32_RES0_BITS \ - (GENMASK_ULL(63,32) | GENMASK_ULL(23, 22) | GENMASK_ULL(20,20)) + (GENMASK_ULL(63, 32) | GENMASK_ULL(22, 22) | GENMASK_ULL(20, 20))static int valid_compat_regs (struct user_pt_regs *regs) {
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 22/60 mailbox: bcm-flexrm-mailbox: Fix FlexRM ring flush timeout issue
In reply to Sasha LevinFrom: Rayagonda Kokatanur <[email protected]>
[ Upstream commit d7bf31a0f85faaf63c63c39d55154825a1eaaea9 ]
RING_CONTROL reg was not written due to wrong address, hence all the subsequent ring flush was timing out.
--- drivers/mailbox/bcm-flexrm-mailbox.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mailbox/bcm-flexrm-mailbox.c +2 -2
@@ -1396,9 +1396,9 @@ static void flexrm_shutdown(struct mbox_chan *chan)/* Clear ring flush state */ timeout =1000 ;/* timeout of 1s */ -writel_relaxed (0x0 , ring +RING_CONTROL ); +writel_relaxed (0x0 , ring->regs +RING_CONTROL ); do { - if (!(readl_relaxed(ring + RING_FLUSH_DONE) & + if (!(readl_relaxed(ring->regs + RING_FLUSH_DONE) & FLUSH_DONE_MASK)) break; mdelay(1);
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 23/60 ASoC: topology: free created components in tplg load error
In reply to Sasha LevinFrom: Bard liao <[email protected]>
[ Upstream commit 304017d31df36fb61eb2ed3ebf65fb6870b3c731 ]
Topology resources are no longer needed if any element failed to load.
--- sound/soc/soc-topology.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
sound/soc/soc-topology.c +7 -1
@@ -2482,6 +2482,7 @@ int snd_soc_tplg_component_load(struct snd_soc_component *comp, struct snd_soc_tplg_ops *ops, const struct firmware *fw, u32 id) { struct soc_tplg tplg; +int ret;/* setup parsing context */ memset (&tplg,0 ,sizeof (tplg));
@@ -2495,7 +2496,12 @@ int snd_soc_tplg_component_load(struct snd_soc_component *comp, tplg.bytes_ext_ops = ops->bytes_ext_ops; tplg.bytes_ext_ops_count = ops->bytes_ext_ops_count; -return soc_tplg_load (&tplg); + ret =soc_tplg_load (&tplg); +/* free the created components if fail to load topology */ +if (ret) +snd_soc_tplg_component_remove (comp,SND_SOC_TPLG_INDEX_ALL ); + +return ret; }EXPORT_SYMBOL_GPL (snd_soc_tplg_component_load);
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 24/60 bpf/test_run: fix unkillable BPF_PROG_TEST_RUN
In reply to Sasha LevinFrom: Stanislav Fomichev <[email protected]>
[ Upstream commit df1a2cb7c74b3d3abc8d8c2d690f82c8ebc3490a ]
Syzbot found out that running BPF_PROG_TEST_RUN with repeat=0xffffffff makes process unkillable. The problem is that when CONFIG_PREEMPT is enabled, we never see need_resched() return true. This is due to the fact that preempt_enable() (which we do in bpf_test_run_one on each iteration) now handles resched if it's needed.
Let's disable preemption for the whole run, not per test. In this case we can properly see whether resched is needed.
Let's also properly return -EINTR to the userspace in case of a signal interrupt.
See recent discussion:
http://lore.kernel.org/netdev/CAH3MdRWHr4N8jei8jxDppXjmw-Nw=puNDLbu1dQOFQHxfU2onA@mail.gmail.com
I'll follow up with the same fix bpf_prog_test_run_flow_dissector in bpf-next.
--- net/bpf/test_run.c | 45 ++++++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 21 deletions(-)
net/bpf/test_run.c +24 -21
@@ -13,27 +13,13 @@#include <net/sock.h> #include <net/tcp.h> -static __always_inline u32 bpf_test_run_one(struct bpf_prog *prog, void *ctx, -struct bpf_cgroup_storage *storage[MAX_BPF_CGROUP_STORAGE_TYPE ]) -{ -u32 ret; - -preempt_disable (); -rcu_read_lock (); -bpf_cgroup_storage_set (storage); - ret =BPF_PROG_RUN (prog, ctx); -rcu_read_unlock (); -preempt_enable (); - -return ret; -} - -static int bpf_test_run (struct bpf_prog *prog,void *ctx,u32 repeat,u32 *ret, -u32 *time) +static int bpf_test_run (struct bpf_prog *prog,void *ctx,u32 repeat, +u32 *retval,u32 *time) {struct bpf_cgroup_storage *storage[MAX_BPF_CGROUP_STORAGE_TYPE ] = {0 };enum bpf_cgroup_storage_type stype;u64 time_start, time_spent =0 ; +int ret =0 ;u32 i;for_each_cgroup_storage_type (stype) {
@@ -48,25 +34,42 @@ static int bpf_test_run(struct bpf_prog *prog, void *ctx, u32 repeat, u32 *ret,if (!repeat) repeat =1 ; + +rcu_read_lock (); +preempt_disable (); time_start =ktime_get_ns ();for (i =0 ; i < repeat; i++) { - *ret =bpf_test_run_one (prog, ctx, storage); +bpf_cgroup_storage_set (storage); + *retval =BPF_PROG_RUN (prog, ctx); + +if (signal_pending (current)) { + ret = -EINTR ; +break ; + } +if (need_resched ()) { -if (signal_pending (current)) -break ; time_spent +=ktime_get_ns () - time_start; +preempt_enable (); +rcu_read_unlock (); +cond_resched (); + +rcu_read_lock (); +preempt_disable (); time_start =ktime_get_ns (); } } time_spent +=ktime_get_ns () - time_start; +preempt_enable (); +rcu_read_unlock (); +do_div (time_spent, repeat); *time = time_spent >U32_MAX ?U32_MAX : (u32 )time_spent;for_each_cgroup_storage_type (stype)bpf_cgroup_storage_free (storage[stype]); -return 0 ; +return ret; } static int bpf_test_finish(const union bpf_attr *kattr,
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 25/60 qed: Fix iWARP buffer size provided for syn packet processing.
In reply to Sasha LevinFrom: Michal Kalderon <[email protected]>
[ Upstream commit 9addc92730df55e2c05e8d3f69267a89d65bcba8 ]
The assumption that the maximum size of a syn packet is 128 bytes is wrong. Tunneling headers were not accounted for. Allocate buffers large enough for mtu.
--- drivers/net/ethernet/qlogic/qed/qed_iwarp.c | 12 ++++++------ drivers/net/ethernet/qlogic/qed/qed_iwarp.h | 1 - 2 files changed, 6 insertions(+), 7 deletions(-)
drivers/net/ethernet/qlogic/qed/qed_iwarp.c +6 -6
@@ -2605,7 +2605,7 @@ qed_iwarp_ll2_start(struct qed_hwfn *p_hwfn,struct qed_iwarp_info *iwarp_info;struct qed_ll2_acquire_data data;struct qed_ll2_cbs cbs; -u32 mpa_buff_size; +u32 buff_size;u16 n_ooo_bufs;int rc =0 ;int i;
@@ -2632,7 +2632,7 @@ qed_iwarp_ll2_start(struct qed_hwfn *p_hwfn,memset (&data,0 ,sizeof (data)); data.input.conn_type =QED_LL2_TYPE_IWARP ; - data.input.mtu =QED_IWARP_MAX_SYN_PKT_SIZE ; + data.input.mtu = params->max_mtu; data.input.rx_num_desc =QED_IWARP_LL2_SYN_RX_SIZE ; data.input.tx_num_desc =QED_IWARP_LL2_SYN_TX_SIZE ; data.input.tx_max_bds_per_packet =1 ;/* will never be fragmented */
@@ -2654,9 +2654,10 @@ qed_iwarp_ll2_start(struct qed_hwfn *p_hwfn, goto err; } + buff_size =QED_IWARP_MAX_BUF_SIZE (params->max_mtu); rc =qed_iwarp_ll2_alloc_buffers (p_hwfn,QED_IWARP_LL2_SYN_RX_SIZE , -QED_IWARP_MAX_SYN_PKT_SIZE , + buff_size, iwarp_info->ll2_syn_handle);if (rc) goto err;
@@ -2710,10 +2711,9 @@ qed_iwarp_ll2_start(struct qed_hwfn *p_hwfn,if (rc) goto err; - mpa_buff_size =QED_IWARP_MAX_BUF_SIZE (params->max_mtu); rc =qed_iwarp_ll2_alloc_buffers (p_hwfn, data.input.rx_num_desc, - mpa_buff_size, + buff_size, iwarp_info->ll2_mpa_handle);if (rc) goto err;
@@ -2726,7 +2726,7 @@ qed_iwarp_ll2_start(struct qed_hwfn *p_hwfn, iwarp_info->max_num_partial_fpdus = (u16 )p_hwfn->p_rdma_info->num_qps; - iwarp_info->mpa_intermediate_buf =kzalloc (mpa_buff_size,GFP_KERNEL ); + iwarp_info->mpa_intermediate_buf =kzalloc (buff_size,GFP_KERNEL );if (!iwarp_info->mpa_intermediate_buf) goto err;
drivers/net/ethernet/qlogic/qed/qed_iwarp.h +0 -1
@@ -46,7 +46,6 @@ enum qed_iwarp_qp_state qed_roce2iwarp_state(enum qed_roce_qp_state state);#define QED_IWARP_LL2_SYN_TX_SIZE (128)#define QED_IWARP_LL2_SYN_RX_SIZE (256) -#define QED_IWARP_MAX_SYN_PKT_SIZE (128)#define QED_IWARP_LL2_OOO_DEF_TX_SIZE (256)#define QED_IWARP_MAX_OOO (16)
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 26/60 qed: Fix iWARP syn packet mac address validation.
In reply to Sasha LevinFrom: Michal Kalderon <[email protected]>
[ Upstream commit 8be3dadf04050c2907760ec1955ca1c8fbc25585 ]
The ll2 forwards all syn packets to the driver without validating the mac address. Add validation check in the driver's iWARP listener flow and drop the packet if it isn't intended for the device.
--- drivers/net/ethernet/qlogic/qed/qed_iwarp.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/net/ethernet/qlogic/qed/qed_iwarp.c +9 -0
@@ -1688,6 +1688,15 @@ qed_iwarp_parse_rx_pkt(struct qed_hwfn *p_hwfn, eth_hlen =ETH_HLEN + (vlan_valid ?sizeof (u32) :0 ); +if (!ether_addr_equal (ethh->h_dest, + p_hwfn->p_rdma_info->iwarp.mac_addr)) { +DP_VERBOSE (p_hwfn, +QED_MSG_RDMA , +"Got unexpected mac %pM instead of %pM\n" , + ethh->h_dest, p_hwfn->p_rdma_info->iwarp.mac_addr); +return -EINVAL ; + } +ether_addr_copy (remote_mac_addr, ethh->h_source);ether_addr_copy (local_mac_addr, ethh->h_dest);
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 27/60 ARM: dts: armada-xp: fix Armada XP boards NAND description
In reply to Sasha LevinFrom: Thomas Petazzoni <[email protected]>
[ Upstream commit 6fc979179c98d2591784937d5618edc3e5cd31c1 ]
Commit 3b79919946cd2cf4dac47842afc9a893acec4ed7 ("ARM: dts:
armada-370-xp: update NAND node with new bindings") updated some Marvell Armada DT description to use the new NAND controller bindings, but did it incorrectly for a number of boards: armada-xp-gp, armada-xp-db and armada-xp-lenovo-ix4-300d. Due to this, the NAND is no longer detected on those platforms.
This commit fixes that by properly using the new NAND DT binding. This commit was runtime-tested on Armada XP GP, the two other platforms are only compile-tested.
--- arch/arm/boot/dts/armada-xp-db.dts | 46 +++++----- arch/arm/boot/dts/armada-xp-gp.dts | 13 +-- .../boot/dts/armada-xp-lenovo-ix4-300d.dts | 85 ++++++++++--------- 3 files changed, 76 insertions(+), 68 deletions(-)
arch/arm/boot/dts/armada-xp-db.dts +24 -22
@@ -144,30 +144,32 @@ status = "okay"; }; - nand@d0000 { + nand-controller@d0000 { status = "okay"; - label = "pxa3xx_nand-0"; - num-cs = <1>; - marvell,nand-keep-config; - nand-on-flash-bbt; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "U-Boot"; - reg = <0 0x800000>; - }; - partition@800000 { - label = "Linux"; - reg = <0x800000 0x800000>; - }; - partition@1000000 { - label = "Filesystem"; - reg = <0x1000000 0x3f000000>; + nand@0 { + reg = <0>; + label = "pxa3xx_nand-0"; + nand-rb = <0>; + nand-on-flash-bbt; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "U-Boot"; + reg = <0 0x800000>; + }; + partition@800000 { + label = "Linux"; + reg = <0x800000 0x800000>; + }; + partition@1000000 { + label = "Filesystem"; + reg = <0x1000000 0x3f000000>; + }; }; }; };
arch/arm/boot/dts/armada-xp-gp.dts +8 -5
@@ -160,12 +160,15 @@ status = "okay"; }; - nand@d0000 { + nand-controller@d0000 { status = "okay"; - label = "pxa3xx_nand-0"; - num-cs = <1>; - marvell,nand-keep-config; - nand-on-flash-bbt; + + nand@0 { + reg = <0>; + label = "pxa3xx_nand-0"; + nand-rb = <0>; + nand-on-flash-bbt; + }; }; };
arch/arm/boot/dts/armada-xp-lenovo-ix4-300d.dts +44 -41
93 lines not on this page · raw message
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 28/60 ARM: dts: am335x-evmsk: Fix PHY mode for ethernet
In reply to Sasha LevinFrom: Peter Ujfalusi <[email protected]>
[ Upstream commit 759c962d3c9bb1a60e3b4b780daa66ee6d4be13a ]
The PHY must add both tx and rx delay and not only on the tx clock. The board uses AR8031_AL1A PHY where the rx delay is enabled by default, the tx dealy is disabled.
The reason why rgmii-txid worked because the rx delay was not disabled by the driver so essentially we ended up with rgmii-id PHY mode.
--- arch/arm/boot/dts/am335x-evmsk.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/am335x-evmsk.dts +2 -2
@@ -651,13 +651,13 @@ &cpsw_emac0 { phy-handle = <ðphy0>; - phy-mode = "rgmii-txid"; + phy-mode = "rgmii-id"; dual_emac_res_vlan = <1>; }; &cpsw_emac1 { phy-handle = <ðphy1>; - phy-mode = "rgmii-txid"; + phy-mode = "rgmii-id"; dual_emac_res_vlan = <2>; };
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 29/60 ARM: dts: am335x-evm: Fix PHY mode for ethernet
In reply to Sasha LevinFrom: Peter Ujfalusi <[email protected]>
[ Upstream commit 37685f6a63eeca2135d1f704e7638409a071b1f6 ]
The PHY must add both tx and rx delay and not only on the tx clock. The board uses AR8031_AL1A PHY where the rx delay is enabled by default, the tx dealy is disabled.
The reason why rgmii-txid worked because the rx delay was not disabled by the driver so essentially we ended up with rgmii-id PHY mode.
--- arch/arm/boot/dts/am335x-evm.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/am335x-evm.dts +1 -1
@@ -729,7 +729,7 @@ &cpsw_emac0 { phy-handle = <ðphy0>; - phy-mode = "rgmii-txid"; + phy-mode = "rgmii-id"; }; &tscadc {
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 30/60 arm64: Relax GIC version check during early boot
In reply to Sasha LevinFrom: Vladimir Murzin <[email protected]>
[ Upstream commit 74698f6971f25d045301139413578865fc2bd8f9 ]
Updates to the GIC architecture allow ID_AA64PFR0_EL1.GIC to have values other than 0 or 1. At the moment, Linux is quite strict in the way it handles this field at early boot stage (cpufeature is fine) and will refuse to use the system register CPU interface if it doesn't find the value 1.
--- arch/arm64/kernel/head.S | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arch/arm64/kernel/head.S +1 -2
@@ -524,8 +524,7 @@ set_hcr: /* GICv3 system register access */ mrs x0, id_aa64pfr0_el1 ubfx x0, x0, #24, #4 - cmp x0, #1 - b.ne 3f + cbz x0, 3f mrs_s x0, SYS_ICC_SRE_EL2 orr x0, x0, #ICC_SRE_EL2_SRE // Set ICC_SRE_EL2.SRE==1
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 31/60 ARM: tegra: Restore DT ABI on Tegra124 Chromebooks
In reply to Sasha LevinFrom: Thierry Reding <[email protected]>
[ Upstream commit 94d9b9337d09bdd27735005b3251d97ab29f7273 ]
Commit 482997699ef0 ("ARM: tegra: Fix unit_address_vs_reg DTC warnings for /memory") inadventently broke device tree ABI by adding a unit- address to the "/memory" node because the device tree compiler flagged the missing unit-address as a warning.
Tegra124 Chromebooks (a.k.a. Nyan) use a bootloader that relies on the full name of the memory node in device tree being exactly "/memory". It can be argued whether this was a good decision or not, and some other bootloaders (such as U-Boot) do accept a unit-address in the name of the node, but the device tree is an ABI and we can't break existing setups just because the device tree compiler considers it bad practice to omit the unit-address nowadays.
This partially reverts the offending commit and restores device tree ABI compatibility.
--- arch/arm/boot/dts/tegra124-nyan.dtsi | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
arch/arm/boot/dts/tegra124-nyan.dtsi +16 -1
@@ -13,10 +13,25 @@ stdout-path = "serial0:115200n8"; }; - memory@80000000 { + /* + * Note that recent version of the device tree compiler (starting with + * version 1.4.2) warn about this node containing a reg property, but + * missing a unit-address. However, the bootloader on these Chromebook + * devices relies on the full name of this node to be exactly /memory. + * Adding the unit-address causes the bootloader to create a /memory + * node and write the memory bank configuration to that node, which in + * turn leads the kernel to believe that the device has 2 GiB of + * memory instead of the amount detected by the bootloader. + * + * The name of this node is effectively ABI and must not be changed. + */ + memory { + device_type = "memory"; reg = <0x0 0x80000000 0x0 0x80000000>; }; + /delete-node/ memory@80000000; + host1x@50000000 { hdmi@54280000 { status = "okay";
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 32/60 drm/amd/display: Fix negative cursor pos programming
In reply to Sasha LevinFrom: Nicholas Kazlauskas <[email protected]>
[ Upstream commit 0921c41e19028314830b33daa681e46b46477c5e ]
[Why]
If the cursor pos passed from DM is less than the plane_state->dst_rect top left corner then the unsigned cursor pos wraps around to a large positive number since cursor pos is a u32.
There was an attempt to guard against this in hubp1_cursor_set_position by checking the src_x_offset and src_y_offset and offseting the cursor hotspot within hubp1_cursor_set_position.
However, the cursor position itself is still being programmed incorrectly as a large value.
This manifests itself visually as the cursor disappearing or containing strange artifacts near the middle of the screen on raven.
[How]
Don't subtract the destination rect top left corner from the pos but add it to the hotspot instead. This happens before the pos gets passed into hubp1_cursor_set_position.
This achieves the same result but avoids the subtraction wrap around. With this fix the original cursor programming logic can be used again.
--- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +2 -2
@@ -2654,8 +2654,8 @@ static void dcn10_set_cursor_position(struct pipe_ctx *pipe_ctx) .mirror = pipe_ctx->plane_state->horizontal_mirror }; - pos_cpy.x -= pipe_ctx->plane_state->dst_rect.x; - pos_cpy.y -= pipe_ctx->plane_state->dst_rect.y; + pos_cpy.x_hotspot += pipe_ctx->plane_state->dst_rect.x; + pos_cpy.y_hotspot += pipe_ctx->plane_state->dst_rect.y;if (pipe_ctx->plane_state->address.type ==PLN_ADDR_TYPE_VIDEO_PROGRESSIVE )
Signature · 6 lines
2.19.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 33/60 net: marvell: mvneta: fix DMA debug warning
In reply to Sasha LevinFrom: Russell King <[email protected]>
[ Upstream commit a8fef9ba58c9966ddb1fec916d8d8137c9d8bc89 ]
Booting 4.20 on SolidRun Clearfog issues this warning with DMA API debug enabled:
WARNING: CPU: 0 PID: 555 at kernel/dma/debug.c:1230 check_sync+0x514/0x5bc mvneta f1070000.ethernet: DMA-API: device driver tries to sync DMA memory it has not allocated [device address=0x000000002dd7dc00] [size=240 bytes] Modules linked in: ahci mv88e6xxx dsa_core xhci_plat_hcd xhci_hcd devlink armada_thermal marvell_cesa des_generic ehci_orion phy_armada38x_comphy mcp3021 spi_orion evbug sfp mdio_i2c ip_tables x_tables CPU: 0 PID: 555 Comm: bridge-network- Not tainted 4.20.0+ #291 Hardware name: Marvell Armada 380/385 (Device Tree) [<c0019638>] (unwind_backtrace) from [<c0014888>] (show_stack+0x10/0x14) [<c0014888>] (show_stack) from [<c07f54e0>] (dump_stack+0x9c/0xd4) [<c07f54e0>] (dump_stack) from [<c00312bc>] (__warn+0xf8/0x124) [<c00312bc>] (__warn) from [<c00313b0>] (warn_slowpath_fmt+0x38/0x48) [<c00313b0>] (warn_slowpath_fmt) from [<c00b0370>] (check_sync+0x514/0x5bc) [<c00b0370>] (check_sync) from [<c00b04f8>] (debug_dma_sync_single_range_for_cpu+0x6c/0x74) [<c00b04f8>] (debug_dma_sync_single_range_for_cpu) from [<c051bd14>] (mvneta_poll+0x298/0xf58) [<c051bd14>] (mvneta_poll) from [<c0656194>] (net_rx_action+0x128/0x424) [<c0656194>] (net_rx_action) from [<c000a230>] (__do_softirq+0xf0/0x540) [<c000a230>] (__do_softirq) from [<c00386e0>] (irq_exit+0x124/0x144) [<c00386e0>] (irq_exit) from [<c009b5e0>] (__handle_domain_irq+0x58/0xb0) [<c009b5e0>] (__handle_domain_irq) from [<c03a63c4>] (gic_handle_irq+0x48/0x98) [<c03a63c4>] (gic_handle_irq) from [<c0009a10>] (__irq_svc+0x70/0x98)
...
This appears to be caused by mvneta_rx_hwbm() calling dma_sync_single_range_for_cpu() with the wrong struct device pointer, as the buffer manager device pointer is used to map and unmap the buffer. Fix this.
--- drivers/net/ethernet/marvell/mvneta.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/marvell/mvneta.c +1 -1
@@ -2146,7 +2146,7 @@ err_drop_frame:if (unlikely (!skb)) goto err_drop_frame_ret_pool; - dma_sync_single_range_for_cpu(dev->dev.parent, + dma_sync_single_range_for_cpu(&pp->bm_priv->pdev->dev, rx_desc->buf_phys_addr, MVNETA_MH_SIZE + NET_SKB_PAD, rx_bytes,
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 34/60 kasan, slub: move kasan_poison_slab hook before page_address
In reply to Sasha LevinFrom: Andrey Konovalov <[email protected]>
[ Upstream commit a71012242837fe5e67d8c999cfc357174ed5dba0 ]
With tag based KASAN page_address() looks at the page flags to see whether the resulting pointer needs to have a tag set. Since we don't want to set a tag when page_address() is called on SLAB pages, we call page_kasan_tag_reset() in kasan_poison_slab(). However in allocate_slab() page_address() is called before kasan_poison_slab(). Fix it by changing the order.
--- mm/slub.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-)
mm/slub.c +15 -4
@@ -1075,6 +1075,16 @@ static void setup_object_debug(struct kmem_cache *s, struct page *page,init_tracking (s, object); } +static void setup_page_debug (struct kmem_cache *s,void *addr,int order) +{ +if (!(s->flags &SLAB_POISON )) +return ; + +metadata_access_enable (); +memset (addr,POISON_INUSE ,PAGE_SIZE << order); +metadata_access_disable (); +} +static inline int alloc_consistency_checks (struct kmem_cache *s,struct page *page,void *object,unsigned long addr)
@@ -1330,6 +1340,8 @@ slab_flags_t kmem_cache_flags(unsigned int object_size,#else /* !CONFIG_SLUB_DEBUG */ static inline void setup_object_debug (struct kmem_cache *s,struct page *page,void *object) {} +static inline void setup_page_debug (struct kmem_cache *s, +void *addr,int order) {}static inline int alloc_debug_processing (struct kmem_cache *s,struct page *page,void *object,unsigned long addr) {return 0 ; }
@@ -1640,12 +1652,11 @@ static struct page *allocate_slab(struct kmem_cache *s, gfp_t flags, int node)if (page_is_pfmemalloc (page))SetPageSlabPfmemalloc (page); - start =page_address (page); +kasan_poison_slab (page); -if (unlikely (s->flags &SLAB_POISON )) -memset (start,POISON_INUSE ,PAGE_SIZE << order); + start =page_address (page); -kasan_poison_slab (page); +setup_page_debug (s, start, order); shuffle =shuffle_freelist (s, page);
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 35/60 mm: handle lru_add_drain_all for UP properly
In reply to Sasha LevinFrom: Michal Hocko <[email protected]>
[ Upstream commit 6ea183d60c469560e7b08a83c9804299e84ec9eb ]
Since for_each_cpu(cpu, mask) added by commit 2d3854a37e8b767a ("cpumask: introduce new API, without changing anything") did not evaluate the mask argument if NR_CPUS == 1 due to CONFIG_SMP=n, lru_add_drain_all() is hitting WARN_ON() at __flush_work() added by commit 4d43d395fed12463 ("workqueue: Try to catch flush_work() without INIT_WORK().") by unconditionally calling flush_work() [1].
Workaround this issue by using CONFIG_SMP=n specific lru_add_drain_all implementation. There is no real need to defer the implementation to the workqueue as the draining is going to happen on the local cpu. So alias lru_add_drain_all to lru_add_drain which does all the necessary work.
[[email protected]: fix various build warnings]
[1] https://lkml.kernel.org/r/[email protected]
--- mm/swap.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-)
mm/swap.c +10 -7
@@ -320,11 +320,6 @@ static inline void activate_page_drain(int cpu) { } -static bool need_activate_page_drain (int cpu) -{ -return false; -} -void activate_page (struct page *page) {struct zone *zone =page_zone (page);
@@ -653,13 +648,15 @@ void lru_add_drain(void)put_cpu (); } +#ifdef CONFIG_SMP + +static DEFINE_PER_CPU(struct work_struct, lru_add_drain_work); +static void lru_add_drain_per_cpu (struct work_struct *dummy) {lru_add_drain (); } -static DEFINE_PER_CPU(struct work_struct, lru_add_drain_work); -/* * Doesn't need any cpu hotplug locking because we do rely on per-cpu * kworkers being shut down before our page_alloc_cpu_dead callback is
@@ -702,6 +699,12 @@ void lru_add_drain_all(void) mutex_unlock(&lock); } +#else +void lru_add_drain_all (void ) +{ +lru_add_drain (); +} +#endif /** * release_pages - batched put_page()
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 36/60 psi: avoid divide-by-zero crash inside virtual machines
In reply to Sasha LevinFrom: Johannes Weiner <[email protected]>
[ Upstream commit 4e37504d1c49eec6434d0cc97278d2b51c9e8763 ]
We've been seeing hard-to-trigger psi crashes when running inside VM instances:
divide error: 0000 [#1] SMP PTI
Modules linked in: [...]
CPU: 0 PID: 212 Comm: kworker/0:2 Not tainted 4.16.18-119_fbk9_3817_gfe944c98d695 #119
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 0.0.0 02/06/2015
Workqueue: events psi_clock
RIP: 0010:psi_update_stats+0x270/0x490
RSP: 0018:ffffc90001117e10 EFLAGS: 00010246
RAX: 0000000000000000 RBX: 0000000000000000 RCX: ffff8800a35a13f8
RDX: 0000000000000000 RSI: ffff8800a35a1340 RDI: 0000000000000000
RBP: 0000000000000658 R08: ffff8800a35a1470 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
R13: 0000000000000000 R14: 0000000000000000 R15: 00000000000f8502
FS: 0000000000000000(0000) GS:ffff88023fc00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fbe370fa000 CR3: 00000000b1e3a000 CR4: 00000000000006f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
psi_clock+0x12/0x50
process_one_work+0x1e0/0x390
worker_thread+0x2b/0x3c0
? rescuer_thread+0x330/0x330
kthread+0x113/0x130
? kthread_create_worker_on_cpu+0x40/0x40
? SyS_exit_group+0x10/0x10
ret_from_fork+0x35/0x40
Code: 48 0f 47 c7 48 01 c2 45 85 e4 48 89 16 0f 85 e6 00 00 00 4c 8b 49 10 4c 8b 51 08 49 69 d9 f2 07 00 00 48 6b c0 64 4c 8b 29 31 d2 <48> f7 f7 49 69 d5 8d 06 00 00 48 89 c5 4c 69 f0 00 98 0b 00 48The Code-line points to period being 0 inside update_stats(), and we divide by that when calculating that period's pressure percentage.
The elapsed period should never be 0. The reason this can happen is due to an off-by-one in the idle time / missing period calculation combined with a coarse sched_clock() in the virtual machine.
The target time for aggregation is advanced into the future on a fixed grid to prevent clock drift. So when an aggregation runs after some idle period, we can not just set it to "now + psi_period", but have to calculate the downtime and advance the target time relative to itself.
However, if the aggregator was disabled exactly one psi_period (ns), we drop one idle period in the calculation due to a > when we should do >=. In that case, next_update will be advanced from 'now - psi_period' to 'now' when it should be moved to 'now + psi_period'. The run finishes with last_update == next_update == sched_clock().
With hardware clocks, this exact nanosecond match isn't likely in the first place; but if it does happen, the clock will still have moved on and the period non-zero by the time the worker runs. A pointlessly short period, but besides the extra work, no harm no foul. However, a slow sched_clock() like we have on VMs might not have advanced either by the time the worker runs again. And when we calculate the elapsed period, the result, our pressure divisor, will be 0. Ouch.
Fix this by correctly handling the situation when the elapsed time between aggregation runs is precisely two periods, and advance the expiration timestamp correctly to period into the future.
--- kernel/sched/psi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/psi.c +1 -1
@@ -321,7 +321,7 @@ static bool update_stats(struct psi_group *group) expires = group->next_update;if (now < expires) goto out; -if (now - expires > psi_period) +if (now - expires >= psi_period) missed_periods =div_u64 (now - expires, psi_period);/*
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 37/60 tmpfs: fix link accounting when a tmpfile is linked in
In reply to Sasha LevinFrom: "Darrick J. Wong" <[email protected]>
[ Upstream commit 1062af920c07f5b54cf5060fde3339da6df0cf6b ]
tmpfs has a peculiarity of accounting hard links as if they were separate inodes: so that when the number of inodes is limited, as it is by default, a user cannot soak up an unlimited amount of unreclaimable dcache memory just by repeatedly linking a file.
But when v3.11 added O_TMPFILE, and the ability to use linkat() on the fd, we missed accommodating this new case in tmpfs: "df -i" shows that an extra "inode" remains accounted after the file is unlinked and the fd closed and the actual inode evicted. If a user repeatedly links tmpfiles into a tmpfs, the limit will be hit (ENOSPC) even after they are deleted.
Just skip the extra reservation from shmem_link() in this case: there's a sense in which this first link of a tmpfile is then cheaper than a hard link of another file, but the accounting works out, and there's still good limiting, so no need to do anything more complicated.
--- mm/shmem.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
mm/shmem.c +7 -3
@@ -2852,10 +2852,14 @@ static int shmem_link(struct dentry *old_dentry, struct inode *dir, struct dentr* No ordinary (disk based) filesystem counts links as inodes; * but each new link needs a new dentry, pinning lowmem, and * tmpfs dentries cannot be pruned until they are unlinked. +* But if an O_TMPFILE file is linked into the tmpfs, the +* first link must skip that, to get the accounting right. */ - ret =shmem_reserve_inode (inode->i_sb); -if (ret) - goto out; +if (inode->i_nlink) { + ret =shmem_reserve_inode (inode->i_sb); +if (ret) + goto out; + } dir->i_size +=BOGO_DIRENT_SIZE ; inode->i_ctime = dir->i_ctime = dir->i_mtime =current_time (inode);
Signature · 1 line
2.19.1
Re: [PATCH AUTOSEL 4.20 37/60] tmpfs: fix link accounting when a tmpfile is linked in
AUTOSEL is wrong to select this commit without also selecting 29b00e609960 ("tmpfs: fix uninitialized return value in shmem_link") which contains the tag
Please add 29b00e609960 for those 6 trees, or else omit 1062af920c07 for now.
Thanks,
Hugh
Quoted 58 lines · Sasha Levin
From: "Darrick J. Wong" <[email protected]>
[ Upstream commit
1062af920c07f5b54cf5060fde3339da6df0cf6b]tmpfs has a peculiarity of accounting hard links as if they were separate inodes: so that when the number of inodes is limited, as it is by default, a user cannot soak up an unlimited amount of unreclaimable dcache memory just by repeatedly linking a file.
But when v3.11 added
O_TMPFILE, and the ability to uselinkat()on the fd, we missed accommodating this new case in tmpfs: "df -i" shows that an extra "inode" remains accounted after the file is unlinked and the fd closed and the actual inode evicted. If a user repeatedly links tmpfiles into a tmpfs, the limit will be hit (ENOSPC) even after they are deleted.Just skip the extra reservation from
shmem_link()in this case: there's a sense in which this first link of a tmpfile is then cheaper than a hard link of another file, but the accounting works out, and there's still good limiting, so no need to do anything more complicated.Fixes f4e0c30c191 ("allow the temp files created by open() to be linked to")Signed-off-by Darrick J. Wong <[email protected]>Signed-off-by Hugh Dickins <[email protected]>Reported-by Matej Kupljen <[email protected]>Acked-by Al Viro <[email protected]>Signed-off-by Andrew Morton <[email protected]>Signed-off-by Linus Torvalds <[email protected]>Signed-off-by Sasha Levin <[email protected]>--- mm/shmem.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)mm/shmem.c +7
-3@@ -2852,10 +2852,14 @@ static int shmem_link(struct dentry *old_dentry, struct inode *dir, struct dentr* No ordinary (disk based) filesystem counts links as inodes; * but each new link needs a new dentry, pinning lowmem, and * tmpfs dentries cannot be pruned until they are unlinked. +* But if an O_TMPFILE file is linked into the tmpfs, the +* first link must skip that, to get the accounting right. */ - ret =shmem_reserve_inode (inode->i_sb); -if (ret) - goto out; +if (inode->i_nlink) { + ret =shmem_reserve_inode (inode->i_sb); +if (ret) + goto out; + } dir->i_size +=BOGO_DIRENT_SIZE ; inode->i_ctime = dir->i_ctime = dir->i_mtime =current_time (inode);Signature · 1 line
2.19.1
Sasha Levin
maintainerRe: [PATCH AUTOSEL 4.20 37/60] tmpfs: fix link accounting when a tmpfile is linked in
Quoted 5 lines · Hugh Dickins
AUTOSEL is wrong to select this commit without also selecting
29b00e609960("tmpfs: fix uninitialized return value inshmem_link") which contains the tagFixes 1062af920c07 ("tmpfs: fix link accounting when a tmpfile is linked in")Please add
29b00e609960for those 6 trees, or else omit1062af920c07for now.
I usually look up relevant "Fixes" tags right before I queue patches up to avoid missing things that came up recently.
I've queued 29b00e609960 on top for all trees, thank you!
--
Thanks,
Sasha
Sasha Levin
maintainerPATCH 38/60 kasan, slab: fix conflicts with CONFIG_HARDENED_USERCOPY
In reply to Sasha LevinFrom: Andrey Konovalov <[email protected]>
[ Upstream commit 219667c23c68eb3dbc0d5662b9246f28477fe529 ]
Similarly to commit 96fedce27e13 ("kasan: make tag based mode work with CONFIG_HARDENED_USERCOPY"), we need to reset pointer tags in __check_heap_object() in mm/slab.c before doing any pointer math.
--- mm/slab.c | 2 ++ 1 file changed, 2 insertions(+)
mm/slab.c +2 -0
@@ -4421,6 +4421,8 @@ void __check_heap_object(const void *ptr, unsigned long n, struct page *page,unsigned int objnr;unsigned long offset; + ptr =kasan_reset_tag (ptr); +/* Find and validate object. */ cachep = page->slab_cache; objnr =obj_to_index (cachep, page, (void *)ptr);
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 39/60 kasan, slab: make freelist stored without tags
In reply to Sasha LevinFrom: Andrey Konovalov <[email protected]>
[ Upstream commit 51dedad06b5f6c3eea7ec1069631b1ef7796912a ]
Similarly to "kasan, slub: move kasan_poison_slab hook before page_address", move kasan_poison_slab() before alloc_slabmgmt(), which calls page_address(), to make page_address() return value to be non-tagged. This, combined with calling kasan_reset_tag() for off-slab slab management object, leads to freelist being stored non-tagged.
--- mm/slab.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
mm/slab.c +8 -1
@@ -2381,6 +2381,7 @@ static void *alloc_slabmgmt(struct kmem_cache *cachep,/* Slab management obj is off-slab. */ freelist =kmem_cache_alloc_node (cachep->freelist_cache, local_flags, nodeid); + freelist =kasan_reset_tag (freelist);if (!freelist)return NULL ; }else {
@@ -2694,6 +2695,13 @@ static struct page *cache_grow_begin(struct kmem_cache *cachep, offset *= cachep->colour_off; +/* +* Call kasan_poison_slab() before calling alloc_slabmgmt(), so +* page_address() in the latter returns a non-tagged pointer, +* as it should be for slab pages. +*/ +kasan_poison_slab (page); +/* Get slab management. */ freelist =alloc_slabmgmt (cachep, page, offset, local_flags & ~GFP_CONSTRAINT_MASK , page_node);
@@ -2702,7 +2710,6 @@ static struct page *cache_grow_begin(struct kmem_cache *cachep,slab_map_pages (cachep, page, freelist); -kasan_poison_slab (page);cache_init_objs (cachep, page);if (gfpflags_allow_blocking (local_flags))
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 40/60 ixgbe: fix older devices that do not support IXGBE_MRQC_L3L4TXSWEN
In reply to Sasha LevinFrom: Jeff Kirsher <[email protected]>
[ Upstream commit 156a67a9065e3339be85f811d1b13b920e50d73b ]
The enabling L3/L4 filtering for transmit switched packets for all devices caused unforeseen issue on older devices when trying to send UDP traffic in an ordered sequence. This bit was originally intended for X550 devices, which supported this feature, so limit the scope of this bit to only X550 devices.
--- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +5 -2
@@ -3952,8 +3952,11 @@ static void ixgbe_setup_mrqc(struct ixgbe_adapter *adapter)else mrqc =IXGBE_MRQC_VMDQRSS64EN ; -/* Enable L3/L4 for Tx Switched packets */ - mrqc |=IXGBE_MRQC_L3L4TXSWEN ; +/* Enable L3/L4 for Tx Switched packets only for X550, +* older devices do not support this feature +*/ +if (hw->mac.type >= ixgbe_mac_X550) + mrqc |=IXGBE_MRQC_L3L4TXSWEN ; }else {if (tcs >4 ) mrqc =IXGBE_MRQC_RTRSS8TCEN ;
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 41/60 i40e: fix potential RX buffer starvation for AF_XDP
In reply to Sasha LevinFrom: Magnus Karlsson <[email protected]>
[ Upstream commit 14ffeb52f3693ae0b674e59453452a2365ae9fd9 ]
When the RX rings are created they are also populated with buffers so that packets can be received. Usually these are kernel buffers, but for AF_XDP in zero-copy mode, these are user-space buffers and in this case the application might not have sent down any buffers to the driver at this point. And if no buffers are allocated at ring creation time, no packets can be received and no interrupts will be generated so the NAPI poll function that allocates buffers to the rings will never get executed.
To rectify this, we kick the NAPI context of any queue with an attached AF_XDP zero-copy socket in two places in the code. Once after an XDP program has loaded and once after the umem is registered. This take care of both cases: XDP program gets loaded first then AF_XDP socket is created, and the reverse, AF_XDP socket is created first, then XDP program is loaded.
--- drivers/net/ethernet/intel/i40e/i40e_main.c | 13 ++++++++++++- drivers/net/ethernet/intel/i40e/i40e_xsk.c | 5 +++++ 2 files changed, 17 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +12 -1
@@ -3290,8 +3290,11 @@ static int i40e_configure_rx_ring(struct i40e_ring *ring) i40e_alloc_rx_buffers_zc(ring, I40E_DESC_UNUSED(ring)) : !i40e_alloc_rx_buffers (ring,I40E_DESC_UNUSED (ring));if (!ok) { +/* Log this in case the user has forgotten to give the kernel +* any buffers, even later in the application. +*/ dev_info (&vsi->back->pdev->dev, -"Failed allocate some buffers on %sRx ring %d (pf_q %d)\n" , +"Failed to allocate some buffers on %sRx ring %d (pf_q %d)\n" , ring->xsk_umem ?"UMEM enabled " :"" , ring->queue_index, pf_q); }
@@ -11895,6 +11898,14 @@ static int i40e_xdp_setup(struct i40e_vsi *vsi,if (old_prog)bpf_prog_put (old_prog); +/* Kick start the NAPI context if there is an AF_XDP socket open +* on that queue id. This so that receiving will start. +*/ +if (need_reset && prog) +for (i =0 ; i < vsi->num_queue_pairs; i++) +if (vsi->xdp_rings[i]->xsk_umem) + (void )i40e_xsk_async_xmit (vsi->netdev, i); +return 0 ; }
drivers/net/ethernet/intel/i40e/i40e_xsk.c +5 -0
@@ -183,6 +183,11 @@ static int i40e_xsk_umem_enable(struct i40e_vsi *vsi, struct xdp_umem *umem, err =i40e_queue_pair_enable (vsi, qid);if (err)return err; + +/* Kick start the NAPI context so that receiving will start */ + err =i40e_xsk_async_xmit (vsi->netdev, qid); +if (err) +return err; }return 0 ;
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 42/60 ixgbe: fix potential RX buffer starvation for AF_XDP
In reply to Sasha LevinFrom: Magnus Karlsson <[email protected]>
[ Upstream commit 4a9b32f30f805ca596d76605903a48eab58e0b88 ]
When the RX rings are created they are also populated with buffers so that packets can be received. Usually these are kernel buffers, but for AF_XDP in zero-copy mode, these are user-space buffers and in this case the application might not have sent down any buffers to the driver at this point. And if no buffers are allocated at ring creation time, no packets can be received and no interrupts will be generated so the NAPI poll function that allocates buffers to the rings will never get executed.
To rectify this, we kick the NAPI context of any queue with an attached AF_XDP zero-copy socket in two places in the code. Once after an XDP program has loaded and once after the umem is registered. This take care of both cases: XDP program gets loaded first then AF_XDP socket is created, and the reverse, AF_XDP socket is created first, then XDP program is loaded.
--- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 12 +++++++++++- drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c | 12 ++++++++++-- 2 files changed, 21 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +11 -1
@@ -10207,6 +10207,7 @@ static int ixgbe_xdp_setup(struct net_device *dev, struct bpf_prog *prog)int i, frame_size = dev->mtu +ETH_HLEN +ETH_FCS_LEN +VLAN_HLEN ;struct ixgbe_adapter *adapter =netdev_priv (dev);struct bpf_prog *old_prog; +bool need_reset;if (adapter->flags &IXGBE_FLAG_SRIOV_ENABLED )return -EINVAL ;
@@ -10229,9 +10230,10 @@ static int ixgbe_xdp_setup(struct net_device *dev, struct bpf_prog *prog)return -ENOMEM ; old_prog =xchg (&adapter->xdp_prog, prog); + need_reset = (!!prog != !!old_prog);/* If transitioning XDP modes reconfigure rings */ -if (!!prog != !!old_prog) { +if (need_reset) {int err =ixgbe_setup_tc (dev, adapter->hw_tcs);if (err) {
@@ -10247,6 +10249,14 @@ static int ixgbe_xdp_setup(struct net_device *dev, struct bpf_prog *prog)if (old_prog)bpf_prog_put (old_prog); +/* Kick start the NAPI context if there is an AF_XDP socket open +* on that queue id. This so that receiving will start. +*/ +if (need_reset && prog) +for (i =0 ; i < adapter->num_rx_queues; i++) +if (adapter->xdp_ring[i]->xsk_umem) + (void )ixgbe_xsk_async_xmit (adapter->netdev, i); +return 0 ; }
drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c +10 -2
@@ -144,11 +144,19 @@ static int ixgbe_xsk_umem_enable(struct ixgbe_adapter *adapter,ixgbe_txrx_ring_disable (adapter, qid); err =ixgbe_add_xsk_umem (adapter, umem, qid); +if (err) +return err; -if (if_running) +if (if_running) {ixgbe_txrx_ring_enable (adapter, qid); -return err; +/* Kick start the NAPI context so that receiving will start */ + err =ixgbe_xsk_async_xmit (adapter->netdev, qid); +if (err) +return err; + } + +return 0 ; }static int ixgbe_xsk_umem_disable (struct ixgbe_adapter *adapter,u16 qid)
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 43/60 ARCv2: lib: memcpy: fix doing prefetchw outside of buffer
In reply to Sasha LevinFrom: Eugeniy Paltsev <[email protected]>
[ Upstream commit f8a15f97664178f27dfbf86a38f780a532cb6df0 ]
ARCv2 optimized memcpy uses PREFETCHW instruction for prefetching the next cache line but doesn't ensure that the line is not past the end of the buffer. PRETECHW changes the line ownership and marks it dirty, which can cause data corruption if this area is used for DMA IO.
Fix the issue by avoiding the PREFETCHW. This leads to performance degradation but it is OK as we'll introduce new memcpy implementation optimized for unaligned memory access using.
We also cut off all PREFETCH instructions at they are quite useless here:
* we call PREFETCH right before LOAD instruction call.
* we copy 16 or 32 bytes of data (depending on CONFIG_ARC_HAS_LL64) in a main logical loop. so we call PREFETCH 4 times (or 2 times) for each L1 cache line (in case of 64B L1 cache Line which is default case). Obviously this is not optimal.
--- arch/arc/lib/memcpy-archs.S | 14 -------------- 1 file changed, 14 deletions(-)
arch/arc/lib/memcpy-archs.S +0 -14
@@ -25,15 +25,11 @@ #endif #ifdef CONFIG_ARC_HAS_LL64 -# define PREFETCH_READ(RX) prefetch [RX, 56] -# define PREFETCH_WRITE(RX) prefetchw [RX, 64] # define LOADX(DST,RX) ldd.ab DST, [RX, 8] # define STOREX(SRC,RX) std.ab SRC, [RX, 8] # define ZOLSHFT 5 # define ZOLAND 0x1F #else -# define PREFETCH_READ(RX) prefetch [RX, 28] -# define PREFETCH_WRITE(RX) prefetchw [RX, 32] # define LOADX(DST,RX) ld.ab DST, [RX, 4] # define STOREX(SRC,RX) st.ab SRC, [RX, 4] # define ZOLSHFT 4
@@ -41,8 +37,6 @@ #endif ENTRY_CFI(memcpy) - prefetch [r1] ; Prefetch the read location - prefetchw [r0] ; Prefetch the write location mov.f 0, r2 ;;; if size is zero jz.d [blink]
@@ -72,8 +66,6 @@ ENTRY_CFI(memcpy) lpnz @.Lcopy32_64bytes ;; LOOP START LOADX (r6, r1) - PREFETCH_READ (r1) - PREFETCH_WRITE (r3) LOADX (r8, r1) LOADX (r10, r1) LOADX (r4, r1)
@@ -117,9 +109,7 @@ ENTRY_CFI(memcpy) lpnz @.Lcopy8bytes_1 ;; LOOP START ld.ab r6, [r1, 4] - prefetch [r1, 28] ;Prefetch the next read location ld.ab r8, [r1,4] - prefetchw [r3, 32] ;Prefetch the next write location SHIFT_1 (r7, r6, 24) or r7, r7, r5
@@ -162,9 +152,7 @@ ENTRY_CFI(memcpy) lpnz @.Lcopy8bytes_2 ;; LOOP START ld.ab r6, [r1, 4] - prefetch [r1, 28] ;Prefetch the next read location ld.ab r8, [r1,4] - prefetchw [r3, 32] ;Prefetch the next write location SHIFT_1 (r7, r6, 16) or r7, r7, r5
@@ -204,9 +192,7 @@ ENTRY_CFI(memcpy) lpnz @.Lcopy8bytes_3 ;; LOOP START ld.ab r6, [r1, 4] - prefetch [r1, 28] ;Prefetch the next read location ld.ab r8, [r1,4] - prefetchw [r3, 32] ;Prefetch the next write location SHIFT_1 (r7, r6, 8) or r7, r7, r5
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 44/60 ARC: uacces: remove lp_start, lp_end from clobber list
In reply to Sasha LevinFrom: Vineet Gupta <[email protected]>
[ Upstream commit d5e3c55e01d8b1774b37b4647c30fb22f1d39077 ]
Newer ARC gcc handles lp_start, lp_end in a different way and doesn't like them in the clobber list.
--- arch/arc/include/asm/uaccess.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arc/include/asm/uaccess.h +4 -4
@@ -207,7 +207,7 @@ raw_copy_from_user(void *to, const void __user *from, unsigned long n)*/ "=&r" (tmp), "+r" (to), "+r" (from) : - : "lp_count", "lp_start", "lp_end", "memory"); + : "lp_count", "memory"); return n; }
@@ -433,7 +433,7 @@ raw_copy_to_user(void __user *to, const void *from, unsigned long n)*/ "=&r" (tmp), "+r" (to), "+r" (from) : - : "lp_count", "lp_start", "lp_end", "memory"); + : "lp_count", "memory"); return n; }
@@ -653,7 +653,7 @@ static inline unsigned long __arc_clear_user(void __user *to, unsigned long n)" .previous \n" : "+r"(d_char), "+r"(res) : "i"(0) - : "lp_count", "lp_start", "lp_end", "memory"); + : "lp_count", "memory"); return res; }
@@ -686,7 +686,7 @@ __arc_strncpy_from_user(char *dst, const char __user *src, long count) " .previous \n" : "+r"(res), "+r"(dst), "+r"(src), "=r"(val) : "g"(-EFAULT), "r"(count) - : "lp_count", "lp_start", "lp_end", "memory"); + : "lp_count", "memory");return res; }
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 45/60 ARCv2: support manual regfile save on interrupts
In reply to Sasha LevinFrom: Vineet Gupta <[email protected]>
[ Upstream commit e494239a007e601448110ac304fe055951f9de3b ]
There's a hardware bug which affects the HSDK platform, triggered by micro-ops for auto-saving regfile on taken interrupt. The workaround is to inhibit autosave.
--- arch/arc/Kconfig | 8 +++++ arch/arc/include/asm/entry-arcv2.h | 54 ++++++++++++++++++++++++++++++ arch/arc/kernel/entry-arcv2.S | 4 ++- arch/arc/kernel/intc-arcv2.c | 2 ++ arch/arc/plat-hsdk/Kconfig | 1 + 5 files changed, 68 insertions(+), 1 deletion(-)
arch/arc/Kconfig +8 -0
@@ -411,6 +411,14 @@ config ARC_HAS_ACCL_REGS (also referred to as r58:r59). These can also be used by gcc as GPR so kernel needs to save/restore per process +config ARC_IRQ_NO_AUTOSAVE + bool "Disable hardware autosave regfile on interrupts" + default n + help + On HS cores, taken interrupt auto saves the regfile on stack. + This is programmable and can be optionally disabled in which case + software INTERRUPT_PROLOGUE/EPILGUE do the needed work + endif # ISA_ARCV2 endmenu # "ARC CPU Configuration"
arch/arc/include/asm/entry-arcv2.h +54 -0
66 lines not on this page · raw message
arch/arc/kernel/entry-arcv2.S +3 -1
@@ -209,7 +209,9 @@ restore_regs: ;####### Return from Intr ####### debug_marker_l1: - bbit1.nt r0, STATUS_DE_BIT, .Lintr_ret_to_delay_slot + ; bbit1.nt r0, STATUS_DE_BIT, .Lintr_ret_to_delay_slot + btst r0, STATUS_DE_BIT ; Z flag set if bit clear + bnz .Lintr_ret_to_delay_slot ; branch if STATUS_DE_BIT set .Lisr_ret_fast_path: ; Handle special case #1: (Entry via Exception, Return via IRQ)
arch/arc/kernel/intc-arcv2.c +2 -0
@@ -49,11 +49,13 @@ void arc_init_IRQ(void) *(unsigned int *)&ictrl =0 ; +#ifndef CONFIG_ARC_IRQ_NO_AUTOSAVE ictrl.save_nr_gpr_pairs =6 ;/* r0 to r11 (r12 saved manually) */ ictrl.save_blink =1 ; ictrl.save_lp_regs =1 ;/* LP_COUNT, LP_START, LP_END */ ictrl.save_u_to_u =0 ;/* user ctxt saved on kernel stack */ ictrl.save_idx_regs =1 ;/* JLI, LDI, EI */ +#endif WRITE_AUX (AUX_IRQ_CTRL , ictrl);
arch/arc/plat-hsdk/Kconfig +1 -0
@@ -9,6 +9,7 @@ menuconfig ARC_SOC_HSDK bool "ARC HS Development Kit SOC" depends on ISA_ARCV2 select ARC_HAS_ACCL_REGS + select ARC_IRQ_NO_AUTOSAVE select CLK_HSDK select RESET_HSDK select MIGHT_HAVE_PCI
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 46/60 i40e: fix XDP_REDIRECT/XDP xmit ring cleanup race
In reply to Sasha LevinFrom: Björn Töpel <[email protected]>
[ Upstream commit 59eb2a884f5380011179acc4662fc2cc2d850454 ]
When the driver clears the XDP xmit ring due to re-configuration or teardown, in-progress ndo_xdp_xmit must be taken into consideration.
The ndo_xdp_xmit function is typically called from a NAPI context that the driver does not control. Therefore, we must be careful not to clear the XDP ring, while the call is on-going. This patch adds a synchronize_rcu() to wait for napi(s) (preempt-disable regions and softirqs), prior clearing the queue. Further, the __I40E_CONFIG_BUSY flag is checked in the ndo_xdp_xmit implementation to avoid touching the XDP xmit queue during re-configuration.
--- drivers/net/ethernet/intel/i40e/i40e_main.c | 14 ++++++++++++-- drivers/net/ethernet/intel/i40e/i40e_txrx.c | 4 +++- 2 files changed, 15 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +12 -2
@@ -6729,8 +6729,13 @@ void i40e_down(struct i40e_vsi *vsi)for (i =0 ; i < vsi->num_queue_pairs; i++) {i40e_clean_tx_ring (vsi->tx_rings[i]); -if (i40e_enabled_xdp_vsi (vsi)) +if (i40e_enabled_xdp_vsi (vsi)) { +/* Make sure that in-progress ndo_xdp_xmit +* calls are completed. +*/ +synchronize_rcu ();i40e_clean_tx_ring (vsi->xdp_rings[i]); + }i40e_clean_rx_ring (vsi->rx_rings[i]); }
@@ -11966,8 +11971,13 @@ static void i40e_queue_pair_reset_stats(struct i40e_vsi *vsi, int queue_pair)static void i40e_queue_pair_clean_rings (struct i40e_vsi *vsi,int queue_pair) {i40e_clean_tx_ring (vsi->tx_rings[queue_pair]); -if (i40e_enabled_xdp_vsi (vsi)) +if (i40e_enabled_xdp_vsi (vsi)) { +/* Make sure that in-progress ndo_xdp_xmit calls are +* completed. +*/ +synchronize_rcu ();i40e_clean_tx_ring (vsi->xdp_rings[queue_pair]); + }i40e_clean_rx_ring (vsi->rx_rings[queue_pair]); }
drivers/net/ethernet/intel/i40e/i40e_txrx.c +3 -1
@@ -3708,6 +3708,7 @@ int i40e_xdp_xmit(struct net_device *dev, int n, struct xdp_frame **frames,struct i40e_netdev_priv *np =netdev_priv (dev);unsigned int queue_index =smp_processor_id ();struct i40e_vsi *vsi = np->vsi; +struct i40e_pf *pf = vsi->back;struct i40e_ring *xdp_ring;int drops =0 ;int i;
@@ -3715,7 +3716,8 @@ int i40e_xdp_xmit(struct net_device *dev, int n, struct xdp_frame **frames,if (test_bit (__I40E_VSI_DOWN, vsi->state))return -ENETDOWN ; -if (!i40e_enabled_xdp_vsi (vsi) || queue_index >= vsi->num_queue_pairs) +if (!i40e_enabled_xdp_vsi (vsi) || queue_index >= vsi->num_queue_pairs || +test_bit (__I40E_CONFIG_BUSY, pf->state))return -ENXIO ;if (unlikely (flags & ~XDP_XMIT_FLAGS_MASK ))
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 47/60 ixgbe: don't do any AF_XDP zero-copy transmit if netif is not OK
In reply to Sasha LevinFrom: Jan Sokolowski <[email protected]>
[ Upstream commit c685c69fba71462c3f9f6a1fb6151cded6c74d42 ]
An issue has been found while testing zero-copy XDP that causes a reset to be triggered. As it takes some time to turn the carrier on after setting zc, and we already start trying to transmit some packets, watchdog considers this as an erroneous state and triggers a reset.
Don't do any work if netif carrier is not OK.
--- drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c +2 -1
@@ -642,7 +642,8 @@ static bool ixgbe_xmit_zc(struct ixgbe_ring *xdp_ring, unsigned int budget)dma_addr_t dma;while (budget-- >0 ) { -if (unlikely (!ixgbe_desc_unused (xdp_ring))) { +if (unlikely (!ixgbe_desc_unused (xdp_ring)) || + !netif_carrier_ok (xdp_ring->netdev)) { work_done = false;break ; }
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 48/60 ARCv2: don't assume core 0x54 has dual issue
In reply to Sasha LevinFrom: Vineet Gupta <[email protected]>
[ Upstream commit 7b2e932f633bcb7b190fc7031ce6dac75f8c3472 ]
The first release of core4 (0x54) was dual issue only (HS4x). Newer releases allow hardware to be configured as single issue (HS3x) or dual issue.
Prevent accessing a HS4x only aux register in HS3x, which otherwise leads to illegal instruction exceptions
--- arch/arc/include/asm/arcregs.h | 8 ++++++++ arch/arc/kernel/setup.c | 26 +++++++++++++++++++++----- 2 files changed, 29 insertions(+), 5 deletions(-)
arch/arc/include/asm/arcregs.h +8 -0
@@ -151,6 +151,14 @@ struct bcr_isa_arcv2 {#endif }; +struct bcr_uarch_build_arcv2 { +#ifdef CONFIG_CPU_BIG_ENDIAN +unsigned int pad:8 , prod:8 , maj:8 , min:8 ; +#else +unsigned int min:8 , maj:8 , prod:8 , pad:8 ; +#endif +}; +struct bcr_mpy {#ifdef CONFIG_CPU_BIG_ENDIAN unsigned int pad:8 , x1616:8 , dsp:4 , cycles:2 , type:2 , ver:8 ;
arch/arc/kernel/setup.c +21 -5
@@ -196,13 +196,29 @@ static void read_arc_build_cfg_regs(void) cpu->bpu.num_pred =2048 << bpu.pte;if (cpu->core.family >=0x54 ) { -unsigned int exec_ctrl; -READ_BCR (AUX_EXEC_CTRL , exec_ctrl); - cpu->extn.dual_enb = !(exec_ctrl &1 ); +struct bcr_uarch_build_arcv2 uarch; -/* dual issue always present for this core */ - cpu->extn.dual =1 ; +/* +* The first 0x54 core (uarch maj:min 0:1 or 0:2) was +* dual issue only (HS4x). But next uarch rev (1:0) +* allows it be configured for single issue (HS3x) +* Ensure we fiddle with dual issue only on HS4x +*/ +READ_BCR (ARC_REG_MICRO_ARCH_BCR , uarch); + +if (uarch.prod ==4 ) { +unsigned int exec_ctrl; + +/* dual issue hardware always present */ + cpu->extn.dual =1 ; + +READ_BCR (AUX_EXEC_CTRL , exec_ctrl); + +/* dual issue hardware enabled ? */ + cpu->extn.dual_enb = !(exec_ctrl &1 ); + + } } }
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 49/60 phonet: fix building with clang
In reply to Sasha LevinFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 6321aa197547da397753757bd84c6ce64b3e3d89 ]
clang warns about overflowing the data[] member in the struct pnpipehdr:
net/phonet/pep.c:295:8: warning: array index 4 is past the end of the array (which contains 1 element) [-Warray-bounds]
if (hdr->data[4] == PEP_IND_READY)
^ ~
include/net/phonet/pep.h:66:3: note: array 'data' declared here
u8 data[1];Using a flexible array member at the end of the struct avoids the warning, but since we cannot have a flexible array member inside of the union, each index now has to be moved back by one, which makes it a little uglier.
--- include/net/phonet/pep.h | 5 +++-- net/phonet/pep.c | 32 ++++++++++++++++---------------- 2 files changed, 19 insertions(+), 18 deletions(-)
include/net/phonet/pep.h +3 -2
@@ -63,10 +63,11 @@ struct pnpipehdr {u8 state_after_reset;/* reset request */ u8 error_code;/* any response */ u8 pep_type;/* status indication */ -u8 data[1 ]; +u8 data0;/* anything else */ }; +u8 data[]; }; -#define other_pep_type data[1] +#define other_pep_type data[0]static inline struct pnpipehdr *pnp_hdr (struct sk_buff *skb) {
net/phonet/pep.c +16 -16
@@ -132,7 +132,7 @@ static int pep_indicate(struct sock *sk, u8 id, u8 code, ph->utid =0 ; ph->message_id = id; ph->pipe_handle = pn->pipe_handle; - ph->data[0 ] = code; + ph->error_code = code;return pn_skb_send (sk, skb,NULL ); }
@@ -153,7 +153,7 @@ static int pipe_handler_request(struct sock *sk, u8 id, u8 code, ph->utid = id;/* whatever */ ph->message_id = id; ph->pipe_handle = pn->pipe_handle; - ph->data[0 ] = code; + ph->error_code = code;return pn_skb_send (sk, skb,NULL ); }
@@ -208,7 +208,7 @@ static int pep_ctrlreq_error(struct sock *sk, struct sk_buff *oskb, u8 code,struct pnpipehdr *ph;struct sockaddr_pn dst;u8 data[4 ] = { - oph->data[0 ],/* PEP type */ + oph->pep_type,/* PEP type */ code,/* error code, at an unusual offset */ PAD ,PAD , };
@@ -221,7 +221,7 @@ static int pep_ctrlreq_error(struct sock *sk, struct sk_buff *oskb, u8 code, ph->utid = oph->utid; ph->message_id =PNS_PEP_CTRL_RESP ; ph->pipe_handle = oph->pipe_handle; - ph->data[0 ] = oph->data[1 ];/* CTRL id */ + ph->data0 = oph->data[0 ];/* CTRL id */ pn_skb_get_src_sockaddr (oskb, &dst);return pn_skb_send (sk, skb, &dst);
@@ -272,17 +272,17 @@ static int pipe_rcv_status(struct sock *sk, struct sk_buff *skb)return -EINVAL ; hdr =pnp_hdr (skb); -if (hdr->data[0 ] !=PN_PEP_TYPE_COMMON ) { +if (hdr->pep_type !=PN_PEP_TYPE_COMMON ) {net_dbg_ratelimited ("Phonet unknown PEP type: %u\n" , - (unsigned int )hdr->data[0 ]); + (unsigned int )hdr->pep_type);return -EOPNOTSUPP ; } -switch (hdr->data[1 ]) { +switch (hdr->data[0 ]) {case PN_PEP_IND_FLOW_CONTROL :switch (pn->tx_fc) {case PN_LEGACY_FLOW_CONTROL : -switch (hdr->data[4 ]) { +switch (hdr->data[3 ]) {case PEP_IND_BUSY :atomic_set (&pn->tx_credits,0 );break ;
@@ -292,7 +292,7 @@ static int pipe_rcv_status(struct sock *sk, struct sk_buff *skb) }break ;case PN_ONE_CREDIT_FLOW_CONTROL : -if (hdr->data[4 ] ==PEP_IND_READY ) +if (hdr->data[3 ] ==PEP_IND_READY )atomic_set (&pn->tx_credits, wake =1 );break ; }
@@ -301,12 +301,12 @@ static int pipe_rcv_status(struct sock *sk, struct sk_buff *skb)case PN_PEP_IND_ID_MCFC_GRANT_CREDITS :if (pn->tx_fc !=PN_MULTI_CREDIT_FLOW_CONTROL )break ; -atomic_add (wake = hdr->data[4 ], &pn->tx_credits); +atomic_add (wake = hdr->data[3 ], &pn->tx_credits);break ;default :net_dbg_ratelimited ("Phonet unknown PEP indication: %u\n" , - (unsigned int )hdr->data[1 ]); + (unsigned int )hdr->data[0 ]);return -EOPNOTSUPP ; }if (wake)
@@ -318,7 +318,7 @@ static int pipe_rcv_created(struct sock *sk, struct sk_buff *skb) {struct pep_sock *pn =pep_sk (sk);struct pnpipehdr *hdr =pnp_hdr (skb); -u8 n_sb = hdr->data[0 ]; +u8 n_sb = hdr->data0; pn->rx_fc = pn->tx_fc =PN_LEGACY_FLOW_CONTROL ;__skb_pull (skb,sizeof (*hdr));
@@ -506,7 +506,7 @@ static int pep_connresp_rcv(struct sock *sk, struct sk_buff *skb)return -ECONNREFUSED ;/* Parse sub-blocks */ - n_sb = hdr->data[4 ]; + n_sb = hdr->data[3 ];while (n_sb >0 ) {u8 type, buf[6 ], len =sizeof (buf);const u8 *data =pep_get_sb (skb, &type, &len, buf);
@@ -739,7 +739,7 @@ static int pipe_do_remove(struct sock *sk) ph->utid =0 ; ph->message_id =PNS_PIPE_REMOVE_REQ ; ph->pipe_handle = pn->pipe_handle; - ph->data[0 ] =PAD ; + ph->data0 =PAD ;return pn_skb_send (sk, skb,NULL ); }
@@ -817,7 +817,7 @@ static struct sock *pep_sock_accept(struct sock *sk, int flags, int *errp, peer_type = hdr->other_pep_type <<8 ;/* Parse sub-blocks (options) */ - n_sb = hdr->data[4 ]; + n_sb = hdr->data[3 ];while (n_sb >0 ) {u8 type, buf[1 ], len =sizeof (buf);const u8 *data =pep_get_sb (skb, &type, &len, buf);
@@ -1109,7 +1109,7 @@ static int pipe_skb_send(struct sock *sk, struct sk_buff *skb) ph->utid =0 ;if (pn->aligned) { ph->message_id =PNS_PIPE_ALIGNED_DATA ; - ph->data[0 ] =0 ;/* padding */ + ph->data0 =0 ;/* padding */ }else ph->message_id =PNS_PIPE_DATA ; ph->pipe_handle = pn->pipe_handle;
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 50/60 mac80211_hwsim: propagate genlmsg_reply return code
In reply to Sasha LevinFrom: Li RongQing <[email protected]>
[ Upstream commit 17407715240456448e4989bee46ffc93991add83 ]
genlmsg_reply can fail, so propagate its return code
--- drivers/net/wireless/mac80211_hwsim.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/mac80211_hwsim.c +1 -1
@@ -3449,7 +3449,7 @@ static int hwsim_get_radio_nl(struct sk_buff *msg, struct genl_info *info) goto out_err; } -genlmsg_reply (skb, info); + res =genlmsg_reply (skb, info);break ; }
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 51/60 bpf, lpm: fix lookup bug in map_delete_elem
In reply to Sasha LevinFrom: Alban Crequy <alban at kinvolk.io>
[ Upstream commit 7c0cdf0b3940f63d9777c3fcf250a2f83859ca54 ]
trie_delete_elem() was deleting an entry even though it was not matching if the prefixlen was correct. This patch adds a check on matchlen.
Reproducer:
$ sudo bpftool map create /sys/fs/bpf/mylpm type lpm_trie key 8 value 1 entries 128 name mylpm flags 1 $ sudo bpftool map update pinned /sys/fs/bpf/mylpm key hex 10 00 00 00 aa bb cc dd value hex 01 $ sudo bpftool map dump pinned /sys/fs/bpf/mylpm key: 10 00 00 00 aa bb cc dd value: 01 Found 1 element $ sudo bpftool map delete pinned /sys/fs/bpf/mylpm key hex 10 00 00 00 ff ff ff ff $ echo $? 0 $ sudo bpftool map dump pinned /sys/fs/bpf/mylpm Found 0 elements
A similar reproducer is added in the selftests.
Without the patch:
$ sudo ./tools/testing/selftests/bpf/test_lpm_map test_lpm_map: test_lpm_map.c:485: test_lpm_delete: Assertion `bpf_map_delete_elem(map_fd, key) == -1 && errno == ENOENT' failed. Aborted
With the patch: test_lpm_map runs without errors.
--- kernel/bpf/lpm_trie.c | 1 + tools/testing/selftests/bpf/test_lpm_map.c | 10 ++++++++++ 2 files changed, 11 insertions(+)
kernel/bpf/lpm_trie.c +1 -0
@@ -432,6 +432,7 @@ static int trie_delete_elem(struct bpf_map *map, void *_key) }if (!node || node->prefixlen != key->prefixlen || + node->prefixlen != matchlen || (node->flags &LPM_TREE_NODE_FLAG_IM )) { ret = -ENOENT ; goto out;
tools/testing/selftests/bpf/test_lpm_map.c +10 -0
@@ -474,6 +474,16 @@ static void test_lpm_delete(void)assert (bpf_map_lookup_elem (map_fd, key, &value) ==-1 && errno ==ENOENT ); + key->prefixlen =30 ;// unused prefix so far +inet_pton (AF_INET ,"192.255.0.0" , key->data); +assert (bpf_map_delete_elem (map_fd, key) ==-1 && + errno ==ENOENT ); + + key->prefixlen =16 ;// same prefix as the root node +inet_pton (AF_INET ,"192.255.0.0" , key->data); +assert (bpf_map_delete_elem (map_fd, key) ==-1 && + errno ==ENOENT ); +/* assert initial lookup */ key->prefixlen =32 ;inet_pton (AF_INET ,"192.168.0.1" , key->data);
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 52/60 net: thunderx: make CFG_DONE message to run through generic send-ack sequence
In reply to Sasha LevinFrom: Vadim Lomovtsev <[email protected]>
[ Upstream commit 0dd563b9a62c4cbabf5d4fd6596440c2491e72b1 ]
At the end of NIC VF initialization VF sends CFG_DONE message to PF without using nicvf_msg_send_to_pf routine. This potentially could re-write data in mailbox. This commit is to implement common way of sending CFG_DONE message by the same way with other configuration messages by using nicvf_send_msg_to_pf() routine.
--- drivers/net/ethernet/cavium/thunder/nic_main.c | 2 +- drivers/net/ethernet/cavium/thunder/nicvf_main.c | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-)
drivers/net/ethernet/cavium/thunder/nic_main.c +1 -1
@@ -1039,7 +1039,7 @@ static void nic_handle_mbx_intr(struct nicpf *nic, int vf)case NIC_MBOX_MSG_CFG_DONE :/* Last message of VF config msg sequence */ nic_enable_vf (nic, vf, true); - goto unlock; +break ;case NIC_MBOX_MSG_SHUTDOWN :/* First msg in VF teardown sequence */ if (vf >= nic->num_vf_en)
drivers/net/ethernet/cavium/thunder/nicvf_main.c +12 -3
@@ -172,6 +172,17 @@ static int nicvf_check_pf_ready(struct nicvf *nic)return 1 ; } +static void nicvf_send_cfg_done (struct nicvf *nic) +{ +union nic_mbx mbx = {}; + + mbx.msg.msg =NIC_MBOX_MSG_CFG_DONE ; +if (nicvf_send_msg_to_pf (nic, &mbx)) { +netdev_err (nic->netdev, +"PF didn't respond to CFG DONE msg\n" ); + } +} +static void nicvf_read_bgx_stats (struct nicvf *nic,struct bgx_stats_msg *bgx) {if (bgx->rx)
@@ -1416,7 +1427,6 @@ int nicvf_open(struct net_device *netdev)struct nicvf *nic =netdev_priv (netdev);struct queue_set *qs = nic->qs;struct nicvf_cq_poll *cq_poll =NULL ; -union nic_mbx mbx = {};netif_carrier_off (netdev);
@@ -1512,8 +1522,7 @@ int nicvf_open(struct net_device *netdev)nicvf_enable_intr (nic,NICVF_INTR_RBDR , qidx);/* Send VF config done msg to PF */ - mbx.msg.msg =NIC_MBOX_MSG_CFG_DONE ; -nicvf_write_to_mbx (nic, &mbx); +nicvf_send_cfg_done (nic);return 0 ; cleanup:
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 53/60 net: thunderx: add nicvf_send_msg_to_pf result check for set_rx_mode_task
In reply to Sasha LevinFrom: Vadim Lomovtsev <[email protected]>
[ Upstream commit 7db730d9d2f7b6af6aeac621b1890ea477a0cb8d ]
The rx_set_mode invokes number of messages to be send to PF for receive mode configuration. In case if there any issues we need to stop sending messages and release allocated memory.
This commit is to implement check of nicvf_msg_send_to_pf() result.
--- drivers/net/ethernet/cavium/thunder/nicvf_main.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/net/ethernet/cavium/thunder/nicvf_main.c +8 -4
@@ -1950,7 +1950,8 @@ static void __nicvf_set_rx_mode_task(u8 mode, struct xcast_addr_list *mc_addrs,/* flush DMAC filters and reset RX mode */ mbx.xcast.msg =NIC_MBOX_MSG_RESET_XCAST ; -nicvf_send_msg_to_pf (nic, &mbx); +if (nicvf_send_msg_to_pf (nic, &mbx) <0 ) + goto free_mc;if (mode &BGX_XCAST_MCAST_FILTER ) {/* once enabling filtering, we need to signal to PF to add
@@ -1958,7 +1959,8 @@ static void __nicvf_set_rx_mode_task(u8 mode, struct xcast_addr_list *mc_addrs,*/ mbx.xcast.msg =NIC_MBOX_MSG_ADD_MCAST ; mbx.xcast.data.mac =0 ; -nicvf_send_msg_to_pf (nic, &mbx); +if (nicvf_send_msg_to_pf (nic, &mbx) <0 ) + goto free_mc; }/* check if we have any specific MACs to be added to PF DMAC filter */
@@ -1967,9 +1969,9 @@ static void __nicvf_set_rx_mode_task(u8 mode, struct xcast_addr_list *mc_addrs,for (idx =0 ; idx < mc_addrs->count; idx++) { mbx.xcast.msg =NIC_MBOX_MSG_ADD_MCAST ; mbx.xcast.data.mac = mc_addrs->mc[idx]; -nicvf_send_msg_to_pf (nic, &mbx); +if (nicvf_send_msg_to_pf (nic, &mbx) <0 ) + goto free_mc; } -kfree (mc_addrs); }/* and finally set rx mode for PF accordingly */
@@ -1977,6 +1979,8 @@ static void __nicvf_set_rx_mode_task(u8 mode, struct xcast_addr_list *mc_addrs, mbx.xcast.data.mode = mode;nicvf_send_msg_to_pf (nic, &mbx); +free_mc: +kfree (mc_addrs); }static void nicvf_set_rx_mode_task (struct work_struct *work_arg)
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 54/60 nfp: bpf: fix code-gen bug on BPF_ALU | BPF_XOR | BPF_K
In reply to Sasha LevinFrom: Jiong Wang <[email protected]>
[ Upstream commit 71c190249f0ced5b26377ea6bf829ab3af77a40c ]
The intended optimization should be A ^ 0 = A, not A ^ -1 = A.
--- drivers/net/ethernet/netronome/nfp/bpf/jit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/netronome/nfp/bpf/jit.c +1 -1
@@ -2309,7 +2309,7 @@ static int xor_reg(struct nfp_prog *nfp_prog, struct nfp_insn_meta *meta)static int xor_imm (struct nfp_prog *nfp_prog,struct nfp_insn_meta *meta) { -return wrp_alu32_imm (nfp_prog, meta,ALU_OP_XOR , !~meta->insn.imm); +return wrp_alu32_imm (nfp_prog, meta,ALU_OP_XOR , !meta->insn.imm); }static int and_reg (struct nfp_prog *nfp_prog,struct nfp_insn_meta *meta)
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 55/60 nfp: bpf: fix ALU32 high bits clearance bug
In reply to Sasha LevinFrom: Jiong Wang <[email protected]>
[ Upstream commit f036ebd9bfbe1e91a3d855e85e05fc5ff156b641 ]
NFP BPF JIT compiler is doing a couple of small optimizations when jitting ALU imm instructions, some of these optimizations could save code-gen, for example:
A & -1 = A A | 0 = A A ^ 0 = A
However, for ALU32, high 32-bit of the 64-bit register should still be cleared according to ISA semantics.
--- drivers/net/ethernet/netronome/nfp/bpf/jit.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-)
drivers/net/ethernet/netronome/nfp/bpf/jit.c +6 -11
@@ -1291,15 +1291,10 @@ wrp_alu64_reg(struct nfp_prog *nfp_prog, struct nfp_insn_meta *meta,static int wrp_alu32_imm (struct nfp_prog *nfp_prog,struct nfp_insn_meta *meta, -enum alu_op alu_op,bool skip) +enum alu_op alu_op) {const struct bpf_insn *insn = &meta->insn; -if (skip) { - meta->skip = true; -return 0 ; - } -wrp_alu_imm (nfp_prog, insn->dst_reg *2 , alu_op, insn->imm);wrp_immed (nfp_prog,reg_both (insn->dst_reg *2 +1 ),0 );
@@ -2309,7 +2304,7 @@ static int xor_reg(struct nfp_prog *nfp_prog, struct nfp_insn_meta *meta)static int xor_imm (struct nfp_prog *nfp_prog,struct nfp_insn_meta *meta) { -return wrp_alu32_imm (nfp_prog, meta,ALU_OP_XOR , !meta->insn.imm); +return wrp_alu32_imm (nfp_prog, meta,ALU_OP_XOR ); }static int and_reg (struct nfp_prog *nfp_prog,struct nfp_insn_meta *meta)
@@ -2319,7 +2314,7 @@ static int and_reg(struct nfp_prog *nfp_prog, struct nfp_insn_meta *meta)static int and_imm (struct nfp_prog *nfp_prog,struct nfp_insn_meta *meta) { -return wrp_alu32_imm (nfp_prog, meta,ALU_OP_AND , !~meta->insn.imm); +return wrp_alu32_imm (nfp_prog, meta,ALU_OP_AND ); }static int or_reg (struct nfp_prog *nfp_prog,struct nfp_insn_meta *meta)
@@ -2329,7 +2324,7 @@ static int or_reg(struct nfp_prog *nfp_prog, struct nfp_insn_meta *meta)static int or_imm (struct nfp_prog *nfp_prog,struct nfp_insn_meta *meta) { -return wrp_alu32_imm (nfp_prog, meta,ALU_OP_OR , !meta->insn.imm); +return wrp_alu32_imm (nfp_prog, meta,ALU_OP_OR ); }static int add_reg (struct nfp_prog *nfp_prog,struct nfp_insn_meta *meta)
@@ -2339,7 +2334,7 @@ static int add_reg(struct nfp_prog *nfp_prog, struct nfp_insn_meta *meta)static int add_imm (struct nfp_prog *nfp_prog,struct nfp_insn_meta *meta) { -return wrp_alu32_imm (nfp_prog, meta,ALU_OP_ADD , !meta->insn.imm); +return wrp_alu32_imm (nfp_prog, meta,ALU_OP_ADD ); }static int sub_reg (struct nfp_prog *nfp_prog,struct nfp_insn_meta *meta)
@@ -2349,7 +2344,7 @@ static int sub_reg(struct nfp_prog *nfp_prog, struct nfp_insn_meta *meta)static int sub_imm (struct nfp_prog *nfp_prog,struct nfp_insn_meta *meta) { -return wrp_alu32_imm (nfp_prog, meta,ALU_OP_SUB , !meta->insn.imm); +return wrp_alu32_imm (nfp_prog, meta,ALU_OP_SUB ); }static int mul_reg (struct nfp_prog *nfp_prog,struct nfp_insn_meta *meta)
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 56/60 bnxt_en: Fix typo in firmware message timeout logic.
In reply to Sasha LevinFrom: Michael Chan <[email protected]>
[ Upstream commit 67681d02aaa1db9044a16df4ca9c77cde1221a3e ]
The logic that polls for the firmware message response uses a shorter sleep interval for the first few passes. But there was a typo so it was using the wrong counter (larger counter) for these short sleep passes. The result is a slightly shorter timeout period for these firmware messages than intended. Fix it by using the proper counter.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +1 -1
@@ -3844,7 +3844,7 @@ static int bnxt_hwrm_do_send_msg(struct bnxt *bp, void *msg, u32 msg_len,if (len)break ;/* on first few passes, just barely sleep */ -if (i <DFLT_HWRM_CMD_TIMEOUT ) +if (i <HWRM_SHORT_TIMEOUT_COUNTER )usleep_range (HWRM_SHORT_MIN_TIMEOUT ,HWRM_SHORT_MAX_TIMEOUT );else
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 57/60 bnxt_en: Wait longer for the firmware message response to complete.
In reply to Sasha LevinFrom: Michael Chan <[email protected]>
[ Upstream commit 0000b81a063b5f3ab82fa18041c28327ce72c312 ]
The code waits up to 20 usec for the firmware response to complete once we've seen the valid response header in the buffer. It turns out that in some scenarios, this wait time is not long enough. Extend it to 150 usec and use usleep_range() instead of udelay().
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 2 +- drivers/net/ethernet/broadcom/bnxt/bnxt.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +1 -1
@@ -3867,7 +3867,7 @@ static int bnxt_hwrm_do_send_msg(struct bnxt *bp, void *msg, u32 msg_len,dma_rmb ();if (*valid)break ; -udelay (1 ); +usleep_range (1 ,5 ); }if (j >=HWRM_VALID_BIT_DELAY_USEC ) {
drivers/net/ethernet/broadcom/bnxt/bnxt.h +1 -1
@@ -583,7 +583,7 @@ struct nqe_cn { (HWRM_SHORT_TIMEOUT_COUNTER * HWRM_SHORT_MIN_TIMEOUT + \ ((n) - HWRM_SHORT_TIMEOUT_COUNTER) * HWRM_MIN_TIMEOUT)) -#define HWRM_VALID_BIT_DELAY_USEC 20 +#define HWRM_VALID_BIT_DELAY_USEC 150#define BNXT_RX_EVENT 1#define BNXT_AGG_EVENT 2
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 58/60 mdio_bus: Fix use-after-free on device_register fails
In reply to Sasha LevinFrom: YueHaibing <[email protected]>
[ Upstream commit 6ff7b060535e87c2ae14dd8548512abfdda528fb ]
KASAN has found use-after-free in fixed_mdio_bus_init, commit 0c692d07842a ("drivers/net/phy/mdio_bus.c: call put_device on device_register() failure") call put_device() while device_register() fails,give up the last reference to the device and allow mdiobus_release to be executed ,kfreeing the bus. However in most drives, mdiobus_free be called to free the bus while mdiobus_register fails. use-after-free occurs when access bus again, this patch revert it to let mdiobus_free free the bus.
KASAN report details as below:
BUG: KASAN: use-after-free in mdiobus_free+0x85/0x90 drivers/net/phy/mdio_bus.c:482
Read of size 4 at addr ffff8881dc824d78 by task syz-executor.0/3524
CPU: 1 PID: 3524 Comm: syz-executor.0 Not tainted 5.0.0-rc7+ #45
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1ubuntu1 04/01/2014
Call Trace:
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0xfa/0x1ce lib/dump_stack.c:113
print_address_description+0x65/0x270 mm/kasan/report.c:187
kasan_report+0x149/0x18d mm/kasan/report.c:317
mdiobus_free+0x85/0x90 drivers/net/phy/mdio_bus.c:482
fixed_mdio_bus_init+0x283/0x1000 [fixed_phy]
? 0xffffffffc0e40000
? 0xffffffffc0e40000
? 0xffffffffc0e40000
do_one_initcall+0xfa/0x5ca init/main.c:887
do_init_module+0x204/0x5f6 kernel/module.c:3460
load_module+0x66b2/0x8570 kernel/module.c:3808
__do_sys_finit_module+0x238/0x2a0 kernel/module.c:3902
do_syscall_64+0x147/0x600 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x462e99
Code: f7 d8 64 89 02 b8 ff ff ff ff c3 66 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f6215c19c58 EFLAGS: 00000246 ORIG_RAX: 0000000000000139
RAX: ffffffffffffffda RBX: 000000000073bf00 RCX: 0000000000462e99
RDX: 0000000000000000 RSI: 0000000020000080 RDI: 0000000000000003
RBP: 00007f6215c19c70 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f6215c1a6bc
R13: 00000000004bcefb R14: 00000000006f7030 R15: 0000000000000004
Allocated by task 3524:
set_track mm/kasan/common.c:85 [inline]
__kasan_kmalloc.constprop.3+0xa0/0xd0 mm/kasan/common.c:496
kmalloc include/linux/slab.h:545 [inline]
kzalloc include/linux/slab.h:740 [inline]
mdiobus_alloc_size+0x54/0x1b0 drivers/net/phy/mdio_bus.c:143
fixed_mdio_bus_init+0x163/0x1000 [fixed_phy]
do_one_initcall+0xfa/0x5ca init/main.c:887
do_init_module+0x204/0x5f6 kernel/module.c:3460
load_module+0x66b2/0x8570 kernel/module.c:3808
__do_sys_finit_module+0x238/0x2a0 kernel/module.c:3902
do_syscall_64+0x147/0x600 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x49/0xbe
Freed by task 3524:
set_track mm/kasan/common.c:85 [inline]
__kasan_slab_free+0x130/0x180 mm/kasan/common.c:458
slab_free_hook mm/slub.c:1409 [inline]
slab_free_freelist_hook mm/slub.c:1436 [inline]
slab_free mm/slub.c:2986 [inline]
kfree+0xe1/0x270 mm/slub.c:3938
device_release+0x78/0x200 drivers/base/core.c:919
kobject_cleanup lib/kobject.c:662 [inline]
kobject_release lib/kobject.c:691 [inline]
kref_put include/linux/kref.h:67 [inline]
kobject_put+0x146/0x240 lib/kobject.c:708
put_device+0x1c/0x30 drivers/base/core.c:2060
__mdiobus_register+0x483/0x560 drivers/net/phy/mdio_bus.c:382
fixed_mdio_bus_init+0x26b/0x1000 [fixed_phy]
do_one_initcall+0xfa/0x5ca init/main.c:887
do_init_module+0x204/0x5f6 kernel/module.c:3460
load_module+0x66b2/0x8570 kernel/module.c:3808
__do_sys_finit_module+0x238/0x2a0 kernel/module.c:3902
do_syscall_64+0x147/0x600 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x49/0xbe
The buggy address belongs to the object at ffff8881dc824c80
which belongs to the cache kmalloc-2k of size 2048
The buggy address is located 248 bytes inside of
2048-byte region [ffff8881dc824c80, ffff8881dc825480)
The buggy address belongs to the page:
page:ffffea0007720800 count:1 mapcount:0 mapping:ffff8881f6c02800 index:0x0 compound_mapcount: 0
flags: 0x2fffc0000010200(slab|head)
raw: 02fffc0000010200 0000000000000000 0000000500000001 ffff8881f6c02800
raw: 0000000000000000 00000000800f000f 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
Memory state around the buggy address:
ffff8881dc824c00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff8881dc824c80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8881dc824d00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff8881dc824d80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8881dc824e00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb--- drivers/net/phy/mdio_bus.c | 1 - 1 file changed, 1 deletion(-)
drivers/net/phy/mdio_bus.c +0 -1
@@ -379,7 +379,6 @@ int __mdiobus_register(struct mii_bus *bus, struct module *owner) err =device_register (&bus->dev);if (err) {pr_err ("mii_bus %s failed to register\n" , bus->id); -put_device (&bus->dev);return -EINVAL ; }
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 59/60 net: set static variable an initial value in atl2_probe()
In reply to Sasha LevinFrom: Mao Wenan <[email protected]>
[ Upstream commit 4593403fa516a5a4cffe6883c5062d60932cbfbe ]
cards_found is a static variable, but when it enters atl2_probe(), cards_found is set to zero, the value is not consistent with last probe, so next behavior is not our expect.
--- drivers/net/ethernet/atheros/atlx/atl2.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/ethernet/atheros/atlx/atl2.c +1 -3
@@ -1335,13 +1335,11 @@ static int atl2_probe(struct pci_dev *pdev, const struct pci_device_id *ent) {struct net_device *netdev;struct atl2_adapter *adapter; -static int cards_found; +static int cards_found =0 ;unsigned long mmio_start;int mmio_len;int err; - cards_found =0 ; - err =pci_enable_device (pdev);if (err)return err;
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 60/60 selftests: fib_tests: sleep after changing carrier. again.
In reply to Sasha LevinFrom: Thadeu Lima de Souza Cascardo <cascardo at canonical.com>
[ Upstream commit af548a27b158d548d41e56255e6eaca1658cc3be ]
Just like commit e2ba732a1681 ("selftests: fib_tests: sleep after changing carrier"), wait one second to allow linkwatch to propagate the carrier change to the stack.
There are two sets of carrier tests. The first slept after the carrier was set to off, and when the second set ran, it was likely that the linkwatch would be able to run again without much delay, reducing the likelihood of a race. However, if you run 'fib_tests.sh -t carrier' on a loop, you will quickly notice the failures.
Sleeping on the second set of tests make the failures go away.
--- tools/testing/selftests/net/fib_tests.sh | 1 + 1 file changed, 1 insertion(+)
tools/testing/selftests/net/fib_tests.sh +1 -0
@@ -388,6 +388,7 @@ fib_carrier_unicast_test() set -e $IP link set dev dummy0 carrier off + sleep 1 set +e echo " Carrier down"
Signature · 1 line
2.19.1