Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp624810pxv; Thu, 15 Jul 2021 11:50:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzbYPG0oBx2i/0vJU3iNOAUtW7f2i5gGpPXHENirEnkyjM4C23yQCu9grD2jr62lk4etRtZ X-Received: by 2002:a92:c7c4:: with SMTP id g4mr3639236ilk.252.1626375044100; Thu, 15 Jul 2021 11:50:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626375044; cv=none; d=google.com; s=arc-20160816; b=aAgVnfYulxQY0B6UYLzZLZsYcGG+MW3DWjIvnbF2qnoiH3twRwQbOcgBLU5pIipJEB Qwy7mwZ8XBCftOgMRu2viNU5VciW6+febNIFAvkh8GXtBm4neON/x3zQ99OBu4uW3gba j8OlReHamQAblFyzPhH43mq5vPLEvFMr3x4QybtyMjA9tDxzuq9xb3DUyVtfiAxdNXEs FZsHFDmwZaA0XSp8Dk893OkQ8xInbykMskYh2FIdI+7kmcHhA3UEt2DPQ6gcI+wvgvQj sKyCerauheUYDBz8ApYoPo59Vr7IJAEnIgg6/G6dxZVOxy4D+OQnJylI4z6UBgwFmRut QKaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=FUptH2nZIqg6FjtiOsCoLxCfZUoDo21op0ui0XgLZnw=; b=BCfbxm89ow++mnF+vZikaIOwf7HmSx7d6Mmyrtn857eKMl7OuhW777FBfbF+r0mZ9k OOnos5FlrT33D5EfdTTYFesVnGf1AN/TM2x49ZfYV0rUFt78xg3ce52xQ0sbiBg6IHYb +Fy/Spmz4KBhHJfNjjOqQtYx//Tipq+vqZNdd1Zd7F+qy90mpg4hAMTlAQFdTI1xTF83 urjnvpQheOlPx1iQUddkQyiWpEwKp7xeOGDeiQwmNJSLOEQKi6ur6Qn0+qrecgs1H0Tp FKcd6Z216x+uhL16eqFj0uxrZirgTy49rotCJHMMi3UvKW9c8A55dg5r5tSshEocEMKk tIHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wpPuqYX4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u15si8561988iot.89.2021.07.15.11.50.31; Thu, 15 Jul 2021 11:50:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wpPuqYX4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240198AbhGOSvl (ORCPT + 99 others); Thu, 15 Jul 2021 14:51:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:50986 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237203AbhGOSse (ORCPT ); Thu, 15 Jul 2021 14:48:34 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E7115613CF; Thu, 15 Jul 2021 18:45:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626374740; bh=31ZrS06a1Aeqc3n+7vR4NdsKfG+zUQ9h3vFAyT/9evg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wpPuqYX41qrJdT0ezKyCU/HgKvGA3zD1dboE4h/PFYQYp2Tp08w+hp9DUs2znr/6Q cpbWNGf2D62cTwlR7LWDR7HXWOxkaseAeC5T6cS+PikQX/Htfs31Vcuu57jMqPrX65 FtXApG5RmPBXsJ2zoJxhcz+WBCBNP5Z33D5GcoaU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Skripkin , Dave Kleikamp , syzbot+0a89a7b56db04c21a656@syzkaller.appspotmail.com Subject: [PATCH 5.4 121/122] jfs: fix GPF in diFree Date: Thu, 15 Jul 2021 20:39:28 +0200 Message-Id: <20210715182523.372443464@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210715182448.393443551@linuxfoundation.org> References: <20210715182448.393443551@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pavel Skripkin commit 9d574f985fe33efd6911f4d752de6f485a1ea732 upstream. Avoid passing inode with JFS_SBI(inode->i_sb)->ipimap == NULL to diFree()[1]. GFP will appear: struct inode *ipimap = JFS_SBI(ip->i_sb)->ipimap; struct inomap *imap = JFS_IP(ipimap)->i_imap; JFS_IP() will return invalid pointer when ipimap == NULL Call Trace: diFree+0x13d/0x2dc0 fs/jfs/jfs_imap.c:853 [1] jfs_evict_inode+0x2c9/0x370 fs/jfs/inode.c:154 evict+0x2ed/0x750 fs/inode.c:578 iput_final fs/inode.c:1654 [inline] iput.part.0+0x3fe/0x820 fs/inode.c:1680 iput+0x58/0x70 fs/inode.c:1670 Reported-and-tested-by: syzbot+0a89a7b56db04c21a656@syzkaller.appspotmail.com Signed-off-by: Pavel Skripkin Signed-off-by: Dave Kleikamp Signed-off-by: Greg Kroah-Hartman --- fs/jfs/inode.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/fs/jfs/inode.c +++ b/fs/jfs/inode.c @@ -151,7 +151,8 @@ void jfs_evict_inode(struct inode *inode if (test_cflag(COMMIT_Freewmap, inode)) jfs_free_zero_link(inode); - diFree(inode); + if (JFS_SBI(inode->i_sb)->ipimap) + diFree(inode); /* * Free the inode from the quota allocation.