[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAP6odjhmVEBghTUQ=N_fxs8rr5USkaDq-AG3=New6AkOVv_HAA@mail.gmail.com>
Date: Thu, 13 Jun 2013 15:26:14 -0700
From: Grant Grundler <grantgrundler@...il.com>
To: Neil Horman <nhorman@...driver.com>
Cc: "open list:TULIP NETWORK DRI..." <netdev@...r.kernel.org>,
Grant Grundler <grundler@...isc-linux.org>,
"David S. Miller" <davem@...emloft.net>
Subject: Re: [PATCH net] tulip: Properly check dma mapping result
On Thu, Jun 13, 2013 at 12:31 PM, Neil Horman <nhorman@...driver.com> wrote:
> Tulip throws an error when dma debugging is enabled, as it doesn't properly
> check dma mapping results with dma_mapping_error() durring tx ring refills.
>
> Easy fix, just add it in, and drop the frame if the mapping is bad
>
> Signed-off-by: Neil Horman <nhorman@...driver.com>
> CC: Grant Grundler <grundler@...isc-linux.org>
LGTM. thanks!
Reviewed-by: Grant Grundler <grundler@...isc-linux.org>
FYA: the original DMA mapping interface that was introduce in 2.4 did
not return errors. It would panic the system. The reasoning at the
time was (I'm paraphrasing): "Driver writers won't check the erorr or
handle it correctly so don't make it more complicated.
cheers,
grant
> CC: "David S. Miller" <davem@...emloft.net>
> ---
> drivers/net/ethernet/dec/tulip/interrupt.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/net/ethernet/dec/tulip/interrupt.c b/drivers/net/ethernet/dec/tulip/interrupt.c
> index 28a5e42..92306b3 100644
> --- a/drivers/net/ethernet/dec/tulip/interrupt.c
> +++ b/drivers/net/ethernet/dec/tulip/interrupt.c
> @@ -76,6 +76,12 @@ int tulip_refill_rx(struct net_device *dev)
>
> mapping = pci_map_single(tp->pdev, skb->data, PKT_BUF_SZ,
> PCI_DMA_FROMDEVICE);
> + if (dma_mapping_error(&tp->pdev->dev, mapping)) {
> + dev_kfree_skb(skb);
> + tp->rx_buffers[entry].skb = NULL;
> + break;
> + }
> +
> tp->rx_buffers[entry].mapping = mapping;
>
> tp->rx_ring[entry].buffer1 = cpu_to_le32(mapping);
> --
> 1.8.1.4
>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists