diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/9p/trans_sock.c | 1 | ||||
-rw-r--r-- | fs/compat.c | 2 | ||||
-rw-r--r-- | fs/hostfs/hostfs_kern.c | 9 | ||||
-rw-r--r-- | fs/lockd/clntlock.c | 4 | ||||
-rw-r--r-- | fs/nfs/callback.c | 3 | ||||
-rw-r--r-- | fs/nfs/direct.c | 24 | ||||
-rw-r--r-- | fs/nfs/file.c | 26 | ||||
-rw-r--r-- | fs/nfs/inode.c | 28 | ||||
-rw-r--r-- | fs/nfsd/nfs2acl.c | 2 | ||||
-rw-r--r-- | fs/nfsd/nfs3acl.c | 2 | ||||
-rw-r--r-- | fs/partitions/Kconfig | 2 | ||||
-rw-r--r-- | fs/proc/generic.c | 47 | ||||
-rw-r--r-- | fs/read_write.c | 34 | ||||
-rw-r--r-- | fs/relayfs/relay.c | 8 |
14 files changed, 107 insertions, 85 deletions
diff --git a/fs/9p/trans_sock.c b/fs/9p/trans_sock.c index a93c2bf94c33..6a9a75d40f73 100644 --- a/fs/9p/trans_sock.c +++ b/fs/9p/trans_sock.c | |||
@@ -26,6 +26,7 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | #include <linux/config.h> | 28 | #include <linux/config.h> |
29 | #include <linux/in.h> | ||
29 | #include <linux/module.h> | 30 | #include <linux/module.h> |
30 | #include <linux/net.h> | 31 | #include <linux/net.h> |
31 | #include <linux/ipv6.h> | 32 | #include <linux/ipv6.h> |
diff --git a/fs/compat.c b/fs/compat.c index 818634120b69..55ac0324aaf1 100644 --- a/fs/compat.c +++ b/fs/compat.c | |||
@@ -1170,7 +1170,7 @@ static ssize_t compat_do_readv_writev(int type, struct file *file, | |||
1170 | } | 1170 | } |
1171 | 1171 | ||
1172 | ret = rw_verify_area(type, file, pos, tot_len); | 1172 | ret = rw_verify_area(type, file, pos, tot_len); |
1173 | if (ret) | 1173 | if (ret < 0) |
1174 | goto out; | 1174 | goto out; |
1175 | 1175 | ||
1176 | fnv = NULL; | 1176 | fnv = NULL; |
diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c index 4684eb7d48c6..b3ad0bd0312f 100644 --- a/fs/hostfs/hostfs_kern.c +++ b/fs/hostfs/hostfs_kern.c | |||
@@ -501,11 +501,16 @@ int hostfs_commit_write(struct file *file, struct page *page, unsigned from, | |||
501 | long long start; | 501 | long long start; |
502 | int err = 0; | 502 | int err = 0; |
503 | 503 | ||
504 | start = (long long) (page->index << PAGE_CACHE_SHIFT) + from; | 504 | start = (((long long) page->index) << PAGE_CACHE_SHIFT) + from; |
505 | buffer = kmap(page); | 505 | buffer = kmap(page); |
506 | err = write_file(FILE_HOSTFS_I(file)->fd, &start, buffer + from, | 506 | err = write_file(FILE_HOSTFS_I(file)->fd, &start, buffer + from, |
507 | to - from); | 507 | to - from); |
508 | if(err > 0) err = 0; | 508 | if(err > 0) err = 0; |
509 | |||
510 | /* Actually, if !err, write_file has added to-from to start, so, despite | ||
511 | * the appearance, we are comparing i_size against the _last_ written | ||
512 | * location, as we should. */ | ||
513 | |||
509 | if(!err && (start > inode->i_size)) | 514 | if(!err && (start > inode->i_size)) |
510 | inode->i_size = start; | 515 | inode->i_size = start; |
511 | 516 | ||
@@ -910,10 +915,8 @@ static struct inode_operations hostfs_dir_iops = { | |||
910 | int hostfs_link_readpage(struct file *file, struct page *page) | 915 | int hostfs_link_readpage(struct file *file, struct page *page) |
911 | { | 916 | { |
912 | char *buffer, *name; | 917 | char *buffer, *name; |
913 | long long start; | ||
914 | int err; | 918 | int err; |
915 | 919 | ||
916 | start = page->index << PAGE_CACHE_SHIFT; | ||
917 | buffer = kmap(page); | 920 | buffer = kmap(page); |
918 | name = inode_name(page->mapping->host, 0); | 921 | name = inode_name(page->mapping->host, 0); |
919 | if(name == NULL) return(-ENOMEM); | 922 | if(name == NULL) return(-ENOMEM); |
diff --git a/fs/lockd/clntlock.c b/fs/lockd/clntlock.c index 006bb9e14579..3eaf6e701087 100644 --- a/fs/lockd/clntlock.c +++ b/fs/lockd/clntlock.c | |||
@@ -157,6 +157,8 @@ void nlmclnt_mark_reclaim(struct nlm_host *host) | |||
157 | inode = fl->fl_file->f_dentry->d_inode; | 157 | inode = fl->fl_file->f_dentry->d_inode; |
158 | if (inode->i_sb->s_magic != NFS_SUPER_MAGIC) | 158 | if (inode->i_sb->s_magic != NFS_SUPER_MAGIC) |
159 | continue; | 159 | continue; |
160 | if (fl->fl_u.nfs_fl.owner == NULL) | ||
161 | continue; | ||
160 | if (fl->fl_u.nfs_fl.owner->host != host) | 162 | if (fl->fl_u.nfs_fl.owner->host != host) |
161 | continue; | 163 | continue; |
162 | if (!(fl->fl_u.nfs_fl.flags & NFS_LCK_GRANTED)) | 164 | if (!(fl->fl_u.nfs_fl.flags & NFS_LCK_GRANTED)) |
@@ -226,6 +228,8 @@ restart: | |||
226 | inode = fl->fl_file->f_dentry->d_inode; | 228 | inode = fl->fl_file->f_dentry->d_inode; |
227 | if (inode->i_sb->s_magic != NFS_SUPER_MAGIC) | 229 | if (inode->i_sb->s_magic != NFS_SUPER_MAGIC) |
228 | continue; | 230 | continue; |
231 | if (fl->fl_u.nfs_fl.owner == NULL) | ||
232 | continue; | ||
229 | if (fl->fl_u.nfs_fl.owner->host != host) | 233 | if (fl->fl_u.nfs_fl.owner->host != host) |
230 | continue; | 234 | continue; |
231 | if (!(fl->fl_u.nfs_fl.flags & NFS_LCK_RECLAIM)) | 235 | if (!(fl->fl_u.nfs_fl.flags & NFS_LCK_RECLAIM)) |
diff --git a/fs/nfs/callback.c b/fs/nfs/callback.c index f2ca782aba33..30cae3602867 100644 --- a/fs/nfs/callback.c +++ b/fs/nfs/callback.c | |||
@@ -14,6 +14,9 @@ | |||
14 | #include <linux/sunrpc/svc.h> | 14 | #include <linux/sunrpc/svc.h> |
15 | #include <linux/sunrpc/svcsock.h> | 15 | #include <linux/sunrpc/svcsock.h> |
16 | #include <linux/nfs_fs.h> | 16 | #include <linux/nfs_fs.h> |
17 | |||
18 | #include <net/inet_sock.h> | ||
19 | |||
17 | #include "nfs4_fs.h" | 20 | #include "nfs4_fs.h" |
18 | #include "callback.h" | 21 | #include "callback.h" |
19 | 22 | ||
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c index b497c71384e8..079228817603 100644 --- a/fs/nfs/direct.c +++ b/fs/nfs/direct.c | |||
@@ -678,15 +678,9 @@ nfs_file_direct_read(struct kiocb *iocb, char __user *buf, size_t count, loff_t | |||
678 | if (!count) | 678 | if (!count) |
679 | goto out; | 679 | goto out; |
680 | 680 | ||
681 | if (mapping->nrpages) { | 681 | retval = nfs_sync_mapping(mapping); |
682 | retval = filemap_fdatawrite(mapping); | 682 | if (retval) |
683 | if (retval == 0) | 683 | goto out; |
684 | retval = nfs_wb_all(inode); | ||
685 | if (retval == 0) | ||
686 | retval = filemap_fdatawait(mapping); | ||
687 | if (retval) | ||
688 | goto out; | ||
689 | } | ||
690 | 684 | ||
691 | retval = nfs_direct_read(inode, ctx, &iov, pos, 1); | 685 | retval = nfs_direct_read(inode, ctx, &iov, pos, 1); |
692 | if (retval > 0) | 686 | if (retval > 0) |
@@ -764,15 +758,9 @@ nfs_file_direct_write(struct kiocb *iocb, const char __user *buf, size_t count, | |||
764 | if (!count) | 758 | if (!count) |
765 | goto out; | 759 | goto out; |
766 | 760 | ||
767 | if (mapping->nrpages) { | 761 | retval = nfs_sync_mapping(mapping); |
768 | retval = filemap_fdatawrite(mapping); | 762 | if (retval) |
769 | if (retval == 0) | 763 | goto out; |
770 | retval = nfs_wb_all(inode); | ||
771 | if (retval == 0) | ||
772 | retval = filemap_fdatawait(mapping); | ||
773 | if (retval) | ||
774 | goto out; | ||
775 | } | ||
776 | 764 | ||
777 | retval = nfs_direct_write(inode, ctx, &iov, pos, 1); | 765 | retval = nfs_direct_write(inode, ctx, &iov, pos, 1); |
778 | if (mapping->nrpages) | 766 | if (mapping->nrpages) |
diff --git a/fs/nfs/file.c b/fs/nfs/file.c index 57d3e77d97ee..7a79fbe9f539 100644 --- a/fs/nfs/file.c +++ b/fs/nfs/file.c | |||
@@ -433,11 +433,7 @@ static int do_unlk(struct file *filp, int cmd, struct file_lock *fl) | |||
433 | * Flush all pending writes before doing anything | 433 | * Flush all pending writes before doing anything |
434 | * with locks.. | 434 | * with locks.. |
435 | */ | 435 | */ |
436 | filemap_fdatawrite(filp->f_mapping); | 436 | nfs_sync_mapping(filp->f_mapping); |
437 | down(&inode->i_sem); | ||
438 | nfs_wb_all(inode); | ||
439 | up(&inode->i_sem); | ||
440 | filemap_fdatawait(filp->f_mapping); | ||
441 | 437 | ||
442 | /* NOTE: special case | 438 | /* NOTE: special case |
443 | * If we're signalled while cleaning up locks on process exit, we | 439 | * If we're signalled while cleaning up locks on process exit, we |
@@ -465,15 +461,8 @@ static int do_setlk(struct file *filp, int cmd, struct file_lock *fl) | |||
465 | * Flush all pending writes before doing anything | 461 | * Flush all pending writes before doing anything |
466 | * with locks.. | 462 | * with locks.. |
467 | */ | 463 | */ |
468 | status = filemap_fdatawrite(filp->f_mapping); | 464 | status = nfs_sync_mapping(filp->f_mapping); |
469 | if (status == 0) { | 465 | if (status != 0) |
470 | down(&inode->i_sem); | ||
471 | status = nfs_wb_all(inode); | ||
472 | up(&inode->i_sem); | ||
473 | if (status == 0) | ||
474 | status = filemap_fdatawait(filp->f_mapping); | ||
475 | } | ||
476 | if (status < 0) | ||
477 | goto out; | 466 | goto out; |
478 | 467 | ||
479 | lock_kernel(); | 468 | lock_kernel(); |
@@ -497,11 +486,7 @@ static int do_setlk(struct file *filp, int cmd, struct file_lock *fl) | |||
497 | * Make sure we clear the cache whenever we try to get the lock. | 486 | * Make sure we clear the cache whenever we try to get the lock. |
498 | * This makes locking act as a cache coherency point. | 487 | * This makes locking act as a cache coherency point. |
499 | */ | 488 | */ |
500 | filemap_fdatawrite(filp->f_mapping); | 489 | nfs_sync_mapping(filp->f_mapping); |
501 | down(&inode->i_sem); | ||
502 | nfs_wb_all(inode); /* we may have slept */ | ||
503 | up(&inode->i_sem); | ||
504 | filemap_fdatawait(filp->f_mapping); | ||
505 | nfs_zap_caches(inode); | 490 | nfs_zap_caches(inode); |
506 | out: | 491 | out: |
507 | rpc_clnt_sigunmask(NFS_CLIENT(inode), &oldset); | 492 | rpc_clnt_sigunmask(NFS_CLIENT(inode), &oldset); |
@@ -524,7 +509,8 @@ static int nfs_lock(struct file *filp, int cmd, struct file_lock *fl) | |||
524 | return -EINVAL; | 509 | return -EINVAL; |
525 | 510 | ||
526 | /* No mandatory locks over NFS */ | 511 | /* No mandatory locks over NFS */ |
527 | if ((inode->i_mode & (S_ISGID | S_IXGRP)) == S_ISGID) | 512 | if ((inode->i_mode & (S_ISGID | S_IXGRP)) == S_ISGID && |
513 | fl->fl_type != F_UNLCK) | ||
528 | return -ENOLCK; | 514 | return -ENOLCK; |
529 | 515 | ||
530 | if (IS_GETLK(cmd)) | 516 | if (IS_GETLK(cmd)) |
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index afd75d0463fd..432f41cd75e6 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c | |||
@@ -640,6 +640,27 @@ static int nfs_show_options(struct seq_file *m, struct vfsmount *mnt) | |||
640 | return 0; | 640 | return 0; |
641 | } | 641 | } |
642 | 642 | ||
643 | /** | ||
644 | * nfs_sync_mapping - helper to flush all mmapped dirty data to disk | ||
645 | */ | ||
646 | int nfs_sync_mapping(struct address_space *mapping) | ||
647 | { | ||
648 | int ret; | ||
649 | |||
650 | if (mapping->nrpages == 0) | ||
651 | return 0; | ||
652 | unmap_mapping_range(mapping, 0, 0, 0); | ||
653 | ret = filemap_fdatawrite(mapping); | ||
654 | if (ret != 0) | ||
655 | goto out; | ||
656 | ret = filemap_fdatawait(mapping); | ||
657 | if (ret != 0) | ||
658 | goto out; | ||
659 | ret = nfs_wb_all(mapping->host); | ||
660 | out: | ||
661 | return ret; | ||
662 | } | ||
663 | |||
643 | /* | 664 | /* |
644 | * Invalidate the local caches | 665 | * Invalidate the local caches |
645 | */ | 666 | */ |
@@ -1179,11 +1200,8 @@ void nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping) | |||
1179 | struct nfs_inode *nfsi = NFS_I(inode); | 1200 | struct nfs_inode *nfsi = NFS_I(inode); |
1180 | 1201 | ||
1181 | if (nfsi->cache_validity & NFS_INO_INVALID_DATA) { | 1202 | if (nfsi->cache_validity & NFS_INO_INVALID_DATA) { |
1182 | if (S_ISREG(inode->i_mode)) { | 1203 | if (S_ISREG(inode->i_mode)) |
1183 | if (filemap_fdatawrite(mapping) == 0) | 1204 | nfs_sync_mapping(mapping); |
1184 | filemap_fdatawait(mapping); | ||
1185 | nfs_wb_all(inode); | ||
1186 | } | ||
1187 | invalidate_inode_pages2(mapping); | 1205 | invalidate_inode_pages2(mapping); |
1188 | 1206 | ||
1189 | spin_lock(&inode->i_lock); | 1207 | spin_lock(&inode->i_lock); |
diff --git a/fs/nfsd/nfs2acl.c b/fs/nfsd/nfs2acl.c index 7cbf0682b2f0..fc95c4df6693 100644 --- a/fs/nfsd/nfs2acl.c +++ b/fs/nfsd/nfs2acl.c | |||
@@ -107,7 +107,7 @@ static int nfsacld_proc_setacl(struct svc_rqst * rqstp, | |||
107 | dprintk("nfsd: SETACL(2acl) %s\n", SVCFH_fmt(&argp->fh)); | 107 | dprintk("nfsd: SETACL(2acl) %s\n", SVCFH_fmt(&argp->fh)); |
108 | 108 | ||
109 | fh = fh_copy(&resp->fh, &argp->fh); | 109 | fh = fh_copy(&resp->fh, &argp->fh); |
110 | nfserr = fh_verify(rqstp, &resp->fh, 0, MAY_NOP); | 110 | nfserr = fh_verify(rqstp, &resp->fh, 0, MAY_SATTR); |
111 | 111 | ||
112 | if (!nfserr) { | 112 | if (!nfserr) { |
113 | nfserr = nfserrno( nfsd_set_posix_acl( | 113 | nfserr = nfserrno( nfsd_set_posix_acl( |
diff --git a/fs/nfsd/nfs3acl.c b/fs/nfsd/nfs3acl.c index 64ba40572fea..16e10c170aed 100644 --- a/fs/nfsd/nfs3acl.c +++ b/fs/nfsd/nfs3acl.c | |||
@@ -101,7 +101,7 @@ static int nfsd3_proc_setacl(struct svc_rqst * rqstp, | |||
101 | int nfserr = 0; | 101 | int nfserr = 0; |
102 | 102 | ||
103 | fh = fh_copy(&resp->fh, &argp->fh); | 103 | fh = fh_copy(&resp->fh, &argp->fh); |
104 | nfserr = fh_verify(rqstp, &resp->fh, 0, MAY_NOP); | 104 | nfserr = fh_verify(rqstp, &resp->fh, 0, MAY_SATTR); |
105 | 105 | ||
106 | if (!nfserr) { | 106 | if (!nfserr) { |
107 | nfserr = nfserrno( nfsd_set_posix_acl( | 107 | nfserr = nfserrno( nfsd_set_posix_acl( |
diff --git a/fs/partitions/Kconfig b/fs/partitions/Kconfig index deb25b661f04..656bc43431b9 100644 --- a/fs/partitions/Kconfig +++ b/fs/partitions/Kconfig | |||
@@ -203,7 +203,7 @@ config ULTRIX_PARTITION | |||
203 | 203 | ||
204 | config SUN_PARTITION | 204 | config SUN_PARTITION |
205 | bool "Sun partition tables support" if PARTITION_ADVANCED | 205 | bool "Sun partition tables support" if PARTITION_ADVANCED |
206 | default y if (SPARC32 || SPARC64 || SUN3 || SUN3X) | 206 | default y if (SPARC || SUN3 || SUN3X) |
207 | ---help--- | 207 | ---help--- |
208 | Like most systems, SunOS uses its own hard disk partition table | 208 | Like most systems, SunOS uses its own hard disk partition table |
209 | format, incompatible with all others. Saying Y here allows you to | 209 | format, incompatible with all others. Saying Y here allows you to |
diff --git a/fs/proc/generic.c b/fs/proc/generic.c index b638fb500743..72b431d0a0a4 100644 --- a/fs/proc/generic.c +++ b/fs/proc/generic.c | |||
@@ -54,6 +54,18 @@ proc_file_read(struct file *file, char __user *buf, size_t nbytes, | |||
54 | ssize_t n, count; | 54 | ssize_t n, count; |
55 | char *start; | 55 | char *start; |
56 | struct proc_dir_entry * dp; | 56 | struct proc_dir_entry * dp; |
57 | unsigned long long pos; | ||
58 | |||
59 | /* | ||
60 | * Gaah, please just use "seq_file" instead. The legacy /proc | ||
61 | * interfaces cut loff_t down to off_t for reads, and ignore | ||
62 | * the offset entirely for writes.. | ||
63 | */ | ||
64 | pos = *ppos; | ||
65 | if (pos > MAX_NON_LFS) | ||
66 | return 0; | ||
67 | if (nbytes > MAX_NON_LFS - pos) | ||
68 | nbytes = MAX_NON_LFS - pos; | ||
57 | 69 | ||
58 | dp = PDE(inode); | 70 | dp = PDE(inode); |
59 | if (!(page = (char*) __get_free_page(GFP_KERNEL))) | 71 | if (!(page = (char*) __get_free_page(GFP_KERNEL))) |
@@ -202,30 +214,17 @@ proc_file_write(struct file *file, const char __user *buffer, | |||
202 | static loff_t | 214 | static loff_t |
203 | proc_file_lseek(struct file *file, loff_t offset, int orig) | 215 | proc_file_lseek(struct file *file, loff_t offset, int orig) |
204 | { | 216 | { |
205 | lock_kernel(); | 217 | loff_t retval = -EINVAL; |
206 | 218 | switch (orig) { | |
207 | switch (orig) { | 219 | case 1: |
208 | case 0: | 220 | offset += file->f_pos; |
209 | if (offset < 0) | 221 | /* fallthrough */ |
210 | goto out; | 222 | case 0: |
211 | file->f_pos = offset; | 223 | if (offset < 0 || offset > MAX_NON_LFS) |
212 | unlock_kernel(); | 224 | break; |
213 | return(file->f_pos); | 225 | file->f_pos = retval = offset; |
214 | case 1: | 226 | } |
215 | if (offset + file->f_pos < 0) | 227 | return retval; |
216 | goto out; | ||
217 | file->f_pos += offset; | ||
218 | unlock_kernel(); | ||
219 | return(file->f_pos); | ||
220 | case 2: | ||
221 | goto out; | ||
222 | default: | ||
223 | goto out; | ||
224 | } | ||
225 | |||
226 | out: | ||
227 | unlock_kernel(); | ||
228 | return -EINVAL; | ||
229 | } | 228 | } |
230 | 229 | ||
231 | static int proc_notify_change(struct dentry *dentry, struct iattr *iattr) | 230 | static int proc_notify_change(struct dentry *dentry, struct iattr *iattr) |
diff --git a/fs/read_write.c b/fs/read_write.c index a091ee4f430d..df3468a22fea 100644 --- a/fs/read_write.c +++ b/fs/read_write.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/security.h> | 14 | #include <linux/security.h> |
15 | #include <linux/module.h> | 15 | #include <linux/module.h> |
16 | #include <linux/syscalls.h> | 16 | #include <linux/syscalls.h> |
17 | #include <linux/pagemap.h> | ||
17 | 18 | ||
18 | #include <asm/uaccess.h> | 19 | #include <asm/uaccess.h> |
19 | #include <asm/unistd.h> | 20 | #include <asm/unistd.h> |
@@ -182,22 +183,33 @@ bad: | |||
182 | } | 183 | } |
183 | #endif | 184 | #endif |
184 | 185 | ||
186 | /* | ||
187 | * rw_verify_area doesn't like huge counts. We limit | ||
188 | * them to something that fits in "int" so that others | ||
189 | * won't have to do range checks all the time. | ||
190 | */ | ||
191 | #define MAX_RW_COUNT (INT_MAX & PAGE_CACHE_MASK) | ||
185 | 192 | ||
186 | int rw_verify_area(int read_write, struct file *file, loff_t *ppos, size_t count) | 193 | int rw_verify_area(int read_write, struct file *file, loff_t *ppos, size_t count) |
187 | { | 194 | { |
188 | struct inode *inode; | 195 | struct inode *inode; |
189 | loff_t pos; | 196 | loff_t pos; |
190 | 197 | ||
191 | if (unlikely(count > INT_MAX)) | 198 | if (unlikely((ssize_t) count < 0)) |
192 | goto Einval; | 199 | goto Einval; |
193 | pos = *ppos; | 200 | pos = *ppos; |
194 | if (unlikely((pos < 0) || (loff_t) (pos + count) < 0)) | 201 | if (unlikely((pos < 0) || (loff_t) (pos + count) < 0)) |
195 | goto Einval; | 202 | goto Einval; |
196 | 203 | ||
197 | inode = file->f_dentry->d_inode; | 204 | inode = file->f_dentry->d_inode; |
198 | if (inode->i_flock && MANDATORY_LOCK(inode)) | 205 | if (inode->i_flock && MANDATORY_LOCK(inode)) { |
199 | return locks_mandatory_area(read_write == READ ? FLOCK_VERIFY_READ : FLOCK_VERIFY_WRITE, inode, file, pos, count); | 206 | int retval = locks_mandatory_area( |
200 | return 0; | 207 | read_write == READ ? FLOCK_VERIFY_READ : FLOCK_VERIFY_WRITE, |
208 | inode, file, pos, count); | ||
209 | if (retval < 0) | ||
210 | return retval; | ||
211 | } | ||
212 | return count > MAX_RW_COUNT ? MAX_RW_COUNT : count; | ||
201 | 213 | ||
202 | Einval: | 214 | Einval: |
203 | return -EINVAL; | 215 | return -EINVAL; |
@@ -244,7 +256,8 @@ ssize_t vfs_read(struct file *file, char __user *buf, size_t count, loff_t *pos) | |||
244 | return -EFAULT; | 256 | return -EFAULT; |
245 | 257 | ||
246 | ret = rw_verify_area(READ, file, pos, count); | 258 | ret = rw_verify_area(READ, file, pos, count); |
247 | if (!ret) { | 259 | if (ret >= 0) { |
260 | count = ret; | ||
248 | ret = security_file_permission (file, MAY_READ); | 261 | ret = security_file_permission (file, MAY_READ); |
249 | if (!ret) { | 262 | if (!ret) { |
250 | if (file->f_op->read) | 263 | if (file->f_op->read) |
@@ -295,7 +308,8 @@ ssize_t vfs_write(struct file *file, const char __user *buf, size_t count, loff_ | |||
295 | return -EFAULT; | 308 | return -EFAULT; |
296 | 309 | ||
297 | ret = rw_verify_area(WRITE, file, pos, count); | 310 | ret = rw_verify_area(WRITE, file, pos, count); |
298 | if (!ret) { | 311 | if (ret >= 0) { |
312 | count = ret; | ||
299 | ret = security_file_permission (file, MAY_WRITE); | 313 | ret = security_file_permission (file, MAY_WRITE); |
300 | if (!ret) { | 314 | if (!ret) { |
301 | if (file->f_op->write) | 315 | if (file->f_op->write) |
@@ -497,7 +511,7 @@ static ssize_t do_readv_writev(int type, struct file *file, | |||
497 | } | 511 | } |
498 | 512 | ||
499 | ret = rw_verify_area(type, file, pos, tot_len); | 513 | ret = rw_verify_area(type, file, pos, tot_len); |
500 | if (ret) | 514 | if (ret < 0) |
501 | goto out; | 515 | goto out; |
502 | ret = security_file_permission(file, type == READ ? MAY_READ : MAY_WRITE); | 516 | ret = security_file_permission(file, type == READ ? MAY_READ : MAY_WRITE); |
503 | if (ret) | 517 | if (ret) |
@@ -653,8 +667,9 @@ static ssize_t do_sendfile(int out_fd, int in_fd, loff_t *ppos, | |||
653 | if (!(in_file->f_mode & FMODE_PREAD)) | 667 | if (!(in_file->f_mode & FMODE_PREAD)) |
654 | goto fput_in; | 668 | goto fput_in; |
655 | retval = rw_verify_area(READ, in_file, ppos, count); | 669 | retval = rw_verify_area(READ, in_file, ppos, count); |
656 | if (retval) | 670 | if (retval < 0) |
657 | goto fput_in; | 671 | goto fput_in; |
672 | count = retval; | ||
658 | 673 | ||
659 | retval = security_file_permission (in_file, MAY_READ); | 674 | retval = security_file_permission (in_file, MAY_READ); |
660 | if (retval) | 675 | if (retval) |
@@ -674,8 +689,9 @@ static ssize_t do_sendfile(int out_fd, int in_fd, loff_t *ppos, | |||
674 | goto fput_out; | 689 | goto fput_out; |
675 | out_inode = out_file->f_dentry->d_inode; | 690 | out_inode = out_file->f_dentry->d_inode; |
676 | retval = rw_verify_area(WRITE, out_file, &out_file->f_pos, count); | 691 | retval = rw_verify_area(WRITE, out_file, &out_file->f_pos, count); |
677 | if (retval) | 692 | if (retval < 0) |
678 | goto fput_out; | 693 | goto fput_out; |
694 | count = retval; | ||
679 | 695 | ||
680 | retval = security_file_permission (out_file, MAY_WRITE); | 696 | retval = security_file_permission (out_file, MAY_WRITE); |
681 | if (retval) | 697 | if (retval) |
diff --git a/fs/relayfs/relay.c b/fs/relayfs/relay.c index 16446a15c96d..2a6f7f12b7f9 100644 --- a/fs/relayfs/relay.c +++ b/fs/relayfs/relay.c | |||
@@ -333,8 +333,7 @@ size_t relay_switch_subbuf(struct rchan_buf *buf, size_t length) | |||
333 | return length; | 333 | return length; |
334 | 334 | ||
335 | toobig: | 335 | toobig: |
336 | printk(KERN_WARNING "relayfs: event too large (%Zd)\n", length); | 336 | buf->chan->last_toobig = length; |
337 | WARN_ON(1); | ||
338 | return 0; | 337 | return 0; |
339 | } | 338 | } |
340 | 339 | ||
@@ -399,6 +398,11 @@ void relay_close(struct rchan *chan) | |||
399 | relay_close_buf(chan->buf[i]); | 398 | relay_close_buf(chan->buf[i]); |
400 | } | 399 | } |
401 | 400 | ||
401 | if (chan->last_toobig) | ||
402 | printk(KERN_WARNING "relayfs: one or more items not logged " | ||
403 | "[item size (%Zd) > sub-buffer size (%Zd)]\n", | ||
404 | chan->last_toobig, chan->subbuf_size); | ||
405 | |||
402 | kref_put(&chan->kref, relay_destroy_channel); | 406 | kref_put(&chan->kref, relay_destroy_channel); |
403 | } | 407 | } |
404 | 408 | ||