Resubmittal [PATCH 1/2] Disallow appends to sysfs files

From: Mitch Williams (mitch.a.williams_at_intel.com)
Date: 01/26/05

  • Next message: Ju, Seokmann: "[Announce] megaraid_mbox 2.20.4.3 patch"
    Date:	Tue, 25 Jan 2005 15:18:45 -0800
    To: linux-kernel@vger.kernel.org
    
    

    This patch returns an error code if the caller attempts to open a sysfs
    file for appending.

    Generated from 2.6.11-rc2.

    Signed-off-by: Mitch Williams <mitch.a.williams@intel.com>

    diff -urpN -X dontdiff linux-2.6.11-clean/fs/sysfs/file.c linux-2.6.11/fs/sysfs/file.c
    --- linux-2.6.11-clean/fs/sysfs/file.c 2004-12-24 13:33:50.000000000 -0800
    +++ linux-2.6.11/fs/sysfs/file.c 2005-01-25 14:59:33.000000000 -0800
    @@ -275,6 +275,15 @@ static int check_perm(struct inode * ino
             if (!ops)
                     goto Eaccess;

    + /* Return error if the file is open for append.
    + * Sysfs can't support append because the kobject
    + * store methods don't take an offset into the buffer
    + * as an argument. They end up thinking the appended
    + * data is the entire contents of the file.
    + */
    + if (file->f_flags & O_APPEND)
    + goto Einval;
    +
             /* File needs write support.
              * The inode's perms must say it's ok,
              * and we must have a store method.
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/


  • Next message: Ju, Seokmann: "[Announce] megaraid_mbox 2.20.4.3 patch"

    Relevant Pages

    • identd giving failures
      ... checking on the username of the caller. ... But it always failing. ... ERROR: UNKNOWN-ERROR ... To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx ...
      (Debian-User)
    • Re: The New TAG Issue
      ... Why don't you just answer her question by quoting the DG contents message -- ... and appending your comments? ... That's the polite thing to do. ... To unsubscribe from the list, ...
      (soc.genealogy.medieval)
    • Re: [PATCH block-2.6] aoe status.sh: handle sysfs not in /etc/mtab
      ... > example aoe status.sh script work when sysfs is mounted but `mount` ... > doesn't mention sysfs. ... To unsubscribe from this list: send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: [patch] Real-Time Preemption, -VP-2.6.9-rc4-mm1-U2
      ... On Fri, 15 Oct 2004, Ingo Molnar wrote: ... scheduling while atomic: XFree86/0x04000002/1129 ... caller is cond_resched+0x53/0x70 ... To unsubscribe from this list: send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: [lm-sensors] Intel Core Duo/Solo Temperature Monitoring Working On Intel DG965 Motherboard
      ... leave it up to the caller to decide whether to ignore them or not, ... rather than hiding them. ... Could you possibly propose a separate patch fixing lib/msr-on-cpu.c (on ... To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx ...
      (Debian-User)