Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5627005imu; Mon, 26 Nov 2018 03:11:46 -0800 (PST) X-Google-Smtp-Source: AJdET5ctrizw9C+4euGMvmfaTDzE6lrjXU+1KGnG926XMTKuBissOOwNgFjSQuNblrAPUCva0Vjr X-Received: by 2002:a62:e0d8:: with SMTP id d85mr27006994pfm.214.1543230706684; Mon, 26 Nov 2018 03:11:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543230706; cv=none; d=google.com; s=arc-20160816; b=T6SDe2zF/4y1kHtcddqrzrLyIhPjXjPyhLsG0EwlR+2NHqpDZEHcCrJF8bl/YXxZWE To4+QzQIk8+A/VhkXYJVuOm1A1z7qA8GZtScJgR6yA75INTDSgrVjYU8O0WsQn1IoBSG ML/9TzRHa2ovKXxGTRkgYt3WwQsUfqk4R7IRHcWGImjcqCCpbUdk5Y4yVy3S/mk/WKEB t/omaS+HG4xmgytLyeAohBd1GuYI4sNrbQVQoi+aIljeAaFBC5EiFVFsGw8ac9o8Qpho rBVvbukKzn4m+6+ZRg+XAbFuWAvDLkvP7+/ciy7wvHG7hhL3Isq9aifHIe+6W0sdOVA/ 0YPA== 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=trsUMXPPSDD+IinwyknfXB+3uQiM0/C9Sm8nDaau3rE=; b=IqMEaF1gABWjYja+vCPm9QGilkt7kK6zxgPIchnAMF6ye9J+wB6wNqHteJfimcSBsy pZFb8LbgKdqMhhovbbl6Zqo+srunLPyIpmx5wLsHJqzEAvDWzBmUh2+aLa7PcFa/GQXX H5i+4IqEF8wWTNHha3e1OZkicx/Aq2yAs3E8pZ4Zm/Cs9QxF09srYOdBaD4QtpDdl9B/ yt7R5yj8yvhB0NPKCGDBt+bD+s91TFpX9zBvHdcFCRUxHrU6sht3J9ouPmZrSgEN38xo O2zqnwE4t16fXrTFiTRaD9DVbiCIVP65VHNJuXcdsqlUbc8XtgjY5LX7BeRaC/BDUyz6 QlVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=L2oLKyoM; 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 y2si1600pfy.29.2018.11.26.03.11.31; Mon, 26 Nov 2018 03:11:46 -0800 (PST) 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=L2oLKyoM; 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 S1731016AbeKZV6N (ORCPT + 99 others); Mon, 26 Nov 2018 16:58:13 -0500 Received: from mail.kernel.org ([198.145.29.99]:43150 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729291AbeKZV6M (ORCPT ); Mon, 26 Nov 2018 16:58:12 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.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 1119B2147D; Mon, 26 Nov 2018 11:04:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1543230266; bh=bwldbHRaS0kWyyQlVRdZLy8i/lpvYXbvhw+Qwxi2LnM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L2oLKyoMt8PD4TJAqHeaZqVSiut2v58SsS1MGTkn/qlu1PkylStp+jl3MLJCbEBU+ KxFzdAH0Co4vvlXYgveMr5fLzQQDl42ZNvevLT7FEpX2C+QBKixCiXWR+xe2wYmLU6 PS/h38fzXfx/TVivcUuQGVOtSEOlIUXrFNDKz7n4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Luis Henriques , "Yan, Zheng" , Ilya Dryomov , Sasha Levin Subject: [PATCH 4.19 069/118] ceph: quota: fix null pointer dereference in quota check Date: Mon, 26 Nov 2018 11:51:03 +0100 Message-Id: <20181126105103.912978214@linuxfoundation.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181126105059.832485122@linuxfoundation.org> References: <20181126105059.832485122@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review 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 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit 71f2cc64d027d712f29bf8d09d3e123302d5f245 ] This patch fixes a possible null pointer dereference in check_quota_exceeded, detected by the static checker smatch, with the following warning:    fs/ceph/quota.c:240 check_quota_exceeded()     error: we previously assumed 'realm' could be null (see line 188) Fixes: b7a2921765cf ("ceph: quota: support for ceph.quota.max_files") Reported-by: Dan Carpenter Signed-off-by: Luis Henriques Reviewed-by: "Yan, Zheng" Signed-off-by: Ilya Dryomov Signed-off-by: Sasha Levin --- fs/ceph/quota.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/ceph/quota.c b/fs/ceph/quota.c index 32d4f13784ba..03f4d24db8fe 100644 --- a/fs/ceph/quota.c +++ b/fs/ceph/quota.c @@ -237,7 +237,8 @@ static bool check_quota_exceeded(struct inode *inode, enum quota_check_op op, ceph_put_snap_realm(mdsc, realm); realm = next; } - ceph_put_snap_realm(mdsc, realm); + if (realm) + ceph_put_snap_realm(mdsc, realm); up_read(&mdsc->snap_rwsem); return exceeded; -- 2.17.1