]> git.baikalelectronics.ru Git - kernel.git/commit
kernel/resource: fix kfree() of bootmem memory again
authorMiaohe Lin <linmiaohe@huawei.com>
Wed, 23 Mar 2022 23:07:18 +0000 (16:07 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 24 Mar 2022 02:00:35 +0000 (19:00 -0700)
commitb714be5f3b0ee6bbd0ab819f7865c833ff3b6f16
tree380d8f619508d02bf01eeeaf818fc3a9c208a531
parentf7bc6f9e3e0f1fa03316f28631ae0f3869aaef05
kernel/resource: fix kfree() of bootmem memory again

Since commit 5152da43e5a3 ("mem hotunplug: fix kfree() of bootmem
memory"), we could get a resource allocated during boot via
alloc_resource().  And it's required to release the resource using
free_resource().  Howerver, many people use kfree directly which will
result in kernel BUG.  In order to fix this without fixing every call
site, just leak a couple of bytes in such corner case.

Link: https://lkml.kernel.org/r/20220217083619.19305-1-linmiaohe@huawei.com
Fixes: 5152da43e5a3 ("mem hotunplug: fix kfree() of bootmem memory")
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Suggested-by: David Hildenbrand <david@redhat.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Alistair Popple <apopple@nvidia.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
kernel/resource.c