From f16c960332b125491178fc2da7ea7893b0d65d05 Mon Sep 17 00:00:00 2001 From: Russell King Date: Fri, 16 Nov 2007 22:13:24 +0000 Subject: NFS: mount failure causes bad page state While testing a kernel based upon ecd744eec3aa8bbc949ec04ed3fbf7ecb2958a0e (with wrong boot arguments), I got the following bad page state entry while NFS was trying to mount it's rootfs: IP-Config: Complete: device=eth0, addr=192.168.1.101, mask=255.255.255.0, gw=255.255.255.255, host=192.168.1.101, domain=, nis-domain=(none), bootserver=192.168.1.100, rootserver=192.168.1.100, rootpath= Looking up port of RPC 100003/2 on 192.168.1.100 rpcbind: server 192.168.1.100 not responding, timed out Root-NFS: Unable to get nfsd port number from server, using default Looking up port of RPC 100005/1 on 192.168.1.100 rpcbind: server 192.168.1.100 not responding, timed out Root-NFS: Unable to get mountd port number from server, using default mount: server 192.168.1.100 not responding, timed out Root-NFS: Server returned error -5 while mounting /nfs/rootfs/ VFS: Unable to mount root fs via NFS, trying floppy. Bad page state in process 'swapper' page:c02b1260 flags:0x00000400 mapping:00000000 mapcount:0 count:0 Trying to fix it up, but a reboot is needed Backtrace: [] (dump_stack+0x0/0x14) from [] (bad_page+0x70/0xac) [] (bad_page+0x0/0xac) from [] (free_hot_cold_page+0x80/0x178) [] (free_hot_cold_page+0x0/0x178) from [] (free_hot_page+0x14/0x18) [] (free_hot_page+0x0/0x18) from [] (put_page+0xf8/0x154) [] (put_page+0x0/0x154) from [] (kfree+0xc8/0xd0) [] (kfree+0x0/0xd0) from [] (nfs_get_sb+0x230/0x710) [] (nfs_get_sb+0x0/0x710) from [] (vfs_kern_mount+0x58/0xac)[] (vfs_kern_mount+0x0/0xac) from [] (do_kern_mount+0x38/0xf4) [] (do_kern_mount+0x0/0xf4) from [] (do_mount+0x1e8/0x614) ... This seems to be caused by use of an uninitialised structure due to NULL options being passed to nfs_validate_mount_data(). Ensure that the parsed mount data is always initialised. Signed-off-by: Russell King (Trond: added fix for the same bug in nfs4_validate_mount_data()). Signed-off-by: Trond Myklebust --- fs/nfs/super.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'fs/nfs') diff --git a/fs/nfs/super.c b/fs/nfs/super.c index 71067d1ac9d..2426e713b77 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c @@ -1054,10 +1054,11 @@ static int nfs_validate_mount_data(void *options, { struct nfs_mount_data *data = (struct nfs_mount_data *)options; + memset(args, 0, sizeof(*args)); + if (data == NULL) goto out_no_data; - memset(args, 0, sizeof(*args)); args->flags = (NFS_MOUNT_VER3 | NFS_MOUNT_TCP); args->rsize = NFS_MAX_FILE_IO_SIZE; args->wsize = NFS_MAX_FILE_IO_SIZE; @@ -1536,10 +1537,11 @@ static int nfs4_validate_mount_data(void *options, struct nfs4_mount_data *data = (struct nfs4_mount_data *)options; char *c; + memset(args, 0, sizeof(*args)); + if (data == NULL) goto out_no_data; - memset(args, 0, sizeof(*args)); args->rsize = NFS_MAX_FILE_IO_SIZE; args->wsize = NFS_MAX_FILE_IO_SIZE; args->timeo = 600; -- cgit v1.2.3