Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp2222271imm; Thu, 18 Oct 2018 10:57:09 -0700 (PDT) X-Google-Smtp-Source: ACcGV633kzKOJx+13rLlf2FOeKq13MBkJhg9WmIdN/XVxyxibLqXK/7S3GdY9Y/KjQpEpRDe1LsF X-Received: by 2002:a62:3995:: with SMTP id u21-v6mr31666170pfj.116.1539885429401; Thu, 18 Oct 2018 10:57:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539885429; cv=none; d=google.com; s=arc-20160816; b=ddBFvFdu0qGkP3mDB1cJKZEydc4KVJgGXOyn4DjUw4z2cKFj9UautTm6iGkY0P4ZZA O9D15ufuYeeHgrTQViuDhmxbnD60M9voC8A3ST4RvjG7quUS6twMtPqkViYgzX7vpbIU tVHIJNYXFt7cv3mK6LoYaz/EQXQDzL888xZ0NONaUzqc5/FvWpRnABX63NlkCDBHEG7b 9gpUKYkGeerL47TiwvfXpHwmZOV1Giy3ggTcEuGXpIRI+eOkHg5z7Vjf+mQ5W/amdmsn rkzjP/E5EflFmbvlDl8OZmrzkzcMEhI61D/e7wZOVhkl9gW8B0xMOcT1rkmvKoWC1mXc MFoQ== 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=KeyJ4d5SDhdoFhAtUq9zSPEGzI8q7SRUFBgJachG94M=; b=UgWZEZI8nO3vmN74nOv5r9p1CVMSWq1ztJRtUhVdMELf2DXhvJamAosJfPhAIXZpme LPH8MtEIBUL9eWs+Ms3U4eTguYxa6lLb1quu1Du74uq5ojq0uFNhozCanjZ0kfcFS3x4 peSQGd5cvteQgomi/0pIXeVHw9XyaWYfkI2e5fhwMcG4DiSfS2McpdiJb4JnRnGQuqTj cJkECT6pfpioN42qdeY1BRjYfWPd2qKa/mE4mIwIOpHBPTwrVvVZx1uXGJQ6e9emGOJk zmAuOZL6JIlOGOOcFyVmXNjwWzBIXz0IwNtJfRh/b3jU511IPPrQU8dYhaJuzIOqkQsb pnZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=fGM7+VNF; 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 t1-v6si21795041pgi.439.2018.10.18.10.56.54; Thu, 18 Oct 2018 10:57:09 -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=fGM7+VNF; 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 S1728583AbeJSB6W (ORCPT + 99 others); Thu, 18 Oct 2018 21:58:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:46238 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728562AbeJSB6V (ORCPT ); Thu, 18 Oct 2018 21:58:21 -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 D37C3204FD; Thu, 18 Oct 2018 17:56:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1539885377; bh=YippU6/2OZcRJNEXCw0fPv0gSpZmLPYBSaSFOP7qlUA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fGM7+VNF2DNW4WlTg3X1CyUDrc1HNTnf93blwwx67EeO83uBXSPjt4/xG5/523nDj Kpug0cfE6PwkquulGubLrEJ/YZGodXXEw39tv71v2MOlxQT0XGB11muw+LCkuMlAPF /H/3Vznoa+cuQchTXG6Y51bMS8VsCu35R7KJLEpw= 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 15/53] batman-adv: fix hardif_neigh refcount on queue_work() failure Date: Thu, 18 Oct 2018 19:54:08 +0200 Message-Id: <20181018175419.604019557@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 4c4af6900844ab04c9434c972021d7b48610e06a ] The hardif_neigh 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/bat_v_elp.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- a/net/batman-adv/bat_v_elp.c +++ b/net/batman-adv/bat_v_elp.c @@ -268,6 +268,7 @@ static void batadv_v_elp_periodic_work(s struct batadv_priv *bat_priv; struct sk_buff *skb; u32 elp_interval; + bool ret; bat_v = container_of(work, struct batadv_hard_iface_bat_v, elp_wq.work); hard_iface = container_of(bat_v, struct batadv_hard_iface, bat_v); @@ -329,8 +330,11 @@ static void batadv_v_elp_periodic_work(s * may sleep and that is not allowed in an rcu protected * context. Therefore schedule a task for that. */ - queue_work(batadv_event_workqueue, - &hardif_neigh->bat_v.metric_work); + ret = queue_work(batadv_event_workqueue, + &hardif_neigh->bat_v.metric_work); + + if (!ret) + batadv_hardif_neigh_put(hardif_neigh); } rcu_read_unlock();