From nobody Sun Feb 8 18:28:27 2026 Received: from relayaws-01.paragon-software.com (relayaws-01.paragon-software.com [35.157.23.187]) (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 271DC13D265; Wed, 17 Apr 2024 13:06:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=35.157.23.187 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713359169; cv=none; b=ftJyV8faNFrwahK2FLp+RqUISs65CsOgqORoBc5wcH5ZfzYQU4QQecFZHNHdOAd3qjfddzagD0uA0ecDjNjyfadcBUvABbk+NFzNPd0quk4WlNWZqxPkwwaef7WYtreoM5KUUWpQY7Ibf3Im3A8Lkz0R4Kwf+sbvepcsr1ilsKM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713359169; c=relaxed/simple; bh=9Ie/YLM/joywAkgY5c4+CnSqKB8Gr3vixzyksohbcTw=; h=Message-ID:Date:MIME-Version:Subject:From:To:References: In-Reply-To:Content-Type; b=h7sXqRBU0fKt7sycjP3M7B8HPgFaZNhb5TBcVX+sfi+PL3nO1XViLC/vjJ6N8/j9Sp/0QEjF0sW+s6lsFxcOMkZFZy7iEBajb9Y24HJJ1VubTXYzXJH36U+WvGNP7Lj8TsBhFpaFuo156VuWZlvKgxUd/QX4Ja2yeh5KrU29cQQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=paragon-software.com; spf=pass smtp.mailfrom=paragon-software.com; dkim=pass (1024-bit key) header.d=paragon-software.com header.i=@paragon-software.com header.b=NVHiYSx9; arc=none smtp.client-ip=35.157.23.187 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=paragon-software.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=paragon-software.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=paragon-software.com header.i=@paragon-software.com header.b="NVHiYSx9" Received: from dlg2.mail.paragon-software.com (vdlg-exch-02.paragon-software.com [172.30.1.105]) by relayaws-01.paragon-software.com (Postfix) with ESMTPS id 213B32126; Wed, 17 Apr 2024 12:58:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1713358713; bh=sstzwDA7HJF1SbYTI7fJ3qkhbZk4t2Sju46k98cE9Mk=; h=Date:Subject:From:To:References:In-Reply-To; b=NVHiYSx9A3Qy8ga9U6cPD4ucTqsztbDPJ3G1vOyNDXOz4qvhmIox/kSwJLwFDFEOt L83ygnznR6U2/UJcQVTvOOlXrMcPoTcFpTwHCHf+G5qoUYWKD0VZkBTOwObmRfBjRg pAhiJejHIrPpDsVwzcRb+XZDWj1UXcYwewVnNQUM= Received: from [192.168.211.39] (192.168.211.39) by vdlg-exch-02.paragon-software.com (172.30.1.105) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.7; Wed, 17 Apr 2024 16:06:01 +0300 Message-ID: Date: Wed, 17 Apr 2024 16:06:01 +0300 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 03/11] fs/ntfs3: Mark volume as dirty if xattr is broken From: Konstantin Komarov To: , LKML , Linux-fsdevel References: <6c99c1bd-448d-4301-8404-50df34e8df8e@paragon-software.com> Content-Language: en-US In-Reply-To: <6c99c1bd-448d-4301-8404-50df34e8df8e@paragon-software.com> Content-Type: text/plain; charset="utf-8"; format="flowed" Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: vdlg-exch-02.paragon-software.com (172.30.1.105) To vdlg-exch-02.paragon-software.com (172.30.1.105) Signed-off-by: Konstantin Komarov --- =C2=A0fs/ntfs3/xattr.c | 17 +++++++++++------ =C2=A01 file changed, 11 insertions(+), 6 deletions(-) diff --git a/fs/ntfs3/xattr.c b/fs/ntfs3/xattr.c index 53e7d1fa036a..872df2197202 100644 --- a/fs/ntfs3/xattr.c +++ b/fs/ntfs3/xattr.c @@ -200,6 +200,7 @@ static ssize_t ntfs_list_ea(struct ntfs_inode *ni,=20 char *buffer, =C2=A0=C2=A0=C2=A0 =C2=A0int err; =C2=A0=C2=A0=C2=A0 =C2=A0int ea_size; =C2=A0=C2=A0=C2=A0 =C2=A0size_t ret; +=C2=A0=C2=A0 =C2=A0u8 name_len; =C2=A0=C2=A0=C2=A0 =C2=A0err =3D ntfs_read_ea(ni, &ea_all, 0, &info); =C2=A0=C2=A0=C2=A0 =C2=A0if (err) @@ -215,28 +216,32 @@ static ssize_t ntfs_list_ea(struct ntfs_inode *ni,=20 char *buffer, =C2=A0=C2=A0=C2=A0 =C2=A0for (off =3D 0; off + sizeof(struct EA_FULL) < si= ze; off +=3D ea_size) { =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0ea =3D Add2Ptr(ea_all, off); =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0ea_size =3D unpacked_ea_size(e= a); +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0name_len =3D ea->name_len; -=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0if (!ea->name_len) +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0if (!name_len) =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0break; -=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0if (ea->name_len > ea_size) +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0if (name_len > ea_size) { +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0ntfs_set_state(ni= ->mi.sbi, NTFS_DIRTY_ERROR); +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0err =3D -EINVAL; = /* corrupted fs. */ =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0break; +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0} =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0if (buffer) { =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0/* Check if= we can use field ea->name */ =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0if (off + e= a_size > size) =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2= =A0 =C2=A0break; -=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0if (ret + ea->nam= e_len + 1 > bytes_per_buffer) { +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0if (ret + name_le= n + 1 > bytes_per_buffer) { =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2= =A0 =C2=A0err =3D -ERANGE; =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2= =A0 =C2=A0goto out; =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0} -=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0memcpy(buffer + r= et, ea->name, ea->name_len); -=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0buffer[ret + ea->= name_len] =3D 0; +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0memcpy(buffer + r= et, ea->name, name_len); +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0buffer[ret + name= _len] =3D 0; =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0} -=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0ret +=3D ea->name_len + 1; +=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0ret +=3D name_len + 1; =C2=A0=C2=A0=C2=A0 =C2=A0} =C2=A0out: --=20 2.34.1