Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932627AbbLSCgK (ORCPT ); Fri, 18 Dec 2015 21:36:10 -0500 Received: from shards.monkeyblade.net ([149.20.54.216]:51066 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752523AbbLSCgJ (ORCPT ); Fri, 18 Dec 2015 21:36:09 -0500 Date: Fri, 18 Dec 2015 21:36:07 -0500 (EST) Message-Id: <20151218.213607.1270121670262037282.davem@davemloft.net> To: khoroshilov@ispras.ru Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, ldv-project@linuxtesting.org Subject: Re: [PATCH] natsemi: add checks for dma mapping errors From: David Miller In-Reply-To: <1450475737-5959-1-git-send-email-khoroshilov@ispras.ru> References: <1450475737-5959-1-git-send-email-khoroshilov@ispras.ru> X-Mailer: Mew version 6.7 on Emacs 24.5 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Fri, 18 Dec 2015 18:36:08 -0800 (PST) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 957 Lines: 24 From: Alexey Khoroshilov Date: Sat, 19 Dec 2015 00:55:37 +0300 > @@ -2093,6 +2099,10 @@ static netdev_tx_t start_tx(struct sk_buff *skb, struct net_device *dev) > np->tx_skbuff[entry] = skb; > np->tx_dma[entry] = pci_map_single(np->pci_dev, > skb->data,skb->len, PCI_DMA_TODEVICE); > + if (pci_dma_mapping_error(np->pci_dev, np->tx_dma[entry])) { > + np->tx_skbuff[entry] = NULL; > + return NETDEV_TX_BUSY; > + } > > np->tx_ring[entry].addr = cpu_to_le32(np->tx_dma[entry]); > Returning NETDEV_TX_BUSY and freeing the SKB will crash the system. NETDEV_TX_BUSY is only for buggy drivers that do not manage their TX ring busy condition correctly, and thus need retries. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/