Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1938491ybv; Fri, 14 Feb 2020 08:32:46 -0800 (PST) X-Google-Smtp-Source: APXvYqwIRjKilA0XN07yUaS+YJ2NTmzGQkWgsYWMdFC+X65NbaKENQ9QDpQkQQekgpt2z5IyDfDs X-Received: by 2002:aca:ebc3:: with SMTP id j186mr2381100oih.15.1581697965950; Fri, 14 Feb 2020 08:32:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581697965; cv=none; d=google.com; s=arc-20160816; b=PDYrfNxWforX51b92YfyVK0bEo4OTpr9/Afm4mIZibDqQUl6vyHXY6ylb6o0ucP5bu XFdh5VFy13XVf9DgUl/txi+3Q2csHCfQatm4Jp38Ujbmge9J/bgFFkkRNzmYrQwG0CNZ NtTKSHMXaaO9TzcvO/VCfpiJowk2y7WLGDSJr5kP2PgDlLckOqTl2f9jRxV/p6dRGl25 Iooe++G/6y+VIMjinluRq4zbTuBe0ozI4ZDyB8W0IW86habf3/CCgGXWpUwK/2lMn+gg lLCTiEBrCS0VjIBFEm1oni9YkkakO1Joq/rIi50nIZkowP2HGht8BRy1fLvo82zLTE+1 K26g== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=PJFstMjKB7t7lz631+DlvXnFLAkBAsCuPIG0VqiizT8=; b=fD5Q/oCP33QfBNdXZxa/iHqNa7T3FatubQhHmxAJVAcAOYg30TBvoc3UG2VL0jydn9 4D0FFOD3LZKTJspKQP1v0KPk6/7lgQ3r0xku6KeteokR60savGnpCIJiT/w5Ta/aefIP /58sgbi1Yu5bC1xW04Ja0s83g5dx8d6lYbsJ+RKWNAAdebGPzEeMohdfjeyGTk0M/2pf oWDNSerpuZn152zaUnxGdJ6orMV1GMXJOZFHpMp3+iS5dj8149g8Bf/VPqfXpiQZgaBZ oBP9g5dOXMQqFgJpnwUsHOWgYPXlShPmBT3Svcf5wD0qAaEeajG8k6am6X74G4y49sZ8 shuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=nGsgfDin; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m19si3131406otq.40.2020.02.14.08.32.33; Fri, 14 Feb 2020 08:32:45 -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=nGsgfDin; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406347AbgBNQ0N (ORCPT + 99 others); Fri, 14 Feb 2020 11:26:13 -0500 Received: from mail.kernel.org ([198.145.29.99]:60876 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405818AbgBNQYL (ORCPT ); Fri, 14 Feb 2020 11:24:11 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 978D124794; Fri, 14 Feb 2020 16:24:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581697450; bh=XuVLhXNZHPeJbyGhkNR8+oC6FyGsCGr10fM/qb0PYjg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nGsgfDinQxVUo/Rwl3xx2TQZuNC47Yw2hl8TDWHVDwsDXVS97J7hhkWeTYJwLrBP2 T1bkhfBOFPkd2wvQ+EWndvbZr7NWSMPUvz7vsatY14EY8x9GEp9oo+I3b6J/OhxISw 07+n4OttQb3XGXmcpY76LExXYDg49FAEme1kSrpc= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Yunfeng Ye , zhengbin , Hu Shiyuan , Feilong Lin , Jan Kara , Andrew Morton , Linus Torvalds , Sasha Levin , reiserfs-devel@vger.kernel.org Subject: [PATCH AUTOSEL 4.9 134/141] reiserfs: prevent NULL pointer dereference in reiserfs_insert_item() Date: Fri, 14 Feb 2020 11:21:14 -0500 Message-Id: <20200214162122.19794-134-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200214162122.19794-1-sashal@kernel.org> References: <20200214162122.19794-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yunfeng Ye [ Upstream commit aacee5446a2a1aa35d0a49dab289552578657fb4 ] 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(). Link: http://lkml.kernel.org/r/79c5135d-ff25-1cc9-4e99-9f572b88cc00@huawei.com Signed-off-by: Yunfeng Ye Cc: zhengbin Cc: Hu Shiyuan Cc: Feilong Lin Cc: Jan Kara Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin --- 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 a97e352d05d3b..5f5fff0688776 100644 --- a/fs/reiserfs/stree.c +++ b/fs/reiserfs/stree.c @@ -2249,7 +2249,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.20.1