From patchwork Fri Aug 17 05:55:59 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yan, Zheng" X-Patchwork-Id: 1337161 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id D13ABDF266 for ; Fri, 17 Aug 2012 05:56:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750856Ab2HQF4D (ORCPT ); Fri, 17 Aug 2012 01:56:03 -0400 Received: from mga03.intel.com ([143.182.124.21]:32012 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750792Ab2HQF4C (ORCPT ); Fri, 17 Aug 2012 01:56:02 -0400 Received: from azsmga002.ch.intel.com ([10.2.17.35]) by azsmga101.ch.intel.com with ESMTP; 16 Aug 2012 22:56:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.77,783,1336374000"; d="scan'208";a="135265312" Received: from zyan5-mobl.sh.intel.com ([10.239.36.145]) by AZSMGA002.ch.intel.com with ESMTP; 16 Aug 2012 22:56:00 -0700 From: "Yan, Zheng" To: ceph-devel@vger.kernel.org Cc: "Yan, Zheng" Subject: [PATCH] ceph: Fix oops when mounting cephfs with non-existing path Date: Fri, 17 Aug 2012 13:55:59 +0800 Message-Id: <1345182959-6486-1-git-send-email-zheng.z.yan@intel.com> X-Mailer: git-send-email 1.7.11.2 Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org From: "Yan, Zheng" req->r_locked_dir is NULL if the request was created by open_root_dentry(). ceph_fill_trace() lacks check for this case. It causes oops when mounting cephfs with non-existing path. Signed-off-by: Yan, Zheng --- fs/ceph/inode.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index 9fff9f3..40e2ef1 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c @@ -992,6 +992,13 @@ int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req, if (rinfo->head->is_dentry) { struct inode *dir = req->r_locked_dir; + /* + * req->r_locked_dir is null if the request was created + * by open_root_dentry() + */ + if (!dir) + return le32_to_cpu(rinfo->head->result); + err = fill_inode(dir, &rinfo->diri, rinfo->dirfrag, session, req->r_request_started, -1, &req->r_caps_reservation);