代码拉取完成,页面将自动刷新
From dbbfdde4febf2f2ebb8522ff817f5fd169883dbc Mon Sep 17 00:00:00 2001
From: Aaron Conole <[email protected]>
Date: Wed, 25 Aug 2021 10:37:22 -0400
Subject: [PATCH] 8021Qaz: check for rx block validity
There is a slim but possible race in the 8021Qaz processing when handling
TLVs during ifdown windows. To address this, check for the rx block
before dereferencing it.
Conflict:NA
Reference:https://github.com/openSUSE/lldpad/commit/dbbfdde4febf2f2ebb8522ff817f5fd169883dbc
closes https://github.com/intel/openlldp/issues/78
Signed-off-by: Aaron Conole <[email protected]>
---
lldp_8021qaz.c | 41 ++++++++++++++++++++++++++++-------------
1 file changed, 28 insertions(+), 13 deletions(-)
diff --git a/lldp_8021qaz.c b/lldp_8021qaz.c
index abeae46..5fccbe4 100644
--- a/lldp_8021qaz.c
+++ b/lldp_8021qaz.c
@@ -1563,48 +1563,63 @@ static bool unpack_ieee8021qaz_tlvs(struct port *port,
/* Process */
switch (tlv->info[OUI_SIZE]) {
case IEEE8021QAZ_ETSCFG_TLV:
- if (tlvs->rx->etscfg == NULL) {
+ if (tlvs->rx && tlvs->rx->etscfg == NULL) {
tlvs->ieee8021qazdu |= RCVD_IEEE8021QAZ_TLV_ETSCFG;
tlvs->rx->etscfg = tlv;
- } else {
+ } else if (tlvs->rx) {
LLDPAD_WARN("%s: %s: 802.1Qaz Duplicate ETSCFG TLV\n",
__func__, port->ifname);
agent->rx.dupTlvs |= DUP_IEEE8021QAZ_TLV_ETSCFG;
return false;
+ } else {
+ LLDPAD_INFO("%s: %s: 802.1Qaz port IFDOWN\n",
+ __func__, port->ifname);
+ return false;
}
break;
case IEEE8021QAZ_ETSREC_TLV:
- if (tlvs->rx->etsrec == NULL) {
+ if (tlvs->rx && tlvs->rx->etsrec == NULL) {
tlvs->ieee8021qazdu |= RCVD_IEEE8021QAZ_TLV_ETSREC;
tlvs->rx->etsrec = tlv;
- } else {
+ } else if (tlvs->rx) {
LLDPAD_WARN("%s: %s: 802.1Qaz Duplicate ETSREC TLV\n",
__func__, port->ifname);
agent->rx.dupTlvs |= DUP_IEEE8021QAZ_TLV_ETSREC;
return false;
+ } else {
+ LLDPAD_INFO("%s: %s: 802.1Qaz port IFDOWN\n",
+ __func__, port->ifname);
+ return false;
}
break;
-
case IEEE8021QAZ_PFC_TLV:
- if (tlvs->rx->pfc == NULL) {
+ if (tlvs->rx && tlvs->rx->pfc == NULL) {
tlvs->ieee8021qazdu |= RCVD_IEEE8021QAZ_TLV_PFC;
tlvs->rx->pfc = tlv;
- } else {
+ } else if (tlvs->rx) {
LLDPAD_WARN("%s: %s: 802.1Qaz Duplicate PFC TLV\n",
__func__, port->ifname);
agent->rx.dupTlvs |= DUP_IEEE8021QAZ_TLV_PFC;
return false;
+ } else {
+ LLDPAD_INFO("%s: %s: 802.1Qaz port IFDOWN\n",
+ __func__, port->ifname);
+ return false;
}
break;
case IEEE8021QAZ_APP_TLV:
- if (tlvs->rx->app == NULL) {
+ if (tlvs->rx && tlvs->rx->app == NULL) {
tlvs->ieee8021qazdu |= RCVD_IEEE8021QAZ_TLV_APP;
tlvs->rx->app = tlv;
- } else {
+ } else if (tlvs->rx) {
LLDPAD_WARN("%s: %s: 802.1Qaz Duplicate APP TLV\n",
__func__, port->ifname);
agent->rx.dupTlvs |= DUP_IEEE8021QAZ_TLV_APP;
return false;
+ } else {
+ LLDPAD_INFO("%s: %s: 802.1Qaz port IFDOWN\n",
+ __func__, port->ifname);
+ return false;
}
break;
default:
@@ -1891,26 +1906,26 @@ static void ieee8021qaz_mibUpdateObjects(struct port *port)
tlvs = ieee8021qaz_data(port->ifname);
- if (tlvs->rx->etscfg) {
+ if (tlvs->rx && tlvs->rx->etscfg) {
process_ieee8021qaz_etscfg_tlv(port);
} else if (tlvs->ets->cfgr) {
free(tlvs->ets->cfgr);
tlvs->ets->cfgr = NULL;
}
- if (tlvs->rx->etsrec) {
+ if (tlvs->rx && tlvs->rx->etsrec) {
process_ieee8021qaz_etsrec_tlv(port);
} else if (tlvs->ets->recr) {
free(tlvs->ets->recr);
tlvs->ets->recr = NULL;
}
- if (tlvs->rx->pfc)
+ if (tlvs->rx && tlvs->rx->pfc)
process_ieee8021qaz_pfc_tlv(port);
else if (tlvs->pfc)
tlvs->pfc->remote_param = false;
- if (tlvs->rx->app)
+ if (tlvs->rx && tlvs->rx->app)
process_ieee8021qaz_app_tlv(port);
else
ieee8021qaz_app_reset(&tlvs->app_head);
--
1.8.3.1
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。