Преглед на файлове

NFS: Prevent integer overflow in nfs_scan_list()

Also ensure that nfs_inode ncommit and npages are large enough to represent
all possible values for the number of pages.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Trond Myklebust преди 18 години
родител
ревизия
dce34ce298
променени са 2 файла, в които са добавени 3 реда и са изтрити 1 реда
  1. 2 0
      fs/nfs/pagelist.c
  2. 1 1
      include/linux/nfs_fs.h

+ 2 - 0
fs/nfs/pagelist.c

@@ -425,6 +425,8 @@ int nfs_scan_list(struct nfs_inode *nfsi,
 						req->wb_index, tag);
 						req->wb_index, tag);
 				nfs_list_add_request(req, dst);
 				nfs_list_add_request(req, dst);
 				res++;
 				res++;
+				if (res == INT_MAX)
+					goto out;
 			}
 			}
 		}
 		}
 
 

+ 1 - 1
include/linux/nfs_fs.h

@@ -158,7 +158,7 @@ struct nfs_inode {
 	spinlock_t		req_lock;
 	spinlock_t		req_lock;
 	struct radix_tree_root	nfs_page_tree;
 	struct radix_tree_root	nfs_page_tree;
 
 
-	unsigned int		ncommit,
+	unsigned long		ncommit,
 				npages;
 				npages;
 
 
 	/* Open contexts for shared mmap writes */
 	/* Open contexts for shared mmap writes */