From: Kulikov Vasiliy <segooon@gmail.com>
To: dkirjanov@kernel.org
Cc: Kernel Janitors <kernel-janitors@vger.kernel.org>,
"David S. Miller" <davem@davemloft.net>,
John Linn <john.linn@xilinx.com>,
Grant Likely <grant.likely@secretlab.ca>,
Jiri Pirko <jpirko@redhat.com>,
Brian Hill <brian.hill@xilinx.com>,
netdev@vger.kernel.org
Subject: Re: [PATCH 3/4] ll_temac: free everything on error path
Date: Thu, 08 Jul 2010 14:24:20 +0000 [thread overview]
Message-ID: <20100708142418.GA30052@shinshilla> (raw)
In-Reply-To: <AANLkTilMaITOMsn_9MmZ7-zHwpvTd2ZYjj4UUWOloYsn@mail.gmail.com>
> I just sent a patch that fixes this.
Hey, you forgot to CC me/kernel-janitors in your patch.
Anyway,
> /**
>+ * * temac_dma_bd_release - Release buffer descriptor rings
>+ */
>+static void temac_dma_bd_release(struct net_device *ndev)
>+{
>+ struct temac_local *lp = netdev_priv(ndev);
>+ int i;
>+
>+ for (i = 0; i < RX_BD_NUM; i++) {
>+ if (lp->rx_skb[i]) {
^^^^^^^^^^
This can be NULL if kzalloc() failed.
>+ dma_unmap_single(ndev->dev.parent, lp->rx_bd_v[i].phys,
>+ XTE_MAX_JUMBO_FRAME_SIZE, DMA_FROM_DEVICE);
>+ dev_kfree_skb(lp->rx_skb[i]);
>+ }
>+ }
>+ dma_free_coherent(ndev->dev.parent, sizeof(*lp->rx_bd_v) * RX_BD_NUM,
>+ lp->rx_bd_v, lp->rx_bd_p);
>+ dma_free_coherent(ndev->dev.parent, sizeof(*lp->tx_bd_v) * TX_BD_NUM,
>+ lp->tx_bd_v, lp->tx_bd_p);
These two DMA's can be unallocated if dma_alloc_coherent() failed.
I wanted to introduce many labels to divide these error cases because of it.
>+ kfree(lp->rx_skb);
>+}
next prev parent reply other threads:[~2010-07-08 14:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-08 12:10 [PATCH 3/4] ll_temac: free everything on error path Kulikov Vasiliy
2010-07-08 13:16 ` Denis Kirjanov
2010-07-08 13:46 ` Kulikov Vasiliy
2010-07-08 13:56 ` Denis Kirjanov
2010-07-08 14:24 ` Kulikov Vasiliy [this message]
2010-07-10 7:30 ` [PATCH 3/4 v3] ll_temac: fix DMA and memory leaks Kulikov Vasiliy
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=20100708142418.GA30052@shinshilla \
--to=segooon@gmail.com \
--cc=brian.hill@xilinx.com \
--cc=davem@davemloft.net \
--cc=dkirjanov@kernel.org \
--cc=grant.likely@secretlab.ca \
--cc=john.linn@xilinx.com \
--cc=jpirko@redhat.com \
--cc=kernel-janitors@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