linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@nvidia.com>
To: Gioh Kim <gi-oh.kim@ionos.com>
Cc: linux-rdma@vger.kernel.org, bvanassche@acm.org, leon@kernel.org,
	dledford@redhat.com, haris.iqbal@ionos.com, jinpu.wang@ionos.com
Subject: Re: [PATCH for-next] RDMA/rtrs-clt: destroy sysfs after removing session from active list
Date: Mon, 12 Apr 2021 20:20:55 -0300	[thread overview]
Message-ID: <20210412232055.GA1196603@nvidia.com> (raw)
In-Reply-To: <20210412084002.33582-1-gi-oh.kim@ionos.com>

On Mon, Apr 12, 2021 at 10:40:02AM +0200, Gioh Kim wrote:
> A session can be removed dynamically by sysfs interface "remove_path"
> that eventually calls rtrs_clt_remove_path_from_sysfs function.
> The current rtrs_clt_remove_path_from_sysfs first removes the sysfs
> interfaces and frees sess->stats object. Second it removes the session
> from the active list.
> 
> Therefore some functions could access non-connected session and
> access the freed sess->stats object even-if they check the session
> status before accessing the session.
> For instance rtrs_clt_request and get_next_path_min_inflight
> check the session status and try to send IO to the session.
> The session status could be changed when they are trying to send IO
> but they could not catch the change and update the statistics information
> in sess->stats object, and generate use-after-free problem.
> (see: "RDMA/rtrs-clt: Check state of the rtrs_clt_sess before reading
> its stats")
> 
> This patch changes the rtrs_clt_remove_path_from_sysfs to remove
> the session from the active session list and then destroy the sysfs
> interfaces.
> 
> Each function still should check the session status because closing
> or error recovery paths can change the status.
> 
> Fixes: 6a98d71daea1 ("RDMA/rtrs: client: main functionality")
> Signed-off-by: Gioh Kim <gi-oh.kim@ionos.com>
> Reviewed-by: Jack Wang <jinpu.wang@ionos.com>
> ---
>  drivers/infiniband/ulp/rtrs/rtrs-clt.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied to for-next, thanks

Jason

      reply	other threads:[~2021-04-12 23:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-12  8:40 [PATCH for-next] RDMA/rtrs-clt: destroy sysfs after removing session from active list Gioh Kim
2021-04-12 23:20 ` Jason Gunthorpe [this message]

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=20210412232055.GA1196603@nvidia.com \
    --to=jgg@nvidia.com \
    --cc=bvanassche@acm.org \
    --cc=dledford@redhat.com \
    --cc=gi-oh.kim@ionos.com \
    --cc=haris.iqbal@ionos.com \
    --cc=jinpu.wang@ionos.com \
    --cc=leon@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).