From: Christoph Hellwig <hch@infradead.org>
To: Lukas Czerner <lczerner@redhat.com>
Cc: hch@infradead.org, xfs@oss.sgi.com
Subject: Re: [PATCH v3] xfs: fix possible overflow in xfs_ioc_trim()
Date: Wed, 21 Sep 2011 08:23:13 -0400 [thread overview]
Message-ID: <20110921122313.GA28663@infradead.org> (raw)
In-Reply-To: <1316598150-12447-1-git-send-email-lczerner@redhat.com>
On Wed, Sep 21, 2011 at 11:42:30AM +0200, Lukas Czerner wrote:
> In xfs_ioc_trim it is possible that computing the last allocation group
> to discard might overflow for big start & len values, because the result
> might be bigger then xfs_agnumber_t which is 32 bit long. Fix this by not
> allowing the start and end block of the range to be beyond the end of the
> file system.
>
> Note that if the start is beyond the end of the file system we have to
> return -EINVAL, but in the "end" case we have to truncate it to the fs
> size.
>
> Also introduce "end" variable, rather than using start+len which which
> might be more confusing to get right as this bug shows.
>
> Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Looks good,
Reviewed-by: Christoph Hellwig <hch@lst.de>
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2011-09-21 12:23 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-21 9:42 [PATCH v3] xfs: fix possible overflow in xfs_ioc_trim() Lukas Czerner
2011-09-21 12:23 ` Christoph Hellwig [this message]
2011-09-23 17:08 ` Alex Elder
2011-09-23 17:17 ` Lukas Czerner
2011-09-23 19:08 ` Alex Elder
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=20110921122313.GA28663@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