Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp759270ybl; Wed, 4 Dec 2019 10:22:30 -0800 (PST) X-Google-Smtp-Source: APXvYqzYtaFe/jNc7qU6X2lKe6nePbsYpTbt6x7IgaIPzs2WwPR6vEyQruLnGBMnPiBLxJe+MQmT X-Received: by 2002:a05:6808:687:: with SMTP id k7mr3873273oig.115.1575483750119; Wed, 04 Dec 2019 10:22:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575483750; cv=none; d=google.com; s=arc-20160816; b=GQq/h129oj+B5r8YFCXHoF6zzLx+WnxpR5/ridY59idYMHQeSJTnvV0tG+9te+YDvQ Ovcz2N1kbgpOZbUH4bMf/cRzE2lMWfqE7RQRjq6TfxG+o9BPbHZnnpuSr/cVZiezdGN4 GDfKLIYp0RrTHKrUAz3ZhV86I2PMnmnb39Zgfe396ubEBM8HoWwq5HYGMD6u1kiD2zXr XWNi80Wj1iMXBeIuwoXt5/vni9a1ZnxVR6p7iYp7HADboZ6vy+IE/FywVpmv8qvF2wuZ TcF92ugeOYU1CXt9+qialyg7Bqb+TWxhg5LIbNADr+zqvLFTxDYuWT38rPWEnxryIX31 +nyg== 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=VUta2D+WwcrvNbaGKkDAGoHuEfNl7uqKMp3ltssurgM=; b=0/+TeF5eFrkzcwLoh0y1acWHc2eMB66bEH9uXC5RnbVwxdhSf5qcRSe3dbaQL+zE5r 9lwVly5PSCP6s38UJyzBat56neqT1yXEN1TenTGbCpIss+Rzg0RMDR0y7ssYD2UNt19q 4o52wX0lxToBvskD3l9rsOtPZxCyQgVg1R97onvIYZsmZ9HdYADxfCZr9QRjfub6UvxG Mh3G6zGLxuxRBghloCG2vth2RdPsPd71/9B9fscdMcSMApeT8TNrfmKkodBN3lSqPyYi fbOFc5PPivwKE/YT9ihIYyWnEOZxk3z/cGG5bCBrvpbT/g0BPGAn+fW47M8w8TqOP4F7 8TlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="Hqj/ZVFv"; 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 f17si3733919otq.96.2019.12.04.10.22.16; Wed, 04 Dec 2019 10:22:30 -0800 (PST) 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="Hqj/ZVFv"; 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 S1730840AbfLDSH6 (ORCPT + 99 others); Wed, 4 Dec 2019 13:07:58 -0500 Received: from mail.kernel.org ([198.145.29.99]:58892 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730832AbfLDSH5 (ORCPT ); Wed, 4 Dec 2019 13:07:57 -0500 Received: from localhost (unknown [217.68.49.72]) (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 0F8D620674; Wed, 4 Dec 2019 18:07:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575482876; bh=GYUwYBLbPvTeBue7pRSHLIh9EK/b9Y9ty9FB+eIcFBk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Hqj/ZVFvk+vquW9On5F4dzofi04NpYUrBam8CwXi7xoX078LBa02iM88+c+LRgrJJ /WfhX0GPBve2P8gtihaMqRIuNyvftLl4/59NBcgMY7M4Y4JJ7GlenUpG/5q+EKbir/ /FdUVXSQ+cTBl9YTZJoF4YpHefCaaHY6qZ5HSzW0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Menglong Dong , "David S. Miller" Subject: [PATCH 4.14 169/209] macvlan: schedule bc_work even if error Date: Wed, 4 Dec 2019 18:56:21 +0100 Message-Id: <20191204175335.116295557@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191204175321.609072813@linuxfoundation.org> References: <20191204175321.609072813@linuxfoundation.org> User-Agent: quilt/0.66 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 From: Menglong Dong [ Upstream commit 1d7ea55668878bb350979c377fc72509dd6f5b21 ] While enqueueing a broadcast skb to port->bc_queue, schedule_work() is called to add port->bc_work, which processes the skbs in bc_queue, to "events" work queue. If port->bc_queue is full, the skb will be discarded and schedule_work(&port->bc_work) won't be called. However, if port->bc_queue is full and port->bc_work is not running or pending, port->bc_queue will keep full and schedule_work() won't be called any more, and all broadcast skbs to macvlan will be discarded. This case can happen: macvlan_process_broadcast() is the pending function of port->bc_work, it moves all the skbs in port->bc_queue to the queue "list", and processes the skbs in "list". During this, new skbs will keep being added to port->bc_queue in macvlan_broadcast_enqueue(), and port->bc_queue may already full when macvlan_process_broadcast() return. This may happen, especially when there are a lot of real-time threads and the process is preempted. Fix this by calling schedule_work(&port->bc_work) even if port->bc_work is full in macvlan_broadcast_enqueue(). Fixes: 412ca1550cbe ("macvlan: Move broadcasts into a work queue") Signed-off-by: Menglong Dong Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/macvlan.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/net/macvlan.c +++ b/drivers/net/macvlan.c @@ -363,10 +363,11 @@ static void macvlan_broadcast_enqueue(st } spin_unlock(&port->bc_queue.lock); + schedule_work(&port->bc_work); + if (err) goto free_nskb; - schedule_work(&port->bc_work); return; free_nskb: