From: Johannes Thumshirn <jth@kernel.org>
To: Christoph Hellwig <hch@lst.de>, Hannes Reinecke <hare@suse.de>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>,
James Bottomley <james.bottomley@hansenpartnership.com>,
Doug Gilberg <dgilbert@interlog.com>,
linux-scsi@vger.kernel.org, Hannes Reinecke <hare@suse.com>
Subject: Re: [PATCHv3 3/6] sg: protect accesses to 'reserved' page array
Date: Fri, 3 Feb 2017 19:06:03 +0100 [thread overview]
Message-ID: <1d212ffc-d1c2-f743-151d-b8f48ea94f30@kernel.org> (raw)
In-Reply-To: <20170203161910.GA4339@lst.de>
On 02/03/2017 05:19 PM, Christoph Hellwig wrote:
> On Fri, Feb 03, 2017 at 02:38:35PM +0100, Hannes Reinecke wrote:
>> On 02/03/2017 02:31 PM, Christoph Hellwig wrote:
>>>> - if (sg_res_in_use(sfp)) {
>>>> + mutex_lock(&sfp->f_mutex);
>>>> + if (sfp->res_in_use) {
>>>> + mutex_unlock(&sfp->f_mutex);
>>>> sg_remove_request(sfp, srp);
>>>> return -EBUSY; /* reserve buffer already being used */
>>>> }
>>>> + mutex_unlock(&sfp->f_mutex);
>>> Holding a mutex over a the check of a single scalar doesn't make sense.
>>>
>> It's adds a synchronisation point, doesn't it?
> It does, but it doesn't actually protect anything..
But all the other mutex_{un,}locks() do (for instance guarding
sg_build_indirect()) and this one provides a synchronization point.
Sorry but I really don't get your point here.
The sole purpose is to guard the reserved list from being altered while
blk_rq_map_* or similar functions are in progess (that's what the
syzcaller reproducer was doing).
Byte,
Johannes
next prev parent reply other threads:[~2017-02-03 18:06 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-03 13:12 [PATCHv3 0/6] sanitize sg Hannes Reinecke
2017-02-03 13:12 ` [PATCHv3 1/6] sg: disable SET_FORCE_LOW_DMA Hannes Reinecke
2017-02-03 13:29 ` Christoph Hellwig
2017-02-03 13:12 ` [PATCHv3 2/6] sg: remove 'save_scat_len' Hannes Reinecke
2017-02-03 13:29 ` Christoph Hellwig
2017-02-03 13:12 ` [PATCHv3 3/6] sg: protect accesses to 'reserved' page array Hannes Reinecke
2017-02-03 13:31 ` Christoph Hellwig
2017-02-03 13:38 ` Hannes Reinecke
2017-02-03 16:19 ` Christoph Hellwig
2017-02-03 18:06 ` Johannes Thumshirn [this message]
2017-02-03 18:21 ` James Bottomley
2017-02-03 13:12 ` [PATCHv3 4/6] sg: check for valid direction before starting the request Hannes Reinecke
2017-02-03 13:12 ` [PATCHv3 5/6] sg: use standard lists for sg_requests Hannes Reinecke
2017-02-03 13:12 ` [PATCHv3 6/6] sg: close race condition in sg_remove_sfp_usercontext() Hannes Reinecke
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=1d212ffc-d1c2-f743-151d-b8f48ea94f30@kernel.org \
--to=jth@kernel.org \
--cc=dgilbert@interlog.com \
--cc=hare@suse.com \
--cc=hare@suse.de \
--cc=hch@lst.de \
--cc=james.bottomley@hansenpartnership.com \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@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).