6.1.53-rc1 review
Subsystems (13)
Greg Kroah-Hartman
maintainerPATCH 137/600 bpftool: use a local copy of perf_event to fix accessing :: Bpf_cookie
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Lobakin <[email protected]>
[ Upstream commit 4cbeeb0dc02f8ac7b975b2ab0080ace53d43d62a ]
When CONFIG_PERF_EVENTS is not set, struct perf_event remains empty. However, the structure is being used by bpftool indirectly via BTF. This leads to:
skeleton/pid_iter.bpf.c:49:30: error: no member named 'bpf_cookie' in 'struct perf_event'
return BPF_CORE_READ(event, bpf_cookie);
~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~...
skeleton/pid_iter.bpf.c:49:9: error: returning 'void' from a function with incompatible result type '__u64' (aka 'unsigned long long')
return BPF_CORE_READ(event, bpf_cookie);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Tools and samples can't use any CONFIG_ definitions, so the fields used there should always be present.
Define struct perf_event___local with the preserve_access_index attribute inside the pid_iter BPF prog to allow compiling on any configs. CO-RE will substitute it with the real struct perf_event accesses later on.
--- tools/bpf/bpftool/skeleton/pid_iter.bpf.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
tools/bpf/bpftool/skeleton/pid_iter.bpf.c +5 -1
@@ -15,6 +15,10 @@ enum bpf_obj_type { BPF_OBJ_BTF, }; +struct perf_event___local { +u64 bpf_cookie; +} __attribute__((preserve_access_index)); + extern const void bpf_link_fops __ksym; extern const void bpf_map_fops __ksym; extern const void bpf_prog_fops __ksym;
@@ -41,8 +45,8 @@ static __always_inline __u32 get_obj_id(void *ent, enum bpf_obj_type type)/* could be used only with BPF_LINK_TYPE_PERF_EVENT links */ static __u64 get_bpf_cookie (struct bpf_link *link) { +struct perf_event___local *event;struct bpf_perf_link *perf_link; -struct perf_event *event; perf_link = container_of(link, struct bpf_perf_link, link); event =BPF_CORE_READ (perf_link, perf_file, private_data);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 138/600 bpftool: Define a local bpf_perf_link to fix accessing its fields
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Lobakin <[email protected]>
[ Upstream commit 67a43462ee2405c94e985a747bdcb8e3a0d66203 ]
When building bpftool with !CONFIG_PERF_EVENTS:
skeleton/pid_iter.bpf.c:47:14: error: incomplete definition of type 'struct bpf_perf_link'
perf_link = container_of(link, struct bpf_perf_link, link);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/bpf/bpftool/bootstrap/libbpf/include/bpf/bpf_helpers.h:74:22: note: expanded from macro 'container_of'
((type *)(__mptr - offsetof(type, member))); \
^~~~~~~~~~~~~~~~~~~~~~
tools/bpf/bpftool/bootstrap/libbpf/include/bpf/bpf_helpers.h:68:60: note: expanded from macro 'offsetof'
#define offsetof(TYPE, MEMBER) ((unsigned long)&((TYPE *)0)->MEMBER)
~~~~~~~~~~~^
skeleton/pid_iter.bpf.c:44:9: note: forward declaration of 'struct bpf_perf_link'
struct bpf_perf_link *perf_link;
^&bpf_perf_link is being defined and used only under the ifdef. Define struct bpf_perf_link___local with the preserve_access_index attribute inside the pid_iter BPF prog to allow compiling on any configs. CO-RE will substitute it with the real struct bpf_perf_link accesses later on.container_of() uses offsetof(), which does the necessary CO-RE relocation if the field is specified with preserve_access_index - as is the case for struct bpf_perf_link___local.
--- tools/bpf/bpftool/skeleton/pid_iter.bpf.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
tools/bpf/bpftool/skeleton/pid_iter.bpf.c +7 -2
@@ -15,6 +15,11 @@ enum bpf_obj_type { BPF_OBJ_BTF, }; +struct bpf_perf_link___local { +struct bpf_link link; +struct file *perf_file; +} __attribute__((preserve_access_index)); +struct perf_event___local {u64 bpf_cookie; } __attribute__((preserve_access_index));
@@ -45,10 +50,10 @@ static __always_inline __u32 get_obj_id(void *ent, enum bpf_obj_type type)/* could be used only with BPF_LINK_TYPE_PERF_EVENT links */ static __u64 get_bpf_cookie (struct bpf_link *link) { +struct bpf_perf_link___local *perf_link;struct perf_event___local *event; -struct bpf_perf_link *perf_link; - perf_link = container_of(link, struct bpf_perf_link, link); + perf_link = container_of(link, struct bpf_perf_link___local, link); event =BPF_CORE_READ (perf_link, perf_file, private_data);return BPF_CORE_READ (event, bpf_cookie); }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 139/600 bpftool: Use a local copy of BPF_LINK_TYPE_PERF_EVENT in pid_iter.bpf.c
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Quentin Monnet <[email protected]>
[ Upstream commit 44ba7b30e84fb40da2295e85a6d209e199fdc977 ]
In order to allow the BPF program in bpftool's pid_iter.bpf.c to compile correctly on hosts where vmlinux.h does not define BPF_LINK_TYPE_PERF_EVENT (running kernel versions lower than 5.15, for example), define and use a local copy of the enum value. This requires LLVM 12 or newer to build the BPF program.
--- tools/bpf/bpftool/skeleton/pid_iter.bpf.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
tools/bpf/bpftool/skeleton/pid_iter.bpf.c +9 -2
@@ -24,6 +24,10 @@ struct perf_event___local {u64 bpf_cookie; } __attribute__((preserve_access_index)); +enum bpf_link_type___local { + BPF_LINK_TYPE_PERF_EVENT___local =7 , +}; + extern const void bpf_link_fops __ksym; extern const void bpf_map_fops __ksym; extern const void bpf_prog_fops __ksym;
@@ -93,10 +97,13 @@ int iter(struct bpf_iter__task_file *ctx) e.pid = task->tgid; e.id =get_obj_id (file->private_data, obj_type); -if (obj_type ==BPF_OBJ_LINK ) { +if (obj_type ==BPF_OBJ_LINK && + bpf_core_enum_value_exists(enum bpf_link_type___local, + BPF_LINK_TYPE_PERF_EVENT___local)) {struct bpf_link *link = (struct bpf_link *) file->private_data; -if (BPF_CORE_READ (link, type) ==BPF_LINK_TYPE_PERF_EVENT ) { + if (link->type == bpf_core_enum_value(enum bpf_link_type___local, + BPF_LINK_TYPE_PERF_EVENT___local)) { e.has_bpf_cookie = true; e.bpf_cookie =get_bpf_cookie (link); }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 140/600 bpftool: Use a local bpf_perf_event_value to fix accessing its fields
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Lobakin <[email protected]>
[ Upstream commit 658ac06801315b739774a15796ff06913ef5cad5 ]
Fix the following error when building bpftool:
CLANG profiler.bpf.o
CLANG pid_iter.bpf.oskeleton/profiler.bpf.c:18:21: error: invalid application of 'sizeof' to an incomplete type 'struct bpf_perf_event_value'
__uint(value_size, sizeof(struct bpf_perf_event_value));
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/bpf/bpftool/bootstrap/libbpf/include/bpf/bpf_helpers.h:13:39: note: expanded from macro '__uint'
tools/bpf/bpftool/bootstrap/libbpf/include/bpf/bpf_helper_defs.h:7:8: note: forward declaration of 'struct bpf_perf_event_value'
struct bpf_perf_event_value;
^struct bpf_perf_event_value is being used in the kernel only when CONFIG_BPF_EVENTS is enabled, so it misses a BTF entry then. Define struct bpf_perf_event_value___local with the preserve_access_index attribute inside the pid_iter BPF prog to allow compiling on any configs. It is a full mirror of a UAPI structure, so is compatible both with and w/o CO-RE. bpf_perf_event_read_value() requires a pointer of the original type, so a cast is needed.
--- tools/bpf/bpftool/skeleton/profiler.bpf.c | 27 ++++++++++++++--------- 1 file changed, 17 insertions(+), 10 deletions(-)
tools/bpf/bpftool/skeleton/profiler.bpf.c +17 -10
@@ -4,6 +4,12 @@#include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> +struct bpf_perf_event_value___local { +__u64 counter; +__u64 enabled; +__u64 running; +} __attribute__((preserve_access_index)); +/* map of perf event fds, num_cpu * num_metric entries */ struct { __uint(type, BPF_MAP_TYPE_PERF_EVENT_ARRAY);
@@ -15,14 +21,14 @@ struct {struct { __uint(type, BPF_MAP_TYPE_PERCPU_ARRAY); __uint(key_size, sizeof(u32)); - __uint(value_size, sizeof(struct bpf_perf_event_value)); + __uint(value_size, sizeof(struct bpf_perf_event_value___local)); } fentry_readings SEC(".maps");/* accumulated readings */ struct { __uint(type, BPF_MAP_TYPE_PERCPU_ARRAY); __uint(key_size, sizeof(u32)); - __uint(value_size, sizeof(struct bpf_perf_event_value)); + __uint(value_size, sizeof(struct bpf_perf_event_value___local)); } accum_readings SEC(".maps");/* sample counts, one per cpu */
@@ -39,7 +45,7 @@ const volatile __u32 num_metric = 1; SEC("fentry/XXX")int BPF_PROG (fentry_XXX ) { -struct bpf_perf_event_value *ptrs[MAX_NUM_MATRICS ]; +struct bpf_perf_event_value___local *ptrs[MAX_NUM_MATRICS ];u32 key =bpf_get_smp_processor_id ();u32 i;
@@ -53,10 +59,10 @@ int BPF_PROG(fentry_XXX) }for (i =0 ; i < num_metric && i <MAX_NUM_MATRICS ; i++) { -struct bpf_perf_event_value reading; +struct bpf_perf_event_value___local reading;int err; - err =bpf_perf_event_read_value (&events, key, &reading, + err =bpf_perf_event_read_value (&events, key, (void *)&reading,sizeof (reading));if (err)return 0 ;
@@ -68,14 +74,14 @@ int BPF_PROG(fentry_XXX) }static inline void -fexit_update_maps (u32 id,struct bpf_perf_event_value *after) +fexit_update_maps (u32 id,struct bpf_perf_event_value___local *after) { -struct bpf_perf_event_value *before, diff; +struct bpf_perf_event_value___local *before, diff; before =bpf_map_lookup_elem (&fentry_readings, &id);/* only account samples with a valid fentry_reading */ if (before && before->counter) { -struct bpf_perf_event_value *accum; +struct bpf_perf_event_value___local *accum; diff.counter = after->counter - before->counter; diff.enabled = after->enabled - before->enabled;
@@ -93,7 +99,7 @@ fexit_update_maps(u32 id, struct bpf_perf_event_value *after) SEC("fexit/XXX")int BPF_PROG (fexit_XXX ) { -struct bpf_perf_event_value readings[MAX_NUM_MATRICS ]; +struct bpf_perf_event_value___local readings[MAX_NUM_MATRICS ];u32 cpu =bpf_get_smp_processor_id ();u32 i, zero =0 ;int err;
@@ -102,7 +108,8 @@ int BPF_PROG(fexit_XXX)/* read all events before updating the maps, to reduce error */ for (i =0 ; i < num_metric && i <MAX_NUM_MATRICS ; i++) { err =bpf_perf_event_read_value (&events, cpu + i * num_cpu, - readings + i,sizeof (*readings)); + (void *)(readings + i), +sizeof (*readings));if (err)return 0 ; }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 141/600 libbpf: Fix realloc API handling in zero-sized edge cases
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrii Nakryiko <[email protected]>
[ Upstream commit 8a0260dbf6553c969248b6530cafadac46562f47 ]
realloc() and reallocarray() can either return NULL or a special non-NULL pointer, if their size argument is zero. This requires a bit more care to handle NULL-as-valid-result situation differently from NULL-as-error case. This has caused real issues before ([0]), and just recently bit again in production when performing bpf_program__attach_usdt().
This patch fixes 4 places that do or potentially could suffer from this mishandling of NULL, including the reported USDT-related one.
There are many other places where realloc()/reallocarray() is used and NULL is always treated as an error value, but all those have guarantees that their size is always non-zero, so those spot don't need any extra handling.
[0] d08ab82f59d5 ("libbpf: Fix double-free when linker processes empty sections")
--- tools/lib/bpf/libbpf.c | 15 ++++++++++++--- tools/lib/bpf/usdt.c | 5 ++++- 2 files changed, 16 insertions(+), 4 deletions(-)
tools/lib/bpf/libbpf.c +12 -3
@@ -6063,7 +6063,11 @@ static int append_subprog_relos(struct bpf_program *main_prog, struct bpf_prograif (main_prog == subprog)return 0 ; relos =libbpf_reallocarray (main_prog->reloc_desc, new_cnt,sizeof (*relos)); -if (!relos) +/* if new count is zero, reallocarray can return a valid NULL result; +* in this case the previous pointer will be freed, so we *have to* +* reassign old pointer to the new value (even if it's NULL) +*/ +if (!relos && new_cnt)return -ENOMEM ;if (subprog->nr_reloc) memcpy(relos + main_prog->nr_reloc, subprog->reloc_desc,
@@ -8345,7 +8349,8 @@ int bpf_program__set_insns(struct bpf_program *prog,return -EBUSY ; insns =libbpf_reallocarray (prog->insns, new_insn_cnt,sizeof (*insns)); -if (!insns) { +/* NULL is a valid return from reallocarray if the new count is zero */ +if (!insns && new_insn_cnt) {pr_warn ("prog '%s': failed to realloc prog code\n" , prog->name);return -ENOMEM ; }
@@ -8640,7 +8645,11 @@ int libbpf_unregister_prog_handler(int handler_id)/* try to shrink the array, but it's ok if we couldn't */ sec_defs =libbpf_reallocarray (custom_sec_defs, custom_sec_def_cnt,sizeof (*sec_defs)); -if (sec_defs) +/* if new count is zero, reallocarray can return a valid NULL result; +* in this case the previous pointer will be freed, so we *have to* +* reassign old pointer to the new value (even if it's NULL) +*/ +if (sec_defs || custom_sec_def_cnt ==0 ) custom_sec_defs = sec_defs;return 0 ;
tools/lib/bpf/usdt.c +4 -1
@@ -852,8 +852,11 @@ static int bpf_link_usdt_detach(struct bpf_link *link)* system is so exhausted on memory, it's the least of user's * concerns, probably. * So just do our best here to return those IDs to usdt_manager. +* Another edge case when we can legitimately get NULL is when +* new_cnt is zero, which can happen in some edge cases, so we +* need to be careful about that. */ -if (new_free_ids) { +if (new_free_ids || new_cnt ==0 ) {memcpy (new_free_ids + man->free_spec_cnt, usdt_link->spec_ids, usdt_link->spec_cnt *sizeof (*usdt_link->spec_ids)); man->free_spec_ids = new_free_ids;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 142/600 bpf: Clear the probe_addr for uprobe
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yafang Shao <[email protected]>
[ Upstream commit 5125e757e62f6c1d5478db4c2b61a744060ddf3f ]
To avoid returning uninitialized or random values when querying the file descriptor (fd) and accessing probe_addr, it is necessary to clear the variable prior to its use.
--- include/linux/trace_events.h | 3 ++- kernel/trace/bpf_trace.c | 2 +- kernel/trace/trace_uprobe.c | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-)
include/linux/trace_events.h +2 -1
@@ -863,7 +863,8 @@ extern int perf_uprobe_init(struct perf_event *event,extern void perf_uprobe_destroy (struct perf_event *event);extern int bpf_get_uprobe_info (const struct perf_event *event,u32 *fd_type,const char **filename, -u64 *probe_offset,bool perf_type_tracepoint); +u64 *probe_offset,u64 *probe_addr, +bool perf_type_tracepoint);#endif extern int ftrace_profile_set_filter (struct perf_event *event,int event_id,char *filter_str);
kernel/trace/bpf_trace.c +1 -1
@@ -2390,7 +2390,7 @@ int bpf_get_perf_event_info(const struct perf_event *event, u32 *prog_id,#ifdef CONFIG_UPROBE_EVENTS if (flags &TRACE_EVENT_FL_UPROBE ) err =bpf_get_uprobe_info (event, fd_type, buf, - probe_offset, + probe_offset, probe_addr, event->attr.type ==PERF_TYPE_TRACEPOINT );#endif }
kernel/trace/trace_uprobe.c +2 -1
@@ -1418,7 +1418,7 @@ static void uretprobe_perf_func(struct trace_uprobe *tu, unsigned long func,int bpf_get_uprobe_info (const struct perf_event *event,u32 *fd_type,const char **filename,u64 *probe_offset, -bool perf_type_tracepoint) +u64 *probe_addr,bool perf_type_tracepoint) {const char *pevent =trace_event_name (event->tp_event);const char *group = event->tp_event->class->system;
@@ -1435,6 +1435,7 @@ int bpf_get_uprobe_info(const struct perf_event *event, u32 *fd_type, : BPF_FD_TYPE_UPROBE; *filename = tu->filename; *probe_offset = tu->offset; + *probe_addr =0 ; return 0; }#endif /* CONFIG_PERF_EVENTS */
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 143/600 bpf: Fix an error in verifying a field in a union
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yafang Shao <[email protected]>
[ Upstream commit 33937607efa050d9e237e0c4ac4ada02d961c466 ]
We are utilizing BPF LSM to monitor BPF operations within our container environment. When we add support for raw_tracepoint, it hits below error.
; (const void *)attr->raw_tracepoint.name);
27: (79) r3 = *(u64 *)(r2 +0)
access beyond the end of member map_type (mend:4) in struct (anon) with off 0 size 8
It can be reproduced with below BPF prog.
SEC("lsm/bpf")
int BPF_PROG(bpf_audit, int cmd, union bpf_attr *attr, unsigned int size)
{
switch (cmd) {
case BPF_RAW_TRACEPOINT_OPEN:
bpf_printk("raw_tracepoint is %s", attr->raw_tracepoint.name);
break;
default:
break;
}
return 0;
}The reason is that when accessing a field in a union, such as bpf_attr, if the field is located within a nested struct that is not the first member of the union, it can result in incorrect field verification.
union bpf_attr {
struct {
__u32 map_type; <<<< Actually it will find that field.
__u32 key_size;
__u32 value_size;
...
};
...
struct {
__u64 name; <<<< We want to verify this field.
__u32 prog_fd;
} raw_tracepoint;
};Considering the potential deep nesting levels, finding a perfect solution to address this issue has proven challenging. Therefore, I propose a solution where we simply skip the verification process if the field in question is located within a union.
--- kernel/bpf/btf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/bpf/btf.c +1 -1
@@ -5788,7 +5788,7 @@ static int btf_struct_walk(struct bpf_verifier_log *log, const struct btf *btf,* that also allows using an array of int as a scratch * space. e.g. skb->cb[]. */ -if (off + size > mtrue_end) { +if (off + size > mtrue_end && !(*flag &PTR_UNTRUSTED )) {bpf_log (log,"access beyond the end of member %s (mend:%u) in struct %s with off %u size %u\n" , mname, mtrue_end, tname, off, size);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 144/600 crypto: qat - change value of default idle filter
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Giovanni Cabiddu <[email protected]>
[ Upstream commit 0f942bdfe9d463be3073301519492f8d53c6b2d5 ]
The power management configuration of 4xxx devices is too aggressive and in some conditions the device might be prematurely put to a low power state.
Increase the idle filter value to prevent that.
In future, this will be set by firmware.
--- drivers/crypto/qat/qat_common/adf_gen4_pm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/qat/qat_common/adf_gen4_pm.h +1 -1
@@ -35,7 +35,7 @@#define ADF_GEN4_PM_MSG_PENDING BIT(0)#define ADF_GEN4_PM_MSG_PAYLOAD_BIT_MASK GENMASK(28, 1) -#define ADF_GEN4_PM_DEFAULT_IDLE_FILTER (0x0) +#define ADF_GEN4_PM_DEFAULT_IDLE_FILTER (0x6)#define ADF_GEN4_PM_MAX_IDLE_FILTER (0x7)int adf_gen4_enable_pm (struct adf_accel_dev *accel_dev);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 145/600 tcp: tcp_enter_quickack_mode() should be static
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 03b123debcbc8db987bda17ed8412cc011064c22 ]
After commit d2ccd7bc8acd ("tcp: avoid resetting ACK timer in DCTCP"), tcp_enter_quickack_mode() is only used from net/ipv4/tcp_input.c.
--- include/net/tcp.h | 1 - net/ipv4/tcp_input.c | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-)
include/net/tcp.h +0 -1
@@ -355,7 +355,6 @@ ssize_t tcp_splice_read(struct socket *sk, loff_t *ppos,struct sk_buff *tcp_stream_alloc_skb (struct sock *sk,int size,gfp_t gfp,bool force_schedule); -void tcp_enter_quickack_mode (struct sock *sk,unsigned int max_quickacks);static inline void tcp_dec_quickack_mode (struct sock *sk,const unsigned int pkts) {
net/ipv4/tcp_input.c +1 -2
@@ -287,7 +287,7 @@ static void tcp_incr_quickack(struct sock *sk, unsigned int max_quickacks) icsk->icsk_ack.quick = quickacks; } -void tcp_enter_quickack_mode (struct sock *sk,unsigned int max_quickacks) +static void tcp_enter_quickack_mode (struct sock *sk,unsigned int max_quickacks) {struct inet_connection_sock *icsk =inet_csk (sk);
@@ -295,7 +295,6 @@ void tcp_enter_quickack_mode(struct sock *sk, unsigned int max_quickacks)inet_csk_exit_pingpong_mode (sk); icsk->icsk_ack.ato =TCP_ATO_MIN ; } -EXPORT_SYMBOL (tcp_enter_quickack_mode);/* Send ACKs quickly, if "quick" count is not exhausted * and the session is not interactive.
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 146/600 hwrng: nomadik - keep clock enabled while hwrng is registered
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Kaiser <[email protected]>
[ Upstream commit 039980de89dc9dd757418d6f296e4126cc3f86c3 ]
The nomadik driver uses devres to register itself with the hwrng core, the driver will be unregistered from hwrng when its device goes out of scope. This happens after the driver's remove function is called.
However, nomadik's clock is disabled in the remove function. There's a short timeframe where nomadik is still registered with the hwrng core although its clock is disabled. I suppose the clock must be active to access the hardware and serve requests from the hwrng core.
Switch to devm_clk_get_enabled and let devres disable the clock and unregister the hwrng. This avoids the race condition.
--- drivers/char/hw_random/nomadik-rng.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-)
drivers/char/hw_random/nomadik-rng.c +3 -9
@@ -13,8 +13,6 @@#include <linux/clk.h> #include <linux/err.h> -static struct clk *rng_clk; -static int nmk_rng_read (struct hwrng *rng,void *data,size_t max,bool wait) {void __iomem *base = (void __iomem *)rng->priv;
@@ -36,21 +34,20 @@ static struct hwrng nmk_rng = {static int nmk_rng_probe (struct amba_device *dev,const struct amba_id *id) { +struct clk *rng_clk;void __iomem *base;int ret; - rng_clk =devm_clk_get (&dev->dev,NULL ); + rng_clk =devm_clk_get_enabled (&dev->dev,NULL );if (IS_ERR (rng_clk)) {dev_err (&dev->dev,"could not get rng clock\n" ); ret =PTR_ERR (rng_clk);return ret; } -clk_prepare_enable (rng_clk); - ret =amba_request_regions (dev, dev->dev.init_name);if (ret) - goto out_clk; +return ret; ret = -ENOMEM ; base =devm_ioremap (&dev->dev, dev->res.start,resource_size (&dev->res));
@@ -64,15 +61,12 @@ static int nmk_rng_probe(struct amba_device *dev, const struct amba_id *id) out_release:amba_release_regions (dev); -out_clk: -clk_disable_unprepare (rng_clk);return ret; }static void nmk_rng_remove (struct amba_device *dev) {amba_release_regions (dev); -clk_disable_unprepare (rng_clk); }static const struct amba_id nmk_rng_ids[] = {
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 147/600 hwrng: pic32 - use devm_clk_get_enabled
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Kaiser <[email protected]>
[ Upstream commit 6755ad74aac0fb1c79b14724feb81b2f6ff25847 ]
Use devm_clk_get_enabled in the pic32 driver. Ensure that the clock is enabled as long as the driver is registered with the hwrng core.
--- drivers/char/hw_random/pic32-rng.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-)
drivers/char/hw_random/pic32-rng.c +5 -14
@@ -36,7 +36,6 @@struct pic32_rng {void __iomem *base;struct hwrng rng; -struct clk *clk; };/*
@@ -70,6 +69,7 @@ static int pic32_rng_read(struct hwrng *rng, void *buf, size_t max,static int pic32_rng_probe (struct platform_device *pdev) {struct pic32_rng *priv; +struct clk *clk;u32 v;int ret;
@@ -81,13 +81,9 @@ static int pic32_rng_probe(struct platform_device *pdev)if (IS_ERR (priv->base))return PTR_ERR (priv->base); - priv->clk =devm_clk_get (&pdev->dev,NULL ); -if (IS_ERR (priv->clk)) -return PTR_ERR (priv->clk); - - ret =clk_prepare_enable (priv->clk); -if (ret) -return ret; + clk =devm_clk_get_enabled (&pdev->dev,NULL ); +if (IS_ERR (clk)) +return PTR_ERR (clk);/* enable TRNG in enhanced mode */ v =TRNGEN |TRNGMOD ;
@@ -98,15 +94,11 @@ static int pic32_rng_probe(struct platform_device *pdev) ret =devm_hwrng_register (&pdev->dev, &priv->rng);if (ret) - goto err_register; +return ret;platform_set_drvdata (pdev, priv);return 0 ; - -err_register: -clk_disable_unprepare (priv->clk); -return ret; }static int pic32_rng_remove (struct platform_device *pdev)
@@ -114,7 +106,6 @@ static int pic32_rng_remove(struct platform_device *pdev)struct pic32_rng *rng =platform_get_drvdata (pdev);writel (0 , rng->base +RNGCON ); -clk_disable_unprepare (rng->clk);return 0 ; }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 148/600 regmap: rbtree: Use alloc_flags for memory allocations
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit 0c8b0bf42c8cef56f7cd9cd876fbb7ece9217064 ]
The kunit tests discovered a sleeping in atomic bug. The allocations in the regcache-rbtree code should use the map->alloc_flags instead of GFP_KERNEL.
[ 5.005510] BUG: sleeping function called from invalid context at include/linux/sched/mm.h:306
[ 5.005960] in_atomic(): 1, irqs_disabled(): 128, non_block: 0, pid: 117, name: kunit_try_catch
[ 5.006219] preempt_count: 1, expected: 0
[ 5.006414] 1 lock held by kunit_try_catch/117:
[ 5.006590] #0: 833b9010 (regmap_kunit:86:(config)->lock){....}-{2:2}, at: regmap_lock_spinlock+0x14/0x1c
[ 5.007493] irq event stamp: 162
[ 5.007627] hardirqs last enabled at (161): [<80786738>] crng_make_state+0x1a0/0x294
[ 5.007871] hardirqs last disabled at (162): [<80c531ec>] _raw_spin_lock_irqsave+0x7c/0x80
[ 5.008119] softirqs last enabled at (0): [<801110ac>] copy_process+0x810/0x2138
[ 5.008356] softirqs last disabled at (0): [<00000000>] 0x0
[ 5.008688] CPU: 0 PID: 117 Comm: kunit_try_catch Tainted: G N 6.4.4-rc3-g0e8d2fdfb188 #1
[ 5.009011] Hardware name: Generic DT based system
[ 5.009277] unwind_backtrace from show_stack+0x18/0x1c
[ 5.009497] show_stack from dump_stack_lvl+0x38/0x5c
[ 5.009676] dump_stack_lvl from __might_resched+0x188/0x2d0
[ 5.009860] __might_resched from __kmem_cache_alloc_node+0x1dc/0x25c
[ 5.010061] __kmem_cache_alloc_node from kmalloc_trace+0x30/0xc8
[ 5.010254] kmalloc_trace from regcache_rbtree_write+0x26c/0x468
[ 5.010446] regcache_rbtree_write from _regmap_write+0x88/0x140
[ 5.010634] _regmap_write from regmap_write+0x44/0x68
[ 5.010803] regmap_write from basic_read_write+0x8c/0x270
[ 5.010980] basic_read_write from kunit_try_run_case+0x48/0xa0--- drivers/base/regmap/regcache-rbtree.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/base/regmap/regcache-rbtree.c +5 -5
@@ -277,7 +277,7 @@ static int regcache_rbtree_insert_to_block(struct regmap *map, blk =krealloc (rbnode->block, blklen * map->cache_word_size, -GFP_KERNEL ); + map->alloc_flags);if (!blk)return -ENOMEM ;
@@ -286,7 +286,7 @@ static int regcache_rbtree_insert_to_block(struct regmap *map,if (BITS_TO_LONGS (blklen) >BITS_TO_LONGS (rbnode->blklen)) { present =krealloc (rbnode->cache_present,BITS_TO_LONGS (blklen) *sizeof (*present), -GFP_KERNEL ); + map->alloc_flags);if (!present)return -ENOMEM ;
@@ -320,7 +320,7 @@ regcache_rbtree_node_alloc(struct regmap *map, unsigned int reg)const struct regmap_range *range;int i; - rbnode =kzalloc (sizeof (*rbnode),GFP_KERNEL ); + rbnode =kzalloc (sizeof (*rbnode), map->alloc_flags);if (!rbnode)return NULL ;
@@ -346,13 +346,13 @@ regcache_rbtree_node_alloc(struct regmap *map, unsigned int reg) } rbnode->block =kmalloc_array (rbnode->blklen, map->cache_word_size, -GFP_KERNEL ); + map->alloc_flags);if (!rbnode->block) goto err_free; rbnode->cache_present =kcalloc (BITS_TO_LONGS (rbnode->blklen),sizeof (*rbnode->cache_present), -GFP_KERNEL ); + map->alloc_flags);if (!rbnode->cache_present) goto err_free_block;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 149/600 wifi: rtw89: debug: Fix error handling in rtw89_debug_priv_btc_manual_set()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhang Shurong <[email protected]>
[ Upstream commit 59b4cc439f184c5eaa34161ec67af1e16ffabed4 ]
If there is a failure during kstrtobool_from_user() rtw89_debug_priv_btc_manual_set should return a negative error code instead of returning the count directly.
Fix this bug by returning an error code instead of a count after a failed call of the function "kstrtobool_from_user". Moreover I omitted the label "out" with this source code correction.
--- drivers/net/wireless/realtek/rtw89/debug.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/net/wireless/realtek/rtw89/debug.c +5 -3
@@ -2302,12 +2302,14 @@ static ssize_t rtw89_debug_priv_btc_manual_set(struct file *filp,struct rtw89_dev *rtwdev = debugfs_priv->rtwdev;struct rtw89_btc *btc = &rtwdev->btc;bool btc_manual; +int ret; -if (kstrtobool_from_user (user_buf, count, &btc_manual)) - goto out; + ret =kstrtobool_from_user (user_buf, count, &btc_manual); +if (ret) +return ret; btc->ctrl.manual = btc_manual; -out: +return count; }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 150/600 wifi: mt76: mt7921: fix non-PSC channel scan fail
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ming Yen Hsieh <[email protected]>
[ Upstream commit 0e5911bb7cc92c00dda9b4d635c1266b7ca915c6 ]
Due to the scan command may only request legacy bands and PSC channel in 6GHz band, we are unable to scan the APs on non-PSC channel in this case. Enable WIPHY_FLAG_SPLIT_SCAN_6GHZ to support non-PSC channel (obtained during scan on legacy bands) in 6GHz scan request.
--- drivers/net/wireless/mediatek/mt76/mt7921/init.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7921/init.c +2 -1
@@ -80,7 +80,8 @@ mt7921_init_wiphy(struct ieee80211_hw *hw) wiphy->max_sched_scan_ssids =MT76_CONNAC_MAX_SCHED_SCAN_SSID ; wiphy->max_match_sets =MT76_CONNAC_MAX_SCAN_MATCH ; wiphy->max_sched_scan_reqs =1 ; - wiphy->flags |=WIPHY_FLAG_HAS_CHANNEL_SWITCH ; + wiphy->flags |=WIPHY_FLAG_HAS_CHANNEL_SWITCH | +WIPHY_FLAG_SPLIT_SCAN_6GHZ ; wiphy->reg_notifier = mt7921_regd_notifier; wiphy->features |= NL80211_FEATURE_SCHED_SCAN_RANDOM_MAC_ADDR |
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 151/600 udp: re-score reuseport groups when connected sockets are present
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lorenz Bauer <[email protected]>
[ Upstream commit f0ea27e7bfe1c34e1f451a63eb68faa1d4c3a86d ]
Contrary to TCP, UDP reuseport groups can contain TCP_ESTABLISHED sockets. To support these properly we remember whether a group has a connected socket and skip the fast reuseport early-return. In effect we continue scoring all reuseport sockets and then choose the one with the highest score.
The current code fails to re-calculate the score for the result of lookup_reuseport. According to Kuniyuki Iwashima:
1) SO_INCOMING_CPU is set
-> selected sk might have +1 score
2) BPF prog returns ESTABLISHED and/or SO_INCOMING_CPU sk -> selected sk will have more than 8
Using the old score could trigger more lookups depending on the order that sockets are created.
sk -> sk (SO_INCOMING_CPU) -> sk (ESTABLISHED)
| |
`-> select the next SO_INCOMING_CPU sk
|
`-> select itself (We should save this lookup)--- net/ipv4/udp.c | 20 +++++++++++++++----- net/ipv6/udp.c | 19 ++++++++++++++----- 2 files changed, 29 insertions(+), 10 deletions(-)
net/ipv4/udp.c +15 -5
@@ -445,14 +445,24 @@ static struct sock *udp4_lib_lookup2(struct net *net, score =compute_score (sk, net, saddr, sport, daddr, hnum, dif, sdif);if (score > badness) { - result =lookup_reuseport (net, sk, skb, - saddr, sport, daddr, hnum); + badness = score; + result =lookup_reuseport (net, sk, skb, saddr, sport, daddr, hnum); +if (!result) { + result = sk; +continue ; + } +/* Fall back to scoring if group has connections */ -if (result && !reuseport_has_conns (sk)) +if (!reuseport_has_conns (sk))return result; - result = result ? : sk; - badness = score; +/* Reuseport logic returned an error, keep original score. */ +if (IS_ERR (result)) +continue ; + + badness =compute_score (result, net, saddr, sport, + daddr, hnum, dif, sdif); + } }return result;
net/ipv6/udp.c +14 -5
@@ -193,14 +193,23 @@ static struct sock *udp6_lib_lookup2(struct net *net, score =compute_score (sk, net, saddr, sport, daddr, hnum, dif, sdif);if (score > badness) { - result =lookup_reuseport (net, sk, skb, - saddr, sport, daddr, hnum); + badness = score; + result =lookup_reuseport (net, sk, skb, saddr, sport, daddr, hnum); +if (!result) { + result = sk; +continue ; + } +/* Fall back to scoring if group has connections */ -if (result && !reuseport_has_conns (sk)) +if (!reuseport_has_conns (sk))return result; - result = result ? : sk; - badness = score; +/* Reuseport logic returned an error, keep original score. */ +if (IS_ERR (result)) +continue ; + + badness =compute_score (sk, net, saddr, sport, + daddr, hnum, dif, sdif); } }return result;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 152/600 bpf: reject unhashed sockets in bpf_sk_assign
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lorenz Bauer <[email protected]>
[ Upstream commit 67312adc96b5a585970d03b62412847afe2c6b01 ]
The semantics for bpf_sk_assign are as follows:
sk = some_lookup_func()
bpf_sk_assign(skb, sk)
bpf_sk_release(sk)
That is, the sk is not consumed by bpf_sk_assign. The function therefore needs to make sure that sk lives long enough to be consumed from __inet_lookup_skb. The path through the stack for a TCPv4 packet is roughly:
netif_receive_skb_core: takes RCU read lock
__netif_receive_skb_core:
sch_handle_ingress:
tcf_classify:
bpf_sk_assign()
deliver_ptype_list_skb:
deliver_skb:
ip_packet_type->func == ip_rcv:
ip_rcv_core:
ip_rcv_finish_core:
dst_input:
ip_local_deliver:
ip_local_deliver_finish:
ip_protocol_deliver_rcu:
tcp_v4_rcv:
__inet_lookup_skb:
skb_steal_sockThe existing helper takes advantage of the fact that everything happens in the same RCU critical section: for sockets with SOCK_RCU_FREE set bpf_sk_assign never takes a reference. skb_steal_sock then checks SOCK_RCU_FREE again and does sock_put if necessary.
This approach assumes that SOCK_RCU_FREE is never set on a sk between bpf_sk_assign and skb_steal_sock, but this invariant is violated by unhashed UDP sockets. A new UDP socket is created in TCP_CLOSE state but without SOCK_RCU_FREE set. That flag is only added in udp_lib_get_port() which happens when a socket is bound.
When bpf_sk_assign was added it wasn't possible to access unhashed UDP sockets from BPF, so this wasn't a problem. This changed in commit 0c48eefae712 ("sock_map: Lift socket state restriction for datagram sockets"), but the helper wasn't adjusted accordingly. The following sequence of events will therefore lead to a refcount leak:
1. Add socket(AF_INET, SOCK_DGRAM) to a sockmap.
2. Pull socket out of sockmap and bpf_sk_assign it. Since SOCK_RCU_FREE is not set we increment the refcount.
3. bind() or connect() the socket, setting SOCK_RCU_FREE.
4. skb_steal_sock will now set refcounted = false due to SOCK_RCU_FREE.
5. tcp_v4_rcv() skips sock_put().
Fix the problem by rejecting unhashed sockets in bpf_sk_assign(). This matches the behaviour of __inet_lookup_skb which is ultimately the goal of bpf_sk_assign().
--- net/core/filter.c | 2 ++ 1 file changed, 2 insertions(+)
net/core/filter.c +2 -0
@@ -7259,6 +7259,8 @@ BPF_CALL_3(bpf_sk_assign, struct sk_buff *, skb, struct sock *, sk, u64, flags)return -ENETUNREACH ;if (unlikely (sk_fullsock (sk) && sk->sk_reuseport))return -ESOCKTNOSUPPORT ; +if (sk_unhashed (sk)) +return -EOPNOTSUPP ;if (sk_is_refcounted (sk) &&unlikely (!refcount_inc_not_zero (&sk->sk_refcnt)))return -ENOENT ;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 153/600 net: export inet_lookup_reuseport and inet6_lookup_reuseport
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lorenz Bauer <[email protected]>
[ Upstream commit ce796e60b3b196b61fcc565df195443cbb846ef0 ]
Rename the existing reuseport helpers for IPv4 and IPv6 so that they can be invoked in the follow up commit. Export them so that building DCCP and IPv6 as a module works.
No change in functionality.
Stable-dep-of: 9c02bec95954 ("bpf, net: Support SO_REUSEPORT sockets with bpf_sk_assign")
--- include/net/inet6_hashtables.h | 7 +++++++ include/net/inet_hashtables.h | 5 +++++ net/ipv4/inet_hashtables.c | 15 ++++++++------- net/ipv6/inet6_hashtables.c | 19 ++++++++++--------- 4 files changed, 30 insertions(+), 16 deletions(-)
include/net/inet6_hashtables.h +7 -0
@@ -48,6 +48,13 @@ struct sock *__inet6_lookup_established(struct net *net, const u16 hnum, const int dif, const int sdif); +struct sock *inet6_lookup_reuseport (struct net *net,struct sock *sk, +struct sk_buff *skb,int doff, +const struct in6_addr *saddr, +__be16 sport, +const struct in6_addr *daddr, +unsigned short hnum); + struct sock *inet6_lookup_listener(struct net *net, struct inet_hashinfo *hashinfo, struct sk_buff *skb, int doff,
include/net/inet_hashtables.h +5 -0
@@ -379,6 +379,11 @@ struct sock *__inet_lookup_established(struct net *net, const __be32 daddr, const u16 hnum, const int dif, const int sdif); +struct sock *inet_lookup_reuseport (struct net *net,struct sock *sk, +struct sk_buff *skb,int doff, +__be32 saddr,__be16 sport, +__be32 daddr,unsigned short hnum); +static inline struct sock * inet_lookup_established(struct net *net, struct inet_hashinfo *hashinfo, const __be32 saddr, const __be16 sport,
net/ipv4/inet_hashtables.c +8 -7
@@ -332,10 +332,10 @@ static inline int compute_score(struct sock *sk, struct net *net,return score; } -static inline struct sock *lookup_reuseport (struct net *net,struct sock *sk, -struct sk_buff *skb,int doff, -__be32 saddr,__be16 sport, -__be32 daddr,unsigned short hnum) +struct sock *inet_lookup_reuseport (struct net *net,struct sock *sk, +struct sk_buff *skb,int doff, +__be32 saddr,__be16 sport, +__be32 daddr,unsigned short hnum) {struct sock *reuse_sk =NULL ;u32 phash;
@@ -346,6 +346,7 @@ static inline struct sock *lookup_reuseport(struct net *net, struct sock *sk, }return reuse_sk; } +EXPORT_SYMBOL_GPL (inet_lookup_reuseport);/* * Here are some nice properties to exploit here. The BSD API
@@ -369,8 +370,8 @@ static struct sock *inet_lhash2_lookup(struct net *net,sk_nulls_for_each_rcu (sk, node, &ilb2->nulls_head) { score =compute_score (sk, net, hnum, daddr, dif, sdif);if (score > hiscore) { - result =lookup_reuseport (net, sk, skb, doff, - saddr, sport, daddr, hnum); + result =inet_lookup_reuseport (net, sk, skb, doff, + saddr, sport, daddr, hnum);if (result)return result;
@@ -399,7 +400,7 @@ static inline struct sock *inet_lookup_run_bpf(struct net *net,if (no_reuseport ||IS_ERR_OR_NULL (sk))return sk; - reuse_sk =lookup_reuseport (net, sk, skb, doff, saddr, sport, daddr, hnum); + reuse_sk =inet_lookup_reuseport (net, sk, skb, doff, saddr, sport, daddr, hnum);if (reuse_sk) sk = reuse_sk;return sk;
net/ipv6/inet6_hashtables.c +10 -9
@@ -111,12 +111,12 @@ static inline int compute_score(struct sock *sk, struct net *net,return score; } -static inline struct sock *lookup_reuseport (struct net *net,struct sock *sk, -struct sk_buff *skb,int doff, -const struct in6_addr *saddr, -__be16 sport, -const struct in6_addr *daddr, -unsigned short hnum) +struct sock *inet6_lookup_reuseport (struct net *net,struct sock *sk, +struct sk_buff *skb,int doff, +const struct in6_addr *saddr, +__be16 sport, +const struct in6_addr *daddr, +unsigned short hnum) {struct sock *reuse_sk =NULL ;u32 phash;
@@ -127,6 +127,7 @@ static inline struct sock *lookup_reuseport(struct net *net, struct sock *sk, }return reuse_sk; } +EXPORT_SYMBOL_GPL (inet6_lookup_reuseport);/* called with rcu_read_lock() */ static struct sock *inet6_lhash2_lookup(struct net *net,
@@ -143,8 +144,8 @@ static struct sock *inet6_lhash2_lookup(struct net *net,sk_nulls_for_each_rcu (sk, node, &ilb2->nulls_head) { score =compute_score (sk, net, hnum, daddr, dif, sdif);if (score > hiscore) { - result =lookup_reuseport (net, sk, skb, doff, - saddr, sport, daddr, hnum); + result =inet6_lookup_reuseport (net, sk, skb, doff, + saddr, sport, daddr, hnum);if (result)return result;
@@ -175,7 +176,7 @@ static inline struct sock *inet6_lookup_run_bpf(struct net *net,if (no_reuseport ||IS_ERR_OR_NULL (sk))return sk; - reuse_sk =lookup_reuseport (net, sk, skb, doff, saddr, sport, daddr, hnum); + reuse_sk =inet6_lookup_reuseport (net, sk, skb, doff, saddr, sport, daddr, hnum);if (reuse_sk) sk = reuse_sk;return sk;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 154/600 net: remove duplicate reuseport_lookup functions
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lorenz Bauer <[email protected]>
[ Upstream commit 0f495f7617229772403e683033abc473f0f0553c ]
There are currently four copies of reuseport_lookup: one each for (TCP, UDP)x(IPv4, IPv6). This forces us to duplicate all callers of those functions as well. This is already the case for sk_lookup helpers (inet,inet6,udp4,udp6)_lookup_run_bpf.
There are two differences between the reuseport_lookup helpers:
1. They call different hash functions depending on protocol
2. UDP reuseport_lookup checks that sk_state != TCP_ESTABLISHED
Move the check for sk_state into the caller and use the INDIRECT_CALL infrastructure to cut down the helpers to one per IP version.
Stable-dep-of: 9c02bec95954 ("bpf, net: Support SO_REUSEPORT sockets with bpf_sk_assign")
--- include/net/inet6_hashtables.h | 11 ++++++++- include/net/inet_hashtables.h | 15 ++++++++----- net/ipv4/inet_hashtables.c | 20 +++++++++++------ net/ipv4/udp.c | 34 +++++++++++----------------- net/ipv6/inet6_hashtables.c | 14 ++++++++---- net/ipv6/udp.c | 41 +++++++++++++--------------------- 6 files changed, 72 insertions(+), 63 deletions(-)
include/net/inet6_hashtables.h +10 -1
@@ -48,12 +48,21 @@ struct sock *__inet6_lookup_established(struct net *net, const u16 hnum, const int dif, const int sdif); +typedef u32 (inet6_ehashfn_t )(const struct net *net, +const struct in6_addr *laddr,const u16 lport, +const struct in6_addr *faddr,const __be16 fport); + +inet6_ehashfn_t inet6_ehashfn; + +INDIRECT_CALLABLE_DECLARE(inet6_ehashfn_t udp6_ehashfn); +struct sock *inet6_lookup_reuseport (struct net *net,struct sock *sk,struct sk_buff *skb,int doff,const struct in6_addr *saddr,__be16 sport,const struct in6_addr *daddr, -unsigned short hnum); +unsigned short hnum, +inet6_ehashfn_t *ehashfn); struct sock *inet6_lookup_listener(struct net *net, struct inet_hashinfo *hashinfo,
include/net/inet_hashtables.h +10 -5
@@ -379,10 +379,19 @@ struct sock *__inet_lookup_established(struct net *net, const __be32 daddr, const u16 hnum, const int dif, const int sdif); +typedef u32 (inet_ehashfn_t )(const struct net *net, +const __be32 laddr,const __u16 lport, +const __be32 faddr,const __be16 fport); + +inet_ehashfn_t inet_ehashfn; + +INDIRECT_CALLABLE_DECLARE(inet_ehashfn_t udp_ehashfn); +struct sock *inet_lookup_reuseport (struct net *net,struct sock *sk,struct sk_buff *skb,int doff,__be32 saddr,__be16 sport, -__be32 daddr,unsigned short hnum); +__be32 daddr,unsigned short hnum, +inet_ehashfn_t *ehashfn);static inline struct sock * inet_lookup_established(struct net *net, struct inet_hashinfo *hashinfo,
@@ -453,10 +462,6 @@ static inline struct sock *__inet_lookup_skb(struct inet_hashinfo *hashinfo, refcounted); } -u32 inet6_ehashfn (const struct net *net, -const struct in6_addr *laddr,const u16 lport, -const struct in6_addr *faddr,const __be16 fport); -static inline void sk_daddr_set (struct sock *sk,__be32 addr) { sk->sk_daddr = addr;/* alias of inet_daddr */
net/ipv4/inet_hashtables.c +13 -7
@@ -28,9 +28,9 @@#include <net/tcp.h> #include <net/sock_reuseport.h> -static u32 inet_ehashfn (const struct net *net,const __be32 laddr, -const __u16 lport,const __be32 faddr, -const __be16 fport) +u32 inet_ehashfn (const struct net *net,const __be32 laddr, +const __u16 lport,const __be32 faddr, +const __be16 fport) {static u32 inet_ehash_secret__read_mostly ;
@@ -39,6 +39,7 @@ static u32 inet_ehashfn(const struct net *net, const __be32 laddr,return __inet_ehashfn (laddr, lport, faddr, fport, inet_ehash_secret +net_hash_mix (net)); } +EXPORT_SYMBOL_GPL (inet_ehashfn);/* This function handles inet_sock, but also timewait and request sockets * for IPv4/IPv6.
@@ -332,16 +333,20 @@ static inline int compute_score(struct sock *sk, struct net *net,return score; } +INDIRECT_CALLABLE_DECLARE(inet_ehashfn_t udp_ehashfn); +struct sock *inet_lookup_reuseport (struct net *net,struct sock *sk,struct sk_buff *skb,int doff,__be32 saddr,__be16 sport, -__be32 daddr,unsigned short hnum) +__be32 daddr,unsigned short hnum, +inet_ehashfn_t *ehashfn) {struct sock *reuse_sk =NULL ;u32 phash;if (sk->sk_reuseport) { - phash =inet_ehashfn (net, daddr, hnum, saddr, sport); + phash =INDIRECT_CALL_2 (ehashfn, udp_ehashfn, inet_ehashfn, + net, daddr, hnum, saddr, sport); reuse_sk =reuseport_select_sock (sk, phash, skb, doff); }return reuse_sk;
@@ -371,7 +376,7 @@ static struct sock *inet_lhash2_lookup(struct net *net, score =compute_score (sk, net, hnum, daddr, dif, sdif);if (score > hiscore) { result =inet_lookup_reuseport (net, sk, skb, doff, - saddr, sport, daddr, hnum); + saddr, sport, daddr, hnum, inet_ehashfn);if (result)return result;
@@ -400,7 +405,8 @@ static inline struct sock *inet_lookup_run_bpf(struct net *net,if (no_reuseport ||IS_ERR_OR_NULL (sk))return sk; - reuse_sk =inet_lookup_reuseport (net, sk, skb, doff, saddr, sport, daddr, hnum); + reuse_sk =inet_lookup_reuseport (net, sk, skb, doff, saddr, sport, daddr, hnum, + inet_ehashfn);if (reuse_sk) sk = reuse_sk;return sk;
net/ipv4/udp.c +13 -21
@@ -400,9 +400,9 @@ static int compute_score(struct sock *sk, struct net *net,return score; } -static u32 udp_ehashfn (const struct net *net,const __be32 laddr, -const __u16 lport,const __be32 faddr, -const __be16 fport) +INDIRECT_CALLABLE_SCOPE +u32 udp_ehashfn(const struct net *net, const __be32 laddr, const __u16 lport, +const __be32 faddr,const __be16 fport) {static u32 udp_ehash_secret__read_mostly ;
@@ -412,22 +412,6 @@ static u32 udp_ehashfn(const struct net *net, const __be32 laddr, udp_ehash_secret + net_hash_mix(net)); } -static struct sock *lookup_reuseport (struct net *net,struct sock *sk, -struct sk_buff *skb, -__be32 saddr,__be16 sport, -__be32 daddr,unsigned short hnum) -{ -struct sock *reuse_sk =NULL ; -u32 hash; - -if (sk->sk_reuseport && sk->sk_state !=TCP_ESTABLISHED ) { - hash =udp_ehashfn (net, daddr, hnum, saddr, sport); - reuse_sk =reuseport_select_sock (sk, hash, skb, -sizeof (struct udphdr )); - } -return reuse_sk; -} -/* called with rcu_read_lock() */ static struct sock *udp4_lib_lookup2(struct net *net, __be32 saddr, __be16 sport,
@@ -446,7 +430,14 @@ static struct sock *udp4_lib_lookup2(struct net *net, daddr, hnum, dif, sdif);if (score > badness) { badness = score; - result =lookup_reuseport (net, sk, skb, saddr, sport, daddr, hnum); + +if (sk->sk_state ==TCP_ESTABLISHED ) { + result = sk; +continue ; + } + + result =inet_lookup_reuseport (net, sk, skb,sizeof (struct udphdr ), + saddr, sport, daddr, hnum, udp_ehashfn);if (!result) { result = sk;continue ;
@@ -485,7 +476,8 @@ static struct sock *udp4_lookup_run_bpf(struct net *net,if (no_reuseport ||IS_ERR_OR_NULL (sk))return sk; - reuse_sk =lookup_reuseport (net, sk, skb, saddr, sport, daddr, hnum); + reuse_sk =inet_lookup_reuseport (net, sk, skb,sizeof (struct udphdr ), + saddr, sport, daddr, hnum, udp_ehashfn);if (reuse_sk) sk = reuse_sk;return sk;
net/ipv6/inet6_hashtables.c +10 -4
@@ -39,6 +39,7 @@ u32 inet6_ehashfn(const struct net *net,return __inet6_ehashfn (lhash, lport, fhash, fport, inet6_ehash_secret +net_hash_mix (net)); } +EXPORT_SYMBOL_GPL (inet6_ehashfn);/* * Sockets in TCP_CLOSE state are _always_ taken out of the hash, so
@@ -111,18 +112,22 @@ static inline int compute_score(struct sock *sk, struct net *net,return score; } +INDIRECT_CALLABLE_DECLARE(inet6_ehashfn_t udp6_ehashfn); +struct sock *inet6_lookup_reuseport (struct net *net,struct sock *sk,struct sk_buff *skb,int doff,const struct in6_addr *saddr,__be16 sport,const struct in6_addr *daddr, -unsigned short hnum) +unsigned short hnum, +inet6_ehashfn_t *ehashfn) {struct sock *reuse_sk =NULL ;u32 phash;if (sk->sk_reuseport) { - phash =inet6_ehashfn (net, daddr, hnum, saddr, sport); + phash =INDIRECT_CALL_INET (ehashfn, udp6_ehashfn, inet6_ehashfn, + net, daddr, hnum, saddr, sport); reuse_sk =reuseport_select_sock (sk, phash, skb, doff); }return reuse_sk;
@@ -145,7 +150,7 @@ static struct sock *inet6_lhash2_lookup(struct net *net, score =compute_score (sk, net, hnum, daddr, dif, sdif);if (score > hiscore) { result =inet6_lookup_reuseport (net, sk, skb, doff, - saddr, sport, daddr, hnum); + saddr, sport, daddr, hnum, inet6_ehashfn);if (result)return result;
@@ -176,7 +181,8 @@ static inline struct sock *inet6_lookup_run_bpf(struct net *net,if (no_reuseport ||IS_ERR_OR_NULL (sk))return sk; - reuse_sk =inet6_lookup_reuseport (net, sk, skb, doff, saddr, sport, daddr, hnum); + reuse_sk =inet6_lookup_reuseport (net, sk, skb, doff, + saddr, sport, daddr, hnum, inet6_ehashfn);if (reuse_sk) sk = reuse_sk;return sk;
net/ipv6/udp.c +16 -25
65 lines not on this page · raw message
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 155/600 bpf, net: Support SO_REUSEPORT sockets with bpf_sk_assign
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lorenz Bauer <[email protected]>
[ Upstream commit 9c02bec95954252c3c01bfbb3f7560e0b95ca955 ]
Currently the bpf_sk_assign helper in tc BPF context refuses SO_REUSEPORT sockets. This means we can't use the helper to steer traffic to Envoy, which configures SO_REUSEPORT on its sockets. In turn, we're blocked from removing TPROXY from our setup.
The reason that bpf_sk_assign refuses such sockets is that the bpf_sk_lookup helpers don't execute SK_REUSEPORT programs. Instead, one of the reuseport sockets is selected by hash. This could cause dispatch to the "wrong" socket:
sk = bpf_sk_lookup_tcp(...) // select SO_REUSEPORT by hash bpf_sk_assign(skb, sk) // SK_REUSEPORT wasn't executed
Fixing this isn't as simple as invoking SK_REUSEPORT from the lookup helpers unfortunately. In the tc context, L2 headers are at the start of the skb, while SK_REUSEPORT expects L3 headers instead.
Instead, we execute the SK_REUSEPORT program when the assigned socket is pulled out of the skb, further up the stack. This creates some trickiness with regards to refcounting as bpf_sk_assign will put both refcounted and RCU freed sockets in skb->sk. reuseport sockets are RCU freed. We can infer that the sk_assigned socket is RCU freed if the reuseport lookup succeeds, but convincing yourself of this fact isn't straight forward. Therefore we defensively check refcounting on the sk_assign sock even though it's probably not required in practice.
--- include/net/inet6_hashtables.h | 56 +++++++++++++++++++++++++++++++--- include/net/inet_hashtables.h | 49 +++++++++++++++++++++++++++-- include/net/sock.h | 7 +++-- include/uapi/linux/bpf.h | 3 -- net/core/filter.c | 2 -- net/ipv4/udp.c | 8 +++-- net/ipv6/udp.c | 8 +++-- tools/include/uapi/linux/bpf.h | 3 -- 8 files changed, 115 insertions(+), 21 deletions(-)
include/net/inet6_hashtables.h +51 -5
@@ -94,6 +94,46 @@ static inline struct sock *__inet6_lookup(struct net *net, daddr, hnum, dif, sdif); } +static inline +struct sock *inet6_steal_sock (struct net *net,struct sk_buff *skb,int doff, +const struct in6_addr *saddr,const __be16 sport, +const struct in6_addr *daddr,const __be16 dport, +bool *refcounted,inet6_ehashfn_t *ehashfn) +{ +struct sock *sk, *reuse_sk; +bool prefetched; + + sk =skb_steal_sock (skb, refcounted, &prefetched); +if (!sk) +return NULL ; + +if (!prefetched) +return sk; + +if (sk->sk_protocol ==IPPROTO_TCP ) { +if (sk->sk_state !=TCP_LISTEN ) +return sk; + }else if (sk->sk_protocol ==IPPROTO_UDP ) { +if (sk->sk_state !=TCP_CLOSE ) +return sk; + }else { +return sk; + } + + reuse_sk =inet6_lookup_reuseport (net, sk, skb, doff, + saddr, sport, daddr,ntohs (dport), + ehashfn); +if (!reuse_sk) +return sk; + +/* We've chosen a new reuseport sock which is never refcounted. This +* implies that sk also isn't refcounted. +*/ +WARN_ON_ONCE (*refcounted); + +return reuse_sk; +} + static inline struct sock *__inet6_lookup_skb(struct inet_hashinfo *hashinfo, struct sk_buff *skb, int doff, const __be16 sport,
@@ -101,14 +141,20 @@ static inline struct sock *__inet6_lookup_skb(struct inet_hashinfo *hashinfo, int iif, int sdif, bool *refcounted) { - struct sock *sk = skb_steal_sock(skb, refcounted); - + struct net *net = dev_net(skb_dst(skb)->dev); +const struct ipv6hdr *ip6h =ipv6_hdr (skb); +struct sock *sk; + + sk =inet6_steal_sock (net, skb, doff, &ip6h->saddr, sport, &ip6h->daddr, dport, + refcounted, inet6_ehashfn); +if (IS_ERR (sk)) +return NULL ;if (sk)return sk; -return __inet6_lookup (dev_net (skb_dst (skb)->dev), hashinfo, skb, - doff, &ipv6_hdr (skb)->saddr, sport, - &ipv6_hdr (skb)->daddr,ntohs (dport), +return __inet6_lookup (net, hashinfo, skb, + doff, &ip6h->saddr, sport, + &ip6h->daddr,ntohs (dport), iif, sdif, refcounted); }
include/net/inet_hashtables.h +47 -2
66 lines not on this page · raw message
include/net/sock.h +5 -2
@@ -2852,20 +2852,23 @@ sk_is_refcounted(struct sock *sk)* skb_steal_sock - steal a socket from an sk_buff * @skb: sk_buff to steal the socket from * @refcounted: is set to true if the socket is reference-counted +* @prefetched: is set to true if the socket was assigned from bpf */ static inline struct sock * -skb_steal_sock (struct sk_buff *skb,bool *refcounted) +skb_steal_sock (struct sk_buff *skb,bool *refcounted,bool *prefetched) {if (skb->sk) {struct sock *sk = skb->sk; *refcounted = true; -if (skb_sk_is_prefetched (skb)) + *prefetched =skb_sk_is_prefetched (skb); +if (*prefetched) *refcounted =sk_is_refcounted (sk); skb->destructor =NULL ; skb->sk =NULL ;return sk; } + *prefetched = false; *refcounted = false;return NULL ; }
include/uapi/linux/bpf.h +0 -3
@@ -4079,9 +4079,6 @@ union bpf_attr {* **-EOPNOTSUPP** if the operation is not supported, for example * a call from outside of TC ingress. * -* **-ESOCKTNOSUPPORT** if the socket type is not supported -* (reuseport). -* * long bpf_sk_assign(struct bpf_sk_lookup *ctx, struct bpf_sock *sk, u64 flags) * Description * Helper is overloaded depending on BPF program type. This
net/core/filter.c +0 -2
@@ -7257,8 +7257,6 @@ BPF_CALL_3(bpf_sk_assign, struct sk_buff *, skb, struct sock *, sk, u64, flags)return -EOPNOTSUPP ;if (unlikely (dev_net (skb->dev) !=sock_net (sk)))return -ENETUNREACH ; -if (unlikely (sk_fullsock (sk) && sk->sk_reuseport)) -return -ESOCKTNOSUPPORT ;if (sk_unhashed (sk))return -EOPNOTSUPP ; if (sk_is_refcounted(sk) &&
net/ipv4/udp.c +6 -2
@@ -2442,7 +2442,11 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct udp_table *udptable,if (udp4_csum_init (skb, uh, proto)) goto csum_error; - sk =skb_steal_sock (skb, &refcounted); + sk =inet_steal_sock (net, skb,sizeof (struct udphdr ), saddr, uh->source, daddr, uh->dest, + &refcounted, udp_ehashfn); +if (IS_ERR (sk)) + goto no_sk; +if (sk) {struct dst_entry *dst =skb_dst (skb);int ret;
@@ -2463,7 +2467,7 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct udp_table *udptable, sk =__udp4_lib_lookup_skb (skb, uh->source, uh->dest, udptable);if (sk)return udp_unicast_rcv_skb (sk, skb, uh); - +no_sk:if (!xfrm4_policy_check (NULL ,XFRM_POLICY_IN , skb)) goto drop;nf_reset_ct (skb);
net/ipv6/udp.c +6 -2
@@ -983,7 +983,11 @@ int __udp6_lib_rcv(struct sk_buff *skb, struct udp_table *udptable, goto csum_error;/* Check if the socket is already available, e.g. due to early demux */ - sk =skb_steal_sock (skb, &refcounted); + sk =inet6_steal_sock (net, skb,sizeof (struct udphdr ), saddr, uh->source, daddr, uh->dest, + &refcounted, udp6_ehashfn); +if (IS_ERR (sk)) + goto no_sk; +if (sk) {struct dst_entry *dst =skb_dst (skb);int ret;
@@ -1017,7 +1021,7 @@ int __udp6_lib_rcv(struct sk_buff *skb, struct udp_table *udptable, goto report_csum_error;return udp6_unicast_rcv_skb (sk, skb, uh); } - +no_sk: reason =SKB_DROP_REASON_NO_SOCKET ;if (!uh->check)
tools/include/uapi/linux/bpf.h +0 -3
@@ -4079,9 +4079,6 @@ union bpf_attr {* **-EOPNOTSUPP** if the operation is not supported, for example * a call from outside of TC ingress. * -* **-ESOCKTNOSUPPORT** if the socket type is not supported -* (reuseport). -* * long bpf_sk_assign(struct bpf_sk_lookup *ctx, struct bpf_sock *sk, u64 flags) * Description * Helper is overloaded depending on BPF program type. This
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 156/600 wifi: mt76: testmode: add nla_policy for MT76_TM_ATTR_TX_LENGTH
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lin Ma <[email protected]>
[ Upstream commit 74f12d511625e603fac8c0c2b6872e687e56dd61 ]
It seems that the nla_policy in mt76_tm_policy is missed for attribute MT76_TM_ATTR_TX_LENGTH. This patch adds the correct description to make sure the
u32 val = nla_get_u32(tb[MT76_TM_ATTR_TX_LENGTH]);
in function mt76_testmode_cmd() is safe and will not result in out-of-attribute read.
--- drivers/net/wireless/mediatek/mt76/testmode.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/mediatek/mt76/testmode.c +1 -0
@@ -8,6 +8,7 @@ const struct nla_policy mt76_tm_policy[NUM_MT76_TM_ATTRS] = { [MT76_TM_ATTR_RESET] = { .type = NLA_FLAG }, [MT76_TM_ATTR_STATE] = { .type = NLA_U8 }, [MT76_TM_ATTR_TX_COUNT] = { .type = NLA_U32 }, + [MT76_TM_ATTR_TX_LENGTH] = { .type = NLA_U32 }, [MT76_TM_ATTR_TX_RATE_MODE] = { .type = NLA_U8 }, [MT76_TM_ATTR_TX_RATE_NSS] = { .type = NLA_U8 }, [MT76_TM_ATTR_TX_RATE_IDX] = { .type = NLA_U8 },
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 157/600 spi: tegra20-sflash: fix to check return value of platform_get_irq() in tegra_sflash_probe()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhang Shurong <[email protected]>
[ Upstream commit 29a449e765ff70a5bd533be94babb6d36985d096 ]
The platform_get_irq might be failed and return a negative result. So there should have an error handling code.
Fixed this by adding an error handling code.
--- drivers/spi/spi-tegra20-sflash.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/spi/spi-tegra20-sflash.c +5 -1
@@ -455,7 +455,11 @@ static int tegra_sflash_probe(struct platform_device *pdev) goto exit_free_master; } - tsd->irq =platform_get_irq (pdev,0 ); + ret =platform_get_irq (pdev,0 ); +if (ret <0 ) + goto exit_free_master; + tsd->irq = ret; + ret =request_irq (tsd->irq, tegra_sflash_isr,0 ,dev_name (&pdev->dev), tsd);if (ret <0 ) {
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 158/600 can: gs_usb: gs_usb_receive_bulk_callback(): count RX overflow errors also in case of OOM
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marc Kleine-Budde <[email protected]>
[ Upstream commit 6c8bc15f02b85bc8f47074110d8fd8caf7a1e42d ]
In case of an RX overflow error from the CAN controller and an OOM where no skb can be allocated, the error counters are not incremented.
Fix this by first incrementing the error counters and then allocate the skb.
--- drivers/net/can/usb/gs_usb.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/can/usb/gs_usb.c +3 -2
@@ -626,6 +626,9 @@ static void gs_usb_receive_bulk_callback(struct urb *urb) }if (hf->flags &GS_CAN_FLAG_OVERFLOW ) { + stats->rx_over_errors++; + stats->rx_errors++; + skb =alloc_can_err_skb (netdev, &cf);if (!skb) goto resubmit_urb;
@@ -633,8 +636,6 @@ static void gs_usb_receive_bulk_callback(struct urb *urb) cf->can_id |=CAN_ERR_CRTL ; cf->len =CAN_ERR_DLC ; cf->data[1 ] =CAN_ERR_CRTL_RX_OVERFLOW ; - stats->rx_over_errors++; - stats->rx_errors++;netif_rx (skb); }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 159/600 wifi: mt76: mt7915: fix power-limits while chan_switch
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ryder Lee <[email protected]>
[ Upstream commit 6c0570bc21ec2073890aa252c8420ca7bec402e4 ]
If user changes the channel without completely disabling the interface the txpower_sku values reported track the old channel the device was operating on. If user bounces the interface the correct power tables are applied.
mt7915_sku_group_len array gets updated before the channel switch happens so it uses data from the old channel.
--- drivers/net/wireless/mediatek/mt76/mt7915/main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7915/main.c +2 -1
@@ -455,7 +455,8 @@ static int mt7915_config(struct ieee80211_hw *hw, u32 changed)ieee80211_wake_queues (hw); } -if (changed &IEEE80211_CONF_CHANGE_POWER ) { +if (changed & (IEEE80211_CONF_CHANGE_POWER | +IEEE80211_CONF_CHANGE_CHANNEL )) { ret =mt7915_mcu_set_txpower_sku (phy);if (ret)return ret;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 160/600 wifi: mwifiex: Fix OOB and integer underflow when rx packets
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Polaris Pi <[email protected]>
[ Upstream commit 11958528161731c58e105b501ed60b83a91ea941 ]
Make sure mwifiex_process_mgmt_packet, mwifiex_process_sta_rx_packet and mwifiex_process_uap_rx_packet, mwifiex_uap_queue_bridged_pkt and mwifiex_process_rx_packet not out-of-bounds access the skb->data buffer.
--- drivers/net/wireless/marvell/mwifiex/sta_rx.c | 11 ++++++++++- .../net/wireless/marvell/mwifiex/uap_txrx.c | 19 +++++++++++++++++++ drivers/net/wireless/marvell/mwifiex/util.c | 10 +++++++--- 3 files changed, 36 insertions(+), 4 deletions(-)
drivers/net/wireless/marvell/mwifiex/sta_rx.c +10 -1
@@ -86,6 +86,14 @@ int mwifiex_process_rx_packet(struct mwifiex_private *priv, rx_pkt_len =le16_to_cpu (local_rx_pd->rx_pkt_length); rx_pkt_hdr = (void *)local_rx_pd + rx_pkt_off; +if (sizeof (*rx_pkt_hdr) + rx_pkt_off > skb->len) { +mwifiex_dbg (priv->adapter,ERROR , +"wrong rx packet offset: len=%d, rx_pkt_off=%d\n" , + skb->len, rx_pkt_off); + priv->stats.rx_dropped++; +dev_kfree_skb_any (skb); + } + if ((!memcmp(&rx_pkt_hdr->rfc1042_hdr, bridge_tunnel_header, sizeof(bridge_tunnel_header))) || (!memcmp(&rx_pkt_hdr->rfc1042_hdr, rfc1042_header,
@@ -194,7 +202,8 @@ int mwifiex_process_sta_rx_packet(struct mwifiex_private *priv, rx_pkt_hdr = (void *)local_rx_pd + rx_pkt_offset; -if ((rx_pkt_offset + rx_pkt_length) > (u16 ) skb->len) { +if ((rx_pkt_offset + rx_pkt_length) > skb->len || +sizeof (rx_pkt_hdr->eth803_hdr) + rx_pkt_offset > skb->len) {mwifiex_dbg (adapter,ERROR ,"wrong rx packet: len=%d, rx_pkt_offset=%d, rx_pkt_length=%d\n" , skb->len, rx_pkt_offset, rx_pkt_length);
drivers/net/wireless/marvell/mwifiex/uap_txrx.c +19 -0
@@ -103,6 +103,15 @@ static void mwifiex_uap_queue_bridged_pkt(struct mwifiex_private *priv,return ; } +if (sizeof (*rx_pkt_hdr) + +le16_to_cpu (uap_rx_pd->rx_pkt_offset) > skb->len) { +mwifiex_dbg (adapter,ERROR , +"wrong rx packet offset: len=%d,rx_pkt_offset=%d\n" , + skb->len,le16_to_cpu (uap_rx_pd->rx_pkt_offset)); + priv->stats.rx_dropped++; +dev_kfree_skb_any (skb); + } + if ((!memcmp(&rx_pkt_hdr->rfc1042_hdr, bridge_tunnel_header, sizeof(bridge_tunnel_header))) || (!memcmp(&rx_pkt_hdr->rfc1042_hdr, rfc1042_header,
@@ -367,6 +376,16 @@ int mwifiex_process_uap_rx_packet(struct mwifiex_private *priv, rx_pkt_type =le16_to_cpu (uap_rx_pd->rx_pkt_type); rx_pkt_hdr = (void *)uap_rx_pd +le16_to_cpu (uap_rx_pd->rx_pkt_offset); +if (le16_to_cpu (uap_rx_pd->rx_pkt_offset) + +sizeof (rx_pkt_hdr->eth803_hdr) > skb->len) { +mwifiex_dbg (adapter,ERROR , +"wrong rx packet for struct ethhdr: len=%d, offset=%d\n" , + skb->len,le16_to_cpu (uap_rx_pd->rx_pkt_offset)); + priv->stats.rx_dropped++; +dev_kfree_skb_any (skb); +return 0 ; + } +ether_addr_copy (ta, rx_pkt_hdr->eth803_hdr.h_source); if ((le16_to_cpu(uap_rx_pd->rx_pkt_offset) +
drivers/net/wireless/marvell/mwifiex/util.c +7 -3
@@ -393,11 +393,15 @@ mwifiex_process_mgmt_packet(struct mwifiex_private *priv, } rx_pd = (struct rxpd *)skb->data; + pkt_len =le16_to_cpu (rx_pd->rx_pkt_length); +if (pkt_len <sizeof (struct ieee80211_hdr ) +sizeof (pkt_len)) { +mwifiex_dbg (priv->adapter,ERROR ,"invalid rx_pkt_length" ); +return -1 ; + }skb_pull (skb,le16_to_cpu (rx_pd->rx_pkt_offset));skb_pull (skb,sizeof (pkt_len)); - - pkt_len =le16_to_cpu (rx_pd->rx_pkt_length); + pkt_len -=sizeof (pkt_len); ieee_hdr = (void *)skb->data;if (ieee80211_is_mgmt (ieee_hdr->frame_control)) {
@@ -410,7 +414,7 @@ mwifiex_process_mgmt_packet(struct mwifiex_private *priv, skb->data +sizeof (struct ieee80211_hdr ), pkt_len - sizeof(struct ieee80211_hdr)); - pkt_len -=ETH_ALEN +sizeof (pkt_len); + pkt_len -=ETH_ALEN ; rx_pd->rx_pkt_length =cpu_to_le16 (pkt_len); cfg80211_rx_mgmt(&priv->wdev, priv->roc_cfg.chan.center_freq,
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 161/600 wifi: mwifiex: fix error recovery in PCIE buffer descriptor management
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Antipov <[email protected]>
[ Upstream commit 288c63d5cb4667a51a04668b3e2bb0ea499bc5f4 ]
Add missing 'kfree_skb()' in 'mwifiex_init_rxq_ring()' and never do 'kfree(card->rxbd_ring_vbase)' because this area is DMAed and should be released with 'dma_free_coherent()'. The latter is performed in 'mwifiex_pcie_delete_rxbd_ring()', which is now called to recover from possible errors in 'mwifiex_pcie_create_rxbd_ring()'. Likewise for 'mwifiex_pcie_init_evt_ring()', 'kfree(card->evtbd_ring_vbase)' 'mwifiex_pcie_delete_evtbd_ring()' and 'mwifiex_pcie_create_rxbd_ring()'.
--- drivers/net/wireless/marvell/mwifiex/pcie.c | 25 ++++++++++++++------- 1 file changed, 17 insertions(+), 8 deletions(-)
drivers/net/wireless/marvell/mwifiex/pcie.c +17 -8
@@ -189,6 +189,8 @@ static int mwifiex_pcie_probe_of(struct device *dev) }static void mwifiex_pcie_work (struct work_struct *work); +static int mwifiex_pcie_delete_rxbd_ring (struct mwifiex_adapter *adapter); +static int mwifiex_pcie_delete_evtbd_ring (struct mwifiex_adapter *adapter); static int mwifiex_map_pci_memory(struct mwifiex_adapter *adapter, struct sk_buff *skb,
@@ -792,14 +794,15 @@ static int mwifiex_init_rxq_ring(struct mwifiex_adapter *adapter)if (!skb) {mwifiex_dbg (adapter,ERROR ,"Unable to allocate skb for RX ring.\n" ); -kfree (card->rxbd_ring_vbase);return -ENOMEM ; }if (mwifiex_map_pci_memory (adapter, skb,MWIFIEX_RX_DATA_BUF_SIZE , -DMA_FROM_DEVICE )) -return -1 ; +DMA_FROM_DEVICE )) { +kfree_skb (skb); +return -ENOMEM ; + } buf_pa =MWIFIEX_SKB_DMA_ADDR (skb);
@@ -849,7 +852,6 @@ static int mwifiex_pcie_init_evt_ring(struct mwifiex_adapter *adapter)if (!skb) {mwifiex_dbg (adapter,ERROR ,"Unable to allocate skb for EVENT buf.\n" ); -kfree (card->evtbd_ring_vbase);return -ENOMEM ; }skb_put (skb,MAX_EVENT_SIZE );
@@ -857,8 +859,7 @@ static int mwifiex_pcie_init_evt_ring(struct mwifiex_adapter *adapter)if (mwifiex_map_pci_memory (adapter, skb,MAX_EVENT_SIZE ,DMA_FROM_DEVICE )) {kfree_skb (skb); -kfree (card->evtbd_ring_vbase); -return -1 ; +return -ENOMEM ; } buf_pa =MWIFIEX_SKB_DMA_ADDR (skb);
@@ -1058,6 +1059,7 @@ static int mwifiex_pcie_delete_txbd_ring(struct mwifiex_adapter *adapter)*/ static int mwifiex_pcie_create_rxbd_ring (struct mwifiex_adapter *adapter) { +int ret;struct pcie_service_card *card = adapter->card;const struct mwifiex_pcie_card_reg *reg = card->pcie.reg;
@@ -1096,7 +1098,10 @@ static int mwifiex_pcie_create_rxbd_ring(struct mwifiex_adapter *adapter) (u32)((u64 )card->rxbd_ring_pbase >>32 ), card->rxbd_ring_size); -return mwifiex_init_rxq_ring (adapter); + ret =mwifiex_init_rxq_ring (adapter); +if (ret) +mwifiex_pcie_delete_rxbd_ring (adapter); +return ret; }/*
@@ -1127,6 +1132,7 @@ static int mwifiex_pcie_delete_rxbd_ring(struct mwifiex_adapter *adapter)*/ static int mwifiex_pcie_create_evtbd_ring (struct mwifiex_adapter *adapter) { +int ret;struct pcie_service_card *card = adapter->card;const struct mwifiex_pcie_card_reg *reg = card->pcie.reg;
@@ -1161,7 +1167,10 @@ static int mwifiex_pcie_create_evtbd_ring(struct mwifiex_adapter *adapter) (u32)((u64 )card->evtbd_ring_pbase >>32 ), card->evtbd_ring_size); -return mwifiex_pcie_init_evt_ring (adapter); + ret =mwifiex_pcie_init_evt_ring (adapter); +if (ret) +mwifiex_pcie_delete_evtbd_ring (adapter); +return ret; }/*
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 162/600 selftests/bpf: fix static assert compilation issue for test_cls_*.c
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alan Maguire <[email protected]>
[ Upstream commit 416c6d01244ecbf0abfdb898fd091b50ef951b48 ]
commit bdeeed3498c7 ("libbpf: fix offsetof() and container_of() to work with CO-RE")
...was backported to stable trees such as 5.15. The problem is that with older LLVM/clang (14/15) - which is often used for older kernels - we see compilation failures in BPF selftests now:
In file included from progs/test_cls_redirect_subprogs.c:2:progs/test_cls_redirect.c:90:2: error: static assertion expression is not an integral constant expression
sizeof(flow_ports_t) !=
^~~~~~~~~~~~~~~~~~~~~~~progs/test_cls_redirect.c:91:3: note: cast that performs the conversions of a reinterpret_cast is not allowed in a constant expression
offsetofend(struct bpf_sock_tuple, ipv4.dport) -
^progs/test_cls_redirect.c:32:3: note: expanded from macro 'offsetofend'
(offsetof(TYPE, MEMBER) + sizeof((((TYPE *)0)->MEMBER)))
^
tools/testing/selftests/bpf/tools/include/bpf/bpf_helpers.h:86:33: note: expanded from macro 'offsetof'
^
In file included from progs/test_cls_redirect_subprogs.c:2:
progs/test_cls_redirect.c:95:2: error: static assertion expression is not an integral constant expression
sizeof(flow_ports_t) !=
^~~~~~~~~~~~~~~~~~~~~~~progs/test_cls_redirect.c:96:3: note: cast that performs the conversions of a reinterpret_cast is not allowed in a constant expression
offsetofend(struct bpf_sock_tuple, ipv6.dport) -
^progs/test_cls_redirect.c:32:3: note: expanded from macro 'offsetofend'
(offsetof(TYPE, MEMBER) + sizeof((((TYPE *)0)->MEMBER)))
^
tools/testing/selftests/bpf/tools/include/bpf/bpf_helpers.h:86:33: note: expanded from macro 'offsetof'
^2 errors generated.
make: *** [Makefile:594: tools/testing/selftests/bpf/test_cls_redirect_subprogs.bpf.o] Error 1
The problem is the new offsetof() does not play nice with static asserts. Given that the context is a static assert (and CO-RE relocation is not needed at compile time), offsetof() usage can be replaced by restoring the original offsetof() definition as __builtin_offsetof().
--- tools/testing/selftests/bpf/progs/test_cls_redirect.h | 9 +++++++++ 1 file changed, 9 insertions(+)
tools/testing/selftests/bpf/progs/test_cls_redirect.h +9 -0
@@ -12,6 +12,15 @@#include <linux/ipv6.h> #include <linux/udp.h> +/* offsetof() is used in static asserts, and the libbpf-redefined CO-RE +* friendly version breaks compilation for older clang versions <= 15 +* when invoked in a static assert. Restore original here. +*/ +#ifdef offsetof +#undef offsetof +#define offsetof (type, member) __builtin_offsetof(type, member) +#endif +struct gre_base_hdr {uint16_t flags;uint16_t protocol;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 163/600 kbuild: rust_is_available: remove -v option
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Masahiro Yamada <[email protected]>
[ Upstream commit d824d2f98565e7c4cb1b862c230198fbe1a968be ]
The -v option is passed when this script is invoked from Makefile, but not when invoked from Kconfig.
As you can see in scripts/Kconfig.include, the 'success' macro suppresses stdout and stderr anyway, so this script does not need to be quiet.
Stable-dep-of: dee3a6b819c9 ("kbuild: rust_is_available: fix version check when CC has multiple arguments")
--- Makefile | 4 +- scripts/rust_is_available.sh | 96 +++++++++++++++--------------------- 2 files changed, 42 insertions(+), 58 deletions(-)
Makefile +2 -2
@@ -1291,7 +1291,7 @@ prepare0: archprepare # All the preparing.. prepare: prepare0 ifdef CONFIG_RUST - $(Q)$(CONFIG_SHELL) $(srctree)/scripts/rust_is_available.sh -v + $(Q)$(CONFIG_SHELL) $(srctree)/scripts/rust_is_available.sh $(Q)$(MAKE) $(build)=rust endif
@@ -1817,7 +1817,7 @@ $(DOC_TARGETS): # "Is Rust available?" target PHONY += rustavailable rustavailable: - $(Q)$(CONFIG_SHELL) $(srctree)/scripts/rust_is_available.sh -v && echo "Rust is available!" + $(Q)$(CONFIG_SHELL) $(srctree)/scripts/rust_is_available.sh && echo "Rust is available!" # Documentation target #
scripts/rust_is_available.sh +40 -56
146 lines not on this page · raw message
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 164/600 kbuild: rust_is_available: fix version check when CC has multiple arguments
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Russell Currey <[email protected]>
[ Upstream commit dee3a6b819c96fc8b1907577f585fd66f5c0fefe ]
rust_is_available.sh uses cc-version.sh to identify which C compiler is in use, as scripts/Kconfig.include does. cc-version.sh isn't designed to be able to handle multiple arguments in one variable, i.e. "ccache clang". Its invocation in rust_is_available.sh quotes "$CC", which makes $1 == "ccache clang" instead of the intended $1 == ccache & $2 == clang.
cc-version.sh could also be changed to handle having "ccache clang" as one argument, but it only has the one consumer upstream, making it simpler to fix the caller here.
--- scripts/rust_is_available.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/rust_is_available.sh +2 -2
@@ -113,10 +113,10 @@ fi # # In the future, we might be able to perform a full version check, see # https://github.com/rust-lang/rust-bindgen/issues/2138. -cc_name=$($(dirname $0)/cc-version.sh "$CC" | cut -f1 -d' ') +cc_name=$($(dirname $0)/cc-version.sh $CC | cut -f1 -d' ') if [ "$cc_name" = Clang ]; then clang_version=$( \ - LC_ALL=C "$CC" --version 2>/dev/null \ + LC_ALL=C $CC --version 2>/dev/null \ | sed -nE '1s:.*version ([0-9]+\.[0-9]+\.[0-9]+).*:\1:p' ) if [ "$clang_version" != "$bindgen_libclang_version" ]; then
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 165/600 kbuild: rust_is_available: add check for `bindgen` invocation
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Miguel Ojeda <[email protected]>
[ Upstream commit 52cae7f28ed6c3992489f16bb355f5b623f0912e ]
scripts/rust_is_available.sh calls bindgen with a special header in order to check whether the libclang version in use is suitable.
However, the invocation itself may fail if, for instance, bindgen cannot locate libclang. This is fine for Kconfig (since the script will still fail and therefore disable Rust as it should), but it is pretty confusing for users of the rustavailable target given the error will be unrelated:
./scripts/rust_is_available.sh: 21: arithmetic expression: expecting primary: "100000 * + 100 * + "
make: *** [Makefile:1816: rustavailable] Error 2Instead, run the bindgen invocation independently in a previous step, saving its output and return code. If it fails, then show the user a proper error message. Otherwise, continue as usual with the saved output.
Since the previous patch we show a reference to the docs, and the docs now explain how bindgen looks for libclang, thus the error message can leverage the documentation, avoiding duplication here (and making users aware of the setup guide in the documentation).
--- scripts/rust_is_available.sh | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-)
scripts/rust_is_available.sh +21 -1
@@ -90,8 +90,28 @@ if [ "$rust_bindings_generator_cversion" -gt "$rust_bindings_generator_min_cvers fi # Check that the `libclang` used by the Rust bindings generator is suitable. +# +# In order to do that, first invoke `bindgen` to get the `libclang` version +# found by `bindgen`. This step may already fail if, for instance, `libclang` +# is not found, thus inform the user in such a case. +bindgen_libclang_output=$( \ + LC_ALL=C "$BINDGEN" $(dirname $0)/rust_is_available_bindgen_libclang.h 2>&1 >/dev/null +) || bindgen_libclang_code=$? +if [ -n "$bindgen_libclang_code" ]; then + echo >&2 "***" + echo >&2 "*** Running '$BINDGEN' to check the libclang version (used by the Rust" + echo >&2 "*** bindings generator) failed with code $bindgen_libclang_code. This may be caused by" + echo >&2 "*** a failure to locate libclang. See output and docs below for details:" + echo >&2 "***" + echo >&2 "$bindgen_libclang_output" + echo >&2 "***" + exit 1 +fi + +# `bindgen` returned successfully, thus use the output to check that the version +# of the `libclang` found by the Rust bindings generator is suitable. bindgen_libclang_version=$( \ - LC_ALL=C "$BINDGEN" $(dirname $0)/rust_is_available_bindgen_libclang.h 2>&1 >/dev/null \ + echo "$bindgen_libclang_output" \ | grep -F 'clang version ' \ | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' \ | head -n 1 \
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 166/600 kbuild: rust_is_available: fix confusion when a version appears in the path
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Miguel Ojeda <[email protected]>
[ Upstream commit 9eb7e20e0c5cd069457845f965b3e8a7d736ecb7 ]
bindgen's output for libclang's version check contains paths, which in turn may contain strings that look like version numbers [1][2]:
.../6.1.0-dev/.../rust_is_available_bindgen_libclang.h:2:9: warning: clang version 11.1.0 [-W#pragma-messages], err: false
which the script will pick up as the version instead of the latter.
It is also the case that versions may appear after the actual version (e.g. distribution's version text), which was the reason behind head [3]:
.../rust-is-available-bindgen-libclang.h:2:9: warning: clang version 13.0.0 (Fedora 13.0.0-3.fc35) [-W#pragma-messages], err: false
Thus instead ask for a match after the clang version string.
--- scripts/rust_is_available.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
scripts/rust_is_available.sh +1 -3
@@ -112,9 +112,7 @@ fi # of the `libclang` found by the Rust bindings generator is suitable. bindgen_libclang_version=$( \ echo "$bindgen_libclang_output" \ - | grep -F 'clang version ' \ - | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' \ - | head -n 1 \ + | sed -nE 's:.*clang version ([0-9]+\.[0-9]+\.[0-9]+).*:\1:p' ) bindgen_libclang_min_version=$($min_tool_version llvm) bindgen_libclang_cversion=$(get_canonical_version $bindgen_libclang_version)
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 167/600 crypto: stm32 - Properly handle pm_runtime_get failing
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Uwe Kleine-König <[email protected]>
[ Upstream commit aec48805163338f8413118796c1dd035661b9140 ]
If pm_runtime_get() (disguised as pm_runtime_resume_and_get()) fails, this means the clk wasn't prepared and enabled. Returning early in this case however is wrong as then the following resource frees are skipped and this is never catched up. So do all the cleanups but clk_disable_unprepare().
Also don't emit a warning, as stm32_hash_runtime_resume() already emitted one.
Note that the return value of stm32_hash_remove() is mostly ignored by the device core. The only effect of returning zero instead of an error value is to suppress another warning in platform_remove(). So return 0 even if pm_runtime_resume_and_get() failed.
--- drivers/crypto/stm32/stm32-hash.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/crypto/stm32/stm32-hash.c +3 -4
@@ -1566,9 +1566,7 @@ static int stm32_hash_remove(struct platform_device *pdev)if (!hdev)return -ENODEV ; - ret =pm_runtime_resume_and_get (hdev->dev); -if (ret <0 ) -return ret; + ret =pm_runtime_get_sync (hdev->dev);stm32_hash_unregister_algs (hdev);
@@ -1584,7 +1582,8 @@ static int stm32_hash_remove(struct platform_device *pdev)pm_runtime_disable (hdev->dev);pm_runtime_put_noidle (hdev->dev); -clk_disable_unprepare (hdev->clk); +if (ret >=0 ) +clk_disable_unprepare (hdev->clk);return 0 ; }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 168/600 crypto: api - Use work queue in crypto_destroy_instance
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Herbert Xu <[email protected]>
[ Upstream commit 9ae4577bc077a7e32c3c7d442c95bc76865c0f17 ]
The function crypto_drop_spawn expects to be called in process context. However, when an instance is unregistered while it still has active users, the last user may cause the instance to be freed in atomic context.
Fix this by delaying the freeing to a work queue.
--- crypto/algapi.c | 16 ++++++++++++++-- include/crypto/algapi.h | 3 +++ 2 files changed, 17 insertions(+), 2 deletions(-)
crypto/algapi.c +14 -2
@@ -17,6 +17,7 @@#include <linux/rtnetlink.h> #include <linux/slab.h> #include <linux/string.h> +#include <linux/workqueue.h> #include "internal.h"
@@ -74,15 +75,26 @@ static void crypto_free_instance(struct crypto_instance *inst) inst->alg.cra_type->free (inst); } -static void crypto_destroy_instance (struct crypto_alg *alg) +static void crypto_destroy_instance_workfn (struct work_struct *w) { -struct crypto_instance *inst = (void *)alg; + struct crypto_instance *inst = container_of(w, struct crypto_instance, + free_work);struct crypto_template *tmpl = inst->tmpl;crypto_free_instance (inst);crypto_tmpl_put (tmpl); } +static void crypto_destroy_instance (struct crypto_alg *alg) +{ +struct crypto_instance *inst =container_of (alg, + struct crypto_instance, + alg); + +INIT_WORK (&inst->free_work, crypto_destroy_instance_workfn); +schedule_work (&inst->free_work); +} +/* * This function adds a spawn to the list secondary_spawns which * will be used at the end of crypto_remove_spawns to unregister
include/crypto/algapi.h +3 -0
@@ -12,6 +12,7 @@#include <linux/kconfig.h> #include <linux/list.h> #include <linux/types.h> +#include <linux/workqueue.h> #include <asm/unaligned.h>
@@ -60,6 +61,8 @@ struct crypto_instance {struct crypto_spawn *spawns; }; +struct work_struct free_work; + void *__ctx[] CRYPTO_MINALIGN_ATTR; };
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 169/600 Bluetooth: nokia: fix value check in nokia_bluetooth_serdev_probe()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuanjun Gong <[email protected]>
[ Upstream commit e8b5aed31355072faac8092ead4938ddec3111fd ]
in nokia_bluetooth_serdev_probe(), check the return value of clk_prepare_enable() and return the error code if clk_prepare_enable() returns an unexpected value.
--- drivers/bluetooth/hci_nokia.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/bluetooth/hci_nokia.c +5 -1
@@ -734,7 +734,11 @@ static int nokia_bluetooth_serdev_probe(struct serdev_device *serdev)return err; } -clk_prepare_enable (sysclk); + err =clk_prepare_enable (sysclk); +if (err) { +dev_err (dev,"could not enable sysclk: %d" , err); +return err; + } btdev->sysclk_speed =clk_get_rate (sysclk);clk_disable_unprepare (sysclk);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 170/600 Bluetooth: Fix potential use-after-free when clear keys
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Min Li <[email protected]>
[ Upstream commit 3673952cf0c6cf81b06c66a0b788abeeb02ff3ae ]
Similar to commit c5d2b6fa26b5 ("Bluetooth: Fix use-after-free in hci_remove_ltk/hci_remove_irk"). We can not access k after kfree_rcu() call.
--- net/bluetooth/hci_core.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
net/bluetooth/hci_core.c +8 -8
@@ -1074,9 +1074,9 @@ void hci_uuids_clear(struct hci_dev *hdev)void hci_link_keys_clear (struct hci_dev *hdev) { -struct link_key *key; +struct link_key *key, *tmp; -list_for_each_entry (key, &hdev->link_keys, list) { +list_for_each_entry_safe (key, tmp, &hdev->link_keys, list) {list_del_rcu (&key->list);kfree_rcu (key, rcu); }
@@ -1084,9 +1084,9 @@ void hci_link_keys_clear(struct hci_dev *hdev)void hci_smp_ltks_clear (struct hci_dev *hdev) { -struct smp_ltk *k; +struct smp_ltk *k, *tmp; -list_for_each_entry (k, &hdev->long_term_keys, list) { +list_for_each_entry_safe (k, tmp, &hdev->long_term_keys, list) {list_del_rcu (&k->list);kfree_rcu (k, rcu); }
@@ -1094,9 +1094,9 @@ void hci_smp_ltks_clear(struct hci_dev *hdev)void hci_smp_irks_clear (struct hci_dev *hdev) { -struct smp_irk *k; +struct smp_irk *k, *tmp; -list_for_each_entry (k, &hdev->identity_resolving_keys, list) { +list_for_each_entry_safe (k, tmp, &hdev->identity_resolving_keys, list) {list_del_rcu (&k->list);kfree_rcu (k, rcu); }
@@ -1104,9 +1104,9 @@ void hci_smp_irks_clear(struct hci_dev *hdev)void hci_blocked_keys_clear (struct hci_dev *hdev) { -struct blocked_key *b; +struct blocked_key *b, *tmp; -list_for_each_entry (b, &hdev->blocked_keys, list) { +list_for_each_entry_safe (b, tmp, &hdev->blocked_keys, list) {list_del_rcu (&b->list);kfree_rcu (b, rcu); }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 171/600 Bluetooth: hci_sync: Dont double print name in add/remove adv_monitor
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Douglas Anderson <[email protected]>
[ Upstream commit 6f55eea116ba3646fb5fbb31de703f8cf79d8214 ]
The hci_add_adv_monitor() hci_remove_adv_monitor() functions call bt_dev_dbg() to print some debug statements. The bt_dev_dbg() macro automatically adds in the device's name. That means that we shouldn't include the name in the bt_dev_dbg() calls.
Stable-dep-of: a2bcd2b63271 ("Bluetooth: hci_sync: Avoid use-after-free in dbg for hci_add_adv_monitor()")
--- net/bluetooth/hci_core.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
net/bluetooth/hci_core.c +5 -5
@@ -1949,14 +1949,14 @@ int hci_add_adv_monitor(struct hci_dev *hdev, struct adv_monitor *monitor)switch (hci_get_adv_monitor_offload_ext (hdev)) {case HCI_ADV_MONITOR_EXT_NONE : -bt_dev_dbg (hdev,"%s add monitor %d status %d" , hdev->name, +bt_dev_dbg (hdev,"add monitor %d status %d" , monitor->handle, status);/* Message was not forwarded to controller - not an error */ break ;case HCI_ADV_MONITOR_EXT_MSFT : status =msft_add_monitor_pattern (hdev, monitor); -bt_dev_dbg (hdev,"%s add monitor %d msft status %d" , hdev->name, +bt_dev_dbg (hdev,"add monitor %d msft status %d" , monitor->handle, status);break ; }
@@ -1976,15 +1976,15 @@ static int hci_remove_adv_monitor(struct hci_dev *hdev,switch (hci_get_adv_monitor_offload_ext (hdev)) {case HCI_ADV_MONITOR_EXT_NONE :/* also goes here when powered off */ -bt_dev_dbg (hdev,"%s remove monitor %d status %d" , hdev->name, +bt_dev_dbg (hdev,"remove monitor %d status %d" , monitor->handle, status); goto free_monitor;case HCI_ADV_MONITOR_EXT_MSFT : handle = monitor->handle; status =msft_remove_monitor (hdev, monitor); -bt_dev_dbg (hdev,"%s remove monitor %d msft status %d" , - hdev->name, handle, status); +bt_dev_dbg (hdev,"remove monitor %d msft status %d" , + handle, status);break ; }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 172/600 Bluetooth: hci_sync: Avoid use-after-free in dbg for hci_add_adv_monitor()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manish Mandlik <[email protected]>
[ Upstream commit a2bcd2b63271a93a695fabbfbf459c603d956d48 ]
KSAN reports use-after-free in hci_add_adv_monitor().
While adding an adv monitor,
hci_add_adv_monitor() calls ->
msft_add_monitor_pattern() calls ->
msft_add_monitor_sync() calls ->
msft_le_monitor_advertisement_cb() calls in an error case ->
hci_free_adv_monitor() which frees the *moniter.This is referenced by bt_dev_dbg() in hci_add_adv_monitor().
Fix the bt_dev_dbg() by using handle instead of monitor->handle.
--- net/bluetooth/hci_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/bluetooth/hci_core.c +1 -1
@@ -1957,7 +1957,7 @@ int hci_add_adv_monitor(struct hci_dev *hdev, struct adv_monitor *monitor)case HCI_ADV_MONITOR_EXT_MSFT : status =msft_add_monitor_pattern (hdev, monitor);bt_dev_dbg (hdev,"add monitor %d msft status %d" , - monitor->handle, status); + handle, status);break ; }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 173/600 net: tcp: fix unexcepted socket die when snd_wnd is 0
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Menglong Dong <[email protected]>
[ Upstream commit e89688e3e97868451a5d05b38a9d2633d6785cd4 ]
In tcp_retransmit_timer(), a window shrunk connection will be regarded as timeout if 'tcp_jiffies32 - tp->rcv_tstamp > TCP_RTO_MAX'. This is not right all the time.
The retransmits will become zero-window probes in tcp_retransmit_timer() if the 'snd_wnd==0'. Therefore, the icsk->icsk_rto will come up to TCP_RTO_MAX sooner or later.
However, the timer can be delayed and be triggered after 122877ms, not TCP_RTO_MAX, as I tested.
Therefore, 'tcp_jiffies32 - tp->rcv_tstamp > TCP_RTO_MAX' is always true once the RTO come up to TCP_RTO_MAX, and the socket will die.
Fix this by replacing the 'tcp_jiffies32' with '(u32)icsk->icsk_timeout', which is exact the timestamp of the timeout.
However, "tp->rcv_tstamp" can restart from idle, then tp->rcv_tstamp could already be a long time (minutes or hours) in the past even on the first RTO. So we double check the timeout with the duration of the retransmission.
Meanwhile, making "2 * TCP_RTO_MAX" as the timeout to avoid the socket dying too soon.
--- net/ipv4/tcp_timer.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)
net/ipv4/tcp_timer.c +17 -1
@@ -441,6 +441,22 @@ static void tcp_fastopen_synack_timer(struct sock *sk, struct request_sock *req) req->timeout << req->num_timeout, TCP_RTO_MAX); } +static bool tcp_rtx_probe0_timed_out (const struct sock *sk, +const struct sk_buff *skb) +{ +const struct tcp_sock *tp =tcp_sk (sk); +const int timeout =TCP_RTO_MAX *2 ; +u32 rcv_delta, rtx_delta; + + rcv_delta =inet_csk (sk)->icsk_timeout - tp->rcv_tstamp; +if (rcv_delta <= timeout) +return false; + + rtx_delta = (u32 )msecs_to_jiffies (tcp_time_stamp (tp) - + (tp->retrans_stamp ?:tcp_skb_timestamp (skb))); + +return rtx_delta > timeout; +}/** * tcp_retransmit_timer() - The TCP retransmit timeout handler
@@ -506,7 +522,7 @@ void tcp_retransmit_timer(struct sock *sk) tp->snd_una, tp->snd_nxt); }#endif -if (tcp_jiffies32 - tp->rcv_tstamp >TCP_RTO_MAX ) { +if (tcp_rtx_probe0_timed_out (sk, skb)) {tcp_write_err (sk); goto out; }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 174/600 selftests/bpf: Fix repeat option when kfunc_call verification fails
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yipeng Zou <[email protected]>
[ Upstream commit 811915db674f8daf19bb4fcb67da9017235ce26d ]
There is no way where topts.repeat can be set to 1 when tc_test fails. Fix the typo where the break statement slipped by one line.
--- tools/testing/selftests/bpf/prog_tests/kfunc_call.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/bpf/prog_tests/kfunc_call.c +1 -1
@@ -171,8 +171,8 @@ static void verify_fail(struct kfunc_test_params *param)case tc_test: topts.data_in = &pkt_v4; topts.data_size_in =sizeof (pkt_v4); -break ; topts.repeat =1 ; +break ; } skel =kfunc_call_fail__open_opts (&opts);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 175/600 selftests/bpf: Clean up fmod_ret in bench_rename test script
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yipeng Zou <[email protected]>
[ Upstream commit 83a89c4b6ae93481d3f618aba6a29d89208d26ed ]
Running the bench_rename test script, the following error occurs:
# ./benchs/run_bench_rename.sh base : 0.819 ± 0.012M/s kprobe : 0.538 ± 0.009M/s kretprobe : 0.503 ± 0.004M/s rawtp : 0.779 ± 0.020M/s fentry : 0.726 ± 0.007M/s fexit : 0.691 ± 0.007M/s benchmark 'rename-fmodret' not found
The bench_rename_fmodret has been removed in commit b000def2e052 ("selftests: Remove fmod_ret from test_overhead"), thus remove it from the runners in the test script.
--- tools/testing/selftests/bpf/benchs/run_bench_rename.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/bpf/benchs/run_bench_rename.sh +1 -1
@@ -2,7 +2,7 @@ set -eufo pipefail -for i in base kprobe kretprobe rawtp fentry fexit fmodret +for i in base kprobe kretprobe rawtp fentry fexit do summary=$(sudo ./bench -w2 -d5 -a rename-$i | tail -n1 | cut -d'(' -f1 | cut -d' ' -f3-) printf "%-10s: %s\n" $i "$summary"
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 176/600 spi: tegra114: Remove unnecessary NULL-pointer checks
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Danilenko <[email protected]>
[ Upstream commit 373c36bf7914e3198ac2654dede499f340c52950 ]
cs_setup, cs_hold and cs_inactive points to fields of spi_device struct, so there is no sense in checking them for NULL.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/spi/spi-tegra114.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-)
drivers/spi/spi-tegra114.c +7 -11
@@ -723,27 +723,23 @@ static int tegra_spi_set_hw_cs_timing(struct spi_device *spi)struct spi_delay *setup = &spi->cs_setup;struct spi_delay *hold = &spi->cs_hold;struct spi_delay *inactive = &spi->cs_inactive; -u8 setup_dly, hold_dly, inactive_dly; +u8 setup_dly, hold_dly;u32 setup_hold;u32 spi_cs_timing;u32 inactive_cycles;u8 cs_state; -if ((setup && setup->unit !=SPI_DELAY_UNIT_SCK ) || - (hold && hold->unit !=SPI_DELAY_UNIT_SCK ) || - (inactive && inactive->unit !=SPI_DELAY_UNIT_SCK )) { +if (setup->unit !=SPI_DELAY_UNIT_SCK || + hold->unit !=SPI_DELAY_UNIT_SCK || + inactive->unit !=SPI_DELAY_UNIT_SCK ) {dev_err (&spi->dev,"Invalid delay unit %d, should be SPI_DELAY_UNIT_SCK\n" ,SPI_DELAY_UNIT_SCK );return -EINVAL ; } - setup_dly = setup ? setup->value :0 ; - hold_dly = hold ? hold->value :0 ; - inactive_dly = inactive ? inactive->value :0 ; - - setup_dly =min_t (u8, setup_dly,MAX_SETUP_HOLD_CYCLES ); - hold_dly =min_t (u8, hold_dly,MAX_SETUP_HOLD_CYCLES ); + setup_dly =min_t (u8, setup->value,MAX_SETUP_HOLD_CYCLES ); + hold_dly =min_t (u8, hold->value,MAX_SETUP_HOLD_CYCLES );if (setup_dly && hold_dly) { setup_hold =SPI_SETUP_HOLD (setup_dly -1 , hold_dly -1 ); spi_cs_timing = SPI_CS_SETUP_HOLD(tspi->spi_cs_timing1,
@@ -755,7 +751,7 @@ static int tegra_spi_set_hw_cs_timing(struct spi_device *spi) } } - inactive_cycles =min_t (u8, inactive_dly,MAX_INACTIVE_CYCLES ); + inactive_cycles =min_t (u8, inactive->value,MAX_INACTIVE_CYCLES );if (inactive_cycles) inactive_cycles--; cs_state = inactive_cycles ?0 :1 ;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 177/600 net: Fix slab-out-of-bounds in inet[6]_steal_sock
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lorenz Bauer <[email protected]>
[ Upstream commit 8897562f67b3e61ad736cd5c9f307447d33280e4 ]
Kumar reported a KASAN splat in tcp_v6_rcv:
bash-5.2# ./test_progs -t btf_skc_cls_ingress
...
[ 51.810085] BUG: KASAN: slab-out-of-bounds in tcp_v6_rcv+0x2d7d/0x3440 [ 51.810458] Read of size 2 at addr ffff8881053f038c by task test_progs/226
The problem is that inet[6]_steal_sock accesses sk->sk_protocol without accounting for request or timewait sockets. To fix this we can't just check sock_common->skc_reuseport since that flag is present on timewait sockets.
Instead, add a fullsock check to avoid the out of bands access of sk_protocol.
--- include/net/inet6_hashtables.h | 2 +- include/net/inet_hashtables.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
include/net/inet6_hashtables.h +1 -1
@@ -107,7 +107,7 @@ struct sock *inet6_steal_sock(struct net *net, struct sk_buff *skb, int doff,if (!sk)return NULL ; -if (!prefetched) +if (!prefetched || !sk_fullsock (sk))return sk;if (sk->sk_protocol ==IPPROTO_TCP ) {
include/net/inet_hashtables.h +1 -1
@@ -455,7 +455,7 @@ struct sock *inet_steal_sock(struct net *net, struct sk_buff *skb, int doff,if (!sk)return NULL ; -if (!prefetched) +if (!prefetched || !sk_fullsock (sk))return sk;if (sk->sk_protocol ==IPPROTO_TCP ) {
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 178/600 net-memcg: Fix scope of sockmem pressure indicators
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Abel Wu <[email protected]>
[ Upstream commit ac8a52962164a50e693fa021d3564d7745b83a7f ]
Now there are two indicators of socket memory pressure sit inside struct mem_cgroup, socket_pressure and tcpmem_pressure, indicating memory reclaim pressure in memcg->memory and ->tcpmem respectively.
When in legacy mode (cgroupv1), the socket memory is charged into ->tcpmem which is independent of ->memory, so socket_pressure has nothing to do with socket's pressure at all. Things could be worse by taking socket_pressure into consideration in legacy mode, as a pressure in ->memory can lead to premature reclamation/throttling in socket.
While for the default mode (cgroupv2), the socket memory is charged into ->memory, and ->tcpmem/->tcpmem_pressure are simply not used.
So {socket,tcpmem}_pressure are only used in default/legacy mode respectively for indicating socket memory pressure. This patch fixes the pieces of code that make mixed use of both.
--- include/linux/memcontrol.h | 9 +++++++-- mm/vmpressure.c | 8 ++++++++ 2 files changed, 15 insertions(+), 2 deletions(-)
include/linux/memcontrol.h +7 -2
@@ -283,6 +283,11 @@ struct mem_cgroup {atomic_long_t memory_events[MEMCG_NR_MEMORY_EVENTS ];atomic_long_t memory_events_local[MEMCG_NR_MEMORY_EVENTS ]; +/* +* Hint of reclaim pressure for socket memroy management. Note +* that this indicator should NOT be used in legacy cgroup mode +* where socket memory is accounted/charged separately. +*/ unsigned long socket_pressure;/* Legacy tcp memory accounting */
@@ -1704,8 +1709,8 @@ void mem_cgroup_sk_alloc(struct sock *sk);void mem_cgroup_sk_free (struct sock *sk);static inline bool mem_cgroup_under_socket_pressure (struct mem_cgroup *memcg) { -if (!cgroup_subsys_on_dfl (memory_cgrp_subsys) && memcg->tcpmem_pressure) -return true; +if (!cgroup_subsys_on_dfl (memory_cgrp_subsys)) +return !!memcg->tcpmem_pressure; do { if (time_before(jiffies, READ_ONCE(memcg->socket_pressure))) return true;
mm/vmpressure.c +8 -0
@@ -244,6 +244,14 @@ void vmpressure(gfp_t gfp, struct mem_cgroup *memcg, bool tree,if (mem_cgroup_disabled ())return ; +/* +* The in-kernel users only care about the reclaim efficiency +* for this @memcg rather than the whole subtree, and there +* isn't and won't be any in-kernel user in a legacy cgroup. +*/ +if (!cgroup_subsys_on_dfl (memory_cgrp_subsys) && !tree) +return ; + vmpr =memcg_to_vmpressure (memcg);/*
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 179/600 ice: ice_aq_check_events: fix off-by-one check when filling buffer
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Przemek Kitszel <[email protected]>
[ Upstream commit e1e8a142c43336e3d25bfa1cb3a4ae7d00875c48 ]
Allow task's event buffer to be filled also in the case that it's size is exactly the size of the message.
--- drivers/net/ethernet/intel/ice/ice_main.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/net/ethernet/intel/ice/ice_main.c +7 -6
@@ -1356,6 +1356,7 @@ int ice_aq_wait_for_event(struct ice_pf *pf, u16 opcode, unsigned long timeout,static void ice_aq_check_events (struct ice_pf *pf,u16 opcode,struct ice_rq_event_info *event) { +struct ice_rq_event_info *task_ev;struct ice_aq_task *task;bool found = false;
@@ -1364,15 +1365,15 @@ static void ice_aq_check_events(struct ice_pf *pf, u16 opcode,if (task->state || task->opcode != opcode)continue ; -memcpy (&task->event->desc, &event->desc,sizeof (event->desc)); - task->event->msg_len = event->msg_len; + task_ev = task->event; +memcpy (&task_ev->desc, &event->desc,sizeof (event->desc)); + task_ev->msg_len = event->msg_len;/* Only copy the data buffer if a destination was set */ -if (task->event->msg_buf && - task->event->buf_len > event->buf_len) { -memcpy (task->event->msg_buf, event->msg_buf, +if (task_ev->msg_buf && task_ev->buf_len >= event->buf_len) { +memcpy (task_ev->msg_buf, event->msg_buf, event->buf_len); - task->event->buf_len = event->buf_len; + task_ev->buf_len = event->buf_len; } task->state =ICE_AQ_TASK_COMPLETE ;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 180/600 crypto: caam - fix unchecked return value error
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gaurav Jain <[email protected]>
[ Upstream commit e30685204711a6be40dec2622606950ccd37dafe ]
error:
Unchecked return value (CHECKED_RETURN)check_return: Calling sg_miter_next without checking return value
fix:
added check if(!sg_miter_next)
--- drivers/crypto/caam/caampkc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/crypto/caam/caampkc.c +3 -1
@@ -223,7 +223,9 @@ static int caam_rsa_count_leading_zeros(struct scatterlist *sgl,if (len && *buff)break ; -sg_miter_next (&miter); +if (!sg_miter_next (&miter)) +break ; + buff = miter.addr; len = miter.length;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 181/600 hwrng: iproc-rng200 - Implement suspend and resume calls
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Fainelli <[email protected]>
[ Upstream commit 8e03dd62e5be811efbf0cbeba47e79e793519105 ]
Chips such as BCM7278 support system wide suspend/resume which will cause the HWRNG block to lose its state and reset to its power on reset register values. We need to cleanup and re-initialize the HWRNG for it to be functional coming out of a system suspend cycle.
--- drivers/char/hw_random/iproc-rng200.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
drivers/char/hw_random/iproc-rng200.c +25 -0
@@ -182,6 +182,8 @@ static int iproc_rng200_probe(struct platform_device *pdev)return PTR_ERR (priv->base); } +dev_set_drvdata (dev, priv); + priv->rng.name ="iproc-rng200" ; priv->rng.read = iproc_rng200_read; priv->rng.init = iproc_rng200_init;
@@ -199,6 +201,28 @@ static int iproc_rng200_probe(struct platform_device *pdev)return 0 ; } +static int __maybe_unused iproc_rng200_suspend (struct device *dev) +{ +struct iproc_rng200_dev *priv =dev_get_drvdata (dev); + +iproc_rng200_cleanup (&priv->rng); + +return 0 ; +} + +static int __maybe_unused iproc_rng200_resume (struct device *dev) +{ +struct iproc_rng200_dev *priv =dev_get_drvdata (dev); + +iproc_rng200_init (&priv->rng); + +return 0 ; +} + +static const struct dev_pm_ops iproc_rng200_pm_ops = { +SET_SYSTEM_SLEEP_PM_OPS (iproc_rng200_suspend, iproc_rng200_resume) +}; +static const struct of_device_id iproc_rng200_of_match[] = { { .compatible ="brcm,bcm2711-rng200" , }, { .compatible ="brcm,bcm7211-rng200" , },
@@ -212,6 +236,7 @@ static struct platform_driver iproc_rng200_driver = { .driver = { .name = "iproc-rng200", .of_match_table = iproc_rng200_of_match, + .pm = &iproc_rng200_pm_ops, }, .probe = iproc_rng200_probe, };
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 182/600 lwt: Fix return values of BPF xmit ops
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yan Zhai <[email protected]>
[ Upstream commit 29b22badb7a84b783e3a4fffca16f7768fb31205 ]
BPF encap ops can return different types of positive values, such like NET_RX_DROP, NET_XMIT_CN, NETDEV_TX_BUSY, and so on, from function skb_do_redirect and bpf_lwt_xmit_reroute. At the xmit hook, such return values would be treated implicitly as LWTUNNEL_XMIT_CONTINUE in ip(6)_finish_output2. When this happens, skbs that have been freed would continue to the neighbor subsystem, causing use-after-free bug and kernel crashes.
To fix the incorrect behavior, skb_do_redirect return values can be simply discarded, the same as tc-egress behavior. On the other hand, bpf_lwt_xmit_reroute returns useful errors to local senders, e.g. PMTU information. Thus convert its return values to avoid the conflict with LWTUNNEL_XMIT_CONTINUE.
--- net/core/lwt_bpf.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
net/core/lwt_bpf.c +3 -4
@@ -60,9 +60,8 @@ static int run_lwt_bpf(struct sk_buff *skb, struct bpf_lwt_prog *lwt, ret =BPF_OK ; }else {skb_reset_mac_header (skb); - ret =skb_do_redirect (skb); -if (ret ==0 ) - ret =BPF_REDIRECT ; +skb_do_redirect (skb); + ret =BPF_REDIRECT ; }break ;
@@ -255,7 +254,7 @@ static int bpf_lwt_xmit_reroute(struct sk_buff *skb) err =dst_output (dev_net (skb_dst (skb)->dev), skb->sk, skb);if (unlikely (err)) -return err; +return net_xmit_errno (err);/* ip[6]_finish_output2 understand LWTUNNEL_XMIT_DONE */ return LWTUNNEL_XMIT_DONE ;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 183/600 lwt: Check LWTUNNEL_XMIT_CONTINUE strictly
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yan Zhai <[email protected]>
[ Upstream commit a171fbec88a2c730b108c7147ac5e7b2f5a02b47 ]
LWTUNNEL_XMIT_CONTINUE is implicitly assumed in ip(6)_finish_output2, such that any positive return value from a xmit hook could cause unexpected continue behavior, despite that related skb may have been freed. This could be error-prone for future xmit hook ops. One of the possible errors is to return statuses of dst_output directly.
To make the code safer, redefine LWTUNNEL_XMIT_CONTINUE value to distinguish from dst_output statuses and check the continue condition explicitly.
--- include/net/lwtunnel.h | 5 ++++- net/ipv4/ip_output.c | 2 +- net/ipv6/ip6_output.c | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-)
include/net/lwtunnel.h +4 -1
@@ -16,9 +16,12 @@#define LWTUNNEL_STATE_INPUT_REDIRECT BIT(1)#define LWTUNNEL_STATE_XMIT_REDIRECT BIT(2) +/* LWTUNNEL_XMIT_CONTINUE should be distinguishable from dst_output return +* values (NET_XMIT_xxx and NETDEV_TX_xxx in linux/netdevice.h) for safety. +*/ enum {LWTUNNEL_XMIT_DONE , -LWTUNNEL_XMIT_CONTINUE , +LWTUNNEL_XMIT_CONTINUE =0x100 , };
net/ipv4/ip_output.c +1 -1
@@ -214,7 +214,7 @@ static int ip_finish_output2(struct net *net, struct sock *sk, struct sk_buff *sif (lwtunnel_xmit_redirect (dst->lwtstate)) {int res =lwtunnel_xmit (skb); -if (res <0 || res ==LWTUNNEL_XMIT_DONE ) +if (res !=LWTUNNEL_XMIT_CONTINUE )return res; }
net/ipv6/ip6_output.c +1 -1
@@ -112,7 +112,7 @@ static int ip6_finish_output2(struct net *net, struct sock *sk, struct sk_buff *if (lwtunnel_xmit_redirect (dst->lwtstate)) {int res =lwtunnel_xmit (skb); -if (res <0 || res ==LWTUNNEL_XMIT_DONE ) +if (res !=LWTUNNEL_XMIT_CONTINUE )return res; }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 184/600 fs: ocfs2: namei: check return value of ocfs2_add_entry()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Artem Chernyshev <[email protected]>
[ Upstream commit 6b72e5f9e79360fce4f2be7fe81159fbdf4256a5 ]
Process result of ocfs2_add_entry() in case we have an error value.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- fs/ocfs2/namei.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/ocfs2/namei.c +4 -0
@@ -1535,6 +1535,10 @@ static int ocfs2_rename(struct user_namespace *mnt_userns, status =ocfs2_add_entry (handle, new_dentry, old_inode,OCFS2_I (old_inode)->ip_blkno, new_dir_bh, &target_insert); +if (status <0 ) { +mlog_errno (status); + goto bail; + } } old_inode->i_ctime =current_time (old_inode);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 185/600 net: annotate data-races around sk->sk_lingertime
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit bc1fb82ae11753c5dec53c667a055dc37796dbd2 ]
sk_getsockopt() runs locklessly. This means sk->sk_lingertime can be read while other threads are changing its value.
Other reads also happen without socket lock being held, and must be annotated.
Remove preprocessor logic using BITS_PER_LONG, compilers are smart enough to figure this by themselves.
v2: fixed a clang W=1 (-Wtautological-constant-out-of-range-compare) warning
(Jakub)
--- net/bluetooth/iso.c | 2 +- net/bluetooth/sco.c | 2 +- net/core/sock.c | 18 +++++++++--------- net/sched/em_meta.c | 2 +- net/smc/af_smc.c | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-)
net/bluetooth/iso.c +1 -1
@@ -1394,7 +1394,7 @@ static int iso_sock_release(struct socket *sock)iso_sock_close (sk); -if (sock_flag (sk,SOCK_LINGER ) && sk->sk_lingertime && +if (sock_flag (sk,SOCK_LINGER ) &&READ_ONCE (sk->sk_lingertime) && !(current->flags &PF_EXITING )) {lock_sock (sk); err =bt_sock_wait_state (sk,BT_CLOSED , sk->sk_lingertime);
net/bluetooth/sco.c +1 -1
@@ -1255,7 +1255,7 @@ static int sco_sock_release(struct socket *sock)sco_sock_close (sk); -if (sock_flag (sk,SOCK_LINGER ) && sk->sk_lingertime && +if (sock_flag (sk,SOCK_LINGER ) &&READ_ONCE (sk->sk_lingertime) && !(current->flags &PF_EXITING )) {lock_sock (sk); err =bt_sock_wait_state (sk,BT_CLOSED , sk->sk_lingertime);
net/core/sock.c +9 -9
@@ -793,7 +793,7 @@ EXPORT_SYMBOL(sock_set_reuseport);void sock_no_linger (struct sock *sk) {lock_sock (sk); - sk->sk_lingertime =0 ; +WRITE_ONCE (sk->sk_lingertime,0 );sock_set_flag (sk,SOCK_LINGER );release_sock (sk); }
@@ -1219,15 +1219,15 @@ int sk_setsockopt(struct sock *sk, int level, int optname, ret = -EFAULT ;break ; } -if (!ling.l_onoff) +if (!ling.l_onoff) {sock_reset_flag (sk,SOCK_LINGER ); -else { -#if (BITS_PER_LONG ==32 ) -if ((unsigned int )ling.l_linger >=MAX_SCHEDULE_TIMEOUT /HZ ) - sk->sk_lingertime =MAX_SCHEDULE_TIMEOUT ; + }else { +unsigned long t_sec = ling.l_linger; + +if (t_sec >=MAX_SCHEDULE_TIMEOUT /HZ ) +WRITE_ONCE (sk->sk_lingertime,MAX_SCHEDULE_TIMEOUT );else -#endif - sk->sk_lingertime = (unsigned int )ling.l_linger *HZ ; +WRITE_ONCE (sk->sk_lingertime, t_sec *HZ );sock_set_flag (sk,SOCK_LINGER ); }break ;
@@ -1678,7 +1678,7 @@ int sk_getsockopt(struct sock *sk, int level, int optname,case SO_LINGER : lv =sizeof (v.ling); v.ling.l_onoff =sock_flag (sk,SOCK_LINGER ); - v.ling.l_linger = sk->sk_lingertime /HZ ; + v.ling.l_linger =READ_ONCE (sk->sk_lingertime) /HZ ;break ;case SO_BSDCOMPAT :
net/sched/em_meta.c +1 -1
@@ -502,7 +502,7 @@ META_COLLECTOR(int_sk_lingertime) *err =-1 ;return ; } - dst->value = sk->sk_lingertime /HZ ; + dst->value =READ_ONCE (sk->sk_lingertime) /HZ ; }META_COLLECTOR (int_sk_err_qlen)
net/smc/af_smc.c +1 -1
@@ -1807,7 +1807,7 @@ void smc_close_non_accepted(struct sock *sk)lock_sock (sk);if (!sk->sk_lingertime)/* wait for peer closing */ - sk->sk_lingertime =SMC_MAX_STREAM_WAIT_TIMEOUT ; +WRITE_ONCE (sk->sk_lingertime,SMC_MAX_STREAM_WAIT_TIMEOUT );__smc_release (smc);release_sock (sk);sock_put (sk);/* sock_hold above */
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 186/600 wifi: mwifiex: fix memory leak in mwifiex_histogram_read()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Antipov <[email protected]>
[ Upstream commit 9c8fd72a5c2a031cbc680a2990107ecd958ffcdb ]
Always free the zeroed page on return from 'mwifiex_histogram_read()'.
--- drivers/net/wireless/marvell/mwifiex/debugfs.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/net/wireless/marvell/mwifiex/debugfs.c +7 -2
@@ -253,8 +253,11 @@ mwifiex_histogram_read(struct file *file, char __user *ubuf,if (!p)return -ENOMEM ; -if (!priv || !priv->hist_data) -return -EFAULT ; +if (!priv || !priv->hist_data) { + ret = -EFAULT ; + goto free_and_exit; + } + phist_data = priv->hist_data; p += sprintf(p, "\n"
@@ -309,6 +312,8 @@ mwifiex_histogram_read(struct file *file, char __user *ubuf, ret =simple_read_from_buffer (ubuf, count, ppos, (char *)page, (unsigned long )p - page); +free_and_exit: +free_page (page);return ret; }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 187/600 wifi: mwifiex: Fix missed return in oob checks failed path
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Polaris Pi <[email protected]>
[ Upstream commit 2785851c627f2db05f9271f7f63661b5dbd95c4c ]
Add missed return in mwifiex_uap_queue_bridged_pkt() and mwifiex_process_rx_packet().
--- drivers/net/wireless/marvell/mwifiex/sta_rx.c | 1 + drivers/net/wireless/marvell/mwifiex/uap_txrx.c | 1 + 2 files changed, 2 insertions(+)
drivers/net/wireless/marvell/mwifiex/sta_rx.c +1 -0
@@ -92,6 +92,7 @@ int mwifiex_process_rx_packet(struct mwifiex_private *priv, skb->len, rx_pkt_off); priv->stats.rx_dropped++;dev_kfree_skb_any (skb); +return -1 ; } if ((!memcmp(&rx_pkt_hdr->rfc1042_hdr, bridge_tunnel_header,
drivers/net/wireless/marvell/mwifiex/uap_txrx.c +1 -0
@@ -110,6 +110,7 @@ static void mwifiex_uap_queue_bridged_pkt(struct mwifiex_private *priv, skb->len, le16_to_cpu(uap_rx_pd->rx_pkt_offset)); priv->stats.rx_dropped++;dev_kfree_skb_any (skb); +return ; } if ((!memcmp(&rx_pkt_hdr->rfc1042_hdr, bridge_tunnel_header,
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 188/600 ARM: dts: Add .dts files missing from the build
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rob Herring <[email protected]>
[ Upstream commit 86684c2481b6e6a46c2282acee13554e34e66071 ]
Comparing .dts files to built .dtb files yielded a few .dts files which are never built. Add them to the build.
Stable-dep-of: 92632115fb57 ("samples/bpf: fix bio latency check with tracepoint")
--- arch/arm/boot/dts/Makefile | 8 ++++++++ 1 file changed, 8 insertions(+)
arch/arm/boot/dts/Makefile +8 -0
@@ -331,6 +331,7 @@ dtb-$(CONFIG_MACH_KIRKWOOD) += \ kirkwood-iconnect.dtb \ kirkwood-iomega_ix2_200.dtb \ kirkwood-is2.dtb \ + kirkwood-km_fixedeth.dtb \ kirkwood-km_kirkwood.dtb \ kirkwood-l-50.dtb \ kirkwood-laplug.dtb \
@@ -861,7 +862,10 @@ dtb-$(CONFIG_ARCH_OMAP3) += \ am3517-craneboard.dtb \ am3517-evm.dtb \ am3517_mt_ventoux.dtb \ + logicpd-torpedo-35xx-devkit.dtb \ logicpd-torpedo-37xx-devkit.dtb \ + logicpd-torpedo-37xx-devkit-28.dtb \ + logicpd-som-lv-35xx-devkit.dtb \ logicpd-som-lv-37xx-devkit.dtb \ omap3430-sdp.dtb \ omap3-beagle.dtb \
@@ -1527,6 +1531,8 @@ dtb-$(CONFIG_MACH_ARMADA_38X) += \ armada-388-helios4.dtb \ armada-388-rd.dtb dtb-$(CONFIG_MACH_ARMADA_39X) += \ + armada-390-db.dtb \ + armada-395-gp.dtb \ armada-398-db.dtb dtb-$(CONFIG_MACH_ARMADA_XP) += \ armada-xp-axpwifiap.dtb \
@@ -1556,6 +1562,7 @@ dtb-$(CONFIG_MACH_DOVE) += \ dtb-$(CONFIG_ARCH_MEDIATEK) += \ mt2701-evb.dtb \ mt6580-evbp1.dtb \ + mt6582-prestigio-pmt5008-3g.dtb \ mt6589-aquaris5.dtb \ mt6589-fairphone-fp1.dtb \ mt6592-evb.dtb \
@@ -1608,6 +1615,7 @@ dtb-$(CONFIG_ARCH_ASPEED) += \ aspeed-bmc-intel-s2600wf.dtb \ aspeed-bmc-inspur-fp5280g2.dtb \ aspeed-bmc-inspur-nf5280m6.dtb \ + aspeed-bmc-inspur-on5263m5.dtb \ aspeed-bmc-lenovo-hr630.dtb \ aspeed-bmc-lenovo-hr855xg2.dtb \ aspeed-bmc-microsoft-olympus.dtb \
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 189/600 samples/bpf: fix bio latency check with tracepoint
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel T. Lee <[email protected]>
[ Upstream commit 92632115fb57ff9e368f256913e96d6fd5abf5ab ]
Recently, a new tracepoint for the block layer, specifically the block_io_start/done tracepoints, was introduced in commit 5a80bd075f3b ("block: introduce block_io_start/block_io_done tracepoints").
Previously, the kprobe entry used for this purpose was quite unstable and inherently broke relevant probes [1]. Now that a stable tracepoint is available, this commit replaces the bio latency check with it.
One of the changes made during this replacement is the key used for the hash table. Since 'struct request' cannot be used as a hash key, the approach taken follows that which was implemented in bcc/biolatency [2]. (uses dev:sector for the key)
[1]: https://github.com/iovisor/bcc/issues/4261
[2]: https://github.com/iovisor/bcc/pull/4691
--- samples/bpf/tracex3_kern.c | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-)
samples/bpf/tracex3_kern.c +24 -12
@@ -11,6 +11,12 @@#include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> +struct start_key { +dev_t dev; +u32 _pad; +sector_t sector; +}; +struct { __uint(type, BPF_MAP_TYPE_HASH); __type(key, long);
@@ -18,16 +24,17 @@ struct {__uint (max_entries,4096 ); } my_map SEC(".maps"); -/* kprobe is NOT a stable ABI. If kernel internals change this bpf+kprobe -* example will no longer be meaningful -*/ -SEC("kprobe/blk_mq_start_request") -int bpf_prog1 (struct pt_regs *ctx) +/* from /sys/kernel/tracing/events/block/block_io_start/format */ +SEC("tracepoint/block/block_io_start") +int bpf_prog1 (struct trace_event_raw_block_rq *ctx) { -long rq =PT_REGS_PARM1 (ctx);u64 val =bpf_ktime_get_ns (); +struct start_key key = { + .dev = ctx->dev, + .sector = ctx->sector + }; -bpf_map_update_elem (&my_map, &rq, &val,BPF_ANY ); +bpf_map_update_elem (&my_map, &key, &val,BPF_ANY );return 0 ; }
@@ -49,21 +56,26 @@ struct {__uint (max_entries,SLOTS ); } lat_map SEC(".maps"); -SEC("kprobe/__blk_account_io_done") -int bpf_prog2 (struct pt_regs *ctx) +/* from /sys/kernel/tracing/events/block/block_io_done/format */ +SEC("tracepoint/block/block_io_done") +int bpf_prog2 (struct trace_event_raw_block_rq *ctx) { -long rq =PT_REGS_PARM1 (ctx); +struct start_key key = { + .dev = ctx->dev, + .sector = ctx->sector + }; +u64 *value, l, base;u32 index; - value =bpf_map_lookup_elem (&my_map, &rq); + value =bpf_map_lookup_elem (&my_map, &key);if (!value)return 0 ;u64 cur_time =bpf_ktime_get_ns ();u64 delta = cur_time - *value; -bpf_map_delete_elem (&my_map, &rq); +bpf_map_delete_elem (&my_map, &key);/* the lines below are computing index = log10(delta)*10 * using integer arithmetic
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 190/600 samples/bpf: fix broken map lookup probe
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel T. Lee <[email protected]>
[ Upstream commit d93a7cf6ca2cfcd7de5d06f753ce8d5e863316ac ]
In the commit 7c4cd051add3 ("bpf: Fix syscall's stackmap lookup potential deadlock"), a potential deadlock issue was addressed, which resulted in *_map_lookup_elem not triggering BPF programs. (prior to lookup, bpf_disable_instrumentation() is used)
To resolve the broken map lookup probe using "htab_map_lookup_elem", this commit introduces an alternative approach. Instead, it utilize "bpf_map_copy_value" and apply a filter specifically for the hash table with map_type.
--- samples/bpf/tracex6_kern.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)
samples/bpf/tracex6_kern.c +15 -2
@@ -2,6 +2,8 @@#include <linux/version.h> #include <uapi/linux/bpf.h> #include <bpf/bpf_helpers.h> +#include <bpf/bpf_tracing.h> +#include <bpf/bpf_core_read.h> struct { __uint(type, BPF_MAP_TYPE_PERF_EVENT_ARRAY);
@@ -45,13 +47,24 @@ int bpf_prog1(struct pt_regs *ctx)return 0 ; } -SEC("kprobe/htab_map_lookup_elem") -int bpf_prog2 (struct pt_regs *ctx) +/* +* Since *_map_lookup_elem can't be expected to trigger bpf programs +* due to potential deadlocks (bpf_disable_instrumentation), this bpf +* program will be attached to bpf_map_copy_value (which is called +* from map_lookup_elem) and will only filter the hashtable type. +*/ +SEC("kprobe/bpf_map_copy_value") +int BPF_KPROBE (bpf_prog2 ,struct bpf_map *map) {u32 key =bpf_get_smp_processor_id ();struct bpf_perf_event_value *val, buf; +enum bpf_map_type type;int error; + type =BPF_CORE_READ (map, map_type); +if (type !=BPF_MAP_TYPE_HASH ) +return 0 ; + error =bpf_perf_event_read_value (&counters, key, &buf,sizeof (buf));if (error)return 0 ;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 191/600 wifi: ath9k: fix races between ath9k_wmi_cmd and ath9k_wmi_ctrl_rx
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fedor Pchelkin <[email protected]>
[ Upstream commit b674fb513e2e7a514fcde287c0f73915d393fdb6 ]
Currently, the synchronization between ath9k_wmi_cmd() and ath9k_wmi_ctrl_rx() is exposed to a race condition which, although being rather unlikely, can lead to invalid behaviour of ath9k_wmi_cmd().
Consider the following scenario:
CPU0 CPU1
ath9k_wmi_cmd(...)
mutex_lock(&wmi->op_mutex)
ath9k_wmi_cmd_issue(...)
wait_for_completion_timeout(...)
---
timeout
---
/* the callback is being processed * before last_seq_id became zero */ ath9k_wmi_ctrl_rx(...) spin_lock_irqsave(...) /* wmi->last_seq_id check here * doesn't detect timeout yet */ spin_unlock_irqrestore(...)
/* last_seq_id is zeroed to
* indicate there was a timeout
*/
wmi->last_seq_id = 0
mutex_unlock(&wmi->op_mutex)
return -ETIMEDOUT
ath9k_wmi_cmd(...)
mutex_lock(&wmi->op_mutex)
/* the buffer is replaced with
* another one
*/
wmi->cmd_rsp_buf = rsp_buf
wmi->cmd_rsp_len = rsp_len
ath9k_wmi_cmd_issue(...)
spin_lock_irqsave(...)
spin_unlock_irqrestore(...)
wait_for_completion_timeout(...)
/* the continuation of the
* callback left after the first
* ath9k_wmi_cmd call
*/
ath9k_wmi_rsp_callback(...)
/* copying data designated
* to already timeouted
* WMI command into an
* inappropriate wmi_cmd_buf
*/
memcpy(...)
complete(&wmi->cmd_wait) /* awakened by the bogus callback
* => invalid return result
*/
mutex_unlock(&wmi->op_mutex)
return 0
To fix this, update last_seq_id on timeout path inside ath9k_wmi_cmd() under the wmi_lock. Move ath9k_wmi_rsp_callback() under wmi_lock inside ath9k_wmi_ctrl_rx() so that the wmi->cmd_wait can be completed only for initially designated wmi_cmd call, otherwise the path would be rejected with last_seq_id check.
Found by Linux Verification Center (linuxtesting.org) with Syzkaller.
--- drivers/net/wireless/ath/ath9k/wmi.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath9k/wmi.c +4 -2
@@ -242,10 +242,10 @@ static void ath9k_wmi_ctrl_rx(void *priv, struct sk_buff *skb,spin_unlock_irqrestore (&wmi->wmi_lock, flags); goto free_skb; } -spin_unlock_irqrestore (&wmi->wmi_lock, flags);/* WMI command response */ ath9k_wmi_rsp_callback (wmi, skb); +spin_unlock_irqrestore (&wmi->wmi_lock, flags); free_skb:kfree_skb (skb);
@@ -308,8 +308,8 @@ int ath9k_wmi_cmd(struct wmi *wmi, enum wmi_cmd_id cmd_id,struct ath_common *common =ath9k_hw_common (ah);u16 headroom =sizeof (struct htc_frame_hdr ) +sizeof (struct wmi_cmd_hdr ); +unsigned long time_left, flags;struct sk_buff *skb; -unsigned long time_left;int ret =0 ;if (ah->ah_flags &AH_UNPLUGGED )
@@ -345,7 +345,9 @@ int ath9k_wmi_cmd(struct wmi *wmi, enum wmi_cmd_id cmd_id,if (!time_left) {ath_dbg (common,WMI ,"Timeout waiting for WMI command: %s\n" ,wmi_cmd_to_name (cmd_id)); +spin_lock_irqsave (&wmi->wmi_lock, flags); wmi->last_seq_id =0 ; +spin_unlock_irqrestore (&wmi->wmi_lock, flags);mutex_unlock (&wmi->op_mutex);return -ETIMEDOUT ; }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 192/600 wifi: ath9k: protect WMI command response buffer replacement with a lock
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fedor Pchelkin <[email protected]>
[ Upstream commit 454994cfa9e4c18b6df9f78b60db8eadc20a6c25 ]
If ath9k_wmi_cmd() has exited with a timeout, it is possible that during next ath9k_wmi_cmd() call the wmi_rsp callback for previous wmi command writes to new wmi->cmd_rsp_buf and makes a completion. This results in an invalid ath9k_wmi_cmd() return value.
Move the replacement of WMI command response buffer and length under wmi_lock. Note that last_seq_id value is updated there, too.
Thus, the buffer cannot be written to by a belated wmi_rsp callback because that path is properly rejected by the last_seq_id check.
Found by Linux Verification Center (linuxtesting.org) with Syzkaller.
--- drivers/net/wireless/ath/ath9k/wmi.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/net/wireless/ath/ath9k/wmi.c +8 -6
@@ -283,7 +283,8 @@ int ath9k_wmi_connect(struct htc_target *htc, struct wmi *wmi,static int ath9k_wmi_cmd_issue (struct wmi *wmi,struct sk_buff *skb, -enum wmi_cmd_id cmd,u16 len) +enum wmi_cmd_id cmd,u16 len, +u8 *rsp_buf,u32 rsp_len) {struct wmi_cmd_hdr *hdr;unsigned long flags;
@@ -293,6 +294,11 @@ static int ath9k_wmi_cmd_issue(struct wmi *wmi, hdr->seq_no =cpu_to_be16 (++wmi->tx_seq_id);spin_lock_irqsave (&wmi->wmi_lock, flags); + +/* record the rsp buffer and length */ + wmi->cmd_rsp_buf = rsp_buf; + wmi->cmd_rsp_len = rsp_len; + wmi->last_seq_id = wmi->tx_seq_id;spin_unlock_irqrestore (&wmi->wmi_lock, flags);
@@ -333,11 +339,7 @@ int ath9k_wmi_cmd(struct wmi *wmi, enum wmi_cmd_id cmd_id, goto out; } -/* record the rsp buffer and length */ - wmi->cmd_rsp_buf = rsp_buf; - wmi->cmd_rsp_len = rsp_len; - - ret =ath9k_wmi_cmd_issue (wmi, skb, cmd_id, cmd_len); + ret =ath9k_wmi_cmd_issue (wmi, skb, cmd_id, cmd_len, rsp_buf, rsp_len);if (ret) goto out;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 193/600 wifi: nl80211/cfg80211: add forgotten nla_policy for BSS color attribute
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lin Ma <[email protected]>
[ Upstream commit 218d690c49b7e9c94ad0d317adbdd4af846ea0dc ]
The previous commit dd3e4fc75b4a ("nl80211/cfg80211: add BSS color to NDP ranging parameters") adds a parameter for NDP ranging by introducing a new attribute type named NL80211_PMSR_FTM_REQ_ATTR_BSS_COLOR.
However, the author forgot to also describe the nla_policy at nl80211_pmsr_ftm_req_attr_policy (net/wireless/nl80211.c). Just complement it to avoid malformed attribute that causes out-of-attribute access.
--- net/wireless/nl80211.c | 1 + 1 file changed, 1 insertion(+)
net/wireless/nl80211.c +1 -0
@@ -323,6 +323,7 @@ nl80211_pmsr_ftm_req_attr_policy[NL80211_PMSR_FTM_REQ_ATTR_MAX + 1] = { [NL80211_PMSR_FTM_REQ_ATTR_TRIGGER_BASED] = { .type = NLA_FLAG }, [NL80211_PMSR_FTM_REQ_ATTR_NON_TRIGGER_BASED] = { .type = NLA_FLAG }, [NL80211_PMSR_FTM_REQ_ATTR_LMR_FEEDBACK] = { .type = NLA_FLAG }, + [NL80211_PMSR_FTM_REQ_ATTR_BSS_COLOR] = { .type = NLA_U8 }, }; static const struct nla_policy
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 194/600 mac80211: make ieee80211_tx_info padding explicit
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit a7a2ef0c4b3efbd7d6f3fabd87dbbc0b3f2de5af ]
While looking at a bug, I got rather confused by the layout of the 'status' field in ieee80211_tx_info. Apparently, the intention is that status_driver_data[] is used for driver specific data, and fills up the size of the union to 40 bytes, just like the other ones.
This is indeed what actually happens, but only because of the combination of two mistakes:
- "void *status_driver_data[18 / sizeof(void *)];" is intended to be 18 bytes long but is actually two bytes shorter because of rounding-down in the division, to a multiple of the pointer size (4 bytes or 8 bytes).
- The other fields combined are intended to be 22 bytes long, but are actually 24 bytes because of padding in front of the unaligned tx_time member, and in front of the pointer array.
The two mistakes cancel out. so the size ends up fine, but it seems more helpful to make this explicit, by having a multiple of 8 bytes in the size calculation and explicitly describing the padding.
--- include/net/mac80211.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
include/net/mac80211.h +3 -1
@@ -1141,9 +1141,11 @@ struct ieee80211_tx_info {u8 ampdu_ack_len;u8 ampdu_len;u8 antenna; +u8 pad;u16 tx_time;u8 flags; -void *status_driver_data[18 /sizeof (void *)]; +u8 pad2; +void *status_driver_data[16 /sizeof (void *)]; } status;struct { struct ieee80211_tx_rate driver_rates[
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 195/600 wifi: mwifiex: avoid possible NULL skb pointer dereference
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Antipov <[email protected]>
[ Upstream commit 35a7a1ce7c7d61664ee54f5239a1f120ab95a87e ]
In 'mwifiex_handle_uap_rx_forward()', always check the value returned by 'skb_copy()' to avoid potential NULL pointer dereference in 'mwifiex_uap_queue_bridged_pkt()', and drop original skb in case of copying failure.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/net/wireless/marvell/mwifiex/uap_txrx.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/net/wireless/marvell/mwifiex/uap_txrx.c +9 -1
@@ -253,7 +253,15 @@ int mwifiex_handle_uap_rx_forward(struct mwifiex_private *priv,if (is_multicast_ether_addr (ra)) { skb_uap =skb_copy (skb,GFP_ATOMIC ); -mwifiex_uap_queue_bridged_pkt (priv, skb_uap); +if (likely (skb_uap)) { +mwifiex_uap_queue_bridged_pkt (priv, skb_uap); + }else { +mwifiex_dbg (adapter,ERROR , +"failed to copy skb for uAP\n" ); + priv->stats.rx_dropped++; +dev_kfree_skb_any (skb); +return -1 ; + } }else {if (mwifiex_get_sta_entry (priv, ra)) {/* Requeue Intra-BSS packet */
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 196/600 Bluetooth: btusb: Do not call kfree_skb() under spin_lock_irqsave()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jinjie Ruan <[email protected]>
[ Upstream commit 2a05334d7f91ff189692089c05fc48cc1d8204de ]
It is not allowed to call kfree_skb() from hardware interrupt context or with hardware interrupts being disabled. So replace kfree_skb() with dev_kfree_skb_irq() under spin_lock_irqsave(). Compile tested only.
--- drivers/bluetooth/btusb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/bluetooth/btusb.c +1 -1
@@ -1984,7 +1984,7 @@ static int btusb_switch_alt_setting(struct hci_dev *hdev, int new_alts)* alternate setting. */ spin_lock_irqsave (&data->rxlock, flags); -kfree_skb (data->sco_skb); +dev_kfree_skb_irq (data->sco_skb); data->sco_skb =NULL ;spin_unlock_irqrestore (&data->rxlock, flags);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 197/600 arm64: mm: use ptep_clear() instead of pte_clear() in clear_flush()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Qi Zheng <[email protected]>
[ Upstream commit 00de2c9f26b15f1a6f2af516dd8ec5f8d28189b7 ]
In clear_flush(), the original pte may be a present entry, so we should use ptep_clear() to let page_table_check track the pte clearing operation, otherwise it may cause false positive in subsequent set_pte_at().
--- arch/arm64/mm/hugetlbpage.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/mm/hugetlbpage.c +1 -1
@@ -236,7 +236,7 @@ static void clear_flush(struct mm_struct *mm,unsigned long i, saddr = addr;for (i =0 ; i < ncontig; i++, addr += pgsize, ptep++) -pte_clear (mm, addr, ptep); +ptep_clear (mm, addr, ptep);flush_tlb_range (&vma, saddr, addr); }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 198/600 wifi: ath9k: use IS_ERR() with debugfs_create_dir()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wang Ming <[email protected]>
[ Upstream commit 1e4134610d93271535ecf900a676e1f094e9944c ]
The debugfs_create_dir() function returns error pointers, it never returns NULL. Most incorrect error checks were fixed, but the one in ath9k_htc_init_debug() was forgotten.
Fix the remaining error check.
--- drivers/net/wireless/ath/ath9k/htc_drv_debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath9k/htc_drv_debug.c +1 -1
@@ -491,7 +491,7 @@ int ath9k_htc_init_debug(struct ath_hw *ah) priv->debug.debugfs_phy =debugfs_create_dir (KBUILD_MODNAME , priv->hw->wiphy->debugfsdir); -if (!priv->debug.debugfs_phy) +if (IS_ERR (priv->debug.debugfs_phy))return -ENOMEM ;ath9k_cmn_spectral_init_debug (&priv->spec_priv, priv->debug.debugfs_phy);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 199/600 ice: avoid executing commands on other ports when driving sync
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jacob Keller <[email protected]>
[ Upstream commit 0aacec49c29e7c5b1487e859b0c0a42388c34092 ]
The ice hardware has a synchronization mechanism used to drive the simultaneous application of commands on both PHY ports and the source timer in the MAC.
When issuing a sync via ice_ptp_exec_tmr_cmd(), the hardware will simultaneously apply the commands programmed for the main timer and each PHY port. Neither the main timer command register, nor the PHY port command registers auto clear on command execution.
During the execution of a timer command intended for a single port on E822 devices, such as those used to configure a PHY during link up, the driver is not correctly clearing the previous commands.
This results in unintentionally executing the last programmed command on the main timer and other PHY ports whenever performing reconfiguration on E822 ports after link up. This results in unintended side effects on other timers, depending on what command was previously programmed.
To fix this, the driver must ensure that the main timer and all other PHY ports are properly initialized to perform no action.
The enumeration for timer commands does not include an enumeration value for doing nothing. Introduce ICE_PTP_NOP for this purpose. When writing a timer command to hardware, leave the command bits set to zero which indicates that no operation should be performed on that port.
Modify ice_ptp_one_port_cmd() to always initialize all ports. For all ports other than the one being configured, write their timer command register to ICE_PTP_NOP. This ensures that no side effect happens on the timer command.
To fix this for the PHY ports, modify ice_ptp_one_port_cmd() to always initialize all other ports to ICE_PTP_NOP. This ensures that no side effects happen on the other ports.
Call ice_ptp_src_cmd() with a command value if ICE_PTP_NOP in ice_sync_phy_timer_e822() and ice_start_phy_timer_e822().
With both of these changes, the driver should no longer execute a stale command on the main timer or another PHY port when reconfiguring one of the PHY ports after link up.
--- drivers/net/ethernet/intel/ice/ice_ptp_hw.c | 55 +++++++++++++++++++-- drivers/net/ethernet/intel/ice/ice_ptp_hw.h | 3 +- 2 files changed, 52 insertions(+), 6 deletions(-)
drivers/net/ethernet/intel/ice/ice_ptp_hw.c +50 -5
@@ -131,6 +131,8 @@ static void ice_ptp_src_cmd(struct ice_hw *hw, enum ice_ptp_tmr_cmd cmd)case READ_TIME : cmd_val |=GLTSYN_CMD_READ_TIME ;break ; +case ICE_PTP_NOP : +break ; }wr32 (hw,GLTSYN_CMD , cmd_val);
@@ -1200,18 +1202,18 @@ ice_ptp_read_port_capture(struct ice_hw *hw, u8 port, u64 *tx_ts, u64 *rx_ts) }/** -* ice_ptp_one_port_cmd - Prepare a single PHY port for a timer command +* ice_ptp_write_port_cmd_e822 - Prepare a single PHY port for a timer command * @hw: pointer to HW struct * @port: Port to which cmd has to be sent * @cmd: Command to be sent to the port * * Prepare the requested port for an upcoming timer sync command. * -* Note there is no equivalent of this operation on E810, as that device -* always handles all external PHYs internally. +* Do not use this function directly. If you want to configure exactly one +* port, use ice_ptp_one_port_cmd() instead. */ static int -ice_ptp_one_port_cmd (struct ice_hw *hw,u8 port,enum ice_ptp_tmr_cmd cmd) +ice_ptp_write_port_cmd_e822 (struct ice_hw *hw,u8 port,enum ice_ptp_tmr_cmd cmd) {u32 cmd_val, val;u8 tmr_idx;
@@ -1235,6 +1237,8 @@ ice_ptp_one_port_cmd(struct ice_hw *hw, u8 port, enum ice_ptp_tmr_cmd cmd)case ADJ_TIME_AT_TIME : cmd_val |=PHY_CMD_ADJ_TIME_AT_TIME ;break ; +case ICE_PTP_NOP : +break ; }/* Tx case */
@@ -1280,6 +1284,39 @@ ice_ptp_one_port_cmd(struct ice_hw *hw, u8 port, enum ice_ptp_tmr_cmd cmd)return 0 ; } +/** +* ice_ptp_one_port_cmd - Prepare one port for a timer command +* @hw: pointer to the HW struct +* @configured_port: the port to configure with configured_cmd +* @configured_cmd: timer command to prepare on the configured_port +* +* Prepare the configured_port for the configured_cmd, and prepare all other +* ports for ICE_PTP_NOP. This causes the configured_port to execute the +* desired command while all other ports perform no operation. +*/ +static int +ice_ptp_one_port_cmd (struct ice_hw *hw,u8 configured_port, +enum ice_ptp_tmr_cmd configured_cmd) +{ +u8 port; + +for (port =0 ; port <ICE_NUM_EXTERNAL_PORTS ; port++) { +enum ice_ptp_tmr_cmd cmd; +int err; + +if (port == configured_port) + cmd = configured_cmd; +else + cmd =ICE_PTP_NOP ; + + err =ice_ptp_write_port_cmd_e822 (hw, port, cmd); +if (err) +return err; + } + +return 0 ; +} +/** * ice_ptp_port_cmd_e822 - Prepare all ports for a timer command * @hw: pointer to the HW struct
@@ -1296,7 +1333,7 @@ ice_ptp_port_cmd_e822(struct ice_hw *hw, enum ice_ptp_tmr_cmd cmd)for (port =0 ; port <ICE_NUM_EXTERNAL_PORTS ; port++) {int err; - err =ice_ptp_one_port_cmd (hw, port, cmd); + err =ice_ptp_write_port_cmd_e822 (hw, port, cmd);if (err)return err; }
@@ -2245,6 +2282,9 @@ static int ice_sync_phy_timer_e822(struct ice_hw *hw, u8 port)if (err) goto err_unlock; +/* Do not perform any action on the main timer */ +ice_ptp_src_cmd (hw,ICE_PTP_NOP ); +/* Issue the sync to activate the time adjustment */ ice_ptp_exec_tmr_cmd (hw);
@@ -2371,6 +2411,9 @@ ice_start_phy_timer_e822(struct ice_hw *hw, u8 port, bool bypass)if (err)return err; +/* Do not perform any action on the main timer */ +ice_ptp_src_cmd (hw,ICE_PTP_NOP ); +ice_ptp_exec_tmr_cmd (hw); err =ice_read_phy_reg_e822 (hw, port,P_REG_PS , &val);
@@ -2914,6 +2957,8 @@ static int ice_ptp_port_cmd_e810(struct ice_hw *hw, enum ice_ptp_tmr_cmd cmd)case ADJ_TIME_AT_TIME : cmd_val =GLTSYN_CMD_ADJ_INIT_TIME ;break ; +case ICE_PTP_NOP : +return 0 ; }/* Read, modify, write */
drivers/net/ethernet/intel/ice/ice_ptp_hw.h +2 -1
@@ -9,7 +9,8 @@ enum ice_ptp_tmr_cmd {INIT_INCVAL ,ADJ_TIME ,ADJ_TIME_AT_TIME , -READ_TIME +READ_TIME , + ICE_PTP_NOP, }; enum ice_ptp_serdes {
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 200/600 net: arcnet: Do not call kfree_skb() under local_irq_disable()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jinjie Ruan <[email protected]>
[ Upstream commit 786c96e92fb9e854cb8b0cb7399bb2fb28e15c4b ]
It is not allowed to call kfree_skb() from hardware interrupt context or with hardware interrupts being disabled. So replace kfree_skb() with dev_kfree_skb_irq() under local_irq_disable(). Compile tested only.
--- drivers/net/arcnet/arcnet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/arcnet/arcnet.c +1 -1
@@ -468,7 +468,7 @@ static void arcnet_reply_tasklet(struct tasklet_struct *t) ret =sock_queue_err_skb (sk, ackskb);if (ret) -kfree_skb (ackskb); +dev_kfree_skb_irq (ackskb);local_irq_enable (); };
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 201/600 mlxsw: i2c: Fix chunk size setting in output mailbox buffer
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vadim Pasternak <[email protected]>
[ Upstream commit 146c7c330507c0384bf29d567186632bfe975927 ]
The driver reads commands output from the output mailbox. If the size of the output mailbox is not a multiple of the transaction / block size, then the driver will not issue enough read transactions to read the entire output, which can result in driver initialization errors.
Fix by determining the number of transactions using DIV_ROUND_UP().
--- drivers/net/ethernet/mellanox/mlxsw/i2c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlxsw/i2c.c +1 -1
@@ -444,7 +444,7 @@ mlxsw_i2c_cmd(struct device *dev, u16 opcode, u32 in_mod, size_t in_mbox_size, }else {/* No input mailbox is case of initialization query command. */ reg_size =MLXSW_I2C_MAX_DATA_SIZE ; - num = reg_size / mlxsw_i2c->block_size; + num =DIV_ROUND_UP (reg_size, mlxsw_i2c->block_size);if (mutex_lock_interruptible (&mlxsw_i2c->cmd.lock) <0 ) {dev_err (&client->dev,"Could not acquire lock" );
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 202/600 mlxsw: i2c: Limit single transaction buffer size
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vadim Pasternak <[email protected]>
[ Upstream commit d7248f1cc835bd80e936dc5b2d94b149bdd0077d ]
Maximum size of buffer is obtained from underlying I2C adapter and in case adapter allows I2C transaction buffer size greater than 100 bytes, transaction will fail due to firmware limitation.
As a result driver will fail initialization.
Limit the maximum size of transaction buffer by 100 bytes to fit to firmware.
Remove unnecessary calculation:max_t(u16, MLXSW_I2C_BLK_DEF, quirk_size).
This condition can not happened.
--- drivers/net/ethernet/mellanox/mlxsw/i2c.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlxsw/i2c.c +2 -1
@@ -48,6 +48,7 @@#define MLXSW_I2C_MBOX_SIZE_BITS 12#define MLXSW_I2C_ADDR_BUF_SIZE 4#define MLXSW_I2C_BLK_DEF 32 +#define MLXSW_I2C_BLK_MAX 100#define MLXSW_I2C_RETRY 5#define MLXSW_I2C_TIMEOUT_MSECS 5000#define MLXSW_I2C_MAX_DATA_SIZE 256
@@ -653,7 +654,7 @@ static int mlxsw_i2c_probe(struct i2c_client *client,return -EOPNOTSUPP ; } - mlxsw_i2c->block_size =max_t (u16,MLXSW_I2C_BLK_DEF , + mlxsw_i2c->block_size =min_t (u16,MLXSW_I2C_BLK_MAX ,min_t (u16, quirks->max_read_len, quirks->max_write_len)); }else {
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 203/600 mlxsw: core_hwmon: Adjust module label names based on MTCAP sensor counter
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vadim Pasternak <[email protected]>
[ Upstream commit 3fc134a07438055fc93ce1bbacf2702ddd09500c ]
Transceiver module temperature sensors are indexed after ASIC and platform sensors. The current label printing method does not take this into account and simply prints the index of the transceiver module sensor.
On new systems that have platform sensors this results in incorrect (shifted) transceiver module labels being printed:
$ sensors [...] front panel 002: +37.0°C (crit = +70.0°C, emerg = +75.0°C) front panel 003: +47.0°C (crit = +70.0°C, emerg = +75.0°C) [...]
Fix by taking the sensor count into account. After the fix:
$ sensors [...] front panel 001: +37.0°C (crit = +70.0°C, emerg = +75.0°C) front panel 002: +47.0°C (crit = +70.0°C, emerg = +75.0°C) [...]
--- drivers/net/ethernet/mellanox/mlxsw/core_hwmon.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlxsw/core_hwmon.c +2 -1
@@ -405,7 +405,8 @@ mlxsw_hwmon_module_temp_label_show(struct device *dev, container_of(attr, struct mlxsw_hwmon_attr, dev_attr);return sprintf (buf,"front panel %03u\n" , - mlxsw_hwmon_attr->type_index); + mlxsw_hwmon_attr->type_index +1 - + mlxsw_hwmon_attr->mlxsw_hwmon_dev->sensor_count); } static ssize_t
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 204/600 hwmon: (tmp513) Fix the channel number in tmp51x_is_visible()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Biju Das <[email protected]>
[ Upstream commit d103337e38e7e64c3d915029e947b1cb0b512737 ]
The supported channels for this driver are {0..3}. Fix the incorrect channel in tmp51x_is_visible().
--- drivers/hwmon/tmp513.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/tmp513.c +1 -1
@@ -434,7 +434,7 @@ static umode_t tmp51x_is_visible(const void *_data,switch (type) {case hwmon_temp: -if (data->id == tmp512 && channel ==4 ) +if (data->id == tmp512 && channel ==3 )return 0 ;switch (attr) {case hwmon_temp_input:
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 205/600 octeontx2-pf: Refactor schedular queue alloc/free calls
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hariprasad Kelam <[email protected]>
[ Upstream commit 6b4b2ded9c4282deea421eef144ab0ced954721c ]
1. Upon txschq free request, the transmit schedular config in hardware is not getting reset. This patch adds necessary changes to do the same.
2. Current implementation calls txschq alloc during interface initialization and in response handler updates the default txschq array. This creates a problem for htb offload where txsch alloc will be called for every tc class. This patch addresses the issue by reading txschq response in mbox caller function instead in the response handler.
3. Current otx2_txschq_stop routine tries to free all txschq nodes allocated to the interface. This creates a problem for htb offload. This patch introduces the otx2_txschq_free_one to free txschq in a given level.
Stable-dep-of: a9ac2e187795 ("octeontx2-pf: Fix PFC TX scheduler free")
--- .../ethernet/marvell/octeontx2/af/rvu_nix.c | 45 +++++++++++++ .../marvell/octeontx2/nic/otx2_common.c | 67 ++++++++++++------- .../marvell/octeontx2/nic/otx2_common.h | 3 +- .../ethernet/marvell/octeontx2/nic/otx2_pf.c | 13 +--- .../ethernet/marvell/octeontx2/nic/otx2_vf.c | 4 -- 5 files changed, 94 insertions(+), 38 deletions(-)
drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c +45 -0
@@ -1691,6 +1691,42 @@ handle_txschq_shaper_update(struct rvu *rvu, int blkaddr, int nixlf,return true; } +static void nix_reset_tx_schedule (struct rvu *rvu,int blkaddr, +int lvl,int schq) +{ +u64 tlx_parent =0 , tlx_schedule =0 ; + +switch (lvl) { +case NIX_TXSCH_LVL_TL2 : + tlx_parent =NIX_AF_TL2X_PARENT (schq); + tlx_schedule =NIX_AF_TL2X_SCHEDULE (schq); +break ; +case NIX_TXSCH_LVL_TL3 : + tlx_parent =NIX_AF_TL3X_PARENT (schq); + tlx_schedule =NIX_AF_TL3X_SCHEDULE (schq); +break ; +case NIX_TXSCH_LVL_TL4 : + tlx_parent =NIX_AF_TL4X_PARENT (schq); + tlx_schedule =NIX_AF_TL4X_SCHEDULE (schq); +break ; +case NIX_TXSCH_LVL_MDQ : +/* no need to reset SMQ_CFG as HW clears this CSR +* on SMQ flush +*/ + tlx_parent =NIX_AF_MDQX_PARENT (schq); + tlx_schedule =NIX_AF_MDQX_SCHEDULE (schq); +break ; +default : +return ; + } + +if (tlx_parent) +rvu_write64 (rvu, blkaddr, tlx_parent,0x0 ); + +if (tlx_schedule) +rvu_write64 (rvu, blkaddr, tlx_schedule,0x0 ); +} +/* Disable shaping of pkts by a scheduler queue * at a given scheduler level. */
@@ -2040,6 +2076,7 @@ int rvu_mbox_handler_nix_txsch_alloc(struct rvu *rvu, pfvf_map[schq] =TXSCH_MAP (pcifunc,0 );nix_reset_tx_linkcfg (rvu, blkaddr, lvl, schq);nix_reset_tx_shaping (rvu, blkaddr, nixlf, lvl, schq); +nix_reset_tx_schedule (rvu, blkaddr, lvl, schq); }for (idx =0 ; idx < req->schq[lvl]; idx++) {
@@ -2049,6 +2086,7 @@ int rvu_mbox_handler_nix_txsch_alloc(struct rvu *rvu, pfvf_map[schq] =TXSCH_MAP (pcifunc,0 );nix_reset_tx_linkcfg (rvu, blkaddr, lvl, schq);nix_reset_tx_shaping (rvu, blkaddr, nixlf, lvl, schq); +nix_reset_tx_schedule (rvu, blkaddr, lvl, schq); } }
@@ -2137,6 +2175,7 @@ static int nix_txschq_free(struct rvu *rvu, u16 pcifunc)continue ;nix_reset_tx_linkcfg (rvu, blkaddr, lvl, schq);nix_clear_tx_xoff (rvu, blkaddr, lvl, schq); +nix_reset_tx_shaping (rvu, blkaddr, nixlf, lvl, schq); } } nix_clear_tx_xoff(rvu, blkaddr, NIX_TXSCH_LVL_TL1,
@@ -2175,6 +2214,7 @@ static int nix_txschq_free(struct rvu *rvu, u16 pcifunc)for (schq =0 ; schq < txsch->schq.max; schq++) {if (TXSCH_MAP_FUNC (txsch->pfvf_map[schq]) != pcifunc)continue ; +nix_reset_tx_schedule (rvu, blkaddr, lvl, schq);rvu_free_rsrc (&txsch->schq, schq); txsch->pfvf_map[schq] =TXSCH_MAP (0 ,NIX_TXSCHQ_FREE ); }
@@ -2234,6 +2274,9 @@ static int nix_txschq_free_one(struct rvu *rvu,*/ nix_clear_tx_xoff (rvu, blkaddr, lvl, schq); +nix_reset_tx_linkcfg (rvu, blkaddr, lvl, schq); +nix_reset_tx_shaping (rvu, blkaddr, nixlf, lvl, schq); +/* Flush if it is a SMQ. Onus of disabling * TL2/3 queue links before SMQ flush is on user */
@@ -2243,6 +2286,8 @@ static int nix_txschq_free_one(struct rvu *rvu, goto err; } +nix_reset_tx_schedule (rvu, blkaddr, lvl, schq); +/* Free the resource */ rvu_free_rsrc (&txsch->schq, schq); txsch->pfvf_map[schq] =TXSCH_MAP (0 ,NIX_TXSCHQ_FREE );
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c +44 -23
105 lines not on this page · raw message
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h +2 -1
@@ -917,7 +917,8 @@ int otx2_config_nix(struct otx2_nic *pfvf);int otx2_config_nix_queues (struct otx2_nic *pfvf);int otx2_txschq_config (struct otx2_nic *pfvf,int lvl,int prio,bool pfc_en);int otx2_txsch_alloc (struct otx2_nic *pfvf); -int otx2_txschq_stop (struct otx2_nic *pfvf); +void otx2_txschq_stop (struct otx2_nic *pfvf); +void otx2_txschq_free_one (struct otx2_nic *pfvf,u16 lvl,u16 schq);void otx2_sqb_flush (struct otx2_nic *pfvf);int __otx2_alloc_rbuf (struct otx2_nic *pfvf,struct otx2_pool *pool,dma_addr_t *dma);
drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c +3 -10
@@ -791,10 +791,6 @@ static void otx2_process_pfaf_mbox_msg(struct otx2_nic *pf,case MBOX_MSG_NIX_LF_ALLOC :mbox_handler_nix_lf_alloc (pf, (struct nix_lf_alloc_rsp *)msg);break ; -case MBOX_MSG_NIX_TXSCH_ALLOC : -mbox_handler_nix_txsch_alloc (pf, - (struct nix_txsch_alloc_rsp *)msg); -break ;case MBOX_MSG_NIX_BP_ENABLE :mbox_handler_nix_bp_enable (pf, (struct nix_bp_cfg_rsp *)msg);break ;
@@ -1517,8 +1513,7 @@ static int otx2_init_hw_resources(struct otx2_nic *pf)otx2_free_cq_res (pf);otx2_ctx_disable (mbox,NIX_AQ_CTYPE_RQ , false); err_free_txsch: -if (otx2_txschq_stop (pf)) -dev_err (pf->dev,"%s failed to stop TX schedulers\n" , __func__); +otx2_txschq_stop (pf); err_free_sq_ptrs:otx2_sq_free_sqbs (pf); err_free_rq_ptrs:
@@ -1553,15 +1548,13 @@ static void otx2_free_hw_resources(struct otx2_nic *pf)struct mbox *mbox = &pf->mbox;struct otx2_cq_queue *cq;struct msg_req *req; -int qidx, err; +int qidx;/* Ensure all SQE are processed */ otx2_sqb_flush (pf);/* Stop transmission */ - err =otx2_txschq_stop (pf); -if (err) -dev_err (pf->dev,"RVUPF: Failed to stop/free TX schedulers\n" ); +otx2_txschq_stop (pf);#ifdef CONFIG_DCB if (pf->pfc_en)
drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c +0 -4
@@ -70,10 +70,6 @@ static void otx2vf_process_vfaf_mbox_msg(struct otx2_nic *vf,case MBOX_MSG_NIX_LF_ALLOC :mbox_handler_nix_lf_alloc (vf, (struct nix_lf_alloc_rsp *)msg);break ; -case MBOX_MSG_NIX_TXSCH_ALLOC : -mbox_handler_nix_txsch_alloc (vf, - (struct nix_txsch_alloc_rsp *)msg); -break ;case MBOX_MSG_NIX_BP_ENABLE :mbox_handler_nix_bp_enable (vf, (struct nix_bp_cfg_rsp *)msg);break ;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 206/600 octeontx2-pf: Fix PFC TX scheduler free
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Suman Ghosh <[email protected]>
[ Upstream commit a9ac2e18779597f280d68a5b5f5bdd51a34080fa ]
During PFC TX schedulers free, flag TXSCHQ_FREE_ALL was being set which caused free up all schedulers other than the PFC schedulers. This patch fixes that to free only the PFC Tx schedulers.
--- .../ethernet/marvell/octeontx2/nic/otx2_common.c | 1 + .../ethernet/marvell/octeontx2/nic/otx2_dcbnl.c | 15 ++++----------- 2 files changed, 5 insertions(+), 11 deletions(-)
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c +1 -0
@@ -773,6 +773,7 @@ void otx2_txschq_free_one(struct otx2_nic *pfvf, u16 lvl, u16 schq)mutex_unlock (&pfvf->mbox.lock); } +EXPORT_SYMBOL (otx2_txschq_free_one);void otx2_txschq_stop (struct otx2_nic *pfvf) {
drivers/net/ethernet/marvell/octeontx2/nic/otx2_dcbnl.c +4 -11
@@ -125,19 +125,12 @@ int otx2_pfc_txschq_alloc(struct otx2_nic *pfvf)static int otx2_pfc_txschq_stop_one (struct otx2_nic *pfvf,u8 prio) { -struct nix_txsch_free_req *free_req; +int lvl; -mutex_lock (&pfvf->mbox.lock);/* free PFC TLx nodes */ - free_req =otx2_mbox_alloc_msg_nix_txsch_free (&pfvf->mbox); -if (!free_req) { -mutex_unlock (&pfvf->mbox.lock); -return -ENOMEM ; - } - - free_req->flags =TXSCHQ_FREE_ALL ; -otx2_sync_mbox_msg (&pfvf->mbox); -mutex_unlock (&pfvf->mbox.lock); +for (lvl =0 ; lvl < pfvf->hw.txschq_link_cfg_lvl; lvl++) +otx2_txschq_free_one (pfvf, lvl, + pfvf->pfc_schq_list[lvl][prio]); pfvf->pfc_alloc_status[prio] = false;return 0 ;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 207/600 cteonxt2-pf: Fix backpressure config for multiple PFC priorities to work simultaneously
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Suman Ghosh <[email protected]>
[ Upstream commit 597d0ec0e4ca6a912affea4cc94df08959e9ec74 ]
MAC (CGX or RPM) asserts backpressure at TL3 or TL2 node of the egress hierarchical scheduler tree depending on link level config done. If there are multiple PFC priorities enabled at a time and for all such flows to backoff, each priority will have to assert backpressure at different TL3/TL2 scheduler nodes and these flows will need to submit egress pkts to these nodes.
Current PFC configuration has an issue where in only one backpressure scheduler node is being allocated which is resulting in only one PFC priority to work. This patch fixes this issue.
--- drivers/net/ethernet/marvell/octeontx2/nic/otx2_dcbnl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/marvell/octeontx2/nic/otx2_dcbnl.c +3 -3
@@ -70,7 +70,7 @@ static int otx2_pfc_txschq_alloc_one(struct otx2_nic *pfvf, u8 prio)* link config level. These rest of the scheduler can be * same as hw.txschq_list. */ -for (lvl =0 ; lvl < pfvf->hw.txschq_link_cfg_lvl; lvl++) +for (lvl =0 ; lvl <= pfvf->hw.txschq_link_cfg_lvl; lvl++) req->schq[lvl] =1 ; rc =otx2_sync_mbox_msg (&pfvf->mbox);
@@ -83,7 +83,7 @@ static int otx2_pfc_txschq_alloc_one(struct otx2_nic *pfvf, u8 prio)return PTR_ERR (rsp);/* Setup transmit scheduler list */ -for (lvl =0 ; lvl < pfvf->hw.txschq_link_cfg_lvl; lvl++) { +for (lvl =0 ; lvl <= pfvf->hw.txschq_link_cfg_lvl; lvl++) {if (!rsp->schq[lvl])return -ENOSPC ;
@@ -128,7 +128,7 @@ static int otx2_pfc_txschq_stop_one(struct otx2_nic *pfvf, u8 prio)int lvl;/* free PFC TLx nodes */ -for (lvl =0 ; lvl < pfvf->hw.txschq_link_cfg_lvl; lvl++) +for (lvl =0 ; lvl <= pfvf->hw.txschq_link_cfg_lvl; lvl++)otx2_txschq_free_one (pfvf, lvl, pfvf->pfc_schq_list[lvl][prio]);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 208/600 sfc: Check firmware supports Ethernet PTP filter
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Austin <[email protected]>
[ Upstream commit c4413a20fa6d7c4888009fb7dd391685f196cd36 ]
Not all firmware variants support RSS filters. Do not fail all PTP functionality when raw ethernet PTP filters fail to insert.
--- drivers/net/ethernet/sfc/ptp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/sfc/ptp.c +2 -1
@@ -1387,7 +1387,8 @@ static int efx_ptp_insert_multicast_filters(struct efx_nic *efx) goto fail; rc =efx_ptp_insert_eth_filter (efx); -if (rc <0 ) +/* Not all firmware variants support this filter */ +if (rc <0 && rc != -EPROTONOSUPPORT ) goto fail; }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 209/600 net/sched: sch_hfsc: Ensure inner classes have fsc curve
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Budimir Markovic <[email protected]>
[ Upstream commit b3d26c5702c7d6c45456326e56d2ccf3f103e60f ]
HFSC assumes that inner classes have an fsc curve, but it is currently possible for classes without an fsc curve to become parents. This leads to bugs including a use-after-free.
Don't allow non-root classes without HFSC_FSC to become parents.
--- net/sched/sch_hfsc.c | 4 ++++ 1 file changed, 4 insertions(+)
net/sched/sch_hfsc.c +4 -0
@@ -1012,6 +1012,10 @@ hfsc_change_class(struct Qdisc *sch, u32 classid, u32 parentid,if (parent ==NULL )return -ENOENT ; } +if (!(parent->cl_flags &HFSC_FSC ) && parent != &q->root) { +NL_SET_ERR_MSG (extack,"Invalid parent - parent class must have FSC" ); +return -EINVAL ; + }if (classid ==0 ||TC_H_MAJ (classid ^ sch->handle) !=0 )return -EINVAL ;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 210/600 netrom: Deny concurrent connect().
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <[email protected]>
[ Upstream commit c2f8fd7949603efb03908e05abbf7726748c8de3 ]
syzkaller reported null-ptr-deref [0] related to AF_NETROM. This is another self-accept issue from the strace log. [1]
syz-executor creates an AF_NETROM socket and calls connect(), which is blocked at that time. Then, sk->sk_state is TCP_SYN_SENT and sock->state is SS_CONNECTING.
[pid 5059] socket(AF_NETROM, SOCK_SEQPACKET, 0) = 4
[pid 5059] connect(4, {sa_family=AF_NETROM, sa_data="..." <unfinished ...>
Another thread calls connect() concurrently, which finally fails with -EINVAL. However, the problem here is the socket state is reset even while the first connect() is blocked.
[pid 5060] connect(4, NULL, 0 <unfinished ...>
[pid 5060] <... connect resumed>) = -1 EINVAL (Invalid argument)
As sk->state is TCP_CLOSE and sock->state is SS_UNCONNECTED, the following listen() succeeds. Then, the first connect() looks up itself as a listener and puts skb into the queue with skb->sk itself. As a result, the next accept() gets another FD of itself as 3, and the first connect() finishes.
[pid 5060] listen(4, 0 <unfinished ...> [pid 5060] <... listen resumed>) = 0 [pid 5060] accept(4, NULL, NULL <unfinished ...> [pid 5060] <... accept resumed>) = 3 [pid 5059] <... connect resumed>) = 0
Then, accept4() is called but blocked, which causes the general protection fault later.
[pid 5059] accept4(4, NULL, 0x20000400, SOCK_NONBLOCK <unfinished ...>
After that, another self-accept occurs by accept() and writev().
[pid 5060] accept(4, NULL, NULL <unfinished ...>
[pid 5061] writev(3, [{iov_base=...}] <unfinished ...>
[pid 5061] <... writev resumed>) = 99
[pid 5060] <... accept resumed>) = 6Finally, the leader thread close()s all FDs. Since the three FDs reference the same socket, nr_release() does the cleanup for it three times, and the remaining accept4() causes the following fault.
[pid 5058] close(3) = 0 [pid 5058] close(4) = 0 [pid 5058] close(5) = -1 EBADF (Bad file descriptor) [pid 5058] close(6) = 0 [pid 5058] <... exit_group resumed>) = ? [ 83.456055][ T5059] general protection fault, probably for non-canonical address 0xdffffc0000000003: 0000 [#1] PREEMPT SMP KASAN
To avoid the issue, we need to return an error for connect() if another connect() is in progress, as done in __inet_stream_connect().
[0]:
general protection fault, probably for non-canonical address 0xdffffc0000000003: 0000 [#1] PREEMPT SMP KASAN KASAN: null-ptr-deref in range [0x0000000000000018-0x000000000000001f] CPU: 0 PID: 5059 Comm: syz-executor.0 Not tainted 6.5.0-rc5-syzkaller-00194-gace0ab3a4b54 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/26/2023 RIP: 0010:__lock_acquire+0x109/0x5de0 kernel/locking/lockdep.c:5012 Code: 45 85 c9 0f 84 cc 0e 00 00 44 8b 05 11 6e 23 0b 45 85 c0 0f 84 be 0d 00 00 48 ba 00 00 00 00 00 fc ff df 4c 89 d1 48 c1 e9 03 <80> 3c 11 00 0f 85 e8 40 00 00 49 81 3a a0 69 48 90 0f 84 96 0d 00 RSP: 0018:ffffc90003d6f9e0 EFLAGS: 00010006 RAX: ffff8880244c8000 RBX: 1ffff920007adf6c RCX: 0000000000000003 RDX: dffffc0000000000 RSI: 0000000000000000 RDI: 0000000000000018 RBP: 0000000000000001 R08: 0000000000000001 R09: 0000000000000001 R10: 0000000000000018 R11: 0000000000000000 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 FS: 00007f51d519a6c0(0000) GS:ffff8880b9800000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f51d5158d58 CR3: 000000002943f000 CR4: 00000000003506f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <TASK> lock_acquire kernel/locking/lockdep.c:5761 [inline] lock_acquire+0x1ae/0x510 kernel/locking/lockdep.c:5726 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0x3a/0x50 kernel/locking/spinlock.c:162 prepare_to_wait+0x47/0x380 kernel/sched/wait.c:269 nr_accept+0x20d/0x650 net/netrom/af_netrom.c:798 do_accept+0x3a6/0x570 net/socket.c:1872 __sys_accept4_file net/socket.c:1913 [inline] __sys_accept4+0x99/0x120 net/socket.c:1943 __do_sys_accept4 net/socket.c:1954 [inline] __se_sys_accept4 net/socket.c:1951 [inline] __x64_sys_accept4+0x96/0x100 net/socket.c:1951 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7f51d447cae9 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b0 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f51d519a0c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000120 RAX: ffffffffffffffda RBX: 00007f51d459bf80 RCX: 00007f51d447cae9 RDX: 0000000020000400 RSI: 0000000000000000 RDI: 0000000000000004 RBP: 00007f51d44c847a R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000800 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007f51d459bf80 R15: 00007ffc25c34e48 </TASK>
--- net/netrom/af_netrom.c | 5 +++++ 1 file changed, 5 insertions(+)
net/netrom/af_netrom.c +5 -0
@@ -660,6 +660,11 @@ static int nr_connect(struct socket *sock, struct sockaddr *uaddr, goto out_release; } +if (sock->state ==SS_CONNECTING ) { + err = -EALREADY ; + goto out_release; + } + sk->sk_state =TCP_CLOSE ; sock->state =SS_UNCONNECTED ;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 211/600 drm/bridge: tc358764: Fix debug print parameter order
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Vasut <[email protected]>
[ Upstream commit 7f947be02aab5b154427cb5b0fffe858fc387b02 ]
The debug print parameters were swapped in the output and they were printed as decimal values, both the hardware address and the value. Update the debug print to print the parameters in correct order, and use hexadecimal print for both address and value.
--- drivers/gpu/drm/bridge/tc358764.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/bridge/tc358764.c +1 -1
@@ -176,7 +176,7 @@ static void tc358764_read(struct tc358764 *ctx, u16 addr, u32 *val)if (ret >=0 )le32_to_cpus (val); -dev_dbg (ctx->dev,"read: %d, addr: %d\n" , addr, *val); +dev_dbg (ctx->dev,"read: addr=0x%04x data=0x%08x\n" , addr, *val); }static void tc358764_write (struct tc358764 *ctx,u16 addr,u32 val)
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 212/600 ASoC: cs43130: Fix numerator/denominator mixup
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Phil Elwell <[email protected]>
[ Upstream commit a9e7c964cea4fb1541cc81a11d1b2fd135f4cf38 ]
In converting to using the standard u16_fract type, commit [1] made the obvious mistake and failed to take account of the difference in numerator and denominator ordering, breaking all uses of the cs43130 codec.
Fix it.
[1] commit e14bd35ef446 ("ASoC: cs43130: Re-use generic struct u16_fract")
--- sound/soc/codecs/cs43130.h | 138 ++++++++++++++++++------------------- 1 file changed, 69 insertions(+), 69 deletions(-)
sound/soc/codecs/cs43130.h +69 -69
@@ -381,88 +381,88 @@ struct cs43130_clk_gen {/* frm_size = 16 */ static const struct cs43130_clk_gen cs43130_16_clk_gen[] = { - {22579200 ,32000 , .v = {441 ,10 , }, }, - {22579200 ,44100 , .v = {32 ,1 , }, }, - {22579200 ,48000 , .v = {147 ,5 , }, }, - {22579200 ,88200 , .v = {16 ,1 , }, }, - {22579200 ,96000 , .v = {147 ,10 , }, }, - {22579200 ,176400 , .v = {8 ,1 , }, }, - {22579200 ,192000 , .v = {147 ,20 , }, }, - {22579200 ,352800 , .v = {4 ,1 , }, }, - {22579200 ,384000 , .v = {147 ,40 , }, }, - {24576000 ,32000 , .v = {48 ,1 , }, }, - {24576000 ,44100 , .v = {5120 ,147 , }, }, - {24576000 ,48000 , .v = {32 ,1 , }, }, - {24576000 ,88200 , .v = {2560 ,147 , }, }, - {24576000 ,96000 , .v = {16 ,1 , }, }, - {24576000 ,176400 , .v = {1280 ,147 , }, }, - {24576000 ,192000 , .v = {8 ,1 , }, }, - {24576000 ,352800 , .v = {640 ,147 , }, }, - {24576000 ,384000 , .v = {4 ,1 , }, }, + {22579200 ,32000 , .v = {10 ,441 , }, }, + {22579200 ,44100 , .v = {1 ,32 , }, }, + {22579200 ,48000 , .v = {5 ,147 , }, }, + {22579200 ,88200 , .v = {1 ,16 , }, }, + {22579200 ,96000 , .v = {10 ,147 , }, }, + {22579200 ,176400 , .v = {1 ,8 , }, }, + {22579200 ,192000 , .v = {20 ,147 , }, }, + {22579200 ,352800 , .v = {1 ,4 , }, }, + {22579200 ,384000 , .v = {40 ,147 , }, }, + {24576000 ,32000 , .v = {1 ,48 , }, }, + {24576000 ,44100 , .v = {147 ,5120 , }, }, + {24576000 ,48000 , .v = {1 ,32 , }, }, + {24576000 ,88200 , .v = {147 ,2560 , }, }, + {24576000 ,96000 , .v = {1 ,16 , }, }, + {24576000 ,176400 , .v = {147 ,1280 , }, }, + {24576000 ,192000 , .v = {1 ,8 , }, }, + {24576000 ,352800 , .v = {147 ,640 , }, }, + {24576000 ,384000 , .v = {1 ,4 , }, }, };/* frm_size = 32 */ static const struct cs43130_clk_gen cs43130_32_clk_gen[] = { - {22579200 ,32000 , .v = {441 ,20 , }, }, - {22579200 ,44100 , .v = {16 ,1 , }, }, - {22579200 ,48000 , .v = {147 ,10 , }, }, - {22579200 ,88200 , .v = {8 ,1 , }, }, - {22579200 ,96000 , .v = {147 ,20 , }, }, - {22579200 ,176400 , .v = {4 ,1 , }, }, - {22579200 ,192000 , .v = {147 ,40 , }, }, - {22579200 ,352800 , .v = {2 ,1 , }, }, - {22579200 ,384000 , .v = {147 ,80 , }, }, - {24576000 ,32000 , .v = {24 ,1 , }, }, - {24576000 ,44100 , .v = {2560 ,147 , }, }, - {24576000 ,48000 , .v = {16 ,1 , }, }, - {24576000 ,88200 , .v = {1280 ,147 , }, }, - {24576000 ,96000 , .v = {8 ,1 , }, }, - {24576000 ,176400 , .v = {640 ,147 , }, }, - {24576000 ,192000 , .v = {4 ,1 , }, }, - {24576000 ,352800 , .v = {320 ,147 , }, }, - {24576000 ,384000 , .v = {2 ,1 , }, }, + {22579200 ,32000 , .v = {20 ,441 , }, }, + {22579200 ,44100 , .v = {1 ,16 , }, }, + {22579200 ,48000 , .v = {10 ,147 , }, }, + {22579200 ,88200 , .v = {1 ,8 , }, }, + {22579200 ,96000 , .v = {20 ,147 , }, }, + {22579200 ,176400 , .v = {1 ,4 , }, }, + {22579200 ,192000 , .v = {40 ,147 , }, }, + {22579200 ,352800 , .v = {1 ,2 , }, }, + {22579200 ,384000 , .v = {80 ,147 , }, }, + {24576000 ,32000 , .v = {1 ,24 , }, }, + {24576000 ,44100 , .v = {147 ,2560 , }, }, + {24576000 ,48000 , .v = {1 ,16 , }, }, + {24576000 ,88200 , .v = {147 ,1280 , }, }, + {24576000 ,96000 , .v = {1 ,8 , }, }, + {24576000 ,176400 , .v = {147 ,640 , }, }, + {24576000 ,192000 , .v = {1 ,4 , }, }, + {24576000 ,352800 , .v = {147 ,320 , }, }, + {24576000 ,384000 , .v = {1 ,2 , }, }, };/* frm_size = 48 */ static const struct cs43130_clk_gen cs43130_48_clk_gen[] = { - {22579200 ,32000 , .v = {147 ,100 , }, }, - {22579200 ,44100 , .v = {32 ,3 , }, }, - {22579200 ,48000 , .v = {49 ,5 , }, }, - {22579200 ,88200 , .v = {16 ,3 , }, }, - {22579200 ,96000 , .v = {49 ,10 , }, }, - {22579200 ,176400 , .v = {8 ,3 , }, }, - {22579200 ,192000 , .v = {49 ,20 , }, }, - {22579200 ,352800 , .v = {4 ,3 , }, }, - {22579200 ,384000 , .v = {49 ,40 , }, }, - {24576000 ,32000 , .v = {16 ,1 , }, }, - {24576000 ,44100 , .v = {5120 ,441 , }, }, - {24576000 ,48000 , .v = {32 ,3 , }, }, - {24576000 ,88200 , .v = {2560 ,441 , }, }, - {24576000 ,96000 , .v = {16 ,3 , }, }, - {24576000 ,176400 , .v = {1280 ,441 , }, }, - {24576000 ,192000 , .v = {8 ,3 , }, }, - {24576000 ,352800 , .v = {640 ,441 , }, }, - {24576000 ,384000 , .v = {4 ,3 , }, }, + {22579200 ,32000 , .v = {100 ,147 , }, }, + {22579200 ,44100 , .v = {3 ,32 , }, }, + {22579200 ,48000 , .v = {5 ,49 , }, }, + {22579200 ,88200 , .v = {3 ,16 , }, }, + {22579200 ,96000 , .v = {10 ,49 , }, }, + {22579200 ,176400 , .v = {3 ,8 , }, }, + {22579200 ,192000 , .v = {20 ,49 , }, }, + {22579200 ,352800 , .v = {3 ,4 , }, }, + {22579200 ,384000 , .v = {40 ,49 , }, }, + {24576000 ,32000 , .v = {1 ,16 , }, }, + {24576000 ,44100 , .v = {441 ,5120 , }, }, + {24576000 ,48000 , .v = {3 ,32 , }, }, + {24576000 ,88200 , .v = {441 ,2560 , }, }, + {24576000 ,96000 , .v = {3 ,16 , }, }, + {24576000 ,176400 , .v = {441 ,1280 , }, }, + {24576000 ,192000 , .v = {3 ,8 , }, }, + {24576000 ,352800 , .v = {441 ,640 , }, }, + {24576000 ,384000 , .v = {3 ,4 , }, }, };/* frm_size = 64 */ static const struct cs43130_clk_gen cs43130_64_clk_gen[] = { - {22579200 ,32000 , .v = {441 ,40 , }, }, - {22579200 ,44100 , .v = {8 ,1 , }, }, - {22579200 ,48000 , .v = {147 ,20 , }, }, - {22579200 ,88200 , .v = {4 ,1 , }, }, - {22579200 ,96000 , .v = {147 ,40 , }, }, - {22579200 ,176400 , .v = {2 ,1 , }, }, - {22579200 ,192000 , .v = {147 ,80 , }, }, + {22579200 ,32000 , .v = {40 ,441 , }, }, + {22579200 ,44100 , .v = {1 ,8 , }, }, + {22579200 ,48000 , .v = {20 ,147 , }, }, + {22579200 ,88200 , .v = {1 ,4 , }, }, + {22579200 ,96000 , .v = {40 ,147 , }, }, + {22579200 ,176400 , .v = {1 ,2 , }, }, + {22579200 ,192000 , .v = {80 ,147 , }, }, {22579200 ,352800 , .v = {1 ,1 , }, }, - {24576000 ,32000 , .v = {12 ,1 , }, }, - {24576000 ,44100 , .v = {1280 ,147 , }, }, - {24576000 ,48000 , .v = {8 ,1 , }, }, - {24576000 ,88200 , .v = {640 ,147 , }, }, - {24576000 ,96000 , .v = {4 ,1 , }, }, - {24576000 ,176400 , .v = {320 ,147 , }, }, - {24576000 ,192000 , .v = {2 ,1 , }, }, - {24576000 ,352800 , .v = {160 ,147 , }, }, + {24576000 ,32000 , .v = {1 ,12 , }, }, + {24576000 ,44100 , .v = {147 ,1280 , }, }, + {24576000 ,48000 , .v = {1 ,8 , }, }, + {24576000 ,88200 , .v = {147 ,640 , }, }, + {24576000 ,96000 , .v = {1 ,4 , }, }, + {24576000 ,176400 , .v = {147 ,320 , }, }, + {24576000 ,192000 , .v = {1 ,2 , }, }, + {24576000 ,352800 , .v = {147 ,160 , }, }, {24576000 ,384000 , .v = {1 ,1 , }, }, };
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 213/600 drm: bridge: dw-mipi-dsi: Fix enable/disable of DSI controller
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ondrej Jirman <[email protected]>
[ Upstream commit 05aa61334592adb230749ff465b103ee10e63936 ]
Before this patch, booting to Linux VT and doing a simple:
echo 2 > /sys/class/graphics/fb0/blank
echo 0 > /sys/class/graphics/fb0/blank
would result in failures to re-enable the panel. Mode set callback is called only once during boot in this scenario, while calls to enable/disable callbacks are balanced afterwards. The driver doesn't work unless userspace calls modeset before enabling the CRTC/connector.
This patch moves enabling of the DSI host from mode_set into pre_enable callback, and removes some old hacks where this bridge driver is directly calling into other bridge driver's callbacks.
pre_enable_prev_first flag is set on the panel's bridge so that panel drivers will get their prepare function called between DSI host's pre_enable and enable callbacks, so that they get a chance to perform panel setup while DSI host is already enabled in command mode. Otherwise panel's prepare would be called before DSI host is enabled, and any DSI communication used in prepare callback would fail.
With all these changes, the enable/disable sequence is now well balanced, and host's and panel's callbacks are called in proper order documented in the drm_panel API documentation without needing the old hacks. (Mainly that panel->prepare is called when DSI host is ready to allow the panel driver to send DSI commands and vice versa during disable.)
Tested on Pinephone Pro. Trace of the callbacks follows.
Before:
[ 1.253882] dw-mipi-dsi-rockchip ff960000.dsi: mode_set [ 1.290732] panel-himax-hx8394 ff960000.dsi.0: prepare [ 1.475576] dw-mipi-dsi-rockchip ff960000.dsi: enable [ 1.475593] panel-himax-hx8394 ff960000.dsi.0: enable
echo 2 > /sys/class/graphics/fb0/blank
[ 13.722799] panel-himax-hx8394 ff960000.dsi.0: disable [ 13.774502] dw-mipi-dsi-rockchip ff960000.dsi: post_disable [ 13.774526] panel-himax-hx8394 ff960000.dsi.0: unprepare
echo 0 > /sys/class/graphics/fb0/blank
[ 17.735796] panel-himax-hx8394 ff960000.dsi.0: prepare [ 17.923522] dw-mipi-dsi-rockchip ff960000.dsi: enable [ 17.923540] panel-himax-hx8394 ff960000.dsi.0: enable [ 17.944330] dw-mipi-dsi-rockchip ff960000.dsi: failed to write command FIFO [ 17.944335] panel-himax-hx8394 ff960000.dsi.0: sending command 0xb9 failed: -110 [ 17.944340] panel-himax-hx8394 ff960000.dsi.0: Panel init sequence failed: -110
echo 2 > /sys/class/graphics/fb0/blank
[ 431.148583] panel-himax-hx8394 ff960000.dsi.0: disable [ 431.169259] dw-mipi-dsi-rockchip ff960000.dsi: failed to write command FIFO [ 431.169268] panel-himax-hx8394 ff960000.dsi.0: Failed to enter sleep mode: -110 [ 431.169282] dw-mipi-dsi-rockchip ff960000.dsi: post_disable [ 431.169316] panel-himax-hx8394 ff960000.dsi.0: unprepare [ 431.169357] pclk_mipi_dsi0 already disabled
echo 0 > /sys/class/graphics/fb0/blank
[ 432.796851] panel-himax-hx8394 ff960000.dsi.0: prepare [ 432.981537] dw-mipi-dsi-rockchip ff960000.dsi: enable [ 432.981568] panel-himax-hx8394 ff960000.dsi.0: enable [ 433.002290] dw-mipi-dsi-rockchip ff960000.dsi: failed to write command FIFO [ 433.002299] panel-himax-hx8394 ff960000.dsi.0: sending command 0xb9 failed: -110 [ 433.002312] panel-himax-hx8394 ff960000.dsi.0: Panel init sequence failed: -110
-----------------------------------------------------------------------
After:
[ 1.248372] dw-mipi-dsi-rockchip ff960000.dsi: mode_set [ 1.248704] dw-mipi-dsi-rockchip ff960000.dsi: pre_enable [ 1.285377] panel-himax-hx8394 ff960000.dsi.0: prepare [ 1.468392] dw-mipi-dsi-rockchip ff960000.dsi: enable [ 1.468421] panel-himax-hx8394 ff960000.dsi.0: enable
echo 2 > /sys/class/graphics/fb0/blank
[ 16.210357] panel-himax-hx8394 ff960000.dsi.0: disable [ 16.261315] dw-mipi-dsi-rockchip ff960000.dsi: post_disable [ 16.261339] panel-himax-hx8394 ff960000.dsi.0: unprepare
echo 0 > /sys/class/graphics/fb0/blank
[ 19.161453] dw-mipi-dsi-rockchip ff960000.dsi: pre_enable [ 19.197869] panel-himax-hx8394 ff960000.dsi.0: prepare [ 19.382141] dw-mipi-dsi-rockchip ff960000.dsi: enable [ 19.382158] panel-himax-hx8394 ff960000.dsi.0: enable
(But depends on functionality intorduced in Linux 6.3, so this patch will
not build on older kernels when applied to older stable branches.)
--- drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-)
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +16 -12
@@ -265,6 +265,7 @@ struct dw_mipi_dsi {struct dw_mipi_dsi *master;/* dual-dsi master ptr */ struct dw_mipi_dsi *slave;/* dual-dsi slave ptr */ +struct drm_display_mode mode;const struct dw_mipi_dsi_plat_data *plat_data; };
@@ -332,6 +333,7 @@ static int dw_mipi_dsi_host_attach(struct mipi_dsi_host *host,if (IS_ERR (bridge))return PTR_ERR (bridge); + bridge->pre_enable_prev_first = true; dsi->panel_bridge = bridge;drm_bridge_add (&dsi->bridge);
@@ -859,15 +861,6 @@ static void dw_mipi_dsi_bridge_post_atomic_disable(struct drm_bridge *bridge,*/ dw_mipi_dsi_set_mode (dsi,0 ); -/* -* TODO Only way found to call panel-bridge post_disable & -* panel unprepare before the dsi "final" disable... -* This needs to be fixed in the drm_bridge framework and the API -* needs to be updated to manage our own call chains... -*/ -if (dsi->panel_bridge->funcs->post_disable) - dsi->panel_bridge->funcs->post_disable (dsi->panel_bridge); -if (phy_ops->power_off) phy_ops->power_off (dsi->plat_data->priv_data);
@@ -942,15 +935,25 @@ static void dw_mipi_dsi_mode_set(struct dw_mipi_dsi *dsi, phy_ops->power_on (dsi->plat_data->priv_data); } +static void dw_mipi_dsi_bridge_atomic_pre_enable (struct drm_bridge *bridge, +struct drm_bridge_state *old_bridge_state) +{ +struct dw_mipi_dsi *dsi =bridge_to_dsi (bridge); + +/* Power up the dsi ctl into a command mode */ +dw_mipi_dsi_mode_set (dsi, &dsi->mode); +if (dsi->slave) +dw_mipi_dsi_mode_set (dsi->slave, &dsi->mode); +} +static void dw_mipi_dsi_bridge_mode_set (struct drm_bridge *bridge,const struct drm_display_mode *mode,const struct drm_display_mode *adjusted_mode) {struct dw_mipi_dsi *dsi =bridge_to_dsi (bridge); -dw_mipi_dsi_mode_set (dsi, adjusted_mode); -if (dsi->slave) -dw_mipi_dsi_mode_set (dsi->slave, adjusted_mode); +/* Store the display mode for later use in pre_enable callback */ +drm_mode_copy (&dsi->mode, adjusted_mode); } static void dw_mipi_dsi_bridge_atomic_enable(struct drm_bridge *bridge,
@@ -1004,6 +1007,7 @@ static const struct drm_bridge_funcs dw_mipi_dsi_bridge_funcs = { .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state, .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state, .atomic_reset = drm_atomic_helper_bridge_reset, + .atomic_pre_enable = dw_mipi_dsi_bridge_atomic_pre_enable, .atomic_enable = dw_mipi_dsi_bridge_atomic_enable, .atomic_post_disable = dw_mipi_dsi_bridge_post_atomic_disable, .mode_set = dw_mipi_dsi_bridge_mode_set,
Signature · 1 line
2.40.1
Re: [PATCH 6.1 213/600] drm: bridge: dw-mipi-dsi: Fix enable/disable of DSI controller
Quoted 2 lines · Greg Kroah-Hartman
6.1-stable review patch. If anyone has any objections, please let me know.
See patch message comment:
(But depends on functionality intorduced in Linux 6.3, so this patch will
not build on older kernels when applied to older stable branches.)
kind regards,
o.
Quoted 191 lines
------------------
From: Ondrej Jirman <[email protected]>
[ Upstream commit
05aa61334592adb230749ff465b103ee10e63936]Before this patch, booting to Linux VT and doing a simple:
echo 2 >
/sys/class/graphics/fb0/blank
echo 0 >/sys/class/graphics/fb0/blankwould result in failures to re-enable the panel. Mode set callback is called only once during boot in this scenario, while calls to enable/disable callbacks are balanced afterwards. The driver doesn't work unless userspace calls modeset before enabling the CRTC/connector.
This patch moves enabling of the DSI host from
mode_setintopre_enablecallback, and removes some old hacks where this bridge driver is directly calling into other bridge driver's callbacks.
pre_enable_prev_firstflag is set on the panel's bridge so that panel drivers will get their prepare function called between DSI host'spre_enableand enable callbacks, so that they get a chance to perform panel setup while DSI host is already enabled in command mode. Otherwise panel's prepare would be called before DSI host is enabled, and any DSI communication used in prepare callback would fail.With all these changes, the enable/disable sequence is now well balanced, and host's and panel's callbacks are called in proper order documented in the
drm_panelAPI documentation without needing the old hacks. (Mainly thatpanel->prepareis called when DSI host is ready to allow the panel driver to send DSI commands and vice versa during disable.)Tested on Pinephone Pro. Trace of the callbacks follows.
Before:
[ 1.253882] dw-mipi-dsi-rockchip ff960000.dsi: mode_set [ 1.290732] panel-himax-hx8394 ff960000.dsi.0: prepare [ 1.475576] dw-mipi-dsi-rockchip ff960000.dsi: enable [ 1.475593] panel-himax-hx8394 ff960000.dsi.0: enableecho 2 >
/sys/class/graphics/fb0/blank[ 13.722799] panel-himax-hx8394 ff960000.dsi.0: disable [ 13.774502] dw-mipi-dsi-rockchip ff960000.dsi: post_disable [ 13.774526] panel-himax-hx8394 ff960000.dsi.0: unprepareecho 0 >
/sys/class/graphics/fb0/blank[ 17.735796] panel-himax-hx8394 ff960000.dsi.0: prepare [ 17.923522] dw-mipi-dsi-rockchip ff960000.dsi: enable [ 17.923540] panel-himax-hx8394 ff960000.dsi.0: enable [ 17.944330] dw-mipi-dsi-rockchip ff960000.dsi: failed to write command FIFO [ 17.944335] panel-himax-hx8394 ff960000.dsi.0: sending command 0xb9 failed: -110 [ 17.944340] panel-himax-hx8394 ff960000.dsi.0: Panel init sequence failed: -110echo 2 >
/sys/class/graphics/fb0/blank[ 431.148583] panel-himax-hx8394 ff960000.dsi.0: disable [ 431.169259] dw-mipi-dsi-rockchip ff960000.dsi: failed to write command FIFO [ 431.169268] panel-himax-hx8394 ff960000.dsi.0: Failed to enter sleep mode: -110 [ 431.169282] dw-mipi-dsi-rockchip ff960000.dsi: post_disable [ 431.169316] panel-himax-hx8394 ff960000.dsi.0: unprepare [ 431.169357] pclk_mipi_dsi0 already disabledecho 0 >
/sys/class/graphics/fb0/blank[ 432.796851] panel-himax-hx8394 ff960000.dsi.0: prepare [ 432.981537] dw-mipi-dsi-rockchip ff960000.dsi: enable [ 432.981568] panel-himax-hx8394 ff960000.dsi.0: enable [ 433.002290] dw-mipi-dsi-rockchip ff960000.dsi: failed to write command FIFO [ 433.002299] panel-himax-hx8394 ff960000.dsi.0: sending command 0xb9 failed: -110 [ 433.002312] panel-himax-hx8394 ff960000.dsi.0: Panel init sequence failed: -110-----------------------------------------------------------------------
After:
[ 1.248372] dw-mipi-dsi-rockchip ff960000.dsi: mode_set [ 1.248704] dw-mipi-dsi-rockchip ff960000.dsi: pre_enable [ 1.285377] panel-himax-hx8394 ff960000.dsi.0: prepare [ 1.468392] dw-mipi-dsi-rockchip ff960000.dsi: enable [ 1.468421] panel-himax-hx8394 ff960000.dsi.0: enableecho 2 >
/sys/class/graphics/fb0/blank[ 16.210357] panel-himax-hx8394 ff960000.dsi.0: disable [ 16.261315] dw-mipi-dsi-rockchip ff960000.dsi: post_disable [ 16.261339] panel-himax-hx8394 ff960000.dsi.0: unprepareecho 0 >
/sys/class/graphics/fb0/blank[ 19.161453] dw-mipi-dsi-rockchip ff960000.dsi: pre_enable [ 19.197869] panel-himax-hx8394 ff960000.dsi.0: prepare [ 19.382141] dw-mipi-dsi-rockchip ff960000.dsi: enable [ 19.382158] panel-himax-hx8394 ff960000.dsi.0: enable(But depends on functionality intorduced in Linux 6.3, so this patch will
not build on older kernels when applied to older stable branches.)Fixes 46fc51546d44 ("drm/bridge/synopsys: Add MIPI DSI host controller bridge")Signed-off-by Ondrej Jirman <[email protected]>Reviewed-by Sam Ravnborg <[email protected]>Signed-off-by Robert Foss <[email protected]>Signed-off-by Sasha Levin <[email protected]>--- drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-)drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +16
-12@@ -265,6 +265,7 @@ struct dw_mipi_dsi {struct dw_mipi_dsi *master;/* dual-dsi master ptr */ struct dw_mipi_dsi *slave;/* dual-dsi slave ptr */ +struct drm_display_mode mode;const struct dw_mipi_dsi_plat_data *plat_data; };@@ -332,6 +333,7 @@ static int dw_mipi_dsi_host_attach(struct mipi_dsi_host *host,if (IS_ERR (bridge))return PTR_ERR (bridge); + bridge->pre_enable_prev_first = true; dsi->panel_bridge = bridge;drm_bridge_add (&dsi->bridge);@@ -859,15 +861,6 @@ static void dw_mipi_dsi_bridge_post_atomic_disable(struct drm_bridge *bridge,*/ dw_mipi_dsi_set_mode (dsi,0 ); -/* -* TODO Only way found to call panel-bridge post_disable & -* panel unprepare before the dsi "final" disable... -* This needs to be fixed in the drm_bridge framework and the API -* needs to be updated to manage our own call chains... -*/ -if (dsi->panel_bridge->funcs->post_disable) - dsi->panel_bridge->funcs->post_disable (dsi->panel_bridge); -if (phy_ops->power_off) phy_ops->power_off (dsi->plat_data->priv_data);@@ -942,15 +935,25 @@ static void dw_mipi_dsi_mode_set(struct dw_mipi_dsi *dsi, phy_ops->power_on (dsi->plat_data->priv_data); } +static void dw_mipi_dsi_bridge_atomic_pre_enable (struct drm_bridge *bridge, +struct drm_bridge_state *old_bridge_state) +{ +struct dw_mipi_dsi *dsi =bridge_to_dsi (bridge); + +/* Power up the dsi ctl into a command mode */ +dw_mipi_dsi_mode_set (dsi, &dsi->mode); +if (dsi->slave) +dw_mipi_dsi_mode_set (dsi->slave, &dsi->mode); +} +static void dw_mipi_dsi_bridge_mode_set (struct drm_bridge *bridge,const struct drm_display_mode *mode,const struct drm_display_mode *adjusted_mode) {struct dw_mipi_dsi *dsi =bridge_to_dsi (bridge); -dw_mipi_dsi_mode_set (dsi, adjusted_mode); -if (dsi->slave) -dw_mipi_dsi_mode_set (dsi->slave, adjusted_mode); +/* Store the display mode for later use in pre_enable callback */ +drm_mode_copy (&dsi->mode, adjusted_mode); } static void dw_mipi_dsi_bridge_atomic_enable(struct drm_bridge *bridge,@@ -1004,6 +1007,7 @@ static const struct drm_bridge_funcs dw_mipi_dsi_bridge_funcs = { .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state, .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state, .atomic_reset = drm_atomic_helper_bridge_reset, + .atomic_pre_enable = dw_mipi_dsi_bridge_atomic_pre_enable, .atomic_enable = dw_mipi_dsi_bridge_atomic_enable, .atomic_post_disable = dw_mipi_dsi_bridge_post_atomic_disable, .mode_set = dw_mipi_dsi_bridge_mode_set,Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerRe: [PATCH 6.1 213/600] drm: bridge: dw-mipi-dsi: Fix enable/disable of DSI controller
Quoted 8 lines · Ondřej Jirman
Quoted 2 lines · Greg Kroah-Hartman
6.1-stable review patch. If anyone has any objections, please let me know.
See patch message comment:
(But depends on functionality intorduced in Linux 6.3, so this patch will
not build on older kernels when applied to older stable branches.)
Ah, missed that, thanks, now dropped.
greg k-h
Greg Kroah-Hartman
maintainerPATCH 214/600 quota: factor out dquot_write_dquot()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Baokun Li <[email protected]>
[ Upstream commit 024128477809f8073d870307c8157b8826ebfd08 ]
Refactor out dquot_write_dquot() to reduce duplicate code.
Message-Id: <[email protected]>
Stable-dep-of: dabc8b207566 ("quota: fix dqput() to follow the guarantees dquot_srcu should provide")
--- fs/quota/dquot.c | 39 ++++++++++++++++----------------------- 1 file changed, 16 insertions(+), 23 deletions(-)
fs/quota/dquot.c +16 -23
@@ -628,6 +628,18 @@ int dquot_scan_active(struct super_block *sb, }EXPORT_SYMBOL (dquot_scan_active); +static inline int dquot_write_dquot (struct dquot *dquot) +{ +int ret = dquot->dq_sb->dq_op->write_dquot (dquot); +if (ret <0 ) { +quota_error (dquot->dq_sb,"Can't write quota structure " +"(error %d). Quota may get out of sync!" , ret); +/* Clear dirty bit anyway to avoid infinite loop. */ +clear_dquot_dirty (dquot); + } +return ret; +} +/* Write all dquot structures to quota files */ int dquot_writeback_dquots (struct super_block *sb,int type) {
@@ -658,16 +670,9 @@ int dquot_writeback_dquots(struct super_block *sb, int type)* use count */ dqgrab (dquot);spin_unlock (&dq_list_lock); - err = sb->dq_op->write_dquot (dquot); -if (err) { -/* -* Clear dirty bit anyway to avoid infinite -* loop here. -*/ -clear_dquot_dirty (dquot); -if (!ret) - ret = err; - } + err =dquot_write_dquot (dquot); +if (err && !ret) + ret = err;dqput (dquot);spin_lock (&dq_list_lock); }
@@ -765,8 +770,6 @@ static struct shrinker dqcache_shrinker = {*/ void dqput (struct dquot *dquot) { -int ret; -if (!dquot)return ;#ifdef CONFIG_QUOTA_DEBUG
@@ -794,17 +797,7 @@ void dqput(struct dquot *dquot)if (dquot_dirty (dquot)) {spin_unlock (&dq_list_lock);/* Commit dquot before releasing */ - ret = dquot->dq_sb->dq_op->write_dquot (dquot); -if (ret <0 ) { -quota_error (dquot->dq_sb,"Can't write quota structure" -" (error %d). Quota may get out of sync!" , - ret); -/* -* We clear dirty bit anyway, so that we avoid -* infinite loop here -*/ -clear_dquot_dirty (dquot); - } +dquot_write_dquot (dquot); goto we_slept; }if (test_bit (DQ_ACTIVE_B , &dquot->dq_flags)) {
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 215/600 quota: rename dquot_active() to inode_quota_active()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Baokun Li <[email protected]>
[ Upstream commit 4b9bdfa16535de8f49bf954aeed0f525ee2fc322 ]
Now we have a helper function dquot_dirty() to determine if dquot has DQ_MOD_B bit. dquot_active() can easily be misunderstood as a helper function to determine if dquot has DQ_ACTIVE_B bit. So we avoid this by renaming it to inode_quota_active() and later on we will add the helper function dquot_active() to determine if dquot has DQ_ACTIVE_B bit.
Message-Id: <[email protected]>
Stable-dep-of: dabc8b207566 ("quota: fix dqput() to follow the guarantees dquot_srcu should provide")
--- fs/quota/dquot.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
fs/quota/dquot.c +10 -10
@@ -1418,7 +1418,7 @@ static int info_bdq_free(struct dquot *dquot, qsize_t space)return QUOTA_NL_NOWARN ; } -static int dquot_active (const struct inode *inode) +static int inode_quota_active (const struct inode *inode) {struct super_block *sb = inode->i_sb;
@@ -1441,7 +1441,7 @@ static int __dquot_initialize(struct inode *inode, int type)qsize_t rsv;int ret =0 ; -if (!dquot_active (inode)) +if (!inode_quota_active (inode))return 0 ; dquots =i_dquot (inode);
@@ -1549,7 +1549,7 @@ bool dquot_initialize_needed(struct inode *inode)struct dquot **dquots;int i; -if (!dquot_active (inode)) +if (!inode_quota_active (inode))return false; dquots =i_dquot (inode);
@@ -1660,7 +1660,7 @@ int __dquot_alloc_space(struct inode *inode, qsize_t number, int flags)int reserve = flags &DQUOT_SPACE_RESERVE ;struct dquot **dquots; -if (!dquot_active (inode)) { +if (!inode_quota_active (inode)) {if (reserve) {spin_lock (&inode->i_lock); *inode_reserved_space (inode) += number;
@@ -1730,7 +1730,7 @@ int dquot_alloc_inode(struct inode *inode)struct dquot_warn warn[MAXQUOTAS ];struct dquot *const *dquots; -if (!dquot_active (inode)) +if (!inode_quota_active (inode))return 0 ;for (cnt =0 ; cnt <MAXQUOTAS ; cnt++) warn[cnt].w_type =QUOTA_NL_NOWARN ;
@@ -1773,7 +1773,7 @@ int dquot_claim_space_nodirty(struct inode *inode, qsize_t number)struct dquot **dquots;int cnt, index; -if (!dquot_active (inode)) { +if (!inode_quota_active (inode)) {spin_lock (&inode->i_lock); *inode_reserved_space (inode) -= number;__inode_add_bytes (inode, number);
@@ -1815,7 +1815,7 @@ void dquot_reclaim_space_nodirty(struct inode *inode, qsize_t number)struct dquot **dquots;int cnt, index; -if (!dquot_active (inode)) { +if (!inode_quota_active (inode)) {spin_lock (&inode->i_lock); *inode_reserved_space (inode) += number;__inode_sub_bytes (inode, number);
@@ -1859,7 +1859,7 @@ void __dquot_free_space(struct inode *inode, qsize_t number, int flags)struct dquot **dquots;int reserve = flags &DQUOT_SPACE_RESERVE , index; -if (!dquot_active (inode)) { +if (!inode_quota_active (inode)) {if (reserve) {spin_lock (&inode->i_lock); *inode_reserved_space (inode) -= number;
@@ -1914,7 +1914,7 @@ void dquot_free_inode(struct inode *inode)struct dquot *const *dquots;int index; -if (!dquot_active (inode)) +if (!inode_quota_active (inode))return ; dquots =i_dquot (inode);
@@ -2086,7 +2086,7 @@ int dquot_transfer(struct user_namespace *mnt_userns, struct inode *inode,struct super_block *sb = inode->i_sb;int ret; -if (!dquot_active (inode)) +if (!inode_quota_active (inode))return 0 ;if (i_uid_needs_update (mnt_userns, iattr, inode)) {
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 216/600 quota: add new helper dquot_active()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Baokun Li <[email protected]>
[ Upstream commit 33bcfafc48cb186bc4bbcea247feaa396594229e ]
Add new helper function dquot_active() to make the code more concise.
Message-Id: <[email protected]>
Stable-dep-of: dabc8b207566 ("quota: fix dqput() to follow the guarantees dquot_srcu should provide")
--- fs/quota/dquot.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-)
fs/quota/dquot.c +14 -9
@@ -336,6 +336,11 @@ static void wait_on_dquot(struct dquot *dquot)mutex_unlock (&dquot->dq_lock); } +static inline int dquot_active (struct dquot *dquot) +{ +return test_bit (DQ_ACTIVE_B , &dquot->dq_flags); +} +static inline int dquot_dirty (struct dquot *dquot) {return test_bit (DQ_MOD_B , &dquot->dq_flags);
@@ -351,14 +356,14 @@ int dquot_mark_dquot_dirty(struct dquot *dquot) {int ret =1 ; -if (!test_bit (DQ_ACTIVE_B , &dquot->dq_flags)) +if (!dquot_active (dquot))return 0 ;if (sb_dqopt (dquot->dq_sb)->flags &DQUOT_NOLIST_DIRTY )return test_and_set_bit (DQ_MOD_B , &dquot->dq_flags);/* If quota is dirty already, we don't have to acquire dq_list_lock */ -if (test_bit (DQ_MOD_B , &dquot->dq_flags)) +if (dquot_dirty (dquot))return 1 ;spin_lock (&dq_list_lock);
@@ -440,7 +445,7 @@ int dquot_acquire(struct dquot *dquot)smp_mb__before_atomic ();set_bit (DQ_READ_B , &dquot->dq_flags);/* Instantiate dquot if needed */ -if (!test_bit (DQ_ACTIVE_B , &dquot->dq_flags) && !dquot->dq_off) { +if (!dquot_active (dquot) && !dquot->dq_off) { ret = dqopt->ops[dquot->dq_id.type]->commit_dqblk (dquot);/* Write the info if needed */ if (info_dirty (&dqopt->info[dquot->dq_id.type])) {
@@ -482,7 +487,7 @@ int dquot_commit(struct dquot *dquot) goto out_lock;/* Inactive dquot can be only if there was error during read/init * => we have better not writing it */ -if (test_bit (DQ_ACTIVE_B , &dquot->dq_flags)) +if (dquot_active (dquot)) ret = dqopt->ops[dquot->dq_id.type]->commit_dqblk (dquot);else ret = -EIO ;
@@ -597,7 +602,7 @@ int dquot_scan_active(struct super_block *sb,spin_lock (&dq_list_lock);list_for_each_entry (dquot, &inuse_list, dq_inuse) { -if (!test_bit (DQ_ACTIVE_B , &dquot->dq_flags)) +if (!dquot_active (dquot))continue ;if (dquot->dq_sb != sb)continue ;
@@ -612,7 +617,7 @@ int dquot_scan_active(struct super_block *sb,* outstanding call and recheck the DQ_ACTIVE_B after that. */ wait_on_dquot (dquot); -if (test_bit (DQ_ACTIVE_B , &dquot->dq_flags)) { +if (dquot_active (dquot)) { ret =fn (dquot, priv);if (ret <0 ) goto out;
@@ -663,7 +668,7 @@ int dquot_writeback_dquots(struct super_block *sb, int type) dquot = list_first_entry(&dirty, struct dquot, dq_dirty); -WARN_ON (!test_bit (DQ_ACTIVE_B , &dquot->dq_flags)); +WARN_ON (!dquot_active (dquot));/* Now we have active dquot from which someone is * holding reference so we can safely just increase
@@ -800,7 +805,7 @@ void dqput(struct dquot *dquot)dquot_write_dquot (dquot); goto we_slept; } -if (test_bit (DQ_ACTIVE_B , &dquot->dq_flags)) { +if (dquot_active (dquot)) {spin_unlock (&dq_list_lock); dquot->dq_sb->dq_op->release_dquot (dquot); goto we_slept;
@@ -901,7 +906,7 @@ struct dquot *dqget(struct super_block *sb, struct kqid qid)* already finished or it will be canceled due to dq_count > 1 test */ wait_on_dquot (dquot);/* Read the dquot / allocate space in quota file */ -if (!test_bit (DQ_ACTIVE_B , &dquot->dq_flags)) { +if (!dquot_active (dquot)) {int err; err = sb->dq_op->acquire_dquot (dquot);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 217/600 quota: fix dqput() to follow the guarantees dquot_srcu should provide
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Baokun Li <[email protected]>
[ Upstream commit dabc8b20756601b9e1cc85a81d47d3f98ed4d13a ]
The dquot_mark_dquot_dirty() using dquot references from the inode should be protected by dquot_srcu. quota_off code takes care to call synchronize_srcu(&dquot_srcu) to not drop dquot references while they are used by other users. But dquot_transfer() breaks this assumption. We call dquot_transfer() to drop the last reference of dquot and add it to free_dquots, but there may still be other users using the dquot at this time, as shown in the function graph below:
cpu1 cpu2
_________________|_________________wb_do_writeback CHOWN(1)
...
ext4_da_update_reserve_space
dquot_claim_block
...
dquot_mark_dquot_dirty // try to dirty old quota
test_bit(DQ_ACTIVE_B, &dquot->dq_flags) // still ACTIVE
if (test_bit(DQ_MOD_B, &dquot->dq_flags))
// test no dirty, wait dq_list_lock
...
dquot_transfer
__dquot_transfer
dqput_all(transfer_from) // rls old dquot
dqput // last dqput
dquot_release
clear_bit(DQ_ACTIVE_B, &dquot->dq_flags)
atomic_dec(&dquot->dq_count)
put_dquot_last(dquot)
list_add_tail(&dquot->dq_free, &free_dquots)
// add the dquot to free_dquots
if (!test_and_set_bit(DQ_MOD_B, &dquot->dq_flags))
add dqi_dirty_list // add released dquot to dirty_listThis can cause various issues, such as dquot being destroyed by dqcache_shrink_scan() after being added to free_dquots, which can trigger a UAF in dquot_mark_dquot_dirty(); or after dquot is added to free_dquots and then to dirty_list, it is added to free_dquots again after dquot_writeback_dquots() is executed, which causes the free_dquots list to be corrupted and triggers a UAF when dqcache_shrink_scan() is called for freeing dquot twice.
As Honza said, we need to fix dquot_transfer() to follow the guarantees dquot_srcu should provide. But calling synchronize_srcu() directly from dquot_transfer() is too expensive (and mostly unnecessary). So we add dquot whose last reference should be dropped to the new global dquot list releasing_dquots, and then queue work item which would call synchronize_srcu() and after that perform the final cleanup of all the dquots on releasing_dquots.
Message-Id: <[email protected]>
--- fs/quota/dquot.c | 96 +++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 78 insertions(+), 18 deletions(-)
fs/quota/dquot.c +78 -18
@@ -225,13 +225,22 @@ static void put_quota_format(struct quota_format_type *fmt)/* * Dquot List Management: -* The quota code uses four lists for dquot management: the inuse_list, -* free_dquots, dqi_dirty_list, and dquot_hash[] array. A single dquot -* structure may be on some of those lists, depending on its current state. +* The quota code uses five lists for dquot management: the inuse_list, +* releasing_dquots, free_dquots, dqi_dirty_list, and dquot_hash[] array. +* A single dquot structure may be on some of those lists, depending on +* its current state. * * All dquots are placed to the end of inuse_list when first created, and this * list is used for invalidate operation, which must look at every dquot. * +* When the last reference of a dquot will be dropped, the dquot will be +* added to releasing_dquots. We'd then queue work item which would call +* synchronize_srcu() and after that perform the final cleanup of all the +* dquots on the list. Both releasing_dquots and free_dquots use the +* dq_free list_head in the dquot struct. When a dquot is removed from +* releasing_dquots, a reference count is always subtracted, and if +* dq_count == 0 at that point, the dquot will be added to the free_dquots. +* * Unused dquots (dq_count == 0) are added to the free_dquots list when freed, * and this list is searched whenever we need an available dquot. Dquots are * removed from the list as soon as they are used again, and
@@ -250,6 +259,7 @@ static void put_quota_format(struct quota_format_type *fmt)static LIST_HEAD (inuse_list);static LIST_HEAD (free_dquots); +static LIST_HEAD (releasing_dquots);static unsigned int dq_hash_bits, dq_hash_mask;static struct hlist_head *dquot_hash;
@@ -260,6 +270,9 @@ static qsize_t inode_get_rsv_space(struct inode *inode);static qsize_t __inode_get_rsv_space (struct inode *inode);static int __dquot_initialize (struct inode *inode,int type); +static void quota_release_workfn (struct work_struct *work); +static DECLARE_DELAYED_WORK(quota_release_work, quota_release_workfn); +static inline unsigned int hashfn (const struct super_block *sb,struct kqid qid) {
@@ -305,12 +318,18 @@ static inline void put_dquot_last(struct dquot *dquot)dqstats_inc (DQST_FREE_DQUOTS ); } +static inline void put_releasing_dquots (struct dquot *dquot) +{ +list_add_tail (&dquot->dq_free, &releasing_dquots); +} +static inline void remove_free_dquot (struct dquot *dquot) {if (list_empty (&dquot->dq_free))return ;list_del_init (&dquot->dq_free); -dqstats_dec (DQST_FREE_DQUOTS ); +if (!atomic_read (&dquot->dq_count)) +dqstats_dec (DQST_FREE_DQUOTS ); }static inline void put_inuse (struct dquot *dquot)
@@ -552,6 +571,8 @@ static void invalidate_dquots(struct super_block *sb, int type)struct dquot *dquot, *tmp; restart: +flush_delayed_work ("a_release_work); +spin_lock (&dq_list_lock);list_for_each_entry_safe (dquot, tmp, &inuse_list, dq_inuse) {if (dquot->dq_sb != sb)
@@ -560,6 +581,12 @@ static void invalidate_dquots(struct super_block *sb, int type)continue ;/* Wait for dquot users */ if (atomic_read (&dquot->dq_count)) { +/* dquot in releasing_dquots, flush and retry */ +if (!list_empty (&dquot->dq_free)) { +spin_unlock (&dq_list_lock); + goto restart; + } +atomic_inc (&dquot->dq_count);spin_unlock (&dq_list_lock);/*
@@ -770,6 +797,49 @@ static struct shrinker dqcache_shrinker = { .seeks = DEFAULT_SEEKS, }; +/* +* Safely release dquot and put reference to dquot. +*/ +static void quota_release_workfn (struct work_struct *work) +{ +struct dquot *dquot; +struct list_head rls_head; + +spin_lock (&dq_list_lock); +/* Exchange the list head to avoid livelock. */ +list_replace_init (&releasing_dquots, &rls_head); +spin_unlock (&dq_list_lock); + +restart: +synchronize_srcu (&dquot_srcu); +spin_lock (&dq_list_lock); +while (!list_empty (&rls_head)) { + dquot = list_first_entry(&rls_head, struct dquot, dq_free); +/* Dquot got used again? */ +if (atomic_read (&dquot->dq_count) >1 ) { +remove_free_dquot (dquot); +atomic_dec (&dquot->dq_count); +continue ; + } +if (dquot_dirty (dquot)) { +spin_unlock (&dq_list_lock); +/* Commit dquot before releasing */ +dquot_write_dquot (dquot); + goto restart; + } +if (dquot_active (dquot)) { +spin_unlock (&dq_list_lock); + dquot->dq_sb->dq_op->release_dquot (dquot); + goto restart; + } +/* Dquot is inactive and clean, now move it to free list */ +remove_free_dquot (dquot); +atomic_dec (&dquot->dq_count); +put_dquot_last (dquot); + } +spin_unlock (&dq_list_lock); +} +/* * Put reference to dquot */
@@ -786,7 +856,7 @@ void dqput(struct dquot *dquot) }#endif dqstats_inc (DQST_DROPS ); -we_slept: +spin_lock (&dq_list_lock);if (atomic_read (&dquot->dq_count) >1 ) {/* We have more than one user... nothing to do */
@@ -798,25 +868,15 @@ void dqput(struct dquot *dquot)spin_unlock (&dq_list_lock);return ; } +/* Need to release dquot? */ -if (dquot_dirty (dquot)) { -spin_unlock (&dq_list_lock); -/* Commit dquot before releasing */ -dquot_write_dquot (dquot); - goto we_slept; - } -if (dquot_active (dquot)) { -spin_unlock (&dq_list_lock); - dquot->dq_sb->dq_op->release_dquot (dquot); - goto we_slept; - } -atomic_dec (&dquot->dq_count);#ifdef CONFIG_QUOTA_DEBUG /* sanity check */ BUG_ON (!list_empty (&dquot->dq_free));#endif -put_dquot_last (dquot); +put_releasing_dquots (dquot);spin_unlock (&dq_list_lock); +queue_delayed_work (system_unbound_wq, "a_release_work,1 ); }EXPORT_SYMBOL (dqput);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 218/600 drm/amd/display: Do not set drr on pipe commit
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wesley Chalmers <[email protected]>
[ Upstream commit e101bf95ea87ccc03ac2f48dfc0757c6364ff3c7 ]
[WHY]
Writing to DRR registers such as OTG_V_TOTAL_MIN on the same frame as a pipe commit can cause underflow.
[HOW]
Move DMUB p-state delegate into optimze_bandwidth; enabling FAMS sets optimized_required.
This change expects that Freesync requests are blocked when optimized_required is true.
--- drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c | 6 ++++++ drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c | 7 +++++++ 2 files changed, 13 insertions(+)
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c +6 -0
@@ -2032,6 +2032,12 @@ void dcn20_optimize_bandwidth(if (hubbub->funcs->program_compbuf_size) hubbub->funcs->program_compbuf_size (hubbub, context->bw_ctx.bw.dcn.compbuf_size_kb, true); +if (context->bw_ctx.bw.dcn.clk.fw_based_mclk_switching) { +dc_dmub_srv_p_state_delegate (dc, + true, context); + context->bw_ctx.bw.dcn.clk.p_state_change_support = true; + } + dc->clk_mgr->funcs->update_clocks( dc->clk_mgr, context,
drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c +7 -0
@@ -987,11 +987,18 @@ void dcn30_set_disp_pattern_generator(const struct dc *dc,void dcn30_prepare_bandwidth (struct dc *dc,struct dc_state *context) { +if (context->bw_ctx.bw.dcn.clk.fw_based_mclk_switching) { + dc->optimized_required = true; + context->bw_ctx.bw.dcn.clk.p_state_change_support = false; + } +if (dc->clk_mgr->dc_mode_softmax_enabled)if (dc->clk_mgr->clks.dramclk_khz <= dc->clk_mgr->bw_params->dc_mode_softmax_memclk *1000 && context->bw_ctx.bw.dcn.clk.dramclk_khz > dc->clk_mgr->bw_params->dc_mode_softmax_memclk *1000 ) dc->clk_mgr->funcs->set_max_memclk (dc->clk_mgr, dc->clk_mgr->bw_params->clk_table.entries[dc->clk_mgr->bw_params->clk_table.num_entries -1 ].memclk_mhz);dcn20_prepare_bandwidth (dc, context); + +dc_dmub_srv_p_state_delegate (dc, false, context); }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 219/600 drm/hyperv: Fix a compilation issue because of not including screen_info.h
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sui Jingfeng <[email protected]>
[ Upstream commit 8d1077cf2e43b15fefd76ebec2b71541eb27ef2c ]
Fixes the following build errors on arm64:
drivers/video/fbdev/hyperv_fb.c: In function 'hvfb_getmem':
Quoted 1 line
Quoted 1 line
drivers/video/fbdev/hyperv_fb.c:1033:24: error: 'screen_info' undeclared (first use in this function)
1033 | base = screen_info.lfb_base;
| ^~~~~~~~~~~drivers/video/fbdev/hyperv_fb.c:1033:24: note: each undeclared identifier is reported only once for each function it appears in
Quoted 1 line
Quoted 1 line
drivers/gpu/drm/hyperv/hyperv_drm_drv.c:75:54: error: 'screen_info' undeclared (first use in this function)
75 | drm_aperture_remove_conflicting_framebuffers(screen_info.lfb_base,
| ^~~~~~~~~~~drivers/gpu/drm/hyperv/hyperv_drm_drv.c:75:54: note: each undeclared identifier is reported only once for each function it appears in
--- drivers/gpu/drm/hyperv/hyperv_drm_drv.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/hyperv/hyperv_drm_drv.c +1 -0
@@ -7,6 +7,7 @@#include <linux/hyperv.h> #include <linux/module.h> #include <linux/pci.h> +#include <linux/screen_info.h> #include <drm/drm_aperture.h> #include <drm/drm_atomic_helper.h>
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 220/600 ASoC: stac9766: fix build errors with REGMAP_AC97
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Randy Dunlap <[email protected]>
[ Upstream commit c70064b96f509daa78f57992aeabcf274fb2fed4 ]
Select REGMAP_AC97 to fix these build errors:
ERROR: modpost: "regmap_ac97_default_volatile" [sound/soc/codecs/snd-soc-stac9766.ko] undefined!
ERROR: modpost: "__regmap_init_ac97" [sound/soc/codecs/snd-soc-stac9766.ko] undefined!
--- sound/soc/codecs/Kconfig | 1 + 1 file changed, 1 insertion(+)
sound/soc/codecs/Kconfig +1 -0
@@ -1552,6 +1552,7 @@ config SND_SOC_STA529 config SND_SOC_STAC9766 tristate depends on SND_SOC_AC97_BUS + select REGMAP_AC97 config SND_SOC_STI_SAS tristate "codec Audio support for STI SAS codec"
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 221/600 soc: qcom: ocmem: Add OCMEM hardware version print
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luca Weiss <[email protected]>
[ Upstream commit e81a16e77259294cd4ff0a9c1fbe5aa0e311a47d ]
It might be useful to know what hardware version of the OCMEM block the SoC contains. Add a debug print for that.
Stable-dep-of: a7b484b1c933 ("soc: qcom: ocmem: Fix NUM_PORTS & NUM_MACROS macros")
--- drivers/soc/qcom/ocmem.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/soc/qcom/ocmem.c +10 -0
@@ -76,6 +76,10 @@ struct ocmem {#define OCMEM_REG_GFX_MPU_START 0x00001004#define OCMEM_REG_GFX_MPU_END 0x00001008 +#define OCMEM_HW_VERSION_MAJOR (val) FIELD_GET(GENMASK(31, 28), val) +#define OCMEM_HW_VERSION_MINOR (val) FIELD_GET(GENMASK(27, 16), val) +#define OCMEM_HW_VERSION_STEP (val) FIELD_GET(GENMASK(15, 0), val) +#define OCMEM_HW_PROFILE_NUM_PORTS (val) FIELD_PREP(0x0000000f, (val))#define OCMEM_HW_PROFILE_NUM_MACROS (val) FIELD_PREP(0x00003f00, (val))
@@ -355,6 +359,12 @@ static int ocmem_dev_probe(struct platform_device *pdev) } } + reg =ocmem_read (ocmem,OCMEM_REG_HW_VERSION ); +dev_dbg (dev,"OCMEM hardware version: %lu.%lu.%lu\n" , +OCMEM_HW_VERSION_MAJOR (reg), +OCMEM_HW_VERSION_MINOR (reg), +OCMEM_HW_VERSION_STEP (reg)); + reg =ocmem_read (ocmem,OCMEM_REG_HW_PROFILE ); ocmem->num_ports =OCMEM_HW_PROFILE_NUM_PORTS (reg); ocmem->num_macros =OCMEM_HW_PROFILE_NUM_MACROS (reg);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 222/600 soc: qcom: ocmem: Fix NUM_PORTS & NUM_MACROS macros
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luca Weiss <[email protected]>
[ Upstream commit a7b484b1c9332a1ee12e8799d62a11ee3f8e0801 ]
Since we're using these two macros to read a value from a register, we need to use the FIELD_GET instead of the FIELD_PREP macro, otherwise we're getting wrong values.
So instead of:
[ 3.111779] ocmem fdd00000.sram: 2 ports, 1 regions, 512 macros, not interleaved
we now get the correct value of:
[ 3.129672] ocmem fdd00000.sram: 2 ports, 1 regions, 2 macros, not interleaved
--- drivers/soc/qcom/ocmem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/soc/qcom/ocmem.c +2 -2
@@ -80,8 +80,8 @@ struct ocmem {#define OCMEM_HW_VERSION_MINOR (val) FIELD_GET(GENMASK(27, 16), val)#define OCMEM_HW_VERSION_STEP (val) FIELD_GET(GENMASK(15, 0), val) -#define OCMEM_HW_PROFILE_NUM_PORTS (val) FIELD_PREP(0x0000000f, (val)) -#define OCMEM_HW_PROFILE_NUM_MACROS (val) FIELD_PREP(0x00003f00, (val)) +#define OCMEM_HW_PROFILE_NUM_PORTS (val) FIELD_GET(0x0000000f, (val)) +#define OCMEM_HW_PROFILE_NUM_MACROS (val) FIELD_GET(0x00003f00, (val))#define OCMEM_HW_PROFILE_LAST_REGN_HALFSIZE 0x00010000#define OCMEM_HW_PROFILE_INTERLEAVING 0x00020000
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 223/600 arm64: dts: qcom: sm6350: Fix ZAP region
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit 44bcded2be4fe9b9d0b6e48075c9947b75c0af63 ]
The previous ZAP region definition was wrong. Fix it. Note this is not a device-specific fixup, but a fixup to the generic PIL load address.
--- arch/arm64/boot/dts/qcom/sm6350.dtsi | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
arch/arm64/boot/dts/qcom/sm6350.dtsi +5 -5
@@ -306,11 +306,6 @@ pil_ipa_gsi_mem: memory@8b710000 { no-map; }; - pil_gpu_mem: memory@8b715400 { - reg = <0 0x8b715400 0 0x2000>; - no-map; - }; - pil_modem_mem: memory@8b800000 { reg = <0 0x8b800000 0 0xf800000>; no-map;
@@ -331,6 +326,11 @@ removed_region: memory@c0000000 { no-map; }; + pil_gpu_mem: memory@f0d00000 { + reg = <0 0xf0d00000 0 0x1000>; + no-map; + }; + debug_region: memory@ffb00000 { reg = <0 0xffb00000 0 0xc0000>; no-map;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 224/600 arm64: dts: qcom: sm8250: correct dynamic power coefficients
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vincent Guittot <[email protected]>
[ Upstream commit 775a5283c25d160b2a1359018c447bc518096547 ]
sm8250 faces the same problem with its Energy Model as sdm845. The energy cost of LITTLE cores is reported to be higher than medium or big cores
EM computes the energy with formula:
energy = OPP's cost / maximum cpu capacity * utilization
On v6.4-rc6 we have:
max capacity of CPU0 = 284
capacity of CPU0's OPP(1612800 Hz) = 253
cost of CPU0's OPP(1612800 Hz) = 191704
max capacity of CPU4 = 871
capacity of CPU4's OPP(710400 Hz) = 255
cost of CPU4's OPP(710400 Hz) = 343217
Both OPPs have almost the same compute capacity but the estimated energy per unit of utilization will be estimated to:
energy CPU0 = 191704 / 284 * 1 = 675
energy CPU4 = 343217 / 871 * 1 = 394
EM estimates that little CPU0 will consume 71% more than medium CPU4 for the same compute capacity. According to [1], little consumes 25% less than medium core for Coremark benchmark at those OPPs for the same duration.
Set the dynamic-power-coefficient of CPU0-3 to 105 to fix the energy model for little CPUs.
[1] https://github.com/kdrag0n/freqbench/tree/master/results/sm8250/k30s
--- arch/arm64/boot/dts/qcom/sm8250.dtsi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm64/boot/dts/qcom/sm8250.dtsi +4 -4
@@ -99,7 +99,7 @@ CPU0: cpu@0 { reg = <0x0 0x0>; enable-method = "psci"; capacity-dmips-mhz = <448>; - dynamic-power-coefficient = <205>; + dynamic-power-coefficient = <105>; next-level-cache = <&L2_0>; power-domains = <&CPU_PD0>; power-domain-names = "psci";
@@ -123,7 +123,7 @@ CPU1: cpu@100 { reg = <0x0 0x100>; enable-method = "psci"; capacity-dmips-mhz = <448>; - dynamic-power-coefficient = <205>; + dynamic-power-coefficient = <105>; next-level-cache = <&L2_100>; power-domains = <&CPU_PD1>; power-domain-names = "psci";
@@ -144,7 +144,7 @@ CPU2: cpu@200 { reg = <0x0 0x200>; enable-method = "psci"; capacity-dmips-mhz = <448>; - dynamic-power-coefficient = <205>; + dynamic-power-coefficient = <105>; next-level-cache = <&L2_200>; power-domains = <&CPU_PD2>; power-domain-names = "psci";
@@ -165,7 +165,7 @@ CPU3: cpu@300 { reg = <0x0 0x300>; enable-method = "psci"; capacity-dmips-mhz = <448>; - dynamic-power-coefficient = <205>; + dynamic-power-coefficient = <105>; next-level-cache = <&L2_300>; power-domains = <&CPU_PD3>; power-domain-names = "psci";
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 225/600 arm64: dts: qcom: msm8916-l8150: correct light sensor VDDIO supply
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
[ Upstream commit 6a541eaa6e8e5283efb993ae7a947bede8d01fa5 ]
liteon,ltr559 light sensor takes VDDIO, not VIO, supply:
msm8916-longcheer-l8150.dtb: light-sensor@23: 'vio-supply' does not match any of the regexes: 'pinctrl-[0-9]+'
--- arch/arm64/boot/dts/qcom/msm8916-longcheer-l8150.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/msm8916-longcheer-l8150.dts +1 -1
@@ -163,7 +163,7 @@ light-sensor@23 { pinctrl-0 = <&light_int_default>; vdd-supply = <&pm8916_l17>; - vio-supply = <&pm8916_l6>; + vddio-supply = <&pm8916_l6>; }; gyroscope@68 {
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 226/600 arm64: dts: qcom: sm8250-edo: Add gpio line names for TLMM
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit 40b398beabdfe0e9088b13976e56b1dc706fe851 ]
Sony ever so graciously provides GPIO line names in their downstream kernel (though sometimes they are not 100% accurate and you can judge that by simply looking at them and with what drivers they are used).
Add these to the PDX203&206 DTSIs to better document the hardware.
Diff between 203 and 206:
< "CAM_PWR_A_CS", > "FRONTC_PWR_EN", < "CAM4_MCLK", < "TOF_RST_N", > "NC", > "NC", < "WLC_I2C_SDA", < "WLC_I2C_SCL", /* GPIO_120 */ > "NC", > "NC", < "WLC_INT_N", > "NC",
Which makes sense, as 203 has a 3D iToF, slightly different camera power wiring and WLC (WireLess Charging).
Stable-dep-of: a422c6a91a66 ("arm64: dts: qcom: sm8250-edo: Rectify gpio-keys")
--- .../qcom/sm8250-sony-xperia-edo-pdx203.dts | 183 ++++++++++++++++++ .../qcom/sm8250-sony-xperia-edo-pdx206.dts | 183 ++++++++++++++++++ 2 files changed, 366 insertions(+)
arch/arm64/boot/dts/qcom/sm8250-sony-xperia-edo-pdx203.dts +183 -0
@@ -14,3 +14,186 @@ / { }; /delete-node/ &vreg_l7f_1p8; + +&tlmm { + gpio-line-names = "AP_CTI_IN", /* GPIO_0 */ + "MDM2AP_ERR_FATAL", + "AP_CTI_OUT", + "MDM2AP_STATUS", + "NFC_I2C_SDA", + "NFC_I2C_SCL", + "NFC_EN", + "NFC_CLK_REQ", + "NFC_ESE_PWR_REQ", + "DVDT_WRT_DET_AND", + "SPK_AMP_RESET_N", /* GPIO_10 */ + "SPK_AMP_INT_N", + "APPS_I2C_1_SDA", + "APPS_I2C_1_SCL", + "NC", + "TX_GTR_THRES_IN", + "HST_BT_UART_CTS", + "HST_BT_UART_RFR", + "HST_BT_UART_TX", + "HST_BT_UART_RX", + "HST_WLAN_EN", /* GPIO_20 */ + "HST_BT_EN", + "RGBC_IR_PWR_EN", + "FP_INT_N", + "NC", + "NC", + "NC", + "NC", + "NFC_ESE_SPI_MISO", + "NFC_ESE_SPI_MOSI", + "NFC_ESE_SPI_SCLK", /* GPIO_30 */ + "NFC_ESE_SPI_CS_N", + "WCD_RST_N", + "NC", + "SDM_DEBUG_UART_TX", + "SDM_DEBUG_UART_RX", + "TS_I2C_SDA", + "TS_I2C_SCL", + "TS_INT_N", + "FP_SPI_MISO", /* GPIO_40 */ + "FP_SPI_MOSI", + "FP_SPI_SCLK", + "FP_SPI_CS_N", + "APPS_I2C_0_SDA", + "APPS_I2C_0_SCL", + "DISP_ERR_FG", + "UIM2_DETECT_EN", + "NC", + "NC", + "NC", /* GPIO_50 */ + "NC", + "MDM_UART_CTS", + "MDM_UART_RFR", + "MDM_UART_TX", + "MDM_UART_RX", + "AP2MDM_STATUS", + "AP2MDM_ERR_FATAL", + "MDM_IPC_HS_UART_TX", + "MDM_IPC_HS_UART_RX", + "NC", /* GPIO_60 */ + "NC", + "NC", + "NC", + "NC", + "USB_CC_DIR", + "DISP_VSYNC", + "NC", + "NC", + "CAM_PWR_B_CS", + "NC", /* GPIO_70 */ + "CAM_PWR_A_CS", + "SBU_SW_SEL", + "SBU_SW_OE", + "FP_RESET_N", + "FP_RESET_N", + "DISP_RESET_N", + "DEBUG_GPIO0", + "TRAY_DET", + "CAM2_RST_N", + "PCIE0_RST_N", + "PCIE0_CLK_REQ_N", /* GPIO_80 */ + "PCIE0_WAKE_N", + "DVDT_ENABLE", + "DVDT_WRT_DET_OR", + "NC", + "PCIE2_RST_N", + "PCIE2_CLK_REQ_N", + "PCIE2_WAKE_N", + "MDM_VFR_IRQ0", + "MDM_VFR_IRQ1", + "SW_SERVICE", /* GPIO_90 */ + "CAM_SOF", + "CAM1_RST_N", + "CAM0_RST_N", + "CAM0_MCLK", + "CAM1_MCLK", + "CAM2_MCLK", + "CAM3_MCLK", + "CAM4_MCLK", + "TOF_RST_N", + "NC", /* GPIO_100 */ + "CCI0_I2C_SDA", + "CCI0_I2C_SCL", + "CCI1_I2C_SDA", + "CCI1_I2C_SCL_", + "CCI2_I2C_SDA", + "CCI2_I2C_SCL", + "CCI3_I2C_SDA", + "CCI3_I2C_SCL", + "CAM3_RST_N", + "NFC_DWL_REQ", /* GPIO_110 */ + "NFC_IRQ", + "XVS", + "NC", + "RF_ID_EXTENSION", + "SPK_AMP_I2C_SDA", + "SPK_AMP_I2C_SCL", + "NC", + "NC", + "WLC_I2C_SDA", + "WLC_I2C_SCL", /* GPIO_120 */ + "ACC_COVER_OPEN", + "ALS_PROX_INT_N", + "ACCEL_INT", + "WLAN_SW_CTRL", + "CAMSENSOR_I2C_SDA", + "CAMSENSOR_I2C_SCL", + "UDON_SWITCH_SEL", + "WDOG_DISABLE", + "BAROMETER_INT", + "NC", /* GPIO_130 */ + "NC", + "FORCED_USB_BOOT", + "NC", + "NC", + "WLC_INT_N", + "NC", + "NC", + "RGBC_IR_INT", + "NC", + "NC", /* GPIO_140 */ + "NC", + "BT_SLIMBUS_CLK", + "BT_SLIMBUS_DATA", + "HW_ID_0", + "HW_ID_1", + "WCD_SWR_TX_CLK", + "WCD_SWR_TX_DATA0", + "WCD_SWR_TX_DATA1", + "WCD_SWR_RX_CLK", + "WCD_SWR_RX_DATA0", /* GPIO_150 */ + "WCD_SWR_RX_DATA1", + "SDM_DMIC_CLK1", + "SDM_DMIC_DATA1", + "SDM_DMIC_CLK2", + "SDM_DMIC_DATA2", + "SPK_AMP_I2S_CLK", + "SPK_AMP_I2S_WS", + "SPK_AMP_I2S_ASP_DIN", + "SPK_AMP_I2S_ASP_DOUT", + "COMPASS_I2C_SDA", /* GPIO_160 */ + "COMPASS_I2C_SCL", + "NC", + "NC", + "SSC_SPI_1_MISO", + "SSC_SPI_1_MOSI", + "SSC_SPI_1_CLK", + "SSC_SPI_1_CS_N", + "NC", + "NC", + "SSC_SENSOR_I2C_SDA", /* GPIO_170 */ + "SSC_SENSOR_I2C_SCL", + "NC", + "NC", + "NC", + "NC", + "HST_BLE_SNS_UART6_TX", + "HST_BLE_SNS_UART6_RX", + "HST_WLAN_UART_TX", + "HST_WLAN_UART_RX"; +};
arch/arm64/boot/dts/qcom/sm8250-sony-xperia-edo-pdx206.dts +183 -0
189 lines not on this page · raw message
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 227/600 arm64: dts: qcom: sm8250-edo: Add GPIO line names for PMIC GPIOs
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit 6b8a63350752c6a5e4b54f2de6174084652cd3cd ]
Sony ever so graciously provides GPIO line names in their downstream kernel (though sometimes they are not 100% accurate and you can judge that by simply looking at them and with what drivers they are used).
Add these to the PDX203&206 DTSIs to better document the hardware.
Diff between 203 and 206:pm8009_gpios
< "CAM_PWR_LD_EN",
Quoted 1 line
"NC",
pm8150_gpios
< "NC", > "G_ASSIST_N", < "WLC_EN_N", /* GPIO_10 */ > "NC", /* GPIO_10 */
Which is due to 5 II having an additional Google Assistant hardware button and 1 II having a wireless charger & different camera wiring to accommodate the additional 3D iToF sensor.
Stable-dep-of: a422c6a91a66 ("arm64: dts: qcom: sm8250-edo: Rectify gpio-keys")
--- .../qcom/sm8250-sony-xperia-edo-pdx203.dts | 50 +++++++++++++++++++ .../qcom/sm8250-sony-xperia-edo-pdx206.dts | 50 +++++++++++++++++++ 2 files changed, 100 insertions(+)
arch/arm64/boot/dts/qcom/sm8250-sony-xperia-edo-pdx203.dts +50 -0
@@ -15,6 +15,56 @@ / { /delete-node/ &vreg_l7f_1p8; +&pm8009_gpios { + gpio-line-names = "NC", /* GPIO_1 */ + "CAM_PWR_LD_EN", + "WIDEC_PWR_EN", + "NC"; +}; + +&pm8150_gpios { + gpio-line-names = "VOL_DOWN_N", /* GPIO_1 */ + "OPTION_2", + "NC", + "PM_SLP_CLK_IN", + "OPTION_1", + "NC", + "NC", + "SP_ARI_PWR_ALARM", + "NC", + "NC"; /* GPIO_10 */ +}; + +&pm8150b_gpios { + gpio-line-names = "SNAPSHOT_N", /* GPIO_1 */ + "FOCUS_N", + "NC", + "NC", + "RF_LCD_ID_EN", + "NC", + "NC", + "LCD_ID", + "NC", + "WLC_EN_N", /* GPIO_10 */ + "NC", + "RF_ID"; +}; + +&pm8150l_gpios { + gpio-line-names = "NC", /* GPIO_1 */ + "PM3003A_EN", + "NC", + "NC", + "NC", + "AUX2_THERM", + "BB_HP_EN", + "FP_LDO_EN", + "PMX_RESET_N", + "AUX3_THERM", /* GPIO_10 */ + "DTV_PWR_EN", + "PM3003A_MODE"; +}; + &tlmm { gpio-line-names = "AP_CTI_IN", /* GPIO_0 */ "MDM2AP_ERR_FATAL",
arch/arm64/boot/dts/qcom/sm8250-sony-xperia-edo-pdx206.dts +50 -0
56 lines not on this page · raw message
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 228/600 arm64: dts: qcom: sm8250-edo: Rectify gpio-keys
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit a422c6a91a667b309ca1a6c08b30dbfcf7d4e866 ]
Set up the corresponding GPIOs properly and add the leftover hardware buttons to mark this piece of the puzzle complete.
--- .../qcom/sm8250-sony-xperia-edo-pdx206.dts | 10 ++++ .../boot/dts/qcom/sm8250-sony-xperia-edo.dtsi | 54 ++++++++++++++++--- 2 files changed, 58 insertions(+), 6 deletions(-)
arch/arm64/boot/dts/qcom/sm8250-sony-xperia-edo-pdx206.dts +10 -0
@@ -20,6 +20,8 @@ &framebuffer { }; &gpio_keys { + pinctrl-0 = <&focus_n &snapshot_n &vol_down_n &g_assist_n>; + g-assist-key { label = "Google Assistant Key"; linux,code = <KEY_LEFTMETA>;
@@ -48,6 +50,14 @@ &pm8150_gpios { "SP_ARI_PWR_ALARM", "NC", "NC"; /* GPIO_10 */ + + g_assist_n: g-assist-n-state { + pins = "gpio6"; + function = "normal"; + power-source = <1>; + bias-pull-up; + input-enable; + }; }; &pm8150b_gpios {
arch/arm64/boot/dts/qcom/sm8250-sony-xperia-edo.dtsi +48 -6
66 lines not on this page · raw message
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 229/600 arm64: dts: qcom: sc8280xp-crd: Correct vreg_misc_3p3 GPIO
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bjorn Andersson <[email protected]>
[ Upstream commit 9566b5271f68bdf6e69b7c511850e3fb75cd18be ]
The vreg_misc_3p3 regulator is controlled by PMC8280_1 GPIO 2, not 1, on the CRD.
--- arch/arm64/boot/dts/qcom/sc8280xp-crd.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/qcom/sc8280xp-crd.dts +2 -2
@@ -57,7 +57,7 @@ vreg_misc_3p3: regulator-misc-3p3 { regulator-min-microvolt = <3300000>; regulator-max-microvolt = <3300000>; - gpio = <&pmc8280_1_gpios 1 GPIO_ACTIVE_HIGH>; + gpio = <&pmc8280_1_gpios 2 GPIO_ACTIVE_HIGH>; enable-active-high; pinctrl-names = "default";
@@ -364,7 +364,7 @@ edp_bl_reg_en: edp-bl-reg-en-state { }; misc_3p3_reg_en: misc-3p3-reg-en-state { - pins = "gpio1"; + pins = "gpio2"; function = "normal"; }; };
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 230/600 arm64: dts: qcom: sc8280xp: Add missing SCM interconnect
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit 0a69ccf20b0837db857abfc94d7e3bacf1cb771b ]
The SCM interconnect path was missing. Add it.
--- arch/arm64/boot/dts/qcom/sc8280xp.dtsi | 1 + 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/qcom/sc8280xp.dtsi +1 -0
@@ -396,6 +396,7 @@ CLUSTER_SLEEP_0: cluster-sleep-0 { firmware { scm: scm { compatible = "qcom,scm-sc8280xp", "qcom,scm"; + interconnects = <&aggre2_noc MASTER_CRYPTO 0 &mc_virt SLAVE_EBI1 0>; }; };
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 231/600 arm64: dts: qcom: msm8996: Add missing interrupt to the USB2 controller
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit 36541089c4733355ed844c67eebd0c3936953454 ]
The interrupt line was previously not described. Take care of that.
--- arch/arm64/boot/dts/qcom/msm8996.dtsi | 3 +++ 1 file changed, 3 insertions(+)
arch/arm64/boot/dts/qcom/msm8996.dtsi +3 -0
@@ -3292,6 +3292,9 @@ usb2: usb@76f8800 { #size-cells = <1>; ranges; + interrupts = <GIC_SPI 352 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "hs_phy_irq"; + clocks = <&gcc GCC_PERIPH_NOC_USB20_AHB_CLK>, <&gcc GCC_USB20_MASTER_CLK>, <&gcc GCC_USB20_MOCK_UTMI_CLK>,
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 232/600 arm64: dts: qcom: sdm845-tama: Set serial indices and stdout-path
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit 9acc60c3e2d449243e4c2126e3b56f1c4f7fd3bc ]
UART6 is used for debug (routed via uSD pins) and UART9 is connected to the bluetooth chip.
Set indexed aliases to make the GENI UART driver happy and route serial traffic through the debug uart by default.
--- arch/arm64/boot/dts/qcom/sdm845-sony-xperia-tama.dtsi | 9 +++++++++ 1 file changed, 9 insertions(+)
arch/arm64/boot/dts/qcom/sdm845-sony-xperia-tama.dtsi +9 -0
@@ -14,6 +14,15 @@ / { qcom,msm-id = <321 0x20001>; /* SDM845 v2.1 */ qcom,board-id = <8 0>; + aliases { + serial0 = &uart6; + serial1 = &uart9; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + gpio-keys { compatible = "gpio-keys";
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 233/600 arm64: dts: qcom: sm8350: Fix CPU idle state residency times
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit 91ce3693e2fb685f31d39605a5ad1fbd940804da ]
The present values look to have been copypasted from 8150 or 8180. Fix that.
--- arch/arm64/boot/dts/qcom/sm8350.dtsi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm64/boot/dts/qcom/sm8350.dtsi +4 -4
@@ -236,8 +236,8 @@ LITTLE_CPU_SLEEP_0: cpu-sleep-0-0 { compatible = "arm,idle-state"; idle-state-name = "silver-rail-power-collapse"; arm,psci-suspend-param = <0x40000004>; - entry-latency-us = <355>; - exit-latency-us = <909>; + entry-latency-us = <360>; + exit-latency-us = <531>; min-residency-us = <3934>; local-timer-stop; };
@@ -246,8 +246,8 @@ BIG_CPU_SLEEP_0: cpu-sleep-1-0 { compatible = "arm,idle-state"; idle-state-name = "gold-rail-power-collapse"; arm,psci-suspend-param = <0x40000004>; - entry-latency-us = <241>; - exit-latency-us = <1461>; + entry-latency-us = <702>; + exit-latency-us = <1061>; min-residency-us = <4488>; local-timer-stop; };
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 234/600 arm64: dts: qcom: sm8350: Add missing LMH interrupts to cpufreq
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit 951151c2bb548e0f6b2c40ab4c48675f5342c914 ]
Add the missing interrupts that communicate the hardware-managed throttling to Linux.
--- arch/arm64/boot/dts/qcom/sm8350.dtsi | 7 +++++++ 1 file changed, 7 insertions(+)
arch/arm64/boot/dts/qcom/sm8350.dtsi +7 -0
@@ -2072,6 +2072,13 @@ cpufreq_hw: cpufreq@18591000 { <0 0x18593000 0 0x1000>; reg-names = "freq-domain0", "freq-domain1", "freq-domain2"; + interrupts = <GIC_SPI 30 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "dcvsh-irq-0", + "dcvsh-irq-1", + "dcvsh-irq-2"; + clocks = <&rpmhcc RPMH_CXO_CLK>, <&gcc GCC_GPLL0>; clock-names = "xo", "alternate";
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 235/600 arm64: dts: qcom: sm8350: Use proper CPU compatibles
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit 4390730cc12af25f7c997f477795f5f4200149c0 ]
The Kryo names (once again) turned out to be fake. The CPUs report:
0x412fd050 (CA55 r2p0) (0 - 3)0x411fd410 (CA78 r1p1) (4 - 6)0x411fd440 (CX1 r1p1) (7)
Use the compatibles that reflect that.
--- arch/arm64/boot/dts/qcom/sm8350.dtsi | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
arch/arm64/boot/dts/qcom/sm8350.dtsi +8 -8
@@ -63,7 +63,7 @@ cpus { CPU0: cpu@0 { device_type = "cpu"; - compatible = "qcom,kryo685"; + compatible = "arm,cortex-a55"; reg = <0x0 0x0>; enable-method = "psci"; next-level-cache = <&L2_0>;
@@ -82,7 +82,7 @@ L3_0: l3-cache { CPU1: cpu@100 { device_type = "cpu"; - compatible = "qcom,kryo685"; + compatible = "arm,cortex-a55"; reg = <0x0 0x100>; enable-method = "psci"; next-level-cache = <&L2_100>;
@@ -98,7 +98,7 @@ L2_100: l2-cache { CPU2: cpu@200 { device_type = "cpu"; - compatible = "qcom,kryo685"; + compatible = "arm,cortex-a55"; reg = <0x0 0x200>; enable-method = "psci"; next-level-cache = <&L2_200>;
@@ -114,7 +114,7 @@ L2_200: l2-cache { CPU3: cpu@300 { device_type = "cpu"; - compatible = "qcom,kryo685"; + compatible = "arm,cortex-a55"; reg = <0x0 0x300>; enable-method = "psci"; next-level-cache = <&L2_300>;
@@ -130,7 +130,7 @@ L2_300: l2-cache { CPU4: cpu@400 { device_type = "cpu"; - compatible = "qcom,kryo685"; + compatible = "arm,cortex-a78"; reg = <0x0 0x400>; enable-method = "psci"; next-level-cache = <&L2_400>;
@@ -146,7 +146,7 @@ L2_400: l2-cache { CPU5: cpu@500 { device_type = "cpu"; - compatible = "qcom,kryo685"; + compatible = "arm,cortex-a78"; reg = <0x0 0x500>; enable-method = "psci"; next-level-cache = <&L2_500>;
@@ -163,7 +163,7 @@ L2_500: l2-cache { CPU6: cpu@600 { device_type = "cpu"; - compatible = "qcom,kryo685"; + compatible = "arm,cortex-a78"; reg = <0x0 0x600>; enable-method = "psci"; next-level-cache = <&L2_600>;
@@ -179,7 +179,7 @@ L2_600: l2-cache { CPU7: cpu@700 { device_type = "cpu"; - compatible = "qcom,kryo685"; + compatible = "arm,cortex-x1"; reg = <0x0 0x700>; enable-method = "psci"; next-level-cache = <&L2_700>;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 236/600 arm64: dts: qcom: pm8350: fix thermal zone name
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Baryshkov <[email protected]>
[ Upstream commit 64f19c06f704846db5e4885ca63c689d9bef5723 ]
The name of the thermal zone in pm8350.dtsi (pm8350c-thermal) conflicts with the thermal zone in pm8350c.dtsi. Rename the thermal zone according to the chip name.
--- arch/arm64/boot/dts/qcom/pm8350.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/pm8350.dtsi +1 -1
@@ -8,7 +8,7 @@ / { thermal-zones { - pm8350_thermal: pm8350c-thermal { + pm8350_thermal: pm8350-thermal { polling-delay-passive = <100>; polling-delay = <0>; thermal-sensors = <&pm8350_temp_alarm>;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 237/600 arm64: dts: qcom: pm8350b: fix thermal zone name
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Baryshkov <[email protected]>
[ Upstream commit aad41d9e6c44dfe299cddab97528a5333f17bdfe ]
The name of the thermal zone in pm8350b.dtsi (pm8350c-thermal) conflicts with the thermal zone in pm8350c.dtsi. Rename the thermal zone according to the chip name.
--- arch/arm64/boot/dts/qcom/pm8350b.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/pm8350b.dtsi +1 -1
@@ -8,7 +8,7 @@ / { thermal-zones { - pm8350b_thermal: pm8350c-thermal { + pm8350b_thermal: pm8350b-thermal { polling-delay-passive = <100>; polling-delay = <0>; thermal-sensors = <&pm8350b_temp_alarm>;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 238/600 arm64: dts: qcom: pmr735b: fix thermal zone name
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Baryshkov <[email protected]>
[ Upstream commit 99f8cf491d546cd668236f573c7d846d3e94f2d6 ]
The name of the thermal zone in pmr735b.dtsi (pmr735a-thermal) conflicts with the thermal zone in pmr735a.dtsi. Rename the thermal zone according to the chip name.
--- arch/arm64/boot/dts/qcom/pmr735b.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/pmr735b.dtsi +1 -1
@@ -8,7 +8,7 @@ / { thermal-zones { - pmr735a_thermal: pmr735a-thermal { + pmr735b_thermal: pmr735b-thermal { polling-delay-passive = <100>; polling-delay = <0>; thermal-sensors = <&pmr735b_temp_alarm>;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 239/600 arm64: dts: qcom: pmk8350: fix ADC-TM compatible string
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Baryshkov <[email protected]>
[ Upstream commit 435a73d7377ceb29c1a22d2711dd85c831b40c45 ]
The commit b2de43136058 ("arm64: dts: qcom: pmk8350: Add peripherals for pmk8350") for the ADC TM (thermal monitoring device) have used the compatible string from the vendor kernel ("qcom,adc-tm7"). Use the proper compatible string that is defined in the upstream kernel ("qcom,spmi-adc-tm5-gen2").
--- arch/arm64/boot/dts/qcom/pmk8350.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/pmk8350.dtsi +1 -1
@@ -44,7 +44,7 @@ pmk8350_vadc: adc@3100 { }; pmk8350_adc_tm: adc-tm@3400 { - compatible = "qcom,adc-tm7"; + compatible = "qcom,spmi-adc-tm5-gen2"; reg = <0x3400>; interrupts = <0x0 0x34 0x0 IRQ_TYPE_EDGE_RISING>; #address-cells = <1>;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 240/600 arm64: dts: qcom: sm8250: Mark PCIe hosts as DMA coherent
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit 339d38a436f30d0f874815eafc7de2257346bf26 ]
The PCIe hosts on SM8250 are cache-coherent. Mark them as such.
--- arch/arm64/boot/dts/qcom/sm8250.dtsi | 3 +++ 1 file changed, 3 insertions(+)
arch/arm64/boot/dts/qcom/sm8250.dtsi +3 -0
@@ -1862,6 +1862,7 @@ pcie0: pci@1c00000 { pinctrl-names = "default"; pinctrl-0 = <&pcie0_default_state>; + dma-coherent; status = "disabled"; };
@@ -1968,6 +1969,7 @@ pcie1: pci@1c08000 { pinctrl-names = "default"; pinctrl-0 = <&pcie1_default_state>; + dma-coherent; status = "disabled"; };
@@ -2076,6 +2078,7 @@ pcie2: pci@1c10000 { pinctrl-names = "default"; pinctrl-0 = <&pcie2_default_state>; + dma-coherent; status = "disabled"; };
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 241/600 ARM: dts: stm32: Rename mdio0 to mdio
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Vasut <[email protected]>
[ Upstream commit a306d8962a24f4e8385853793fd58f9792c7aa61 ]
Replace "mdio0" node with "mdio" to match mdio.yaml DT schema.
Stable-dep-of: 0ee0ef38aa9f ("ARM: dts: stm32: Add missing detach mailbox for emtrion emSBC-Argon")
--- arch/arm/boot/dts/stm32mp157c-emstamp-argon.dtsi | 2 +- arch/arm/boot/dts/stm32mp157c-ev1.dts | 2 +- arch/arm/boot/dts/stm32mp157c-lxa-mc1.dts | 2 +- arch/arm/boot/dts/stm32mp157c-odyssey.dts | 2 +- arch/arm/boot/dts/stm32mp15xx-dhcom-som.dtsi | 2 +- arch/arm/boot/dts/stm32mp15xx-dhcor-avenger96.dtsi | 2 +- arch/arm/boot/dts/stm32mp15xx-dhcor-drc-compact.dtsi | 2 +- arch/arm/boot/dts/stm32mp15xx-dkx.dtsi | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-)
arch/arm/boot/dts/stm32mp157c-emstamp-argon.dtsi +1 -1
@@ -173,7 +173,7 @@ ðernet0 { phy-handle = <&phy0>; st,eth-ref-clk-sel; - mdio0 { + mdio { #address-cells = <1>; #size-cells = <0>; compatible = "snps,dwmac-mdio";
arch/arm/boot/dts/stm32mp157c-ev1.dts +1 -1
@@ -144,7 +144,7 @@ ðernet0 { max-speed = <1000>; phy-handle = <&phy0>; - mdio0 { + mdio { #address-cells = <1>; #size-cells = <0>; compatible = "snps,dwmac-mdio";
arch/arm/boot/dts/stm32mp157c-lxa-mc1.dts +1 -1
@@ -112,7 +112,7 @@ ðernet0 { phy-handle = <ðphy>; status = "okay"; - mdio0 { + mdio { compatible = "snps,dwmac-mdio"; #address-cells = <1>; #size-cells = <0>;
arch/arm/boot/dts/stm32mp157c-odyssey.dts +1 -1
@@ -41,7 +41,7 @@ ðernet0 { assigned-clock-rates = <125000000>; /* Clock PLL4 to 750Mhz in ATF/U-Boot */ st,eth-clk-sel; - mdio0 { + mdio { #address-cells = <1>; #size-cells = <0>; compatible = "snps,dwmac-mdio";
arch/arm/boot/dts/stm32mp15xx-dhcom-som.dtsi +1 -1
@@ -125,7 +125,7 @@ ðernet0 { max-speed = <100>; phy-handle = <&phy0>; - mdio0 { + mdio { #address-cells = <1>; #size-cells = <0>; compatible = "snps,dwmac-mdio";
arch/arm/boot/dts/stm32mp15xx-dhcor-avenger96.dtsi +1 -1
@@ -151,7 +151,7 @@ ðernet0 { max-speed = <1000>; phy-handle = <&phy0>; - mdio0 { + mdio { #address-cells = <1>; #size-cells = <0>; compatible = "snps,dwmac-mdio";
arch/arm/boot/dts/stm32mp15xx-dhcor-drc-compact.dtsi +1 -1
@@ -78,7 +78,7 @@ ðernet0 { max-speed = <1000>; phy-handle = <&phy0>; - mdio0 { + mdio { #address-cells = <1>; #size-cells = <0>; compatible = "snps,dwmac-mdio";
arch/arm/boot/dts/stm32mp15xx-dkx.dtsi +1 -1
@@ -141,7 +141,7 @@ ðernet0 { max-speed = <1000>; phy-handle = <&phy0>; - mdio0 { + mdio { #address-cells = <1>; #size-cells = <0>; compatible = "snps,dwmac-mdio";
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 242/600 ARM: dts: stm32: YAML validation fails for Argon Boards
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pierre-Yves MORDRET <[email protected]>
[ Upstream commit fc8d2b21bc5d5d7a6eadaa8c2a5d2e6856689480 ]
"make dtbs_check" gives following output :
stm32mp157c-emstamp-argon.dtb: gpu@59000000: 'contiguous-area' does not match any of the regexes: 'pinctrl-[0-9]+'
Quoted 1 line
From schema:
Documentation/devicetree/bindings/gpu/vivante,gc.yaml
Stable-dep-of: 0ee0ef38aa9f ("ARM: dts: stm32: Add missing detach mailbox for emtrion emSBC-Argon")
--- arch/arm/boot/dts/stm32mp157c-emstamp-argon.dtsi | 9 --------- 1 file changed, 9 deletions(-)
arch/arm/boot/dts/stm32mp157c-emstamp-argon.dtsi +0 -9
@@ -68,11 +68,6 @@ retram: retram@38000000 { reg = <0x38000000 0x10000>; no-map; }; - - gpu_reserved: gpu@dc000000 { - reg = <0xdc000000 0x4000000>; - no-map; - }; }; led: gpio_leds {
@@ -183,10 +178,6 @@ phy0: ethernet-phy@0 { }; }; -&gpu { - contiguous-area = <&gpu_reserved>; -}; - &hash1 { status = "okay"; };
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 243/600 ARM: dts: stm32: adopt generic iio bindings for adc channels on emstamp-argon
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Olivier Moysan <[email protected]>
[ Upstream commit c46e9b6cc98245f7264a8d15394d1f95d433abec ]
Use STM32 ADC generic bindings instead of legacy bindings on emtrion GmbH Argon boards.
The STM32 ADC specific binding to declare channels has been deprecated, hence adopt the generic IIO channels bindings, instead.
The STM32MP151 device tree now exposes internal channels using the generic binding. This makes the change mandatory here to avoid a mixed use of legacy and generic binding, which is not supported by the driver.
Stable-dep-of: 0ee0ef38aa9f ("ARM: dts: stm32: Add missing detach mailbox for emtrion emSBC-Argon")
--- arch/arm/boot/dts/stm32mp157c-emstamp-argon.dtsi | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
arch/arm/boot/dts/stm32mp157c-emstamp-argon.dtsi +4 -2
@@ -97,9 +97,11 @@ &adc { adc1: adc@0 { pinctrl-names = "default"; pinctrl-0 = <&adc1_in6_pins_a>; - st,min-sample-time-nsecs = <5000>; - st,adc-channels = <6>; status = "disabled"; + channel@6 { + reg = <6>; + st,min-sample-time-ns = <5000>; + }; }; adc2: adc@100 {
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 244/600 ARM: dts: stm32: Add missing detach mailbox for emtrion emSBC-Argon
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Vasut <[email protected]>
[ Upstream commit 0ee0ef38aa9f75f21b51f729dd42b2e932515188 ]
Add missing "detach" mailbox to this board to permit the CPU to inform the remote processor on a detach. This signal allows the remote processor firmware to stop IPC communication and to reinitialize the resources for a re-attach.
Without this mailbox, detach is not possible and kernel log contains the following warning to, so make sure all the STM32MP15xx platform DTs are
in sync regarding the mailboxes to fix the detach issue and the warning:
"
stm32-rproc 10000000.m4: mbox_request_channel_byname() could not locate channel named "detach" "
--- arch/arm/boot/dts/stm32mp157c-emstamp-argon.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/stm32mp157c-emstamp-argon.dtsi +2 -2
@@ -368,8 +368,8 @@ &iwdg2 { &m4_rproc { memory-region = <&retram>, <&mcuram>, <&mcuram2>, <&vdev0vring0>, <&vdev0vring1>, <&vdev0buffer>; - mboxes = <&ipcc 0>, <&ipcc 1>, <&ipcc 2>; - mbox-names = "vq0", "vq1", "shutdown"; + mboxes = <&ipcc 0>, <&ipcc 1>, <&ipcc 2>, <&ipcc 3>; + mbox-names = "vq0", "vq1", "shutdown", "detach"; interrupt-parent = <&exti>; interrupts = <68 1>; interrupt-names = "wdg";
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 245/600 ARM: dts: stm32: YAML validation fails for Odyssey Boards
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pierre-Yves MORDRET <[email protected]>
[ Upstream commit 84a34e1862aae43e4dcdfb743a7dd3ade1fe4a3c ]
"make dtbs_check" gives following output :stm32mp157c-odyssey.dt.yaml: gpu@59000000: 'contiguous-area' does not match any of the regexes: 'pinctrl-[0-9]+'
Quoted 1 line
From schema:
Documentation/devicetree/bindings/gpu/vivante,gc.yaml
Stable-dep-of: 966f04a89d77 ("ARM: dts: stm32: Add missing detach mailbox for Odyssey SoM")
--- arch/arm/boot/dts/stm32mp157c-odyssey-som.dtsi | 10 ---------- 1 file changed, 10 deletions(-)
arch/arm/boot/dts/stm32mp157c-odyssey-som.dtsi +0 -10
@@ -62,11 +62,6 @@ retram: retram@38000000 { reg = <0x38000000 0x10000>; no-map; }; - - gpu_reserved: gpu@d4000000 { - reg = <0xd4000000 0x4000000>; - no-map; - }; }; led {
@@ -80,11 +75,6 @@ led-blue { }; }; -&gpu { - contiguous-area = <&gpu_reserved>; - status = "okay"; -}; - &i2c2 { pinctrl-names = "default"; pinctrl-0 = <&i2c2_pins_a>;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 246/600 ARM: dts: stm32: Add missing detach mailbox for Odyssey SoM
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Vasut <[email protected]>
[ Upstream commit 966f04a89d77548e673de2c400abe0b2cf5c15db ]
Add missing "detach" mailbox to this board to permit the CPU to inform the remote processor on a detach. This signal allows the remote processor firmware to stop IPC communication and to reinitialize the resources for a re-attach.
Without this mailbox, detach is not possible and kernel log contains the following warning to, so make sure all the STM32MP15xx platform DTs are
in sync regarding the mailboxes to fix the detach issue and the warning:
"
stm32-rproc 10000000.m4: mbox_request_channel_byname() could not locate channel named "detach" "
--- arch/arm/boot/dts/stm32mp157c-odyssey-som.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/stm32mp157c-odyssey-som.dtsi +2 -2
@@ -230,8 +230,8 @@ &iwdg2 { &m4_rproc { memory-region = <&retram>, <&mcuram>, <&mcuram2>, <&vdev0vring0>, <&vdev0vring1>, <&vdev0buffer>; - mboxes = <&ipcc 0>, <&ipcc 1>, <&ipcc 2>; - mbox-names = "vq0", "vq1", "shutdown"; + mboxes = <&ipcc 0>, <&ipcc 1>, <&ipcc 2>, <&ipcc 3>; + mbox-names = "vq0", "vq1", "shutdown", "detach"; interrupt-parent = <&exti>; interrupts = <68 1>; status = "okay";
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 247/600 ARM: dts: stm32: Update to generic ADC channel binding on DHSOM systems
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Vasut <[email protected]>
[ Upstream commit 9bcfc3cdc903485a52c6f471f4ae96a41fa51803 ]
The generic ADC channel binding is recommended over legacy one, update the DT to the modern binding. No functional change. For further details, see commit which adds the generic binding to STM32 ADC binding document:
'664b9879f56e ("dt-bindings: iio: stm32-adc: add generic channel binding")'
Stable-dep-of: deb7edbc27a6 ("ARM: dts: stm32: Add missing detach mailbox for DHCOM SoM")
--- arch/arm/boot/dts/stm32mp15xx-dhcom-som.dtsi | 18 +++++---- .../boot/dts/stm32mp15xx-dhcor-avenger96.dtsi | 38 +++++++++++++++---- 2 files changed, 40 insertions(+), 16 deletions(-)
arch/arm/boot/dts/stm32mp15xx-dhcom-som.dtsi +10 -8
@@ -80,17 +80,19 @@ &adc { vdda-supply = <&vdda>; vref-supply = <&vdda>; status = "okay"; +}; - adc1: adc@0 { - st,min-sample-time-nsecs = <5000>; - st,adc-channels = <0>; - status = "okay"; +&adc1 { + channel@0 { + reg = <0>; + st,min-sample-time-ns = <5000>; }; +}; - adc2: adc@100 { - st,adc-channels = <1>; - st,min-sample-time-nsecs = <5000>; - status = "okay"; +&adc2 { + channel@1 { + reg = <1>; + st,min-sample-time-ns = <5000>; }; };
arch/arm/boot/dts/stm32mp15xx-dhcor-avenger96.dtsi +30 -8
@@ -112,17 +112,39 @@ &adc { vdda-supply = <&vdda>; vref-supply = <&vdda>; status = "okay"; +}; - adc1: adc@0 { - st,adc-channels = <0 1 6>; - st,min-sample-time-nsecs = <5000>; - status = "okay"; +&adc1 { + channel@0 { + reg = <0>; + st,min-sample-time-ns = <5000>; }; - adc2: adc@100 { - st,adc-channels = <0 1 2>; - st,min-sample-time-nsecs = <5000>; - status = "okay"; + channel@1 { + reg = <1>; + st,min-sample-time-ns = <5000>; + }; + + channel@6 { + reg = <6>; + st,min-sample-time-ns = <5000>; + }; +}; + +&adc2 { + channel@0 { + reg = <0>; + st,min-sample-time-ns = <5000>; + }; + + channel@1 { + reg = <1>; + st,min-sample-time-ns = <5000>; + }; + + channel@2 { + reg = <2>; + st,min-sample-time-ns = <5000>; }; };
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 248/600 ARM: dts: stm32: Add missing detach mailbox for DHCOM SoM
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Vasut <[email protected]>
[ Upstream commit deb7edbc27a6ec4d8f5edfd8519b7ed13cbd2a52 ]
Add missing "detach" mailbox to this board to permit the CPU to inform the remote processor on a detach. This signal allows the remote processor firmware to stop IPC communication and to reinitialize the resources for a re-attach.
Without this mailbox, detach is not possible and kernel log contains the following warning to, so make sure all the STM32MP15xx platform DTs are
in sync regarding the mailboxes to fix the detach issue and the warning:
"
stm32-rproc 10000000.m4: mbox_request_channel_byname() could not locate channel named "detach" "
--- arch/arm/boot/dts/stm32mp15xx-dhcom-som.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/stm32mp15xx-dhcom-som.dtsi +2 -2
@@ -416,8 +416,8 @@ &iwdg2 { &m4_rproc { memory-region = <&retram>, <&mcuram>, <&mcuram2>, <&vdev0vring0>, <&vdev0vring1>, <&vdev0buffer>; - mboxes = <&ipcc 0>, <&ipcc 1>, <&ipcc 2>; - mbox-names = "vq0", "vq1", "shutdown"; + mboxes = <&ipcc 0>, <&ipcc 1>, <&ipcc 2>, <&ipcc 3>; + mbox-names = "vq0", "vq1", "shutdown", "detach"; interrupt-parent = <&exti>; interrupts = <68 1>; status = "okay";
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 249/600 firmware: ti_sci: Use system_state to determine polling
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nishanth Menon <[email protected]>
[ Upstream commit 9225bcdedf16297a346082e7d23b0e8434aa98ed ]
Commit b9e8a7d950ff ("firmware: ti_sci: Switch transport to polled mode during system suspend") aims to resolve issues with tisci operations during system suspend operation. However, the system may enter a no_irq stage in various other usage modes, including power-off and restart. To determine if polling mode is appropriate, use the system_state instead.
While at this, drop the unused is_suspending state variable and related helpers.
--- drivers/firmware/ti_sci.c | 36 ++---------------------------------- 1 file changed, 2 insertions(+), 34 deletions(-)
drivers/firmware/ti_sci.c +2 -34
@@ -97,7 +97,6 @@ struct ti_sci_desc {* @node: list head * @host_id: Host ID * @users: Number of users of this instance -* @is_suspending: Flag set to indicate in suspend path. */ struct ti_sci_info {struct device *dev;
@@ -116,7 +115,6 @@ struct ti_sci_info {u8 host_id;/* protected by ti_sci_list_mutex */ int users; -bool is_suspending; };#define cl_to_ti_sci_info (c) container_of(c, struct ti_sci_info, cl)
@@ -418,14 +416,14 @@ static inline int ti_sci_do_xfer(struct ti_sci_info *info, ret =0 ; -if (!info->is_suspending) { +if (system_state <=SYSTEM_RUNNING ) {/* And we wait for the response. */ timeout =msecs_to_jiffies (info->desc->max_rx_timeout_ms);if (!wait_for_completion_timeout (&xfer->done, timeout)) ret = -ETIMEDOUT ; }else {/* -* If we are suspending, we cannot use wait_for_completion_timeout +* If we are !running, we cannot use wait_for_completion_timeout * during noirq phase, so we must manually poll the completion. */ ret = read_poll_timeout_atomic(try_wait_for_completion, done_state,
@@ -3282,35 +3280,6 @@ static int tisci_reboot_handler(struct notifier_block *nb, unsigned long mode,return NOTIFY_BAD ; } -static void ti_sci_set_is_suspending (struct ti_sci_info *info,bool is_suspending) -{ - info->is_suspending = is_suspending; -} - -static int ti_sci_suspend (struct device *dev) -{ -struct ti_sci_info *info =dev_get_drvdata (dev); -/* -* We must switch operation to polled mode now as drivers and the genpd -* layer may make late TI SCI calls to change clock and device states -* from the noirq phase of suspend. -*/ -ti_sci_set_is_suspending (info, true); - -return 0 ; -} - -static int ti_sci_resume (struct device *dev) -{ -struct ti_sci_info *info =dev_get_drvdata (dev); - -ti_sci_set_is_suspending (info, false); - -return 0 ; -} - -static DEFINE_SIMPLE_DEV_PM_OPS(ti_sci_pm_ops, ti_sci_suspend, ti_sci_resume); -/* Description for K2G */ static const struct ti_sci_desc ti_sci_pmmc_k2g_desc = { .default_host_id =2 ,
@@ -3519,7 +3488,6 @@ static struct platform_driver ti_sci_driver = { .driver = { .name = "ti-sci", .of_match_table = of_match_ptr(ti_sci_of_match), - .pm = &ti_sci_pm_ops, }, };module_platform_driver (ti_sci_driver);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 250/600 drm/amdgpu: avoid integer overflow warning in amdgpu_device_resize_fb_bar()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit 822130b5e8834ab30ad410cf19a582e5014b9a85 ]
On 32-bit architectures comparing a resource against a value larger than U32_MAX can cause a warning:
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:1344:18: error: result of comparison of constant 4294967296 with expression of type 'resource_size_t' (aka 'unsigned int') is always false [-Werror,-Wtautological-constant-out-of-range-compare]
res->start > 0x100000000ull)
~~~~~~~~~~ ^ ~~~~~~~~~~~~~~As gcc does not warn about this in dead code, add an IS_ENABLED() check at the start of the function. This will always return success but not actually resize the BAR on 32-bit architectures without high memory, which is exactly what we want here, as the driver can fall back to bank switching the VRAM access.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +3 -0
@@ -1212,6 +1212,9 @@ int amdgpu_device_resize_fb_bar(struct amdgpu_device *adev)u16 cmd;int r; +if (!IS_ENABLED (CONFIG_PHYS_ADDR_T_64BIT )) +return 0 ; +/* Bypass for VF */ if (amdgpu_sriov_vf (adev))return 0 ;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 251/600 ARM: dts: BCM53573: Drop nonexistent #usb-cells
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rafał Miłecki <[email protected]>
[ Upstream commit 05d2c3d552b8c92fc397377d9d1112fc58e2cd59 ]
Such property simply doesn't exist (is not documented or used anywhere).
This fixes:arch/arm/boot/dts/broadcom/bcm47189-luxul-xap-1440.dtb: usb@d000: Unevaluated properties are not allowed ('#usb-cells' was unexpected)
From schema: Documentation/devicetree/bindings/usb/generic-ohci.yaml
--- arch/arm/boot/dts/bcm53573.dtsi | 2 -- 1 file changed, 2 deletions(-)
arch/arm/boot/dts/bcm53573.dtsi +0 -2
@@ -156,8 +156,6 @@ ehci_port2: port@2 { }; ohci: usb@d000 { - #usb-cells = <0>; - compatible = "generic-ohci"; reg = <0xd000 0x1000>; interrupt-parent = <&gic>;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 252/600 ARM: dts: BCM53573: Add cells sizes to PCIe node
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rafał Miłecki <[email protected]>
[ Upstream commit 3392ef368d9b04622fe758b1079b512664b6110a ]
This fixes:arch/arm/boot/dts/broadcom/bcm47189-luxul-xap-1440.dtb: pcie@2000: '#address-cells' is a required property
From schema: /lib/python3.10/site-packages/dtschema/schemas/pci/pci-bus.yamlarch/arm/boot/dts/broadcom/bcm47189-luxul-xap-1440.dtb: pcie@2000: '#size-cells' is a required property
From schema: /lib/python3.10/site-packages/dtschema/schemas/pci/pci-bus.yaml
Two properties that need to be added later are "device_type" and "ranges". Adding "device_type" on its own causes a new warning and the value of "ranges" needs to be determined yet.
--- arch/arm/boot/dts/bcm53573.dtsi | 3 +++ 1 file changed, 3 insertions(+)
arch/arm/boot/dts/bcm53573.dtsi +3 -0
@@ -127,6 +127,9 @@ uart0: serial@300 { pcie0: pcie@2000 { reg = <0x00002000 0x1000>; + + #address-cells = <3>; + #size-cells = <2>; }; usb2: usb2@4000 {
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 253/600 ARM: dts: BCM53573: Use updated "spi-gpio" binding properties
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rafał Miłecki <[email protected]>
[ Upstream commit 2c0fd6b3d0778ceab40205315ccef74568490f17 ]
Switch away from deprecated properties.
This fixes:arch/arm/boot/dts/broadcom/bcm947189acdbmr.dtb: spi: gpio-sck: False schema does not allow [[3, 21, 0]]
From schema: Documentation/devicetree/bindings/spi/spi-gpio.yamlarch/arm/boot/dts/broadcom/bcm947189acdbmr.dtb: spi: gpio-miso: False schema does not allow [[3, 22, 0]]
From schema: Documentation/devicetree/bindings/spi/spi-gpio.yamlarch/arm/boot/dts/broadcom/bcm947189acdbmr.dtb: spi: gpio-mosi: False schema does not allow [[3, 23, 0]]
From schema: Documentation/devicetree/bindings/spi/spi-gpio.yamlarch/arm/boot/dts/broadcom/bcm947189acdbmr.dtb: spi: 'sck-gpios' is a required property
From schema: Documentation/devicetree/bindings/spi/spi-gpio.yamlarch/arm/boot/dts/broadcom/bcm947189acdbmr.dtb: spi: Unevaluated properties are not allowed ('gpio-miso', 'gpio-mosi', 'gpio-sck' were unexpected)
From schema: Documentation/devicetree/bindings/spi/spi-gpio.yaml
--- arch/arm/boot/dts/bcm947189acdbmr.dts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm/boot/dts/bcm947189acdbmr.dts +3 -3
@@ -60,9 +60,9 @@ button-wps { spi { compatible = "spi-gpio"; num-chipselects = <1>; - gpio-sck = <&chipcommon 21 0>; - gpio-miso = <&chipcommon 22 0>; - gpio-mosi = <&chipcommon 23 0>; + sck-gpios = <&chipcommon 21 0>; + miso-gpios = <&chipcommon 22 0>; + mosi-gpios = <&chipcommon 23 0>; cs-gpios = <&chipcommon 24 0>; #address-cells = <1>; #size-cells = <0>;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 254/600 arm64: tegra: Fix HSUART for Jetson AGX Orin
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jon Hunter <[email protected]>
[ Upstream commit 861dbb2b15b1049113887fb95e856f7123eea0cc ]
After commit 71de0a054d0e ("arm64: tegra: Drop serial clock-names and reset-names") was applied, the HSUART failed to probe and the following error is seen:
serial-tegra 3100000.serial: Couldn't get the reset
serial-tegra: probe of 3100000.serial failed with error -2
Commit 71de0a054d0e ("arm64: tegra: Drop serial clock-names and reset-names") is correct because the "reset-names" property is not needed for 8250 UARTs. However, the "reset-names" is required for the HSUART and should have been populated as part of commit ff578db7b693 ("arm64: tegra: Enable UART instance on 40-pin header") that enabled the HSUART for Jetson AGX Orin. Fix this by populating the "reset-names" property for the HSUART on Jetson AGX Orin.
--- arch/arm64/boot/dts/nvidia/tegra234-p3737-0000+p3701-0000.dts | 1 + 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/nvidia/tegra234-p3737-0000+p3701-0000.dts +1 -0
@@ -2004,6 +2004,7 @@ interrupt-controller@2a40000 { serial@3100000 { compatible = "nvidia,tegra194-hsuart"; + reset-names = "serial"; status = "okay"; };
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 255/600 arm64: dts: qcom: sm8250-sony-xperia: correct GPIO keys wakeup again
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
[ Upstream commit b8fbeea0253211d97c579eae787274633d3eaf0d ]
gpio-keys,wakeup is a deprecated property:
m8250-sony-xperia-edo-pdx206.dtb: gpio-keys: key-camera-focus: Unevaluated properties are not allowed ('gpio-key,wakeup' was unexpected)
--- arch/arm64/boot/dts/qcom/sm8250-sony-xperia-edo.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/qcom/sm8250-sony-xperia-edo.dtsi +2 -2
@@ -60,7 +60,7 @@ key-camera-focus { gpios = <&pm8150b_gpios 2 GPIO_ACTIVE_LOW>; debounce-interval = <15>; linux,can-disable; - gpio-key,wakeup; + wakeup-source; }; key-camera-snapshot {
@@ -69,7 +69,7 @@ key-camera-snapshot { gpios = <&pm8150b_gpios 1 GPIO_ACTIVE_LOW>; debounce-interval = <15>; linux,can-disable; - gpio-key,wakeup; + wakeup-source; }; key-vol-down {
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 256/600 arm64: dts: qcom: pm6150l: Add missing short interrupt
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit 7e1f024ef0d1da456f61d00f01dc3287ede915b3 ]
Add the missing short interrupt. This fixes the schema warning:
wled@d800: interrupt-names: ['ovp'] is too short
--- arch/arm64/boot/dts/qcom/pm6150l.dtsi | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/qcom/pm6150l.dtsi +3 -2
@@ -75,8 +75,9 @@ pm6150l_lsid5: pmic@5 { pm6150l_wled: leds@d800 { compatible = "qcom,pm6150l-wled"; reg = <0xd800>, <0xd900>; - interrupts = <0x5 0xd8 0x1 IRQ_TYPE_EDGE_RISING>; - interrupt-names = "ovp"; + interrupts = <0x5 0xd8 0x1 IRQ_TYPE_EDGE_RISING>, + <0x5 0xd8 0x2 IRQ_TYPE_EDGE_RISING>; + interrupt-names = "ovp", "short"; label = "backlight"; status = "disabled";
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 257/600 arm64: dts: qcom: pm660l: Add missing short interrupt
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit 9a4ac09db3c7413e334b4abd6b2f6de8930dd781 ]
Add the missing short interrupt. This fixes the schema warning:
wled@d800: interrupt-names: ['ovp'] is too short
--- arch/arm64/boot/dts/qcom/pm660l.dtsi | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/qcom/pm660l.dtsi +3 -2
@@ -74,8 +74,9 @@ pm660l_lpg: pwm { pm660l_wled: leds@d800 { compatible = "qcom,pm660l-wled"; reg = <0xd800>, <0xd900>; - interrupts = <0x3 0xd8 0x1 IRQ_TYPE_EDGE_RISING>; - interrupt-names = "ovp"; + interrupts = <0x3 0xd8 0x1 IRQ_TYPE_EDGE_RISING>, + <0x3 0xd8 0x2 IRQ_TYPE_EDGE_RISING>; + interrupt-names = "ovp", "short"; label = "backlight"; status = "disabled";
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 258/600 arm64: dts: qcom: pmi8994: Add missing OVP interrupt
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit 8db94432690371b1736e9a2566a9b3d8a73d5a97 ]
Add the missing OVP interrupt. This fixes the schema warning:
wled@d800: interrupt-names: ['short'] is too short
--- arch/arm64/boot/dts/qcom/pmi8994.dtsi | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/qcom/pmi8994.dtsi +3 -2
@@ -54,8 +54,9 @@ pmi8994_spmi_regulators: regulators { pmi8994_wled: wled@d800 { compatible = "qcom,pmi8994-wled"; reg = <0xd800>, <0xd900>; - interrupts = <3 0xd8 0x02 IRQ_TYPE_EDGE_RISING>; - interrupt-names = "short"; + interrupts = <0x3 0xd8 0x1 IRQ_TYPE_EDGE_RISING>, + <0x3 0xd8 0x2 IRQ_TYPE_EDGE_RISING>; + interrupt-names = "ovp", "short"; qcom,cabc; qcom,external-pfet; status = "disabled";
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 259/600 arm64: tegra: Fix HSUART for Smaug
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Diogo Ivo <[email protected]>
[ Upstream commit 590bfe51838f6345a6a3288507661dc9b7208464 ]
After commit 71de0a054d0e ("arm64: tegra: Drop serial clock-names and reset-names") was applied, the HSUART failed to probe and the following error is seen:
serial-tegra 70006300.serial: Couldn't get the reset
serial-tegra: probe of 70006300.serial failed with error -2
Commit 71de0a054d0e ("arm64: tegra: Drop serial clock-names and reset-names") is correct because the "reset-names" property is not needed for 8250 UARTs. However, the "reset-names" is required for the HSUART and should have been populated as part of commit a63c0cd83720c ("arm64: dts: tegra: smaug: Add Bluetooth node") that enabled the HSUART for the Pixel C. Fix this by populating the "reset-names" property for the HSUART on the Pixel C.
--- arch/arm64/boot/dts/nvidia/tegra210-smaug.dts | 1 + 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/nvidia/tegra210-smaug.dts +1 -0
@@ -1312,6 +1312,7 @@ serial@70006000 { uartd: serial@70006300 { compatible = "nvidia,tegra30-hsuart"; + reset-names = "serial"; status = "okay"; bluetooth {
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 260/600 drm/etnaviv: fix dumping of active MMU context
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lucas Stach <[email protected]>
[ Upstream commit 20faf2005ec85fa1a6acc9a74ff27de667f90576 ]
gpu->mmu_context is the MMU context of the last job in the HW queue, which isn't necessarily the same as the context from the bad job. Dump the MMU context from the scheduler determined bad submit to make it work as intended.
--- drivers/gpu/drm/etnaviv/etnaviv_dump.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/gpu/drm/etnaviv/etnaviv_dump.c +7 -7
@@ -125,9 +125,9 @@ void etnaviv_core_dump(struct etnaviv_gem_submit *submit)return ; etnaviv_dump_core = false; -mutex_lock (&gpu->mmu_context->lock); +mutex_lock (&submit->mmu_context->lock); - mmu_size =etnaviv_iommu_dump_size (gpu->mmu_context); + mmu_size =etnaviv_iommu_dump_size (submit->mmu_context);/* We always dump registers, mmu, ring, hanging cmdbuf and end marker */ n_obj =5 ;
@@ -157,7 +157,7 @@ void etnaviv_core_dump(struct etnaviv_gem_submit *submit) iter.start =__vmalloc (file_size,GFP_KERNEL | __GFP_NOWARN | __GFP_NORETRY);if (!iter.start) { -mutex_unlock (&gpu->mmu_context->lock); +mutex_unlock (&submit->mmu_context->lock);dev_warn (gpu->dev,"failed to allocate devcoredump file\n" );return ; }
@@ -169,18 +169,18 @@ void etnaviv_core_dump(struct etnaviv_gem_submit *submit)memset (iter.hdr,0 , iter.data - iter.start);etnaviv_core_dump_registers (&iter, gpu); -etnaviv_core_dump_mmu (&iter, gpu->mmu_context, mmu_size); +etnaviv_core_dump_mmu (&iter, submit->mmu_context, mmu_size);etnaviv_core_dump_mem (&iter,ETDUMP_BUF_RING , gpu->buffer.vaddr, gpu->buffer.size,etnaviv_cmdbuf_get_va (&gpu->buffer, - &gpu->mmu_context->cmdbuf_mapping)); + &submit->mmu_context->cmdbuf_mapping));etnaviv_core_dump_mem (&iter,ETDUMP_BUF_CMD , submit->cmdbuf.vaddr, submit->cmdbuf.size,etnaviv_cmdbuf_get_va (&submit->cmdbuf, - &gpu->mmu_context->cmdbuf_mapping)); + &submit->mmu_context->cmdbuf_mapping)); -mutex_unlock (&gpu->mmu_context->lock); +mutex_unlock (&submit->mmu_context->lock);/* Reserve space for the bomap */ if (n_bomap_pages) {
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 261/600 block: cleanup queue_wc_store
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christoph Hellwig <[email protected]>
[ Upstream commit c4e21bcd0f9d01f9c5d6c52007f5541871a5b1de ]
Get rid of the local queue_wc_store variable and handling setting and clearing the QUEUE_FLAG_WC flag diretly instead the if / else if.
Stable-dep-of: 43c9835b144c ("block: don't allow enabling a cache on devices that don't support it")
--- block/blk-sysfs.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-)
block/blk-sysfs.c +3 -11
@@ -528,21 +528,13 @@ static ssize_t queue_wc_show(struct request_queue *q, char *page)static ssize_t queue_wc_store (struct request_queue *q,const char *page,size_t count) { -int set =-1 ; -if (!strncmp (page,"write back" ,10 )) - set =1 ; +blk_queue_flag_set (QUEUE_FLAG_WC , q);else if (!strncmp (page,"write through" ,13 ) || !strncmp (page,"none" ,4 )) - set =0 ; - -if (set ==-1 ) -return -EINVAL ; - -if (set) -blk_queue_flag_set (QUEUE_FLAG_WC , q); -else blk_queue_flag_clear (QUEUE_FLAG_WC , q); +else +return -EINVAL ;return count; }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 262/600 block: dont allow enabling a cache on devices that dont support it
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christoph Hellwig <[email protected]>
[ Upstream commit 43c9835b144c7ce29efe142d662529662a9eb376 ]
Currently the write_cache attribute allows enabling the QUEUE_FLAG_WC flag on devices that never claimed the capability.
Fix that by adding a QUEUE_FLAG_HW_WC flag that is set by blk_queue_write_cache and guards re-enabling the cache through sysfs.
Note that any rescan that calls blk_queue_write_cache will still re-enable the write cache as in the current code.
--- block/blk-settings.c | 7 +++++-- block/blk-sysfs.c | 11 +++++++---- include/linux/blkdev.h | 1 + 3 files changed, 13 insertions(+), 6 deletions(-)
block/blk-settings.c +5 -2
@@ -824,10 +824,13 @@ EXPORT_SYMBOL(blk_set_queue_depth);*/ void blk_queue_write_cache (struct request_queue *q,bool wc,bool fua) { -if (wc) +if (wc) { +blk_queue_flag_set (QUEUE_FLAG_HW_WC , q);blk_queue_flag_set (QUEUE_FLAG_WC , q); -else + }else { +blk_queue_flag_clear (QUEUE_FLAG_HW_WC , q);blk_queue_flag_clear (QUEUE_FLAG_WC , q); + }if (fua)blk_queue_flag_set (QUEUE_FLAG_FUA , q);else
block/blk-sysfs.c +7 -4
@@ -528,13 +528,16 @@ static ssize_t queue_wc_show(struct request_queue *q, char *page)static ssize_t queue_wc_store (struct request_queue *q,const char *page,size_t count) { -if (!strncmp (page,"write back" ,10 )) +if (!strncmp (page,"write back" ,10 )) { +if (!test_bit (QUEUE_FLAG_HW_WC , &q->queue_flags)) +return -EINVAL ;blk_queue_flag_set (QUEUE_FLAG_WC , q); -else if (!strncmp (page,"write through" ,13 ) || - !strncmp (page,"none" ,4 )) + }else if (!strncmp (page,"write through" ,13 ) || + !strncmp (page,"none" ,4 )) {blk_queue_flag_clear (QUEUE_FLAG_WC , q); -else + }else {return -EINVAL ; + }return count; }
include/linux/blkdev.h +1 -0
@@ -565,6 +565,7 @@ struct request_queue {#define QUEUE_FLAG_NOXMERGES 9/* No extended merges */ #define QUEUE_FLAG_ADD_RANDOM 10/* Contributes to random pool */ #define QUEUE_FLAG_SAME_FORCE 12/* force complete on same CPU */ +#define QUEUE_FLAG_HW_WC 18/* Write back caching supported */ #define QUEUE_FLAG_INIT_DONE 14/* queue is initialized */ #define QUEUE_FLAG_STABLE_WRITES 15/* don't modify blks until WB is done */ #define QUEUE_FLAG_POLL 16/* IO polling enabled if set */
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 263/600 x86/mm: Fix PAT bit missing from page protection modify mask
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Janusz Krzysztofik <[email protected]>
[ Upstream commit 548cb932051fb6232ac983ed6673dae7bdf3cf4c ]
Visible glitches have been observed when running graphics applications on Linux under Xen hypervisor. Those observations have been confirmed with failures from kms_pwrite_crc Intel GPU test that verifies data coherency of DRM frame buffer objects using hardware CRC checksums calculated by display controllers, exposed to userspace via debugfs. Affected processing paths have then been identified with new IGT test variants that mmap the objects using different methods and caching modes [1].
When running as a Xen PV guest, Linux uses Xen provided PAT configuration which is different from its native one. In particular, Xen specific PTE encoding of write-combining caching, likely used by graphics applications, differs from the Linux default one found among statically defined minimal set of supported modes. Since Xen defines PTE encoding of the WC mode as _PAGE_PAT, it no longer belongs to the minimal set, depends on correct handling of _PAGE_PAT bit, and can be mismatched with write-back caching.
When a user calls mmap() for a DRM buffer object, DRM device specific .mmap file operation, called from mmap_region(), takes care of setting PTE encoding bits in a vm_page_prot field of an associated virtual memory area structure. Unfortunately, _PAGE_PAT bit is not preserved when the vma's .vm_flags are then applied to .vm_page_prot via vm_set_page_prot(). Bits to be preserved are determined with _PAGE_CHG_MASK symbol that doesn't cover _PAGE_PAT. As a consequence, WB caching is requested instead of WC when running under Xen (also, WP is silently changed to WT, and UC downgraded to UC_MINUS). When running on bare metal, WC is not affected, but WP and WT extra modes are unintentionally replaced with WC and UC, respectively.
WP and WT modes, encoded with _PAGE_PAT bit set, were introduced by commit 281d4078bec3 ("x86: Make page cache mode a real type"). Care was taken to extend _PAGE_CACHE_MASK symbol with that additional bit, but that symbol has never been used for identification of bits preserved when applying page protection flags. Support for all cache modes under Xen, including the problematic WC mode, was then introduced by commit 47591df50512 ("xen: Support Xen pv-domains using PAT").
The issue needs to be fixed by including _PAGE_PAT bit into a bitmask used by pgprot_modify() for selecting bits to be preserved. We can do that either internally to pgprot_modify() (as initially proposed), or by making _PAGE_PAT a part of _PAGE_CHG_MASK. If we go for the latter then, since _PAGE_PAT is the same as _PAGE_PSE, we need to note that _HPAGE_CHG_MASK -- a huge pmds' counterpart of _PAGE_CHG_MASK, introduced by commit c489f1257b8c ("thp: add pmd_modify"), defined as (_PAGE_CHG_MASK | _PAGE_PSE) -- will no longer differ from _PAGE_CHG_MASK. If such modification of _PAGE_CHG_MASK was irrelevant to its users then one might wonder why that new _HPAGE_CHG_MASK symbol was introduced instead of reusing the existing one with that otherwise irrelevant bit (_PAGE_PSE in that case) added.
Add _PAGE_PAT to _PAGE_CHG_MASK and _PAGE_PAT_LARGE to _HPAGE_CHG_MASK for symmetry. Split out common bits from both symbols to a common symbol for clarity.
[ dhansen: tweak the solution changelog description ]
[1] https://gitlab.freedesktop.org/drm/igt-gpu-tools/-/commit/0f0754413f14
--- arch/x86/include/asm/pgtable_types.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
arch/x86/include/asm/pgtable_types.h +6 -5
@@ -125,11 +125,12 @@* instance, and is *not* included in this mask since * pte_modify() does modify it. */ -#define _PAGE_CHG_MASK (PTE_PFN_MASK | _PAGE_PCD | _PAGE_PWT | \ - _PAGE_SPECIAL | _PAGE_ACCESSED | _PAGE_DIRTY | \ - _PAGE_SOFT_DIRTY | _PAGE_DEVMAP | _PAGE_ENC | \ - _PAGE_UFFD_WP) -#define _HPAGE_CHG_MASK (_PAGE_CHG_MASK | _PAGE_PSE) +#define _COMMON_PAGE_CHG_MASK (PTE_PFN_MASK | _PAGE_PCD | _PAGE_PWT | \ + _PAGE_SPECIAL | _PAGE_ACCESSED | _PAGE_DIRTY |\ + _PAGE_SOFT_DIRTY | _PAGE_DEVMAP | _PAGE_ENC | \ + _PAGE_UFFD_WP) +#define _PAGE_CHG_MASK (_COMMON_PAGE_CHG_MASK | _PAGE_PAT) +#define _HPAGE_CHG_MASK (_COMMON_PAGE_CHG_MASK | _PAGE_PSE | _PAGE_PAT_LARGE)/* * The cache modes defined here are used to translate between pure SW usage
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 264/600 drm/bridge: anx7625: Use common macros for DP power sequencing commands
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen-Yu Tsai <[email protected]>
[ Upstream commit 2ba776f903cb7157e80b5f314fb0b4faf6ea6958 ]
The DRM DP code has macros for the DP power sequencing commands. Use them in the anx7625 driver instead of raw numbers.
--- drivers/gpu/drm/bridge/analogix/anx7625.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/bridge/analogix/anx7625.c +4 -4
@@ -933,8 +933,8 @@ static void anx7625_dp_start(struct anx7625_data *ctx)dev_dbg (dev,"set downstream sink into normal\n" );/* Downstream sink enter into normal mode */ - data =1 ; - ret =anx7625_aux_trans (ctx,DP_AUX_NATIVE_WRITE ,0x000600 ,1 , &data); + data =DP_SET_POWER_D0 ; + ret =anx7625_aux_trans (ctx,DP_AUX_NATIVE_WRITE ,DP_SET_POWER ,1 , &data);if (ret <0 )dev_err (dev,"IO error : set sink into normal mode fail\n" );
@@ -973,8 +973,8 @@ static void anx7625_dp_stop(struct anx7625_data *ctx)dev_dbg (dev,"notify downstream enter into standby\n" );/* Downstream monitor enter into standby mode */ - data =2 ; - ret |=anx7625_aux_trans (ctx,DP_AUX_NATIVE_WRITE ,0x000600 ,1 , &data); + data =DP_SET_POWER_D3 ; + ret |=anx7625_aux_trans (ctx,DP_AUX_NATIVE_WRITE ,DP_SET_POWER ,1 , &data);if (ret <0 )DRM_DEV_ERROR (dev,"IO error : mute video fail\n" );
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 265/600 drm/bridge: anx7625: Use common macros for HDCP capabilities
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen-Yu Tsai <[email protected]>
[ Upstream commit 41639b3a8b0f1f194dfe0577d99db70613f78626 ]
The DRM DP code has macros for the DP HDCP capabilities. Use them in the anx7625 driver instead of raw numbers.
--- drivers/gpu/drm/bridge/analogix/anx7625.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/bridge/analogix/anx7625.c +2 -2
@@ -874,11 +874,11 @@ static int anx7625_hdcp_enable(struct anx7625_data *ctx) }/* Read downstream capability */ - ret =anx7625_aux_trans (ctx,DP_AUX_NATIVE_READ ,0x68028 ,1 , &bcap); + ret =anx7625_aux_trans (ctx,DP_AUX_NATIVE_READ ,DP_AUX_HDCP_BCAPS ,1 , &bcap);if (ret <0 )return ret; -if (!(bcap &0x01 )) { +if (!(bcap &DP_BCAPS_HDCP_CAPABLE )) {pr_warn ("downstream not support HDCP 1.4, cap(%x).\n" , bcap);return 0 ; }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 266/600 ARM: dts: samsung: s3c6410-mini6410: correct ethernet reg addresses (split)
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
[ Upstream commit cf0cb2af6a18f28b84f9f1416bff50ca60d6e98a ]
The davicom,dm9000 Ethernet Controller accepts two reg addresses.
--- arch/arm/boot/dts/s3c6410-mini6410.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/s3c6410-mini6410.dts +1 -1
@@ -51,7 +51,7 @@ srom-cs1-bus@18000000 { ethernet@18000000 { compatible = "davicom,dm9000"; - reg = <0x18000000 0x2 0x18000004 0x2>; + reg = <0x18000000 0x2>, <0x18000004 0x2>; interrupt-parent = <&gpn>; interrupts = <7 IRQ_TYPE_LEVEL_HIGH>; davicom,no-eeprom;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 267/600 ARM: dts: s5pv210: add dummy 5V regulator for backlight on SMDKv210
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
[ Upstream commit b77904ba177a9c67b6dbc3637fdf1faa22df6e5c ]
Backlight is supplied by DC5V regulator. The DTS has no PMIC node, so just add a regulator-fixed to solve it and fix dtbs_check warning:
s5pv210-smdkv210.dtb: backlight: 'power-supply' is a required property
Stable-dep-of: 982655cb0e7f ("ARM: dts: samsung: s5pv210-smdkv210: correct ethernet reg addresses (split)")
--- arch/arm/boot/dts/s5pv210-smdkv210.dts | 8 ++++++++ 1 file changed, 8 insertions(+)
arch/arm/boot/dts/s5pv210-smdkv210.dts +8 -0
@@ -55,6 +55,14 @@ backlight { default-brightness-level = <6>; pinctrl-names = "default"; pinctrl-0 = <&pwm3_out>; + power-supply = <&dc5v_reg>; + }; + + dc5v_reg: regulator-0 { + compatible = "regulator-fixed"; + regulator-name = "DC5V"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; }; };
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 268/600 ARM: dts: samsung: s5pv210-smdkv210: correct ethernet reg addresses (split)
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
[ Upstream commit 982655cb0e7f18934d7532c32366e574ad61dbd7 ]
The davicom,dm9000 Ethernet Controller accepts two reg addresses.
--- arch/arm/boot/dts/s5pv210-smdkv210.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/s5pv210-smdkv210.dts +1 -1
@@ -41,7 +41,7 @@ pmic_ap_clk: clock-0 { ethernet@a8000000 { compatible = "davicom,dm9000"; - reg = <0xA8000000 0x2 0xA8000002 0x2>; + reg = <0xa8000000 0x2>, <0xa8000002 0x2>; interrupt-parent = <&gph1>; interrupts = <1 IRQ_TYPE_LEVEL_HIGH>; local-mac-address = [00 00 de ad be ef];
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 269/600 drm: adv7511: Fix low refresh rate register for ADV7533/5
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bogdan Togorean <[email protected]>
[ Upstream commit d281eeaa4de2636ff0c8e6ae387bb07b50e5fcbb ]
For ADV7533 and ADV7535 low refresh rate is selected using bits [3:2] of 0x4a main register.
So depending on ADV model write 0xfb or 0x4a register.
--- drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +7 -2
@@ -786,8 +786,13 @@ static void adv7511_mode_set(struct adv7511 *adv7511,else low_refresh_rate =ADV7511_LOW_REFRESH_RATE_NONE ; -regmap_update_bits (adv7511->regmap,0xfb , -0x6 , low_refresh_rate <<1 ); +if (adv7511->type ==ADV7511 ) +regmap_update_bits (adv7511->regmap,0xfb , +0x6 , low_refresh_rate <<1 ); +else +regmap_update_bits (adv7511->regmap,0x4a , +0xc , low_refresh_rate <<2 ); +regmap_update_bits (adv7511->regmap,0x17 ,0x60 , (vsync_polarity <<6 ) | (hsync_polarity <<5 ));
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 270/600 ARM: dts: BCM53573: Fix Ethernet info for Luxul devices
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rafał Miłecki <[email protected]>
[ Upstream commit 44ad8207806973f4e4f7d870fff36cc01f494250 ]
Both Luxul's XAP devices (XAP-810 and XAP-1440) are access points that use a non-default design. They don't include switch but have a single Ethernet port and BCM54210E PHY connected to the Ethernet controller's MDIO bus.
Support for those devices regressed due to two changes:
1. Describing MDIO bus with switch
After commit 9fb90ae6cae7 ("ARM: dts: BCM53573: Describe on-SoC BCM53125 rev 4 switch") Linux stopped probing for MDIO devices.
2. Dropping hardcoded BCM54210E delays
In commit fea7fda7f50a ("net: phy: broadcom: Fix RGMII delays configuration for BCM54210E") support for other PHY modes was added but that requires a proper "phy-mode" value in DT.
Both above changes are correct (they don't need to be reverted or anything) but they need this fix for DT data to be correct and for Linux to work properly.
--- arch/arm/boot/dts/bcm47189-luxul-xap-1440.dts | 13 +++++++++++++ arch/arm/boot/dts/bcm47189-luxul-xap-810.dts | 13 +++++++++++++ 2 files changed, 26 insertions(+)
arch/arm/boot/dts/bcm47189-luxul-xap-1440.dts +13 -0
@@ -46,3 +46,16 @@ button-restart { }; }; }; + +&gmac0 { + phy-mode = "rgmii"; + phy-handle = <&bcm54210e>; + + mdio { + /delete-node/ switch@1e; + + bcm54210e: ethernet-phy@0 { + reg = <0>; + }; + }; +};
arch/arm/boot/dts/bcm47189-luxul-xap-810.dts +13 -0
@@ -83,3 +83,16 @@ pcie0_chipcommon: chipcommon@0 { }; }; }; + +&gmac0 { + phy-mode = "rgmii"; + phy-handle = <&bcm54210e>; + + mdio { + /delete-node/ switch@1e; + + bcm54210e: ethernet-phy@0 { + reg = <0>; + }; + }; +};
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 271/600 arm64: dts: qcom: sdm845: Add missing RPMh power domain to GCC
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manivannan Sadhasivam <[email protected]>
[ Upstream commit 4b6ea15c0a1122422b44bf6c47a3c22fc8d46777 ]
GCC and it's GDSCs are under the RPMh CX power domain. So let's add the missing RPMh power domain to the GCC node.
--- arch/arm64/boot/dts/qcom/sdm845.dtsi | 1 + 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/qcom/sdm845.dtsi +1 -0
@@ -1099,6 +1099,7 @@ gcc: clock-controller@100000 { #clock-cells = <1>; #reset-cells = <1>; #power-domain-cells = <1>; + power-domains = <&rpmhpd SDM845_CX>; }; qfprom@784000 {
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 272/600 arm64: dts: qcom: sdm845: Fix the min frequency of "ice_core_clk"
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manivannan Sadhasivam <[email protected]>
[ Upstream commit bbbef6e24bc4493602df68b052f6f48d48e3184a ]
Minimum frequency of the "ice_core_clk" should be 75MHz as specified in the downstream vendor devicetree. So fix it!
--- arch/arm64/boot/dts/qcom/sdm845.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/sdm845.dtsi +1 -1
@@ -2521,7 +2521,7 @@ ufs_mem_hc: ufshc@1d84000 { <0 0>, <0 0>, <0 0>, - <0 300000000>; + <75000000 300000000>; status = "disabled"; };
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 273/600 arm64: dts: qcom: msm8996-gemini: fix touchscreen VIO supply
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
[ Upstream commit 21fc24ee9c5943732c9ae538766c9be93d70d936 ]
According to bindings and Linux driver, there is no VDDA but VIO supply.
--- arch/arm64/boot/dts/qcom/msm8996-xiaomi-gemini.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/msm8996-xiaomi-gemini.dts +1 -1
@@ -81,7 +81,7 @@ synaptics@20 { #size-cells = <0>; interrupt-parent = <&tlmm>; interrupts = <125 IRQ_TYPE_LEVEL_LOW>; - vdda-supply = <&vreg_l6a_1p8>; + vio-supply = <&vreg_l6a_1p8>; vdd-supply = <&vdd_3v2_tp>; reset-gpios = <&tlmm 89 GPIO_ACTIVE_LOW>;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 274/600 drm/amdgpu: Update min() to min_t() in amdgpu_info_ioctl
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Srinivasan Shanmugam <[email protected]>
[ Upstream commit a0cc8e1512ad72c9f97cdcb76d42715730adaf62 ]
Fixes the following:
WARNING: min() should probably be min_t(size_t, size, sizeof(ip))
+ ret = copy_to_user(out, &ip, min((size_t)size, sizeof(ip)));
And other style fixes:
WARNING: Prefer 'unsigned int' to bare use of 'unsigned'
WARNING: Missing a blank line after declarations
--- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +8 -6
@@ -554,6 +554,7 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) crtc = (struct drm_crtc *)minfo->crtcs[i];if (crtc && crtc->base.id == info->mode_crtc.id) {struct amdgpu_crtc *amdgpu_crtc =to_amdgpu_crtc (crtc); + ui32 = amdgpu_crtc->crtc_id; found =1 ;break ;
@@ -572,7 +573,7 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)if (ret)return ret; - ret =copy_to_user (out, &ip,min ((size_t )size,sizeof (ip))); + ret =copy_to_user (out, &ip,min_t (size_t, size,sizeof (ip)));return ret ? -EFAULT :0 ; }case AMDGPU_INFO_HW_IP_COUNT : {
@@ -718,17 +719,18 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) ? -EFAULT :0 ; }case AMDGPU_INFO_READ_MMR_REG : { -unsigned n, alloc_size; +unsigned int n, alloc_size;uint32_t *regs; -unsigned se_num = (info->read_mmr_reg.instance >> +unsigned int se_num = (info->read_mmr_reg.instance >>AMDGPU_INFO_MMR_SE_INDEX_SHIFT ) &AMDGPU_INFO_MMR_SE_INDEX_MASK ; -unsigned sh_num = (info->read_mmr_reg.instance >> +unsigned int sh_num = (info->read_mmr_reg.instance >>AMDGPU_INFO_MMR_SH_INDEX_SHIFT ) &AMDGPU_INFO_MMR_SH_INDEX_MASK ;/* set full masks if the userspace set all bits -* in the bitfields */ +* in the bitfields +*/ if (se_num ==AMDGPU_INFO_MMR_SE_INDEX_MASK ) se_num =0xffffffff ;else if (se_num >=AMDGPU_GFX_MAX_SE )
@@ -852,7 +854,7 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)return ret; }case AMDGPU_INFO_VCE_CLOCK_TABLE : { -unsigned i; +unsigned int i;struct drm_amdgpu_info_vce_clock_table vce_clk_table = {};struct amd_vce_state *vce_state;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 275/600 md: Factor out is_md_suspended helper
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xiao Ni <[email protected]>
[ Upstream commit d19329133d25ad3dc32f8a62635692cb2f189014 ]
This helper function will be used in next patch. It's easy for understanding.
Stable-dep-of: e24ed04389f9 ("md: restore 'noio_flag' for the last mddev_resume()")
--- drivers/md/md.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)
drivers/md/md.c +12 -5
@@ -368,6 +368,13 @@ EXPORT_SYMBOL_GPL(md_new_event);static LIST_HEAD (all_mddevs);static DEFINE_SPINLOCK (all_mddevs_lock); +static bool is_md_suspended (struct mddev *mddev) +{ +if (mddev->suspended) +return true; +else +return false; +}/* Rather than calling directly into the personality make_request function, * IO requests come here first so that we can check if the device is * being suspended pending a reconfiguration.
@@ -377,7 +384,7 @@ static DEFINE_SPINLOCK(all_mddevs_lock);*/ static bool is_suspended (struct mddev *mddev,struct bio *bio) { -if (mddev->suspended) +if (is_md_suspended (mddev))return true;if (bio_data_dir (bio) !=WRITE )return false;
@@ -422,7 +429,7 @@ void md_handle_request(struct mddev *mddev, struct bio *bio) goto check_suspended; } -if (atomic_dec_and_test (&mddev->active_io) && mddev->suspended) +if (atomic_dec_and_test (&mddev->active_io) &&is_md_suspended (mddev))wake_up (&mddev->sb_wait); }EXPORT_SYMBOL (md_handle_request);
@@ -6238,7 +6245,7 @@ EXPORT_SYMBOL_GPL(md_stop_writes);static void mddev_detach (struct mddev *mddev) {md_bitmap_wait_behind_writes (mddev); -if (mddev->pers && mddev->pers->quiesce && !mddev->suspended) { +if (mddev->pers && mddev->pers->quiesce && !is_md_suspended (mddev)) { mddev->pers->quiesce (mddev,1 ); mddev->pers->quiesce (mddev,0 ); }
@@ -8548,7 +8555,7 @@ bool md_write_start(struct mddev *mddev, struct bio *bi)return true;wait_event (mddev->sb_wait, !test_bit (MD_SB_CHANGE_PENDING , &mddev->sb_flags) || - mddev->suspended); +is_md_suspended (mddev));if (test_bit (MD_SB_CHANGE_PENDING , &mddev->sb_flags)) {percpu_ref_put (&mddev->writes_pending);return false;
@@ -9276,7 +9283,7 @@ void md_check_recovery(struct mddev *mddev)wake_up (&mddev->sb_wait); } -if (mddev->suspended) +if (is_md_suspended (mddev))return ;if (mddev->bitmap)
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 276/600 md: Change active_io to percpu
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xiao Ni <[email protected]>
[ Upstream commit 72adae23a72cb12e2ef0dcd7c0aa042867f27998 ]
Now the type of active_io is atomic. It's used to count how many ios are in the submitting process and it's added and decreased very time. But it only needs to check if it's zero when suspending the raid. So we can switch atomic to percpu to improve the performance.
After switching active_io to percpu type, we use the state of active_io to judge if the raid device is suspended. And we don't need to wake up ->sb_wait in md_handle_request anymore. It's done in the callback function which is registered when initing active_io. The argument mddev->suspended is only used to count how many users are trying to set raid to suspend state.
Stable-dep-of: e24ed04389f9 ("md: restore 'noio_flag' for the last mddev_resume()")
--- drivers/md/md.c | 43 ++++++++++++++++++++++++------------------- drivers/md/md.h | 2 +- 2 files changed, 25 insertions(+), 20 deletions(-)
drivers/md/md.c +24 -19
@@ -370,10 +370,7 @@ static DEFINE_SPINLOCK(all_mddevs_lock);static bool is_md_suspended (struct mddev *mddev) { -if (mddev->suspended) -return true; -else -return false; +return percpu_ref_is_dying (&mddev->active_io); }/* Rather than calling directly into the personality make_request function, * IO requests come here first so that we can check if the device is
@@ -400,12 +397,10 @@ static bool is_suspended(struct mddev *mddev, struct bio *bio)void md_handle_request (struct mddev *mddev,struct bio *bio) { check_suspended: -rcu_read_lock ();if (is_suspended (mddev, bio)) {DEFINE_WAIT (__wait);/* Bail out if REQ_NOWAIT is set for the bio */ if (bio->bi_opf &REQ_NOWAIT ) { -rcu_read_unlock ();bio_wouldblock_error (bio);return ; }
@@ -414,23 +409,19 @@ void md_handle_request(struct mddev *mddev, struct bio *bio) TASK_UNINTERRUPTIBLE);if (!is_suspended (mddev, bio))break ; -rcu_read_unlock ();schedule (); -rcu_read_lock (); }finish_wait (&mddev->sb_wait, &__wait); } -atomic_inc (&mddev->active_io); -rcu_read_unlock (); +if (!percpu_ref_tryget_live (&mddev->active_io)) + goto check_suspended;if (!mddev->pers->make_request (mddev, bio)) { -atomic_dec (&mddev->active_io); -wake_up (&mddev->sb_wait); +percpu_ref_put (&mddev->active_io); goto check_suspended; } -if (atomic_dec_and_test (&mddev->active_io) &&is_md_suspended (mddev)) -wake_up (&mddev->sb_wait); +percpu_ref_put (&mddev->active_io); }EXPORT_SYMBOL (md_handle_request);
@@ -478,11 +469,10 @@ void mddev_suspend(struct mddev *mddev)lockdep_assert_held (&mddev->reconfig_mutex);if (mddev->suspended++)return ; -synchronize_rcu ();wake_up (&mddev->sb_wait);set_bit (MD_ALLOW_SB_UPDATE , &mddev->flags); -smp_mb__after_atomic (); -wait_event (mddev->sb_wait,atomic_read (&mddev->active_io) ==0 ); +percpu_ref_kill (&mddev->active_io); +wait_event (mddev->sb_wait,percpu_ref_is_zero (&mddev->active_io)); mddev->pers->quiesce (mddev,1 );clear_bit_unlock (MD_ALLOW_SB_UPDATE , &mddev->flags);wait_event (mddev->sb_wait, !test_bit (MD_UPDATING_SB , &mddev->flags));
@@ -500,6 +490,7 @@ void mddev_resume(struct mddev *mddev)lockdep_assert_held (&mddev->reconfig_mutex);if (--mddev->suspended)return ; +percpu_ref_resurrect (&mddev->active_io);wake_up (&mddev->sb_wait); mddev->pers->quiesce (mddev,0 );
@@ -678,7 +669,6 @@ void mddev_init(struct mddev *mddev)timer_setup (&mddev->safemode_timer, md_safemode_timeout,0 );atomic_set (&mddev->active,1 );atomic_set (&mddev->openers,0 ); -atomic_set (&mddev->active_io,0 );spin_lock_init (&mddev->lock);atomic_set (&mddev->flush_pending,0 );init_waitqueue_head (&mddev->sb_wait);
@@ -5786,6 +5776,12 @@ static void md_safemode_timeout(struct timer_list *t) }static int start_dirty_degraded; +static void active_io_release (struct percpu_ref *ref) +{ + struct mddev *mddev = container_of(ref, struct mddev, active_io); + +wake_up (&mddev->sb_wait); +}int md_run (struct mddev *mddev) {
@@ -5866,10 +5862,15 @@ int md_run(struct mddev *mddev) nowait = nowait &&bdev_nowait (rdev->bdev); } + err =percpu_ref_init (&mddev->active_io, active_io_release, +PERCPU_REF_ALLOW_REINIT ,GFP_KERNEL ); +if (err) +return err; +if (!bioset_initialized (&mddev->bio_set)) { err =bioset_init (&mddev->bio_set,BIO_POOL_SIZE ,0 ,BIOSET_NEED_BVECS );if (err) -return err; + goto exit_active_io; }if (!bioset_initialized (&mddev->sync_set)) { err =bioset_init (&mddev->sync_set,BIO_POOL_SIZE ,0 ,BIOSET_NEED_BVECS );
@@ -6057,6 +6058,8 @@ int md_run(struct mddev *mddev)bioset_exit (&mddev->sync_set); exit_bio_set:bioset_exit (&mddev->bio_set); +exit_active_io: +percpu_ref_exit (&mddev->active_io);return err; }EXPORT_SYMBOL_GPL (md_run);
@@ -6283,6 +6286,7 @@ void md_stop(struct mddev *mddev)*/ __md_stop_writes (mddev);__md_stop (mddev); +percpu_ref_exit (&mddev->active_io);bioset_exit (&mddev->bio_set);bioset_exit (&mddev->sync_set); }
@@ -7852,6 +7856,7 @@ static void md_free_disk(struct gendisk *disk)struct mddev *mddev = disk->private_data;percpu_ref_exit (&mddev->writes_pending); +percpu_ref_exit (&mddev->active_io);bioset_exit (&mddev->bio_set);bioset_exit (&mddev->sync_set);
drivers/md/md.h +1 -1
@@ -315,7 +315,7 @@ struct mddev {unsigned long sb_flags;int suspended; -atomic_t active_io; +struct percpu_ref active_io;int ro;int sysfs_active;/* set when sysfs deletes * are happening, so run/
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 277/600 md: restore noio_flag for the last mddev_resume()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yu Kuai <[email protected]>
[ Upstream commit e24ed04389f9619e0aaef615a8948633c182a8b0 ]
memalloc_noio_save() is called for the first mddev_suspend(), and repeated mddev_suspend() only increase 'suspended'. However, memalloc_noio_restore() is also called for the first mddev_resume(), which means that memory reclaim will be enabled before the last mddev_resume() is called, while the array is still suspended.
Fix this problem by restore 'noio_flag' for the last mddev_resume().
--- drivers/md/md.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/md/md.c +4 -2
@@ -485,11 +485,13 @@ EXPORT_SYMBOL_GPL(mddev_suspend);void mddev_resume (struct mddev *mddev) { -/* entred the memalloc scope from mddev_suspend() */ -memalloc_noio_restore (mddev->noio_flag);lockdep_assert_held (&mddev->reconfig_mutex);if (--mddev->suspended)return ; + +/* entred the memalloc scope from mddev_suspend() */ +memalloc_noio_restore (mddev->noio_flag); +percpu_ref_resurrect (&mddev->active_io);wake_up (&mddev->sb_wait); mddev->pers->quiesce (mddev,0 );
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 278/600 md/raid10: factor out dereference_rdev_and_rrdev()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Li Nan <[email protected]>
[ Upstream commit b99f8fd2d91eb734f13098aa1cf337edaca454b7 ]
Factor out a helper to get 'rdev' and 'replacement' from config->mirrors. Just to make code cleaner and prepare to fix the bug of io loss while 'replacement' replace 'rdev'.
There is no functional change.
Stable-dep-of: 673643490b9a ("md/raid10: use dereference_rdev_and_rrdev() to get devices")
--- drivers/md/raid10.c | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-)
drivers/md/raid10.c +20 -9
@@ -1317,6 +1317,25 @@ static void raid10_write_one_disk(struct mddev *mddev, struct r10bio *r10_bio, } } +static struct md_rdev *dereference_rdev_and_rrdev (struct raid10_info *mirror, +struct md_rdev **prrdev) +{ +struct md_rdev *rdev, *rrdev; + + rrdev =rcu_dereference (mirror->replacement); +/* +* Read replacement first to prevent reading both rdev and +* replacement as NULL during replacement replace rdev. +*/ +smp_mb (); + rdev =rcu_dereference (mirror->rdev); +if (rdev == rrdev) + rrdev =NULL ; + + *prrdev = rrdev; +return rdev; +} +static void wait_blocked_dev (struct mddev *mddev,struct r10bio *r10_bio) {int i;
@@ -1460,15 +1479,7 @@ static void raid10_write_request(struct mddev *mddev, struct bio *bio,int d = r10_bio->devs[i].devnum;struct md_rdev *rdev, *rrdev; - rrdev =rcu_dereference (conf->mirrors[d].replacement); -/* -* Read replacement first to prevent reading both rdev and -* replacement as NULL during replacement replace rdev. -*/ -smp_mb (); - rdev =rcu_dereference (conf->mirrors[d].rdev); -if (rdev == rrdev) - rrdev =NULL ; + rdev =dereference_rdev_and_rrdev (&conf->mirrors[d], &rrdev);if (rdev && (test_bit (Faulty, &rdev->flags))) rdev =NULL ;if (rrdev && (test_bit (Faulty, &rrdev->flags)))
Signature · 1 line
2.40.1