public inbox for ntfs3@lists.linux.dev
 help / color / mirror / Atom feed
* [PATCH 0/2] fs/ntfs3: Fix bugs and typos
@ 2024-05-29  6:40 Huacai Chen
  2024-05-29  6:40 ` [PATCH 1/2] fs/ntfs3: Update log->page_{mask,bits} if log->page_size changed Huacai Chen
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Huacai Chen @ 2024-05-29  6:40 UTC (permalink / raw)
  To: Konstantin Komarov; +Cc: Huacai Chen, ntfs3, linux-kernel, Huacai Chen

When we enable NTFS3 on Loongson platforms we found some bugs and
typos. So fix them.

Huacai Chen(2):
 fs/ntfs3: Update log->page_{mask,bits} if log->page_size changed.
 fs/ntfs3: Rename the label end_reply to end_replay.

Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
---
2.27.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] fs/ntfs3: Update log->page_{mask,bits} if log->page_size changed
  2024-05-29  6:40 [PATCH 0/2] fs/ntfs3: Fix bugs and typos Huacai Chen
@ 2024-05-29  6:40 ` Huacai Chen
  2024-05-29  6:40 ` [PATCH 2/2] fs/ntfs3: Rename the label end_reply to end_replay Huacai Chen
  2024-06-12  4:48 ` [PATCH 0/2] fs/ntfs3: Fix bugs and typos Huacai Chen
  2 siblings, 0 replies; 5+ messages in thread
From: Huacai Chen @ 2024-05-29  6:40 UTC (permalink / raw)
  To: Konstantin Komarov; +Cc: Huacai Chen, ntfs3, linux-kernel, Huacai Chen, stable

If an NTFS file system is mounted to another system with different
PAGE_SIZE from the original system, log->page_size will change in
log_replay(), but log->page_{mask,bits} don't change correspondingly.
This will cause a panic because "u32 bytes = log->page_size - page_off"
will get a negative value in the later read_log_page().

Cc: stable@vger.kernel.org
Fixes: b46acd6a6a627d876898e ("fs/ntfs3: Add NTFS journal")
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
---
 fs/ntfs3/fslog.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/ntfs3/fslog.c b/fs/ntfs3/fslog.c
index 855519713bf7..19c448093df7 100644
--- a/fs/ntfs3/fslog.c
+++ b/fs/ntfs3/fslog.c
@@ -3914,6 +3914,9 @@ int log_replay(struct ntfs_inode *ni, bool *initialized)
 		goto out;
 	}
 
+	log->page_mask = log->page_size - 1;
+	log->page_bits = blksize_bits(log->page_size);
+
 	/* If the file size has shrunk then we won't mount it. */
 	if (log->l_size < le64_to_cpu(ra2->l_size)) {
 		err = -EINVAL;
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] fs/ntfs3: Rename the label end_reply to end_replay
  2024-05-29  6:40 [PATCH 0/2] fs/ntfs3: Fix bugs and typos Huacai Chen
  2024-05-29  6:40 ` [PATCH 1/2] fs/ntfs3: Update log->page_{mask,bits} if log->page_size changed Huacai Chen
@ 2024-05-29  6:40 ` Huacai Chen
  2024-06-12  4:48 ` [PATCH 0/2] fs/ntfs3: Fix bugs and typos Huacai Chen
  2 siblings, 0 replies; 5+ messages in thread
From: Huacai Chen @ 2024-05-29  6:40 UTC (permalink / raw)
  To: Konstantin Komarov; +Cc: Huacai Chen, ntfs3, linux-kernel, Huacai Chen, stable

The label end_reply is obviously a typo. It should be "replay" in this
context. So rename end_reply to end_replay.

Cc: stable@vger.kernel.org
Fixes: b46acd6a6a627d876898e ("fs/ntfs3: Add NTFS journal")
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
---
 fs/ntfs3/fslog.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/ntfs3/fslog.c b/fs/ntfs3/fslog.c
index 19c448093df7..87c0e2b52954 100644
--- a/fs/ntfs3/fslog.c
+++ b/fs/ntfs3/fslog.c
@@ -4661,7 +4661,7 @@ int log_replay(struct ntfs_inode *ni, bool *initialized)
 	 * table are not empty.
 	 */
 	if ((!dptbl || !dptbl->total) && (!trtbl || !trtbl->total))
-		goto end_reply;
+		goto end_replay;
 
 	sbi->flags |= NTFS_FLAGS_NEED_REPLAY;
 	if (is_ro)
@@ -5090,7 +5090,7 @@ int log_replay(struct ntfs_inode *ni, bool *initialized)
 
 	sbi->flags &= ~NTFS_FLAGS_NEED_REPLAY;
 
-end_reply:
+end_replay:
 
 	err = 0;
 	if (is_ro)
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/2] fs/ntfs3: Fix bugs and typos
  2024-05-29  6:40 [PATCH 0/2] fs/ntfs3: Fix bugs and typos Huacai Chen
  2024-05-29  6:40 ` [PATCH 1/2] fs/ntfs3: Update log->page_{mask,bits} if log->page_size changed Huacai Chen
  2024-05-29  6:40 ` [PATCH 2/2] fs/ntfs3: Rename the label end_reply to end_replay Huacai Chen
@ 2024-06-12  4:48 ` Huacai Chen
  2024-06-19  8:03   ` Konstantin Komarov
  2 siblings, 1 reply; 5+ messages in thread
From: Huacai Chen @ 2024-06-12  4:48 UTC (permalink / raw)
  To: Huacai Chen; +Cc: Konstantin Komarov, ntfs3, linux-kernel

Hi, Konstantin,

Could you please take some time to review this series? Thank you.

Huacai

On Wed, May 29, 2024 at 2:41 PM Huacai Chen <chenhuacai@loongson.cn> wrote:
>
> When we enable NTFS3 on Loongson platforms we found some bugs and
> typos. So fix them.
>
> Huacai Chen(2):
>  fs/ntfs3: Update log->page_{mask,bits} if log->page_size changed.
>  fs/ntfs3: Rename the label end_reply to end_replay.
>
> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
> ---
> 2.27.0
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/2] fs/ntfs3: Fix bugs and typos
  2024-06-12  4:48 ` [PATCH 0/2] fs/ntfs3: Fix bugs and typos Huacai Chen
@ 2024-06-19  8:03   ` Konstantin Komarov
  0 siblings, 0 replies; 5+ messages in thread
From: Konstantin Komarov @ 2024-06-19  8:03 UTC (permalink / raw)
  To: Huacai Chen, Huacai Chen; +Cc: ntfs3, linux-kernel

On 12.06.2024 07:48, Huacai Chen wrote:
> Hi, Konstantin,
>
> Could you please take some time to review this series? Thank you.
>
> Huacai
>
> On Wed, May 29, 2024 at 2:41 PM Huacai Chen <chenhuacai@loongson.cn> wrote:
>> When we enable NTFS3 on Loongson platforms we found some bugs and
>> typos. So fix them.
>>
>> Huacai Chen(2):
>>   fs/ntfs3: Update log->page_{mask,bits} if log->page_size changed.
>>   fs/ntfs3: Rename the label end_reply to end_replay.
>>
>> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
>> ---
>> 2.27.0
>>
Hi,Huacai

We have accepted your patches and will add them to the repository shortly.

Regards, Konstantin

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-06-19  8:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-29  6:40 [PATCH 0/2] fs/ntfs3: Fix bugs and typos Huacai Chen
2024-05-29  6:40 ` [PATCH 1/2] fs/ntfs3: Update log->page_{mask,bits} if log->page_size changed Huacai Chen
2024-05-29  6:40 ` [PATCH 2/2] fs/ntfs3: Rename the label end_reply to end_replay Huacai Chen
2024-06-12  4:48 ` [PATCH 0/2] fs/ntfs3: Fix bugs and typos Huacai Chen
2024-06-19  8:03   ` Konstantin Komarov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox