Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mm/damon/sysfs: dealloc commit test ctx always

The damon_ctx for testing online DAMON parameters commit inputs is
deallocated only when the test fails. This means memory is leaked for
every successful online DAMON parameters commit. Fix the leak by always
deallocating it.

Link: https://lkml.kernel.org/r/20251003201455.41448-3-sj@kernel.org
Fixes: 4c9ea539ad59 ("mm/damon/sysfs: validate user inputs from damon_sysfs_commit_input()")
Signed-off-by: SeongJae Park <sj@kernel.org>
Cc: <stable@vger.kernel.org> [6.15+]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

SeongJae Park and committed by
Andrew Morton
139e7a57 f0c5118e

+2 -3
+2 -3
mm/damon/sysfs.c
··· 1476 1476 if (!test_ctx) 1477 1477 return -ENOMEM; 1478 1478 err = damon_commit_ctx(test_ctx, param_ctx); 1479 - if (err) { 1480 - damon_destroy_ctx(test_ctx); 1479 + if (err) 1481 1480 goto out; 1482 - } 1483 1481 err = damon_commit_ctx(kdamond->damon_ctx, param_ctx); 1484 1482 out: 1483 + damon_destroy_ctx(test_ctx); 1485 1484 damon_destroy_ctx(param_ctx); 1486 1485 return err; 1487 1486 }