From patchwork Sat Nov 23 13:32:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tetsuo Handa X-Patchwork-Id: 13883859 Received: from www262.sakura.ne.jp (www262.sakura.ne.jp [202.181.97.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1588F195; Sat, 23 Nov 2024 13:32:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.181.97.72 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732368731; cv=none; b=HEOfhdK2PE0jREln8/Vlu2eYHHv0fbIdk0tEC7ihA8fKdYKxtd4ebdV0XqLuavsCclMWPXB4m+NSUMXKZ1mq7Q+VCQnePpOIO71dxfGAg1CCnTWxKcCWzrtCtWlySILSqZFM/VYmoiwTmB5dv5B8wjxdiR9sohqV9YqOTu1O9j0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732368731; c=relaxed/simple; bh=HJmkkxRyUful3cxYBbxXfhhekFdA0s2rCgRiOghD7/s=; h=Message-ID:Date:MIME-Version:To:Cc:From:Subject:Content-Type; b=G5cqPoo59WRtRR7SLmDiD/kuvNd3ikMmi9UWUNP0O2y+4u3m6UQNVTAwApmMH7sRHRYyP9WuuoM4fZjMpU871R2/711zxiGF0Oj6sNe4mTMW/XvAi2KN/nlMVGSmo6/mHN/aqqBFyHHrUvT6OxyxRqKiq69OQbP6Ss2JvzQ6URs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=I-love.SAKURA.ne.jp; spf=pass smtp.mailfrom=I-love.SAKURA.ne.jp; arc=none smtp.client-ip=202.181.97.72 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=I-love.SAKURA.ne.jp Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=I-love.SAKURA.ne.jp Received: from www262.sakura.ne.jp (localhost [127.0.0.1]) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTP id 4ANDW7tV090774; Sat, 23 Nov 2024 22:32:07 +0900 (JST) (envelope-from penguin-kernel@I-love.SAKURA.ne.jp) Received: from [192.168.1.6] (M106072142033.v4.enabler.ne.jp [106.72.142.33]) (authenticated bits=0) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTPSA id 4ANDW7HK090758 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NO); Sat, 23 Nov 2024 22:32:07 +0900 (JST) (envelope-from penguin-kernel@I-love.SAKURA.ne.jp) Message-ID: Date: Sat, 23 Nov 2024 22:32:07 +0900 Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: linux-fsdevel Cc: LKML From: Tetsuo Handa Subject: [PATCH] hfs: don't use BUG() when we can continue X-Anti-Virus-Server: fsav102.rs.sakura.ne.jp X-Virus-Status: clean syzkaller can mount crafted filesystem images. Don't crash the kernel when we can continue. Reported-by: syzbot+97e301b4b82ae803d21b@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=97e301b4b82ae803d21b Tested-by: syzbot+97e301b4b82ae803d21b@syzkaller.appspotmail.com Signed-off-by: Tetsuo Handa --- fs/hfs/inode.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/hfs/inode.c b/fs/hfs/inode.c index a81ce7a740b9..794d710c3ae0 100644 --- a/fs/hfs/inode.c +++ b/fs/hfs/inode.c @@ -81,7 +81,7 @@ static bool hfs_release_folio(struct folio *folio, gfp_t mask) tree = HFS_SB(sb)->cat_tree; break; default: - BUG(); + pr_warn("unexpected inode %lu at %s()\n", inode->i_ino, __func__); return false; } @@ -305,7 +305,7 @@ static int hfs_test_inode(struct inode *inode, void *data) case HFS_CDR_FIL: return inode->i_ino == be32_to_cpu(rec->file.FlNum); default: - BUG(); + pr_warn("unexpected type %u at %s()\n", rec->type, __func__); return 1; } } @@ -441,7 +441,7 @@ int hfs_write_inode(struct inode *inode, struct writeback_control *wbc) hfs_btree_write(HFS_SB(inode->i_sb)->cat_tree); return 0; default: - BUG(); + pr_warn("unexpected inode %lu at %s()\n", inode->i_ino, __func__); return -EIO; } }