1
0
mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git synced 2026-01-12 01:20:14 +00:00
Ma Ke fe9d31fd1a mm/hmm/test: fix error handling in dmirror_device_init
dmirror_device_init() calls device_initialize() which sets the device
reference count to 1, but fails to call put_device() when error occurs
after dev_set_name() or cdev_device_add() failures.  This results in
memory leaks of struct device objects.  Additionally,
dmirror_device_remove() lacks the final put_device() call to properly
release the device reference.

Found by code review.

Link: https://lkml.kernel.org/r/20251108115346.6368-1-make24@iscas.ac.cn
Fixes: 6a760f58c792 ("mm/hmm/test: use char dev with struct device to get device node")
Signed-off-by: Ma Ke <make24@iscas.ac.cn>
Cc: Haoxiang Li <make24@iscas.ac.cn>
Cc: Jason Gunthorpe <jgg@ziepe.ca>
Cc: John Hubbard <jhubbard@nvidia.com>
Cc: Leon Romanovsky <leon@kernel.org>
Cc: Mika Penttilä <mpenttil@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2025-11-24 15:08:50 -08:00
..
2025-04-11 17:32:38 -07:00
2025-04-11 17:32:37 -07:00
2025-10-05 10:48:33 -07:00
2025-07-08 19:11:57 -04:00
2025-03-25 10:18:31 -03:00
2025-10-02 08:57:03 -07:00
2025-05-11 17:54:04 -07:00
2025-03-25 10:18:31 -03:00
2025-08-04 10:54:36 -07:00
2025-09-13 16:54:46 -07:00
2025-08-02 12:01:37 -07:00