Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753469AbdGMPnw (ORCPT ); Thu, 13 Jul 2017 11:43:52 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:38648 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753436AbdGMPnu (ORCPT ); Thu, 13 Jul 2017 11:43:50 -0400 From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Felix Fietkau , "David S. Miller" , Amit Pundir Subject: [PATCH 3.18 04/22] bgmac: add check for oversized packets Date: Thu, 13 Jul 2017 17:42:44 +0200 Message-Id: <20170713153934.317285073@linuxfoundation.org> X-Mailer: git-send-email 2.13.2 In-Reply-To: <20170713153934.089183081@linuxfoundation.org> References: <20170713153934.089183081@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: 1087 Lines: 38 3.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Felix Fietkau commit 6a6c708469c9e10fd87adcc3abff164270538d62 upstream. In very rare cases, the MAC can catch an internal buffer that is bigger than it's supposed to be. Instead of crashing the kernel, simply pass the buffer back to the hardware Signed-off-by: Felix Fietkau Signed-off-by: David S. Miller Signed-off-by: Amit Pundir Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/broadcom/bgmac.c | 7 +++++++ 1 file changed, 7 insertions(+) --- a/drivers/net/ethernet/broadcom/bgmac.c +++ b/drivers/net/ethernet/broadcom/bgmac.c @@ -373,6 +373,13 @@ static int bgmac_dma_rx_read(struct bgma break; } + if (len > BGMAC_RX_ALLOC_SIZE) { + bgmac_err(bgmac, "Found oversized packet at slot %d, DMA issue!\n", + ring->start); + put_page(virt_to_head_page(buf)); + break; + } + /* Omit CRC. */ len -= ETH_FCS_LEN;