All of lore.kernel.org
 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: Sat, 19 Dec 2015 12:54:33 -0500 (EST)	[thread overview]
Message-ID: <20151219.125433.148505706922863925.davem@davemloft.net> (raw)
In-Reply-To: <56754855.6080808@ispras.ru>

From: Alexey Khoroshilov <khoroshilov@ispras.ru>
Date: Sat, 19 Dec 2015 15:06:45 +0300

> On 19.12.2015 05:36, David Miller wrote:
>> 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.
> 
> I do not quite understand what do you mean by 'freeing the SKB'.
> At least the patch left skb untouched.

Sorry, I misread your patch, I thought I saw a kfree there but
obviously there isn't.

>> NETDEV_TX_BUSY is only for buggy drivers that do not manage their
>> TX ring busy condition correctly, and thus need retries.
> 
> Ok, I will replace NETDEV_TX_BUSY by dropping the packet.

Thanks.

      parent reply	other threads:[~2015-12-19 17:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-18 21:55 [PATCH] natsemi: add checks for dma mapping errors Alexey Khoroshilov
2015-12-19  2:36 ` David Miller
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     ` David Miller [this message]

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=20151219.125433.148505706922863925.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.