[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAM_iQpXxHk+yFqqK-Hezsc83_mKfbUXr4=jjNnik5DwGscRKUA@mail.gmail.com>
Date: Wed, 13 Jun 2018 23:21:54 -0700
From: Cong Wang <xiyou.wangcong@...il.com>
To: Leon Romanovsky <leon@...nel.org>
Cc: LKML <linux-kernel@...r.kernel.org>, linux-rdma@...r.kernel.org,
Doug Ledford <dledford@...hat.com>,
Jason Gunthorpe <jgg@...lanox.com>
Subject: Re: [PATCH] infiniband: fix a subtle race condition
On Wed, Jun 13, 2018 at 10:34 PM, Leon Romanovsky <leon@...nel.org> wrote:
>
> Hi Cong,
>
> If the compiler optimizes the first line (mutex_lock) as you wrote,
> it will reuse "f" for the second line (mutex_unlock) too.
Nope, check the assembly if you don't trust me, at least
my compiler always fetches ctx->file without this patch.
I can show you the assembly code tomorrow (too late to
access my dev machine now).
>
> You need to ensure that ucma_modify_id() doesn't run in parallel to
> anything that uses "ctx->file" directly and indirectly.
>
Talk is easy, show me the code. :) I knew there is probably
some other race with this code even after my patch, possibly with
->close() for example, but for this specific unlock warning, this patch
is sufficient. I can't solve all the races in one patch.
Powered by blists - more mailing lists