Received: by 2002:a25:b323:0:0:0:0:0 with SMTP id l35csp960476ybj; Fri, 20 Sep 2019 02:50:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqyhTTBkra/dT4dWb/8RjWgQRvZrlXfs4Mbh3PkLv+gHACRPltRz+31fF0D7c5nQBHQbTtEm X-Received: by 2002:a17:906:1659:: with SMTP id n25mr18791416ejd.258.1568973002394; Fri, 20 Sep 2019 02:50:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568973002; cv=none; d=google.com; s=arc-20160816; b=rx864D4gpCbz5CFvJn7Fj5YTBK5ziYY/g94yYrG/nK7CnMHbNbAPPAURr5jJk034I5 7cl5cSBdB73/Mj2Oi6P7fuMZB0pUwKwqjZ5K+5BH4UOjQN4Ce4BkZF9s7d9FwBbH/WST PJ/puX6DUJktok/qA6Yh4CkewrjlrfxrDLBirvp1sQu9T66CDVQlWE0Djrx5UFHDi4zC DqSEb3KDGdf20fvHRXdXyiP2QXmqlaEYgIf9mA/pxLrB1ZtunfDqm6WPnn+SUDyMg6DD sW+vTIZwhlsBN9Jm46kFATuRmwstR1O1wFkW+G2kZPaCZ0HoY6wdH6pcY6BZiWsgF6HZ zC3Q== 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=ar1T4gzRJeBj1mim11iu9GEMFkEMsoI6IGPNp0QUcWs=; b=PSL/1oPq+Ej/Sec0t2z1WH3xfUsD7xP8V94zkS2z39FVW0Tfts3Wxgk96BmEJeRfYZ Vf0+N25VoTwlltDrYz7QiwuFmJXyJpMb7gGzyDO+omwNub5965f356t7542YZO1TQCYd ri0qtMQhnccgJdqLRK/TB4fJUe/vpL22CPj0YTiUNv/hLWUh3H7OomQGu8Mzb18wVxD/ 3iYcMYXeB0hiQZQnY2vlVX4iiXbKQWXJaR/6AMRq9OUntEmU2xi5gJRjy0oyIfdYcu+m NmotodvyhDpaHmSFHVXkN+EzZzzPFSOQi9+MtemjXeoOC1Dvc0llqkmSU4ZY3JMmaMfs nU7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=sQTUqJb1; 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 n6si733469ejj.232.2019.09.20.02.49.38; Fri, 20 Sep 2019 02:50:02 -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=sQTUqJb1; 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 S2405849AbfISWL1 (ORCPT + 99 others); Thu, 19 Sep 2019 18:11:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:50094 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2393587AbfISWLZ (ORCPT ); Thu, 19 Sep 2019 18:11:25 -0400 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 6D5BA21907; Thu, 19 Sep 2019 22:11:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1568931084; bh=HaJIQUt1q4yjUOn3fBZcxEDzdsuOckbpaxjgOjv2+7k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sQTUqJb1ys9BOABweHm2WY89EHZpVgZfnQkgU2kyf2mN3Z9hp13zloI42CZQ/zhwa kZT9ICgT9FQeEE3k0pd4NTlInonOQatwXjkVYdN5FCdK7jmkHakznS2li+5B/LKO0Z a67O85HOy/wieQCKkKZRJ5Jre6ffOvw64wIia1wc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Igor Russkikh , Dmitry Bogdanov , "David S. Miller" , Sasha Levin Subject: [PATCH 5.2 105/124] net: aquantia: fix out of memory condition on rx side Date: Fri, 20 Sep 2019 00:03:13 +0200 Message-Id: <20190919214823.020732439@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190919214819.198419517@linuxfoundation.org> References: <20190919214819.198419517@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: Dmitry Bogdanov [ Upstream commit be6cef69ba570ebb327eba1ef6438f7af49aaf86 ] On embedded environments with hard memory limits it is a normal although rare case when skb can't be allocated on rx part under high traffic. In such OOM cases napi_complete_done() was not called. So the napi object became in an invalid state like it is "scheduled". Kernel do not re-schedules the poll of that napi object. Consequently, kernel can not remove that object the system hangs on `ifconfig down` waiting for a poll. We are fixing this by gracefully closing napi poll routine with correct invocation of napi_complete_done. This was reproduced with artificially failing the allocation of skb to simulate an "out of memory" error case and check that traffic does not get stuck. Fixes: 970a2e9864b0 ("net: ethernet: aquantia: Vector operations") Signed-off-by: Igor Russkikh Signed-off-by: Dmitry Bogdanov Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/aquantia/atlantic/aq_vec.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_vec.c b/drivers/net/ethernet/aquantia/atlantic/aq_vec.c index 715685aa48c39..28892b8acd0e1 100644 --- a/drivers/net/ethernet/aquantia/atlantic/aq_vec.c +++ b/drivers/net/ethernet/aquantia/atlantic/aq_vec.c @@ -86,6 +86,7 @@ static int aq_vec_poll(struct napi_struct *napi, int budget) } } +err_exit: if (!was_tx_cleaned) work_done = budget; @@ -95,7 +96,7 @@ static int aq_vec_poll(struct napi_struct *napi, int budget) 1U << self->aq_ring_param.vec_idx); } } -err_exit: + return work_done; } -- 2.20.1