* [PATCH] ext2: fix improper assignment for e_value_offs
@ 2020-06-03 8:44 Chengguang Xu
2020-06-05 15:20 ` Jan Kara
0 siblings, 1 reply; 2+ messages in thread
From: Chengguang Xu @ 2020-06-03 8:44 UTC (permalink / raw)
To: jack; +Cc: linux-ext4, Chengguang Xu
In the process of changing value for existing EA,
there is an improper assignment of e_value_offs(setting to 0),
because it will be reset to incorrect value in the following
loop(shifting EA values before target). Delayed assignment
can avoid this issue.
Signed-off-by: Chengguang Xu <cgxu519@mykernel.net>
---
fs/ext2/xattr.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/ext2/xattr.c b/fs/ext2/xattr.c
index 943cc469f42f..c802ea682e7f 100644
--- a/fs/ext2/xattr.c
+++ b/fs/ext2/xattr.c
@@ -588,7 +588,6 @@ ext2_xattr_set(struct inode *inode, int name_index, const char *name,
/* Remove the old value. */
memmove(first_val + size, first_val, val - first_val);
memset(first_val, 0, size);
- here->e_value_offs = 0;
min_offs += size;
/* Adjust all value offsets. */
@@ -600,6 +599,8 @@ ext2_xattr_set(struct inode *inode, int name_index, const char *name,
cpu_to_le16(o + size);
last = EXT2_XATTR_NEXT(last);
}
+
+ here->e_value_offs = 0;
}
if (value == NULL) {
/* Remove the old name. */
--
2.20.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ext2: fix improper assignment for e_value_offs
2020-06-03 8:44 [PATCH] ext2: fix improper assignment for e_value_offs Chengguang Xu
@ 2020-06-05 15:20 ` Jan Kara
0 siblings, 0 replies; 2+ messages in thread
From: Jan Kara @ 2020-06-05 15:20 UTC (permalink / raw)
To: Chengguang Xu; +Cc: jack, linux-ext4
On Wed 03-06-20 16:44:29, Chengguang Xu wrote:
> In the process of changing value for existing EA,
> there is an improper assignment of e_value_offs(setting to 0),
> because it will be reset to incorrect value in the following
> loop(shifting EA values before target). Delayed assignment
> can avoid this issue.
>
> Signed-off-by: Chengguang Xu <cgxu519@mykernel.net>
Thanks. I've added the patch to my tree.
Honza
> ---
> fs/ext2/xattr.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/fs/ext2/xattr.c b/fs/ext2/xattr.c
> index 943cc469f42f..c802ea682e7f 100644
> --- a/fs/ext2/xattr.c
> +++ b/fs/ext2/xattr.c
> @@ -588,7 +588,6 @@ ext2_xattr_set(struct inode *inode, int name_index, const char *name,
> /* Remove the old value. */
> memmove(first_val + size, first_val, val - first_val);
> memset(first_val, 0, size);
> - here->e_value_offs = 0;
> min_offs += size;
>
> /* Adjust all value offsets. */
> @@ -600,6 +599,8 @@ ext2_xattr_set(struct inode *inode, int name_index, const char *name,
> cpu_to_le16(o + size);
> last = EXT2_XATTR_NEXT(last);
> }
> +
> + here->e_value_offs = 0;
> }
> if (value == NULL) {
> /* Remove the old name. */
> --
> 2.20.1
>
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-06-05 15:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-03 8:44 [PATCH] ext2: fix improper assignment for e_value_offs Chengguang Xu
2020-06-05 15:20 ` Jan Kara
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).