From: "Gustavo F. Padovan" <padovan@profusion.mobi>
To: Anderson Lizardo <anderson.lizardo@openbossa.org>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH v2] Bluetooth: Fix error handling for l2cap_init()
Date: Mon, 22 Nov 2010 15:34:47 -0200 [thread overview]
Message-ID: <20101122173447.GA23109@vigoh> (raw)
In-Reply-To: <1290423434-2920-1-git-send-email-anderson.lizardo@openbossa.org>
Hi Anderson,
* Anderson Lizardo <anderson.lizardo@openbossa.org> [2010-11-22 06:57:14 -0400]:
> create_singlethread_workqueue() may fail with errors such as -ENOMEM. If
> this happens, the return value is not set to a negative value and the
> module load will succeed. It will then crash on module unload because of
> a destroy_workqueue() call on a NULL pointer.
>
> Additionally, the _busy_wq workqueue is not being destroyed if any
> errors happen on l2cap_init().
>
> Signed-off-by: Anderson Lizardo <anderson.lizardo@openbossa.org>
> ---
> net/bluetooth/l2cap.c | 8 ++++++--
> 1 files changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c
> index 18a802c..7980e24 100644
> --- a/net/bluetooth/l2cap.c
> +++ b/net/bluetooth/l2cap.c
> @@ -4875,8 +4875,10 @@ static int __init l2cap_init(void)
> return err;
>
> _busy_wq = create_singlethread_workqueue("l2cap");
> - if (!_busy_wq)
> - goto error;
> + if (!_busy_wq) {
> + err = -ENOMEM;
> + goto error_busy_wq;
> + }
I prefer if you move the workqueue creation to after the
hci_register_proto block. That will make things easier.
--
Gustavo F. Padovan
http://profusion.mobi
next prev parent reply other threads:[~2010-11-22 17:34 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-22 10:57 [PATCH v2] Bluetooth: Fix error handling for l2cap_init() Anderson Lizardo
2010-11-22 17:34 ` Gustavo F. Padovan [this message]
2010-11-22 18:05 ` Anderson Lizardo
2010-11-24 12:42 ` Marcel Holtmann
2010-11-24 15:13 ` Anderson Lizardo
2010-11-24 21:05 ` Gustavo F. Padovan
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=20101122173447.GA23109@vigoh \
--to=padovan@profusion.mobi \
--cc=anderson.lizardo@openbossa.org \
--cc=linux-bluetooth@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox