iomap: fix integer truncation issues in the zeroing and dirtying helpers
PATCH 1/1 iomap: fix integer truncation issues in the zeroing and dirtying helpers
Fix the min_t calls in the zeroing and dirtying helpers to perform the comparisms on 64-bit types, which prevents them from incorrectly being truncated, and larger zeroing operations being stuck in a never ending loop.
Special thanks to Markus Stockhausen for spotting the bug.
--- fs/iomap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/iomap.c +2 -2
@@ -278,7 +278,7 @@ iomap_dirty_actor(struct inode *inode, loff_t pos, loff_t length, void *data,unsigned long bytes;/* Bytes to write to page */ offset = (pos & (PAGE_SIZE -1 )); - bytes = min_t(unsigned long, PAGE_SIZE - offset, length); + bytes =min_t (loff_t,PAGE_SIZE - offset, length); rpage =__iomap_read_page (inode, pos);if (IS_ERR (rpage))
@@ -373,7 +373,7 @@ iomap_zero_range_actor(struct inode *inode, loff_t pos, loff_t count,unsigned offset, bytes; offset = pos & (PAGE_SIZE -1 );/* Within page */ - bytes =min_t (unsigned,PAGE_SIZE - offset, count); + bytes =min_t (loff_t,PAGE_SIZE - offset, count);if (IS_DAX (inode)) status =iomap_dax_zero (pos, offset, bytes, iomap);
Signature · 1 line
2.11.0
Quoted 9 lines · Christoph Hellwig
Fix the
min_tcalls in the zeroing and dirtying helpers to perform the comparisms on 64-bit types, which prevents them from incorrectly being truncated, and larger zeroing operations being stuck in a never ending loop.Special thanks to Markus Stockhausen for spotting the bug.
Reported-by Paul Menzel <[email protected]>Tested-by Paul Menzel <[email protected]>
Looks fine to me,
(Are you going to push this to Al yourself, or do you want me to drag it through the xfs tree?)
Quoted 33 lines
--- fs/iomap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)fs/iomap.c +2
-2@@ -278,7 +278,7 @@ iomap_dirty_actor(struct inode *inode, loff_t pos, loff_t length, void *data,unsigned long bytes;/* Bytes to write to page */ offset = (pos & (PAGE_SIZE -1 )); - bytes = min_t(unsigned long, PAGE_SIZE - offset, length); + bytes =min_t (loff_t,PAGE_SIZE - offset, length); rpage =__iomap_read_page (inode, pos);if (IS_ERR (rpage))@@ -373,7 +373,7 @@ iomap_zero_range_actor(struct inode *inode, loff_t pos, loff_t count,unsigned offset, bytes; offset = pos & (PAGE_SIZE -1 );/* Within page */ - bytes =min_t (unsigned,PAGE_SIZE - offset, count); + bytes =min_t (loff_t,PAGE_SIZE - offset, count);if (IS_DAX (inode)) status =iomap_dax_zero (pos, offset, bytes, iomap);Signature · 6 lines
2.11.0 -- To unsubscribe from this list: send the line "unsubscribe linux-xfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 5 lines · Darrick J. Wong
Looks fine to me,
Reviewed-by Darrick J. Wong <[email protected]>(Are you going to push this to Al yourself, or do you want me to drag it through the xfs tree?)
In general we've maintained iomap.c through the XFS tree so far. I think it's easiest to stick to that.
Quoted 9 lines · Christoph Hellwig
Quoted 5 lines · Darrick J. Wong
Looks fine to me,
Reviewed-by Darrick J. Wong <[email protected]>(Are you going to push this to Al yourself, or do you want me to drag it through the xfs tree?)
In general we've maintained
iomap.cthrough the XFS tree so far. I think it's easiest to stick to that.
Needs signed-off-by. :(
--D
Quoted 4 lines
--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Christoph Hellwig
Reviewed-byQuoted 5 lines · Darrick J. Wong
Quoted 4 lines · Christoph Hellwig
Quoted 3 lines · Darrick J. Wong
Looks fine to me,
Reviewed-by Darrick J. Wong <[email protected]>
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
(Are you going to push this to Al yourself, or do you want me to drag it through the xfs tree?)
In general we've maintained
iomap.cthrough the XFS tree so far. I think it's easiest to stick to that.Needs signed-off-by. :(
Feel free to add it:
Dear Christoph,
Quoted 9 lines · Christoph Hellwig
Fix the
min_tcalls in the zeroing and dirtying helpers to perform the comparisms on 64-bit types, which prevents them from incorrectly being truncated, and larger zeroing operations being stuck in a never ending loop.Special thanks to Markus Stockhausen for spotting the bug.
Reported-by Paul Menzel <[email protected]>Tested-by Paul Menzel <[email protected]>
Thank you very much for providing the fix that quickly.
Please don’t forget to tag it for the stable series (4.8+).
Kind regards,
Paul
Hi Paul,
I'm overdue doing another XFS stable backport batch, and I will include this patch.
Dear Christoph,
Quoted 2 lines · Christoph Hellwig
I'm overdue doing another XFS stable backport batch, and I will include this patch.
If I am not mistaken, this has not been picked up yet for the stable series.
``` $ git tag --contains e28ae8e428fefe2facd72cea9f29906ecb9c861d v4.13 v4.13-rc6 v4.13-rc7 v4.13.1 $ git log --grep e28ae8e428fefe2facd72cea9f29906ecb9c861d v4.9.48 $ ```
Do you want me to submit it for inclusion?
Kind regards,
Paul