aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJames Bottomley <James.Bottomley@HansenPartnership.com>2008-04-02 11:05:48 -0400
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2008-04-07 13:19:10 -0400
commit2f3edc6936e3f6be3f1df1e89c141ae028fa605e (patch)
tree14198ea135c600b42e4c7416db44967a6517a2db /drivers
parentfa8e36c39b00a219d2c37250e493c3421e0e67e9 (diff)
[SCSI] transport_class: BUG if we can't release the attribute container
Every current transport class calls transport_container_release but ignores the return value. This is catastrophic if it returns an error because the containers are part of a global list and the next action of almost every transport class is to free the memory used by the container. Fix this by making transport_container_release a void, but making it BUG if attribute_container_release returns an error ... this catches the root cause of a system panic much earlier. If we don't do this, we get an eventual BUG when the attribute container list notices the corruption caused by the freed memory it's still referencing. Also made attribute_container_release __must_check as a reminder. Cc: Greg KH <greg@kroah.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/base/transport_class.c3
-rw-r--r--drivers/scsi/raid_class.c2
2 files changed, 3 insertions, 2 deletions
diff --git a/drivers/base/transport_class.c b/drivers/base/transport_class.c
index 40bca48abc12..cabd0edf2156 100644
--- a/drivers/base/transport_class.c
+++ b/drivers/base/transport_class.c
@@ -108,7 +108,8 @@ EXPORT_SYMBOL_GPL(anon_transport_class_register);
108 */ 108 */
109void anon_transport_class_unregister(struct anon_transport_class *atc) 109void anon_transport_class_unregister(struct anon_transport_class *atc)
110{ 110{
111 attribute_container_unregister(&atc->container); 111 if (unlikely(attribute_container_unregister(&atc->container)))
112 BUG();
112} 113}
113EXPORT_SYMBOL_GPL(anon_transport_class_unregister); 114EXPORT_SYMBOL_GPL(anon_transport_class_unregister);
114 115
diff --git a/drivers/scsi/raid_class.c b/drivers/scsi/raid_class.c
index 86e13183c9ba..52182a744ba6 100644
--- a/drivers/scsi/raid_class.c
+++ b/drivers/scsi/raid_class.c
@@ -289,7 +289,7 @@ raid_class_release(struct raid_template *r)
289{ 289{
290 struct raid_internal *i = to_raid_internal(r); 290 struct raid_internal *i = to_raid_internal(r);
291 291
292 attribute_container_unregister(&i->r.raid_attrs.ac); 292 BUG_ON(attribute_container_unregister(&i->r.raid_attrs.ac));
293 293
294 kfree(i); 294 kfree(i);
295} 295}