lkml.org 
[lkml]   [2008]   [May]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: kobject: Fix kobject_rename and !CONFIG_SYSFS
On Thu, May 08, 2008 at 02:41:00PM -0700, Eric W. Biederman wrote:
>
> From: Eric W. Biederman <ebiederm@xmission.com>
>
> When looking at kobject_rename I found two bugs with
> that exist when sysfs support is disabled in the kernel.
>
> kobject_rename does not change the name on the kobject when
> sysfs support is not compiled in.
>
> kobject_rename without locking attempts to check the
> validity of a rename operation, which the kobject layer
> simply does not have the infrastructure to do so.
>
> This patch documents the previously unstated requirement of
> kobject_rename that is the responsibility of the caller to
> provide mutual exclusion and to be certain that the new_name
> for the kobject is valid.
>
> This patch modifies sysfs_rename_dir in !CONFIG_SYSFS case
> to call kobject_set_name to actually change the kobject_name.
>
> This patch removes the bogus and misleading check in kobject_rename
> that attempts to see if a rename is valid. The check is bogus
> because we do not have the proper locking. The check is misleading
> because it looks like we can and do perform useful checking at the
> kobject level that we don't.
>
> The users in net/core/dev.c already have all of the necessary checks
> in place and don't care. The other use in net/core/wireless.c
> as originally implemented is incorrect because it performs no locking
> and a simple patch has been sent that adds the necessary locking
> and sanity checks there. Ensuring this patch will not have an
> effect on users of kobject_rename or device_rename.

Eric, Randy Dunlap has found that this patch breaks the build when
CONFIG_SYSFS is not enabled. Can you please fix it up before I send it
to Linus?

The exact error is:
In file included from /local/linsrc/next-20080509/include/linux/kobject.h:21,
from /local/linsrc/next-20080509/include/linux/module.h:16,
from /local/linsrc/next-20080509/include/linux/crypto.h:21,
from /local/linsrc/next-20080509/arch/x86/kernel/asm-offsets_64.c:7,
from /local/linsrc/next-20080509/arch/x86/kernel/asm-offsets.c:4:
/local/linsrc/next-20080509/include/linux/sysfs.h: In function 'sysfs_rename_dir':
/local/linsrc/next-20080509/include/linux/sysfs.h:142: error: implicit declaration of function 'kobject_set_name'


thanks,

greg k-h


\
 
 \ /
  Last update: 2008-05-13 00:07    [W:0.117 / U:3.376 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site