Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp5215242ybl; Tue, 27 Aug 2019 00:56:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqw+DcTwKtcQOdJbvPfr22jNhqKlNpV1ros0Fh+OySEu41QWkuNNts2ep6QQAYp88ytj9Xql X-Received: by 2002:a17:90a:1d0:: with SMTP id 16mr23486399pjd.98.1566892573457; Tue, 27 Aug 2019 00:56:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566892573; cv=none; d=google.com; s=arc-20160816; b=a20BVIBKagLAabz88P6r9fzEX1HStGf/Vhsm07gFpN4mAUn9gQUqTg82BaZbXDXQMB B0mVfmhTaiQ+YO2GElmChmN7Gu1HrzxwA/tNscCx+B1lD5c49Oc1Uqxg/UBgMBPaWASl zdpEYxM7T/cHQxqeM1k1E5ZV/6o+wbJRgS9mEFzK1Nds1n+IJLDjV/SBUmqYqz1/kA9n zNlDFGBPIja1LmeoSb9Bqyl7IKEYMgwt7LgC7Q/zoTTmQuiQ8F+ljjXrROZrpZRHPIcv kjZtykP0d5zQvLzLyU2WdU3Mu/WVcf0SaN0Hm/55TlDHPbrYGMOPhObDdMtVJYGQxkFk +PQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=tPmSG0Ts6t1WMNxJDBk/HF6tp1hz4WJ/oeGQz+vZDNE=; b=mkNGY+EbDGspYQzcRa5+zP+Zgb9YlB+1EHHib3l4nlwpfbIN8oVnvrNyta04h4Nlpd x4p16eq1xr2P6xUtI+1psSVlLOSKIun6hlLIlSk2ejZYhWD8Uws31pKCeBOrNeNxQ0ho t7cOpPDnvCgZpsMFuq3pvDpkPk9TCTZa6Y+UW21xYQBqSbsw8dsLl+l85mLTgye5wzmb MinSRu8AhvOwFguhRlwi4VWRxjEMLQn/Wkt1veyg7IiUMIMkQSM+tpCGjCl42NFeyV7W Nm5Fvv9riLZr3pmzycwel+Uzr99hEKVZTCRdyqkzbPzqxMniKySBYLte0Aen2hH89XD3 vNMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=tWml8olD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w7si11063487pgl.323.2019.08.27.00.55.57; Tue, 27 Aug 2019 00:56:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=tWml8olD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729750AbfH0HxS (ORCPT + 99 others); Tue, 27 Aug 2019 03:53:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:44730 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728988AbfH0HxO (ORCPT ); Tue, 27 Aug 2019 03:53:14 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 EF1EC217F5; Tue, 27 Aug 2019 07:53:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1566892394; bh=NowFkdEu21UO3lyhuKThxidzyxj5RXtdZ+GwbRkJ17E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tWml8olDwdKG103Afgx9FcmG9Fx2pJG3hPRwoR6qjD4nPrnINHriqCZDRppPFCmG3 3+WdGalo/xK7KOwf+CqiYzAbJNmxep3RVG5BqGH0UaHFrEe1duDEyIo3mMczgUe0g4 cVgQ89rVxeBx3IEy8BI/gh5T3u7QSO3z6yRKEImo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hector Martin , Jeff Layton , "Yan, Zheng" , Ilya Dryomov Subject: [PATCH 4.14 39/62] ceph: dont try fill file_lock on unsuccessful GETFILELOCK reply Date: Tue, 27 Aug 2019 09:50:44 +0200 Message-Id: <20190827072702.894262572@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190827072659.803647352@linuxfoundation.org> References: <20190827072659.803647352@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jeff Layton commit 28a282616f56990547b9dcd5c6fbd2001344664c upstream. When ceph_mdsc_do_request returns an error, we can't assume that the filelock_reply pointer will be set. Only try to fetch fields out of the r_reply_info when it returns success. Cc: stable@vger.kernel.org Reported-by: Hector Martin Signed-off-by: Jeff Layton Reviewed-by: "Yan, Zheng" Signed-off-by: Ilya Dryomov Signed-off-by: Greg Kroah-Hartman --- fs/ceph/locks.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/fs/ceph/locks.c +++ b/fs/ceph/locks.c @@ -78,8 +78,7 @@ static int ceph_lock_message(u8 lock_typ req->r_wait_for_completion = ceph_lock_wait_for_completion; err = ceph_mdsc_do_request(mdsc, inode, req); - - if (operation == CEPH_MDS_OP_GETFILELOCK) { + if (!err && operation == CEPH_MDS_OP_GETFILELOCK) { fl->fl_pid = -le64_to_cpu(req->r_reply_info.filelock_reply->pid); if (CEPH_LOCK_SHARED == req->r_reply_info.filelock_reply->type) fl->fl_type = F_RDLCK;