Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ea814ab9 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull ext4 updates from Ted Ts'o:
 "Pretty much all bug fixes and clean ups for 4.3, after a lot of
  features and other churn going into 4.2"

* tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4:
  Revert "ext4: remove block_device_ejected"
  ext4: ratelimit the file system mounted message
  ext4: silence a format string false positive
  ext4: simplify some code in read_mmp_block()
  ext4: don't manipulate recovery flag when freezing no-journal fs
  jbd2: limit number of reserved credits
  ext4 crypto: remove duplicate header file
  ext4: update c/mtime on truncate up
  jbd2: avoid infinite loop when destroying aborted journal
  ext4, jbd2: add REQ_FUA flag when recording an error in the superblock
  ext4 crypto: fix spelling typo in comment
  ext4 crypto: exit cleanly if ext4_derive_key_aes() fails
  ext4: reject journal options for ext2 mounts
  ext4: implement cgroup writeback support
  ext4: replace ext4_io_submit->io_op with ->io_wbc
  ext4 crypto: check for too-short encrypted file names
  ext4 crypto: use a jbd2 transaction when adding a crypto policy
  jbd2: speedup jbd2_journal_dirty_metadata()
parents e31fb9e0 bdfe0cbd
Loading
Loading
Loading
Loading
+4 −1
Original line number Original line Diff line number Diff line
@@ -19,7 +19,6 @@
#include <linux/gfp.h>
#include <linux/gfp.h>
#include <linux/kernel.h>
#include <linux/kernel.h>
#include <linux/key.h>
#include <linux/key.h>
#include <linux/key.h>
#include <linux/list.h>
#include <linux/list.h>
#include <linux/mempool.h>
#include <linux/mempool.h>
#include <linux/random.h>
#include <linux/random.h>
@@ -329,6 +328,10 @@ int _ext4_fname_disk_to_usr(struct inode *inode,
			return oname->len;
			return oname->len;
		}
		}
	}
	}
	if (iname->len < EXT4_CRYPTO_BLOCK_SIZE) {
		EXT4_ERROR_INODE(inode, "encrypted inode too small");
		return -EUCLEAN;
	}
	if (EXT4_I(inode)->i_crypt_info)
	if (EXT4_I(inode)->i_crypt_info)
		return ext4_fname_decrypt(inode, iname, oname);
		return ext4_fname_decrypt(inode, iname, oname);


+3 −1
Original line number Original line Diff line number Diff line
@@ -30,7 +30,7 @@ static void derive_crypt_complete(struct crypto_async_request *req, int rc)


/**
/**
 * ext4_derive_key_aes() - Derive a key using AES-128-ECB
 * ext4_derive_key_aes() - Derive a key using AES-128-ECB
 * @deriving_key: Encryption key used for derivatio.
 * @deriving_key: Encryption key used for derivation.
 * @source_key:   Source key to which to apply derivation.
 * @source_key:   Source key to which to apply derivation.
 * @derived_key:  Derived key.
 * @derived_key:  Derived key.
 *
 *
@@ -220,6 +220,8 @@ int _ext4_get_encryption_info(struct inode *inode)
	BUG_ON(master_key->size != EXT4_AES_256_XTS_KEY_SIZE);
	BUG_ON(master_key->size != EXT4_AES_256_XTS_KEY_SIZE);
	res = ext4_derive_key_aes(ctx.nonce, master_key->raw,
	res = ext4_derive_key_aes(ctx.nonce, master_key->raw,
				  raw_key);
				  raw_key);
	if (res)
		goto out;
got_key:
got_key:
	ctfm = crypto_alloc_ablkcipher(cipher_str, 0, 0);
	ctfm = crypto_alloc_ablkcipher(cipher_str, 0, 0);
	if (!ctfm || IS_ERR(ctfm)) {
	if (!ctfm || IS_ERR(ctfm)) {
+15 −2
Original line number Original line Diff line number Diff line
@@ -12,6 +12,7 @@
#include <linux/string.h>
#include <linux/string.h>
#include <linux/types.h>
#include <linux/types.h>


#include "ext4_jbd2.h"
#include "ext4.h"
#include "ext4.h"
#include "xattr.h"
#include "xattr.h"


@@ -49,7 +50,8 @@ static int ext4_create_encryption_context_from_policy(
	struct inode *inode, const struct ext4_encryption_policy *policy)
	struct inode *inode, const struct ext4_encryption_policy *policy)
{
{
	struct ext4_encryption_context ctx;
	struct ext4_encryption_context ctx;
	int res = 0;
	handle_t *handle;
	int res, res2;


	res = ext4_convert_inline_data(inode);
	res = ext4_convert_inline_data(inode);
	if (res)
	if (res)
@@ -78,11 +80,22 @@ static int ext4_create_encryption_context_from_policy(
	BUILD_BUG_ON(sizeof(ctx.nonce) != EXT4_KEY_DERIVATION_NONCE_SIZE);
	BUILD_BUG_ON(sizeof(ctx.nonce) != EXT4_KEY_DERIVATION_NONCE_SIZE);
	get_random_bytes(ctx.nonce, EXT4_KEY_DERIVATION_NONCE_SIZE);
	get_random_bytes(ctx.nonce, EXT4_KEY_DERIVATION_NONCE_SIZE);


	handle = ext4_journal_start(inode, EXT4_HT_MISC,
				    ext4_jbd2_credits_xattr(inode));
	if (IS_ERR(handle))
		return PTR_ERR(handle);
	res = ext4_xattr_set(inode, EXT4_XATTR_INDEX_ENCRYPTION,
	res = ext4_xattr_set(inode, EXT4_XATTR_INDEX_ENCRYPTION,
			     EXT4_XATTR_NAME_ENCRYPTION_CONTEXT, &ctx,
			     EXT4_XATTR_NAME_ENCRYPTION_CONTEXT, &ctx,
			     sizeof(ctx), 0);
			     sizeof(ctx), 0);
	if (!res)
	if (!res) {
		ext4_set_inode_flag(inode, EXT4_INODE_ENCRYPT);
		ext4_set_inode_flag(inode, EXT4_INODE_ENCRYPT);
		res = ext4_mark_inode_dirty(handle, inode);
		if (res)
			EXT4_ERROR_INODE(inode, "Failed to mark inode dirty");
	}
	res2 = ext4_journal_stop(handle);
	if (!res)
		res = res2;
	return res;
	return res;
}
}


+1 −1
Original line number Original line Diff line number Diff line
@@ -187,7 +187,7 @@ typedef struct ext4_io_end {
} ext4_io_end_t;
} ext4_io_end_t;


struct ext4_io_submit {
struct ext4_io_submit {
	int			io_op;
	struct writeback_control *io_wbc;
	struct bio		*io_bio;
	struct bio		*io_bio;
	ext4_io_end_t		*io_end;
	ext4_io_end_t		*io_end;
	sector_t		io_next_block;
	sector_t		io_next_block;
+8 −0
Original line number Original line Diff line number Diff line
@@ -4728,6 +4728,14 @@ int ext4_setattr(struct dentry *dentry, struct iattr *attr)
				error = ext4_orphan_add(handle, inode);
				error = ext4_orphan_add(handle, inode);
				orphan = 1;
				orphan = 1;
			}
			}
			/*
			 * Update c/mtime on truncate up, ext4_truncate() will
			 * update c/mtime in shrink case below
			 */
			if (!shrink) {
				inode->i_mtime = ext4_current_time(inode);
				inode->i_ctime = inode->i_mtime;
			}
			down_write(&EXT4_I(inode)->i_data_sem);
			down_write(&EXT4_I(inode)->i_data_sem);
			EXT4_I(inode)->i_disksize = attr->ia_size;
			EXT4_I(inode)->i_disksize = attr->ia_size;
			rc = ext4_mark_inode_dirty(handle, inode);
			rc = ext4_mark_inode_dirty(handle, inode);
Loading