[PATCH] nfs: fix NULL pointer dereference in nfs4_fl_prepare_ds

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

 



In the event that there is an error connecting to a DS, we currently
zero out the ds pointer and then try to dereference it to clear the
NFS4DS_CONNECTING bit.

Fix this by clearing the bit unconditionally before zeroing out the
pointer.

Cc: Andy Adamson <andros@xxxxxxxxxx>
Cc: <stable@xxxxxxxxxxxxxxx> # v3.10+
Signed-off-by: Jeff Layton <jlayton@xxxxxxxxxx>
---
 fs/nfs/nfs4filelayoutdev.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/nfs/nfs4filelayoutdev.c b/fs/nfs/nfs4filelayoutdev.c
index 95604f6..816cda8 100644
--- a/fs/nfs/nfs4filelayoutdev.c
+++ b/fs/nfs/nfs4filelayoutdev.c
@@ -819,11 +819,11 @@ nfs4_fl_prepare_ds(struct pnfs_layout_segment *lseg, u32 ds_idx)
 		int err;
 
 		err = nfs4_ds_connect(s, ds);
+		nfs4_clear_ds_conn_bit(ds);
 		if (err) {
 			nfs4_mark_deviceid_unavailable(devid);
 			ds = NULL;
 		}
-		nfs4_clear_ds_conn_bit(ds);
 	} else {
 		/* Either ds is connected, or ds is NULL */
 		nfs4_wait_ds_connect(ds);
-- 
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