Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs

Pull vfs fixes from Al Viro.

The most notable fix here is probably the fix for a splice regression
("fix a fencepost error in pipe_advance()") noticed by Alan Wylie.

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
fix a fencepost error in pipe_advance()
coredump: Ensure proper size of sparse core files
aio: fix lock dep warning
tmpfs: clear S_ISGID when setting posix ACLs

+65 -36
+4 -2
fs/aio.c
··· 1085 1085 * Tell lockdep we inherited freeze protection from submission 1086 1086 * thread. 1087 1087 */ 1088 - __sb_writers_acquired(file_inode(file)->i_sb, SB_FREEZE_WRITE); 1088 + if (S_ISREG(file_inode(file)->i_mode)) 1089 + __sb_writers_acquired(file_inode(file)->i_sb, SB_FREEZE_WRITE); 1089 1090 file_end_write(file); 1090 1091 } 1091 1092 ··· 1526 1525 * by telling it the lock got released so that it doesn't 1527 1526 * complain about held lock when we return to userspace. 1528 1527 */ 1529 - __sb_writers_release(file_inode(file)->i_sb, SB_FREEZE_WRITE); 1528 + if (S_ISREG(file_inode(file)->i_mode)) 1529 + __sb_writers_release(file_inode(file)->i_sb, SB_FREEZE_WRITE); 1530 1530 } 1531 1531 kfree(iovec); 1532 1532 return ret;
+1
fs/binfmt_elf.c
··· 2298 2298 goto end_coredump; 2299 2299 } 2300 2300 } 2301 + dump_truncate(cprm); 2301 2302 2302 2303 if (!elf_core_write_extra_data(cprm)) 2303 2304 goto end_coredump;
+18
fs/coredump.c
··· 833 833 return mod ? dump_skip(cprm, align - mod) : 1; 834 834 } 835 835 EXPORT_SYMBOL(dump_align); 836 + 837 + /* 838 + * Ensures that file size is big enough to contain the current file 839 + * postion. This prevents gdb from complaining about a truncated file 840 + * if the last "write" to the file was dump_skip. 841 + */ 842 + void dump_truncate(struct coredump_params *cprm) 843 + { 844 + struct file *file = cprm->file; 845 + loff_t offset; 846 + 847 + if (file->f_op->llseek && file->f_op->llseek != no_llseek) { 848 + offset = file->f_op->llseek(file, 0, SEEK_CUR); 849 + if (i_size_read(file->f_mapping->host) < offset) 850 + do_truncate(file->f_path.dentry, offset, 0, file); 851 + } 852 + } 853 + EXPORT_SYMBOL(dump_truncate);
+4 -5
fs/posix_acl.c
··· 922 922 int error; 923 923 924 924 if (type == ACL_TYPE_ACCESS) { 925 - error = posix_acl_equiv_mode(acl, &inode->i_mode); 926 - if (error < 0) 927 - return 0; 928 - if (error == 0) 929 - acl = NULL; 925 + error = posix_acl_update_mode(inode, 926 + &inode->i_mode, &acl); 927 + if (error) 928 + return error; 930 929 } 931 930 932 931 inode->i_ctime = current_time(inode);
+1
include/linux/coredump.h
··· 14 14 extern int dump_skip(struct coredump_params *cprm, size_t nr); 15 15 extern int dump_emit(struct coredump_params *cprm, const void *addr, int nr); 16 16 extern int dump_align(struct coredump_params *cprm, int align); 17 + extern void dump_truncate(struct coredump_params *cprm); 17 18 #ifdef CONFIG_COREDUMP 18 19 extern void do_coredump(const siginfo_t *siginfo); 19 20 #else
+37 -29
lib/iov_iter.c
··· 730 730 } 731 731 EXPORT_SYMBOL(iov_iter_copy_from_user_atomic); 732 732 733 - static void pipe_advance(struct iov_iter *i, size_t size) 733 + static inline void pipe_truncate(struct iov_iter *i) 734 734 { 735 735 struct pipe_inode_info *pipe = i->pipe; 736 - struct pipe_buffer *buf; 737 - int idx = i->idx; 738 - size_t off = i->iov_offset, orig_sz; 739 - 740 - if (unlikely(i->count < size)) 741 - size = i->count; 742 - orig_sz = size; 743 - 744 - if (size) { 745 - if (off) /* make it relative to the beginning of buffer */ 746 - size += off - pipe->bufs[idx].offset; 747 - while (1) { 748 - buf = &pipe->bufs[idx]; 749 - if (size <= buf->len) 750 - break; 751 - size -= buf->len; 752 - idx = next_idx(idx, pipe); 753 - } 754 - buf->len = size; 755 - i->idx = idx; 756 - off = i->iov_offset = buf->offset + size; 757 - } 758 - if (off) 759 - idx = next_idx(idx, pipe); 760 736 if (pipe->nrbufs) { 761 - int unused = (pipe->curbuf + pipe->nrbufs) & (pipe->buffers - 1); 762 - /* [curbuf,unused) is in use. Free [idx,unused) */ 763 - while (idx != unused) { 737 + size_t off = i->iov_offset; 738 + int idx = i->idx; 739 + int nrbufs = (idx - pipe->curbuf) & (pipe->buffers - 1); 740 + if (off) { 741 + pipe->bufs[idx].len = off - pipe->bufs[idx].offset; 742 + idx = next_idx(idx, pipe); 743 + nrbufs++; 744 + } 745 + while (pipe->nrbufs > nrbufs) { 764 746 pipe_buf_release(pipe, &pipe->bufs[idx]); 765 747 idx = next_idx(idx, pipe); 766 748 pipe->nrbufs--; 767 749 } 768 750 } 769 - i->count -= orig_sz; 751 + } 752 + 753 + static void pipe_advance(struct iov_iter *i, size_t size) 754 + { 755 + struct pipe_inode_info *pipe = i->pipe; 756 + if (unlikely(i->count < size)) 757 + size = i->count; 758 + if (size) { 759 + struct pipe_buffer *buf; 760 + size_t off = i->iov_offset, left = size; 761 + int idx = i->idx; 762 + if (off) /* make it relative to the beginning of buffer */ 763 + left += off - pipe->bufs[idx].offset; 764 + while (1) { 765 + buf = &pipe->bufs[idx]; 766 + if (left <= buf->len) 767 + break; 768 + left -= buf->len; 769 + idx = next_idx(idx, pipe); 770 + } 771 + i->idx = idx; 772 + i->iov_offset = buf->offset + left; 773 + } 774 + i->count -= size; 775 + /* ... and discard everything past that point */ 776 + pipe_truncate(i); 770 777 } 771 778 772 779 void iov_iter_advance(struct iov_iter *i, size_t size) ··· 833 826 size_t count) 834 827 { 835 828 BUG_ON(direction != ITER_PIPE); 829 + WARN_ON(pipe->nrbufs == pipe->buffers); 836 830 i->type = direction; 837 831 i->pipe = pipe; 838 832 i->idx = (pipe->curbuf + pipe->nrbufs) & (pipe->buffers - 1);