check the return vlaue of function ecp_create

This commit is contained in:
zengweifeng 2021-01-26 16:53:16 +08:00
parent 1b635b7819
commit 80bc820818
2 changed files with 37 additions and 1 deletions

View File

@ -4,7 +4,7 @@
Name: lldpad
Version: 1.0.1
Release: 14
Release: 15
Summary: Intel LLDP Agent
License: GPLv2
URL: https://www.open-lldp.org
@ -36,6 +36,7 @@ Patch24: open-lldp-v1.0.1-24-switch-from-sysv-to-posix-shared-memory-apis.pa
Patch25: open-lldp-v1.0.1-25-l2_linux_packet-correctly-process-return-value-of-ge.patch
Patch26: open-lldp-v1.0.1-26-lldpad-system-capability-incorrect-advertised-as-sta.patch
Patch27: open-lldp-v1.0.1-27-fix-build-warnings.patch
Patch28: open-lldp-ecp-allow-for-failure-to-create.patch
BuildRequires: automake autoconf libtool flex kernel-headers libconfig-devel
BuildRequires: libnl3-devel readline-devel systemd git
@ -110,6 +111,12 @@ make check
%{_mandir}/man*/*
%changelog
* Tue Jan 26 2021 zengwefeng<zwfeng@huawei.com> - 1.0.1-15
- Type:bugfix
- Id:NA
- SUG:NA
- DESC:check the return value of ecp_create
* Thu Sep 10 2020 lunankun <lunankun@huawei.com> - 1.0.1-14
- Type:bugfix
- Id:NA

View File

@ -0,0 +1,29 @@
From 488051ae0b88b8b77081fadff8154dbd4ddfd54c Mon Sep 17 00:00:00 2001
From: rpm-build <rpm-build>
Date: Tue, 26 Jan 2021 16:16:17 +0800
Subject: [PATCH] ecp-allow-for-failure-to-create.patch
---
qbg/ecp22.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/qbg/ecp22.c b/qbg/ecp22.c
index 4640701..ba8f891 100644
--- a/qbg/ecp22.c
+++ b/qbg/ecp22.c
@@ -782,7 +782,11 @@ void ecp22_start(char *ifname)
ecp = find_ecpdata(ifname, eud);
if (!ecp)
ecp = ecp22_create(ifname, eud);
- ecp->max_retries = ECP22_MAX_RETRIES_DEFAULT;
+ if (!ecp) {
+ LLDPAD_DBG("%s:%s failed creating ECP22 instance\n", __func__, ifname);
+ return;
+ }
+ ecp->max_retries = ECP22_MAX_RETRIES_DEFAULT;
ecp->max_rte = ECP22_ACK_TIMER_DEFAULT;
LIST_INIT(&ecp->inuse.head);
ecp->inuse.last = 0;
--
2.23.0