5.19.17-rc1 review
Subsystems (9)
Greg Kroah-Hartman
maintainerPATCH 584/717 selftests/bpf: Free the allocated resources after test case succeeds
In reply to Greg Kroah-HartmanFrom: Hou Tao <[email protected]>
[ Upstream commit 103d002fb7d548fb1187e350f2b73788558128b9 ]
Free the created fd or allocated bpf_object after test case succeeds, else there will be resource leaks.
Spotted by using address sanitizer and checking the content of /proc/$pid/fd directory.
--- .../bpf/map_tests/array_map_batch_ops.c | 2 ++ .../bpf/map_tests/htab_map_batch_ops.c | 2 ++ .../bpf/map_tests/lpm_trie_map_batch_ops.c | 2 ++ tools/testing/selftests/bpf/test_maps.c | 24 ++++++++++++------- 4 files changed, 21 insertions(+), 9 deletions(-)
tools/testing/selftests/bpf/map_tests/array_map_batch_ops.c +2 -0
@@ -3,6 +3,7 @@#include <stdio.h> #include <errno.h> #include <string.h> +#include <unistd.h> #include <bpf/bpf.h> #include <bpf/libbpf.h>
@@ -137,6 +138,7 @@ static void __test_map_lookup_and_update_batch(bool is_pcpu)free (keys);free (values);free (visited); +close (map_fd); }static void array_map_batch_ops (void )
tools/testing/selftests/bpf/map_tests/htab_map_batch_ops.c +2 -0
@@ -3,6 +3,7 @@#include <stdio.h> #include <errno.h> #include <string.h> +#include <unistd.h> #include <bpf/bpf.h> #include <bpf/libbpf.h>
@@ -255,6 +256,7 @@ void __test_map_lookup_and_delete_batch(bool is_pcpu)free (visited);if (!is_pcpu)free (values); +close (map_fd); }void htab_map_batch_ops (void )
tools/testing/selftests/bpf/map_tests/lpm_trie_map_batch_ops.c +2 -0
@@ -7,6 +7,7 @@#include <errno.h> #include <string.h> #include <stdlib.h> +#include <unistd.h> #include <bpf/bpf.h> #include <bpf/libbpf.h>
@@ -150,4 +151,5 @@ void test_lpm_trie_map_batch_ops(void)free (keys);free (values);free (visited); +close (map_fd); }
tools/testing/selftests/bpf/test_maps.c +15 -9
@@ -658,13 +658,13 @@ static void test_sockmap(unsigned int tasks, void *data) {struct bpf_map *bpf_map_rx, *bpf_map_tx, *bpf_map_msg, *bpf_map_break;int map_fd_msg =0 , map_fd_rx =0 , map_fd_tx =0 , map_fd_break; +struct bpf_object *parse_obj, *verdict_obj, *msg_obj;int ports[] = {50200 ,50201 ,50202 ,50204 };int err, i, fd, udp, sfd[6 ] = {0xdeadbeef };u8 buf[20 ] = {0x0 ,0x5 ,0x3 ,0x2 ,0x1 ,0x0 };int parse_prog, verdict_prog, msg_prog;struct sockaddr_in addr;int one =1 , s, sc, rc; -struct bpf_object *obj;struct timeval to;__u32 key, value;pid_t pid[tasks];
@@ -760,6 +760,7 @@ static void test_sockmap(unsigned int tasks, void *data) i, udp); goto out_sockmap; } +close (udp);/* Test update without programs */ for (i =0 ; i <6 ; i++) {
@@ -822,27 +823,27 @@ static void test_sockmap(unsigned int tasks, void *data)/* Load SK_SKB program and Attach */ err =bpf_prog_test_load (SOCKMAP_PARSE_PROG , -BPF_PROG_TYPE_SK_SKB , &obj, &parse_prog); +BPF_PROG_TYPE_SK_SKB , &parse_obj, &parse_prog);if (err) {printf ("Failed to load SK_SKB parse prog\n" ); goto out_sockmap; } err =bpf_prog_test_load (SOCKMAP_TCP_MSG_PROG , -BPF_PROG_TYPE_SK_MSG , &obj, &msg_prog); +BPF_PROG_TYPE_SK_MSG , &msg_obj, &msg_prog);if (err) {printf ("Failed to load SK_SKB msg prog\n" ); goto out_sockmap; } err =bpf_prog_test_load (SOCKMAP_VERDICT_PROG , -BPF_PROG_TYPE_SK_SKB , &obj, &verdict_prog); +BPF_PROG_TYPE_SK_SKB , &verdict_obj, &verdict_prog);if (err) {printf ("Failed to load SK_SKB verdict prog\n" ); goto out_sockmap; } - bpf_map_rx =bpf_object__find_map_by_name (obj,"sock_map_rx" ); + bpf_map_rx =bpf_object__find_map_by_name (verdict_obj,"sock_map_rx" );if (!bpf_map_rx) {printf ("Failed to load map rx from verdict prog\n" ); goto out_sockmap;
@@ -854,7 +855,7 @@ static void test_sockmap(unsigned int tasks, void *data) goto out_sockmap; } - bpf_map_tx =bpf_object__find_map_by_name (obj,"sock_map_tx" ); + bpf_map_tx =bpf_object__find_map_by_name (verdict_obj,"sock_map_tx" );if (!bpf_map_tx) {printf ("Failed to load map tx from verdict prog\n" ); goto out_sockmap;
@@ -866,7 +867,7 @@ static void test_sockmap(unsigned int tasks, void *data) goto out_sockmap; } - bpf_map_msg =bpf_object__find_map_by_name (obj,"sock_map_msg" ); + bpf_map_msg =bpf_object__find_map_by_name (verdict_obj,"sock_map_msg" );if (!bpf_map_msg) {printf ("Failed to load map msg from msg_verdict prog\n" ); goto out_sockmap;
@@ -878,7 +879,7 @@ static void test_sockmap(unsigned int tasks, void *data) goto out_sockmap; } - bpf_map_break =bpf_object__find_map_by_name (obj,"sock_map_break" ); + bpf_map_break =bpf_object__find_map_by_name (verdict_obj,"sock_map_break" );if (!bpf_map_break) {printf ("Failed to load map tx from verdict prog\n" ); goto out_sockmap;
@@ -1124,7 +1125,9 @@ static void test_sockmap(unsigned int tasks, void *data) }close (fd);close (map_fd_rx); -bpf_object__close (obj); +bpf_object__close (parse_obj); +bpf_object__close (msg_obj); +bpf_object__close (verdict_obj);return ; out:for (i =0 ; i <6 ; i++)
@@ -1282,8 +1285,11 @@ static void test_map_in_map(void)printf ("Inner map mim.inner was not destroyed\n" ); goto out_map_in_map; } + +close (fd); } +bpf_object__close (obj);return ; out_map_in_map:
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 585/717 can: bcm: check the result of can_send() in bcm_can_tx()
In reply to Greg Kroah-HartmanFrom: Ziyang Xuan <[email protected]>
[ Upstream commit 3fd7bfd28cfd68ae80a2fe92ea1615722cc2ee6e ]
If can_send() fail, it should not update frames_abs counter in bcm_can_tx(). Add the result check for can_send() in bcm_can_tx().
--- net/can/bcm.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
net/can/bcm.c +4 -3
@@ -274,6 +274,7 @@ static void bcm_can_tx(struct bcm_op *op)struct sk_buff *skb;struct net_device *dev;struct canfd_frame *cf = op->frames + op->cfsiz * op->currframe; +int err;/* no target device? => exit */ if (!op->ifindex)
@@ -298,11 +299,11 @@ static void bcm_can_tx(struct bcm_op *op)/* send with loopback */ skb->dev = dev;can_skb_set_owner (skb, op->sk); -can_send (skb,1 ); + err =can_send (skb,1 ); +if (!err) + op->frames_abs++; -/* update statistics */ op->currframe++; - op->frames_abs++;/* reached last frame? */ if (op->currframe >= op->nframes)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 586/717 wifi: rt2x00: dont run Rt5592 IQ calibration on MT7620
In reply to Greg Kroah-HartmanFrom: Daniel Golle <[email protected]>
[ Upstream commit d3aad83d05aec0cfd7670cf0028f2ad4b81de92e ]
The function rt2800_iq_calibrate is intended for Rt5592 only. Don't call it for MT7620 which has it's own calibration functions.
--- drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/ralink/rt2x00/rt2800lib.c +2 -1
@@ -4365,7 +4365,8 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev, reg = (rf->channel <=14 ?0x1c :0x24 ) +2 *rt2x00dev->lna_gain;rt2800_bbp_write_with_rx_chain (rt2x00dev,66 , reg); -rt2800_iq_calibrate (rt2x00dev, rf->channel); +if (rt2x00_rt (rt2x00dev,RT5592 )) +rt2800_iq_calibrate (rt2x00dev, rf->channel); } bbp =rt2800_bbp_read (rt2x00dev,4 );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 587/717 wifi: rt2x00: set correct TX_SW_CFG1 MAC register for MT7620
In reply to Greg Kroah-HartmanFrom: Daniel Golle <[email protected]>
[ Upstream commit eeb50acf15762b61921f9df18663f839f387c054 ]
Set correct TX_SW_CFG1 MAC register as it is done also in v3 of the vendor driver[1].
--- drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ralink/rt2x00/rt2800lib.c +1 -1
@@ -5868,7 +5868,7 @@ static int rt2800_init_registers(struct rt2x00_dev *rt2x00dev)rt2800_register_write (rt2x00dev,TX_SW_CFG0 ,0x00000404 ); }else if (rt2x00_rt (rt2x00dev,RT6352 )) {rt2800_register_write (rt2x00dev,TX_SW_CFG0 ,0x00000401 ); -rt2800_register_write (rt2x00dev,TX_SW_CFG1 ,0x000C0000 ); +rt2800_register_write (rt2x00dev,TX_SW_CFG1 ,0x000C0001 );rt2800_register_write (rt2x00dev,TX_SW_CFG2 ,0x00000000 );rt2800_register_write (rt2x00dev,TX_ALC_VGA3 ,0x00000000 );rt2800_register_write (rt2x00dev,TX0_BB_GAIN_ATTEN ,0x0 );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 588/717 wifi: rt2x00: set VGC gain for both chains of MT7620
In reply to Greg Kroah-HartmanFrom: Daniel Golle <[email protected]>
[ Upstream commit 0e09768c085709e10ece3b68f6ac921d3f6a9caa ]
Set bbp66 for all chains of the MT7620.
--- drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/ralink/rt2x00/rt2800lib.c +2 -1
@@ -5645,7 +5645,8 @@ static inline void rt2800_set_vgc(struct rt2x00_dev *rt2x00dev,if (qual->vgc_level != vgc_level) {if (rt2x00_rt (rt2x00dev,RT3572 ) ||rt2x00_rt (rt2x00dev,RT3593 ) || -rt2x00_rt (rt2x00dev,RT3883 )) { +rt2x00_rt (rt2x00dev,RT3883 ) || +rt2x00_rt (rt2x00dev,RT6352 )) {rt2800_bbp_write_with_rx_chain (rt2x00dev,66 , vgc_level); }else if (rt2x00_rt (rt2x00dev,RT5592 )) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 589/717 wifi: rt2x00: set SoC wmac clock register
In reply to Greg Kroah-HartmanFrom: Daniel Golle <[email protected]>
[ Upstream commit cbde6ed406a51092d9e8a2df058f5f8490f27443 ]
Instead of using the default value 33 (pci), set US_CYC_CNT init based on Programming guide:
If available, set chipset bus clock with fallback to cpu clock/3.
--- .../net/wireless/ralink/rt2x00/rt2800lib.c | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+)
drivers/net/wireless/ralink/rt2x00/rt2800lib.c +21 -0
@@ -6131,6 +6131,27 @@ static int rt2800_init_registers(struct rt2x00_dev *rt2x00dev) reg =rt2800_register_read (rt2x00dev,US_CYC_CNT );rt2x00_set_field32 (®,US_CYC_CNT_CLOCK_CYCLE ,125 );rt2800_register_write (rt2x00dev,US_CYC_CNT , reg); + }else if (rt2x00_is_soc (rt2x00dev)) { +struct clk *clk =clk_get_sys ("bus" ,NULL ); +int rate; + +if (IS_ERR (clk)) { + clk =clk_get_sys ("cpu" ,NULL ); + +if (IS_ERR (clk)) { + rate =125 ; + }else { + rate =clk_get_rate (clk) /3000000 ; +clk_put (clk); + } + }else { + rate =clk_get_rate (clk) /1000000 ; +clk_put (clk); + } + + reg =rt2800_register_read (rt2x00dev,US_CYC_CNT ); +rt2x00_set_field32 (®,US_CYC_CNT_CLOCK_CYCLE , rate); +rt2800_register_write (rt2x00dev,US_CYC_CNT , reg); } reg =rt2800_register_read (rt2x00dev,HT_FBK_CFG0 );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 590/717 wifi: rt2x00: correctly set BBP register 86 for MT7620
In reply to Greg Kroah-HartmanFrom: Daniel Golle <[email protected]>
[ Upstream commit c9aada64fe6493461127f1522d7e2f01792d2424 ]
Instead of 0 set the correct value for BBP register 86 for MT7620.
--- drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/wireless/ralink/rt2x00/rt2800lib.c +4 -1
@@ -4164,7 +4164,10 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev,rt2800_bbp_write (rt2x00dev,62 ,0x37 - rt2x00dev->lna_gain);rt2800_bbp_write (rt2x00dev,63 ,0x37 - rt2x00dev->lna_gain);rt2800_bbp_write (rt2x00dev,64 ,0x37 - rt2x00dev->lna_gain); -rt2800_bbp_write (rt2x00dev,86 ,0 ); +if (rt2x00_rt (rt2x00dev,RT6352 )) +rt2800_bbp_write (rt2x00dev,86 ,0x38 ); +else +rt2800_bbp_write (rt2x00dev,86 ,0 ); }if (rf->channel <=14 ) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 591/717 hwmon: (sht4x) do not overflow clamping operation on 32-bit platforms
In reply to Greg Kroah-HartmanFrom: Jason A. Donenfeld <[email protected]>
[ Upstream commit f9c0cf8f26de367c58e48b02b1cdb9c377626e6f ]
On 32-bit platforms, long is 32 bits, so (long)UINT_MAX is less than (long)SHT4X_MIN_POLL_INTERVAL, which means the clamping operation is bogus. Fix this by clamping at INT_MAX, so that the upperbound is the same on all platforms.
--- drivers/hwmon/sht4x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/sht4x.c +1 -1
@@ -129,7 +129,7 @@ static int sht4x_read_values(struct sht4x_data *data)static ssize_t sht4x_interval_write (struct sht4x_data *data,long val) { - data->update_interval =clamp_val (val,SHT4X_MIN_POLL_INTERVAL ,UINT_MAX ); + data->update_interval =clamp_val (val,SHT4X_MIN_POLL_INTERVAL ,INT_MAX );return 0 ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 592/717 net: If sock is dead dont access socks sk_wq in sk_stream_wait_memory
In reply to Greg Kroah-HartmanFrom: Liu Jian <[email protected]>
[ Upstream commit 3f8ef65af927db247418d4e1db49164d7a158fc5 ]
Fixes the below NULL pointer dereference:
[...]
[ 14.471200] Call Trace: [ 14.471562] <TASK> [ 14.471882] lock_acquire+0x245/0x2e0 [ 14.472416] ? remove_wait_queue+0x12/0x50 [ 14.473014] ? _raw_spin_lock_irqsave+0x17/0x50 [ 14.473681] _raw_spin_lock_irqsave+0x3d/0x50 [ 14.474318] ? remove_wait_queue+0x12/0x50 [ 14.474907] remove_wait_queue+0x12/0x50 [ 14.475480] sk_stream_wait_memory+0x20d/0x340 [ 14.476127] ? do_wait_intr_irq+0x80/0x80 [ 14.476704] do_tcp_sendpages+0x287/0x600 [ 14.477283] tcp_bpf_push+0xab/0x260 [ 14.477817] tcp_bpf_sendmsg_redir+0x297/0x500 [ 14.478461] ? __local_bh_enable_ip+0x77/0xe0 [ 14.479096] tcp_bpf_send_verdict+0x105/0x470 [ 14.479729] tcp_bpf_sendmsg+0x318/0x4f0 [ 14.480311] sock_sendmsg+0x2d/0x40 [ 14.480822] ____sys_sendmsg+0x1b4/0x1c0 [ 14.481390] ? copy_msghdr_from_user+0x62/0x80 [ 14.482048] ___sys_sendmsg+0x78/0xb0 [ 14.482580] ? vmf_insert_pfn_prot+0x91/0x150 [ 14.483215] ? __do_fault+0x2a/0x1a0 [ 14.483738] ? do_fault+0x15e/0x5d0 [ 14.484246] ? __handle_mm_fault+0x56b/0x1040 [ 14.484874] ? lock_is_held_type+0xdf/0x130 [ 14.485474] ? find_held_lock+0x2d/0x90 [ 14.486046] ? __sys_sendmsg+0x41/0x70 [ 14.486587] __sys_sendmsg+0x41/0x70 [ 14.487105] ? intel_pmu_drain_pebs_core+0x350/0x350 [ 14.487822] do_syscall_64+0x34/0x80 [ 14.488345] entry_SYSCALL_64_after_hwframe+0x63/0xcd [...]
The test scenario has the following flow:
thread1 thread2
----------- ---------------
tcp_bpf_sendmsg
tcp_bpf_send_verdict
tcp_bpf_sendmsg_redir sock_close
tcp_bpf_push_locked __sock_release
tcp_bpf_push //inet_release
do_tcp_sendpages sock->ops->release
sk_stream_wait_memory // tcp_close
sk_wait_event sk->sk_prot->close
release_sock(__sk);
***
lock_sock(sk);
__tcp_close
sock_orphan(sk)
sk->sk_wq = NULL
release_sock
****
lock_sock(__sk);
remove_wait_queue(sk_sleep(sk), &wait);
sk_sleep(sk)
//NULL pointer dereference
&rcu_dereference_raw(sk->sk_wq)->waitWhile waiting for memory in thread1, the socket is released with its wait queue because thread2 has closed it. This caused by tcp_bpf_send_verdict didn't increase the f_count of psock->sk_redir->sk_socket->file in thread1.
We should check if SOCK_DEAD flag is set on wakeup in sk_stream_wait_memory before accessing the wait queue.
--- net/core/stream.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/core/stream.c +2 -1
@@ -159,7 +159,8 @@ int sk_stream_wait_memory(struct sock *sk, long *timeo_p) *timeo_p = current_timeo; } out: -remove_wait_queue (sk_sleep (sk), &wait); +if (!sock_flag (sk,SOCK_DEAD )) +remove_wait_queue (sk_sleep (sk), &wait);return err; do_error:
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 593/717 bpf: Adjust kprobe_multi entry_ip for CONFIG_X86_KERNEL_IBT
In reply to Greg Kroah-HartmanFrom: Jiri Olsa <[email protected]>
[ Upstream commit c09eb2e578eb1668bbc84dc07e8d8bd6f04b9a02 ]
Martynas reported bpf_get_func_ip returning +4 address when CONFIG_X86_KERNEL_IBT option is enabled.
When CONFIG_X86_KERNEL_IBT is enabled we'll have endbr instruction at the function entry, which screws return value of bpf_get_func_ip() helper that should return the function address.
There's short term workaround for kprobe_multi bpf program made by Alexei [1], but we need this fixup also for bpf_get_attach_cookie, that returns cookie based on the entry_ip value.
Moving the fixup in the fprobe handler, so both bpf_get_func_ip and bpf_get_attach_cookie get expected function address when CONFIG_X86_KERNEL_IBT option is enabled.
Also renaming kprobe_multi_link_handler entry_ip argument to fentry_ip so it's clearer this is an ftrace __fentry__ ip.
[1] commit 7f0059b58f02 ("selftests/bpf: Fix kprobe_multi test.")
--- kernel/trace/bpf_trace.c | 20 +++++++++++++++++-- .../selftests/bpf/progs/kprobe_multi.c | 4 +--- 2 files changed, 19 insertions(+), 5 deletions(-)
kernel/trace/bpf_trace.c +18 -2
@@ -1026,6 +1026,22 @@ static const struct bpf_func_proto bpf_get_func_ip_proto_tracing = { .arg1_type = ARG_PTR_TO_CTX, }; +#ifdef CONFIG_X86_KERNEL_IBT +static unsigned long get_entry_ip (unsigned long fentry_ip) +{ +u32 instr; + +/* Being extra safe in here in case entry ip is on the page-edge. */ +if (get_kernel_nofault (instr, (u32 *) fentry_ip -1 )) +return fentry_ip; +if (is_endbr (instr)) + fentry_ip -=ENDBR_INSN_SIZE ; +return fentry_ip; +} +#else +#define get_entry_ip (fentry_ip) fentry_ip +#endif + BPF_CALL_1(bpf_get_func_ip_kprobe, struct pt_regs *, regs) {struct kprobe *kp =kprobe_running ();
@@ -2414,13 +2430,13 @@ kprobe_multi_link_prog_run(struct bpf_kprobe_multi_link *link, }static void -kprobe_multi_link_handler (struct fprobe *fp,unsigned long entry_ip, +kprobe_multi_link_handler (struct fprobe *fp,unsigned long fentry_ip,struct pt_regs *regs) {struct bpf_kprobe_multi_link *link; link = container_of(fp, struct bpf_kprobe_multi_link, fp); -kprobe_multi_link_prog_run (link, entry_ip, regs); +kprobe_multi_link_prog_run (link,get_entry_ip (fentry_ip), regs); }static int symbols_cmp_r (const void *a,const void *b,const void *priv)
tools/testing/selftests/bpf/progs/kprobe_multi.c +1 -3
@@ -36,15 +36,13 @@ __u64 kretprobe_test6_result = 0;__u64 kretprobe_test7_result =0 ;__u64 kretprobe_test8_result =0 ; -extern bool CONFIG_X86_KERNEL_IBT __kconfig __weak; -static void kprobe_multi_check (void *ctx,bool is_return) {if (bpf_get_current_pid_tgid () >>32 != pid)return ;__u64 cookie = test_cookie ?bpf_get_attach_cookie (ctx) :0 ; -__u64 addr =bpf_get_func_ip (ctx) - (CONFIG_X86_KERNEL_IBT ?4 :0 ); +__u64 addr =bpf_get_func_ip (ctx);#define SET (__var, __addr, __cookie) ({ \ if (((const void *) addr == __addr) && \
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 594/717 bpf: use bpf_prog_pack for bpf_dispatcher
In reply to Greg Kroah-HartmanFrom: Song Liu <[email protected]>
[ Upstream commit 19c02415da2345d0dda2b5c4495bc17cc14b18b5 ]
Allocate bpf_dispatcher with bpf_prog_pack_alloc so that bpf_dispatcher can share pages with bpf programs.
arch_prepare_bpf_dispatcher() is updated to provide a RW buffer as working area for arch code to write to.
This also fixes CPA W^X warnning like:
CPA refuse W^X violation: 8000000000000163 -> 0000000000000163 range: ...
--- arch/x86/net/bpf_jit_comp.c | 16 ++++++++-------- include/linux/bpf.h | 3 ++- include/linux/filter.h | 5 +++++ kernel/bpf/core.c | 9 +++++++-- kernel/bpf/dispatcher.c | 27 +++++++++++++++++++++------ 5 files changed, 43 insertions(+), 17 deletions(-)
arch/x86/net/bpf_jit_comp.c +8 -8
@@ -2216,7 +2216,7 @@ int arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, void *image, void *ireturn ret; } -static int emit_bpf_dispatcher (u8 **pprog,int a,int b,s64 *progs) +static int emit_bpf_dispatcher (u8 **pprog,int a,int b,s64 *progs,u8 *image,u8 *buf) {u8 *jg_reloc, *prog = *pprog;int pivot, err, jg_bytes =1 ;
@@ -2232,12 +2232,12 @@ static int emit_bpf_dispatcher(u8 **pprog, int a, int b, s64 *progs)EMIT2_off32 (0x81 ,add_1reg (0xF8 ,BPF_REG_3 ), progs[a]); err =emit_cond_near_jump (&prog,/* je func */ - (void *)progs[a], prog, + (void *)progs[a], image + (prog - buf),X86_JE );if (err)return err; -emit_indirect_jump (&prog,2 /* rdx */ , prog); +emit_indirect_jump (&prog,2 /* rdx */ , image + (prog - buf)); *pprog = prog;return 0 ;
@@ -2262,7 +2262,7 @@ static int emit_bpf_dispatcher(u8 **pprog, int a, int b, s64 *progs) jg_reloc = prog; err =emit_bpf_dispatcher (&prog, a, a + pivot,/* emit lower_part */ - progs); + progs, image, buf);if (err)return err;
@@ -2276,7 +2276,7 @@ static int emit_bpf_dispatcher(u8 **pprog, int a, int b, s64 *progs)emit_code (jg_reloc - jg_bytes, jg_offset, jg_bytes); err =emit_bpf_dispatcher (&prog, a + pivot +1 ,/* emit upper_part */ - b, progs); + b, progs, image, buf);if (err)return err;
@@ -2296,12 +2296,12 @@ static int cmp_ips(const void *a, const void *b)return 0 ; } -int arch_prepare_bpf_dispatcher (void *image,s64 *funcs,int num_funcs) +int arch_prepare_bpf_dispatcher (void *image,void *buf,s64 *funcs,int num_funcs) { -u8 *prog = image; +u8 *prog = buf;sort (funcs, num_funcs,sizeof (funcs[0 ]), cmp_ips,NULL ); -return emit_bpf_dispatcher (&prog,0 , num_funcs -1 , funcs); +return emit_bpf_dispatcher (&prog,0 , num_funcs -1 , funcs, image, buf); }struct x64_jit_data {
include/linux/bpf.h +2 -1
@@ -869,6 +869,7 @@ struct bpf_dispatcher {struct bpf_dispatcher_prog progs[BPF_DISPATCHER_MAX ];int num_progs;void *image; +void *rw_image;u32 image_off;struct bpf_ksym ksym; };
@@ -888,7 +889,7 @@ int bpf_trampoline_unlink_prog(struct bpf_tramp_link *link, struct bpf_trampolinstruct bpf_trampoline *bpf_trampoline_get (u64 key,struct bpf_attach_target_info *tgt_info);void bpf_trampoline_put (struct bpf_trampoline *tr); -int arch_prepare_bpf_dispatcher (void *image,s64 *funcs,int num_funcs); +int arch_prepare_bpf_dispatcher (void *image,void *buf,s64 *funcs,int num_funcs);#define BPF_DISPATCHER_INIT (_name) { \ .mutex = __MUTEX_INITIALIZER(_name.mutex), \ .func = &_name##_func, \
include/linux/filter.h +5 -0
@@ -1052,6 +1052,8 @@ extern long bpf_jit_limit_max;typedef void (*bpf_jit_fill_hole_t )(void *area,unsigned int size); +void bpf_jit_fill_hole_with_zero (void *area,unsigned int size); +struct bpf_binary_header * bpf_jit_binary_alloc(unsigned int proglen, u8 **image_ptr, unsigned int alignment,
@@ -1064,6 +1066,9 @@ void bpf_jit_free(struct bpf_prog *fp);struct bpf_binary_header *bpf_jit_binary_pack_hdr (const struct bpf_prog *fp); +void *bpf_prog_pack_alloc (u32 size,bpf_jit_fill_hole_t bpf_fill_ill_insns); +void bpf_prog_pack_free (struct bpf_binary_header *hdr); +static inline bool bpf_prog_kallsyms_verify_off (const struct bpf_prog *fp) { return list_empty(&fp->aux->ksym.lnode) ||
kernel/bpf/core.c +7 -2
@@ -822,6 +822,11 @@ struct bpf_prog_pack {unsigned long bitmap[]; }; +void bpf_jit_fill_hole_with_zero (void *area,unsigned int size) +{ +memset (area,0 , size); +} +#define BPF_PROG_SIZE_TO_NBITS (size) (round_up(size, BPF_PROG_CHUNK_SIZE) / BPF_PROG_CHUNK_SIZE)static size_t bpf_prog_pack_size =-1 ;
@@ -892,7 +897,7 @@ static struct bpf_prog_pack *alloc_new_pack(bpf_jit_fill_hole_t bpf_fill_ill_insreturn pack; } -static void *bpf_prog_pack_alloc (u32 size,bpf_jit_fill_hole_t bpf_fill_ill_insns) +void *bpf_prog_pack_alloc (u32 size,bpf_jit_fill_hole_t bpf_fill_ill_insns) {unsigned int nbits =BPF_PROG_SIZE_TO_NBITS (size);struct bpf_prog_pack *pack;
@@ -936,7 +941,7 @@ static void *bpf_prog_pack_alloc(u32 size, bpf_jit_fill_hole_t bpf_fill_ill_insnreturn ptr; } -static void bpf_prog_pack_free (struct bpf_binary_header *hdr) +void bpf_prog_pack_free (struct bpf_binary_header *hdr) {struct bpf_prog_pack *pack =NULL , *tmp;unsigned int nbits;
kernel/bpf/dispatcher.c +21 -6
@@ -85,12 +85,12 @@ static bool bpf_dispatcher_remove_prog(struct bpf_dispatcher *d,return false; } -int __weak arch_prepare_bpf_dispatcher (void *image,s64 *funcs,int num_funcs) +int __weak arch_prepare_bpf_dispatcher (void *image,void *buf,s64 *funcs,int num_funcs) {return -ENOTSUPP ; } -static int bpf_dispatcher_prepare (struct bpf_dispatcher *d,void *image) +static int bpf_dispatcher_prepare (struct bpf_dispatcher *d,void *image,void *buf) {s64 ips[BPF_DISPATCHER_MAX ] = {}, *ipsp = &ips[0 ];int i;
@@ -99,12 +99,12 @@ static int bpf_dispatcher_prepare(struct bpf_dispatcher *d, void *image)if (d->progs[i].prog) *ipsp++ = (s64 )(uintptr_t )d->progs[i].prog->bpf_func; } -return arch_prepare_bpf_dispatcher (image, &ips[0 ], d->num_progs); +return arch_prepare_bpf_dispatcher (image, buf, &ips[0 ], d->num_progs); }static void bpf_dispatcher_update (struct bpf_dispatcher *d,int prev_num_progs) { -void *old, *new; +void *old, *new, *tmp;u32 noff;int err;
@@ -117,8 +117,14 @@ static void bpf_dispatcher_update(struct bpf_dispatcher *d, int prev_num_progs) } new = d->num_progs ? d->image + noff :NULL ; + tmp = d->num_progs ? d->rw_image + noff :NULL ;if (new) { -if (bpf_dispatcher_prepare (d, new)) +/* Prepare the dispatcher in d->rw_image. Then use +* bpf_arch_text_copy to update d->image, which is RO+X. +*/ +if (bpf_dispatcher_prepare (d, new, tmp)) +return ; +if (IS_ERR (bpf_arch_text_copy (new, tmp,PAGE_SIZE /2 )))return ; }
@@ -140,9 +146,18 @@ void bpf_dispatcher_change_prog(struct bpf_dispatcher *d, struct bpf_prog *from,mutex_lock (&d->mutex);if (!d->image) { - d->image =bpf_jit_alloc_exec_page (); + d->image =bpf_prog_pack_alloc (PAGE_SIZE , bpf_jit_fill_hole_with_zero);if (!d->image) goto out; + d->rw_image =bpf_jit_alloc_exec (PAGE_SIZE ); +if (!d->rw_image) { +u32 size =PAGE_SIZE ; + +bpf_arch_text_copy (d->image, &size,sizeof (size)); +bpf_prog_pack_free ((struct bpf_binary_header *)d->image); + d->image =NULL ; + goto out; + }bpf_image_ksym_add (d->image, &d->ksym); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 595/717 Bluetooth: L2CAP: Fix user-after-free
In reply to Greg Kroah-HartmanFrom: Luiz Augusto von Dentz <[email protected]>
[ Upstream commit 35fcbc4243aad7e7d020b7c1dfb14bb888b20a4f ]
This uses l2cap_chan_hold_unless_zero() after calling __l2cap_get_chan_blah() to prevent the following trace:
Bluetooth: l2cap_core.c:static void l2cap_chan_destroy(struct kref *kref)
Bluetooth: chan 0000000023c4974d
Bluetooth: parent 00000000ae861c08
==================================================================
BUG: KASAN: use-after-free in __mutex_waiter_is_first kernel/locking/mutex.c:191 [inline] BUG: KASAN: use-after-free in __mutex_lock_common kernel/locking/mutex.c:671 [inline] BUG: KASAN: use-after-free in __mutex_lock+0x278/0x400 kernel/locking/mutex.c:729 Read of size 8 at addr ffff888006a49b08 by task kworker/u3:2/389
--- net/bluetooth/l2cap_core.c | 7 +++++++ 1 file changed, 7 insertions(+)
net/bluetooth/l2cap_core.c +7 -0
@@ -4308,6 +4308,12 @@ static int l2cap_connect_create_rsp(struct l2cap_conn *conn, } } + chan =l2cap_chan_hold_unless_zero (chan); +if (!chan) { + err = -EBADSLT ; + goto unlock; + } + err =0 ;l2cap_chan_lock (chan);
@@ -4337,6 +4343,7 @@ static int l2cap_connect_create_rsp(struct l2cap_conn *conn, }l2cap_chan_unlock (chan); +l2cap_chan_put (chan); unlock:mutex_unlock (&conn->chan_lock);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 596/717 i2c: designware-pci: Group AMD NAVI quirk parts together
In reply to Greg Kroah-HartmanFrom: Andy Shevchenko <[email protected]>
[ Upstream commit 65769162ae4b7f2d82e54998be446226b05fcd8f ]
The code is ogranized in a way that all related parts to the certain platform quirk go together. This is not the case for AMD NAVI. Shuffle code to make it happen.
While at it, drop the frequency definition and use hard coded value as it's done for other platforms and add a comment to the PCI ID list.
--- drivers/i2c/busses/i2c-designware-pcidrv.c | 30 +++++++++++----------- 1 file changed, 15 insertions(+), 15 deletions(-)
drivers/i2c/busses/i2c-designware-pcidrv.c +15 -15
@@ -27,7 +27,6 @@#include "i2c-ccgx-ucsi.h" #define DRIVER_NAME "i2c-designware-pci" -#define AMD_CLK_RATE_HZ 100000enum dw_pci_ctl_id_t { medfield,
@@ -100,11 +99,6 @@ static u32 mfld_get_clk_rate_khz(struct dw_i2c_dev *dev)return 25000 ; } -static u32 navi_amd_get_clk_rate_khz (struct dw_i2c_dev *dev) -{ -return AMD_CLK_RATE_HZ ; -} -static int mfld_setup (struct pci_dev *pdev,struct dw_pci_controller *c) {struct dw_i2c_dev *dev =dev_get_drvdata (&pdev->dev);
@@ -126,15 +120,6 @@ static int mfld_setup(struct pci_dev *pdev, struct dw_pci_controller *c)return -ENODEV ; } -static int navi_amd_setup (struct pci_dev *pdev,struct dw_pci_controller *c) -{ -struct dw_i2c_dev *dev =dev_get_drvdata (&pdev->dev); - - dev->flags |=MODEL_AMD_NAVI_GPU ; - dev->timings.bus_freq_hz =I2C_MAX_STANDARD_MODE_FREQ ; -return 0 ; -} -static int mrfld_setup (struct pci_dev *pdev,struct dw_pci_controller *c) {/*
@@ -159,6 +144,20 @@ static u32 ehl_get_clk_rate_khz(struct dw_i2c_dev *dev)return 100000 ; } +static u32 navi_amd_get_clk_rate_khz (struct dw_i2c_dev *dev) +{ +return 100000 ; +} + +static int navi_amd_setup (struct pci_dev *pdev,struct dw_pci_controller *c) +{ +struct dw_i2c_dev *dev =dev_get_drvdata (&pdev->dev); + + dev->flags |=MODEL_AMD_NAVI_GPU ; + dev->timings.bus_freq_hz =I2C_MAX_STANDARD_MODE_FREQ ; +return 0 ; +} +static struct dw_pci_controller dw_pci_controllers[] = { [medfield] = { .bus_num =-1 ,
@@ -389,6 +388,7 @@ static const struct pci_device_id i2_designware_pci_ids[] = { { PCI_VDEVICE(INTEL, 0x4bbe), elkhartlake }, { PCI_VDEVICE(INTEL, 0x4bbf), elkhartlake }, { PCI_VDEVICE(INTEL, 0x4bc0), elkhartlake }, +/* AMD NAVI */ { PCI_VDEVICE(ATI, 0x7314), navi_amd }, { PCI_VDEVICE(ATI, 0x73a4), navi_amd }, { PCI_VDEVICE(ATI, 0x73e4), navi_amd },
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 597/717 r8152: Rate limit overflow messages
In reply to Greg Kroah-HartmanFrom: Andrew Gaul <[email protected]>
[ Upstream commit 93e2be344a7db169b7119de21ac1bf253b8c6907 ]
My system shows almost 10 million of these messages over a 24-hour period which pollutes my logs.
--- drivers/net/usb/r8152.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/usb/r8152.c +3 -1
@@ -1874,7 +1874,9 @@ static void intr_callback(struct urb *urb) "Stop submitting intr, status %d\n", status);return ;case -EOVERFLOW : -netif_info (tp, intr, tp->netdev,"intr status -EOVERFLOW\n" ); +if (net_ratelimit ()) +netif_info (tp, intr, tp->netdev, +"intr status -EOVERFLOW\n" ); goto resubmit;/* -EPIPE: should clear the halt */ default :
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 598/717 drm/nouveau/nouveau_bo: fix potential memory leak in nouveau_bo_alloc()
In reply to Greg Kroah-HartmanFrom: Jianglei Nie <[email protected]>
[ Upstream commit 6dc548745d5b5102e3c53dc5097296ac270b6c69 ]
nouveau_bo_alloc() allocates a memory chunk for "nvbo" with kzalloc(). When some error occurs, "nvbo" should be released. But when WARN_ON(pi < 0)) equals true, the function return ERR_PTR without releasing the "nvbo", which will lead to a memory leak.
We should release the "nvbo" with kfree() if WARN_ON(pi < 0)) equals true.
--- drivers/gpu/drm/nouveau/nouveau_bo.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nouveau_bo.c +3 -1
@@ -281,8 +281,10 @@ nouveau_bo_alloc(struct nouveau_cli *cli, u64 *size, int *align, u32 domain,break ; } -if (WARN_ON (pi <0 )) +if (WARN_ON (pi <0 )) { +kfree (nvbo);return ERR_PTR (-EINVAL ); + }/* Disable compression if suitable settings couldn't be found. */ if (nvbo->comp && !vmm->page[pi].comp) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 599/717 drm: Use size_t type for len variable in drm_copy_field()
In reply to Greg Kroah-HartmanFrom: Javier Martinez Canillas <[email protected]>
[ Upstream commit 94dc3471d1b2b58b3728558d0e3f264e9ce6ff59 ]
The strlen() function returns a size_t which is an unsigned int on 32-bit arches and an unsigned long on 64-bit arches. But in the drm_copy_field() function, the strlen() return value is assigned to an 'int len' variable.
Later, the len variable is passed as copy_from_user() third argument that is an unsigned long parameter as well.
In theory, this can lead to an integer overflow via type conversion. Since the assignment happens to a signed int lvalue instead of a size_t lvalue.
In practice though, that's unlikely since the values copied are set by DRM drivers and not controlled by userspace. But using a size_t for len is the correct thing to do anyways.
--- drivers/gpu/drm/drm_ioctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_ioctl.c +1 -1
@@ -472,7 +472,7 @@ EXPORT_SYMBOL(drm_invalid_op);*/ static int drm_copy_field (char __user *buf,size_t *buf_len,const char *value) { -int len; +size_t len;/* don't overflow userbuf */ len =strlen (value);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 600/717 drm: Prevent drm_copy_field() to attempt copying a NULL pointer
In reply to Greg Kroah-HartmanFrom: Javier Martinez Canillas <[email protected]>
[ Upstream commit f6ee30407e883042482ad4ad30da5eaba47872ee ]
There are some struct drm_driver fields that are required by drivers since drm_copy_field() attempts to copy them to user-space via DRM_IOCTL_VERSION.
But it can be possible that a driver has a bug and did not set some of the fields, which leads to drm_copy_field() attempting to copy a NULL pointer:
[ +10.395966] Unable to handle kernel access to user memory outside uaccess routines at virtual address 0000000000000000
[ +0.010955] Mem abort info: [ +0.002835] ESR = 0x0000000096000004 [ +0.003872] EC = 0x25: DABT (current EL), IL = 32 bits [ +0.005395] SET = 0, FnV = 0 [ +0.003113] EA = 0, S1PTW = 0 [ +0.003182] FSC = 0x04: level 0 translation fault [ +0.004964] Data abort info: [ +0.002919] ISV = 0, ISS = 0x00000004 [ +0.003886] CM = 0, WnR = 0 [ +0.003040] user pgtable: 4k pages, 48-bit VAs, pgdp=0000000115dad000 [ +0.006536] [0000000000000000] pgd=0000000000000000, p4d=0000000000000000 [ +0.006925] Internal error: Oops: 96000004 [#1] SMP ... [ +0.011113] pstate: 80400005 (Nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) [ +0.007061] pc : __pi_strlen+0x14/0x150 [ +0.003895] lr : drm_copy_field+0x30/0x1a4 [ +0.004156] sp : ffff8000094b3a50 [ +0.003355] x29: ffff8000094b3a50 x28: ffff8000094b3b70 x27: 0000000000000040 [ +0.007242] x26: ffff443743c2ba00 x25: 0000000000000000 x24: 0000000000000040 [ +0.007243] x23: ffff443743c2ba00 x22: ffff8000094b3b70 x21: 0000000000000000 [ +0.007241] x20: 0000000000000000 x19: ffff8000094b3b90 x18: 0000000000000000 [ +0.007241] x17: 0000000000000000 x16: 0000000000000000 x15: 0000aaab14b9af40 [ +0.007241] x14: 0000000000000000 x13: 0000000000000000 x12: 0000000000000000 [ +0.007239] x11: 0000000000000000 x10: 0000000000000000 x9 : ffffa524ad67d4d8 [ +0.007242] x8 : 0101010101010101 x7 : 7f7f7f7f7f7f7f7f x6 : 6c6e6263606e7141 [ +0.007239] x5 : 0000000000000000 x4 : 0000000000000000 x3 : 0000000000000000 [ +0.007241] x2 : 0000000000000000 x1 : ffff8000094b3b90 x0 : 0000000000000000 [ +0.007240] Call trace: [ +0.002475] __pi_strlen+0x14/0x150 [ +0.003537] drm_version+0x84/0xac [ +0.003448] drm_ioctl_kernel+0xa8/0x16c [ +0.003975] drm_ioctl+0x270/0x580 [ +0.003448] __arm64_sys_ioctl+0xb8/0xfc [ +0.003978] invoke_syscall+0x78/0x100 [ +0.003799] el0_svc_common.constprop.0+0x4c/0xf4 [ +0.004767] do_el0_svc+0x38/0x4c [ +0.003357] el0_svc+0x34/0x100 [ +0.003185] el0t_64_sync_handler+0x11c/0x150 [ +0.004418] el0t_64_sync+0x190/0x194 [ +0.003716] Code: 92402c04 b200c3e8 f13fc09f 5400088c (a9400c02) [ +0.006180] ---[ end trace 0000000000000000 ]---
--- drivers/gpu/drm/drm_ioctl.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/drm_ioctl.c +6 -0
@@ -474,6 +474,12 @@ static int drm_copy_field(char __user *buf, size_t *buf_len, const char *value) {size_t len; +/* don't attempt to copy a NULL pointer */ +if (WARN_ONCE (!value,"BUG: the value to copy was not set!" )) { + *buf_len =0 ; +return 0 ; + } +/* don't overflow userbuf */ len =strlen (value);if (len > *buf_len)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 601/717 drm/komeda: Fix handling of atomic commits in the atomic_commit_tail hook
In reply to Greg Kroah-HartmanFrom: Liviu Dudau <[email protected]>
[ Upstream commit eaa225b6b52233d45457fd33730e1528c604d92d ]
Komeda driver relies on the generic DRM atomic helper functions to handle commits. It only implements an atomic_commit_tail hook for the mode_config_helper_funcs and even that one is pretty close to the generic implementation with the exception of additional dma_fence signalling.
What the generic helper framework doesn't do is waiting for the actual hardware to signal that the commit parameters have been written into the appropriate registers. As we signal CRTC events only on the irq handlers, we need to flush the configuration and wait for the hardware to respond.
Add the Komeda specific implementation for atomic_commit_hw_done() that flushes and waits for flip done before calling drm_atomic_helper_commit_hw_done().
The fix was prompted by a patch from Carsten Haitzler where he was trying to solve the same issue but in a different way that I think can lead to wrong event signaling to userspace.
--- .../gpu/drm/arm/display/komeda/komeda_crtc.c | 4 ++-- .../gpu/drm/arm/display/komeda/komeda_kms.c | 21 ++++++++++++++++++- .../gpu/drm/arm/display/komeda/komeda_kms.h | 2 ++ 3 files changed, 24 insertions(+), 3 deletions(-)
drivers/gpu/drm/arm/display/komeda/komeda_crtc.c +2 -2
@@ -235,7 +235,7 @@ void komeda_crtc_handle_event(struct komeda_crtc *kcrtc, crtc->state->event =NULL ;drm_crtc_send_vblank_event (crtc, event); }else { -DRM_WARN ("CRTC[%d]: FLIP happen but no pending commit.\n" , +DRM_WARN ("CRTC[%d]: FLIP happened but no pending commit.\n" ,drm_crtc_index (&kcrtc->base)); }spin_unlock_irqrestore (&crtc->dev->event_lock, flags);
@@ -286,7 +286,7 @@ komeda_crtc_atomic_enable(struct drm_crtc *crtc,komeda_crtc_do_flush (crtc, old); } -static void +void komeda_crtc_flush_and_wait_for_flip_done (struct komeda_crtc *kcrtc,struct completion *input_flip_done) {
drivers/gpu/drm/arm/display/komeda/komeda_kms.c +20 -1
@@ -69,6 +69,25 @@ static const struct drm_driver komeda_kms_driver = { .minor = 1, }; +static void komeda_kms_atomic_commit_hw_done (struct drm_atomic_state *state) +{ +struct drm_device *dev = state->dev; +struct komeda_kms_dev *kms =to_kdev (dev); +int i; + +for (i =0 ; i < kms->n_crtcs; i++) { +struct komeda_crtc *kcrtc = &kms->crtcs[i]; + +if (kcrtc->base.state->active) { +struct completion *flip_done =NULL ; +if (kcrtc->base.state->event) + flip_done = kcrtc->base.state->event->base.completion; +komeda_crtc_flush_and_wait_for_flip_done (kcrtc, flip_done); + } + } +drm_atomic_helper_commit_hw_done (state); +} +static void komeda_kms_commit_tail (struct drm_atomic_state *old_state) {struct drm_device *dev = old_state->dev;
@@ -81,7 +100,7 @@ static void komeda_kms_commit_tail(struct drm_atomic_state *old_state)drm_atomic_helper_commit_modeset_enables (dev, old_state); -drm_atomic_helper_commit_hw_done (old_state); +komeda_kms_atomic_commit_hw_done (old_state);drm_atomic_helper_wait_for_flip_done (dev, old_state);
drivers/gpu/drm/arm/display/komeda/komeda_kms.h +2 -0
@@ -182,6 +182,8 @@ void komeda_kms_cleanup_private_objs(struct komeda_kms_dev *kms);void komeda_crtc_handle_event (struct komeda_crtc *kcrtc,struct komeda_events *evts); +void komeda_crtc_flush_and_wait_for_flip_done (struct komeda_crtc *kcrtc, +struct completion *input_flip_done);struct komeda_kms_dev *komeda_kms_attach (struct komeda_dev *mdev);void komeda_kms_detach (struct komeda_kms_dev *kms);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 602/717 gpu: lontium-lt9611: Fix NULL pointer dereference in lt9611_connector_init()
In reply to Greg Kroah-HartmanFrom: Zeng Jingxiang <[email protected]>
[ Upstream commit ef8886f321c5dab8124b9153d25afa2a71d05323 ]
A NULL check for bridge->encoder shows that it may be NULL, but it already been dereferenced on all paths leading to the check.
812 if (!bridge->encoder) {
Dereference the pointer bridge->encoder.
810 drm_connector_attach_encoder(<9611->connector, bridge->encoder);
--- drivers/gpu/drm/bridge/lontium-lt9611.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/bridge/lontium-lt9611.c +2 -1
@@ -807,13 +807,14 @@ static int lt9611_connector_init(struct drm_bridge *bridge, struct lt9611 *lt961drm_connector_helper_add (<9611->connector, <9611_bridge_connector_helper_funcs); -drm_connector_attach_encoder (<9611->connector, bridge->encoder);if (!bridge->encoder) {DRM_ERROR ("Parent encoder object not found" );return -ENODEV ; } +drm_connector_attach_encoder (<9611->connector, bridge->encoder); +return 0 ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 603/717 drm/amd/display: fix overflow on MIN_I64 definition
In reply to Greg Kroah-HartmanFrom: David Gow <[email protected]>
[ Upstream commit 6ae0632d17759852c07e2d1e0a31c728eb6ba246 ]
The definition of MIN_I64 in bw_fixed.c can cause gcc to whinge about integer overflow, because it is treated as a positive value, which is then negated. The temporary positive value is not necessarily representable.
This causes the following warning:../drivers/gpu/drm/amd/amdgpu/../display/dc/dml/calcs/bw_fixed.c:30:19:
warning: integer overflow in expression ‘-9223372036854775808’ of type ‘long long int’ results in ‘-9223372036854775808’ [-Woverflow]
30 | (int64_t)(-(1LL << 63))
| ^
Writing out (-MAX_I64 - 1) works instead.
--- drivers/gpu/drm/amd/display/dc/dml/calcs/bw_fixed.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/dc/dml/calcs/bw_fixed.c +3 -3
@@ -26,12 +26,12 @@#include "bw_fixed.h" -#define MIN_I64 \ - (int64_t)(-(1LL << 63)) -#define MAX_I64 \ (int64_t)((1ULL << 63) - 1) +#define MIN_I64 \ + (-MAX_I64 - 1) +#define FRACTIONAL_PART_MASK \ ((1ULL << BW_FIXED_BITS_PER_FRACTIONAL_PART) - 1)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 604/717 udmabuf: Set ubuf->sg = NULL if the creation of sg table fails
In reply to Greg Kroah-HartmanFrom: Vivek Kasireddy <[email protected]>
[ Upstream commit d9c04a1b7a15b5e74b2977461d9511e497f05d8f ]
When userspace tries to map the dmabuf and if for some reason (e.g. OOM) the creation of the sg table fails, ubuf->sg needs to be set to NULL. Otherwise, when the userspace subsequently closes the dmabuf fd, we'd try to erroneously free the invalid sg table from release_udmabuf resulting in the following crash reported by syzbot:
general protection fault, probably for non-canonical address 0xdffffc0000000000: 0000 [#1] PREEMPT SMP KASAN KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007] CPU: 0 PID: 3609 Comm: syz-executor487 Not tainted 5.19.0-syzkaller-13930-g7ebfc85e2cd7 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/22/2022 RIP: 0010:dma_unmap_sgtable include/linux/dma-mapping.h:378 [inline] RIP: 0010:put_sg_table drivers/dma-buf/udmabuf.c:89 [inline] RIP: 0010:release_udmabuf+0xcb/0x4f0 drivers/dma-buf/udmabuf.c:114 Code: 48 89 fa 48 c1 ea 03 80 3c 02 00 0f 85 2b 04 00 00 48 8d 7d 0c 4c 8b 63 30 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <0f> b6 14 02 48 89 f8 83 e0 07 83 c0 03 38 d0 7c 08 84 d2 0f 85 e2 RSP: 0018:ffffc900037efd30 EFLAGS: 00010246 RAX: dffffc0000000000 RBX: ffffffff8cb67800 RCX: 0000000000000000 RDX: 0000000000000000 RSI: ffffffff84ad27e0 RDI: 0000000000000000 RBP: fffffffffffffff4 R08: 0000000000000005 R09: 0000000000000000 R10: 0000000000000000 R11: 000000000008c07c R12: ffff88801fa05000 R13: ffff888073db07e8 R14: ffff888025c25440 R15: 0000000000000000 FS: 0000555555fc4300(0000) GS:ffff8880b9a00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007fc1c0ce06e4 CR3: 00000000715e6000 CR4: 00000000003506f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <TASK> dma_buf_release+0x157/0x2d0 drivers/dma-buf/dma-buf.c:78 __dentry_kill+0x42b/0x640 fs/dcache.c:612 dentry_kill fs/dcache.c:733 [inline] dput+0x806/0xdb0 fs/dcache.c:913 __fput+0x39c/0x9d0 fs/file_table.c:333 task_work_run+0xdd/0x1a0 kernel/task_work.c:177 ptrace_notify+0x114/0x140 kernel/signal.c:2353 ptrace_report_syscall include/linux/ptrace.h:420 [inline] ptrace_report_syscall_exit include/linux/ptrace.h:482 [inline] syscall_exit_work kernel/entry/common.c:249 [inline] syscall_exit_to_user_mode_prepare+0x129/0x280 kernel/entry/common.c:276 __syscall_exit_to_user_mode_work kernel/entry/common.c:281 [inline] syscall_exit_to_user_mode+0x9/0x50 kernel/entry/common.c:294 do_syscall_64+0x42/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7fc1c0c35b6b Code: 0f 05 48 3d 00 f0 ff ff 77 45 c3 0f 1f 40 00 48 83 ec 18 89 7c 24
0c e8 63 fc ff ff 8b 7c 24 0c 41 89 c0 b8 03 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 35 44 89 c7 89 44 24 0c e8 a1 fc ff ff 8b 44
RSP: 002b:00007ffd78a06090 EFLAGS: 00000293 ORIG_RAX: 0000000000000003
RAX: 0000000000000000 RBX: 0000000000000007 RCX: 00007fc1c0c35b6b
RDX: 0000000020000280 RSI: 0000000040086200 RDI: 0000000000000006
RBP: 0000000000000007 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000293 R12: 000000000000000c
R13: 0000000000000003 R14: 00007fc1c0cfe4a0 R15: 00007ffd78a06140
</TASK> Modules linked in: ---[ end trace 0000000000000000 ]--- RIP: 0010:dma_unmap_sgtable include/linux/dma-mapping.h:378 [inline] RIP: 0010:put_sg_table drivers/dma-buf/udmabuf.c:89 [inline] RIP: 0010:release_udmabuf+0xcb/0x4f0 drivers/dma-buf/udmabuf.c:114
--- drivers/dma-buf/udmabuf.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/dma-buf/udmabuf.c +6 -3
@@ -124,17 +124,20 @@ static int begin_cpu_udmabuf(struct dma_buf *buf, {struct udmabuf *ubuf = buf->priv;struct device *dev = ubuf->device->this_device; +int ret =0 ;if (!ubuf->sg) { ubuf->sg =get_sg_table (dev, buf, direction); -if (IS_ERR (ubuf->sg)) -return PTR_ERR (ubuf->sg); +if (IS_ERR (ubuf->sg)) { + ret =PTR_ERR (ubuf->sg); + ubuf->sg =NULL ; + } }else {dma_sync_sg_for_cpu (dev, ubuf->sg->sgl, ubuf->sg->nents, direction); } -return 0 ; +return ret; } static int end_cpu_udmabuf(struct dma_buf *buf,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 605/717 platform/x86: pmc_atom: Improve quirk message to be less cryptic
In reply to Greg Kroah-HartmanFrom: Andy Shevchenko <[email protected]>
[ Upstream commit 32c9b75640aeb1b144f9e2963c1640f4cef7c6f2 ]
Not everyone can get what "critclks" means in the message, improve it to make less cryptic.
--- drivers/platform/x86/pmc_atom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/x86/pmc_atom.c +1 -1
@@ -354,7 +354,7 @@ static bool pmc_clk_is_critical = true;static int dmi_callback (const struct dmi_system_id *d) { -pr_info ("%s critclks quirk enabled\n" , d->ident); +pr_info ("%s: PMC critical clocks quirk enabled\n" , d->ident);return 1 ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 606/717 drm: bridge: dw_hdmi: only trigger hotplug event on link change
In reply to Greg Kroah-HartmanFrom: Lucas Stach <[email protected]>
[ Upstream commit da09daf881082266e4075657fac53c7966de8e4d ]
There are two events that signal a real change of the link state: HPD going high means the sink is newly connected or wants the source to re-read the EDID, RX sense going low is a indication that the link has been disconnected.
Ignore the other two events that also trigger interrupts, but don't need immediate attention: HPD going low does not necessarily mean the link has been lost and should not trigger a immediate read of the status. RX sense going high also does not require a detect cycle, as HPD going high is the right point in time to read the EDID.
--- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +8 -5
@@ -3095,6 +3095,7 @@ static irqreturn_t dw_hdmi_irq(int irq, void *dev_id) {struct dw_hdmi *hdmi = dev_id;u8 intr_stat, phy_int_pol, phy_pol_mask, phy_stat; +enum drm_connector_status status = connector_status_unknown; intr_stat =hdmi_readb (hdmi,HDMI_IH_PHY_STAT0 ); phy_int_pol =hdmi_readb (hdmi,HDMI_PHY_POL0 );
@@ -3133,13 +3134,15 @@ static irqreturn_t dw_hdmi_irq(int irq, void *dev_id)cec_notifier_phys_addr_invalidate (hdmi->cec_notifier);mutex_unlock (&hdmi->cec_notifier_mutex); } - } -if (intr_stat &HDMI_IH_PHY_STAT0_HPD ) { -enum drm_connector_status status = phy_int_pol &HDMI_PHY_HPD - ? connector_status_connected - : connector_status_disconnected; +if (phy_stat &HDMI_PHY_HPD ) + status = connector_status_connected; + +if (!(phy_stat & (HDMI_PHY_HPD |HDMI_PHY_RX_SENSE ))) + status = connector_status_disconnected; + } +if (status != connector_status_unknown) {dev_dbg (hdmi->dev,"EVENT=%s\n" , status == connector_status_connected ?"plugin" :"plugout" );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 607/717 drm/amdgpu: Skip the program of MMMC_VM_AGP_* in SRIOV on MMHUB v3_0_0
In reply to Greg Kroah-HartmanFrom: Yifan Zha <[email protected]>
[ Upstream commit c1026c6f319724dc88fc08d9d9d35bcbdf492b42 ]
[Why]
VF should not program these registers, the value were defined in the host.
[How]
Skip writing them in SRIOV environment and program them on host side.
--- drivers/gpu/drm/amd/amdgpu/mmhub_v3_0.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/mmhub_v3_0.c +5 -5
@@ -169,17 +169,17 @@ static void mmhub_v3_0_init_system_aperture_regs(struct amdgpu_device *adev)uint64_t value;uint32_t tmp; -/* Disable AGP. */ -WREG32_SOC15 (MMHUB ,0 , regMMMC_VM_AGP_BASE,0 ); -WREG32_SOC15 (MMHUB ,0 , regMMMC_VM_AGP_TOP,0 ); -WREG32_SOC15 (MMHUB ,0 , regMMMC_VM_AGP_BOT,0x00FFFFFF ); -if (!amdgpu_sriov_vf (adev)) {/* * the new L1 policy will block SRIOV guest from writing * these regs, and they will be programed at host. * so skip programing these regs. */ +/* Disable AGP. */ +WREG32_SOC15 (MMHUB ,0 , regMMMC_VM_AGP_BASE,0 ); +WREG32_SOC15 (MMHUB ,0 , regMMMC_VM_AGP_TOP,0 ); +WREG32_SOC15 (MMHUB ,0 , regMMMC_VM_AGP_BOT,0x00FFFFFF ); +/* Program the system aperture low logical page number. */ WREG32_SOC15 (MMHUB ,0 , regMMMC_VM_SYSTEM_APERTURE_LOW_ADDR, adev->gmc.vram_start >>18 );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 608/717 drm/admgpu: Skip CG/PG on SOC21 under SRIOV VF
In reply to Greg Kroah-HartmanFrom: Yifan Zha <[email protected]>
[ Upstream commit 828418259254863e0af5805bd712284e2bd88e3b ]
[Why]
There is no CG(Clock Gating)/PG(Power Gating) requirement on SRIOV VF. For multi VF, VF should not enable any CG/PG features.
For one VF, PF will program CG/PG related registers.
[How]
Do not set any cg/pg flag bit at early init under sriov.
--- drivers/gpu/drm/amd/amdgpu/soc21.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/amdgpu/soc21.c +4 -0
@@ -551,6 +551,10 @@ static int soc21_common_early_init(void *handle)AMD_PG_SUPPORT_JPEG |AMD_PG_SUPPORT_ATHUB |AMD_PG_SUPPORT_MMHUB ; +if (amdgpu_sriov_vf (adev)) { + adev->cg_flags =0 ; + adev->pg_flags =0 ; + } adev->external_rev_id = adev->rev_id +0x1 ;// TODO: need update break ;case IP_VERSION (11 ,0 ,2 ):
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 609/717 ALSA: usb-audio: Register card at the last interface
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
[ Upstream commit 6392dcd1d0c7034ccf630ec55fc9e5810ecadf3b ]
The USB-audio driver matches per interface, and as default, it registers the card instance at the very first instance. This can be a problem for the devices that have multiple interfaces to be probed, as the udev rule isn't applied properly for the later appearing interfaces. Although we introduced the delayed_register option and the quirks for covering those shortcomings, it's nothing but a workaround for specific devices.
This patch is an another attempt to fix the problem in a more generic way. Now the driver checks the whole USB device descriptor at the very first time when an interface is attached to a sound card. It looks at each matching interface in the descriptor and remembers the last matching one. The snd_card_register() is invoked only when this last interface is probed.
After this change, the quirks for the delayed registration become superfluous, hence they are removed along with the patch. OTOH, the delayed_register option is still kept, as it might be useful for some corner cases (e.g. a special driver overtakes the interface probe from the standard driver, and the last interface probe may miss).
--- sound/usb/card.c | 32 +++++++++++++++++++++++++------- sound/usb/quirks.c | 42 ------------------------------------------ sound/usb/quirks.h | 2 -- sound/usb/usbaudio.h | 1 + 4 files changed, 26 insertions(+), 51 deletions(-)
sound/usb/card.c +25 -7
@@ -690,7 +690,7 @@ static bool get_alias_id(struct usb_devireturn false; } -static bool check_delayed_register_option (struct snd_usb_audio *chip,int iface) +static int check_delayed_register_option (struct snd_usb_audio *chip) {int i;unsigned int id, inum;
@@ -699,14 +699,31 @@ static bool check_delayed_register_optioif (delayed_register[i] &&sscanf (delayed_register[i],"%x:%x" , &id, &inum) ==2 && id == chip->usb_id) -return iface < inum; +return inum; } -return false; +return -1 ; }static const struct usb_device_id usb_audio_ids[];/* defined below */ +/* look for the last interface that matches with our ids and remember it */ +static void find_last_interface (struct snd_usb_audio *chip) +{ +struct usb_host_config *config = chip->dev->actconfig; +struct usb_interface *intf; +int i; + +if (!config) +return ; +for (i =0 ; i < config->desc.bNumInterfaces; i++) { + intf = config->interface[i]; +if (usb_match_id (intf, usb_audio_ids)) + chip->last_iface = intf->altsetting[0 ].desc.bInterfaceNumber; + } +usb_audio_dbg (chip,"Found last interface = %d\n" , chip->last_iface); +} +/* look for the corresponding quirk */ static const struct snd_usb_audio_quirk *get_alias_quirk (struct usb_device *dev,unsigned int id)
@@ -813,6 +830,7 @@ static int usb_audio_probe(struct usb_in err = -ENODEV ; goto __error; } +find_last_interface (chip); }if (chip->num_interfaces >=MAX_CARD_INTERFACES ) {
@@ -862,11 +880,11 @@ static int usb_audio_probe(struct usb_in chip->need_delayed_register = false;/* clear again */ } -/* we are allowed to call snd_card_register() many times, but first -* check to see if a device needs to skip it or do anything special +/* register card if we reach to the last interface or to the specified +* one given via option */ -if (!snd_usb_registration_quirk (chip, ifnum) && - !check_delayed_register_option (chip, ifnum)) { +if (check_delayed_register_option (chip) == ifnum || + chip->last_iface == ifnum) { err =snd_card_register (chip->card);if (err <0 ) goto __error;
sound/usb/quirks.c +0 -42
48 lines not on this page · raw message
sound/usb/quirks.h +0 -2
@@ -48,8 +48,6 @@ void snd_usb_audioformat_attributes_quirstruct audioformat *fp, int stream); -bool snd_usb_registration_quirk (struct snd_usb_audio *chip,int iface); -void snd_usb_init_quirk_flags (struct snd_usb_audio *chip);#endif /* __USBAUDIO_QUIRKS_H */
sound/usb/usbaudio.h +1 -0
@@ -37,6 +37,7 @@ struct snd_usb_audio {unsigned int quirk_flags; unsigned int need_delayed_register:1; /* warn for delayed registration */int num_interfaces; +int last_iface;int num_suspended_intf;int sample_rate_read_error;
Greg Kroah-Hartman
maintainerPATCH 610/717 drm/vc4: vec: Fix timings for VEC modes
In reply to Greg Kroah-HartmanFrom: Mateusz Kwiatkowski <[email protected]>
[ Upstream commit 30d7565be96b3946c18a1ce3fd538f7946839092 ]
This commit fixes vertical timings of the VEC (composite output) modes to accurately represent the 525-line ("NTSC") and 625-line ("PAL") ITU-R standards.
Previous timings were actually defined as 502 and 601 lines, resulting in non-standard 62.69 Hz and 52 Hz signals being generated, respectively.
--- drivers/gpu/drm/vc4/vc4_vec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/vc4/vc4_vec.c +2 -2
@@ -256,7 +256,7 @@ static void vc4_vec_ntsc_j_mode_set(struct vc4_vec *vec)static const struct drm_display_mode ntsc_mode = {DRM_MODE ("720x480" ,DRM_MODE_TYPE_DRIVER ,13500 ,720 ,720 +14 ,720 +14 +64 ,720 +14 +64 +60 ,0 , -480 ,480 +3 ,480 +3 +3 ,480 +3 +3 +16 ,0 , +480 ,480 +7 ,480 +7 +6 ,525 ,0 ,DRM_MODE_FLAG_INTERLACE ) };
@@ -278,7 +278,7 @@ static void vc4_vec_pal_m_mode_set(struct vc4_vec *vec)static const struct drm_display_mode pal_mode = {DRM_MODE ("720x576" ,DRM_MODE_TYPE_DRIVER ,13500 ,720 ,720 +20 ,720 +20 +64 ,720 +20 +64 +60 ,0 , -576 ,576 +2 ,576 +2 +3 ,576 +2 +3 +20 ,0 , +576 ,576 +4 ,576 +4 +6 ,625 ,0 ,DRM_MODE_FLAG_INTERLACE ) };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 611/717 drm: panel-orientation-quirks: Add quirk for Anbernic Win600
In reply to Greg Kroah-HartmanFrom: Maya Matuszczyk <[email protected]>
[ Upstream commit 770e19076065e079a32f33eb11be2057c87f1cde ]
This device is another x86 gaming handheld, and as (hopefully) there is only one set of DMI IDs it's using DMI_EXACT_MATCH
--- drivers/gpu/drm/drm_panel_orientation_quirks.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/drm_panel_orientation_quirks.c +6 -0
@@ -128,6 +128,12 @@ static const struct dmi_system_id orientation_data[] = { DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "One S1003"), }, .driver_data = (void *)&lcd800x1280_rightside_up, + }, { /* Anbernic Win600 */ + .matches = { +DMI_EXACT_MATCH (DMI_BOARD_VENDOR ,"Anbernic" ), + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Win600"), + }, + .driver_data = (void *)&lcd720x1280_rightside_up, }, { /* Asus T100HA */ .matches = { DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 612/717 drm: panel-orientation-quirks: Add quirk for Aya Neo Air
In reply to Greg Kroah-HartmanFrom: Maya Matuszczyk <[email protected]>
[ Upstream commit e10ea7b9b90219da305a16b3c1252169715a807b ]
Yet another x86 gaming handheld.
This one has many SKUs with quite a few of DMI strings, so let's just use a catchall, just as with Aya Neo Next.
--- drivers/gpu/drm/drm_panel_orientation_quirks.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/gpu/drm/drm_panel_orientation_quirks.c +12 -0
@@ -103,6 +103,12 @@ static const struct drm_dmi_panel_orientation_data lcd800x1280_rightside_up = { .orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP, }; +static const struct drm_dmi_panel_orientation_data lcd1080x1920_leftside_up = { + .width =1080 , + .height =1920 , + .orientation =DRM_MODE_PANEL_ORIENTATION_LEFT_UP , +}; +static const struct drm_dmi_panel_orientation_data lcd1200x1920_rightside_up = { .width =1200 , .height =1920 ,
@@ -158,6 +164,12 @@ static const struct dmi_system_id orientation_data[] = { DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "AYA NEO 2021"), }, .driver_data = (void *)&lcd800x1280_rightside_up, + }, { /* AYA NEO AIR */ + .matches = { +DMI_EXACT_MATCH (DMI_SYS_VENDOR ,"AYANEO" ), + DMI_MATCH(DMI_BOARD_NAME, "AIR"), + }, + .driver_data = (void *)&lcd1080x1920_leftside_up, }, { /* AYA NEO NEXT */ .matches = { DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "AYANEO"),
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 613/717 platform/chrome: cros_ec: Notify the PM of wake events during resume
In reply to Greg Kroah-HartmanFrom: Jameson Thies <[email protected]>
[ Upstream commit 8edd2752b0aa498b3a61f3caee8f79f7e0567fad ]
cros_ec_handle_event in the cros_ec driver can notify the PM of wake events. When a device is suspended, cros_ec_handle_event will not check MKBP events. Instead, received MKBP events are checked during resume by cros_ec_report_events_during_suspend. But cros_ec_report_events_during_suspend cannot notify the PM if received events are wake events, causing wake events to not be reported if received while the device is suspended.
Update cros_ec_report_events_during_suspend to notify the PM of wake events during resume by calling pm_wakeup_event.
--- drivers/platform/chrome/cros_ec.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/platform/chrome/cros_ec.c +7 -1
@@ -352,10 +352,16 @@ EXPORT_SYMBOL(cros_ec_suspend);static void cros_ec_report_events_during_suspend (struct cros_ec_device *ec_dev) { +bool wake_event; +while (ec_dev->mkbp_event_supported && -cros_ec_get_next_event (ec_dev,NULL ,NULL ) >0 ) +cros_ec_get_next_event (ec_dev, &wake_event,NULL ) >0 ) {blocking_notifier_call_chain (&ec_dev->event_notifier,1 , ec_dev); + +if (wake_event &&device_may_wakeup (ec_dev->dev)) +pm_wakeup_event (ec_dev->dev,0 ); + } }/**
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 614/717 platform/x86: hp-wmi: Setting thermal profile fails with 0x06
In reply to Greg Kroah-HartmanFrom: Jorge Lopez <[email protected]>
[ Upstream commit 00b1829294b7c88ecba92c661fbe6fe347b364d2 ]
Error 0x06 (invalid command parameter) is reported by hp-wmi module when reading the current thermal profile and then proceed to set it back. The failing condition occurs in Linux NixOS after user configures the thermal profile to ‘quiet mode’ in Windows. Quiet Fan Mode is supported in Windows but was not supported in hp-wmi module.
This fix adds support for PLATFORM_PROFILE_QUIET in hp-wmi module for HP notebooks other than HP Omen series. Quiet thermal profile is not supported in HP Omen series notebooks.
--- drivers/platform/x86/hp-wmi.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/platform/x86/hp-wmi.c +10 -1
@@ -177,7 +177,8 @@ enum hp_thermal_profile_omen_v1 {enum hp_thermal_profile {HP_THERMAL_PROFILE_PERFORMANCE =0x00 ,HP_THERMAL_PROFILE_DEFAULT =0x01 , -HP_THERMAL_PROFILE_COOL =0x02 +HP_THERMAL_PROFILE_COOL =0x02 , +HP_THERMAL_PROFILE_QUIET =0x03 , };#define IS_HWBLOCKED (x) ((x & HPWMI_POWER_FW_OR_HW) != HPWMI_POWER_FW_OR_HW)
@@ -1194,6 +1195,9 @@ static int hp_wmi_platform_profile_get(struct platform_profile_handler *pprof,case HP_THERMAL_PROFILE_COOL : *profile =PLATFORM_PROFILE_COOL ;break ; +case HP_THERMAL_PROFILE_QUIET : + *profile =PLATFORM_PROFILE_QUIET ; +break ;default :return -EINVAL ; }
@@ -1216,6 +1220,9 @@ static int hp_wmi_platform_profile_set(struct platform_profile_handler *pprof,case PLATFORM_PROFILE_COOL : tp =HP_THERMAL_PROFILE_COOL ;break ; +case PLATFORM_PROFILE_QUIET : + tp =HP_THERMAL_PROFILE_QUIET ; +break ;default :return -EOPNOTSUPP ; }
@@ -1263,6 +1270,8 @@ static int thermal_profile_setup(void) platform_profile_handler.profile_get = hp_wmi_platform_profile_get; platform_profile_handler.profile_set = hp_wmi_platform_profile_set; + +set_bit (PLATFORM_PROFILE_QUIET , platform_profile_handler.choices); }set_bit (PLATFORM_PROFILE_COOL , platform_profile_handler.choices);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 615/717 platform/x86: msi-laptop: Change DMI match / alias strings to fix module autoloading
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit 2a2565272a3628e45d61625e36ef17af7af4e3de ]
On a MSI S270 with Fedora 37 x86_64 / systemd-251.4 the module does not properly autoload.
This is likely caused by issues with how systemd-udevd handles the single quote char (') which is part of the sys_vendor / chassis_vendor strings on this laptop. As a workaround remove the single quote char + everything behind it from the sys_vendor + chassis_vendor matches. This fixes the module not autoloading.
--- drivers/platform/x86/msi-laptop.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/platform/x86/msi-laptop.c +3 -5
@@ -596,11 +596,10 @@ static const struct dmi_system_id msi_dmi_table[] __initconst = { { .ident = "MSI S270", .matches = { -DMI_MATCH (DMI_SYS_VENDOR ,"MICRO-STAR INT'L CO.,LTD" ), +DMI_MATCH (DMI_SYS_VENDOR ,"MICRO-STAR INT" ),DMI_MATCH (DMI_PRODUCT_NAME ,"MS-1013" ),DMI_MATCH (DMI_PRODUCT_VERSION ,"0131" ), -DMI_MATCH (DMI_CHASSIS_VENDOR , -"MICRO-STAR INT'L CO.,LTD" ) +DMI_MATCH (DMI_CHASSIS_VENDOR ,"MICRO-STAR INT" ) }, .driver_data = &quirk_old_ec_model, .callback = dmi_check_cb
@@ -633,8 +632,7 @@ static const struct dmi_system_id msi_dmi_table[] __initconst = {DMI_MATCH (DMI_SYS_VENDOR ,"NOTEBOOK" ),DMI_MATCH (DMI_PRODUCT_NAME ,"SAM2000" ),DMI_MATCH (DMI_PRODUCT_VERSION ,"0131" ), -DMI_MATCH (DMI_CHASSIS_VENDOR , -"MICRO-STAR INT'L CO.,LTD" ) +DMI_MATCH (DMI_CHASSIS_VENDOR ,"MICRO-STAR INT" ) }, .driver_data = &quirk_old_ec_model, .callback = dmi_check_cb
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 616/717 ALSA: intel-dspconfig: add ES8336 support for AlderLake-PS
In reply to Greg Kroah-HartmanFrom: Muralidhar Reddy <[email protected]>
[ Upstream commit 9db1c9fa214ef41d098633ff40a87284ca6e1870 ]
added quirks for ESS8336 for AlderLake-PS
--- sound/hda/intel-dsp-config.c | 5 +++++ 1 file changed, 5 insertions(+)
sound/hda/intel-dsp-config.c +5 -0
@@ -422,6 +422,11 @@ static const struct config_entry config_table[] = { .device = 0x51cd, },/* Alderlake-PS */ + { + .flags = FLAG_SOF, + .device = 0x51c9, + .codec_hid = &essx_83x6, + }, { .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, .device = 0x51c9,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 617/717 ASoC: SOF: pci: Change DMI match info to support all Chrome platforms
In reply to Greg Kroah-HartmanFrom: Jairaj Arava <[email protected]>
[ Upstream commit c1c1fc8103f794a10c5c15e3c17879caf4f42c8f ]
In some Chrome platforms if OEM's use their own string as SYS_VENDOR than "Google", it leads to firmware load failure from intel/sof/community path.
Hence, changing SYS_VENDOR to PRODUCT_FAMILY in which "Google" is used as common prefix and is supported in all Chrome platforms.
--- sound/soc/sof/sof-pci-dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/sof/sof-pci-dev.c +1 -1
@@ -138,7 +138,7 @@ static const struct dmi_system_id community_key_platforms[] = { .ident = "Google Chromebooks", .callback = chromebook_use_community_key, .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "Google"), + DMI_MATCH(DMI_PRODUCT_FAMILY, "Google"), } }, {},
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 618/717 ASoC: SOF: add quirk to override topology mclk_id
In reply to Greg Kroah-HartmanFrom: Pierre-Louis Bossart <[email protected]>
[ Upstream commit d136949dd8e2e309dc2f186507486b71cbe9acdb ]
Some Intel-based platforms rely on a topology file that hard-codes the use of MCLK0. This is incorrect in 10% of the cases. Rather than generating yet another set of topology files, this patch adds a kernel module parameter to override the topology value.
In hindsight, we should never have allowed mclks to be specified in topology, this is a hardware-level information that should not have been visible in the topology.
Future patches will try to set this value automagically, e.g. by parsing the NHLT content.
--- sound/soc/sof/intel/hda.c | 11 +++++++++++ sound/soc/sof/ipc3-topology.c | 7 +++++++ sound/soc/sof/sof-priv.h | 4 ++++ 3 files changed, 22 insertions(+)
sound/soc/sof/intel/hda.c +11 -0
@@ -376,6 +376,10 @@ static int dmic_num_override = -1;module_param_named (dmic_num, dmic_num_override, int,0444 );MODULE_PARM_DESC (dmic_num,"SOF HDA DMIC number" ); +static int mclk_id_override =-1 ; +module_param_named (mclk_id, mclk_id_override, int,0444 ); +MODULE_PARM_DESC (mclk_id,"SOF SSP mclk_id" ); +#if IS_ENABLED (CONFIG_SND_SOC_SOF_HDA )static bool hda_codec_use_common_hdmi =IS_ENABLED (CONFIG_SND_HDA_CODEC_HDMI );module_param_named (use_common_hdmi, hda_codec_use_common_hdmi, bool,0444 );
@@ -1433,6 +1437,13 @@ struct snd_soc_acpi_mach *hda_machine_select(struct snd_sof_dev *sdev) sof_pdata->tplg_filename = tplg_filename; } + +/* check if mclk_id should be modified from topology defaults */ +if (mclk_id_override >=0 ) { +dev_info (sdev->dev,"Overriding topology with MCLK %d from kernel_parameter\n" , mclk_id_override); + sdev->mclk_id_override = true; + sdev->mclk_id_quirk = mclk_id_override; + } }/*
sound/soc/sof/ipc3-topology.c +7 -0
@@ -1233,6 +1233,7 @@ static int sof_link_afe_load(struct snd_soc_component *scomp, struct snd_sof_daistatic int sof_link_ssp_load (struct snd_soc_component *scomp,struct snd_sof_dai_link *slink,struct sof_ipc_dai_config *config,struct snd_sof_dai *dai) { +struct snd_sof_dev *sdev =snd_soc_component_get_drvdata (scomp);struct snd_soc_tplg_hw_config *hw_config = slink->hw_configs;struct sof_dai_private_data *private = dai->private;u32 size =sizeof (*config);
@@ -1257,6 +1258,12 @@ static int sof_link_ssp_load(struct snd_soc_component *scomp, struct snd_sof_dai config[i].hdr.size = size; +if (sdev->mclk_id_override) { +dev_dbg (scomp->dev,"tplg: overriding topology mclk_id %d by quirk %d\n" , + config[i].ssp.mclk_id, sdev->mclk_id_quirk); + config[i].ssp.mclk_id = sdev->mclk_id_quirk; + } +/* copy differentiating hw configs to ipc structs */ config[i].ssp.mclk_rate =le32_to_cpu (hw_config[i].mclk_rate); config[i].ssp.bclk_rate =le32_to_cpu (hw_config[i].bclk_rate);
sound/soc/sof/sof-priv.h +4 -0
@@ -585,6 +585,10 @@ struct snd_sof_dev {/* to protect the ipc_rx_handler_list and dsp_state_handler_list list */ struct mutex client_event_handler_mutex; +/* quirks to override topology values */ +bool mclk_id_override; +u16 mclk_id_quirk;/* same size as in IPC3 definitions */ +void *private;/* core does not touch this */ };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 619/717 drm/amdgpu: SDMA update use unlocked iterator
In reply to Greg Kroah-HartmanFrom: Philip Yang <[email protected]>
[ Upstream commit 3913f0179ba366f7d7d160c506ce00de1602bbc4 ]
SDMA update page table may be called from unlocked context, this generate below warning. Use unlocked iterator to handle this case.
WARNING: CPU: 0 PID: 1475 at drivers/dma-buf/dma-resv.c:483 dma_resv_iter_next Call Trace: dma_resv_iter_first+0x43/0xa0 amdgpu_vm_sdma_update+0x69/0x2d0 [amdgpu] amdgpu_vm_ptes_update+0x29c/0x870 [amdgpu] amdgpu_vm_update_range+0x2f6/0x6c0 [amdgpu] svm_range_unmap_from_gpus+0x115/0x300 [amdgpu] svm_range_cpu_invalidate_pagetables+0x510/0x5e0 [amdgpu] __mmu_notifier_invalidate_range_start+0x1d3/0x230 unmap_vmas+0x140/0x150 unmap_region+0xa8/0x110
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c +6 -3
@@ -211,12 +211,15 @@ static int amdgpu_vm_sdma_update(struct amdgpu_vm_update_params *p,int r;/* Wait for PD/PT moves to be completed */ -dma_resv_for_each_fence (&cursor, bo->tbo.base.resv, -DMA_RESV_USAGE_KERNEL , fence) { +dma_resv_iter_begin (&cursor, bo->tbo.base.resv,DMA_RESV_USAGE_KERNEL ); +dma_resv_for_each_fence_unlocked (&cursor, fence) { r =amdgpu_sync_fence (&p->job->sync, fence); -if (r) +if (r) { +dma_resv_iter_end (&cursor);return r; + } } +dma_resv_iter_end (&cursor); do { ndw = p->num_dw_left;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 620/717 drm/amd/display: correct hostvm flag
In reply to Greg Kroah-HartmanFrom: Sherry Wang <[email protected]>
[ Upstream commit 796d6a37ff5ffaf9f2dc0f3f4bf9f4a1034c00de ]
[Why]
Hostvm should be enabled/disabled accordding to the status of riommu_active, but hostvm always be disabled on DCN31 which causes underflow
[How]
Set correct hostvm flag on DCN31
--- drivers/gpu/drm/amd/display/dc/dcn31/dcn31_resource.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dcn31/dcn31_resource.c +1 -1
@@ -892,7 +892,7 @@ static const struct dc_debug_options debug_defaults_drv = { .enable_sw_cntl_psr = true, .apply_vendor_specific_lttpr_wa = true, .enable_z9_disable_interface = true, /* Allow support for the PMFW interface for disable Z9*/ - .dml_hostvm_override = DML_HOSTVM_OVERRIDE_FALSE, + .dml_hostvm_override = DML_HOSTVM_NO_OVERRIDE, };static const struct dc_debug_options debug_defaults_diags = {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 621/717 drm/amdgpu: fix initial connector audio value
In reply to Greg Kroah-HartmanFrom: hongao <[email protected]>
[ Upstream commit 4bb71fce58f30df3f251118291d6b0187ce531e6 ]
This got lost somewhere along the way, This fixes
audio not working until set_property was called.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c +6 -1
@@ -1674,10 +1674,12 @@ amdgpu_connector_add(struct amdgpu_device *adev, adev->mode_info.dither_property, AMDGPU_FMT_DITHER_DISABLE); -if (amdgpu_audio !=0 ) +if (amdgpu_audio !=0 ) {drm_object_attach_property (&amdgpu_connector->base.base, adev->mode_info.audio_property,AMDGPU_AUDIO_AUTO ); + amdgpu_connector->audio =AMDGPU_AUDIO_AUTO ; + } subpixel_order = SubPixelHorizontalRGB; connector->interlace_allowed = true;
@@ -1799,6 +1801,7 @@ amdgpu_connector_add(struct amdgpu_device *adev,drm_object_attach_property (&amdgpu_connector->base.base, adev->mode_info.audio_property,AMDGPU_AUDIO_AUTO ); + amdgpu_connector->audio =AMDGPU_AUDIO_AUTO ; } drm_object_attach_property(&amdgpu_connector->base.base, adev->mode_info.dither_property,
@@ -1852,6 +1855,7 @@ amdgpu_connector_add(struct amdgpu_device *adev,drm_object_attach_property (&amdgpu_connector->base.base, adev->mode_info.audio_property,AMDGPU_AUDIO_AUTO ); + amdgpu_connector->audio =AMDGPU_AUDIO_AUTO ; } drm_object_attach_property(&amdgpu_connector->base.base, adev->mode_info.dither_property,
@@ -1902,6 +1906,7 @@ amdgpu_connector_add(struct amdgpu_device *adev,drm_object_attach_property (&amdgpu_connector->base.base, adev->mode_info.audio_property,AMDGPU_AUDIO_AUTO ); + amdgpu_connector->audio =AMDGPU_AUDIO_AUTO ; } drm_object_attach_property(&amdgpu_connector->base.base, adev->mode_info.dither_property,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 622/717 drm/meson: reorder driver deinit sequence to fix use-after-free bug
In reply to Greg Kroah-HartmanFrom: Adrián Larumbe <[email protected]>
[ Upstream commit 31c519981eb141c7ec39bfd5be25d35f02edb868 ]
Unloading the driver triggers the following KASAN warning:
[ +0.006275] ============================================================= [ +0.000029] BUG: KASAN: use-after-free in __list_del_entry_valid+0xe0/0x1a0 [ +0.000026] Read of size 8 at addr ffff000020c395e0 by task rmmod/2695
[ +0.000019] CPU: 5 PID: 2695 Comm: rmmod Tainted: G C O 5.19.0-rc6-lrmbkasan+ #1 [ +0.000013] Hardware name: Hardkernel ODROID-N2Plus (DT) [ +0.000008] Call trace: [ +0.000007] dump_backtrace+0x1ec/0x280 [ +0.000013] show_stack+0x24/0x80 [ +0.000008] dump_stack_lvl+0x98/0xd4 [ +0.000011] print_address_description.constprop.0+0x80/0x520 [ +0.000011] print_report+0x128/0x260 [ +0.000007] kasan_report+0xb8/0xfc [ +0.000008] __asan_report_load8_noabort+0x3c/0x50 [ +0.000010] __list_del_entry_valid+0xe0/0x1a0 [ +0.000009] drm_atomic_private_obj_fini+0x30/0x200 [drm] [ +0.000172] drm_bridge_detach+0x94/0x260 [drm] [ +0.000145] drm_encoder_cleanup+0xa4/0x290 [drm] [ +0.000144] drm_mode_config_cleanup+0x118/0x740 [drm] [ +0.000143] drm_mode_config_init_release+0x1c/0x2c [drm] [ +0.000144] drm_managed_release+0x170/0x414 [drm] [ +0.000142] drm_dev_put.part.0+0xc0/0x124 [drm] [ +0.000143] drm_dev_put+0x20/0x30 [drm] [ +0.000142] meson_drv_unbind+0x1d8/0x2ac [meson_drm] [ +0.000028] take_down_aggregate_device+0xb0/0x160 [ +0.000016] component_del+0x18c/0x360 [ +0.000009] meson_dw_hdmi_remove+0x28/0x40 [meson_dw_hdmi] [ +0.000015] platform_remove+0x64/0xb0 [ +0.000009] device_remove+0xb8/0x154 [ +0.000009] device_release_driver_internal+0x398/0x5b0 [ +0.000009] driver_detach+0xac/0x1b0 [ +0.000009] bus_remove_driver+0x158/0x29c [ +0.000009] driver_unregister+0x70/0xb0 [ +0.000008] platform_driver_unregister+0x20/0x2c [ +0.000008] meson_dw_hdmi_platform_driver_exit+0x1c/0x30 [meson_dw_hdmi] [ +0.000012] __do_sys_delete_module+0x288/0x400 [ +0.000011] __arm64_sys_delete_module+0x5c/0x80 [ +0.000009] invoke_syscall+0x74/0x260 [ +0.000009] el0_svc_common.constprop.0+0xcc/0x260 [ +0.000009] do_el0_svc+0x50/0x70 [ +0.000007] el0_svc+0x68/0x1a0 [ +0.000012] el0t_64_sync_handler+0x11c/0x150 [ +0.000008] el0t_64_sync+0x18c/0x190
[ +0.000018] Allocated by task 0:
[ +0.000007] (stack is not available)
[ +0.000011] Freed by task 2695: [ +0.000008] kasan_save_stack+0x2c/0x5c [ +0.000011] kasan_set_track+0x2c/0x40 [ +0.000008] kasan_set_free_info+0x28/0x50 [ +0.000009] ____kasan_slab_free+0x128/0x1d4 [ +0.000008] __kasan_slab_free+0x18/0x24 [ +0.000007] slab_free_freelist_hook+0x108/0x230 [ +0.000011] kfree+0x110/0x35c [ +0.000008] release_nodes+0xf0/0x16c [ +0.000009] devres_release_group+0x180/0x270 [ +0.000008] component_unbind+0x128/0x1e0 [ +0.000010] component_unbind_all+0x1b8/0x264 [ +0.000009] meson_drv_unbind+0x1a0/0x2ac [meson_drm] [ +0.000025] take_down_aggregate_device+0xb0/0x160 [ +0.000009] component_del+0x18c/0x360 [ +0.000009] meson_dw_hdmi_remove+0x28/0x40 [meson_dw_hdmi] [ +0.000012] platform_remove+0x64/0xb0 [ +0.000008] device_remove+0xb8/0x154 [ +0.000009] device_release_driver_internal+0x398/0x5b0 [ +0.000009] driver_detach+0xac/0x1b0 [ +0.000009] bus_remove_driver+0x158/0x29c [ +0.000008] driver_unregister+0x70/0xb0 [ +0.000008] platform_driver_unregister+0x20/0x2c [ +0.000008] meson_dw_hdmi_platform_driver_exit+0x1c/0x30 [meson_dw_hdmi] [ +0.000011] __do_sys_delete_module+0x288/0x400 [ +0.000010] __arm64_sys_delete_module+0x5c/0x80 [ +0.000008] invoke_syscall+0x74/0x260 [ +0.000008] el0_svc_common.constprop.0+0xcc/0x260 [ +0.000008] do_el0_svc+0x50/0x70 [ +0.000007] el0_svc+0x68/0x1a0 [ +0.000009] el0t_64_sync_handler+0x11c/0x150 [ +0.000009] el0t_64_sync+0x18c/0x190
[ +0.000014] The buggy address belongs to the object at ffff000020c39000
which belongs to the cache kmalloc-4k of size 4096
[ +0.000008] The buggy address is located 1504 bytes inside of
4096-byte region [ffff000020c39000, ffff000020c3a000)
[ +0.000016] The buggy address belongs to the physical page: [ +0.000009] page:fffffc0000830e00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x20c38 [ +0.000013] head:fffffc0000830e00 order:3 compound_mapcount:0 compound_pincount:0 [ +0.000008] flags: 0xffff00000010200(slab|head|node=0|zone=0|lastcpupid=0xffff) [ +0.000019] raw: 0ffff00000010200 fffffc0000fd4808 fffffc0000126208 ffff000000002e80 [ +0.000009] raw: 0000000000000000 0000000000020002 00000001ffffffff 0000000000000000 [ +0.000008] page dumped because: kasan: bad access detected
[ +0.000011] Memory state around the buggy address: [ +0.000008] ffff000020c39480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ +0.000007] ffff000020c39500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ +0.000007] >ffff000020c39580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ +0.000007] ^ [ +0.000007] ffff000020c39600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ +0.000007] ffff000020c39680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ +0.000006] ==================================================================
The reason this is happening is unloading meson-dw-hdmi will cause the component API to take down the aggregate device, which in turn will cause all devres-managed memory to be freed, including the struct dw_hdmi allocated in dw_hdmi_probe. This struct embeds a struct drm_bridge that is added at the end of the function, and which is later on picked up in meson_encoder_hdmi_init.
However, when attaching the bridge to the encoder created in meson_encoder_hdmi_init, it's linked to the encoder's bridge chain, from where it never leaves, even after devres_release_group is called when the driver's components are unbound and the embedding structure freed.
Then, when calling drm_dev_put in the aggregate driver's unbind function, drm_bridge_detach is called for every single bridge linked to the encoder, including the one whose memory had already been deallocated.
Fix by calling component_unbind_all after drm_dev_put.
--- drivers/gpu/drm/meson/meson_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/meson/meson_drv.c +1 -1
@@ -388,9 +388,9 @@ static void meson_drv_unbind(struct device *dev)drm_dev_unregister (drm);drm_kms_helper_poll_fini (drm);drm_atomic_helper_shutdown (drm); -component_unbind_all (dev, drm);free_irq (priv->vsync_irq, drm);drm_dev_put (drm); +component_unbind_all (dev, drm);if (priv->afbcd.ops) priv->afbcd.ops->exit (priv);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 623/717 drm/meson: explicitly remove aggregate driver at module unload time
In reply to Greg Kroah-HartmanFrom: Adrián Larumbe <[email protected]>
[ Upstream commit 8616f2a0589a80e08434212324250eb22f6a66ce ]
Because component_master_del wasn't being called when unloading the meson_drm module, the aggregate device would linger forever in the global aggregate_devices list. That means when unloading and reloading the meson_dw_hdmi module, component_add would call into try_to_bring_up_aggregate_device and find the unbound meson_drm aggregate device.
This would in turn dereference some of the aggregate_device's struct entries which point to memory automatically freed by the devres API when unbinding the aggregate device from meson_drv_unbind, and trigger an use-after-free bug:
[ +0.000014] ============================================================= [ +0.000007] BUG: KASAN: use-after-free in find_components+0x468/0x500 [ +0.000017] Read of size 8 at addr ffff000006731688 by task modprobe/2536 [ +0.000018] CPU: 4 PID: 2536 Comm: modprobe Tainted: G C O 5.19.0-rc6-lrmbkasan+ #1 [ +0.000010] Hardware name: Hardkernel ODROID-N2Plus (DT) [ +0.000008] Call trace: [ +0.000005] dump_backtrace+0x1ec/0x280 [ +0.000011] show_stack+0x24/0x80 [ +0.000007] dump_stack_lvl+0x98/0xd4 [ +0.000010] print_address_description.constprop.0+0x80/0x520 [ +0.000011] print_report+0x128/0x260 [ +0.000007] kasan_report+0xb8/0xfc [ +0.000007] __asan_report_load8_noabort+0x3c/0x50 [ +0.000009] find_components+0x468/0x500 [ +0.000008] try_to_bring_up_aggregate_device+0x64/0x390 [ +0.000009] __component_add+0x1dc/0x49c [ +0.000009] component_add+0x20/0x30 [ +0.000008] meson_dw_hdmi_probe+0x28/0x34 [meson_dw_hdmi] [ +0.000013] platform_probe+0xd0/0x220 [ +0.000008] really_probe+0x3ac/0xa80 [ +0.000008] __driver_probe_device+0x1f8/0x400 [ +0.000008] driver_probe_device+0x68/0x1b0 [ +0.000008] __driver_attach+0x20c/0x480 [ +0.000009] bus_for_each_dev+0x114/0x1b0 [ +0.000007] driver_attach+0x48/0x64 [ +0.000009] bus_add_driver+0x390/0x564 [ +0.000007] driver_register+0x1a8/0x3e4 [ +0.000009] __platform_driver_register+0x6c/0x94 [ +0.000007] meson_dw_hdmi_platform_driver_init+0x30/0x1000 [meson_dw_hdmi] [ +0.000014] do_one_initcall+0xc4/0x2b0 [ +0.000008] do_init_module+0x154/0x570 [ +0.000010] load_module+0x1a78/0x1ea4 [ +0.000008] __do_sys_init_module+0x184/0x1cc [ +0.000008] __arm64_sys_init_module+0x78/0xb0 [ +0.000008] invoke_syscall+0x74/0x260 [ +0.000008] el0_svc_common.constprop.0+0xcc/0x260 [ +0.000009] do_el0_svc+0x50/0x70 [ +0.000008] el0_svc+0x68/0x1a0 [ +0.000009] el0t_64_sync_handler+0x11c/0x150 [ +0.000009] el0t_64_sync+0x18c/0x190
[ +0.000014] Allocated by task 902: [ +0.000007] kasan_save_stack+0x2c/0x5c [ +0.000009] __kasan_kmalloc+0x90/0xd0 [ +0.000007] __kmalloc_node+0x240/0x580 [ +0.000010] memcg_alloc_slab_cgroups+0xa4/0x1ac [ +0.000010] memcg_slab_post_alloc_hook+0xbc/0x4c0 [ +0.000008] kmem_cache_alloc_node+0x1d0/0x490 [ +0.000009] __alloc_skb+0x1d4/0x310 [ +0.000010] alloc_skb_with_frags+0x8c/0x620 [ +0.000008] sock_alloc_send_pskb+0x5ac/0x6d0 [ +0.000010] unix_dgram_sendmsg+0x2e0/0x12f0 [ +0.000010] sock_sendmsg+0xcc/0x110 [ +0.000007] sock_write_iter+0x1d0/0x304 [ +0.000008] new_sync_write+0x364/0x460 [ +0.000007] vfs_write+0x420/0x5ac [ +0.000008] ksys_write+0x19c/0x1f0 [ +0.000008] __arm64_sys_write+0x78/0xb0 [ +0.000007] invoke_syscall+0x74/0x260 [ +0.000008] el0_svc_common.constprop.0+0x1a8/0x260 [ +0.000009] do_el0_svc+0x50/0x70 [ +0.000007] el0_svc+0x68/0x1a0 [ +0.000008] el0t_64_sync_handler+0x11c/0x150 [ +0.000008] el0t_64_sync+0x18c/0x190
[ +0.000013] Freed by task 2509: [ +0.000008] kasan_save_stack+0x2c/0x5c [ +0.000007] kasan_set_track+0x2c/0x40 [ +0.000008] kasan_set_free_info+0x28/0x50 [ +0.000008] ____kasan_slab_free+0x128/0x1d4 [ +0.000008] __kasan_slab_free+0x18/0x24 [ +0.000007] slab_free_freelist_hook+0x108/0x230 [ +0.000010] kfree+0x110/0x35c [ +0.000008] release_nodes+0xf0/0x16c [ +0.000008] devres_release_all+0xfc/0x180 [ +0.000008] device_unbind_cleanup+0x24/0x164 [ +0.000008] device_release_driver_internal+0x3e8/0x5b0 [ +0.000010] driver_detach+0xac/0x1b0 [ +0.000008] bus_remove_driver+0x158/0x29c [ +0.000008] driver_unregister+0x70/0xb0 [ +0.000009] platform_driver_unregister+0x20/0x2c [ +0.000007] 0xffff800003722d98 [ +0.000012] __do_sys_delete_module+0x288/0x400 [ +0.000009] __arm64_sys_delete_module+0x5c/0x80 [ +0.000008] invoke_syscall+0x74/0x260 [ +0.000008] el0_svc_common.constprop.0+0xcc/0x260 [ +0.000008] do_el0_svc+0x50/0x70 [ +0.000007] el0_svc+0x68/0x1a0 [ +0.000008] el0t_64_sync_handler+0x11c/0x150 [ +0.000009] el0t_64_sync+0x18c/0x190
[ +0.000013] Last potentially related work creation: [ +0.000007] kasan_save_stack+0x2c/0x5c [ +0.000007] __kasan_record_aux_stack+0xb8/0xf0 [ +0.000009] kasan_record_aux_stack_noalloc+0x14/0x20 [ +0.000008] insert_work+0x54/0x290 [ +0.000009] __queue_work+0x48c/0xd24 [ +0.000008] queue_work_on+0x90/0x11c [ +0.000008] call_usermodehelper_exec+0x188/0x404 [ +0.000010] kobject_uevent_env+0x5a8/0x794 [ +0.000010] kobject_uevent+0x14/0x20 [ +0.000008] driver_register+0x230/0x3e4 [ +0.000009] __platform_driver_register+0x6c/0x94 [ +0.000007] gxbb_driver_init+0x28/0x34 [ +0.000010] do_one_initcall+0xc4/0x2b0 [ +0.000008] do_initcalls+0x20c/0x24c [ +0.000010] kernel_init_freeable+0x22c/0x278 [ +0.000009] kernel_init+0x3c/0x170 [ +0.000008] ret_from_fork+0x10/0x20
[ +0.000013] The buggy address belongs to the object at ffff000006731600
which belongs to the cache kmalloc-256 of size 256
[ +0.000009] The buggy address is located 136 bytes inside of
256-byte region [ffff000006731600, ffff000006731700)
[ +0.000015] The buggy address belongs to the physical page: [ +0.000008] page:fffffc000019cc00 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff000006730a00 pfn:0x6730 [ +0.000011] head:fffffc000019cc00 order:2 compound_mapcount:0 compound_pincount:0 [ +0.000008] flags: 0xffff00000010200(slab|head|node=0|zone=0|lastcpupid=0xffff) [ +0.000016] raw: 0ffff00000010200 fffffc00000c3d08 fffffc0000ef2b08 ffff000000002680 [ +0.000009] raw: ffff000006730a00 0000000000150014 00000001ffffffff 0000000000000000 [ +0.000006] page dumped because: kasan: bad access detected
[ +0.000011] Memory state around the buggy address: [ +0.000007] ffff000006731580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ +0.000007] ffff000006731600: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ +0.000007] >ffff000006731680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ +0.000007] ^ [ +0.000006] ffff000006731700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ +0.000007] ffff000006731780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ +0.000006] ==================================================================
Fix by adding 'remove' driver callback for meson-drm, and explicitly deleting the aggregate device.
--- drivers/gpu/drm/meson/meson_drv.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/gpu/drm/meson/meson_drv.c +8 -0
@@ -493,6 +493,13 @@ static int meson_drv_probe(struct platform_device *pdev)return 0 ; }; +static int meson_drv_remove (struct platform_device *pdev) +{ +component_master_del (&pdev->dev, &meson_drv_master_ops); + +return 0 ; +} +static struct meson_drm_match_data meson_drm_gxbb_data = { .compat =VPU_COMPATIBLE_GXBB , };
@@ -530,6 +537,7 @@ static const struct dev_pm_ops meson_drv_pm_ops = {static struct platform_driver meson_drm_platform_driver = { .probe = meson_drv_probe, + .remove = meson_drv_remove, .shutdown = meson_drv_shutdown, .driver = { .name ="meson-drm" ,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 624/717 drm/meson: remove drm bridges at aggregate driver unbind time
In reply to Greg Kroah-HartmanFrom: Adrián Larumbe <[email protected]>
[ Upstream commit 09847723c12fc2753749cec3939a02ee92dac468 ]
drm bridges added by meson_encoder_hdmi_init and meson_encoder_cvbs_init were not manually removed at module unload time, which caused dangling references to freed memory to remain linked in the global bridge_list.
When loading the driver modules back in, the same functions would again call drm_bridge_add, and when traversing the global bridge_list, would end up peeking into freed memory.
Once again KASAN revealed the problem:
[ +0.000095] ============================================================= [ +0.000008] BUG: KASAN: use-after-free in __list_add_valid+0x9c/0x120 [ +0.000018] Read of size 8 at addr ffff00003da291f0 by task modprobe/2483
[ +0.000018] CPU: 3 PID: 2483 Comm: modprobe Tainted: G C O 5.19.0-rc6-lrmbkasan+ #1 [ +0.000011] Hardware name: Hardkernel ODROID-N2Plus (DT) [ +0.000008] Call trace: [ +0.000006] dump_backtrace+0x1ec/0x280 [ +0.000012] show_stack+0x24/0x80 [ +0.000008] dump_stack_lvl+0x98/0xd4 [ +0.000011] print_address_description.constprop.0+0x80/0x520 [ +0.000011] print_report+0x128/0x260 [ +0.000008] kasan_report+0xb8/0xfc [ +0.000008] __asan_report_load8_noabort+0x3c/0x50 [ +0.000009] __list_add_valid+0x9c/0x120 [ +0.000009] drm_bridge_add+0x6c/0x104 [drm] [ +0.000165] dw_hdmi_probe+0x1900/0x2360 [dw_hdmi] [ +0.000022] meson_dw_hdmi_bind+0x520/0x814 [meson_dw_hdmi] [ +0.000014] component_bind+0x174/0x520 [ +0.000012] component_bind_all+0x1a8/0x38c [ +0.000010] meson_drv_bind_master+0x5e8/0xb74 [meson_drm] [ +0.000032] meson_drv_bind+0x20/0x2c [meson_drm] [ +0.000027] try_to_bring_up_aggregate_device+0x19c/0x390 [ +0.000010] component_master_add_with_match+0x1c8/0x284 [ +0.000009] meson_drv_probe+0x274/0x280 [meson_drm] [ +0.000026] platform_probe+0xd0/0x220 [ +0.000009] really_probe+0x3ac/0xa80 [ +0.000009] __driver_probe_device+0x1f8/0x400 [ +0.000009] driver_probe_device+0x68/0x1b0 [ +0.000009] __driver_attach+0x20c/0x480 [ +0.000008] bus_for_each_dev+0x114/0x1b0 [ +0.000009] driver_attach+0x48/0x64 [ +0.000008] bus_add_driver+0x390/0x564 [ +0.000009] driver_register+0x1a8/0x3e4 [ +0.000009] __platform_driver_register+0x6c/0x94 [ +0.000008] meson_drm_platform_driver_init+0x3c/0x1000 [meson_drm] [ +0.000027] do_one_initcall+0xc4/0x2b0 [ +0.000011] do_init_module+0x154/0x570 [ +0.000011] load_module+0x1a78/0x1ea4 [ +0.000008] __do_sys_init_module+0x184/0x1cc [ +0.000009] __arm64_sys_init_module+0x78/0xb0 [ +0.000009] invoke_syscall+0x74/0x260 [ +0.000009] el0_svc_common.constprop.0+0xcc/0x260 [ +0.000008] do_el0_svc+0x50/0x70 [ +0.000007] el0_svc+0x68/0x1a0 [ +0.000012] el0t_64_sync_handler+0x11c/0x150 [ +0.000008] el0t_64_sync+0x18c/0x190
[ +0.000016] Allocated by task 879: [ +0.000008] kasan_save_stack+0x2c/0x5c [ +0.000011] __kasan_kmalloc+0x90/0xd0 [ +0.000007] __kmalloc+0x278/0x4a0 [ +0.000011] mpi_resize+0x13c/0x1d0 [ +0.000011] mpi_powm+0xd24/0x1570 [ +0.000009] rsa_enc+0x1a4/0x30c [ +0.000009] pkcs1pad_verify+0x3f0/0x580 [ +0.000009] public_key_verify_signature+0x7a8/0xba4 [ +0.000010] public_key_verify_signature_2+0x40/0x60 [ +0.000008] verify_signature+0xb4/0x114 [ +0.000008] pkcs7_validate_trust_one.constprop.0+0x3b8/0x574 [ +0.000009] pkcs7_validate_trust+0xb8/0x15c [ +0.000008] verify_pkcs7_message_sig+0xec/0x1b0 [ +0.000012] verify_pkcs7_signature+0x78/0xac [ +0.000007] mod_verify_sig+0x110/0x190 [ +0.000009] module_sig_check+0x114/0x1e0 [ +0.000009] load_module+0xa0/0x1ea4 [ +0.000008] __do_sys_init_module+0x184/0x1cc [ +0.000008] __arm64_sys_init_module+0x78/0xb0 [ +0.000008] invoke_syscall+0x74/0x260 [ +0.000009] el0_svc_common.constprop.0+0x1a8/0x260 [ +0.000008] do_el0_svc+0x50/0x70 [ +0.000007] el0_svc+0x68/0x1a0 [ +0.000009] el0t_64_sync_handler+0x11c/0x150 [ +0.000009] el0t_64_sync+0x18c/0x190
[ +0.000013] Freed by task 2422: [ +0.000008] kasan_save_stack+0x2c/0x5c [ +0.000009] kasan_set_track+0x2c/0x40 [ +0.000007] kasan_set_free_info+0x28/0x50 [ +0.000009] ____kasan_slab_free+0x128/0x1d4 [ +0.000008] __kasan_slab_free+0x18/0x24 [ +0.000007] slab_free_freelist_hook+0x108/0x230 [ +0.000010] kfree+0x110/0x35c [ +0.000008] release_nodes+0xf0/0x16c [ +0.000009] devres_release_group+0x180/0x270 [ +0.000008] take_down_aggregate_device+0xcc/0x160 [ +0.000010] component_del+0x18c/0x360 [ +0.000009] meson_dw_hdmi_remove+0x28/0x40 [meson_dw_hdmi] [ +0.000013] platform_remove+0x64/0xb0 [ +0.000008] device_remove+0xb8/0x154 [ +0.000009] device_release_driver_internal+0x398/0x5b0 [ +0.000009] driver_detach+0xac/0x1b0 [ +0.000009] bus_remove_driver+0x158/0x29c [ +0.000008] driver_unregister+0x70/0xb0 [ +0.000009] platform_driver_unregister+0x20/0x2c [ +0.000007] meson_dw_hdmi_platform_driver_exit+0x1c/0x30 [meson_dw_hdmi] [ +0.000012] __do_sys_delete_module+0x288/0x400 [ +0.000009] __arm64_sys_delete_module+0x5c/0x80 [ +0.000009] invoke_syscall+0x74/0x260 [ +0.000008] el0_svc_common.constprop.0+0xcc/0x260 [ +0.000008] do_el0_svc+0x50/0x70 [ +0.000007] el0_svc+0x68/0x1a0 [ +0.000008] el0t_64_sync_handler+0x11c/0x150 [ +0.000009] el0t_64_sync+0x18c/0x190
[ +0.000013] The buggy address belongs to the object at ffff00003da29000
which belongs to the cache kmalloc-1k of size 1024
[ +0.000008] The buggy address is located 496 bytes inside of
1024-byte region [ffff00003da29000, ffff00003da29400)
[ +0.000015] The buggy address belongs to the physical page: [ +0.000009] page:fffffc0000f68a00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x3da28 [ +0.000012] head:fffffc0000f68a00 order:3 compound_mapcount:0 compound_pincount:0 [ +0.000009] flags: 0xffff00000010200(slab|head|node=0|zone=0|lastcpupid=0xffff) [ +0.000019] raw: 0ffff00000010200 fffffc0000eb5c08 fffffc0000d96608 ffff000000002a80 [ +0.000008] raw: 0000000000000000 00000000000a000a 00000001ffffffff 0000000000000000 [ +0.000008] page dumped because: kasan: bad access detected
[ +0.000011] Memory state around the buggy address: [ +0.000009] ffff00003da29080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ +0.000007] ffff00003da29100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ +0.000007] >ffff00003da29180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ +0.000007] ^ [ +0.000008] ffff00003da29200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ +0.000006] ffff00003da29280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ +0.000007] ==================================================================
Fix by keeping track of which encoders were initialised in the meson_drm structure and manually removing their bridges at aggregate driver's unbind time.
--- drivers/gpu/drm/meson/meson_drv.c | 4 ++++ drivers/gpu/drm/meson/meson_drv.h | 7 +++++++ drivers/gpu/drm/meson/meson_encoder_cvbs.c | 13 +++++++++++++ drivers/gpu/drm/meson/meson_encoder_cvbs.h | 1 + drivers/gpu/drm/meson/meson_encoder_hdmi.c | 13 +++++++++++++ drivers/gpu/drm/meson/meson_encoder_hdmi.h | 1 + 6 files changed, 39 insertions(+)
drivers/gpu/drm/meson/meson_drv.c +4 -0
@@ -390,6 +390,10 @@ static void meson_drv_unbind(struct device *dev)drm_atomic_helper_shutdown (drm);free_irq (priv->vsync_irq, drm);drm_dev_put (drm); + +meson_encoder_hdmi_remove (priv); +meson_encoder_cvbs_remove (priv); +component_unbind_all (dev, drm);if (priv->afbcd.ops)
drivers/gpu/drm/meson/meson_drv.h +7 -0
@@ -25,6 +25,12 @@ enum vpu_compatible { VPU_COMPATIBLE_G12A = 3, }; +enum { +MESON_ENC_CVBS =0 , +MESON_ENC_HDMI , +MESON_ENC_LAST , +}; +struct meson_drm_match_data {enum vpu_compatible compat;struct meson_afbcd_ops *afbcd_ops;
@@ -51,6 +57,7 @@ struct meson_drm {struct drm_crtc *crtc;struct drm_plane *primary_plane;struct drm_plane *overlay_plane; +void *encoders[MESON_ENC_LAST ];const struct meson_drm_soc_limits *limits;
drivers/gpu/drm/meson/meson_encoder_cvbs.c +13 -0
@@ -281,5 +281,18 @@ int meson_encoder_cvbs_init(struct meson_drm *priv) }drm_connector_attach_encoder (connector, &meson_encoder_cvbs->encoder); + priv->encoders[MESON_ENC_CVBS ] = meson_encoder_cvbs; +return 0 ; } + +void meson_encoder_cvbs_remove (struct meson_drm *priv) +{ +struct meson_encoder_cvbs *meson_encoder_cvbs; + +if (priv->encoders[MESON_ENC_CVBS ]) { + meson_encoder_cvbs = priv->encoders[MESON_ENC_CVBS ]; +drm_bridge_remove (&meson_encoder_cvbs->bridge); +drm_bridge_remove (meson_encoder_cvbs->next_bridge); + } +}
drivers/gpu/drm/meson/meson_encoder_cvbs.h +1 -0
@@ -25,5 +25,6 @@ struct meson_cvbs_mode {extern struct meson_cvbs_mode meson_cvbs_modes[MESON_CVBS_MODES_COUNT ];int meson_encoder_cvbs_init (struct meson_drm *priv); +void meson_encoder_cvbs_remove (struct meson_drm *priv);#endif /* __MESON_VENC_CVBS_H */
drivers/gpu/drm/meson/meson_encoder_hdmi.c +13 -0
@@ -446,6 +446,8 @@ int meson_encoder_hdmi_init(struct meson_drm *priv) meson_encoder_hdmi->cec_notifier = notifier; } + priv->encoders[MESON_ENC_HDMI ] = meson_encoder_hdmi; +dev_dbg (priv->dev,"HDMI encoder initialized\n" );return 0 ;
@@ -454,3 +456,14 @@ int meson_encoder_hdmi_init(struct meson_drm *priv)of_node_put (remote);return ret; } + +void meson_encoder_hdmi_remove (struct meson_drm *priv) +{ +struct meson_encoder_hdmi *meson_encoder_hdmi; + +if (priv->encoders[MESON_ENC_HDMI ]) { + meson_encoder_hdmi = priv->encoders[MESON_ENC_HDMI ]; +drm_bridge_remove (&meson_encoder_hdmi->bridge); +drm_bridge_remove (meson_encoder_hdmi->next_bridge); + } +}
drivers/gpu/drm/meson/meson_encoder_hdmi.h +1 -0
@@ -8,5 +8,6 @@#define __MESON_ENCODER_HDMI_Hint meson_encoder_hdmi_init (struct meson_drm *priv); +void meson_encoder_hdmi_remove (struct meson_drm *priv);#endif /* __MESON_ENCODER_HDMI_H */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 625/717 drm/dp: Dont rewrite link config when setting phy test pattern
In reply to Greg Kroah-HartmanFrom: Khaled Almahallawy <[email protected]>
[ Upstream commit 7b4d8db657192066bc6f1f6635d348413dac1e18 ]
The sequence for Source DP PHY CTS automation is [2][1]:
1- Emulate successful Link Training(LT)
2- Short HPD and change link rates and number of lanes by LT. (This is same flow for Link Layer CTS)
3- Short HPD and change PHY test pattern and swing/pre-emphasis levels (This step should not trigger LT)
The problem is with DP PHY compliance setup as follow:
[DPTX + on board LTTPR]------Main Link--->[Scope]
^ |
| |
| |
----------Aux Ch------>[Aux Emulator]At step 3, before writing TRAINING_LANEx_SET/LINK_QUAL_PATTERN_SET to declare the pattern/swing requested by scope, we write link config in LINK_BW_SET/LANE_COUNT_SET on a port that has LTTPR. As LTTPR snoops aux transaction, LINK_BW_SET/LANE_COUNT_SET writes indicate a LT will start [Check DP 2.0 E11 -Sec 3.6.8.2 & 3.6.8.6.3], and LTTPR will reset the link and stop sending DP signals to DPTX/Scope causing the measurements to fail. Note that step 3 will not trigger LT and DP link will never recovered by the
Aux Emulator/Scope.
The reset of link can be tested with a monitor connected to LTTPR port simply by writing to LINK_BW_SET or LANE_COUNT_SET as follow
igt/tools/dpcd_reg write --offset=0x100 --value 0x14 --device=2
OR
printf '\x14' | sudo dd of=/dev/drm_dp_aux2 bs=1 count=1 conv=notrunc seek=$((0x100))
This single aux write causes the screen to blank, sending short HPD to DPTX, setting LINK_STATUS_UPDATE = 1 in DPCD 0x204, and triggering LT.
As stated in [1]:
"Before any TX electrical testing can be performed, the link between a DPTX and DPRX (in this case, a piece of test equipment), including all LTTPRs within the path, shall be trained as defined in this Standard."
In addition, changing Phy pattern/Swing/Pre-emphasis (Step 3) uses the same link rate and lane count applied on step 2, so no need to redo LT.
The fix is to not rewrite link config in step 3, and just writes TRAINING_LANEx_SET and LINK_QUAL_PATTERN_SET
[1]: DP 2.0 E11 - 3.6.11.1 LTTPR DPTX_PHY Electrical Compliance
[2]: Configuring UnigrafDPTC Controller - Automation Test Sequence
https://www.keysight.com/us/en/assets/9922-01244/help-files/
D9040DPPC-DisplayPort-Test-Software-Online-Help-latest.chm
--- drivers/gpu/drm/display/drm_dp_helper.c | 9 --------- 1 file changed, 9 deletions(-)
drivers/gpu/drm/display/drm_dp_helper.c +0 -9
@@ -2636,17 +2636,8 @@ int drm_dp_set_phy_test_pattern(struct drm_dp_aux *aux, struct drm_dp_phy_test_params *data, u8 dp_rev) { int err, i; -u8 link_config[2 ];u8 test_pattern; - link_config[0 ] =drm_dp_link_rate_to_bw_code (data->link_rate); - link_config[1 ] = data->num_lanes; -if (data->enhanced_frame_cap) - link_config[1 ] |=DP_LANE_COUNT_ENHANCED_FRAME_EN ; - err =drm_dp_dpcd_write (aux,DP_LINK_BW_SET , link_config,2 ); -if (err <0 ) -return err; - test_pattern = data->phy_pattern;if (dp_rev <0x12 ) { test_pattern = (test_pattern << 2) &
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 626/717 drm/amd/display: Remove interface for periodic interrupt 1
In reply to Greg Kroah-HartmanFrom: Aric Cyr <[email protected]>
[ Upstream commit 97d8d6f075bd8f988589be02b91f6fa644d0b0b8 ]
[why]
Only a single VLINE interrupt is available so interface should not expose the second one which is used by DMU firmware.
[how]
Remove references to periodic_interrupt1 and VLINE1 from DC interfaces.
--- drivers/gpu/drm/amd/display/dc/core/dc.c | 16 +++------ drivers/gpu/drm/amd/display/dc/dc_stream.h | 6 ++-- .../amd/display/dc/dcn10/dcn10_hw_sequencer.c | 35 ++++++------------- .../amd/display/dc/dcn10/dcn10_hw_sequencer.h | 3 +- .../gpu/drm/amd/display/dc/inc/hw_sequencer.h | 8 +---- 5 files changed, 18 insertions(+), 50 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +4 -12
@@ -2632,11 +2632,8 @@ static void copy_stream_update_to_stream(struct dc *dc,if (update->abm_level) stream->abm_level = *update->abm_level; -if (update->periodic_interrupt0) - stream->periodic_interrupt0 = *update->periodic_interrupt0; - -if (update->periodic_interrupt1) - stream->periodic_interrupt1 = *update->periodic_interrupt1; +if (update->periodic_interrupt) + stream->periodic_interrupt = *update->periodic_interrupt;if (update->gamut_remap) stream->gamut_remap_matrix = *update->gamut_remap;
@@ -2723,13 +2720,8 @@ static void commit_planes_do_stream_update(struct dc *dc,if (!pipe_ctx->top_pipe && !pipe_ctx->prev_odm_pipe && pipe_ctx->stream == stream) { -if (stream_update->periodic_interrupt0 && - dc->hwss.setup_periodic_interrupt) - dc->hwss.setup_periodic_interrupt (dc, pipe_ctx,VLINE0 ); - -if (stream_update->periodic_interrupt1 && - dc->hwss.setup_periodic_interrupt) - dc->hwss.setup_periodic_interrupt (dc, pipe_ctx,VLINE1 ); +if (stream_update->periodic_interrupt && dc->hwss.setup_periodic_interrupt) + dc->hwss.setup_periodic_interrupt (dc, pipe_ctx); if ((stream_update->hdr_static_metadata && !stream->use_dynamic_meta) || stream_update->vrr_infopacket ||
drivers/gpu/drm/amd/display/dc/dc_stream.h +2 -4
@@ -200,8 +200,7 @@ struct dc_stream_state {/* DMCU info */ unsigned int abm_level; -struct periodic_interrupt_config periodic_interrupt0; -struct periodic_interrupt_config periodic_interrupt1; +struct periodic_interrupt_config periodic_interrupt;/* from core_stream struct */ struct dc_context *ctx;
@@ -268,8 +267,7 @@ struct dc_stream_update {struct dc_info_packet *hdr_static_metadata;unsigned int *abm_level; -struct periodic_interrupt_config *periodic_interrupt0; -struct periodic_interrupt_config *periodic_interrupt1; +struct periodic_interrupt_config *periodic_interrupt;struct dc_info_packet *vrr_infopacket;struct dc_info_packet *vsc_infopacket;
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +10 -25
@@ -3623,7 +3623,7 @@ void dcn10_calc_vupdate_position( {const struct dc_crtc_timing *dc_crtc_timing = &pipe_ctx->stream->timing;int vline_int_offset_from_vupdate = - pipe_ctx->stream->periodic_interrupt0.lines_offset; + pipe_ctx->stream->periodic_interrupt.lines_offset;int vupdate_offset_from_vsync = dc->hwss.get_vupdate_offset_from_vsync (pipe_ctx);int start_position;
@@ -3648,18 +3648,10 @@ void dcn10_calc_vupdate_position(static void dcn10_cal_vline_position (struct dc *dc,struct pipe_ctx *pipe_ctx, -enum vline_select vline,uint32_t *start_line,uint32_t *end_line) { -enum vertical_interrupt_ref_point ref_point =INVALID_POINT ; - -if (vline ==VLINE0 ) - ref_point = pipe_ctx->stream->periodic_interrupt0.ref_point; -else if (vline ==VLINE1 ) - ref_point = pipe_ctx->stream->periodic_interrupt1.ref_point; - -switch (ref_point) { +switch (pipe_ctx->stream->periodic_interrupt.ref_point) {case START_V_UPDATE : dcn10_calc_vupdate_position( dc,
@@ -3668,7 +3660,9 @@ static void dcn10_cal_vline_position( end_line);break ;case START_V_SYNC : -// Suppose to do nothing because vsync is 0; +// vsync is line 0 so start_line is just the requested line offset + *start_line = pipe_ctx->stream->periodic_interrupt.lines_offset; + *end_line = *start_line +2 ;break ;default :ASSERT (0 );
@@ -3678,24 +3672,15 @@ static void dcn10_cal_vline_position(void dcn10_setup_periodic_interrupt (struct dc *dc, -struct pipe_ctx *pipe_ctx, -enum vline_select vline) +struct pipe_ctx *pipe_ctx) {struct timing_generator *tg = pipe_ctx->stream_res.tg; +uint32_t start_line =0 ; +uint32_t end_line =0 ; -if (vline ==VLINE0 ) { -uint32_t start_line =0 ; -uint32_t end_line =0 ; +dcn10_cal_vline_position (dc, pipe_ctx, &start_line, &end_line); -dcn10_cal_vline_position (dc, pipe_ctx, vline, &start_line, &end_line); - - tg->funcs->setup_vertical_interrupt0 (tg, start_line, end_line); - - }else if (vline ==VLINE1 ) { - pipe_ctx->stream_res.tg->funcs->setup_vertical_interrupt1 ( - tg, - pipe_ctx->stream->periodic_interrupt1.lines_offset); - } + tg->funcs->setup_vertical_interrupt0 (tg, start_line, end_line); }void dcn10_setup_vupdate_interrupt (struct dc *dc,struct pipe_ctx *pipe_ctx)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.h +1 -2
@@ -175,8 +175,7 @@ void dcn10_set_cursor_attribute(struct pipe_ctx *pipe_ctx);void dcn10_set_cursor_sdr_white_level (struct pipe_ctx *pipe_ctx);void dcn10_setup_periodic_interrupt (struct dc *dc, -struct pipe_ctx *pipe_ctx, -enum vline_select vline); +struct pipe_ctx *pipe_ctx); enum dc_status dcn10_set_clock(struct dc *dc, enum dc_clock_type clock_type, uint32_t clk_khz,
drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h +1 -7
@@ -32,11 +32,6 @@#include "inc/hw/link_encoder.h" #include "core_status.h" -enum vline_select { -VLINE0 , -VLINE1 -}; -struct pipe_ctx ;struct dc_state ;struct dc_stream_status ;
@@ -116,8 +111,7 @@ struct hw_sequencer_funcs { int group_index, int group_size, struct pipe_ctx *grouped_pipes[]);void (*setup_periodic_interrupt)(struct dc *dc, -struct pipe_ctx *pipe_ctx, -enum vline_select vline); +struct pipe_ctx *pipe_ctx);void (*set_drr)(struct pipe_ctx **pipe_ctx,int num_pipes,struct dc_crtc_timing_adjust adjust); void (*set_static_screen_control)(struct pipe_ctx **pipe_ctx,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 627/717 drm/amd/display: polling vid stream status in hpo dp blank
In reply to Greg Kroah-HartmanFrom: Wenjing Liu <[email protected]>
[ Upstream commit e32df0c7ecead95d70ca89f39b1b2b02a59ff691 ]
[why]
vid stream control is double bufferred, if we don't wait for video stream enable set to 0, we may get temporary image corruption showing on the stream when setting PIXEL_TO_SYMBOL_FIFO_ENABLE to 0.
--- .../drm/amd/display/dc/dcn31/dcn31_hpo_dp_stream_encoder.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn31/dcn31_hpo_dp_stream_encoder.c +3 -3
@@ -150,9 +150,9 @@ static void dcn31_hpo_dp_stream_enc_dp_blank(* 10us*5000=50ms. This covers 41.7ms of minimum 24 Hz mode + * a little more because we may not trust delay accuracy. */ -//REG_WAIT(DP_SYM32_ENC_VID_STREAM_CONTROL, -// VID_STREAM_STATUS, 0, -// 10, 5000); +REG_WAIT (DP_SYM32_ENC_VID_STREAM_CONTROL , +VID_STREAM_STATUS ,0 , +10 ,5000 );/* Disable SDP tranmission */ REG_UPDATE(DP_SYM32_ENC_SDP_CONTROL,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 628/717 drm/amdkfd: Fix UBSAN shift-out-of-bounds warning
In reply to Greg Kroah-HartmanFrom: Felix Kuehling <[email protected]>
[ Upstream commit b292cafe2dd02d96a07147e4b160927e8399d5cc ]
This was fixed in initialize_cpsch before, but not in initialize_nocpsch. Factor sdma bitmap initialization into a helper function to apply the correct implementation in both cases without duplicating it.
v2: Added a range check
--- .../drm/amd/amdkfd/kfd_device_queue_manager.c | 45 +++++++++---------- 1 file changed, 21 insertions(+), 24 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +21 -24
@@ -1232,6 +1232,24 @@ static void init_interrupts(struct device_queue_manager *dqm) dqm->dev->kfd2kgd->init_interrupts (dqm->dev->adev, i); } +static void init_sdma_bitmaps (struct device_queue_manager *dqm) +{ +unsigned int num_sdma_queues = + min_t(unsigned int, sizeof(dqm->sdma_bitmap)*8, +get_num_sdma_queues (dqm)); +unsigned int num_xgmi_sdma_queues = + min_t(unsigned int, sizeof(dqm->xgmi_sdma_bitmap)*8, +get_num_xgmi_sdma_queues (dqm)); + +if (num_sdma_queues) + dqm->sdma_bitmap =GENMASK_ULL (num_sdma_queues-1 ,0 ); +if (num_xgmi_sdma_queues) + dqm->xgmi_sdma_bitmap =GENMASK_ULL (num_xgmi_sdma_queues-1 ,0 ); + + dqm->sdma_bitmap &= ~get_reserved_sdma_queues_bitmap (dqm); +pr_info ("sdma_bitmap: %llx\n" , dqm->sdma_bitmap); +} +static int initialize_nocpsch (struct device_queue_manager *dqm) {int pipe, queue;
@@ -1260,11 +1278,7 @@ static int initialize_nocpsch(struct device_queue_manager *dqm)memset (dqm->vmid_pasid,0 ,sizeof (dqm->vmid_pasid)); - dqm->sdma_bitmap = ~0ULL >> (64 -get_num_sdma_queues (dqm)); - dqm->sdma_bitmap &= ~(get_reserved_sdma_queues_bitmap (dqm)); -pr_info ("sdma_bitmap: %llx\n" , dqm->sdma_bitmap); - - dqm->xgmi_sdma_bitmap = ~0ULL >> (64 -get_num_xgmi_sdma_queues (dqm)); +init_sdma_bitmaps (dqm);return 0 ; }
@@ -1442,9 +1456,6 @@ static int set_sched_resources(struct device_queue_manager *dqm)static int initialize_cpsch (struct device_queue_manager *dqm) { -uint64_t num_sdma_queues; -uint64_t num_xgmi_sdma_queues; -pr_debug ("num of pipes: %d\n" ,get_pipes_per_mec (dqm));mutex_init (&dqm->lock_hidden);
@@ -1453,24 +1464,10 @@ static int initialize_cpsch(struct device_queue_manager *dqm) dqm->active_cp_queue_count =0 ; dqm->gws_queue_count =0 ; dqm->active_runlist = false; - - num_sdma_queues =get_num_sdma_queues (dqm); -if (num_sdma_queues >=BITS_PER_TYPE (dqm->sdma_bitmap)) - dqm->sdma_bitmap =ULLONG_MAX ; -else - dqm->sdma_bitmap = (BIT_ULL (num_sdma_queues) -1 ); - - dqm->sdma_bitmap &= ~(get_reserved_sdma_queues_bitmap (dqm)); -pr_info ("sdma_bitmap: %llx\n" , dqm->sdma_bitmap); - - num_xgmi_sdma_queues =get_num_xgmi_sdma_queues (dqm); -if (num_xgmi_sdma_queues >=BITS_PER_TYPE (dqm->xgmi_sdma_bitmap)) - dqm->xgmi_sdma_bitmap =ULLONG_MAX ; -else - dqm->xgmi_sdma_bitmap = (BIT_ULL (num_xgmi_sdma_queues) -1 ); -INIT_WORK (&dqm->hw_exception_work, kfd_process_hw_exception); +init_sdma_bitmaps (dqm); +return 0 ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 629/717 ARM: dts: imx6: delete interrupts property if interrupts-extended is set
In reply to Greg Kroah-HartmanFrom: Alexander Stein <[email protected]>
[ Upstream commit c9d38ff7080b2c4fa6786b82210fa13115895aae ]
In most cases this is related to fsl,err006687-workaround-present, which requires a GPIO interrupt next a GIC interrupt.
This fixes the dtbs_check warning:
imx6dl-mba6a.dtb: ethernet@2188000: More than one condition true in oneOf schema:
{'$filename': 'Documentation/devicetree/bindings/net/fsl,fec.yaml',
[...]
--- arch/arm/boot/dts/imx6dl-riotboard.dts | 1 + arch/arm/boot/dts/imx6q-arm2.dts | 1 + arch/arm/boot/dts/imx6q-evi.dts | 1 + arch/arm/boot/dts/imx6q-mccmon6.dts | 1 + arch/arm/boot/dts/imx6qdl-nit6xlite.dtsi | 1 + arch/arm/boot/dts/imx6qdl-nitrogen6_max.dtsi | 1 + arch/arm/boot/dts/imx6qdl-nitrogen6_som2.dtsi | 1 + arch/arm/boot/dts/imx6qdl-nitrogen6x.dtsi | 1 + arch/arm/boot/dts/imx6qdl-sabreauto.dtsi | 1 + arch/arm/boot/dts/imx6qdl-tqma6a.dtsi | 1 + arch/arm/boot/dts/imx6qdl-ts7970.dtsi | 1 + 11 files changed, 11 insertions(+)
arch/arm/boot/dts/imx6dl-riotboard.dts +1 -0
@@ -90,6 +90,7 @@ pinctrl-0 = <&pinctrl_enet>; phy-mode = "rgmii-id"; phy-handle = <&rgmii_phy>; + /delete-property/ interrupts; interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>, <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>; fsl,err006687-workaround-present;
arch/arm/boot/dts/imx6q-arm2.dts +1 -0
@@ -178,6 +178,7 @@ pinctrl-names = "default"; pinctrl-0 = <&pinctrl_enet>; phy-mode = "rgmii"; + /delete-property/ interrupts; interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>, <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>; fsl,err006687-workaround-present;
arch/arm/boot/dts/imx6q-evi.dts +1 -0
@@ -146,6 +146,7 @@ pinctrl-0 = <&pinctrl_enet>; phy-mode = "rgmii"; phy-reset-gpios = <&gpio1 25 GPIO_ACTIVE_LOW>; + /delete-property/ interrupts; interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>, <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>; fsl,err006687-workaround-present;
arch/arm/boot/dts/imx6q-mccmon6.dts +1 -0
@@ -100,6 +100,7 @@ pinctrl-0 = <&pinctrl_enet>; phy-mode = "rgmii"; phy-reset-gpios = <&gpio1 27 GPIO_ACTIVE_LOW>; + /delete-property/ interrupts; interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>, <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>; status = "okay";
arch/arm/boot/dts/imx6qdl-nit6xlite.dtsi +1 -0
@@ -192,6 +192,7 @@ phy-mode = "rgmii"; phy-handle = <ðphy>; phy-reset-gpios = <&gpio1 27 GPIO_ACTIVE_LOW>; + /delete-property/ interrupts; interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>, <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>; fsl,err006687-workaround-present;
arch/arm/boot/dts/imx6qdl-nitrogen6_max.dtsi +1 -0
@@ -334,6 +334,7 @@ phy-mode = "rgmii"; phy-handle = <ðphy>; phy-reset-gpios = <&gpio1 27 GPIO_ACTIVE_LOW>; + /delete-property/ interrupts; interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>, <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>; fsl,err006687-workaround-present;
arch/arm/boot/dts/imx6qdl-nitrogen6_som2.dtsi +1 -0
@@ -263,6 +263,7 @@ pinctrl-names = "default"; pinctrl-0 = <&pinctrl_enet>; phy-mode = "rgmii"; + /delete-property/ interrupts; interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>, <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>; fsl,err006687-workaround-present;
arch/arm/boot/dts/imx6qdl-nitrogen6x.dtsi +1 -0
@@ -267,6 +267,7 @@ phy-mode = "rgmii"; phy-handle = <ðphy>; phy-reset-gpios = <&gpio1 27 GPIO_ACTIVE_LOW>; + /delete-property/ interrupts; interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>, <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>; fsl,err006687-workaround-present;
arch/arm/boot/dts/imx6qdl-sabreauto.dtsi +1 -0
@@ -295,6 +295,7 @@ pinctrl-names = "default"; pinctrl-0 = <&pinctrl_enet>; phy-mode = "rgmii-id"; + /delete-property/ interrupts; interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>, <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>; fsl,err006687-workaround-present;
arch/arm/boot/dts/imx6qdl-tqma6a.dtsi +1 -0
@@ -7,6 +7,7 @@ #include <dt-bindings/gpio/gpio.h> &fec { + /delete-property/ interrupts; interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>, <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>; fsl,err006687-workaround-present;
arch/arm/boot/dts/imx6qdl-ts7970.dtsi +1 -0
@@ -192,6 +192,7 @@ pinctrl-names = "default"; pinctrl-0 = <&pinctrl_enet>; phy-mode = "rgmii"; + /delete-property/ interrupts; interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>, <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>; fsl,err006687-workaround-present;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 630/717 ARM: dts: imx7d-sdb: config the max pressure for tsc2046
In reply to Greg Kroah-HartmanFrom: Haibo Chen <[email protected]>
[ Upstream commit e7c4ebe2f9cd68588eb24ba4ed122e696e2d5272 ]
Use the general touchscreen method to config the max pressure for touch tsc2046(data sheet suggest 8 bit pressure), otherwise, for ABS_PRESSURE, when config the same max and min value, weston will meet the following issue,
[17:19:39.183] event1 - ADS7846 Touchscreen: is tagged by udev as: Touchscreen [17:19:39.183] event1 - ADS7846 Touchscreen: kernel bug: device has min == max on ABS_PRESSURE [17:19:39.183] event1 - ADS7846 Touchscreen: was rejected [17:19:39.183] event1 - not using input device '/dev/input/event1'
This will then cause the APP weston-touch-calibrator can't list touch devices.
root@imx6ul7d:~# weston-touch-calibrator could not load cursor 'dnd-move' could not load cursor 'dnd-copy' could not load cursor 'dnd-none' No devices listed.
And accroding to binding Doc, "ti,x-max", "ti,y-max", "ti,pressure-max" belong to the deprecated properties, so remove them. Also for "ti,x-min", "ti,y-min", "ti,x-plate-ohms", the value set in dts equal to the default value in driver, so are redundant, also remove here.
--- arch/arm/boot/dts/imx7d-sdb.dts | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
arch/arm/boot/dts/imx7d-sdb.dts +1 -6
@@ -206,12 +206,7 @@ interrupt-parent = <&gpio2>; interrupts = <29 0>; pendown-gpio = <&gpio2 29 GPIO_ACTIVE_HIGH>; - ti,x-min = /bits/ 16 <0>; - ti,x-max = /bits/ 16 <0>; - ti,y-min = /bits/ 16 <0>; - ti,y-max = /bits/ 16 <0>; - ti,pressure-max = /bits/ 16 <0>; - ti,x-plate-ohms = /bits/ 16 <400>; + touchscreen-max-pressure = <255>; wakeup-source; }; };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 631/717 ARM: dts: imx6q: add missing properties for sram
In reply to Greg Kroah-HartmanFrom: Alexander Stein <[email protected]>
[ Upstream commit b11d083c5dcec7c42fe982c854706d404ddd3a5f ]
All 3 properties are required by sram.yaml. Fixes the dtbs_check warning:
sram@900000: '#address-cells' is a required property sram@900000: '#size-cells' is a required property sram@900000: 'ranges' is a required property
--- arch/arm/boot/dts/imx6q.dtsi | 3 +++ 1 file changed, 3 insertions(+)
arch/arm/boot/dts/imx6q.dtsi +3 -0
@@ -163,6 +163,9 @@ ocram: sram@900000 { compatible = "mmio-sram"; reg = <0x00900000 0x40000>; + ranges = <0 0x00900000 0x40000>; + #address-cells = <1>; + #size-cells = <1>; clocks = <&clks IMX6QDL_CLK_OCRAM>; };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 632/717 ARM: dts: imx6dl: add missing properties for sram
In reply to Greg Kroah-HartmanFrom: Alexander Stein <[email protected]>
[ Upstream commit f5848b95633d598bacf0500e0108dc5961af88c0 ]
All 3 properties are required by sram.yaml. Fixes the dtbs_check warning:
sram@900000: '#address-cells' is a required property sram@900000: '#size-cells' is a required property sram@900000: 'ranges' is a required property
--- arch/arm/boot/dts/imx6dl.dtsi | 3 +++ 1 file changed, 3 insertions(+)
arch/arm/boot/dts/imx6dl.dtsi +3 -0
@@ -84,6 +84,9 @@ ocram: sram@900000 { compatible = "mmio-sram"; reg = <0x00900000 0x20000>; + ranges = <0 0x00900000 0x20000>; + #address-cells = <1>; + #size-cells = <1>; clocks = <&clks IMX6QDL_CLK_OCRAM>; };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 633/717 ARM: dts: imx6qp: add missing properties for sram
In reply to Greg Kroah-HartmanFrom: Alexander Stein <[email protected]>
[ Upstream commit 088fe5237435ee2f7ed4450519b2ef58b94c832f ]
All 3 properties are required by sram.yaml. Fixes the dtbs_check warning:
sram@940000: '#address-cells' is a required property sram@940000: '#size-cells' is a required property sram@940000: 'ranges' is a required property
--- arch/arm/boot/dts/imx6qp.dtsi | 6 ++++++ 1 file changed, 6 insertions(+)
arch/arm/boot/dts/imx6qp.dtsi +6 -0
@@ -9,12 +9,18 @@ ocram2: sram@940000 { compatible = "mmio-sram"; reg = <0x00940000 0x20000>; + ranges = <0 0x00940000 0x20000>; + #address-cells = <1>; + #size-cells = <1>; clocks = <&clks IMX6QDL_CLK_OCRAM>; }; ocram3: sram@960000 { compatible = "mmio-sram"; reg = <0x00960000 0x20000>; + ranges = <0 0x00960000 0x20000>; + #address-cells = <1>; + #size-cells = <1>; clocks = <&clks IMX6QDL_CLK_OCRAM>; };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 634/717 ARM: dts: imx6sl: add missing properties for sram
In reply to Greg Kroah-HartmanFrom: Alexander Stein <[email protected]>
[ Upstream commit 60c9213a1d9941a8b33db570796c3f9be8984974 ]
All 3 properties are required by sram.yaml. Fixes the dtbs_check warning:
sram@900000: '#address-cells' is a required property sram@900000: '#size-cells' is a required property sram@900000: 'ranges' is a required property
--- arch/arm/boot/dts/imx6sl.dtsi | 3 +++ 1 file changed, 3 insertions(+)
arch/arm/boot/dts/imx6sl.dtsi +3 -0
@@ -115,6 +115,9 @@ ocram: sram@900000 { compatible = "mmio-sram"; reg = <0x00900000 0x20000>; + ranges = <0 0x00900000 0x20000>; + #address-cells = <1>; + #size-cells = <1>; clocks = <&clks IMX6SL_CLK_OCRAM>; };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 635/717 ARM: dts: imx6sll: add missing properties for sram
In reply to Greg Kroah-HartmanFrom: Alexander Stein <[email protected]>
[ Upstream commit 7492a83ed9b7a151e2dd11d64b06da7a7f0fa7f9 ]
All 3 properties are required by sram.yaml. Fixes the dtbs_check warning:
sram@900000: '#address-cells' is a required property sram@900000: '#size-cells' is a required property sram@900000: 'ranges' is a required property
--- arch/arm/boot/dts/imx6sll.dtsi | 3 +++ 1 file changed, 3 insertions(+)
arch/arm/boot/dts/imx6sll.dtsi +3 -0
@@ -115,6 +115,9 @@ ocram: sram@900000 { compatible = "mmio-sram"; reg = <0x00900000 0x20000>; + ranges = <0 0x00900000 0x20000>; + #address-cells = <1>; + #size-cells = <1>; }; intc: interrupt-controller@a01000 {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 636/717 ARM: dts: imx6sx: add missing properties for sram
In reply to Greg Kroah-HartmanFrom: Alexander Stein <[email protected]>
[ Upstream commit 415432c008b2bce8138841356ba444631cabaa50 ]
All 3 properties are required by sram.yaml. Fixes the dtbs_check warning:
sram@900000: '#address-cells' is a required property sram@900000: '#size-cells' is a required property sram@900000: 'ranges' is a required property
--- arch/arm/boot/dts/imx6sx.dtsi | 6 ++++++ 1 file changed, 6 insertions(+)
arch/arm/boot/dts/imx6sx.dtsi +6 -0
@@ -164,12 +164,18 @@ ocram_s: sram@8f8000 { compatible = "mmio-sram"; reg = <0x008f8000 0x4000>; + ranges = <0 0x008f8000 0x4000>; + #address-cells = <1>; + #size-cells = <1>; clocks = <&clks IMX6SX_CLK_OCRAM_S>; }; ocram: sram@900000 { compatible = "mmio-sram"; reg = <0x00900000 0x20000>; + ranges = <0 0x00900000 0x20000>; + #address-cells = <1>; + #size-cells = <1>; clocks = <&clks IMX6SX_CLK_OCRAM>; };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 637/717 ARM: dts: imx6sl: use tabs for code indent
In reply to Greg Kroah-HartmanFrom: Marcel Ziswiler <[email protected]>
[ Upstream commit 218db824a7519856d0eaaeb5c41ca504ed550210 ]
This fixes the following error:
arch/arm/boot/dts/imx6sl.dtsi:714: error: code indent should use tabs where possible
--- arch/arm/boot/dts/imx6sl.dtsi | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
arch/arm/boot/dts/imx6sl.dtsi +10 -10
@@ -61,10 +61,10 @@ <792000 1175000>, <396000 975000>; fsl,soc-operating-points = - /* ARM kHz SOC-PU uV */ - <996000 1225000>, - <792000 1175000>, - <396000 1175000>; + /* ARM kHz SOC-PU uV */ + <996000 1225000>, + <792000 1175000>, + <396000 1175000>; clock-latency = <61036>; /* two CLK32 periods */ #cooling-cells = <2>; clocks = <&clks IMX6SL_CLK_ARM>, <&clks IMX6SL_CLK_PLL2_PFD2>,
@@ -225,7 +225,7 @@ uart5: serial@2018000 { compatible = "fsl,imx6sl-uart", - "fsl,imx6q-uart", "fsl,imx21-uart"; + "fsl,imx6q-uart", "fsl,imx21-uart"; reg = <0x02018000 0x4000>; interrupts = <0 30 IRQ_TYPE_LEVEL_HIGH>; clocks = <&clks IMX6SL_CLK_UART>,
@@ -238,7 +238,7 @@ uart1: serial@2020000 { compatible = "fsl,imx6sl-uart", - "fsl,imx6q-uart", "fsl,imx21-uart"; + "fsl,imx6q-uart", "fsl,imx21-uart"; reg = <0x02020000 0x4000>; interrupts = <0 26 IRQ_TYPE_LEVEL_HIGH>; clocks = <&clks IMX6SL_CLK_UART>,
@@ -251,7 +251,7 @@ uart2: serial@2024000 { compatible = "fsl,imx6sl-uart", - "fsl,imx6q-uart", "fsl,imx21-uart"; + "fsl,imx6q-uart", "fsl,imx21-uart"; reg = <0x02024000 0x4000>; interrupts = <0 27 IRQ_TYPE_LEVEL_HIGH>; clocks = <&clks IMX6SL_CLK_UART>,
@@ -312,7 +312,7 @@ uart3: serial@2034000 { compatible = "fsl,imx6sl-uart", - "fsl,imx6q-uart", "fsl,imx21-uart"; + "fsl,imx6q-uart", "fsl,imx21-uart"; reg = <0x02034000 0x4000>; interrupts = <0 28 IRQ_TYPE_LEVEL_HIGH>; clocks = <&clks IMX6SL_CLK_UART>,
@@ -325,7 +325,7 @@ uart4: serial@2038000 { compatible = "fsl,imx6sl-uart", - "fsl,imx6q-uart", "fsl,imx21-uart"; + "fsl,imx6q-uart", "fsl,imx21-uart"; reg = <0x02038000 0x4000>; interrupts = <0 29 IRQ_TYPE_LEVEL_HIGH>; clocks = <&clks IMX6SL_CLK_UART>,
@@ -714,7 +714,7 @@ #power-domain-cells = <0>; power-supply = <®_pu>; clocks = <&clks IMX6SL_CLK_GPU2D_OVG>, - <&clks IMX6SL_CLK_GPU2D_PODF>; + <&clks IMX6SL_CLK_GPU2D_PODF>; }; pd_disp: power-domain@2 {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 638/717 ARM: dts: imx6sx-udoo-neo: dont use multiple blank lines
In reply to Greg Kroah-HartmanFrom: Marcel Ziswiler <[email protected]>
[ Upstream commit fd2dd7077c7498765e7326c1b7f34bde85f1a975 ]
This fixes the following warning:
arch/arm/boot/dts/imx6sx-udoo-neo.dtsi:309: check: Please don't use multiple blank lines
While at it, use tabs indent for some pinctrl entries.
--- arch/arm/boot/dts/imx6sx-udoo-neo.dtsi | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
arch/arm/boot/dts/imx6sx-udoo-neo.dtsi +6 -8
@@ -226,7 +226,7 @@ &iomuxc { pinctrl_bt_reg: btreggrp { fsl,pins = - <MX6SX_PAD_KEY_ROW2__GPIO2_IO_17 0x15059>; + <MX6SX_PAD_KEY_ROW2__GPIO2_IO_17 0x15059>; }; pinctrl_enet1: enet1grp {
@@ -306,7 +306,6 @@ >; }; - pinctrl_uart1: uart1grp { fsl,pins = <MX6SX_PAD_GPIO1_IO04__UART1_DCE_TX 0x1b0b1>,
@@ -347,24 +346,23 @@ pinctrl_otg1_reg: otg1grp { fsl,pins = - <MX6SX_PAD_GPIO1_IO09__GPIO1_IO_9 0x10b0>; + <MX6SX_PAD_GPIO1_IO09__GPIO1_IO_9 0x10b0>; }; - pinctrl_otg2_reg: otg2grp { fsl,pins = - <MX6SX_PAD_NAND_RE_B__GPIO4_IO_12 0x10b0>; + <MX6SX_PAD_NAND_RE_B__GPIO4_IO_12 0x10b0>; }; pinctrl_usb_otg1: usbotg1grp { fsl,pins = - <MX6SX_PAD_GPIO1_IO10__ANATOP_OTG1_ID 0x17059>, - <MX6SX_PAD_GPIO1_IO08__USB_OTG1_OC 0x10b0>; + <MX6SX_PAD_GPIO1_IO10__ANATOP_OTG1_ID 0x17059>, + <MX6SX_PAD_GPIO1_IO08__USB_OTG1_OC 0x10b0>; }; pinctrl_usb_otg2: usbot2ggrp { fsl,pins = - <MX6SX_PAD_QSPI1A_DATA0__USB_OTG2_OC 0x10b0>; + <MX6SX_PAD_QSPI1A_DATA0__USB_OTG2_OC 0x10b0>; }; pinctrl_usdhc2: usdhc2grp {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 639/717 kselftest/arm64: Fix validatation termination record after EXTRA_CONTEXT
In reply to Greg Kroah-HartmanFrom: Mark Brown <[email protected]>
[ Upstream commit 5c152c2f66f9368394b89ac90dc7483476ef7b88 ]
When arm64 signal context data overflows the base struct sigcontext it gets placed in an extra buffer pointed to by a record of type EXTRA_CONTEXT in the base struct sigcontext which is required to be the last record in the base struct sigframe. The current validation code attempts to check this by using GET_RESV_NEXT_HEAD() to step forward from the current record to the next but that is a macro which assumes it is being provided with a struct _aarch64_ctx and uses the size there to skip forward to the next record. Instead validate_extra_context() passes it a struct extra_context which has a separate size field. This compiles but results in us trying to validate a termination record in completely the wrong place, at best failing validation and at worst just segfaulting. Fix this by passing the struct _aarch64_ctx we meant to into the macro.
--- tools/testing/selftests/arm64/signal/testcases/testcases.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/arm64/signal/testcases/testcases.c +1 -1
@@ -33,7 +33,7 @@ bool validate_extra_context(struct extra_context *extra, char **err)return false;fprintf (stderr,"Validating EXTRA...\n" ); - term =GET_RESV_NEXT_HEAD (extra); + term =GET_RESV_NEXT_HEAD (&extra->head);if (!term || term->magic || term->size) { *err ="Missing terminator after EXTRA context" ;return false;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 640/717 arm64: dts: imx8mm-kontron: Use the VSELECT signal to switch SD card IO voltage
In reply to Greg Kroah-HartmanFrom: Frieder Schrempf <[email protected]>
[ Upstream commit eef2c0217e02b6c7ed5b10b82ea944127145e113 ]
It turns out that it is not necessary to declare the VSELECT signal as GPIO and let the PMIC driver set it to a fixed high level. This switches the voltage between 3.3V and 1.8V by setting the PMIC register for LDO5 accordingly.
Instead we can do it like other boards already do and simply mux the VSELECT signal of the USDHC interface to the pin. This makes sure that the correct voltage is selected by setting the PMIC's SD_VSEL input to high or low accordingly.
--- arch/arm64/boot/dts/freescale/imx8mm-kontron-n801x-s.dts | 3 +++ arch/arm64/boot/dts/freescale/imx8mm-kontron-n801x-som.dtsi | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/freescale/imx8mm-kontron-n801x-s.dts +3 -0
@@ -321,6 +321,7 @@ MX8MM_IOMUXC_SD2_DATA2_USDHC2_DATA2 0x1d0 MX8MM_IOMUXC_SD2_DATA3_USDHC2_DATA3 0x1d0 MX8MM_IOMUXC_SD2_CD_B_GPIO2_IO12 0x019 + MX8MM_IOMUXC_GPIO1_IO04_USDHC2_VSELECT 0x1d0 >; };
@@ -333,6 +334,7 @@ MX8MM_IOMUXC_SD2_DATA2_USDHC2_DATA2 0x1d4 MX8MM_IOMUXC_SD2_DATA3_USDHC2_DATA3 0x1d4 MX8MM_IOMUXC_SD2_CD_B_GPIO2_IO12 0x019 + MX8MM_IOMUXC_GPIO1_IO04_USDHC2_VSELECT 0x1d0 >; };
@@ -345,6 +347,7 @@ MX8MM_IOMUXC_SD2_DATA2_USDHC2_DATA2 0x1d6 MX8MM_IOMUXC_SD2_DATA3_USDHC2_DATA3 0x1d6 MX8MM_IOMUXC_SD2_CD_B_GPIO2_IO12 0x019 + MX8MM_IOMUXC_GPIO1_IO04_USDHC2_VSELECT 0x1d0 >; }; };
arch/arm64/boot/dts/freescale/imx8mm-kontron-n801x-som.dtsi +0 -2
@@ -86,7 +86,6 @@ pinctrl-0 = <&pinctrl_pmic>; interrupt-parent = <&gpio1>; interrupts = <0 IRQ_TYPE_LEVEL_LOW>; - sd-vsel-gpios = <&gpio1 4 GPIO_ACTIVE_HIGH>; regulators { reg_vdd_soc: BUCK1 {
@@ -229,7 +228,6 @@ pinctrl_pmic: pmicgrp { fsl,pins = < MX8MM_IOMUXC_GPIO1_IO00_GPIO1_IO0 0x141 - MX8MM_IOMUXC_GPIO1_IO04_GPIO1_IO4 0x141 >; };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 641/717 arm64: dts: imx8mq-librem5: Add bq25895 as max17055s power supply
In reply to Greg Kroah-HartmanFrom: Sebastian Krzyszkowiak <[email protected]>
[ Upstream commit 6effe295e1a87408033c29dbcea9d5a5c8b937d5 ]
This allows the userspace to notice that there's not enough current provided to charge the battery, and also fixes issues with 0% SOC values being considered invalid.
--- arch/arm64/boot/dts/freescale/imx8mq-librem5.dtsi | 1 + 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/freescale/imx8mq-librem5.dtsi +1 -0
@@ -1077,6 +1077,7 @@ interrupts = <20 IRQ_TYPE_LEVEL_LOW>; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_gauge>; + power-supplies = <&bq25895>; maxim,over-heat-temp = <700>; maxim,over-volt = <4500>; maxim,rsns-microohm = <5000>;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 642/717 btrfs: dump extra info if one free space cache has more bitmaps than it should
In reply to Greg Kroah-HartmanFrom: Qu Wenruo <[email protected]>
[ Upstream commit 62cd9d4474282a1eb84f945955c56cbfc42e1ffe ]
There is an internal report on hitting the following ASSERT() in recalculate_thresholds():
ASSERT(ctl->total_bitmaps <= max_bitmaps);
Above @max_bitmaps is calculated using the following variables:
- bytes_per_bg
8 * 4096 * 4096 (128M) for x86_64/x86.
- block_group->length
The length of the block group.
@max_bitmaps is the rounded up value of block_group->length / 128M.
Normally one free space cache should not have more bitmaps than above value, but when it happens the ASSERT() can be triggered if CONFIG_BTRFS_ASSERT is also enabled.
But the ASSERT() itself won't provide enough info to know which is going wrong.
Is the bg too small thus it only allows one bitmap?
Or is there something else wrong?
So although I haven't found extra reports or crash dump to do further investigation, add the extra info to make it more helpful to debug.
--- fs/btrfs/free-space-cache.c | 6 ++++++ 1 file changed, 6 insertions(+)
fs/btrfs/free-space-cache.c +6 -0
@@ -693,6 +693,12 @@ static void recalculate_thresholds(struct btrfs_free_space_ctl *ctl) max_bitmaps =max_t (u64, max_bitmaps,1 ); +if (ctl->total_bitmaps > max_bitmaps) +btrfs_err (block_group->fs_info, +"invalid free space control: bg start=%llu len=%llu total_bitmaps=%u unit=%u max_bitmaps=%llu bytes_per_bg=%llu" , + block_group->start, block_group->length, + ctl->total_bitmaps, ctl->unit, max_bitmaps, + bytes_per_bg);ASSERT (ctl->total_bitmaps <= max_bitmaps);/*
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 643/717 btrfs: scrub: properly report super block errors in system log
In reply to Greg Kroah-HartmanFrom: Qu Wenruo <[email protected]>
[ Upstream commit e69bf81c9a339f1b2c041b112a6fbb9f60fc9340 ]
[PROBLEM]
Unlike data/metadata corruption, if scrub detected some error in the super block, the only error message is from the updated device status:
BTRFS info (device dm-1): scrub: started on devid 2
BTRFS error (device dm-1): bdev /dev/mapper/test-scratch2 errs: wr 0, rd 0, flush 0, corrupt 1, gen 0 BTRFS info (device dm-1): scrub: finished on devid 2 with status: 0
This is not helpful at all.
[CAUSE]
Unlike data/metadata error reporting, there is no visible report in kernel dmesg to report supper block errors.
In fact, return value of scrub_checksum_super() is intentionally skipped, thus scrub_handle_errored_block() will never be called for super blocks.
[FIX]
Make super block errors to output an error message, now the full dmesg would looks like this:
BTRFS info (device dm-1): scrub: started on devid 2
BTRFS warning (device dm-1): super block error on device /dev/mapper/test-scratch2, physical 67108864 BTRFS error (device dm-1): bdev /dev/mapper/test-scratch2 errs: wr 0, rd 0, flush 0, corrupt 1, gen 0 BTRFS info (device dm-1): scrub: finished on devid 2 with status: 0
BTRFS info (device dm-1): scrub: started on devid 2
This fix involves:
- Move the super_errors reporting to scrub_handle_errored_block() This allows the device status message to show after the super block error message.
But now we no longer distinguish super block corruption and generation mismatch, now all counted as corruption.
- Properly check the return value from scrub_checksum_super()
- Add extra super block error reporting for scrub_print_warning().
--- fs/btrfs/scrub.c | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-)
fs/btrfs/scrub.c +12 -21
@@ -731,6 +731,13 @@ static void scrub_print_warning(const char *errstr, struct scrub_block *sblock) dev = sblock->sectors[0 ]->dev; fs_info = sblock->sctx->fs_info; +/* Super block error, no need to search extent tree. */ +if (sblock->sectors[0 ]->flags &BTRFS_EXTENT_FLAG_SUPER ) { +btrfs_warn_in_rcu (fs_info,"%s on device %s, physical %llu" , + errstr,rcu_str_deref (dev->name), + sblock->sectors[0 ]->physical); +return ; + } path =btrfs_alloc_path ();if (!path)return ;
@@ -806,7 +813,7 @@ static inline void scrub_put_recover(struct btrfs_fs_info *fs_info,static int scrub_handle_errored_block (struct scrub_block *sblock_to_check) {struct scrub_ctx *sctx = sblock_to_check->sctx; -struct btrfs_device *dev; +struct btrfs_device *dev = sblock_to_check->sectors[0 ]->dev;struct btrfs_fs_info *fs_info;u64 logical;unsigned int failed_mirror_index;
@@ -827,13 +834,15 @@ static int scrub_handle_errored_block(struct scrub_block *sblock_to_check) fs_info = sctx->fs_info;if (sblock_to_check->sectors[0 ]->flags &BTRFS_EXTENT_FLAG_SUPER ) {/* -* if we find an error in a super block, we just report it. +* If we find an error in a super block, we just report it. * They will get written with the next transaction commit * anyway */ +scrub_print_warning ("super block error" , sblock_to_check);spin_lock (&sctx->stat_lock); ++sctx->stat.super_errors;spin_unlock (&sctx->stat_lock); +btrfs_dev_stat_inc_and_print (dev,BTRFS_DEV_STAT_CORRUPTION_ERRS );return 0 ; } logical = sblock_to_check->sectors[0 ]->logical;
@@ -842,7 +851,6 @@ static int scrub_handle_errored_block(struct scrub_block *sblock_to_check) is_metadata = !(sblock_to_check->sectors[0 ]->flags &BTRFS_EXTENT_FLAG_DATA ); have_csum = sblock_to_check->sectors[0 ]->have_csum; - dev = sblock_to_check->sectors[0 ]->dev;if (!sctx->is_dev_replace &&btrfs_repair_one_zone (fs_info, logical))return 0 ;
@@ -1773,7 +1781,7 @@ static int scrub_checksum(struct scrub_block *sblock)else if (flags &BTRFS_EXTENT_FLAG_TREE_BLOCK ) ret =scrub_checksum_tree_block (sblock);else if (flags &BTRFS_EXTENT_FLAG_SUPER ) - (void )scrub_checksum_super (sblock); + ret =scrub_checksum_super (sblock);else WARN_ON (1 );if (ret)
@@ -1912,23 +1920,6 @@ static int scrub_checksum_super(struct scrub_block *sblock)if (memcmp (calculated_csum, s->csum, sctx->fs_info->csum_size)) ++fail_cor; -if (fail_cor + fail_gen) { -/* -* if we find an error in a super block, we just report it. -* They will get written with the next transaction commit -* anyway -*/ -spin_lock (&sctx->stat_lock); - ++sctx->stat.super_errors; -spin_unlock (&sctx->stat_lock); -if (fail_cor) -btrfs_dev_stat_inc_and_print (sector->dev, -BTRFS_DEV_STAT_CORRUPTION_ERRS ); -else -btrfs_dev_stat_inc_and_print (sector->dev, -BTRFS_DEV_STAT_GENERATION_ERRS ); - } -return fail_cor + fail_gen; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 644/717 btrfs: scrub: try to fix super block errors
In reply to Greg Kroah-HartmanFrom: Qu Wenruo <[email protected]>
[ Upstream commit f9eab5f0bba76742af654f33d517bf62a0db8f12 ]
[BUG]
The following script shows that, although scrub can detect super block errors, it never tries to fix it:
mkfs.btrfs -f -d raid1 -m raid1 $dev1 $dev2 xfs_io -c "pwrite 67108864 4k" $dev2
mount $dev1 $mnt
btrfs scrub start -B $dev2
btrfs scrub start -Br $dev2
umount $mnt
The first scrub reports the super error correctly:
scrub done for f3289218-abd3-41ac-a630-202f766c0859
Scrub started: Tue Aug 2 14:44:11 2022
Status: finished
Duration: 0:00:00
Total to scrub: 1.26GiB
Rate: 0.00B/s
Error summary: super=1
Corrected: 0
Uncorrectable: 0
Unverified: 0But the second read-only scrub still reports the same super error:
Scrub started: Tue Aug 2 14:44:11 2022
Status: finished
Duration: 0:00:00
Total to scrub: 1.26GiB
Rate: 0.00B/s
Error summary: super=1
Corrected: 0
Uncorrectable: 0
Unverified: 0[CAUSE]
The comments already shows that super block can be easily fixed by committing a transaction:
/*
* If we find an error in a super block, we just report it.
* They will get written with the next transaction commit
* anyway
*/
But the truth is, such assumption is not always true, and since scrub should try to repair every error it found (except for read-only scrub), we should really actively commit a transaction to fix this.
[FIX]
Just commit a transaction if we found any super block errors, after everything else is done.
We cannot do this just after scrub_supers(), as btrfs_commit_transaction() will try to pause and wait for the running scrub, thus we can not call it with scrub_lock hold.
--- fs/btrfs/scrub.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+)
fs/btrfs/scrub.c +36 -0
@@ -4112,6 +4112,7 @@ int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start,int ret;struct btrfs_device *dev;unsigned int nofs_flag; +bool need_commit = false;if (btrfs_fs_closing (fs_info))return -EAGAIN ;
@@ -4215,6 +4216,12 @@ int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start,*/ nofs_flag =memalloc_nofs_save ();if (!is_dev_replace) { +u64 old_super_errors; + +spin_lock (&sctx->stat_lock); + old_super_errors = sctx->stat.super_errors; +spin_unlock (&sctx->stat_lock); +btrfs_info (fs_info,"scrub: started on devid %llu" , devid);/* * by holding device list mutex, we can
@@ -4223,6 +4230,16 @@ int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start,mutex_lock (&fs_info->fs_devices->device_list_mutex); ret =scrub_supers (sctx, dev);mutex_unlock (&fs_info->fs_devices->device_list_mutex); + +spin_lock (&sctx->stat_lock); +/* +* Super block errors found, but we can not commit transaction +* at current context, since btrfs_commit_transaction() needs +* to pause the current running scrub (hold by ourselves). +*/ +if (sctx->stat.super_errors > old_super_errors && !sctx->readonly) + need_commit = true; +spin_unlock (&sctx->stat_lock); }if (!ret)
@@ -4249,6 +4266,25 @@ int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start,scrub_workers_put (fs_info);scrub_put_ctx (sctx); +/* +* We found some super block errors before, now try to force a +* transaction commit, as scrub has finished. +*/ +if (need_commit) { +struct btrfs_trans_handle *trans; + + trans =btrfs_start_transaction (fs_info->tree_root,0 ); +if (IS_ERR (trans)) { + ret =PTR_ERR (trans); +btrfs_err (fs_info, +"scrub: failed to start transaction to fix super block errors: %d" , ret); +return ret; + } + ret =btrfs_commit_transaction (trans); +if (ret <0 ) +btrfs_err (fs_info, +"scrub: failed to commit transaction to fix super block errors: %d" , ret); + }return ret; out:scrub_workers_put (fs_info);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 645/717 btrfs: dont print information about space cache or tree every remount
In reply to Greg Kroah-HartmanFrom: Maciej S. Szmigiero <[email protected]>
[ Upstream commit dbecac26630014d336a8e5ea67096ff18210fb9c ]
btrfs currently prints information about space cache or free space tree being in use on every remount, regardless whether such remount actually enabled or disabled one of these features.
This is actually unnecessary since providing remount options changing the state of these features will explicitly print the appropriate notice.
Let's instead print such unconditional information just on an initial mount to avoid filling the kernel log when, for example, laptop-mode-tools remount the fs on some events.
--- fs/btrfs/super.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
fs/btrfs/super.c +7 -4
@@ -625,6 +625,7 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options,int saved_compress_level;bool saved_compress_force;int no_compress =0 ; +const bool remounting =test_bit (BTRFS_FS_STATE_REMOUNTING , &info->fs_state);if (btrfs_fs_compat_ro (info,FREE_SPACE_TREE ))btrfs_set_opt (info->mount_opt,FREE_SPACE_TREE );
@@ -1136,10 +1137,12 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options, }if (!ret) ret =btrfs_check_mountopts_zoned (info); -if (!ret &&btrfs_test_opt (info,SPACE_CACHE )) -btrfs_info (info,"disk space caching is enabled" ); -if (!ret &&btrfs_test_opt (info,FREE_SPACE_TREE )) -btrfs_info (info,"using free space tree" ); +if (!ret && !remounting) { +if (btrfs_test_opt (info,SPACE_CACHE )) +btrfs_info (info,"disk space caching is enabled" ); +if (btrfs_test_opt (info,FREE_SPACE_TREE )) +btrfs_info (info,"using free space tree" ); + }return ret; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 646/717 btrfs: call __btrfs_remove_free_space_cache_locked on cache load failure
In reply to Greg Kroah-HartmanFrom: Josef Bacik <[email protected]>
[ Upstream commit 8a1ae2781dee9fc21ca82db682d37bea4bd074ad ]
Now that lockdep is staying enabled through our entire CI runs I started seeing the following stack in generic/475
------------[ cut here ]------------ WARNING: CPU: 1 PID: 2171864 at fs/btrfs/discard.c:604 btrfs_discard_update_discardable+0x98/0xb0 CPU: 1 PID: 2171864 Comm: kworker/u4:0 Not tainted 5.19.0-rc8+ #789 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.13.0-2.fc32 04/01/2014 Workqueue: btrfs-cache btrfs_work_helper RIP: 0010:btrfs_discard_update_discardable+0x98/0xb0 RSP: 0018:ffffb857c2f7bad0 EFLAGS: 00010246 RAX: 0000000000000000 RBX: ffff8c85c605c200 RCX: 0000000000000001 RDX: 0000000000000000 RSI: ffffffff86807c5b RDI: ffffffff868a831e RBP: ffff8c85c4c54000 R08: 0000000000000000 R09: 0000000000000000 R10: ffff8c85c66932f0 R11: 0000000000000001 R12: ffff8c85c3899010 R13: ffff8c85d5be4f40 R14: ffff8c85c4c54000 R15: ffff8c86114bfa80 FS: 0000000000000000(0000) GS:ffff8c863bd00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f2e7f168160 CR3: 000000010289a004 CR4: 0000000000370ee0 Call Trace: __btrfs_remove_free_space_cache+0x27/0x30 load_free_space_cache+0xad2/0xaf0 caching_thread+0x40b/0x650 ? lock_release+0x137/0x2d0 btrfs_work_helper+0xf2/0x3e0 ? lock_is_held_type+0xe2/0x140 process_one_work+0x271/0x590 ? process_one_work+0x590/0x590 worker_thread+0x52/0x3b0 ? process_one_work+0x590/0x590 kthread+0xf0/0x120 ? kthread_complete_and_exit+0x20/0x20 ret_from_fork+0x1f/0x30
This is the code
ctl = block_group->free_space_ctl;
discard_ctl = &block_group->fs_info->discard_ctl;
lockdep_assert_held(&ctl->tree_lock);We have a temporary free space ctl for loading the free space cache in order to avoid having allocations happening while we're loading the cache. When we hit an error we free it all up, however this also calls btrfs_discard_update_discardable, which requires block_group->free_space_ctl->tree_lock to be held. However this is our temporary ctl so this lock isn't held. Fix this by calling __btrfs_remove_free_space_cache_locked instead so that we only clean up the entries and do not mess with the discardable stats.
--- fs/btrfs/free-space-cache.c | 53 +++++++++++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 20 deletions(-)
fs/btrfs/free-space-cache.c +33 -20
@@ -48,6 +48,25 @@ static void bitmap_clear_bits(struct btr struct btrfs_free_space *info, u64 offset, u64 bytes, bool update_stats); +static void __btrfs_remove_free_space_cache_locked ( +struct btrfs_free_space_ctl *ctl) +{ +struct btrfs_free_space *info; +struct rb_node *node; + +while ((node =rb_last (&ctl->free_space_offset)) !=NULL ) { + info = rb_entry(node, struct btrfs_free_space, offset_index); +if (!info->bitmap) { +unlink_free_space (ctl, info, true); +kmem_cache_free (btrfs_free_space_cachep, info); + }else { +free_bitmap (ctl, info); + } + +cond_resched_lock (&ctl->tree_lock); + } +} +static struct inode *__lookup_free_space_inode (struct btrfs_root *root,struct btrfs_path *path,u64 offset)
@@ -881,7 +900,14 @@ out:return ret; free_cache:io_ctl_drop_pages (&io_ctl); -__btrfs_remove_free_space_cache (ctl); + +/* +* We need to call the _locked variant so we don't try to update the +* discard counters. +*/ +spin_lock (&ctl->tree_lock); +__btrfs_remove_free_space_cache_locked (ctl); +spin_unlock (&ctl->tree_lock); goto out; }
@@ -1007,7 +1033,13 @@ int load_free_space_cache(struct btrfs_bif (ret ==0 ) ret =1 ; }else { +/* +* We need to call the _locked variant so we don't try to update +* the discard counters. +*/ +spin_lock (&tmp_ctl.tree_lock);__btrfs_remove_free_space_cache (&tmp_ctl); +spin_unlock (&tmp_ctl.tree_lock);btrfs_warn (fs_info,"block group %llu has wrong amount of free space" , block_group->start);
@@ -2970,25 +3002,6 @@ static void __btrfs_return_cluster_to_frbtrfs_put_block_group (block_group); } -static void __btrfs_remove_free_space_cache_locked ( -struct btrfs_free_space_ctl *ctl) -{ -struct btrfs_free_space *info; -struct rb_node *node; - -while ((node =rb_last (&ctl->free_space_offset)) !=NULL ) { - info = rb_entry(node, struct btrfs_free_space, offset_index); -if (!info->bitmap) { -unlink_free_space (ctl, info, true); -kmem_cache_free (btrfs_free_space_cachep, info); - }else { -free_bitmap (ctl, info); - } - -cond_resched_lock (&ctl->tree_lock); - } -} -void __btrfs_remove_free_space_cache (struct btrfs_free_space_ctl *ctl) {spin_lock (&ctl->tree_lock);
Greg Kroah-Hartman
maintainerPATCH 647/717 ARM: 9233/1: stacktrace: Skip frame pointer boundary check for call_with_stack()
In reply to Greg Kroah-HartmanFrom: Li Huafei <[email protected]>
[ Upstream commit 5854e4d8530e6ed4c2532a71a6b0474e199d44dd ]
When using the frame pointer unwinder, it was found that the stack trace output of stack_trace_save() is incomplete if the stack contains call_with_stack():
[0x7f00002c] dump_stack_task+0x2c/0x90 [hrtimer]
[0x7f0000a0] hrtimer_hander+0x10/0x18 [hrtimer]
[0x801a67f0] __hrtimer_run_queues+0x1b0/0x3b4
[0x801a7350] hrtimer_run_queues+0xc4/0xd8
[0x801a597c] update_process_times+0x3c/0x88
[0x801b5a98] tick_periodic+0x50/0xd8
[0x801b5bf4] tick_handle_periodic+0x24/0x84
[0x8010ffc4] twd_handler+0x38/0x48
[0x8017d220] handle_percpu_devid_irq+0xa8/0x244
[0x80176e9c] generic_handle_domain_irq+0x2c/0x3c
[0x8052e3a8] gic_handle_irq+0x7c/0x90
[0x808ab15c] generic_handle_arch_irq+0x60/0x80
[0x8051191c] call_with_stack+0x1c/0x20
For the frame pointer unwinder, unwind_frame() checks stackframe::fp by stackframe::sp. Since call_with_stack() switches the SP from one stack to another, stackframe::fp and stackframe: :sp will point to different stacks, so we can no longer check stackframe::fp by stackframe::sp. Skip checking stackframe::fp at this point to avoid this problem.
--- arch/arm/kernel/stacktrace.c | 40 ++++++++++++++++++++++++++++------ arch/arm/lib/call_with_stack.S | 2 ++ 2 files changed, 35 insertions(+), 7 deletions(-)
arch/arm/kernel/stacktrace.c +33 -7
@@ -9,6 +9,8 @@#include <asm/stacktrace.h> #include <asm/traps.h> +#include "reboot.h" +#if defined(CONFIG_FRAME_POINTER ) && !defined(CONFIG_ARM_UNWIND )/* * Unwind the current stack frame and store the new register values in the
@@ -39,29 +41,53 @@* Note that with framepointer enabled, even the leaf functions have the same * prologue and epilogue, therefore we can ignore the LR value in this case. */ -int notrace unwind_frame(struct stackframe *frame) + +extern unsigned long call_with_stack_end; + +static int frame_pointer_check (struct stackframe *frame) {unsigned long high, low;unsigned long fp = frame->fp; +unsigned long pc = frame->pc; + +/* +* call_with_stack() is the only place we allow SP to jump from one +* stack to another, with FP and SP pointing to different stacks, +* skipping the FP boundary check at this point. +*/ +if (pc >= (unsigned long )&call_with_stack && + pc < (unsigned long )&call_with_stack_end) +return 0 ;/* only go to a higher address on the stack */ low = frame->sp; high =ALIGN (low,THREAD_SIZE ); -#ifdef CONFIG_CC_IS_CLANG /* check current frame pointer is within bounds */ +#ifdef CONFIG_CC_IS_CLANG if (fp < low +4 || fp > high -4 )return -EINVAL ; - - frame->sp = frame->fp; - frame->fp =READ_ONCE_NOCHECK (*(unsigned long *)(fp)); - frame->pc =READ_ONCE_NOCHECK (*(unsigned long *)(fp +4 ));#else -/* check current frame pointer is within bounds */ if (fp < low +12 || fp > high -4 )return -EINVAL ; +#endif + +return 0 ; +} + +int notrace unwind_frame(struct stackframe *frame) +{ +unsigned long fp = frame->fp; + +if (frame_pointer_check (frame)) +return -EINVAL ;/* restore the registers from the stack frame */ +#ifdef CONFIG_CC_IS_CLANG + frame->sp = frame->fp; + frame->fp =READ_ONCE_NOCHECK (*(unsigned long *)(fp)); + frame->pc =READ_ONCE_NOCHECK (*(unsigned long *)(fp +4 )); +#else frame->fp =READ_ONCE_NOCHECK (*(unsigned long *)(fp -12 )); frame->sp =READ_ONCE_NOCHECK (*(unsigned long *)(fp -8 )); frame->pc =READ_ONCE_NOCHECK (*(unsigned long *)(fp -4 ));
arch/arm/lib/call_with_stack.S +2 -0
@@ -46,4 +46,6 @@ UNWIND( .setfp fpreg, sp ) pop {fpreg, pc} UNWIND( .fnend ) #endif + .globl call_with_stack_end +call_with_stack_end: ENDPROC(call_with_stack)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 648/717 ARM: 9234/1: stacktrace: Avoid duplicate saving of exception PC value
In reply to Greg Kroah-HartmanFrom: Li Huafei <[email protected]>
[ Upstream commit 752ec621ef5c30777958cc5eb5f1cf394f7733f4 ]
Because an exception stack frame is not created in the exception entry, save_trace() does special handling for the exception PC, but this is only needed when CONFIG_FRAME_POINTER_UNWIND=y. When CONFIG_ARM_UNWIND=y, unwind annotations have been added to the exception entry and save_trace() will repeatedly save the exception PC:
[0x7f000090] hrtimer_hander+0x8/0x10 [hrtimer]
[0x8019ec50] __hrtimer_run_queues+0x18c/0x394
[0x8019f760] hrtimer_run_queues+0xbc/0xd0
[0x8019def0] update_process_times+0x34/0x80
[0x801ad2a4] tick_periodic+0x48/0xd0
[0x801ad3dc] tick_handle_periodic+0x1c/0x7c
[0x8010f2e0] twd_handler+0x30/0x40
[0x80177620] handle_percpu_devid_irq+0xa0/0x23c
[0x801718d0] generic_handle_domain_irq+0x24/0x34
[0x80502d28] gic_handle_irq+0x74/0x88
[0x8085817c] generic_handle_arch_irq+0x58/0x78
[0x80100ba8] __irq_svc+0x88/0xc8
[0x80108114] arch_cpu_idle+0x38/0x3c
[0x80108114] arch_cpu_idle+0x38/0x3c <==== duplicate saved exception PC
[0x80861bf8] default_idle_call+0x38/0x130
[0x8015d5cc] do_idle+0x150/0x214
[0x8015d978] cpu_startup_entry+0x18/0x1c
[0x808589c0] rest_init+0xd8/0xdc
[0x80c00a44] arch_post_acpi_subsys_init+0x0/0x8We can move the special handling of the exception PC in save_trace() to the unwind_frame() of the frame pointer unwinder.
--- arch/arm/include/asm/stacktrace.h | 6 +++++ arch/arm/kernel/return_address.c | 1 + arch/arm/kernel/stacktrace.c | 44 +++++++++++++++++++++---------- 3 files changed, 37 insertions(+), 14 deletions(-)
arch/arm/include/asm/stacktrace.h +6 -0
@@ -21,6 +21,9 @@ struct stackframe {struct llist_node *kr_cur;struct task_struct *tsk;#endif +#ifdef CONFIG_UNWINDER_FRAME_POINTER +bool ex_frame; +#endif }; static __always_inline
@@ -34,6 +37,9 @@ void arm_get_current_stackframe(struct pt_regs *regs, struct stackframe *frame) frame->kr_cur =NULL ; frame->tsk = current;#endif +#ifdef CONFIG_UNWINDER_FRAME_POINTER + frame->ex_frame =in_entry_text (frame->pc); +#endif }extern int unwind_frame (struct stackframe *frame);
arch/arm/kernel/return_address.c +1 -0
@@ -47,6 +47,7 @@ void *return_address(unsigned int level) frame.kr_cur =NULL ; frame.tsk = current;#endif + frame.ex_frame = false;walk_stackframe (&frame, save_return_addr, &data);
arch/arm/kernel/stacktrace.c +30 -14
80 lines not on this page · raw message
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 649/717 ARM: 9242/1: kasan: Only map modules if CONFIG_KASAN_VMALLOC=n
In reply to Greg Kroah-HartmanFrom: Alex Sverdlin <[email protected]>
[ Upstream commit 823f606ab6b4759a1faf0388abcf4fb0776710d2 ]
In case CONFIG_KASAN_VMALLOC=y kasan_populate_vmalloc() allocates the shadow pages dynamically. But even worse is that kasan_release_vmalloc() releases them, which is not compatible with create_mapping() of MODULES_VADDR..MODULES_END range:
BUG: Bad page state in process kworker/9:1 pfn:2068b page:e5e06160 refcount:0 mapcount:0 mapping:00000000 index:0x0 flags: 0x1000(reserved) raw: 00001000 e5e06164 e5e06164 00000000 00000000 00000000 ffffffff 00000000 page dumped because: PAGE_FLAGS_CHECK_AT_FREE flag(s) set bad because of flags: 0x1000(reserved) Modules linked in: ip_tables CPU: 9 PID: 154 Comm: kworker/9:1 Not tainted 5.4.188-... #1 Hardware name: LSI Axxia AXM55XX Workqueue: events do_free_init
unwind_backtraceshow_stackdump_stackbad_pagefree_pcp_preparefree_unref_pagekasan_depopulate_vmalloc_pte__apply_to_page_rangeapply_to_existing_page_rangekasan_release_vmalloc__purge_vmap_area_lazy
_vm_unmap_aliases.part.0__vunmapdo_free_initprocess_one_workworker_thread
kthread
--- arch/arm/mm/kasan_init.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
arch/arm/mm/kasan_init.c +7 -2
@@ -264,12 +264,17 @@ void __init kasan_init(void)/* * 1. The module global variables are in MODULES_VADDR ~ MODULES_END, -* so we need to map this area. +* so we need to map this area if CONFIG_KASAN_VMALLOC=n. With +* VMALLOC support KASAN will manage this region dynamically, +* refer to kasan_populate_vmalloc() and ARM's implementation of +* module_alloc(). * 2. PKMAP_BASE ~ PKMAP_BASE+PMD_SIZE's shadow and MODULES_VADDR * ~ MODULES_END's shadow is in the same PMD_SIZE, so we can't * use kasan_populate_zero_shadow. */ -create_mapping ((void *)MODULES_VADDR , (void *)(PKMAP_BASE +PMD_SIZE )); +if (!IS_ENABLED (CONFIG_KASAN_VMALLOC ) &&IS_ENABLED (CONFIG_MODULES )) +create_mapping ((void *)MODULES_VADDR , (void *)(MODULES_END )); +create_mapping ((void *)PKMAP_BASE , (void *)(PKMAP_BASE +PMD_SIZE ));/* * KAsan may reuse the contents of kasan_early_shadow_pte directly, so
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 650/717 clk: zynqmp: Fix stack-out-of-bounds in strncpy`
In reply to Greg Kroah-HartmanFrom: Ian Nam <[email protected]>
[ Upstream commit dd80fb2dbf1cd8751efbe4e53e54056f56a9b115 ]
"BUG: KASAN: stack-out-of-bounds in strncpy+0x30/0x68"
Linux-ATF interface is using 16 bytes of SMC payload. In case clock name is longer than 15 bytes, string terminated NULL character will not be received by Linux. Add explicit NULL character at last byte to fix issues when clock name is longer.
This fixes below bug reported by KASAN:
==================================================================
BUG: KASAN: stack-out-of-bounds in strncpy+0x30/0x68 Read of size 1 at addr ffff0008c89a7410 by task swapper/0/1 CPU: 1 PID: 1 Comm: swapper/0 Not tainted 5.4.0-00396-g81ef9e7-dirty #3 Hardware name: Xilinx Versal vck190 Eval board revA (QSPI) (DT) Call trace: dump_backtrace+0x0/0x1e8 show_stack+0x14/0x20 dump_stack+0xd4/0x108 print_address_description.isra.0+0xbc/0x37c __kasan_report+0x144/0x198 kasan_report+0xc/0x18 __asan_load1+0x5c/0x68 strncpy+0x30/0x68 zynqmp_clock_probe+0x238/0x7b8 platform_drv_probe+0x6c/0xc8 really_probe+0x14c/0x418 driver_probe_device+0x74/0x130 __device_attach_driver+0xc4/0xe8 bus_for_each_drv+0xec/0x150 __device_attach+0x160/0x1d8 device_initial_probe+0x10/0x18 bus_probe_device+0xe0/0xf0 device_add+0x528/0x950 of_device_add+0x5c/0x80 of_platform_device_create_pdata+0x120/0x168 of_platform_bus_create+0x244/0x4e0 of_platform_populate+0x50/0xe8 zynqmp_firmware_probe+0x370/0x3a8 platform_drv_probe+0x6c/0xc8 really_probe+0x14c/0x418 driver_probe_device+0x74/0x130 device_driver_attach+0x94/0xa0 __driver_attach+0x70/0x108 bus_for_each_dev+0xe4/0x158 driver_attach+0x30/0x40 bus_add_driver+0x21c/0x2b8 driver_register+0xbc/0x1d0 __platform_driver_register+0x7c/0x88 zynqmp_firmware_driver_init+0x1c/0x24 do_one_initcall+0xa4/0x234 kernel_init_freeable+0x1b0/0x24c kernel_init+0x10/0x110 ret_from_fork+0x10/0x18 The buggy address belongs to the page: page:ffff0008f9be1c88 refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 raw: 0008d00000000000 ffff0008f9be1c90 ffff0008f9be1c90 0000000000000000 raw: 0000000000000000 0000000000000000 00000000ffffffff page dumped because: kasan: bad access detected
addr ffff0008c89a7410 is located in stack of task swapper/0/1 at offset 112 in frame:
zynqmp_clock_probe+0x0/0x7b8
this frame has 3 objects:
[32, 44) 'response'
[64, 80) 'ret_payload'
[96, 112) 'name'
Memory state around the buggy address:
ffff0008c89a7300: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff0008c89a7380: 00 00 00 00 f1 f1 f1 f1 00 04 f2 f2 00 00 f2 f2
>ffff0008c89a7400: 00 00 f3 f3 00 00 00 00 00 00 00 00 00 00 00 00
^
ffff0008c89a7480: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff0008c89a7500: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================--- drivers/clk/zynqmp/clkc.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/clk/zynqmp/clkc.c +7 -0
@@ -710,6 +710,13 @@ static void zynqmp_get_clock_info(void)FIELD_PREP (CLK_ATTR_NODE_INDEX , i);zynqmp_pm_clock_get_name (clock[i].clk_id, &name); + +/* +* Terminate with NULL character in case name provided by firmware +* is longer and truncated due to size limit. +*/ + name.name[sizeof (name.name) -1 ] ='\0' ; +if (!strcmp (name.name,RESERVED_CLK_NAME ))continue ;strncpy (clock[i].clk_name, name.name,MAX_NAME_LEN );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 651/717 media: cx88: Fix a null-ptr-deref bug in buffer_prepare()
In reply to Greg Kroah-HartmanFrom: Zheyu Ma <[email protected]>
[ Upstream commit 2b064d91440b33fba5b452f2d1b31f13ae911d71 ]
When the driver calls cx88_risc_buffer() to prepare the buffer, the function call may fail, resulting in a empty buffer and null-ptr-deref later in buffer_queue().
The following log can reveal it:
[ 41.822762] general protection fault, probably for non-canonical address 0xdffffc0000000000: 0000 [#1] PREEMPT SMP KASAN PTI [ 41.824488] KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007] [ 41.828027] RIP: 0010:buffer_queue+0xc2/0x500 [ 41.836311] Call Trace: [ 41.836945] __enqueue_in_driver+0x141/0x360 [ 41.837262] vb2_start_streaming+0x62/0x4a0 [ 41.838216] vb2_core_streamon+0x1da/0x2c0 [ 41.838516] __vb2_init_fileio+0x981/0xbc0 [ 41.839141] __vb2_perform_fileio+0xbf9/0x1120 [ 41.840072] vb2_fop_read+0x20e/0x400 [ 41.840346] v4l2_read+0x215/0x290 [ 41.840603] vfs_read+0x162/0x4c0
Fix this by checking the return value of cx88_risc_buffer()
[hverkuil: fix coding style issues]
--- drivers/media/pci/cx88/cx88-vbi.c | 9 +++--- drivers/media/pci/cx88/cx88-video.c | 43 +++++++++++++++-------------- 2 files changed, 26 insertions(+), 26 deletions(-)
drivers/media/pci/cx88/cx88-vbi.c +4 -5
@@ -144,11 +144,10 @@ static int buffer_prepare(struct vb2_buffer *vb)return -EINVAL ;vb2_set_plane_payload (vb,0 , size); -cx88_risc_buffer (dev->pci, &buf->risc, sgt->sgl, -0 ,VBI_LINE_LENGTH * lines, -VBI_LINE_LENGTH ,0 , - lines); -return 0 ; +return cx88_risc_buffer (dev->pci, &buf->risc, sgt->sgl, +0 ,VBI_LINE_LENGTH * lines, +VBI_LINE_LENGTH ,0 , + lines); }static void buffer_finish (struct vb2_buffer *vb)
drivers/media/pci/cx88/cx88-video.c +22 -21
70 lines not on this page · raw message
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 652/717 media: platform: fix some double free in meson-ge2d and mtk-jpeg and s5p-mfc
In reply to Greg Kroah-HartmanFrom: Hangyu Hua <[email protected]>
[ Upstream commit c65c3f3a2cbf21ed429d9b9c725bdb5dc6abf4cf ]
video_unregister_device will release device internally. There is no need to call video_device_release after video_unregister_device.
--- drivers/media/platform/amlogic/meson-ge2d/ge2d.c | 1 - drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c | 1 - drivers/media/platform/samsung/s5p-mfc/s5p_mfc.c | 3 +-- 3 files changed, 1 insertion(+), 4 deletions(-)
drivers/media/platform/amlogic/meson-ge2d/ge2d.c +0 -1
@@ -1030,7 +1030,6 @@ static int ge2d_remove(struct platform_device *pdev)video_unregister_device (ge2d->vfd);v4l2_m2m_release (ge2d->m2m_dev); -video_device_release (ge2d->vfd);v4l2_device_unregister (&ge2d->v4l2_dev);clk_disable_unprepare (ge2d->clk);
drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c +0 -1
@@ -1411,7 +1411,6 @@ static int mtk_jpeg_remove(struct platform_device *pdev)pm_runtime_disable (&pdev->dev);video_unregister_device (jpeg->vdev); -video_device_release (jpeg->vdev);v4l2_m2m_release (jpeg->m2m_dev);v4l2_device_unregister (&jpeg->v4l2_dev);
drivers/media/platform/samsung/s5p-mfc/s5p_mfc.c +1 -2
@@ -1399,6 +1399,7 @@ static int s5p_mfc_probe(struct platform_device *pdev)/* Deinit MFC if probe had failed */ err_enc_reg:video_unregister_device (dev->vfd_dec); + dev->vfd_dec =NULL ; err_dec_reg:video_device_release (dev->vfd_enc); err_enc_alloc:
@@ -1444,8 +1445,6 @@ static int s5p_mfc_remove(struct platform_device *pdev)video_unregister_device (dev->vfd_enc);video_unregister_device (dev->vfd_dec); -video_device_release (dev->vfd_enc); -video_device_release (dev->vfd_dec);v4l2_device_unregister (&dev->v4l2_dev);s5p_mfc_unconfigure_dma_memory (dev);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 653/717 clk: zynqmp: pll: rectify rate rounding in zynqmp_pll_round_rate
In reply to Greg Kroah-HartmanFrom: Quanyang Wang <[email protected]>
[ Upstream commit 30eaf02149ecc3c5815e45d27187bf09e925071d ]
The function zynqmp_pll_round_rate is used to find a most appropriate PLL frequency which the hardware can generate according to the desired frequency. For example, if the desired frequency is 297MHz, considering the limited range from PS_PLL_VCO_MIN (1.5GHz) to PS_PLL_VCO_MAX (3.0GHz) of PLL, zynqmp_pll_round_rate should return 1.872GHz (297MHz * 5).
There are two problems with the current code of zynqmp_pll_round_rate:
1) When the rate is below PS_PLL_VCO_MIN, it can't find a correct rate when the parameter "rate" is an integer multiple of *prate, in other words, if "f" is zero, zynqmp_pll_round_rate won't return a valid frequency which is from PS_PLL_VCO_MIN to PS_PLL_VCO_MAX. For example, *prate is 33MHz and the rate is 660MHz, zynqmp_pll_round_rate will not boost up rate and just return 660MHz, and this will cause clk_calc_new_rates failure since zynqmp_pll_round_rate returns an invalid rate out of its boundaries.
2) Even if the rate is higher than PS_PLL_VCO_MIN, there is still a risk that zynqmp_pll_round_rate returns an invalid rate because the function DIV_ROUND_CLOSEST makes some loss in the fractional part. If the parent clock *prate is 33333333Hz and we want to set the PLL rate to 1.5GHz, this function will return 1499999985Hz by using the formula below:
value = *prate * DIV_ROUND_CLOSEST(rate, *prate)).
This value is also invalid since it's slightly smaller than PS_PLL_VCO_MIN. because DIV_ROUND_CLOSEST makes some loss in the fractional part.
--- drivers/clk/zynqmp/pll.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-)
drivers/clk/zynqmp/pll.c +15 -16
@@ -102,26 +102,25 @@ static long zynqmp_pll_round_rate(struct clk_hw *hw, unsigned long rate, unsigned long *prate) {u32 fbdiv; -long rate_div, f; +u32 mult, div; -/* Enable the fractional mode if needed */ - rate_div = (rate *FRAC_DIV ) / *prate; - f = rate_div %FRAC_DIV ; -if (f) { -if (rate >PS_PLL_VCO_MAX ) { - fbdiv = rate /PS_PLL_VCO_MAX ; - rate = rate / (fbdiv +1 ); - } -if (rate <PS_PLL_VCO_MIN ) { - fbdiv =DIV_ROUND_UP (PS_PLL_VCO_MIN , rate); - rate = rate * fbdiv; - } -return rate; +/* Let rate fall inside the range PS_PLL_VCO_MIN ~ PS_PLL_VCO_MAX */ +if (rate >PS_PLL_VCO_MAX ) { + div =DIV_ROUND_UP (rate,PS_PLL_VCO_MAX ); + rate = rate / div; + } +if (rate <PS_PLL_VCO_MIN ) { + mult =DIV_ROUND_UP (PS_PLL_VCO_MIN , rate); + rate = rate * mult; } fbdiv =DIV_ROUND_CLOSEST (rate, *prate); - fbdiv =clamp_t (u32, fbdiv,PLL_FBDIV_MIN ,PLL_FBDIV_MAX ); -return *prate * fbdiv; +if (fbdiv <PLL_FBDIV_MIN || fbdiv >PLL_FBDIV_MAX ) { + fbdiv =clamp_t (u32, fbdiv,PLL_FBDIV_MIN ,PLL_FBDIV_MAX ); + rate = *prate * fbdiv; + } + +return rate; }/**
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 654/717 RDMA/rxe: Delete error messages triggered by incoming Read requests
In reply to Greg Kroah-HartmanFrom: Daisuke Matsuda <[email protected]>
[ Upstream commit 2c02249fcbfc066bd33e2a7375c7006d4cb367f6 ]
An incoming Read request causes multiple Read responses. If a user MR to copy data from is unavailable or responder cannot send a reply, then the error messages can be printed for each response attempt, resulting in message overflow.
--- drivers/infiniband/sw/rxe/rxe_resp.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
drivers/infiniband/sw/rxe/rxe_resp.c +3 -7
@@ -787,10 +787,8 @@ static enum resp_states read_reply(struct rxe_qp *qp,if (!skb)return RESPST_ERR_RNR ; - err =rxe_mr_copy (mr, res->read.va,payload_addr (&ack_pkt), - payload,RXE_FROM_MR_OBJ ); -if (err) -pr_err ("Failed copying memory\n" ); +rxe_mr_copy (mr, res->read.va,payload_addr (&ack_pkt), + payload,RXE_FROM_MR_OBJ );if (mr)rxe_put (mr);
@@ -801,10 +799,8 @@ static enum resp_states read_reply(struct rxe_qp *qp, } err =rxe_xmit_packet (qp, &ack_pkt, skb); -if (err) { -pr_err ("Failed sending RDMA reply.\n" ); +if (err)return RESPST_ERR_RNR ; - } res->read.va += payload; res->read.resid -= payload;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 655/717 usb: host: xhci-plat: suspend and resume clocks
In reply to Greg Kroah-HartmanFrom: Justin Chen <[email protected]>
[ Upstream commit 8bd954c56197caf5e3a804d989094bc3fe6329aa ]
Introduce XHCI_SUSPEND_RESUME_CLKS quirk as a means to suspend and resume clocks if the hardware is capable of doing so. We assume that clocks will be needed if the device may wake.
--- drivers/usb/host/xhci-plat.c | 16 +++++++++++++++- drivers/usb/host/xhci.h | 1 + 2 files changed, 16 insertions(+), 1 deletion(-)
drivers/usb/host/xhci-plat.c +15 -1
@@ -437,7 +437,16 @@ static int __maybe_unused xhci_plat_suspend(struct device *dev)* xhci_suspend() needs `do_wakeup` to know whether host is allowed * to do wakeup during suspend. */ -return xhci_suspend (xhci,device_may_wakeup (dev)); + ret =xhci_suspend (xhci,device_may_wakeup (dev)); +if (ret) +return ret; + +if (!device_may_wakeup (dev) && (xhci->quirks &XHCI_SUSPEND_RESUME_CLKS )) { +clk_disable_unprepare (xhci->clk); +clk_disable_unprepare (xhci->reg_clk); + } + +return 0 ; }static int __maybe_unused xhci_plat_resume (struct device *dev)
@@ -446,6 +455,11 @@ static int __maybe_unused xhci_plat_resume(struct device *dev)struct xhci_hcd *xhci =hcd_to_xhci (hcd);int ret; +if (!device_may_wakeup (dev) && (xhci->quirks &XHCI_SUSPEND_RESUME_CLKS )) { +clk_prepare_enable (xhci->clk); +clk_prepare_enable (xhci->reg_clk); + } + ret =xhci_priv_resume_quirk (hcd);if (ret)return ret;
drivers/usb/host/xhci.h +1 -0
@@ -1899,6 +1899,7 @@ struct xhci_hcd {#define XHCI_NO_SOFT_RETRY BIT_ULL(40)#define XHCI_BROKEN_D3COLD BIT_ULL(41)#define XHCI_EP_CTX_BROKEN_DCS BIT_ULL(42) +#define XHCI_SUSPEND_RESUME_CLKS BIT_ULL(43)unsigned int num_active_eps;unsigned int limit_active_eps;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 656/717 usb: host: xhci-plat: suspend/resume clks for brcm
In reply to Greg Kroah-HartmanFrom: Justin Chen <[email protected]>
[ Upstream commit c69400b09e471a3f1167adead55a808f0da6534a ]
The xhci_plat_brcm xhci block can enter suspend with clock disabled to save power and re-enable them on resume. Make use of the XHCI_SUSPEND_RESUME_CLKS quirk to do so.
--- drivers/usb/host/xhci-plat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/host/xhci-plat.c +1 -1
@@ -123,7 +123,7 @@ static const struct xhci_plat_priv xhci_plat_renesas_rcar_gen3 = { };static const struct xhci_plat_priv xhci_plat_brcm = { - .quirks =XHCI_RESET_ON_RESUME , + .quirks =XHCI_RESET_ON_RESUME |XHCI_SUSPEND_RESUME_CLKS , };static const struct of_device_id usb_xhci_of_match[] = {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 657/717 scsi: lpfc: Fix null ndlp ptr dereference in abnormal exit path for GFT_ID
In reply to Greg Kroah-HartmanFrom: James Smart <[email protected]>
[ Upstream commit 59b7e210a522b836a01516c71ee85d1d92c1f075 ]
An error case exit from lpfc_cmpl_ct_cmd_gft_id() results in a call to lpfc_nlp_put() with a null pointer to a nodelist structure.
Changed lpfc_cmpl_ct_cmd_gft_id() to initialize nodelist pointer upon entry.
--- drivers/scsi/lpfc/lpfc_ct.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/scsi/lpfc/lpfc_ct.c +2 -5
@@ -1509,7 +1509,7 @@ lpfc_cmpl_ct_cmd_gft_id(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,struct lpfc_sli_ct_request *CTrsp;int did;struct lpfc_nodelist *ndlp =NULL ; -struct lpfc_nodelist *ns_ndlp =NULL ; +struct lpfc_nodelist *ns_ndlp = cmdiocb->ndlp;uint32_t fc4_data_0, fc4_data_1;u32 ulp_status =get_job_ulpstatus (phba, rspiocb);u32 ulp_word4 =get_job_word4 (phba, rspiocb);
@@ -1522,15 +1522,12 @@ lpfc_cmpl_ct_cmd_gft_id(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, ulp_status, ulp_word4, did);/* Ignore response if link flipped after this request was made */ -if ((uint32_t ) cmdiocb->event_tag != phba->fc_eventTag) { +if ((uint32_t )cmdiocb->event_tag != phba->fc_eventTag) {lpfc_printf_vlog (vport,KERN_INFO ,LOG_DISCOVERY ,"9046 Event tag mismatch. Ignoring NS rsp\n" ); goto out; } -/* Preserve the nameserver node to release the reference. */ - ns_ndlp = cmdiocb->ndlp; -if (ulp_status ==IOSTAT_SUCCESS ) {/* Good status, continue checking */ CTrsp = (struct lpfc_sli_ct_request *)outp->virt;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 658/717 dmaengine: ti: k3-udma: Reset UDMA_CHAN_RT byte counters to prevent overflow
In reply to Greg Kroah-HartmanFrom: Vaishnav Achath <[email protected]>
[ Upstream commit 7c94dcfa8fcff2dba53915f1dabfee49a3df8b88 ]
UDMA_CHAN_RT_*BCNT_REG stores the real-time channel bytecount statistics. These registers are 32-bit hardware counters and the driver uses these counters to monitor the operational progress status for a channel, when transferring more than 4GB of data it was observed that these counters overflow and completion calculation of a operation gets affected and the transfer hangs indefinitely.
This commit adds changes to decrease the byte count for every complete transaction so that these registers never overflow and the proper byte count statistics is maintained for ongoing transaction by the RT counters.
Earlier uc->bcnt used to maintain a count of the completed bytes at driver side, since the RT counters maintain the statistics of current transaction now, the maintenance of uc->bcnt is not necessary.
--- drivers/dma/ti/k3-udma.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-)
drivers/dma/ti/k3-udma.c +17 -8
@@ -300,8 +300,6 @@ struct udma_chan {struct udma_tx_drain tx_drain; -u32 bcnt;/* number of bytes completed since the start of the channel */ -/* Channel configuration parameters */ struct udma_chan_config config;
@@ -757,6 +755,20 @@ static void udma_reset_rings(struct udma_chan *uc) } } +static void udma_decrement_byte_counters (struct udma_chan *uc,u32 val) +{ +if (uc->desc->dir ==DMA_DEV_TO_MEM ) { +udma_rchanrt_write (uc,UDMA_CHAN_RT_BCNT_REG , val); +udma_rchanrt_write (uc,UDMA_CHAN_RT_SBCNT_REG , val); +udma_rchanrt_write (uc,UDMA_CHAN_RT_PEER_BCNT_REG , val); + }else { +udma_tchanrt_write (uc,UDMA_CHAN_RT_BCNT_REG , val); +udma_tchanrt_write (uc,UDMA_CHAN_RT_SBCNT_REG , val); +if (!uc->bchan) +udma_tchanrt_write (uc,UDMA_CHAN_RT_PEER_BCNT_REG , val); + } +} +static void udma_reset_counters (struct udma_chan *uc) {u32 val;
@@ -790,8 +802,6 @@ static void udma_reset_counters(struct udma_chan *uc) val =udma_rchanrt_read (uc,UDMA_CHAN_RT_PEER_BCNT_REG );udma_rchanrt_write (uc,UDMA_CHAN_RT_PEER_BCNT_REG , val); } - - uc->bcnt =0 ; }static int udma_reset_chan (struct udma_chan *uc,bool hard)
@@ -1115,7 +1125,7 @@ static void udma_check_tx_completion(struct work_struct *work)if (uc->desc) {struct udma_desc *d = uc->desc; - uc->bcnt += d->residue; +udma_decrement_byte_counters (uc, d->residue);udma_start (uc);vchan_cookie_complete (&d->vd);break ;
@@ -1168,7 +1178,7 @@ static irqreturn_t udma_ring_irq_handler(int irq, void *data)vchan_cyclic_callback (&d->vd); }else {if (udma_is_desc_really_done (uc, d)) { - uc->bcnt += d->residue; +udma_decrement_byte_counters (uc, d->residue);udma_start (uc);vchan_cookie_complete (&d->vd); }else {
@@ -1204,7 +1214,7 @@ static irqreturn_t udma_udma_irq_handler(int irq, void *data)vchan_cyclic_callback (&d->vd); }else {/* TODO: figure out the real amount of data */ - uc->bcnt += d->residue; +udma_decrement_byte_counters (uc, d->residue);udma_start (uc);vchan_cookie_complete (&d->vd); }
@@ -3809,7 +3819,6 @@ static enum dma_status udma_tx_status(struct dma_chan *chan, bcnt =udma_tchanrt_read (uc,UDMA_CHAN_RT_BCNT_REG ); } - bcnt -= uc->bcnt;if (bcnt && !(bcnt % uc->desc->residue)) residue =0 ;else
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 659/717 scsi: 3w-9xxx: Avoid disabling device if failing to enable it
In reply to Greg Kroah-HartmanFrom: Letu Ren <[email protected]>
[ Upstream commit 7eff437b5ee1309b34667844361c6bbb5c97df05 ]
The original code will "goto out_disable_device" and call pci_disable_device() if pci_enable_device() fails. The kernel will generate a warning message like "3w-9xxx 0000:00:05.0: disabling already-disabled device".
We shouldn't disable a device that failed to be enabled. A simple return is fine.
--- drivers/scsi/3w-9xxx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/3w-9xxx.c +1 -1
@@ -2006,7 +2006,7 @@ static int twa_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id) retval =pci_enable_device (pdev);if (retval) {TW_PRINTK (host,TW_DRIVER ,0x34 ,"Failed to enable pci device" ); - goto out_disable_device; +return -ENODEV ; }pci_set_master (pdev);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 660/717 nbd: Fix hung when signal interrupts nbd_start_device_ioctl()
In reply to Greg Kroah-HartmanFrom: Shigeru Yoshida <[email protected]>
[ Upstream commit 1de7c3cf48fc41cd95adb12bd1ea9033a917798a ]
syzbot reported hung task [1]. The following program is a simplified version of the reproducer:
int main(void)
{
int sv[2], fd;
if (socketpair(AF_UNIX, SOCK_STREAM, 0, sv) < 0)
return 1;
if ((fd = open("/dev/nbd0", 0)) < 0)
return 1;
if (ioctl(fd, NBD_SET_SIZE_BLOCKS, 0x81) < 0)
return 1;
if (ioctl(fd, NBD_SET_SOCK, sv[0]) < 0)
return 1;
if (ioctl(fd, NBD_DO_IT) < 0)
return 1;
return 0;
}When signal interrupt nbd_start_device_ioctl() waiting the condition atomic_read(&config->recv_threads) == 0, the task can hung because it waits the completion of the inflight IOs.
This patch fixes the issue by clearing queue, not just shutdown, when signal interrupt nbd_start_device_ioctl().
--- drivers/block/nbd.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/block/nbd.c +4 -2
@@ -1414,10 +1414,12 @@ static int nbd_start_device_ioctl(struct nbd_device *nbd)mutex_unlock (&nbd->config_lock); ret =wait_event_interruptible (config->recv_wq,atomic_read (&config->recv_threads) ==0 ); -if (ret) +if (ret) {sock_shutdown (nbd); -flush_workqueue (nbd->recv_workq); +nbd_clear_que (nbd); + } +flush_workqueue (nbd->recv_workq);mutex_lock (&nbd->config_lock);nbd_bdev_reset (nbd);/* user requested, ignore socket errors */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 661/717 iommu/arm-smmu-v3: Make default domain type of HiSilicon PTT device to identity
In reply to Greg Kroah-HartmanFrom: Yicong Yang <[email protected]>
[ Upstream commit 24b6c7798a0122012ca848ea0d25e973334266b0 ]
The DMA operations of HiSilicon PTT device can only work properly with identical mappings. So add a quirk for the device to force the domain as passthrough.
--- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +21 -0
@@ -2839,6 +2839,26 @@ static int arm_smmu_dev_disable_feature(struct device *dev, } } +/* +* HiSilicon PCIe tune and trace device can be used to trace TLP headers on the +* PCIe link and save the data to memory by DMA. The hardware is restricted to +* use identity mapping only. +*/ +#define IS_HISI_PTT_DEVICE (pdev) ((pdev)->vendor == PCI_VENDOR_ID_HUAWEI && \ + (pdev)->device == 0xa12e) + +static int arm_smmu_def_domain_type (struct device *dev) +{ +if (dev_is_pci (dev)) { +struct pci_dev *pdev =to_pci_dev (dev); + +if (IS_HISI_PTT_DEVICE (pdev)) +return IOMMU_DOMAIN_IDENTITY ; + } + +return 0 ; +} +static struct iommu_ops arm_smmu_ops = { .capable = arm_smmu_capable, .domain_alloc = arm_smmu_domain_alloc,
@@ -2856,6 +2876,7 @@ static struct iommu_ops arm_smmu_ops = { .sva_unbind = arm_smmu_sva_unbind, .sva_get_pasid = arm_smmu_sva_get_pasid, .page_response = arm_smmu_page_response, + .def_domain_type = arm_smmu_def_domain_type, .pgsize_bitmap = -1UL, /* Restricted during device attach */ .owner = THIS_MODULE, .default_domain_ops = &(const struct iommu_domain_ops ) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 662/717 usb: gadget: uvc: increase worker prio to WQ_HIGHPRI
In reply to Greg Kroah-HartmanFrom: Michael Grzeschik <[email protected]>
[ Upstream commit 9b91a65230784a9ef644b8bdbb82a79ba4ae9456 ]
This patch is changing the simple workqueue in the gadget driver to be allocated as async_wq with a higher priority. The pump worker, that is filling the usb requests, will have a higher priority and will not be scheduled away so often while the video stream is handled. This will lead to fewer streaming underruns.
--- drivers/usb/gadget/function/f_uvc.c | 4 ++++ drivers/usb/gadget/function/uvc.h | 1 + drivers/usb/gadget/function/uvc_v4l2.c | 2 +- drivers/usb/gadget/function/uvc_video.c | 9 +++++++-- 4 files changed, 13 insertions(+), 3 deletions(-)
drivers/usb/gadget/function/f_uvc.c +4 -0
@@ -897,10 +897,14 @@ static void uvc_function_unbind(struct usb_configuration *c, {struct usb_composite_dev *cdev = c->cdev;struct uvc_device *uvc =to_uvc (f); +struct uvc_video *video = &uvc->video;long wait_ret =1 ;uvcg_info (f,"%s()\n" , __func__); +if (video->async_wq) +destroy_workqueue (video->async_wq); +/* * If we know we're connected via v4l2, then there should be a cleanup * of the device from userspace either via UVC_EVENT_DISCONNECT or
drivers/usb/gadget/function/uvc.h +1 -0
@@ -88,6 +88,7 @@ struct uvc_video {struct usb_ep *ep;struct work_struct pump; +struct workqueue_struct *async_wq;/* Frame parameters */ u8 bpp;
drivers/usb/gadget/function/uvc_v4l2.c +1 -1
@@ -170,7 +170,7 @@ uvc_v4l2_qbuf(struct file *file, void *fh, struct v4l2_buffer *b)return ret;if (uvc->state ==UVC_STATE_STREAMING ) -schedule_work (&video->pump); +queue_work (video->async_wq, &video->pump);return ret; }
drivers/usb/gadget/function/uvc_video.c +7 -2
@@ -277,7 +277,7 @@ uvc_video_complete(struct usb_ep *ep, struct usb_request *req)spin_unlock_irqrestore (&video->req_lock, flags);if (uvc->state ==UVC_STATE_STREAMING ) -schedule_work (&video->pump); +queue_work (video->async_wq, &video->pump); } static int
@@ -485,7 +485,7 @@ int uvcg_video_enable(struct uvc_video *video, int enable) video->req_int_count =0 ; -schedule_work (&video->pump); +queue_work (video->async_wq, &video->pump);return ret; }
@@ -499,6 +499,11 @@ int uvcg_video_init(struct uvc_video *video, struct uvc_device *uvc)spin_lock_init (&video->req_lock);INIT_WORK (&video->pump, uvcg_video_pump); +/* Allocate a work queue for asynchronous video pump handler. */ + video->async_wq =alloc_workqueue ("uvcgadget" ,WQ_UNBOUND |WQ_HIGHPRI ,0 ); +if (!video->async_wq) +return -EINVAL ; + video->uvc = uvc; video->fcc =V4L2_PIX_FMT_YUYV ; video->bpp =16 ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 663/717 power: supply: adp5061: fix out-of-bounds read in adp5061_get_chg_type()
In reply to Greg Kroah-HartmanFrom: Wei Yongjun <[email protected]>
[ Upstream commit 9d47e01b9d807808224347935562f7043a358054 ]
ADP5061_CHG_STATUS_1_CHG_STATUS is masked with 0x07, which means a length of 8, but adp5061_chg_type array size is 4, may end up reading 4 elements beyond the end of the adp5061_chg_type[] array.
--- drivers/power/supply/adp5061.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/power/supply/adp5061.c +3 -3
@@ -427,11 +427,11 @@ static int adp5061_get_chg_type(struct adp5061_state *st,if (ret <0 )return ret; - chg_type = adp5061_chg_type[ADP5061_CHG_STATUS_1_CHG_STATUS (status1)]; -if (chg_type >ADP5061_CHG_FAST_CV ) + chg_type =ADP5061_CHG_STATUS_1_CHG_STATUS (status1); +if (chg_type >=ARRAY_SIZE (adp5061_chg_type)) val->intval =POWER_SUPPLY_STATUS_UNKNOWN ;else - val->intval = chg_type; + val->intval = adp5061_chg_type[chg_type];return ret; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 664/717 staging: vt6655: fix potential memory leak
In reply to Greg Kroah-HartmanFrom: Nam Cao <[email protected]>
[ Upstream commit c8ff91535880d41b49699b3829fb6151942de29e ]
In function device_init_td0_ring, memory is allocated for member td_info of priv->apTD0Rings[i], with i increasing from 0. In case of allocation failure, the memory is freed in reversed order, with i decreasing to 0. However, the case i=0 is left out and thus memory is leaked.
Modify the memory freeing loop to include the case i=0.
--- drivers/staging/vt6655/device_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/vt6655/device_main.c +1 -1
@@ -675,7 +675,7 @@ static int device_init_td0_ring(struct vnt_private *priv)return 0 ; err_free_desc: -while (--i) { +while (i--) { desc = &priv->apTD0Rings[i];kfree (desc->td_info); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 665/717 blk-throttle: prevent overflow while calculating wait time
In reply to Greg Kroah-HartmanFrom: Yu Kuai <[email protected]>
[ Upstream commit 8d6bbaada2e0a65f9012ac4c2506460160e7237a ]
There is a problem found by code review in tg_with_in_bps_limit() that 'bps_limit * jiffy_elapsed_rnd' might overflow. Fix the problem by calling mul_u64_u64_div_u64() instead.
--- block/blk-throttle.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
block/blk-throttle.c +3 -5
@@ -806,7 +806,7 @@ static bool tg_with_in_bps_limit(struct throtl_grp *tg, struct bio *bio, u64 bps_limit, unsigned long *wait) { bool rw = bio_data_dir(bio); -u64 bytes_allowed, extra_bytes, tmp; +u64 bytes_allowed, extra_bytes;unsigned long jiffy_elapsed, jiffy_wait, jiffy_elapsed_rnd;unsigned int bio_size =throtl_bio_data_size (bio);
@@ -824,10 +824,8 @@ static bool tg_with_in_bps_limit(struct throtl_grp *tg, struct bio *bio, jiffy_elapsed_rnd = tg->td->throtl_slice; jiffy_elapsed_rnd =roundup (jiffy_elapsed_rnd, tg->td->throtl_slice); - - tmp = bps_limit * jiffy_elapsed_rnd; -do_div (tmp,HZ ); - bytes_allowed = tmp; + bytes_allowed =mul_u64_u64_div_u64 (bps_limit, (u64 )jiffy_elapsed_rnd, + (u64 )HZ );if (tg->bytes_disp[rw] + bio_size <= bytes_allowed) {if (wait)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 666/717 ata: libahci_platform: Sanity check the DT child nodes number
In reply to Greg Kroah-HartmanFrom: Serge Semin <[email protected]>
[ Upstream commit 3c132ea6508b34956e5ed88d04936983ec230601 ]
Having greater than AHCI_MAX_PORTS (32) ports detected isn't that critical from the further AHCI-platform initialization point of view since exceeding the ports upper limit will cause allocating more resources than will be used afterwards. But detecting too many child DT-nodes doesn't seem right since it's very unlikely to have it on an ordinary platform. In accordance with the AHCI specification there can't be more than 32 ports implemented at least due to having the CAP.NP field of 5 bits wide and the PI register of dword size. Thus if such situation is found the DTB must have been corrupted and the data read from it shouldn't be reliable. Let's consider that as an erroneous situation and halt further resources allocation.
Note it's logically more correct to have the nports set only after the initialization value is checked for being sane. So while at it let's make sure nports is assigned with a correct value.
--- drivers/ata/libahci_platform.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/ata/libahci_platform.c +12 -2
@@ -451,14 +451,24 @@ struct ahci_host_priv *ahci_platform_get_resources(struct platform_device *pdev, } } - hpriv->nports = child_nodes =of_get_child_count (dev->of_node); +/* +* Too many sub-nodes most likely means having something wrong with +* the firmware. +*/ + child_nodes =of_get_child_count (dev->of_node); +if (child_nodes >AHCI_MAX_PORTS ) { + rc = -EINVAL ; + goto err_out; + }/* * If no sub-node was found, we still need to set nports to * one in order to be able to use the * ahci_platform_[en|dis]able_[phys|regulators] functions. */ -if (!child_nodes) +if (child_nodes) + hpriv->nports = child_nodes; +else hpriv->nports =1 ; hpriv->phys =devm_kcalloc (dev, hpriv->nports,sizeof (*hpriv->phys),GFP_KERNEL );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 667/717 bcache: fix set_at_max_writeback_rate() for multiple attached devices
In reply to Greg Kroah-HartmanFrom: Coly Li <[email protected]>
[ Upstream commit d2d05b88035d2d51a5bb6c5afec88a0880c73df4 ]
Inside set_at_max_writeback_rate() the calculation in following if() check is wrong,
if (atomic_inc_return(&c->idle_counter) < atomic_read(&c->attached_dev_nr) * 6)
Because each attached backing device has its own writeback thread running and increasing c->idle_counter, the counter increates much faster than expected. The correct calculation should be,
(counter / dev_nr) < dev_nr * 6
which equals to,
counter < dev_nr * dev_nr * 6
This patch fixes the above mistake with correct calculation, and helper routine idle_counter_exceeded() is added to make code be more clear.
--- drivers/md/bcache/writeback.c | 73 +++++++++++++++++++++++++---------- 1 file changed, 52 insertions(+), 21 deletions(-)
drivers/md/bcache/writeback.c +52 -21
@@ -157,6 +157,53 @@ static void __update_writeback_rate(struct cached_dev *dc) dc->writeback_rate_target = target; } +static bool idle_counter_exceeded (struct cache_set *c) +{ +int counter, dev_nr; + +/* +* If c->idle_counter is overflow (idel for really long time), +* reset as 0 and not set maximum rate this time for code +* simplicity. +*/ + counter =atomic_inc_return (&c->idle_counter); +if (counter <=0 ) { +atomic_set (&c->idle_counter,0 ); +return false; + } + + dev_nr =atomic_read (&c->attached_dev_nr); +if (dev_nr ==0 ) +return false; + +/* +* c->idle_counter is increased by writeback thread of all +* attached backing devices, in order to represent a rough +* time period, counter should be divided by dev_nr. +* Otherwise the idle time cannot be larger with more backing +* device attached. +* The following calculation equals to checking +* (counter / dev_nr) < (dev_nr * 6) +*/ +if (counter < (dev_nr * dev_nr *6 )) +return false; + +return true; +} + +/* +* Idle_counter is increased every time when update_writeback_rate() is +* called. If all backing devices attached to the same cache set have +* identical dc->writeback_rate_update_seconds values, it is about 6 +* rounds of update_writeback_rate() on each backing device before +* c->at_max_writeback_rate is set to 1, and then max wrteback rate set +* to each dc->writeback_rate.rate. +* In order to avoid extra locking cost for counting exact dirty cached +* devices number, c->attached_dev_nr is used to calculate the idle +* throushold. It might be bigger if not all cached device are in write- +* back mode, but it still works well with limited extra rounds of +* update_writeback_rate(). +*/ static bool set_at_max_writeback_rate (struct cache_set *c,struct cached_dev *dc) {
@@ -167,21 +214,8 @@ static bool set_at_max_writeback_rate(struct cache_set *c,/* Don't set max writeback rate if gc is running */ if (!c->gc_mark_valid)return false; -/* -* Idle_counter is increased everytime when update_writeback_rate() is -* called. If all backing devices attached to the same cache set have -* identical dc->writeback_rate_update_seconds values, it is about 6 -* rounds of update_writeback_rate() on each backing device before -* c->at_max_writeback_rate is set to 1, and then max wrteback rate set -* to each dc->writeback_rate.rate. -* In order to avoid extra locking cost for counting exact dirty cached -* devices number, c->attached_dev_nr is used to calculate the idle -* throushold. It might be bigger if not all cached device are in write- -* back mode, but it still works well with limited extra rounds of -* update_writeback_rate(). -*/ -if (atomic_inc_return (&c->idle_counter) < -atomic_read (&c->attached_dev_nr) *6 ) + +if (!idle_counter_exceeded (c))return false;if (atomic_read (&c->at_max_writeback_rate) !=1 )
@@ -195,13 +229,10 @@ static bool set_at_max_writeback_rate(struct cache_set *c, dc->writeback_rate_change =0 ;/* -* Check c->idle_counter and c->at_max_writeback_rate agagain in case -* new I/O arrives during before set_at_max_writeback_rate() returns. -* Then the writeback rate is set to 1, and its new value should be -* decided via __update_writeback_rate(). +* In case new I/O arrives during before +* set_at_max_writeback_rate() returns. */ -if ((atomic_read (&c->idle_counter) < -atomic_read (&c->attached_dev_nr) *6 ) || +if (!idle_counter_exceeded (c) || !atomic_read (&c->at_max_writeback_rate))return false;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 668/717 soundwire: cadence: Dont overwrite msg->buf during write commands
In reply to Greg Kroah-HartmanFrom: Richard Fitzgerald <[email protected]>
[ Upstream commit ba05b39d265bdd16913f7684600d9d41e2796745 ]
The buf passed in struct sdw_msg must only be written for a READ, in that case the RDATA part of the response is the data value of the register.
For a write command there is no RDATA, and buf should be assumed to be const and unmodifable. The original caller should not expect its data buffer to be corrupted by an sdw_nwrite().
--- drivers/soundwire/cadence_master.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/soundwire/cadence_master.c +6 -3
@@ -544,9 +544,12 @@ cdns_fill_msg_resp(struct sdw_cdns *cdns,return SDW_CMD_IGNORED ; } -/* fill response */ -for (i =0 ; i < count; i++) - msg->buf[i + offset] =FIELD_GET (CDNS_MCP_RESP_RDATA , cdns->response_buf[i]); +if (msg->flags ==SDW_MSG_FLAG_READ ) { +/* fill response */ +for (i =0 ; i < count; i++) + msg->buf[i + offset] =FIELD_GET (CDNS_MCP_RESP_RDATA , + cdns->response_buf[i]); + }return SDW_CMD_OK ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 669/717 soundwire: intel: fix error handling on dai registration issues
In reply to Greg Kroah-HartmanFrom: Pierre-Louis Bossart <[email protected]>
[ Upstream commit c6867cda906aadbce5e71efde9c78a26108b2bad ]
The call to intel_register_dai() may fail because of memory allocation issues or problems reported by the ASoC core. In all cases, when a error is thrown the component is not registered, it's invalid to unregister it.
--- drivers/soundwire/intel.c | 1 - 1 file changed, 1 deletion(-)
drivers/soundwire/intel.c +0 -1
@@ -1401,7 +1401,6 @@ int intel_link_startup(struct auxiliary_device *auxdev) ret =intel_register_dai (sdw);if (ret) {dev_err (dev,"DAI registration failed: %d\n" , ret); -snd_soc_unregister_component (dev); goto err_interrupt; }
Signature · 1 line
2.35.1
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.19.17 release. There are 717 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Note, this will be the LAST 5.19.y kernel to be released. Please move to the 6.0.y kernel branch at this point in time, as after this is released, this branch will be end-of-life.
Hi Greg, thanks for the patch series, which is out three days after the -rc1 have been pused. As usual, the template message follows.
Successfully cross-compiled for arm64 (bcm2711_defconfig, GCC 10.2.0) and powerpc (ps3_defconfig, GCC 12.1.0).
Signature · 1 line
An old man doll... just what I always wanted! - Clara
Greg Kroah-Hartman
maintainerQuoted 6 lines · Bagas Sanjaya
Quoted 5 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.19.17 release. There are 717 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Quoted 7 lines
Quoted 4 lines
Note, this will be the LAST 5.19.y kernel to be released. Please move to the 6.0.y kernel branch at this point in time, as after this is released, this branch will be end-of-life.
Hi Greg, thanks for the patch series, which is out three days after the -rc1 have been pused. As usual, the template message follows.
What exactly do you mean by "3 days after"?
Are you watching the linux-stable-rc branches? Those are there only for CI systems and are not a "real" -rc release at all until we do this email announcement.
The -rc1 release here does not look at all like what was in the linux-stable-rc branch 3 days ago if you look closely. There are a lot fewer patches now than before, and other changes.
So again, unless you are running a CI system, don't look at the linux-stable-rc branches.
thanks,
greg k-h
Hi!
Quoted 19 lines
Quoted 5 lines
Quoted 5 lines
This is the start of the stable review cycle for the 5.19.17 release. There are 717 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Quoted 7 lines
Quoted 4 lines
Note, this will be the LAST 5.19.y kernel to be released. Please move to the 6.0.y kernel branch at this point in time, as after this is released, this branch will be end-of-life.
Hi Greg, thanks for the patch series, which is out three days after the -rc1 have been pused. As usual, the template message follows.
What exactly do you mean by "3 days after"?
Are you watching the linux-stable-rc branches? Those are there only for CI systems and are not a "real" -rc release at all until we do this email announcement.
Quoted 6 lines
The -rc1 release here does not look at all like what was in the linux-stable-rc branch 3 days ago if you look closely. There are a lot fewer patches now than before, and other changes.
So again, unless you are running a CI system, don't look at the linux-stable-rc branches.
What do you suggest for people trying to review -stable? Two days are not enough to review 500 patches...
Best regards,
Pavel
Signature · 2 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Greg Kroah-Hartman
maintainerQuoted 25 lines · Pavel Machek
Hi!
Quoted 23 lines
Quoted 5 lines
Quoted 5 lines
This is the start of the stable review cycle for the 5.19.17 release. There are 717 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Quoted 7 lines
Quoted 4 lines
Note, this will be the LAST 5.19.y kernel to be released. Please move to the 6.0.y kernel branch at this point in time, as after this is released, this branch will be end-of-life.
Hi Greg, thanks for the patch series, which is out three days after the -rc1 have been pused. As usual, the template message follows.
What exactly do you mean by "3 days after"?
Are you watching the linux-stable-rc branches? Those are there only for CI systems and are not a "real" -rc release at all until we do this email announcement.
The -rc1 release here does not look at all like what was in the linux-stable-rc branch 3 days ago if you look closely. There are a lot fewer patches now than before, and other changes.
Quoted 5 lines
Quoted 2 lines
So again, unless you are running a CI system, don't look at the linux-stable-rc branches.
What do you suggest for people trying to review -stable? Two days are not enough to review 500 patches...
There's 717 patches here, more than 500 :)
Almost all of these have been in the stable queue for a full week now, if not longer. Almost all of these were already in the last 6.0.y review cycle and release also, so you all should have already seen these before, and maintainers have had a chance to weigh in on them.
Kernel development is constantly going faster this year than last year, that's something that has always been the case, so having more patches in stable is also a constant.
Also, there's no requirement that you have to review them all, right? Review the ones that you care about in your subsystems and all is good.
thanks,
greg k-h
Greg Kroah-Hartman
maintainerPATCH 670/717 HID: roccat: Fix use-after-free in roccat_read()
In reply to Greg Kroah-HartmanFrom: Hyunwoo Kim <[email protected]>
[ Upstream commit cacdb14b1c8d3804a3a7d31773bc7569837b71a4 ]
roccat_report_event() is responsible for registering roccat-related reports in struct roccat_device.
int roccat_report_event(int minor, u8 const *data)
{
struct roccat_device *device;
struct roccat_reader *reader;
struct roccat_report *report;
uint8_t *new_value;
device = devices[minor];
new_value = kmemdup(data, device->report_size, GFP_ATOMIC);
if (!new_value)
return -ENOMEM;
report = &device->cbuf[device->cbuf_end];
/* passing NULL is safe */
kfree(report->value);
...The registered report is stored in the struct roccat_device member "struct roccat_report cbuf[ROCCAT_CBUF_SIZE];".
If more reports are received than the "ROCCAT_CBUF_SIZE" value, kfree() the saved report from cbuf[0] and allocates a new reprot. Since there is no lock when this kfree() is performed, kfree() can be performed even while reading the saved report.
static ssize_t roccat_read(struct file *file, char __user *buffer,
size_t count, loff_t *ppos)
{
struct roccat_reader *reader = file->private_data;
struct roccat_device *device = reader->device;
struct roccat_report *report;
ssize_t retval = 0, len;
DECLARE_WAITQUEUE(wait, current);
mutex_lock(&device->cbuf_lock);
...
report = &device->cbuf[reader->cbuf_start];
/*
* If report is larger than requested amount of data, rest of report
* is lost!
*/
len = device->report_size > count ? count : device->report_size;
if (copy_to_user(buffer, report->value, len)) {
retval = -EFAULT;
goto exit_unlock;
}
...The roccat_read() function receives the device->cbuf report and delivers it to the user through copy_to_user().
If the N+ROCCAT_CBUF_SIZE th report is received while copying of the Nth report->value is in progress, the pointer that copy_to_user() is working on is kfree()ed and UAF read may occur. (race condition)
Since the device node of this driver does not set separate permissions, this is not a security vulnerability, but because it is used for requesting screen display of profile or dpi settings,
a user using the roccat device can apply udev to this device node or There is a possibility to use it by giving.
--- drivers/hid/hid-roccat.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/hid/hid-roccat.c +4 -0
@@ -257,6 +257,8 @@ int roccat_report_event(int minor, u8 const *data)if (!new_value)return -ENOMEM ; +mutex_lock (&device->cbuf_lock); + report = &device->cbuf[device->cbuf_end];/* passing NULL is safe */
@@ -276,6 +278,8 @@ int roccat_report_event(int minor, u8 const *data) reader->cbuf_start = (reader->cbuf_start +1 ) %ROCCAT_CBUF_SIZE ; } +mutex_unlock (&device->cbuf_lock); +wake_up_interruptible (&device->wait);return 0 ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 671/717 HSI: ssi_protocol: fix potential resource leak in ssip_pn_open()
In reply to Greg Kroah-HartmanFrom: Jianglei Nie <[email protected]>
[ Upstream commit b28dbcb379e6a7f80262c2732a57681b1ee548ca ]
ssip_pn_open() claims the HSI client's port with hsi_claim_port(). When hsi_register_port_event() gets some error and returns a negetive value, the HSI client's port should be released with hsi_release_port().
Fix it by calling hsi_release_port() when hsi_register_port_event() fails.
--- drivers/hsi/clients/ssi_protocol.c | 1 + 1 file changed, 1 insertion(+)
drivers/hsi/clients/ssi_protocol.c +1 -0
@@ -931,6 +931,7 @@ static int ssip_pn_open(struct net_device *dev)if (err <0 ) {dev_err (&cl->device,"Register HSI port event failed (%d)\n" , err); +hsi_release_port (cl);return err; }dev_dbg (&cl->device,"Configuring SSI port\n" );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 672/717 HID: nintendo: check analog user calibration for plausibility
In reply to Greg Kroah-HartmanFrom: Johnothan King <[email protected]>
[ Upstream commit 50503e360eeb968a3d00234c9cc4057d774c3e9a ]
Arne Wendt writes:
Cheap clone controllers may (falsely) report as having a user calibration for the analog sticks in place, but return wrong/impossible values for the actual calibration data. In the present case at mine, the controller reports having a user calibration in place and successfully executes the read commands. The reported user calibration however is min = center = max = 0.
This pull request addresses problems of this kind by checking the provided user calibration-data for plausibility (min < center < max) and falling back to the default values if implausible.
I'll note that I was experiencing a crash because of this bug when using the GuliKit KingKong 2 controller. The crash manifests as a divide by zero error in the kernel logs:
kernel: divide error: 0000 [#1] PREEMPT SMP NOPTI
--- drivers/hid/hid-nintendo.c | 55 +++++++++++++++++++++----------------- 1 file changed, 30 insertions(+), 25 deletions(-)
drivers/hid/hid-nintendo.c +30 -25
@@ -761,12 +761,31 @@ static int joycon_read_stick_calibration(struct joycon_ctlr *ctlr, u16 cal_addr, cal_y->max = cal_y->center + y_max_above; cal_y->min = cal_y->center - y_min_below; -return 0 ; +/* check if calibration values are plausible */ +if (cal_x->min >= cal_x->center || cal_x->center >= cal_x->max || + cal_y->min >= cal_y->center || cal_y->center >= cal_y->max) + ret = -EINVAL ; + +return ret; }static const u16 DFLT_STICK_CAL_CEN =2000 ;static const u16 DFLT_STICK_CAL_MAX =3500 ;static const u16 DFLT_STICK_CAL_MIN =500 ; +static void joycon_use_default_calibration (struct hid_device *hdev, +struct joycon_stick_cal *cal_x, +struct joycon_stick_cal *cal_y, +const char *stick,int ret) +{ +hid_warn (hdev, +"Failed to read %s stick cal, using defaults; e=%d\n" , + stick, ret); + + cal_x->center = cal_y->center =DFLT_STICK_CAL_CEN ; + cal_x->max = cal_y->max =DFLT_STICK_CAL_MAX ; + cal_x->min = cal_y->min =DFLT_STICK_CAL_MIN ; +} +static int joycon_request_calibration (struct joycon_ctlr *ctlr) {u16 left_stick_addr =JC_CAL_FCT_DATA_LEFT_ADDR ;
@@ -794,38 +813,24 @@ static int joycon_request_calibration(struct joycon_ctlr *ctlr) &ctlr->left_stick_cal_x, &ctlr->left_stick_cal_y, true); -if (ret) { -hid_warn (ctlr->hdev, -"Failed to read left stick cal, using dflts; e=%d\n" , - ret); - - ctlr->left_stick_cal_x.center =DFLT_STICK_CAL_CEN ; - ctlr->left_stick_cal_x.max =DFLT_STICK_CAL_MAX ; - ctlr->left_stick_cal_x.min =DFLT_STICK_CAL_MIN ; - ctlr->left_stick_cal_y.center =DFLT_STICK_CAL_CEN ; - ctlr->left_stick_cal_y.max =DFLT_STICK_CAL_MAX ; - ctlr->left_stick_cal_y.min =DFLT_STICK_CAL_MIN ; - } +if (ret) +joycon_use_default_calibration (ctlr->hdev, + &ctlr->left_stick_cal_x, + &ctlr->left_stick_cal_y, +"left" , ret);/* read the right stick calibration data */ ret =joycon_read_stick_calibration (ctlr, right_stick_addr, &ctlr->right_stick_cal_x, &ctlr->right_stick_cal_y, false); -if (ret) { -hid_warn (ctlr->hdev, -"Failed to read right stick cal, using dflts; e=%d\n" , - ret); - - ctlr->right_stick_cal_x.center =DFLT_STICK_CAL_CEN ; - ctlr->right_stick_cal_x.max =DFLT_STICK_CAL_MAX ; - ctlr->right_stick_cal_x.min =DFLT_STICK_CAL_MIN ; - ctlr->right_stick_cal_y.center =DFLT_STICK_CAL_CEN ; - ctlr->right_stick_cal_y.max =DFLT_STICK_CAL_MAX ; - ctlr->right_stick_cal_y.min =DFLT_STICK_CAL_MIN ; - } +if (ret) +joycon_use_default_calibration (ctlr->hdev, + &ctlr->right_stick_cal_x, + &ctlr->right_stick_cal_y, +"right" , ret);hid_dbg (ctlr->hdev,"calibration:\n" "l_x_c=%d l_x_max=%d l_x_min=%d\n"
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 673/717 eventfd: guard wake_up in eventfd fs calls as well
In reply to Greg Kroah-HartmanFrom: Dylan Yudaken <[email protected]>
[ Upstream commit 9f0deaa12d832f488500a5afe9b912e9b3cfc432 ]
Guard wakeups that the user can trigger, and that may end up triggering a call back into eventfd_signal. This is in addition to the current approach that only guards in eventfd_signal.
Rename in_eventfd_signal -> in_eventfd at the same time to reflect this.
Without this there would be a deadlock in the following code using libaio:
int main()
{
struct io_context *ctx = NULL;
struct iocb iocb;
struct iocb *iocbs[] = { &iocb };
int evfd;
uint64_t val = 1;
evfd = eventfd(0, EFD_CLOEXEC);
assert(!io_setup(2, &ctx));
io_prep_poll(&iocb, evfd, POLLIN);
io_set_eventfd(&iocb, evfd);
assert(1 == io_submit(ctx, 1, iocbs));
write(evfd, &val, 8);
}--- fs/eventfd.c | 10 +++++++--- include/linux/eventfd.h | 2 +- include/linux/sched.h | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-)
fs/eventfd.c +7 -3
@@ -69,17 +69,17 @@ __u64 eventfd_signal(struct eventfd_ctx *ctx, __u64 n)* it returns false, the eventfd_signal() call should be deferred to a * safe context. */ -if (WARN_ON_ONCE (current->in_eventfd_signal)) +if (WARN_ON_ONCE (current->in_eventfd))return 0 ;spin_lock_irqsave (&ctx->wqh.lock, flags); - current->in_eventfd_signal =1 ; + current->in_eventfd =1 ;if (ULLONG_MAX - ctx->count < n) n =ULLONG_MAX - ctx->count; ctx->count += n;if (waitqueue_active (&ctx->wqh))wake_up_locked_poll (&ctx->wqh,EPOLLIN ); - current->in_eventfd_signal =0 ; + current->in_eventfd =0 ;spin_unlock_irqrestore (&ctx->wqh.lock, flags);return n;
@@ -253,8 +253,10 @@ static ssize_t eventfd_read(struct kiocb *iocb, struct iov_iter *to)__set_current_state (TASK_RUNNING ); }eventfd_ctx_do_read (ctx, &ucnt); + current->in_eventfd =1 ;if (waitqueue_active (&ctx->wqh))wake_up_locked_poll (&ctx->wqh,EPOLLOUT ); + current->in_eventfd =0 ;spin_unlock_irq (&ctx->wqh.lock);if (unlikely (copy_to_iter (&ucnt,sizeof (ucnt), to) !=sizeof (ucnt)))return -EFAULT ;
@@ -301,8 +303,10 @@ static ssize_t eventfd_write(struct file *file, const char __user *buf, size_t c }if (likely (res >0 )) { ctx->count += ucnt; + current->in_eventfd =1 ;if (waitqueue_active (&ctx->wqh))wake_up_locked_poll (&ctx->wqh,EPOLLIN ); + current->in_eventfd =0 ; }spin_unlock_irq (&ctx->wqh.lock);
include/linux/eventfd.h +1 -1
@@ -46,7 +46,7 @@ void eventfd_ctx_do_read(struct eventfd_ctx *ctx, __u64 *cnt);static inline bool eventfd_signal_allowed (void ) { -return !current->in_eventfd_signal; +return !current->in_eventfd; }#else /* CONFIG_EVENTFD */
include/linux/sched.h +1 -1
@@ -934,7 +934,7 @@ struct task_struct {#endif #ifdef CONFIG_EVENTFD /* Recursion prevention for eventfd_signal() */ - unsigned in_eventfd_signal:1; + unsigned in_eventfd:1;#endif #ifdef CONFIG_IOMMU_SVA unsigned pasid_activated:1;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 674/717 md/raid5: Wait for MD_SB_CHANGE_PENDING in raid5d
In reply to Greg Kroah-HartmanFrom: Logan Gunthorpe <[email protected]>
[ Upstream commit 5e2cf333b7bd5d3e62595a44d598a254c697cd74 ]
A complicated deadlock exists when using the journal and an elevated group_thrtead_cnt. It was found with loop devices, but its not clear whether it can be seen with real disks. The deadlock can occur simply by writing data with an fio script.
When the deadlock occurs, multiple threads will hang in different ways:
1) The group threads will hang in the blk-wbt code with bios waiting to
be submitted to the block layer:
io_schedule+0x70/0xb0
rq_qos_wait+0x153/0x210
wbt_wait+0x115/0x1b0
io_schedule+0x70/0xb0
rq_qos_wait+0x153/0x210
wbt_wait+0x115/0x1b0
__rq_qos_throttle+0x38/0x60
blk_mq_submit_bio+0x589/0xcd0
wbt_wait+0x115/0x1b0
__rq_qos_throttle+0x38/0x60
blk_mq_submit_bio+0x589/0xcd0
__submit_bio+0xe6/0x100
submit_bio_noacct_nocheck+0x42e/0x470
submit_bio_noacct+0x4c2/0xbb0
ops_run_io+0x46b/0x1a30
handle_stripe+0xcd3/0x36b0
handle_active_stripes.constprop.0+0x6f6/0xa60
raid5_do_work+0x177/0x330
Or:
io_schedule+0x70/0xb0
rq_qos_wait+0x153/0x210
wbt_wait+0x115/0x1b0
__rq_qos_throttle+0x38/0x60
blk_mq_submit_bio+0x589/0xcd0
__submit_bio+0xe6/0x100
submit_bio_noacct_nocheck+0x42e/0x470
submit_bio_noacct+0x4c2/0xbb0
flush_deferred_bios+0x136/0x170
raid5_do_work+0x262/0x330 2) The r5l_reclaim thread will hang in the same way, submitting a
bio to the block layer:
io_schedule+0x70/0xb0
rq_qos_wait+0x153/0x210
wbt_wait+0x115/0x1b0
__rq_qos_throttle+0x38/0x60
blk_mq_submit_bio+0x589/0xcd0
__submit_bio+0xe6/0x100
submit_bio_noacct_nocheck+0x42e/0x470
submit_bio_noacct+0x4c2/0xbb0
submit_bio+0x3f/0xf0
md_super_write+0x12f/0x1b0
md_update_sb.part.0+0x7c6/0xff0
md_update_sb+0x30/0x60
r5l_do_reclaim+0x4f9/0x5e0
r5l_reclaim_thread+0x69/0x30b
However, before hanging, the MD_SB_CHANGE_PENDING flag will be
set for sb_flags in r5l_write_super_and_discard_space(). This
flag will never be cleared because the submit_bio() call never
returns. 3) Due to the MD_SB_CHANGE_PENDING flag being set, handle_stripe() will do no processing on any pending stripes and re-set STRIPE_HANDLE. This will cause the raid5d thread to enter an infinite loop, constantly trying to handle the same stripes stuck in the queue.
The raid5d thread has a blk_plug that holds a number of bios that are also stuck waiting seeing the thread is in a loop that never schedules. These bios have been accounted for by blk-wbt thus preventing the other threads above from continuing when they try to submit bios. --Deadlock.
To fix this, add the same wait_event() that is used in raid5_do_work() to raid5d() such that if MD_SB_CHANGE_PENDING is set, the thread will schedule and wait until the flag is cleared. The schedule action will flush the plug which will allow the r5l_reclaim thread to continue, thus preventing the deadlock.
However, md_check_recovery() calls can also clear MD_SB_CHANGE_PENDING from the same thread and can thus deadlock if the thread is put to sleep. So avoid waiting if md_check_recovery() is being called in the loop.
It's not clear when the deadlock was introduced, but the similar wait_event() call in raid5_do_work() was added in 2017 by this commit:
16d997b78b15 ("md/raid5: simplfy delaying of writes while metadata
is updated.")
--- drivers/md/raid5.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/md/raid5.c +12 -0
@@ -36,6 +36,7 @@*/ #include <linux/blkdev.h> +#include <linux/delay.h> #include <linux/kthread.h> #include <linux/raid/pq.h> #include <linux/async_tx.h>
@@ -6552,7 +6553,18 @@ static void raid5d(struct md_thread *thread)spin_unlock_irq (&conf->device_lock);md_check_recovery (mddev);spin_lock_irq (&conf->device_lock); + +/* +* Waiting on MD_SB_CHANGE_PENDING below may deadlock +* seeing md_check_recovery() is needed to clear +* the flag when using mdmon. +*/ +continue ; } + +wait_event_lock_irq (mddev->sb_wait, + !test_bit (MD_SB_CHANGE_PENDING , &mddev->sb_flags), + conf->device_lock); }pr_debug ("%d stripes handled\n" , handled);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 675/717 usb: host: xhci: Fix potential memory leak in xhci_alloc_stream_info()
In reply to Greg Kroah-HartmanFrom: Jianglei Nie <[email protected]>
[ Upstream commit 7e271f42a5cc3768cd2622b929ba66859ae21f97 ]
xhci_alloc_stream_info() allocates stream context array for stream_info ->stream_ctx_array with xhci_alloc_stream_ctx(). When some error occurs, stream_info->stream_ctx_array is not released, which will lead to a memory leak.
We can fix it by releasing the stream_info->stream_ctx_array with xhci_free_stream_ctx() on the error path to avoid the potential memory leak.
--- drivers/usb/host/xhci-mem.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/usb/host/xhci-mem.c +6 -1
@@ -641,7 +641,7 @@ struct xhci_stream_info *xhci_alloc_stream_info(struct xhci_hcd *xhci, num_stream_ctxs, &stream_info->ctx_array_dma, mem_flags);if (!stream_info->stream_ctx_array) - goto cleanup_ctx; + goto cleanup_ring_array;memset (stream_info->stream_ctx_array,0 ,sizeof (struct xhci_stream_ctx )*num_stream_ctxs);
@@ -702,6 +702,11 @@ struct xhci_stream_info *xhci_alloc_stream_info(struct xhci_hcd *xhci, }xhci_free_command (xhci, stream_info->free_streams_command); cleanup_ctx: +xhci_free_stream_ctx (xhci, + stream_info->num_stream_ctxs, + stream_info->stream_ctx_array, + stream_info->ctx_array_dma); +cleanup_ring_array:kfree (stream_info->stream_rings); cleanup_info:kfree (stream_info);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 676/717 usb: musb: Fix musb_gadget.c rxstate overflow bug
In reply to Greg Kroah-HartmanFrom: Robin Guo <[email protected]>
[ Upstream commit eea4c860c3b366369eff0489d94ee4f0571d467d ]
The usb function device call musb_gadget_queue() adds the passed request to musb_ep::req_list,If the (request->length > musb_ep->packet_sz) and (is_buffer_mapped(req) return false),the rxstate() will copy all data in fifo to request->buf which may cause request->buf out of bounds.
Fix it by add the length check :
fifocnt = min_t(unsigned, request->length - request->actual, fifocnt);
--- drivers/usb/musb/musb_gadget.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/usb/musb/musb_gadget.c +3 -0
@@ -760,6 +760,9 @@ static void rxstate(struct musb *musb, struct musb_request *req)musb_writew (epio,MUSB_RXCSR , csr); buffer_aint_mapped: + fifo_count = min_t(unsigned int, + request->length - request->actual, + (unsigned int )fifo_count);musb_read_fifo (musb_ep->hw_ep, fifo_count, (u8 *) (request->buf + request->actual)); request->actual += fifo_count;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 677/717 usb: dwc3: core: add gfladj_refclk_lpm_sel quirk
In reply to Greg Kroah-HartmanFrom: Alexander Stein <[email protected]>
[ Upstream commit a6fc2f1b092787e9d7dbe472d720cede81680315 ]
This selects the SOF/ITP counter be running on ref_clk. As documented U2_FREECLK_EXISTS has to be set to 0 as well.
--- drivers/usb/dwc3/core.c | 8 +++++++- drivers/usb/dwc3/core.h | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-)
drivers/usb/dwc3/core.c +7 -1
@@ -407,6 +407,10 @@ static void dwc3_ref_clk_period(struct dwc3 *dwc) reg |=FIELD_PREP (DWC3_GFLADJ_REFCLK_FLADJ_MASK , fladj) |FIELD_PREP (DWC3_GFLADJ_240MHZDECR , decr >>1 ) |FIELD_PREP (DWC3_GFLADJ_240MHZDECR_PLS1 , decr &1 ); + +if (dwc->gfladj_refclk_lpm_sel) + reg |=DWC3_GFLADJ_REFCLK_LPM_SEL ; +dwc3_writel (dwc->regs,DWC3_GFLADJ , reg); }
@@ -788,7 +792,7 @@ static int dwc3_phy_setup(struct dwc3 *dwc)else reg |=DWC3_GUSB2PHYCFG_ENBLSLPM ; -if (dwc->dis_u2_freeclk_exists_quirk) +if (dwc->dis_u2_freeclk_exists_quirk || dwc->gfladj_refclk_lpm_sel) reg &= ~DWC3_GUSB2PHYCFG_U2_FREECLK_EXISTS ;dwc3_writel (dwc->regs,DWC3_GUSB2PHYCFG (0 ), reg);
@@ -1490,6 +1494,8 @@ static void dwc3_get_properties(struct dwc3 *dwc) "snps,dis-tx-ipgap-linecheck-quirk"); dwc->parkmode_disable_ss_quirk =device_property_read_bool (dev,"snps,parkmode-disable-ss-quirk" ); + dwc->gfladj_refclk_lpm_sel =device_property_read_bool (dev, +"snps,gfladj-refclk-lpm-sel-quirk" ); dwc->tx_de_emphasis_quirk =device_property_read_bool (dev,"snps,tx_de_emphasis_quirk" );
drivers/usb/dwc3/core.h +2 -0
@@ -390,6 +390,7 @@#define DWC3_GFLADJ_30MHZ_SDBND_SEL BIT(7)#define DWC3_GFLADJ_30MHZ_MASK 0x3f#define DWC3_GFLADJ_REFCLK_FLADJ_MASK GENMASK(21, 8) +#define DWC3_GFLADJ_REFCLK_LPM_SEL BIT(23)#define DWC3_GFLADJ_240MHZDECR GENMASK(30, 24)#define DWC3_GFLADJ_240MHZDECR_PLS1 BIT(31)
@@ -1309,6 +1310,7 @@ struct dwc3 { unsigned dis_del_phy_power_chg_quirk:1; unsigned dis_tx_ipgap_linecheck_quirk:1; unsigned parkmode_disable_ss_quirk:1; + unsigned gfladj_refclk_lpm_sel:1; unsigned tx_de_emphasis_quirk:1; unsigned tx_de_emphasis:2;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 678/717 arm64: dts: imx8mp: Add snps,gfladj-refclk-lpm-sel quirk to USB nodes
In reply to Greg Kroah-HartmanFrom: Alexander Stein <[email protected]>
[ Upstream commit 5c3d5ecf48ab06c709c012bf1e8f0c91e1fcd7ad ]
With this set the SOF/ITP counter is based on ref_clk when 2.0 ports are suspended.
snps,dis-u2-freeclk-exists-quirk can be removed as snps,gfladj-refclk-lpm-sel also clears the free running clock configuration bit.
--- arch/arm64/boot/dts/freescale/imx8mp.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/freescale/imx8mp.dtsi +2 -2
@@ -1168,7 +1168,7 @@ interrupts = <GIC_SPI 40 IRQ_TYPE_LEVEL_HIGH>; phys = <&usb3_phy0>, <&usb3_phy0>; phy-names = "usb2-phy", "usb3-phy"; - snps,dis-u2-freeclk-exists-quirk; + snps,gfladj-refclk-lpm-sel-quirk; }; };
@@ -1210,7 +1210,7 @@ interrupts = <GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH>; phys = <&usb3_phy1>, <&usb3_phy1>; phy-names = "usb2-phy", "usb3-phy"; - snps,dis-u2-freeclk-exists-quirk; + snps,gfladj-refclk-lpm-sel-quirk; }; };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 679/717 usb: dwc3: core: Enable GUCTL1 bit 10 for fixing termination error after resume bug
In reply to Greg Kroah-HartmanFrom: Piyush Mehta <[email protected]>
[ Upstream commit 63d7f9810a38102cdb8cad214fac98682081e1a7 ]
When configured in HOST mode, after issuing U3/L2 exit controller fails to send proper CRC checksum in CRC5 field. Because of this behavior Transaction Error is generated, resulting in reset and re-enumeration of usb device attached. Enabling chicken bit 10 of GUCTL1 will correct this problem.
When this bit is set to '1', the UTMI/ULPI opmode will be changed to "normal" along with HS terminations, term, and xcvr signals after EOR. This option is to support certain legacy UTMI/ULPI PHYs.
Added "snps,resume-hs-terminations" quirk to resolved the above issue.
--- drivers/usb/dwc3/core.c | 17 +++++++++++++++++ drivers/usb/dwc3/core.h | 4 ++++ 2 files changed, 21 insertions(+)
drivers/usb/dwc3/core.c +17 -0
@@ -1149,6 +1149,21 @@ static int dwc3_core_init(struct dwc3 *dwc)dwc3_writel (dwc->regs,DWC3_GUCTL2 , reg); } +/* +* When configured in HOST mode, after issuing U3/L2 exit controller +* fails to send proper CRC checksum in CRC5 feild. Because of this +* behaviour Transaction Error is generated, resulting in reset and +* re-enumeration of usb device attached. All the termsel, xcvrsel, +* opmode becomes 0 during end of resume. Enabling bit 10 of GUCTL1 +* will correct this problem. This option is to support certain +* legacy ULPI PHYs. +*/ +if (dwc->resume_hs_terminations) { + reg =dwc3_readl (dwc->regs,DWC3_GUCTL1 ); + reg |=DWC3_GUCTL1_RESUME_OPMODE_HS_HOST ; +dwc3_writel (dwc->regs,DWC3_GUCTL1 , reg); + } + if (!DWC3_VER_IS_PRIOR(DWC3, 250A)) { reg =dwc3_readl (dwc->regs,DWC3_GUCTL1 );
@@ -1492,6 +1507,8 @@ static void dwc3_get_properties(struct dwc3 *dwc) "snps,dis-del-phy-power-chg-quirk"); dwc->dis_tx_ipgap_linecheck_quirk =device_property_read_bool (dev,"snps,dis-tx-ipgap-linecheck-quirk" ); + dwc->resume_hs_terminations =device_property_read_bool (dev, +"snps,resume-hs-terminations" ); dwc->parkmode_disable_ss_quirk =device_property_read_bool (dev,"snps,parkmode-disable-ss-quirk" ); dwc->gfladj_refclk_lpm_sel = device_property_read_bool(dev,
drivers/usb/dwc3/core.h +4 -0
@@ -262,6 +262,7 @@#define DWC3_GUCTL1_DEV_FORCE_20_CLK_FOR_30_CLK BIT(26)#define DWC3_GUCTL1_DEV_L1_EXIT_BY_HW BIT(24)#define DWC3_GUCTL1_PARKMODE_DISABLE_SS BIT(17) +#define DWC3_GUCTL1_RESUME_OPMODE_HS_HOST BIT(10)/* Global Status Register */ #define DWC3_GSTS_OTG_IP BIT(10)
@@ -1094,6 +1095,8 @@ struct dwc3_scratchpad_array {* change quirk. * @dis_tx_ipgap_linecheck_quirk: set if we disable u2mac linestate * check during HS transmit. +* @resume-hs-terminations: Set if we enable quirk for fixing improper crc +* generation after resume from suspend. * @parkmode_disable_ss_quirk: set if we need to disable all SuperSpeed * instances in park mode. * @tx_de_emphasis_quirk: set if we enable Tx de-emphasis quirk
@@ -1309,6 +1312,7 @@ struct dwc3 { unsigned dis_u2_freeclk_exists_quirk:1; unsigned dis_del_phy_power_chg_quirk:1; unsigned dis_tx_ipgap_linecheck_quirk:1; + unsigned resume_hs_terminations:1; unsigned parkmode_disable_ss_quirk:1; unsigned gfladj_refclk_lpm_sel:1;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 680/717 Revert "usb: storage: Add quirk for Samsung Fit flash"
In reply to Greg Kroah-HartmanFrom: sunghwan jung <[email protected]>
[ Upstream commit ad5dbfc123e6ffbbde194e2a4603323e09f741ee ]
This reverts commit 86d92f5465958752481269348d474414dccb1552, which fix the timeout issue for "Samsung Fit Flash".
But the commit affects not only "Samsung Fit Flash" but also other usb storages that use the same controller and causes severe performance regression.
# hdparm -t /dev/sda (without the quirk) Timing buffered disk reads: 622 MB in 3.01 seconds = 206.66 MB/sec
# hdparm -t /dev/sda (with the quirk) Timing buffered disk reads: 220 MB in 3.00 seconds = 73.32 MB/sec
The commit author mentioned that "Issue was reproduced after device has bad block", so this quirk should be applied when we have the timeout issue with a device that has bad blocks.
We revert the commit so that we apply this quirk by adding kernel paramters using a bootloader or other ways when we really need it, without the performance regression with devices that don't have the issue.
--- drivers/usb/storage/unusual_devs.h | 6 ------ 1 file changed, 6 deletions(-)
drivers/usb/storage/unusual_devs.h +0 -6
@@ -1275,12 +1275,6 @@ UNUSUAL_DEV( 0x090a, 0x1200, 0x0000, 0x9999, USB_SC_RBC, USB_PR_BULK, NULL, 0 ), -UNUSUAL_DEV (0x090c ,0x1000 ,0x1100 ,0x1100 , -"Samsung" , -"Flash Drive FIT" , -USB_SC_DEVICE ,USB_PR_DEVICE ,NULL , -US_FL_MAX_SECTORS_64 ), -/* aeb */ UNUSUAL_DEV( 0x090c, 0x1132, 0x0000, 0xffff, "Feiya",
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 681/717 staging: rtl8723bs: fix potential memory leak in rtw_init_drv_sw()
In reply to Greg Kroah-HartmanFrom: Xiaoke Wang <[email protected]>
[ Upstream commit 5a5aa9cce621e2c0e25a1e5d72d6be1749167cc0 ]
In rtw_init_drv_sw(), there are various init functions are called to populate the padapter structure and some checks for their return value. However, except for the first one error path, the other five error paths do not properly release the previous allocated resources, which leads to various memory leaks.
This patch fixes them and keeps the success and error separate. Note that these changes keep the form of rtw_init_drv_sw() in "drivers/staging/r8188eu/os_dep/os_intfs.c". As there is no proper device to test with, no runtime testing was performed.
--- drivers/staging/rtl8723bs/os_dep/os_intfs.c | 60 +++++++++++---------- 1 file changed, 31 insertions(+), 29 deletions(-)
drivers/staging/rtl8723bs/os_dep/os_intfs.c +31 -29
@@ -664,51 +664,36 @@ void rtw_reset_drv_sw(struct adapter *padapter)u8 rtw_init_drv_sw (struct adapter *padapter) { -u8 ret8 = _SUCCESS; -rtw_init_default_value (padapter);rtw_init_hal_com_default_value (padapter); -if (rtw_init_cmd_priv (&padapter->cmdpriv)) { - ret8 = _FAIL; - goto exit; - } +if (rtw_init_cmd_priv (&padapter->cmdpriv)) +return _FAIL; padapter->cmdpriv.padapter = padapter; -if (rtw_init_evt_priv (&padapter->evtpriv)) { - ret8 = _FAIL; - goto exit; - } +if (rtw_init_evt_priv (&padapter->evtpriv)) + goto free_cmd_priv; - -if (rtw_init_mlme_priv (padapter) == _FAIL) { - ret8 = _FAIL; - goto exit; - } +if (rtw_init_mlme_priv (padapter) == _FAIL) + goto free_evt_priv;init_mlme_ext_priv (padapter); -if (_rtw_init_xmit_priv (&padapter->xmitpriv, padapter) == _FAIL) { - ret8 = _FAIL; - goto exit; - } +if (_rtw_init_xmit_priv (&padapter->xmitpriv, padapter) == _FAIL) + goto free_mlme_ext; -if (_rtw_init_recv_priv (&padapter->recvpriv, padapter) == _FAIL) { - ret8 = _FAIL; - goto exit; - } +if (_rtw_init_recv_priv (&padapter->recvpriv, padapter) == _FAIL) + goto free_xmit_priv;/* add for CONFIG_IEEE80211W, none 11w also can use */ spin_lock_init (&padapter->security_key_mutex);/* We don't need to memset padapter->XXX to zero, because adapter is allocated by vzalloc(). */ /* memset((unsigned char *)&padapter->securitypriv, 0, sizeof (struct security_priv)); */ -if (_rtw_init_sta_priv (&padapter->stapriv) == _FAIL) { - ret8 = _FAIL; - goto exit; - } +if (_rtw_init_sta_priv (&padapter->stapriv) == _FAIL) + goto free_recv_priv; padapter->stapriv.padapter = padapter; padapter->setband =GHZ24_50 ;
@@ -719,9 +704,26 @@ u8 rtw_init_drv_sw(struct adapter *padapter)rtw_hal_dm_init (padapter); -exit: +return _SUCCESS; + +free_recv_priv: +_rtw_free_recv_priv (&padapter->recvpriv); + +free_xmit_priv: +_rtw_free_xmit_priv (&padapter->xmitpriv); + +free_mlme_ext: +free_mlme_ext_priv (&padapter->mlmeextpriv); -return ret8; +rtw_free_mlme_priv (&padapter->mlmepriv); + +free_evt_priv: +rtw_free_evt_priv (&padapter->evtpriv); + +free_cmd_priv: +rtw_free_cmd_priv (&padapter->cmdpriv); + +return _FAIL; }void rtw_cancel_all_timer (struct adapter *padapter)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 682/717 staging: rtl8723bs: fix a potential memory leak in rtw_init_cmd_priv()
In reply to Greg Kroah-HartmanFrom: Xiaoke Wang <[email protected]>
[ Upstream commit 708056fba733a73d926772ea4ce9a42d240345da ]
In rtw_init_cmd_priv(), if pcmdpriv->rsp_allocated_buf is allocated in failure, then pcmdpriv->cmd_allocated_buf will be not properly released. Besides, considering there are only two error paths and the first one can directly return, so we do not need implicitly jump to the exit tag to execute the error handler.
So this patch added kfree(pcmdpriv->cmd_allocated_buf); on the error path to release the resource and simplified the return logic of rtw_init_cmd_priv(). As there is no proper device to test with, no runtime testing was performed.
--- drivers/staging/rtl8723bs/core/rtw_cmd.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-)
drivers/staging/rtl8723bs/core/rtw_cmd.c +6 -10
@@ -161,8 +161,6 @@ static struct cmd_hdl wlancmds[] = {int rtw_init_cmd_priv (struct cmd_priv *pcmdpriv) { -int res =0 ; -init_completion (&pcmdpriv->cmd_queue_comp);init_completion (&pcmdpriv->terminate_cmdthread_comp);
@@ -175,18 +173,16 @@ int rtw_init_cmd_priv(struct cmd_priv *pcmdpriv) pcmdpriv->cmd_allocated_buf =rtw_zmalloc (MAX_CMDSZ +CMDBUFF_ALIGN_SZ ); -if (!pcmdpriv->cmd_allocated_buf) { - res = -ENOMEM ; - goto exit; - } +if (!pcmdpriv->cmd_allocated_buf) +return -ENOMEM ; pcmdpriv->cmd_buf = pcmdpriv->cmd_allocated_buf +CMDBUFF_ALIGN_SZ - ((SIZE_PTR )(pcmdpriv->cmd_allocated_buf) & (CMDBUFF_ALIGN_SZ -1 )); pcmdpriv->rsp_allocated_buf =rtw_zmalloc (MAX_RSPSZ +4 );if (!pcmdpriv->rsp_allocated_buf) { - res = -ENOMEM ; - goto exit; +kfree (pcmdpriv->cmd_allocated_buf); +return -ENOMEM ; } pcmdpriv->rsp_buf = pcmdpriv->rsp_allocated_buf +4 - ((SIZE_PTR )(pcmdpriv->rsp_allocated_buf) &3 );
@@ -196,8 +192,8 @@ int rtw_init_cmd_priv(struct cmd_priv *pcmdpriv) pcmdpriv->rsp_cnt =0 ;mutex_init (&pcmdpriv->sctx_mutex); -exit: -return res; + +return 0 ; }static void c2h_wk_callback (struct work_struct *work);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 683/717 scsi: tracing: Fix compile error in trace_array calls when TRACING is disabled
In reply to Greg Kroah-HartmanFrom: Arun Easi <[email protected]>
[ Upstream commit 1a77dd1c2bb5d4a58c16d198cf593720787c02e4 ]
Fix this compilation error seen when CONFIG_TRACING is not enabled:
drivers/scsi/qla2xxx/qla_os.c: In function 'qla_trace_init':drivers/scsi/qla2xxx/qla_os.c:2854:25: error: implicit declaration of function 'trace_array_get_by_name'; did you mean 'trace_array_set_clr_event'? [-Werror=implicit-function-declaration]
2854 | qla_trc_array = trace_array_get_by_name("qla2xxx");
| ^~~~~~~~~~~~~~~~~~~~~~~
| trace_array_set_clr_eventdrivers/scsi/qla2xxx/qla_os.c: In function 'qla_trace_uninit':drivers/scsi/qla2xxx/qla_os.c:2869:9: error: implicit declaration of function 'trace_array_put' [-Werror=implicit-function-declaration]
2869 | trace_array_put(qla_trc_array);
| ^~~~~~~~~~~~~~~--- include/linux/trace.h | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-)
include/linux/trace.h +34 -2
@@ -2,8 +2,6 @@#ifndef _LINUX_TRACE_H#define _LINUX_TRACE_H -#ifdef CONFIG_TRACING -#define TRACE_EXPORT_FUNCTION BIT(0)#define TRACE_EXPORT_EVENT BIT(1)#define TRACE_EXPORT_MARKER BIT(2)
@@ -28,6 +26,8 @@ struct trace_export {int flags; }; +#ifdef CONFIG_TRACING +int register_ftrace_export (struct trace_export *export);int unregister_ftrace_export (struct trace_export *export);
@@ -48,6 +48,38 @@ void osnoise_arch_unregister(void);void osnoise_trace_irq_entry (int id);void osnoise_trace_irq_exit (int id,const char *desc); +#else /* CONFIG_TRACING */ +static inline int register_ftrace_export (struct trace_export *export) +{ +return -EINVAL ; +} +static inline int unregister_ftrace_export (struct trace_export *export) +{ +return 0 ; +} +static inline void trace_printk_init_buffers (void ) +{ +} +static inline int trace_array_printk (struct trace_array *tr,unsigned long ip, +const char *fmt, ...) +{ +return 0 ; +} +static inline int trace_array_init_printk (struct trace_array *tr) +{ +return -EINVAL ; +} +static inline void trace_array_put (struct trace_array *tr) +{ +} +static inline struct trace_array *trace_array_get_by_name (const char *name) +{ +return NULL ; +} +static inline int trace_array_destroy (struct trace_array *tr) +{ +return 0 ; +}#endif /* CONFIG_TRACING */ #endif /* _LINUX_TRACE_H */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 684/717 ext2: Use kvmalloc() for group descriptor array
In reply to Greg Kroah-HartmanFrom: Jan Kara <[email protected]>
[ Upstream commit e7c7fbb9a8574ebd89cc05db49d806c7476863ad ]
Array of group descriptor block buffers can get rather large. In theory in can reach 1MB for perfectly valid filesystem and even more for maliciously crafted ones. Use kvmalloc() to allocate the array to avoid straining memory allocator with large order allocations unnecessarily.
--- fs/ext2/super.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
fs/ext2/super.c +3 -3
@@ -163,7 +163,7 @@ static void ext2_put_super (struct super_block * sb) db_count = sbi->s_gdb_count;for (i =0 ; i < db_count; i++)brelse (sbi->s_group_desc[i]); -kfree (sbi->s_group_desc); +kvfree (sbi->s_group_desc);kfree (sbi->s_debts);percpu_counter_destroy (&sbi->s_freeblocks_counter);percpu_counter_destroy (&sbi->s_freeinodes_counter);
@@ -1093,7 +1093,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) } db_count = (sbi->s_groups_count +EXT2_DESC_PER_BLOCK (sb) -1 ) /EXT2_DESC_PER_BLOCK (sb); - sbi->s_group_desc =kmalloc_array (db_count, + sbi->s_group_desc =kvmalloc_array (db_count,sizeof (struct buffer_head *),GFP_KERNEL );if (sbi->s_group_desc ==NULL ) {
@@ -1219,7 +1219,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)for (i =0 ; i < db_count; i++)brelse (sbi->s_group_desc[i]); failed_mount_group_desc: -kfree (sbi->s_group_desc); +kvfree (sbi->s_group_desc);kfree (sbi->s_debts); failed_mount:brelse (bh);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 685/717 nvme: handle effects after freeing the request
In reply to Greg Kroah-HartmanFrom: Keith Busch <[email protected]>
[ Upstream commit bc8fb906b0ff9339b4286698cb7cd9cd5b8c53eb ]
If a reset occurs after the scan work attempts to issue a command, the reset may quisce the admin queue, which blocks the scan work's command from dispatching. The scan work will not be able to complete while the queue is quiesced.
Meanwhile, the reset work will cancel all outstanding admin tags and wait until all requests have transitioned to idle, which includes the passthrough request. But the passthrough request won't be set to idle until after the scan_work flushes, so we're deadlocked.
Fix this by handling the end effects after the request has been freed.
--- drivers/nvme/host/core.c | 17 ++++++----------- drivers/nvme/host/ioctl.c | 9 ++++++++- drivers/nvme/host/nvme.h | 4 +++- drivers/nvme/target/passthru.c | 7 ++++++- 4 files changed, 23 insertions(+), 14 deletions(-)
drivers/nvme/host/core.c +6 -11
@@ -1089,8 +1089,8 @@ static u32 nvme_passthru_start(struct nvme_ctrl *ctrl, struct nvme_ns *ns,return effects; } -static void nvme_passthru_end (struct nvme_ctrl *ctrl,u32 effects, -struct nvme_command *cmd,int status) +void nvme_passthru_end (struct nvme_ctrl *ctrl,u32 effects, +struct nvme_command *cmd,int status) {if (effects &NVME_CMD_EFFECTS_CSE_MASK ) {nvme_unfreeze (ctrl);
@@ -1126,21 +1126,16 @@ static void nvme_passthru_end(struct nvme_ctrl *ctrl, u32 effects,break ; } } +EXPORT_SYMBOL_NS_GPL (nvme_passthru_end,NVME_TARGET_PASSTHRU ); -int nvme_execute_passthru_rq (struct request *rq) +int nvme_execute_passthru_rq (struct request *rq,u32 *effects) {struct nvme_command *cmd =nvme_req (rq)->cmd;struct nvme_ctrl *ctrl =nvme_req (rq)->ctrl;struct nvme_ns *ns = rq->q->queuedata; -u32 effects; -int ret; - effects =nvme_passthru_start (ctrl, ns, cmd->common.opcode); - ret =nvme_execute_rq (rq, false); -if (effects)/* nothing to be done for zero cmd effects */ -nvme_passthru_end (ctrl, effects, cmd, ret); - -return ret; + *effects =nvme_passthru_start (ctrl, ns, cmd->common.opcode); +return nvme_execute_rq (rq, false); }EXPORT_SYMBOL_NS_GPL (nvme_execute_passthru_rq,NVME_TARGET_PASSTHRU );
drivers/nvme/host/ioctl.c +8 -1
@@ -136,9 +136,11 @@ static int nvme_submit_user_cmd(struct request_queue *q, unsigned bufflen, void __user *meta_buffer, unsigned meta_len, u32 meta_seed, u64 *result, unsigned timeout, bool vec) { + struct nvme_ctrl *ctrl;struct request *req;void *meta =NULL ;struct bio *bio; +u32 effects;int ret; req = nvme_alloc_user_request(q, cmd, ubuffer, bufflen, meta_buffer,
@@ -147,8 +149,9 @@ static int nvme_submit_user_cmd(struct request_queue *q,return PTR_ERR (req); bio = req->bio; + ctrl =nvme_req (req)->ctrl; - ret =nvme_execute_passthru_rq (req); + ret =nvme_execute_passthru_rq (req, &effects);if (result) *result =le64_to_cpu (nvme_req (req)->result.u64);
@@ -158,6 +161,10 @@ static int nvme_submit_user_cmd(struct request_queue *q,if (bio)blk_rq_unmap_user (bio);blk_mq_free_request (req); + +if (effects) +nvme_passthru_end (ctrl, effects, cmd, ret); +return ret; }
drivers/nvme/host/nvme.h +3 -1
@@ -994,7 +994,9 @@ static inline bool nvme_ctrl_sgl_supported(struct nvme_ctrl *ctrl)u32 nvme_command_effects (struct nvme_ctrl *ctrl,struct nvme_ns *ns,u8 opcode); -int nvme_execute_passthru_rq (struct request *rq); +int nvme_execute_passthru_rq (struct request *rq,u32 *effects); +void nvme_passthru_end (struct nvme_ctrl *ctrl,u32 effects, +struct nvme_command *cmd,int status);struct nvme_ctrl *nvme_ctrl_from_file (struct file *file);struct nvme_ns *nvme_find_get_ns (struct nvme_ctrl *ctrl,unsigned nsid);void nvme_put_ns (struct nvme_ns *ns);
drivers/nvme/target/passthru.c +6 -1
@@ -215,9 +215,11 @@ static void nvmet_passthru_execute_cmd_work(struct work_struct *w) { struct nvmet_req *req = container_of(w, struct nvmet_req, p.work);struct request *rq = req->p.rq; +struct nvme_ctrl *ctrl =nvme_req (rq)->ctrl; +u32 effects;int status; - status =nvme_execute_passthru_rq (rq); + status =nvme_execute_passthru_rq (rq, &effects);if (status ==NVME_SC_SUCCESS && req->cmd->common.opcode == nvme_admin_identify) {
@@ -238,6 +240,9 @@ static void nvmet_passthru_execute_cmd_work(struct work_struct *w) req->cqe->result =nvme_req (rq)->result;nvmet_req_complete (req, status);blk_mq_free_request (rq); + +if (effects) +nvme_passthru_end (ctrl, effects, req->cmd, status); } static void nvmet_passthru_req_done(struct request *rq,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 686/717 nvme: copy firmware_rev on each init
In reply to Greg Kroah-HartmanFrom: Keith Busch <[email protected]>
[ Upstream commit a8eb6c1ba48bddea82e8d74cbe6e119f006be97d ]
The firmware revision can change on after a reset so copy the most recent info each time instead of just the first time, otherwise the sysfs firmware_rev entry may contain stale data.
--- drivers/nvme/host/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/nvme/host/core.c +2 -1
@@ -2796,7 +2796,6 @@ static int nvme_init_subsystem(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id)nvme_init_subnqn (subsys, ctrl, id);memcpy (subsys->serial, id->sn,sizeof (subsys->serial));memcpy (subsys->model, id->mn,sizeof (subsys->model)); -memcpy (subsys->firmware_rev, id->fr,sizeof (subsys->firmware_rev)); subsys->vendor_id =le16_to_cpu (id->vid); subsys->cmic = id->cmic;
@@ -3015,6 +3014,8 @@ static int nvme_init_identify(struct nvme_ctrl *ctrl) ctrl->quirks |= core_quirks[i].quirks; } } +memcpy (ctrl->subsys->firmware_rev, id->fr, +sizeof (ctrl->subsys->firmware_rev));if (force_apst && (ctrl->quirks &NVME_QUIRK_NO_DEEPEST_PS )) {dev_warn (ctrl->device,"forcibly allowing all power states due to nvme_core.force_apst -- use at your own risk\n" );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 687/717 nvmet-tcp: add bounds check on Transfer Tag
In reply to Greg Kroah-HartmanFrom: Varun Prakash <[email protected]>
[ Upstream commit b6a545ffa2c192b1e6da4a7924edac5ba9f4ea2b ]
ttag is used as an index to get cmd in nvmet_tcp_handle_h2c_data_pdu(), add a bounds check to avoid out-of-bounds access.
--- drivers/nvme/target/tcp.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/nvme/target/tcp.c +9 -2
@@ -935,10 +935,17 @@ static int nvmet_tcp_handle_h2c_data_pdu(struct nvmet_tcp_queue *queue)struct nvme_tcp_data_pdu *data = &queue->pdu.data;struct nvmet_tcp_cmd *cmd; -if (likely (queue->nr_cmds)) +if (likely (queue->nr_cmds)) { +if (unlikely (data->ttag >= queue->nr_cmds)) { +pr_err ("queue %d: received out of bound ttag %u, nr_cmds %u\n" , + queue->idx, data->ttag, queue->nr_cmds); +nvmet_tcp_fatal_error (queue); +return -EPROTO ; + } cmd = &queue->cmds[data->ttag]; -else + }else { cmd = &queue->connect; + }if (le32_to_cpu (data->data_offset) != cmd->rbytes_done) { pr_err("ttag %u unexpected data offset %u (expected %u)\n",
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 688/717 usb: idmouse: fix an uninit-value in idmouse_open
In reply to Greg Kroah-HartmanFrom: Dongliang Mu <[email protected]>
[ Upstream commit bce2b0539933e485d22d6f6f076c0fcd6f185c4c ]
In idmouse_create_image, if any ftip_command fails, it will go to the reset label. However, this leads to the data in bulk_in_buffer[HEADER..IMGSIZE] uninitialized. And the check for valid image incurs an uninitialized dereference.
Fix this by moving the check before reset label since this check only be valid if the data after bulk_in_buffer[HEADER] has concrete data.
Note that this is found by KMSAN, so only kernel compilation is tested.
--- drivers/usb/misc/idmouse.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/usb/misc/idmouse.c +4 -4
@@ -177,10 +177,6 @@ static int idmouse_create_image(struct usb_idmouse *dev) bytes_read += bulk_read; } -/* reset the device */ -reset: -ftip_command (dev,FTIP_RELEASE ,0 ,0 ); -/* check for valid image */ /* right border should be black (0x00) */ for (bytes_read =sizeof (HEADER )-1 +WIDTH -1 ; bytes_read <IMGSIZE ; bytes_read +=WIDTH )
@@ -192,6 +188,10 @@ static int idmouse_create_image(struct usb_idmouse *dev)if (dev->bulk_in_buffer[bytes_read] !=0xFF )return -EAGAIN ; +/* reset the device */ +reset: +ftip_command (dev,FTIP_RELEASE ,0 ,0 ); +/* should be IMGSIZE == 65040 */ dev_dbg (&dev->interface->dev,"read %d bytes fingerprint data\n" , bytes_read);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 689/717 blk-mq: use quiesced elevator switch when reinitializing queues
In reply to Greg Kroah-HartmanFrom: Keith Busch <[email protected]>
[ Upstream commit 8237c01f1696bc53c470493bf1fe092a107648a6 ]
The hctx's run_work may be racing with the elevator switch when reinitializing hardware queues. The queue is merely frozen in this context, but that only prevents requests from allocating and doesn't stop the hctx work from running. The work may get an elevator pointer that's being torn down, and can result in use-after-free errors and kernel panics (example below). Use the quiesced elevator switch instead, and make the previous one static since it is now only used locally.
nvme nvme0: resetting controller
nvme nvme0: 32/0/0 default/read/poll queues
BUG: kernel NULL pointer dereference, address: 0000000000000008 #PF: supervisor read access in kernel mode #PF: error_code(0x0000) - not-present page PGD 80000020c8861067 P4D 80000020c8861067 PUD 250f8c8067 PMD 0 Oops: 0000 [#1] SMP PTI Workqueue: kblockd blk_mq_run_work_fn RIP: 0010:kyber_has_work+0x29/0x70
...
Call Trace: __blk_mq_do_dispatch_sched+0x83/0x2b0 __blk_mq_sched_dispatch_requests+0x12e/0x170 blk_mq_sched_dispatch_requests+0x30/0x60 __blk_mq_run_hw_queue+0x2b/0x50 process_one_work+0x1ef/0x380 worker_thread+0x2d/0x3e0
--- block/blk-mq.c | 6 +++--- block/blk.h | 3 +-- block/elevator.c | 4 ++-- 3 files changed, 6 insertions(+), 7 deletions(-)
block/blk-mq.c +3 -3
@@ -4481,14 +4481,14 @@ static bool blk_mq_elv_switch_none(struct list_head *head,list_add (&qe->node, head);/* -* After elevator_switch_mq, the previous elevator_queue will be +* After elevator_switch, the previous elevator_queue will be * released by elevator_release. The reference of the io scheduler * module get by elevator_get will also be put. So we need to get * a reference of the io scheduler module here to prevent it to be * removed. */ __module_get (qe->type->elevator_owner); -elevator_switch_mq (q,NULL ); +elevator_switch (q,NULL );mutex_unlock (&q->sysfs_lock);return true;
@@ -4520,7 +4520,7 @@ static void blk_mq_elv_switch_back(struct list_head *head,kfree (qe);mutex_lock (&q->sysfs_lock); -elevator_switch_mq (q, t); +elevator_switch (q, t);mutex_unlock (&q->sysfs_lock); }
block/blk.h +1 -2
@@ -260,8 +260,7 @@ bool blk_bio_list_merge(struct request_queue *q, struct list_head *list,void blk_insert_flush (struct request *rq); -int elevator_switch_mq (struct request_queue *q, -struct elevator_type *new_e); +int elevator_switch (struct request_queue *q,struct elevator_type *new_e);void elevator_exit (struct request_queue *q);int elv_register_queue (struct request_queue *q,bool uevent);void elv_unregister_queue (struct request_queue *q);
block/elevator.c +2 -2
@@ -588,7 +588,7 @@ void elv_unregister(struct elevator_type *e) }EXPORT_SYMBOL_GPL (elv_unregister); -int elevator_switch_mq (struct request_queue *q, +static int elevator_switch_mq (struct request_queue *q,struct elevator_type *new_e) {int ret;
@@ -723,7 +723,7 @@ void elevator_init_mq(struct request_queue *q)* need for the new one. this way we have a chance of going back to the old * one, if the new one fails init for some reason. */ -static int elevator_switch (struct request_queue *q,struct elevator_type *new_e) +int elevator_switch (struct request_queue *q,struct elevator_type *new_e) {int err;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 690/717 hwmon (occ): Retry for checksum failure
In reply to Greg Kroah-HartmanFrom: Eddie James <[email protected]>
[ Upstream commit dbed963ed62c4c2b8870a02c8b7dcb0c2af3ee0b ]
Due to the OCC communication design with a shared SRAM area, checkum errors are expected due to corrupted buffer from OCC communications with other system components. Therefore, retry the command twice in the event of a checksum failure.
--- drivers/hwmon/occ/p9_sbe.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)
drivers/hwmon/occ/p9_sbe.c +12 -5
@@ -14,6 +14,8 @@#include "common.h" +#define OCC_CHECKSUM_RETRIES 3 +struct p9_sbe_occ {struct occ occ;bool sbe_error;
@@ -81,18 +83,23 @@ static bool p9_sbe_occ_save_ffdc(struct p9_sbe_occ *ctx, const void *resp,static int p9_sbe_occ_send_cmd (struct occ *occ,u8 *cmd,size_t len,void *resp,size_t resp_len) { +size_t original_resp_len = resp_len;struct p9_sbe_occ *ctx =to_p9_sbe_occ (occ); -int rc; +int rc, i; - rc =fsi_occ_submit (ctx->sbe, cmd, len, resp, &resp_len); -if (rc <0 ) { +for (i =0 ; i <OCC_CHECKSUM_RETRIES ; ++i) { + rc =fsi_occ_submit (ctx->sbe, cmd, len, resp, &resp_len); +if (rc >=0 ) +break ;if (resp_len) {if (p9_sbe_occ_save_ffdc (ctx, resp, resp_len))sysfs_notify (&occ->bus_dev->kobj,NULL , bin_attr_ffdc.attr.name); +return rc; } - -return rc; +if (rc != -EBADE ) +return rc; + resp_len = original_resp_len; }switch (((struct occ_response *)resp)->return_status) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 691/717 fsi: occ: Prevent use after free
In reply to Greg Kroah-HartmanFrom: Eddie James <[email protected]>
[ Upstream commit d3e1e24604031b0d83b6c2d38f54eeea265cfcc0 ]
Use get_device and put_device in the open and close functions to make sure the device doesn't get freed while a file descriptor is open.
Also, lock around the freeing of the device buffer and check the buffer before using it in the submit function.
--- drivers/fsi/fsi-occ.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)
drivers/fsi/fsi-occ.c +15 -3
@@ -94,6 +94,7 @@ static int occ_open(struct inode *inode, struct file *file) client->occ = occ;mutex_init (&client->lock); file->private_data = client; +get_device (occ->dev);/* We allocate a 1-page buffer, make sure it all fits */ BUILD_BUG_ON ((OCC_CMD_DATA_BYTES +3 ) >PAGE_SIZE );
@@ -197,6 +198,7 @@ static int occ_release(struct inode *inode, struct file *file) {struct occ_client *client = file->private_data; +put_device (client->occ->dev);free_page ((unsigned long )client->buffer);kfree (client);
@@ -493,12 +495,19 @@ int fsi_occ_submit(struct device *dev, const void *request, size_t req_len,for (i =1 ; i < req_len -2 ; ++i) checksum += byte_request[i]; -mutex_lock (&occ->occ_lock); + rc =mutex_lock_interruptible (&occ->occ_lock); +if (rc) +return rc; occ->client_buffer = response; occ->client_buffer_size = user_resp_len; occ->client_response_size =0 ; +if (!occ->buffer) { + rc = -ENOENT ; + goto done; + } +/* * Get a sequence number and update the counter. Avoid a sequence * number of 0 which would pass the response check below even if the
@@ -671,10 +680,13 @@ static int occ_remove(struct platform_device *pdev) {struct occ *occ =platform_get_drvdata (pdev); -kvfree (occ->buffer); -misc_deregister (&occ->mdev); +mutex_lock (&occ->occ_lock); +kvfree (occ->buffer); + occ->buffer =NULL ; +mutex_unlock (&occ->occ_lock); +device_for_each_child (&pdev->dev,NULL , occ_unregister_child);ida_simple_remove (&occ_ida, occ->idx);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 692/717 fsi: master-ast-cf: Fix missing of_node_put in fsi_master_acf_probe
In reply to Greg Kroah-HartmanFrom: Lv Ruyi <[email protected]>
[ Upstream commit 182d98e00e4745fe253cb0c24c63bbac253464a2 ]
of_parse_phandle returns node pointer with refcount incremented, use of_node_put() on it when done.
--- drivers/fsi/fsi-master-ast-cf.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/fsi/fsi-master-ast-cf.c +2 -0
@@ -1324,12 +1324,14 @@ static int fsi_master_acf_probe(struct platform_device *pdev) } master->cvic =devm_of_iomap (&pdev->dev, np,0 ,NULL );if (IS_ERR (master->cvic)) { +of_node_put (np); rc =PTR_ERR (master->cvic);dev_err (&pdev->dev,"Error %d mapping CVIC\n" , rc); goto err_free; } rc =of_property_read_u32 (np,"copro-sw-interrupts" , &master->cvic_sw_irq); +of_node_put (np);if (rc) {dev_err (&pdev->dev,"Can't find coprocessor SW interrupt\n" ); goto err_free;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 693/717 usb: typec: ucsi: Dont warn on probe deferral
In reply to Greg Kroah-HartmanFrom: Wayne Chang <[email protected]>
[ Upstream commit fce703a991b7e8c7e1371de95b9abaa832ecf9c3 ]
Deferred probe is an expected return value for fwnode_usb_role_switch_get(). Given that the driver deals with it properly, there's no need to output a warning that may potentially confuse users.
--
V2 -> V3: remove the Fixes and Cc
V1 -> V2: adjust the coding style for better reading format.
drivers/usb/typec/ucsi/ucsi.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
--- drivers/usb/typec/ucsi/ucsi.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/usb/typec/ucsi/ucsi.c +3 -5
@@ -1067,11 +1067,9 @@ static int ucsi_register_port(struct ucsi *ucsi, int index) cap->fwnode =ucsi_find_fwnode (con); con->usb_role_sw =fwnode_usb_role_switch_get (cap->fwnode); -if (IS_ERR (con->usb_role_sw)) { -dev_err (ucsi->dev,"con%d: failed to get usb role switch\n" , - con->num); -return PTR_ERR (con->usb_role_sw); - } +if (IS_ERR (con->usb_role_sw)) +return dev_err_probe (ucsi->dev,PTR_ERR (con->usb_role_sw), +"con%d: failed to get usb role switch\n" , con->num);/* Delay other interactions with the con until registration is complete */ mutex_lock (&con->lock);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 694/717 clk: bcm2835: Make peripheral PLLC critical
In reply to Greg Kroah-HartmanFrom: Maxime Ripard <[email protected]>
[ Upstream commit 6c5422851d8be8c7451e968fd2e6da41b6109e17 ]
When testing for a series affecting the VEC, it was discovered that turning off and on the VEC clock is crashing the system.
It turns out that, when disabling the VEC clock, it's the only child of the PLLC-per clock which will also get disabled. The source of the crash is PLLC-per being disabled.
It's likely that some other device might not take a clock reference that it actually needs, but it's unclear which at this point. Let's make PLLC-per critical so that we don't have that crash.
--- drivers/clk/bcm/clk-bcm2835.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/bcm/clk-bcm2835.c +1 -1
@@ -1784,7 +1784,7 @@ static const struct bcm2835_clk_desc clk_desc_array[] = { .load_mask = CM_PLLC_LOADPER, .hold_mask = CM_PLLC_HOLDPER, .fixed_divider = 1, - .flags = CLK_SET_RATE_PARENT), + .flags = CLK_IS_CRITICAL | CLK_SET_RATE_PARENT),/* * PLLD is the display PLL, used to drive DSI display panels.
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 695/717 clk: bcm2835: Round UART input clock up
In reply to Greg Kroah-HartmanFrom: Ivan T. Ivanov <[email protected]>
[ Upstream commit f690a4d7a8f66430662975511c86819dc9965bcc ]
It was reported that RPi3[1] and RPi Zero 2W boards have issues with the Bluetooth. It turns out that when switching from initial to operation speed host and device no longer can talk each other because host uses incorrect UART baud rate.
The UART driver used in this case is amba-pl011. Original fix, see below Github link[2], was inside pl011 module, but somehow it didn't look as the right place to fix. Beside that this original rounding function is not exactly perfect for all possible clock values. So I deiced to move the hack to the platform which actually need it.
The UART clock is initialised to be as close to the requested frequency as possible without exceeding it. Now that there is a clock manager that returns the actual frequencies, an expected 48MHz clock is reported as 47999625. If the requested baud rate == requested clock/16, there is no headroom and the slight reduction in actual clock rate results in failure.
If increasing a clock by less than 0.1% changes it from ..999.. to ..000.., round it up.
[1] https://bugzilla.suse.com/show_bug.cgi?id=1188238
[2] https://github.com/raspberrypi/linux/commit/ab3f1b39537f6d3825b8873006fbe2fc5ff057b7
--- drivers/clk/bcm/clk-bcm2835.c | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-)
drivers/clk/bcm/clk-bcm2835.c +33 -2
@@ -30,6 +30,7 @@#include <linux/debugfs.h> #include <linux/delay.h> #include <linux/io.h> +#include <linux/math.h> #include <linux/module.h> #include <linux/of_device.h> #include <linux/platform_device.h>
@@ -502,6 +503,8 @@ struct bcm2835_clock_data {bool low_jitter;u32 tcnt_mux; + +bool round_up; };struct bcm2835_gate_data {
@@ -993,12 +996,34 @@ static unsigned long bcm2835_clock_rate_from_divisor(struct bcm2835_clock *clockreturn temp; } +static unsigned long bcm2835_round_rate (unsigned long rate) +{ +unsigned long scaler; +unsigned long limit; + + limit = rate /100000 ; + + scaler =1 ; +while (scaler < limit) + scaler *=10 ; + +/* +* If increasing a clock by less than 0.1% changes it +* from ..999.. to ..000.., round up. +*/ +if ((rate + scaler -1 ) / scaler %1000 ==0 ) + rate =roundup (rate, scaler); + +return rate; +} +static unsigned long bcm2835_clock_get_rate (struct clk_hw *hw,unsigned long parent_rate) {struct bcm2835_clock *clock =bcm2835_clock_from_hw (hw);struct bcm2835_cprman *cprman = clock->cprman;const struct bcm2835_clock_data *data = clock->data; +unsigned long rate;u32 div;if (data->int_bits ==0 && data->frac_bits ==0 )
@@ -1006,7 +1031,12 @@ static unsigned long bcm2835_clock_get_rate(struct clk_hw *hw, div =cprman_read (cprman, data->div_reg); -return bcm2835_clock_rate_from_divisor (clock, parent_rate, div); + rate =bcm2835_clock_rate_from_divisor (clock, parent_rate, div); + +if (data->round_up) + rate =bcm2835_round_rate (rate); + +return rate; }static void bcm2835_clock_wait_busy (struct bcm2835_clock *clock)
@@ -2143,7 +2173,8 @@ static const struct bcm2835_clk_desc clk_desc_array[] = { .div_reg = CM_UARTDIV, .int_bits = 10, .frac_bits = 12, - .tcnt_mux = 28), + .tcnt_mux = 28, + .round_up = true),/* TV encoder clock. Only operating frequency is 108Mhz. */ [BCM2835_CLOCK_VEC] = REGISTER_PER_CLK(
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 696/717 perf: Skip and warn on unknown format configN attrs
In reply to Greg Kroah-HartmanFrom: Rob Herring <[email protected]>
commit e552b7be12ed62357df84392efa525ecb01910fb upstream.
If the kernel exposes a new perf_event_attr field in a format attr, perf will return an error stating the specified PMU can't be found. For example, a format attr with 'config3:0-63' causes an error as config3 is unknown to perf. This causes a compatibility issue between a newer kernel with older perf tool.
Before this change with a kernel adding 'config3' I get:
$ perf record -e arm_spe// -- true
event syntax error: 'arm_spe//'
\___ Cannot find PMU `arm_spe'. Missing kernel support?
Run 'perf list' for a list of valid events Usage: perf record [<options>] [<command>]
or: perf record [<options>] -- <command> [<options>]
-e, --event <event> event selector. use 'perf list' to list
available events
After this change, I get:
$ perf record -e arm_spe// -- true WARNING: 'arm_spe_0' format 'inv_event_filter' requires 'perf_event_attr::config3' which is not supported by this version of perf! [ perf record: Woken up 2 times to write data ] [ perf record: Captured and wrote 0.091 MB perf.data ]
To support unknown configN formats, rework the YACC implementation to pass any config[0-9]+ format to perf_pmu__new_format() to handle with a warning.
--- tools/perf/util/parse-events.c | 3 +++ tools/perf/util/pmu.c | 17 +++++++++++++++++ tools/perf/util/pmu.h | 2 ++ tools/perf/util/pmu.l | 2 -- tools/perf/util/pmu.y | 15 ++++----------- 5 files changed, 26 insertions(+), 13 deletions(-)
tools/perf/util/parse-events.c +3 -0
@@ -255,6 +255,9 @@ __add_event(struct list_head *list, intstruct perf_cpu_map *cpus = pmu ?perf_cpu_map__get (pmu->cpus) : cpu_list ?perf_cpu_map__new (cpu_list) :NULL ; +if (pmu) +perf_pmu__warn_invalid_formats (pmu); +if (pmu && attr->type ==PERF_TYPE_RAW )perf_pmu__warn_invalid_config (pmu, attr->config, name);
tools/perf/util/pmu.c +17 -0
@@ -1048,6 +1048,23 @@ err:return NULL ; } +void perf_pmu__warn_invalid_formats (struct perf_pmu *pmu) +{ +struct perf_pmu_format *format; + +/* fake pmu doesn't have format list */ +if (pmu == &perf_pmu__fake) +return ; + +list_for_each_entry (format, &pmu->format, list) +if (format->value >=PERF_PMU_FORMAT_VALUE_CONFIG_END ) { +pr_warning ("WARNING: '%s' format '%s' requires 'perf_event_attr::config%d'" +"which is not supported by this version of perf!\n" , + pmu->name, format->name, format->value); +return ; + } +} +static struct perf_pmu *pmu_find (const char *name) {struct perf_pmu *pmu;
tools/perf/util/pmu.h +2 -0
@@ -17,6 +17,7 @@ enum {PERF_PMU_FORMAT_VALUE_CONFIG ,PERF_PMU_FORMAT_VALUE_CONFIG1 ,PERF_PMU_FORMAT_VALUE_CONFIG2 , + PERF_PMU_FORMAT_VALUE_CONFIG_END, };#define PERF_PMU_FORMAT_BITS 64
@@ -139,6 +140,7 @@ int perf_pmu__caps_parse(struct perf_pmuvoid perf_pmu__warn_invalid_config (struct perf_pmu *pmu,__u64 config,const char *name); +void perf_pmu__warn_invalid_formats (struct perf_pmu *pmu);bool perf_pmu__has_hybrid (void );int perf_pmu__match (char *pattern,char *name,char *tok);
tools/perf/util/pmu.l +0 -2
@@ -27,8 +27,6 @@ num_dec [0-9]+ {num_dec} { return value(10); } config { return PP_CONFIG; } -config1 { return PP_CONFIG1; } -config2 { return PP_CONFIG2; } - { return '-'; } : { return ':'; } , { return ','; }
tools/perf/util/pmu.y +4 -11
@@ -20,7 +20,7 @@ do { \ %} -%token PP_CONFIG PP_CONFIG1 PP_CONFIG2 +%token PP_CONFIG %token PP_VALUE PP_ERROR %type <num> PP_VALUE %type <bits> bit_term
@@ -47,18 +47,11 @@ PP_CONFIG ':' bits $3)); } | -PP_CONFIG1 ':' bits +PP_CONFIG PP_VALUE ':' bits { ABORT_ON(perf_pmu__new_format(format, name, - PERF_PMU_FORMAT_VALUE_CONFIG1, - $3)); -} -| -PP_CONFIG2 ':' bits -{ - ABORT_ON(perf_pmu__new_format(format, name, - PERF_PMU_FORMAT_VALUE_CONFIG2, - $3)); + $2, + $4)); } bits:
Greg Kroah-Hartman
maintainerPATCH 697/717 perf intel-pt: Fix segfault in intel_pt_print_info() with uClibc
In reply to Greg Kroah-HartmanFrom: Adrian Hunter <[email protected]>
commit 5a3d47071f0ced0431ef82a5fb6bd077ed9493db upstream.
uClibc segfaulted because NULL was passed as the format to fprintf().
That happened because one of the format strings was missing and intel_pt_print_info() didn't check that before calling fprintf().
Add the missing format string, and check format is not NULL before calling fprintf().
--- tools/perf/util/intel-pt.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
tools/perf/util/intel-pt.c +7 -2
@@ -3878,6 +3878,7 @@ static const char * const intel_pt_info_ [INTEL_PT_SNAPSHOT_MODE] = " Snapshot mode %"PRId64"\n", [INTEL_PT_PER_CPU_MMAPS] = " Per-cpu maps %"PRId64"\n", [INTEL_PT_MTC_BIT] = " MTC bit %#"PRIx64"\n", + [INTEL_PT_MTC_FREQ_BITS] = " MTC freq bits %#"PRIx64"\n", [INTEL_PT_TSC_CTC_N] = " TSC:CTC numerator %"PRIu64"\n", [INTEL_PT_TSC_CTC_D] = " TSC:CTC denominator %"PRIu64"\n", [INTEL_PT_CYC_BIT] = " CYC bit %#"PRIx64"\n",
@@ -3892,8 +3893,12 @@ static void intel_pt_print_info(__u64 *aif (!dump_trace)return ; -for (i = start; i <= finish; i++) -fprintf (stdout, intel_pt_info_fmts[i], arr[i]); +for (i = start; i <= finish; i++) { +const char *fmt = intel_pt_info_fmts[i]; + +if (fmt) +fprintf (stdout, fmt, arr[i]); + } }static void intel_pt_print_info_str (const char *name,const char *str)
Greg Kroah-Hartman
maintainerPATCH 698/717 perf intel-pt: Fix system_wide dummy event for hybrid
In reply to Greg Kroah-HartmanFrom: Adrian Hunter <[email protected]>
commit 6cef7dab3e2e5cb23a13569c3880c0532326748c upstream.
User space tasks can migrate between CPUs, so when tracing selected CPUs, system-wide sideband is still needed, however evlist->core.has_user_cpus is not set in the hybrid case, so check the target cpu_list instead.
--- tools/perf/arch/x86/util/intel-pt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/arch/x86/util/intel-pt.c +1 -1
@@ -871,7 +871,7 @@ static int intel_pt_recording_options(st* User space tasks can migrate between CPUs, so when tracing * selected CPUs, sideband for all CPUs is still needed. */ - need_system_wide_tracking = evlist->core.has_user_cpus && + need_system_wide_tracking = opts->target.cpu_list && !intel_pt_evsel->core.attr.exclude_user; tracking_evsel =evlist__add_aux_dummy (evlist, need_system_wide_tracking);
Greg Kroah-Hartman
maintainerPATCH 699/717 mm: hugetlb: fix UAF in hugetlb_handle_userfault
In reply to Greg Kroah-HartmanFrom: Liu Shixin <[email protected]>
commit 958f32ce832ba781ac20e11bb2d12a9352ea28fc upstream.
The vma_lock and hugetlb_fault_mutex are dropped before handling userfault and reacquire them again after handle_userfault(), but reacquire the vma_lock could lead to UAF[1,2] due to the following race,
hugetlb_fault
hugetlb_no_page
/*unlock vma_lock */
hugetlb_handle_userfault
handle_userfault
/* unlock mm->mmap_lock*/
vm_mmap_pgoff
do_mmap
mmap_region
munmap_vma_range
/* clean old vma */
/* lock vma_lock again <--- UAF */
/* unlock vma_lock */Since the vma_lock will unlock immediately after hugetlb_handle_userfault(), let's drop the unneeded lock and unlock in hugetlb_handle_userfault() to fix the issue.
[1] https://lore.kernel.org/linux-mm/[email protected]/
[2] https://lore.kernel.org/linux-mm/[email protected]/
--- mm/hugetlb.c | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-)
mm/hugetlb.c +17 -20
@@ -5467,7 +5467,6 @@ static inline vm_fault_t hugetlb_handle_ unsigned long addr, unsigned long reason) { -vm_fault_t ret;u32 hash;struct vm_fault vmf = { .vma = vma,
@@ -5485,18 +5484,14 @@ static inline vm_fault_t hugetlb_handle_ };/* -* hugetlb_fault_mutex and i_mmap_rwsem must be -* dropped before handling userfault. Reacquire -* after handling fault to make calling code simpler. +* vma_lock and hugetlb_fault_mutex must be dropped before handling +* userfault. Also mmap_lock will be dropped during handling +* userfault, any vma operation should be careful from here. */ hash =hugetlb_fault_mutex_hash (mapping, idx);mutex_unlock (&hugetlb_fault_mutex_table[hash]);i_mmap_unlock_read (mapping); - ret =handle_userfault (&vmf, reason); -i_mmap_lock_read (mapping); -mutex_lock (&hugetlb_fault_mutex_table[hash]); - -return ret; +return handle_userfault (&vmf, reason); } static vm_fault_t hugetlb_no_page(struct mm_struct *mm,
@@ -5514,6 +5509,7 @@ static vm_fault_t hugetlb_no_page(structspinlock_t *ptl;unsigned long haddr = address &huge_page_mask (h);bool new_page, new_pagecache_page = false; +u32 hash =hugetlb_fault_mutex_hash (mapping, idx);/* * Currently, we are forced to kill the process in the event the
@@ -5524,7 +5520,7 @@ static vm_fault_t hugetlb_no_page(structif (is_vma_resv_set (vma,HPAGE_RESV_UNMAPPED )) {pr_warn_ratelimited ("PID %d killed due to inadequate hugepage pool\n" , current->pid); -return ret; + goto out; }/*
@@ -5541,12 +5537,10 @@ retry: page =find_lock_page (mapping, idx);if (!page) {/* Check for page in userfault range */ -if (userfaultfd_missing (vma)) { - ret =hugetlb_handle_userfault (vma, mapping, idx, +if (userfaultfd_missing (vma)) +return hugetlb_handle_userfault (vma, mapping, idx, flags, haddr, address,VM_UFFD_MISSING ); - goto out; - } page =alloc_huge_page (vma, haddr,0 );if (IS_ERR (page)) {
@@ -5606,10 +5600,9 @@ retry:if (userfaultfd_minor (vma)) {unlock_page (page);put_page (page); - ret =hugetlb_handle_userfault (vma, mapping, idx, +return hugetlb_handle_userfault (vma, mapping, idx, flags, haddr, address,VM_UFFD_MINOR ); - goto out; } }
@@ -5667,6 +5660,8 @@ retry:unlock_page (page); out: +mutex_unlock (&hugetlb_fault_mutex_table[hash]); +i_mmap_unlock_read (mapping);return ret; backout:
@@ -5765,11 +5760,13 @@ vm_fault_t hugetlb_fault(struct mm_struc entry =huge_ptep_get (ptep);/* PTE markers should be handled the same way as none pte */ -if (huge_pte_none_mostly (entry)) { - ret =hugetlb_no_page (mm, vma, mapping, idx, address, ptep, +if (huge_pte_none_mostly (entry)) +/* +* hugetlb_no_page will drop vma lock and hugetlb fault +* mutex internally, which make us return immediately. +*/ +return hugetlb_no_page (mm, vma, mapping, idx, address, ptep, entry, flags); - goto out_mutex; - } ret =0 ;
Greg Kroah-Hartman
maintainerPATCH 700/717 net: ieee802154: return -EINVAL for unknown addr type
In reply to Greg Kroah-HartmanFrom: Alexander Aring <[email protected]>
commit 30393181fdbc1608cc683b4ee99dcce05ffcc8c7 upstream.
This patch adds handling to return -EINVAL for an unknown addr type. The current behaviour is to return 0 as successful but the size of an unknown addr type is not defined and should return an error like -EINVAL.
--- include/net/ieee802154_netdev.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
include/net/ieee802154_netdev.h +9 -3
@@ -185,21 +185,27 @@ static inline int ieee802154_sockaddr_check_size(struct sockaddr_ieee802154 *daddr, int len) {struct ieee802154_addr_sa *sa; +int ret =0 ; sa = &daddr->addr;if (len <IEEE802154_MIN_NAMELEN )return -EINVAL ;switch (sa->addr_type) { +case IEEE802154_ADDR_NONE : +break ;case IEEE802154_ADDR_SHORT :if (len <IEEE802154_NAMELEN_SHORT ) -return -EINVAL ; + ret = -EINVAL ;break ;case IEEE802154_ADDR_LONG :if (len <IEEE802154_NAMELEN_LONG ) -return -EINVAL ; + ret = -EINVAL ; +break ; +default : + ret = -EINVAL ;break ; } -return 0 ; +return ret; } static inline void ieee802154_addr_from_sa(struct ieee802154_addr *a,
Greg Kroah-Hartman
maintainerPATCH 701/717 ALSA: usb-audio: Fix last interface check for registration
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
commit 39efc9c8a973ddff5918191525d1679d0fb368ea upstream.
The recent fix in commit 6392dcd1d0c7 ("ALSA: usb-audio: Register card at the last interface") tried to delay the card registration until the last found interface is probed. It assumed that the probe callback gets called for those later interfaces, but it's not always true; as the driver loops over the descriptor and probes the matching ones, it's not separately called via multiple probe calls. This results in the missing card registration, i.e. no sound device.
For addressing this problem, replace the check whether the last interface is processed with usb_interface_claimed() instead of the comparison with the probe interface number.
--- sound/usb/card.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/usb/card.c +1 -1
@@ -884,7 +884,7 @@ static int usb_audio_probe(struct usb_in* one given via option */ if (check_delayed_register_option (chip) == ifnum || - chip->last_iface == ifnum) { +usb_interface_claimed (usb_ifnum_to_if (dev, chip->last_iface))) { err =snd_card_register (chip->card);if (err <0 ) goto __error;
Greg Kroah-Hartman
maintainerPATCH 702/717 blk-wbt: fix that rwb->wc is always set to 1 in wbt_init()
In reply to Greg Kroah-HartmanFrom: Yu Kuai <[email protected]>
commit 285febabac4a16655372d23ff43e89ff6f216691 upstream.
commit 8c5035dfbb94 ("blk-wbt: call rq_qos_add() after wb_normal is initialized") moves wbt_set_write_cache() before rq_qos_add(), which is wrong because wbt_rq_qos() is still NULL.
Fix the problem by removing wbt_set_write_cache() and setting 'rwb->wc' directly. Noted that this patch also remove the redundant setting of 'rab->wc'.
--- block/blk-wbt.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
block/blk-wbt.c +1 -2
@@ -841,12 +841,11 @@ int wbt_init(struct request_queue *q) rwb->last_comp = rwb->last_issue = jiffies; rwb->win_nsec =RWB_WINDOW_NSEC ; rwb->enable_state =WBT_STATE_ON_DEFAULT ; - rwb->wc =1 ; + rwb->wc =test_bit (QUEUE_FLAG_WC , &q->queue_flags); rwb->rq_depth.default_depth =RWB_DEF_DEPTH ; rwb->min_lat_nsec =wbt_default_latency_nsec (q);wbt_queue_depth_changed (&rwb->rqos); -wbt_set_write_cache (q,test_bit (QUEUE_FLAG_WC , &q->queue_flags));/* * Assign rwb and add the stats callback.
Greg Kroah-Hartman
maintainerPATCH 703/717 net: ethernet: ti: davinci_mdio: fix build for mdio bitbang uses
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
commit 35bbe652c421037822aba29423f5f1f7d0d69f3f upstream.
davinci_mdio.c uses mdio bitbang APIs, so it should select MDIO_BITBANG to prevent build errors.
arm-linux-gnueabi-ld: drivers/net/ethernet/ti/davinci_mdio.o: in function `davinci_mdio_remove':drivers/net/ethernet/ti/davinci_mdio.c:649: undefined reference to `free_mdio_bitbang'
arm-linux-gnueabi-ld: drivers/net/ethernet/ti/davinci_mdio.o: in function `davinci_mdio_probe':drivers/net/ethernet/ti/davinci_mdio.c:545: undefined reference to `alloc_mdio_bitbang'
arm-linux-gnueabi-ld: drivers/net/ethernet/ti/davinci_mdio.o: in function `davinci_mdiobb_read':drivers/net/ethernet/ti/davinci_mdio.c:236: undefined reference to `mdiobb_read'
arm-linux-gnueabi-ld: drivers/net/ethernet/ti/davinci_mdio.o: in function `davinci_mdiobb_write':drivers/net/ethernet/ti/davinci_mdio.c:253: undefined reference to `mdiobb_write'
--- drivers/net/ethernet/ti/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/ti/Kconfig +1 -0
@@ -33,6 +33,7 @@ config TI_DAVINCI_MDIO tristate "TI DaVinci MDIO Support" depends on ARCH_DAVINCI || ARCH_OMAP2PLUS || ARCH_KEYSTONE || ARCH_K3 || COMPILE_TEST select PHYLIB + select MDIO_BITBANG help This driver supports TI's DaVinci MDIO module.
Greg Kroah-Hartman
maintainerPATCH 704/717 Revert "drm/amd/display: correct hostvm flag"
In reply to Greg Kroah-HartmanFrom: Aric Cyr <[email protected]>
commit 96ab3cb3b0f862308a03046d01d66c7b4154846b upstream.
This reverts commit 796d6a37ff5ffaf9f2dc0f3f4bf9f4a1034c00de.
4K144 resolution isn't available on DCN31.
--- drivers/gpu/drm/amd/display/dc/dcn31/dcn31_resource.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dcn31/dcn31_resource.c +1 -1
@@ -892,7 +892,7 @@ static const struct dc_debug_options deb .enable_sw_cntl_psr = true, .apply_vendor_specific_lttpr_wa = true, .enable_z9_disable_interface = true, /* Allow support for the PMFW interface for disable Z9*/ - .dml_hostvm_override = DML_HOSTVM_NO_OVERRIDE, + .dml_hostvm_override = DML_HOSTVM_OVERRIDE_FALSE, };static const struct dc_debug_options debug_defaults_diags = {
Greg Kroah-Hartman
maintainerPATCH 705/717 Revert "net/ieee802154: reject zero-sized raw_sendmsg()"
In reply to Greg Kroah-HartmanFrom: Alexander Aring <[email protected]>
[ Upstream commit 2eb2756f6c9e9621e022d78321ce40a62c4520b5 ]
This reverts commit 3a4d061c699bd3eedc80dc97a4b2a2e1af83c6f5.
There is a v2 which does return zero if zero length is given.
--- net/ieee802154/socket.c | 3 --- 1 file changed, 3 deletions(-)
net/ieee802154/socket.c +0 -3
@@ -251,9 +251,6 @@ static int raw_sendmsg(struct sock *sk, struct msghdr *msg, size_t size)return -EOPNOTSUPP ; } -if (!size) -return -EINVAL ; -lock_sock (sk);if (!sk->sk_bound_dev_if) dev =dev_getfirstbyhwtype (sock_net (sk),ARPHRD_IEEE802154 );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 706/717 net/ieee802154: dont warn zero-sized raw_sendmsg()
In reply to Greg Kroah-HartmanFrom: Tetsuo Handa <[email protected]>
[ Upstream commit b12e924a2f5b960373459c8f8a514f887adf5cac ]
syzbot is hitting skb_assert_len() warning at __dev_queue_xmit() [1], for PF_IEEE802154 socket's zero-sized raw_sendmsg() request is hitting __dev_queue_xmit() with skb->len == 0.
Since PF_IEEE802154 socket's zero-sized raw_sendmsg() request was able to return 0, don't call __dev_queue_xmit() if packet length is 0.
----------
#include <sys/socket.h>
#include <netinet/in.h>
int main(int argc, char *argv[])
{
struct sockaddr_in addr = { .sin_family = AF_INET, .sin_addr.s_addr = htonl(INADDR_LOOPBACK) };
struct iovec iov = { };
struct msghdr hdr = { .msg_name = &addr, .msg_namelen = sizeof(addr), .msg_iov = &iov, .msg_iovlen = 1 };
sendmsg(socket(PF_IEEE802154, SOCK_RAW, 0), &hdr, 0);
return 0;
}
----------Note that this might be a sign that commit fd1894224407c484 ("bpf: Don't redirect packets with invalid pkt_len") should be reverted, for skb->len == 0 was acceptable for at least PF_IEEE802154 socket.
--- net/ieee802154/socket.c | 4 ++++ 1 file changed, 4 insertions(+)
net/ieee802154/socket.c +4 -0
@@ -272,6 +272,10 @@ static int raw_sendmsg(struct sock *sk, struct msghdr *msg, size_t size) err = -EMSGSIZE ; goto out_dev; } +if (!size) { + err =0 ; + goto out_dev; + } hlen =LL_RESERVED_SPACE (dev); tlen = dev->needed_tailroom;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 707/717 powerpc/64s/interrupt: Fix lost interrupts when returning to soft-masked context
In reply to Greg Kroah-HartmanFrom: Nicholas Piggin <[email protected]>
commit a4cb3651a174366cc85a677da9e3681fbe97fdae upstream.
It's possible for an interrupt returning to an irqs-disabled context to lose a pending soft-masked irq because it branches to part of the exit code for irqs-enabled contexts, which is meant to clear only the PACA_IRQS_HARD_DIS flag from PACAIRQHAPPENED by zeroing the byte. This just looks like a simple thinko from a recent commit (if there was no hard mask pending, there would be no reason to clear it anyway).
This also adds comment to the code that actually does need to clear the flag.
--- arch/powerpc/kernel/interrupt_64.S | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
arch/powerpc/kernel/interrupt_64.S +13 -2
@@ -571,7 +571,7 @@ _ASM_NOKPROBE_SYMBOL(interrupt_return_\s beq .Lfast_kernel_interrupt_return_\srr\() // EE already disabled lbz r11,PACAIRQHAPPENED(r13) andi. r10,r11,PACA_IRQ_MUST_HARD_MASK - beq 1f // No HARD_MASK pending + beq .Lfast_kernel_interrupt_return_\srr\() // No HARD_MASK pending /* Must clear MSR_EE from _MSR */ #ifdef CONFIG_PPC_BOOK3S
@@ -588,12 +588,23 @@ _ASM_NOKPROBE_SYMBOL(interrupt_return_\s b .Lfast_kernel_interrupt_return_\srr\() .Linterrupt_return_\srr\()_soft_enabled: + /* + * In the soft-enabled case, need to double-check that we have no + * pending interrupts that might have come in before we reached the + * restart section of code, and restart the exit so those can be + * handled. + * + * If there are none, it is be possible that the interrupt still + * has PACA_IRQ_HARD_DIS set, which needs to be cleared for the + * interrupted context. This clear will not clobber a new pending + * interrupt coming in, because we're in the restart section, so + * such would return to the restart location. + */ #ifdef CONFIG_PPC_BOOK3S lbz r11,PACAIRQHAPPENED(r13) andi. r11,r11,(~PACA_IRQ_HARD_DIS)@l bne- interrupt_return_\srr\()_kernel_restart #endif -1: li r11,0 stb r11,PACAIRQHAPPENED(r13) // clear the possible HARD_DIS
Greg Kroah-Hartman
maintainerPATCH 708/717 drm/amd/display: Fix build breakage with CONFIG_DEBUG_FS=n
In reply to Greg Kroah-HartmanFrom: Nathan Chancellor <[email protected]>
commit 2130b87b2273389cafe6765bf09ef564cda01407 upstream.
After commit 8799c0be89eb ("drm/amd/display: Fix vblank refcount in vrr transition"), a build with CONFIG_DEBUG_FS=n is broken due to a misplaced brace, along the lines of:
In file included from drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm_trace.h:39,
from drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:41:
drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c: At top level:
./include/drm/drm_atomic.h:864:9: error: expected identifier or ‘(’ before ‘for’
864 | for ((__i) = 0; \
| ^~~
drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:8317:9: note: in expansion of macro ‘for_each_new_crtc_in_state’
8317 | for_each_new_crtc_in_state(state, crtc, new_crtc_state, j)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~Move the brace within the #ifdef so that the file can be built with or without CONFIG_DEBUG_FS.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1 -1
@@ -9991,8 +9991,8 @@ static void amdgpu_dm_atomic_commit_tail crtc, dm_new_crtc_state, cur_crc_src)) DRM_DEBUG_DRIVER("Failed to configure crc source"); } -#endif } +#endif }for_each_new_crtc_in_state (state, crtc, new_crtc_state, j)
Greg Kroah-Hartman
maintainerPATCH 709/717 kbuild: Add skip_encoding_btf_enum64 option to pahole
In reply to Greg Kroah-HartmanFrom: Martin Rodriguez Reboredo <[email protected]>
New pahole (version 1.24) generates by default new BTF_KIND_ENUM64 BTF tag, which is not supported by stable kernel.
As a result the kernel with CONFIG_DEBUG_INFO_BTF option will fail to compile with following error:
BTFIDS vmlinux
FAILED: load BTF from vmlinux: Invalid argument
New pahole provides --skip_encoding_btf_enum64 option to skip BTF_KIND_ENUM64 generation and produce BTF supported by stable kernel.
Adding this option to scripts/pahole-flags.sh.
This change does not have equivalent commit in linus tree, because linus tree has support for BTF_KIND_ENUM64 tag, so it does not need to be disabled.
--- scripts/pahole-flags.sh | 4 ++++ 1 file changed, 4 insertions(+)
scripts/pahole-flags.sh +4 -0
@@ -20,4 +20,8 @@ if [ "${pahole_ver}" -ge "122" ]; then extra_paholeopt="${extra_paholeopt} -j" fi +if [ "${pahole_ver}" -ge "124" ]; then + extra_paholeopt="${extra_paholeopt} --skip_encoding_btf_enum64" +fi + echo ${extra_paholeopt}
Greg Kroah-Hartman
maintainerPATCH 710/717 Kconfig.debug: simplify the dependency of DEBUG_INFO_DWARF4/5
In reply to Greg Kroah-HartmanFrom: Masahiro Yamada <[email protected]>
commit 4f001a21080ff2e2f0e1c3692f5e119aedbb3bc1 upstream.
Commit c0a5c81ca9be ("Kconfig.debug: drop GCC 5+ version check for DWARF5") could have cleaned up the code a bit more.
"CC_IS_CLANG &&" is unneeded. No functional change is intended.
--- lib/Kconfig.debug | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
lib/Kconfig.debug +2 -2
@@ -264,7 +264,7 @@ config DEBUG_INFO_DWARF_TOOLCHAIN_DEFAUL config DEBUG_INFO_DWARF4 bool "Generate DWARF Version 4 debuginfo" select DEBUG_INFO - depends on !CC_IS_CLANG || (CC_IS_CLANG && (AS_IS_LLVM || (AS_IS_GNU && AS_VERSION >= 23502))) + depends on !CC_IS_CLANG || AS_IS_LLVM || (AS_IS_GNU && AS_VERSION >= 23502) help Generate DWARF v4 debug info. This requires gcc 4.5+, binutils 2.35.2 if using clang without clang's integrated assembler, and gdb 7.0+.
@@ -276,7 +276,7 @@ config DEBUG_INFO_DWARF4 config DEBUG_INFO_DWARF5 bool "Generate DWARF Version 5 debuginfo" select DEBUG_INFO - depends on !CC_IS_CLANG || (CC_IS_CLANG && (AS_IS_LLVM || (AS_IS_GNU && AS_VERSION >= 23502))) + depends on !CC_IS_CLANG || AS_IS_LLVM || (AS_IS_GNU && AS_VERSION >= 23502) help Generate DWARF v5 debug info. Requires binutils 2.35.2, gcc 5.0+ (gcc 5.0+ accepts the -gdwarf-5 flag but only had partial support for some
Greg Kroah-Hartman
maintainerPATCH 711/717 Kconfig.debug: add toolchain checks for DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT
In reply to Greg Kroah-HartmanFrom: Masahiro Yamada <[email protected]>
commit bb1435f3f575b5213eaf27434efa3971f51c01de upstream.
CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT does not give explicit -gdwarf-* flag. The actual DWARF version is up to the toolchain.
The combination of GCC and GAS works fine, and Clang with the integrated assembler is good too.
The combination of Clang and GAS is tricky, but at least, the -g flag works for Clang <=13, which defaults to DWARF v4.
Clang 14 switched its default to DWARF v5.
Now, CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT has the same issue as addressed by commit 98cd6f521f10 ("Kconfig: allow explicit opt in to DWARF v5").
CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=y for Clang >= 14 and GAS < 2.35 produces a ton of errors like follows:
/tmp/main-c2741c.s: Assembler messages:
/tmp/main-c2741c.s:109: Error: junk at end of line, first unrecognized character is `"' /tmp/main-c2741c.s:109: Error: file number less than one
Add 'depends on' to check toolchains.
--- lib/Kconfig.debug | 1 + 1 file changed, 1 insertion(+)
lib/Kconfig.debug +1 -0
@@ -253,6 +253,7 @@ config DEBUG_INFO_NONE config DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT bool "Rely on the toolchain's implicit default DWARF version" select DEBUG_INFO + depends on !CC_IS_CLANG || AS_IS_LLVM || CLANG_VERSION < 140000 || (AS_IS_GNU && AS_VERSION >= 23502) help The implicit default version of DWARF debug info produced by a toolchain changes over time.
Greg Kroah-Hartman
maintainerPATCH 712/717 lib/Kconfig.debug: Add check for non-constant .{s,u}leb128 support to DWARF5
In reply to Greg Kroah-HartmanFrom: Nathan Chancellor <[email protected]>
commit 0a6de78cff600cb991f2a1b7ed376935871796a0 upstream.
When building with a RISC-V kernel with DWARF5 debug info using clang and the GNU assembler, several instances of the following error appear:
/tmp/vgettimeofday-48aa35.s:2963: Error: non-constant .uleb128 is not supported
Dumping the .s file reveals these .uleb128 directives come from .debug_loc and .debug_ranges:
.Ldebug_loc0:
.byte 4 # DW_LLE_offset_pair
.uleb128 .Lfunc_begin0-.Lfunc_begin0 # starting offset
.uleb128 .Ltmp1-.Lfunc_begin0 # ending offset
.byte 1 # Loc expr size
.byte 90 # DW_OP_reg10
.byte 0 # DW_LLE_end_of_list.Ldebug_ranges0:
.byte 4 # DW_RLE_offset_pair
.uleb128 .Ltmp6-.Lfunc_begin0 # starting offset
.uleb128 .Ltmp27-.Lfunc_begin0 # ending offset
.byte 4 # DW_RLE_offset_pair
.uleb128 .Ltmp28-.Lfunc_begin0 # starting offset
.uleb128 .Ltmp30-.Lfunc_begin0 # ending offset
.byte 0 # DW_RLE_end_of_listThere is an outstanding binutils issue to support a non-constant operand to .sleb128 and .uleb128 in GAS for RISC-V but there does not appear to be any movement on it, due to concerns over how it would work with linker relaxation.
To avoid these build errors, prevent DWARF5 from being selected when using clang and an assembler that does not have support for these symbol deltas, which can be easily checked in Kconfig with as-instr plus the small test program from the dwz test suite from the binutils issue.
--- lib/Kconfig.debug | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
lib/Kconfig.debug +7 -2
@@ -231,6 +231,11 @@ config DEBUG_INFO in the "Debug information" choice below, indicating that debug information will be generated for build targets. +# Clang is known to generate .{s,u}leb128 with symbol deltas with DWARF5, which +# some targets may not support: https://sourceware.org/bugzilla/show_bug.cgi?id=27215 +config AS_HAS_NON_CONST_LEB128 + def_bool $(as-instr,.uleb128 .Lexpr_end4 - .Lexpr_start3\n.Lexpr_start3:\n.Lexpr_end4:) + choice prompt "Debug information" depends on DEBUG_KERNEL
@@ -253,7 +258,7 @@ config DEBUG_INFO_NONE config DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT bool "Rely on the toolchain's implicit default DWARF version" select DEBUG_INFO - depends on !CC_IS_CLANG || AS_IS_LLVM || CLANG_VERSION < 140000 || (AS_IS_GNU && AS_VERSION >= 23502) + depends on !CC_IS_CLANG || AS_IS_LLVM || CLANG_VERSION < 140000 || (AS_IS_GNU && AS_VERSION >= 23502 && AS_HAS_NON_CONST_LEB128) help The implicit default version of DWARF debug info produced by a toolchain changes over time.
@@ -277,7 +282,7 @@ config DEBUG_INFO_DWARF4 config DEBUG_INFO_DWARF5 bool "Generate DWARF Version 5 debuginfo" select DEBUG_INFO - depends on !CC_IS_CLANG || AS_IS_LLVM || (AS_IS_GNU && AS_VERSION >= 23502) + depends on !CC_IS_CLANG || AS_IS_LLVM || (AS_IS_GNU && AS_VERSION >= 23502 && AS_HAS_NON_CONST_LEB128) help Generate DWARF v5 debug info. Requires binutils 2.35.2, gcc 5.0+ (gcc 5.0+ accepts the -gdwarf-5 flag but only had partial support for some
Greg Kroah-Hartman
maintainerPATCH 713/717 HID: uclogic: Add missing suffix for digitalizers
In reply to Greg Kroah-HartmanFrom: José Expósito <[email protected]>
commit 0977fda0587cbc5403651ba169e264aa01e8a026 upstream.
The Pen (0x02) application usage was changed to Digitalizer (0x01) in commit f7d8e387d9ae ("HID: uclogic: Switch to Digitizer usage for styluses"). However, a suffix was not selected for the new usage.
Handle the digitalizer application usage in uclogic_input_configured() and add the required suffix.
--- drivers/hid/hid-uclogic-core.c | 1 + 1 file changed, 1 insertion(+)
drivers/hid/hid-uclogic-core.c +1 -0
@@ -153,6 +153,7 @@ static int uclogic_input_configured(stru suffix ="Pad" ;break ;case HID_DG_PEN : +case HID_DG_DIGITIZER : suffix ="Pen" ;break ;case HID_CP_CONSUMER_CONTROL :
Greg Kroah-Hartman
maintainerPATCH 714/717 ext4: continue to expand file system when the target size doesnt reach
In reply to Greg Kroah-HartmanFrom: Jerry Lee 李修賢 <[email protected]>
commit df3cb754d13d2cd5490db9b8d536311f8413a92e upstream.
When expanding a file system from (16TiB-2MiB) to 18TiB, the operation exits early which leads to result inconsistency between resize2fs and Ext4 kernel driver.
=== before ===
○ → resize2fs /dev/mapper/thin
resize2fs 1.45.5 (07-Jan-2020)
Filesystem at /dev/mapper/thin is mounted on /mnt/test; on-line resizing required old_desc_blocks = 2048, new_desc_blocks = 2304
The filesystem on /dev/mapper/thin is now 4831837696 (4k) blocks long.
[ 865.186308] EXT4-fs (dm-5): mounted filesystem with ordered data mode. Opts: (null). Quota mode: none. [ 912.091502] dm-4: detected capacity change from 34359738368 to 38654705664 [ 970.030550] dm-5: detected capacity change from 34359734272 to 38654701568 [ 1000.012751] EXT4-fs (dm-5): resizing filesystem from 4294966784 to 4831837696 blocks [ 1000.012878] EXT4-fs (dm-5): resized filesystem to 4294967296
=== after ===
[ 129.104898] EXT4-fs (dm-5): mounted filesystem with ordered data mode. Opts: (null). Quota mode: none. [ 143.773630] dm-4: detected capacity change from 34359738368 to 38654705664 [ 198.203246] dm-5: detected capacity change from 34359734272 to 38654701568 [ 207.918603] EXT4-fs (dm-5): resizing filesystem from 4294966784 to 4831837696 blocks [ 207.918754] EXT4-fs (dm-5): resizing filesystem from 4294967296 to 4831837696 blocks [ 207.918758] EXT4-fs (dm-5): Converting file system to meta_bg [ 207.918790] EXT4-fs (dm-5): resizing filesystem from 4294967296 to 4831837696 blocks [ 221.454050] EXT4-fs (dm-5): resized to 4658298880 blocks [ 227.634613] EXT4-fs (dm-5): resized filesystem to 4831837696
--- fs/ext4/resize.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ext4/resize.c +1 -1
@@ -2100,7 +2100,7 @@ retry: goto out; } -if (ext4_blocks_count (es) == n_blocks_count) +if (ext4_blocks_count (es) == n_blocks_count && n_blocks_count_retry ==0 ) goto out; err =ext4_alloc_flex_bg_array (sb, n_group +1 );
Greg Kroah-Hartman
maintainerPATCH 715/717 drm/i915: Rename block_size()/block_offset()
In reply to Greg Kroah-HartmanFrom: Ville Syrjälä <[email protected]>
commit 39b1bc4b5bcccac781267bb826b035fbb99c8b9d upstream.
Give block_size()/block_offset() a "raw_" prefix since they both operate on the "raw" (as in not duplicated) BDB block contents.
What actually spurred this was a conflict between intel_bios.c block_size() vs. block_size() from blkdev.h. That only happened to me on a custom tree where we somehow manage to include blkdev.h into intel_bios.c. But I think the rename makes sense anyway to clarify the purpose of these functions.
--- drivers/gpu/drm/i915/display/intel_bios.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/display/intel_bios.c +4 -4
@@ -123,7 +123,7 @@ find_raw_section(const void *_bdb, enum* Offset from the start of BDB to the start of the * block data (just past the block header). */ -static u32 block_offset (const void *bdb,enum bdb_block_id section_id) +static u32 raw_block_offset (const void *bdb,enum bdb_block_id section_id) {const void *block;
@@ -135,7 +135,7 @@ static u32 block_offset(const void *bdb, }/* size of the block excluding the header */ -static u32 block_size (const void *bdb,enum bdb_block_id section_id) +static u32 raw_block_size (const void *bdb,enum bdb_block_id section_id) {const void *block;
@@ -232,7 +232,7 @@ static bool validate_lfp_data_ptrs(constint data_block_size, lfp_data_size;int i; - data_block_size =block_size (bdb,BDB_LVDS_LFP_DATA ); + data_block_size =raw_block_size (bdb,BDB_LVDS_LFP_DATA );if (data_block_size ==0 )return false;
@@ -309,7 +309,7 @@ static bool fixup_lfp_data_ptrs(const vou32 offset;int i; - offset =block_offset (bdb,BDB_LVDS_LFP_DATA ); + offset =raw_block_offset (bdb,BDB_LVDS_LFP_DATA );for (i =0 ; i <16 ; i++) { if (ptrs->ptr[i].fp_timing.offset < offset ||
Greg Kroah-Hartman
maintainerPATCH 716/717 drm/i915/bios: Validate fp_timing terminator presence
In reply to Greg Kroah-HartmanFrom: Ville Syrjälä <[email protected]>
commit 4e78d6023c15c6acce8fbe42e13027c460395522 upstream.
Validate the LFP data block a bit hardwer by making sure the fp_timing terminators (0xffff) are where we expect them to be.
--- drivers/gpu/drm/i915/display/intel_bios.c | 60 ++++++++++++++++-------------- 1 file changed, 32 insertions(+), 28 deletions(-)
drivers/gpu/drm/i915/display/intel_bios.c +32 -28
@@ -134,18 +134,6 @@ static u32 raw_block_offset(const void *return block - bdb; } -/* size of the block excluding the header */ -static u32 raw_block_size (const void *bdb,enum bdb_block_id section_id) -{ -const void *block; - - block =find_raw_section (bdb, section_id); -if (!block) -return 0 ; - -return get_blocksize (block); -} -struct bdb_block_entry {struct list_head node;enum bdb_block_id section_id;
@@ -230,9 +218,14 @@ static bool validate_lfp_data_ptrs(const {int fp_timing_size, dvo_timing_size, panel_pnp_id_size, panel_name_size;int data_block_size, lfp_data_size; +const void *data_block;int i; - data_block_size =raw_block_size (bdb,BDB_LVDS_LFP_DATA ); + data_block =find_raw_section (bdb,BDB_LVDS_LFP_DATA ); +if (!data_block) +return false; + + data_block_size =get_blocksize (data_block);if (data_block_size ==0 )return false;
@@ -260,21 +253,6 @@ static bool validate_lfp_data_ptrs(constif (16 * lfp_data_size > data_block_size)return false; -/* -* Except for vlv/chv machines all real VBTs seem to have 6 -* unaccounted bytes in the fp_timing table. And it doesn't -* appear to be a really intentional hole as the fp_timing -* 0xffff terminator is always within those 6 missing bytes. -*/ -if (fp_timing_size + dvo_timing_size + panel_pnp_id_size != lfp_data_size && - fp_timing_size +6 + dvo_timing_size + panel_pnp_id_size != lfp_data_size) -return false; - -if (ptrs->ptr[0 ].fp_timing.offset + fp_timing_size > ptrs->ptr[0 ].dvo_timing.offset || - ptrs->ptr[0 ].dvo_timing.offset + dvo_timing_size != ptrs->ptr[0 ].panel_pnp_id.offset || - ptrs->ptr[0 ].panel_pnp_id.offset + panel_pnp_id_size != lfp_data_size) -return false; -/* make sure the table entries have uniform size */ for (i =1 ; i <16 ; i++) { if (ptrs->ptr[i].fp_timing.table_size != fp_timing_size ||
@@ -288,6 +266,23 @@ static bool validate_lfp_data_ptrs(constreturn false; } +/* +* Except for vlv/chv machines all real VBTs seem to have 6 +* unaccounted bytes in the fp_timing table. And it doesn't +* appear to be a really intentional hole as the fp_timing +* 0xffff terminator is always within those 6 missing bytes. +*/ +if (fp_timing_size +6 + dvo_timing_size + panel_pnp_id_size == lfp_data_size) + fp_timing_size +=6 ; + +if (fp_timing_size + dvo_timing_size + panel_pnp_id_size != lfp_data_size) +return false; + +if (ptrs->ptr[0 ].fp_timing.offset + fp_timing_size != ptrs->ptr[0 ].dvo_timing.offset || + ptrs->ptr[0 ].dvo_timing.offset + dvo_timing_size != ptrs->ptr[0 ].panel_pnp_id.offset || + ptrs->ptr[0 ].panel_pnp_id.offset + panel_pnp_id_size != lfp_data_size) +return false; +/* make sure the tables fit inside the data block */ for (i =0 ; i <16 ; i++) { if (ptrs->ptr[i].fp_timing.offset + fp_timing_size > data_block_size ||
@@ -299,6 +294,15 @@ static bool validate_lfp_data_ptrs(constif (ptrs->panel_name.offset +16 * panel_name_size > data_block_size)return false; +/* make sure fp_timing terminators are present at expected locations */ +for (i =0 ; i <16 ; i++) { +const u16 *t = data_block + ptrs->ptr[i].fp_timing.offset + + fp_timing_size -2 ; + +if (*t !=0xffff ) +return false; + } +return true; }
Greg Kroah-Hartman
maintainerPATCH 717/717 drm/i915/bios: Use hardcoded fp_timing size for generating LFP data pointers
In reply to Greg Kroah-HartmanFrom: Ville Syrjälä <[email protected]>
commit d3a7051841f0a4bcb1ee26a1b721c6150cc4c2b1 upstream.
The current scheme for generating the LFP data table pointers (when the block including them is missing from the VBT) expects the 0xffff sequence to only appear in the fp_timing terminator entries. However some VBTs also have extra 0xffff sequences elsewhere in the LFP data. When looking for the terminators we may end up finding those extra sequeneces insted, which means we deduce the wrong size for the fp_timing table. The code then notices the inconsistent looking values and gives up on the generated data table pointers, preventing us from parsing the LFP data table entirely.
Let's give up on the "search for the terminators" approach and instead just hardcode the expected size for the fp_timing table.
We have enough sanity checks in place to make sure we shouldn't end up parsing total garbage even if that size should change in the future (although that seems unlikely as the fp_timing and dvo_timing tables have been declared obsolete as of VBT version 229).
--- drivers/gpu/drm/i915/display/intel_bios.c | 46 +++++++++++------------------- 1 file changed, 18 insertions(+), 28 deletions(-)
drivers/gpu/drm/i915/display/intel_bios.c +18 -28
@@ -336,18 +336,6 @@ static bool fixup_lfp_data_ptrs(const voreturn validate_lfp_data_ptrs (bdb, ptrs); } -static const void *find_fp_timing_terminator (const u8 *data,int size) -{ -int i; - -for (i =0 ; i < size -1 ; i++) { -if (data[i] ==0xff && data[i+1 ] ==0xff ) -return &data[i]; - } - -return NULL ; -} -static int make_lfp_data_ptr (struct lvds_lfp_data_ptr_table *table,int table_size,int total_size) {
@@ -371,11 +359,22 @@ static void next_lfp_data_ptr(struct lvdstatic void *generate_lfp_data_ptrs (struct drm_i915_private *i915,const void *bdb) { -int i, size, table_size, block_size, offset; -const void *t0, *t1, *block; +int i, size, table_size, block_size, offset, fp_timing_size;struct bdb_lvds_lfp_data_ptrs *ptrs; +const void *block;void *ptrs_block; +/* +* The hardcoded fp_timing_size is only valid for +* modernish VBTs. All older VBTs definitely should +* include block 41 and thus we don't need to +* generate one. +*/ +if (i915->vbt.version <155 ) +return NULL ; + + fp_timing_size =38 ; + block =find_raw_section (bdb,BDB_LVDS_LFP_DATA );if (!block)return NULL ;
@@ -384,17 +383,8 @@ static void *generate_lfp_data_ptrs(stru block_size =get_blocksize (block); - size = block_size; - t0 =find_fp_timing_terminator (block, size); -if (!t0) -return NULL ; - - size -= t0 - block -2 ; - t1 =find_fp_timing_terminator (t0 +2 , size); -if (!t1) -return NULL ; - - size = t1 - t0; + size = fp_timing_size +sizeof (struct lvds_dvo_timing ) + +sizeof (struct lvds_pnp_id );if (size *16 > block_size)return NULL ;
@@ -412,7 +402,7 @@ static void *generate_lfp_data_ptrs(stru table_size =sizeof (struct lvds_dvo_timing ); size =make_lfp_data_ptr (&ptrs->ptr[0 ].dvo_timing, table_size, size); - table_size = t0 - block +2 ; + table_size = fp_timing_size; size =make_lfp_data_ptr (&ptrs->ptr[0 ].fp_timing, table_size, size);if (ptrs->ptr[0 ].fp_timing.table_size)
@@ -427,14 +417,14 @@ static void *generate_lfp_data_ptrs(strureturn NULL ; } - size = t1 - t0; + size = fp_timing_size +sizeof (struct lvds_dvo_timing ) + +sizeof (struct lvds_pnp_id );for (i =1 ; i <16 ; i++) {next_lfp_data_ptr (&ptrs->ptr[i].fp_timing, &ptrs->ptr[i-1 ].fp_timing, size);next_lfp_data_ptr (&ptrs->ptr[i].dvo_timing, &ptrs->ptr[i-1 ].dvo_timing, size);next_lfp_data_ptr (&ptrs->ptr[i].panel_pnp_id, &ptrs->ptr[i-1 ].panel_pnp_id, size); } - size = t1 - t0; table_size =sizeof (struct lvds_lfp_panel_name );if (16 * (size + table_size) <= block_size) {
Quoted 14 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.19.17 release. There are 717 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Note, this will be the LAST 5.19.y kernel to be released. Please move to the 6.0.y kernel branch at this point in time, as after this is released, this branch will be end-of-life.
Responses should be made by Mon, 24 Oct 2022 07:19:57 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.19.17-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.19.y
and the diffstat can be found below.thanks,
greg k-h
Results from Linaro's test farm.
No regressions on arm64, arm, x86_64, and i386.
## Build
* kernel: 5.19.17-rc1
* git: https://gitlab.com/Linaro/lkft/mirrors/stable/linux-stable-rc
* git branch: linux-5.19.y
* git commit: b0c2a34d484bc2819f59332935fd31bc30ebfbba
* git describe: v5.19.16-718-gb0c2a34d484b
* test details:
https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-5.19.y/build/v5.19.16-718-gb0c2a34d484b
## No Test Regressions (compared to v5.19.16)
## No Metric Regressions (compared to v5.19.16)
## No Test Fixes (compared to v5.19.16)
## No Metric Fixes (compared to v5.19.16)
## Test result summary
total: 121631, pass: 106766, fail: 1652, skip: 12837, xfail: 376
## Build Summary
* arc: 10 total, 10 passed, 0 failed
* arm: 333 total, 333 passed, 0 failed
* arm64: 65 total, 63 passed, 2 failed
* i386: 55 total, 53 passed, 2 failed
* mips: 56 total, 56 passed, 0 failed
* parisc: 12 total, 12 passed, 0 failed
* powerpc: 69 total, 63 passed, 6 failed
* riscv: 27 total, 22 passed, 5 failed
* s390: 21 total, 21 passed, 0 failed
* sh: 24 total, 24 passed, 0 failed
* sparc: 12 total, 12 passed, 0 failed
* x86_64: 58 total, 56 passed, 2 failed
## Test suites summary
* fwts
* igt-gpu-tools
* kselftest-android
* kselftest-arm64
* kselftest-arm64/arm64.btitest.bti_c_func
* kselftest-arm64/arm64.btitest.bti_j_func
* kselftest-arm64/arm64.btitest.bti_jc_func
* kselftest-arm64/arm64.btitest.bti_none_func
* kselftest-arm64/arm64.btitest.nohint_func
* kselftest-arm64/arm64.btitest.paciasp_func
* kselftest-arm64/arm64.nobtitest.bti_c_func
* kselftest-arm64/arm64.nobtitest.bti_j_func
* kselftest-arm64/arm64.nobtitest.bti_jc_func
* kselftest-arm64/arm64.nobtitest.bti_none_func
* kselftest-arm64/arm64.nobtitest.nohint_func
* kselftest-arm64/arm64.nobtitest.paciasp_func
* kselftest-breakpoints
* kselftest-capabilities
* kselftest-cgroup
* kselftest-clone3
* kselftest-core
* kselftest-cpu-hotplug
* kselftest-cpufreq
* kselftest-drivers-dma-buf
* kselftest-efivarfs
* kselftest-filesystems
* kselftest-filesystems-binderfs
* kselftest-firmware
* kselftest-fpu
* kselftest-futex
* kselftest-gpio
* kselftest-intel_pstate
* kselftest-ipc
* kselftest-ir
* kselftest-kcmp
* kselftest-kexec
* kselftest-kvm
* kselftest-lib
* kselftest-livepatch
* kselftest-membarrier
* kselftest-memfd
* kselftest-memory-hotplug
* kselftest-mincore
* kselftest-mount
* kselftest-mqueue
* kselftest-net
* kselftest-net-forwarding
* kselftest-netfilter
* kselftest-nsfs
* kselftest-openat2
* kselftest-pid_namespace
* kselftest-pidfd
* kselftest-proc
* kselftest-pstore
* kselftest-ptrace
* kselftest-rseq
* kselftest-rtc
* kselftest-seccomp
* kselftest-sigaltstack
* kselftest-size
* kselftest-splice
* kselftest-static_keys
* kselftest-sync
* kselftest-sysctl
* kselftest-tc-testing
* kselftest-timens
* kselftest-timers
* kselftest-tmpfs
* kselftest-tpm2
* kselftest-user
* kselftest-vm
* kselftest-x86
* kselftest-zram
* kunit
* kvm-unit-tests
* libgpiod
* libhugetlbfs
* log-parser-boot
* log-parser-test
* ltp-at
* ltp-cap_bounds
* ltp-commands
* ltp-containers
* ltp-controllers
* ltp-cpuhotplug
* ltp-crypto
* ltp-cve
* ltp-dio
* ltp-fcntl-locktests
* ltp-filecaps
* ltp-fs
* ltp-fs_bind
* ltp-fs_perms_simpl
* ltp-fs_perms_simple
* ltp-fsx
* ltp-hugetlb
* ltp-io
* ltp-ipc
* ltp-math
* ltp-mm
* ltp-nptl
* ltp-open-posix-tests
* ltp-pty
* ltp-sched
* ltp-securebits
* ltp-smoke
* ltp-syscalls
* ltp-tracing
* network-basic-tests
* packetdrill
* perf
* perf/Zstd-perf.data-compression
* rcutorture
* v4l2-compliance
* vdso
--
Linaro LKFT
https://lkft.linaro.org
Quoted 5 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.19.17 release. There are 717 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Quoted 7 lines
Note, this will be the LAST 5.19.y kernel to be released. Please move to the 6.0.y kernel branch at this point in time, as after this is released, this branch will be end-of-life.
Responses should be made by Mon, 24 Oct 2022 07:19:57 +0000. Anything received after that time might be too late.
Build results:
total: 150 pass: 150 fail: 0 Qemu test results: total: 490 pass: 490 fail: 0
Guenter
Quoted 6 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.19.17 release. There are 717 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Quoted 6 lines
Note, this will be the LAST 5.19.y kernel to be released. Please move to the 6.0.y kernel branch at this point in time, as after this is released, this branch will be end-of-life.
Responses should be made by Mon, 24 Oct 2022 07:19:57 +0000. Anything received after that time might be too late.
5.19.17-rc1 compiled and booted on my x86_64 test system. No errors or regressions.
All the best,
-srw
Quoted 13 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.19.17 release. There are 717 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Note, this will be the LAST 5.19.y kernel to be released. Please move to the 6.0.y kernel branch at this point in time, as after this is released, this branch will be end-of-life.
Responses should be made by Mon, 24 Oct 2022 07:19:57 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.19.17-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.19.y
and the diffstat can be found below.thanks,
greg k-h
Built and booted successfully on RISC-V RV64 (HiFive Unmatched).