+++ /dev/null
-From ed717de59dd86eedcc05544515e2362ad31826e5 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 27 May 2022 09:17:39 +0000
-Subject: iio: Directly use ida_alloc()/free()
-
-From: keliu <liuke94@huawei.com>
-
-[ Upstream commit 319dbcd84fd2676afb2bcfee575fbc1fce474ec3 ]
-
-Use ida_alloc()/ida_free() instead of deprecated
-ida_simple_get()/ida_simple_remove() .
-
-Signed-off-by: keliu <liuke94@huawei.com>
-Link: https://lore.kernel.org/r/20220527091739.2949426-1-liuke94@huawei.com
-Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-Stable-dep-of: 2bc9cd66eb25 ("iio: Use per-device lockdep class for mlock")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/iio/industrialio-core.c | 6 +++---
- drivers/iio/industrialio-trigger.c | 6 +++---
- 2 files changed, 6 insertions(+), 6 deletions(-)
-
-diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
-index ed36851d646b..21ca028b3666 100644
---- a/drivers/iio/industrialio-core.c
-+++ b/drivers/iio/industrialio-core.c
-@@ -1647,7 +1647,7 @@ static void iio_dev_release(struct device *device)
-
- iio_device_detach_buffers(indio_dev);
-
-- ida_simple_remove(&iio_ida, iio_dev_opaque->id);
-+ ida_free(&iio_ida, iio_dev_opaque->id);
- kfree(iio_dev_opaque);
- }
-
-@@ -1689,7 +1689,7 @@ struct iio_dev *iio_device_alloc(struct device *parent, int sizeof_priv)
- mutex_init(&iio_dev_opaque->info_exist_lock);
- INIT_LIST_HEAD(&iio_dev_opaque->channel_attr_list);
-
-- iio_dev_opaque->id = ida_simple_get(&iio_ida, 0, 0, GFP_KERNEL);
-+ iio_dev_opaque->id = ida_alloc(&iio_ida, GFP_KERNEL);
- if (iio_dev_opaque->id < 0) {
- /* cannot use a dev_err as the name isn't available */
- pr_err("failed to get device id\n");
-@@ -1698,7 +1698,7 @@ struct iio_dev *iio_device_alloc(struct device *parent, int sizeof_priv)
- }
-
- if (dev_set_name(&indio_dev->dev, "iio:device%d", iio_dev_opaque->id)) {
-- ida_simple_remove(&iio_ida, iio_dev_opaque->id);
-+ ida_free(&iio_ida, iio_dev_opaque->id);
- kfree(iio_dev_opaque);
- return NULL;
- }
-diff --git a/drivers/iio/industrialio-trigger.c b/drivers/iio/industrialio-trigger.c
-index 585b6cef8fcc..1e43e93b5816 100644
---- a/drivers/iio/industrialio-trigger.c
-+++ b/drivers/iio/industrialio-trigger.c
-@@ -71,7 +71,7 @@ int __iio_trigger_register(struct iio_trigger *trig_info,
-
- trig_info->owner = this_mod;
-
-- trig_info->id = ida_simple_get(&iio_trigger_ida, 0, 0, GFP_KERNEL);
-+ trig_info->id = ida_alloc(&iio_trigger_ida, GFP_KERNEL);
- if (trig_info->id < 0)
- return trig_info->id;
-
-@@ -98,7 +98,7 @@ int __iio_trigger_register(struct iio_trigger *trig_info,
- mutex_unlock(&iio_trigger_list_lock);
- device_del(&trig_info->dev);
- error_unregister_id:
-- ida_simple_remove(&iio_trigger_ida, trig_info->id);
-+ ida_free(&iio_trigger_ida, trig_info->id);
- return ret;
- }
- EXPORT_SYMBOL(__iio_trigger_register);
-@@ -109,7 +109,7 @@ void iio_trigger_unregister(struct iio_trigger *trig_info)
- list_del(&trig_info->list);
- mutex_unlock(&iio_trigger_list_lock);
-
-- ida_simple_remove(&iio_trigger_ida, trig_info->id);
-+ ida_free(&iio_trigger_ida, trig_info->id);
- /* Possible issue in here */
- device_del(&trig_info->dev);
- }
---
-2.35.1
-
+++ /dev/null
-From e19912f64dba225e3c4d69acaf0ae10e9d66ea36 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 29 Aug 2022 11:18:40 +0200
-Subject: iio: Use per-device lockdep class for mlock
-
-From: Vincent Whitchurch <vincent.whitchurch@axis.com>
-
-[ Upstream commit 2bc9cd66eb25d0fefbb081421d6586495e25840e ]
-
-If an IIO driver uses callbacks from another IIO driver and calls
-iio_channel_start_all_cb() from one of its buffer setup ops, then
-lockdep complains due to the lock nesting, as in the below example with
-lmp91000.
-
-Since the locks are being taken on different IIO devices, there is no
-actual deadlock. Fix the warning by telling lockdep to use a different
-class for each iio_device.
-
- ============================================
- WARNING: possible recursive locking detected
- --------------------------------------------
- python3/23 is trying to acquire lock:
- (&indio_dev->mlock){+.+.}-{3:3}, at: iio_update_buffers
-
- but task is already holding lock:
- (&indio_dev->mlock){+.+.}-{3:3}, at: enable_store
-
- other info that might help us debug this:
- Possible unsafe locking scenario:
-
- CPU0
- ----
- lock(&indio_dev->mlock);
- lock(&indio_dev->mlock);
-
- *** DEADLOCK ***
-
- May be due to missing lock nesting notation
-
- 5 locks held by python3/23:
- #0: (sb_writers#5){.+.+}-{0:0}, at: ksys_write
- #1: (&of->mutex){+.+.}-{3:3}, at: kernfs_fop_write_iter
- #2: (kn->active#14){.+.+}-{0:0}, at: kernfs_fop_write_iter
- #3: (&indio_dev->mlock){+.+.}-{3:3}, at: enable_store
- #4: (&iio_dev_opaque->info_exist_lock){+.+.}-{3:3}, at: iio_update_buffers
-
- Call Trace:
- __mutex_lock
- iio_update_buffers
- iio_channel_start_all_cb
- lmp91000_buffer_postenable
- __iio_update_buffers
- enable_store
-
-Fixes: 67e17300dc1d76 ("iio: potentiostat: add LMP91000 support")
-Signed-off-by: Vincent Whitchurch <vincent.whitchurch@axis.com>
-Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
-Link: https://lore.kernel.org/r/20220829091840.2791846-1-vincent.whitchurch@axis.com
-Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/iio/industrialio-core.c | 5 +++++
- include/linux/iio/iio-opaque.h | 2 ++
- 2 files changed, 7 insertions(+)
-
-diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
-index 21ca028b3666..30a8bd927d7f 100644
---- a/drivers/iio/industrialio-core.c
-+++ b/drivers/iio/industrialio-core.c
-@@ -1647,6 +1647,8 @@ static void iio_dev_release(struct device *device)
-
- iio_device_detach_buffers(indio_dev);
-
-+ lockdep_unregister_key(&iio_dev_opaque->mlock_key);
-+
- ida_free(&iio_ida, iio_dev_opaque->id);
- kfree(iio_dev_opaque);
- }
-@@ -1706,6 +1708,9 @@ struct iio_dev *iio_device_alloc(struct device *parent, int sizeof_priv)
- INIT_LIST_HEAD(&iio_dev_opaque->buffer_list);
- INIT_LIST_HEAD(&iio_dev_opaque->ioctl_handlers);
-
-+ lockdep_register_key(&iio_dev_opaque->mlock_key);
-+ lockdep_set_class(&indio_dev->mlock, &iio_dev_opaque->mlock_key);
-+
- return indio_dev;
- }
- EXPORT_SYMBOL(iio_device_alloc);
-diff --git a/include/linux/iio/iio-opaque.h b/include/linux/iio/iio-opaque.h
-index 6b3586b3f952..d1f8b30a7c8b 100644
---- a/include/linux/iio/iio-opaque.h
-+++ b/include/linux/iio/iio-opaque.h
-@@ -11,6 +11,7 @@
- * checked by device drivers but should be considered
- * read-only as this is a core internal bit
- * @driver_module: used to make it harder to undercut users
-+ * @mlock_key: lockdep class for iio_dev lock
- * @info_exist_lock: lock to prevent use during removal
- * @trig_readonly: mark the current trigger immutable
- * @event_interface: event chrdevs associated with interrupt lines
-@@ -42,6 +43,7 @@ struct iio_dev_opaque {
- int currentmode;
- int id;
- struct module *driver_module;
-+ struct lock_class_key mlock_key;
- struct mutex info_exist_lock;
- bool trig_readonly;
- struct iio_event_interface *event_interface;
---
-2.35.1
-
+++ /dev/null
-From 72ab021346f9098a7e3b5f5cf19ba084a6d7e3c7 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Sat, 6 Aug 2022 18:20:21 +0800
-Subject: libbpf: Do not require executable permission for shared libraries
-
-From: Hengqi Chen <hengqi.chen@gmail.com>
-
-[ Upstream commit 9e32084ef1c33a87a736d6ce3fcb95b60dac9aa1 ]
-
-Currently, resolve_full_path() requires executable permission for both
-programs and shared libraries. This causes failures on distos like Debian
-since the shared libraries are not installed executable and Linux is not
-requiring shared libraries to have executable permissions. Let's remove
-executable permission check for shared libraries.
-
-Reported-by: Goro Fuji <goro@fastly.com>
-Signed-off-by: Hengqi Chen <hengqi.chen@gmail.com>
-Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
-Link: https://lore.kernel.org/bpf/20220806102021.3867130-1-hengqi.chen@gmail.com
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- tools/lib/bpf/libbpf.c | 8 +++++---
- 1 file changed, 5 insertions(+), 3 deletions(-)
-
-diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
-index f179100d2a61..37b4c8784bfa 100644
---- a/tools/lib/bpf/libbpf.c
-+++ b/tools/lib/bpf/libbpf.c
-@@ -11211,15 +11211,17 @@ static const char *arch_specific_lib_paths(void)
- static int resolve_full_path(const char *file, char *result, size_t result_sz)
- {
- const char *search_paths[3] = {};
-- int i;
-+ int i, perm;
-
- if (str_has_sfx(file, ".so") || strstr(file, ".so.")) {
- search_paths[0] = getenv("LD_LIBRARY_PATH");
- search_paths[1] = "/usr/lib64:/usr/lib";
- search_paths[2] = arch_specific_lib_paths();
-+ perm = R_OK;
- } else {
- search_paths[0] = getenv("PATH");
- search_paths[1] = "/usr/bin:/usr/sbin";
-+ perm = R_OK | X_OK;
- }
-
- for (i = 0; i < ARRAY_SIZE(search_paths); i++) {
-@@ -11238,8 +11240,8 @@ static int resolve_full_path(const char *file, char *result, size_t result_sz)
- if (!seg_len)
- continue;
- snprintf(result, result_sz, "%.*s/%s", seg_len, s, file);
-- /* ensure it is an executable file/link */
-- if (access(result, R_OK | X_OK) < 0)
-+ /* ensure it has required permissions */
-+ if (access(result, perm) < 0)
- continue;
- pr_debug("resolved '%s' to '%s'\n", file, result);
- return 0;
---
-2.35.1
-
+++ /dev/null
-From 0be94f1fb1ca6e96e09481dd9f2b28e773986fbc Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 9 Sep 2022 12:30:52 -0700
-Subject: libbpf: Fix crash if SEC("freplace") programs don't have
- attach_prog_fd set
-
-From: Andrii Nakryiko <andrii@kernel.org>
-
-[ Upstream commit 749c202cb6ea40f4d7ac95c4a1217a7b506f43a8 ]
-
-Fix SIGSEGV caused by libbpf trying to find attach type in vmlinux BTF
-for freplace programs. It's wrong to search in vmlinux BTF and libbpf
-doesn't even mark vmlinux BTF as required for freplace programs. So
-trying to search anything in obj->vmlinux_btf might cause NULL
-dereference if nothing else in BPF object requires vmlinux BTF.
-
-Instead, error out if freplace (EXT) program doesn't specify
-attach_prog_fd during at the load time.
-
-Fixes: 91abb4a6d79d ("libbpf: Support attachment of BPF tracing programs to kernel modules")
-Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
-Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
-Link: https://lore.kernel.org/bpf/20220909193053.577111-3-andrii@kernel.org
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- tools/lib/bpf/libbpf.c | 13 +++++++++----
- 1 file changed, 9 insertions(+), 4 deletions(-)
-
-diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
-index 266357b1dca1..f179100d2a61 100644
---- a/tools/lib/bpf/libbpf.c
-+++ b/tools/lib/bpf/libbpf.c
-@@ -9598,11 +9598,15 @@ static int libbpf_find_attach_btf_id(struct bpf_program *prog, const char *attac
- int err = 0;
-
- /* BPF program's BTF ID */
-- if (attach_prog_fd) {
-+ if (prog->type == BPF_PROG_TYPE_EXT || attach_prog_fd) {
-+ if (!attach_prog_fd) {
-+ pr_warn("prog '%s': attach program FD is not set\n", prog->name);
-+ return -EINVAL;
-+ }
- err = libbpf_find_prog_btf_id(attach_name, attach_prog_fd);
- if (err < 0) {
-- pr_warn("failed to find BPF program (FD %d) BTF ID for '%s': %d\n",
-- attach_prog_fd, attach_name, err);
-+ pr_warn("prog '%s': failed to find BPF program (FD %d) BTF ID for '%s': %d\n",
-+ prog->name, attach_prog_fd, attach_name, err);
- return err;
- }
- *btf_obj_fd = 0;
-@@ -9619,7 +9623,8 @@ static int libbpf_find_attach_btf_id(struct bpf_program *prog, const char *attac
- err = find_kernel_btf_id(prog->obj, attach_name, attach_type, btf_obj_fd, btf_type_id);
- }
- if (err) {
-- pr_warn("failed to find kernel BTF type ID of '%s': %d\n", attach_name, err);
-+ pr_warn("prog '%s': failed to find kernel BTF type ID of '%s': %d\n",
-+ prog->name, attach_name, err);
- return err;
- }
- return 0;
---
-2.35.1
-
+++ /dev/null
-From 9db8e342e53ae8e4c3f81e529dc9423679863bd3 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Sat, 17 Sep 2022 16:48:09 +0800
-Subject: libbpf: Fix NULL pointer exception in API btf_dump__dump_type_data
-
-From: Xin Liu <liuxin350@huawei.com>
-
-[ Upstream commit 7620bffbf72cd66a5d18e444a143b5b5989efa87 ]
-
-We found that function btf_dump__dump_type_data can be called by the
-user as an API, but in this function, the `opts` parameter may be used
-as a null pointer.This causes `opts->indent_str` to trigger a NULL
-pointer exception.
-
-Fixes: 2ce8450ef5a3 ("libbpf: add bpf_object__open_{file, mem} w/ extensible opts")
-Signed-off-by: Xin Liu <liuxin350@huawei.com>
-Signed-off-by: Weibin Kong <kongweibin2@huawei.com>
-Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
-Link: https://lore.kernel.org/bpf/20220917084809.30770-1-liuxin350@huawei.com
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- tools/lib/bpf/btf_dump.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/tools/lib/bpf/btf_dump.c b/tools/lib/bpf/btf_dump.c
-index 6b1bc1f43728..9bad1d00f363 100644
---- a/tools/lib/bpf/btf_dump.c
-+++ b/tools/lib/bpf/btf_dump.c
-@@ -2325,7 +2325,7 @@ int btf_dump__dump_type_data(struct btf_dump *d, __u32 id,
- d->typed_dump->indent_lvl = OPTS_GET(opts, indent_level, 0);
-
- /* default indent string is a tab */
-- if (!opts->indent_str)
-+ if (!OPTS_GET(opts, indent_str, NULL))
- d->typed_dump->indent_str[0] = '\t';
- else
- libbpf_strlcpy(d->typed_dump->indent_str, opts->indent_str,
---
-2.35.1
-
+++ /dev/null
-From 804e8b72dae4def8d6bb59131c471e72a4c9248e Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 30 Sep 2022 17:07:08 +0800
-Subject: libbpf: Fix overrun in netlink attribute iteration
-
-From: Xin Liu <liuxin350@huawei.com>
-
-[ Upstream commit 51e05a8cf8eb34da7473823b7f236a77adfef0b4 ]
-
-I accidentally found that a change in commit 1045b03e07d8 ("netlink: fix
-overrun in attribute iteration") was not synchronized to the function
-`nla_ok` in tools/lib/bpf/nlattr.c, I think it is necessary to modify,
-this patch will do it.
-
-Signed-off-by: Xin Liu <liuxin350@huawei.com>
-Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
-Link: https://lore.kernel.org/bpf/20220930090708.62394-1-liuxin350@huawei.com
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- tools/lib/bpf/nlattr.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/tools/lib/bpf/nlattr.c b/tools/lib/bpf/nlattr.c
-index f57e77a6e40f..3900d052ed19 100644
---- a/tools/lib/bpf/nlattr.c
-+++ b/tools/lib/bpf/nlattr.c
-@@ -32,7 +32,7 @@ static struct nlattr *nla_next(const struct nlattr *nla, int *remaining)
-
- static int nla_ok(const struct nlattr *nla, int remaining)
- {
-- return remaining >= sizeof(*nla) &&
-+ return remaining >= (int)sizeof(*nla) &&
- nla->nla_len >= sizeof(*nla) &&
- nla->nla_len <= remaining;
- }
---
-2.35.1
-
+++ /dev/null
-From 0457975144700445431d089a2d8eac38aa31f523 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Sun, 31 Jul 2022 19:51:09 -0700
-Subject: libbpf: Initialize err in probe_map_create
-
-From: Florian Fainelli <f.fainelli@gmail.com>
-
-[ Upstream commit 3045f42a64324d339125a8a1a1763bb9e1e08300 ]
-
-GCC-11 warns about the possibly unitialized err variable in
-probe_map_create:
-
-libbpf_probes.c: In function 'probe_map_create':
-libbpf_probes.c:361:38: error: 'err' may be used uninitialized in this function [-Werror=maybe-uninitialized]
- 361 | return fd < 0 && err == exp_err ? 1 : 0;
- | ~~~~^~~~~~~~~~
-
-Fixes: 878d8def0603 ("libbpf: Rework feature-probing APIs")
-Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
-Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
-Acked-by: Jiri Olsa <jolsa@kernel.org>
-Link: https://lore.kernel.org/bpf/20220801025109.1206633-1-f.fainelli@gmail.com
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- tools/lib/bpf/libbpf_probes.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/tools/lib/bpf/libbpf_probes.c b/tools/lib/bpf/libbpf_probes.c
-index 97b06cede56f..6cf44e61815d 100644
---- a/tools/lib/bpf/libbpf_probes.c
-+++ b/tools/lib/bpf/libbpf_probes.c
-@@ -247,7 +247,7 @@ static int probe_map_create(enum bpf_map_type map_type, __u32 ifindex)
- LIBBPF_OPTS(bpf_map_create_opts, opts);
- int key_size, value_size, max_entries;
- __u32 btf_key_type_id = 0, btf_value_type_id = 0;
-- int fd = -1, btf_fd = -1, fd_inner = -1, exp_err = 0, err;
-+ int fd = -1, btf_fd = -1, fd_inner = -1, exp_err = 0, err = 0;
-
- opts.map_ifindex = ifindex;
-
---
-2.35.1
-
+++ /dev/null
-From e00889247b3c09ea2aa8010882be1ee5b1fe3de2 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 5 Aug 2022 13:31:54 -0500
-Subject: RDMA/rxe: Set pd early in mr alloc routines
-
-From: Bob Pearson <rpearsonhpe@gmail.com>
-
-[ Upstream commit 58651bbb30f87dab474eff31ab564391aa6ea1f3 ]
-
-Move setting of pd in mr objects ahead of any possible errors so that it
-will always be set in rxe_mr_cleanup() to avoid seg faults when
-rxe_put(mr_pd(mr)) is called.
-
-Fixes: cf40367961d8 ("RDMA/rxe: Move mr cleanup code to rxe_mr_cleanup()")
-Link: https://lore.kernel.org/r/20220805183153.32007-2-rpearsonhpe@gmail.com
-Signed-off-by: Bob Pearson <rpearsonhpe@gmail.com>
-Reviewed-by: Li Zhijian <lizhijian@fujitsu.com>
-Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/infiniband/sw/rxe/rxe_loc.h | 6 +++---
- drivers/infiniband/sw/rxe/rxe_mr.c | 11 ++++-------
- drivers/infiniband/sw/rxe/rxe_verbs.c | 12 +++++++-----
- 3 files changed, 14 insertions(+), 15 deletions(-)
-
-diff --git a/drivers/infiniband/sw/rxe/rxe_loc.h b/drivers/infiniband/sw/rxe/rxe_loc.h
-index d86253c6d6b5..301b8fac2343 100644
---- a/drivers/infiniband/sw/rxe/rxe_loc.h
-+++ b/drivers/infiniband/sw/rxe/rxe_loc.h
-@@ -64,10 +64,10 @@ int rxe_mmap(struct ib_ucontext *context, struct vm_area_struct *vma);
-
- /* rxe_mr.c */
- u8 rxe_get_next_key(u32 last_key);
--void rxe_mr_init_dma(struct rxe_pd *pd, int access, struct rxe_mr *mr);
--int rxe_mr_init_user(struct rxe_pd *pd, u64 start, u64 length, u64 iova,
-+void rxe_mr_init_dma(int access, struct rxe_mr *mr);
-+int rxe_mr_init_user(struct rxe_dev *rxe, u64 start, u64 length, u64 iova,
- int access, struct rxe_mr *mr);
--int rxe_mr_init_fast(struct rxe_pd *pd, int max_pages, struct rxe_mr *mr);
-+int rxe_mr_init_fast(int max_pages, struct rxe_mr *mr);
- int rxe_mr_copy(struct rxe_mr *mr, u64 iova, void *addr, int length,
- enum rxe_mr_copy_dir dir);
- int copy_data(struct rxe_pd *pd, int access, struct rxe_dma_info *dma,
-diff --git a/drivers/infiniband/sw/rxe/rxe_mr.c b/drivers/infiniband/sw/rxe/rxe_mr.c
-index 850b80f5ad8b..af34f198e645 100644
---- a/drivers/infiniband/sw/rxe/rxe_mr.c
-+++ b/drivers/infiniband/sw/rxe/rxe_mr.c
-@@ -103,17 +103,16 @@ static int rxe_mr_alloc(struct rxe_mr *mr, int num_buf)
- return -ENOMEM;
- }
-
--void rxe_mr_init_dma(struct rxe_pd *pd, int access, struct rxe_mr *mr)
-+void rxe_mr_init_dma(int access, struct rxe_mr *mr)
- {
- rxe_mr_init(access, mr);
-
-- mr->ibmr.pd = &pd->ibpd;
- mr->access = access;
- mr->state = RXE_MR_STATE_VALID;
- mr->type = IB_MR_TYPE_DMA;
- }
-
--int rxe_mr_init_user(struct rxe_pd *pd, u64 start, u64 length, u64 iova,
-+int rxe_mr_init_user(struct rxe_dev *rxe, u64 start, u64 length, u64 iova,
- int access, struct rxe_mr *mr)
- {
- struct rxe_map **map;
-@@ -125,7 +124,7 @@ int rxe_mr_init_user(struct rxe_pd *pd, u64 start, u64 length, u64 iova,
- int err;
- int i;
-
-- umem = ib_umem_get(pd->ibpd.device, start, length, access);
-+ umem = ib_umem_get(&rxe->ib_dev, start, length, access);
- if (IS_ERR(umem)) {
- pr_warn("%s: Unable to pin memory region err = %d\n",
- __func__, (int)PTR_ERR(umem));
-@@ -175,7 +174,6 @@ int rxe_mr_init_user(struct rxe_pd *pd, u64 start, u64 length, u64 iova,
- }
- }
-
-- mr->ibmr.pd = &pd->ibpd;
- mr->umem = umem;
- mr->access = access;
- mr->length = length;
-@@ -197,7 +195,7 @@ int rxe_mr_init_user(struct rxe_pd *pd, u64 start, u64 length, u64 iova,
- return err;
- }
-
--int rxe_mr_init_fast(struct rxe_pd *pd, int max_pages, struct rxe_mr *mr)
-+int rxe_mr_init_fast(int max_pages, struct rxe_mr *mr)
- {
- int err;
-
-@@ -208,7 +206,6 @@ int rxe_mr_init_fast(struct rxe_pd *pd, int max_pages, struct rxe_mr *mr)
- if (err)
- goto err1;
-
-- mr->ibmr.pd = &pd->ibpd;
- mr->max_buf = max_pages;
- mr->state = RXE_MR_STATE_FREE;
- mr->type = IB_MR_TYPE_MEM_REG;
-diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.c b/drivers/infiniband/sw/rxe/rxe_verbs.c
-index e264cf69bf55..f54a3eba652f 100644
---- a/drivers/infiniband/sw/rxe/rxe_verbs.c
-+++ b/drivers/infiniband/sw/rxe/rxe_verbs.c
-@@ -903,7 +903,9 @@ static struct ib_mr *rxe_get_dma_mr(struct ib_pd *ibpd, int access)
- return ERR_PTR(-ENOMEM);
-
- rxe_get(pd);
-- rxe_mr_init_dma(pd, access, mr);
-+ mr->ibmr.pd = ibpd;
-+
-+ rxe_mr_init_dma(access, mr);
- rxe_finalize(mr);
-
- return &mr->ibmr;
-@@ -928,8 +930,9 @@ static struct ib_mr *rxe_reg_user_mr(struct ib_pd *ibpd,
-
-
- rxe_get(pd);
-+ mr->ibmr.pd = ibpd;
-
-- err = rxe_mr_init_user(pd, start, length, iova, access, mr);
-+ err = rxe_mr_init_user(rxe, start, length, iova, access, mr);
- if (err)
- goto err3;
-
-@@ -938,7 +941,6 @@ static struct ib_mr *rxe_reg_user_mr(struct ib_pd *ibpd,
- return &mr->ibmr;
-
- err3:
-- rxe_put(pd);
- rxe_cleanup(mr);
- err2:
- return ERR_PTR(err);
-@@ -962,8 +964,9 @@ static struct ib_mr *rxe_alloc_mr(struct ib_pd *ibpd, enum ib_mr_type mr_type,
- }
-
- rxe_get(pd);
-+ mr->ibmr.pd = ibpd;
-
-- err = rxe_mr_init_fast(pd, max_num_sg, mr);
-+ err = rxe_mr_init_fast(max_num_sg, mr);
- if (err)
- goto err2;
-
-@@ -972,7 +975,6 @@ static struct ib_mr *rxe_alloc_mr(struct ib_pd *ibpd, enum ib_mr_type mr_type,
- return &mr->ibmr;
-
- err2:
-- rxe_put(pd);
- rxe_cleanup(mr);
- err1:
- return ERR_PTR(err);
---
-2.35.1
-
+++ /dev/null
-From f776297112ffff04df95795c3ded986b58d886ba Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Sun, 12 Jun 2022 17:34:34 -0500
-Subject: RDMA/rxe: Stop lookup of partially built objects
-
-From: Bob Pearson <rpearsonhpe@gmail.com>
-
-[ Upstream commit 215d0a755e1bcd92cbe6a71a21194ce7c82ec106 ]
-
-Currently the rdma_rxe driver has a security weakness due to giving
-objects which are partially initialized indices allowing external actors
-to gain access to them by sending packets which refer to their
-index (e.g. qpn, rkey, etc) causing unpredictable results.
-
-This patch adds a new API rxe_finalize(obj) which enables looking up pool
-objects from indices using rxe_pool_get_index() for AH, QP, MR, and
-MW. They are added in create verbs only after the objects are fully
-initialized.
-
-It also adds wait for completion to destroy/dealloc verbs to assure that
-all references have been dropped before returning to rdma_core by
-implementing a new rxe_pool API rxe_cleanup() which drops a reference to
-the object and then waits for all other references to be dropped. When
-the last reference is dropped the object is completed by kref. After that
-it cleans up the object and if locally allocated frees the memory. In the
-special case of address handle objects the delay is implemented separately
-if the destroy_ah call is not sleepable.
-
-Combined with deferring cleanup code to type specific cleanup routines
-this allows all pending activity referring to objects to complete before
-returning to rdma_core.
-
-Link: https://lore.kernel.org/r/20220612223434.31462-2-rpearsonhpe@gmail.com
-Signed-off-by: Bob Pearson <rpearsonhpe@gmail.com>
-Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
-Stable-dep-of: 58651bbb30f8 ("RDMA/rxe: Set pd early in mr alloc routines")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/infiniband/sw/rxe/rxe_mr.c | 2 +-
- drivers/infiniband/sw/rxe/rxe_mw.c | 4 +-
- drivers/infiniband/sw/rxe/rxe_pool.c | 100 ++++++++++++++++++++++++--
- drivers/infiniband/sw/rxe/rxe_pool.h | 18 +++--
- drivers/infiniband/sw/rxe/rxe_verbs.c | 39 ++++++----
- 5 files changed, 136 insertions(+), 27 deletions(-)
-
-diff --git a/drivers/infiniband/sw/rxe/rxe_mr.c b/drivers/infiniband/sw/rxe/rxe_mr.c
-index c28b18d59a06..850b80f5ad8b 100644
---- a/drivers/infiniband/sw/rxe/rxe_mr.c
-+++ b/drivers/infiniband/sw/rxe/rxe_mr.c
-@@ -619,7 +619,7 @@ int rxe_dereg_mr(struct ib_mr *ibmr, struct ib_udata *udata)
- if (atomic_read(&mr->num_mw) > 0)
- return -EINVAL;
-
-- rxe_put(mr);
-+ rxe_cleanup(mr);
-
- return 0;
- }
-diff --git a/drivers/infiniband/sw/rxe/rxe_mw.c b/drivers/infiniband/sw/rxe/rxe_mw.c
-index 6c24bc4318e8..ad7ea8fccf11 100644
---- a/drivers/infiniband/sw/rxe/rxe_mw.c
-+++ b/drivers/infiniband/sw/rxe/rxe_mw.c
-@@ -33,6 +33,8 @@ int rxe_alloc_mw(struct ib_mw *ibmw, struct ib_udata *udata)
- RXE_MW_STATE_FREE : RXE_MW_STATE_VALID;
- spin_lock_init(&mw->lock);
-
-+ rxe_finalize(mw);
-+
- return 0;
- }
-
-@@ -40,7 +42,7 @@ int rxe_dealloc_mw(struct ib_mw *ibmw)
- {
- struct rxe_mw *mw = to_rmw(ibmw);
-
-- rxe_put(mw);
-+ rxe_cleanup(mw);
-
- return 0;
- }
-diff --git a/drivers/infiniband/sw/rxe/rxe_pool.c b/drivers/infiniband/sw/rxe/rxe_pool.c
-index e9f3bbd8d605..74eca7f33f3b 100644
---- a/drivers/infiniband/sw/rxe/rxe_pool.c
-+++ b/drivers/infiniband/sw/rxe/rxe_pool.c
-@@ -6,6 +6,7 @@
-
- #include "rxe.h"
-
-+#define RXE_POOL_TIMEOUT (200)
- #define RXE_POOL_ALIGN (16)
-
- static const struct rxe_type_info {
-@@ -136,8 +137,12 @@ void *rxe_alloc(struct rxe_pool *pool)
- elem->pool = pool;
- elem->obj = obj;
- kref_init(&elem->ref_cnt);
-+ init_completion(&elem->complete);
-
-- err = xa_alloc_cyclic(&pool->xa, &elem->index, elem, pool->limit,
-+ /* allocate index in array but leave pointer as NULL so it
-+ * can't be looked up until rxe_finalize() is called
-+ */
-+ err = xa_alloc_cyclic(&pool->xa, &elem->index, NULL, pool->limit,
- &pool->next, GFP_KERNEL);
- if (err < 0)
- goto err_free;
-@@ -151,9 +156,11 @@ void *rxe_alloc(struct rxe_pool *pool)
- return NULL;
- }
-
--int __rxe_add_to_pool(struct rxe_pool *pool, struct rxe_pool_elem *elem)
-+int __rxe_add_to_pool(struct rxe_pool *pool, struct rxe_pool_elem *elem,
-+ bool sleepable)
- {
- int err;
-+ gfp_t gfp_flags;
-
- if (WARN_ON(pool->type == RXE_TYPE_MR))
- return -EINVAL;
-@@ -164,9 +171,18 @@ int __rxe_add_to_pool(struct rxe_pool *pool, struct rxe_pool_elem *elem)
- elem->pool = pool;
- elem->obj = (u8 *)elem - pool->elem_offset;
- kref_init(&elem->ref_cnt);
--
-- err = xa_alloc_cyclic(&pool->xa, &elem->index, elem, pool->limit,
-- &pool->next, GFP_KERNEL);
-+ init_completion(&elem->complete);
-+
-+ /* AH objects are unique in that the create_ah verb
-+ * can be called in atomic context. If the create_ah
-+ * call is not sleepable use GFP_ATOMIC.
-+ */
-+ gfp_flags = sleepable ? GFP_KERNEL : GFP_ATOMIC;
-+
-+ if (sleepable)
-+ might_sleep();
-+ err = xa_alloc_cyclic(&pool->xa, &elem->index, NULL, pool->limit,
-+ &pool->next, gfp_flags);
- if (err < 0)
- goto err_cnt;
-
-@@ -198,9 +214,67 @@ void *rxe_pool_get_index(struct rxe_pool *pool, u32 index)
- static void rxe_elem_release(struct kref *kref)
- {
- struct rxe_pool_elem *elem = container_of(kref, typeof(*elem), ref_cnt);
-+
-+ complete(&elem->complete);
-+}
-+
-+int __rxe_cleanup(struct rxe_pool_elem *elem, bool sleepable)
-+{
- struct rxe_pool *pool = elem->pool;
-+ struct xarray *xa = &pool->xa;
-+ static int timeout = RXE_POOL_TIMEOUT;
-+ unsigned long flags;
-+ int ret, err = 0;
-+ void *xa_ret;
-
-- xa_erase(&pool->xa, elem->index);
-+ if (sleepable)
-+ might_sleep();
-+
-+ /* erase xarray entry to prevent looking up
-+ * the pool elem from its index
-+ */
-+ xa_lock_irqsave(xa, flags);
-+ xa_ret = __xa_erase(xa, elem->index);
-+ xa_unlock_irqrestore(xa, flags);
-+ WARN_ON(xa_err(xa_ret));
-+
-+ /* if this is the last call to rxe_put complete the
-+ * object. It is safe to touch obj->elem after this since
-+ * it is freed below
-+ */
-+ __rxe_put(elem);
-+
-+ /* wait until all references to the object have been
-+ * dropped before final object specific cleanup and
-+ * return to rdma-core
-+ */
-+ if (sleepable) {
-+ if (!completion_done(&elem->complete) && timeout) {
-+ ret = wait_for_completion_timeout(&elem->complete,
-+ timeout);
-+
-+ /* Shouldn't happen. There are still references to
-+ * the object but, rather than deadlock, free the
-+ * object or pass back to rdma-core.
-+ */
-+ if (WARN_ON(!ret))
-+ err = -EINVAL;
-+ }
-+ } else {
-+ unsigned long until = jiffies + timeout;
-+
-+ /* AH objects are unique in that the destroy_ah verb
-+ * can be called in atomic context. This delay
-+ * replaces the wait_for_completion call above
-+ * when the destroy_ah call is not sleepable
-+ */
-+ while (!completion_done(&elem->complete) &&
-+ time_before(jiffies, until))
-+ mdelay(1);
-+
-+ if (WARN_ON(!completion_done(&elem->complete)))
-+ err = -EINVAL;
-+ }
-
- if (pool->cleanup)
- pool->cleanup(elem);
-@@ -209,6 +283,8 @@ static void rxe_elem_release(struct kref *kref)
- kfree(elem->obj);
-
- atomic_dec(&pool->num_elem);
-+
-+ return err;
- }
-
- int __rxe_get(struct rxe_pool_elem *elem)
-@@ -220,3 +296,15 @@ int __rxe_put(struct rxe_pool_elem *elem)
- {
- return kref_put(&elem->ref_cnt, rxe_elem_release);
- }
-+
-+void __rxe_finalize(struct rxe_pool_elem *elem)
-+{
-+ struct xarray *xa = &elem->pool->xa;
-+ unsigned long flags;
-+ void *ret;
-+
-+ xa_lock_irqsave(xa, flags);
-+ ret = __xa_store(&elem->pool->xa, elem->index, elem, GFP_KERNEL);
-+ xa_unlock_irqrestore(xa, flags);
-+ WARN_ON(xa_err(ret));
-+}
-diff --git a/drivers/infiniband/sw/rxe/rxe_pool.h b/drivers/infiniband/sw/rxe/rxe_pool.h
-index 0860660d65ec..9d83cb32092f 100644
---- a/drivers/infiniband/sw/rxe/rxe_pool.h
-+++ b/drivers/infiniband/sw/rxe/rxe_pool.h
-@@ -24,6 +24,7 @@ struct rxe_pool_elem {
- void *obj;
- struct kref ref_cnt;
- struct list_head list;
-+ struct completion complete;
- u32 index;
- };
-
-@@ -57,21 +58,28 @@ void rxe_pool_cleanup(struct rxe_pool *pool);
- void *rxe_alloc(struct rxe_pool *pool);
-
- /* connect already allocated object to pool */
--int __rxe_add_to_pool(struct rxe_pool *pool, struct rxe_pool_elem *elem);
--
--#define rxe_add_to_pool(pool, obj) __rxe_add_to_pool(pool, &(obj)->elem)
-+int __rxe_add_to_pool(struct rxe_pool *pool, struct rxe_pool_elem *elem,
-+ bool sleepable);
-+#define rxe_add_to_pool(pool, obj) __rxe_add_to_pool(pool, &(obj)->elem, true)
-+#define rxe_add_to_pool_ah(pool, obj, sleepable) __rxe_add_to_pool(pool, \
-+ &(obj)->elem, sleepable)
-
- /* lookup an indexed object from index. takes a reference on object */
- void *rxe_pool_get_index(struct rxe_pool *pool, u32 index);
-
- int __rxe_get(struct rxe_pool_elem *elem);
--
- #define rxe_get(obj) __rxe_get(&(obj)->elem)
-
- int __rxe_put(struct rxe_pool_elem *elem);
--
- #define rxe_put(obj) __rxe_put(&(obj)->elem)
-
-+int __rxe_cleanup(struct rxe_pool_elem *elem, bool sleepable);
-+#define rxe_cleanup(obj) __rxe_cleanup(&(obj)->elem, true)
-+#define rxe_cleanup_ah(obj, sleepable) __rxe_cleanup(&(obj)->elem, sleepable)
-+
- #define rxe_read(obj) kref_read(&(obj)->elem.ref_cnt)
-
-+void __rxe_finalize(struct rxe_pool_elem *elem);
-+#define rxe_finalize(obj) __rxe_finalize(&(obj)->elem)
-+
- #endif /* RXE_POOL_H */
-diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.c b/drivers/infiniband/sw/rxe/rxe_verbs.c
-index d2b4e68402d4..e264cf69bf55 100644
---- a/drivers/infiniband/sw/rxe/rxe_verbs.c
-+++ b/drivers/infiniband/sw/rxe/rxe_verbs.c
-@@ -115,7 +115,7 @@ static void rxe_dealloc_ucontext(struct ib_ucontext *ibuc)
- {
- struct rxe_ucontext *uc = to_ruc(ibuc);
-
-- rxe_put(uc);
-+ rxe_cleanup(uc);
- }
-
- static int rxe_port_immutable(struct ib_device *dev, u32 port_num,
-@@ -149,7 +149,7 @@ static int rxe_dealloc_pd(struct ib_pd *ibpd, struct ib_udata *udata)
- {
- struct rxe_pd *pd = to_rpd(ibpd);
-
-- rxe_put(pd);
-+ rxe_cleanup(pd);
- return 0;
- }
-
-@@ -176,7 +176,8 @@ static int rxe_create_ah(struct ib_ah *ibah,
- if (err)
- return err;
-
-- err = rxe_add_to_pool(&rxe->ah_pool, ah);
-+ err = rxe_add_to_pool_ah(&rxe->ah_pool, ah,
-+ init_attr->flags & RDMA_CREATE_AH_SLEEPABLE);
- if (err)
- return err;
-
-@@ -188,7 +189,7 @@ static int rxe_create_ah(struct ib_ah *ibah,
- err = copy_to_user(&uresp->ah_num, &ah->ah_num,
- sizeof(uresp->ah_num));
- if (err) {
-- rxe_put(ah);
-+ rxe_cleanup(ah);
- return -EFAULT;
- }
- } else if (ah->is_user) {
-@@ -197,6 +198,8 @@ static int rxe_create_ah(struct ib_ah *ibah,
- }
-
- rxe_init_av(init_attr->ah_attr, &ah->av);
-+ rxe_finalize(ah);
-+
- return 0;
- }
-
-@@ -228,7 +231,8 @@ static int rxe_destroy_ah(struct ib_ah *ibah, u32 flags)
- {
- struct rxe_ah *ah = to_rah(ibah);
-
-- rxe_put(ah);
-+ rxe_cleanup_ah(ah, flags & RDMA_DESTROY_AH_SLEEPABLE);
-+
- return 0;
- }
-
-@@ -308,12 +312,13 @@ static int rxe_create_srq(struct ib_srq *ibsrq, struct ib_srq_init_attr *init,
-
- err = rxe_srq_from_init(rxe, srq, init, udata, uresp);
- if (err)
-- goto err_put;
-+ goto err_cleanup;
-
- return 0;
-
--err_put:
-- rxe_put(srq);
-+err_cleanup:
-+ rxe_cleanup(srq);
-+
- return err;
- }
-
-@@ -362,7 +367,7 @@ static int rxe_destroy_srq(struct ib_srq *ibsrq, struct ib_udata *udata)
- {
- struct rxe_srq *srq = to_rsrq(ibsrq);
-
-- rxe_put(srq);
-+ rxe_cleanup(srq);
- return 0;
- }
-
-@@ -429,10 +434,11 @@ static int rxe_create_qp(struct ib_qp *ibqp, struct ib_qp_init_attr *init,
- if (err)
- goto qp_init;
-
-+ rxe_finalize(qp);
- return 0;
-
- qp_init:
-- rxe_put(qp);
-+ rxe_cleanup(qp);
- return err;
- }
-
-@@ -485,7 +491,7 @@ static int rxe_destroy_qp(struct ib_qp *ibqp, struct ib_udata *udata)
- if (ret)
- return ret;
-
-- rxe_put(qp);
-+ rxe_cleanup(qp);
- return 0;
- }
-
-@@ -803,7 +809,7 @@ static int rxe_destroy_cq(struct ib_cq *ibcq, struct ib_udata *udata)
-
- rxe_cq_disable(cq);
-
-- rxe_put(cq);
-+ rxe_cleanup(cq);
- return 0;
- }
-
-@@ -898,6 +904,7 @@ static struct ib_mr *rxe_get_dma_mr(struct ib_pd *ibpd, int access)
-
- rxe_get(pd);
- rxe_mr_init_dma(pd, access, mr);
-+ rxe_finalize(mr);
-
- return &mr->ibmr;
- }
-@@ -926,11 +933,13 @@ static struct ib_mr *rxe_reg_user_mr(struct ib_pd *ibpd,
- if (err)
- goto err3;
-
-+ rxe_finalize(mr);
-+
- return &mr->ibmr;
-
- err3:
- rxe_put(pd);
-- rxe_put(mr);
-+ rxe_cleanup(mr);
- err2:
- return ERR_PTR(err);
- }
-@@ -958,11 +967,13 @@ static struct ib_mr *rxe_alloc_mr(struct ib_pd *ibpd, enum ib_mr_type mr_type,
- if (err)
- goto err2;
-
-+ rxe_finalize(mr);
-+
- return &mr->ibmr;
-
- err2:
- rxe_put(pd);
-- rxe_put(mr);
-+ rxe_cleanup(mr);
- err1:
- return ERR_PTR(err);
- }
---
-2.35.1
-
+++ /dev/null
-From 3ebbdd2966382da0d4d34b48b7f9e925e1347dc0 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 5 Sep 2022 21:36:13 +0800
-Subject: selftests/cpu-hotplug: Delete fault injection related code
-
-From: Zhao Gongyi <zhaogongyi@huawei.com>
-
-[ Upstream commit 195d74be717af14e5991f818f73f067367bfc1ed ]
-
-Delete fault injection related code since the module has been deleted.
-
-Signed-off-by: Zhao Gongyi <zhaogongyi@huawei.com>
-Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
-Stable-dep-of: 51d4c851465c ("selftests/cpu-hotplug: Reserve one cpu online at least")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- tools/testing/selftests/cpu-hotplug/config | 1 -
- .../selftests/cpu-hotplug/cpu-on-off-test.sh | 87 ++-----------------
- 2 files changed, 6 insertions(+), 82 deletions(-)
- delete mode 100644 tools/testing/selftests/cpu-hotplug/config
-
-diff --git a/tools/testing/selftests/cpu-hotplug/config b/tools/testing/selftests/cpu-hotplug/config
-deleted file mode 100644
-index d4aca2ad5069..000000000000
---- a/tools/testing/selftests/cpu-hotplug/config
-+++ /dev/null
-@@ -1 +0,0 @@
--CONFIG_NOTIFIER_ERROR_INJECTION=y
-diff --git a/tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh b/tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh
-index 940b68c940bb..32ec7e4489ee 100755
---- a/tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh
-+++ b/tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh
-@@ -116,10 +116,10 @@ online_cpu_expect_fail()
-
- if online_cpu $cpu 2> /dev/null; then
- echo $FUNCNAME $cpu: unexpected success >&2
-- exit 1
-+ retval=1
- elif ! cpu_is_offline $cpu; then
- echo $FUNCNAME $cpu: unexpected online >&2
-- exit 1
-+ retval=1
- fi
- }
-
-@@ -142,16 +142,14 @@ offline_cpu_expect_fail()
-
- if offline_cpu $cpu 2> /dev/null; then
- echo $FUNCNAME $cpu: unexpected success >&2
-- exit 1
-+ retval=1
- elif ! cpu_is_online $cpu; then
- echo $FUNCNAME $cpu: unexpected offline >&2
-- exit 1
-+ retval=1
- fi
- }
-
--error=-12
- allcpus=0
--priority=0
- online_cpus=0
- online_max=0
- offline_cpus=0
-@@ -159,31 +157,20 @@ offline_max=0
- present_cpus=0
- present_max=0
-
--while getopts e:ahp: opt; do
-+while getopts ah opt; do
- case $opt in
-- e)
-- error=$OPTARG
-- ;;
- a)
- allcpus=1
- ;;
- h)
-- echo "Usage $0 [ -a ] [ -e errno ] [ -p notifier-priority ]"
-+ echo "Usage $0 [ -a ]"
- echo -e "\t default offline one cpu"
- echo -e "\t run with -a option to offline all cpus"
- exit
- ;;
-- p)
-- priority=$OPTARG
-- ;;
- esac
- done
-
--if ! [ "$error" -ge -4095 -a "$error" -lt 0 ]; then
-- echo "error code must be -4095 <= errno < 0" >&2
-- exit 1
--fi
--
- prerequisite
-
- #
-@@ -231,66 +218,4 @@ for cpu in `hotplaggable_offline_cpus`; do
- online_cpu_expect_success $cpu
- done
-
--#
--# Test with cpu notifier error injection
--#
--
--DEBUGFS=`mount -t debugfs | head -1 | awk '{ print $3 }'`
--NOTIFIER_ERR_INJECT_DIR=$DEBUGFS/notifier-error-inject/cpu
--
--prerequisite_extra()
--{
-- msg="skip extra tests:"
--
-- /sbin/modprobe -q -r cpu-notifier-error-inject
-- /sbin/modprobe -q cpu-notifier-error-inject priority=$priority
--
-- if [ ! -d "$DEBUGFS" ]; then
-- echo $msg debugfs is not mounted >&2
-- exit $ksft_skip
-- fi
--
-- if [ ! -d $NOTIFIER_ERR_INJECT_DIR ]; then
-- echo $msg cpu-notifier-error-inject module is not available >&2
-- exit $ksft_skip
-- fi
--}
--
--prerequisite_extra
--
--#
--# Offline all hot-pluggable CPUs
--#
--echo 0 > $NOTIFIER_ERR_INJECT_DIR/actions/CPU_DOWN_PREPARE/error
--for cpu in `hotpluggable_online_cpus`; do
-- offline_cpu_expect_success $cpu
--done
--
--#
--# Test CPU hot-add error handling (offline => online)
--#
--echo $error > $NOTIFIER_ERR_INJECT_DIR/actions/CPU_UP_PREPARE/error
--for cpu in `hotplaggable_offline_cpus`; do
-- online_cpu_expect_fail $cpu
--done
--
--#
--# Online all hot-pluggable CPUs
--#
--echo 0 > $NOTIFIER_ERR_INJECT_DIR/actions/CPU_UP_PREPARE/error
--for cpu in `hotplaggable_offline_cpus`; do
-- online_cpu_expect_success $cpu
--done
--
--#
--# Test CPU hot-remove error handling (online => offline)
--#
--echo $error > $NOTIFIER_ERR_INJECT_DIR/actions/CPU_DOWN_PREPARE/error
--for cpu in `hotpluggable_online_cpus`; do
-- offline_cpu_expect_fail $cpu
--done
--
--echo 0 > $NOTIFIER_ERR_INJECT_DIR/actions/CPU_DOWN_PREPARE/error
--/sbin/modprobe -q -r cpu-notifier-error-inject
--
- exit $retval
---
-2.35.1
-
+++ /dev/null
-From e6006d195338689e0c40d3c5e4c13859ca18a7dd Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 5 Sep 2022 21:36:14 +0800
-Subject: selftests/cpu-hotplug: Reserve one cpu online at least
-
-From: Zhao Gongyi <zhaogongyi@huawei.com>
-
-[ Upstream commit 51d4c851465c32143d9c7b1cfb46fc581922b116 ]
-
-Considering that we can not offline all cpus in any cases,
-we need to reserve one cpu online when the test offline all
-hotpluggable online cpus, otherwise the test will fail forever.
-
-Fixes: d89dffa976bc ("fault-injection: add selftests for cpu and memory hotplug")
-
-Signed-off-by: Zhao Gongyi <zhaogongyi@huawei.com>
-Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- .../selftests/cpu-hotplug/cpu-on-off-test.sh | 40 ++++++++++---------
- 1 file changed, 22 insertions(+), 18 deletions(-)
-
-diff --git a/tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh b/tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh
-index 32ec7e4489ee..4c1d6d9abecc 100755
---- a/tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh
-+++ b/tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh
-@@ -149,6 +149,25 @@ offline_cpu_expect_fail()
- fi
- }
-
-+online_all_hot_pluggable_cpus()
-+{
-+ for cpu in `hotplaggable_offline_cpus`; do
-+ online_cpu_expect_success $cpu
-+ done
-+}
-+
-+offline_all_hot_pluggable_cpus()
-+{
-+ local reserve_cpu=$online_max
-+ for cpu in `hotpluggable_online_cpus`; do
-+ # Reserve one cpu oneline at least.
-+ if [ $cpu -eq $reserve_cpu ];then
-+ continue
-+ fi
-+ offline_cpu_expect_success $cpu
-+ done
-+}
-+
- allcpus=0
- online_cpus=0
- online_max=0
-@@ -197,25 +216,10 @@ else
- echo -e "\t online all offline cpus"
- fi
-
--#
--# Online all hot-pluggable CPUs
--#
--for cpu in `hotplaggable_offline_cpus`; do
-- online_cpu_expect_success $cpu
--done
-+online_all_hot_pluggable_cpus
-
--#
--# Offline all hot-pluggable CPUs
--#
--for cpu in `hotpluggable_online_cpus`; do
-- offline_cpu_expect_success $cpu
--done
-+offline_all_hot_pluggable_cpus
-
--#
--# Online all hot-pluggable CPUs again
--#
--for cpu in `hotplaggable_offline_cpus`; do
-- online_cpu_expect_success $cpu
--done
-+online_all_hot_pluggable_cpus
-
- exit $retval
---
-2.35.1
-
+++ /dev/null
-From 76399f911221e984d4c4829293ab97c081b508ce Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 5 Sep 2022 21:36:12 +0800
-Subject: selftests/cpu-hotplug: Use return instead of exit
-
-From: Zhao Gongyi <zhaogongyi@huawei.com>
-
-[ Upstream commit 972cf4ce51ef5532d56822af17defb148aac0ccb ]
-
-Some cpus will be left in offline state when online
-function exits in some error conditions. Use return
-instead of exit to fix it.
-
-Signed-off-by: Zhao Gongyi <zhaogongyi@huawei.com>
-Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
-Stable-dep-of: 51d4c851465c ("selftests/cpu-hotplug: Reserve one cpu online at least")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- .../selftests/cpu-hotplug/cpu-on-off-test.sh | 13 ++++++++-----
- 1 file changed, 8 insertions(+), 5 deletions(-)
-
-diff --git a/tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh b/tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh
-index 0d26b5e3f966..940b68c940bb 100755
---- a/tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh
-+++ b/tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh
-@@ -4,6 +4,7 @@
- SYSFS=
- # Kselftest framework requirement - SKIP code is 4.
- ksft_skip=4
-+retval=0
-
- prerequisite()
- {
-@@ -102,10 +103,10 @@ online_cpu_expect_success()
-
- if ! online_cpu $cpu; then
- echo $FUNCNAME $cpu: unexpected fail >&2
-- exit 1
-+ retval=1
- elif ! cpu_is_online $cpu; then
- echo $FUNCNAME $cpu: unexpected offline >&2
-- exit 1
-+ retval=1
- fi
- }
-
-@@ -128,10 +129,10 @@ offline_cpu_expect_success()
-
- if ! offline_cpu $cpu; then
- echo $FUNCNAME $cpu: unexpected fail >&2
-- exit 1
-+ retval=1
- elif ! cpu_is_offline $cpu; then
- echo $FUNCNAME $cpu: unexpected offline >&2
-- exit 1
-+ retval=1
- fi
- }
-
-@@ -201,7 +202,7 @@ if [ $allcpus -eq 0 ]; then
- offline_cpu_expect_success $present_max
- online_cpu $present_max
- fi
-- exit 0
-+ exit $retval
- else
- echo "Full scope test: all hotplug cpus"
- echo -e "\t online all offline cpus"
-@@ -291,3 +292,5 @@ done
-
- echo 0 > $NOTIFIER_ERR_INJECT_DIR/actions/CPU_DOWN_PREPARE/error
- /sbin/modprobe -q -r cpu-notifier-error-inject
-+
-+exit $retval
---
-2.35.1
-
nfsd-protect-against-send-buffer-overflow-in-nfsv2-r.patch
nfsd-fix-handling-of-oversized-nfsv4-compound-reques.patch
x86-paravirt-add-extra-clobbers-with-zero_call_used_.patch
-libbpf-initialize-err-in-probe_map_create.patch
wifi-rtlwifi-8192de-correct-checking-of-iqk-reload.patch
wifi-ath10k-add-peer-map-clean-up-for-peer-delete-in.patch
bpf-fix-non-static-bpf_func_proto-struct-definitions.patch
bluetooth-rfcomm-fix-possible-deadlock-on-socket-shu.patch
net-fs_enet-fix-wrong-check-in-do_pd_setup.patch
bpf-ensure-correct-locking-around-vulnerable-functio.patch
-libbpf-fix-crash-if-sec-freplace-programs-don-t-have.patch
wifi-ath11k-include-sta_keepalive_arp_response-tlv-h.patch
bluetooth-hci_-ldisc-serdev-check-percpu_init_rwsem-.patch
-libbpf-fix-null-pointer-exception-in-api-btf_dump__d.patch
netfilter-conntrack-fix-the-gc-rescheduling-delay.patch
netfilter-conntrack-revisit-the-gc-initial-reschedul.patch
flow_dissector-do-not-count-vlan-tags-inside-tunnel-.patch
arm64-ftrace-fix-module-plts-with-mcount.patch
arm-dts-exynos-fix-polarity-of-vbus-gpio-of-origen.patch
iomap-iomap-fix-memory-corruption-when-recording-err.patch
-selftests-cpu-hotplug-use-return-instead-of-exit.patch
-selftests-cpu-hotplug-delete-fault-injection-related.patch
-selftests-cpu-hotplug-reserve-one-cpu-online-at-leas.patch
iio-adc-at91-sama5d2_adc-fix-at91_sama5d2_mr_trackti.patch
iio-adc-at91-sama5d2_adc-check-return-status-for-pre.patch
iio-adc-at91-sama5d2_adc-lock-around-oversampling-an.patch
dmaengine-hisilicon-disable-channels-when-unregister.patch
dmaengine-hisilicon-fix-cq-head-update.patch
dmaengine-hisilicon-add-multi-thread-support-for-a-d.patch
-iio-directly-use-ida_alloc-free.patch
-iio-use-per-device-lockdep-class-for-mlock.patch
usb-gadget-f_fs-stricter-integer-overflow-checks.patch
dyndbg-fix-static_branch-manipulation.patch
dyndbg-fix-module.dyndbg-handling.patch
scsi-iscsi-iscsi_tcp-fix-null-ptr-deref-while-callin.patch
clk-qcom-apss-ipq6018-mark-apcs_alias0_core_clk-as-c.patch
clk-qcom-gcc-sm6115-override-default-alpha-pll-regs.patch
-rdma-rxe-stop-lookup-of-partially-built-objects.patch
-rdma-rxe-set-pd-early-in-mr-alloc-routines.patch
rdma-rxe-fix-resize_finish-in-rxe_queue.c.patch
fsi-core-check-error-number-after-calling-ida_simple.patch
mfd-intel_soc_pmic-fix-an-error-handling-path-in-int.patch
x86-entry-work-around-clang-__bdos-bug.patch
nfsd-return-nfserr_serverfault-if-splice_ok-but-buf-.patch
nfsd-fix-use-after-free-on-source-server-when-doing-.patch
-libbpf-do-not-require-executable-permission-for-shar.patch
wifi-ath10k-set-tx-credit-to-one-for-wcn3990-snoc-ba.patch
wifi-brcmfmac-fix-invalid-address-access-when-enabli.patch
bpftool-clear-errno-after-libcap-s-checks.patch
bpf-use-bpf_prog_pack-for-bpf_dispatcher.patch
bluetooth-l2cap-fix-user-after-free.patch
net-sched-cls_u32-avoid-memcpy-false-positive-warnin.patch
-libbpf-fix-overrun-in-netlink-attribute-iteration.patch
i2c-designware-pci-group-amd-navi-quirk-parts-togeth.patch
r8152-rate-limit-overflow-messages.patch
drm-nouveau-nouveau_bo-fix-potential-memory-leak-in-.patch