]> git.baikalelectronics.ru Git - kernel.git/commit
sysfs: Complain bitterly about attempts to remove files from nonexistent directories.
authorEric W. Biederman <ebiederm@xmission.com>
Sat, 14 Jan 2012 05:32:59 +0000 (21:32 -0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 24 Jan 2012 20:12:32 +0000 (12:12 -0800)
commit1c28f8614902b7eeb6a052375c3c899acb4c9a1e
tree7734c3d6a07173cb509be7a2ac7318fd389510bb
parent7257e17bf5d631d9aa12977015256f8d4c79af06
sysfs: Complain bitterly about attempts to remove files from nonexistent directories.

Recently an OOPS was observed from the usb serial io_ti driver when it tried to remove
sysfs directories.  Upon investigation it turns out this driver was always buggy
and that a recent sysfs change had stopped guarding itself against removing attributes
from sysfs directories that had already been removed. :(

Historically we have been silent about attempting to files from nonexistent sysfs
directories and have politely returned error codes.  That has resulted in people writing
broken code that ignores the error codes.

Issue a kernel WARNING and a stack backtrace to make it clear in no uncertain
terms that abusing sysfs is not ok, and the callers need to fix their code.

This change transforms the io_ti OOPS into a more comprehensible error message
and stack backtrace.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Reported-by: Wolfgang Frisch <wfpub@roembden.net>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fs/sysfs/file.c
fs/sysfs/inode.c