mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Miller <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
Date: Fri, 18 Dec 2015 21:36:07 -0500 (EST)	[thread overview]
Message-ID: <20151218.213607.1270121670262037282.davem@davemloft.net> (raw)
In-Reply-To: <1450475737-5959-1-git-send-email-khoroshilov@ispras.ru>

From: Alexey Khoroshilov <khoroshilov@ispras.ru>
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.

  reply	other threads:[~2015-12-19  2:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-18 21:55 Alexey Khoroshilov
2015-12-19  2:36 ` David Miller [this message]
2015-12-19 12:06   ` Alexey Khoroshilov
2015-12-19 12:13     ` [PATCH v2] " Alexey Khoroshilov
2015-12-19 17:59       ` David Miller
2015-12-19 17:54     ` [PATCH] " David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151218.213607.1270121670262037282.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=khoroshilov@ispras.ru \
    --cc=ldv-project@linuxtesting.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®