diff options
| -rw-r--r-- | meta-networking/recipes-protocols/net-snmp/net-snmp/net-snmp-agentx-crash.patch | 75 | ||||
| -rw-r--r-- | meta-networking/recipes-protocols/net-snmp/net-snmp_5.7.3.bb | 1 |
2 files changed, 76 insertions, 0 deletions
diff --git a/meta-networking/recipes-protocols/net-snmp/net-snmp/net-snmp-agentx-crash.patch b/meta-networking/recipes-protocols/net-snmp/net-snmp/net-snmp-agentx-crash.patch new file mode 100644 index 0000000000..5eed893e18 --- /dev/null +++ b/meta-networking/recipes-protocols/net-snmp/net-snmp/net-snmp-agentx-crash.patch | |||
| @@ -0,0 +1,75 @@ | |||
| 1 | Description: fix snmpd crash via AgentX connection | ||
| 2 | |||
| 3 | taken from Fedora, net-snmp-5.7-agentx-crash.patch | ||
| 4 | |||
| 5 | bz729738 - net-snmp dumps core in netsnmp_oid_find_prefix | ||
| 6 | bz1038011 - net-snmp: snmpd crashes/hangs when AgentX subagent times-out | ||
| 7 | |||
| 8 | commit f9304c83f76202db0e684269ca1af32e43cd9db4 | ||
| 9 | Author: Jan Safranek <jsafranek@users.sourceforge.net> | ||
| 10 | Date: Tue Feb 7 14:53:44 2012 +0100 | ||
| 11 | |||
| 12 | CHANGES: PATCH 1633670: fixed snmpd crashing when an AgentX subagent | ||
| 13 | disconnect in the middle of processing of a request. | ||
| 14 | |||
| 15 | I fixed also the memory leak reported in the tracker comments. | ||
| 16 | |||
| 17 | Upstream-Status: Backport | ||
| 18 | |||
| 19 | Signed-off-by: Zhu Yanjun <yanjun.zhu@windriver.com> | ||
| 20 | Signed-off-by: Jackie Huang <jackie.huang@windriver.com> | ||
| 21 | |||
| 22 | --- | ||
| 23 | agent/mibgroup/agentx/master.c | 5 +++++ | ||
| 24 | agent/mibgroup/agentx/master_admin.c | 9 +++++++-- | ||
| 25 | 2 files changed, 12 insertions(+), 2 deletions(-) | ||
| 26 | |||
| 27 | diff --git a/agent/mibgroup/agentx/master.c b/agent/mibgroup/agentx/master.c | ||
| 28 | index c42a42a..baeebaf 100644 | ||
| 29 | --- a/agent/mibgroup/agentx/master.c | ||
| 30 | +++ b/agent/mibgroup/agentx/master.c | ||
| 31 | @@ -219,6 +219,9 @@ agentx_got_response(int operation, | ||
| 32 | if (!cache) { | ||
| 33 | DEBUGMSGTL(("agentx/master", "response too late on session %8p\n", | ||
| 34 | session)); | ||
| 35 | + /* response is too late, free the cache */ | ||
| 36 | + if (magic) | ||
| 37 | + netsnmp_free_delegated_cache((netsnmp_delegated_cache*) magic); | ||
| 38 | return 0; | ||
| 39 | } | ||
| 40 | requests = cache->requests; | ||
| 41 | @@ -606,6 +609,8 @@ agentx_master_handler(netsnmp_mib_handler *handler, | ||
| 42 | result = snmp_async_send(ax_session, pdu, agentx_got_response, cb_data); | ||
| 43 | if (result == 0) { | ||
| 44 | snmp_free_pdu(pdu); | ||
| 45 | + if (cb_data) | ||
| 46 | + netsnmp_free_delegated_cache((netsnmp_delegated_cache*) cb_data); | ||
| 47 | } | ||
| 48 | |||
| 49 | return SNMP_ERR_NOERROR; | ||
| 50 | diff --git a/agent/mibgroup/agentx/master_admin.c b/agent/mibgroup/agentx/master_admin.c | ||
| 51 | index f16f392..b84b85e 100644 | ||
| 52 | --- a/agent/mibgroup/agentx/master_admin.c | ||
| 53 | +++ b/agent/mibgroup/agentx/master_admin.c | ||
| 54 | @@ -133,11 +133,16 @@ close_agentx_session(netsnmp_session * session, int sessid) | ||
| 55 | * requests, so that the delegated request will be completed and | ||
| 56 | * further requests can be processed | ||
| 57 | */ | ||
| 58 | - netsnmp_remove_delegated_requests_for_session(session); | ||
| 59 | + while (netsnmp_remove_delegated_requests_for_session(session)) { | ||
| 60 | + DEBUGMSGTL(("agentx/master", "Continue removing delegated reqests\n")); | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | if (session->subsession != NULL) { | ||
| 64 | netsnmp_session *subsession = session->subsession; | ||
| 65 | for(; subsession; subsession = subsession->next) { | ||
| 66 | - netsnmp_remove_delegated_requests_for_session(subsession); | ||
| 67 | + while (netsnmp_remove_delegated_requests_for_session(subsession)) { | ||
| 68 | + DEBUGMSGTL(("agentx/master", "Continue removing delegated subsession reqests\n")); | ||
| 69 | + } | ||
| 70 | } | ||
| 71 | } | ||
| 72 | |||
| 73 | -- | ||
| 74 | 2.7.4 | ||
| 75 | |||
diff --git a/meta-networking/recipes-protocols/net-snmp/net-snmp_5.7.3.bb b/meta-networking/recipes-protocols/net-snmp/net-snmp_5.7.3.bb index 79892a120a..ca98fc08a0 100644 --- a/meta-networking/recipes-protocols/net-snmp/net-snmp_5.7.3.bb +++ b/meta-networking/recipes-protocols/net-snmp/net-snmp_5.7.3.bb | |||
| @@ -22,6 +22,7 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/net-snmp/net-snmp-${PV}.zip \ | |||
| 22 | file://0001-config_os_headers-Error-Fix.patch \ | 22 | file://0001-config_os_headers-Error-Fix.patch \ |
| 23 | file://0001-config_os_libs2-Error-Fix.patch \ | 23 | file://0001-config_os_libs2-Error-Fix.patch \ |
| 24 | file://0001-snmplib-keytools.c-Don-t-check-for-return-from-EVP_M.patch \ | 24 | file://0001-snmplib-keytools.c-Don-t-check-for-return-from-EVP_M.patch \ |
| 25 | file://net-snmp-agentx-crash.patch \ | ||
| 25 | " | 26 | " |
| 26 | SRC_URI[md5sum] = "9f682bd70c717efdd9f15b686d07baee" | 27 | SRC_URI[md5sum] = "9f682bd70c717efdd9f15b686d07baee" |
| 27 | SRC_URI[sha256sum] = "e8dfc79b6539b71a6ff335746ce63d2da2239062ad41872fff4354cafed07a3e" | 28 | SRC_URI[sha256sum] = "e8dfc79b6539b71a6ff335746ce63d2da2239062ad41872fff4354cafed07a3e" |
