From: zhanghailiang <zhang.zhanghailiang@huawei.com>
To: qemu-trivial@nongnu.org
Cc: zhanghailiang <zhang.zhanghailiang@huawei.com>,
qemu-devel@nongnu.org, stefanha@redhat.com,
peter.huangpeng@huawei.com
Subject: [Qemu-devel] [PATCH] l2tpv3: fix possible double free
Date: Fri, 14 Nov 2014 09:39:23 +0800 [thread overview]
Message-ID: <1415929163-12184-1-git-send-email-zhang.zhanghailiang@huawei.com> (raw)
freeaddrinfo(result) does not assign result = NULL, after frees it.
There will be a double free when it goes error case.
It is reported by covertiy.
Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
---
net/l2tpv3.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/net/l2tpv3.c b/net/l2tpv3.c
index 528d95b..f9e0c98 100644
--- a/net/l2tpv3.c
+++ b/net/l2tpv3.c
@@ -661,6 +661,7 @@ int net_init_l2tpv3(const NetClientOptions *opts,
fd = -errno;
error_report("l2tpv3_open : socket creation failed, errno = %d", -fd);
freeaddrinfo(result);
+ result = NULL;
goto outerr;
}
if (bind(fd, (struct sockaddr *) result->ai_addr, result->ai_addrlen)) {
--
1.7.12.4
next reply other threads:[~2014-11-14 1:42 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-14 1:39 zhanghailiang [this message]
2014-11-14 3:03 ` [Qemu-devel] [PATCH] l2tpv3: fix possible double free Gonglei
2014-11-14 8:45 ` Paolo Bonzini
2014-11-17 5:13 ` zhanghailiang
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=1415929163-12184-1-git-send-email-zhang.zhanghailiang@huawei.com \
--to=zhang.zhanghailiang@huawei.com \
--cc=peter.huangpeng@huawei.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
--cc=stefanha@redhat.com \
/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;
as well as URLs for NNTP newsgroup(s).