Message ID | 482ee0b8a30b62324adb9f7c551a99926f037393.1726257832.git.trond.myklebust@hammerspace.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | filemap: filemap_read() should check that the offset is positive or zero | expand |
diff --git a/mm/filemap.c b/mm/filemap.c index c69227ccdabb..99ed5d291a6a 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -2600,6 +2600,8 @@ ssize_t filemap_read(struct kiocb *iocb, struct iov_iter *iter, loff_t isize, end_offset; loff_t last_pos = ra->prev_pos; + if (unlikely(iocb->ki_pos < 0)) + return -EINVAL; if (unlikely(iocb->ki_pos >= inode->i_sb->s_maxbytes)) return 0; if (unlikely(!iov_iter_count(iter)))