Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S262160AbVBAWqI (ORCPT ); Tue, 1 Feb 2005 17:46:08 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S262152AbVBAWoc (ORCPT ); Tue, 1 Feb 2005 17:44:32 -0500 Received: from fmr18.intel.com ([134.134.136.17]:3281 "EHLO orsfmr003.jf.intel.com") by vger.kernel.org with ESMTP id S262158AbVBAWj1 (ORCPT ); Tue, 1 Feb 2005 17:39:27 -0500 Date: Tue, 1 Feb 2005 14:39:21 -0800 From: Mitch Williams X-X-Sender: mawilli1@mawilli1-desk2.amr.corp.intel.com To: linux-kernel@vger.kernel.org cc: greg@kroah.com Subject: [PATCH] reject sysfs writes with nonzero position Message-ID: ReplyTo: "Mitch Williams" MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1117 Lines: 29 This patch causes an error to be returned if the user attempts to write a sysfs file at a nonzero offset. Because sysfs store methods do not support a position parameter, the behavior in this case would be unpredictable. Thus, we return an error, because at least now we're consistent. This patch generated from 2.6.11-rc1. Now with tabs. Signed-off-by: Mitch Williams 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 10:47:15.000000000 -0800 @@ -232,6 +232,8 @@ sysfs_write_file(struct file *file, cons { struct sysfs_buffer * buffer = file->private_data; + if (*ppos > 0) + return -EIO; down(&buffer->sem); count = fill_write_buffer(buffer,buf,count); if (count > 0) - 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/