All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Rafał Miłecki" <zajec5@gmail.com>
To: Felix Fietkau <nbd@openwrt.org>
Cc: Network Development <netdev@vger.kernel.org>,
	Hauke Mehrtens <hauke@hauke-m.de>
Subject: Re: [PATCH v6 4/9] bgmac: simplify/optimize rx DMA error handling
Date: Tue, 14 Apr 2015 11:19:10 +0200	[thread overview]
Message-ID: <CACna6rz-b2TXMPpPdRCiyS45mfZ2pgLRNiCyPpd4XLVDfwfbEA@mail.gmail.com> (raw)
In-Reply-To: <552CDA4D.6080702@openwrt.org>

On 14 April 2015 at 11:13, Felix Fietkau <nbd@openwrt.org> wrote:
> On 2015-04-14 07:55, Rafał Miłecki wrote:
>> On 14 April 2015 at 01:42, Felix Fietkau <nbd@openwrt.org> wrote:
>>> @@ -528,14 +524,14 @@ static void bgmac_dma_rx_ring_free(struct bgmac *bgmac,
>>>
>>>         for (i = 0; i < ring->num_slots; i++) {
>>>                 slot = &ring->slots[i];
>>> -               if (!slot->buf)
>>> +               if (!slot->dma_addr)
>>>                         continue;
>>
>> I think it breaks error path of bgmac_dma_alloc. It may happen that
>> during DMA alloc we alloc skb and then we fail to map it. In such case
>> buf should be freed. Please trace how bgmac_dma_free is used in
>> bgmac_dma_alloc.
> I don't think so: bgmac_dma_rx_skb_for_slot handles both buffer
> allocation and dma mapping. If dma mapping fails, the buffer is freed
> before any part of the slot is overwritten.

Oops, I think I just spotted a memory leak then.

If bgmac_dma_rx_skb_for_slot fails to do DMA mapping it returns an
error without freeing a skb.

-- 
Rafał

  reply	other threads:[~2015-04-14  9:19 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-13 23:42 [PATCH v6 1/9] bgmac: simplify tx ring index handling Felix Fietkau
2015-04-13 23:42 ` [PATCH v6 2/9] bgmac: leave interrupts disabled as long as there is work to do Felix Fietkau
2015-04-14  5:40   ` Rafał Miłecki
2015-04-13 23:42 ` [PATCH v6 3/9] bgmac: set received skb headroom to NET_SKB_PAD Felix Fietkau
2015-04-13 23:42 ` [PATCH v6 4/9] bgmac: simplify/optimize rx DMA error handling Felix Fietkau
2015-04-14  5:55   ` Rafał Miłecki
2015-04-14  9:13     ` Felix Fietkau
2015-04-14  9:19       ` Rafał Miłecki [this message]
2015-04-14  9:26         ` Felix Fietkau
2015-04-14  9:32           ` Rafał Miłecki
2015-04-14  9:37           ` Rafał Miłecki
2015-04-13 23:42 ` [PATCH v6 5/9] bgmac: add check for oversized packets Felix Fietkau
2015-04-14  5:56   ` Rafał Miłecki
2015-04-13 23:42 ` [PATCH v6 6/9] bgmac: increase rx ring size from 511 to 512 Felix Fietkau
2015-04-14  5:57   ` Rafał Miłecki
2015-04-13 23:42 ` [PATCH v6 7/9] bgmac: simplify dma init/cleanup Felix Fietkau
2015-04-14  7:24   ` Rafał Miłecki
2015-04-13 23:42 ` [PATCH v6 8/9] bgmac: fix DMA rx corruption Felix Fietkau
2015-04-13 23:42 ` [PATCH v6 9/9] bgmac: drop ring->num_slots Felix Fietkau
2015-04-14  6:38   ` Rafał Miłecki
2015-04-14  5:38 ` [PATCH v6 1/9] bgmac: simplify tx ring index handling Rafał Miłecki

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=CACna6rz-b2TXMPpPdRCiyS45mfZ2pgLRNiCyPpd4XLVDfwfbEA@mail.gmail.com \
    --to=zajec5@gmail.com \
    --cc=hauke@hauke-m.de \
    --cc=nbd@openwrt.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.