Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp2648250rdg; Mon, 16 Oct 2023 10:22:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFBHmVQ0uyn5oxtGoW92lyHjjQHkas6vBirGm8DR7LnwaNvzvzrHfHRiTnDrGQo3VNn3n9/ X-Received: by 2002:a05:6a20:7483:b0:16a:4480:647f with SMTP id p3-20020a056a20748300b0016a4480647fmr37137073pzd.19.1697476958456; Mon, 16 Oct 2023 10:22:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697476958; cv=none; d=google.com; s=arc-20160816; b=y2RLBQAm66BeJFGaxiiuQlE0aiMdMAYhy5xcS6Xi97QLArrN5S50csyT/pG86igA2r /9XkvWToCAhJwkaoAMtaZV86BgZsGvrMC7HRlTn2SlkpSBpgBoqwfWTB1MkoO7pOVcr9 MJ9e9bAxFCRu9bX3B5SeS/AH5KeN1TS7Doh8KqpVx5xETCx49aZhOx/mDIdqAocxu2LI 8yEeK7BVzaJVeWDLAHg/yB8Pgm2gd6QJhK4fyri5sBzPBnp3q1sZdTvIbw85g7v0wUtL nWrVgrVg5TjW0KnvYlsVF1biQuD4TUURWsYIkHINTGC2805vH90Uae7ATFJLha4HXB3g R3Jg== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=fzazQLMiElf0E2rTzrIHqd72McOV2ajmxD+aMmf7vqY=; fh=YvngEdAreZZStCMdXee1y6QQCKyMVNE7mjE7XAaE5g0=; b=aqqgR1wIm3RC4t12KdCbsJD3nShWmg9HPq90WcD/PZzxtPT6yzOkoHbbBnqk8tkz39 oTL9zGxp7mPVF3g5WKf+dI6NP/cIGQ1K47bY7aZQp7uKaZ4v6oz6FFnHwzewM4tCXMHq OxPdXqJa1hgv7vo7QwHlrQshNNUCJLBsS68Rw9VH76UUoKfjMTD8qYahjHys3N5bDyAV 4OX4fEZyf9+dv9k+j6g5D+NpOWWgNG9x5vw7KmkZs3W7rAG+F8sw9B8oW9ByYCLcseW/ +2D1mgEfh0Zi0eg4wFZ5DjpU/gK8hhb636uZyJQWgkz+3I5LJqWsiJRyQCZUW70uDUUS jMDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=CAgtLmkj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id my9-20020a17090b4c8900b002776a60ea68si6998821pjb.1.2023.10.16.10.22.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 10:22:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=CAgtLmkj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 35619808BD01; Mon, 16 Oct 2023 10:22:36 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229952AbjJPRW3 (ORCPT + 99 others); Mon, 16 Oct 2023 13:22:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229666AbjJPRW2 (ORCPT ); Mon, 16 Oct 2023 13:22:28 -0400 Received: from mail-pl1-x644.google.com (mail-pl1-x644.google.com [IPv6:2607:f8b0:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C6AF83 for ; Mon, 16 Oct 2023 10:22:26 -0700 (PDT) Received: by mail-pl1-x644.google.com with SMTP id d9443c01a7336-1ca052ec63bso26879385ad.1 for ; Mon, 16 Oct 2023 10:22:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697476946; x=1698081746; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=fzazQLMiElf0E2rTzrIHqd72McOV2ajmxD+aMmf7vqY=; b=CAgtLmkjiuoqkGRgCTLpRenMfACIUPcqXrX8nGL+mFdXKqYOoiBywqmDJt3ZGhUOxq DMNoLuEvacjgOjF3cKnSIWzdBSL0Zs4x9Rvzyt4D5Xx84lBMP0KbkDCcOL71OtYXwwr6 BI7t6J0eH1xmIe6DDymvq82D6mEsiwA9AFBWi4+MdMww8eWYUhnXcTT4k2Kr53jJcniZ 62NkJ2SzfwEmEKyryxTBbiAyWxuX5UIPe5TPuiG1516A8lEgt7cmoUwfcSD8/Vm/mAJH BzWEMRyJAWY5aNxiQQHnPzK+OKCmxYCSOqXkZM22I154T2Xcqwq5+EhPZGXJ6FzS3j/l jluw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697476946; x=1698081746; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=fzazQLMiElf0E2rTzrIHqd72McOV2ajmxD+aMmf7vqY=; b=cRmFRRcRN5Nglq4N52X3YftNsCHbL07rzSmA9nugcglwTs05YueU/odWa+g41xgjQ6 v7aw4KNecCOz2LI9I9u3Y/sLcjLEOKFHGCZZgSveKOCx5DShNzOmawLE8aVq4vuYCFh7 ysBzMeiRsaNxndmbAP2FffgNVGw2oMJ7/gs/8mU18pH9LCNODMM0Ki8nne4RJW2gYGB3 Z8SFJV8Ys7h3LiMRLQGxbo90RWhZ7dzVFFmZaMPgP0WC+jExBombOZdFAxtcSv/jpQvs 6kMsr9ljLzvJl+kS22bNlQEmxFCVaLHfZpYO0lsTf/RYdfRKuOWGTZvlqi4ZM7BdSUgg YIuQ== X-Gm-Message-State: AOJu0YwY0xIi0CXZbgUkBrzRk1N1Sz20CKBt6wRSQVg3bVamnUOoxGnY 45uY5Pg+zQwp9SC+iFlevsk= X-Received: by 2002:a17:903:2445:b0:1ca:2497:554 with SMTP id l5-20020a170903244500b001ca24970554mr9560472pls.8.1697476945945; Mon, 16 Oct 2023 10:22:25 -0700 (PDT) Received: from manas-VirtualBox.iitr.ac.in ([103.37.201.178]) by smtp.gmail.com with ESMTPSA id ik5-20020a170902ab0500b001b8622c1ad2sm8926936plb.130.2023.10.16.10.22.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 10:22:25 -0700 (PDT) From: Manas Ghandat To: dave.kleikamp@oracle.com, shaggy@kernel.org Cc: Manas Ghandat , Linux-kernel-mentees@lists.linuxfoundation.org, jfs-discussion@lists.sourceforge.net, linux-kernel@vger.kernel.org, syzbot+9924e2a08d9ba0fd4ce2@syzkaller.appspotmail.com Subject: [PATCH] jfs: fix slab-out-of-bounds Read in dtSearch Date: Mon, 16 Oct 2023 22:41:30 +0530 Message-Id: <20231016171130.15952-1-ghandatmanas@gmail.com> X-Mailer: git-send-email 2.37.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Mon, 16 Oct 2023 10:22:36 -0700 (PDT) Currently while searching for current page in the sorted entry table of the page there is a out of bound access. Added a bound check to fix the error. Reported-by: syzbot+9924e2a08d9ba0fd4ce2@syzkaller.appspotmail.com Fixes: https://syzkaller.appspot.com/bug?extid=9924e2a08d9ba0fd4ce2 Signed-off-by: Manas Ghandat --- fs/jfs/jfs_dtree.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/jfs/jfs_dtree.c b/fs/jfs/jfs_dtree.c index 92b7c533407c..cf67d32d5b7f 100644 --- a/fs/jfs/jfs_dtree.c +++ b/fs/jfs/jfs_dtree.c @@ -633,6 +633,9 @@ int dtSearch(struct inode *ip, struct component_name * key, ino_t * data, for (base = 0, lim = p->header.nextindex; lim; lim >>= 1) { index = base + (lim >> 1); + if (stbl[index] > 128 || stbl[index] < 0) + goto out; + if (p->header.flag & BT_LEAF) { /* uppercase leaf name to compare */ cmp = -- 2.37.2