linux-stable/Documentation
Oscar Salvador f5c12105c1 mm,page_owner: fix refcount imbalance
Current code does not contemplate scenarios were an allocation and free
operation on the same pages do not handle it in the same amount at once. 
To give an example, page_alloc_exact(), where we will allocate a page of
enough order to stafisfy the size request, but we will free the remainings
right away.

In the above example, we will increment the stack_record refcount only
once, but we will decrease it the same number of times as number of unused
pages we have to free.  This will lead to a warning because of refcount
imbalance.

Fix this by recording the number of base pages in the refcount field.

Link: https://lkml.kernel.org/r/20240404070702.2744-3-osalvador@suse.de
Reported-by: syzbot+41bbfdb8d41003d12c0f@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/linux-mm/00000000000090e8ff0613eda0e5@google.com
Fixes: 217b2119b9 ("mm,page_owner: implement the tracking of the stacks count")
Signed-off-by: Oscar Salvador <osalvador@suse.de>
Reviewed-by: Vlastimil Babka <vbabka@suse.cz>
Tested-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Cc: Alexander Potapenko <glider@google.com>
Cc: Andrey Konovalov <andreyknvl@gmail.com>
Cc: Marco Elver <elver@google.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2024-04-16 15:39:49 -07:00
..
ABI
PCI
RCU
accel
accounting
admin-guide x86/bugs: Remove CONFIG_BHI_MITIGATION_AUTO and spectre_bhi=auto 2024-04-12 12:05:54 +02:00
arch
block
bpf
cdrom
core-api
cpu-freq
crypto
dev-tools
devicetree Merge tag 'drm-msm-next-2024-04-11' of https://gitlab.freedesktop.org/drm/msm into drm-fixes 2024-04-12 11:01:45 +10:00
doc-guide
driver-api virtio: store owner from modules with register_virtio_driver() 2024-04-08 04:11:04 -04:00
fault-injection
fb
features
filesystems Documentation: filesystems: Add bcachefs toctree 2024-04-06 13:50:26 -04:00
firmware-guide
firmware_class
fpga
gpu
hid
hwmon
i2c
iio
images
infiniband
input
isdn
kbuild
kernel-hacking
leds
litmus-tests
livepatch
locking
maintainer
mhi
misc-devices
mm mm,page_owner: fix refcount imbalance 2024-04-16 15:39:49 -07:00
netlabel
netlink
networking
nvdimm
nvme
pcmcia
peci
power
process
rust
scheduler
scsi
security
sound
sphinx
sphinx-static
spi
staging
target
tee
timers
tools
trace
translations
usb
userspace-api
virt
w1
watchdog
wmi
.gitignore
Changes
CodingStyle
Kconfig
Makefile
SubmittingPatches
atomic_bitops.txt
atomic_t.txt
conf.py
docutils.conf
dontdiff
index.rst
memory-barriers.txt
subsystem-apis.rst