Received: by 2002:a25:b323:0:0:0:0:0 with SMTP id l35csp1052474ybj; Fri, 20 Sep 2019 04:25:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqy0UcUcLkbLov1JCuWyUd0anC4HReRIF3TK3N+xLH8ohnvkxxoS4hszkV7Y1oIgrdFryjeP X-Received: by 2002:a17:906:d8a9:: with SMTP id qc9mr17376533ejb.199.1568978749347; Fri, 20 Sep 2019 04:25:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568978749; cv=none; d=google.com; s=arc-20160816; b=A8aB34l0sp3JJQMCLAoX05LJIPzF3dwZrB2Bo7ITmnmAsjs/pq+iVbDqeYcBFx/enI l+1059WaJWGU/nP1b/G1/mm4KbR+LsBezXIyOpMH1RuYdq04YNOHNbY9FPiyFBnz6ucR VC1rcx4JsnjA+ZDGU00oCPru3NKxJis0hqU4aNZySJTblGJT4c+oYzkcxzvKdoEYVt2w B+IFPKnZe5Xf+xUYBPb1Ck1qRm3XHyCSUSV9qDbfm5jAPzjsPU7zlw2hD+7z9rATE18s Ky6l2g8+vmjZtoJcvU4RSj9gzsSUtr9Ae+R1bGPXlwSAHartmUavSWpqJhp2IluG4qqV +3eQ== 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=vXlyyyTAp1x1PWEglSCgbXMRM3C7lMW5Q/U2utLYPLs=; b=z0BcS9ZPXR5lFK3kzNve0rn/doWlvEiy1W86lEjo20j/X8sx67hMHhQYq1/HhwuLtz +wmJxZrjFdWRVdUD+oNGtzK4WThFy4pACBYxXePypB0BAaGLsSK+1LMiEyCsd8g1ulOe 8CP38QSalgUQcRBlFVBZVvvEhFo2Akdx0NKu+x3KCKOMCxOzG7vAgMwu7Brr2Z4lxBdA ic1sOvc7S7A7Ktzn2peNY4KYqSTzBLgxzB/PIN0KP+uCT3R35+zS4FQ3YKCQlJDcYA0/ aQGVAondedNK8LIrdS8HCgtQsDHrmiR/yDMMG7LRQRr5rNIC3gtZrr8fBXRVb8tASwCu TFwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Dagi1RAE; 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 m1si1163489edb.433.2019.09.20.04.25.25; Fri, 20 Sep 2019 04:25:49 -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=Dagi1RAE; 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 S2393779AbfISWOe (ORCPT + 99 others); Thu, 19 Sep 2019 18:14:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:54130 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2393769AbfISWOc (ORCPT ); Thu, 19 Sep 2019 18:14:32 -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 E42892196E; Thu, 19 Sep 2019 22:14:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1568931271; bh=WDvQUbKcJHAN78tC7rWq9WCVMyV4U0AuITSfOrmD5UQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Dagi1RAEI/jo9Yp3UxoZDFrY+Q9FgiprX4XBpcCckjFRm4YR0e7gX9RSJp/1SuqJ1 4+7IykRHh3dWlYW9h44tjn130y+lk81gq/1KgKUbcuDGDuIXDXmmVKg5/mpq66F94c fCWCQ4F1+04Grw2ytedxjQsbFRdbcHHpa8aXmx/g= 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 4.19 65/79] net: aquantia: fix out of memory condition on rx side Date: Fri, 20 Sep 2019 00:03:50 +0200 Message-Id: <20190919214813.375849733@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190919214807.612593061@linuxfoundation.org> References: <20190919214807.612593061@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 d335c334fa561..82582fa54d5d2 100644 --- a/drivers/net/ethernet/aquantia/atlantic/aq_vec.c +++ b/drivers/net/ethernet/aquantia/atlantic/aq_vec.c @@ -89,6 +89,7 @@ static int aq_vec_poll(struct napi_struct *napi, int budget) } } +err_exit: if (!was_tx_cleaned) work_done = budget; @@ -98,7 +99,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