From patchwork Tue May 24 15:04:40 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boaz Harrosh X-Patchwork-Id: 812462 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p4OF5M9c022471 for ; Tue, 24 May 2011 15:05:23 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754500Ab1EXPFQ (ORCPT ); Tue, 24 May 2011 11:05:16 -0400 Received: from daytona.panasas.com ([67.152.220.89]:46583 "EHLO daytona.panasas.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754482Ab1EXPFM (ORCPT ); Tue, 24 May 2011 11:05:12 -0400 Received: from fs2.bhalevy.com ([172.17.33.70]) by daytona.panasas.com with Microsoft SMTPSVC(6.0.3790.4675); Tue, 24 May 2011 11:05:11 -0400 From: Boaz Harrosh To: Benny Halevy , Trond Myklebust , NFS list Subject: [PATCH 02/12] SQUASHME: Bug in new global-device-cache code Date: Tue, 24 May 2011 18:04:40 +0300 Message-Id: <1306249480-23212-1-git-send-email-bharrosh@panasas.com> X-Mailer: git-send-email 1.7.2.3 In-Reply-To: <4DDBC611.3050202@panasas.com> References: <4DDBC611.3050202@panasas.com> X-OriginalArrivalTime: 24 May 2011 15:05:11.0563 (UTC) FILETIME=[FA7DD5B0:01CC1A23] Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Tue, 24 May 2011 15:05:23 +0000 (UTC) NULL deref on first ever call. (When device is not found) Signed-off-by: Boaz Harrosh --- fs/nfs/pnfs_dev.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/fs/nfs/pnfs_dev.c b/fs/nfs/pnfs_dev.c index 7997899..7e5542c 100644 --- a/fs/nfs/pnfs_dev.c +++ b/fs/nfs/pnfs_dev.c @@ -100,7 +100,7 @@ _find_get_deviceid(const struct pnfs_layoutdriver_type *ld, rcu_read_lock(); d = _lookup_deviceid(ld, clp, id, hash); - if (!atomic_inc_not_zero(&d->ref)) + if (!d || !atomic_inc_not_zero(&d->ref)) d = NULL; rcu_read_unlock(); return d;