6.3.2-rc1 review
Subsystems (6)
Greg Kroah-Hartman
maintainerPATCH 383/694 bpf: Fix struct_meta lookup for bpf_obj_free_fields kfunc call
In reply to Greg Kroah-HartmanFrom: Dave Marchevsky <[email protected]>
[ Upstream commit f6a6a5a976288e4d0d94eb1c6c9e983e8e5cdb31 ]
bpf_obj_drop_impl has a void return type. In check_kfunc_call, the "else if" which sets insn_aux->kptr_struct_meta for bpf_obj_drop_impl is surrounded by a larger if statement which checks btf_type_is_ptr. As a result:
* The bpf_obj_drop_impl-specific code will never execute
* The btf_struct_meta input to bpf_obj_drop is always NULL
* __bpf_obj_drop_impl will always see a NULL btf_record when called from BPF program, and won't call bpf_obj_free_fields
* program-allocated kptrs which have fields that should be cleaned up by bpf_obj_free_fields may instead leak resources
This patch adds a btf_type_is_void branch to the larger if and moves special handling for bpf_obj_drop_impl there, fixing the issue.
--- kernel/bpf/verifier.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
kernel/bpf/verifier.c +9 -5
@@ -10002,10 +10002,6 @@ static int check_kfunc_call(struct bpf_verifier_env *env, struct bpf_insn *insn, insn_aux->obj_new_size = ret_t->size; insn_aux->kptr_struct_meta =btf_find_struct_meta (ret_btf, ret_btf_id); - }else if (meta.func_id == special_kfunc_list[KF_bpf_obj_drop_impl]) { - insn_aux->kptr_struct_meta = -btf_find_struct_meta (meta.arg_obj_drop.btf, - meta.arg_obj_drop.btf_id); }else if (meta.func_id == special_kfunc_list[KF_bpf_list_pop_front] || meta.func_id == special_kfunc_list[KF_bpf_list_pop_back]) {struct btf_field *field = meta.arg_list_head.field;
@@ -10090,7 +10086,15 @@ static int check_kfunc_call(struct bpf_verifier_env *env, struct bpf_insn *insn,if (reg_may_point_to_spin_lock (®s[BPF_REG_0 ]) && !regs[BPF_REG_0 ].id) regs[BPF_REG_0 ].id = ++env->id_gen; - }/* else { add_kfunc_call() ensures it is btf_type_is_void(t) } */ + }else if (btf_type_is_void (t)) { +if (meta.btf == btf_vmlinux &&btf_id_set_contains (&special_kfunc_set, meta.func_id)) { +if (meta.func_id == special_kfunc_list[KF_bpf_obj_drop_impl]) { + insn_aux->kptr_struct_meta = +btf_find_struct_meta (meta.arg_obj_drop.btf, + meta.arg_obj_drop.btf_id); + } + } + } nargs =btf_type_vlen (meta.func_proto); args = (const struct btf_param *)(meta.func_proto +1 );
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 384/694 f2fs: fix iostat lock protection
In reply to Greg Kroah-HartmanFrom: Qilin Tan <[email protected]>
[ Upstream commit 144f1cd40bf91fb3ac1d41806470756ce774f389 ]
Made iostat lock irq safe to avoid potentinal deadlock.
Deadlock scenario:f2fs_attr_store
-> f2fs_sbi_store
-> _sbi_store
-> spin_lock(sbi->iostat_lock)
<interrupt request>
-> scsi_end_request
-> bio_endio
-> f2fs_dio_read_end_io
-> f2fs_update_iostat
-> spin_lock_irqsave(sbi->iostat_lock) ===> Dead lock here--- fs/f2fs/sysfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/f2fs/sysfs.c +2 -2
@@ -575,9 +575,9 @@ static ssize_t __sbi_store(struct f2fs_attr *a,if (!strcmp (a->attr.name,"iostat_period_ms" )) {if (t <MIN_IOSTAT_PERIOD_MS || t >MAX_IOSTAT_PERIOD_MS )return -EINVAL ; -spin_lock (&sbi->iostat_lock); +spin_lock_irq (&sbi->iostat_lock); sbi->iostat_period_ms = (unsigned int )t; -spin_unlock (&sbi->iostat_lock); +spin_unlock_irq (&sbi->iostat_lock);return count; }#endif
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 385/694 net: qrtr: correct types of trace event parameters
In reply to Greg Kroah-HartmanFrom: Simon Horman <[email protected]>
[ Upstream commit 054fbf7ff8143d35ca7d3bb5414bb44ee1574194 ]
The arguments passed to the trace events are of type unsigned int, however the signature of the events used __le32 parameters.
I may be missing the point here, but sparse flagged this and it does seem incorrect to me.
net/qrtr/ns.c: note: in included file (through include/trace/trace_events.h, include/trace/define_trace.h, include/trace/events/qrtr.h):
./include/trace/events/qrtr.h:11:1: warning: cast to restricted __le32
./include/trace/events/qrtr.h:11:1: warning: restricted __le32 degrades to integer ./include/trace/events/qrtr.h:11:1: warning: restricted __le32 degrades to integer
... (a lot more similar warnings)
net/qrtr/ns.c:115:47: expected restricted __le32 [usertype] service
net/qrtr/ns.c:115:47: got unsigned int service
net/qrtr/ns.c:115:61: warning: incorrect type in argument 2 (different base types)
... (a lot more similar warnings)
--- include/trace/events/qrtr.h | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-)
include/trace/events/qrtr.h +18 -15
@@ -10,15 +10,16 @@ TRACE_EVENT(qrtr_ns_service_announce_new, - TP_PROTO(__le32 service, __le32 instance, __le32 node, __le32 port), + TP_PROTO(unsigned int service, unsigned int instance, + unsigned int node, unsigned int port), TP_ARGS(service, instance, node, port), TP_STRUCT__entry( - __field(__le32, service) - __field(__le32, instance) - __field(__le32, node) - __field(__le32, port) + __field(unsigned int, service) + __field(unsigned int, instance) + __field(unsigned int, node) + __field(unsigned int, port) ), TP_fast_assign(
@@ -36,15 +37,16 @@ TRACE_EVENT(qrtr_ns_service_announce_new, TRACE_EVENT(qrtr_ns_service_announce_del, - TP_PROTO(__le32 service, __le32 instance, __le32 node, __le32 port), + TP_PROTO(unsigned int service, unsigned int instance, + unsigned int node, unsigned int port), TP_ARGS(service, instance, node, port), TP_STRUCT__entry( - __field(__le32, service) - __field(__le32, instance) - __field(__le32, node) - __field(__le32, port) + __field(unsigned int, service) + __field(unsigned int, instance) + __field(unsigned int, node) + __field(unsigned int, port) ), TP_fast_assign(
@@ -62,15 +64,16 @@ TRACE_EVENT(qrtr_ns_service_announce_del, TRACE_EVENT(qrtr_ns_server_add, - TP_PROTO(__le32 service, __le32 instance, __le32 node, __le32 port), + TP_PROTO(unsigned int service, unsigned int instance, + unsigned int node, unsigned int port), TP_ARGS(service, instance, node, port), TP_STRUCT__entry( - __field(__le32, service) - __field(__le32, instance) - __field(__le32, node) - __field(__le32, port) + __field(unsigned int, service) + __field(unsigned int, instance) + __field(unsigned int, node) + __field(unsigned int, port) ), TP_fast_assign(
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 386/694 selftests: xsk: Use correct UMEM size in testapp_invalid_desc
In reply to Greg Kroah-HartmanFrom: Kal Conley <[email protected]>
[ Upstream commit 7a2050df244e2c9a4e90882052b7907450ad10ed ]
Avoid UMEM_SIZE macro in testapp_invalid_desc which is incorrect when the frame size is not XSK_UMEM__DEFAULT_FRAME_SIZE. Also remove the macro since it's no longer being used.
--- tools/testing/selftests/bpf/xskxceiver.c | 9 +++++---- tools/testing/selftests/bpf/xskxceiver.h | 1 - 2 files changed, 5 insertions(+), 5 deletions(-)
tools/testing/selftests/bpf/xskxceiver.c +5 -4
@@ -1635,6 +1635,7 @@ static void testapp_single_pkt(struct test_spec *test)static void testapp_invalid_desc (struct test_spec *test) { +u64 umem_size = test->ifobj_tx->umem->num_frames * test->ifobj_tx->umem->frame_size;struct pkt pkts[] = {/* Zero packet address allowed */ {0 ,PKT_SIZE ,0 , true},
@@ -1645,9 +1646,9 @@ static void testapp_invalid_desc(struct test_spec *test)/* Packet too large */ {0x2000, XSK_UMEM__INVALID_FRAME_SIZE, 0, false},/* After umem ends */ - {UMEM_SIZE, PKT_SIZE, 0, false}, + {umem_size, PKT_SIZE, 0, false},/* Straddle the end of umem */ - {UMEM_SIZE - PKT_SIZE / 2, PKT_SIZE, 0, false}, + {umem_size - PKT_SIZE / 2, PKT_SIZE, 0, false},/* Straddle a page boundrary */ {0x3000 - PKT_SIZE / 2, PKT_SIZE, 0, false}, /* Straddle a 2K boundrary */
@@ -1665,8 +1666,8 @@ static void testapp_invalid_desc(struct test_spec *test) }if (test->ifobj_tx->shared_umem) { - pkts[4 ].addr +=UMEM_SIZE ; - pkts[5 ].addr +=UMEM_SIZE ; + pkts[4 ].addr += umem_size; + pkts[5 ].addr += umem_size; }pkt_stream_generate_custom (test, pkts,ARRAY_SIZE (pkts));
tools/testing/selftests/bpf/xskxceiver.h +0 -1
@@ -53,7 +53,6 @@#define THREAD_TMOUT 3#define DEFAULT_PKT_CNT (4 * 1024)#define DEFAULT_UMEM_BUFFERS (DEFAULT_PKT_CNT / 4) -#define UMEM_SIZE (DEFAULT_UMEM_BUFFERS * XSK_UMEM__DEFAULT_FRAME_SIZE)#define RX_FULL_RXQSIZE 32#define UMEM_HEADROOM_TEST_SIZE 128#define XSK_UMEM__INVALID_FRAME_SIZE (XSK_UMEM__DEFAULT_FRAME_SIZE + 1)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 387/694 selftests: xsk: Disable IPv6 on VETH1
In reply to Greg Kroah-HartmanFrom: Kal Conley <[email protected]>
[ Upstream commit f2b50f17268390567bc0e95642170d88f336c8f4 ]
This change fixes flakiness in the BIDIRECTIONAL test:
# [is_pkt_valid] expected length [60], got length [90] not ok 1 FAIL: SKB BUSY-POLL BIDIRECTIONAL
When IPv6 is enabled, the interface will periodically send MLDv1 and MLDv2 packets. These packets can cause the BIDIRECTIONAL test to fail since it uses VETH0 for RX.
For other tests, this was not a problem since they only receive on VETH1 and IPv6 was already disabled on VETH0.
--- tools/testing/selftests/bpf/test_xsk.sh | 1 + 1 file changed, 1 insertion(+)
tools/testing/selftests/bpf/test_xsk.sh +1 -0
@@ -116,6 +116,7 @@ setup_vethPairs() { ip link add ${VETH0} numtxqueues 4 numrxqueues 4 type veth peer name ${VETH1} numtxqueues 4 numrxqueues 4 if [ -f /proc/net/if_inet6 ]; then echo 1 > /proc/sys/net/ipv6/conf/${VETH0}/disable_ipv6 + echo 1 > /proc/sys/net/ipv6/conf/${VETH1}/disable_ipv6 fi if [[ $verbose -eq 1 ]]; then echo "setting up ${VETH1}"
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 388/694 selftests: xsk: Deflakify STATS_RX_DROPPED test
In reply to Greg Kroah-HartmanFrom: Kal Conley <[email protected]>
[ Upstream commit 68e7322142f5e731af222892d384d311835db0f1 ]
Fix flaky STATS_RX_DROPPED test. The receiver calls getsockopt after receiving the last (valid) packet which is not the final packet sent in the test (valid and invalid packets are sent in alternating fashion with the final packet being invalid). Since the last packet may or may not have been dropped already, both outcomes must be allowed.
This issue could also be fixed by making sure the last packet sent is valid. This alternative is left as an exercise to the reader (or the benevolent maintainers of this file).
This problem was quite visible on certain setups. On one machine this failure was observed 50% of the time.
Also, remove a redundant assignment of pkt_stream->nb_pkts. This field is already initialized by __pkt_stream_alloc.
--- tools/testing/selftests/bpf/xskxceiver.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
tools/testing/selftests/bpf/xskxceiver.c +8 -2
@@ -631,7 +631,6 @@ static struct pkt_stream *pkt_stream_generate(struct xsk_umem_info *umem, u32 nbif (!pkt_stream)exit_with_error (ENOMEM ); - pkt_stream->nb_pkts = nb_pkts;for (i =0 ; i < nb_pkts; i++) {pkt_set (umem, &pkt_stream->pkts[i], (i % umem->num_frames) * umem->frame_size, pkt_len);
@@ -1124,7 +1123,14 @@ static int validate_rx_dropped(struct ifobject *ifobject)if (err)return TEST_FAILURE ; -if (stats.rx_dropped == ifobject->pkt_stream->nb_pkts /2 ) +/* The receiver calls getsockopt after receiving the last (valid) +* packet which is not the final packet sent in this test (valid and +* invalid packets are sent in alternating fashion with the final +* packet being invalid). Since the last packet may or may not have +* been dropped already, both outcomes must be allowed. +*/ +if (stats.rx_dropped == ifobject->pkt_stream->nb_pkts /2 || + stats.rx_dropped == ifobject->pkt_stream->nb_pkts /2 -1 )return TEST_PASS ;return TEST_FAILURE ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 389/694 selftests/bpf: Wait for receive in cg_storage_multi test
In reply to Greg Kroah-HartmanFrom: YiFei Zhu <[email protected]>
[ Upstream commit 5af607a861d43ffff830fc1890033e579ec44799 ]
In some cases the loopback latency might be large enough, causing the assertion on invocations to be run before ingress prog getting executed. The assertion would fail and the test would flake.
This can be reliably reproduced by arbitrarily increasing the loopback latency (thanks to [1]):
tc qdisc add dev lo root handle 1: htb default 12
tc class add dev lo parent 1:1 classid 1:12 htb rate 20kbps ceil 20kbps tc qdisc add dev lo parent 1:12 netem delay 100ms
Fix this by waiting on the receive end, instead of instantly returning to the assert. The call to read() will wait for the default SO_RCVTIMEO timeout of 3 seconds provided by start_server().
[1] https://gist.github.com/kstevens715/4598301
--- tools/testing/selftests/bpf/prog_tests/cg_storage_multi.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
tools/testing/selftests/bpf/prog_tests/cg_storage_multi.c +6 -2
@@ -56,8 +56,9 @@ static bool assert_storage_noexist(struct bpf_map *map, const void *key)static bool connect_send (const char *cgroup_path) { -bool res = true;int server_fd =-1 , client_fd =-1 ; +char message[] ="message" ; +bool res = true;if (join_cgroup (cgroup_path)) goto out_clean;
@@ -70,7 +71,10 @@ static bool connect_send(const char *cgroup_path)if (client_fd <0 ) goto out_clean; -if (send (client_fd,"message" ,strlen ("message" ),0 ) <0 ) +if (send (client_fd, &message,sizeof (message),0 ) <0 ) + goto out_clean; + +if (read (server_fd, &message,sizeof (message)) <0 ) goto out_clean; res = false;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 390/694 bpftool: Fix bug for long instructions in program CFG dumps
In reply to Greg Kroah-HartmanFrom: Quentin Monnet <[email protected]>
[ Upstream commit 67cf52cdb6c8fa6365d29106555dacf95c9fd374 ]
When dumping the control flow graphs for programs using the 16-byte long load instruction, we need to skip the second part of this instruction when looking for the next instruction to process. Otherwise, we end up printing "BUG_ld_00" from the kernel disassembler in the CFG.
--- tools/bpf/bpftool/xlated_dumper.c | 7 +++++++ 1 file changed, 7 insertions(+)
tools/bpf/bpftool/xlated_dumper.c +7 -0
@@ -372,8 +372,15 @@ void dump_xlated_for_graph(struct dump_data *dd, void *buf_start, void *buf_end,struct bpf_insn *insn_start = buf_start;struct bpf_insn *insn_end = buf_end;struct bpf_insn *cur = insn_start; +bool double_insn = false;for (; cur <= insn_end; cur++) { +if (double_insn) { + double_insn = false; +continue ; + } + double_insn = cur->code == (BPF_LD |BPF_IMM |BPF_DW ); +printf ("% 4d: " , (int )(cur - insn_start + start_idx));print_bpf_insn (&cbs, cur, true);if (cur != insn_end)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 391/694 crypto: drbg - Only fail when jent is unavailable in FIPS mode
In reply to Greg Kroah-HartmanFrom: Herbert Xu <[email protected]>
[ Upstream commit 686cd976b6ddedeeb1a1fb09ba53a891d3cc9a03 ]
When jent initialisation fails for any reason other than ENOENT, the entire drbg fails to initialise, even when we're not in FIPS mode. This is wrong because we can still use the kernel RNG when we're not in FIPS mode.
Change it so that it only fails when we are in FIPS mode.
--- crypto/drbg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
crypto/drbg.c +1 -1
@@ -1546,7 +1546,7 @@ static int drbg_prepare_hrng(struct drbg_state *drbg)const int err =PTR_ERR (drbg->jent); drbg->jent =NULL ; -if (fips_enabled || err != -ENOENT ) +if (fips_enabled)return err;pr_info ("DRBG: Continuing without Jitter RNG\n" ); }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 392/694 xsk: Fix unaligned descriptor validation
In reply to Greg Kroah-HartmanFrom: Kal Conley <[email protected]>
[ Upstream commit d769ccaf957fe7391f357c0a923de71f594b8a2b ]
Make sure unaligned descriptors that straddle the end of the UMEM are considered invalid. Currently, descriptor validation is broken for zero-copy mode which only checks descriptors at page granularity. For example, descriptors in zero-copy mode that overrun the end of the UMEM but not a page boundary are (incorrectly) considered valid. The UMEM boundary check needs to happen before the page boundary and contiguity checks in xp_desc_crosses_non_contig_pg(). Do this check in xp_unaligned_validate_desc() instead like xp_check_unaligned() already does.
--- include/net/xsk_buff_pool.h | 9 ++------- net/xdp/xsk_queue.h | 1 + 2 files changed, 3 insertions(+), 7 deletions(-)
include/net/xsk_buff_pool.h +2 -7
@@ -180,13 +180,8 @@ static inline bool xp_desc_crosses_non_contig_pg(struct xsk_buff_pool *pool,if (likely (!cross_pg))return false; -if (pool->dma_pages_cnt) { -return !(pool->dma_pages[addr >>PAGE_SHIFT ] & -XSK_NEXT_PG_CONTIG_MASK ); - } - -/* skb path */ -return addr + len > pool->addrs_cnt; +return pool->dma_pages_cnt && + !(pool->dma_pages[addr >>PAGE_SHIFT ] &XSK_NEXT_PG_CONTIG_MASK ); }static inline u64 xp_aligned_extract_addr (struct xsk_buff_pool *pool,u64 addr)
net/xdp/xsk_queue.h +1 -0
@@ -162,6 +162,7 @@ static inline bool xp_unaligned_validate_desc(struct xsk_buff_pool *pool,return false;if (base_addr >= pool->addrs_cnt || addr >= pool->addrs_cnt || + addr + desc->len > pool->addrs_cnt ||xp_desc_crosses_non_contig_pg (pool, addr, desc->len))return false;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 393/694 f2fs: fix to avoid use-after-free for cached IPU bio
In reply to Greg Kroah-HartmanFrom: Chao Yu <[email protected]>
[ Upstream commit 5cdb422c839134273866208dad5360835ddb9794 ]
xfstest generic/019 reports a bug:
kernel BUG at mm/filemap.c:1619!
RIP: 0010:folio_end_writeback+0x8a/0x90 Call Trace: end_page_writeback+0x1c/0x60 f2fs_write_end_io+0x199/0x420 bio_endio+0x104/0x180 submit_bio_noacct+0xa5/0x510 submit_bio+0x48/0x80 f2fs_submit_write_bio+0x35/0x300 f2fs_submit_merged_ipu_write+0x2a0/0x2b0 f2fs_write_single_data_page+0x838/0x8b0 f2fs_write_cache_pages+0x379/0xa30 f2fs_write_data_pages+0x30c/0x340 do_writepages+0xd8/0x1b0 __writeback_single_inode+0x44/0x370 writeback_sb_inodes+0x233/0x4d0 __writeback_inodes_wb+0x56/0xf0 wb_writeback+0x1dd/0x2d0 wb_workfn+0x367/0x4a0 process_one_work+0x21d/0x430 worker_thread+0x4e/0x3c0 kthread+0x103/0x130 ret_from_fork+0x2c/0x50
The root cause is: after cp_error is set, f2fs_submit_merged_ipu_write() in f2fs_write_single_data_page() tries to flush IPU bio in cache, however f2fs_submit_merged_ipu_write() missed to check validity of @bio parameter, result in submitting random cached bio which belong to other IO context, then it will cause use-after-free issue, fix it by adding additional validity check.
--- fs/f2fs/data.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
fs/f2fs/data.c +4 -1
@@ -874,6 +874,8 @@ void f2fs_submit_merged_ipu_write(struct f2fs_sb_info *sbi,bool found = false;struct bio *target = bio ? *bio :NULL ; +f2fs_bug_on (sbi, !target && !page); +for (temp =HOT ; temp <NR_TEMP_TYPE && !found; temp++) {struct f2fs_bio_info *io = sbi->write_io[DATA ] + temp;struct list_head *head = &io->bio_list;
@@ -2898,7 +2900,8 @@ int f2fs_write_single_data_page(struct page *page, int *submitted,if (unlikely (f2fs_cp_error (sbi))) {f2fs_submit_merged_write (sbi,DATA ); -f2fs_submit_merged_ipu_write (sbi, bio,NULL ); +if (bio && *bio) +f2fs_submit_merged_ipu_write (sbi, bio,NULL ); submitted =NULL ; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 394/694 wifi: iwlwifi: fix duplicate entry in iwl_dev_info_table
In reply to Greg Kroah-HartmanFrom: Gregory Greenman <[email protected]>
[ Upstream commit fc3c2f0ed86b65dff4b6844c59c597b977cae533 ]
There're two identical entries for ax1650 device in iwl_dev_info_table. Remove one of the duplicate entries.
--- drivers/net/wireless/intel/iwlwifi/pcie/drv.c | 1 - 1 file changed, 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/pcie/drv.c +0 -1
@@ -565,7 +565,6 @@ static const struct iwl_dev_info iwl_dev_info_table[] = {IWL_DEV_INFO (0x43F0 ,0x1652 , killer1650i_2ax_cfg_qu_b0_hr_b0, iwl_ax201_killer_1650i_name),IWL_DEV_INFO (0x43F0 ,0x2074 , iwl_ax201_cfg_qu_hr,NULL ),IWL_DEV_INFO (0x43F0 ,0x4070 , iwl_ax201_cfg_qu_hr,NULL ), -IWL_DEV_INFO (0x43F0 ,0x1651 , killer1650s_2ax_cfg_qu_b0_hr_b0, iwl_ax201_killer_1650s_name),IWL_DEV_INFO (0xA0F0 ,0x0070 , iwl_ax201_cfg_qu_hr,NULL ),IWL_DEV_INFO (0xA0F0 ,0x0074 , iwl_ax201_cfg_qu_hr,NULL ), IWL_DEV_INFO(0xA0F0, 0x0078, iwl_ax201_cfg_qu_hr, NULL),
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 395/694 bpf/btf: Fix is_int_ptr()
In reply to Greg Kroah-HartmanFrom: Feng Zhou <[email protected]>
[ Upstream commit 91f2dc6838c19342f7f2993627c622835cc24890 ]
When tracing a kernel function with arg type is u32*, btf_ctx_access() would report error: arg2 type INT is not a struct.
The commit bb6728d75611 ("bpf: Allow access to int pointer arguments in tracing programs") added support for int pointer, but did not skip modifiers before checking it's type. This patch fixes it.
--- kernel/bpf/btf.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
kernel/bpf/btf.c +2 -6
@@ -5891,12 +5891,8 @@ struct btf *bpf_prog_get_target_btf(const struct bpf_prog *prog)static bool is_int_ptr (struct btf *btf,const struct btf_type *t) { -/* t comes in already as a pointer */ - t =btf_type_by_id (btf, t->type); - -/* allow const */ -if (BTF_INFO_KIND (t->info) ==BTF_KIND_CONST ) - t =btf_type_by_id (btf, t->type); +/* skip modifiers */ + t =btf_type_skip_modifiers (btf, t->type,NULL );return btf_type_is_int (t); }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 396/694 scsi: lpfc: Fix ioremap issues in lpfc_sli4_pci_mem_setup()
In reply to Greg Kroah-HartmanFrom: Shuchang Li <[email protected]>
[ Upstream commit 91a0c0c1413239d0548b5aac4c82f38f6d53a91e ]
When if_type equals zero and pci_resource_start(pdev, PCI_64BIT_BAR4) returns false, drbl_regs_memmap_p is not remapped. This passes a NULL pointer to iounmap(), which can trigger a WARN() on certain arches.
When if_type equals six and pci_resource_start(pdev, PCI_64BIT_BAR4) returns true, drbl_regs_memmap_p may has been remapped and ctrl_regs_memmap_p is not remapped. This is a resource leak and passes a NULL pointer to iounmap().
To fix these issues, we need to add null checks before iounmap(), and change some goto labels.
--- drivers/scsi/lpfc/lpfc_init.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/scsi/lpfc/lpfc_init.c +6 -4
@@ -12026,7 +12026,7 @@ lpfc_sli4_pci_mem_setup(struct lpfc_hba *phba) goto out_iounmap_all; }else { error = -ENOMEM ; - goto out_iounmap_all; + goto out_iounmap_ctrl; } }
@@ -12044,7 +12044,7 @@ lpfc_sli4_pci_mem_setup(struct lpfc_hba *phba)dev_err (&pdev->dev,"ioremap failed for SLI4 HBA dpp registers.\n" ); error = -ENOMEM ; - goto out_iounmap_ctrl; + goto out_iounmap_all; } phba->pci_bar4_memmap_p = phba->sli4_hba.dpp_regs_memmap_p; }
@@ -12069,9 +12069,11 @@ lpfc_sli4_pci_mem_setup(struct lpfc_hba *phba)return 0 ; out_iounmap_all: -iounmap (phba->sli4_hba.drbl_regs_memmap_p); +if (phba->sli4_hba.drbl_regs_memmap_p) +iounmap (phba->sli4_hba.drbl_regs_memmap_p); out_iounmap_ctrl: -iounmap (phba->sli4_hba.ctrl_regs_memmap_p); +if (phba->sli4_hba.ctrl_regs_memmap_p) +iounmap (phba->sli4_hba.ctrl_regs_memmap_p); out_iounmap_conf:iounmap (phba->sli4_hba.conf_regs_memmap_p);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 397/694 net: ethernet: stmmac: dwmac-rk: rework optional clock handling
In reply to Greg Kroah-HartmanFrom: Sebastian Reichel <[email protected]>
[ Upstream commit ea449f7fa0bf3fcd02e04a770b9ff707bf5e8f96 ]
The clock requesting code is quite repetitive. Fix this by requesting the clocks via devm_clk_bulk_get_optional. The optional variant has been used, since this is effectively what the old code did. The exact clocks required depend on the platform and configuration. As a side effect this change adds correct -EPROBE_DEFER handling.
--- .../net/ethernet/stmicro/stmmac/dwmac-rk.c | 183 +++++++----------- 1 file changed, 70 insertions(+), 113 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c +70 -113
@@ -39,6 +39,24 @@ struct rk_gmac_ops {u32 regs[]; }; +static const char *const rk_clocks[] = { +"aclk_mac" ,"pclk_mac" ,"mac_clk_tx" ,"clk_mac_speed" , +}; + +static const char *const rk_rmii_clocks[] = { +"mac_clk_rx" ,"clk_mac_ref" ,"clk_mac_refout" , +}; + +enum rk_clocks_index { +RK_ACLK_MAC =0 , +RK_PCLK_MAC , +RK_MAC_CLK_TX , +RK_CLK_MAC_SPEED , +RK_MAC_CLK_RX , +RK_CLK_MAC_REF , +RK_CLK_MAC_REFOUT , +}; +struct rk_priv_data {struct platform_device *pdev;phy_interface_t phy_iface;
@@ -51,15 +69,9 @@ struct rk_priv_data {bool clock_input;bool integrated_phy; +struct clk_bulk_data *clks; +int num_clks;struct clk *clk_mac; -struct clk *gmac_clkin; -struct clk *mac_clk_rx; -struct clk *mac_clk_tx; -struct clk *clk_mac_ref; -struct clk *clk_mac_refout; -struct clk *clk_mac_speed; -struct clk *aclk_mac; -struct clk *pclk_mac;struct clk *clk_phy;struct reset_control *phy_reset;
@@ -104,10 +116,11 @@ static void px30_set_to_rmii(struct rk_priv_data *bsp_priv)static void px30_set_rmii_speed (struct rk_priv_data *bsp_priv,int speed) { +struct clk *clk_mac_speed = bsp_priv->clks[RK_CLK_MAC_SPEED ].clk;struct device *dev = &bsp_priv->pdev->dev;int ret; -if (IS_ERR (bsp_priv->clk_mac_speed)) { +if (!clk_mac_speed) {dev_err (dev,"%s: Missing clk_mac_speed clock\n" , __func__);return ; }
@@ -116,7 +129,7 @@ static void px30_set_rmii_speed(struct rk_priv_data *bsp_priv, int speed)regmap_write (bsp_priv->grf,PX30_GRF_GMAC_CON1 ,PX30_GMAC_SPEED_10M ); - ret =clk_set_rate (bsp_priv->clk_mac_speed,2500000 ); + ret =clk_set_rate (clk_mac_speed,2500000 );if (ret)dev_err (dev,"%s: set clk_mac_speed rate 2500000 failed: %d\n" , __func__, ret);
@@ -124,7 +137,7 @@ static void px30_set_rmii_speed(struct rk_priv_data *bsp_priv, int speed)regmap_write (bsp_priv->grf,PX30_GRF_GMAC_CON1 ,PX30_GMAC_SPEED_100M ); - ret =clk_set_rate (bsp_priv->clk_mac_speed,25000000 ); + ret =clk_set_rate (clk_mac_speed,25000000 );if (ret)dev_err (dev,"%s: set clk_mac_speed rate 25000000 failed: %d\n" , __func__, ret);
@@ -1066,6 +1079,7 @@ static void rk3568_set_to_rmii(struct rk_priv_data *bsp_priv)static void rk3568_set_gmac_speed (struct rk_priv_data *bsp_priv,int speed) { +struct clk *clk_mac_speed = bsp_priv->clks[RK_CLK_MAC_SPEED ].clk;struct device *dev = &bsp_priv->pdev->dev;unsigned long rate;int ret;
@@ -1085,7 +1099,7 @@ static void rk3568_set_gmac_speed(struct rk_priv_data *bsp_priv, int speed)return ; } - ret =clk_set_rate (bsp_priv->clk_mac_speed, rate); + ret =clk_set_rate (clk_mac_speed, rate);if (ret)dev_err (dev,"%s: set clk_mac_speed rate %ld failed %d\n" , __func__, rate, ret);
@@ -1371,6 +1385,7 @@ static void rv1126_set_to_rmii(struct rk_priv_data *bsp_priv)static void rv1126_set_rgmii_speed (struct rk_priv_data *bsp_priv,int speed) { +struct clk *clk_mac_speed = bsp_priv->clks[RK_CLK_MAC_SPEED ].clk;struct device *dev = &bsp_priv->pdev->dev;unsigned long rate;int ret;
@@ -1390,7 +1405,7 @@ static void rv1126_set_rgmii_speed(struct rk_priv_data *bsp_priv, int speed)return ; } - ret =clk_set_rate (bsp_priv->clk_mac_speed, rate); + ret =clk_set_rate (clk_mac_speed, rate);if (ret)dev_err (dev,"%s: set clk_mac_speed rate %ld failed %d\n" , __func__, rate, ret);
@@ -1398,6 +1413,7 @@ static void rv1126_set_rgmii_speed(struct rk_priv_data *bsp_priv, int speed)static void rv1126_set_rmii_speed (struct rk_priv_data *bsp_priv,int speed) { +struct clk *clk_mac_speed = bsp_priv->clks[RK_CLK_MAC_SPEED ].clk;struct device *dev = &bsp_priv->pdev->dev;unsigned long rate;int ret;
@@ -1414,7 +1430,7 @@ static void rv1126_set_rmii_speed(struct rk_priv_data *bsp_priv, int speed)return ; } - ret =clk_set_rate (bsp_priv->clk_mac_speed, rate); + ret =clk_set_rate (clk_mac_speed, rate);if (ret)dev_err (dev,"%s: set clk_mac_speed rate %ld failed %d\n" , __func__, rate, ret);
@@ -1475,68 +1491,50 @@ static int rk_gmac_clk_init(struct plat_stmmacenet_data *plat) {struct rk_priv_data *bsp_priv = plat->bsp_priv;struct device *dev = &bsp_priv->pdev->dev; -int ret; +int phy_iface = bsp_priv->phy_iface; +int i, j, ret; bsp_priv->clk_enabled = false; - bsp_priv->mac_clk_rx =devm_clk_get (dev,"mac_clk_rx" ); -if (IS_ERR (bsp_priv->mac_clk_rx)) -dev_err (dev,"cannot get clock %s\n" , -"mac_clk_rx" ); - - bsp_priv->mac_clk_tx =devm_clk_get (dev,"mac_clk_tx" ); -if (IS_ERR (bsp_priv->mac_clk_tx)) -dev_err (dev,"cannot get clock %s\n" , -"mac_clk_tx" ); + bsp_priv->num_clks =ARRAY_SIZE (rk_clocks); +if (phy_iface ==PHY_INTERFACE_MODE_RMII ) + bsp_priv->num_clks +=ARRAY_SIZE (rk_rmii_clocks); - bsp_priv->aclk_mac =devm_clk_get (dev,"aclk_mac" ); -if (IS_ERR (bsp_priv->aclk_mac)) -dev_err (dev,"cannot get clock %s\n" , -"aclk_mac" ); + bsp_priv->clks =devm_kcalloc (dev, bsp_priv->num_clks, +sizeof (*bsp_priv->clks),GFP_KERNEL ); +if (!bsp_priv->clks) +return -ENOMEM ; - bsp_priv->pclk_mac =devm_clk_get (dev,"pclk_mac" ); -if (IS_ERR (bsp_priv->pclk_mac)) -dev_err (dev,"cannot get clock %s\n" , -"pclk_mac" ); +for (i =0 ; i <ARRAY_SIZE (rk_clocks); i++) + bsp_priv->clks[i].id = rk_clocks[i]; - bsp_priv->clk_mac =devm_clk_get (dev,"stmmaceth" ); -if (IS_ERR (bsp_priv->clk_mac)) -dev_err (dev,"cannot get clock %s\n" , -"stmmaceth" ); - -if (bsp_priv->phy_iface ==PHY_INTERFACE_MODE_RMII ) { - bsp_priv->clk_mac_ref =devm_clk_get (dev,"clk_mac_ref" ); -if (IS_ERR (bsp_priv->clk_mac_ref)) -dev_err (dev,"cannot get clock %s\n" , -"clk_mac_ref" ); - -if (!bsp_priv->clock_input) { - bsp_priv->clk_mac_refout = -devm_clk_get (dev,"clk_mac_refout" ); -if (IS_ERR (bsp_priv->clk_mac_refout)) -dev_err (dev,"cannot get clock %s\n" , -"clk_mac_refout" ); - } +if (phy_iface ==PHY_INTERFACE_MODE_RMII ) { +for (j =0 ; j <ARRAY_SIZE (rk_rmii_clocks); j++) + bsp_priv->clks[i++].id = rk_rmii_clocks[j]; } - bsp_priv->clk_mac_speed =devm_clk_get (dev,"clk_mac_speed" ); -if (IS_ERR (bsp_priv->clk_mac_speed)) -dev_err (dev,"cannot get clock %s\n" ,"clk_mac_speed" ); + ret =devm_clk_bulk_get_optional (dev, bsp_priv->num_clks, + bsp_priv->clks); +if (ret) +return dev_err_probe (dev, ret,"Failed to get clocks\n" ); + +/* "stmmaceth" will be enabled by the core */ + bsp_priv->clk_mac =devm_clk_get (dev,"stmmaceth" ); + ret =PTR_ERR_OR_ZERO (bsp_priv->clk_mac); +if (ret) +return dev_err_probe (dev, ret,"Cannot get stmmaceth clock\n" );if (bsp_priv->clock_input) {dev_info (dev,"clock input from PHY\n" ); - }else { -if (bsp_priv->phy_iface ==PHY_INTERFACE_MODE_RMII ) -clk_set_rate (bsp_priv->clk_mac,50000000 ); + }else if (phy_iface ==PHY_INTERFACE_MODE_RMII ) { +clk_set_rate (bsp_priv->clk_mac,50000000 ); }if (plat->phy_node && bsp_priv->integrated_phy) { bsp_priv->clk_phy =of_clk_get (plat->phy_node,0 ); -if (IS_ERR (bsp_priv->clk_phy)) { - ret =PTR_ERR (bsp_priv->clk_phy); -dev_err (dev,"Cannot get PHY clock: %d\n" , ret); -return -EINVAL ; - } + ret =PTR_ERR_OR_ZERO (bsp_priv->clk_phy); +if (ret) +return dev_err_probe (dev, ret,"Cannot get PHY clock\n" );clk_set_rate (bsp_priv->clk_phy,50000000 ); }
@@ -1545,77 +1543,36 @@ static int rk_gmac_clk_init(struct plat_stmmacenet_data *plat)static int gmac_clk_enable (struct rk_priv_data *bsp_priv,bool enable) { -int phy_iface = bsp_priv->phy_iface; +int ret;if (enable) {if (!bsp_priv->clk_enabled) { -if (phy_iface ==PHY_INTERFACE_MODE_RMII ) { -if (!IS_ERR (bsp_priv->mac_clk_rx)) -clk_prepare_enable ( - bsp_priv->mac_clk_rx); - -if (!IS_ERR (bsp_priv->clk_mac_ref)) -clk_prepare_enable ( - bsp_priv->clk_mac_ref); - -if (!IS_ERR (bsp_priv->clk_mac_refout)) -clk_prepare_enable ( - bsp_priv->clk_mac_refout); - } - -if (!IS_ERR (bsp_priv->clk_phy)) -clk_prepare_enable (bsp_priv->clk_phy); - -if (!IS_ERR (bsp_priv->aclk_mac)) -clk_prepare_enable (bsp_priv->aclk_mac); - -if (!IS_ERR (bsp_priv->pclk_mac)) -clk_prepare_enable (bsp_priv->pclk_mac); - -if (!IS_ERR (bsp_priv->mac_clk_tx)) -clk_prepare_enable (bsp_priv->mac_clk_tx); + ret =clk_bulk_prepare_enable (bsp_priv->num_clks, + bsp_priv->clks); +if (ret) +return ret; -if (!IS_ERR (bsp_priv->clk_mac_speed)) -clk_prepare_enable (bsp_priv->clk_mac_speed); + ret =clk_prepare_enable (bsp_priv->clk_phy); +if (ret) +return ret;if (bsp_priv->ops && bsp_priv->ops->set_clock_selection) bsp_priv->ops->set_clock_selection (bsp_priv, bsp_priv->clock_input, true); -/** -* if (!IS_ERR(bsp_priv->clk_mac)) -* clk_prepare_enable(bsp_priv->clk_mac); -*/ mdelay (5 ); bsp_priv->clk_enabled = true; } }else {if (bsp_priv->clk_enabled) { -if (phy_iface ==PHY_INTERFACE_MODE_RMII ) { -clk_disable_unprepare (bsp_priv->mac_clk_rx); - -clk_disable_unprepare (bsp_priv->clk_mac_ref); - -clk_disable_unprepare (bsp_priv->clk_mac_refout); - } - +clk_bulk_disable_unprepare (bsp_priv->num_clks, + bsp_priv->clks);clk_disable_unprepare (bsp_priv->clk_phy); -clk_disable_unprepare (bsp_priv->aclk_mac); - -clk_disable_unprepare (bsp_priv->pclk_mac); - -clk_disable_unprepare (bsp_priv->mac_clk_tx); - -clk_disable_unprepare (bsp_priv->clk_mac_speed); -if (bsp_priv->ops && bsp_priv->ops->set_clock_selection) bsp_priv->ops->set_clock_selection (bsp_priv, bsp_priv->clock_input, false); -/** -* if (!IS_ERR(bsp_priv->clk_mac)) -* clk_disable_unprepare(bsp_priv->clk_mac); -*/ + bsp_priv->clk_enabled = false; } }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 398/694 net: ethernet: stmmac: dwmac-rk: fix optional phy regulator handling
In reply to Greg Kroah-HartmanFrom: Sebastian Reichel <[email protected]>
[ Upstream commit db21973263f8c56750cb610f1d5e8bee00a513b9 ]
The usual devm_regulator_get() call already handles "optional" regulators by returning a valid dummy and printing a warning that the dummy regulator should be described properly. This code open coded the same behaviour, but masked any errors that are not -EPROBE_DEFER and is quite noisy.
This change effectively unmasks and propagates regulators errors not involving -ENODEV, downgrades the error print to warning level if no regulator is specified and captures the probe defer message for /sys/kernel/debug/devices_deferred.
--- drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c +4 -10
@@ -1586,9 +1586,6 @@ static int phy_power_on(struct rk_priv_data *bsp_priv, bool enable)int ret;struct device *dev = &bsp_priv->pdev->dev; -if (!ldo) -return 0 ; -if (enable) { ret =regulator_enable (ldo);if (ret)
@@ -1636,14 +1633,11 @@ static struct rk_priv_data *rk_gmac_setup(struct platform_device *pdev, } } - bsp_priv->regulator =devm_regulator_get_optional (dev,"phy" ); + bsp_priv->regulator =devm_regulator_get (dev,"phy" );if (IS_ERR (bsp_priv->regulator)) { -if (PTR_ERR (bsp_priv->regulator) == -EPROBE_DEFER ) { -dev_err (dev,"phy regulator is not available yet, deferred probing\n" ); -return ERR_PTR (-EPROBE_DEFER ); - } -dev_err (dev,"no regulator found\n" ); - bsp_priv->regulator =NULL ; + ret =PTR_ERR (bsp_priv->regulator); +dev_err_probe (dev, ret,"failed to get phy regulator\n" ); +return ERR_PTR (ret); } ret =of_property_read_string (dev->of_node,"clock_in_out" , &strings);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 399/694 wifi: ath11k: fix writing to unintended memory region
In reply to Greg Kroah-HartmanFrom: P Praneesh <[email protected]>
[ Upstream commit 756a7f90878f0866fd2fe167ef37e90b47326b96 ]
While initializing spectral, the magic value is getting written to the invalid memory address leading to random boot-up crash. This occurs due to the incorrect index increment in ath11k_dbring_fill_magic_value function. Fix it by replacing the existing logic with memset32 to ensure there is no invalid memory access.
Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.4.0.1-01838-QCAHKSWPL_SILICONZ-1
--- drivers/net/wireless/ath/ath11k/dbring.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/net/wireless/ath/ath11k/dbring.c +6 -6
@@ -26,13 +26,13 @@ int ath11k_dbring_validate_buffer(struct ath11k *ar, void *buffer, u32 size)static void ath11k_dbring_fill_magic_value (struct ath11k *ar,void *buffer,u32 size) { -u32 *temp; -int idx; - - size = size >>2 ; +/* memset32 function fills buffer payload with the ATH11K_DB_MAGIC_VALUE +* and the variable size is expected to be the number of u32 values +* to be stored, not the number of bytes. +*/ + size = size /sizeof (u32); -for (idx =0 , temp = buffer; idx < size; idx++, temp++) - *temp++ =ATH11K_DB_MAGIC_VALUE ; +memset32 (buffer,ATH11K_DB_MAGIC_VALUE , size); } static int ath11k_dbring_bufs_replenish(struct ath11k *ar,
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 400/694 bpf, sockmap: fix deadlocks in the sockhash and sockmap
In reply to Greg Kroah-HartmanFrom: Xin Liu <[email protected]>
[ Upstream commit ed17aa92dc56b6d8883e4b7a8f1c6fbf5ed6cd29 ]
When huang uses sched_switch tracepoint, the tracepoint does only one thing in the mounted ebpf program, which deletes the fixed elements in sockhash ([0])
It seems that elements in sockhash are rarely actively deleted by users or ebpf program. Therefore, we do not pay much attention to their deletion. Compared with hash maps, sockhash only provides spin_lock_bh protection. This causes it to appear to have self-locking behavior in the interrupt context.
[0]:https://lore.kernel.org/all/CABcoxUayum5oOqFMMqAeWuS8+EzojquSOSyDA3J_2omY=2EeAg@mail.gmail.com/
--- net/core/sock_map.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
net/core/sock_map.c +6 -4
@@ -414,8 +414,9 @@ static int __sock_map_delete(struct bpf_stab *stab, struct sock *sk_test, {struct sock *sk;int err =0 ; +unsigned long flags; -raw_spin_lock_bh (&stab->lock); +raw_spin_lock_irqsave (&stab->lock, flags); sk = *psk;if (!sk_test || sk_test == sk) sk =xchg (psk,NULL );
@@ -425,7 +426,7 @@ static int __sock_map_delete(struct bpf_stab *stab, struct sock *sk_test,else err = -EINVAL ; -raw_spin_unlock_bh (&stab->lock); +raw_spin_unlock_irqrestore (&stab->lock, flags);return err; }
@@ -923,11 +924,12 @@ static long sock_hash_delete_elem(struct bpf_map *map, void *key)struct bpf_shtab_bucket *bucket;struct bpf_shtab_elem *elem;int ret = -ENOENT ; +unsigned long flags; hash =sock_hash_bucket_hash (key, key_size); bucket =sock_hash_select_bucket (htab, hash); -raw_spin_lock_bh (&bucket->lock); +raw_spin_lock_irqsave (&bucket->lock, flags); elem =sock_hash_lookup_elem_raw (&bucket->head, hash, key, key_size);if (elem) {hlist_del_rcu (&elem->node);
@@ -935,7 +937,7 @@ static long sock_hash_delete_elem(struct bpf_map *map, void *key)sock_hash_free_elem (htab, elem); ret =0 ; } -raw_spin_unlock_bh (&bucket->lock); +raw_spin_unlock_irqrestore (&bucket->lock, flags);return ret; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 401/694 nvmet: fix error handling in nvmet_execute_identify_cns_cs_ns()
In reply to Greg Kroah-HartmanFrom: Damien Le Moal <[email protected]>
[ Upstream commit ab76e7206b672b2e8818cb121a04506956d6b223 ]
Nvme specifications state that:
If the I/O Command Set associated with the namespace identified by the NSID field does not support the Identify Namespace data structure specified by the CSI field, the controller shall abort the command with a status code of Invalid Field in Command.
In other words, if nvmet_execute_identify_cns_cs_ns() is called for a target with a block device that is not zoned, we should not return any data and set the status to NVME_SC_INVALID_FIELD.
While at it, it is also better to revalidate the ns block devie *before* checking if the block device is zoned, to ensure that nvmet_execute_identify_cns_cs_ns() operates against updated device characteristics.
--- drivers/nvme/target/zns.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
drivers/nvme/target/zns.c +9 -7
@@ -97,7 +97,7 @@ void nvmet_execute_identify_cns_cs_ctrl(struct nvmet_req *req)void nvmet_execute_identify_cns_cs_ns (struct nvmet_req *req) { -struct nvme_id_ns_zns *id_zns; +struct nvme_id_ns_zns *id_zns =NULL ;u64 zsze;u16 status;u32 mar, mor;
@@ -118,16 +118,18 @@ void nvmet_execute_identify_cns_cs_ns(struct nvmet_req *req)if (status) goto done; -if (!bdev_is_zoned (req->ns->bdev)) { - req->error_loc = offsetof(struct nvme_identify , nsid); - goto done; - } -if (nvmet_ns_revalidate (req->ns)) {mutex_lock (&req->ns->subsys->lock);nvmet_ns_changed (req->ns->subsys, req->ns->nsid);mutex_unlock (&req->ns->subsys->lock); } + +if (!bdev_is_zoned (req->ns->bdev)) { + status =NVME_SC_INVALID_FIELD |NVME_SC_DNR ; + req->error_loc = offsetof(struct nvme_identify , nsid); + goto out; + } + zsze = (bdev_zone_sectors (req->ns->bdev) <<9 ) >> req->ns->blksize_shift; id_zns->lbafe[0 ].zsze =cpu_to_le64 (zsze);
@@ -148,8 +150,8 @@ void nvmet_execute_identify_cns_cs_ns(struct nvmet_req *req) done: status =nvmet_copy_to_sgl (req,0 , id_zns,sizeof (*id_zns)); -kfree (id_zns); out: +kfree (id_zns);nvmet_req_complete (req, status); }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 402/694 nvmet: fix Identify Namespace handling
In reply to Greg Kroah-HartmanFrom: Damien Le Moal <[email protected]>
[ Upstream commit 8c098aa00118c35108f0c19bd3cdc45e11574948 ]
The identify command with cns set to NVME_ID_CNS_NS does not directly depend on the command set. The NVMe specifications is rather confusing here as it appears that this command only applies to the NVM command set. However, footnote 8 of Figure 273 in the NVMe 2.0 base specifications clearly state that this command applies to NVM command sets that support logical blocks, that is, NVM and ZNS. Both the NVM and ZNS command set specifications also list this identify as mandatory.
The command handling should thus not look at the csi field since it is defined as unused for this command. Given that we do not support the KV command set, simply remove the csi switch-case for that command handling and call directly nvmet_execute_identify_ns() in nvmet_execute_identify().
--- drivers/nvme/target/admin-cmd.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/nvme/target/admin-cmd.c +2 -7
@@ -692,13 +692,8 @@ static void nvmet_execute_identify(struct nvmet_req *req)switch (req->cmd->identify.cns) {case NVME_ID_CNS_NS : -switch (req->cmd->identify.csi) { -case NVME_CSI_NVM : -return nvmet_execute_identify_ns (req); -default : -break ; - } -break ; +nvmet_execute_identify_ns (req); +return ;case NVME_ID_CNS_CS_NS :if (IS_ENABLED (CONFIG_BLK_DEV_ZONED )) {switch (req->cmd->identify.csi) {
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 403/694 nvmet: fix Identify Controller handling
In reply to Greg Kroah-HartmanFrom: Damien Le Moal <[email protected]>
[ Upstream commit 62904b3b333e7f3c0f879dc3513295eee5765c9f ]
The identify command with cns set to NVME_ID_CNS_CTRL does not depend on the command set. The execution of this command should thus not look at the csi specified in the command. Simplify nvmet_execute_identify() to directly call nvmet_execute_identify_ctrl() without the csi switch-case.
--- drivers/nvme/target/admin-cmd.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/nvme/target/admin-cmd.c +2 -5
@@ -705,11 +705,8 @@ static void nvmet_execute_identify(struct nvmet_req *req) }break ;case NVME_ID_CNS_CTRL : -switch (req->cmd->identify.csi) { -case NVME_CSI_NVM : -return nvmet_execute_identify_ctrl (req); - } -break ; +nvmet_execute_identify_ctrl (req); +return ;case NVME_ID_CNS_CS_CTRL :if (IS_ENABLED (CONFIG_BLK_DEV_ZONED )) {switch (req->cmd->identify.csi) {
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 404/694 nvmet: fix Identify Active Namespace ID list handling
In reply to Greg Kroah-HartmanFrom: Damien Le Moal <[email protected]>
[ Upstream commit 97416f67d55fb8b866ff1815ca7ef26b6dfa6a5e ]
The identify command with cns set to NVME_ID_CNS_NS_ACTIVE_LIST does not depend on the command set. The execution of this command should thus not look at the csi field specified in the command. Simplify nvmet_execute_identify() to directly call nvmet_execute_identify_nslist() without the csi switch-case.
--- drivers/nvme/target/admin-cmd.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/nvme/target/admin-cmd.c +2 -7
@@ -718,13 +718,8 @@ static void nvmet_execute_identify(struct nvmet_req *req) }break ;case NVME_ID_CNS_NS_ACTIVE_LIST : -switch (req->cmd->identify.csi) { -case NVME_CSI_NVM : -return nvmet_execute_identify_nslist (req); -default : -break ; - } -break ; +nvmet_execute_identify_nslist (req); +return ;case NVME_ID_CNS_NS_DESC_LIST :if (nvmet_handle_identify_desclist (req) == true)return ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 405/694 nvmet: fix I/O Command Set specific Identify Controller
In reply to Greg Kroah-HartmanFrom: Damien Le Moal <[email protected]>
[ Upstream commit a5a6ab0950b46ab1ef4a5c83c80234018b81b38a ]
For an identify command with cns set to NVME_ID_CNS_CS_CTRL, the NVMe 2.0 specification states that:
If the I/O Command Set specified by the CSI field does not have an Identify Controller data structure, then the controller shall return a zero filled data structure. If the host requests a data structure for an I/O Command Set that the controller does not support, the controller shall abort the command with a status code of Invalid Field in Command.
However, the current implementation of this identify command in nvmet_execute_identify() only handles the ZNS command set, returning an error for the NVM command set, which is not compliant with the specifications as we do support this command set.
Fix this by:
1) Renaming nvmet_execute_identify_cns_cs_ctrl() to nvmet_execute_identify_ctrl_zns() to continue handling the ZNS command set as is.
2) Introduce a nvmet_execute_identify_ctrl_ns() helper to handle the NVM command set, returning a zero filled nvme_id_ctrl_nvm data structure.
3) Modify nvmet_execute_identify() to call these helpers based on the csi specified, returning an error for unsupported command sets.
--- drivers/nvme/target/admin-cmd.c | 22 ++++++++++++++++------ drivers/nvme/target/nvmet.h | 2 +- drivers/nvme/target/zns.c | 2 +- 3 files changed, 18 insertions(+), 8 deletions(-)
drivers/nvme/target/admin-cmd.c +16 -6
@@ -685,6 +685,13 @@ static bool nvmet_handle_identify_desclist(struct nvmet_req *req) } } +static void nvmet_execute_identify_ctrl_nvm (struct nvmet_req *req) +{ +/* Not supported: return zeroes */ +nvmet_req_complete (req, +nvmet_zero_sgl (req,0 ,sizeof (struct nvme_id_ctrl_nvm ))); +} +static void nvmet_execute_identify (struct nvmet_req *req) {if (!nvmet_check_transfer_len (req,NVME_IDENTIFY_DATA_SIZE ))
@@ -708,13 +715,16 @@ static void nvmet_execute_identify(struct nvmet_req *req)nvmet_execute_identify_ctrl (req);return ;case NVME_ID_CNS_CS_CTRL : -if (IS_ENABLED (CONFIG_BLK_DEV_ZONED )) { -switch (req->cmd->identify.csi) { -case NVME_CSI_ZNS : -return nvmet_execute_identify_cns_cs_ctrl (req); -default : -break ; +switch (req->cmd->identify.csi) { +case NVME_CSI_NVM : +nvmet_execute_identify_ctrl_nvm (req); +return ; +case NVME_CSI_ZNS : +if (IS_ENABLED (CONFIG_BLK_DEV_ZONED )) { +nvmet_execute_identify_ctrl_zns (req); +return ; } +break ; }break ;case NVME_ID_CNS_NS_ACTIVE_LIST :
drivers/nvme/target/nvmet.h +1 -1
@@ -581,7 +581,7 @@ bool nvmet_ns_revalidate(struct nvmet_ns *ns);u16 blk_to_nvme_status (struct nvmet_req *req,blk_status_t blk_sts);bool nvmet_bdev_zns_enable (struct nvmet_ns *ns); -void nvmet_execute_identify_cns_cs_ctrl (struct nvmet_req *req); +void nvmet_execute_identify_ctrl_zns (struct nvmet_req *req);void nvmet_execute_identify_cns_cs_ns (struct nvmet_req *req);void nvmet_bdev_execute_zone_mgmt_recv (struct nvmet_req *req);void nvmet_bdev_execute_zone_mgmt_send (struct nvmet_req *req);
drivers/nvme/target/zns.c +1 -1
@@ -70,7 +70,7 @@ bool nvmet_bdev_zns_enable(struct nvmet_ns *ns)return true; } -void nvmet_execute_identify_cns_cs_ctrl (struct nvmet_req *req) +void nvmet_execute_identify_ctrl_zns (struct nvmet_req *req) {u8 zasl = req->sq->ctrl->subsys->zasl;struct nvmet_ctrl *ctrl = req->sq->ctrl;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 406/694 nvme: fix async event trace event
In reply to Greg Kroah-HartmanFrom: Keith Busch <[email protected]>
[ Upstream commit 6622b76fe922b94189499a90ccdb714a4a8d0773 ]
Mixing AER Event Type and Event Info has masking clashes. Just print the event type, but also include the event info of the AER result in the trace.
--- drivers/nvme/host/core.c | 5 +---- drivers/nvme/host/trace.h | 15 ++++++--------- 2 files changed, 7 insertions(+), 13 deletions(-)
drivers/nvme/host/core.c +1 -4
@@ -4819,8 +4819,6 @@ static bool nvme_handle_aen_notice(struct nvme_ctrl *ctrl, u32 result)u32 aer_notice_type =nvme_aer_subtype (result);bool requeue = true; -trace_nvme_async_event (ctrl, aer_notice_type); -switch (aer_notice_type) {case NVME_AER_NOTICE_NS_CHANGED :set_bit (NVME_AER_NOTICE_NS_CHANGED , &ctrl->events);
@@ -4856,7 +4854,6 @@ static bool nvme_handle_aen_notice(struct nvme_ctrl *ctrl, u32 result)static void nvme_handle_aer_persistent_error (struct nvme_ctrl *ctrl) { -trace_nvme_async_event (ctrl,NVME_AER_ERROR );dev_warn (ctrl->device,"resetting controller due to AER\n" );nvme_reset_ctrl (ctrl); }
@@ -4872,6 +4869,7 @@ void nvme_complete_async_event(struct nvme_ctrl *ctrl, __le16 status,if (le16_to_cpu (status) >>1 !=NVME_SC_SUCCESS )return ; +trace_nvme_async_event (ctrl, result);switch (aer_type) {case NVME_AER_NOTICE : requeue =nvme_handle_aen_notice (ctrl, result);
@@ -4889,7 +4887,6 @@ void nvme_complete_async_event(struct nvme_ctrl *ctrl, __le16 status,case NVME_AER_SMART :case NVME_AER_CSS :case NVME_AER_VS : -trace_nvme_async_event (ctrl, aer_type); ctrl->aen_result = result;break ;default :
drivers/nvme/host/trace.h +6 -9
@@ -127,15 +127,12 @@ TRACE_EVENT(nvme_async_event, ),TP_printk ("nvme%d: NVME_AEN=%#08x [%s]" , __entry->ctrl_id, __entry->result, -__print_symbolic (__entry->result, -aer_name (NVME_AER_NOTICE_NS_CHANGED ), -aer_name (NVME_AER_NOTICE_ANA ), -aer_name (NVME_AER_NOTICE_FW_ACT_STARTING ), -aer_name (NVME_AER_NOTICE_DISC_CHANGED ), -aer_name (NVME_AER_ERROR ), -aer_name (NVME_AER_SMART ), -aer_name (NVME_AER_CSS ), -aer_name (NVME_AER_VS )) +__print_symbolic (__entry->result &0x7 , +aer_name (NVME_AER_ERROR ), +aer_name (NVME_AER_SMART ), +aer_name (NVME_AER_NOTICE ), +aer_name (NVME_AER_CSS ), +aer_name (NVME_AER_VS )) ) );
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 407/694 nvme-fcloop: fix "inconsistent {IN-HARDIRQ-W} -> {HARDIRQ-ON-W} usage"
In reply to Greg Kroah-HartmanFrom: Ming Lei <[email protected]>
[ Upstream commit 4f86a6ff6fbd891232dda3ca97fd1b9630b59809 ]
fcloop_fcp_op() could be called from flush request's ->end_io(flush_end_io) in which the spinlock of fq->mq_flush_lock is grabbed with irq saved/disabled.
So fcloop_fcp_op() can't call spin_unlock_irq(&tfcp_req->reqlock) simply which enables irq unconditionally.
Fixes the warning by switching to spin_lock_irqsave()/spin_unlock_irqrestore()
--- drivers/nvme/target/fcloop.c | 48 ++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 21 deletions(-)
drivers/nvme/target/fcloop.c +27 -21
@@ -614,10 +614,11 @@ fcloop_fcp_recv_work(struct work_struct *work)struct fcloop_fcpreq *tfcp_req = container_of(work, struct fcloop_fcpreq, fcp_rcv_work);struct nvmefc_fcp_req *fcpreq = tfcp_req->fcpreq; +unsigned long flags;int ret =0 ;bool aborted = false; -spin_lock_irq (&tfcp_req->reqlock); +spin_lock_irqsave (&tfcp_req->reqlock, flags);switch (tfcp_req->inistate) {case INI_IO_START : tfcp_req->inistate =INI_IO_ACTIVE ;
@@ -626,11 +627,11 @@ fcloop_fcp_recv_work(struct work_struct *work) aborted = true;break ;default : -spin_unlock_irq (&tfcp_req->reqlock); +spin_unlock_irqrestore (&tfcp_req->reqlock, flags);WARN_ON (1 );return ; } -spin_unlock_irq (&tfcp_req->reqlock); +spin_unlock_irqrestore (&tfcp_req->reqlock, flags);if (unlikely (aborted)) ret = -ECANCELED ;
@@ -655,8 +656,9 @@ fcloop_fcp_abort_recv_work(struct work_struct *work) container_of(work, struct fcloop_fcpreq, abort_rcv_work);struct nvmefc_fcp_req *fcpreq;bool completed = false; +unsigned long flags; -spin_lock_irq (&tfcp_req->reqlock); +spin_lock_irqsave (&tfcp_req->reqlock, flags); fcpreq = tfcp_req->fcpreq;switch (tfcp_req->inistate) {case INI_IO_ABORTED :
@@ -665,11 +667,11 @@ fcloop_fcp_abort_recv_work(struct work_struct *work) completed = true;break ;default : -spin_unlock_irq (&tfcp_req->reqlock); +spin_unlock_irqrestore (&tfcp_req->reqlock, flags);WARN_ON (1 );return ; } -spin_unlock_irq (&tfcp_req->reqlock); +spin_unlock_irqrestore (&tfcp_req->reqlock, flags);if (unlikely (completed)) {/* remove reference taken in original abort downcall */
@@ -681,9 +683,9 @@ fcloop_fcp_abort_recv_work(struct work_struct *work)nvmet_fc_rcv_fcp_abort (tfcp_req->tport->targetport, &tfcp_req->tgt_fcp_req); -spin_lock_irq (&tfcp_req->reqlock); +spin_lock_irqsave (&tfcp_req->reqlock, flags); tfcp_req->fcpreq =NULL ; -spin_unlock_irq (&tfcp_req->reqlock); +spin_unlock_irqrestore (&tfcp_req->reqlock, flags);fcloop_call_host_done (fcpreq, tfcp_req, -ECANCELED );/* call_host_done releases reference for abort downcall */
@@ -699,11 +701,12 @@ fcloop_tgt_fcprqst_done_work(struct work_struct *work)struct fcloop_fcpreq *tfcp_req = container_of(work, struct fcloop_fcpreq, tio_done_work);struct nvmefc_fcp_req *fcpreq; +unsigned long flags; -spin_lock_irq (&tfcp_req->reqlock); +spin_lock_irqsave (&tfcp_req->reqlock, flags); fcpreq = tfcp_req->fcpreq; tfcp_req->inistate =INI_IO_COMPLETED ; -spin_unlock_irq (&tfcp_req->reqlock); +spin_unlock_irqrestore (&tfcp_req->reqlock, flags);fcloop_call_host_done (fcpreq, tfcp_req, tfcp_req->status); }
@@ -807,13 +810,14 @@ fcloop_fcp_op(struct nvmet_fc_target_port *tgtport,u32 rsplen =0 , xfrlen =0 ;int fcp_err =0 , active, aborted;u8 op = tgt_fcpreq->op; +unsigned long flags; -spin_lock_irq (&tfcp_req->reqlock); +spin_lock_irqsave (&tfcp_req->reqlock, flags); fcpreq = tfcp_req->fcpreq; active = tfcp_req->active; aborted = tfcp_req->aborted; tfcp_req->active = true; -spin_unlock_irq (&tfcp_req->reqlock); +spin_unlock_irqrestore (&tfcp_req->reqlock, flags);if (unlikely (active))/* illegal - call while i/o active */
@@ -821,9 +825,9 @@ fcloop_fcp_op(struct nvmet_fc_target_port *tgtport,if (unlikely (aborted)) {/* target transport has aborted i/o prior */ -spin_lock_irq (&tfcp_req->reqlock); +spin_lock_irqsave (&tfcp_req->reqlock, flags); tfcp_req->active = false; -spin_unlock_irq (&tfcp_req->reqlock); +spin_unlock_irqrestore (&tfcp_req->reqlock, flags); tgt_fcpreq->transferred_length =0 ; tgt_fcpreq->fcp_error = -ECANCELED ; tgt_fcpreq->done (tgt_fcpreq);
@@ -880,9 +884,9 @@ fcloop_fcp_op(struct nvmet_fc_target_port *tgtport,break ; } -spin_lock_irq (&tfcp_req->reqlock); +spin_lock_irqsave (&tfcp_req->reqlock, flags); tfcp_req->active = false; -spin_unlock_irq (&tfcp_req->reqlock); +spin_unlock_irqrestore (&tfcp_req->reqlock, flags); tgt_fcpreq->transferred_length = xfrlen; tgt_fcpreq->fcp_error = fcp_err;
@@ -896,15 +900,16 @@ fcloop_tgt_fcp_abort(struct nvmet_fc_target_port *tgtport, struct nvmefc_tgt_fcp_req *tgt_fcpreq) {struct fcloop_fcpreq *tfcp_req =tgt_fcp_req_to_fcpreq (tgt_fcpreq); +unsigned long flags;/* * mark aborted only in case there were 2 threads in transport * (one doing io, other doing abort) and only kills ops posted * after the abort request */ -spin_lock_irq (&tfcp_req->reqlock); +spin_lock_irqsave (&tfcp_req->reqlock, flags); tfcp_req->aborted = true; -spin_unlock_irq (&tfcp_req->reqlock); +spin_unlock_irqrestore (&tfcp_req->reqlock, flags); tfcp_req->status =NVME_SC_INTERNAL ;
@@ -946,6 +951,7 @@ fcloop_fcp_abort(struct nvme_fc_local_port *localport,struct fcloop_ini_fcpreq *inireq = fcpreq->private;struct fcloop_fcpreq *tfcp_req;bool abortio = true; +unsigned long flags;spin_lock (&inireq->inilock); tfcp_req = inireq->tfcp_req;
@@ -958,7 +964,7 @@ fcloop_fcp_abort(struct nvme_fc_local_port *localport,return ;/* break initiator/target relationship for io */ -spin_lock_irq (&tfcp_req->reqlock); +spin_lock_irqsave (&tfcp_req->reqlock, flags);switch (tfcp_req->inistate) {case INI_IO_START :case INI_IO_ACTIVE :
@@ -968,11 +974,11 @@ fcloop_fcp_abort(struct nvme_fc_local_port *localport, abortio = false;break ;default : -spin_unlock_irq (&tfcp_req->reqlock); +spin_unlock_irqrestore (&tfcp_req->reqlock, flags);WARN_ON (1 );return ; } -spin_unlock_irq (&tfcp_req->reqlock); +spin_unlock_irqrestore (&tfcp_req->reqlock, flags);if (abortio)/* leave the reference while the work item is scheduled */
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 408/694 selftests/bpf: Use read_perf_max_sample_freq() in perf_event_stackmap
In reply to Greg Kroah-HartmanFrom: Song Liu <[email protected]>
[ Upstream commit de6d014a09bf12a9a8959d60c0a1d4a41d394a89 ]
Currently, perf_event sample period in perf_event_stackmap is set too low that the test fails randomly. Fix this by using the max sample frequency, from read_perf_max_sample_freq().
Move read_perf_max_sample_freq() to testing_helpers.c. Replace the CHECK() with if-printf, as CHECK is not available in testing_helpers.c.
--- .../bpf/prog_tests/perf_event_stackmap.c | 3 ++- .../bpf/prog_tests/stacktrace_build_id_nmi.c | 15 -------------- tools/testing/selftests/bpf/testing_helpers.c | 20 +++++++++++++++++++ tools/testing/selftests/bpf/testing_helpers.h | 2 ++ 4 files changed, 24 insertions(+), 16 deletions(-)
tools/testing/selftests/bpf/prog_tests/perf_event_stackmap.c +2 -1
@@ -63,7 +63,8 @@ void test_perf_event_stackmap(void)PERF_SAMPLE_BRANCH_NO_FLAGS |PERF_SAMPLE_BRANCH_NO_CYCLES | PERF_SAMPLE_BRANCH_CALL_STACK, - .sample_period = 5000, + .freq = 1, + .sample_freq = read_perf_max_sample_freq(), .size = sizeof(struct perf_event_attr), };struct perf_event_stackmap *skel;
tools/testing/selftests/bpf/prog_tests/stacktrace_build_id_nmi.c +0 -15
@@ -2,21 +2,6 @@#include <test_progs.h> #include "test_stacktrace_build_id.skel.h" -static __u64 read_perf_max_sample_freq (void ) -{ -__u64 sample_freq =5000 ;/* fallback to 5000 on error */ -FILE *f; -__u32 duration =0 ; - - f =fopen ("/proc/sys/kernel/perf_event_max_sample_rate" ,"r" ); -if (f ==NULL ) -return sample_freq; -CHECK (fscanf (f,"%llu" , &sample_freq) !=1 ,"Get max sample rate" , -"return default value: 5000,err %d\n" , -errno); -fclose (f); -return sample_freq; -} -void test_stacktrace_build_id_nmi (void ) {int control_map_fd, stackid_hmap_fd, stackmap_fd;
tools/testing/selftests/bpf/testing_helpers.c +20 -0
@@ -229,3 +229,23 @@ int bpf_test_load_program(enum bpf_prog_type type, const struct bpf_insn *insns,return bpf_prog_load (type,NULL , license, insns, insns_cnt, &opts); } + +__u64 read_perf_max_sample_freq (void ) +{ +__u64 sample_freq =5000 ;/* fallback to 5000 on error */ +FILE *f; + + f =fopen ("/proc/sys/kernel/perf_event_max_sample_rate" ,"r" ); +if (f ==NULL ) { +printf ("Failed to open /proc/sys/kernel/perf_event_max_sample_rate: err %d\n" +"return default value: 5000\n" , -errno); +return sample_freq; + } +if (fscanf (f,"%llu" , &sample_freq) !=1 ) { +printf ("Failed to parse /proc/sys/kernel/perf_event_max_sample_rate: err %d\n" +"return default value: 5000\n" , -errno); + } + +fclose (f); +return sample_freq; +}
tools/testing/selftests/bpf/testing_helpers.h +2 -0
@@ -20,3 +20,5 @@ struct test_filter_set;int parse_test_list (const char *s,struct test_filter_set *test_set,bool is_glob_pattern); + +__u64 read_perf_max_sample_freq (void );
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 409/694 selftests/bpf: Fix leaked bpf_link in get_stackid_cannot_attach
In reply to Greg Kroah-HartmanFrom: Song Liu <[email protected]>
[ Upstream commit c1e07a80cf23d3a6e96172bc9a73bfa912a9fcbc ]
skel->links.oncpu is leaked in one case. This causes test perf_branches fails when it runs after get_stackid_cannot_attach:
./test_progs -t get_stackid_cannot_attach,perf_branches
84 get_stackid_cannot_attach:OK
test_perf_branches_common:PASS:test_perf_branches_load 0 nsec test_perf_branches_common:PASS:attach_perf_event 0 nsec test_perf_branches_common:PASS:set_affinity 0 nsec check_good_sample:FAIL:output not valid no valid sample from prog
146/1 perf_branches/perf_branches_hw:FAIL 146/2 perf_branches/perf_branches_no_hw:OK 146 perf_branches:FAIL
All error logs:
test_perf_branches_common:PASS:test_perf_branches_load 0 nsec test_perf_branches_common:PASS:attach_perf_event 0 nsec test_perf_branches_common:PASS:set_affinity 0 nsec check_good_sample:FAIL:output not valid no valid sample from prog
146/1 perf_branches/perf_branches_hw:FAIL
146 perf_branches:FAIL
Summary: 1/1 PASSED, 0 SKIPPED, 1 FAILED
Fix this by adding the missing bpf_link__destroy().
--- .../testing/selftests/bpf/prog_tests/get_stackid_cannot_attach.c | 1 + 1 file changed, 1 insertion(+)
tools/testing/selftests/bpf/prog_tests/get_stackid_cannot_attach.c +1 -0
@@ -65,6 +65,7 @@ void test_get_stackid_cannot_attach(void) skel->links.oncpu =bpf_program__attach_perf_event (skel->progs.oncpu, pmu_fd);ASSERT_OK_PTR (skel->links.oncpu,"attach_perf_event_callchain" ); +bpf_link__destroy (skel->links.oncpu);close (pmu_fd);/* add exclude_callchain_kernel, attach should fail */
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 410/694 blk-mq: dont plug for head insertions in blk_execute_rq_nowait
In reply to Greg Kroah-HartmanFrom: Christoph Hellwig <[email protected]>
[ Upstream commit 50947d7fe9fa6abe3ddc40769dfb02a51c58edb6 ]
Plugs never insert at head, so don't plug for head insertions.
--- block/blk-mq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
block/blk-mq.c +1 -1
@@ -1345,7 +1345,7 @@ void blk_execute_rq_nowait(struct request *rq, bool at_head)* device, directly accessing the plug instead of using blk_mq_plug() * should not have any consequences. */ -if (current->plug) +if (current->plug && !at_head)blk_add_rq_to_plug (current->plug, rq);else blk_mq_sched_insert_request (rq, at_head, true, false);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 411/694 wifi: iwlwifi: debug: fix crash in __iwl_err()
In reply to Greg Kroah-HartmanFrom: Johannes Berg <[email protected]>
[ Upstream commit 634c7b1bd08ca322537ab389f8cbd7bb543b5e45 ]
In __iwl_err(), if we rate-limit the message away, then vaf.va is still NULL-initialized by the time we get to the tracing code, which then crashes. When it doesn't get rate-limited out, it's still wrong to reuse the old args2 that was already printed, which is why we bother making a copy in the first place.
Assign vaf.va properly to fix this.
--- drivers/net/wireless/intel/iwlwifi/iwl-debug.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/iwl-debug.c +2 -1
@@ -1,6 +1,6 @@// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause /* -* Copyright (C) 2005-2011, 2021 Intel Corporation +* Copyright (C) 2005-2011, 2021-2022 Intel Corporation */ #include <linux/device.h> #include <linux/interrupt.h>
@@ -57,6 +57,7 @@ void __iwl_err(struct device *dev, enum iwl_err_mode mode, const char *fmt, ...)default :break ; } + vaf.va = &args;trace_iwlwifi_err (&vaf);va_end (args); }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 412/694 wifi: iwlwifi: mvm: fix A-MSDU checks
In reply to Greg Kroah-HartmanFrom: Johannes Berg <[email protected]>
[ Upstream commit d34d11aea2d5d71a66f2f90507c3f7202b964175 ]
Since Gl A-step devices use the old checksum hardware, we shouldn't use the Bz code to check for A-MSDU combining ability; fix that.
--- drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +4 -1
@@ -5525,7 +5525,10 @@ static bool iwl_mvm_mac_can_aggregate(struct ieee80211_hw *hw, {struct iwl_mvm *mvm =IWL_MAC80211_GET_MVM (hw); -if (mvm->trans->trans_cfg->device_family >=IWL_DEVICE_FAMILY_BZ ) +if (mvm->trans->trans_cfg->device_family >IWL_DEVICE_FAMILY_BZ || + (mvm->trans->trans_cfg->device_family ==IWL_DEVICE_FAMILY_BZ && + !(CSR_HW_REV_TYPE (mvm->trans->hw_rev) ==IWL_CFG_MAC_TYPE_GL && + mvm->trans->hw_rev_step ==SILICON_A_STEP )))return iwl_mvm_tx_csum_bz (mvm, head, true) ==iwl_mvm_tx_csum_bz (mvm, skb, true);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 413/694 wifi: iwlwifi: trans: dont trigger d3 interrupt twice
In reply to Greg Kroah-HartmanFrom: Avraham Stern <[email protected]>
[ Upstream commit 277f56a141fc54ef7f9e09dba65fb2e12021411d ]
When the IPC registers are used for sleep control, setting the IPC sleep bit already triggers an interrupt to the fw, so there is no need to also set the doorbell. Setting also the doorbell triggers the sleep interrupt twice which lead to an assert.
--- drivers/net/wireless/intel/iwlwifi/pcie/trans.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/net/wireless/intel/iwlwifi/pcie/trans.c +3 -6
@@ -1522,19 +1522,16 @@ static int iwl_pcie_d3_handshake(struct iwl_trans *trans, bool suspend)struct iwl_trans_pcie *trans_pcie =IWL_TRANS_GET_PCIE_TRANS (trans);int ret; -if (trans->trans_cfg->device_family ==IWL_DEVICE_FAMILY_AX210 ) { +if (trans->trans_cfg->device_family ==IWL_DEVICE_FAMILY_AX210 )iwl_write_umac_prph (trans,UREG_DOORBELL_TO_ISR6 , suspend ?UREG_DOORBELL_TO_ISR6_SUSPEND :UREG_DOORBELL_TO_ISR6_RESUME ); - }else if (trans->trans_cfg->device_family >=IWL_DEVICE_FAMILY_BZ ) { +else if (trans->trans_cfg->device_family >=IWL_DEVICE_FAMILY_BZ )iwl_write32 (trans,CSR_IPC_SLEEP_CONTROL , suspend ?CSR_IPC_SLEEP_CONTROL_SUSPEND :CSR_IPC_SLEEP_CONTROL_RESUME ); -iwl_write_umac_prph (trans,UREG_DOORBELL_TO_ISR6 , -UREG_DOORBELL_TO_ISR6_SLEEP_CTRL ); - }else { +else return 0 ; - } ret =wait_event_timeout (trans_pcie->sx_waitq, trans_pcie->sx_complete,2 *HZ );
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 414/694 wifi: iwlwifi: mvm: dont set CHECKSUM_COMPLETE for unsupported protocols
In reply to Greg Kroah-HartmanFrom: Avraham Stern <[email protected]>
[ Upstream commit 217f3c52f00d3419ecdd38a99a7eceecb11679b2 ]
On Bz devices, CHECKSUM_COMPLETE was set for unsupported protocols which results in a warning. Fix it.
--- drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c +2 -3
@@ -171,8 +171,7 @@ static int iwl_mvm_create_skb(struct iwl_mvm *mvm, struct sk_buff *skb,* Starting from Bz hardware, it calculates starting directly after * the MAC header, so that matches mac80211's expectation. */ -if (skb->ip_summed ==CHECKSUM_COMPLETE && - mvm->trans->trans_cfg->device_family <IWL_DEVICE_FAMILY_BZ ) { +if (skb->ip_summed ==CHECKSUM_COMPLETE ) {struct {u8 hdr[6 ];__be16 type;
@@ -187,7 +186,7 @@ static int iwl_mvm_create_skb(struct iwl_mvm *mvm, struct sk_buff *skb, shdr->type !=htons (ETH_P_PAE ) && shdr->type != htons(ETH_P_TDLS)))) skb->ip_summed = CHECKSUM_NONE; - else + else if (mvm->trans->trans_cfg->device_family < IWL_DEVICE_FAMILY_BZ) /* mac80211 assumes full CSUM including SNAP header */ skb_postpush_rcsum(skb, shdr, sizeof(*shdr)); }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 415/694 bpf, sockmap: Revert buggy deadlock fix in the sockhash and sockmap
In reply to Greg Kroah-HartmanFrom: Daniel Borkmann <[email protected]>
[ Upstream commit 8c5c2a4898e3d6bad86e29d471e023c8a19ba799 ]
syzbot reported a splat and bisected it to recent commit ed17aa92dc56 ("bpf,
sockmap: fix deadlocks in the sockhash and sockmap"):
[...]
WARNING: CPU: 1 PID: 9280 at kernel/softirq.c:376 __local_bh_enable_ip+0xbe/0x130 kernel/softirq.c:376 Modules linked in: CPU: 1 PID: 9280 Comm: syz-executor.1 Not tainted 6.2.0-syzkaller-13249-gd319f344561d #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/30/2023 RIP: 0010:__local_bh_enable_ip+0xbe/0x130 kernel/softirq.c:376 [...] Call Trace: <TASK> spin_unlock_bh include/linux/spinlock.h:395 [inline] sock_map_del_link+0x2ea/0x510 net/core/sock_map.c:165 sock_map_unref+0xb0/0x1d0 net/core/sock_map.c:184 sock_hash_delete_elem+0x1ec/0x2a0 net/core/sock_map.c:945 map_delete_elem kernel/bpf/syscall.c:1536 [inline] __sys_bpf+0x2edc/0x53e0 kernel/bpf/syscall.c:5053 __do_sys_bpf kernel/bpf/syscall.c:5166 [inline] __se_sys_bpf kernel/bpf/syscall.c:5164 [inline] __x64_sys_bpf+0x79/0xc0 kernel/bpf/syscall.c:5164 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7fe8f7c8c169 </TASK> [...]
Revert for now until we have a proper solution.
--- net/core/sock_map.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
net/core/sock_map.c +4 -6
@@ -414,9 +414,8 @@ static int __sock_map_delete(struct bpf_stab *stab, struct sock *sk_test, {struct sock *sk;int err =0 ; -unsigned long flags; -raw_spin_lock_irqsave (&stab->lock, flags); +raw_spin_lock_bh (&stab->lock); sk = *psk;if (!sk_test || sk_test == sk) sk =xchg (psk,NULL );
@@ -426,7 +425,7 @@ static int __sock_map_delete(struct bpf_stab *stab, struct sock *sk_test,else err = -EINVAL ; -raw_spin_unlock_irqrestore (&stab->lock, flags); +raw_spin_unlock_bh (&stab->lock);return err; }
@@ -924,12 +923,11 @@ static long sock_hash_delete_elem(struct bpf_map *map, void *key)struct bpf_shtab_bucket *bucket;struct bpf_shtab_elem *elem;int ret = -ENOENT ; -unsigned long flags; hash =sock_hash_bucket_hash (key, key_size); bucket =sock_hash_select_bucket (htab, hash); -raw_spin_lock_irqsave (&bucket->lock, flags); +raw_spin_lock_bh (&bucket->lock); elem =sock_hash_lookup_elem_raw (&bucket->head, hash, key, key_size);if (elem) {hlist_del_rcu (&elem->node);
@@ -937,7 +935,7 @@ static long sock_hash_delete_elem(struct bpf_map *map, void *key)sock_hash_free_elem (htab, elem); ret =0 ; } -raw_spin_unlock_irqrestore (&bucket->lock, flags); +raw_spin_unlock_bh (&bucket->lock);return ret; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 416/694 f2fs: fix to check return value of f2fs_do_truncate_blocks()
In reply to Greg Kroah-HartmanFrom: Chao Yu <[email protected]>
[ Upstream commit b851ee6ba3cc212641e622ebcf92b950c7bafa07 ]
Otherwise, if truncation on cow_inode failed, remained data may pollute current transaction of atomic write.
--- fs/f2fs/file.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
fs/f2fs/file.c +5 -1
@@ -2113,7 +2113,11 @@ static int f2fs_ioc_start_atomic_write(struct file *filp, bool truncate)clear_inode_flag (fi->cow_inode,FI_INLINE_DATA ); }else {/* Reuse the already created COW inode */ -f2fs_do_truncate_blocks (fi->cow_inode,0 , true); + ret =f2fs_do_truncate_blocks (fi->cow_inode,0 , true); +if (ret) { +f2fs_up_write (&fi->i_gc_rwsem[WRITE ]); + goto out; + } }f2fs_write_inode (inode,NULL );
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 417/694 f2fs: fix to check return value of inc_valid_block_count()
In reply to Greg Kroah-HartmanFrom: Chao Yu <[email protected]>
[ Upstream commit 935fc6fa6466cf18dd72dd1518ebc7bfc4cd58a4 ]
In __replace_atomic_write_block(), we missed to check return value of inc_valid_block_count(), for extreme testcase that f2fs image is run out of space, it may cause inconsistent status in between SIT table and total valid block count.
--- fs/f2fs/segment.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
fs/f2fs/segment.c +7 -1
@@ -246,10 +246,16 @@ static int __replace_atomic_write_block(struct inode *inode, pgoff_t index, }else {blkcnt_t count =1 ; + err =inc_valid_block_count (sbi, inode, &count); +if (err) { +f2fs_put_dnode (&dn); +return err; + } + *old_addr = dn.data_blkaddr;f2fs_truncate_data_blocks_range (&dn,1 );dec_valid_block_count (sbi,F2FS_I (inode)->cow_inode, count); -inc_valid_block_count (sbi, inode, &count); +f2fs_replace_block (sbi, &dn, dn.data_blkaddr, new_addr, ni.version, true, false); }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 418/694 md/raid10: fix task hung in raid10d
In reply to Greg Kroah-HartmanFrom: Li Nan <[email protected]>
[ Upstream commit 72c215ed8731c88b2d7e09afc51fffc207ae47b8 ]
commit fe630de009d0 ("md/raid10: avoid deadlock on recovery.") allowed normal io and sync io to exist at the same time. Task hung will occur as below:
T1 T2 T3 T4
raid10d
handle_read_error
allow_barrier
conf->nr_pending--
-> 0
//submit sync io
raid10_sync_request
raise_barrier
->will not be blocked
...
//submit to drivers
raid10_read_request
wait_barrier
conf->nr_pending++
-> 1
//retry read fail
raid10_end_read_request
reschedule_retry
add to retry_list
conf->nr_queued++
-> 1
//sync io fail
end_sync_read
__end_sync_read
reschedule_retry
add to retry_list
conf->nr_queued++
-> 2
...
handle_read_error
get form retry_list
conf->nr_queued--
freeze_array
wait nr_pending == nr_queued+1
->1 ->2//task hung
retry read and sync io will be added to retry_list(nr_queued->2) if they fails. raid10d() called handle_read_error() and hung in freeze_array(). nr_queued will not decrease because raid10d is blocked, nr_pending will not increase because conf->barrier is not released.
Fix it by moving allow_barrier() after raid10_read_request(). raise_barrier() will wait for nr_waiting to become 0. Therefore, sync io and regular io will not be issued at the same time.
Also remove the check of nr_queued in stop_waiting_barrier. It can be 0 but don't need to be blocking. Remove the check for MD_RECOVERY_RUNNING as the check is redundent.
--- drivers/md/raid10.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-)
drivers/md/raid10.c +13 -5
@@ -995,11 +995,15 @@ static bool stop_waiting_barrier(struct r10conf *conf) (!bio_list_empty(&bio_list[0]) || !bio_list_empty(&bio_list[1])))return true; -/* move on if recovery thread is blocked by us */ -if (conf->mddev->thread->tsk == current && -test_bit (MD_RECOVERY_RUNNING , &conf->mddev->recovery) && - conf->nr_queued >0 ) +/* +* move on if io is issued from raid10d(), nr_pending is not released +* from original io(see handle_read_error()). All raise barrier is +* blocked until this io is done. +*/ +if (conf->mddev->thread->tsk == current) { +WARN_ON_ONCE (atomic_read (&conf->nr_pending) ==0 );return true; + }return false; }
@@ -2978,9 +2982,13 @@ static void handle_read_error(struct mddev *mddev, struct r10bio *r10_bio)md_error (mddev, rdev);rdev_dec_pending (rdev, mddev); -allow_barrier (conf); r10_bio->state =0 ;raid10_read_request (mddev, r10_bio->master_bio, r10_bio); +/* +* allow_barrier after re-submit to ensure no sync io +* can be issued while regular io pending. +*/ +allow_barrier (conf); }static void handle_write_completed (struct r10conf *conf,struct r10bio *r10_bio)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 419/694 md/raid10: fix leak of r10bio->remaining for recovery
In reply to Greg Kroah-HartmanFrom: Yu Kuai <[email protected]>
[ Upstream commit 26208a7cffd0c7cbf14237ccd20c7270b3ffeb7e ]
raid10_sync_request() will add 'r10bio->remaining' for both rdev and replacement rdev. However, if the read io fails, recovery_request_write() returns without issuing the write io, in this case, end_sync_request() is only called once and 'remaining' is leaked, cause an io hang.
Fix the problem by decreasing 'remaining' according to if 'bio' and 'repl_bio' is valid.
--- drivers/md/raid10.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-)
drivers/md/raid10.c +13 -10
@@ -2613,11 +2613,22 @@ static void recovery_request_write(struct mddev *mddev, struct r10bio *r10_bio) {struct r10conf *conf = mddev->private;int d; -struct bio *wbio, *wbio2; +struct bio *wbio = r10_bio->devs[1 ].bio; +struct bio *wbio2 = r10_bio->devs[1 ].repl_bio; + +/* Need to test wbio2->bi_end_io before we call +* submit_bio_noacct as if the former is NULL, +* the latter is free to free wbio2. +*/ +if (wbio2 && !wbio2->bi_end_io) + wbio2 =NULL ;if (!test_bit (R10BIO_Uptodate, &r10_bio->state)) {fix_recovery_read_error (r10_bio); -end_sync_request (r10_bio); +if (wbio->bi_end_io) +end_sync_request (r10_bio); +if (wbio2) +end_sync_request (r10_bio);return ; }
@@ -2626,14 +2637,6 @@ static void recovery_request_write(struct mddev *mddev, struct r10bio *r10_bio)* and submit the write request */ d = r10_bio->devs[1 ].devnum; - wbio = r10_bio->devs[1 ].bio; - wbio2 = r10_bio->devs[1 ].repl_bio; -/* Need to test wbio2->bi_end_io before we call -* submit_bio_noacct as if the former is NULL, -* the latter is free to free wbio2. -*/ -if (wbio2 && !wbio2->bi_end_io) - wbio2 =NULL ;if (wbio->bi_end_io) {atomic_inc (&conf->mirrors[d].rdev->nr_pending);md_sync_acct (conf->mirrors[d].rdev->bdev,bio_sectors (wbio));
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 420/694 md/raid10: fix memleak for conf->bio_split
In reply to Greg Kroah-HartmanFrom: Yu Kuai <[email protected]>
[ Upstream commit c9ac2acde53f5385de185bccf6aaa91cf9ac1541 ]
In the error path of raid10_run(), 'conf' need be freed, however, 'conf->bio_split' is missed and memory will be leaked.
Since there are 3 places to free 'conf', factor out a helper to fix the problem.
--- drivers/md/raid10.c | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-)
drivers/md/raid10.c +17 -20
@@ -4015,6 +4015,20 @@ static int setup_geo(struct geom *geo, struct mddev *mddev, enum geo_type new)return nc*fc; } +static void raid10_free_conf (struct r10conf *conf) +{ +if (!conf) +return ; + +mempool_exit (&conf->r10bio_pool); +kfree (conf->mirrors); +kfree (conf->mirrors_old); +kfree (conf->mirrors_new); +safe_put_page (conf->tmppage); +bioset_exit (&conf->bio_split); +kfree (conf); +} +static struct r10conf *setup_conf (struct mddev *mddev) {struct r10conf *conf =NULL ;
@@ -4097,13 +4111,7 @@ static struct r10conf *setup_conf(struct mddev *mddev)return conf; out: -if (conf) { -mempool_exit (&conf->r10bio_pool); -kfree (conf->mirrors); -safe_put_page (conf->tmppage); -bioset_exit (&conf->bio_split); -kfree (conf); - } +raid10_free_conf (conf);return ERR_PTR (err); }
@@ -4294,10 +4302,7 @@ static int raid10_run(struct mddev *mddev) out_free_conf:md_unregister_thread (&mddev->thread); -mempool_exit (&conf->r10bio_pool); -safe_put_page (conf->tmppage); -kfree (conf->mirrors); -kfree (conf); +raid10_free_conf (conf); mddev->private =NULL ; out:return -EIO ;
@@ -4305,15 +4310,7 @@ static int raid10_run(struct mddev *mddev)static void raid10_free (struct mddev *mddev,void *priv) { -struct r10conf *conf = priv; - -mempool_exit (&conf->r10bio_pool); -safe_put_page (conf->tmppage); -kfree (conf->mirrors); -kfree (conf->mirrors_old); -kfree (conf->mirrors_new); -bioset_exit (&conf->bio_split); -kfree (conf); +raid10_free_conf (priv); }static void raid10_quiesce (struct mddev *mddev,int quiesce)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 421/694 md/raid10: fix memleak of md thread
In reply to Greg Kroah-HartmanFrom: Yu Kuai <[email protected]>
[ Upstream commit f0ddb83da3cbbf8a1f9087a642c448ff52ee9abd ]
In raid10_run(), if setup_conf() succeed and raid10_run() failed before setting 'mddev->thread', then in the error path 'conf->thread' is not freed.
Fix the problem by setting 'mddev->thread' right after setup_conf().
--- drivers/md/raid10.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/md/raid10.c +3 -3
@@ -4148,6 +4148,9 @@ static int raid10_run(struct mddev *mddev)if (!conf) goto out; + mddev->thread = conf->thread; + conf->thread =NULL ; +if (mddev_is_clustered (conf->mddev)) {int fc, fo;
@@ -4160,9 +4163,6 @@ static int raid10_run(struct mddev *mddev) } } - mddev->thread = conf->thread; - conf->thread =NULL ; -if (mddev->queue) {blk_queue_max_write_zeroes_sectors (mddev->queue,0 );blk_queue_io_min (mddev->queue, mddev->chunk_sectors <<9 );
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 422/694 md/raid10: dont call bio_start_io_acct twice for bio which experienced read error
In reply to Greg Kroah-HartmanFrom: Yu Kuai <[email protected]>
[ Upstream commit 7cddb055bfda5f7b0be931e8ea750fc28bc18a27 ]
handle_read_error() will resumit r10_bio by raid10_read_request(), which will call bio_start_io_acct() again, while bio_end_io_acct() will only be called once.
Fix the problem by don't account io again from handle_read_error().
--- drivers/md/raid10.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/md/raid10.c +3 -1
@@ -1248,7 +1248,8 @@ static void raid10_read_request(struct mddev *mddev, struct bio *bio, } slot = r10_bio->read_slot; -if (blk_queue_io_stat (bio->bi_bdev->bd_disk->queue)) +if (!r10_bio->start_time && +blk_queue_io_stat (bio->bi_bdev->bd_disk->queue)) r10_bio->start_time =bio_start_io_acct (bio); read_bio =bio_alloc_clone (rdev->bdev, bio, gfp, &mddev->bio_set);
@@ -1578,6 +1579,7 @@ static void __make_request(struct mddev *mddev, struct bio *bio, int sectors) r10_bio->sector = bio->bi_iter.bi_sector; r10_bio->state =0 ; r10_bio->read_slot =-1 ; + r10_bio->start_time =0 ;memset (r10_bio->devs,0 ,sizeof (r10_bio->devs[0 ]) * conf->geo.raid_disks);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 423/694 wifi: iwlwifi: mvm: dont drop unencrypted MCAST frames
In reply to Greg Kroah-HartmanFrom: Ayala Beker <[email protected]>
[ Upstream commit 8e5a26360cbe29b896b6758518280d41c3704d43 ]
MCAST frames are filtered out by the driver if we are not authorized yet.
Fix it to filter out only protected frames.
--- drivers/net/wireless/intel/iwlwifi/mvm/rx.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/rx.c +3 -2
@@ -384,9 +384,10 @@ void iwl_mvm_rx_rx_mpdu(struct iwl_mvm *mvm, struct napi_struct *napi,* Don't even try to decrypt a MCAST frame that was received * before the managed vif is authorized, we'd fail anyway. */ -if (vif->type ==NL80211_IFTYPE_STATION && +if (is_multicast_ether_addr (hdr->addr1) && + vif->type ==NL80211_IFTYPE_STATION && !mvmvif->authorized && -is_multicast_ether_addr (hdr->addr1)) { +ieee80211_has_protected (hdr->frame_control)) {IWL_DEBUG_DROP (mvm,"MCAST before the vif is authorized\n" );kfree_skb (skb);rcu_read_unlock ();
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 424/694 wifi: iwlwifi: yoyo: skip dump correctly on hw error
In reply to Greg Kroah-HartmanFrom: Daniel Gabay <[email protected]>
[ Upstream commit 11195ab0d6f3202cf7af1a4c69570f59c377d8ad ]
When NIC is in a bad state, reading data will return 28 bits as 0xa5a5a5a and the lowest 4 bits are not fixed value.
Mask these bits in a few places to skip the dump correctly.
--- drivers/net/wireless/intel/iwlwifi/fw/dbg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/intel/iwlwifi/fw/dbg.c +2 -2
@@ -1038,7 +1038,7 @@ iwl_dump_ini_prph_mac_iter(struct iwl_fw_runtime *fwrt, range->range_data_size = reg->dev_addr.size;for (i =0 ; i <le32_to_cpu (reg->dev_addr.size); i +=4 ) { prph_val =iwl_read_prph (fwrt->trans, addr + i); -if (prph_val ==0x5a5a5a5a ) +if ((prph_val & ~0xf ) ==0xa5a5a5a0 )return -EBUSY ; *val++ =cpu_to_le32 (prph_val); }
@@ -1562,7 +1562,7 @@ iwl_dump_ini_dbgi_sram_iter(struct iwl_fw_runtime *fwrt, prph_data =iwl_read_prph_no_grab (fwrt->trans, (i %2 ) ?DBGI_SRAM_TARGET_ACCESS_RDATA_MSB :DBGI_SRAM_TARGET_ACCESS_RDATA_LSB ); -if (prph_data ==0x5a5a5a5a ) { +if ((prph_data & ~0xf ) ==0xa5a5a5a0 ) {iwl_trans_release_nic_access (fwrt->trans);return -EBUSY ; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 425/694 wifi: iwlwifi: yoyo: Fix possible division by zero
In reply to Greg Kroah-HartmanFrom: Daniel Gabay <[email protected]>
[ Upstream commit ba30415118eee374a08b39a0460a1d1e52c24a25 ]
Don't allow buffer allocation TLV with zero req_size since it leads later to division by zero in iwl_dbg_tlv_alloc_fragments(). Also, NPK/SRAM locations are allowed to have zero buffer req_size, don't discard them.
--- drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c +6 -0
@@ -138,6 +138,12 @@ static int iwl_dbg_tlv_alloc_buf_alloc(struct iwl_trans *trans, alloc_id != IWL_FW_INI_ALLOCATION_ID_DBGC1) goto err; +if (buf_location ==IWL_FW_INI_LOCATION_DRAM_PATH && + alloc->req_size ==0 ) { +IWL_ERR (trans,"WRT: Invalid DRAM buffer allocation requested size (0)\n" ); +return -EINVAL ; + } + trans->dbg.fw_mon_cfg[alloc_id] = *alloc;return 0 ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 426/694 wifi: iwlwifi: mvm: initialize seq variable
In reply to Greg Kroah-HartmanFrom: Tom Rix <[email protected]>
[ Upstream commit 11e94d2bcd88dea5d9ce99555b6b172f5232d3e2 ]
Clang static analysis reports this issue
d3.c:567:22: warning: The left operand of '>' is
a garbage value
if (seq.tkip.iv32 > cur_rx_iv32)
~~~~~~~~~~~~~ ^
seq is never initialized. Call ieee80211_get_key_rx_seq() to initialize seq.
--- drivers/net/wireless/intel/iwlwifi/mvm/d3.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/intel/iwlwifi/mvm/d3.c +1 -0
@@ -563,6 +563,7 @@ static void iwl_mvm_wowlan_get_tkip_data(struct ieee80211_hw *hw, }for (i =0 ; i <IWL_NUM_RSC ; i++) { +ieee80211_get_key_rx_seq (key, i, &seq);/* wrapping isn't allowed, AP must rekey */ if (seq.tkip.iv32 > cur_rx_iv32) cur_rx_iv32 = seq.tkip.iv32;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 427/694 wifi: iwlwifi: fw: move memset before early return
In reply to Greg Kroah-HartmanFrom: Tom Rix <[email protected]>
[ Upstream commit 8ce437dd5b2e4adef13aa4ecce07392f9966b1ab ]
Clang static analysis reports this representative issue dbg.c:1455:6: warning: Branch condition evaluates to a garbage value
if (!rxf_data.size)
^~~~~~~~~~~~~~
This check depends on iwl_ini_get_rxf_data() to clear rxf_data but the function can return early without doing the clear. So move the memset before the early return.
--- drivers/net/wireless/intel/iwlwifi/fw/dbg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/intel/iwlwifi/fw/dbg.c +2 -2
@@ -1388,13 +1388,13 @@ static void iwl_ini_get_rxf_data(struct iwl_fw_runtime *fwrt,if (!data)return ; +memset (data,0 ,sizeof (*data)); +/* make sure only one bit is set in only one fid */ if (WARN_ONCE (hweight_long (fid1) +hweight_long (fid2) !=1 ,"fid1=%x, fid2=%x\n" , fid1, fid2))return ; -memset (data,0 ,sizeof (*data)); -if (fid1) { fifo_idx =ffs (fid1) -1 ; if (WARN_ONCE(fifo_idx >= MAX_NUM_LMAC, "fifo_idx=%d\n",
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 428/694 jdb2: Dont refuse invalidation of already invalidated buffers
In reply to Greg Kroah-HartmanFrom: Jan Kara <[email protected]>
[ Upstream commit bd159398a2d2234de07d310132865706964aaaa7 ]
When invalidating buffers under the partial tail page, jbd2_journal_invalidate_folio() returns -EBUSY if the buffer is part of the committing transaction as we cannot safely modify buffer state. However if the buffer is already invalidated (due to previous invalidation attempts from ext4_wait_for_tail_page_commit()), there's nothing to do and there's no point in returning -EBUSY. This fixes occasional warnings from ext4_journalled_invalidate_folio() triggered by generic/051 fstest when blocksize < pagesize.
--- fs/jbd2/transaction.c | 3 +++ 1 file changed, 3 insertions(+)
fs/jbd2/transaction.c +3 -0
@@ -2387,6 +2387,9 @@ static int journal_unmap_buffer(journal_t *journal, struct buffer_head *bh,spin_unlock (&jh->b_state_lock);write_unlock (&journal->j_state_lock);jbd2_journal_put_journal_head (jh); +/* Already zapped buffer? Nothing to do... */ +if (!bh->b_bdev) +return 0 ;return -EBUSY ; }/*
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 429/694 io_uring/rsrc: use nospeced indexes
In reply to Greg Kroah-HartmanFrom: Pavel Begunkov <[email protected]>
[ Upstream commit 953c37e066f05a3dca2d74643574b8dfe8a83983 ]
We use array_index_nospec() for registered buffer indexes, but don't use it while poking into rsrc tags, fix that.
--- io_uring/rsrc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
io_uring/rsrc.c +1 -1
@@ -577,7 +577,7 @@ static int __io_sqe_buffers_update(struct io_ring_ctx *ctx, } ctx->user_bufs[i] = imu; - *io_get_tag_slot (ctx->buf_data, offset) = tag; + *io_get_tag_slot (ctx->buf_data, i) = tag; }if (needs_switch)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 430/694 wifi: iwlwifi: make the loop for card preparation effective
In reply to Greg Kroah-HartmanFrom: Emmanuel Grumbach <[email protected]>
[ Upstream commit 28965ec0b5d9112585f725660e2ff13218505ace ]
Since we didn't reset t to 0, only the first iteration of the loop did checked the ready bit several times.
Quoted 1 line
From the second iteration and on, we just tested the bit once and
continued to the next iteration.
--- drivers/net/wireless/intel/iwlwifi/pcie/trans.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/pcie/trans.c +2 -1
@@ -599,7 +599,6 @@ static int iwl_pcie_set_hw_ready(struct iwl_trans *trans)int iwl_pcie_prepare_card_hw (struct iwl_trans *trans) {int ret; -int t =0 ;int iter;IWL_DEBUG_INFO (trans,"iwl_trans_prepare_card_hw enter\n" );
@@ -616,6 +615,8 @@ int iwl_pcie_prepare_card_hw(struct iwl_trans *trans)usleep_range (1000 ,2000 );for (iter =0 ; iter <10 ; iter++) { +int t =0 ; +/* If HW is not ready, prepare the conditions to check again */ iwl_set_bit (trans,CSR_HW_IF_CONFIG_REG ,CSR_HW_IF_CONFIG_REG_PREPARE );
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 431/694 wifi: mt76: remove redundent MCU_UNI_CMD_* definitions
In reply to Greg Kroah-HartmanFrom: Deren Wu <[email protected]>
[ Upstream commit 532f0482fc577a78c0086893ab39acb406ac3e65 ]
clear redundent definitions only
--- drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h | 3 --- 1 file changed, 3 deletions(-)
drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h +0 -3
@@ -967,9 +967,6 @@ enum {DEV_INFO_MAX_NUM }; -#define MCU_UNI_CMD_EVENT BIT(1) -#define MCU_UNI_CMD_UNSOLICITED_EVENT BIT(2) -/* event table */ enum {MCU_EVENT_TARGET_ADDRESS_LEN =0x01 ,
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 432/694 wifi: mt76: mt7921: fix wrong command to set STA channel
In reply to Greg Kroah-HartmanFrom: Deren Wu <[email protected]>
[ Upstream commit fcc51acfebb85dbc3ab1bea3ce4997d7c0a3a38d ]
Should not use AND operator to check vif type NL80211_IFTYPE_MONITOR, and that will cause we go into sniffer command for both STA and MONITOR mode. However, the sniffer command would set channel properly (with some extra options), the STA mode still works even if using the wrong command.
Fix vif type check to make sure we using the right command to update channel.
--- drivers/net/wireless/mediatek/mt76/mt7921/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7921/main.c +1 -1
@@ -1694,7 +1694,7 @@ static void mt7921_ctx_iter(void *priv, u8 *mac,if (ctx != mvif->ctx)return ; -if (vif->type &NL80211_IFTYPE_MONITOR ) +if (vif->type ==NL80211_IFTYPE_MONITOR )mt7921_mcu_config_sniffer (mvif, ctx);else mt76_connac_mcu_uni_set_chctx (mvif->phy->mt76, &mvif->mt76, ctx);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 433/694 wifi: mt76: mt7921: fix PCI DMA hang after reboot
In reply to Greg Kroah-HartmanFrom: Deren Wu <[email protected]>
[ Upstream commit 9270270d62191b7549296721e8d5f3dc0df01563 ]
mt7921 just stop some workers and clean up chip status before reboot. In stress test, there are working activities still running at the period of .shutdown callback and that would cause some hosts cannot recover DMA after reboot. To avoid the floating state in reboot, we use mt7921_pci_remove() to fully deinit all resources.
--- drivers/net/wireless/mediatek/mt76/mt7921/pci.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7921/pci.c +1 -11
@@ -515,17 +515,7 @@ static int mt7921_pci_resume(struct device *device)static void mt7921_pci_shutdown (struct pci_dev *pdev) { -struct mt76_dev *mdev =pci_get_drvdata (pdev); - struct mt7921_dev *dev = container_of(mdev, struct mt7921_dev, mt76); -struct mt76_connac_pm *pm = &dev->pm; - -cancel_delayed_work_sync (&pm->ps_work); -cancel_work_sync (&pm->wake_work); - -/* chip cleanup before reboot */ -mt7921_mcu_drv_pmctrl (dev); -mt7921_dma_cleanup (dev); -mt7921_wfsys_reset (dev); +mt7921_pci_remove (pdev); } static DEFINE_SIMPLE_DEV_PM_OPS(mt7921_pm_ops, mt7921_pci_suspend, mt7921_pci_resume);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 434/694 wifi: mt76: mt7915: unlock on error in mt7915_thermal_temp_store()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit cdc215c2c8d74b3c8886650e979b47f16c1f7f92 ]
Drop the lock before returning -EINVAL.
--- drivers/net/wireless/mediatek/mt76/mt7915/init.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/mediatek/mt76/mt7915/init.c +1 -0
@@ -89,6 +89,7 @@ static ssize_t mt7915_thermal_temp_store(struct device *dev, val < phy->throttle_temp[MT7915_CRIT_TEMP_IDX])) {dev_err (phy->dev->mt76.dev,"temp1_max shall be greater than temp1_crit." ); +mutex_unlock (&phy->dev->mt76.mutex);return -EINVAL ; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 435/694 wifi: mt76: mt7996: fix radiotap bitfield
In reply to Greg Kroah-HartmanFrom: Ryder Lee <[email protected]>
[ Upstream commit 63a3724632464559d1e98d90d2c63d43ec6ef6f5 ]
The 11be generation's radiotap bitfields were wrongly copy-and-pasted from 11ax driver, so fix them accordingly.
--- .../net/wireless/mediatek/mt76/mt7996/mac.c | 54 ++++++++++--------- .../net/wireless/mediatek/mt76/mt7996/mac.h | 41 +++++++------- 2 files changed, 47 insertions(+), 48 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7996/mac.c +28 -26
@@ -260,12 +260,9 @@ mt7996_mac_decode_he_radiotap_ru(struct mt76_rx_status *status,struct ieee80211_radiotap_he *he, __le32 *rxv) { - u32 ru_h, ru_l; -u8 ru, offs =0 ; + u32 ru, offs = 0; - ru_l =le32_get_bits (rxv[0 ],MT_PRXV_HE_RU_ALLOC_L ); - ru_h =le32_get_bits (rxv[1 ],MT_PRXV_HE_RU_ALLOC_H ); - ru = (u8)(ru_l | ru_h <<4 ); + ru =le32_get_bits (rxv[0 ],MT_PRXV_HE_RU_ALLOC ); status->bw =RATE_INFO_BW_HE_RU ;
@@ -330,18 +327,23 @@ mt7996_mac_decode_he_mu_radiotap(struct sk_buff *skb, __le32 *rxv) he_mu->flags2 |=MU_PREP (FLAGS2_BW_FROM_SIG_A_BW , status->bw) |MU_PREP (FLAGS2_SIG_B_SYMS_USERS , -le32_get_bits (rxv[2 ],MT_CRXV_HE_NUM_USER )); +le32_get_bits (rxv[4 ],MT_CRXV_HE_NUM_USER )); - he_mu->ru_ch1[0 ] =le32_get_bits (rxv[3 ],MT_CRXV_HE_RU0 ); + he_mu->ru_ch1[0 ] =le32_get_bits (rxv[16 ],MT_CRXV_HE_RU0 ) &0xff ;if (status->bw >=RATE_INFO_BW_40 ) { he_mu->flags1 |=HE_BITS (MU_FLAGS1_CH2_RU_KNOWN ); - he_mu->ru_ch2[0 ] =le32_get_bits (rxv[3 ],MT_CRXV_HE_RU1 ); + he_mu->ru_ch2[0 ] =le32_get_bits (rxv[16 ],MT_CRXV_HE_RU1 ) &0xff ; }if (status->bw >=RATE_INFO_BW_80 ) { - he_mu->ru_ch1[1 ] =le32_get_bits (rxv[3 ],MT_CRXV_HE_RU2 ); - he_mu->ru_ch2[1 ] =le32_get_bits (rxv[3 ],MT_CRXV_HE_RU3 ); +u32 ru_h, ru_l; + + he_mu->ru_ch1[1 ] =le32_get_bits (rxv[16 ],MT_CRXV_HE_RU2 ) &0xff ; + + ru_l =le32_get_bits (rxv[16 ],MT_CRXV_HE_RU3_L ); + ru_h =le32_get_bits (rxv[17 ],MT_CRXV_HE_RU3_H ) &0x7 ; + he_mu->ru_ch2[1 ] = (u8)(ru_l | ru_h <<4 ); } }
@@ -364,23 +366,23 @@ mt7996_mac_decode_he_radiotap(struct sk_buff *skb, __le32 *rxv, u8 mode) HE_BITS(DATA2_TXOP_KNOWN), };struct ieee80211_radiotap_he *he =NULL ; -u32 ltf_size =le32_get_bits (rxv[2 ],MT_CRXV_HE_LTF_SIZE ) +1 ; +u32 ltf_size =le32_get_bits (rxv[4 ],MT_CRXV_HE_LTF_SIZE ) +1 ; status->flag |=RX_FLAG_RADIOTAP_HE ; he =skb_push (skb,sizeof (known));memcpy (he, &known,sizeof (known)); - he->data3 =HE_PREP (DATA3_BSS_COLOR ,BSS_COLOR , rxv[14 ]) | -HE_PREP (DATA3_LDPC_XSYMSEG ,LDPC_EXT_SYM , rxv[2 ]); - he->data4 =HE_PREP (DATA4_SU_MU_SPTL_REUSE ,SR_MASK , rxv[11 ]); - he->data5 =HE_PREP (DATA5_PE_DISAMBIG ,PE_DISAMBIG , rxv[2 ]) | + he->data3 =HE_PREP (DATA3_BSS_COLOR ,BSS_COLOR , rxv[9 ]) | +HE_PREP (DATA3_LDPC_XSYMSEG ,LDPC_EXT_SYM , rxv[4 ]); + he->data4 =HE_PREP (DATA4_SU_MU_SPTL_REUSE ,SR_MASK , rxv[13 ]); + he->data5 =HE_PREP (DATA5_PE_DISAMBIG ,PE_DISAMBIG , rxv[5 ]) |le16_encode_bits (ltf_size,IEEE80211_RADIOTAP_HE_DATA5_LTF_SIZE );if (le32_to_cpu (rxv[0 ]) &MT_PRXV_TXBF ) he->data5 |=HE_BITS (DATA5_TXBF ); - he->data6 =HE_PREP (DATA6_TXOP ,TXOP_DUR , rxv[14 ]) | -HE_PREP (DATA6_DOPPLER ,DOPPLER , rxv[14 ]); + he->data6 =HE_PREP (DATA6_TXOP ,TXOP_DUR , rxv[9 ]) | +HE_PREP (DATA6_DOPPLER ,DOPPLER , rxv[9 ]);switch (mode) {case MT_PHY_TYPE_HE_SU :
@@ -389,22 +391,22 @@ mt7996_mac_decode_he_radiotap(struct sk_buff *skb, __le32 *rxv, u8 mode)HE_BITS (DATA1_BEAM_CHANGE_KNOWN ) |HE_BITS (DATA1_BW_RU_ALLOC_KNOWN ); - he->data3 |=HE_PREP (DATA3_BEAM_CHANGE ,BEAM_CHNG , rxv[14 ]) | -HE_PREP (DATA3_UL_DL ,UPLINK , rxv[2 ]); + he->data3 |=HE_PREP (DATA3_BEAM_CHANGE ,BEAM_CHNG , rxv[8 ]) | +HE_PREP (DATA3_UL_DL ,UPLINK , rxv[5 ]);break ;case MT_PHY_TYPE_HE_EXT_SU : he->data1 |=HE_BITS (DATA1_FORMAT_EXT_SU ) |HE_BITS (DATA1_UL_DL_KNOWN ) |HE_BITS (DATA1_BW_RU_ALLOC_KNOWN ); - he->data3 |=HE_PREP (DATA3_UL_DL ,UPLINK , rxv[2 ]); + he->data3 |=HE_PREP (DATA3_UL_DL ,UPLINK , rxv[5 ]);break ;case MT_PHY_TYPE_HE_MU : he->data1 |=HE_BITS (DATA1_FORMAT_MU ) |HE_BITS (DATA1_UL_DL_KNOWN ); - he->data3 |=HE_PREP (DATA3_UL_DL ,UPLINK , rxv[2 ]); - he->data4 |=HE_PREP (DATA4_MU_STA_ID ,MU_AID , rxv[7 ]); + he->data3 |=HE_PREP (DATA3_UL_DL ,UPLINK , rxv[5 ]); + he->data4 |=HE_PREP (DATA4_MU_STA_ID ,MU_AID , rxv[8 ]);mt7996_mac_decode_he_radiotap_ru (status, he, rxv);mt7996_mac_decode_he_mu_radiotap (skb, rxv);
@@ -415,10 +417,10 @@ mt7996_mac_decode_he_radiotap(struct sk_buff *skb, __le32 *rxv, u8 mode)HE_BITS (DATA1_SPTL_REUSE3_KNOWN ) |HE_BITS (DATA1_SPTL_REUSE4_KNOWN ); - he->data4 |=HE_PREP (DATA4_TB_SPTL_REUSE1 ,SR_MASK , rxv[11 ]) | -HE_PREP (DATA4_TB_SPTL_REUSE2 ,SR1_MASK , rxv[11 ]) | -HE_PREP (DATA4_TB_SPTL_REUSE3 ,SR2_MASK , rxv[11 ]) | -HE_PREP (DATA4_TB_SPTL_REUSE4 ,SR3_MASK , rxv[11 ]); + he->data4 |=HE_PREP (DATA4_TB_SPTL_REUSE1 ,SR_MASK , rxv[13 ]) | +HE_PREP (DATA4_TB_SPTL_REUSE2 ,SR1_MASK , rxv[13 ]) | +HE_PREP (DATA4_TB_SPTL_REUSE3 ,SR2_MASK , rxv[13 ]) | +HE_PREP (DATA4_TB_SPTL_REUSE4 ,SR3_MASK , rxv[13 ]);mt7996_mac_decode_he_radiotap_ru (status, he, rxv);break ;
drivers/net/wireless/mediatek/mt76/mt7996/mac.h +19 -22
61 lines not on this page · raw message
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 436/694 wifi: mt76: mt7915: expose device tree match table
In reply to Greg Kroah-HartmanFrom: Lorenz Brun <[email protected]>
[ Upstream commit 90fb69212c60e26ef70ed0e8532b116c7649ac88 ]
On MT7986 the WiFi driver currently does not get automatically loaded, requiring manual modprobing because the device tree compatibles are not exported into metadata.
Add the missing MODULE_DEVICE_TABLE macro to fix this.
--- drivers/net/wireless/mediatek/mt76/mt7915/soc.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/wireless/mediatek/mt76/mt7915/soc.c +2 -0
@@ -1239,6 +1239,8 @@ static const struct of_device_id mt7986_wmac_of_match[] = { {}, }; +MODULE_DEVICE_TABLE (of, mt7986_wmac_of_match); +struct platform_driver mt7986_wmac_driver = { .driver = { .name ="mt7986-wmac" ,
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 437/694 wifi: mt76: mt7915: rework init flow in mt7915_thermal_init()
In reply to Greg Kroah-HartmanFrom: Howard Hsu <[email protected]>
[ Upstream commit 9c97df11dfe68b548a47744ba9fa6beddcfba2bc ]
If kernel do not enable CONFIG_HWMON, it may cause thermal initialization to be done with temperature value 0 and then can not transmit. This commit fixes it by setting trigger/restore temperature before checking CONFIG_HWMON.
--- drivers/net/wireless/mediatek/mt76/mt7915/init.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7915/init.c +4 -4
@@ -203,6 +203,10 @@ static int mt7915_thermal_init(struct mt7915_phy *phy) phy->cdev = cdev; } +/* initialize critical/maximum high temperature */ + phy->throttle_temp[MT7915_CRIT_TEMP_IDX ] =MT7915_CRIT_TEMP ; + phy->throttle_temp[MT7915_MAX_TEMP_IDX ] =MT7915_MAX_TEMP ; +if (!IS_REACHABLE (CONFIG_HWMON ))return 0 ;
@@ -211,10 +215,6 @@ static int mt7915_thermal_init(struct mt7915_phy *phy)if (IS_ERR (hwmon))return PTR_ERR (hwmon); -/* initialize critical/maximum high temperature */ - phy->throttle_temp[MT7915_CRIT_TEMP_IDX ] =MT7915_CRIT_TEMP ; - phy->throttle_temp[MT7915_MAX_TEMP_IDX ] =MT7915_MAX_TEMP ; -return 0 ; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 438/694 wifi: mt76: handle failure of vzalloc in mt7615_coredump_work
In reply to Greg Kroah-HartmanFrom: Kang Chen <[email protected]>
[ Upstream commit 9e47dd9f64a47ae00ca0123017584c37209ee900 ]
vzalloc may fails, dump might be null and will cause illegal address access later.
--- drivers/net/wireless/mediatek/mt76/mt7615/mac.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7615/mac.c +5 -3
@@ -2355,7 +2355,7 @@ void mt7615_coredump_work(struct work_struct *work)break ;skb_pull (skb,sizeof (struct mt7615_mcu_rxd )); -if (data + skb->len - dump >MT76_CONNAC_COREDUMP_SZ ) { +if (!dump || data + skb->len - dump >MT76_CONNAC_COREDUMP_SZ ) {dev_kfree_skb (skb);continue ; }
@@ -2365,6 +2365,8 @@ void mt7615_coredump_work(struct work_struct *work)dev_kfree_skb (skb); } -dev_coredumpv (dev->mt76.dev, dump,MT76_CONNAC_COREDUMP_SZ , -GFP_KERNEL ); + +if (dump) +dev_coredumpv (dev->mt76.dev, dump,MT76_CONNAC_COREDUMP_SZ , +GFP_KERNEL ); }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 439/694 wifi: mt76: mt7996: let non-bufferable MMPDUs use correct hw queue
In reply to Greg Kroah-HartmanFrom: Shayne Chen <[email protected]>
[ Upstream commit d0b6f86fdbefa62fd4ad2acd1aea6c45f9b518ba ]
Pass qid into mt7996_mac_write_txwi() to let the tx descriptor of non-bufferable MMPDUs be filled with correct hw queue index.
--- drivers/net/wireless/mediatek/mt76/mt7996/mac.c | 11 ++++++----- drivers/net/wireless/mediatek/mt76/mt7996/mcu.c | 6 +++--- drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h | 5 +++-- 3 files changed, 12 insertions(+), 10 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7996/mac.c +6 -5
@@ -981,8 +981,9 @@ mt7996_mac_write_txwi_80211(struct mt7996_dev *dev, __le32 *txwi, }void mt7996_mac_write_txwi (struct mt7996_dev *dev,__le32 *txwi, -struct sk_buff *skb,struct mt76_wcid *wcid,int pid, -struct ieee80211_key_conf *key,u32 changed) +struct sk_buff *skb,struct mt76_wcid *wcid, +struct ieee80211_key_conf *key,int pid, +enum mt76_txq_id qid,u32 changed) {struct ieee80211_tx_info *info =IEEE80211_SKB_CB (skb);struct ieee80211_vif *vif = info->control.vif;
@@ -1013,7 +1014,7 @@ void mt7996_mac_write_txwi(struct mt7996_dev *dev, __le32 *txwi, }else if (beacon) { p_fmt =MT_TX_TYPE_FW ; q_idx =MT_LMAC_BCN0 ; - }else if (skb_get_queue_mapping (skb) >=MT_TXQ_PSD ) { + }else if (qid >=MT_TXQ_PSD ) { p_fmt =MT_TX_TYPE_CT ; q_idx =MT_LMAC_ALTX0 ; }else {
@@ -1122,8 +1123,8 @@ int mt7996_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,memset (txwi_ptr,0 ,MT_TXD_SIZE );/* Transmit non qos data by 802.11 header and need to fill txd by host*/ if (!is_8023 || pid >=MT_PACKET_ID_FIRST ) -mt7996_mac_write_txwi (dev, txwi_ptr, tx_info->skb, wcid, pid, - key,0 ); +mt7996_mac_write_txwi (dev, txwi_ptr, tx_info->skb, wcid, key, + pid, qid,0 ); txp = (struct mt76_connac_txp_common *)(txwi +MT_TXD_SIZE );for (i =0 ; i < nbuf; i++) {
drivers/net/wireless/mediatek/mt76/mt7996/mcu.c +3 -3
@@ -1906,8 +1906,9 @@ mt7996_mcu_beacon_cont(struct mt7996_dev *dev, struct ieee80211_vif *vif, } buf = (u8 *)bcn +sizeof (*bcn) -MAX_BEACON_SIZE ; -mt7996_mac_write_txwi (dev, (__le32 *)buf, skb, wcid,0 ,NULL , +mt7996_mac_write_txwi (dev, (__le32 *)buf, skb, wcid,NULL ,0 ,0 ,BSS_CHANGED_BEACON ); +memcpy (buf +MT_TXD_SIZE , skb->data, skb->len); }
@@ -2115,8 +2116,7 @@ int mt7996_mcu_beacon_inband_discov(struct mt7996_dev *dev, buf = (u8 *)tlv +sizeof (*discov) -MAX_INBAND_FRAME_SIZE ; -mt7996_mac_write_txwi (dev, (__le32 *)buf, skb, wcid,0 ,NULL , - changed); +mt7996_mac_write_txwi (dev, (__le32 *)buf, skb, wcid,NULL ,0 ,0 , changed);memcpy (buf +MT_TXD_SIZE , skb->data, skb->len);
drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h +3 -2
@@ -487,8 +487,9 @@ void mt7996_mac_enable_nf(struct mt7996_dev *dev, u8 band);void mt7996_mac_enable_rtscts (struct mt7996_dev *dev,struct ieee80211_vif *vif,bool enable);void mt7996_mac_write_txwi (struct mt7996_dev *dev,__le32 *txwi, -struct sk_buff *skb,struct mt76_wcid *wcid,int pid, -struct ieee80211_key_conf *key,u32 changed); +struct sk_buff *skb,struct mt76_wcid *wcid, +struct ieee80211_key_conf *key,int pid, +enum mt76_txq_id qid,u32 changed);void mt7996_mac_set_timing (struct mt7996_phy *phy);int mt7996_mac_sta_add (struct mt76_dev *mdev,struct ieee80211_vif *vif,struct ieee80211_sta *sta);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 440/694 wifi: mt76: mt7996: fix pointer calculation in ie countdown event
In reply to Greg Kroah-HartmanFrom: Peter Chiu <[email protected]>
[ Upstream commit 8b14ce24a0297175bc4ebdf26d45a22b5a33847f ]
Fix the tail and data pointers. The rxd->len in mt7996_mcu_rxd does not include the length of general rxd. It only includes the length of firmware event rxd. Use skb->length to get the correct length.
--- drivers/net/wireless/mediatek/mt76/mt7996/mcu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7996/mcu.c +2 -1
@@ -422,7 +422,8 @@ mt7996_mcu_ie_countdown(struct mt7996_dev *dev, struct sk_buff *skb)if (hdr->band && dev->mt76.phys[hdr->band]) mphy = dev->mt76.phys[hdr->band]; - tail = skb->data +le16_to_cpu (rxd->len); + tail = skb->data + skb->len; + data +=sizeof (struct header );while (data +sizeof (struct tlv ) < tail &&le16_to_cpu (tlv->len)) {switch (le16_to_cpu (tlv->tag)) {case UNI_EVENT_IE_COUNTDOWN_CSA :
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 441/694 wifi: mt76: mt7996: fix eeprom tx path bitfields
In reply to Greg Kroah-HartmanFrom: StanleyYP Wang <[email protected]>
[ Upstream commit 72fc0df3006ce5c109f9c68f0724e44c47b4ec7b ]
Swap the tx path bitfields of band1 and band2 to read correct setting.
--- drivers/net/wireless/mediatek/mt76/mt7996/eeprom.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7996/eeprom.h +4 -4
@@ -31,11 +31,11 @@ enum mt7996_eeprom_field {#define MT_EE_WIFI_CONF2_BAND_SEL GENMASK(2, 0)#define MT_EE_WIFI_CONF1_TX_PATH_BAND0 GENMASK(5, 3) -#define MT_EE_WIFI_CONF2_TX_PATH_BAND1 GENMASK(5, 3) -#define MT_EE_WIFI_CONF2_TX_PATH_BAND2 GENMASK(2, 0) +#define MT_EE_WIFI_CONF2_TX_PATH_BAND1 GENMASK(2, 0) +#define MT_EE_WIFI_CONF2_TX_PATH_BAND2 GENMASK(5, 3)#define MT_EE_WIFI_CONF4_STREAM_NUM_BAND0 GENMASK(5, 3) -#define MT_EE_WIFI_CONF5_STREAM_NUM_BAND1 GENMASK(5, 3) -#define MT_EE_WIFI_CONF5_STREAM_NUM_BAND2 GENMASK(2, 0) +#define MT_EE_WIFI_CONF5_STREAM_NUM_BAND1 GENMASK(2, 0) +#define MT_EE_WIFI_CONF5_STREAM_NUM_BAND2 GENMASK(5, 3)#define MT_EE_RATE_DELTA_MASK GENMASK(5, 0)#define MT_EE_RATE_DELTA_SIGN BIT(6)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 442/694 wifi: mt76: mt7921: use driver flags rather than mac80211 flags to mcu
In reply to Greg Kroah-HartmanFrom: Neil Chen <[email protected]>
[ Upstream commit a5af1481a85679a9812f728ee5cf64ee7edbe669 ]
FIF_* flags from mac80211 is not ABI. mt7921 should not pass it into mcu directly. Remap FIF_* to driver defined flags as mcu command input.
--- .../net/wireless/mediatek/mt76/mt7921/main.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7921/main.c +16 -1
@@ -702,10 +702,25 @@ static void mt7921_configure_filter(struct ieee80211_hw *hw, unsigned int *total_flags, u64 multicast) { +#define MT7921_FILTER_FCSFAIL BIT(2) +#define MT7921_FILTER_CONTROL BIT(5) +#define MT7921_FILTER_OTHER_BSS BIT(6) +#define MT7921_FILTER_ENABLE BIT(31) +struct mt7921_dev *dev =mt7921_hw_dev (hw); +u32 flags =MT7921_FILTER_ENABLE ; + +#define MT7921_FILTER (_fif, _type) do { \ + if (*total_flags & (_fif)) \ + flags |= MT7921_FILTER_##_type; \ + } while (0) + +MT7921_FILTER (FIF_FCSFAIL ,FCSFAIL ); +MT7921_FILTER (FIF_CONTROL ,CONTROL ); +MT7921_FILTER (FIF_OTHER_BSS ,OTHER_BSS );mt7921_mutex_acquire (dev); -mt7921_mcu_set_rxfilter (dev, *total_flags,0 ,0 ); +mt7921_mcu_set_rxfilter (dev, flags,0 ,0 );mt7921_mutex_release (dev); *total_flags &= (FIF_OTHER_BSS |FIF_FCSFAIL |FIF_CONTROL );
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 443/694 wifi: mt76: mt7921e: fix probe timeout after reboot
In reply to Greg Kroah-HartmanFrom: Quan Zhou <[email protected]>
[ Upstream commit c397fc1e6365a2a9e5540a85b2c1d4ea412aa0e2 ]
In system warm reboot scene, due to the polling timeout(now 1000us) is too short to wait dma idle in time, it may make driver probe fail with error code -ETIMEDOUT. Meanwhile, we also found the dma may take around 70ms to enter idle state. Change the polling idle timeout to 100ms to avoid the probabilistic probe fail.
Tested pass with 5000 times warm reboot on x86 platform.
[4.477496] pci 0000:01:00.0: attach allowed to drvr mt7921e [internal device] [4.478306] mt7921e 0000:01:00.0: ASIC revision: 79610010 [4.480063] mt7921e: probe of 0000:01:00.0 failed with error -110
--- drivers/net/wireless/mediatek/mt76/mt7921/dma.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7921/dma.c +3 -3
@@ -90,9 +90,9 @@ static int mt7921_dma_disable(struct mt7921_dev *dev, bool force)MT_WFDMA0_GLO_CFG_OMIT_RX_INFO | MT_WFDMA0_GLO_CFG_OMIT_RX_INFO_PFET2); -if (!mt76_poll (dev,MT_WFDMA0_GLO_CFG , -MT_WFDMA0_GLO_CFG_TX_DMA_BUSY | -MT_WFDMA0_GLO_CFG_RX_DMA_BUSY ,0 ,1000 )) +if (!mt76_poll_msec_tick (dev,MT_WFDMA0_GLO_CFG , +MT_WFDMA0_GLO_CFG_TX_DMA_BUSY | +MT_WFDMA0_GLO_CFG_RX_DMA_BUSY ,0 ,100 ,1 ))return -ETIMEDOUT ;return 0 ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 444/694 wifi: mt76: fix 6GHz high channel not be scanned
In reply to Greg Kroah-HartmanFrom: Ming Yen Hsieh <[email protected]>
[ Upstream commit 23792cedaff02351b57bddd8957fc917fa88f2e0 ]
mt76 scan command only support 64 channels currently. If the channel count is larger than 64(for 2+5+6GHz), some channels will not be scanned. Hence change the scan type to full channel scan in case of the command cannot include proper list for chip.
--- .../net/wireless/mediatek/mt76/mt76_connac_mcu.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c +10 -3
@@ -1678,8 +1678,16 @@ int mt76_connac_mcu_hw_scan(struct mt76_phy *phy, struct ieee80211_vif *vif, req->channel_min_dwell_time =cpu_to_le16 (duration); req->channel_dwell_time =cpu_to_le16 (duration); - req->channels_num =min_t (u8, sreq->n_channels,32 ); - req->ext_channels_num =min_t (u8, ext_channels_num,32 ); +if (sreq->n_channels ==0 || sreq->n_channels >64 ) { + req->channel_type =0 ; + req->channels_num =0 ; + req->ext_channels_num =0 ; + }else { + req->channel_type =4 ; + req->channels_num =min_t (u8, sreq->n_channels,32 ); + req->ext_channels_num =min_t (u8, ext_channels_num,32 ); + } +for (i =0 ; i < req->channels_num + req->ext_channels_num; i++) {if (i >=32 ) chan = &req->ext_channels[i -32 ];
@@ -1699,7 +1707,6 @@ int mt76_connac_mcu_hw_scan(struct mt76_phy *phy, struct ieee80211_vif *vif, } chan->channel_num = scan_list[i]->hw_value; } - req->channel_type = sreq->n_channels ?4 :0 ;if (sreq->ie_len >0 ) {memcpy (req->ies, sreq->ie, sreq->ie_len);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 445/694 mt76: mt7921: fix kernel panic by accessing unallocated eeprom.data
In reply to Greg Kroah-HartmanFrom: Sean Wang <[email protected]>
[ Upstream commit 12db28c3ef31f719bd18fa186a40bb152e6a527c ]
The MT7921 driver no longer uses eeprom.data, but the relevant code has not been removed completely since
commit 16d98b548365 ("mt76: mt7921: rely on mcu_get_nic_capability"). This could result in potential invalid memory access.
To fix the kernel panic issue in mt7921, it is necessary to avoid accessing unallocated eeprom.data which can lead to invalid memory access.
Furthermore, it is possible to entirely eliminate the mt7921_mcu_parse_eeprom function and solely depend on mt7921_mcu_parse_response to divide the RxD header.
[2.702735] BUG: kernel NULL pointer dereference, address: 0000000000000550 [2.702740] #PF: supervisor write access in kernel mode [2.702741] #PF: error_code(0x0002) - not-present page [2.702743] PGD 0 P4D 0 [2.702747] Oops: 0002 [#1] PREEMPT SMP NOPTI [2.702755] RIP: 0010:mt7921_mcu_parse_response+0x147/0x170 [mt7921_common] [2.702758] RSP: 0018:ffffae7c00fef828 EFLAGS: 00010286 [2.702760] RAX: ffffa367f57be024 RBX: ffffa367cc7bf500 RCX: 0000000000000000 [2.702762] RDX: 0000000000000550 RSI: 0000000000000000 RDI: ffffa367cc7bf500 [2.702763] RBP: ffffae7c00fef840 R08: ffffa367cb167000 R09: 0000000000000005 [2.702764] R10: 0000000000000000 R11: ffffffffc04702e4 R12: ffffa367e8329f40 [2.702766] R13: 0000000000000000 R14: 0000000000000001 R15: ffffa367e8329f40 [2.702768] FS: 000079ee6cf20c40(0000) GS:ffffa36b2f940000(0000) knlGS:0000000000000000 [2.702769] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [2.702775] CR2: 0000000000000550 CR3: 00000001233c6004 CR4: 0000000000770ee0 [2.702776] PKRU: 55555554 [2.702777] Call Trace: [2.702782] mt76_mcu_skb_send_and_get_msg+0xc3/0x11e [mt76 <HASH:1bc4 5>] [2.702785] mt7921_run_firmware+0x241/0x853 [mt7921_common <HASH:6a2f 6>] [2.702789] mt7921e_mcu_init+0x2b/0x56 [mt7921e <HASH:d290 7>] [2.702792] mt7921_register_device+0x2eb/0x5a5 [mt7921_common <HASH:6a2f 6>] [2.702795] ? mt7921_irq_tasklet+0x1d4/0x1d4 [mt7921e <HASH:d290 7>] [2.702797] mt7921_pci_probe+0x2d6/0x319 [mt7921e <HASH:d290 7>] [2.702799] pci_device_probe+0x9f/0x12a
--- .../net/wireless/mediatek/mt76/mt7921/mcu.c | 20 ------------------- 1 file changed, 20 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7921/mcu.c +0 -20
@@ -16,24 +16,6 @@ static bool mt7921_disable_clc;module_param_named (disable_clc, mt7921_disable_clc, bool,0644 );MODULE_PARM_DESC (disable_clc,"disable CLC support" ); -static int -mt7921_mcu_parse_eeprom (struct mt76_dev *dev,struct sk_buff *skb) -{ -struct mt7921_mcu_eeprom_info *res; -u8 *buf; - -if (!skb) -return -EINVAL ; - -skb_pull (skb,sizeof (struct mt76_connac2_mcu_rxd )); - - res = (struct mt7921_mcu_eeprom_info *)skb->data; - buf = dev->eeprom.data +le32_to_cpu (res->addr); -memcpy (buf, res->data,16 ); - -return 0 ; -} -int mt7921_mcu_parse_response (struct mt76_dev *mdev,int cmd,struct sk_buff *skb,int seq) {
@@ -60,8 +42,6 @@ int mt7921_mcu_parse_response(struct mt76_dev *mdev, int cmd, }else if (cmd ==MCU_EXT_CMD (THERMAL_CTRL )) {skb_pull (skb,sizeof (*rxd) +4 ); ret =le32_to_cpu (*(__le32 *)skb->data); - }else if (cmd ==MCU_EXT_CMD (EFUSE_ACCESS )) { - ret =mt7921_mcu_parse_eeprom (mdev, skb); } else if (cmd == MCU_UNI_CMD(DEV_INFO_UPDATE) || cmd == MCU_UNI_CMD(BSS_INFO_UPDATE) || cmd == MCU_UNI_CMD(STA_REC_UPDATE) ||
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 446/694 wifi: mt76: mt7921: fix missing unwind goto in `mt7921u_probe`
In reply to Greg Kroah-HartmanFrom: Jiefeng Li <[email protected]>
[ Upstream commit 5c47cdebbaeb7724df6f9f46917c93e53f791547 ]
mt7921u_dma_init can only return zero or negative number according to its definition. When it returns non-zero number, there exists an error and this function should handle this error rather than return directly.
--- drivers/net/wireless/mediatek/mt76/mt7921/usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7921/usb.c +1 -1
@@ -272,7 +272,7 @@ static int mt7921u_probe(struct usb_interface *usb_intf, ret =mt7921u_dma_init (dev, false);if (ret) -return ret; + goto error; hw =mt76_hw (dev);/* check hw sg support in order to enable AMSDU */
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 447/694 wifi: mt76: mt7921e: improve reliability of dma reset
In reply to Greg Kroah-HartmanFrom: Quan Zhou <[email protected]>
[ Upstream commit 87714bf6ed1589813e473db5471e6e9857755764 ]
The hardware team has advised the driver that it is necessary to first put WFDMA into an idle state before resetting the WFDMA. Otherwise, the WFDMA may enter an unknown state where it cannot be polled with the right state successfully. To ensure that the DMA can work properly while a stressful cold reboot test was being made, we have reordered the programming sequence in the driver based on the hardware team's guidance.
The patch would modify the WFDMA disabling flow from
"DMA reset -> disabling DMASHDL -> disabling WFDMA -> polling and waiting until DMA idle" to "disabling WFDMA -> polling and waiting for DMA idle -> disabling DMASHDL -> DMA reset.
Where he polling and waiting until WFDMA is idle is coordinated with the operation of disabling WFDMA. Even while WFDMA is being disabled, it can still handle Tx/Rx requests. The additional polling allows sufficient time for WFDMA to process the last T/Rx request. When the idle state of WFDMA is reached, it is a reliable indication that DMASHDL is also idle to ensure it is safe to disable it and perform the DMA reset.
--- .../net/wireless/mediatek/mt76/mt7921/dma.c | 36 ++++++++++--------- 1 file changed, 20 insertions(+), 16 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7921/dma.c +20 -16
@@ -66,22 +66,6 @@ static void mt7921_dma_prefetch(struct mt7921_dev *dev)static int mt7921_dma_disable (struct mt7921_dev *dev,bool force) { -if (force) { -/* reset */ -mt76_clear (dev,MT_WFDMA0_RST , -MT_WFDMA0_RST_DMASHDL_ALL_RST | -MT_WFDMA0_RST_LOGIC_RST ); - -mt76_set (dev,MT_WFDMA0_RST , -MT_WFDMA0_RST_DMASHDL_ALL_RST | -MT_WFDMA0_RST_LOGIC_RST ); - } - -/* disable dmashdl */ -mt76_clear (dev,MT_WFDMA0_GLO_CFG_EXT0 , -MT_WFDMA0_CSR_TX_DMASHDL_ENABLE ); -mt76_set (dev,MT_DMASHDL_SW_CONTROL ,MT_DMASHDL_DMASHDL_BYPASS ); -/* disable WFDMA0 */ mt76_clear(dev, MT_WFDMA0_GLO_CFG, MT_WFDMA0_GLO_CFG_TX_DMA_EN | MT_WFDMA0_GLO_CFG_RX_DMA_EN |
@@ -95,6 +79,22 @@ static int mt7921_dma_disable(struct mt7921_dev *dev, bool force) MT_WFDMA0_GLO_CFG_RX_DMA_BUSY, 0, 100, 1))return -ETIMEDOUT ; +/* disable dmashdl */ +mt76_clear (dev,MT_WFDMA0_GLO_CFG_EXT0 , +MT_WFDMA0_CSR_TX_DMASHDL_ENABLE ); +mt76_set (dev,MT_DMASHDL_SW_CONTROL ,MT_DMASHDL_DMASHDL_BYPASS ); + +if (force) { +/* reset */ +mt76_clear (dev,MT_WFDMA0_RST , +MT_WFDMA0_RST_DMASHDL_ALL_RST | +MT_WFDMA0_RST_LOGIC_RST ); + +mt76_set (dev,MT_WFDMA0_RST , +MT_WFDMA0_RST_DMASHDL_ALL_RST | +MT_WFDMA0_RST_LOGIC_RST ); + } +return 0 ; }
@@ -301,6 +301,10 @@ void mt7921_dma_cleanup(struct mt7921_dev *dev)MT_WFDMA0_GLO_CFG_OMIT_RX_INFO | MT_WFDMA0_GLO_CFG_OMIT_RX_INFO_PFET2); +mt76_poll_msec_tick (dev,MT_WFDMA0_GLO_CFG , +MT_WFDMA0_GLO_CFG_TX_DMA_BUSY | +MT_WFDMA0_GLO_CFG_RX_DMA_BUSY ,0 ,100 ,1 ); +/* reset */ mt76_clear(dev, MT_WFDMA0_RST, MT_WFDMA0_RST_DMASHDL_ALL_RST |
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 448/694 wifi: mt76: mt7921e: stop chip reset worker in unregister hook
In reply to Greg Kroah-HartmanFrom: Quan Zhou <[email protected]>
[ Upstream commit 3d78c46423c6567ed25ca033e086865b1b4d5ae1 ]
If the chip reset worker is triggered during the remove process, the chip DMA may not be properly pushed back to the idle state. This can lead to corruption of the DMA flow due to the chip reset. Therefore, it is necessary to stop the chip reset before the DMA is finalized.
To avoid resetting the chip after the reset worker is cancelled, use __mt7921_mcu_drv_pmctrl() instead of mt7921_mcu_drv_pmctrl(). It is safe to ignore the pm mutex because the pm worker and wake worker have already been cancelled.
--- drivers/net/wireless/mediatek/mt76/mt7921/pci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7921/pci.c +2 -1
@@ -115,9 +115,10 @@ static void mt7921e_unregister_device(struct mt7921_dev *dev)napi_disable (&dev->mt76.napi[i]);cancel_delayed_work_sync (&pm->ps_work);cancel_work_sync (&pm->wake_work); +cancel_work_sync (&dev->reset_work);mt7921_tx_token_put (dev); -mt7921_mcu_drv_pmctrl (dev); +__mt7921_mcu_drv_pmctrl (dev);mt7921_dma_cleanup (dev);mt7921_wfsys_reset (dev);skb_queue_purge (&dev->mt76.mcu.res_q);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 449/694 wifi: mt76: connac: fix txd multicast rate setting
In reply to Greg Kroah-HartmanFrom: Ryder Lee <[email protected]>
[ Upstream commit 3d2892e05086d09aecf14ea64b2debbf495e313c ]
The vif->bss_conf.mcast_rate should be applied to multicast data frame only.
--- drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c +2 -1
@@ -537,7 +537,8 @@ void mt76_connac2_mac_write_txwi(struct mt76_dev *dev, __le32 *txwi,if (txwi[2 ] &cpu_to_le32 (MT_TXD2_FIX_RATE )) {/* Fixed rata is available just for 802.11 txd */ struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; -bool multicast =is_multicast_ether_addr (hdr->addr1); +bool multicast =ieee80211_is_data (hdr->frame_control) && +is_multicast_ether_addr (hdr->addr1);u16 rate =mt76_connac2_mac_tx_rate_val (mphy, vif, beacon, multicast);u32 val =MT_TXD6_FIXED_BW ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 450/694 wifi: iwlwifi: mvm: check firmware response size
In reply to Greg Kroah-HartmanFrom: Johannes Berg <[email protected]>
[ Upstream commit 13513cec93ac9902d0b896976d8bab3758a9881c ]
Check the firmware response size for responses to the memory read/write command in debugfs before using it.
--- drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c +10 -0
@@ -1745,6 +1745,11 @@ static ssize_t iwl_dbgfs_mem_read(struct file *file, char __user *user_buf,if (ret <0 )return ret; +if (iwl_rx_packet_payload_len (hcmd.resp_pkt) <sizeof (*rsp)) { + ret = -EIO ; + goto out; + } + rsp = (void *)hcmd.resp_pkt->data;if (le32_to_cpu (rsp->status) !=DEBUG_MEM_STATUS_SUCCESS ) { ret = -ENXIO ;
@@ -1821,6 +1826,11 @@ static ssize_t iwl_dbgfs_mem_write(struct file *file,if (ret <0 )return ret; +if (iwl_rx_packet_payload_len (hcmd.resp_pkt) <sizeof (*rsp)) { + ret = -EIO ; + goto out; + } + rsp = (void *)hcmd.resp_pkt->data;if (rsp->status !=DEBUG_MEM_STATUS_SUCCESS ) { ret = -ENXIO ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 451/694 netfilter: conntrack: restore IPS_CONFIRMED out of nf_conntrack_hash_check_insert()
In reply to Greg Kroah-HartmanFrom: Pablo Neira Ayuso <[email protected]>
[ Upstream commit 2cdaa3eefed83082923cf219c8b6a314e622da74 ]
e6d57e9ff0ae ("netfilter: conntrack: fix rmmod double-free race") consolidates IPS_CONFIRMED bit set in nf_conntrack_hash_check_insert(). However, this breaks ctnetlink:
# conntrack -I -p tcp --timeout 123 --src 1.2.3.4 --dst 5.6.7.8 --state ESTABLISHED --sport 1 --dport 4 -u SEEN_REPLY conntrack v1.4.6 (conntrack-tools): Operation failed: Device or resource busy
This is a partial revert of the aforementioned commit to restore IPS_CONFIRMED.
--- net/netfilter/nf_conntrack_bpf.c | 1 + net/netfilter/nf_conntrack_core.c | 1 - net/netfilter/nf_conntrack_netlink.c | 3 +++ 3 files changed, 4 insertions(+), 1 deletion(-)
net/netfilter/nf_conntrack_bpf.c +1 -0
@@ -381,6 +381,7 @@ __bpf_kfunc struct nf_conn *bpf_ct_insert_entry(struct nf_conn___init *nfct_i)struct nf_conn *nfct = (struct nf_conn *)nfct_i;int err; + nfct->status |=IPS_CONFIRMED ; err =nf_conntrack_hash_check_insert (nfct);if (err <0 ) {nf_conntrack_free (nfct);
net/netfilter/nf_conntrack_core.c +0 -1
@@ -932,7 +932,6 @@ nf_conntrack_hash_check_insert(struct nf_conn *ct) goto out; } - ct->status |=IPS_CONFIRMED ;smp_wmb ();/* The caller holds a reference to this object */ refcount_set (&ct->ct_general.use,2 );
net/netfilter/nf_conntrack_netlink.c +3 -0
@@ -2316,6 +2316,9 @@ ctnetlink_create_conntrack(struct net *net,nfct_seqadj_ext_add (ct);nfct_synproxy_ext_add (ct); +/* we must add conntrack extensions before confirmation. */ + ct->status |=IPS_CONFIRMED ; +if (cda[CTA_STATUS ]) { err =ctnetlink_change_status (ct, cda);if (err <0 )
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 452/694 wifi: mt76: mt7996: fill txd by host driver
In reply to Greg Kroah-HartmanFrom: Ryder Lee <[email protected]>
[ Upstream commit 3b522cadedfe6e9e0e8193d7d4ab5aa8d0c73209 ]
The hardware SDO has issue to fill txd for the moment, so fallback to driver filling method.
--- drivers/net/wireless/mediatek/mt76/mt7996/mac.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7996/mac.c +4 -9
@@ -1120,11 +1120,8 @@ int mt7996_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,return id; pid =mt76_tx_status_skb_add (mdev, wcid, tx_info->skb); -memset (txwi_ptr,0 ,MT_TXD_SIZE ); -/* Transmit non qos data by 802.11 header and need to fill txd by host*/ -if (!is_8023 || pid >=MT_PACKET_ID_FIRST ) -mt7996_mac_write_txwi (dev, txwi_ptr, tx_info->skb, wcid, key, - pid, qid,0 ); +mt7996_mac_write_txwi (dev, txwi_ptr, tx_info->skb, wcid, key, + pid, qid,0 ); txp = (struct mt76_connac_txp_common *)(txwi +MT_TXD_SIZE );for (i =0 ; i < nbuf; i++) {
@@ -1133,10 +1130,8 @@ int mt7996_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr, } txp->fw.nbuf = nbuf; - txp->fw.flags =cpu_to_le16 (MT_CT_INFO_FROM_HOST ); - -if (!is_8023 || pid >=MT_PACKET_ID_FIRST ) - txp->fw.flags |=cpu_to_le16 (MT_CT_INFO_APPLY_TXD ); + txp->fw.flags = +cpu_to_le16 (MT_CT_INFO_FROM_HOST |MT_CT_INFO_APPLY_TXD );if (!key) txp->fw.flags |=cpu_to_le16 (MT_CT_INFO_NONE_CIPHER_FRAME );
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 453/694 netfilter: conntrack: fix wrong ct->timeout value
In reply to Greg Kroah-HartmanFrom: Tzung-Bi Shih <[email protected]>
[ Upstream commit 73db1b8f2bb6725b7391e85aab41fdf592b3c0c1 ]
(struct nf_conn)->timeout is an interval before the conntrack confirmed. After confirmed, it becomes a timestamp.
It is observed that timeout of an unconfirmed conntrack:
- Set by calling ctnetlink_change_timeout(). As a result, nfct_time_stamp was wrongly added to ct->timeout twice.
- Get by calling ctnetlink_dump_timeout(). As a result, nfct_time_stamp was wrongly subtracted.
Call Trace: <TASK> dump_stack_lvl ctnetlink_dump_timeout __ctnetlink_glue_build ctnetlink_glue_build __nfqnl_enqueue_packet nf_queue nf_hook_slow ip_mc_output ? __pfx_ip_finish_output ip_send_skb ? __pfx_dst_output udp_send_skb udp_sendmsg ? __pfx_ip_generic_getfrag sock_sendmsg
Separate the 2 cases in:
- Setting ct->timeout in __nf_ct_set_timeout().
- Getting ct->timeout in ctnetlink_dump_timeout().
Pablo appends:
Update ctnetlink to set up the timeout _after_ the IPS_CONFIRMED flag is set on, otherwise conntrack creation via ctnetlink breaks.
Note that the problem described in this patch occurs since the introduction of the nfnetlink_queue conntrack support, select a sufficiently old Fixes: tag for -stable kernel to pick up this fix.
--- include/net/netfilter/nf_conntrack_core.h | 6 +++++- net/netfilter/nf_conntrack_netlink.c | 13 +++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-)
include/net/netfilter/nf_conntrack_core.h +5 -1
@@ -89,7 +89,11 @@ static inline void __nf_ct_set_timeout(struct nf_conn *ct, u64 timeout) {if (timeout >INT_MAX ) timeout =INT_MAX ; -WRITE_ONCE (ct->timeout, nfct_time_stamp + (u32 )timeout); + +if (nf_ct_is_confirmed (ct)) +WRITE_ONCE (ct->timeout, nfct_time_stamp + (u32 )timeout); +else + ct->timeout = (u32 )timeout; }int __nf_ct_change_timeout (struct nf_conn *ct,u64 cta_timeout);
net/netfilter/nf_conntrack_netlink.c +9 -4
@@ -176,7 +176,12 @@ static int ctnetlink_dump_status(struct sk_buff *skb, const struct nf_conn *ct)static int ctnetlink_dump_timeout (struct sk_buff *skb,const struct nf_conn *ct,bool skip_zero) { -long timeout =nf_ct_expires (ct) /HZ ; +long timeout; + +if (nf_ct_is_confirmed (ct)) + timeout =nf_ct_expires (ct) /HZ ; +else + timeout = ct->timeout /HZ ;if (skip_zero && timeout ==0 )return 0 ;
@@ -2253,9 +2258,6 @@ ctnetlink_create_conntrack(struct net *net,if (!cda[CTA_TIMEOUT ]) goto err1; - timeout = (u64 )ntohl (nla_get_be32 (cda[CTA_TIMEOUT ])) *HZ ; -__nf_ct_set_timeout (ct, timeout); -rcu_read_lock ();if (cda[CTA_HELP ]) {char *helpname =NULL ;
@@ -2319,6 +2321,9 @@ ctnetlink_create_conntrack(struct net *net,/* we must add conntrack extensions before confirmation. */ ct->status |=IPS_CONFIRMED ; + timeout = (u64 )ntohl (nla_get_be32 (cda[CTA_TIMEOUT ])) *HZ ; +__nf_ct_set_timeout (ct, timeout); +if (cda[CTA_STATUS ]) { err =ctnetlink_change_status (ct, cda);if (err <0 )
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 454/694 wifi: iwlwifi: fw: fix memory leak in debugfs
In reply to Greg Kroah-HartmanFrom: Johannes Berg <[email protected]>
[ Upstream commit 3d90d2f4a018fe8cfd65068bc6350b6222be4852 ]
Fix a memory leak that occurs when reading the fw_info file all the way, since we return NULL indicating no more data, but don't free the status tracking object.
--- drivers/net/wireless/intel/iwlwifi/fw/debugfs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/fw/debugfs.c +3 -1
@@ -317,8 +317,10 @@ static void *iwl_dbgfs_fw_info_seq_next(struct seq_file *seq,const struct iwl_fw *fw = priv->fwrt->fw; *pos = ++state->pos; -if (*pos >= fw->ucode_capa.n_cmd_versions) +if (*pos >= fw->ucode_capa.n_cmd_versions) { +kfree (state);return NULL ; + }return state; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 455/694 wifi: iwlwifi: mvm: support wowlan info notification version 2
In reply to Greg Kroah-HartmanFrom: Haim Dreyfuss <[email protected]>
[ Upstream commit 905d50ddbc83bef0d7f3386e7f3472b0324b405b ]
As part of version 2 we don't need to have wake_packet_bufsize and wake_packet_length. The first one is already calculated by the driver, the latter is sent as part of the wake packet notification.
Stable-dep-of: 457d7fb03e6c ("wifi: iwlwifi: mvm: fix potential memory leak")
--- .../net/wireless/intel/iwlwifi/fw/api/d3.h | 37 ++++++++++++++++++- drivers/net/wireless/intel/iwlwifi/mvm/d3.c | 35 +++++++++++++++++- 2 files changed, 69 insertions(+), 3 deletions(-)
drivers/net/wireless/intel/iwlwifi/fw/api/d3.h +35 -2
@@ -767,7 +767,7 @@ struct iwl_wowlan_status_v12 { } __packed;/* WOWLAN_STATUSES_RSP_API_S_VER_12 */ /** -* struct iwl_wowlan_info_notif - WoWLAN information notification +* struct iwl_wowlan_info_notif_v1 - WoWLAN information notification * @gtk: GTK data * @igtk: IGTK data * @replay_ctr: GTK rekey replay counter
@@ -785,7 +785,7 @@ struct iwl_wowlan_status_v12 {* @station_id: station id * @reserved2: reserved */ -struct iwl_wowlan_info_notif { +struct iwl_wowlan_info_notif_v1 {struct iwl_wowlan_gtk_status_v3 gtk[WOWLAN_GTK_KEYS_NUM ];struct iwl_wowlan_igtk_status igtk[WOWLAN_IGTK_KEYS_NUM ];__le64 replay_ctr;
@@ -803,6 +803,39 @@ struct iwl_wowlan_info_notif {u8 reserved2[2 ]; } __packed;/* WOWLAN_INFO_NTFY_API_S_VER_1 */ +/** +* struct iwl_wowlan_info_notif - WoWLAN information notification +* @gtk: GTK data +* @igtk: IGTK data +* @replay_ctr: GTK rekey replay counter +* @pattern_number: number of the matched patterns +* @reserved1: reserved +* @qos_seq_ctr: QoS sequence counters to use next +* @wakeup_reasons: wakeup reasons, see &enum iwl_wowlan_wakeup_reason +* @num_of_gtk_rekeys: number of GTK rekeys +* @transmitted_ndps: number of transmitted neighbor discovery packets +* @received_beacons: number of received beacons +* @tid_tear_down: bit mask of tids whose BA sessions were closed +* in suspend state +* @station_id: station id +* @reserved2: reserved +*/ +struct iwl_wowlan_info_notif { +struct iwl_wowlan_gtk_status_v3 gtk[WOWLAN_GTK_KEYS_NUM ]; +struct iwl_wowlan_igtk_status igtk[WOWLAN_IGTK_KEYS_NUM ]; +__le64 replay_ctr; +__le16 pattern_number; +__le16 reserved1; +__le16 qos_seq_ctr[8 ]; +__le32 wakeup_reasons; +__le32 num_of_gtk_rekeys; +__le32 transmitted_ndps; +__le32 received_beacons; +u8 tid_tear_down; +u8 station_id; +u8 reserved2[2 ]; +} __packed;/* WOWLAN_INFO_NTFY_API_S_VER_2 */ +/** * struct iwl_wowlan_wake_pkt_notif - WoWLAN wake packet notification * @wake_packet_length: wakeup packet length
drivers/net/wireless/intel/iwlwifi/mvm/d3.c +34 -1
@@ -2016,6 +2016,12 @@ static void iwl_mvm_parse_wowlan_info_notif(struct iwl_mvm *mvm, {u32 i; +if (!data) { +IWL_ERR (mvm,"iwl_wowlan_info_notif data is NULL\n" ); + status =NULL ; +return ; + } +if (len <sizeof (*data)) {IWL_ERR (mvm,"Invalid WoWLAN info notification!\n" ); status =NULL ;
@@ -2703,10 +2709,33 @@ static bool iwl_mvm_wait_d3_notif(struct iwl_notif_wait_data *notif_wait,struct iwl_d3_data *d3_data = data;u32 len;int ret; +int wowlan_info_ver =iwl_fw_lookup_notif_ver (mvm->fw, +PROT_OFFLOAD_GROUP , +WOWLAN_INFO_NOTIFICATION , +IWL_FW_CMD_VER_UNKNOWN ); +switch (WIDE_ID (pkt->hdr.group_id, pkt->hdr.cmd)) {case WIDE_ID (PROT_OFFLOAD_GROUP ,WOWLAN_INFO_NOTIFICATION ): { -struct iwl_wowlan_info_notif *notif = (void *)pkt->data; +struct iwl_wowlan_info_notif *notif; + +if (wowlan_info_ver <2 ) { +struct iwl_wowlan_info_notif_v1 *notif_v1 = (void *)pkt->data; + + notif =kmemdup (notif_v1, + offsetofend(struct iwl_wowlan_info_notif, + received_beacons), +GFP_ATOMIC ); + +if (!notif) +return false; + + notif->tid_tear_down = notif_v1->tid_tear_down; + notif->station_id = notif_v1->station_id; + + }else { + notif = (void *)pkt->data; + }if (d3_data->notif_received &IWL_D3_NOTIF_WOWLAN_INFO ) {/* We might get two notifications due to dual bss */
@@ -2719,6 +2748,10 @@ static bool iwl_mvm_wait_d3_notif(struct iwl_notif_wait_data *notif_wait, len =iwl_rx_packet_payload_len (pkt);iwl_mvm_parse_wowlan_info_notif (mvm, notif, d3_data->status, len); + +if (wowlan_info_ver <2 ) +kfree (notif); +if (d3_data->status && d3_data->status->wakeup_reasons &IWL_WOWLAN_WAKEUP_REASON_HAS_WAKEUP_PKT )/* We are supposed to get also wake packet notif */
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 456/694 wifi: iwlwifi: mvm: fix potential memory leak
In reply to Greg Kroah-HartmanFrom: Johannes Berg <[email protected]>
[ Upstream commit 457d7fb03e6c3d73fbb509bd85fc4b02d1ab405e ]
If we do get multiple notifications from firmware, then we might have allocated 'notif', but don't free it. Fix that by checking for duplicates before allocation.
--- drivers/net/wireless/intel/iwlwifi/mvm/d3.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/d3.c +7 -7
@@ -2719,6 +2719,13 @@ static bool iwl_mvm_wait_d3_notif(struct iwl_notif_wait_data *notif_wait,case WIDE_ID (PROT_OFFLOAD_GROUP ,WOWLAN_INFO_NOTIFICATION ): {struct iwl_wowlan_info_notif *notif; +if (d3_data->notif_received &IWL_D3_NOTIF_WOWLAN_INFO ) { +/* We might get two notifications due to dual bss */ +IWL_DEBUG_WOWLAN (mvm, +"Got additional wowlan info notification\n" ); +break ; + } +if (wowlan_info_ver <2 ) {struct iwl_wowlan_info_notif_v1 *notif_v1 = (void *)pkt->data;
@@ -2737,13 +2744,6 @@ static bool iwl_mvm_wait_d3_notif(struct iwl_notif_wait_data *notif_wait, notif = (void *)pkt->data; } -if (d3_data->notif_received &IWL_D3_NOTIF_WOWLAN_INFO ) { -/* We might get two notifications due to dual bss */ -IWL_DEBUG_WOWLAN (mvm, -"Got additional wowlan info notification\n" ); -break ; - } - d3_data->notif_received |=IWL_D3_NOTIF_WOWLAN_INFO ; len =iwl_rx_packet_payload_len (pkt); iwl_mvm_parse_wowlan_info_notif(mvm, notif, d3_data->status,
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 457/694 net: libwx: fix memory leak in wx_setup_rx_resources
In reply to Greg Kroah-HartmanFrom: Zhengchao Shao <[email protected]>
[ Upstream commit e315e7b83a22043bffee450437d7089ef373cbf6 ]
When wx_alloc_page_pool() failed in wx_setup_rx_resources(), it doesn't release DMA buffer. Add dma_free_coherent() in the error path to release the DMA buffer.
--- drivers/net/ethernet/wangxun/libwx/wx_lib.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/wangxun/libwx/wx_lib.c +4 -1
@@ -1798,10 +1798,13 @@ static int wx_setup_rx_resources(struct wx_ring *rx_ring) ret =wx_alloc_page_pool (rx_ring);if (ret <0 ) {dev_err (rx_ring->dev,"Page pool creation failed: %d\n" , ret); - goto err; + goto err_desc; }return 0 ; + +err_desc: +dma_free_coherent (dev, rx_ring->size, rx_ring->desc, rx_ring->dma); err:kvfree (rx_ring->rx_buffer_info); rx_ring->rx_buffer_info =NULL ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 458/694 ixgbe: Allow flow hash to be set via ethtool
In reply to Greg Kroah-HartmanFrom: Joe Damato <[email protected]>
[ Upstream commit 4f3ed1293feb9502dc254b05802faf1ad3317ac6 ]
ixgbe currently returns EINVAL whenever the flowhash it set by ethtool because the ethtool code in the kernel passes a non-zero value for hfunc that ixgbe should allow.
When ethtool is called with ETHTOOL_SRXFHINDIR, ethtool_set_rxfh_indir will call ixgbe's set_rxfh function with ETH_RSS_HASH_NO_CHANGE. This value should be accepted.
When ethtool is called with ETHTOOL_SRSSH, ethtool_set_rxfh will call ixgbe's set_rxfh function with rxfh.hfunc, which appears to be hardcoded in ixgbe to always be ETH_RSS_HASH_TOP. This value should also be accepted.
Before this patch:
$ sudo ethtool -L eth1 combined 10 $ sudo ethtool -X eth1 default Cannot set RX flow hash configuration: Invalid argument
After this patch:
$ sudo ethtool -L eth1 combined 10
$ sudo ethtool -X eth1 default
$ sudo ethtool -x eth1
RX flow hash indirection table for eth1 with 10 RX ring(s):
0: 0 1 2 3 4 5 6 7
8: 8 9 0 1 2 3 4 5
16: 6 7 8 9 0 1 2 3
24: 4 5 6 7 8 9 0 1
...--- drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c +2 -2
@@ -3131,8 +3131,8 @@ static int ixgbe_set_rxfh(struct net_device *netdev, const u32 *indir,int i;u32 reta_entries =ixgbe_rss_indir_tbl_entries (adapter); -if (hfunc) -return -EINVAL ; +if (hfunc !=ETH_RSS_HASH_NO_CHANGE && hfunc !=ETH_RSS_HASH_TOP ) +return -EOPNOTSUPP ;/* Fill out the redirection table */ if (indir) {
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 459/694 ixgbe: Enable setting RSS table to default values
In reply to Greg Kroah-HartmanFrom: Joe Damato <[email protected]>
[ Upstream commit e85d3d55875f7a1079edfbc4e4e98d6f8aea9ac7 ]
ethtool uses ETHTOOL_GRXRINGS to compute how many queues are supported by RSS. The driver should return the smaller of either:
- The maximum number of RSS queues the device supports, OR
- The number of RX queues configured
Prior to this change, running ethtool -X $iface default fails if the number of queues configured is larger than the number supported by RSS, even though changing the queue count correctly resets the flowhash to use all supported queues.
Other drivers (for example, i40e) will succeed but the flow hash will reset to support the maximum number of queues supported by RSS, even if that amount is smaller than the configured amount.
Prior to this change:
$ sudo ethtool -L eth1 combined 20
$ sudo ethtool -x eth1
RX flow hash indirection table for eth1 with 20 RX ring(s):
0: 0 1 2 3 4 5 6 7
8: 8 9 10 11 12 13 14 15
16: 0 1 2 3 4 5 6 7
24: 8 9 10 11 12 13 14 15
32: 0 1 2 3 4 5 6 7
...You can see that the flowhash was correctly set to use the maximum number of queues supported by the driver (16).
However, asking the NIC to reset to "default" fails:
$ sudo ethtool -X eth1 default Cannot set RX flow hash configuration: Invalid argument
After this change, the flowhash can be reset to default which will use all of the available RSS queues (16) or the configured queue count, whichever is smaller.
Starting with eth1 which has 10 queues and a flowhash distributing to all 10 queues:
$ sudo ethtool -x eth1
RX flow hash indirection table for eth1 with 10 RX ring(s):
0: 0 1 2 3 4 5 6 7
8: 8 9 0 1 2 3 4 5
16: 6 7 8 9 0 1 2 3
...Increasing the queue count to 48 resets the flowhash to distribute to 16 queues, as it did before this patch:
$ sudo ethtool -L eth1 combined 48
$ sudo ethtool -x eth1
RX flow hash indirection table for eth1 with 16 RX ring(s):
0: 0 1 2 3 4 5 6 7
8: 8 9 10 11 12 13 14 15
16: 0 1 2 3 4 5 6 7
...Due to the other bugfix in this series, the flowhash can be set to use queues 0-5:
$ sudo ethtool -X eth1 equal 5
$ sudo ethtool -x eth1
RX flow hash indirection table for eth1 with 16 RX ring(s):
0: 0 1 2 3 4 0 1 2
8: 3 4 0 1 2 3 4 0
16: 1 2 3 4 0 1 2 3
...Due to this bugfix, the flowhash can be reset to default and use 16 queues:
$ sudo ethtool -X eth1 default
$ sudo ethtool -x eth1
RX flow hash indirection table for eth1 with 16 RX ring(s):
0: 0 1 2 3 4 5 6 7
8: 8 9 10 11 12 13 14 15
16: 0 1 2 3 4 5 6 7
...--- .../net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c +10 -9
@@ -2665,6 +2665,14 @@ static int ixgbe_get_rss_hash_opts(struct ixgbe_adapter *adapter,return 0 ; } +static int ixgbe_rss_indir_tbl_max (struct ixgbe_adapter *adapter) +{ +if (adapter->hw.mac.type < ixgbe_mac_X550) +return 16 ; +else +return 64 ; +} +static int ixgbe_get_rxnfc (struct net_device *dev,struct ethtool_rxnfc *cmd,u32 *rule_locs) {
@@ -2673,7 +2681,8 @@ static int ixgbe_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd,switch (cmd->cmd) {case ETHTOOL_GRXRINGS : - cmd->data = adapter->num_rx_queues; + cmd->data =min_t (int, adapter->num_rx_queues, +ixgbe_rss_indir_tbl_max (adapter)); ret =0 ;break ;case ETHTOOL_GRXCLSRLCNT :
@@ -3075,14 +3084,6 @@ static int ixgbe_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd)return ret; } -static int ixgbe_rss_indir_tbl_max (struct ixgbe_adapter *adapter) -{ -if (adapter->hw.mac.type < ixgbe_mac_X550) -return 16 ; -else -return 64 ; -} -static u32 ixgbe_get_rxfh_key_size (struct net_device *netdev) {return IXGBE_RSS_KEY_SIZE ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 460/694 net/mlx5e: Dont clone flow post action attributes second time
In reply to Greg Kroah-HartmanFrom: Vlad Buslov <[email protected]>
[ Upstream commit e9fce818fe003b6c527f25517b9ac08eb4661b5d ]
The code already clones post action attributes in mlx5e_clone_flow_attr_for_post_act(). Creating another copy in mlx5e_tc_post_act_add() is a erroneous leftover from original implementation. Instead, assign handle->attribute to post_attr provided by the caller. Note that cloning the attribute second time is not just wasteful but also causes issues like second copy not being properly updated in neigh update code which leads to following use-after-free:
Feb 21 09:02:00 c-237-177-40-045 kernel: BUG: KASAN: use-after-free in mlx5_cmd_set_fte+0x200d/0x24c0 [mlx5_core] Feb 21 09:02:00 c-237-177-40-045 kernel: kasan_report+0xbb/0x1a0 Feb 21 09:02:00 c-237-177-40-045 kernel: kasan_save_stack+0x1e/0x40 Feb 21 09:02:00 c-237-177-40-045 kernel: kasan_set_track+0x21/0x30 Feb 21 09:02:00 c-237-177-40-045 kernel: __kasan_kmalloc+0x7a/0x90 Feb 21 09:02:00 c-237-177-40-045 kernel: kasan_save_stack+0x1e/0x40 Feb 21 09:02:00 c-237-177-40-045 kernel: kasan_set_track+0x21/0x30 Feb 21 09:02:00 c-237-177-40-045 kernel: kasan_save_free_info+0x2a/0x40 Feb 21 09:02:00 c-237-177-40-045 kernel: ____kasan_slab_free+0x11a/0x1b0 Feb 21 09:02:00 c-237-177-40-045 kernel: page dumped because: kasan: bad access detected Feb 21 09:02:00 c-237-177-40-045 kernel: mlx5_core 0000:08:00.0: mlx5_cmd_out_err:803:(pid 8833): SET_FLOW_TABLE_ENTRY(0x936) op_mod(0x0) failed, status bad resource state(0x9), syndrome (0xf2ff71), err(-22) Feb 21 09:02:00 c-237-177-40-045 kernel: mlx5_core 0000:08:00.0 enp8s0f0: Failed to add post action rule Feb 21 09:02:00 c-237-177-40-045 kernel: mlx5_core 0000:08:00.0: mlx5e_tc_encap_flows_add:190:(pid 8833): Failed to update flow post acts, -22 Feb 21 09:02:00 c-237-177-40-045 kernel: Call Trace: Feb 21 09:02:00 c-237-177-40-045 kernel: <TASK> Feb 21 09:02:00 c-237-177-40-045 kernel: dump_stack_lvl+0x57/0x7d Feb 21 09:02:00 c-237-177-40-045 kernel: print_report+0x170/0x471 Feb 21 09:02:00 c-237-177-40-045 kernel: ? mlx5_cmd_set_fte+0x200d/0x24c0 [mlx5_core] Feb 21 09:02:00 c-237-177-40-045 kernel: kasan_report+0xbb/0x1a0 Feb 21 09:02:00 c-237-177-40-045 kernel: ? mlx5_cmd_set_fte+0x200d/0x24c0 [mlx5_core] Feb 21 09:02:00 c-237-177-40-045 kernel: mlx5_cmd_set_fte+0x200d/0x24c0 [mlx5_core] Feb 21 09:02:00 c-237-177-40-045 kernel: ? __module_address.part.0+0x62/0x200 Feb 21 09:02:00 c-237-177-40-045 kernel: ? mlx5_cmd_stub_create_flow_table+0xd0/0xd0 [mlx5_core] Feb 21 09:02:00 c-237-177-40-045 kernel: ? __raw_spin_lock_init+0x3b/0x110 Feb 21 09:02:00 c-237-177-40-045 kernel: mlx5_cmd_create_fte+0x80/0xb0 [mlx5_core] Feb 21 09:02:00 c-237-177-40-045 kernel: add_rule_fg+0xe80/0x19c0 [mlx5_core] -- Feb 21 09:02:00 c-237-177-40-045 kernel: Allocated by task 13476: Feb 21 09:02:00 c-237-177-40-045 kernel: kasan_save_stack+0x1e/0x40 Feb 21 09:02:00 c-237-177-40-045 kernel: kasan_set_track+0x21/0x30 Feb 21 09:02:00 c-237-177-40-045 kernel: __kasan_kmalloc+0x7a/0x90 Feb 21 09:02:00 c-237-177-40-045 kernel: mlx5_packet_reformat_alloc+0x7b/0x230 [mlx5_core] Feb 21 09:02:00 c-237-177-40-045 kernel: mlx5e_tc_tun_create_header_ipv4+0x977/0xf10 [mlx5_core] Feb 21 09:02:00 c-237-177-40-045 kernel: mlx5e_attach_encap+0x15b4/0x1e10 [mlx5_core] Feb 21 09:02:00 c-237-177-40-045 kernel: post_process_attr+0x305/0xa30 [mlx5_core] Feb 21 09:02:00 c-237-177-40-045 kernel: mlx5e_tc_add_fdb_flow+0x4c0/0xcf0 [mlx5_core] Feb 21 09:02:00 c-237-177-40-045 kernel: __mlx5e_add_fdb_flow+0x7cf/0xe90 [mlx5_core] Feb 21 09:02:00 c-237-177-40-045 kernel: mlx5e_configure_flower+0xcaa/0x4b90 [mlx5_core] Feb 21 09:02:00 c-237-177-40-045 kernel: mlx5e_rep_setup_tc_cls_flower+0x99/0x1b0 [mlx5_core] Feb 21 09:02:00 c-237-177-40-045 kernel: mlx5e_rep_setup_tc_cb+0x133/0x1e0 [mlx5_core] -- Feb 21 09:02:00 c-237-177-40-045 kernel: Freed by task 8833: Feb 21 09:02:00 c-237-177-40-045 kernel: kasan_save_stack+0x1e/0x40 Feb 21 09:02:00 c-237-177-40-045 kernel: kasan_set_track+0x21/0x30 Feb 21 09:02:00 c-237-177-40-045 kernel: kasan_save_free_info+0x2a/0x40 Feb 21 09:02:00 c-237-177-40-045 kernel: ____kasan_slab_free+0x11a/0x1b0 Feb 21 09:02:00 c-237-177-40-045 kernel: __kmem_cache_free+0x1de/0x400 Feb 21 09:02:00 c-237-177-40-045 kernel: mlx5_packet_reformat_dealloc+0xad/0x100 [mlx5_core] Feb 21 09:02:00 c-237-177-40-045 kernel: mlx5e_tc_encap_flows_del+0x3c0/0x500 [mlx5_core] Feb 21 09:02:00 c-237-177-40-045 kernel: mlx5e_rep_update_flows+0x40c/0xa80 [mlx5_core] Feb 21 09:02:00 c-237-177-40-045 kernel: mlx5e_rep_neigh_update+0x473/0x7a0 [mlx5_core] Feb 21 09:02:00 c-237-177-40-045 kernel: process_one_work+0x7c2/0x1310 Feb 21 09:02:00 c-237-177-40-045 kernel: worker_thread+0x59d/0xec0 Feb 21 09:02:00 c-237-177-40-045 kernel: kthread+0x28f/0x330
--- .../net/ethernet/mellanox/mlx5/core/en/tc/post_act.c | 11 ++--------- .../net/ethernet/mellanox/mlx5/core/en/tc/post_act.h | 2 +- 2 files changed, 3 insertions(+), 10 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en/tc/post_act.c +2 -9
@@ -106,22 +106,17 @@ mlx5e_tc_post_act_offload(struct mlx5e_post_act *post_act, }struct mlx5e_post_act_handle * -mlx5e_tc_post_act_add (struct mlx5e_post_act *post_act,struct mlx5_flow_attr *attr) +mlx5e_tc_post_act_add (struct mlx5e_post_act *post_act,struct mlx5_flow_attr *post_attr) { -u32 attr_sz =ns_to_attr_sz (post_act->ns_type);struct mlx5e_post_act_handle *handle; -struct mlx5_flow_attr *post_attr;int err; handle =kzalloc (sizeof (*handle),GFP_KERNEL ); - post_attr =mlx5_alloc_flow_attr (post_act->ns_type); -if (!handle || !post_attr) { -kfree (post_attr); +if (!handle) {kfree (handle);return ERR_PTR (-ENOMEM ); } -memcpy (post_attr, attr, attr_sz); post_attr->chain =0 ; post_attr->prio =0 ; post_attr->ft = post_act->ft;
@@ -145,7 +140,6 @@ mlx5e_tc_post_act_add(struct mlx5e_post_act *post_act, struct mlx5_flow_attr *atreturn handle; err_xarray: -kfree (post_attr);kfree (handle);return ERR_PTR (err); }
@@ -164,7 +158,6 @@ mlx5e_tc_post_act_del(struct mlx5e_post_act *post_act, struct mlx5e_post_act_hanif (!IS_ERR_OR_NULL (handle->rule))mlx5e_tc_post_act_unoffload (post_act, handle);xa_erase (&post_act->ids, handle->id); -kfree (handle->attr);kfree (handle); }
drivers/net/ethernet/mellanox/mlx5/core/en/tc/post_act.h +1 -1
@@ -19,7 +19,7 @@ void mlx5e_tc_post_act_destroy(struct mlx5e_post_act *post_act);struct mlx5e_post_act_handle * -mlx5e_tc_post_act_add (struct mlx5e_post_act *post_act,struct mlx5_flow_attr *attr); +mlx5e_tc_post_act_add (struct mlx5e_post_act *post_act,struct mlx5_flow_attr *post_attr);void mlx5e_tc_post_act_del (struct mlx5e_post_act *post_act,struct mlx5e_post_act_handle *handle);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 461/694 net/mlx5e: Release the label when replacing existing ct entry
In reply to Greg Kroah-HartmanFrom: Vlad Buslov <[email protected]>
[ Upstream commit 8ac04a28144cfa89b61be518268233742c23d88d ]
Cited commit doesn't release the label mapping when replacing existing ct entry which leads to following memleak report:
unreferenced object 0xffff8881854cf280 (size 96):
comm "kworker/u48:74", pid 23093, jiffies 4296664564 (age 175.944s) hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<000000002722d368>] __kmalloc+0x4b/0x1c0
[<00000000cc44e18f>] mapping_add+0x6e8/0xc90 [mlx5_core]
[<000000003ad942a7>] mlx5_get_label_mapping+0x66/0xe0 [mlx5_core]
[<00000000266308ac>] mlx5_tc_ct_entry_create_mod_hdr+0x1c4/0xf50 [mlx5_core]
[<000000009a768b4f>] mlx5_tc_ct_entry_add_rule+0x16f/0xaf0 [mlx5_core]
[<00000000a178f3e5>] mlx5_tc_ct_block_flow_offload_add+0x10cb/0x1f90 [mlx5_core]
[<000000007b46c496>] mlx5_tc_ct_block_flow_offload+0x14a/0x630 [mlx5_core]
[<00000000a9a18ac5>] nf_flow_offload_tuple+0x1a3/0x390 [nf_flow_table]
[<00000000d0881951>] flow_offload_work_handler+0x257/0xd30 [nf_flow_table]
[<000000009e4935a4>] process_one_work+0x7c2/0x13e0
[<00000000f5cd36a7>] worker_thread+0x59d/0xec0
[<00000000baed1daf>] kthread+0x28f/0x330
[<0000000063d282a4>] ret_from_fork+0x1f/0x30Fix the issue by correctly releasing the label mapping.
--- drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c +1 -0
@@ -920,6 +920,7 @@ mlx5_tc_ct_entry_replace_rule(struct mlx5_tc_ct_priv *ct_priv, zone_rule->rule = rule;mlx5_tc_ct_entry_destroy_mod_hdr (ct_priv, old_attr, zone_rule->mh); zone_rule->mh = mh; +mlx5_put_label_mapping (ct_priv, old_attr->ct_attr.ct_labels_id);kfree (old_attr);kvfree (spec);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 462/694 net/mlx5: E-switch, Create per vport table based on devlink encap mode
In reply to Greg Kroah-HartmanFrom: Chris Mi <[email protected]>
[ Upstream commit fd745f4c0abe41ebb09d11bf622b054a0f3e7b49 ]
Currently when creating per vport table, create flags are hardcoded. Devlink encap mode is set based on user input and HW capability. Create per vport table based on devlink encap mode.
--- .../net/ethernet/mellanox/mlx5/core/en/tc/sample.c | 4 ++-- .../net/ethernet/mellanox/mlx5/core/esw/vporttbl.c | 12 +++++++++++- drivers/net/ethernet/mellanox/mlx5/core/eswitch.h | 2 +- .../ethernet/mellanox/mlx5/core/eswitch_offloads.c | 2 +- 4 files changed, 15 insertions(+), 5 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en/tc/sample.c +2 -2
@@ -14,10 +14,10 @@#define MLX5_ESW_VPORT_TBL_SIZE_SAMPLE (64 * 1024) -static const struct esw_vport_tbl_namespace mlx5_esw_vport_tbl_sample_ns = { +static struct esw_vport_tbl_namespace mlx5_esw_vport_tbl_sample_ns = { .max_fte =MLX5_ESW_VPORT_TBL_SIZE_SAMPLE , .max_num_groups =0 ,/* default num of groups */ - .flags =MLX5_FLOW_TABLE_TUNNEL_EN_REFORMAT |MLX5_FLOW_TABLE_TUNNEL_EN_DECAP , + .flags =0 , };struct mlx5e_tc_psample {
drivers/net/ethernet/mellanox/mlx5/core/esw/vporttbl.c +11 -1
@@ -11,7 +11,7 @@ struct mlx5_vport_key {u16 prio;u16 vport;u16 vhca_id; -const struct esw_vport_tbl_namespace *vport_ns; +struct esw_vport_tbl_namespace *vport_ns; } __packed;struct mlx5_vport_table {
@@ -21,6 +21,14 @@ struct mlx5_vport_table {struct mlx5_vport_key key; }; +static void +esw_vport_tbl_init (struct mlx5_eswitch *esw,struct esw_vport_tbl_namespace *ns) +{ +if (esw->offloads.encap !=DEVLINK_ESWITCH_ENCAP_MODE_NONE ) + ns->flags |= (MLX5_FLOW_TABLE_TUNNEL_EN_REFORMAT | +MLX5_FLOW_TABLE_TUNNEL_EN_DECAP ); +} +static struct mlx5_flow_table *esw_vport_tbl_create (struct mlx5_eswitch *esw,struct mlx5_flow_namespace *ns,const struct esw_vport_tbl_namespace *vport_ns)
@@ -80,6 +88,7 @@ mlx5_esw_vporttbl_get(struct mlx5_eswitch *esw, struct mlx5_vport_tbl_attr *attru32 hkey;mutex_lock (&esw->fdb_table.offloads.vports.lock); +esw_vport_tbl_init (esw, attr->vport_ns); hkey =flow_attr_to_vport_key (esw, attr, &skey); e =esw_vport_tbl_lookup (esw, &skey, hkey);if (e) {
@@ -127,6 +136,7 @@ mlx5_esw_vporttbl_put(struct mlx5_eswitch *esw, struct mlx5_vport_tbl_attr *attru32 hkey;mutex_lock (&esw->fdb_table.offloads.vports.lock); +esw_vport_tbl_init (esw, attr->vport_ns); hkey =flow_attr_to_vport_key (esw, attr, &key); e =esw_vport_tbl_lookup (esw, &key, hkey);if (!e || --e->num_rules)
drivers/net/ethernet/mellanox/mlx5/core/eswitch.h +1 -1
@@ -674,7 +674,7 @@ struct mlx5_vport_tbl_attr {u32 chain;u16 prio;u16 vport; -const struct esw_vport_tbl_namespace *vport_ns; +struct esw_vport_tbl_namespace *vport_ns; }; struct mlx5_flow_table *
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +1 -1
@@ -73,7 +73,7 @@#define MLX5_ESW_FT_OFFLOADS_DROP_RULE (1) -static const struct esw_vport_tbl_namespace mlx5_esw_vport_tbl_mirror_ns = { +static struct esw_vport_tbl_namespace mlx5_esw_vport_tbl_mirror_ns = { .max_fte =MLX5_ESW_VPORT_TBL_SIZE , .max_num_groups =MLX5_ESW_VPORT_TBL_NUM_GROUPS , .flags =0 ,
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 463/694 net/mlx5: E-switch, Dont destroy indirect table in split rule
In reply to Greg Kroah-HartmanFrom: Chris Mi <[email protected]>
[ Upstream commit 4c8189302567f75099a336b0efcff8291ec86ff4 ]
Source port rewrite (forward to ovs internal port or statck device) isn't supported in the rule of split action. So there is no indirect table in split rule. The cited commit destroyes indirect table in split rule. The indirect table for other rules will be destroyed wrongly. It will cause traffic loss.
Fix it by removing the destroy function in split rule. And also remove the destroy function in error flow.
--- drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c | 2 -- 1 file changed, 2 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +0 -2
@@ -760,7 +760,6 @@ mlx5_eswitch_add_fwd_rule(struct mlx5_eswitch *esw,kfree (dest);return rule; err_chain_src_rewrite: -esw_put_dest_tables_loop (esw, attr,0 , i);mlx5_esw_vporttbl_put (esw, &fwd_attr); err_get_fwd:mlx5_chains_put_table (chains, attr->chain, attr->prio,0 );
@@ -803,7 +802,6 @@ __mlx5_eswitch_del_rule(struct mlx5_eswitch *esw,if (fwd_rule) {mlx5_esw_vporttbl_put (esw, &fwd_attr);mlx5_chains_put_table (chains, attr->chain, attr->prio,0 ); -esw_put_dest_tables_loop (esw, attr,0 , esw_attr->split_count); }else {if (split)mlx5_esw_vporttbl_put (esw, &fwd_attr);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 464/694 net/mlx5: Release tunnel device after tc update skb
In reply to Greg Kroah-HartmanFrom: Chris Mi <[email protected]>
[ Upstream commit 4fbef0f8ea6350eaea89b1e3175f9325252913ac ]
The cited commit causes a regression. Tunnel device is not released after tc update skb if skb needs to be freed. The following error message will be printed:
unregister_netdevice: waiting for vxlan1 to become free. Usage count = 11
Fix it by releasing tunnel device if skb needs to be freed.
--- drivers/net/ethernet/mellanox/mlx5/core/en/rep/tc.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/mellanox/mlx5/core/en/rep/tc.c +1 -0
@@ -715,5 +715,6 @@ void mlx5e_rep_tc_receive(struct mlx5_cqe64 *cqe, struct mlx5e_rq *rq,return ; free_skb: +dev_put (tc_priv.fwd_dev);dev_kfree_skb_any (skb); }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 465/694 net/mlx5e: Fix error flow in representor failing to add vport rx rule
In reply to Greg Kroah-HartmanFrom: Roi Dayan <[email protected]>
[ Upstream commit 0a6b069cc60d68d33b4f6e7dd7f1adc3ec749766 ]
On representor init rx error flow the flow steering pointer is being released so mlx5e_attach_netdev() doesn't have a valid fs pointer in its error flow. Make sure the pointer is nullified when released and add a check in mlx5e_fs_cleanup() to verify fs is not null as representor cleanup callback would be called anyway.
--- drivers/net/ethernet/mellanox/mlx5/core/en_fs.c | 2 ++ drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 1 + drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | 2 ++ 3 files changed, 5 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/en_fs.c +2 -0
@@ -1490,6 +1490,8 @@ struct mlx5e_flow_steering *mlx5e_fs_init(const struct mlx5e_profile *profile,void mlx5e_fs_cleanup (struct mlx5e_flow_steering *fs) { +if (!fs) +return ;debugfs_remove_recursive (fs->dfs_root);mlx5e_fs_ethtool_free (fs);mlx5e_fs_tc_free (fs);
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +1 -0
@@ -5270,6 +5270,7 @@ static void mlx5e_nic_cleanup(struct mlx5e_priv *priv)mlx5e_health_destroy_reporters (priv);mlx5e_ktls_cleanup (priv);mlx5e_fs_cleanup (priv->fs); + priv->fs =NULL ; }static int mlx5e_init_nic_rx (struct mlx5e_priv *priv)
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c +2 -0
@@ -828,6 +828,7 @@ static int mlx5e_init_ul_rep(struct mlx5_core_dev *mdev,static void mlx5e_cleanup_rep (struct mlx5e_priv *priv) {mlx5e_fs_cleanup (priv->fs); + priv->fs =NULL ; }static int mlx5e_create_rep_ttc_table (struct mlx5e_priv *priv)
@@ -994,6 +995,7 @@ static int mlx5e_init_rep_rx(struct mlx5e_priv *priv) priv->rx_res =NULL ; err_free_fs:mlx5e_fs_cleanup (priv->fs); + priv->fs =NULL ;return err; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 466/694 Revert "net/mlx5: Remove "recovery" arg from mlx5_load_one() function"
In reply to Greg Kroah-HartmanFrom: Moshe Shemesh <[email protected]>
[ Upstream commit 21608a2cf38e9f743636b5f86507ffbca18ecee7 ]
This reverts commit 5977ac3910f1cbaf44dca48179118b25c206ac29.
Revert this patch as we need the "recovery" arg back in mlx5_load_one() function. This arg will be used in the next patch for using recovery timeout during sync reset flow.
Stable-dep-of: dfad99750c0f ("net/mlx5: Use recovery timeout on sync reset flow")
--- drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c | 2 +- drivers/net/ethernet/mellanox/mlx5/core/main.c | 9 +++++---- drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c +1 -1
@@ -167,7 +167,7 @@ static void mlx5_fw_reset_complete_reload(struct mlx5_core_dev *dev)if (mlx5_health_wait_pci_up (dev))mlx5_core_err (dev,"reset reload flow aborted, PCI reads still not working\n" );else -mlx5_load_one (dev); +mlx5_load_one (dev, false);devlink_remote_reload_actions_performed (priv_to_devlink (dev),0 ,BIT (DEVLINK_RELOAD_ACTION_DRIVER_REINIT ) |BIT (DEVLINK_RELOAD_ACTION_FW_ACTIVATE ));
drivers/net/ethernet/mellanox/mlx5/core/main.c +5 -4
@@ -1509,13 +1509,13 @@ int mlx5_load_one_devl_locked(struct mlx5_core_dev *dev, bool recovery)return err; } -int mlx5_load_one (struct mlx5_core_dev *dev) +int mlx5_load_one (struct mlx5_core_dev *dev,bool recovery) {struct devlink *devlink =priv_to_devlink (dev);int ret;devl_lock (devlink); - ret =mlx5_load_one_devl_locked (dev, false); + ret =mlx5_load_one_devl_locked (dev, recovery);devl_unlock (devlink);return ret; }
@@ -1912,7 +1912,8 @@ static void mlx5_pci_resume(struct pci_dev *pdev)mlx5_pci_trace (dev,"Enter, loading driver..\n" ); - err =mlx5_load_one (dev); + err =mlx5_load_one (dev, false); +if (!err)devlink_health_reporter_state_update (dev->priv.health.fw_fatal_reporter,DEVLINK_HEALTH_REPORTER_STATE_HEALTHY );
@@ -2003,7 +2004,7 @@ static int mlx5_resume(struct pci_dev *pdev) {struct mlx5_core_dev *dev =pci_get_drvdata (pdev); -return mlx5_load_one (dev); +return mlx5_load_one (dev, false); }static const struct pci_device_id mlx5_core_pci_table[] = {
drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h +1 -1
@@ -321,7 +321,7 @@ int mlx5_init_one(struct mlx5_core_dev *dev);void mlx5_uninit_one (struct mlx5_core_dev *dev);void mlx5_unload_one (struct mlx5_core_dev *dev,bool suspend);void mlx5_unload_one_devl_locked (struct mlx5_core_dev *dev,bool suspend); -int mlx5_load_one (struct mlx5_core_dev *dev); +int mlx5_load_one (struct mlx5_core_dev *dev,bool recovery);int mlx5_load_one_devl_locked (struct mlx5_core_dev *dev,bool recovery); int mlx5_vport_set_other_func_cap(struct mlx5_core_dev *dev, const void *hca_cap, u16 function_id,
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 467/694 net/mlx5: Use recovery timeout on sync reset flow
In reply to Greg Kroah-HartmanFrom: Moshe Shemesh <[email protected]>
[ Upstream commit dfad99750c0f83b0242572a573afa2c055f85b36 ]
Use the same timeout for sync reset flow and health recovery flow, since the former involves driver's recovery from firmware reset, which is similar to health recovery. Otherwise, in some cases, such as a firmware upgrade on the DPU, the firmware pre-init bit may not be ready within current timeout and the driver will abort loading back after reset.
--- drivers/net/ethernet/mellanox/mlx5/core/devlink.c | 2 +- drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/devlink.c +1 -1
@@ -202,7 +202,7 @@ static int mlx5_devlink_reload_up(struct devlink *devlink, enum devlink_reload_abreak ;/* On fw_activate action, also driver is reloaded and reinit performed */ *actions_performed |=BIT (DEVLINK_RELOAD_ACTION_DRIVER_REINIT ); - ret =mlx5_load_one_devl_locked (dev, false); + ret =mlx5_load_one_devl_locked (dev, true);break ;default :/* Unsupported action should not get to this function */
drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c +2 -2
@@ -167,7 +167,7 @@ static void mlx5_fw_reset_complete_reload(struct mlx5_core_dev *dev)if (mlx5_health_wait_pci_up (dev))mlx5_core_err (dev,"reset reload flow aborted, PCI reads still not working\n" );else -mlx5_load_one (dev, false); +mlx5_load_one (dev, true);devlink_remote_reload_actions_performed (priv_to_devlink (dev),0 ,BIT (DEVLINK_RELOAD_ACTION_DRIVER_REINIT ) |BIT (DEVLINK_RELOAD_ACTION_FW_ACTIVATE ));
@@ -499,7 +499,7 @@ int mlx5_fw_reset_wait_reset_done(struct mlx5_core_dev *dev) err = fw_reset->ret;if (test_and_clear_bit (MLX5_FW_RESET_FLAGS_RELOAD_REQUIRED , &fw_reset->reset_flags)) {mlx5_unload_one_devl_locked (dev, false); -mlx5_load_one_devl_locked (dev, false); +mlx5_load_one_devl_locked (dev, true); } out:clear_bit (MLX5_FW_RESET_FLAGS_PENDING_COMP , &fw_reset->reset_flags);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 468/694 net/mlx5e: Nullify table pointer when failing to create
In reply to Greg Kroah-HartmanFrom: Aya Levin <[email protected]>
[ Upstream commit 1b540decd03acd736693aabb6cb46c71fca38ae6 ]
On failing to create promisc flow steering table, the pointer is returned with an error. Nullify it so unloading the driver won't try to destroy a non existing table.
Failing to create promisc table may happen over BF devices when the ARM side is going through a firmware tear down. The host side start a reload flow. While the driver unloads, it tries to remove the promisc table. Remove WARN in this state as it is a valid error flow.
--- drivers/net/ethernet/mellanox/mlx5/core/en_fs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/en_fs.c +2 -1
@@ -783,6 +783,7 @@ static int mlx5e_create_promisc_table(struct mlx5e_flow_steering *fs) ft->t =mlx5_create_auto_grouped_flow_table (fs->ns, &ft_attr);if (IS_ERR (ft->t)) { err =PTR_ERR (ft->t); + ft->t =NULL ;fs_err (fs,"fail to create promisc table err=%d\n" , err);return err; }
@@ -810,7 +811,7 @@ static void mlx5e_del_promisc_rule(struct mlx5e_flow_steering *fs)static void mlx5e_destroy_promisc_table (struct mlx5e_flow_steering *fs) { -if (WARN (!fs->promisc.ft.t,"Trying to remove non-existing promiscuous table" )) +if (!fs->promisc.ft.t)return ;mlx5e_del_promisc_rule (fs);mlx5_destroy_flow_table (fs->promisc.ft.t);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 469/694 Revert "net/mlx5e: Dont use termination table when redundant"
In reply to Greg Kroah-HartmanFrom: Vlad Buslov <[email protected]>
[ Upstream commit 081abcacaf0a9505c0d4cc9780b12e6ce5d33630 ]
This reverts commit 14624d7247fcd0f3114a6f5f17b3c8d1020fbbb7.
The termination table usage is requires for DMFS steering mode as firmware doesn't support mixed table destinations list which causes following syndrome with hairpin rules:
[81922.283225] mlx5_core 0000:08:00.0: mlx5_cmd_out_err:803:(pid 25977): SET_FLOW_TABLE_ENTRY(0x936) op_mod(0x0) failed, status bad parameter(0x3), syndrome (0xaca205), err(-22)
--- .../mlx5/core/eswitch_offloads_termtbl.c | 32 +++---------------- 1 file changed, 4 insertions(+), 28 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_termtbl.c +4 -28
@@ -210,18 +210,6 @@ static bool mlx5_eswitch_offload_is_uplink_port(const struct mlx5_eswitch *esw,return (port_mask & port_value) ==MLX5_VPORT_UPLINK ; } -static bool -mlx5_eswitch_is_push_vlan_no_cap (struct mlx5_eswitch *esw, -struct mlx5_flow_act *flow_act) -{ -if (flow_act->action &MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH && - !(mlx5_fs_get_capabilities (esw->dev,MLX5_FLOW_NAMESPACE_FDB ) & -MLX5_FLOW_STEERING_CAP_VLAN_PUSH_ON_RX )) -return true; - -return false; -} - bool mlx5_eswitch_termtbl_required(struct mlx5_eswitch *esw, struct mlx5_flow_attr *attr,
@@ -237,7 +225,10 @@ mlx5_eswitch_termtbl_required(struct mlx5_eswitch *esw, (!mlx5_eswitch_offload_is_uplink_port(esw, spec) && !esw_attr->int_port))return false; -if (mlx5_eswitch_is_push_vlan_no_cap (esw, flow_act)) +/* push vlan on RX */ +if (flow_act->action &MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH && + !(mlx5_fs_get_capabilities (esw->dev,MLX5_FLOW_NAMESPACE_FDB ) & +MLX5_FLOW_STEERING_CAP_VLAN_PUSH_ON_RX ))return true;/* hairpin */
@@ -261,31 +252,19 @@ mlx5_eswitch_add_termtbl_rule(struct mlx5_eswitch *esw,struct mlx5_flow_act term_tbl_act = {};struct mlx5_flow_handle *rule =NULL ;bool term_table_created = false; -bool is_push_vlan_on_rx;int num_vport_dests =0 ;int i, curr_dest; - is_push_vlan_on_rx =mlx5_eswitch_is_push_vlan_no_cap (esw, flow_act);mlx5_eswitch_termtbl_actions_move (flow_act, &term_tbl_act); term_tbl_act.action |=MLX5_FLOW_CONTEXT_ACTION_FWD_DEST ;for (i =0 ; i < num_dest; i++) {struct mlx5_termtbl_handle *tt; -bool hairpin = false;/* only vport destinations can be terminated */ if (dest[i].type !=MLX5_FLOW_DESTINATION_TYPE_VPORT )continue ; -if (attr->dests[num_vport_dests].rep && - attr->dests[num_vport_dests].rep->vport ==MLX5_VPORT_UPLINK ) - hairpin = true; - -if (!is_push_vlan_on_rx && !hairpin) { - num_vport_dests++; -continue ; - } -if (attr->dests[num_vport_dests].flags &MLX5_ESW_DEST_ENCAP ) { term_tbl_act.action |=MLX5_FLOW_CONTEXT_ACTION_PACKET_REFORMAT ; term_tbl_act.pkt_reformat = attr->dests[num_vport_dests].pkt_reformat;
@@ -333,9 +312,6 @@ mlx5_eswitch_add_termtbl_rule(struct mlx5_eswitch *esw,for (curr_dest =0 ; curr_dest < num_vport_dests; curr_dest++) {struct mlx5_termtbl_handle *tt = attr->dests[curr_dest].termtbl; -if (!tt) -continue ; - attr->dests[curr_dest].termtbl =NULL ;/* search for the destination associated with the
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 470/694 net: stmmac:fix system hang when setting up tag_8021q VLAN for DSA ports
In reply to Greg Kroah-HartmanFrom: Yan Wang <[email protected]>
[ Upstream commit 35226750f7ab9d49140d95bc7d38a2a9b0f4fdfc ]
The system hang because of dsa_tag_8021q_port_setup()->
stmmac_vlan_rx_add_vid().
I found in stmmac_drv_probe() that cailing pm_runtime_put() disabled the clock.
First, when the kernel is compiled with CONFIG_PM=y,The stmmac's resume/suspend is active.
Secondly,stmmac as DSA master,the dsa_tag_8021q_port_setup() function will callback stmmac_vlan_rx_add_vid when DSA dirver starts. However, The system is hanged for the stmmac_vlan_rx_add_vid() accesses its registers after stmmac's clock is closed.
I would suggest adding the pm_runtime_resume_and_get() to the stmmac_vlan_rx_add_vid().This guarantees that resuming clock output while in use.
--- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +9 -3
@@ -6350,6 +6350,10 @@ static int stmmac_vlan_rx_add_vid(struct net_device *ndev, __be16 proto, u16 vidbool is_double = false;int ret; + ret =pm_runtime_resume_and_get (priv->device); +if (ret <0 ) +return ret; +if (be16_to_cpu (proto) ==ETH_P_8021AD ) is_double = true;
@@ -6357,16 +6361,18 @@ static int stmmac_vlan_rx_add_vid(struct net_device *ndev, __be16 proto, u16 vid ret =stmmac_vlan_update (priv, is_double);if (ret) {clear_bit (vid, priv->active_vlans); -return ret; + goto err_pm_put; }if (priv->hw->num_vlan) { ret =stmmac_add_hw_vlan_rx_fltr (priv, ndev, priv->hw, proto, vid);if (ret) -return ret; + goto err_pm_put; } +err_pm_put: +pm_runtime_put (priv->device); -return 0 ; +return ret; }static int stmmac_vlan_rx_kill_vid (struct net_device *ndev,__be16 proto,u16 vid)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 471/694 bpf: Fix race between btf_put and btf_idr walk.
In reply to Greg Kroah-HartmanFrom: Alexei Starovoitov <[email protected]>
[ Upstream commit acf1c3d68e9a31f10d92bc67ad4673cdae5e8d92 ]
Florian and Eduard reported hard dead lock:
[ 58.433327] _raw_spin_lock_irqsave+0x40/0x50 [ 58.433334] btf_put+0x43/0x90 [ 58.433338] bpf_find_btf_id+0x157/0x240 [ 58.433353] btf_parse_fields+0x921/0x11c0
This happens since btf->refcount can be 1 at the time of btf_put() and btf_put() will call btf_free_id() which will try to grab btf_idr_lock and will dead lock.
Avoid the issue by doing btf_put() without locking.
--- kernel/bpf/btf.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
kernel/bpf/btf.c +3 -5
@@ -572,8 +572,8 @@ static s32 bpf_find_btf_id(const char *name, u32 kind, struct btf **btf_p) *btf_p = btf;return ret; } -spin_lock_bh (&btf_idr_lock);btf_put (btf); +spin_lock_bh (&btf_idr_lock); }spin_unlock_bh (&btf_idr_lock);return ret;
@@ -8245,12 +8245,10 @@ bpf_core_find_cands(struct bpf_core_ctx *ctx, u32 local_type_id)btf_get (mod_btf);spin_unlock_bh (&btf_idr_lock); cands =bpf_core_add_cands (cands, mod_btf,btf_nr_types (main_btf)); -if (IS_ERR (cands)) { -btf_put (mod_btf); +btf_put (mod_btf); +if (IS_ERR (cands))return ERR_CAST (cands); - }spin_lock_bh (&btf_idr_lock); -btf_put (mod_btf); }spin_unlock_bh (&btf_idr_lock);/* cands is a pointer to kmalloced memory here if cands->cnt > 0
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 472/694 bpf: Dont EFAULT for getsockopt with optval=NULL
In reply to Greg Kroah-HartmanFrom: Stanislav Fomichev <[email protected]>
[ Upstream commit 00e74ae0863827d944e36e56a4ce1e77e50edb91 ]
Some socket options do getsockopt with optval=NULL to estimate the size of the final buffer (which is returned via optlen). This breaks BPF getsockopt assumptions about permitted optval buffer size. Let's enforce these assumptions only when non-NULL optval is provided.
--- kernel/bpf/cgroup.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
kernel/bpf/cgroup.c +6 -3
@@ -1921,14 +1921,17 @@ int __cgroup_bpf_run_filter_getsockopt(struct sock *sk, int level,if (ret <0 ) goto out; -if (ctx.optlen > max_optlen || ctx.optlen <0 ) { +if (optval && (ctx.optlen > max_optlen || ctx.optlen <0 )) { ret = -EFAULT ; goto out; }if (ctx.optlen !=0 ) { -if (copy_to_user (optval, ctx.optval, ctx.optlen) || -put_user (ctx.optlen, optlen)) { +if (optval &©_to_user (optval, ctx.optval, ctx.optlen)) { + ret = -EFAULT ; + goto out; + } +if (put_user (ctx.optlen, optlen)) { ret = -EFAULT ; goto out; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 473/694 netfilter: nf_tables: dont write table validation state without mutex
In reply to Greg Kroah-HartmanFrom: Florian Westphal <[email protected]>
[ Upstream commit 9a32e9850686599ed194ccdceb6cd3dd56b2d9b9 ]
The ->cleanup callback needs to be removed, this doesn't work anymore as the transaction mutex is already released in the ->abort function.
Just do it after a successful validation pass, this either happens from commit or abort phases where transaction mutex is held.
--- include/linux/netfilter/nfnetlink.h | 1 - net/netfilter/nf_tables_api.c | 8 ++------ net/netfilter/nfnetlink.c | 2 -- 3 files changed, 2 insertions(+), 9 deletions(-)
include/linux/netfilter/nfnetlink.h +0 -1
@@ -45,7 +45,6 @@ struct nfnetlink_subsystem {int (*commit)(struct net *net,struct sk_buff *skb);int (*abort)(struct net *net,struct sk_buff *skb,enum nfnl_abort_action action); -void (*cleanup)(struct net *net);bool (*valid_genid)(struct net *net,u32 genid); };
net/netfilter/nf_tables_api.c +2 -6
@@ -8645,6 +8645,8 @@ static int nf_tables_validate(struct net *net)if (nft_table_validate (net, table) <0 )return -EAGAIN ; } + +nft_validate_state_update (net,NFT_VALIDATE_SKIP );break ; }
@@ -9586,11 +9588,6 @@ static int __nf_tables_abort(struct net *net, enum nfnl_abort_action action)return 0 ; } -static void nf_tables_cleanup (struct net *net) -{ -nft_validate_state_update (net,NFT_VALIDATE_SKIP ); -} -static int nf_tables_abort (struct net *net,struct sk_buff *skb,enum nfnl_abort_action action) {
@@ -9624,7 +9621,6 @@ static const struct nfnetlink_subsystem nf_tables_subsys = { .cb = nf_tables_cb, .commit = nf_tables_commit, .abort = nf_tables_abort, - .cleanup = nf_tables_cleanup, .valid_genid = nf_tables_valid_genid, .owner = THIS_MODULE, };
net/netfilter/nfnetlink.c +0 -2
@@ -590,8 +590,6 @@ static void nfnetlink_rcv_batch(struct sk_buff *skb, struct nlmsghdr *nlh, goto replay_abort; } } -if (ss->cleanup) - ss->cleanup (net);nfnl_err_deliver (&err_list, oskb);kfree_skb (skb);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 474/694 net: dpaa: Fix uninitialized variable in dpaa_stop()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 461bb5b97049a149278f2c27a3aa12af16da6a2e ]
The return value is not initialized on the success path.
--- drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +2 -1
@@ -299,7 +299,8 @@ static int dpaa_stop(struct net_device *net_dev) {struct mac_device *mac_dev;struct dpaa_priv *priv; -int i, err, error; +int i, error; +int err =0 ; priv =netdev_priv (net_dev); mac_dev = priv->mac_dev;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 475/694 net/sched: sch_fq: fix integer overflow of "credit"
In reply to Greg Kroah-HartmanFrom: Davide Caratti <[email protected]>
[ Upstream commit 7041101ff6c3073fd8f2e99920f535b111c929cb ]
if sch_fq is configured with "initial quantum" having values greater than INT_MAX, the first assignment of "credit" does signed integer overflow to a very negative value.
In this situation, the syzkaller script provided by Cristoph triggers the CPU soft-lockup warning even with few sockets. It's not an infinite loop, but "credit" wasn't probably meant to be minus 2Gb for each new flow. Capping "initial quantum" to INT_MAX proved to fix the issue.
v2: validation of "initial quantum" is done in fq_policy, instead of open
coding in fq_change() _ suggested by Jakub Kicinski
--- net/sched/sch_fq.c | 6 ++++- .../tc-testing/tc-tests/qdiscs/fq.json | 22 +++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-)
net/sched/sch_fq.c +5 -1
@@ -779,13 +779,17 @@ static int fq_resize(struct Qdisc *sch, u32 log)return 0 ; } +static struct netlink_range_validation iq_range = { + .max =INT_MAX , +}; +static const struct nla_policy fq_policy[TCA_FQ_MAX +1 ] = { [TCA_FQ_UNSPEC ] = { .strict_start_type =TCA_FQ_TIMER_SLACK }, [TCA_FQ_PLIMIT ] = { .type =NLA_U32 }, [TCA_FQ_FLOW_PLIMIT ] = { .type =NLA_U32 }, [TCA_FQ_QUANTUM ] = { .type =NLA_U32 }, - [TCA_FQ_INITIAL_QUANTUM ] = { .type =NLA_U32 }, + [TCA_FQ_INITIAL_QUANTUM ] =NLA_POLICY_FULL_RANGE (NLA_U32 , &iq_range), [TCA_FQ_RATE_ENABLE ] = { .type =NLA_U32 }, [TCA_FQ_FLOW_DEFAULT_RATE ] = { .type =NLA_U32 }, [TCA_FQ_FLOW_MAX_RATE ] = { .type =NLA_U32 },
tools/testing/selftests/tc-testing/tc-tests/qdiscs/fq.json +22 -0
@@ -114,6 +114,28 @@ "$IP link del dev $DUMMY type dummy" ] }, + { + "id": "10f7", + "name": "Create FQ with invalid initial_quantum setting", + "category": [ + "qdisc", + "fq" + ], + "plugins": { + "requires": "nsPlugin" + }, + "setup": [ + "$IP link add dev $DUMMY type dummy || /bin/true" + ], + "cmdUnderTest": "$TC qdisc add dev $DUMMY handle 1: root fq initial_quantum 0x80000000", + "expExitCode": "2", + "verifyCmd": "$TC qdisc show dev $DUMMY", + "matchPattern": "qdisc fq 1: root.*initial_quantum 2048Mb", + "matchCount": "0", + "teardown": [ + "$IP link del dev $DUMMY type dummy" + ] + }, { "id": "9398", "name": "Create FQ with maxrate setting",
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 476/694 net/sched: cls_api: Initialize miss_cookie_node when action miss is not used
In reply to Greg Kroah-HartmanFrom: Ivan Vecera <[email protected]>
[ Upstream commit 2cc8a008d62f3c04eeb7ec6fe59e542802bb8df3 ]
Function tcf_exts_init_ex() sets exts->miss_cookie_node ptr only when use_action_miss is true so it assumes in other case that the field is set to NULL by the caller. If not then the field contains garbage and subsequent tcf_exts_destroy() call results in a crash.
Ensure that the field .miss_cookie_node pointer is NULL when use_action_miss parameter is false to avoid this potential scenario.
--- net/sched/cls_api.c | 1 + 1 file changed, 1 insertion(+)
net/sched/cls_api.c +1 -0
@@ -3211,6 +3211,7 @@ int tcf_exts_init_ex(struct tcf_exts *exts, struct net *net, int action,#ifdef CONFIG_NET_CLS_ACT exts->type =0 ; exts->nr_actions =0 ; + exts->miss_cookie_node =NULL ;/* Note: we do not own yet a reference on net. * This reference might be taken later from tcf_exts_get_net(). */
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 477/694 ipv4: Fix potential uninit variable access bug in __ip_make_skb()
In reply to Greg Kroah-HartmanFrom: Ziyang Xuan <[email protected]>
[ Upstream commit 99e5acae193e369b71217efe6f1dad42f3f18815 ]
Like commit ea30388baebc ("ipv6: Fix an uninit variable access bug in __ip6_make_skb()"). icmphdr does not in skb linear region under the scenario of SOCK_RAW socket. Access icmp_hdr(skb)->type directly will trigger the uninit variable access bug.
Use a local variable icmp_type to carry the correct value in different scenarios.
--- net/ipv4/ip_output.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
net/ipv4/ip_output.c +13 -3
@@ -1570,9 +1570,19 @@ struct sk_buff *__ip_make_skb(struct sock *sk, cork->dst =NULL ;skb_dst_set (skb, &rt->dst); -if (iph->protocol ==IPPROTO_ICMP ) -icmp_out_count (net, ((struct icmphdr *) -skb_transport_header (skb))->type); +if (iph->protocol ==IPPROTO_ICMP ) { +u8 icmp_type; + +/* For such sockets, transhdrlen is zero when do ip_append_data(), +* so icmphdr does not in skb linear region and can not get icmp_type +* by icmp_hdr(skb)->type. +*/ +if (sk->sk_type ==SOCK_RAW && !inet_sk (sk)->hdrincl) + icmp_type = fl4->fl4_icmp_type; +else + icmp_type =icmp_hdr (skb)->type; +icmp_out_count (net, icmp_type); + }ip_cork_release (cork); out:
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 478/694 rxrpc: Fix error when reading rxrpc tokens
In reply to Greg Kroah-HartmanFrom: Marc Dionne <[email protected]>
[ Upstream commit fadfc57cc8047080a123b16f288b7138524fb1e2 ]
When converting from ASSERTCMP to WARN_ON, the tested condition must be inverted, which was missed for this case.
This would cause an EIO error when trying to read an rxrpc token, for instance when trying to display tokens with AuriStor's "tokens" command.
--- net/rxrpc/key.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/rxrpc/key.c +1 -1
@@ -680,7 +680,7 @@ static long rxrpc_read(const struct key *key,return -ENOPKG ; } -if (WARN_ON ((unsigned long )xdr - (unsigned long )oldxdr == +if (WARN_ON ((unsigned long )xdr - (unsigned long )oldxdr != toksize))return -EIO ; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 479/694 Revert "Bluetooth: btsdio: fix use after free bug in btsdio_remove due to unfinished work"
In reply to Greg Kroah-HartmanFrom: Liu Jian <[email protected]>
[ Upstream commit db2bf510bd5d57f064d9e1db395ed86a08320c54 ]
This reverts commit 1e9ac114c4428fdb7ff4635b45d4f46017e8916f.
This patch introduces a possible null-ptr-def problem. Revert it. And the fixed bug by this patch have resolved by commit 73f7b171b7c0 ("Bluetooth:
btsdio: fix use after free bug in btsdio_remove due to race condition").
--- drivers/bluetooth/btsdio.c | 1 - 1 file changed, 1 deletion(-)
drivers/bluetooth/btsdio.c +0 -1
@@ -354,7 +354,6 @@ static void btsdio_remove(struct sdio_func *func)BT_DBG ("func %p" , func); -cancel_work_sync (&data->work);if (!data)return ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 480/694 netlink: Use copy_to_user() for optval in netlink_getsockopt().
In reply to Greg Kroah-HartmanFrom: Kuniyuki Iwashima <[email protected]>
[ Upstream commit d913d32cc2707e9cd24fe6fa6d7d470e9c728980 ]
Brad Spencer provided a detailed report [0] that when calling getsockopt() for AF_NETLINK, some SOL_NETLINK options set only 1 byte even though such options require at least sizeof(int) as length.
The options return a flag value that fits into 1 byte, but such behaviour confuses users who do not initialise the variable before calling getsockopt() and do not strictly check the returned value as char.
Currently, netlink_getsockopt() uses put_user() to copy data to optlen and optval, but put_user() casts the data based on the pointer, char *optval. As a result, only 1 byte is set to optval.
To avoid this behaviour, we need to use copy_to_user() or cast optval for put_user().
Note that this changes the behaviour on big-endian systems, but we document that the size of optval is int in the man page.
$ man 7 netlink
...
Socket options
To set or get a netlink socket option, call getsockopt(2) to read
or setsockopt(2) to write the option with the option level argument
set to SOL_NETLINK. Unless otherwise noted, optval is a pointer to
an int.--- net/netlink/af_netlink.c | 75 ++++++++++++---------------------------- 1 file changed, 23 insertions(+), 52 deletions(-)
net/netlink/af_netlink.c +23 -52
@@ -1742,7 +1742,8 @@ static int netlink_getsockopt(struct socket *sock, int level, int optname, {struct sock *sk = sock->sk;struct netlink_sock *nlk =nlk_sk (sk); -int len, val, err; +unsigned int flag; +int len, val;if (level !=SOL_NETLINK )return -ENOPROTOOPT ;
@@ -1754,39 +1755,17 @@ static int netlink_getsockopt(struct socket *sock, int level, int optname,switch (optname) {case NETLINK_PKTINFO : -if (len <sizeof (int )) -return -EINVAL ; - len =sizeof (int ); - val = nlk->flags &NETLINK_F_RECV_PKTINFO ?1 :0 ; -if (put_user (len, optlen) || -put_user (val, optval)) -return -EFAULT ; - err =0 ; + flag =NETLINK_F_RECV_PKTINFO ;break ;case NETLINK_BROADCAST_ERROR : -if (len <sizeof (int )) -return -EINVAL ; - len =sizeof (int ); - val = nlk->flags &NETLINK_F_BROADCAST_SEND_ERROR ?1 :0 ; -if (put_user (len, optlen) || -put_user (val, optval)) -return -EFAULT ; - err =0 ; + flag =NETLINK_F_BROADCAST_SEND_ERROR ;break ;case NETLINK_NO_ENOBUFS : -if (len <sizeof (int )) -return -EINVAL ; - len =sizeof (int ); - val = nlk->flags &NETLINK_F_RECV_NO_ENOBUFS ?1 :0 ; -if (put_user (len, optlen) || -put_user (val, optval)) -return -EFAULT ; - err =0 ; + flag =NETLINK_F_RECV_NO_ENOBUFS ;break ;case NETLINK_LIST_MEMBERSHIPS : { -int pos, idx, shift; +int pos, idx, shift, err =0 ; - err =0 ;netlink_lock_table ();for (pos =0 ; pos *8 < nlk->ngroups; pos +=sizeof (u32)) {if (len - pos <sizeof (u32))
@@ -1803,40 +1782,32 @@ static int netlink_getsockopt(struct socket *sock, int level, int optname,if (put_user (ALIGN (nlk->ngroups /8 ,sizeof (u32)), optlen)) err = -EFAULT ;netlink_unlock_table (); -break ; +return err; }case NETLINK_CAP_ACK : -if (len <sizeof (int )) -return -EINVAL ; - len =sizeof (int ); - val = nlk->flags &NETLINK_F_CAP_ACK ?1 :0 ; -if (put_user (len, optlen) || -put_user (val, optval)) -return -EFAULT ; - err =0 ; + flag =NETLINK_F_CAP_ACK ;break ;case NETLINK_EXT_ACK : -if (len <sizeof (int )) -return -EINVAL ; - len =sizeof (int ); - val = nlk->flags &NETLINK_F_EXT_ACK ?1 :0 ; -if (put_user (len, optlen) ||put_user (val, optval)) -return -EFAULT ; - err =0 ; + flag =NETLINK_F_EXT_ACK ;break ;case NETLINK_GET_STRICT_CHK : -if (len <sizeof (int )) -return -EINVAL ; - len =sizeof (int ); - val = nlk->flags &NETLINK_F_STRICT_CHK ?1 :0 ; -if (put_user (len, optlen) ||put_user (val, optval)) -return -EFAULT ; - err =0 ; + flag =NETLINK_F_STRICT_CHK ;break ;default : - err = -ENOPROTOOPT ; +return -ENOPROTOOPT ; } -return err; + +if (len <sizeof (int )) +return -EINVAL ; + + len =sizeof (int ); + val = nlk->flags & flag ?1 :0 ; + +if (put_user (len, optlen) || +copy_to_user (optval, &val, len)) +return -EFAULT ; + +return 0 ; }static void netlink_cmsg_recv_pktinfo (struct msghdr *msg,struct sk_buff *skb)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 481/694 net: amd: Fix link leak when verifying config failed
In reply to Greg Kroah-HartmanFrom: Gencen Gan <[email protected]>
[ Upstream commit d325c34d9e7e38d371c0a299d415e9b07f66a1fb ]
After failing to verify configuration, it returns directly without releasing link, which may cause memory leak.
Paolo Abeni thinks that the whole code of this driver is quite "suboptimal" and looks unmainatained since at least ~15y, so he suggests that we could simply remove the whole driver, please take it into consideration.
Simon Horman suggests that the fix label should be set to "Linux-2.6.12-rc2" considering that the problem has existed since the driver was introduced and the commit above doesn't seem to exist in net/net-next.
--- drivers/net/ethernet/amd/nmclan_cs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/amd/nmclan_cs.c +1 -1
@@ -651,7 +651,7 @@ static int nmclan_config(struct pcmcia_device *link) }else {pr_notice ("mace id not found: %x %x should be 0x40 0x?9\n" , sig[0 ], sig[1 ]); -return -ENODEV ; + goto failed; } }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 482/694 tcp/udp: Fix memleaks of sk and zerocopy skbs with TX timestamp.
In reply to Greg Kroah-HartmanFrom: Kuniyuki Iwashima <[email protected]>
[ Upstream commit 50749f2dd6854a41830996ad302aef2ffaf011d8 ]
syzkaller reported [0] memory leaks of an UDP socket and ZEROCOPY skbs. We can reproduce the problem with these sequences:
sk = socket(AF_INET, SOCK_DGRAM, 0) sk.setsockopt(SOL_SOCKET, SO_TIMESTAMPING, SOF_TIMESTAMPING_TX_SOFTWARE) sk.setsockopt(SOL_SOCKET, SO_ZEROCOPY, 1)
sk.sendto(b'', MSG_ZEROCOPY, ('127.0.0.1', 53))
sk.close()
sendmsg() calls msg_zerocopy_alloc(), which allocates a skb, sets skb->cb->ubuf.refcnt to 1, and calls sock_hold(). Here, struct ubuf_info_msgzc indirectly holds a refcnt of the socket. When the skb is sent, __skb_tstamp_tx() clones it and puts the clone into the socket's error queue with the TX timestamp.
When the original skb is received locally, skb_copy_ubufs() calls skb_unclone(), and pskb_expand_head() increments skb->cb->ubuf.refcnt. This additional count is decremented while freeing the skb, but struct ubuf_info_msgzc still has a refcnt, so __msg_zerocopy_callback() is not called.
The last refcnt is not released unless we retrieve the TX timestamped skb by recvmsg(). Since we clear the error queue in inet_sock_destruct() after the socket's refcnt reaches 0, there is a circular dependency. If we close() the socket holding such skbs, we never call sock_put() and leak the count, sk, and skb.
TCP has the same problem, and commit e0c8bccd40fc ("net: stream:
purge sk_error_queue in sk_stream_kill_queues()") tried to fix it by calling skb_queue_purge() during close(). However, there is a small chance that skb queued in a qdisc or device could be put into the error queue after the skb_queue_purge() call.
In __skb_tstamp_tx(), the cloned skb should not have a reference to the ubuf to remove the circular dependency, but skb_clone() does not call skb_copy_ubufs() for zerocopy skb. So, we need to call skb_orphan_frags_rx() for the cloned skb to call skb_copy_ubufs().
[0]:
BUG: memory leak
unreferenced object 0xffff88800c6d2d00 (size 1152):
comm "syz-executor392", pid 264, jiffies 4294785440 (age 13.044s)
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 cd af e8 81 00 00 00 00 ................
02 00 07 40 00 00 00 00 00 00 00 00 00 00 00 00 ...@............
backtrace:
[<0000000055636812>] sk_prot_alloc+0x64/0x2a0 net/core/sock.c:2024
[<0000000054d77b7a>] sk_alloc+0x3b/0x800 net/core/sock.c:2083
[<0000000066f3c7e0>] inet_create net/ipv4/af_inet.c:319 [inline]
[<0000000066f3c7e0>] inet_create+0x31e/0xe40 net/ipv4/af_inet.c:245
[<000000009b83af97>] __sock_create+0x2ab/0x550 net/socket.c:1515
[<00000000b9b11231>] sock_create net/socket.c:1566 [inline]
[<00000000b9b11231>] __sys_socket_create net/socket.c:1603 [inline]
[<00000000b9b11231>] __sys_socket_create net/socket.c:1588 [inline]
[<00000000b9b11231>] __sys_socket+0x138/0x250 net/socket.c:1636
[<000000004fb45142>] __do_sys_socket net/socket.c:1649 [inline]
[<000000004fb45142>] __se_sys_socket net/socket.c:1647 [inline]
[<000000004fb45142>] __x64_sys_socket+0x73/0xb0 net/socket.c:1647
[<0000000066999e0e>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
[<0000000066999e0e>] do_syscall_64+0x38/0x90 arch/x86/entry/common.c:80
[<0000000017f238c1>] entry_SYSCALL_64_after_hwframe+0x63/0xcd
BUG: memory leak
unreferenced object 0xffff888017633a00 (size 240):
comm "syz-executor392", pid 264, jiffies 4294785440 (age 13.044s)
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 2d 6d 0c 80 88 ff ff .........-m.....
backtrace:
[<000000002b1c4368>] __alloc_skb+0x229/0x320 net/core/skbuff.c:497
[<00000000143579a6>] alloc_skb include/linux/skbuff.h:1265 [inline]
[<00000000143579a6>] sock_omalloc+0xaa/0x190 net/core/sock.c:2596
[<00000000be626478>] msg_zerocopy_alloc net/core/skbuff.c:1294 [inline]
[<00000000be626478>] msg_zerocopy_realloc+0x1ce/0x7f0 net/core/skbuff.c:1370
[<00000000cbfc9870>] __ip_append_data+0x2adf/0x3b30 net/ipv4/ip_output.c:1037
[<0000000089869146>] ip_make_skb+0x26c/0x2e0 net/ipv4/ip_output.c:1652
[<00000000098015c2>] udp_sendmsg+0x1bac/0x2390 net/ipv4/udp.c:1253
[<0000000045e0e95e>] inet_sendmsg+0x10a/0x150 net/ipv4/af_inet.c:819
[<000000008d31bfde>] sock_sendmsg_nosec net/socket.c:714 [inline]
[<000000008d31bfde>] sock_sendmsg+0x141/0x190 net/socket.c:734
[<0000000021e21aa4>] __sys_sendto+0x243/0x360 net/socket.c:2117
[<00000000ac0af00c>] __do_sys_sendto net/socket.c:2129 [inline]
[<00000000ac0af00c>] __se_sys_sendto net/socket.c:2125 [inline]
[<00000000ac0af00c>] __x64_sys_sendto+0xe1/0x1c0 net/socket.c:2125
[<0000000066999e0e>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
[<0000000066999e0e>] do_syscall_64+0x38/0x90 arch/x86/entry/common.c:80
[<0000000017f238c1>] entry_SYSCALL_64_after_hwframe+0x63/0xcd--- net/core/skbuff.c | 3 +++ 1 file changed, 3 insertions(+)
net/core/skbuff.c +3 -0
@@ -5162,6 +5162,9 @@ void __skb_tstamp_tx(struct sk_buff *orig_skb, skb =alloc_skb (0 ,GFP_ATOMIC ); }else { skb =skb_clone (orig_skb,GFP_ATOMIC ); + +if (skb_orphan_frags_rx (skb,GFP_ATOMIC )) +return ; }if (!skb)return ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 483/694 ipmi: ASPEED_BT_IPMI_BMC: select REGMAP_MMIO instead of depending on it
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit 2a587b9ad052e7e92e508aea90c1e2ae433c1908 ]
REGMAP is a hidden (not user visible) symbol. Users cannot set it directly thru "make *config", so drivers should select it instead of depending on it if they need it.
Consistently using "select" or "depends on" can also help reduce Kconfig circular dependency issues.
Therefore, change the use of "depends on REGMAP_MMIO" to "select REGMAP_MMIO", which will also set REGMAP.
Message-Id: <[email protected]>
--- drivers/char/ipmi/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/char/ipmi/Kconfig +2 -1
@@ -162,7 +162,8 @@ config IPMI_KCS_BMC_SERIO config ASPEED_BT_IPMI_BMC depends on ARCH_ASPEED || COMPILE_TEST - depends on REGMAP && REGMAP_MMIO && MFD_SYSCON + depends on MFD_SYSCON + select REGMAP_MMIO tristate "BT IPMI bmc driver" help Provides a driver for the BT (Block Transfer) IPMI interface
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 484/694 ASoC: cs35l41: Only disable internal boost
In reply to Greg Kroah-HartmanFrom: Lucas Tanure <[email protected]>
[ Upstream commit 4658de99d43cd740e019e7fd124b4128f8f4027f ]
In error situations, only the internal boost case should be disabled and re-enabled.
Also, for other boost cases re-enabling the boost to the default internal boost config is incorrect.
--- sound/soc/codecs/cs35l41.c | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-)
sound/soc/codecs/cs35l41.c +19 -15
@@ -356,6 +356,19 @@ static const struct snd_kcontrol_new cs35l41_aud_controls[] = { WM_ADSP_FW_CONTROL("DSP1", 0), }; +static void cs35l41_boost_enable (struct cs35l41_private *cs35l41,unsigned int enable) +{ +switch (cs35l41->hw_cfg.bst_type) { +case CS35L41_INT_BOOST : + enable = enable ?CS35L41_BST_EN_DEFAULT :CS35L41_BST_DIS_FET_OFF ; +regmap_update_bits (cs35l41->regmap,CS35L41_PWR_CTRL2 ,CS35L41_BST_EN_MASK , + enable <<CS35L41_BST_EN_SHIFT ); +break ; +default : +break ; + } +} +static irqreturn_t cs35l41_irq (int irq,void *data) {struct cs35l41_private *cs35l41 = data;
@@ -431,8 +444,7 @@ static irqreturn_t cs35l41_irq(int irq, void *data)if (status[0 ] &CS35L41_BST_OVP_ERR ) {dev_crit_ratelimited (cs35l41->dev,"VBST Over Voltage error\n" ); -regmap_update_bits (cs35l41->regmap,CS35L41_PWR_CTRL2 , -CS35L41_BST_EN_MASK ,0 ); +cs35l41_boost_enable (cs35l41,0 );regmap_write (cs35l41->regmap,CS35L41_IRQ1_STATUS1 ,CS35L41_BST_OVP_ERR );regmap_write (cs35l41->regmap,CS35L41_PROTECT_REL_ERR_IGN ,0 );
@@ -441,16 +453,13 @@ static irqreturn_t cs35l41_irq(int irq, void *data) CS35L41_BST_OVP_ERR_RLS);regmap_update_bits (cs35l41->regmap,CS35L41_PROTECT_REL_ERR_IGN ,CS35L41_BST_OVP_ERR_RLS ,0 ); -regmap_update_bits (cs35l41->regmap,CS35L41_PWR_CTRL2 , -CS35L41_BST_EN_MASK , -CS35L41_BST_EN_DEFAULT <<CS35L41_BST_EN_SHIFT ); +cs35l41_boost_enable (cs35l41,1 ); ret =IRQ_HANDLED ; }if (status[0 ] &CS35L41_BST_DCM_UVP_ERR ) {dev_crit_ratelimited (cs35l41->dev,"DCM VBST Under Voltage Error\n" ); -regmap_update_bits (cs35l41->regmap,CS35L41_PWR_CTRL2 , -CS35L41_BST_EN_MASK ,0 ); +cs35l41_boost_enable (cs35l41,0 );regmap_write (cs35l41->regmap,CS35L41_IRQ1_STATUS1 ,CS35L41_BST_DCM_UVP_ERR );regmap_write (cs35l41->regmap,CS35L41_PROTECT_REL_ERR_IGN ,0 );
@@ -459,16 +468,13 @@ static irqreturn_t cs35l41_irq(int irq, void *data) CS35L41_BST_UVP_ERR_RLS);regmap_update_bits (cs35l41->regmap,CS35L41_PROTECT_REL_ERR_IGN ,CS35L41_BST_UVP_ERR_RLS ,0 ); -regmap_update_bits (cs35l41->regmap,CS35L41_PWR_CTRL2 , -CS35L41_BST_EN_MASK , -CS35L41_BST_EN_DEFAULT <<CS35L41_BST_EN_SHIFT ); +cs35l41_boost_enable (cs35l41,1 ); ret =IRQ_HANDLED ; }if (status[0 ] &CS35L41_BST_SHORT_ERR ) {dev_crit_ratelimited (cs35l41->dev,"LBST error: powering off!\n" ); -regmap_update_bits (cs35l41->regmap,CS35L41_PWR_CTRL2 , -CS35L41_BST_EN_MASK ,0 ); +cs35l41_boost_enable (cs35l41,0 );regmap_write (cs35l41->regmap,CS35L41_IRQ1_STATUS1 ,CS35L41_BST_SHORT_ERR );regmap_write (cs35l41->regmap,CS35L41_PROTECT_REL_ERR_IGN ,0 );
@@ -477,9 +483,7 @@ static irqreturn_t cs35l41_irq(int irq, void *data) CS35L41_BST_SHORT_ERR_RLS);regmap_update_bits (cs35l41->regmap,CS35L41_PROTECT_REL_ERR_IGN ,CS35L41_BST_SHORT_ERR_RLS ,0 ); -regmap_update_bits (cs35l41->regmap,CS35L41_PWR_CTRL2 , -CS35L41_BST_EN_MASK , -CS35L41_BST_EN_DEFAULT <<CS35L41_BST_EN_SHIFT ); +cs35l41_boost_enable (cs35l41,1 ); ret =IRQ_HANDLED ; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 485/694 drivers: staging: rtl8723bs: Fix locking in _rtw_join_timeout_handler()
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit 215792eda008f6a1e7ed9d77fa20d582d22bb114 ]
Commit 041879b12ddb ("drivers: staging: rtl8192bs: Fix deadlock in rtw_joinbss_event_prehandle()") besides fixing the deadlock also modified _rtw_join_timeout_handler() to use spin_[un]lock_irq() instead of spin_[un]lock_bh().
_rtw_join_timeout_handler() calls rtw_do_join() which takes pmlmepriv->scanned_queue.lock using spin_[un]lock_bh(). This spin_unlock_bh() call re-enables softirqs which triggers an oops in kernel/softirq.c: __local_bh_enable_ip() when it calls lockdep_assert_irqs_enabled():
[ 244.506087] WARNING: CPU: 2 PID: 0 at kernel/softirq.c:376 __local_bh_enable_ip+0xa6/0x100 ... [ 244.509022] Call Trace: [ 244.509048] <IRQ> [ 244.509100] _rtw_join_timeout_handler+0x134/0x170 [r8723bs] [ 244.509468] ? __pfx__rtw_join_timeout_handler+0x10/0x10 [r8723bs] [ 244.509772] ? __pfx__rtw_join_timeout_handler+0x10/0x10 [r8723bs] [ 244.510076] call_timer_fn+0x95/0x2a0 [ 244.510200] __run_timers.part.0+0x1da/0x2d0
This oops is causd by the switch to spin_[un]lock_irq() which disables the IRQs for the entire duration of _rtw_join_timeout_handler().
Disabling the IRQs is not necessary since all code taking this lock runs from either user contexts or from softirqs, switch back to spin_[un]lock_bh() to fix this.
--- drivers/staging/rtl8723bs/core/rtw_mlme.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/rtl8723bs/core/rtw_mlme.c +2 -2
@@ -1549,7 +1549,7 @@ void _rtw_join_timeout_handler(struct timer_list *t)if (adapter->bDriverStopped || adapter->bSurpriseRemoved)return ; -spin_lock_irq (&pmlmepriv->lock); +spin_lock_bh (&pmlmepriv->lock);if (rtw_to_roam (adapter) >0 ) {/* join timeout caused by roaming */ while (1 ) {
@@ -1577,7 +1577,7 @@ void _rtw_join_timeout_handler(struct timer_list *t) } -spin_unlock_irq (&pmlmepriv->lock); +spin_unlock_bh (&pmlmepriv->lock); }/*
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 486/694 drivers: staging: rtl8723bs: Fix locking in rtw_scan_timeout_handler()
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit 3f467036093fedd7e231924327455fc609b5ef02 ]
Commit cc7ad0d77b51 ("drivers: staging: rtl8723bs: Fix deadlock in rtw_surveydone_event_callback()") besides fixing the deadlock also modified rtw_scan_timeout_handler() to use spin_[un]lock_irq() instead of spin_[un]lock_bh().
Disabling the IRQs is not necessary since all code taking this lock runs from either user contexts or from softirqs
rtw_scan_timeout_handler() is the only function taking pmlmepriv->lock which uses spin_[un]lock_irq() for this. Switch back to spin_[un]lock_bh() to make it consistent with the rest of the code.
--- drivers/staging/rtl8723bs/core/rtw_mlme.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/rtl8723bs/core/rtw_mlme.c +2 -2
@@ -1590,11 +1590,11 @@ void rtw_scan_timeout_handler(struct timer_list *t) mlmepriv.scan_to_timer);struct mlme_priv *pmlmepriv = &adapter->mlmepriv; -spin_lock_irq (&pmlmepriv->lock); +spin_lock_bh (&pmlmepriv->lock);_clr_fwstate_ (pmlmepriv, _FW_UNDER_SURVEY); -spin_unlock_irq (&pmlmepriv->lock); +spin_unlock_bh (&pmlmepriv->lock);rtw_indicate_scan_done (adapter, true); }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 487/694 pstore: Revert pmsg_lock back to a normal mutex
In reply to Greg Kroah-HartmanFrom: John Stultz <[email protected]>
[ Upstream commit 5239a89b06d6b199f133bf0ffea421683187f257 ]
This reverts commit 76d62f24db07f22ccf9bc18ca793c27d4ebef721.
So while priority inversion on the pmsg_lock is an occasional problem that an rt_mutex would help with, in uses where logging is writing to pmsg heavily from multiple threads, the pmsg_lock can be heavily contended.
After this change landed, it was reported that cases where the mutex locking overhead was commonly adding on the order of 10s of usecs delay had suddenly jumped to ~msec delay with rtmutex.
It seems the slight differences in the locks under this level of contention causes the normal mutexes to utilize the spinning optimizations, while the rtmutexes end up in the sleeping slowpath (which allows additional threads to pile on trying to take the lock).
In this case, it devolves to a worse case senerio where the lock acquisition and scheduling overhead dominates, and each thread is waiting on the order of ~ms to do ~us of work.
Obviously, having tons of threads all contending on a single lock for logging is non-optimal, so the proper fix is probably reworking pstore pmsg to have per-cpu buffers so we don't have contention.
Additionally, Steven Rostedt has provided some furhter optimizations for rtmutexes that improves the rtmutex spinning path, but at least in my testing, I still see the test tripping into the sleeping path on rtmutexes while utilizing the spinning path with mutexes.
But in the short term, lets revert the change to the rt_mutex and go back to normal mutexes to avoid a potentially major performance regression. And we can work on optimizations to both rtmutexes and finer-grained locking for pstore pmsg in the future.
--- fs/pstore/pmsg.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
fs/pstore/pmsg.c +3 -4
@@ -7,10 +7,9 @@#include <linux/device.h> #include <linux/fs.h> #include <linux/uaccess.h> -#include <linux/rtmutex.h> #include "internal.h" -static DEFINE_RT_MUTEX (pmsg_lock); +static DEFINE_MUTEX (pmsg_lock);static ssize_t write_pmsg (struct file *file,const char __user *buf,size_t count,loff_t *ppos)
@@ -29,9 +28,9 @@ static ssize_t write_pmsg(struct file *file, const char __user *buf,if (!access_ok (buf, count))return -EFAULT ; -rt_mutex_lock (&pmsg_lock); +mutex_lock (&pmsg_lock); ret = psinfo->write_user (&record, buf); -rt_mutex_unlock (&pmsg_lock); +mutex_unlock (&pmsg_lock);return ret ? ret : count; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 488/694 usb: host: xhci-rcar: remove leftover quirk handling
In reply to Greg Kroah-HartmanFrom: Wolfram Sang <[email protected]>
[ Upstream commit 5d67f4861884762ebc2bddb5d667444e45f25782 ]
Loading V3 firmware does not need a quirk anymore, remove the leftover code.
--- drivers/usb/host/xhci-rcar.c | 3 --- 1 file changed, 3 deletions(-)
drivers/usb/host/xhci-rcar.c +0 -3
@@ -80,7 +80,6 @@ MODULE_FIRMWARE(XHCI_RCAR_FIRMWARE_NAME_V3);/* For soc_device_attribute */ #define RCAR_XHCI_FIRMWARE_V2 BIT(0)/* FIRMWARE V2 */ -#define RCAR_XHCI_FIRMWARE_V3 BIT(1)/* FIRMWARE V3 */ static const struct soc_device_attribute rcar_quirks_match[] = { {
@@ -152,8 +151,6 @@ static int xhci_rcar_download_firmware(struct usb_hcd *hcd)if (quirks &RCAR_XHCI_FIRMWARE_V2 ) firmware_name =XHCI_RCAR_FIRMWARE_NAME_V2 ; -else if (quirks &RCAR_XHCI_FIRMWARE_V3 ) - firmware_name =XHCI_RCAR_FIRMWARE_NAME_V3 ;else firmware_name = priv->firmware_name;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 489/694 usb: dwc3: gadget: Change condition for processing suspend event
In reply to Greg Kroah-HartmanFrom: Prashanth K <[email protected]>
[ Upstream commit 4decf4060ecfee1f7a710999fcd421645ac0c419 ]
Currently we process the suspend interrupt event only if the device is in configured state. Consider a case where device is not configured and got suspend interrupt, in that case our gadget will still use 100mA as composite_suspend didn't happen. But battery charging specification (BC1.2) expects a downstream device to draw less than 2.5mA when unconnected OR suspended.
Fix this by removing the condition for processing suspend event, and thus composite_resume would set vbus draw to 2.
--- drivers/usb/dwc3/gadget.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-)
drivers/usb/dwc3/gadget.c +2 -9
@@ -4262,15 +4262,8 @@ static void dwc3_gadget_interrupt(struct dwc3 *dwc,break ;case DWC3_DEVICE_EVENT_SUSPEND :/* It changed to be suspend event for version 2.30a and above */ - if (!DWC3_VER_IS_PRIOR(DWC3, 230A)) { -/* -* Ignore suspend event until the gadget enters into -* USB_STATE_CONFIGURED state. -*/ -if (dwc->gadget->state >=USB_STATE_CONFIGURED ) -dwc3_gadget_suspend_interrupt (dwc, - event->event_info); - } + if (!DWC3_VER_IS_PRIOR(DWC3, 230A)) +dwc3_gadget_suspend_interrupt (dwc, event->event_info);break ;case DWC3_DEVICE_EVENT_SOF :case DWC3_DEVICE_EVENT_ERRATIC_ERROR :
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 490/694 serial: stm32: Re-assert RTS/DE GPIO in RS485 mode only if more data are transmitted
In reply to Greg Kroah-HartmanFrom: Marek Vasut <[email protected]>
[ Upstream commit c47527cbcc3c50800f34b8c684f29721f75de246 ]
The stm32_usart_transmit_chars() may be called with empty or stopped transmit queue, and no XON/OFF character pending. This can happen at the end of transmission, where this last call is used to either handle the XON/XOFF x_char, or disable TX interrupt if queue is empty or stopped.
If that occurs, do not assert the RS485 RTS/DE GPIO anymore, as the GPIO would remain asserted past the end of transmission and that would block the RS485 bus after the transmission.
Only assert the RS485 RTS/DE GPIO if there is either pending XON/XOFF x_char, or at least one character in running transmit queue.
--- drivers/tty/serial/stm32-usart.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/tty/serial/stm32-usart.c +3 -2
@@ -693,8 +693,9 @@ static void stm32_usart_transmit_chars(struct uart_port *port)int ret;if (!stm32_port->hw_flow_control && - port->rs485.flags &SER_RS485_ENABLED ) { - stm32_port->txdone = false; + port->rs485.flags &SER_RS485_ENABLED && + (port->x_char || + !(uart_circ_empty (xmit) ||uart_tx_stopped (port)))) {stm32_usart_tc_interrupt_disable (port);stm32_usart_rs485_rts_enable (port); }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 491/694 fpga: bridge: fix kernel-doc parameter description
In reply to Greg Kroah-HartmanFrom: Marco Pagani <[email protected]>
[ Upstream commit 7ef1a2c1c9dffa177ecc3ea50b7f5ee63a621137 ]
Fix the kernel-doc description for the "struct fpga_image_info *info" parameter of the fpga_bridge_get() function.
--- drivers/fpga/fpga-bridge.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/fpga/fpga-bridge.c +1 -1
@@ -115,7 +115,7 @@ static int fpga_bridge_dev_match(struct device *dev, const void *data)/** * fpga_bridge_get - get an exclusive reference to an fpga bridge * @dev: parent device that fpga bridge was registered with -* @info: fpga manager info +* @info: fpga image specific information * * Given a device, get an exclusive reference to an fpga bridge. *
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 492/694 iommufd/selftest: Catch overflow of uptr and length
In reply to Greg Kroah-HartmanFrom: Jason Gunthorpe <[email protected]>
[ Upstream commit fd8c1a4aee973e87d890a5861e106625a33b2c4e ]
syzkaller hits a WARN_ON when trying to have a uptr close to UINTPTR_MAX:
WARNING: CPU: 1 PID: 393 at drivers/iommu/iommufd/selftest.c:403 iommufd_test+0xb19/0x16f0 Modules linked in: CPU: 1 PID: 393 Comm: repro Not tainted 6.2.0-c9c3395d5e3d #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org 04/01/2014 RIP: 0010:iommufd_test+0xb19/0x16f0 Code: 94 c4 31 ff 44 89 e6 e8 a5 54 17 ff 45 84 e4 0f 85 bb 0b 00 00 41 be fb ff ff ff e8 31 53 17 ff e9 a0 f7 ff ff e8 27 53 17 ff <0f> 0b 41 be 8 RSP: 0018:ffffc90000eabdc0 EFLAGS: 00010246 RAX: 0000000000000000 RBX: 0000000000000000 RCX: ffffffff8214c487 RDX: 0000000000000000 RSI: ffff88800f5c8000 RDI: 0000000000000002 RBP: ffffc90000eabe48 R08: 0000000000000000 R09: 0000000000000001 R10: 0000000000000001 R11: 0000000000000000 R12: 00000000cd2b0000 R13: 00000000cd2af000 R14: 0000000000000000 R15: ffffc90000eabe68 FS: 00007f94d76d5740(0000) GS:ffff88807dd00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000020000043 CR3: 0000000006880006 CR4: 0000000000770ee0 PKRU: 55555554 Call Trace: <TASK> ? write_comp_data+0x2f/0x90 iommufd_fops_ioctl+0x1ef/0x310 __x64_sys_ioctl+0x10e/0x160 ? __pfx_iommufd_fops_ioctl+0x10/0x10 do_syscall_64+0x3b/0x90 entry_SYSCALL_64_after_hwframe+0x72/0xdc
Check that the user memory range doesn't overflow.
--- drivers/iommu/iommufd/selftest.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/iommu/iommufd/selftest.c +7 -2
@@ -339,10 +339,12 @@ static int iommufd_test_md_check_pa(struct iommufd_ucmd *ucmd, {struct iommufd_hw_pagetable *hwpt;struct mock_iommu_domain *mock; +uintptr_t end;int rc;if (iova %MOCK_IO_PAGE_SIZE || length %MOCK_IO_PAGE_SIZE || - (uintptr_t )uptr %MOCK_IO_PAGE_SIZE ) + (uintptr_t )uptr %MOCK_IO_PAGE_SIZE || +check_add_overflow ((uintptr_t )uptr, (uintptr_t )length, &end))return -EINVAL ; hwpt =get_md_pagetable (ucmd, mockpt_id, &mock);
@@ -390,7 +392,10 @@ static int iommufd_test_md_check_refs(struct iommufd_ucmd *ucmd, void __user *uptr, size_t length, unsigned int refs) { - if (length % PAGE_SIZE || (uintptr_t)uptr % PAGE_SIZE) + uintptr_t end; + +if (length %PAGE_SIZE || (uintptr_t )uptr %PAGE_SIZE || +check_add_overflow ((uintptr_t )uptr, (uintptr_t )length, &end))return -EINVAL ;for (; length; length -=PAGE_SIZE ) {
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 493/694 iio: light: max44009: add missing OF device matching
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit b29c49026c3c05a11f845dba17cad0b3ba06836d ]
The driver currently matches only via i2c_device_id, but also has of_device_id table:
drivers/iio/light/max44009.c:545:34: error: ‘max44009_of_match’ defined but not used [-Werror=unused-const-variable=]
--- drivers/iio/light/max44009.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/iio/light/max44009.c +7 -6
@@ -527,6 +527,12 @@ static int max44009_probe(struct i2c_client *client)return devm_iio_device_register (&client->dev, indio_dev); } +static const struct of_device_id max44009_of_match[] = { + { .compatible ="maxim,max44009" }, + { } +}; +MODULE_DEVICE_TABLE (of, max44009_of_match); +static const struct i2c_device_id max44009_id[] = { {"max44009" ,0 }, { }
@@ -536,18 +542,13 @@ MODULE_DEVICE_TABLE(i2c, max44009_id);static struct i2c_driver max44009_driver = { .driver = { .name =MAX44009_DRV_NAME , + .of_match_table = max44009_of_match, }, .probe_new = max44009_probe, .id_table = max44009_id, };module_i2c_driver (max44009_driver); -static const struct of_device_id max44009_of_match[] = { - { .compatible ="maxim,max44009" }, - { } -}; -MODULE_DEVICE_TABLE (of, max44009_of_match); -MODULE_AUTHOR ("Robert Eshleman <[email protected]>" );MODULE_LICENSE ("GPL v2" );MODULE_DESCRIPTION ("MAX44009 ambient light sensor driver" );
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 494/694 spi: Constify spi parameters of chip select APIs
In reply to Greg Kroah-HartmanFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit d2f19eec510424caa55ea949f016ddabe2d8173a ]
The "spi" parameters of spi_get_chipselect() and spi_get_csgpiod() can be const.
--- include/linux/spi/spi.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
include/linux/spi/spi.h +2 -2
@@ -266,7 +266,7 @@ static inline void *spi_get_drvdata(struct spi_device *spi)return dev_get_drvdata (&spi->dev); } -static inline u8 spi_get_chipselect (struct spi_device *spi,u8 idx) +static inline u8 spi_get_chipselect (const struct spi_device *spi,u8 idx) {return spi->chip_select; }
@@ -276,7 +276,7 @@ static inline void spi_set_chipselect(struct spi_device *spi, u8 idx, u8 chipsel spi->chip_select = chipselect; } -static inline struct gpio_desc *spi_get_csgpiod (struct spi_device *spi,u8 idx) +static inline struct gpio_desc *spi_get_csgpiod (const struct spi_device *spi,u8 idx) {return spi->cs_gpiod; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 495/694 serial: 8250_bcm7271: Fix arbitration handling
In reply to Greg Kroah-HartmanFrom: Doug Berger <[email protected]>
[ Upstream commit 15ac1122fd6d4bf408a03e6f23c7ad4f60b22f9e ]
The arbitration of the UART DMA is mishandled for a few exceptional cases when probing and releasing the driver.
It is possible that the DMA register spaces are not defined in device tree for an instance of the driver, so attempts to access the registers in brcmuart_arbitration() would use NULL pointers.
It is also possible for the probe function to return an error while still holding the UART DMA. This would prevent the UART DMA from being claimed by an instance that could use it.
These errors are addressed by only releasing the UART DMA if it is held by this instance (i.e. priv->dma_enabled == 1) and directing early error paths in probe to this common release_dma handling.
--- drivers/tty/serial/8250/8250_bcm7271.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)
drivers/tty/serial/8250/8250_bcm7271.c +12 -6
@@ -1014,14 +1014,16 @@ static int brcmuart_probe(struct platform_device *pdev)/* See if a Baud clock has been specified */ baud_mux_clk =of_clk_get_by_name (np,"sw_baud" );if (IS_ERR (baud_mux_clk)) { -if (PTR_ERR (baud_mux_clk) == -EPROBE_DEFER ) -return -EPROBE_DEFER ; +if (PTR_ERR (baud_mux_clk) == -EPROBE_DEFER ) { + ret = -EPROBE_DEFER ; + goto release_dma; + }dev_dbg (dev,"BAUD MUX clock not specified\n" ); }else {dev_dbg (dev,"BAUD MUX clock found\n" ); ret =clk_prepare_enable (baud_mux_clk);if (ret) -return ret; + goto release_dma; priv->baud_mux_clk = baud_mux_clk;init_real_clk_rates (dev, priv); clk_rate = priv->default_mux_rate;
@@ -1029,7 +1031,8 @@ static int brcmuart_probe(struct platform_device *pdev)if (clk_rate ==0 ) {dev_err (dev,"clock-frequency or clk not defined\n" ); -return -EINVAL ; + ret = -EINVAL ; + goto release_dma; }dev_dbg (dev,"DMA is %senabled\n" , priv->dma_enabled ?"" :"not " );
@@ -1116,7 +1119,9 @@ static int brcmuart_probe(struct platform_device *pdev)serial8250_unregister_port (priv->line); err:brcmuart_free_bufs (dev, priv); -brcmuart_arbitration (priv,0 ); +release_dma: +if (priv->dma_enabled) +brcmuart_arbitration (priv,0 );return ret; }
@@ -1128,7 +1133,8 @@ static int brcmuart_remove(struct platform_device *pdev)hrtimer_cancel (&priv->hrt);serial8250_unregister_port (priv->line);brcmuart_free_bufs (&pdev->dev, priv); -brcmuart_arbitration (priv,0 ); +if (priv->dma_enabled) +brcmuart_arbitration (priv,0 );return 0 ; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 496/694 spi: atmel-quadspi: Dont leak clk enable count in pm resume
In reply to Greg Kroah-HartmanFrom: Uwe Kleine-König <[email protected]>
[ Upstream commit c18bbac353ffed50be134b0a2a059a2bd540c503 ]
The pm resume call is supposed to enable two clocks. If the second enable fails the callback reports failure but doesn't undo the first enable.
So call clk_disable() for the first clock when clk_enable() for the second one fails.
--- drivers/spi/atmel-quadspi.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/spi/atmel-quadspi.c +5 -1
@@ -786,7 +786,11 @@ static int __maybe_unused atmel_qspi_runtime_resume(struct device *dev)if (ret)return ret; -return clk_enable (aq->qspick); + ret =clk_enable (aq->qspick); +if (ret) +clk_disable (aq->pclk); + +return ret; }static const struct dev_pm_ops __maybe_unused atmel_qspi_pm_ops = {
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 497/694 spi: atmel-quadspi: Free resources even if runtime resume failed in .remove()
In reply to Greg Kroah-HartmanFrom: Uwe Kleine-König <[email protected]>
[ Upstream commit 9448bc1dee65f86c0fe64d9dea8b410af0586886 ]
An early error exit in atmel_qspi_remove() doesn't prevent the device unbind. So this results in an spi controller with an unbound parent and unmapped register space (because devm_ioremap_resource() is undone). So using the remaining spi controller probably results in an oops.
Instead unregister the controller unconditionally and only skip hardware access and clk disable.
Also add a warning about resume failing and return zero unconditionally. The latter has the only effect to suppress a less helpful error message by the spi core.
--- drivers/spi/atmel-quadspi.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-)
drivers/spi/atmel-quadspi.c +17 -7
@@ -706,18 +706,28 @@ static int atmel_qspi_remove(struct platform_device *pdev)struct atmel_qspi *aq =spi_controller_get_devdata (ctrl);int ret; - ret =pm_runtime_resume_and_get (&pdev->dev); -if (ret <0 ) -return ret; -spi_unregister_controller (ctrl); -atmel_qspi_write (QSPI_CR_QSPIDIS , aq,QSPI_CR ); + + ret =pm_runtime_get_sync (&pdev->dev); +if (ret >=0 ) { +atmel_qspi_write (QSPI_CR_QSPIDIS , aq,QSPI_CR ); +clk_disable (aq->qspick); +clk_disable (aq->pclk); + }else { +/* +* atmel_qspi_runtime_{suspend,resume} just disable and enable +* the two clks respectively. So after resume failed these are +* off, and we skip hardware access and disabling these clks again. +*/ +dev_warn (&pdev->dev,"Failed to resume device on remove\n" ); + } + +clk_unprepare (aq->qspick); +clk_unprepare (aq->pclk);pm_runtime_disable (&pdev->dev);pm_runtime_put_noidle (&pdev->dev); -clk_disable_unprepare (aq->qspick); -clk_disable_unprepare (aq->pclk);return 0 ; }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 498/694 spi: imx: Dont skip cleanup in removes error path
In reply to Greg Kroah-HartmanFrom: Uwe Kleine-König <[email protected]>
[ Upstream commit 11951c9e3f364d7ae3b568a0e52c8335d43066b5 ]
Returning early in a platform driver's remove callback is wrong. In this case the dma resources are not released in the error path. this is never retried later and so this is a permanent leak. To fix this, only skip hardware disabling if waking the device fails.
--- drivers/spi/spi-imx.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
drivers/spi/spi-imx.c +5 -7
@@ -1856,13 +1856,11 @@ static int spi_imx_remove(struct platform_device *pdev)spi_unregister_controller (controller); - ret =pm_runtime_resume_and_get (spi_imx->dev); -if (ret <0 ) { -dev_err (spi_imx->dev,"failed to enable clock\n" ); -return ret; - } - -writel (0 , spi_imx->base +MXC_CSPICTRL ); + ret =pm_runtime_get_sync (spi_imx->dev); +if (ret >=0 ) +writel (0 , spi_imx->base +MXC_CSPICTRL ); +else +dev_warn (spi_imx->dev,"failed to enable clock, skip hw disable\n" );pm_runtime_dont_use_autosuspend (spi_imx->dev);pm_runtime_put_sync (spi_imx->dev);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 499/694 interconnect: qcom: drop obsolete OSM_L3/EPSS defines
In reply to Greg Kroah-HartmanFrom: Dmitry Baryshkov <[email protected]>
[ Upstream commit 4c4161b4c81b632fc29002c324e996cbb79894e7 ]
Since Qualcomm platforms have switched to the separate OSM_L3/EPSS driver, old related defines became unused. Drop them now.
--- drivers/interconnect/qcom/sc7180.h | 2 -- drivers/interconnect/qcom/sc7280.h | 2 -- drivers/interconnect/qcom/sc8180x.h | 2 -- drivers/interconnect/qcom/sdm845.h | 2 -- drivers/interconnect/qcom/sm8150.h | 2 -- drivers/interconnect/qcom/sm8250.h | 2 -- 6 files changed, 12 deletions(-)
drivers/interconnect/qcom/sc7180.h +0 -2
@@ -145,7 +145,5 @@#define SC7180_SLAVE_SERVICE_SNOC 134#define SC7180_SLAVE_QDSS_STM 135#define SC7180_SLAVE_TCU 136 -#define SC7180_MASTER_OSM_L3_APPS 137 -#define SC7180_SLAVE_OSM_L3 138#endif
drivers/interconnect/qcom/sc7280.h +0 -2
@@ -150,7 +150,5 @@#define SC7280_SLAVE_PCIE_1 139#define SC7280_SLAVE_QDSS_STM 140#define SC7280_SLAVE_TCU 141 -#define SC7280_MASTER_EPSS_L3_APPS 142 -#define SC7280_SLAVE_EPSS_L3 143#endif
drivers/interconnect/qcom/sc8180x.h +0 -2
@@ -168,8 +168,6 @@#define SC8180X_SLAVE_EBI_CH0_DISPLAY 158#define SC8180X_SLAVE_MNOC_SF_MEM_NOC_DISPLAY 159#define SC8180X_SLAVE_MNOC_HF_MEM_NOC_DISPLAY 160 -#define SC8180X_MASTER_OSM_L3_APPS 161 -#define SC8180X_SLAVE_OSM_L3 162#define SC8180X_MASTER_QUP_CORE_0 163#define SC8180X_MASTER_QUP_CORE_1 164
drivers/interconnect/qcom/sdm845.h +0 -2
@@ -136,7 +136,5 @@#define SDM845_SLAVE_SERVICE_SNOC 128#define SDM845_SLAVE_QDSS_STM 129#define SDM845_SLAVE_TCU 130 -#define SDM845_MASTER_OSM_L3_APPS 131 -#define SDM845_SLAVE_OSM_L3 132#endif /* __DRIVERS_INTERCONNECT_QCOM_SDM845_H__ */
drivers/interconnect/qcom/sm8150.h +0 -2
@@ -148,7 +148,5 @@#define SM8150_SLAVE_VSENSE_CTRL_CFG 137#define SM8150_SNOC_CNOC_MAS 138#define SM8150_SNOC_CNOC_SLV 139 -#define SM8150_MASTER_OSM_L3_APPS 140 -#define SM8150_SLAVE_OSM_L3 141#endif
drivers/interconnect/qcom/sm8250.h +0 -2
@@ -158,7 +158,5 @@#define SM8250_SLAVE_VSENSE_CTRL_CFG 147#define SM8250_SNOC_CNOC_MAS 148#define SM8250_SNOC_CNOC_SLV 149 -#define SM8250_MASTER_EPSS_L3_APPS 150 -#define SM8250_SLAVE_EPSS_L3 151#endif
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 500/694 interconnect: qcom: osm-l3: drop unuserd header inclusion
In reply to Greg Kroah-HartmanFrom: Dmitry Baryshkov <[email protected]>
[ Upstream commit f730038fe6a6de170268fd779b2c029aa70a928b ]
The commit 4529992c9474 ("interconnect: qcom: osm-l3: Use platform-independent node ids") made osm-l3 driver use platform-independent IDs, removing the need to include platform headers.
--- drivers/interconnect/qcom/osm-l3.c | 7 ------- 1 file changed, 7 deletions(-)
drivers/interconnect/qcom/osm-l3.c +0 -7
@@ -14,13 +14,6 @@#include <dt-bindings/interconnect/qcom,osm-l3.h> -#include "sc7180.h" -#include "sc7280.h" -#include "sc8180x.h" -#include "sdm845.h" -#include "sm8150.h" -#include "sm8250.h" -#define LUT_MAX_ENTRIES 40U#define LUT_SRC GENMASK(31, 30)#define LUT_L_VAL GENMASK(7, 0)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 501/694 spi: f_ospi: Add missing spi_mem_default_supports_op() helper
In reply to Greg Kroah-HartmanFrom: Kunihiko Hayashi <[email protected]>
[ Upstream commit bc43c5ec1a97772269785d19f62d32c91ac5fc36 ]
The .supports_op() callback function returns true by default after performing driver-specific checks. Therefore the driver cannot apply the buswidth in devicetree.
Call spi_mem_default_supports_op() helper to handle the buswidth in devicetree.
--- drivers/spi/spi-sn-f-ospi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spi-sn-f-ospi.c +1 -1
@@ -561,7 +561,7 @@ static bool f_ospi_supports_op(struct spi_mem *mem,if (!f_ospi_supports_op_width (mem, op))return false; -return true; +return spi_mem_default_supports_op (mem, op); }static int f_ospi_adjust_op_size (struct spi_mem *mem,struct spi_mem_op *op)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 502/694 module/decompress: Never use kunmap() for local un-mappings
In reply to Greg Kroah-HartmanFrom: Fabio M. De Francesco <[email protected]>
[ Upstream commit 3c17655ab13704582fe25e8ea3200a9b2f8bf20a ]
Use kunmap_local() to unmap pages locally mapped with kmap_local_page().
kunmap_local() must be called on the kernel virtual address returned by kmap_local_page(), differently from how we use kunmap() which instead expects the mapped page as its argument.
In module_zstd_decompress() we currently map with kmap_local_page() and unmap with kunmap(). This breaks the code and so it should be fixed.
--- kernel/module/decompress.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/module/decompress.c +1 -1
@@ -267,7 +267,7 @@ static ssize_t module_zstd_decompress(struct load_info *info, zstd_dec.size =PAGE_SIZE ; ret =zstd_decompress_stream (dstream, &zstd_dec, &zstd_buf); -kunmap (page); +kunmap_local (zstd_dec.dst); retval =zstd_get_error_code (ret);if (retval)break ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 503/694 usb: gadget: udc: renesas_usb3: Fix use after free bug in renesas_usb3_remove due to race condition
In reply to Greg Kroah-HartmanFrom: Zheng Wang <[email protected]>
[ Upstream commit 2b947f8769be8b8181dc795fd292d3e7120f5204 ]
In renesas_usb3_probe, role_work is bound with renesas_usb3_role_work. renesas_usb3_start will be called to start the work.
If we remove the driver which will call usbhs_remove, there may be an unfinished work. The possible sequence is as follows:
CPU0 CPU1
renesas_usb3_role_workrenesas_usb3_removeusb_role_switch_unregisterdevice_unregister
kfree(sw)
//free usb3->role_sw
usb_role_switch_set_role
//use usb3->role_swThe usb3->role_sw could be freed under such circumstance and then used in usb_role_switch_set_role.
This bug was found by static analysis. And note that removing a driver is a root-only operation, and should never happen in normal case. But the root user may directly remove the device which will also trigger the remove function.
Fix it by canceling the work before cleanup in the renesas_usb3_remove.
--- drivers/usb/gadget/udc/renesas_usb3.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/gadget/udc/renesas_usb3.c +1 -0
@@ -2661,6 +2661,7 @@ static int renesas_usb3_remove(struct platform_device *pdev)debugfs_remove_recursive (usb3->dentry);device_remove_file (&pdev->dev, &dev_attr_role); +cancel_work_sync (&usb3->role_work);usb_role_switch_unregister (usb3->role_sw);usb_del_gadget_udc (&usb3->gadget);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 504/694 ASoC: soc-compress: Inherit atomicity from DAI link for Compress FE
In reply to Greg Kroah-HartmanFrom: Daniel Baluta <[email protected]>
[ Upstream commit 37b58becc1cee4d591024f2056d7ffa99c6089e0 ]
After commit bbf7d3b1c4f40 ("ASoC: soc-pcm: align BE 'atomicity' with that of the FE") BE and FE atomicity must match.
In the case of Compress PCM there is a mismatch in atomicity between FE and BE and we get errors like this:
[ 36.434566] sai1-wm8960-hifi: dpcm_be_connect: FE is atomic but BE is nonatomic, invalid configuration [ 36.444278] PCM Deep Buffer: ASoC: can't connect SAI1.OUT
In order to fix this we must inherit the atomicity from DAI link associated with current PCM Compress FE.
--- sound/soc/soc-compress.c | 3 +++ 1 file changed, 3 insertions(+)
sound/soc/soc-compress.c +3 -0
@@ -622,6 +622,9 @@ int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num)return ret; } +/* inherit atomicity from DAI link */ + be_pcm->nonatomic = rtd->dai_link->nonatomic; + rtd->pcm = be_pcm; rtd->fe_compr =1 ;if (rtd->dai_link->dpcm_playback)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 505/694 PCI: imx6: Install the fault handler only on compatible match
In reply to Greg Kroah-HartmanFrom: H. Nikolaus Schaller <[email protected]>
[ Upstream commit 5f5ac460dfe7f4e11f99de9870f240e39189cf72 ]
commit bb38919ec56e ("PCI: imx6: Add support for i.MX6 PCIe controller") added a fault hook to this driver in the probe function. So it was only installed if needed.
commit bde4a5a00e76 ("PCI: imx6: Allow probe deferral by reset GPIO") moved it from probe to driver init which installs the hook unconditionally as soon as the driver is compiled into a kernel.
When this driver is compiled as a module, the hook is not registered until after the driver has been matched with a .compatible and loaded.
commit 415b6185c541 ("PCI: imx6: Fix config read timeout handling") extended the fault handling code.
commit 2d8ed461dbc9 ("PCI: imx6: Add support for i.MX8MQ") added some protection for non-ARM architectures, but this does not protect non-i.MX ARM architectures.
Since fault handlers can be triggered on any architecture for different reasons, there is no guarantee that they will be triggered only for the assumed situation, leading to improper error handling (i.MX6-specific imx6q_pcie_abort_handler) on foreign systems.
I had seen strange L3 imprecise external abort messages several times on OMAP4 and OMAP5 devices and couldn't make sense of them until I realized they were related to this unused imx6q driver because I had CONFIG_PCI_IMX6=y.
Note that CONFIG_PCI_IMX6=y is useful for kernel binaries that are designed to run on different ARM SoC and be differentiated only by device tree binaries. So turning off CONFIG_PCI_IMX6 is not a solution.
Therefore we check the compatible in the init function before registering the fault handler.
--- drivers/pci/controller/dwc/pci-imx6.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/pci/controller/dwc/pci-imx6.c +7 -0
@@ -1566,6 +1566,13 @@ DECLARE_PCI_FIXUP_CLASS_HEADER(PCI_VENDOR_ID_SYNOPSYS, 0xabcd,static int __init imx6_pcie_init (void ) {#ifdef CONFIG_ARM +struct device_node *np; + + np =of_find_matching_node (NULL , imx6_pcie_of_match); +if (!np) +return -ENODEV ; +of_node_put (np); +/* * Since probe() can be deferred we need to make sure that * hook_fault_code is not called after __init memory is freed
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 506/694 ASoC: es8316: Handle optional IRQ assignment
In reply to Greg Kroah-HartmanFrom: Cristian Ciocaltea <[email protected]>
[ Upstream commit 39db65a0a17b54915b269d3685f253a4731f344c ]
The driver is able to work fine without relying on a mandatory interrupt being assigned to the I2C device. This is only needed when making use of the jack-detect support.
However, the following warning message is always emitted when there is no such interrupt available:
es8316 0-0011: Failed to get IRQ 0: -22
Do not attempt to request an IRQ if it is not available/valid. This also ensures the rather misleading message is not displayed anymore.
Also note the IRQ validation relies on commit dab472eb931bc291 ("i2c /
ACPI: Use 0 to indicate that device does not have interrupt assigned").
--- sound/soc/codecs/es8316.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
sound/soc/codecs/es8316.c +8 -6
@@ -842,12 +842,14 @@ static int es8316_i2c_probe(struct i2c_client *i2c_client) es8316->irq = i2c_client->irq;mutex_init (&es8316->lock); - ret =devm_request_threaded_irq (dev, es8316->irq,NULL , es8316_irq, -IRQF_TRIGGER_HIGH |IRQF_ONESHOT |IRQF_NO_AUTOEN , -"es8316" , es8316); -if (ret) { -dev_warn (dev,"Failed to get IRQ %d: %d\n" , es8316->irq, ret); - es8316->irq = -ENXIO ; +if (es8316->irq >0 ) { + ret =devm_request_threaded_irq (dev, es8316->irq,NULL , es8316_irq, +IRQF_TRIGGER_HIGH |IRQF_ONESHOT |IRQF_NO_AUTOEN , +"es8316" , es8316); +if (ret) { +dev_warn (dev,"Failed to get IRQ %d: %d\n" , es8316->irq, ret); + es8316->irq = -ENXIO ; + } } return devm_snd_soc_register_component(&i2c_client->dev,
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 507/694 linux/vt_buffer.h: allow either builtin or modular for macros
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit 2b76ffe81e32afd6d318dc4547e2ba8c46207b77 ]
Fix build errors on ARCH=alpha when CONFIG_MDA_CONSOLE=m. This allows the ARCH macros to be the only ones defined.
In file included from ../drivers/video/console/mdacon.c:37:../arch/alpha/include/asm/vga.h:17:40: error: expected identifier or '(' before 'volatile'
17 | static inline void scr_writew(u16 val, volatile u16 *addr)
| ^~~~~~~~../include/linux/vt_buffer.h:24:34: note: in definition of macro 'scr_writew'
24 | #define scr_writew(val, addr) (*(addr) = (val))
| ^~~~../include/linux/vt_buffer.h:24:40: error: expected ')' before '=' token
24 | #define scr_writew(val, addr) (*(addr) = (val))
| ^../arch/alpha/include/asm/vga.h:17:20: note: in expansion of macro 'scr_writew'
17 | static inline void scr_writew(u16 val, volatile u16 *addr)
| ^~~~~~~~~~
../arch/alpha/include/asm/vga.h:25:29: error: expected identifier or '(' before 'volatile'
25 | static inline u16 scr_readw(volatile const u16 *addr)
| ^~~~~~~~
--- include/linux/vt_buffer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/vt_buffer.h +1 -1
@@ -16,7 +16,7 @@#include <linux/string.h> -#if defined(CONFIG_VGA_CONSOLE ) || defined(CONFIG_MDA_CONSOLE ) +#if IS_ENABLED (CONFIG_VGA_CONSOLE ) ||IS_ENABLED (CONFIG_MDA_CONSOLE )#include <asm/vga.h> #endif
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 508/694 dt-bindings: serial: snps-dw-apb-uart: correct number of DMAs
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit dedd376e0c7096daf4171d54957a679b4dfeadbf ]
The "minItems" alone does not impose any upper limit of DMAs, so switch it to "maxItems" which also implies same value for minItems.
--- Documentation/devicetree/bindings/serial/snps-dw-apb-uart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/devicetree/bindings/serial/snps-dw-apb-uart.yaml +1 -1
@@ -68,7 +68,7 @@ properties: - const: apb_pclk dmas: - minItems: 2 + maxItems: 2 dma-names: items:
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 509/694 spi: qup: Dont skip cleanup in removes error path
In reply to Greg Kroah-HartmanFrom: Uwe Kleine-König <[email protected]>
[ Upstream commit 61f49171a43ab1f80c73c5c88c508770c461e0f2 ]
Returning early in a platform driver's remove callback is wrong. In this case the dma resources are not released in the error path. this is never retried later and so this is a permanent leak. To fix this, only skip hardware disabling if waking the device fails.
--- drivers/spi/spi-qup.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-)
drivers/spi/spi-qup.c +13 -9
@@ -1277,18 +1277,22 @@ static int spi_qup_remove(struct platform_device *pdev)struct spi_qup *controller =spi_master_get_devdata (master);int ret; - ret =pm_runtime_resume_and_get (&pdev->dev); -if (ret <0 ) -return ret; + ret =pm_runtime_get_sync (&pdev->dev); - ret =spi_qup_set_state (controller,QUP_STATE_RESET ); -if (ret) -return ret; +if (ret >=0 ) { + ret =spi_qup_set_state (controller,QUP_STATE_RESET ); +if (ret) +dev_warn (&pdev->dev,"failed to reset controller (%pe)\n" , +ERR_PTR (ret)); -spi_qup_release_dma (master); +clk_disable_unprepare (controller->cclk); +clk_disable_unprepare (controller->iclk); + }else { +dev_warn (&pdev->dev,"failed to resume, skip hw disable (%pe)\n" , +ERR_PTR (ret)); + } -clk_disable_unprepare (controller->cclk); -clk_disable_unprepare (controller->iclk); +spi_qup_release_dma (master);pm_runtime_put_noidle (&pdev->dev);pm_runtime_disable (&pdev->dev);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 510/694 interconnect: qcom: rpm: drop bogus pm domain attach
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
[ Upstream commit 72b2720c18ecde92e6a36c4ac897dd5848e3f379 ]
Any power domain would already have been attached by the platform bus code so drop the bogus power domain attach which always succeeds from probe.
This effectively reverts commit 7de109c0abe9 ("interconnect: icc-rpm:
Add support for bus power domain").
--- drivers/interconnect/qcom/icc-rpm.c | 7 ------- drivers/interconnect/qcom/icc-rpm.h | 1 - drivers/interconnect/qcom/msm8996.c | 1 - 3 files changed, 9 deletions(-)
drivers/interconnect/qcom/icc-rpm.c +0 -7
@@ -11,7 +11,6 @@#include <linux/of_device.h> #include <linux/of_platform.h> #include <linux/platform_device.h> -#include <linux/pm_domain.h> #include <linux/regmap.h> #include <linux/slab.h>
@@ -496,12 +495,6 @@ int qnoc_probe(struct platform_device *pdev)if (ret)return ret; -if (desc->has_bus_pd) { - ret =dev_pm_domain_attach (dev, true); -if (ret) -return ret; - } - provider = &qp->provider; provider->dev = dev; provider->set = qcom_icc_set;
drivers/interconnect/qcom/icc-rpm.h +0 -1
@@ -91,7 +91,6 @@ struct qcom_icc_desc {size_t num_nodes;const char *const *clocks;size_t num_clocks; -bool has_bus_pd;enum qcom_icc_type type;const struct regmap_config *regmap_cfg;unsigned int qos_offset;
drivers/interconnect/qcom/msm8996.c +0 -1
@@ -1823,7 +1823,6 @@ static const struct qcom_icc_desc msm8996_a0noc = { .num_nodes = ARRAY_SIZE(a0noc_nodes), .clocks = bus_a0noc_clocks, .num_clocks = ARRAY_SIZE(bus_a0noc_clocks), - .has_bus_pd = true, .regmap_cfg = &msm8996_a0noc_regmap_config };
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 511/694 spi: mchp-pci1xxxx: Fix length of SPI transactions not set properly in driver
In reply to Greg Kroah-HartmanFrom: Tharun Kumar P <[email protected]>
[ Upstream commit 35c8c5e503a82e0a4bf251d32096211eba8c2be6 ]
In pci1xxxx_spi_transfer_one API, length of SPI transaction gets cleared by setting of length mask. Set length of transaction only after masking length field.
--- drivers/spi/spi-pci1xxxx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/spi/spi-pci1xxxx.c +2 -1
@@ -199,8 +199,9 @@ static int pci1xxxx_spi_transfer_one(struct spi_controller *spi_ctlr,else regval &= ~SPI_MST_CTL_MODE_SEL ; - regval |= ((clkdiv <<5 ) |SPI_FORCE_CE | (len <<8 )); + regval |= ((clkdiv <<5 ) |SPI_FORCE_CE ); regval &= ~SPI_MST_CTL_CMD_LEN_MASK ; + regval |= (len <<8 );writel (regval, par->reg_base +SPI_MST_CTL_REG_OFFSET (p->hw_inst)); regval = readl(par->reg_base +
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 512/694 spi: mchp-pci1xxxx: Fix SPI transactions not working after suspend and resume
In reply to Greg Kroah-HartmanFrom: Tharun Kumar P <[email protected]>
[ Upstream commit 4266d21669de62cf3fb6774f7d404c1eb95a5ab3 ]
pci1xxxx_spi_resume API masks SPI interrupt bit which prohibits interrupt from coming to the host at the end of the transaction after suspend-resume. This patch unmasks this bit at resume.
--- drivers/spi/spi-pci1xxxx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spi-pci1xxxx.c +1 -1
@@ -58,7 +58,7 @@#define VENDOR_ID_MCHP 0x1055#define SPI_SUSPEND_CONFIG 0x101 -#define SPI_RESUME_CONFIG 0x303 +#define SPI_RESUME_CONFIG 0x203struct pci1xxxx_spi_internal {u8 hw_inst;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 513/694 spi: mpc5xxx-psc: Remove unused platform_data
In reply to Greg Kroah-HartmanFrom: Rob Herring <[email protected]>
[ Upstream commit 04725901d9933b3134e6dee6b5bc1efb67f8d43f ]
The platform_data for the MPC5xxx PSC SPI controllers is never used, so remove it and the resulting code which depends on it.
Stable-dep-of: 45d2af82e0e6 ("spi: mchp-pci1xxxx: Fix improper implementation of disabling chip select lines")
--- drivers/spi/spi-mpc512x-psc.c | 28 ++++--------------------- drivers/spi/spi-mpc52xx-psc.c | 39 +++-------------------------------- 2 files changed, 7 insertions(+), 60 deletions(-)
drivers/spi/spi-mpc512x-psc.c +4 -24
@@ -22,7 +22,6 @@#include <linux/delay.h> #include <linux/clk.h> #include <linux/spi/spi.h> -#include <linux/fsl_devices.h> #include <asm/mpc52xx_psc.h> enum {
@@ -51,8 +50,6 @@ enum { __ret; })struct mpc512x_psc_spi { -void (*cs_control)(struct spi_device *spi,bool on); -/* driver internal data */ int type;void __iomem *psc;
@@ -128,26 +125,16 @@ static void mpc512x_psc_spi_activate_cs(struct spi_device *spi) mps->bits_per_word = cs->bits_per_word;if (spi->cs_gpiod) { -if (mps->cs_control) -/* boardfile override */ - mps->cs_control (spi, (spi->mode &SPI_CS_HIGH ) ?1 :0 ); -else -/* gpiolib will deal with the inversion */ -gpiod_set_value (spi->cs_gpiod,1 ); +/* gpiolib will deal with the inversion */ +gpiod_set_value (spi->cs_gpiod,1 ); } }static void mpc512x_psc_spi_deactivate_cs (struct spi_device *spi) { -struct mpc512x_psc_spi *mps =spi_master_get_devdata (spi->master); -if (spi->cs_gpiod) { -if (mps->cs_control) -/* boardfile override */ - mps->cs_control (spi, (spi->mode &SPI_CS_HIGH ) ?0 :1 ); -else -/* gpiolib will deal with the inversion */ -gpiod_set_value (spi->cs_gpiod,0 ); +/* gpiolib will deal with the inversion */ +gpiod_set_value (spi->cs_gpiod,0 ); } }
@@ -474,7 +461,6 @@ static irqreturn_t mpc512x_psc_spi_isr(int irq, void *dev_id)static int mpc512x_psc_spi_do_probe (struct device *dev,u32 regaddr,u32 size,unsigned int irq) { -struct fsl_spi_platform_data *pdata =dev_get_platdata (dev);struct mpc512x_psc_spi *mps;struct spi_master *master;int ret;
@@ -490,12 +476,6 @@ static int mpc512x_psc_spi_do_probe(struct device *dev, u32 regaddr, mps->type = (int )of_device_get_match_data (dev); mps->irq = irq; -if (pdata) { - mps->cs_control = pdata->cs_control; - master->bus_num = pdata->bus_num; - master->num_chipselect = pdata->max_chipselect; - } - master->mode_bits =SPI_CPOL |SPI_CPHA |SPI_CS_HIGH |SPI_LSB_FIRST ; master->setup = mpc512x_psc_spi_setup; master->prepare_transfer_hardware = mpc512x_psc_spi_prep_xfer_hw;
drivers/spi/spi-mpc52xx-psc.c +3 -36
@@ -18,7 +18,6 @@#include <linux/io.h> #include <linux/delay.h> #include <linux/spi/spi.h> -#include <linux/fsl_devices.h> #include <linux/slab.h> #include <linux/of_irq.h>
@@ -28,10 +27,6 @@#define MCLK 20000000/* PSC port MClk in hz */ struct mpc52xx_psc_spi { -/* fsl_spi_platform data */ -void (*cs_control)(struct spi_device *spi,bool on); -u32 sysclk; -/* driver internal data */ struct mpc52xx_psc __iomem *psc;struct mpc52xx_psc_fifo __iomem *fifo;
@@ -101,17 +96,6 @@ static void mpc52xx_psc_spi_activate_cs(struct spi_device *spi) ccr |= (MCLK /1000000 -1 ) &0xFF ;out_be16 ((u16 __iomem *)&psc->ccr, ccr); mps->bits_per_word = cs->bits_per_word; - -if (mps->cs_control) - mps->cs_control (spi, (spi->mode &SPI_CS_HIGH ) ?1 :0 ); -} - -static void mpc52xx_psc_spi_deactivate_cs (struct spi_device *spi) -{ -struct mpc52xx_psc_spi *mps =spi_master_get_devdata (spi->master); - -if (mps->cs_control) - mps->cs_control (spi, (spi->mode &SPI_CS_HIGH ) ?0 :1 ); }#define MPC52xx_PSC_BUFSIZE (MPC52xx_PSC_RFNUM_MASK + 1)
@@ -220,14 +204,9 @@ int mpc52xx_psc_spi_transfer_one_message(struct spi_controller *ctlr, m->actual_length += t->len;spi_transfer_delay_exec (t); - -if (cs_change) -mpc52xx_psc_spi_deactivate_cs (spi); } m->status = status; -if (status || !cs_change) -mpc52xx_psc_spi_deactivate_cs (spi);mpc52xx_psc_spi_transfer_setup (spi,NULL );
@@ -269,7 +248,7 @@ static int mpc52xx_psc_spi_port_config(int psc_id, struct mpc52xx_psc_spi *mps)int ret;/* default sysclk is 512MHz */ - mclken_div = (mps->sysclk ? mps->sysclk :512000000 ) /MCLK ; + mclken_div =512000000 /MCLK ; ret =mpc52xx_set_psc_clkdiv (psc_id, mclken_div);if (ret)return ret;
@@ -317,7 +296,6 @@ static irqreturn_t mpc52xx_psc_spi_isr(int irq, void *dev_id)static int mpc52xx_psc_spi_do_probe (struct device *dev,u32 regaddr,u32 size,unsigned int irq,s16 bus_num) { -struct fsl_spi_platform_data *pdata =dev_get_platdata (dev);struct mpc52xx_psc_spi *mps;struct spi_master *master;int ret;
@@ -333,19 +311,8 @@ static int mpc52xx_psc_spi_do_probe(struct device *dev, u32 regaddr, master->mode_bits =SPI_CPOL |SPI_CPHA |SPI_CS_HIGH |SPI_LSB_FIRST ; mps->irq = irq; -if (pdata ==NULL ) { -dev_warn (dev, -"probe called without platform data, no cs_control function will be called\n" ); - mps->cs_control =NULL ; - mps->sysclk =0 ; - master->bus_num = bus_num; - master->num_chipselect =255 ; - }else { - mps->cs_control = pdata->cs_control; - mps->sysclk = pdata->sysclk; - master->bus_num = pdata->bus_num; - master->num_chipselect = pdata->max_chipselect; - } + master->bus_num = bus_num; + master->num_chipselect =255 ; master->setup = mpc52xx_psc_spi_setup; master->transfer_one_message = mpc52xx_psc_spi_transfer_one_message; master->cleanup = mpc52xx_psc_spi_cleanup;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 514/694 spi: mchp-pci1xxxx: Fix improper implementation of disabling chip select lines
In reply to Greg Kroah-HartmanFrom: Tharun Kumar P <[email protected]>
[ Upstream commit 45d2af82e0e6f662d0d0db20993b35cb1d8da646 ]
Hardware does not have support to disable individual chip select lines. Disable all chip select lines by using SPI_FORCE_CE bit.
--- drivers/spi/spi-pci1xxxx.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-)
drivers/spi/spi-pci1xxxx.c +5 -12
@@ -114,17 +114,14 @@ static void pci1xxxx_spi_set_cs(struct s/* Set the DEV_SEL bits of the SPI_MST_CTL_REG */ regval =readl (par->reg_base +SPI_MST_CTL_REG_OFFSET (p->hw_inst)); -if (enable) { +if (!enable) { + regval |=SPI_FORCE_CE ; regval &= ~SPI_MST_CTL_DEVSEL_MASK ; regval |= (spi->chip_select <<25 ); -writel (regval, - par->reg_base +SPI_MST_CTL_REG_OFFSET (p->hw_inst)); }else { - regval &= ~(spi->chip_select <<25 ); -writel (regval, - par->reg_base +SPI_MST_CTL_REG_OFFSET (p->hw_inst)); - + regval &= ~SPI_FORCE_CE ; } +writel (regval, par->reg_base +SPI_MST_CTL_REG_OFFSET (p->hw_inst)); }static u8 pci1xxxx_get_clock_div (u32 hz)
@@ -199,7 +196,7 @@ static int pci1xxxx_spi_transfer_one(strelse regval &= ~SPI_MST_CTL_MODE_SEL ; - regval |= ((clkdiv <<5 ) |SPI_FORCE_CE ); + regval |= (clkdiv <<5 ); regval &= ~SPI_MST_CTL_CMD_LEN_MASK ; regval |= (len <<8 ); writel(regval, par->reg_base +
@@ -223,10 +220,6 @@ static int pci1xxxx_spi_transfer_one(str } } } - - regval =readl (par->reg_base +SPI_MST_CTL_REG_OFFSET (p->hw_inst)); - regval &= ~SPI_FORCE_CE ; -writel (regval, par->reg_base +SPI_MST_CTL_REG_OFFSET (p->hw_inst)); p->spi_xfer_in_progress = false;return 0 ;
Greg Kroah-Hartman
maintainerPATCH 515/694 spi: fsl-spi: Fix CPM/QE mode Litte Endian
In reply to Greg Kroah-HartmanFrom: Christophe Leroy <[email protected]>
[ Upstream commit c20c57d9868d7f9fd1b2904c7801b07e128f6322 ]
CPM has the same problem as QE so for CPM also use the fix added by commit 0398fb70940e ("spi/spi_mpc8xxx: Fix QE mode Litte Endian"):
CPM mode uses Little Endian so words > 8 bits are byte swapped. Workaround this by always enforcing wordsize 8 for 16 and 32 bits words. Unfortunately this will not work for LSB transfers where wordsize is > 8 bits so disable these for now.
Also limit the workaround to 16 and 32 bits words because it can only work for multiples of 8-bits.
--- drivers/spi/spi-fsl-spi.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/spi/spi-fsl-spi.c +7 -5
@@ -181,8 +181,8 @@ static int mspi_apply_qe_mode_quirks(struct spi_mpc8xxx_cs *cs,struct spi_device *spi, int bits_per_word) { -/* QE uses Little Endian for words > 8 -* so transform all words > 8 into 8 bits +/* CPM/QE uses Little Endian for words > 8 +* so transform 16 and 32 bits words into 8 bits * Unfortnatly that doesn't work for LSB so * reject these for now */ /* Note: 32 bits word, LSB works iff
@@ -190,9 +190,11 @@ static int mspi_apply_qe_mode_quirks(struct spi_mpc8xxx_cs *cs,if (spi->mode &SPI_LSB_FIRST && bits_per_word >8 )return -EINVAL ; -if (bits_per_word >8 ) +if (bits_per_word <=8 ) +return bits_per_word; +if (bits_per_word ==16 || bits_per_word ==32 )return 8 ;/* pretend its 8 bits */ -return bits_per_word; +return -EINVAL ; } static int fsl_spi_setup_transfer(struct spi_device *spi,
@@ -222,7 +224,7 @@ static int fsl_spi_setup_transfer(struct spi_device *spi, bits_per_word =mspi_apply_cpu_mode_quirks (cs, spi, mpc8xxx_spi, bits_per_word); - else if (mpc8xxx_spi->flags & SPI_QE) + else bits_per_word =mspi_apply_qe_mode_quirks (cs, spi, bits_per_word);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 516/694 vmci_host: fix a race condition in vmci_host_poll() causing GPF
In reply to Greg Kroah-HartmanFrom: Dae R. Jeong <[email protected]>
[ Upstream commit ae13381da5ff0e8e084c0323c3cc0a945e43e9c7 ]
During fuzzing, a general protection fault is observed in vmci_host_poll().
general protection fault, probably for non-canonical address 0xdffffc0000000019: 0000 [#1] PREEMPT SMP KASAN KASAN: null-ptr-deref in range [0x00000000000000c8-0x00000000000000cf] RIP: 0010:__lock_acquire+0xf3/0x5e00 kernel/locking/lockdep.c:4926 <- omitting registers -> Call Trace: <TASK> lock_acquire+0x1a4/0x4a0 kernel/locking/lockdep.c:5672 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0xb3/0x100 kernel/locking/spinlock.c:162 add_wait_queue+0x3d/0x260 kernel/sched/wait.c:22 poll_wait include/linux/poll.h:49 [inline] vmci_host_poll+0xf8/0x2b0 drivers/misc/vmw_vmci/vmci_host.c:174 vfs_poll include/linux/poll.h:88 [inline] do_pollfd fs/select.c:873 [inline] do_poll fs/select.c:921 [inline] do_sys_poll+0xc7c/0x1aa0 fs/select.c:1015 __do_sys_ppoll fs/select.c:1121 [inline] __se_sys_ppoll+0x2cc/0x330 fs/select.c:1101 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x4e/0xa0 arch/x86/entry/common.c:82 entry_SYSCALL_64_after_hwframe+0x46/0xb0
Example thread interleaving that causes the general protection fault is as follows:
CPU1 (vmci_host_poll) CPU2 (vmci_host_do_init_context)
----- -----
// Read uninitialized context
context = vmci_host_dev->context;
// Initialize context
vmci_host_dev->context = vmci_ctx_create();
vmci_host_dev->ct_type = VMCIOBJ_CONTEXT;if (vmci_host_dev->ct_type == VMCIOBJ_CONTEXT) {
// Dereferencing the wrong pointer
poll_wait(..., &context->host_context);
}In this scenario, vmci_host_poll() reads vmci_host_dev->context first, and then reads vmci_host_dev->ct_type to check that vmci_host_dev->context is initialized. However, since these two reads are not atomically executed, there is a chance of a race condition as described above.
To fix this race condition, read vmci_host_dev->context after checking the value of vmci_host_dev->ct_type so that vmci_host_poll() always reads an initialized context.
--- drivers/misc/vmw_vmci/vmci_host.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/misc/vmw_vmci/vmci_host.c +7 -1
@@ -165,10 +165,16 @@ static int vmci_host_close(struct inode *inode, struct file *filp)static __poll_t vmci_host_poll (struct file *filp,poll_table *wait) {struct vmci_host_dev *vmci_host_dev = filp->private_data; -struct vmci_ctx *context = vmci_host_dev->context; +struct vmci_ctx *context;__poll_t mask =0 ;if (vmci_host_dev->ct_type ==VMCIOBJ_CONTEXT ) { +/* +* Read context only if ct_type == VMCIOBJ_CONTEXT to make +* sure that context is initialized +*/ + context = vmci_host_dev->context; +/* Check for VMCI calls to this VM context. */ if (wait) poll_wait(filp, &context->host_context.wait_queue,
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 517/694 of: Fix modalias string generation
In reply to Greg Kroah-HartmanFrom: Miquel Raynal <[email protected]>
[ Upstream commit b19a4266c52de78496fe40f0b37580a3b762e67d ]
The helper generating an OF based modalias (of_device_get_modalias()) works fine, but due to the use of snprintf() internally it needs a buffer one byte longer than what should be needed just for the entire string (excluding the '\0'). Most users of this helper are sysfs hooks providing the modalias string to users. They all provide a PAGE_SIZE buffer which is way above the number of bytes required to fit the modalias string and hence do not suffer from this issue.
There is another user though, of_device_request_module(), which is only called by drivers/usb/common/ulpi.c. This request module function is faulty, but maybe because in most cases there is an alternative, ULPI driver users have not noticed it.
In this function, of_device_get_modalias() is called twice. The first time without buffer just to get the number of bytes required by the modalias string (excluding the null byte), and a second time, after buffer allocation, to fill the buffer. The allocation asks for an additional byte, in order to store the trailing '\0'. However, the buffer *length* provided to of_device_get_modalias() excludes this extra byte. The internal use of snprintf() with a length that is exactly the number of bytes to be written has the effect of using the last available byte to store a '\0', which then smashes the last character of the modalias string.
Provide the actual size of the buffer to of_device_get_modalias() to fix this issue.
Note: the "str[size - 1] = '\0';" line is not really needed as snprintf will anyway end the string with a null byte, but there is a possibility that this function might be called on a struct device_node without compatible, in this case snprintf() would not be executed. So we keep it just to avoid possible unbounded strings.
--- drivers/of/device.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/of/device.c +5 -2
@@ -297,12 +297,15 @@ int of_device_request_module(struct device *dev)if (size <0 )return size; - str =kmalloc (size +1 ,GFP_KERNEL ); +/* Reserve an additional byte for the trailing '\0' */ + size++; + + str =kmalloc (size,GFP_KERNEL );if (!str)return -ENOMEM ;of_device_get_modalias (dev, str, size); - str[size] ='\0' ; + str[size -1 ] ='\0' ; ret =request_module (str);kfree (str);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 518/694 PCI/EDR: Clear Device Status after EDR error recovery
In reply to Greg Kroah-HartmanFrom: Kuppuswamy Sathyanarayanan <[email protected]>
[ Upstream commit c441b1e03da6c680a3e12da59c554f454f2ccf5e ]
During EDR recovery, the OS must clear error status of the port that triggered DPC even if firmware retains control of DPC and AER (see the implementation note in the PCI Firmware spec r3.3, sec 4.6.12).
Prior to 068c29a248b6 ("PCI/ERR: Clear PCIe Device Status errors only if OS owns AER"), the port Device Status was cleared in this path:
edr_handle_event
dpc_process_error(dev) # "dev" triggered DPC
pcie_do_recovery(dev, dpc_reset_link)
dpc_reset_link # exit DPC
pcie_clear_device_status(dev) # clear Device Status
After 068c29a248b6, pcie_do_recovery() no longer clears Device Status when firmware controls AER, so the error bit remains set even after recovery.
Per the "Downstream Port Containment configuration control" bit in the returned _OSC Control Field (sec 4.5.1), the OS is allowed to clear error status until it evaluates _OST, so clear Device Status in edr_handle_event() if the error recovery was successful.
--- drivers/pci/pcie/edr.c | 1 + 1 file changed, 1 insertion(+)
drivers/pci/pcie/edr.c +1 -0
@@ -193,6 +193,7 @@ static void edr_handle_event(acpi_handle handle, u32 event, void *data)*/ if (estate ==PCI_ERS_RESULT_RECOVERED ) {pci_dbg (edev,"DPC port successfully recovered\n" ); +pcie_clear_device_status (edev);acpi_send_edr_status (pdev, edev,EDR_OST_SUCCESS ); }else {pci_dbg (edev,"DPC port recovery failed\n" );
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 519/694 ia64: mm/contig: fix section mismatch warning/error
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit 58deeb4ef3b054498747d0929d94ac53ab90981f ]
alloc_per_cpu_data() is called by find_memory(), which is marked as __init. Therefore alloc_per_cpu_data() can also be marked as __init to remedy this modpost problem.
WARNING: modpost: vmlinux.o: section mismatch in reference: alloc_per_cpu_data (section: .text) -> memblock_alloc_try_nid (section: .init.text)
--- arch/ia64/mm/contig.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/ia64/mm/contig.c +1 -1
@@ -77,7 +77,7 @@ void *per_cpu_init(void)return __per_cpu_start + __per_cpu_offset[smp_processor_id ()]; } -static inline void +static inline __init void alloc_per_cpu_data (void ) {size_t size =PERCPU_PAGE_SIZE *num_possible_cpus ();
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 520/694 ia64: salinfo: placate defined-but-not-used warning
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit 0de155752b152d6bcd96b5b5bf20af336abd183a ]
When CONFIG_PROC_FS is not set, proc_salinfo_show() is not used. Mark the function as __maybe_unused to quieten the warning message.
../arch/ia64/kernel/salinfo.c:584:12: warning: 'proc_salinfo_show' defined but not used [-Wunused-function]
584 | static int proc_salinfo_show(struct seq_file *m, void *v)
| ^~~~~~~~~~~~~~~~~
--- arch/ia64/kernel/salinfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/ia64/kernel/salinfo.c +1 -1
@@ -581,7 +581,7 @@ static int salinfo_cpu_pre_down(unsigned int cpu)* 'data' contains an integer that corresponds to the feature we're * testing */ -static int proc_salinfo_show (struct seq_file *m,void *v) +static int __maybe_unused proc_salinfo_show (struct seq_file *m,void *v) {unsigned long data = (unsigned long )v;seq_puts (m, (sal_platform_features & data) ?"1\n" :"0\n" );
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 521/694 scripts/gdb: bail early if there are no clocks
In reply to Greg Kroah-HartmanFrom: Florian Fainelli <[email protected]>
[ Upstream commit 1d7adbc74c009057ed9dc3112f388e91a9c79acc ]
Avoid generating an exception if there are no clocks registered:
(gdb) lx-clk-summary
enable prepare protect
clock count count count rate
------------------------------------------------------------------------
Python Exception <class 'gdb.error'>: No symbol "clk_root_list" in current context.
Error occurred in Python: No symbol "clk_root_list" in current context.
--- scripts/gdb/linux/clk.py | 2 ++ 1 file changed, 2 insertions(+)
scripts/gdb/linux/clk.py +2 -0
@@ -41,6 +41,8 @@ are cached and potentially out of date""" self.show_subtree(child, level + 1) def invoke(self, arg, from_tty): + if utils.gdb_eval_or_none("clk_root_list") is None: + raise gdb.GdbError("No clocks registered") gdb.write(" enable prepare protect \n") gdb.write(" clock count count count rate \n") gdb.write("------------------------------------------------------------------------\n")
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 522/694 scripts/gdb: bail early if there are no generic PD
In reply to Greg Kroah-HartmanFrom: Florian Fainelli <[email protected]>
[ Upstream commit f19c3c2959e465209ade1a7a699e6cbf4359ce78 ]
Avoid generating an exception if there are no generic power domain(s) registered:
(gdb) lx-genpd-summary
domain status children
/device runtime status
----------------------------------------------------------------------
Python Exception <class 'gdb.error'>: No symbol "gpd_list" in current context. Error occurred in Python: No symbol "gpd_list" in current context. (gdb) quit
--- scripts/gdb/linux/genpd.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
scripts/gdb/linux/genpd.py +3 -1
@@ -5,7 +5,7 @@ import gdb import sys -from linux.utils import CachedType +from linux.utils import CachedType, gdb_eval_or_none from linux.lists import list_for_each_entry generic_pm_domain_type = CachedType('struct generic_pm_domain')
@@ -70,6 +70,8 @@ Output is similar to /sys/kernel/debug/pm_genpd/pm_genpd_summary''' gdb.write(' %-50s %s\n' % (kobj_path, rtpm_status_str(dev))) def invoke(self, arg, from_tty): + if gdb_eval_or_none("&gpd_list") is None: + raise gdb.GdbError("No power domain(s) registered") gdb.write('domain status children\n'); gdb.write(' /device runtime status\n'); gdb.write('----------------------------------------------------------------------\n');
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 523/694 ASoC: mediatek: common: Fix refcount leak in parse_dai_link_info
In reply to Greg Kroah-HartmanFrom: Aashish Sharma <[email protected]>
[ Upstream commit beed115c2ce78f990222a29abed042582df4e87c ]
Add missing of_node_put()s before the returns to balance of_node_get()s and of_node_put()s, which may get unbalanced in case the for loop 'for_each_available_child_of_node' returns early.
--- sound/soc/mediatek/common/mtk-soundcard-driver.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
sound/soc/mediatek/common/mtk-soundcard-driver.c +9 -3
@@ -47,20 +47,26 @@ int parse_dai_link_info(struct snd_soc_card *card)/* Loop over all the dai link sub nodes */ for_each_available_child_of_node (dev->of_node, sub_node) {if (of_property_read_string (sub_node,"link-name" , - &dai_link_name)) + &dai_link_name)) { +of_node_put (sub_node);return -EINVAL ; + }for_each_card_prelinks (card, i, dai_link) {if (!strcmp (dai_link_name, dai_link->name))break ; } -if (i >= card->num_links) +if (i >= card->num_links) { +of_node_put (sub_node);return -EINVAL ; + } ret =set_card_codec_info (card, sub_node, dai_link); -if (ret <0 ) +if (ret <0 ) { +of_node_put (sub_node);return ret; + } }return 0 ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 524/694 HID: amd_sfh: Correct the structure fields
In reply to Greg Kroah-HartmanFrom: Basavaraj Natikar <[email protected]>
[ Upstream commit 7e7fdab79899f62de39c9280fb78f3d3b02ac207 ]
Misinterpreted sfh_cmd_base structure member fields. Therefore, adjust the structure member fields accordingly to reflect functionality.
--- drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_interface.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_interface.h +3 -3
@@ -33,9 +33,9 @@ struct sfh_cmd_base {struct {u32 sensor_id :4 ;u32 cmd_id :4 ; -u32 sub_cmd_id :6 ; -u32 length :12 ; -u32 rsvd :5 ; +u32 sub_cmd_id :8 ; +u32 sub_cmd_value :12 ; +u32 rsvd :3 ;u32 intr_disable :1 ; } cmd; };
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 525/694 HID: amd_sfh: Correct the sensor enable and disable command
In reply to Greg Kroah-HartmanFrom: Basavaraj Natikar <[email protected]>
[ Upstream commit 0b9255bf11baa61cd526e6bd24d6c8e6d1eabf8d ]
In order to start or stop sensors, the firmware command needs to be changed to add an additional default subcommand value. For this reason, add a subcommand value to enable or disable sensors accordingly.
--- drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_interface.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_interface.c +2 -0
@@ -33,6 +33,7 @@ static void amd_start_sensor(struct amd_mp2_dev *privdata, struct amd_mp2_sensor cmd_base.ul =0 ; cmd_base.cmd.cmd_id =ENABLE_SENSOR ; cmd_base.cmd.intr_disable =0 ; + cmd_base.cmd.sub_cmd_value =1 ; cmd_base.cmd.sensor_id = info.sensor_idx;writel (cmd_base.ul, privdata->mmio +AMD_C2P_MSG (0 ));
@@ -45,6 +46,7 @@ static void amd_stop_sensor(struct amd_mp2_dev *privdata, u16 sensor_idx) cmd_base.ul =0 ; cmd_base.cmd.cmd_id =DISABLE_SENSOR ; cmd_base.cmd.intr_disable =0 ; + cmd_base.cmd.sub_cmd_value =1 ; cmd_base.cmd.sensor_id = sensor_idx;writeq (0x0 , privdata->mmio +AMD_C2P_MSG (1 ));
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 526/694 HID: amd_sfh: Fix illuminance value
In reply to Greg Kroah-HartmanFrom: Basavaraj Natikar <[email protected]>
[ Upstream commit a33e5e393171ae8384d3381db5cd159ba877cfcb ]
Illuminance value is actually 32 bits, but is incorrectly trancated to 16 bits. Hence convert to integer illuminace accordingly to reflect correct values.
--- drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_desc.c | 2 +- drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_interface.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_desc.c +1 -1
@@ -218,7 +218,7 @@ static u8 get_input_rep(u8 current_index, int sensor_idx, int report_id,OFFSET_SENSOR_DATA_DEFAULT ;memcpy_fromio (&als_data, sensoraddr,sizeof (struct sfh_als_data ));get_common_inputs (&als_input.common_property, report_id); - als_input.illuminance_value = als_data.lux; + als_input.illuminance_value =float_to_int (als_data.lux); report_size =sizeof (als_input);memcpy (input_report, &als_input,sizeof (als_input));break ;
drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_interface.h +1 -1
@@ -133,7 +133,7 @@ struct sfh_mag_data {struct sfh_als_data {struct sfh_common_data commondata; -u16 lux; +u32 lux; };struct hpd_status {
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 527/694 HID: amd_sfh: Add support for shutdown operation
In reply to Greg Kroah-HartmanFrom: Basavaraj Natikar <[email protected]>
[ Upstream commit 1353ecaf1830d6d1b74f3225378a9498b4e14fdd ]
As soon as the system is booted after shutdown, the sensors may remain in a weird state and fail to initialize. Therefore, all sensors should be turned off during shutdown.
--- drivers/hid/amd-sfh-hid/amd_sfh_pcie.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/hid/amd-sfh-hid/amd_sfh_pcie.c +9 -0
@@ -367,6 +367,14 @@ static int amd_mp2_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ireturn devm_add_action_or_reset (&pdev->dev, privdata->mp2_ops->remove, privdata); } +static void amd_sfh_shutdown (struct pci_dev *pdev) +{ +struct amd_mp2_dev *mp2 =pci_get_drvdata (pdev); + +if (mp2 && mp2->mp2_ops) + mp2->mp2_ops->stop_all (mp2); +} +static int __maybe_unused amd_mp2_pci_resume (struct device *dev) {struct amd_mp2_dev *mp2 =dev_get_drvdata (dev);
@@ -401,6 +409,7 @@ static struct pci_driver amd_mp2_pci_driver = { .id_table = amd_mp2_pci_tbl, .probe = amd_mp2_pci_probe, .driver.pm = &amd_mp2_pm_ops, + .shutdown = amd_sfh_shutdown, };module_pci_driver (amd_mp2_pci_driver);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 528/694 HID: amd_sfh: Correct the stop all command
In reply to Greg Kroah-HartmanFrom: Basavaraj Natikar <[email protected]>
[ Upstream commit 82c2a0d137794f5ef47982231593a00aee26ce3b ]
Misinterpreted the stop all command in SHF1.1 firmware. Therefore, it is necessary to update the stop all command accordingly to disable all sensors.
--- drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_interface.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_interface.c +3 -1
@@ -58,8 +58,10 @@ static void amd_stop_all_sensor(struct amd_mp2_dev *privdata)struct sfh_cmd_base cmd_base; cmd_base.ul =0 ; - cmd_base.cmd.cmd_id =STOP_ALL_SENSORS ; + cmd_base.cmd.cmd_id =DISABLE_SENSOR ; cmd_base.cmd.intr_disable =0 ; +/* 0xf indicates all sensors */ + cmd_base.cmd.sensor_id =0xf ;writel (cmd_base.ul, privdata->mmio +AMD_C2P_MSG (0 )); }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 529/694 HID: amd_sfh: Increase sensor command timeout for SFH1.1
In reply to Greg Kroah-HartmanFrom: Basavaraj Natikar <[email protected]>
[ Upstream commit 571dc8f59dd477037bb5a029e8d1b5a4a4d9dd63 ]
The initialization of SFH1.1 sensors may take some time. Hence, increase sensor command timeouts in order to obtain status responses within a maximum timeout.
--- drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_interface.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_interface.c +2 -2
@@ -16,11 +16,11 @@ static int amd_sfh_wait_response(struct amd_mp2_dev *mp2, u8 sid, u32 cmd_id) {struct sfh_cmd_response cmd_resp; -/* Get response with status within a max of 1600 ms timeout */ +/* Get response with status within a max of 10000 ms timeout */ if (!readl_poll_timeout (mp2->mmio +AMD_P2C_MSG (0 ), cmd_resp.resp, (cmd_resp.response.response ==0 && cmd_resp.response.cmd_id == cmd_id && (sid ==0xff || - cmd_resp.response.sensor_id == sid)),500 ,1600000 )) + cmd_resp.response.sensor_id == sid)),500 ,10000000 ))return cmd_resp.response.response;return -1 ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 530/694 HID: amd_sfh: Handle "no sensors" enabled for SFH1.1
In reply to Greg Kroah-HartmanFrom: Basavaraj Natikar <[email protected]>
[ Upstream commit 8455cbb25927013b3417ab619dced1c0e87708af ]
Based on num_hid_devices, each sensor device is initialized. If "no sensors" is initialized, amd_sfh work initialization and scheduling doesn’t make sense and returns EOPNOTSUPP to stop driver probe. Hence, add a check for "no sensors" enabled to handle the special case.
--- drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c +11 -0
@@ -112,6 +112,7 @@ static int amd_sfh1_1_hid_client_init(struct amd_mp2_dev *privdata) cl_data->num_hid_devices =amd_sfh_get_sensor_num (privdata, &cl_data->sensor_idx[0 ]);if (cl_data->num_hid_devices ==0 )return -ENODEV ; + cl_data->is_any_sensor_enabled = false;INIT_DELAYED_WORK (&cl_data->work, amd_sfh_work);INIT_DELAYED_WORK (&cl_data->work_buffer, amd_sfh_work_buffer);
@@ -170,6 +171,7 @@ static int amd_sfh1_1_hid_client_init(struct amd_mp2_dev *privdata) status = (status ==0 ) ?SENSOR_ENABLED :SENSOR_DISABLED ;if (status ==SENSOR_ENABLED ) { + cl_data->is_any_sensor_enabled = true; cl_data->sensor_sts[i] =SENSOR_ENABLED ; rc =amdtp_hid_probe (i, cl_data);if (rc) {
@@ -186,12 +188,21 @@ static int amd_sfh1_1_hid_client_init(struct amd_mp2_dev *privdata) cl_data->sensor_sts[i]); goto cleanup; } + }else { + cl_data->sensor_sts[i] =SENSOR_DISABLED ; }dev_dbg (dev,"sid 0x%x (%s) status 0x%x\n" , cl_data->sensor_idx[i],get_sensor_name (cl_data->sensor_idx[i]), cl_data->sensor_sts[i]); } +if (!cl_data->is_any_sensor_enabled) { +dev_warn (dev,"Failed to discover, sensors not enabled is %d\n" , + cl_data->is_any_sensor_enabled); + rc = -EOPNOTSUPP ; + goto cleanup; + } +schedule_delayed_work (&cl_data->work_buffer,msecs_to_jiffies (AMD_SFH_IDLE_LOOP ));return 0 ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 531/694 cacheinfo: Check sib_leaf in cache_leaves_are_shared()
In reply to Greg Kroah-HartmanFrom: Pierre Gondois <[email protected]>
[ Upstream commit 7a306e3eabf2b2fd8cffa69b87b32dbf814d79ce ]
If there is no ACPI/DT information, it is assumed that L1 caches are private and L2 (and higher) caches are shared. A cache is 'shared' between two CPUs if it is accessible from these two CPUs.
Each CPU owns a representation (i.e. has a dedicated cacheinfo struct) of the caches it has access to. cache_leaves_are_shared() tries to identify whether two representations are designating the same actual cache.
In cache_leaves_are_shared(), if 'this_leaf' is a L2 cache (or higher) and 'sib_leaf' is a L1 cache, the caches are detected as shared as only this_leaf's cache level is checked.
This is leads to setting sib_leaf as being shared with another CPU, which is incorrect as this is a L1 cache.
Check 'sib_leaf->level'. Also update the comment as the function is called when populating 'shared_cpu_map'.
--- drivers/base/cacheinfo.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/base/cacheinfo.c +2 -3
@@ -38,11 +38,10 @@ static inline bool cache_leaves_are_shared(struct cacheinfo *this_leaf, {/* * For non DT/ACPI systems, assume unique level 1 caches, -* system-wide shared caches for all other levels. This will be used -* only if arch specific code has not populated shared_cpu_map +* system-wide shared caches for all other levels. */ if (!(IS_ENABLED (CONFIG_OF ) ||IS_ENABLED (CONFIG_ACPI ))) -return !(this_leaf->level ==1 ); +return (this_leaf->level !=1 ) && (sib_leaf->level !=1 );if ((sib_leaf->attributes &CACHE_ID ) && (this_leaf->attributes &CACHE_ID ))
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 532/694 cacheinfo: Check cache properties are present in DT
In reply to Greg Kroah-HartmanFrom: Pierre Gondois <[email protected]>
[ Upstream commit cde0fbff07eff7e4e0e85fa053fe19a24c86b1e0 ]
If a Device Tree (DT) is used, the presence of cache properties is assumed. Not finding any is not considered. For arm64 platforms, cache information can be fetched from the clidr_el1 register. Checking whether cache information is available in the DT allows to switch to using clidr_el1.
init_of_cache_level()
\-of_count_cache_leaves()
will assume there a 2 cache leaves (L1 data/instruction caches), which can be different from clidr_el1 information.
cache_setup_of_node() tries to read cache properties in the DT. If there are none, this is considered a success. Knowing no information was available would allow to switch to using clidr_el1.
--- drivers/base/cacheinfo.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)
drivers/base/cacheinfo.c +32 -0
@@ -78,6 +78,9 @@ bool last_level_cache_is_shared(unsigned int cpu_x, unsigned int cpu_y) } #ifdef CONFIG_OF + +static bool of_check_cache_nodes(struct device_node *np); + /* OF properties to query for a given cache type */ struct cache_type_info { const char *size_prop;
@@ -205,6 +208,11 @@ static int cache_setup_of_node(unsigned int cpu)return -ENOENT ; } +if (!of_check_cache_nodes (np)) { +of_node_put (np); +return -ENOENT ; + } + prev = np;while (index <cache_leaves (cpu)) {
@@ -229,6 +237,25 @@ static int cache_setup_of_node(unsigned int cpu)return 0 ; } +static bool of_check_cache_nodes (struct device_node *np) +{ +struct device_node *next; + +if (of_property_present (np,"cache-size" ) || +of_property_present (np,"i-cache-size" ) || +of_property_present (np,"d-cache-size" ) || +of_property_present (np,"cache-unified" )) +return true; + + next =of_find_next_cache_node (np); +if (next) { +of_node_put (next); +return true; + } + +return false; +} +static int of_count_cache_leaves (struct device_node *np) {unsigned int leaves =0 ;
@@ -260,6 +287,11 @@ int init_of_cache_level(unsigned int cpu)struct device_node *prev =NULL ;unsigned int levels =0 , leaves, level; +if (!of_check_cache_nodes (np)) { +of_node_put (np); +return -ENOENT ; + } + leaves =of_count_cache_leaves (np);if (leaves >0 ) levels =1 ;
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 533/694 coresight: etm_pmu: Set the module field
In reply to Greg Kroah-HartmanFrom: Suzuki K Poulose <[email protected]>
[ Upstream commit 18996a113f2567aef3057e300e3193ce2df1684c ]
struct pmu::module must be set to the module owning the PMU driver. Set this for the coresight etm_pmu.
--- drivers/hwtracing/coresight/coresight-etm-perf.c | 1 + 1 file changed, 1 insertion(+)
drivers/hwtracing/coresight/coresight-etm-perf.c +1 -0
@@ -901,6 +901,7 @@ int __init etm_perf_init(void) etm_pmu.addr_filters_sync = etm_addr_filters_sync; etm_pmu.addr_filters_validate = etm_addr_filters_validate; etm_pmu.nr_addr_filters =ETM_ADDR_CMP_MAX ; + etm_pmu.module =THIS_MODULE ; ret =perf_pmu_register (&etm_pmu,CORESIGHT_ETM_PMU_NAME ,-1 );if (ret ==0 )
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 534/694 drm/panel: novatek-nt35950: Improve error handling
In reply to Greg Kroah-HartmanFrom: Konrad Dybcio <[email protected]>
[ Upstream commit 5dd45b66742a1f3cfa9a92dc0ac8714c7708ee6c ]
In a very peculiar case when probing and registering with the secondary DSI host succeeds, but the OF backlight or DSI attachment fails, the primary DSI device is automatically cleaned up, but the secondary one is not, leading to -EEXIST when the driver core tries to handle -EPROBE_DEFER.
Unregister the DSI1 device manually on failure to prevent that.
--- drivers/gpu/drm/panel/panel-novatek-nt35950.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/panel/panel-novatek-nt35950.c +7 -1
@@ -585,8 +585,11 @@ static int nt35950_probe(struct mipi_dsi_device *dsi) DRM_MODE_CONNECTOR_DSI); ret =drm_panel_of_backlight (&nt->panel); -if (ret) +if (ret) { +mipi_dsi_device_unregister (nt->dsi[1 ]); +return dev_err_probe (dev, ret,"Failed to get backlight\n" ); + }drm_panel_add (&nt->panel);
@@ -602,6 +605,9 @@ static int nt35950_probe(struct mipi_dsi_device *dsi) ret =mipi_dsi_attach (nt->dsi[i]);if (ret <0 ) { +/* If we fail to attach to either host, we're done */ +mipi_dsi_device_unregister (nt->dsi[1 ]); +return dev_err_probe (dev, ret,"Cannot attach to DSI%d host.\n" , i); }
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 535/694 ASoC: fsl_mqs: move of_node_put() to the correct location
In reply to Greg Kroah-HartmanFrom: Liliang Ye <[email protected]>
[ Upstream commit 1c34890273a020d61d6127ade3f68ed1cb21c16a ]
of_node_put() should have been done directly after mqs_priv->regmap = syscon_node_to_regmap(gpr_np); otherwise it creates a reference leak on the success path.
To fix this, of_node_put() is moved to the correct location, and change all the gotos to direct returns.
--- sound/soc/fsl/fsl_mqs.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-)
sound/soc/fsl/fsl_mqs.c +5 -10
@@ -210,10 +210,10 @@ static int fsl_mqs_probe(struct platform_device *pdev) } mqs_priv->regmap =syscon_node_to_regmap (gpr_np); +of_node_put (gpr_np);if (IS_ERR (mqs_priv->regmap)) {dev_err (&pdev->dev,"failed to get gpr regmap\n" ); - ret =PTR_ERR (mqs_priv->regmap); - goto err_free_gpr_np; +return PTR_ERR (mqs_priv->regmap); } }else { regs =devm_platform_ioremap_resource (pdev,0 );
@@ -242,8 +242,7 @@ static int fsl_mqs_probe(struct platform_device *pdev)if (IS_ERR (mqs_priv->mclk)) {dev_err (&pdev->dev,"failed to get the clock: %ld\n" ,PTR_ERR (mqs_priv->mclk)); - ret =PTR_ERR (mqs_priv->mclk); - goto err_free_gpr_np; +return PTR_ERR (mqs_priv->mclk); }dev_set_drvdata (&pdev->dev, mqs_priv);
@@ -252,13 +251,9 @@ static int fsl_mqs_probe(struct platform_device *pdev) ret =devm_snd_soc_register_component (&pdev->dev, &soc_codec_fsl_mqs, &fsl_mqs_dai,1 );if (ret) - goto err_free_gpr_np; -return 0 ; - -err_free_gpr_np: -of_node_put (gpr_np); +return ret; -return ret; +return 0 ; }static int fsl_mqs_remove (struct platform_device *pdev)
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 536/694 PCI/PM: Extend D3hot delay for NVIDIA HDA controllers
In reply to Greg Kroah-HartmanFrom: Alex Williamson <[email protected]>
[ Upstream commit a5a6dd2624698b6e3045c3a1450874d8c790d5d9 ]
Assignment of NVIDIA Ampere-based GPUs have seen a regression since the below referenced commit, where the reduced D3hot transition delay appears to introduce a small window where a D3hot->D0 transition followed by a bus reset can wedge the device. The entire device is subsequently unavailable, returning -1 on config space read and is unrecoverable without a host reset.
This has been observed with RTX A2000 and A5000 GPU and audio functions assigned to a Windows VM, where shutdown of the VM places the devices in D3hot prior to vfio-pci performing a bus reset when userspace releases the devices. The issue has roughly a 2-3% chance of occurring per shutdown.
Restoring the HDA controller d3hot_delay to the effective value before the below commit has been shown to resolve the issue. NVIDIA confirms this change should be safe for all of their HDA controllers.
--- drivers/pci/quirks.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/pci/quirks.c +13 -0
@@ -1939,6 +1939,19 @@ static void quirk_radeon_pm(struct pci_dev *dev) }DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_ATI ,0x6741 , quirk_radeon_pm); +/* +* NVIDIA Ampere-based HDA controllers can wedge the whole device if a bus +* reset is performed too soon after transition to D0, extend d3hot_delay +* to previous effective default for all NVIDIA HDA controllers. +*/ +static void quirk_nvidia_hda_pm (struct pci_dev *dev) +{ +quirk_d3hot_delay (dev,20 ); +} +DECLARE_PCI_FIXUP_CLASS_FINAL (PCI_VENDOR_ID_NVIDIA ,PCI_ANY_ID , +PCI_CLASS_MULTIMEDIA_HD_AUDIO ,8 , + quirk_nvidia_hda_pm); +/* * Ryzen5/7 XHCI controllers fail upon resume from runtime suspend or s2idle. * https://bugzilla.kernel.org/show_bug.cgi?id=205587
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 537/694 drm/panel: novatek-nt35950: Only unregister DSI1 if it exists
In reply to Greg Kroah-HartmanFrom: Konrad Dybcio <[email protected]>
[ Upstream commit a50be876f4fe2349dc8b056a49d87f69c944570f ]
Commit 5dd45b66742a ("drm/panel: novatek-nt35950: Improve error handling") introduced logic to unregister DSI1 on any sort of probe failure, as that's not done automatically by kernel APIs.
It did not however account for cases where only one DSI host is used. Fix that.
--- drivers/gpu/drm/panel/panel-novatek-nt35950.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/panel/panel-novatek-nt35950.c +4 -2
@@ -586,7 +586,8 @@ static int nt35950_probe(struct mipi_dsi_device *dsi) ret =drm_panel_of_backlight (&nt->panel);if (ret) { -mipi_dsi_device_unregister (nt->dsi[1 ]); +if (num_dsis ==2 ) +mipi_dsi_device_unregister (nt->dsi[1 ]);return dev_err_probe (dev, ret,"Failed to get backlight\n" ); }
@@ -606,7 +607,8 @@ static int nt35950_probe(struct mipi_dsi_device *dsi) ret =mipi_dsi_attach (nt->dsi[i]);if (ret <0 ) {/* If we fail to attach to either host, we're done */ -mipi_dsi_device_unregister (nt->dsi[1 ]); +if (num_dsis ==2 ) +mipi_dsi_device_unregister (nt->dsi[1 ]);return dev_err_probe (dev, ret,"Cannot attach to DSI%d host.\n" , i);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 538/694 spi: cadence-quadspi: fix suspend-resume implementations
In reply to Greg Kroah-HartmanFrom: Dhruva Gole <[email protected]>
[ Upstream commit 2087e85bb66ee3652dafe732bb9b9b896229eafc ]
The cadence QSPI driver misbehaves after performing a full system suspend resume:
...
spi-nor spi0.0: resume() failed
...
This results in a flash connected via OSPI interface after system suspend- resume to be unusable.
fix these suspend and resume functions.
--- drivers/spi/spi-cadence-quadspi.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-)
drivers/spi/spi-cadence-quadspi.c +16 -3
@@ -1806,17 +1806,30 @@ static int cqspi_remove(struct platform_static int cqspi_suspend (struct device *dev) {struct cqspi_st *cqspi =dev_get_drvdata (dev); +struct spi_master *master =dev_get_drvdata (dev); +int ret; + ret =spi_master_suspend (master);cqspi_controller_enable (cqspi,0 ); -return 0 ; + +clk_disable_unprepare (cqspi->clk); + +return ret; }static int cqspi_resume (struct device *dev) {struct cqspi_st *cqspi =dev_get_drvdata (dev); +struct spi_master *master =dev_get_drvdata (dev); + +clk_prepare_enable (cqspi->clk); +cqspi_wait_idle (cqspi); +cqspi_controller_init (cqspi); + + cqspi->current_cs =-1 ; + cqspi->sclk =0 ; -cqspi_controller_enable (cqspi,1 ); -return 0 ; +return spi_master_resume (master); }static const struct dev_pm_ops cqspi__dev_pm_ops = {
Greg Kroah-Hartman
maintainerPATCH 539/694 i2c: cadence: cdns_i2c_master_xfer(): Fix runtime PM leak on error path
In reply to Greg Kroah-HartmanFrom: Lars-Peter Clausen <[email protected]>
[ Upstream commit ae1664f04f504a998737f5bb563f16b44357bcca ]
The cdns_i2c_master_xfer() function gets a runtime PM reference when the function is entered. This reference is released when the function is exited. There is currently one error path where the function exits directly, which leads to a leak of the runtime PM reference.
Make sure that this error path also releases the runtime PM reference.
--- drivers/i2c/busses/i2c-cadence.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/i2c/busses/i2c-cadence.c +4 -2
@@ -827,8 +827,10 @@ static int cdns_i2c_master_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs,#if IS_ENABLED (CONFIG_I2C_SLAVE )/* Check i2c operating mode and switch if possible */ if (id->dev_mode ==CDNS_I2C_MODE_SLAVE ) { -if (id->slave_state !=CDNS_I2C_SLAVE_STATE_IDLE ) -return -EAGAIN ; +if (id->slave_state !=CDNS_I2C_SLAVE_STATE_IDLE ) { + ret = -EAGAIN ; + goto out; + }/* Set mode to master */ cdns_i2c_set_mode (CDNS_I2C_MODE_MASTER , id);
Signature · 1 line
2.39.2
Greg Kroah-Hartman
maintainerPATCH 540/694 i2c: xiic: xiic_xfer(): Fix runtime PM leak on error path
In reply to Greg Kroah-HartmanFrom: Lars-Peter Clausen <[email protected]>
[ Upstream commit d663d93bb47e7ab45602b227701022d8aa16040a ]
The xiic_xfer() function gets a runtime PM reference when the function is entered. This reference is released when the function is exited. There is currently one error path where the function exits directly, which leads to a leak of the runtime PM reference.
Make sure that this error path also releases the runtime PM reference.
--- drivers/i2c/busses/i2c-xiic.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/i2c/busses/i2c-xiic.c +3 -1
@@ -1164,7 +1164,7 @@ static int xiic_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) err =xiic_start_xfer (i2c, msgs, num);if (err <0 ) {dev_err (adap->dev.parent,"Error xiic_start_xfer\n" ); -return err; + goto out; } err =wait_for_completion_timeout (&i2c->completion,XIIC_XFER_TIMEOUT );
@@ -1178,6 +1178,8 @@ static int xiic_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) err = (i2c->state ==STATE_DONE ) ? num : -EIO ; }mutex_unlock (&i2c->lock); + +out:pm_runtime_mark_last_busy (i2c->dev);pm_runtime_put_autosuspend (i2c->dev);return err;
Signature · 1 line
2.39.2