Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp636279pxv; Thu, 15 Jul 2021 12:06:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxI+DRh5MH5s01OKG6U3uSBgsHooz3EWnWCc2I+OoxjFEdH5a4a/Tls0eFw59RF1+4SJ8gR X-Received: by 2002:a17:907:9719:: with SMTP id jg25mr276381ejc.362.1626376001322; Thu, 15 Jul 2021 12:06:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626376001; cv=none; d=google.com; s=arc-20160816; b=0dKuyhy8C6u+RjgyPaUiYLXXUnkBhQkVW1prGTQ+2eG7uMhofIFXrI+XphDpa3ss/x zhZ/m69WUa6uSSSyx3n13wgzcnrMJJy4YoxkDxEbA+MKnovovcQFiHklZoKlPj6R/elR dN+5CGGG7/5MUxTxBjblozvsMAy9XE16IfciCvpshdM/b6pyNatSVHs8LbGSm8M3WJAX VtMhDGLC9NMUyV4KaQ1kMWUVYbaiqOqJWI3dEAEbm4VZk7dWKMI4YhNcxn0jYyLTI3C6 BJ9rBkAnIqKXzQHtlgIDO7nr7IXVS/NRyufdj1iAOn5Qh+9UeNbhxVKWFhYfBhdN2Y+a f1oA== 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=F3jJ3R+oSWItV9d4+4aNiKdnmJdcHBQTwrHePvqFysSSgkDQCSJlcmr5gAGP1D20Vg 1sw6K+oRKEooVQBtZWmp2pb3yDf2nGBwBhVEJXapSEgqEiUuKfjTwQ4rcjJqQ2NSVj31 GHKLO9t55v8uMJWlTn93OaP8UDXsa3lm5yEw0MDOy59UaJQQTAcNszakqNAZerOU0r7E 6aQztq5BSdHN2M/X4qtTh0xDG4kg/wgHONqaIzCit/etawV4OR/OD0YTSKDp1FeFMYtT 2oKysT7GCY0vqOotRt8rTGM8O6GKdCbVneMbUbDiG+6+rT5Mj3y12nZJyLwUnmMLAmZG 6nLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JAER8eJz; 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 c16si8572078edw.522.2021.07.15.12.06.17; Thu, 15 Jul 2021 12:06:41 -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=JAER8eJz; 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 S242883AbhGOTGm (ORCPT + 99 others); Thu, 15 Jul 2021 15:06:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:33262 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240854AbhGOS4i (ORCPT ); Thu, 15 Jul 2021 14:56:38 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2A9B6613E7; Thu, 15 Jul 2021 18:53:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626375223; bh=31ZrS06a1Aeqc3n+7vR4NdsKfG+zUQ9h3vFAyT/9evg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JAER8eJzAKz6g/5t5zaFFzjDw6OldRudKXKmmrjC8mvQ9wg+CqmCAnMJhY1Bc8vTU SRIWonsScAH5xz5rFD11yu8NhwhfiVnp9cxq6MIdYKlVl0XHkOkbsXPHnVzeg6AAYh jx/y7xlzZ/8gW47UcY/S0TaurMJxOAc5fs7RK01w= 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.10 212/215] jfs: fix GPF in diFree Date: Thu, 15 Jul 2021 20:39:44 +0200 Message-Id: <20210715182636.603327159@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210715182558.381078833@linuxfoundation.org> References: <20210715182558.381078833@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.