public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: James Bottomley <James.Bottomley@suse.de>
To: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: Matthew Wilcox <matthew@wil.cx>,
	Dan Carpenter <error27@gmail.com>,
	linux-scsi@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: bug report: sd:  off by one in sd_read_block_limits()
Date: Wed, 03 Mar 2010 12:38:31 +0530	[thread overview]
Message-ID: <1267600111.4383.43.camel@mulgrave.site> (raw)
In-Reply-To: <yq1fx4i26cc.fsf@sermon.lab.mkp.net>

On Tue, 2010-03-02 at 08:36 -0500, Martin K. Petersen wrote:
> James,
> 
> While I agree the original VPD code's double kmalloc() was a bit of a
> wart at least it did the right thing because it allocated a suitably
> sized buffer for page 0.
> 
> My concern with the interface you introduced in e3deec09 is that for
> devices that support a large number of VPD pages we won't be able to fit
> the page list in the allocated buffer.  And callers are likely to pick a
> buffer size that makes sense for the VPD page they are interested in.
> It's not a big deal in the block limits/block device characteristics
> case because they are big enough.

Actually, I don't really think that's a problem.  The design is to weed
out USB devices that have silly returns, either by not returning a
correct page zero, or by only accepting VPDs to the few pages and
crashing on ones they don't support.  If we run off the end of the
buffer because there are 32 or more pages, then it's reasonably safe to
assume the device will respond correctly to a VPD inquiry.

> But at the very minimum that interface should come with a big fat
> warning in the comment section that describes that the page list must
> also be able to fit.

But it doesn't have to ... if we correctly return more pages than will
fit in the buffer, it will proceed to do the requested page VPD inquiry.

James



  parent reply	other threads:[~2010-03-03  7:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-02  8:21 bug report: sd: off by one in sd_read_block_limits() Dan Carpenter
2010-03-02 13:12 ` Martin K. Petersen
2010-03-02 13:21   ` Martin K. Petersen
2010-03-02 13:31     ` Matthew Wilcox
2010-03-02 13:36     ` Martin K. Petersen
2010-03-02 14:56       ` Matthew Wilcox
2010-03-03  7:08       ` James Bottomley [this message]
2010-03-02 13:44     ` Martin K. Petersen

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=1267600111.4383.43.camel@mulgrave.site \
    --to=james.bottomley@suse.de \
    --cc=error27@gmail.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=matthew@wil.cx \
    /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