From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 5BB4B78F29 for ; Mon, 15 Jun 2026 03:14:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781493249; cv=none; b=k3SE/qeLRuxi04FMtncjpdBfcHipsGKFdhodEMqhhOYjTMtBAVE+O7bEWaQz4ddH5NbbyqpkqWKl+wh6/oo67Yo/TG54ui8xAPW9sVMwxn7MntdV/tZKJX4CPyPWRbwUIdqbhcFw8WjxxNWNGx7wBo3T2tl6db14wDSZm57vZFU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781493249; c=relaxed/simple; bh=y1NUWFYTXmsd7gPiP4CmZXn7rKpG1fV6KDXBO9jHHwk=; h=Message-ID:Date:MIME-Version:Cc:Subject:To:References:From: In-Reply-To:Content-Type; b=B1MOblFNBpAtpYgRhkp29O6LAeT1ppMvEdTM3h9pr+j9emHje3oGG09gDCdTfW81PDX8qOnCkgtkef6X41DM9yJ6+aPzm4zKZj6etPIWlf/tllFWTYVZJsoNOmZGmLurOT+TgIGQ/KvQoIodiajEM6jMSyTpxRlQl5cYpVqcND0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=eIMhx9Ur; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="eIMhx9Ur" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A96821F000E9; Mon, 15 Jun 2026 03:14:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1781493247; bh=m8p1sEGL+W1L0l6iKEoOSB+rXixXbnsVyCjzmpVoam0=; h=Date:Cc:Subject:To:References:From:In-Reply-To; b=eIMhx9Urd+AE8bQq+bKCn3TPJa96gOWFy+mTz1lQMyRxlCQSsr3EQXOZKIfNr+CwR TaJp7tedSsX1j6ZztZc5NfFzpo0LDUrBPkBgPpmbcQdRykaQsNXYTHRvGzOQz4kKb0 I0GBvfpMiekFj+E30As051xhyYAgMLVObAu2wshcWoSa8MXQForsit9Sina9DwPbHn 3VrM1q/g9m9dOAkOGBhTYa23hAJnRgHJRhrlRcwQvCdg49owHXgkhyalAOJnOOJQDK EAmB+Ac2jhgWM4l+jo1lhxX/PEj83daWv9K88PV1CyEkEQha8KTuJjQIg7pKCXuksH 1krdrhJHpNf/g== Message-ID: Date: Mon, 15 Jun 2026 11:14:04 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Cc: chao@kernel.org, "open list:F2FS FILE SYSTEM" , open list Subject: Re: [PATCH] f2fs: validate inline dentry name lengths before conversion To: Samuel Moelius , Jaegeuk Kim References: <20260603154933.16368-1-sam.moelius@trailofbits.com> Content-Language: en-US From: Chao Yu In-Reply-To: <20260603154933.16368-1-sam.moelius@trailofbits.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 6/3/26 23:49, Samuel Moelius wrote: > Inline dentry conversion copies names out of the inline dentry area > before checking that each recorded name length fits in the available > filename slots. > > A corrupted image can therefore make the conversion path read past > the inline filename storage while building the regular dentry block. > > Validate each inline dentry name length against the inline filename > area before copying it. > > Assisted-by: Codex:gpt-5.5-cyber-preview > Signed-off-by: Samuel Moelius > --- > fs/f2fs/inline.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/fs/f2fs/inline.c b/fs/f2fs/inline.c > index 7aabfc9b43cb..4584dfbe3fb8 100644 > --- a/fs/f2fs/inline.c > +++ b/fs/f2fs/inline.c > @@ -507,6 +507,10 @@ static int f2fs_add_inline_entries(struct inode *dir, void *inline_dentry) > bit_pos++; > continue; > } > + if (unlikely(le16_to_cpu(de->name_len) > F2FS_NAME_LEN || > + bit_pos + GET_DENTRY_SLOTS(le16_to_cpu(de->name_len)) > > + d.max)) > + return -EFSCORRUPTED; err = -EFSCORRUPTED; goto punch_dentry_pages; Thanks, > > /* > * We only need the disk_name and hash to move the dentry.