Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp663724pxv; Thu, 15 Jul 2021 12:51:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxvaSqfwbzv2/2bxziJlEJL3eE14NlpG7Ik3gdWFLEKRbQbXwoE4Uo/ZO2n838t7Egh7E2r X-Received: by 2002:a02:2382:: with SMTP id u124mr5432294jau.138.1626378666511; Thu, 15 Jul 2021 12:51:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626378666; cv=none; d=google.com; s=arc-20160816; b=AS3umqli90y+gShU5wLHnW+GSyvasBjU7GqdhVbeINe7PJKiyVYP/lF1OSoH00cWc6 pHR7I9Dwumgf59WP8eXSZRqKZlm+kHK662GuZk/WYAuQde3ph7z8GCNrpowEVC7NCvn3 szmH0p9qUIhGnR/wu07+ve/ZVUSQi2h9Ed+C0RZC9giko9c1HOVeuqsjRhUNCZg4OdBu mGiJeHbeprBBl0gOCwvaXhu9FEcwqcICht1YRls8SizSeRK/FgQQcvDBk6EKb3i9kEsI ZwXXOul0cwb7kaM+DZ0dlZXkEmVfVstHSQ5zDGnrRGNLfblSzgldtsCOg6xXH/IxwPEv 271w== 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=tF5l2IuV98YKVhZgUUaCStbD5aWBx4yOiYANRDG8dM43IbtSrn7RhtGV4WAvaO13zx uW0hnWlwwvluL+FIQpchwW+hQDveF2Fo3ltK+tVnvbR6sbLG8x60LfloB7qrvS9AayhA Mxt3368V8GNKxzV+PvNrUdoELRgHmIgckBI3AcJZe+NgxkCvyVZiDkPV0OfsuTNYzDH+ 2pOXgI6bBGv/0rtFLOZGV5OhboGLN59Kt/Lg6d2jAnLrfn2Koa4P2ymAyQ/m6TrCSQl7 OgcMoOxKOq2q15YHU6IqkunDKZlgprWj5+WYz5vD1INp7TCRA9OdI5NZYM5w3nk95xKh 43qQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fbl9F9tm; 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 d7si442557iop.31.2021.07.15.12.50.53; Thu, 15 Jul 2021 12:51:06 -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=fbl9F9tm; 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 S245686AbhGOTxO (ORCPT + 99 others); Thu, 15 Jul 2021 15:53:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:58176 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244835AbhGOTSe (ORCPT ); Thu, 15 Jul 2021 15:18:34 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 494D9613F7; Thu, 15 Jul 2021 19:13:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626376416; bh=31ZrS06a1Aeqc3n+7vR4NdsKfG+zUQ9h3vFAyT/9evg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fbl9F9tmnHMPk56qMyoykjH52toUhYj7nozuAT6IV6bjsR6E3c4pki8WWTxXsZdxF 0LumSRDKiECxWhNXs1baXa5J3+aF6VcyDk6KylnEkpXhgX7K55dYvjV/W5SPv3OWMh HQcU1407OLHqSzlnkxIY9GCNtJJfpFn/dkgNglHs= 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.13 263/266] jfs: fix GPF in diFree Date: Thu, 15 Jul 2021 20:40:18 +0200 Message-Id: <20210715182653.379110370@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210715182613.933608881@linuxfoundation.org> References: <20210715182613.933608881@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.