Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752896AbbBYRvJ (ORCPT ); Wed, 25 Feb 2015 12:51:09 -0500 Received: from mail-wi0-f178.google.com ([209.85.212.178]:60105 "EHLO mail-wi0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752120AbbBYRvH (ORCPT ); Wed, 25 Feb 2015 12:51:07 -0500 From: Ameen Ali To: davem@davemloft.net Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Ameen Ali Subject: [PATCH 4/4] net/core/dev.c : Race condition in net_tx_action. Date: Wed, 25 Feb 2015 19:50:59 +0200 Message-Id: <1424886659-3641-1-git-send-email-ameenali023@gmail.com> X-Mailer: git-send-email 2.1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1382 Lines: 32 Transmitting asynchronously on all the network devices available we will notice the following behaviour: a) The instruction "if (sd->completion_queue) {" saves on a CPU register the pointer value (register contents is used for the comparison) b) The interupt is disabled (using "local_irq_disable") c) when the content of "clist" is updated, the register is used, instead of re-read the "completion_queue" variable. So, when a low-level tx interrupt arrives after the latching of "completion_queue", but before "local_irq_disable", the value stored in "clist" reflect the situation before low-level tx interrupt, resulting in a sk_buff leak --- net/core/dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/core/dev.c b/net/core/dev.c index 8f9710c..db3e59e 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -3413,7 +3413,7 @@ EXPORT_SYMBOL(netif_rx_ni); static void net_tx_action(struct softirq_action *h) { - struct softnet_data *sd = this_cpu_ptr(&softnet_data); + volatile struct softnet_data *sd = &__get_cpu_var(softnet_data); if (sd->completion_queue) { struct sk_buff *clist; -- 2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/