linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kalle Valo <kvalo@codeaurora.org>
To: Alexey Khoroshilov <khoroshilov@ispras.ru>
Cc: Mike Looijmans <mike.looijmans@topic.nl>,
	linux-wireless@vger.kernel.org, fariyaf@gmail.com
Subject: Re: Commit "rsi: fix memory leak in rsi_load_ta_instructions()" breaks things
Date: Fri, 24 Jul 2015 19:59:08 +0300	[thread overview]
Message-ID: <871tfxcx0j.fsf@kamboji.qca.qualcomm.com> (raw)
In-Reply-To: <55B26728.1010804@ispras.ru> (Alexey Khoroshilov's message of "Fri, 24 Jul 2015 23:26:16 +0700")

Alexey Khoroshilov <khoroshilov@ispras.ru> writes:

> On 24.07.2015 21:12, Kalle Valo wrote:
>> Mike Looijmans <mike.looijmans@topic.nl> writes:
>> 

>>> Just read some documentation:
>>> https://kernel.org/doc/Documentation/firmware_class/README
>>> It states "kernel: grows a buffer in PAGE_SIZE increments to hold the
>>> image as it comes in". Probably the firmware buffer is fragmented in
>>> memory as a result, and that wouldn't be very DMA friendly indeed. The
>>> copy would be contiguous again.
>
> Interesting idea. Even fw_get_filesystem_firmware() uses vmalloc(), so
> fw_entry->data may be physically noncontiguous in case of reading
> firmware from file system as well.
>
> The only my doubt is whether contiguous memory is required here. As far
> as I can see, rsi_copy_to_card() writes data by blocks of size
> dev->tx_blk_size that is 256 for rsi_91x_sdio. So, it is not clear where
> problems can appear.

You cannot DMA from memory allocated with vmalloc(). So kmalloc() & co
has to be used when doing DMA.

>>> I can submit a patch to add the "kfree()" call. Don't know about the
>>> revert though, can I just submit the revert as a patch and then the
>>> "kfree" as a second patch in the same set?
>> 
>> Better to do the revert and kfree() addition in one patch, they are
>> simple enough. Just document in the commit log that it reverts the
>> broken commit.
>> 
>> And remember to add CC stable to the commit log so that the fix goes to
>> stable releases.
>
> Agree with Kalle with a couple of notes.
>
> To document a fix of a broken commit the preferable way is to use Fixes:
> tag.
> https://kernel.org/doc/Documentation/SubmittingPatches
>
> Also it would be useful to add a comment before kmemdup() with
> information why it is needed there.

Good points.

-- 
Kalle Valo

      reply	other threads:[~2015-07-24 16:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-24  7:01 Commit "rsi: fix memory leak in rsi_load_ta_instructions()" breaks things Mike Looijmans
2015-07-24  8:02 ` Kalle Valo
2015-07-24  8:39 ` Alexey Khoroshilov
2015-07-24 11:02   ` Mike Looijmans
2015-07-24 11:35     ` Alexey Khoroshilov
2015-07-24 13:42       ` Mike Looijmans
2015-07-24 14:12         ` Kalle Valo
2015-07-24 16:26           ` Alexey Khoroshilov
2015-07-24 16:59             ` Kalle Valo [this message]

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=871tfxcx0j.fsf@kamboji.qca.qualcomm.com \
    --to=kvalo@codeaurora.org \
    --cc=fariyaf@gmail.com \
    --cc=khoroshilov@ispras.ru \
    --cc=linux-wireless@vger.kernel.org \
    --cc=mike.looijmans@topic.nl \
    /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).