This patch series consolidates the changes submitted and reviewed at [1]
and [2].
The patches at [1] and [2] were submitted separarely, but they have some
inter dependency (later patches were created on top of earlier ones).
As both sets are still under review, I have put them in a single
change set here, so that it can be reviewed/included together and also
to avoid automation build failures where git am fails because of absent
parent.
I have included Acked-by (from Vlastimil) and Reviewed-by (from Alexander)
tags obtained so far for these changes and have also addressed last review
comment from Vlastimil [3].
To summarize, the changes in this set are as follows:
PATCH-1: Checks validity of a stackdepot handle before proceeding
to access stackdepot slab/objects.
PATCH-2: Adds a helper in stackdepot, to allow users to print
stack entries just by specifying the stackdepot handle. It also
changes such users to use this new interface.
PATCH-3: Adds a helper in stackdepot, to allow users to print
stack entries into buffers just by specifying the stackdepot handle and
destination buffer. It also changes such users to use this new interface.
[1] https://lore.kernel.org/lkml/[email protected]/
[2] https://lore.kernel.org/lkml/[email protected]/
[3] https://lore.kernel.org/lkml/[email protected]/
Imran Khan (3):
lib, stackdepot: check stackdepot handle before accessing slabs.
lib, stackdepot: Add helper to print stack entries.
lib, stackdepot: Add helper to print stack entries into buffer.
drivers/gpu/drm/drm_dp_mst_topology.c | 5 +--
drivers/gpu/drm/drm_mm.c | 5 +--
drivers/gpu/drm/i915/i915_vma.c | 5 +--
drivers/gpu/drm/i915/intel_runtime_pm.c | 20 +++--------
include/linux/stackdepot.h | 5 +++
lib/stackdepot.c | 45 +++++++++++++++++++++++++
mm/kasan/report.c | 15 ++-------
mm/page_owner.c | 18 +++-------
8 files changed, 66 insertions(+), 52 deletions(-)
--
2.30.2
stack_depot_save allocates slabs that will be used for storing
objects in future.If this slab allocation fails we may get to
a situation where space allocation for a new stack_record fails,
causing stack_depot_save to return 0 as handle.
If user of this handle ends up invoking stack_depot_fetch with
this handle value, current implementation of stack_depot_fetch
will end up using slab from wrong index.
To avoid this check handle value at the beginning.
Signed-off-by: Imran Khan <[email protected]>
Suggested-by: Vlastimil Babka <[email protected]>
Acked-by: Vlastimil Babka <[email protected]>
---
lib/stackdepot.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/lib/stackdepot.c b/lib/stackdepot.c
index 0a2e417f83cb..67439c082490 100644
--- a/lib/stackdepot.c
+++ b/lib/stackdepot.c
@@ -232,6 +232,9 @@ unsigned int stack_depot_fetch(depot_stack_handle_t handle,
struct stack_record *stack;
*entries = NULL;
+ if (!handle)
+ return 0;
+
if (parts.slabindex > depot_index) {
WARN(1, "slab index %d out of bounds (%d) for stack id %08x\n",
parts.slabindex, depot_index, handle);
--
2.30.2