linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Luben Tuikov <ltuikov@yahoo.com>
Cc: linux-scsi <linux-scsi@vger.kernel.org>,
	Douglas Gilbert <dougg@torque.net>
Subject: Re: [PATCH] [SCSI] sg.c: fixes to sg_build_indirect()
Date: Sat, 4 Nov 2006 20:12:14 +0000	[thread overview]
Message-ID: <20061104201214.GA32205@infradead.org> (raw)
In-Reply-To: <254019.55389.qm@web31801.mail.mud.yahoo.com>

On Sat, Nov 04, 2006 at 11:48:42AM -0800, Luben Tuikov wrote:
> The sg driver corrupts memory when the data buffer
> size is 5493376 (0x53d280) bytes.  The reason for this
> is the computation of the left over size given the
> size of scatter-gather array and the size of the
> scatter-gather element.  This patch fixes this.
> 
> Other fixes:
> 1. Eliminate scatter_elem_sz_prev, and use memory
>    barriers to get its current value.  Reset it to PAGE_SIZE
>    if the user has set it to something smaller.

I just stumbled over the scatter_elem_sz / scatter_elem_sz_prev
usage aswell when reasearching something unrelated in sg.
It seems very wrong to me to have unprotectred globals for buffer
size estimations.  If these estimates make sense we should do 
them per open file descriptor to avoid the races and to make sure
they still work properly in cases where multiple I/Os are going on
through sg.

Anyway, your patch looks very good and is an improvement in that area.


      reply	other threads:[~2006-11-04 20:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-04 19:48 [PATCH] [SCSI] sg.c: fixes to sg_build_indirect() Luben Tuikov
2006-11-04 20:12 ` Christoph Hellwig [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=20061104201214.GA32205@infradead.org \
    --to=hch@infradead.org \
    --cc=dougg@torque.net \
    --cc=linux-scsi@vger.kernel.org \
    --cc=ltuikov@yahoo.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).