Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1939572ybl; Tue, 3 Dec 2019 15:20:46 -0800 (PST) X-Google-Smtp-Source: APXvYqxnkVpqgMMhufjOdQe6R/H144YhkFeyvOe1kQwZkyT5Jp7mSN0dLDgrQQ2MJsmXN1RqTVJu X-Received: by 2002:a05:6830:130d:: with SMTP id p13mr337514otq.161.1575415246241; Tue, 03 Dec 2019 15:20:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575415246; cv=none; d=google.com; s=arc-20160816; b=gG+w+z40DrbmXw7yfbWlecbhO/xHIzoUQkZmgmRXvBaSRr80dThCPTJg77rMbYIBlS q0UId7+Y9oF1x59l0UjfbKJ876nYrreGIqm2LR32mIBgDWf+7+ZVZEFojMjjUPGRWkrX u/OjdUlxGSFxZgLuFH6RjSWmoU2Tf3rqSDUe81q4POyj6xVr9vJ7RAfK8VcpE9p+l2Ad CRuBnDxPMskYZtffQeBhvQkmLPCIJHBPvwPD/d96LYksBIxwMIBxBBI1RMifQgJm33ED Ak43As/bQ8pgJTWsniiyQlarl9Ccc8wMQ2S7voHLRj0gSBc02TznaThEoogxsYDhkgGu M9Iw== 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=CNEleuze/DiCzaHS1yaV5eNhjt/w9dgWCTsUhCRwQ/U=; b=QZ8ijcapCBtr0XNSgXYbMQ5YweIW3NqKiNYvZkdwD5sNx3lW9XBCEN4n1GBiIj4m6U SZszGCWEfoL1bzD10Ympv9mHb61/n9kBAFBHtxDYE7oM9ZaRkfUCwWGoKrMtD1r7+wqj 3eoGqo252QkrRntsVu7C8Fykcxng3dj9igZptcSbjBUp4KVrDfQ9PTrjFqx8VNzySfgc 7T5WKQXfyTrydYlJ3MrBjC/aKN36TC+V6dtop+9Zk8QOsamcqquTPxjFjwWkh9+uSPhv b2h+UTCYzj73nZAglcbJRiNMskPZLGog7iJlJWlrigDKn6MltHz5y1xLvlUXaH2pgGqd Cy9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=1vZRE1lx; 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 o8si2406121oti.47.2019.12.03.15.20.33; Tue, 03 Dec 2019 15:20:46 -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=1vZRE1lx; 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 S1728196AbfLCWjX (ORCPT + 99 others); Tue, 3 Dec 2019 17:39:23 -0500 Received: from mail.kernel.org ([198.145.29.99]:49390 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727836AbfLCWjV (ORCPT ); Tue, 3 Dec 2019 17:39:21 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 3EC5F2084F; Tue, 3 Dec 2019 22:39:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575412760; bh=o2kukSFFfU0mbQWuJGg0mw6F6cIceRtU2S4LX75rTso=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1vZRE1lxwufewIgVTxLwyx4G0Zchq7TdzMECJlDzClZvyh+jATbe95XIyUPYJbuof 53dzIQEJO9jzR9Xu74vh0Zo594uV+4ylarL0tNkPLq2ZIWjIBDUq093xJroNEC1Xtk eZaBv/8TxFXWXpUmZnF0nbxHC9TJho2+FhoxYQxc= 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 5.4 17/46] macvlan: schedule bc_work even if error Date: Tue, 3 Dec 2019 23:35:37 +0100 Message-Id: <20191203212733.796192448@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191203212705.175425505@linuxfoundation.org> References: <20191203212705.175425505@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 @@ -359,10 +359,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: