From: Trond Myklebust Date: Sun, 17 Jun 2007 19:47:53 +0000 (-0400) Subject: NFS: Prevent integer overflow in nfs_scan_list() X-Git-Tag: v2.6.23-rc1~1073^2~102 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=dce34ce298d85b81630401f4feb4bd7ac77fe9c7;p=linux-2.6-omap-h63xx.git 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 --- diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c index ad90cbe7670..68f6bf12200 100644 --- a/fs/nfs/pagelist.c +++ b/fs/nfs/pagelist.c @@ -425,6 +425,8 @@ int nfs_scan_list(struct nfs_inode *nfsi, req->wb_index, tag); nfs_list_add_request(req, dst); res++; + if (res == INT_MAX) + goto out; } } diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index a9420547673..750708ccd70 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h @@ -158,7 +158,7 @@ struct nfs_inode { spinlock_t req_lock; struct radix_tree_root nfs_page_tree; - unsigned int ncommit, + unsigned long ncommit, npages; /* Open contexts for shared mmap writes */