linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Jinjie Ruan <ruanjinjie@huawei.com>
Cc: lars.povlsen@microchip.com, Steen.Hegelund@microchip.com,
	daniel.machon@microchip.com, davem@davemloft.net,
	edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
	jensemil.schulzostergaard@microchip.com,
	UNGLinuxDriver@microchip.com,
	linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] net: microchip: vcap api: Fix memory leaks in vcap_api_encode_rule_test()
Date: Fri, 11 Oct 2024 10:24:49 +0100	[thread overview]
Message-ID: <20241011092449.GD66815@kernel.org> (raw)
In-Reply-To: <20241010130231.3151896-1-ruanjinjie@huawei.com>

On Thu, Oct 10, 2024 at 09:02:31PM +0800, Jinjie Ruan wrote:
> Commit a3c1e45156ad ("net: microchip: vcap: Fix use-after-free error in
> kunit test") fixed the use-after-free error, but introduced below
> memory leaks by removing necessary vcap_free_rule(), add it to fix it.
> 
> 	unreferenced object 0xffffff80ca58b700 (size 192):
> 	  comm "kunit_try_catch", pid 1215, jiffies 4294898264
> 	  hex dump (first 32 bytes):
> 	    00 12 7a 00 05 00 00 00 0a 00 00 00 64 00 00 00  ..z.........d...
> 	    00 00 00 00 00 00 00 00 00 04 0b cc 80 ff ff ff  ................
> 	  backtrace (crc 9c09c3fe):
> 	    [<0000000052a0be73>] kmemleak_alloc+0x34/0x40
> 	    [<0000000043605459>] __kmalloc_cache_noprof+0x26c/0x2f4
> 	    [<0000000040a01b8d>] vcap_alloc_rule+0x3cc/0x9c4
> 	    [<000000003fe86110>] vcap_api_encode_rule_test+0x1ac/0x16b0
> 	    [<00000000b3595fc4>] kunit_try_run_case+0x13c/0x3ac
> 	    [<0000000010f5d2bf>] kunit_generic_run_threadfn_adapter+0x80/0xec
> 	    [<00000000c5d82c9a>] kthread+0x2e8/0x374
> 	    [<00000000f4287308>] ret_from_fork+0x10/0x20

I guess that the rest of the log could be trimmed from the
commit message. But I don't feel strongly about that.

Also, it is probably not necessary to repost just because of this,
but as a bug fix this patch should be targeted at the net tree
and that should be indicated in the subject.

  [PATCH net] ...

...

> Cc: stable@vger.kernel.org
> Fixes: a3c1e45156ad ("net: microchip: vcap: Fix use-after-free error in kunit test")
> Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>

Reviewed-by: Simon Horman <horms@kernel.org>



  reply	other threads:[~2024-10-11  9:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-10 13:02 [PATCH] net: microchip: vcap api: Fix memory leaks in vcap_api_encode_rule_test() Jinjie Ruan
2024-10-11  9:24 ` Simon Horman [this message]
2024-10-11 10:24 ` Daniel Machon
2024-10-11 15:10   ` Jens Emil Schulz Østergaard
2024-10-13  9:54     ` Daniel Machon
2024-10-11 15:28 ` Jens Emil Schulz Østergaard

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=20241011092449.GD66815@kernel.org \
    --to=horms@kernel.org \
    --cc=Steen.Hegelund@microchip.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=daniel.machon@microchip.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jensemil.schulzostergaard@microchip.com \
    --cc=kuba@kernel.org \
    --cc=lars.povlsen@microchip.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=ruanjinjie@huawei.com \
    /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).