Skip to content

lib/percpu-refcount: fix use-after-free by late ->release

Ming Lei linux-block lkml llvm oe-kbuild-all 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 4 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3lib/percpu-refcount: support to exit refcount automatically during releasinginclude/linux/percpu-refcount.h lib/percpu-refcount.c+25 -50 replies
2/3lib/percpu-refcount: apply PERCPU_REF_AUTO_EXITdrivers/infiniband/ulp/rtrs/rtrs-srv.c mm/memcontrol.c+4 -50 replies
3/3lib/percpu-refcount: drain ->release() in perpcu_ref_exit()include/linux/percpu-refcount.h lib/percpu-refcount.c+50 -131 reply

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/3] lib/percpu-refcount: fix use-after-free by late ->release

Hi,

The pattern of wait_event(percpu_ref_is_zero()) may cause percpu_ref_exit() to be called before ->release() is done, so user-after-free may be caused, fix the issue by draining ->release() in percpu_ref_exit().

Ming Lei (3):
lib/percpu-refcount: support to exit refcount automatically during
releasing
lib/percpu-refcount: apply PERCPU_REF_AUTO_EXIT lib/percpu-refcount: drain ->release() in perpcu_ref_exit()

 drivers/infiniband/ulp/rtrs/rtrs-srv.c |  4 +--
 include/linux/percpu-refcount.h        | 36 ++++++++++++++++++++++++--
 lib/percpu-refcount.c                  | 31 +++++++++++++++++++---
 mm/memcontrol.c                        |  5 ++--
 4 files changed, 66 insertions(+), 10 deletions(-)
Signature · 1 line
2.38.1