Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932416AbdCTSKU (ORCPT ); Mon, 20 Mar 2017 14:10:20 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:41202 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756896AbdCTSHi (ORCPT ); Mon, 20 Mar 2017 14:07:38 -0400 From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jeremy Linton , Tom Lendacky , "David S. Miller" Subject: [PATCH 4.10 38/63] amd-xgbe: Enable IRQs only if napi_complete_done() is true Date: Mon, 20 Mar 2017 18:52:03 +0100 Message-Id: <20170320174745.485991404@linuxfoundation.org> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20170320174742.712298584@linuxfoundation.org> References: <20170320174742.712298584@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1866 Lines: 52 4.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: "Lendacky, Thomas" [ Upstream commit d7aba644ffdebf756e51e26a2229055211838e89 ] Depending on the hardware, the amd-xgbe driver may use disable_irq_nosync() and enable_irq() when an interrupt is received to process Rx packets. If the napi_complete_done() return value isn't checked an unbalanced enable for the IRQ could result, generating a warning stack trace. Update the driver to only enable interrupts if napi_complete_done() returns true. Reported-by: Jeremy Linton Signed-off-by: Tom Lendacky Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/amd/xgbe/xgbe-drv.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) --- a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c +++ b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c @@ -2274,10 +2274,7 @@ static int xgbe_one_poll(struct napi_str processed = xgbe_rx_poll(channel, budget); /* If we processed everything, we are done */ - if (processed < budget) { - /* Turn off polling */ - napi_complete_done(napi, processed); - + if ((processed < budget) && napi_complete_done(napi, processed)) { /* Enable Tx and Rx interrupts */ if (pdata->channel_irq_mode) xgbe_enable_rx_tx_int(pdata, channel); @@ -2319,10 +2316,7 @@ static int xgbe_all_poll(struct napi_str } while ((processed < budget) && (processed != last_processed)); /* If we processed everything, we are done */ - if (processed < budget) { - /* Turn off polling */ - napi_complete_done(napi, processed); - + if ((processed < budget) && napi_complete_done(napi, processed)) { /* Enable Tx and Rx interrupts */ xgbe_enable_rx_tx_ints(pdata); }