FAILED: patch "[PATCH] ext4: in ext4_seek_{hole,data}, return -ENXIO for negative" failed to apply to 4.9-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 4.9-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
Quoted 1 line
From
1bd8d6cd3e413d64e543ec3e69ff43e75a1cf1eaMon Sep 17 00:00:00 2001
From: "Darrick J. Wong" <[email protected]>
Date: Thu, 24 Aug 2017 13:22:06 -0400
Subject: [PATCH] ext4: in ext4_seek_{hole,data}, return -ENXIO for negative
offsets
In the ext4 implementations of SEEK_HOLE and SEEK_DATA, make sure we return -ENXIO for negative offsets instead of banging around inside the extent code and returning -EFSCORRUPTED.
Reported-by Mateusz S <[email protected]>
Signed-off-by Darrick J. Wong <[email protected]>
Signed-off-by Theodore Ts'o <[email protected]>
Cc [email protected] # 4.6
fs/ext4/file.c +2 -2
@@ -595,7 +595,7 @@ static loff_t ext4_seek_data(struct file *file, loff_t offset, loff_t maxsize)inode_lock (inode); isize =i_size_read (inode); -if (offset >= isize) { +if (offset <0 || offset >= isize) {inode_unlock (inode);return -ENXIO ; }
@@ -658,7 +658,7 @@ static loff_t ext4_seek_hole(struct file *file, loff_t offset, loff_t maxsize)inode_lock (inode); isize =i_size_read (inode); -if (offset >= isize) { +if (offset <0 || offset >= isize) {inode_unlock (inode);return -ENXIO ; }