!117 [sync] PR-116: Fix crash when reloading DHCP config on SIGHUP

From: @openeuler-sync-bot 
Reviewed-by: @jiangheng12 
Signed-off-by: @jiangheng12
This commit is contained in:
openeuler-ci-bot 2024-11-11 10:39:20 +00:00 committed by Gitee
commit b097c8d65e
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 58 additions and 1 deletions

View File

@ -0,0 +1,50 @@
From f006be7842104a9f86fbf419326b7aad08ade61d Mon Sep 17 00:00:00 2001
From: Simon Kelley <simon@thekelleys.org.uk>
Date: Fri, 4 Oct 2024 16:59:14 +0100
Subject: [PATCH] Fix crash when reloading DHCP config on SIGHUP.
Confusion in the code to free old DHCP configuration when it's
being reloaded causes invalid pointers to be followed and a crash.
https://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/2024q4/017764.html
has a more complete explanation of the problem.
Conflict:NA
Reference:https://github.com/rhuijben/dnsmasq/commit/f006be7842104a9f86fbf419326b7aad08ade61d
---
src/option.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/option.c b/src/option.c
index f4ff7c0..ed0d9e1 100644
--- a/src/option.c
+++ b/src/option.c
@@ -1336,7 +1336,7 @@ static void dhcp_netid_free(struct dhcp_netid *nid)
/* Parse one or more tag:s before parameters.
* Moves arg to the end of tags. */
-static struct dhcp_netid * dhcp_tags(char **arg)
+static struct dhcp_netid *dhcp_tags(char **arg)
{
struct dhcp_netid *id = NULL;
@@ -1360,7 +1360,13 @@ static void dhcp_netid_list_free(struct dhcp_netid_list *netid)
{
struct dhcp_netid_list *tmplist = netid;
netid = netid->next;
- dhcp_netid_free(tmplist->list);
+ /* Note: don't use dhcp_netid_free() here, since that
+ frees a list linked on netid->next. Where a netid_list
+ is used that's because the the ->next pointers in the
+ netids are being used to temporarily construct
+ a list of valid tags. */
+ free(tmplist->list->net);
+ free(tmplist->list);
free(tmplist);
}
}
--
2.33.0

View File

@ -1,6 +1,6 @@
Name: dnsmasq Name: dnsmasq
Version: 2.90 Version: 2.90
Release: 1 Release: 2
Summary: Dnsmasq provides network infrastructure for small networks Summary: Dnsmasq provides network infrastructure for small networks
License: GPLv2 or GPLv3 License: GPLv2 or GPLv3
URL: http://www.thekelleys.org.uk/dnsmasq/ URL: http://www.thekelleys.org.uk/dnsmasq/
@ -15,6 +15,7 @@ Patch4: backport-Fix-spurious-resource-limit-exceeded-messages.patch
Patch5: backport-Fix-error-introduced-in-51471cafa5a4fa44d6fe49.patch Patch5: backport-Fix-error-introduced-in-51471cafa5a4fa44d6fe49.patch
Patch6: bugfix-allow-binding-mac-with-ipv6.patch Patch6: bugfix-allow-binding-mac-with-ipv6.patch
Patch7: bugfix-deal-with-CONFRIM-when-binding-mac-with-ipv6.patch Patch7: bugfix-deal-with-CONFRIM-when-binding-mac-with-ipv6.patch
Patch8: backport-Fix-crash-when-reloading-DHCP-config-on-SIGHUP.patch
BuildRequires: gcc BuildRequires: gcc
BuildRequires: dbus-devel pkgconfig libidn2-devel nettle-devel systemd BuildRequires: dbus-devel pkgconfig libidn2-devel nettle-devel systemd
@ -104,6 +105,12 @@ install -Dpm644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysusersdir}/dnsmasq.conf
%{_mandir}/man8/dnsmasq* %{_mandir}/man8/dnsmasq*
%changelog %changelog
* Sat Oct 12 2024 huyizhen <huyizhen2@huawei.com> - 2.90-2
- Type:bugfix
- CVE:
- SUG:NA
- DESC:Replace huawei bad free patch by community patch
* Thu Feb 22 2024 renmingshuai <renmingshuai@huawei.com> - 2.90-1 * Thu Feb 22 2024 renmingshuai <renmingshuai@huawei.com> - 2.90-1
- Type:requirement - Type:requirement
- Id:NA - Id:NA