| To: | Lukas Czerner <lczerner@xxxxxxxxxx> |
|---|---|
| Subject: | Re: [PATCH v2] xfs: fix possible overflow in xfs_ioc_trim() |
| From: | Christoph Hellwig <hch@xxxxxxxxxxxxx> |
| Date: | Wed, 7 Sep 2011 07:21:55 -0400 |
| Cc: | Christoph Hellwig <hch@xxxxxxxxxxxxx>, xfs@xxxxxxxxxxx |
| In-reply-to: | <alpine.LFD.2.00.1109071200480.4579@xxxxxxxxxxxxxxxxxxxxxxxxxx> |
| References: | <1315322977-22736-1-git-send-email-lczerner@xxxxxxxxxx> <20110906153301.GA21675@xxxxxxxxxxxxx> <alpine.LFD.2.00.1109071200480.4579@xxxxxxxxxxxxxxxxxxxxxxxxxx> |
| User-agent: | Mutt/1.5.21 (2010-09-15) |
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? |
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | ENQUIRY, rsvn_office |
|---|---|
| Next by Date: | Re: CPU stuck for 67s (kernel BUG) + in xfs_trans_committed_bulk while deleting lots a files (mostly hard-links), Christoph Hellwig |
| Previous by Thread: | Re: [PATCH v2] xfs: fix possible overflow in xfs_ioc_trim(), Lukas Czerner |
| Next by Thread: | Re: [PATCH v2] xfs: fix possible overflow in xfs_ioc_trim(), Lukas Czerner |
| Indexes: | [Date] [Thread] [Top] [All Lists] |