Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp647894pxv; Thu, 15 Jul 2021 12:24:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzjbqynGQb+xbo7Vq5HkbCKGQIvHcVMWZOVxcZiRcBI3TICW9mbg0SiP4Ssro9bQJuFvFRO X-Received: by 2002:a05:6402:58:: with SMTP id f24mr9566395edu.234.1626377082562; Thu, 15 Jul 2021 12:24:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626377082; cv=none; d=google.com; s=arc-20160816; b=vE0jVAgeUUytEL1yoUAkOp5GzuGFv00IifSCvaeGcjiDVMbvovNjTG3s43HDoDBwm8 3gvfZMUYYJctve0sJzA3JFa0Aj2EEpXpP5/UhxXQfE8j6uaYc0NQkOTOkbMaxIpou9Co 3+Ld/WynxY+/0JDMBtKC8xualGyBuiYlyc8iJmmInKzSTUJRiC3x+u7J1QqFcHuwOZP6 QNgQJ+ToIkqnbnhV9EOvfNYFS3LXephkigG/K3EgKbqZ4plqlLSLkh14TGQc3I6TNPrA QGDokT5lIV+85mQD8/Mc5HTTpwgA3aO9EwK5/hunfQa/wgqH4b/1r4JDkxVTp7MZ2IyD qSeg== 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=bzODDvrLotWCoJyYDoHkhZak/fffw/L3JWHFvuHzLKLeuNoge1QNsR+yzGOm0PVixw gWHuRAdvofte+gqeXZPvESCdlbXFeK//A6mL/URltfH8O1gb9kh63cJUUdDb3QWfnZ4e 0JXhMPHcDf4m9nmIKrQJiogRPi0vKTMwDEAsLlasB/uJHnEF5iYhPf6UyXLShvz976b2 WLjkb+PtkYAxGwtN7ZToxLdk9kvPAzgtn35113u6bDCqeq5mHqRq5A35vI8rN3EACTh0 gY49BFLzQoZOt3N9vgGgptqCjMoEoOq/r+Gk5Y1c+MtW+p2wGtZ4Ru2pNMKqa1vBSTcg d2Ig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=u8WxWVTm; 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 ji15si6172303ejc.676.2021.07.15.12.24.17; Thu, 15 Jul 2021 12:24:42 -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=u8WxWVTm; 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 S245457AbhGOTX5 (ORCPT + 99 others); Thu, 15 Jul 2021 15:23:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:46434 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242389AbhGOTGy (ORCPT ); Thu, 15 Jul 2021 15:06:54 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 44E8361370; Thu, 15 Jul 2021 19:03:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626375794; bh=31ZrS06a1Aeqc3n+7vR4NdsKfG+zUQ9h3vFAyT/9evg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u8WxWVTmbSSg+5DaoMEqa/d5oL8NUzdcVqJGAQgHxwIlu+P969iETQTuNukvJep14 lFi2rl5HW5OfLchv65DlsWZzx1CMpb0+iIhEJ7XWDsvdgUrIJa29yWFU1s+rX9Qx09 VsP6alhAEn3jVICSbBa+yIFoqkZYWUrvJbfZZgs0= 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.12 238/242] jfs: fix GPF in diFree Date: Thu, 15 Jul 2021 20:40:00 +0200 Message-Id: <20210715182634.754322573@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210715182551.731989182@linuxfoundation.org> References: <20210715182551.731989182@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.