netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: zerons <sironhide0null@gmail.com>
To: santosh.shilimkar@oracle.com,
	Ka-Cheong Poon <ka-cheong.poon@oracle.com>,
	netdev@vger.kernel.org
Cc: davem@davemloft.net, rds-devel@oss.oracle.com
Subject: Re: [PATCH net 2/2] net/rds: Fix MR reference counting problem
Date: Wed, 8 Apr 2020 10:25:11 +0800	[thread overview]
Message-ID: <e1853439-fe73-14d1-a57c-1a67341a7f8a@gmail.com> (raw)
In-Reply-To: <96f17f7d-365c-32ec-2efe-a6a5d9d306b7@oracle.com>

On 4/8/20 03:30, santosh.shilimkar@oracle.com wrote:
> On 4/7/20 9:08 AM, Ka-Cheong Poon wrote:
>> In rds_free_mr(), it calls rds_destroy_mr(mr) directly.  But this
>> defeats the purpose of reference counting and makes MR free handling
>> impossible.  It means that holding a reference does not guarantee that
>> it is safe to access some fields.  For example, In
>> rds_cmsg_rdma_dest(), it increases the ref count, unlocks and then
>> calls mr->r_trans->sync_mr().  But if rds_free_mr() (and
>> rds_destroy_mr()) is called in between (there is no lock preventing
>> this to happen), r_trans_private is set to NULL, causing a panic.
>> Similar issue is in rds_rdma_unuse().
>>
>> Reported-by: zerons <sironhide0null@gmail.com>
>> Signed-off-by: Ka-Cheong Poon <ka-cheong.poon@oracle.com>
>> ---
> Thanks for getting this out on the list.
> 
> Hi zerons,
> Can you please review it and see it addresses your concern ?
> 

Yes, the MR gets freed only when the ref count decreases to zero does
address my concern. I think it make the logic cleaner as well. Fantastic!

Regards,
zerons

  reply	other threads:[~2020-04-08  2:25 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-07 16:08 [PATCH net 1/2] net/rds: Replace direct refcount_inc() by inline function Ka-Cheong Poon
2020-04-07 16:08 ` [PATCH net 2/2] net/rds: Fix MR reference counting problem Ka-Cheong Poon
2020-04-07 19:30   ` santosh.shilimkar
2020-04-08  2:25     ` zerons [this message]
2020-04-08  2:52       ` santosh.shilimkar
2020-04-07 18:48 ` [PATCH net 1/2] net/rds: Replace direct refcount_inc() by inline function Leon Romanovsky
2020-04-07 20:19   ` David Miller
2020-04-08  4:15   ` Ka-Cheong Poon
2020-04-08  6:44     ` Leon Romanovsky

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=e1853439-fe73-14d1-a57c-1a67341a7f8a@gmail.com \
    --to=sironhide0null@gmail.com \
    --cc=davem@davemloft.net \
    --cc=ka-cheong.poon@oracle.com \
    --cc=netdev@vger.kernel.org \
    --cc=rds-devel@oss.oracle.com \
    --cc=santosh.shilimkar@oracle.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;
as well as URLs for NNTP newsgroup(s).