Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1596355

Re: [PATCH 3/7] net: stmmac: Check for DMA mapping errors

From Thierry Reding <thierry.reding@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH 3/7] net: stmmac: Check for DMA mapping errors
Date 2017-03-09 20:30 +0100
Message-ID <tjbV8-17u-23@gated-at.bofh.it> (permalink)
References <te5nj-4nQ-5@gated-at.bofh.it> <te5nj-4nQ-3@gated-at.bofh.it> <tfqSJ-4fZ-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

On Mon, Feb 27, 2017 at 11:37:24AM +0200, Mikko Perttunen wrote:
> On 23.02.2017 19:24, Thierry Reding wrote:
> > From: Thierry Reding <treding@nvidia.com>
> > 
> > When DMA mapping an SKB fragment, the mapping must be checked for
> > errors, otherwise the DMA debug code will complain upon unmap.
> > 
> > Signed-off-by: Thierry Reding <treding@nvidia.com>
> > ---
> >  drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> > index 6b7a5ce19589..d7387919bdb6 100644
> > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> > @@ -2072,6 +2072,8 @@ static netdev_tx_t stmmac_tso_xmit(struct sk_buff *skb, struct net_device *dev)
> >  		des = skb_frag_dma_map(priv->device, frag, 0,
> >  				       skb_frag_size(frag),
> >  				       DMA_TO_DEVICE);
> > +		if (dma_mapping_error(priv->device, des))
> > +			goto dma_map_err;
> 
> If this map fails, we should also unmap the previously mapped fragments and
> the separate mapping made using dma_map_single.

That's already taken care of via the dma_map_err label:

	dev_kfree_skb()
	  consume_skb()
	    __kfree_skb()
	      skb_release_all()
	        skb_release_data()

Thierry

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

Re: [PATCH 3/7] net: stmmac: Check for DMA mapping errors Thierry Reding <thierry.reding@gmail.com> - 2017-03-09 20:30 +0100

csiph-web