All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Oscar Megia López" <megia.oscar@gmail.com>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: Christian Koenig <christian.koenig@amd.com>,
	Huang Rui <ray.huang@amd.com>,
	Matthew Auld <matthew.auld@intel.com>,
	Matthew Brost <matthew.brost@intel.com>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	linux-kernel-mentees@lists.linux.dev, stable@vger.kernel.org
Subject: Re: [PATCH v4] Memory leak error in qxl unbind
Date: Fri, 21 Aug 2026 16:48:58 +0200	[thread overview]
Message-ID: <3b85e6e2-29d0-43ea-abe2-246f1148939a@gmail.com> (raw)
In-Reply-To: <2026080941-edge-lurk-2146@gregkh>

On 8/9/26 20:19, Greg KH wrote:
> On Sun, Aug 09, 2026 at 06:53:14PM +0200, Óscar Megía López wrote:
>> I discovered an OOM after run the script below
>> (I updated it and added a sleep to allow enough time for the cache to
>> recover):
>>
>> while [ 1 -eq 1 ]; do\
>>    i=$((i+1)); echo 0000:00:01.0 > /sys/bus/pci/drivers/qxl/unbind;\
>>    if (($i%1000==0)); then\
>>      echo i=$i; free;\
>>      grep nr_free_pages /proc/vmstat;\
>>      grep -E "PageTables|VmallocUsed|Slab|Reclaimable" /proc/meminfo;\
>>      sync; echo 3 > /proc/sys/vm/drop_caches;\
>>      echo 1 > /proc/sys/vm/compact_memory;\
>>      sleep 10s;\
>>      free;\
>>      grep nr_free_pages /proc/vmstat;\
>>      grep -E "PageTables|VmallocUsed|Slab|Reclaimable" /proc/meminfo;\
>>      uptime;\
>>    fi;\
>>    echo 0000:00:01.0 > /sys/bus/pci/drivers/qxl/bind;\
>>   done
>>
>> The OOM isn't just a simple leak; it's a refcount corruption which renders
>> the list_lru fix dead code after the first mid-init failure.
>>
>> Here's the chain:
>>
>> Bug 1: ttm_pool_type_init() does not check return from list_lru_init().
>>
>> Fix: Check the return value from list_lru_init() and propagate the error.
>>
>> Bug 2: ttm_pool_fini() does not destroy list lru with list_lru_destroy().
>>
>> Fix: Add list_lru_destroy() after ttm_pool_type_fini().
>>
>> Bug 3: ttm_pool_mgr_init() does not check ttm_pool_type_init() return
>> and does not free pool if returns error.
>>
>> Fix: Move up shrinker_alloc(), check ttm_pool_type_init() return and free
>> pool types and shrinker if non-zero and return error.
>>
>> Bug 4: ttm_pool_mgr_fini() does not destroy the list_lru.
>>
>> Fix: Add list_lru_destroy() after ttm_pool_type_fini().
>>
>> Fixed check for an empty shrinker_list.
> Why is this not 4 different patches as part of a series?
>
>> This patch depends on patch ("[PATCH v3] drm/qxl: fix use-after-free in
>> qxl_irq_handler on PCI"), link [1] below.
> That's not going to age well in a changelog text :(
I'm a newbie. What's the best way to add a patch it depends on?
>
> thanks,
>
> greg k-h

      reply	other threads:[~2026-08-21 14:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-09 16:53 [PATCH v4] Memory leak error in qxl unbind Óscar Megía López
2026-08-09 17:04 ` sashiko-bot
2026-08-09 18:19 ` Greg KH
2026-08-21 14:48   ` Oscar Megia López [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=3b85e6e2-29d0-43ea-abe2-246f1148939a@gmail.com \
    --to=megia.oscar@gmail.com \
    --cc=christian.koenig@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel-mentees@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matthew.auld@intel.com \
    --cc=matthew.brost@intel.com \
    --cc=ray.huang@amd.com \
    --cc=stable@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.