[PATCH] NFS: initialize nfs_open_context.list member at allocation time

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



alloc_nfs_open_context creates a nfs_open_context struct, but doesn't
initialize the list_head embedded in it. In newer kernels, this is
harmless since the ctx is always put on a list soon after creation. In
an older RHEL4 kernel however, it's possible (though unlikely) for a ctx
to be passed to put_nfs_open_context without ever being put on a list,
which can cause an oops.

Since it's hard to predict how this code will change in the future,
let's go ahead and initialize the list.

Reported-by: Paul Bunyan <pbunyan@xxxxxxxxxx>
Signed-off-by: Jeff Layton <jlayton@xxxxxxxxxx>
---
 fs/nfs/inode.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 7d2d6c7..3185fc2 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -638,6 +638,7 @@ static struct nfs_open_context *alloc_nfs_open_context(struct path *path, struct
 		ctx->dir_cookie = 0;
 		nfs_init_lock_context(&ctx->lock_context);
 		ctx->lock_context.open_context = ctx;
+		INIT_LIST_HEAD(&ctx->list);
 	}
 	return ctx;
 }
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux