summaryrefslogtreecommitdiffstats
path: root/meta-networking/recipes-protocols/net-snmp/net-snmp
diff options
context:
space:
mode:
authorJackie Huang <jackie.huang@windriver.com>2016-07-06 22:18:03 -0400
committerJoe MacDonald <joe_macdonald@mentor.com>2016-07-18 13:59:16 -0400
commit582eddb44e0d1ce67a04afb441059a8bf7cc1ef1 (patch)
tree1df7db0734df890d48c7bdd2c6299d2dc2b53517 /meta-networking/recipes-protocols/net-snmp/net-snmp
parenta27d4a75c503f8cab2188cfed78754d1a4157775 (diff)
downloadmeta-openembedded-582eddb44e0d1ce67a04afb441059a8bf7cc1ef1.tar.gz
net-snmp: fix snmpd crash via AgentX connection
backport a patch to fixed snmpd crashing when an AgentX subagent disconnect in the middle of processing of a request. Signed-off-by: Zhu Yanjun <yanjun.zhu@windriver.com> Signed-off-by: Jackie Huang <jackie.huang@windriver.com> Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> Signed-off-by: Joe MacDonald <joe_macdonald@mentor.com>
Diffstat (limited to 'meta-networking/recipes-protocols/net-snmp/net-snmp')
-rw-r--r--meta-networking/recipes-protocols/net-snmp/net-snmp/net-snmp-agentx-crash.patch75
1 files changed, 75 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 000000000..5eed893e1
--- /dev/null
+++ b/meta-networking/recipes-protocols/net-snmp/net-snmp/net-snmp-agentx-crash.patch
@@ -0,0 +1,75 @@
1Description: fix snmpd crash via AgentX connection
2
3 taken from Fedora, net-snmp-5.7-agentx-crash.patch
4
5bz729738 - net-snmp dumps core in netsnmp_oid_find_prefix
6bz1038011 - net-snmp: snmpd crashes/hangs when AgentX subagent times-out
7
8commit f9304c83f76202db0e684269ca1af32e43cd9db4
9Author: Jan Safranek <jsafranek@users.sourceforge.net>
10Date: 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
17Upstream-Status: Backport
18
19Signed-off-by: Zhu Yanjun <yanjun.zhu@windriver.com>
20Signed-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
27diff --git a/agent/mibgroup/agentx/master.c b/agent/mibgroup/agentx/master.c
28index 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;
50diff --git a/agent/mibgroup/agentx/master_admin.c b/agent/mibgroup/agentx/master_admin.c
51index 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--
742.7.4
75