From: Ajay Kaher <akaher@vmware.com>
To: "aarcange@redhat.com" <aarcange@redhat.com>,
"jannh@google.com" <jannh@google.com>,
"oleg@redhat.com" <oleg@redhat.com>,
"peterx@redhat.com" <peterx@redhat.com>,
"rppt@linux.ibm.com" <rppt@linux.ibm.com>,
"jgg@mellanox.com" <jgg@mellanox.com>,
"mhocko@suse.com" <mhocko@suse.com>
Cc: "yishaih@mellanox.com" <yishaih@mellanox.com>,
"dledford@redhat.com" <dledford@redhat.com>,
"sean.hefty@intel.com" <sean.hefty@intel.com>,
"hal.rosenstock@gmail.com" <hal.rosenstock@gmail.com>,
"matanb@mellanox.com" <matanb@mellanox.com>,
"leonro@mellanox.com" <leonro@mellanox.com>,
"linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"stable@vger.kernel.org" <stable@vger.kernel.org>,
Srivatsa Bhat <srivatsab@vmware.com>,
Alexey Makhalov <amakhalov@vmware.com>,
Greg KH <gregkh@linuxfoundation.org>,
Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [PATCH] [v4.14.y] infiniband: fix race condition between infiniband mlx4, mlx5 driver and core dumping
Date: Fri, 14 Jun 2019 14:41:39 +0000 [thread overview]
Message-ID: <9C189085-083D-46EA-98DB-B11AD62051B6@vmware.com> (raw)
In-Reply-To: <1560199937-23476-1-git-send-email-akaher@vmware.com>
On 10/06/19, 6:22 PM, "Ajay Kaher" <akaher@vmware.com> 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@vmware.com>
> Acked-by: Jason Gunthorpe <jgg@mellanox.com>
Greg, I hope you would like to review and proceed further with this patch.
> ---
> 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)
> @@ -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);
> diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
> index 13a9206..3fbe396 100644
> --- a/drivers/infiniband/hw/mlx5/main.c
> +++ b/drivers/infiniband/hw/mlx5/main.c
> @@ -1646,6 +1646,8 @@ static void mlx5_ib_disassociate_ucontext(struct ib_ucontext *ibcontext)
> * mlx5_ib_vma_close.
> */
> down_write(&owning_mm->mmap_sem);
> + if (!mmget_still_valid(owning_mm))
> + goto skip_mm;
> mutex_lock(&context->vma_private_list_mutex);
> list_for_each_entry_safe(vma_private, n, &context->vma_private_list,
> list) {
> @@ -1662,6 +1664,7 @@ static void mlx5_ib_disassociate_ucontext(struct ib_ucontext *ibcontext)
> kfree(vma_private);
> }
> mutex_unlock(&context->vma_private_list_mutex);
> +skip_mm:
> up_write(&owning_mm->mmap_sem);
> mmput(owning_mm);
> put_task_struct(owning_process);
> --
> 2.7.4
next prev parent reply other threads:[~2019-06-14 14:42 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-10 20:52 Ajay Kaher
2019-06-10 13:55 ` Michal Hocko
2019-06-10 16:05 ` Jason Gunthorpe
2019-06-14 14:41 ` Ajay Kaher [this message]
2019-06-14 14:55 ` Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9C189085-083D-46EA-98DB-B11AD62051B6@vmware.com \
--to=akaher@vmware.com \
--cc=aarcange@redhat.com \
--cc=amakhalov@vmware.com \
--cc=dledford@redhat.com \
--cc=gregkh@linuxfoundation.org \
--cc=hal.rosenstock@gmail.com \
--cc=jannh@google.com \
--cc=jgg@mellanox.com \
--cc=leonro@mellanox.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=matanb@mellanox.com \
--cc=mhocko@suse.com \
--cc=oleg@redhat.com \
--cc=peterx@redhat.com \
--cc=rppt@linux.ibm.com \
--cc=sean.hefty@intel.com \
--cc=srivatsab@vmware.com \
--cc=stable@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=yishaih@mellanox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®