All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: <linux-fsdevel@vger.kernel.org>
Cc: butt3rflyh4ck <butterflyhuangxx@gmail.com>,
	Jan Kara <jack@suse.cz>,
	stable@vger.kernel.org
Subject: [PATCH 2/2] udf: Restore i_lenAlloc when inode expansion fails
Date: Tue, 18 Jan 2022 10:57:48 +0100	[thread overview]
Message-ID: <20220118095753.627-2-jack@suse.cz> (raw)
In-Reply-To: <20220118095449.2937-1-jack@suse.cz>

When we fail to expand inode from inline format to a normal format, we
restore inode to contain the original inline formatting but we forgot to
set i_lenAlloc back. The mismatch between i_lenAlloc and i_size was then
causing further problems such as warnings and lost data down the line.

Reported-by: butt3rflyh4ck <butterflyhuangxx@gmail.com>
CC: stable@vger.kernel.org
Fixes: 7e49b6f2480c ("udf: Convert UDF to new truncate calling sequence")
Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/udf/inode.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/udf/inode.c b/fs/udf/inode.c
index d6aa506b6b58..ea8f6cd01f50 100644
--- a/fs/udf/inode.c
+++ b/fs/udf/inode.c
@@ -315,6 +315,7 @@ int udf_expand_file_adinicb(struct inode *inode)
 		unlock_page(page);
 		iinfo->i_alloc_type = ICBTAG_FLAG_AD_IN_ICB;
 		inode->i_data.a_ops = &udf_adinicb_aops;
+		iinfo->i_lenAlloc = inode->i_size;
 		up_write(&iinfo->i_data_sem);
 	}
 	put_page(page);
-- 
2.31.1


  parent reply	other threads:[~2022-01-18  9:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-18  9:57 [PATCH 0/2] udf: Inline format expansion fixes Jan Kara
2022-01-18  9:57 ` [PATCH 1/2] udf: Fix NULL ptr deref when converting from inline format Jan Kara
2022-01-20  9:05   ` Christoph Hellwig
2022-01-18  9:57 ` Jan Kara [this message]
2022-01-20  9:06   ` [PATCH 2/2] udf: Restore i_lenAlloc when inode expansion fails Christoph Hellwig
2022-01-20 11:19     ` Jan Kara
2022-01-18 10:11 ` [PATCH 0/2] udf: Inline format expansion fixes butt3rflyh4ck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220118095753.627-2-jack@suse.cz \
    --to=jack@suse.cz \
    --cc=butterflyhuangxx@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.