Skip to content

remove dead NULL checks after GFP_NOFAIL allocations and fix xive use-after-free

Gou Hao dri-devel linux-mm linux-rdma linuxppc-dev lkml 2 versions – Applied

Status from this message: Applied, thanks!

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest6 patches 12 repliesApplied 4/6
  2. v14 patches 2 repliesSuperseded

Changes in v2 from the cover letter

- Remove the now-unused out_free_domain error label in the xive patch after deleting the unreachable NULL check goto.
- Fix a use-after-free of xive_ipis: when xive_init_ipis() fails, the error path frees xive_ipis but xive_smp_probe() ignores the error and proceeds to dereference it in xive_setup_cpu_ipi(). Propagate the error return through xive_smp_probe() and check it in both pnv_smp_probe() and pSeries_smp_probe().

Patches in v2 Applied · 4/6

#Subject and filesSizeRepliesApplied
1/6powerpc/xive: remove dead NULL check after GFP_NOFAIL allocationarch/powerpc/sysdev/xive/common.c+1 -44 replies
2/6powerpc/xive: add error return value to xive_smp_probe()arch/powerpc/include/asm/xive.h arch/powerpc/sysdev/xive/common.c+5 -31 replyApplied
3/6powerpc/xive: fix use-after-free of xive_ipisarch/powerpc/platforms/powernv/smp.c arch/powerpc/platforms/pseries/smp.c arch/powerpc/sysdev/xive/common.c+15 -72 replies
4/6drm: remove dead WARN_ON NULL check after GFP_NOFAIL allocationdrivers/gpu/drm/drm_modeset_lock.c+0 -40 repliesApplied
5/6lib/test_hmm: remove dead NULL checks after GFP_NOFAIL allocationslib/test_hmm.c+0 -61 replyApplied
6/6RDMA/cxgb4: remove dead NULL checks after GFP_NOFAIL allocationsdrivers/infiniband/hw/cxgb4/mem.c+2 -81 replyApplied

Reviews trailers per patch

5 of 6 patches have a Reviewed-by or Acked-by.

PatchWentao GuanjiazhenyuanCédric Le GoaterPotnuri Bharat TejaAlistair PoppleMukesh Kumar Chaurasiya (IBM)
1/6R-b R-b R-b R-b
2/6R-b R-b R-b
3/6R-b R-b R-b
4/6
5/6R-b
6/6R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 6 reviewers.

Read the v2 thread

Cover letter [PATCH v2 0/6] remove dead NULL checks after GFP_NOFAIL allocations and fix xive use-after-free

Changes in v2:
- Remove the now-unused out_free_domain error label in the xive patch after deleting the unreachable NULL check goto.
- Fix a use-after-free of xive_ipis: when xive_init_ipis() fails, the error path frees xive_ipis but xive_smp_probe() ignores the error and proceeds to dereference it in xive_setup_cpu_ipi(). Propagate the error return through xive_smp_probe() and check it in both pnv_smp_probe() and pSeries_smp_probe().

This is a code cleanup series that removes unreachable NULL checks (and associated error handling) that follow allocations using __GFP_NOFAIL, which guarantees non-NULL return.

Gou Hao (6):
powerpc/xive: remove dead NULL check after GFP_NOFAIL allocation powerpc/xive: add error return value to xive_smp_probe() powerpc/xive: fix use-after-free of xive_ipis
drm: remove dead WARN_ON NULL check after GFP_NOFAIL allocation lib/test_hmm: remove dead NULL checks after GFP_NOFAIL allocations RDMA/cxgb4: remove dead NULL checks after GFP_NOFAIL allocations

 arch/powerpc/include/asm/xive.h      |  4 ++--
 arch/powerpc/platforms/powernv/smp.c |  8 +++++---
 arch/powerpc/platforms/pseries/smp.c |  8 +++++---
 arch/powerpc/sysdev/xive/common.c    | 15 +++++++++------
 drivers/gpu/drm/drm_modeset_lock.c   |  4 ----
 drivers/infiniband/hw/cxgb4/mem.c    | 10 ++--------
 lib/test_hmm.c                       |  6 ------
 7 files changed, 23 insertions(+), 32 deletions(-)
Signature · 1 line
2.20.1