On Tue 11-06-19 02:22:17, Ajay Kaher wrote: > This patch is the extension of following upstream commit to fix > the race condition between get_task_mm() and core dumping > for IB->mlx4 and IB->mlx5 drivers: > > commit 04f5866e41fb ("coredump: fix race condition between > mmget_not_zero()/get_task_mm() and core dumping")' > > Thanks to Jason for pointing this. > > Signed-off-by: Ajay Kaher <akaher@xxxxxxxxxx> > --- > drivers/infiniband/hw/mlx4/main.c | 4 +++- > drivers/infiniband/hw/mlx5/main.c | 3 +++ > 2 files changed, 6 insertions(+), 1 deletion(-) > > diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c > index e2beb18..0299c06 100644 > --- a/drivers/infiniband/hw/mlx4/main.c > +++ b/drivers/infiniband/hw/mlx4/main.c > @@ -1197,6 +1197,8 @@ static void mlx4_ib_disassociate_ucontext(struct ib_ucontext *ibcontext) > * mlx4_ib_vma_close(). > */ > down_write(&owning_mm->mmap_sem); > + if (!mmget_still_valid(owning_mm)) > + goto skip_mm; > for (i = 0; i < HW_BAR_COUNT; i++) { > vma = context->hw_bar_info[i].vma; > if (!vma) I have missed this part in 4.4 stable backport. Thanks for catching it. I have updated my backport. > @@ -1215,7 +1217,7 @@ static void mlx4_ib_disassociate_ucontext(struct ib_ucontext *ibcontext) > /* context going to be destroyed, should not access ops any more */ > context->hw_bar_info[i].vma->vm_ops = NULL; > } > - > +skip_mm: > up_write(&owning_mm->mmap_sem); > mmput(owning_mm); > put_task_struct(owning_process); -- Michal Hocko SUSE Labs