X-Git-Url: https://git.karo-electronics.de/?a=blobdiff_plain;f=fs%2Fread_write.c;h=a091ee4f430df6cc83317b59c4a2fc363c005080;hb=0ace57a96bf299f6d46fd49e3edbaf79f500d160;hp=563abd09b5c84b882cbe6f47e56d05e80e5db4b6;hpb=6c89cce75c6f93088a5a2a25bb9674a9194592cc;p=karo-tx-linux.git diff --git a/fs/read_write.c b/fs/read_write.c index 563abd09b5c8..a091ee4f430d 100644 --- a/fs/read_write.c +++ b/fs/read_write.c @@ -188,7 +188,7 @@ int rw_verify_area(int read_write, struct file *file, loff_t *ppos, size_t count struct inode *inode; loff_t pos; - if (unlikely(count > file->f_maxcount)) + if (unlikely(count > INT_MAX)) goto Einval; pos = *ppos; if (unlikely((pos < 0) || (loff_t) (pos + count) < 0)) @@ -497,6 +497,9 @@ static ssize_t do_readv_writev(int type, struct file *file, } ret = rw_verify_area(type, file, pos, tot_len); + if (ret) + goto out; + ret = security_file_permission(file, type == READ ? MAY_READ : MAY_WRITE); if (ret) goto out;