From patchwork Wed Apr 17 18:39:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 10905841 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7D9AF1515 for ; Wed, 17 Apr 2019 18:40:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6A81528721 for ; Wed, 17 Apr 2019 18:40:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5E66228832; Wed, 17 Apr 2019 18:40:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E95E428721 for ; Wed, 17 Apr 2019 18:40:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732587AbfDQSkE (ORCPT ); Wed, 17 Apr 2019 14:40:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:41014 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732549AbfDQSkD (ORCPT ); Wed, 17 Apr 2019 14:40:03 -0400 Received: from tleilax.poochiereds.net (cpe-71-70-156-158.nc.res.rr.com [71.70.156.158]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C14EC2173C; Wed, 17 Apr 2019 18:40:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555526403; bh=mV6bjppEY/gpgmUKY/5vC9dz9UkCeodLWb11aju7hLQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R7Dcd6Hxp4dmT4Zc+F6UST3Eq0byIVEPXPIfcuK68NtFIaqYzhuc578axQN8hfPFn H4++2To4UykHpCY7w3HxJneJTFr2rxbxvzcVn8gSlXgY9NSoY6FZhOLmiV6qNIUpLF 0mpt+5o9yUpDaiYprozXNlUhLr7nEiMNQcBhLOSw= From: Jeff Layton To: zyan@redhat.com, sage@redhat.com, idryomov@gmail.com Cc: ceph-devel@vger.kernel.org, bengland@redhat.com Subject: [PATCH v2 2/4] ceph: use pathlen values returned by set_request_path_attr Date: Wed, 17 Apr 2019 14:39:57 -0400 Message-Id: <20190417183959.11296-3-jlayton@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190417183959.11296-1-jlayton@kernel.org> References: <20190417183959.11296-1-jlayton@kernel.org> MIME-Version: 1.0 Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We make copies of the dentry name in set_request_path_attr, but then create_request_message re-fetches the lengths out of the dentry. Those lengths may not be correct if we race with a rename. Use the pathlen values that set_request_path_attr returned instead. Cc: stable@vger.kernel.org Signed-off-by: Jeff Layton --- fs/ceph/mds_client.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c index 4cfefe118128..f362c16c5119 100644 --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c @@ -2305,9 +2305,9 @@ static struct ceph_msg *create_request_message(struct ceph_mds_client *mdsc, (!!req->r_inode_drop + !!req->r_dentry_drop + !!req->r_old_inode_drop + !!req->r_old_dentry_drop); if (req->r_dentry_drop) - len += req->r_dentry->d_name.len; + len += pathlen1; if (req->r_old_dentry_drop) - len += req->r_old_dentry->d_name.len; + len += pathlen2; msg = ceph_msg_new2(CEPH_MSG_CLIENT_REQUEST, len, 1, GFP_NOFS, false); if (!msg) {