From: Don Fry <pcnet32@frontier.com>
To: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: davem@davemloft.net, netdev@vger.kernel.org
Subject: Re: [PATCH net-next 1/2] pcnet32: fix reallocation error
Date: Tue, 18 Feb 2014 20:58:55 -0800 [thread overview]
Message-ID: <1392785935.2570.16.camel@Linux> (raw)
In-Reply-To: <201402182129.BDD57369.FVOQHFOFtJSLOM@I-love.SAKURA.ne.jp>
-----Original Message-----
From: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Subject: Re: [PATCH net-next 1/2] pcnet32: fix reallocation error
Date: Tue, 18 Feb 2014 21:29:00 +0900
>Don Fry wrote:
>> pcnet32_realloc_rx_ring() only worked on the first log2 number of
>> entries in the receive ring instead of the all the entries.
>> Replaced "1 << size" with more descriptive variable.
>
>> /* first copy the current receive buffers */
>> - overlap = min(size, lp->rx_ring_size);
>> + overlap = min(entries, lp->rx_ring_size);
>
>> /* now allocate any new buffers needed */
>> - for (; new < size; new++) {
>> + for (; new < entries; new++) {
>>
>Until this fix, lp->rx_skbuff[size...(1<<size)-1] were not allocated by
>netdev_alloc_skb() and lp->rx_ring_dma_addr[size...(1<<size)-1] were not mapped
>by pci_map_single(), right?
>
>Since lp->rx_ring_size was set to (1<<size), wasn't there possibility that
>something bad happens by accessing lp->rx_skbuff[] and lp->rx_ring_dma_addr[]
>up to (1<<size)-1 ? (In other words, don't we want to backport this fix?)
>
I looked into this when testing. If the device is operational
(netif_running) when the ring is resized, it will do pcnet32_restart and
make sure all rx buffers are full. If the device is not operational it
will leave the ring partially full until it is opened and then the ring
is filled via pcnet32_init_ring(). Another thing that could happen
while it is down is that a selftest is done (offline) which also calls
pcnet32_restart and makes sure the ring is full. I could not find a
case that would cause a problem. No-one has reported this in the last 8
years so it does not look like backporting this fix is needed, in my
opinion.
next prev parent reply other threads:[~2014-02-19 4:59 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-18 4:57 [PATCH net-next 1/2] pcnet32: fix reallocation error Don Fry
2014-02-18 12:29 ` Tetsuo Handa
2014-02-19 4:58 ` Don Fry [this message]
2014-02-19 19:59 ` David Miller
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=1392785935.2570.16.camel@Linux \
--to=pcnet32@frontier.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=penguin-kernel@I-love.SAKURA.ne.jp \
/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;
as well as URLs for NNTP newsgroup(s).