* [patch] ext4 crypto: type bug with encrypted symlinks
@ 2015-04-15 9:21 ` Dan Carpenter
0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2015-04-15 9:21 UTC (permalink / raw)
To: Theodore Ts'o; +Cc: Andreas Dilger, linux-ext4, kernel-janitors
sd->len is an __le16 and not an __le32.
Fixes: f1195c72c951 ('ext4 crypto: Add symlink encryption')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index 69e12ee..5c82a3c 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -3256,7 +3256,7 @@ static int ext4_symlink(struct inode *dir,
ext4_put_fname_crypto_ctx(&ctx);
if (err < 0)
goto err_drop_inode;
- sd->len = cpu_to_le32(ostr.len);
+ sd->len = cpu_to_le16(ostr.len);
disk_link.name = (char *) sd;
}
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [patch] ext4 crypto: type bug with encrypted symlinks
@ 2015-04-15 9:21 ` Dan Carpenter
0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2015-04-15 9:21 UTC (permalink / raw)
To: Theodore Ts'o; +Cc: Andreas Dilger, linux-ext4, kernel-janitors
sd->len is an __le16 and not an __le32.
Fixes: f1195c72c951 ('ext4 crypto: Add symlink encryption')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index 69e12ee..5c82a3c 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -3256,7 +3256,7 @@ static int ext4_symlink(struct inode *dir,
ext4_put_fname_crypto_ctx(&ctx);
if (err < 0)
goto err_drop_inode;
- sd->len = cpu_to_le32(ostr.len);
+ sd->len = cpu_to_le16(ostr.len);
disk_link.name = (char *) sd;
}
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [patch] ext4 crypto: type bug with encrypted symlinks
2015-04-15 9:21 ` Dan Carpenter
@ 2015-04-15 15:14 ` Andreas Dilger
-1 siblings, 0 replies; 6+ messages in thread
From: Andreas Dilger @ 2015-04-15 15:14 UTC (permalink / raw)
To: Dan Carpenter
Cc: Theodore Ts'o, Andreas Dilger, linux-ext4, kernel-janitors
Nak. ostr.len is the variable being swabbed, and it is a __u32.
Cheers, Andreas
> On Apr 15, 2015, at 03:21, Dan Carpenter <dan.carpenter@oracle.com> wrote:
>
> sd->len is an __le16 and not an __le32.
>
> Fixes: f1195c72c951 ('ext4 crypto: Add symlink encryption')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
> index 69e12ee..5c82a3c 100644
> --- a/fs/ext4/namei.c
> +++ b/fs/ext4/namei.c
> @@ -3256,7 +3256,7 @@ static int ext4_symlink(struct inode *dir,
> ext4_put_fname_crypto_ctx(&ctx);
> if (err < 0)
> goto err_drop_inode;
> - sd->len = cpu_to_le32(ostr.len);
> + sd->len = cpu_to_le16(ostr.len);
> disk_link.name = (char *) sd;
> }
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [patch] ext4 crypto: type bug with encrypted symlinks
@ 2015-04-15 15:14 ` Andreas Dilger
0 siblings, 0 replies; 6+ messages in thread
From: Andreas Dilger @ 2015-04-15 15:14 UTC (permalink / raw)
To: Dan Carpenter
Cc: Theodore Ts'o, Andreas Dilger, linux-ext4, kernel-janitors
Nak. ostr.len is the variable being swabbed, and it is a __u32.
Cheers, Andreas
> On Apr 15, 2015, at 03:21, Dan Carpenter <dan.carpenter@oracle.com> wrote:
>
> sd->len is an __le16 and not an __le32.
>
> Fixes: f1195c72c951 ('ext4 crypto: Add symlink encryption')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
> index 69e12ee..5c82a3c 100644
> --- a/fs/ext4/namei.c
> +++ b/fs/ext4/namei.c
> @@ -3256,7 +3256,7 @@ static int ext4_symlink(struct inode *dir,
> ext4_put_fname_crypto_ctx(&ctx);
> if (err < 0)
> goto err_drop_inode;
> - sd->len = cpu_to_le32(ostr.len);
> + sd->len = cpu_to_le16(ostr.len);
> disk_link.name = (char *) sd;
> }
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [patch] ext4 crypto: type bug with encrypted symlinks
2015-04-15 15:14 ` Andreas Dilger
@ 2015-04-15 16:45 ` Theodore Ts'o
-1 siblings, 0 replies; 6+ messages in thread
From: Theodore Ts'o @ 2015-04-15 16:45 UTC (permalink / raw)
To: Andreas Dilger; +Cc: Dan Carpenter, Andreas Dilger, linux-ext4, kernel-janitors
On Wed, Apr 15, 2015 at 09:14:17AM -0600, Andreas Dilger wrote:
> Nak. ostr.len is the variable being swabbed, and it is a __u32.
No, Dan is right; sd->len has been changed to be 16 bits on disk, per
Andreas' suggestion, and I missed changing the cpu_to_le32() to be
cpu_to_le16() here. The fact that the in-memory representation
happens to be 32-bits doesn't matter, it's the fact that on-disk
representation is 16-bits which is important here.
In practice the filename length can never be larger
i_sb->s_blocksize(), so we could probably change struct ext4_str to
use an __u16 --- but at least at one point RISC architectues can
sometimes handle 32-bit values more efficiently than 16-bit values,
and it's probably not worth the effort to make the change.
- Ted
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [patch] ext4 crypto: type bug with encrypted symlinks
@ 2015-04-15 16:45 ` Theodore Ts'o
0 siblings, 0 replies; 6+ messages in thread
From: Theodore Ts'o @ 2015-04-15 16:45 UTC (permalink / raw)
To: Andreas Dilger; +Cc: Dan Carpenter, Andreas Dilger, linux-ext4, kernel-janitors
On Wed, Apr 15, 2015 at 09:14:17AM -0600, Andreas Dilger wrote:
> Nak. ostr.len is the variable being swabbed, and it is a __u32.
No, Dan is right; sd->len has been changed to be 16 bits on disk, per
Andreas' suggestion, and I missed changing the cpu_to_le32() to be
cpu_to_le16() here. The fact that the in-memory representation
happens to be 32-bits doesn't matter, it's the fact that on-disk
representation is 16-bits which is important here.
In practice the filename length can never be larger
i_sb->s_blocksize(), so we could probably change struct ext4_str to
use an __u16 --- but at least at one point RISC architectues can
sometimes handle 32-bit values more efficiently than 16-bit values,
and it's probably not worth the effort to make the change.
- Ted
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-04-15 16:45 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-15 9:21 [patch] ext4 crypto: type bug with encrypted symlinks Dan Carpenter
2015-04-15 9:21 ` Dan Carpenter
2015-04-15 15:14 ` Andreas Dilger
2015-04-15 15:14 ` Andreas Dilger
2015-04-15 16:45 ` Theodore Ts'o
2015-04-15 16:45 ` Theodore Ts'o
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.