linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [[PATCH] fix an endianness bug in ext4_encrypted_zeroout()
@ 2015-11-26 16:04 Al Viro
  2015-11-26 20:21 ` Theodore Ts'o
  0 siblings, 1 reply; 2+ messages in thread
From: Al Viro @ 2015-11-26 16:04 UTC (permalink / raw)
  To: Theodore Ts'o; +Cc: linux-ext4, linux-kernel

ex->ee_block is not host-endian (note that accesses of other fields
of *ex right next to that line go through the helpers that do proper
conversion from little-endian to host-endian; it might make sense
to add similar for ->ee_block to avoid reintroducing that kind of
bugs...)

Cc: stable@vger.kernel.org # v4.1+
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---

diff --git a/fs/ext4/crypto.c b/fs/ext4/crypto.c
index af06830..1a08350 100644
--- a/fs/ext4/crypto.c
+++ b/fs/ext4/crypto.c
@@ -389,7 +389,7 @@ int ext4_encrypted_zeroout(struct inode *inode, struct ext4_extent *ex)
 	struct ext4_crypto_ctx	*ctx;
 	struct page		*ciphertext_page = NULL;
 	struct bio		*bio;
-	ext4_lblk_t		lblk = ex->ee_block;
+	ext4_lblk_t		lblk = le32_to_cpu(ex->ee_block);
 	ext4_fsblk_t		pblk = ext4_ext_pblock(ex);
 	unsigned int		len = ext4_ext_get_actual_len(ex);
 	int			ret, err = 0;

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

* Re: [[PATCH] fix an endianness bug in ext4_encrypted_zeroout()
  2015-11-26 16:04 [[PATCH] fix an endianness bug in ext4_encrypted_zeroout() Al Viro
@ 2015-11-26 20:21 ` Theodore Ts'o
  0 siblings, 0 replies; 2+ messages in thread
From: Theodore Ts'o @ 2015-11-26 20:21 UTC (permalink / raw)
  To: Al Viro; +Cc: linux-ext4, linux-kernel

On Thu, Nov 26, 2015 at 04:04:34PM +0000, Al Viro wrote:
> ex->ee_block is not host-endian (note that accesses of other fields
> of *ex right next to that line go through the helpers that do proper
> conversion from little-endian to host-endian; it might make sense
> to add similar for ->ee_block to avoid reintroducing that kind of
> bugs...)
> 
> Cc: stable@vger.kernel.org # v4.1+
> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Thanks for catching this!   Applied.

							- Ted

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

end of thread, other threads:[~2015-11-26 20:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-26 16:04 [[PATCH] fix an endianness bug in ext4_encrypted_zeroout() Al Viro
2015-11-26 20:21 ` Theodore Ts'o

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).