27 Jul, 2008

40 commits

  • Add a new ia_valid flag: ATTR_TIMES_SET, to handle the
    UTIMES_OMIT/UTIMES_NOW and UTIMES_NOW/UTIMES_OMIT cases. In these
    cases neither ATTR_MTIME_SET nor ATTR_ATIME_SET is in the flags, yet
    the POSIX draft specifies that permission checking is performed the
    same way as if one or both of the times was explicitly set to a
    timestamp.

    See the path "vfs: utimensat(): fix error checking for
    {UTIME_NOW,UTIME_OMIT} case" by Michael Kerrisk for the patch
    introducing this behavior.

    This is a cleanup, as well as allowing filesystems (NFS/fuse/...) to
    perform their own permission checking instead of the default.

    CC: Ulrich Drepper
    CC: Michael Kerrisk
    Signed-off-by: Miklos Szeredi
    Signed-off-by: Al Viro

    Miklos Szeredi
     
  • - use kstrdup() instead of kmalloc() + memcpy()
    - return NULL if allocating ->mnt_devname failed
    - mnt_devname should be const

    Signed-off-by: Li Zefan
    Acked-by: Cyrill Gorcunov
    Signed-off-by: Al Viro

    Li Zefan
     
  • Signed-off-by: Al Viro

    Al Viro
     
  • ... and get rid of the last "let's deduce mask from nameidata->flags"
    bit.

    Signed-off-by: Al Viro

    Al Viro
     
  • * MAY_CHDIR is redundant - it's an equivalent of MAY_ACCESS
    * MAY_ACCESS on fuse should affect only the last step of pathname resolution
    * fchdir() and chroot() should pass MAY_ACCESS, for the same reason why
    chdir() needs that.
    * now that we pass MAY_ACCESS explicitly in all cases, LOOKUP_ACCESS can be
    removed; it has no business being in nameidata.

    Signed-off-by: Al Viro

    Al Viro
     
  • long overdue...

    Signed-off-by: Al Viro

    Al Viro
     
  • ... so we ought to pass MAY_CHDIR to vfs_permission() instead of having
    it triggered on every step of preceding pathname resolution. LOOKUP_CHDIR
    is killed by that.

    Signed-off-by: Al Viro

    Al Viro
     
  • Remove the unused mode parameter from vfs_symlink and callers.

    Thanks to Tetsuo Handa for noticing.

    CC: Tetsuo Handa
    Signed-off-by: Miklos Szeredi

    Miklos Szeredi
     
  • Why not reuse "inode" which is assigned as

    struct inode *inode = old_dentry->d_inode;

    in the beginning of vfs_link() ?

    Signed-off-by: Tetsuo Handa
    Signed-off-by: Miklos Szeredi

    Tetsuo Handa
     
  • All calls to remove_suid() are made with a file pointer, because
    (similarly to file_update_time) it is called when the file is written.

    Clean up callers by passing in a file instead of a dentry.

    Signed-off-by: Miklos Szeredi

    Miklos Szeredi
     
  • vfs_permission(MAY_WRITE) already checked for the inode being
    immutable, so no need to repeat it.

    Signed-off-by: Miklos Szeredi
    Acked-by: Christoph Hellwig

    Miklos Szeredi
     
  • * kill nameidata * argument; map the 3 bits in ->flags anybody cares
    about to new MAY_... ones and pass with the mask.
    * kill redundant gfs2_iop_permission()
    * sanitize ecryptfs_permission()
    * fix remaining places where ->permission() instances might barf on new
    MAY_... found in mask.

    The obvious next target in that direction is permission(9)

    folded fix for nfs_permission() breakage from Miklos Szeredi

    Signed-off-by: Al Viro

    Al Viro
     
  • hpfs_unlink() calls permission() prior to truncating the file. HPFS
    doesn't define a .permission method, so replace with explicit call to
    generic_permission().

    This is equivalent, except that devcgroup_inode_permission() and
    security_inode_permission() are not called.

    The truncation is just an implementation detail of the unlink, so
    these security checks are unnecessary.

    I suspect that even calling generic_permission() is unnecessary, since
    we shouldn't mind if the file isn't writable. But I leave that to the
    maintainer to decide.

    Signed-off-by: Miklos Szeredi
    CC: Mikulas Patocka

    Miklos Szeredi
     
  • * keep references to ctl_table_head and ctl_table in /proc/sys inodes
    * grab the former during operations, use the latter for access to
    entry if that succeeds
    * have ->d_compare() check if table should be seen for one who does lookup;
    that allows us to avoid flipping inodes - if we have the same name resolve
    to different things, we'll just keep several dentries and ->d_compare()
    will reject the wrong ones.
    * have ->lookup() and ->readdir() scan the table of our inode first, then
    walk all ctl_table_header and scan ->attached_by for those that are
    attached to our directory.
    * implement ->getattr().
    * get rid of insane amounts of tree-walking
    * get rid of the need to know dentry in ->permission() and of the contortions
    induced by that.

    Signed-off-by: Al Viro

    Al Viro
     
  • In a sense, that's the heart of the series. It's based on the following
    property of the trees we are actually asked to add: they can be split into
    stem that is already covered by registered trees and crown that is entirely
    new. IOW, if a/b and a/c/d are introduced by our tree, then a/c is also
    introduced by it.

    That allows to associate tree and table entry with each node in the union;
    while directory nodes might be covered by many trees, only one will cover
    the node by its crown. And that will allow much saner logics for /proc/sys
    in the next patches. This patch introduces the data structures needed to
    keep track of that.

    When adding a sysctl table, we find a "parent" one. Which is to say,
    find the deepest node on its stem that already is present in one of the
    tables from our table set or its ancestor sets. That table will be our
    parent and that node in it - attachment point. Add our table to list
    anchored in parent, have it refer the parent and contents of attachment
    point. Also remember where its crown lives.

    Signed-off-by: Al Viro

    Al Viro
     
  • Massage ipv4 initialization - make sure that net.ipv4 appears as
    non-per-net-namespace before it shows up in per-net-namespace sysctls.
    That's the only change outside of sysctl.c needed to get sane ordering
    rules and data structures for sysctls (esp. for procfs side of that
    mess).

    Signed-off-by: Al Viro

    Al Viro
     
  • Refcount the sucker; instead of freeing it by the end of unregistration
    just drop the refcount and free only when it hits zero. Make sure that
    we _always_ make ->unregistering non-NULL in start_unregistering().

    That allows anybody to get a reference to such puppy, preventing its
    freeing and reuse. It does *not* block unregistration. Anybody who
    holds such a reference can
    * try to grab a "use" reference (ctl_head_grab()); that will
    succeeds if and only if it hadn't entered unregistration yet. If it
    succeeds, we can use it in all normal ways until we release the "use"
    reference (with ctl_head_finish()). Note that this relies on having
    ->unregistering become non-NULL in all cases when one starts to unregister
    the sucker.
    * keep pointers to ctl_table entries; they *can* be freed if
    the entire thing is unregistered. However, if ctl_head_grab() succeeds,
    we know that unregistration had not happened (and will not happen until
    ctl_head_finish()) and such pointers can be used safely.

    IOW, now we can have inodes under /proc/sys keep references to ctl_table
    entries, protecting them with references to ctl_table_header and
    grabbing the latter for the duration of operations that require access
    to ctl_table. That won't cause deadlocks, since unregistration will not
    be stopped by mere keeping a reference to ctl_table_header.

    Signed-off-by: Al Viro

    Al Viro
     
  • New object: set of sysctls [currently - root and per-net-ns].
    Contains: pointer to parent set, list of tables and "should I see this set?"
    method (->is_seen(set)).
    Current lists of tables are subsumed by that; net-ns contains such a beast.
    ->lookup() for ctl_table_root returns pointer to ctl_table_set instead of
    that to ->list of that ctl_table_set.

    [folded compile fixes by rdd for configs without sysctl]

    Signed-off-by: Al Viro

    Al Viro
     
  • hppfs_permission() is equivalent to the '.permission == NULL' case.

    Signed-off-by: Miklos Szeredi
    Signed-off-by: Al Viro

    Miklos Szeredi
     
  • Merge fifo and pipe file_operations.

    Signed-off-by: Denys Vlasenko
    Signed-off-by: Al Viro

    Denys Vlasenko
     
  • Lookup can install a child dentry for a deleted directory. This keeps
    the directory dentry alive, and the inode pinned in the cache and on
    disk, even after all external references have gone away.

    This isn't a big problem normally, since memory pressure or umount
    will clear out the directory dentry and its children, releasing the
    inode. But for UBIFS this causes problems because its orphan area can
    overflow.

    Fix this by returning ENOENT for all lookups on a S_DEAD directory
    before creating a child dentry.

    Thanks to Zoltan Sogor for noticing this while testing UBIFS, and
    Artem for the excellent analysis of the problem and testing.

    Reported-by: Artem Bityutskiy
    Tested-by: Artem Bityutskiy
    Signed-off-by: Miklos Szeredi
    Signed-off-by: Al Viro

    Miklos Szeredi
     
  • …nel/git/tip/linux-2.6-tip

    * 'tracing-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
    ftrace: fix modular build
    ftrace: disable tracing on acpi idle calls
    ftrace: remove latency-tracer leftover
    ftrace: only trace preempt off with preempt tracer
    ftrace: fix 4d3702b6 (post-v2.6.26): WARNING: at kernel/lockdep.c:2731 check_flags (ftrace)

    Linus Torvalds
     
  • …git/tip/linux-2.6-tip

    * 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
    x86, AMD IOMMU: include amd_iommu_last_bdf in device initialization
    x86: fix IBM Summit based systems' phys_cpu_present_map on 32-bit kernels
    x86, RDC321x: remove gpio.h complications
    x86, RDC321x: add to mach-default
    crashdump: fix undefined reference to `elfcorehdr_addr'
    flag parameters: fix compile error of sys_epoll_create1

    Linus Torvalds
     
  • * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/cooloney/blackfin-2.6: (30 commits)
    Blackfin arch: If we double fault, rather than hang forever, reset
    Blackfin arch: When icache is off, make sure people know it
    Blackfin arch: Fix bug - skip single step in high priority interrupt handler instead of disabling all interrupts in single step debugging.
    Blackfin arch: cache the values of vco/sclk/cclk as the overhead of doing so (~24 bytes) is worth avoiding the software mult/div routines
    Blackfin arch: fix bug - IMDMA is not type struct dma_register
    Blackfin arch: check the EXTBANKS field of the DDRCTL1 register to see if we are using both memory banks
    Blackfin arch: Apply Bluetechnix CM-BF527 board support patch
    Blackfin arch: Add unwinding for stack info, and a little more detail on trace buffer
    Blackfin arch: Add ISP1760 board resources to BF548-EZKIT
    Blackfin arch: fix bug - detect 0.1 silicon revision BF527-EZKIT as 0.0 version
    Blackfin arch: add missing IORESOURCE_MEM flags to UART3
    Blackfin arch: Add return value check in bfin_sir_probe(), remove SSYNC().
    Blackfin arch: Extend sram malloc to handle L2 SRAM.
    Blackfin arch: Remove useless config option.
    Blackfin arch: change L1 malloc to base on slab cache and lists.
    Blackfin arch: use local labels and ENDPROC() markings
    Blackfin arch: Do not need this dualcore test module in kernel.
    Blackfin arch: Allow ptrace to peek and poke application data in L1 data SRAM.
    Blackfin arch: Add ANOMALY_05000368 workaround
    Blackfin arch: Functional power management support
    ...

    Linus Torvalds
     
  • commit 236b8756a2b6f90498d45b2c36d43e5372f2d4b8 ("dsp56k: BKL pushdown")
    removed the `struct inode *inode' parameter from dsp56k_ioctl(), but
    forgot to update the use of `inode' in the first line of the function.

    Signed-off-by: Geert Uytterhoeven
    Signed-off-by: Linus Torvalds

    Geert Uytterhoeven
     
  • Removed duplicated include
    in drivers/video/fbmem.c

    Signed-off-by: Huang Weiyi
    Signed-off-by: Linus Torvalds

    Huang Weiyi
     
  • * 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6:
    When verifying the decoded header before decoding the object identifier
    [CIFS] Fix warnings from checkpatch
    [CIFS] Fix improper endian conversion of ACL subauth field
    [CIFS] Fix possible double free if search immediately after search rewind fails
    [CIFS] remove checkpatch warning
    Signed-off-by: Alexey Dobriyan
    cifs: assorted endian annotations
    [CIFS] break ATTR_SIZE changes out into their own function
    lockdep: annotate cifs in-kernel sockets
    [CIFS] Fix compiler warning on 64-bit

    Linus Torvalds
     
  • This patch makes the following needlessly global functions static:
    - stifb_init_fb()
    - stifb_init()

    Signed-off-by: Adrian Bunk
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Adrian Bunk
     
  • This patch makes the following needlessly global code static:
    - sticon.c: sticonsole_init()
    - sticore.c: struct default_sti
    - sticore.c: sti_init_graph()
    - sticore.c: sti_inq_conf()
    - sticore.c: sti_rom_copy()
    - sticore.c: sti_select_fbfont()
    - sticore.c: sti_select_font()
    - sticore.c: sti_get_wmode_rom()
    - sticore.c: sti_read_rom()

    [akpm@linux-foundation.org: coding-style fixes]
    Signed-off-by: Adrian Bunk
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Adrian Bunk
     
  • This patch makes the needlessly global macfb_setup() static.

    Signed-off-by: Adrian Bunk
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Adrian Bunk
     
  • This patch makes the needlessly global root_device_name static.

    Signed-off-by: Adrian Bunk
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Adrian Bunk
     
  • The following functions can now become static:
    - rtc_interrupt()
    - rtc_get_rtc_time()

    Signed-off-by: Adrian Bunk
    Acked-by: Bernhard Walle
    Acked-by: Paul Gortmaker
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Adrian Bunk
     
  • This patch makes the following needlessly global code static:
    - swap_lock
    - nr_swapfiles
    - struct swap_list

    Signed-off-by: Adrian Bunk
    Reviewed-by: KOSAKI Motohiro
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Adrian Bunk
     
  • This patch makes the needlessly global print_bad_pte() static.

    Signed-off-by: Adrian Bunk
    Reviewed-by: KOSAKI Motohiro
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Adrian Bunk
     
  • This patch makes the following needlessly global functions static:
    - percpu_depopulate()
    - __percpu_depopulate_mask()
    - percpu_populate()
    - __percpu_populate_mask()

    Signed-off-by: Adrian Bunk
    Acked-by: Christoph Lameter
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Adrian Bunk
     
  • This patch makes the needlessly global sparse_early_mem_map_alloc()
    static.

    Signed-off-by: Adrian Bunk
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Adrian Bunk
     
  • This patch makes the needlessly global parport_cs_release() static.

    Signed-off-by: Adrian Bunk
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Adrian Bunk
     
  • pnp_add_card_id() can now become static.

    Signed-off-by: Adrian Bunk
    Cc: Bjorn Helgaas
    Cc: Rene Herman
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Adrian Bunk
     
  • cgroup_seqfile_release() can become static.

    Signed-off-by: Adrian Bunk
    Acked-by: Paul Menage
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Adrian Bunk
     
  • Make the needlessly global drm_minors_cleanup() static.

    Signed-off-by: Adrian Bunk
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Adrian Bunk