diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-09-19 12:46:53 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-09-19 12:46:53 -0400 |
commit | 4ed4b5475211fab6a0ad00eed2f9297395e7598e (patch) | |
tree | 9849dc8e2bc0ad68ed03a48d686f8c0ed65995a7 | |
parent | 79e453d49bd49ba1b576f89310cc565c9e4ca379 (diff) | |
parent | 5c2d97cb31fb77981797fec46230ca005b865799 (diff) |
Merge branch 'fixes' of git://git.linux-nfs.org/pub/linux/nfs-2.6
* 'fixes' of git://git.linux-nfs.org/pub/linux/nfs-2.6:
NFS: Fix nfs_page use after free issues in fs/nfs/write.c
NFSv4: Fix incorrect semaphore release in _nfs4_do_open()
NFS: Fix Oopsable condition in nfs_readpage_sync()
-rw-r--r-- | fs/nfs/nfs4proc.c | 6 | ||||
-rw-r--r-- | fs/nfs/read.c | 6 | ||||
-rw-r--r-- | fs/nfs/write.c | 4 |
3 files changed, 9 insertions, 7 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 153898e1331f..b14145b7b87f 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -970,7 +970,7 @@ static int _nfs4_do_open(struct inode *dir, struct dentry *dentry, int flags, st | |||
970 | status = -ENOMEM; | 970 | status = -ENOMEM; |
971 | opendata = nfs4_opendata_alloc(dentry, sp, flags, sattr); | 971 | opendata = nfs4_opendata_alloc(dentry, sp, flags, sattr); |
972 | if (opendata == NULL) | 972 | if (opendata == NULL) |
973 | goto err_put_state_owner; | 973 | goto err_release_rwsem; |
974 | 974 | ||
975 | status = _nfs4_proc_open(opendata); | 975 | status = _nfs4_proc_open(opendata); |
976 | if (status != 0) | 976 | if (status != 0) |
@@ -989,11 +989,11 @@ static int _nfs4_do_open(struct inode *dir, struct dentry *dentry, int flags, st | |||
989 | return 0; | 989 | return 0; |
990 | err_opendata_free: | 990 | err_opendata_free: |
991 | nfs4_opendata_free(opendata); | 991 | nfs4_opendata_free(opendata); |
992 | err_release_rwsem: | ||
993 | up_read(&clp->cl_sem); | ||
992 | err_put_state_owner: | 994 | err_put_state_owner: |
993 | nfs4_put_state_owner(sp); | 995 | nfs4_put_state_owner(sp); |
994 | out_err: | 996 | out_err: |
995 | /* Note: clp->cl_sem must be released before nfs4_put_open_state()! */ | ||
996 | up_read(&clp->cl_sem); | ||
997 | *res = NULL; | 997 | *res = NULL; |
998 | return status; | 998 | return status; |
999 | } | 999 | } |
diff --git a/fs/nfs/read.c b/fs/nfs/read.c index 7a9ee00e0c61..f0aff824a291 100644 --- a/fs/nfs/read.c +++ b/fs/nfs/read.c | |||
@@ -204,9 +204,11 @@ static int nfs_readpage_sync(struct nfs_open_context *ctx, struct inode *inode, | |||
204 | NFS_I(inode)->cache_validity |= NFS_INO_INVALID_ATIME; | 204 | NFS_I(inode)->cache_validity |= NFS_INO_INVALID_ATIME; |
205 | spin_unlock(&inode->i_lock); | 205 | spin_unlock(&inode->i_lock); |
206 | 206 | ||
207 | nfs_readpage_truncate_uninitialised_page(rdata); | 207 | if (rdata->res.eof || rdata->res.count == rdata->args.count) { |
208 | if (rdata->res.eof || rdata->res.count == rdata->args.count) | ||
209 | SetPageUptodate(page); | 208 | SetPageUptodate(page); |
209 | if (rdata->res.eof && count != 0) | ||
210 | memclear_highpage_flush(page, rdata->args.pgbase, count); | ||
211 | } | ||
210 | result = 0; | 212 | result = 0; |
211 | 213 | ||
212 | io_error: | 214 | io_error: |
diff --git a/fs/nfs/write.c b/fs/nfs/write.c index 8ab3cf10d792..7084ac9a6455 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c | |||
@@ -590,8 +590,8 @@ static void nfs_cancel_commit_list(struct list_head *head) | |||
590 | req = nfs_list_entry(head->next); | 590 | req = nfs_list_entry(head->next); |
591 | nfs_list_remove_request(req); | 591 | nfs_list_remove_request(req); |
592 | nfs_inode_remove_request(req); | 592 | nfs_inode_remove_request(req); |
593 | nfs_clear_page_writeback(req); | ||
594 | dec_zone_page_state(req->wb_page, NR_UNSTABLE_NFS); | 593 | dec_zone_page_state(req->wb_page, NR_UNSTABLE_NFS); |
594 | nfs_clear_page_writeback(req); | ||
595 | } | 595 | } |
596 | } | 596 | } |
597 | 597 | ||
@@ -1386,8 +1386,8 @@ nfs_commit_list(struct inode *inode, struct list_head *head, int how) | |||
1386 | req = nfs_list_entry(head->next); | 1386 | req = nfs_list_entry(head->next); |
1387 | nfs_list_remove_request(req); | 1387 | nfs_list_remove_request(req); |
1388 | nfs_mark_request_commit(req); | 1388 | nfs_mark_request_commit(req); |
1389 | nfs_clear_page_writeback(req); | ||
1390 | dec_zone_page_state(req->wb_page, NR_UNSTABLE_NFS); | 1389 | dec_zone_page_state(req->wb_page, NR_UNSTABLE_NFS); |
1390 | nfs_clear_page_writeback(req); | ||
1391 | } | 1391 | } |
1392 | return -ENOMEM; | 1392 | return -ENOMEM; |
1393 | } | 1393 | } |