From: Greg KH <greg@kroah.com>
To: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: linux-scsi <linux-scsi@vger.kernel.org>
Subject: Re: transport_class: BUG if we can't release the attribute container
Date: Tue, 1 Apr 2008 23:32:32 -0700 [thread overview]
Message-ID: <20080402063232.GD8158@kroah.com> (raw)
In-Reply-To: <1206203957.4393.16.camel@localhost.localdomain>
On Sat, Mar 22, 2008 at 11:39:17AM -0500, James Bottomley wrote:
> 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.
>
> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
>
> ---
>
> diff --git a/drivers/base/transport_class.c b/drivers/base/transport_class.c
> index 40bca48..06861ae 100644
> --- a/drivers/base/transport_class.c
> +++ b/drivers/base/transport_class.c
> @@ -108,7 +108,7 @@ EXPORT_SYMBOL_GPL(anon_transport_class_register);
> */
> void anon_transport_class_unregister(struct anon_transport_class *atc)
> {
> - attribute_container_unregister(&atc->container);
> + BUG_ON(attribute_container_unregister(&atc->container));
BUG_ON() should not do anything in the macro except test for a value, no
function calling. I think checkpatch.pl checks for this...
If you change that, I have no problem with this.
thanks,
greg k-h
next prev parent reply other threads:[~2008-04-02 6:32 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-22 16:39 transport_class: BUG if we can't release the attribute container James Bottomley
2008-04-02 6:32 ` Greg KH [this message]
2008-04-02 14:15 ` James Bottomley
2008-04-02 14:30 ` Matthew Wilcox
2008-04-02 14:32 ` James Bottomley
2008-04-02 14:53 ` Greg KH
2008-04-02 15:05 ` James Bottomley
2008-04-02 14:32 ` Boaz Harrosh
2008-04-02 14:36 ` James Bottomley
2008-04-02 14:54 ` Greg KH
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=20080402063232.GD8158@kroah.com \
--to=greg@kroah.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=linux-scsi@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.