Skip to content

Commit 77c688a

Browse files
committed
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull vfs updates from Al Viro: "The big thing in this pile is Eric's unmount-on-rmdir series; we finally have everything we need for that. The final piece of prereqs is delayed mntput() - now filesystem shutdown always happens on shallow stack. Other than that, we have several new primitives for iov_iter (Matt Wilcox, culled from his XIP-related series) pushing the conversion to ->read_iter()/ ->write_iter() a bit more, a bunch of fs/dcache.c cleanups and fixes (including the external name refcounting, which gives consistent behaviour of d_move() wrt procfs symlinks for long and short names alike) and assorted cleanups and fixes all over the place. This is just the first pile; there's a lot of stuff from various people that ought to go in this window. Starting with unionmount/overlayfs mess... ;-/" * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (60 commits) fs/file_table.c: Update alloc_file() comment vfs: Deduplicate code shared by xattr system calls operating on paths reiserfs: remove pointless forward declaration of struct nameidata don't need that forward declaration of struct nameidata in dcache.h anymore take dname_external() into fs/dcache.c let path_init() failures treated the same way as subsequent link_path_walk() fix misuses of f_count() in ppp and netlink ncpfs: use list_for_each_entry() for d_subdirs walk vfs: move getname() from callers to do_mount() gfs2_atomic_open(): skip lookups on hashed dentry [infiniband] remove pointless assignments gadgetfs: saner API for gadgetfs_create_file() f_fs: saner API for ffs_sb_create_file() jfs: don't hash direct inode [s390] remove pointless assignment of ->f_op in vmlogrdr ->open() ecryptfs: ->f_op is never NULL android: ->f_op is never NULL nouveau: __iomem misannotations missing annotation in fs/file.c fs: namespace: suppress 'may be used uninitialized' warnings ...
2 parents 5e40d33 + a457606 commit 77c688a

74 files changed

Lines changed: 889 additions & 960 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎Documentation/filesystems/vfs.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ noted. This means that most methods can block safely. All methods are
237237
only called from a process context (i.e. not from an interrupt handler
238238
or bottom half).
239239

240-
alloc_inode: this method is called by inode_alloc() to allocate memory
240+
alloc_inode: this method is called by alloc_inode() to allocate memory
241241
for struct inode and initialize it. If this function is not
242242
defined, a simple 'struct inode' is allocated. Normally
243243
alloc_inode will be used to allocate a larger structure which

‎arch/alpha/kernel/osf_sys.c‎

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,8 @@ struct procfs_args {
446446
* unhappy with OSF UFS. [CHECKME]
447447
*/
448448
static int
449-
osf_ufs_mount(const char *dirname, struct ufs_args __user *args, int flags)
449+
osf_ufs_mount(const char __user *dirname,
450+
struct ufs_args __user *args, int flags)
450451
{
451452
int retval;
452453
struct cdfs_args tmp;
@@ -466,7 +467,8 @@ osf_ufs_mount(const char *dirname, struct ufs_args __user *args, int flags)
466467
}
467468

468469
static int
469-
osf_cdfs_mount(const char *dirname, struct cdfs_args __user *args, int flags)
470+
osf_cdfs_mount(const char __user *dirname,
471+
struct cdfs_args __user *args, int flags)
470472
{
471473
int retval;
472474
struct cdfs_args tmp;
@@ -486,7 +488,8 @@ osf_cdfs_mount(const char *dirname, struct cdfs_args __user *args, int flags)
486488
}
487489

488490
static int
489-
osf_procfs_mount(const char *dirname, struct procfs_args __user *args, int flags)
491+
osf_procfs_mount(const char __user *dirname,
492+
struct procfs_args __user *args, int flags)
490493
{
491494
struct procfs_args tmp;
492495

@@ -500,28 +503,22 @@ SYSCALL_DEFINE4(osf_mount, unsigned long, typenr, const char __user *, path,
500503
int, flag, void __user *, data)
501504
{
502505
int retval;
503-
struct filename *name;
504506

505-
name = getname(path);
506-
retval = PTR_ERR(name);
507-
if (IS_ERR(name))
508-
goto out;
509507
switch (typenr) {
510508
case 1:
511-
retval = osf_ufs_mount(name->name, data, flag);
509+
retval = osf_ufs_mount(path, data, flag);
512510
break;
513511
case 6:
514-
retval = osf_cdfs_mount(name->name, data, flag);
512+
retval = osf_cdfs_mount(path, data, flag);
515513
break;
516514
case 9:
517-
retval = osf_procfs_mount(name->name, data, flag);
515+
retval = osf_procfs_mount(path, data, flag);
518516
break;
519517
default:
520518
retval = -EINVAL;
521519
printk("osf_mount(%ld, %x)\n", typenr, flag);
522520
}
523-
putname(name);
524-
out:
521+
525522
return retval;
526523
}
527524

‎arch/x86/ia32/ia32_aout.c‎

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -308,11 +308,8 @@ static int load_aout_binary(struct linux_binprm *bprm)
308308
(current->mm->start_brk = N_BSSADDR(ex));
309309

310310
retval = setup_arg_pages(bprm, IA32_STACK_TOP, EXSTACK_DEFAULT);
311-
if (retval < 0) {
312-
/* Someone check-me: is this error path enough? */
313-
send_sig(SIGKILL, current, 0);
311+
if (retval < 0)
314312
return retval;
315-
}
316313

317314
install_exec_creds(bprm);
318315

@@ -324,17 +321,13 @@ static int load_aout_binary(struct linux_binprm *bprm)
324321

325322
error = vm_brk(text_addr & PAGE_MASK, map_size);
326323

327-
if (error != (text_addr & PAGE_MASK)) {
328-
send_sig(SIGKILL, current, 0);
324+
if (error != (text_addr & PAGE_MASK))
329325
return error;
330-
}
331326

332327
error = read_code(bprm->file, text_addr, 32,
333328
ex.a_text + ex.a_data);
334-
if ((signed long)error < 0) {
335-
send_sig(SIGKILL, current, 0);
329+
if ((signed long)error < 0)
336330
return error;
337-
}
338331
} else {
339332
#ifdef WARN_OLD
340333
static unsigned long error_time, error_time2;
@@ -368,20 +361,16 @@ static int load_aout_binary(struct linux_binprm *bprm)
368361
MAP_EXECUTABLE | MAP_32BIT,
369362
fd_offset);
370363

371-
if (error != N_TXTADDR(ex)) {
372-
send_sig(SIGKILL, current, 0);
364+
if (error != N_TXTADDR(ex))
373365
return error;
374-
}
375366

376367
error = vm_mmap(bprm->file, N_DATADDR(ex), ex.a_data,
377368
PROT_READ | PROT_WRITE | PROT_EXEC,
378369
MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE |
379370
MAP_EXECUTABLE | MAP_32BIT,
380371
fd_offset + ex.a_text);
381-
if (error != N_DATADDR(ex)) {
382-
send_sig(SIGKILL, current, 0);
372+
if (error != N_DATADDR(ex))
383373
return error;
384-
}
385374
}
386375
beyond_if:
387376
set_binfmt(&aout_format);

‎drivers/block/rsxx/core.c‎

Lines changed: 16 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,6 @@ static DEFINE_SPINLOCK(rsxx_ida_lock);
6262

6363
/* --------------------Debugfs Setup ------------------- */
6464

65-
struct rsxx_cram {
66-
u32 f_pos;
67-
u32 offset;
68-
void *i_private;
69-
};
70-
7165
static int rsxx_attr_pci_regs_show(struct seq_file *m, void *p)
7266
{
7367
struct rsxx_cardinfo *card = m->private;
@@ -184,93 +178,50 @@ static int rsxx_attr_pci_regs_open(struct inode *inode, struct file *file)
184178
static ssize_t rsxx_cram_read(struct file *fp, char __user *ubuf,
185179
size_t cnt, loff_t *ppos)
186180
{
187-
struct rsxx_cram *info = fp->private_data;
188-
struct rsxx_cardinfo *card = info->i_private;
181+
struct rsxx_cardinfo *card = file_inode(fp)->i_private;
189182
char *buf;
190-
int st;
183+
ssize_t st;
191184

192-
buf = kzalloc(sizeof(*buf) * cnt, GFP_KERNEL);
185+
buf = kzalloc(cnt, GFP_KERNEL);
193186
if (!buf)
194187
return -ENOMEM;
195188

196-
info->f_pos = (u32)*ppos + info->offset;
197-
198-
st = rsxx_creg_read(card, CREG_ADD_CRAM + info->f_pos, cnt, buf, 1);
199-
if (st)
200-
return st;
201-
202-
st = copy_to_user(ubuf, buf, cnt);
189+
st = rsxx_creg_read(card, CREG_ADD_CRAM + (u32)*ppos, cnt, buf, 1);
190+
if (!st)
191+
st = copy_to_user(ubuf, buf, cnt);
192+
kfree(buf);
203193
if (st)
204194
return st;
205-
206-
info->offset += cnt;
207-
208-
kfree(buf);
209-
195+
*ppos += cnt;
210196
return cnt;
211197
}
212198

213199
static ssize_t rsxx_cram_write(struct file *fp, const char __user *ubuf,
214200
size_t cnt, loff_t *ppos)
215201
{
216-
struct rsxx_cram *info = fp->private_data;
217-
struct rsxx_cardinfo *card = info->i_private;
202+
struct rsxx_cardinfo *card = file_inode(fp)->i_private;
218203
char *buf;
219-
int st;
204+
ssize_t st;
220205

221-
buf = kzalloc(sizeof(*buf) * cnt, GFP_KERNEL);
206+
buf = kzalloc(cnt, GFP_KERNEL);
222207
if (!buf)
223208
return -ENOMEM;
224209

225210
st = copy_from_user(buf, ubuf, cnt);
211+
if (!st)
212+
st = rsxx_creg_write(card, CREG_ADD_CRAM + (u32)*ppos, cnt,
213+
buf, 1);
214+
kfree(buf);
226215
if (st)
227216
return st;
228-
229-
info->f_pos = (u32)*ppos + info->offset;
230-
231-
st = rsxx_creg_write(card, CREG_ADD_CRAM + info->f_pos, cnt, buf, 1);
232-
if (st)
233-
return st;
234-
235-
info->offset += cnt;
236-
237-
kfree(buf);
238-
217+
*ppos += cnt;
239218
return cnt;
240219
}
241220

242-
static int rsxx_cram_open(struct inode *inode, struct file *file)
243-
{
244-
struct rsxx_cram *info = kzalloc(sizeof(*info), GFP_KERNEL);
245-
if (!info)
246-
return -ENOMEM;
247-
248-
info->i_private = inode->i_private;
249-
info->f_pos = file->f_pos;
250-
file->private_data = info;
251-
252-
return 0;
253-
}
254-
255-
static int rsxx_cram_release(struct inode *inode, struct file *file)
256-
{
257-
struct rsxx_cram *info = file->private_data;
258-
259-
if (!info)
260-
return 0;
261-
262-
kfree(info);
263-
file->private_data = NULL;
264-
265-
return 0;
266-
}
267-
268221
static const struct file_operations debugfs_cram_fops = {
269222
.owner = THIS_MODULE,
270-
.open = rsxx_cram_open,
271223
.read = rsxx_cram_read,
272224
.write = rsxx_cram_write,
273-
.release = rsxx_cram_release,
274225
};
275226

276227
static const struct file_operations debugfs_stats_fops = {

‎drivers/bluetooth/hci_vhci.c‎

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -160,13 +160,11 @@ static int vhci_create_device(struct vhci_data *data, __u8 opcode)
160160
}
161161

162162
static inline ssize_t vhci_get_user(struct vhci_data *data,
163-
const struct iovec *iov,
164-
unsigned long count)
163+
struct iov_iter *from)
165164
{
166-
size_t len = iov_length(iov, count);
165+
size_t len = iov_iter_count(from);
167166
struct sk_buff *skb;
168167
__u8 pkt_type, opcode;
169-
unsigned long i;
170168
int ret;
171169

172170
if (len < 2 || len > HCI_MAX_FRAME_SIZE)
@@ -176,12 +174,9 @@ static inline ssize_t vhci_get_user(struct vhci_data *data,
176174
if (!skb)
177175
return -ENOMEM;
178176

179-
for (i = 0; i < count; i++) {
180-
if (copy_from_user(skb_put(skb, iov[i].iov_len),
181-
iov[i].iov_base, iov[i].iov_len)) {
182-
kfree_skb(skb);
183-
return -EFAULT;
184-
}
177+
if (copy_from_iter(skb_put(skb, len), len, from) != len) {
178+
kfree_skb(skb);
179+
return -EFAULT;
185180
}
186181

187182
pkt_type = *((__u8 *) skb->data);
@@ -294,13 +289,12 @@ static ssize_t vhci_read(struct file *file,
294289
return ret;
295290
}
296291

297-
static ssize_t vhci_write(struct kiocb *iocb, const struct iovec *iov,
298-
unsigned long count, loff_t pos)
292+
static ssize_t vhci_write(struct kiocb *iocb, struct iov_iter *from)
299293
{
300294
struct file *file = iocb->ki_filp;
301295
struct vhci_data *data = file->private_data;
302296

303-
return vhci_get_user(data, iov, count);
297+
return vhci_get_user(data, from);
304298
}
305299

306300
static unsigned int vhci_poll(struct file *file, poll_table *wait)
@@ -365,7 +359,7 @@ static int vhci_release(struct inode *inode, struct file *file)
365359
static const struct file_operations vhci_fops = {
366360
.owner = THIS_MODULE,
367361
.read = vhci_read,
368-
.aio_write = vhci_write,
362+
.write_iter = vhci_write,
369363
.poll = vhci_poll,
370364
.open = vhci_open,
371365
.release = vhci_release,

0 commit comments

Comments
 (0)