Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp503926ybl; Wed, 4 Dec 2019 06:24:23 -0800 (PST) X-Google-Smtp-Source: APXvYqyqUJ9g4LFdWxqKhpQUwvoZxC3fbl01OxF76SaKdXEbmV4Nl/cDxIcArxmcLHwM09Zga+46 X-Received: by 2002:aca:b588:: with SMTP id e130mr2662344oif.169.1575469462872; Wed, 04 Dec 2019 06:24:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575469462; cv=none; d=google.com; s=arc-20160816; b=i8qp/ZGeC6u8I/GqPuppZfx+2vqidjoZMjWTEN4LrkqDLkHiKLQTbSRKXHb2J46FmA L0OTOaE71+hZHKeAPOrz/Dtm6BFiITTG8yC0jmv2zCfK8Zt07IqasS9h6xkCxqNGiVLc h+3uHvEUviuU/Dz0591PtKvACAUYW5KnNjF/EypL5cdekF+D9NvSULeYY38UxrNBq4Ob 4pWjW4RV0ks85YrppSa1nAmJRzTstg3qMbHM/lt6TEzAOtH3BbguBJn1afUVpGtgkC4s JA13ZV9Q/PJJmgOE6g4ttjsMJN7u183y6kgrCrAsQCQ4ZCujNn4kbFvqb0Jm/q+5vCNI sDyw== 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 :content-language:mime-version:user-agent:date:message-id:subject :from:to; bh=ADqVmCPe3XMMgodlvQzUpZmf7WvXt1WHmM2zyA4RrCQ=; b=NL374pKPKO+enM29q5NS3FEP+VF6/xuIp2ZD1C3B0WTJTplpa7Oq5qEMw9p2px4etc DQh62nzK1dDlHUkYgweQG463Psg2f19MUnvwkSLctQH8Ly/dyZSMYKbOdYvRJhT0BdsT cxHfdxEEYOD5nR3jUzMOkkVF/RDGM07DgDx2ag8nHwBUAs94rzymcdRX/xn0KuVjU/iu d996vgfuwhYzniCSqXxNjCIpzCQB2lDQRtTi1oJx77j4WUgrrsoh3aTGT9IjMlbnCCj/ a00PKqqZ8lWHu756HM1wwN+OhOnqH4O4+JMofJ0A626fxqKVgXujkJ/gzVuyDQkOhi3z Bsiw== ARC-Authentication-Results: i=1; mx.google.com; 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 d95si3375000otb.258.2019.12.04.06.24.09; Wed, 04 Dec 2019 06:24:22 -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; 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 S1728011AbfLDOXL (ORCPT + 99 others); Wed, 4 Dec 2019 09:23:11 -0500 Received: from szxga07-in.huawei.com ([45.249.212.35]:44006 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727850AbfLDOXL (ORCPT ); Wed, 4 Dec 2019 09:23:11 -0500 Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id E01303A4CD5614230013; Wed, 4 Dec 2019 22:23:05 +0800 (CST) Received: from [127.0.0.1] (10.177.251.225) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.439.0; Wed, 4 Dec 2019 22:22:58 +0800 To: , , , , "hushiyuan@huawei.com" , "linfeilong@huawei.com" From: Yunfeng Ye Subject: [PATCH] reiserfs: prevent NULL pointer dereference in reiserfs_insert_item() Message-ID: <79c5135d-ff25-1cc9-4e99-9f572b88cc00@huawei.com> Date: Wed, 4 Dec 2019 22:22:51 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.251.225] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The variable inode may be NULL in reiserfs_insert_item(), but there is no check before accessing the member of inode. Fix this by adding NULL pointer check before calling reiserfs_debug(). Signed-off-by: Yunfeng Ye --- fs/reiserfs/stree.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/reiserfs/stree.c b/fs/reiserfs/stree.c index da9ebe33882b..bb4973aefbb1 100644 --- a/fs/reiserfs/stree.c +++ b/fs/reiserfs/stree.c @@ -2246,7 +2246,8 @@ int reiserfs_insert_item(struct reiserfs_transaction_handle *th, /* also releases the path */ unfix_nodes(&s_ins_balance); #ifdef REISERQUOTA_DEBUG - reiserfs_debug(th->t_super, REISERFS_DEBUG_CODE, + if (inode) + reiserfs_debug(th->t_super, REISERFS_DEBUG_CODE, "reiserquota insert_item(): freeing %u id=%u type=%c", quota_bytes, inode->i_uid, head2type(ih)); #endif -- 2.7.4