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

Commit 7e05b807 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull VFS fixes from Al Viro:
 "A bunch of assorted fixes, most of them followups to overlayfs merge"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
  ovl: initialize ->is_cursor
  Return short read or 0 at end of a raw device, not EIO
  isofs: don't bother with ->d_op for normal case
  isofs_cmp(): we'll never see a dentry for . or ..
  overlayfs: fix lockdep misannotation
  ovl: fix check for cursor
  overlayfs: barriers for opening upper-layer directory
  rcu: Provide counterpart to rcu_dereference() for non-RCU situations
  staging: android: logger: Fix log corruption regression
parents 4cb8c359 9f2f7d4c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -285,7 +285,7 @@ static long raw_ctl_compat_ioctl(struct file *file, unsigned int cmd,

static const struct file_operations raw_fops = {
	.read		= new_sync_read,
	.read_iter	= generic_file_read_iter,
	.read_iter	= blkdev_read_iter,
	.write		= new_sync_write,
	.write_iter	= blkdev_write_iter,
	.fsync		= blkdev_fsync,
+8 −5
Original line number Diff line number Diff line
@@ -420,7 +420,7 @@ static ssize_t logger_write_iter(struct kiocb *iocb, struct iov_iter *from)
	struct logger_log *log = file_get_log(iocb->ki_filp);
	struct logger_entry header;
	struct timespec now;
	size_t len, count;
	size_t len, count, w_off;

	count = min_t(size_t, iocb->ki_nbytes, LOGGER_ENTRY_MAX_PAYLOAD);

@@ -452,11 +452,14 @@ static ssize_t logger_write_iter(struct kiocb *iocb, struct iov_iter *from)
	memcpy(log->buffer + log->w_off, &header, len);
	memcpy(log->buffer, (char *)&header + len, sizeof(header) - len);

	len = min(count, log->size - log->w_off);
	/* Work with a copy until we are ready to commit the whole entry */
	w_off =  logger_offset(log, log->w_off + sizeof(struct logger_entry));

	if (copy_from_iter(log->buffer + log->w_off, len, from) != len) {
	len = min(count, log->size - w_off);

	if (copy_from_iter(log->buffer + w_off, len, from) != len) {
		/*
		 * Note that by not updating w_off, this abandons the
		 * Note that by not updating log->w_off, this abandons the
		 * portion of the new entry that *was* successfully
		 * copied, just above.  This is intentional to avoid
		 * message corruption from missing fragments.
@@ -470,7 +473,7 @@ static ssize_t logger_write_iter(struct kiocb *iocb, struct iov_iter *from)
		return -EFAULT;
	}

	log->w_off = logger_offset(log, log->w_off + count);
	log->w_off = logger_offset(log, w_off + count);
	mutex_unlock(&log->mutex);

	/* wake up any blocked readers */
+2 −1
Original line number Diff line number Diff line
@@ -1585,7 +1585,7 @@ ssize_t blkdev_write_iter(struct kiocb *iocb, struct iov_iter *from)
}
EXPORT_SYMBOL_GPL(blkdev_write_iter);

static ssize_t blkdev_read_iter(struct kiocb *iocb, struct iov_iter *to)
ssize_t blkdev_read_iter(struct kiocb *iocb, struct iov_iter *to)
{
	struct file *file = iocb->ki_filp;
	struct inode *bd_inode = file->f_mapping->host;
@@ -1599,6 +1599,7 @@ static ssize_t blkdev_read_iter(struct kiocb *iocb, struct iov_iter *to)
	iov_iter_truncate(to, size);
	return generic_file_read_iter(iocb, to);
}
EXPORT_SYMBOL_GPL(blkdev_read_iter);

/*
 * Try to release a page associated with block device when the system
+2 −22
Original line number Diff line number Diff line
@@ -29,13 +29,9 @@
#define BEQUIET

static int isofs_hashi(const struct dentry *parent, struct qstr *qstr);
static int isofs_hash(const struct dentry *parent, struct qstr *qstr);
static int isofs_dentry_cmpi(const struct dentry *parent,
		const struct dentry *dentry,
		unsigned int len, const char *str, const struct qstr *name);
static int isofs_dentry_cmp(const struct dentry *parent,
		const struct dentry *dentry,
		unsigned int len, const char *str, const struct qstr *name);

#ifdef CONFIG_JOLIET
static int isofs_hashi_ms(const struct dentry *parent, struct qstr *qstr);
@@ -134,10 +130,6 @@ static const struct super_operations isofs_sops = {


static const struct dentry_operations isofs_dentry_ops[] = {
	{
		.d_hash		= isofs_hash,
		.d_compare	= isofs_dentry_cmp,
	},
	{
		.d_hash		= isofs_hashi,
		.d_compare	= isofs_dentry_cmpi,
@@ -257,25 +249,12 @@ static int isofs_dentry_cmp_common(
	return 1;
}

static int
isofs_hash(const struct dentry *dentry, struct qstr *qstr)
{
	return isofs_hash_common(qstr, 0);
}

static int
isofs_hashi(const struct dentry *dentry, struct qstr *qstr)
{
	return isofs_hashi_common(qstr, 0);
}

static int
isofs_dentry_cmp(const struct dentry *parent, const struct dentry *dentry,
		unsigned int len, const char *str, const struct qstr *name)
{
	return isofs_dentry_cmp_common(len, str, name, 0, 0);
}

static int
isofs_dentry_cmpi(const struct dentry *parent, const struct dentry *dentry,
		unsigned int len, const char *str, const struct qstr *name)
@@ -930,7 +909,8 @@ static int isofs_fill_super(struct super_block *s, void *data, int silent)
	if (opt.check == 'r')
		table++;

	s->s_d_op = &isofs_dentry_ops[table];
	if (table)
		s->s_d_op = &isofs_dentry_ops[table - 1];

	/* get the root dentry */
	s->s_root = d_make_root(inode);
+4 −18
Original line number Diff line number Diff line
@@ -18,25 +18,10 @@ static int
isofs_cmp(struct dentry *dentry, const char *compare, int dlen)
{
	struct qstr qstr;

	if (!compare)
		return 1;

	/* check special "." and ".." files */
	if (dlen == 1) {
		/* "." */
		if (compare[0] == 0) {
			if (!dentry->d_name.len)
				return 0;
			compare = ".";
		} else if (compare[0] == 1) {
			compare = "..";
			dlen = 2;
		}
	}

	qstr.name = compare;
	qstr.len = dlen;
	if (likely(!dentry->d_op))
		return dentry->d_name.len != dlen || memcmp(dentry->d_name.name, compare, dlen);
	return dentry->d_op->d_compare(NULL, NULL, dentry->d_name.len, dentry->d_name.name, &qstr);
}

@@ -146,6 +131,7 @@ isofs_find_entry(struct inode *dir, struct dentry *dentry,
				(!(de->flags[-sbi->s_high_sierra] & 1))) &&
			(sbi->s_showassoc ||
				(!(de->flags[-sbi->s_high_sierra] & 4)))) {
			if (dpnt && (dlen > 1 || dpnt[0] > 1))
				match = (isofs_cmp(dentry, dpnt, dlen) == 0);
		}
		if (match) {
Loading