Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp4603405rwb; Tue, 8 Aug 2023 10:49:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH/DCqHczUtmbdqXv2su8B37SVcZXWXzj6cEy+TdF5zjuK0RwmE+2PsButWfVP7U/WAozpG X-Received: by 2002:a05:6a00:1682:b0:66d:263f:d923 with SMTP id k2-20020a056a00168200b0066d263fd923mr259936pfc.20.1691516941743; Tue, 08 Aug 2023 10:49:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691516941; cv=none; d=google.com; s=arc-20160816; b=VkqGOPNPweKxJ+h1PF6X8IyDmp99s8Vn3VqXZUtd+gCS9ndbXgpFHQ9UBoCZL9uqam cNYjLdQdMZCPG83XzDjipb+XonrZ5hA7qrMqRKGmvJvxa7M6nnTRWZLi/4Etc6FaivjW lW79US2m3gICHy/YPNtIC5Z2TlLaYMuKf0/x2N8KMpSU3MzmxffcVKv9k4OJqwx9pbmH qYNY8+OOQhK0WfP2UwrOyaoLr0q//btMCUyP1Spu+kexcXb8sj/3rmQgqNGxMDzxzGZH BBA7pBqj+zO8Imx3QZne5/TkfmOqa0lWIdoqzyiShfZffJ3G751qb2BScbvtrhsRrfRF c4cg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ohd14K5oR+JrF5FR78MmbbdwJ7n6halDzi8bumggJ7I=; fh=TRtNIs3l4qcWJtx9U8Pb0lNP/WkK2zT+1RKb/Lt2Awg=; b=atWQOWXVGNUTkEklauskCw/iZkKG97cTI1e3gT4lYPR/WyxW7D6SvKtyimFKQ0/X2N HUxQpOObZMSsY05vZQMv75bQadkPlAPKH4LWvkaPMPcCZdPNrkO9Eif2qT+UTLcZfY6s TyI3T2xHU6OgwuaFZ+sQcF7SvwUYz7F3KBDQw+zj+9l8D4BBMJmWCqJR6MrXkwksG2oP P5HwITdNEmS9v/aLtfOooP5pMnYVwBlMG2gye3eVsM4QIenGeU3kgF5Eh717btGo5SSg s7zPhXDepXdhycFdq3E9nWcGQggEm37tj8bHKryXMpqIcO+WGfJdaT/JMtnpiwSKDy5/ 4lyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b="Aj+/NLyI"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f18-20020a056a0022d200b0067fea30cd05si7720716pfj.79.2023.08.08.10.48.49; Tue, 08 Aug 2023 10:49:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b="Aj+/NLyI"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229877AbjHHPkw (ORCPT + 99 others); Tue, 8 Aug 2023 11:40:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229504AbjHHPkg (ORCPT ); Tue, 8 Aug 2023 11:40:36 -0400 Received: from mail-pf1-x42a.google.com (mail-pf1-x42a.google.com [IPv6:2607:f8b0:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07FE5115; Tue, 8 Aug 2023 08:36:28 -0700 (PDT) Received: by mail-pf1-x42a.google.com with SMTP id d2e1a72fcca58-686fc0d3c92so3931946b3a.0; Tue, 08 Aug 2023 08:36:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691508988; x=1692113788; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ohd14K5oR+JrF5FR78MmbbdwJ7n6halDzi8bumggJ7I=; b=Aj+/NLyI0M4bjOuiF+GrOUzh8mKxQX5IIwSr5wVfEEI0l7sJrjMwKUw1ymTphYw+nt RLXAmib2imTvrC+zW2kk5dI6POkLpD+E5XQVOpOfOKe1UXI2e5vNsKzZ607DKIi+BH3O 5SFDkYMApqDoRfLC+O1xkB8DyagE7k0fq7eprQwBWQoPGKUXgj/xG01T+JarE3IeG5l3 iu6V8cMRtQjna2+01pJOTIhQlF0veYkIn9b6bNj1+kGNFGWRvYHJ0MJXftSE8w1Jnxl9 rUl4V6yWTwMk1SJ7fAi0qFO7yixjD2k+zw340olwzaNQH5WiemwHBezrrGQNtXQHyfAq yEPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691508988; x=1692113788; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ohd14K5oR+JrF5FR78MmbbdwJ7n6halDzi8bumggJ7I=; b=MJQhv7XUemZLxE/PPk59gIKmpne53+1pHYH97xMy6FgspdwAGjV8bDhVhWLuEOo6w1 ai1KDWBGBfzTAh/CHkUjwpYlmYFp65nSX7q30Tnu5Z+8CGzFJhtBmtB+AH8K3HAw0VEL 0dyiT7iXDdna8qnYHlEB5mD89DvPW1R/UGmwC9eb3nIx3Mpf4gZAESC2cf/LF8FIOfhq oaElzhGfOtGucjxMCZGFEog1AITjw/eVqK3SueWkDVUVSZAxYqP0H38jIUt2hUn/sneB 2GBSfsHODX9yNahevD82el2uyeFNeU3cweGnFI8+pZml89K1HJF44dE1+fJCoS8Idg+A HgqQ== X-Gm-Message-State: AOJu0Yy2EVTmLof7aBb2rvI14fpfgA15fbeMDlJMcDaiakFXcUtbGYMG ZBGjJjcyeD0eCc5+wLg0BB9QHFZpJCqjZ/95 X-Received: by 2002:a05:6830:1e0d:b0:6bc:9078:81c8 with SMTP id s13-20020a0568301e0d00b006bc907881c8mr11518461otr.20.1691490610989; Tue, 08 Aug 2023 03:30:10 -0700 (PDT) Received: from manas-VirtualBox.iitr.ac.in ([103.37.201.175]) by smtp.gmail.com with ESMTPSA id l12-20020a17090aec0c00b002677739860fsm7483268pjy.34.2023.08.08.03.30.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Aug 2023 03:30:10 -0700 (PDT) From: Manas Ghandat To: gregkh@linuxfoundation.org Cc: Manas Ghandat , Linux-kernel-mentees@lists.linuxfoundation.org, anton@tuxera.com, linkinjeon@kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-ntfs-dev@lists.sourceforge.net, syzbot+4768a8f039aa677897d0@syzkaller.appspotmail.com Subject: [PATCH v2] ntfs : fix shift-out-of-bounds in ntfs_iget Date: Tue, 8 Aug 2023 15:59:58 +0530 Message-Id: <20230808102958.8161-1-ghandatmanas@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <2023080821-blandness-survival-44af@gregkh> References: <2023080821-blandness-survival-44af@gregkh> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Added a check to the compression_unit so that out of bound doesn't occur. Fix patching issues in version 2. Signed-off-by: Manas Ghandat Reported-by: syzbot+4768a8f039aa677897d0@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=4768a8f039aa677897d0 --- fs/ntfs/inode.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/fs/ntfs/inode.c b/fs/ntfs/inode.c index 6c3f38d66579..a657322874ed 100644 --- a/fs/ntfs/inode.c +++ b/fs/ntfs/inode.c @@ -1077,6 +1077,15 @@ static int ntfs_read_locked_inode(struct inode *vi) goto unm_err_out; } if (a->data.non_resident.compression_unit) { + if (a->data.non_resident.compression_unit + + vol->cluster_size_bits > 32) { + ntfs_error(vi->i_sb, + "Found non-standard compression unit (%u). Cannot handle this.", + a->data.non_resident.compression_unit + ); + err = -EOPNOTSUPP; + goto unm_err_out; + } ni->itype.compressed.block_size = 1U << (a->data.non_resident. compression_unit + -- 2.37.2