From patchwork Mon Dec 22 17:37:06 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Larry Finger X-Patchwork-Id: 5528621 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id EC7539F30B for ; Mon, 22 Dec 2014 17:38:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 15F842018E for ; Mon, 22 Dec 2014 17:38:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 35013201B4 for ; Mon, 22 Dec 2014 17:38:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755446AbaLVRiQ (ORCPT ); Mon, 22 Dec 2014 12:38:16 -0500 Received: from mail-ob0-f176.google.com ([209.85.214.176]:33204 "EHLO mail-ob0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755249AbaLVRiP (ORCPT ); Mon, 22 Dec 2014 12:38:15 -0500 Received: by mail-ob0-f176.google.com with SMTP id vb8so22100733obc.7; Mon, 22 Dec 2014 09:38:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id; bh=lDodBZa3keRgLDOTTD0ROE9QmVgBreewXOhnc73Dxg8=; b=smdHitPIekNFDr/FfRYSyrX9BQASNiy3krgRTSupuNnd1IxShVXZACipWHt1gDoww1 gq+f8UuTC8aDZv7BBZQAR6feN2PfaIWIs+Xylgvp6ot0xGL0fo2irIhi4HMGpbcKASAb HtNZvsVSQVGnIwWkPzsrNosLGk/g02eXMcojbEBtrLznQsWFjXno7ydHDzcT5aCXzEd8 WdmAXqNVZMcIabatYcxyD5nHaImqzJkBrjdRgIz/phMJDgV83YPToZ5f3pIS4EWwvR7w dSjYSEZ+7at5v7nImzAWkbLtlyABHvWpx/wiSxATr8cLXMXXht5h0w14DiJKDWigDZgb P1sw== X-Received: by 10.182.1.172 with SMTP id 12mr13864277obn.6.1419269894750; Mon, 22 Dec 2014 09:38:14 -0800 (PST) Received: from linux.site ([69.76.245.152]) by mx.google.com with ESMTPSA id vx15sm8921930oeb.6.2014.12.22.09.38.13 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 22 Dec 2014 09:38:14 -0800 (PST) From: Larry Finger To: kvalo@codeaurora.org Cc: linux-wireless@vger.kernel.org, Larry Finger , netdev@vger.kernel.org, Eric Biggers , Stable Subject: [PATCH for 3.19] rtlwifi: Fix error when accessing unmapped memory in skb Date: Mon, 22 Dec 2014 11:37:06 -0600 Message-Id: <1419269826-12552-1-git-send-email-Larry.Finger@lwfinger.net> X-Mailer: git-send-email 2.1.2 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY, URIBL_BLACK autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Under heavy memory pressure, it is possible for the allocation of a new skb to fail. When this happens, the kernel gets a memory access violation. Previous versions of the drivers would drop the read request; however, this logic was missed in the 3.18 update. This patch restores the previous behavior. Reported-by: Eric Biggers Signed-off-by: Larry Finger Cc: Eric Biggers Cc: Stable [3.18] --- drivers/net/wireless/rtlwifi/pci.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/rtlwifi/pci.c b/drivers/net/wireless/rtlwifi/pci.c index 846a2e6..55334ca 100644 --- a/drivers/net/wireless/rtlwifi/pci.c +++ b/drivers/net/wireless/rtlwifi/pci.c @@ -912,13 +912,15 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw) } end: if (rtlpriv->use_new_trx_flow) { - _rtl_pci_init_one_rxdesc(hw, (u8 *)buffer_desc, - rxring_idx, - rtlpci->rx_ring[rxring_idx].idx); + if (!_rtl_pci_init_one_rxdesc(hw, (u8 *)buffer_desc, + rxring_idx, + rtlpci->rx_ring[rxring_idx].idx)) + return; } else { - _rtl_pci_init_one_rxdesc(hw, (u8 *)pdesc, rxring_idx, - rtlpci->rx_ring[rxring_idx].idx); - + if (!_rtl_pci_init_one_rxdesc(hw, (u8 *)pdesc, + rxring_idx, + rtlpci->rx_ring[rxring_idx].idx)) + return; if (rtlpci->rx_ring[rxring_idx].idx == rtlpci->rxringcount - 1) rtlpriv->cfg->ops->set_desc(hw, (u8 *)pdesc,