From: Antonio Quartulli <ordex@autistici.org>
To: The list for a Better Approach To Mobile Ad-hoc Networking
<b.a.t.m.a.n@lists.open-mesh.org>
Cc: "Martin Hundebøll" <martin@hundeboll.net>
Subject: Re: [B.A.T.M.A.N.] [PATCH] batman-adv: Avoid double freeing of bat_counters
Date: Wed, 17 Apr 2013 14:05:50 +0200 [thread overview]
Message-ID: <20130417120550.GD20819@ritirata.org> (raw)
In-Reply-To: <1366194530-9367-1-git-send-email-martin@hundeboll.net>
[-- Attachment #1: Type: text/plain, Size: 1127 bytes --]
On Wed, Apr 17, 2013 at 12:28:50PM +0200, Martin Hundebøll wrote:
> On errors in batadv_mesh_init(), bat_counters will be freed in both
> batadv_mesh_free() and batadv_softif_init_late(). This patch fixes this
> by returning earlier from batadv_softif_init_late() in case of errors in
> batadv_mesh_init().
>
> Signed-off-by: Martin Hundebøll <martin@hundeboll.net>
> ---
> soft-interface.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/soft-interface.c b/soft-interface.c
> index c2a9c20..4de4d0f 100644
> --- a/soft-interface.c
> +++ b/soft-interface.c
> @@ -503,6 +503,9 @@ static int batadv_softif_init_late(struct net_device *dev)
>
> unreg_debugfs:
> batadv_debugfs_del_meshif(dev);
> +
> + return ret;
> +
Hi Martin, good catch!
But using 1 goto to execute 1 operation is not very good.
What about this:
ret = batadv_mesh_init(dev);
if (ret < 0)
batadv_debugfs_del_meshif(dev);
return ret;
and remove the unreg_debugfs label at all (and its content)
Cheers,
--
Antonio Quartulli
..each of us alone is worth nothing..
Ernesto "Che" Guevara
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2013-04-17 12:05 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-17 10:28 [B.A.T.M.A.N.] [PATCH] batman-adv: Avoid double freeing of bat_counters Martin Hundebøll
2013-04-17 12:05 ` Antonio Quartulli [this message]
2013-04-17 12:36 ` [B.A.T.M.A.N.] [PATCHv2] " Martin Hundebøll
2013-04-17 15:56 ` Marek Lindner
2013-04-17 19:13 ` [B.A.T.M.A.N.] [PATCHv3] " Martin Hundebøll
2013-04-17 19:53 ` Marek Lindner
[not found] <pull request for net: batman-adv 2013-05-21>
2013-05-21 19:53 ` [B.A.T.M.A.N.] (no subject) Antonio Quartulli
2013-05-21 19:53 ` [B.A.T.M.A.N.] [PATCH] batman-adv: Avoid double freeing of bat_counters Antonio Quartulli
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=20130417120550.GD20819@ritirata.org \
--to=ordex@autistici.org \
--cc=b.a.t.m.a.n@lists.open-mesh.org \
--cc=martin@hundeboll.net \
/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