Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp3731023imm; Mon, 8 Oct 2018 08:38:25 -0700 (PDT) X-Google-Smtp-Source: ACcGV63EKzJ9ebOJs78XzuHuk+YktUEITIDEPvi4Qr3W969oz4MlCklnXgVSFLOpLM0trwYi7rWe X-Received: by 2002:a17:902:6501:: with SMTP id b1-v6mr24677732plk.31.1539013105705; Mon, 08 Oct 2018 08:38:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539013105; cv=none; d=google.com; s=arc-20160816; b=W5/EcZ+aG7lxi+Hfot99ANZdee52T8WjronUfE7VT79oElXHTlyEpju2NlcIyir0ZB R2AKh4SeN9qbGSgWGPmKO+9CuVOibPx/yNWfD0SMPM1oeHrapcEFTsUqjKjG3SHafzo1 cavb5hO3d0peBcZ8t4w9kEfgAGLjioWWyTf2j4xhxTmsStTxE5aSvLDHPzviJOSBsy06 fKr5ae7wFmE0GvGl/QSWT8K2Pwjj2jMyQf32QsRHMauJisyKyw1ZRNzevstwxfYWw7pg y3J8msVNsfdk6J9Q2hhy+QaRAYS3FajQ/7/GmmrrofRR1/pbjFvnJ9RlKcl6CjbD4j6C 2V1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=gG/sEf1f1085otx7zXnIPHcBXSwiWDtp5uzzz32KNY4=; b=zxCIRurAXXIXYRbXK2p6ie8Z7GVDcdOpfaSzAf7RgNtTlbKLrIhdv939TGzqXuQ+fl 9tvQXmknQe0yJvtTBdbhO8/6ZbsfCPrKPHsytwzBiTdUarEWi4raiF5moqqpJdbGFn6X 6UEYGTQQfGtL2+ZLcOCo/A3ZYcb+LeOstnnclKV0z82TNvsFexOcH4Q+z3GMOk4iavy/ Z/fI05PmwtNVIGdodp/rChuxvZ6vjvBQSpO/UjRnzmwcRA0paeJI1iLCqX9cNoUfVOqY kKO3GA8sQBQQNHHDN8ZVC+2bvD7YIdJ4Tr9axjvakg5SknU0x346g82V54lw3anIdIrL 9h8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=nr88Ai9y; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x36-v6si1386843pgl.520.2018.10.08.08.38.10; Mon, 08 Oct 2018 08:38:25 -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=nr88Ai9y; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727584AbeJHWuP (ORCPT + 99 others); Mon, 8 Oct 2018 18:50:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:56054 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726679AbeJHWh4 (ORCPT ); Mon, 8 Oct 2018 18:37:56 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C4F8D214C5; Mon, 8 Oct 2018 15:25:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1539012341; bh=vJWPjeWltJg0fFi6bskHxlsFM7buiGZcZqiw49b+wB0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nr88Ai9yKXgQ9VTqbzDZTG0Hsum6FsBRyTSJxqFqTZ4PIGTnFF61xitbZPTP1QraB FZ/UmyJe+PCGMJuQNGJ6DIc5XqYh8wkOsBHzhxmQBy/zpNvf+MOuyweI1qJiwjadnS q0852cfX3WZWVe1YaHIRM638UF0R8SqOusvem6gE= From: Sasha Levin To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Marek Lindner , Sven Eckelmann , Simon Wunderlich , Sasha Levin Subject: [PATCH AUTOSEL 4.18 15/58] batman-adv: fix hardif_neigh refcount on queue_work() failure Date: Mon, 8 Oct 2018 11:24:40 -0400 Message-Id: <20181008152523.70705-15-sashal@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181008152523.70705-1-sashal@kernel.org> References: <20181008152523.70705-1-sashal@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- net/batman-adv/bat_v_elp.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/net/batman-adv/bat_v_elp.c b/net/batman-adv/bat_v_elp.c index e103c759b7ab..9f481cfdf77d 100644 --- 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(struct work_struct *work) 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(struct work_struct *work) * 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(); -- 2.17.1