mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Anton Volkov <avolkov@ispras.ru>
To: corbet@lwn.net
Cc: mchehab@kernel.org, linux-media@vger.kernel.org,
	linux-kernel@vger.kernel.org, ldv-project@linuxtesting.org,
	Alexey Khoroshilov <khoroshilov@ispras.ru>
Subject: Possible memory leak in cafe_ccic.ko
Date: Tue, 22 Aug 2017 19:26:23 +0300	[thread overview]
Message-ID: <9aac6eca-e553-0b49-d5ce-e49029b52fdc@ispras.ru> (raw)

Hello.

While searching for races in the Linux kernel I've come across 
"drivers/media/platform/marvell-ccic/cafe_ccic.ko" module. Here are 
questions that I came up with while analyzing results. Lines are given 
using the info from Linux v4.12.

Consider the following case:

Thread 1:                  Thread 2:
                            mcam_v4l_release
                            ->mcam_free_dma_bufs
                                cam->dma_bufs[i] = NULL
                                cam->nbufs = 0
cafe_pci_resume                (mcam-core.c: line 413)
->mccic_resume
   ->mcam_read_setup
     ->mcam_alloc_dma_bufs
       cam->dma_bufs[i] =
          dma_alloc_coherent()
          (mcam-core.c: line 381)

It looks like mcam_v4l_release() doesn't really shut the device down. In 
this case cafe_pci_resume() leaks memory for cam->dma_bufs[i] after 
mcam_v4l_release() freed and poisoned them. Is this feasible from your 
point of view?

Thank you for your time.

-- Anton Volkov
Linux Verification Center, ISPRAS
web: http://linuxtesting.org
e-mail: avolkov@ispras.ru

                 reply	other threads:[~2017-08-22 16:26 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=9aac6eca-e553-0b49-d5ce-e49029b52fdc@ispras.ru \
    --to=avolkov@ispras.ru \
    --cc=corbet@lwn.net \
    --cc=khoroshilov@ispras.ru \
    --cc=ldv-project@linuxtesting.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@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

all inboxes | Powered by JetHome®