From patchwork Mon Nov 2 10:16:10 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Dedecker X-Patchwork-Id: 538953 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from arrakis.dune.hu (arrakis.dune.hu [78.24.191.176]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 97F90140D7A for ; Mon, 2 Nov 2015 21:16:38 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=ub2BiTtb; dkim-atps=neutral Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id DB593280163; Mon, 2 Nov 2015 11:14:39 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on arrakis.dune.hu X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_DKIM_INVALID autolearn=unavailable version=3.3.2 Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 5AC86280163 for ; Mon, 2 Nov 2015 11:14:35 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 CL_IP_EQ_HELO_IP=-2 (check from: .gmail. - helo: .mail-wm0-f50.google. - helo-domain: .google.) FROM/MX_MATCHES_HELO(DOMAIN)=-2; rate: -8.5 Received: from mail-wm0-f50.google.com (mail-wm0-f50.google.com [74.125.82.50]) by arrakis.dune.hu (Postfix) with ESMTPS for ; Mon, 2 Nov 2015 11:14:34 +0100 (CET) Received: by wmeg8 with SMTP id g8so54611478wme.0 for ; Mon, 02 Nov 2015 02:16:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=ZlV8zCW3E5CJrzu1VlD2Gr2jJjfr2mws8U0M688RDBU=; b=ub2BiTtbTEXb//UjaQl4rWKagEOeGY+dgyAs3iKW22S2b8IeoHNXA4XRf5i1ToTe+N wU497tvJ9ulrAzfSeGwIUDWtlRMfyHbc/xEpRQKsoQNl09cDK8Ovi3Mg/UtyeKFK/Vg1 byLsisDrt+321pSuaOlIFE/fKWuCiXEYkK9KfWwE8SHScDnzCmx/Vp/xXYms0lebf2wA jgS7f//Nwf9wuV8iWTV3dO16SYkvtgvNbr6W1V4cuHA3JNrU7EGhnofzPyMPafwP+r8N WyxlGV3PFlT4sg8vlCZGKqynrt2gWUMavEBWVqEVovoyLD4bpCrsSWXDQqr54pfVT+Ze cBtg== X-Received: by 10.28.55.138 with SMTP id e132mr11581529wma.86.1446459381056; Mon, 02 Nov 2015 02:16:21 -0800 (PST) Received: from cplx43.eu.thmulti.com ([141.11.62.7]) by smtp.gmail.com with ESMTPSA id e189sm17298743wma.4.2015.11.02.02.16.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 02 Nov 2015 02:16:20 -0800 (PST) From: Hans Dedecker To: openwrt-devel@lists.openwrt.org Date: Mon, 2 Nov 2015 11:16:10 +0100 Message-Id: <1446459372-19588-1-git-send-email-dedeckeh@gmail.com> X-Mailer: git-send-email 1.9.1 Cc: Hans Dedecker , cyrus@openwrt.org Subject: [OpenWrt-Devel] [PATCH 1/2 ubus] lua: Fix stack imbalance in ubus_event_handler X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: openwrt-devel-bounces@lists.openwrt.org Sender: "openwrt-devel" The value from getglobal wasn't being removed from the stack, resulting in an ever growing stack in the ubus event handler. Signed-off-by: Karl Vogel Signed-off-by: Hans Dedecker --- lua/ubus.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lua/ubus.c b/lua/ubus.c index a48fb7d..2903e7b 100644 --- a/lua/ubus.c +++ b/lua/ubus.c @@ -597,10 +597,13 @@ ubus_event_handler(struct ubus_context *ctx, struct ubus_event_handler *ev, lua_getglobal(state, "__ubus_cb_event"); lua_rawgeti(state, -1, listener->r); + lua_remove(state, -2); if (lua_isfunction(state, -1)) { ubus_lua_parse_blob_array(state, blob_data(msg), blob_len(msg), true); lua_call(state, 1, 0); + } else { + lua_pop(state, 1); } }