Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp2222177imm; Thu, 18 Oct 2018 10:57:03 -0700 (PDT) X-Google-Smtp-Source: ACcGV630pNKkn5pNB/Y6R2GJfia/vXqEWtHD9SPaLYHab/04XofHl0bphdDoRWQ7ytw2qx0jpySe X-Received: by 2002:a63:6444:: with SMTP id y65-v6mr6241556pgb.205.1539885423388; Thu, 18 Oct 2018 10:57:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539885423; cv=none; d=google.com; s=arc-20160816; b=0S+T0UyPsgV1QkpMqGbY1Rb2Ra1fRjSE5JB6s/3BQZJ2fETJTnTnC2Snadujb2Mz7c 2MK8LSByuR69e2H0joKqmdibqKtxQy1uJhzaa3ljkHoFAYfQwsL3qP+mpPs67C/fe63o oRuiya9/niME1IR7GVVRKKkOwKxhhxIBNMhKsTr+v/X8KTqXBqgiOh7xXFiWmtH0o0xi 0+ioqjB/wxjlSHO6Gcdx4egxtlXuSQVvHVDKs3o6K03L9Y+GBVgFjN6y2jkwWzZ+Bi0/ Wj0p/MXjgcit5Yp81Hi1j5fzuEdFU5LpGWSOvaQ+TL72x9elYINJ59kLWwNhqNyRVqpb rycA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=c1695V7/jv7H0j22F+eO+oSl1a839+gLBF1NfVLnUAU=; b=juCB1gipuV9VFPAc4IcVn/23IPWOezEM8hx/vv209FmbV9k5wVV2X8Z6vIHa9DSvti 1DknrDu9cnXOvUD8F/jz+lIdO6RsXPQRHkfvouRs0/Z12wcHgZSE1oOMPCa09/gt6Wq/ DsnUzwAUedLIIeyRDgbxp04BB6pt1CHxC1y2VosSF883fYE/jDT7KNTnMh1teDesQWql yOIY0lVjaPbiwQZ8aJyBmmYuLe5Tsq/73vE/3PAoCQLGGvRykVOr8HSvuC5HB4cdZz1l lrfN/5THn9jDV3SMRf5GwD910TIFI8Wz4eGVErYagonAsfW66biTHJsheY5g57/MToi9 ogrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=btgMjyGj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 29-v6si21922863pgl.104.2018.10.18.10.56.48; Thu, 18 Oct 2018 10:57:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=btgMjyGj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728551AbeJSB6S (ORCPT + 99 others); Thu, 18 Oct 2018 21:58:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:46168 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727417AbeJSB6R (ORCPT ); Thu, 18 Oct 2018 21:58:17 -0400 Received: from localhost (ip-213-127-77-176.ip.prioritytelecom.net [213.127.77.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CDDB0214C2; Thu, 18 Oct 2018 17:56:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1539885373; bh=Jzdu7zUy3Phb6dMJpUsuIwC7HaPTCl5brA78+U3QoOY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=btgMjyGjtQ5cmSlYbov5Qnx+CZzIcH5Q9dlS43coDUtj761rX6yKF2i3mX0aXsrUR E3mcQVIcqA8mRK2nu5BrdyAGmECRMAw2xRM4952U+cMZm2QoRp9H9lEmDb0P7SD3E7 f2FsebhxdvSmTXvbHyl0/pk0YY31l0xVKCVnui98= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marek Lindner , Sven Eckelmann , Simon Wunderlich , Sasha Levin Subject: [PATCH 4.18 14/53] batman-adv: fix backbone_gw refcount on queue_work() failure Date: Thu, 18 Oct 2018 19:54:07 +0200 Message-Id: <20181018175419.365804476@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181018175416.561567978@linuxfoundation.org> References: <20181018175416.561567978@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Marek Lindner [ Upstream commit 5af96b9c59c72fb2af2d19c5cc2f3cdcee391dff ] The backbone_gw refcounter is to be decreased by the queued work and currently is never decreased if the queue_work() call fails. Fix by checking the queue_work() return value and decrease refcount if necessary. Signed-off-by: Marek Lindner Signed-off-by: Sven Eckelmann Signed-off-by: Simon Wunderlich Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- net/batman-adv/bridge_loop_avoidance.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) --- a/net/batman-adv/bridge_loop_avoidance.c +++ b/net/batman-adv/bridge_loop_avoidance.c @@ -1772,6 +1772,7 @@ batadv_bla_loopdetect_check(struct batad { struct batadv_bla_backbone_gw *backbone_gw; struct ethhdr *ethhdr; + bool ret; ethhdr = eth_hdr(skb); @@ -1795,8 +1796,13 @@ batadv_bla_loopdetect_check(struct batad if (unlikely(!backbone_gw)) return true; - queue_work(batadv_event_workqueue, &backbone_gw->report_work); - /* backbone_gw is unreferenced in the report work function function */ + ret = queue_work(batadv_event_workqueue, &backbone_gw->report_work); + + /* backbone_gw is unreferenced in the report work function function + * if queue_work() call was successful + */ + if (!ret) + batadv_backbone_gw_put(backbone_gw); return true; }