Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp1166622rdb; Mon, 2 Oct 2023 00:41:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFCvr1oxgD1UV9tgh+YdjjJucGo/Lx1a6bfcwHUea/oMGITKzjanCMF+YHTmmhZ2qmtt8yV X-Received: by 2002:a17:902:f806:b0:1c7:443d:7419 with SMTP id ix6-20020a170902f80600b001c7443d7419mr7240001plb.29.1696232469318; Mon, 02 Oct 2023 00:41:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696232469; cv=none; d=google.com; s=arc-20160816; b=0ZF0IO8b+TasK3fmkdBL/JWPB4oh1npuzWZnm1AjklN9qVXZkNOJoedSomg9qSooau 4/r35XywYY2+g0AvH3wAbTGxNtkdgmP5s1VM4QtXRuAuFrkMh+cXSCg582L6kgo6aLEX H7NAYmTEnrdz1pkAN5iIzO6Fj/bcDUhW80t4puZENZoymvGoW6GowclOs9OqCFOzJxxX LgN9biFsfBzTDt0KLLlppTctpNWiCQj6OU2JQX7D8RS+srfGABlMrJTPu6EhLLaJaiZo I/CVjlfKugEItp7Mr6UGXxMrdhy51O2SUHs2kBHPAIQe0hzfBqxCkNhM3dmqLJ8KTMPg dMFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=9xW3a1nINnEbWotZ8VGaoeFipO2l6o5xih0v3ERc7HM=; fh=07f6uiwk6fGt3dfe+jisMtjaMLtlCFMkqIBWhPKl/NY=; b=n04p8ZkGvR7cWnXGsVnZxHighOg/d7vuS5q/5c70dQLLuSLK8ON8FBY7JScD+BuaiB Pw3xAPqdPJ8F9XC+gg36uxdA9RCAqZhp6bQhBmjhLq0nxr2rO1hYxLgYe1iYW/1fwCxw qeFXNIH4cykCyCgYMGgxVLHH2q2UlvKiRqJ4wnao0L0uIdBLH6ZkvejnQg/2TjiN99F6 3NzKGkBXkNpzeA9OzYBFbx9Qu84FO6eRECbc2XeB/C5QBOfDwC5eNj/HvZgHruPMzddC F1q6zwsRRN+2EaDwn+eLQrNu+qGOg+2Z10RBQe6+VkQCz/+cP8vG6UcaoBjfeAII75NN 2upQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=BjlldH3U; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id b4-20020a170902650400b001c4329b77bfsi24642123plk.123.2023.10.02.00.41.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 00:41:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=BjlldH3U; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (Postfix) with ESMTP id 3C98680697F5; Sun, 1 Oct 2023 21:36:05 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229575AbjJBEfZ (ORCPT + 99 others); Mon, 2 Oct 2023 00:35:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229448AbjJBEfX (ORCPT ); Mon, 2 Oct 2023 00:35:23 -0400 Received: from mail-oa1-x33.google.com (mail-oa1-x33.google.com [IPv6:2001:4860:4864:20::33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 60ED6B4 for ; Sun, 1 Oct 2023 21:35:19 -0700 (PDT) Received: by mail-oa1-x33.google.com with SMTP id 586e51a60fabf-1e12f41e496so1856157fac.3 for ; Sun, 01 Oct 2023 21:35:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696221318; x=1696826118; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=9xW3a1nINnEbWotZ8VGaoeFipO2l6o5xih0v3ERc7HM=; b=BjlldH3UQmeUjo8tjWhTRIsV92Is6K9NpiWgTBdgQX5pP35xDOigxjZFbJiOE192r+ K/K/ZWrm/1VWyiHRDmlj5tF3h93ypoWft7qZn75x3g7QQWhh2pldYw97p6TSnxXHj4CC CQg9xs98G3J/ygRd23ljnGYaJznWdOCp424QlB4jz5hKnZRn2bBimUmicJwAv142bgCQ qcwRjrHsTbLR/cL6dnBUydHyP7ctdh89ezLCa3voymBt+oZOYoM+yZ2TZs2gj0Clcr+B xr9wAgTpQIgBccTYzSvKe13t6yQnpuPRa4PY1yw6kckrYuC7+9L4506iTVck9Yu2B1f0 OcHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696221318; x=1696826118; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=9xW3a1nINnEbWotZ8VGaoeFipO2l6o5xih0v3ERc7HM=; b=wxY9ZQVljR9RT/kVUrhkVk+Ov7MRb6azIyGVIvB9FiOf3y/SWQzXjpF8KEjNu39z+C FXHkRZbKxNbQoTWsdbDzjMrHbw1SVdhsmXjZERDpAAJJCCgZ86ZuhcAucX/1oNoCJySK yP9dxwvQs47psuVZBfxASE92xt6KZPhYsUqe0jzkuUh2NeLCDvHkNrKIG14s1WJU4A4Y xbi0UFbfvg30bbQya+IAPT3ZlgaCzYwf3BdI3v3mThe4alNzLsOLivzq50+k0uXUHdwj ojgNhvVuD/SQHbttrd+0SH4lsIuPAskoh5R9Yvpaj7EY7KRvFxgUNChPDLfsJeXud9lA Xaaw== X-Gm-Message-State: AOJu0Yy6N++moSshcxDKPpW15T2tRcEH5IUi20Zqk85YUw0MaH47iDO3 qB6oTRahwfneicQaLrP67n5kzG/qilIw9Q== X-Received: by 2002:a05:6871:811:b0:1dc:723d:b8d0 with SMTP id q17-20020a056871081100b001dc723db8d0mr13014714oap.27.1696221318480; Sun, 01 Oct 2023 21:35:18 -0700 (PDT) Received: from [10.0.2.15] ([103.37.201.176]) by smtp.gmail.com with ESMTPSA id k67-20020a633d46000000b00577bc070c6bsm17446832pga.68.2023.10.01.21.35.16 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 01 Oct 2023 21:35:18 -0700 (PDT) Message-ID: Date: Mon, 2 Oct 2023 10:05:14 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH] jfs: fix array-index-out-of-bounds in diAlloc To: shaggy@kernel.org Cc: jfs-discussion@lists.sourceforge.net, linux-kernel@vger.kernel.org, Linux-kernel-mentees@lists.linuxfoundation.org References: <20230926071312.14086-1-ghandatmanas@gmail.com> Content-Language: en-US From: Manas Ghandat In-Reply-To: <20230926071312.14086-1-ghandatmanas@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, RCVD_IN_BL_SPAMCOP_NET,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.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 (lipwig.vger.email [0.0.0.0]); Sun, 01 Oct 2023 21:36:05 -0700 (PDT) X-Spam-Level: * just a friendly ping On 26/09/23 12:43, Manas Ghandat wrote: > Currently there is not check against the agno of the iag while > allocating new inodes to avoid fragmentation problem. Added the check > which is required. > > Signed-off-by: Manas Ghandat > --- > fs/jfs/jfs_imap.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/fs/jfs/jfs_imap.c b/fs/jfs/jfs_imap.c > index 799d3837e7c2..ace8a1506380 100644 > --- a/fs/jfs/jfs_imap.c > +++ b/fs/jfs/jfs_imap.c > @@ -1355,6 +1355,8 @@ int diAlloc(struct inode *pip, bool dir, struct inode *ip) > > /* get the ag number of this iag */ > agno = BLKTOAG(JFS_IP(pip)->agstart, JFS_SBI(pip->i_sb)); > + if (agno < 0) > + return -EIO; > > if (atomic_read(&JFS_SBI(pip->i_sb)->bmap->db_active[agno])) { > /*