From: Christoph Hellwig <hch@infradead.org>
To: Lukas Czerner <lczerner@redhat.com>
Cc: Christoph Hellwig <hch@infradead.org>, xfs@oss.sgi.com
Subject: Re: [PATCH v2] xfs: fix possible overflow in xfs_ioc_trim()
Date: Wed, 7 Sep 2011 07:21:55 -0400 [thread overview]
Message-ID: <20110907112155.GA1017@infradead.org> (raw)
In-Reply-To: <alpine.LFD.2.00.1109071200480.4579@dhcp-27-109.brq.redhat.com>
On Wed, Sep 07, 2011 at 12:05:14PM +0200, Lukas Czerner wrote:
> > > + if (len > max_blks)
> > > + len = max_blks - start;
> >
> > Is this really the correct check?
> >
> > Shouldn't it be
> >
> > if (start + len > max_blks)
> > len = max_blks - start;
> >
> > I'd also just use the mp->m_sb.sb_dblocks value directly instead
> > of assigning it to a local variable.
> >
>
> Agh, you're right. I am bit too hasty I guess. I thought that
>
> if (start_agno >= mp->m_sb.sb_agcount)
> return -XFS_ERROR(EINVAL);
>
> will cover us from the unreasonably big start, however if the file
> system has really huge number of AGs than it will fail to prevent the
> overflow, I am not sure if that is possible to happen, but what you
> proposed is definitely better.
The problem is that start could be very far into the fs, so checking
len alone won't help very much. And we probably want a check if
start + len is overflowing, too.
Care to update the test case to cover these cases as well?
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2011-09-07 11:21 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-06 15:29 [PATCH v2] xfs: fix possible overflow in xfs_ioc_trim() Lukas Czerner
2011-09-06 15:33 ` Christoph Hellwig
2011-09-07 10:05 ` Lukas Czerner
2011-09-07 11:21 ` Christoph Hellwig [this message]
2011-09-07 12:26 ` Lukas Czerner
2011-09-20 13:36 ` Lukas Czerner
2011-09-20 17:12 ` Christoph Hellwig
2011-09-21 7:46 ` Lukas Czerner
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=20110907112155.GA1017@infradead.org \
--to=hch@infradead.org \
--cc=lczerner@redhat.com \
--cc=xfs@oss.sgi.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