From patchwork Wed Sep 25 20:20:57 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 2944101 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id DC2529F289 for ; Wed, 25 Sep 2013 20:21:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A0F782038B for ; Wed, 25 Sep 2013 20:21:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 526542037D for ; Wed, 25 Sep 2013 20:21:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755090Ab3IYUU7 (ORCPT ); Wed, 25 Sep 2013 16:20:59 -0400 Received: from mx1.redhat.com ([209.132.183.28]:64218 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755216Ab3IYUU6 (ORCPT ); Wed, 25 Sep 2013 16:20:58 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r8PKKv1x014175 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 25 Sep 2013 16:20:57 -0400 Received: from sikun.lab.eng.rdu2.redhat.com (sikun.lab.eng.rdu2.redhat.com [10.8.0.43]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r8PKKvIV011488; Wed, 25 Sep 2013 16:20:57 -0400 From: Jeff Layton 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 Message-Id: <1380140457-27408-1-git-send-email-jlayton@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-8.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Cc: # v3.10+ Signed-off-by: Jeff Layton --- 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);