Fix null dereference in findLBEndpointSandbox

This commit is contained in:
guojunding 2024-07-18 10:48:48 +08:00
parent ed6829c1ac
commit 93b250b31e
2 changed files with 45 additions and 1 deletions

View File

@ -0,0 +1,37 @@
From 90990763aa5895d00934ef0924b10ca7b39821eb Mon Sep 17 00:00:00 2001
From: Scott Percival <scottp@lastyard.com>
Date: Tue, 22 Sep 2020 14:56:03 +0800
Subject: [PATCH] service_linux: Fix null dereference in findLBEndpointSandbox
Signed-off-by: Scott Percival <scottp@lastyard.com>
(cherry picked from commit 2fe6352d2420502217c3249db8c03c0d52287069)
Signed-off-by: Ameya Gawde <agawde@mirantis.com>
---
service_linux.go | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git libnetwork-d00ceed44cc447c77f25cdf5d59e83163bdcb4c9/service_linux.go libnetwork-d00ceed44cc447c77f25cdf5d59e83163bdcb4c9-b/service_linux.go
index 3ffa607..bb0074f 100644
--- libnetwork-d00ceed44cc447c77f25cdf5d59e83163bdcb4c9/service_linux.go
+++ libnetwork-d00ceed44cc447c77f25cdf5d59e83163bdcb4c9-b/service_linux.go
@@ -67,11 +67,13 @@ func (n *network) findLBEndpointSandbox() (*endpoint, *sandbox, error) {
if !ok {
return nil, nil, fmt.Errorf("Unable to get sandbox for %s(%s) in for %s", ep.Name(), ep.ID(), n.ID())
}
- ep = sb.getEndpoint(ep.ID())
- if ep == nil {
+ var sep *endpoint
+ sep = sb.getEndpoint(ep.ID())
+ if sep == nil {
return nil, nil, fmt.Errorf("Load balancing endpoint %s(%s) removed from %s", ep.Name(), ep.ID(), n.ID())
}
- return ep, sb, nil
+ return sep, sb, nil
+
}
// Searches the OS sandbox for the name of the endpoint interface
--
2.9.3.windows.1

View File

@ -1,11 +1,14 @@
%define debug_package %{nil}
Name: libnetwork
Version: 0.8.0.dev.2
Release: 102
Release: 103
Summary: Proxy used for docker port mapping
License: Apache License 2.0
URL: https://github.com/docker/libnetwork
Source: libnetwork-d00ceed.tar.gz
Patch1: backport-Fix-null-dereference-in-findLBEndpointSandbox.patch
BuildRequires: golang >= 1.8.3
BuildRequires: make
Provides: docker-proxy
@ -15,6 +18,7 @@ Obsoletes: docker-proxy
%prep
%setup -c -n libnetwork
%patch1 -p0
%build
cd libnetwork-d00ceed44cc447c77f25cdf5d59e83163bdcb4c9
@ -41,6 +45,9 @@ install -p -m 755 libnetwork-d00ceed44cc447c77f25cdf5d59e83163bdcb4c9/docker-pro
%{_bindir}/docker-proxy
%changelog
* Thu Jul 18 2024 guojunding <guojunding@kylinos.cn> - 0.8.0.dev.2-103
- Fix null dereference in findLBEndpointSandbox
* Thu Mar 18 2021 xiadanni<xiadanni1@huawei.com> 0.8.0.dev.2-102
- Type:bugfix
- Id:NA