mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: maneesh@in.ibm.com
Cc: Thibaut VARENE <varenet@parisc-linux.org>,
	linux-scsi@vger.kernel.org, linuxraid@amcc.com,
	Matt Tolentino <matthew.e.tolentino@intel.com>,
	len.brown@intel.com, Ingo Molnar <mingo@elte.hu>,
	LKML <linux-kernel@vger.kernel.org>, Greg KH <greg@kroah.com>
Subject: kobject_register needs return value checks (was: What protection does sysfs_readdir have with SMP/Preemption?)
Date: Wed, 23 Nov 2005 10:24:32 -0500	[thread overview]
Message-ID: <1132759472.13395.65.camel@localhost.localdomain> (raw)
In-Reply-To: <1132755654.13395.37.camel@localhost.localdomain>

I'm doing some tests to see what happens on a failure of setting up
something in the sysfs, and I've discovered a few areas that don't test
the return value of kobject_register. The test was due to a memory
problem in a custom kernel that showed that sysfs didn't quite handle
the error cases well.

I did the following command:

find .  -name "*.c" ! -type d  | xargs grep  "kobject_register"

I found 27 hits. Of these:

14 - checked the return value.
1 - reference in .mod.c file /* ignore it */
3 - in comments /* ignore it */
1 - declaration of actual function /* ignore it */
1 - EXPORT_SYMBOL /* ignore it */
1 - inside a printk quote. /* ignore it */

and ...

6 - calls without checking return values.

Here are the culprits:

./drivers/acpi/scan.c:  kobject_register(&device->kobj);
./drivers/firmware/efivars.c:   kobject_register(&new_efivar->kobj);
./drivers/md/md.c:      kobject_register(&mddev->kobj);
./drivers/parisc/pdc_stable.c:          kobject_register(&entry->kobj);
./fs/partitions/check.c:        kobject_register(&p->kobj);
./kernel/params.c:      kobject_register(&mk->kobj);


Normally, these would not return errors, but in case they do, the kernel
should be robust enough to handle it.

I tried to CC all the maintainers of the above files.

-- Steve



  reply	other threads:[~2005-11-23 15:24 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-22 21:33 What protection does sysfs_readdir have with SMP/Preemption? Steven Rostedt
2005-11-22 21:39 ` Greg KH
2005-11-23  4:50   ` Maneesh Soni
2005-11-23  8:18     ` Ingo Molnar
2005-11-23 12:35       ` Steven Rostedt
2005-11-23 12:54         ` Maneesh Soni
2005-11-23 12:50       ` Maneesh Soni
2005-11-23 12:52       ` [OOPS] sysfs_hash_and_remove (was Re: What protection ....) Maneesh Soni
2005-11-24 12:26         ` Maneesh Soni
2005-11-24 14:34           ` Ingo Molnar
2005-11-26 22:26             ` James Bottomley
2006-02-11  0:33         ` Greg KH
2006-02-11 15:46           ` Steven Rostedt
2006-02-24  1:04             ` Greg KH
2005-11-23 12:56     ` What protection does sysfs_readdir have with SMP/Preemption? Steven Rostedt
2005-11-23 13:58       ` Maneesh Soni
2005-11-23 14:15         ` Steven Rostedt
2005-11-23 14:20           ` Steven Rostedt
2005-11-23 15:24             ` Steven Rostedt [this message]
2005-11-24  4:16           ` Maneesh Soni
2005-11-24 14:32             ` Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1132759472.13395.65.camel@localhost.localdomain \
    --to=rostedt@goodmis.org \
    --cc=greg@kroah.com \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=linuxraid@amcc.com \
    --cc=maneesh@in.ibm.com \
    --cc=matthew.e.tolentino@intel.com \
    --cc=mingo@elte.hu \
    --cc=varenet@parisc-linux.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome