Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp2773774rdb; Mon, 12 Feb 2024 16:52:58 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVGjP+sQnQsgsiLsc7QOE3aMj9PrymrDHTtEpJBaEWkV095G306m649Ar80X6XJescBboFDF1DlerMoKL9A1wNIxMPO68onNu8NWsmx5w== X-Google-Smtp-Source: AGHT+IEX5wC94qBlsU4dHCGHJbwr8yL92s6CMJ1OHCaAC0mET5Ch/8NxhALg3ljYgbNIQOaICU42 X-Received: by 2002:a05:6a20:c91b:b0:19e:3709:f3f9 with SMTP id gx27-20020a056a20c91b00b0019e3709f3f9mr12206633pzb.2.1707785578490; Mon, 12 Feb 2024 16:52:58 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707785578; cv=pass; d=google.com; s=arc-20160816; b=MDZ8vkbZFnSYwaMI07ufz4bIgwxTkjVMe7+PniKx5hzWmH0TPlUudJrbTd+vJqXfKf 9GClsLPuBHmAWYn0K5udis0BXzwWVi+Bo2xk6GIdFtD5anhFj/llw0AOH+fMCNmq27yP ysdIjPFPYC2X/8Tm12b37NjyaPCoUWyAWznuQ+km+sSkpb1w5PGTS6INFaU79KqV/7me FoeTG5n+QkUAMZzWIInz4Ah1JGtaWy0FijF2eiC2KLVrT7hcbzLUQJbRNbCMRavpce69 zHVJKXhvsBRg1wW/6Gmds0WpIw7NA+FAjxvg/ZmoNt1Oq9TvK/kBm2CUNi2aNrXXhvqF tCEQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=s+WKdXfKa1UpZ1V4EpYmkAEo3HSAmS7aslUaovU/OFs=; fh=/jkkqr5uN1jB32VnlrbGJI0fOTwfd0KHp0KdwQBCx/k=; b=aMUG68FO4TayLPZ41kzvvWyImShHI5gl+hlkI9XvZgxVoLidNhhQqBSMyY9+tHxm7z kODC7W5Jdn59g20V1k0oH2l+cWboSXVmtl1ZtHTlXXJjeA2qu9EbeGQ2urDu+gVkvezU rkWjlb/SVfOThdd0GJ2bH7jpT62Of0dFRAmxxuQsthQyaAyshkcZKYSw52IIJyw694BR 4UEbYZV9TavCab63FlG2XJ8hHSuMXgS1781hSGh2dki67M/tbStJ7s3Q4G+fOxHgrRmT H62A0pAdgyZAGzCxUZDP1xtSIBfdJ8/e1FNWHBeJCb67iq3tacY4lppHZBCJlXGj9TVS h8qg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=OCmrjVN1; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-62696-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62696-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=2; AJvYcCWucy1avJOj/rZzRxdQIaLuW6Swt1fGQ+Hd90BaRbQ00kJANAjtNX0FNRKNsjTuZ8JM4L1TCDV3QwjiVJLEQUV9VGHmNg9DNXhhFKjWEw== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id t8-20020a056a00138800b006e0cff575c1si3601235pfg.397.2024.02.12.16.52.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 16:52:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-62696-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=OCmrjVN1; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-62696-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62696-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 27938285888 for ; Tue, 13 Feb 2024 00:52:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BC17579924; Tue, 13 Feb 2024 00:22:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="OCmrjVN1" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 E212A7A708; Tue, 13 Feb 2024 00:22:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707783771; cv=none; b=l2RAuv3kMOVxihYQCxCHrRVI13+g5tXt7x5RiMrhHPuvpq1j3zc+92+hhF/f0f5wsOd6TRGLRc+f/e+lJ9+siGCB5yFJsOTJnHPZWjA+n/MUmY6/3qKpTp5FJBxZq/314/eyWax5hFAGY/PIU1rY+oAEvvJaW/JRD0BIG2A9+NY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707783771; c=relaxed/simple; bh=YjAmsIifFdM1ic+s/g5GLs25vN52ua+ZyccU80kqhaQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GkAu4FxtIPhG+W19Bxmn/ldFrMFFVL6BAF2SZAx59l7RmjY5flCGln+NIOkICHG1Ngy063hpkmTuxpcyqefZgE+2tHfjBcQCffIanNJLBBOR33R5LAhrbQsK60ueJs0yvU1yIXI6FrxqcemIUINfg5CqmS5zL8oyxFAl/595UCI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=OCmrjVN1; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id D2E51C433F1; Tue, 13 Feb 2024 00:22:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707783770; bh=YjAmsIifFdM1ic+s/g5GLs25vN52ua+ZyccU80kqhaQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OCmrjVN1NwPAhvS/8FwPlkO4CdfBAOb1bmHutkClv8ba7aMR4cfJi50NeD69KhMpv Xa+Rg6qgMzEA6TuRvdI6Tyb/3k92NWubfxk8pQyprf2EWZeY6G1cde+sdLMOsRuGAG Qh+ZRbUMCW2SGGvNdaRyXWuwL4tdWlCAGcNOw89w1UfK58uLTmiaKNDqzDoYozYFHn H7qu8ijeu8UteYlUrunx67csruGNDS2V2Fhk24zneKYk0u2JjIU7+XVVcymg77qVav VziqGh9iwx/CNt0lDuqD/9T4yEWCkUbjIdlqYV4boCIuWz9hz938vzXRcW8txjYzoD TemBUMpU+ccxg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Edward Adam Davis , syzbot+65e940cfb8f99a97aca7@syzkaller.appspotmail.com, Konstantin Komarov , Sasha Levin , ntfs3@lists.linux.dev Subject: [PATCH AUTOSEL 6.1 12/28] fs/ntfs3: Fix oob in ntfs_listxattr Date: Mon, 12 Feb 2024 19:22:10 -0500 Message-ID: <20240213002235.671934-12-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240213002235.671934-1-sashal@kernel.org> References: <20240213002235.671934-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.1.77 Content-Transfer-Encoding: 8bit From: Edward Adam Davis [ Upstream commit 731ab1f9828800df871c5a7ab9ffe965317d3f15 ] The length of name cannot exceed the space occupied by ea. Reported-and-tested-by: syzbot+65e940cfb8f99a97aca7@syzkaller.appspotmail.com Signed-off-by: Edward Adam Davis Signed-off-by: Konstantin Komarov Signed-off-by: Sasha Levin --- fs/ntfs3/xattr.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/ntfs3/xattr.c b/fs/ntfs3/xattr.c index df15e00c2a3a..d98cf7b382bc 100644 --- a/fs/ntfs3/xattr.c +++ b/fs/ntfs3/xattr.c @@ -217,6 +217,9 @@ static ssize_t ntfs_list_ea(struct ntfs_inode *ni, char *buffer, if (!ea->name_len) break; + if (ea->name_len > ea_size) + break; + if (buffer) { /* Check if we can use field ea->name */ if (off + ea_size > size) -- 2.43.0