From: Laszlo Ersek <lersek@redhat.com>
To: Zhang Lubo <lubo.zhang@intel.com>, edk2-devel@ml01.01.org
Cc: Ye Ting <ting.ye@intel.com>, Fu Siyuan <siyuan.fu@intel.com>,
Wu Jiaxin <jiaxin.wu@intel.com>
Subject: Re: [patch] NetworkPkg: Enhance the code in DNS driver.
Date: Fri, 14 Oct 2016 14:12:07 +0200 [thread overview]
Message-ID: <3b947323-e3b0-9a52-525b-957a0cad7e0e@redhat.com> (raw)
In-Reply-To: <1476428061-23960-1-git-send-email-lubo.zhang@intel.com>
On 10/14/16 08:54, Zhang Lubo wrote:
> There may be an error happens when we use the
> configure function to set or change the configuration
> data for the DNS6 instance, So we will free the
> DnsServerList without configured to NULL. If we reset
> the instance with the parameter DnsConfigData to NULL, the
> DnsServerList will be freed twice.
>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Zhang Lubo <lubo.zhang@intel.com>
> Cc: Ye Ting <ting.ye@intel.com>
> Cc: Fu Siyuan <siyuan.fu@intel.com>
> Cc: Wu Jiaxin <jiaxin.wu@intel.com>
> ---
> NetworkPkg/DnsDxe/DnsProtocol.c | 4 ++++
> 1 file changed, 4 insertions(+)
The subject line of the patch is near useless, I'm afraid.
How about:
NetworkPkg/DnsDxe: eliminate double-free on DNS configuration failure
Thanks
Laszlo
> diff --git a/NetworkPkg/DnsDxe/DnsProtocol.c b/NetworkPkg/DnsDxe/DnsProtocol.c
> index 64fca6a..6d117b2 100644
> --- a/NetworkPkg/DnsDxe/DnsProtocol.c
> +++ b/NetworkPkg/DnsDxe/DnsProtocol.c
> @@ -285,10 +285,11 @@ Dns4Configure (
> //
> Status = Dns4ConfigUdp (Instance, Instance->UdpIo);
> if (EFI_ERROR (Status)) {
> if (Instance->Dns4CfgData.DnsServerList != NULL) {
> FreePool (Instance->Dns4CfgData.DnsServerList);
> + Instance->Dns4CfgData.DnsServerList = NULL;
> }
> goto ON_EXIT;
> }
>
> //
> @@ -296,10 +297,11 @@ Dns4Configure (
> //
> Status = AddDns4ServerIp (&mDriverData->Dns4ServerList, Instance->SessionDnsServer.v4);
> if (EFI_ERROR (Status)) {
> if (Instance->Dns4CfgData.DnsServerList != NULL) {
> FreePool (Instance->Dns4CfgData.DnsServerList);
> + Instance->Dns4CfgData.DnsServerList = NULL;
> }
> goto ON_EXIT;
> }
>
> Instance->State = DNS_STATE_CONFIGED;
> @@ -1106,10 +1108,11 @@ Dns6Configure (
> //
> Status = Dns6ConfigUdp (Instance, Instance->UdpIo);
> if (EFI_ERROR (Status)) {
> if (Instance->Dns6CfgData.DnsServerList != NULL) {
> FreePool (Instance->Dns6CfgData.DnsServerList);
> + Instance->Dns6CfgData.DnsServerList = NULL;
> }
> goto ON_EXIT;
> }
>
> //
> @@ -1117,10 +1120,11 @@ Dns6Configure (
> //
> Status = AddDns6ServerIp (&mDriverData->Dns6ServerList, Instance->SessionDnsServer.v6);
> if (EFI_ERROR (Status)) {
> if (Instance->Dns6CfgData.DnsServerList != NULL) {
> FreePool (Instance->Dns6CfgData.DnsServerList);
> + Instance->Dns6CfgData.DnsServerList = NULL;
> }
> goto ON_EXIT;
> }
>
> Instance->State = DNS_STATE_CONFIGED;
>
next prev parent reply other threads:[~2016-10-14 12:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-14 6:54 [patch] NetworkPkg: Enhance the code in DNS driver Zhang Lubo
2016-10-14 12:12 ` Laszlo Ersek [this message]
2016-10-17 9:06 ` Fu, Siyuan
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-list 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=3b947323-e3b0-9a52-525b-957a0cad7e0e@redhat.com \
--to=devel@edk2.groups.io \
/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