From patchwork Sat Sep 28 12:34:44 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yan, Zheng" X-Patchwork-Id: 2957771 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 93242BFF0B for ; Sat, 28 Sep 2013 12:35:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CA21920345 for ; Sat, 28 Sep 2013 12:35:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 86D7720240 for ; Sat, 28 Sep 2013 12:35:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753487Ab3I1MfQ (ORCPT ); Sat, 28 Sep 2013 08:35:16 -0400 Received: from mga14.intel.com ([143.182.124.37]:53954 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753117Ab3I1MfP (ORCPT ); Sat, 28 Sep 2013 08:35:15 -0400 Received: from azsmga002.ch.intel.com ([10.2.17.35]) by azsmga102.ch.intel.com with ESMTP; 28 Sep 2013 05:35:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.90,999,1371106800"; d="scan'208";a="300491708" Received: from unknown (HELO zyan5-mobl.ccr.corp.intel.com) ([10.255.20.216]) by AZSMGA002.ch.intel.com with ESMTP; 28 Sep 2013 05:34:51 -0700 From: "Yan, Zheng" To: ceph-devel@vger.kernel.org Cc: sage@inktank.com, dan.carpenter@oracle.com, "Yan, Zheng" Subject: [PATCH 1/2] ceph: check rinfo->dir_dir before dereferencing it. Date: Sat, 28 Sep 2013 20:34:44 +0800 Message-Id: <1380371685-11577-1-git-send-email-zheng.z.yan@intel.com> X-Mailer: git-send-email 1.8.1.4 Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Spam-Status: No, score=-9.3 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 From: "Yan, Zheng" Signed-off-by: Yan, Zheng --- fs/ceph/inode.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index 49d4de0..6f0a35c 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c @@ -1288,7 +1288,8 @@ int ceph_readdir_prepopulate(struct ceph_mds_request *req, u64 r_readdir_offset = req->r_readdir_offset; u32 frag = le32_to_cpu(rhead->args.readdir.frag); - if (le32_to_cpu(rinfo->dir_dir->frag) != frag) { + if (rinfo->dir_dir && + le32_to_cpu(rinfo->dir_dir->frag) != frag) { dout("readdir_prepopulate got new frag %x -> %x\n", frag, le32_to_cpu(rinfo->dir_dir->frag)); frag = le32_to_cpu(rinfo->dir_dir->frag);