linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@redhat.com>
To: trond.myklebust@netapp.com
Cc: linux-nfs@vger.kernel.org, andros@netapp.com
Subject: [PATCH] nfs: fix NULL pointer dereference in nfs4_fl_prepare_ds
Date: Wed, 25 Sep 2013 16:20:57 -0400	[thread overview]
Message-ID: <1380140457-27408-1-git-send-email-jlayton@redhat.com> (raw)

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@netapp.com>
Cc: <stable@vger.kernel.org> # v3.10+
Signed-off-by: Jeff Layton <jlayton@redhat.com>
---
 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


             reply	other threads:[~2013-09-25 20:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-25 20:20 Jeff Layton [this message]
2013-09-26 14:19 ` [PATCH] nfs: fix NULL pointer dereference in nfs4_fl_prepare_ds Jeff Layton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1380140457-27408-1-git-send-email-jlayton@redhat.com \
    --to=jlayton@redhat.com \
    --cc=andros@netapp.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=trond.myklebust@netapp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).