NFS: Fix a use-before-initialised warning in fs/nfs/write.c and fs/nfs/pnfs.c
authorTrond Myklebust <Trond.Myklebust@netapp.com>
Fri, 27 Apr 2012 18:31:47 +0000 (14:31 -0400)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Fri, 27 Apr 2012 19:03:51 +0000 (15:03 -0400)
If the allocation of nfs_write_header fails, the list of nfs_pages that
needs to be cleaned up is still on desc->pg_list...

Reported-by: Bryan Schumaker <bjschuma@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Acked-by: Fred Isaman <iisaman@netapp.com>
fs/nfs/pnfs.c
fs/nfs/write.c

index 4da05e469be51594373932f759800a6862849648..39cbac548730bd74144bf82ecc79c467bfd52cd8 100644 (file)
@@ -1308,7 +1308,7 @@ pnfs_generic_pg_writepages(struct nfs_pageio_descriptor *desc)
 
        whdr = nfs_writehdr_alloc();
        if (!whdr) {
-               desc->pg_completion_ops->error_cleanup(&hdr->pages);
+               desc->pg_completion_ops->error_cleanup(&desc->pg_list);
                put_lseg(desc->pg_lseg);
                desc->pg_lseg = NULL;
                return -ENOMEM;
index fec214bfa7024a1dd5f0c77ac7d5d4888df421d1..3636191c39968c0d812207d125542c725a6de572 100644 (file)
@@ -1164,7 +1164,7 @@ static int nfs_generic_pg_writepages(struct nfs_pageio_descriptor *desc)
 
        whdr = nfs_writehdr_alloc();
        if (!whdr) {
-               desc->pg_completion_ops->error_cleanup(&hdr->pages);
+               desc->pg_completion_ops->error_cleanup(&desc->pg_list);
                return -ENOMEM;
        }
        hdr = &whdr->header;