Skip to contentSkip to conversation

NFS: Prevent garbage cinfo->ds from leaking out

PATCH New Fred Isaman 1 participant 1 message Apr 24, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 NFS: Prevent garbage cinfo->ds from leaking out

This is a bugfix that applies on top of the previous directio patches, that fixes a bug introduced in "NFS: create struct nfs_commit_info".

---
 fs/nfs/nfs4filelayout.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
fs/nfs/nfs4filelayout.c +6 -1
index 806a55f..80a63f6 100644
@@ -1184,7 +1184,12 @@ filelayout_free_layout_hdr(struct pnfs_layout_hdr *lo)
 static struct pnfs_ds_commit_info *
 filelayout_get_ds_info(struct inode *inode)
 {
-	return &FILELAYOUT_FROM_HDR(NFS_I(inode)->layout)->commit_info;
+	struct pnfs_layout_hdr *layout = NFS_I(inode)->layout;
+
+	if (layout == NULL)
+		return NULL;
+	else
+		return &FILELAYOUT_FROM_HDR(layout)->commit_info;
 }
 
 static struct pnfs_layoutdriver_type filelayout_type = {
Signature · 1 line
1.7.2.1