public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: stable@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	patches@lists.linux.dev,
	"Matthew Wilcox (Oracle)" <willy@infradead.org>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Shakeel Butt <shakeel.butt@linux.dev>,
	Balbir Singh <balbirs@nvidia.com>, Michal Hocko <mhocko@suse.com>,
	Christoph Hellwig <hch@lst.de>,
	Muchun Song <muchun.song@linux.dev>,
	Roman Gushchin <roman.gushchin@linux.dev>,
	"Uladzislau Rezki (Sony)" <urezki@gmail.com>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: [PATCH 6.6 087/116] vmalloc: fix accounting with i915
Date: Mon, 23 Dec 2024 16:59:17 +0100	[thread overview]
Message-ID: <20241223155402.943868423@linuxfoundation.org> (raw)
In-Reply-To: <20241223155359.534468176@linuxfoundation.org>

6.6-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Matthew Wilcox (Oracle) <willy@infradead.org>

commit a2e740e216f5bf49ccb83b6d490c72a340558a43 upstream.

If the caller of vmap() specifies VM_MAP_PUT_PAGES (currently only the
i915 driver), we will decrement nr_vmalloc_pages and MEMCG_VMALLOC in
vfree().  These counters are incremented by vmalloc() but not by vmap() so
this will cause an underflow.  Check the VM_MAP_PUT_PAGES flag before
decrementing either counter.

Link: https://lkml.kernel.org/r/20241211202538.168311-1-willy@infradead.org
Fixes: b944afc9d64d ("mm: add a VM_MAP_PUT_PAGES flag for vmap")
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Reviewed-by: Shakeel Butt <shakeel.butt@linux.dev>
Reviewed-by: Balbir Singh <balbirs@nvidia.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Muchun Song <muchun.song@linux.dev>
Cc: Roman Gushchin <roman.gushchin@linux.dev>
Cc: "Uladzislau Rezki (Sony)" <urezki@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 mm/vmalloc.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -2851,7 +2851,8 @@ void vfree(const void *addr)
 		struct page *page = vm->pages[i];
 
 		BUG_ON(!page);
-		mod_memcg_page_state(page, MEMCG_VMALLOC, -1);
+		if (!(vm->flags & VM_MAP_PUT_PAGES))
+			mod_memcg_page_state(page, MEMCG_VMALLOC, -1);
 		/*
 		 * High-order allocs for huge vmallocs are split, so
 		 * can be freed as an array of order-0 allocations
@@ -2859,7 +2860,8 @@ void vfree(const void *addr)
 		__free_page(page);
 		cond_resched();
 	}
-	atomic_long_sub(vm->nr_pages, &nr_vmalloc_pages);
+	if (!(vm->flags & VM_MAP_PUT_PAGES))
+		atomic_long_sub(vm->nr_pages, &nr_vmalloc_pages);
 	kvfree(vm->pages);
 	kfree(vm);
 }



  parent reply	other threads:[~2024-12-23 16:14 UTC|newest]

Thread overview: 128+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-23 15:57 [PATCH 6.6 000/116] 6.6.68-rc1 review Greg Kroah-Hartman
2024-12-23 15:57 ` [PATCH 6.6 001/116] net: sched: fix ordering of qlen adjustment Greg Kroah-Hartman
2024-12-23 15:57 ` [PATCH 6.6 002/116] usb: dwc2: gadget: Dont write invalid mapped sg entries into dma_desc with iommu enabled Greg Kroah-Hartman
2024-12-23 15:57 ` [PATCH 6.6 003/116] PCI: vmd: Create domain symlink before pci_bus_add_devices() Greg Kroah-Hartman
2024-12-23 15:57 ` [PATCH 6.6 004/116] PCI: Add ACS quirk for Broadcom BCM5760X NIC Greg Kroah-Hartman
2024-12-23 15:57 ` [PATCH 6.6 005/116] usb: cdns3-ti: Add workaround for Errata i2409 Greg Kroah-Hartman
2024-12-23 15:57 ` [PATCH 6.6 006/116] MIPS: Loongson64: DTS: Fix msi node for ls7a Greg Kroah-Hartman
2024-12-23 15:57 ` [PATCH 6.6 007/116] ASoC: Intel: sof_sdw: fix jack detection on ADL-N variant RVP Greg Kroah-Hartman
2024-12-23 15:57 ` [PATCH 6.6 008/116] ASoC: Intel: sof_sdw: add quirk for Dell SKU 0B8C Greg Kroah-Hartman
2024-12-23 15:57 ` [PATCH 6.6 009/116] PCI: Use preserve_config in place of pci_flags Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.6 010/116] PCI/AER: Disable AER service on suspend Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.6 011/116] usb: cdns3: Add quirk flag to enable suspend residency Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.6 012/116] net: stmmac: fix TSO DMA API usage causing oops Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.6 013/116] platform/x86: p2sb: Make p2sb_get_devfn() return void Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.6 014/116] p2sb: Factor out p2sb_read_from_cache() Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.6 015/116] p2sb: Introduce the global flag p2sb_hidden_by_bios Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.6 016/116] p2sb: Move P2SB hide and unhide code to p2sb_scan_and_cache() Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.6 017/116] p2sb: Do not scan and remove the P2SB device when it is unhidden Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.6 018/116] i2c: pnx: Fix timeout in wait functions Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.6 019/116] xfs: fix the contact address for the sysfs ABI documentation Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.6 020/116] xfs: verify buffer, inode, and dquot items every tx commit Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.6 021/116] xfs: use consistent uid/gid when grabbing dquots for inodes Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.6 022/116] xfs: declare xfs_file.c symbols in xfs_file.h Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.6 023/116] xfs: create a new helper to return a files allocation unit Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.6 024/116] xfs: Fix xfs_flush_unmap_range() range for RT Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.6 025/116] xfs: Fix xfs_prepare_shift() " Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.6 026/116] xfs: dont walk off the end of a directory data block Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.6 027/116] xfs: convert comma to semicolon Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.6 028/116] xfs: fix file_path handling in tracepoints Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.6 029/116] xfs: remove unused parameter in macro XFS_DQUOT_LOGRES Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.6 030/116] xfs: attr forks require attr, not attr2 Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.6 031/116] xfs: conditionally allow FS_XFLAG_REALTIME changes if S_DAX is set Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.6 032/116] xfs: Fix the owner setting issue for rmap query in xfs fsmap Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.6 033/116] xfs: use XFS_BUF_DADDR_NULL for daddrs in getfsmap code Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.6 034/116] xfs: take m_growlock when running growfsrt Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.6 035/116] xfs: reset rootdir extent size hint after growfsrt Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.6 036/116] tools: hv: change permissions of NetworkManager configuration file Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.6 037/116] cxl/pci: Fix potential bogus return value upon successful probing Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.6 038/116] cxl/region: Fix region creation for greater than x2 switches Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.6 039/116] net/smc: protect link down work from execute after lgr freed Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.6 040/116] net/smc: check sndbuf_space again after NOSPACE flag is set in smc_poll Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.6 041/116] net/smc: check iparea_offset and ipv6_prefixes_cnt when receiving proposal msg Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.6 042/116] net/smc: check v2_ext_offset/eid_cnt/ism_gid_cnt " Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.6 043/116] net/smc: check smcd_v2_ext_offset " Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.6 044/116] net/smc: check return value of sock_recvmsg when draining clc data Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.6 045/116] net: mscc: ocelot: fix incorrect IFH SRC_PORT field in ocelot_ifh_set_basic() Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.6 046/116] netdevsim: prevent bad user input in nsim_dev_health_break_write() Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.6 047/116] ionic: Fix netdev notifier unregister on failure Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.6 048/116] ionic: use ee->offset when returning sprom data Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.6 049/116] net: renesas: rswitch: rework ts tags management Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.6 050/116] ksmbd: count all requests in req_running counter Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.6 051/116] ksmbd: fix broken transfers when exceeding max simultaneous operations Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.6 052/116] net: hinic: Fix cleanup in create_rxqs/txqs() Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.6 053/116] net: ethernet: bgmac-platform: fix an OF node reference leak Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.6 054/116] ipvs: Fix clamp() of ip_vs_conn_tab on small memory systems Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.6 055/116] netfilter: ipset: Fix for recursive locking warning Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.6 056/116] selftests: openvswitch: fix tcpdump execution Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.6 057/116] net: mdiobus: fix an OF node reference leak Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.6 058/116] mmc: sdhci-tegra: Remove SDHCI_QUIRK_BROKEN_ADMA_ZEROLEN_DESC quirk Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.6 059/116] mmc: mtk-sd: disable wakeup in .remove() and in the error path of .probe() Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.6 060/116] EDAC/amd64: Simplify ECC check on unified memory controllers Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.6 061/116] KVM: x86: Cache CPUID.0xD XSTATE offsets+sizes during module init Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.6 062/116] net: tun: fix tun_napi_alloc_frags() Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.6 063/116] chelsio/chtls: prevent potential integer overflow on 32bit Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.6 064/116] i2c: riic: Always round-up when calculating bus period Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.6 065/116] efivarfs: Fix error on non-existent file Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.6 066/116] hexagon: Disable constant extender optimization for LLVM prior to 19.1.0 Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.6 067/116] USB: serial: option: add TCL IK512 MBIM & ECM Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.6 068/116] USB: serial: option: add MeiG Smart SLM770A Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.6 069/116] USB: serial: option: add Netprisma LCUK54 modules for WWAN Ready Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.6 070/116] USB: serial: option: add MediaTek T7XX compositions Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.6 071/116] USB: serial: option: add Telit FE910C04 rmnet compositions Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.6 072/116] thunderbolt: Improve redrive mode handling Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.6 073/116] drm/modes: Avoid divide by zero harder in drm_mode_vrefresh() Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.6 074/116] drm/panel: novatek-nt35950: fix return value check in nt35950_probe() Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.6 075/116] i915/guc: Reset engine utilization buffer before registration Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.6 076/116] i915/guc: Ensure busyness counter increases motonically Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.6 077/116] i915/guc: Accumulate active runtime on gt reset Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.6 078/116] drm/amdgpu: dont access invalid sched Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.6 079/116] hwmon: (tmp513) Dont use "proxy" headers Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.6 080/116] hwmon: (tmp513) Simplify with dev_err_probe() Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.6 081/116] hwmon: (tmp513) Use SI constants from units.h Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.6 082/116] hwmon: (tmp513) Fix interpretation of values of Shunt Voltage and Limit Registers Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.6 083/116] hwmon: (tmp513) Fix Current Register value interpretation Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.6 084/116] hwmon: (tmp513) Fix interpretation of values of Temperature Result and Limit Registers Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.6 085/116] zram: refuse to use zero sized block device as backing device Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.6 086/116] zram: fix uninitialized ZRAM not releasing " Greg Kroah-Hartman
2025-01-08  3:58   ` Sergey Senozhatsky
2024-12-23 15:59 ` Greg Kroah-Hartman [this message]
2024-12-23 15:59 ` [PATCH 6.6 088/116] btrfs: tree-checker: reject inline extent items with 0 ref count Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.6 089/116] Drivers: hv: util: Avoid accessing a ringbuffer not initialized yet Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.6 090/116] KVM: x86: Play nice with protected guests in complete_hypercall_exit() Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.6 091/116] smb: client: fix TCP timers deadlock after rmmod Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.6 092/116] tracing: Fix test_event_printk() to process entire print argument Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.6 093/116] tracing: Add missing helper functions in event pointer dereference check Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.6 094/116] tracing: Add "%s" check in test_event_printk() Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.6 095/116] selftests/memfd: run sysctl tests when PID namespace support is enabled Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.6 096/116] selftests/bpf: Use asm constraint "m" for LoongArch Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.6 097/116] io_uring: Fix registered ring file refcount leak Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.6 098/116] io_uring: check if iowq is killed before queuing Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.6 099/116] NFS/pnfs: Fix a live lock between recalled layouts and layoutget Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.6 100/116] of/irq: Fix interrupt-map cell length check in of_irq_parse_imap_parent() Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.6 101/116] of/irq: Fix using uninitialized variable @addr_len in API of_irq_parse_one() Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.6 102/116] nilfs2: fix buffer head leaks in calls to truncate_inode_pages() Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.6 103/116] nilfs2: prevent use of deleted inode Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.6 104/116] udmabuf: also check for F_SEAL_FUTURE_WRITE Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.6 105/116] of: Fix error path in of_parse_phandle_with_args_map() Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.6 106/116] of: Fix refcount leakage for OF node returned by __of_get_dma_parent() Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.6 107/116] ceph: validate snapdirname option length when mounting Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.6 108/116] ceph: improve error handling and short/overflow-read logic in __ceph_sync_read() Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.6 109/116] ceph: fix memory leaks " Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.6 110/116] epoll: Add synchronous wakeup support for ep_poll_callback Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.6 111/116] io_uring/rw: split io_read() into a helper Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.6 112/116] io_uring/rw: treat -EOPNOTSUPP for IOCB_NOWAIT like -EAGAIN Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.6 113/116] io_uring/rw: avoid punting to io-wq directly Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.6 114/116] net: fec: refactor PPS channel configuration Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.6 115/116] net: fec: make PPS channel configurable Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.6 116/116] drm/amdgpu: Handle NULL bo->tbo.resource (again) in amdgpu_vm_bo_update Greg Kroah-Hartman
2024-12-23 21:15 ` [PATCH 6.6 000/116] 6.6.68-rc1 review SeongJae Park
2024-12-23 22:41 ` Shuah Khan
2024-12-24  6:46 ` Harshit Mogalapalli
2024-12-24 10:22 ` Ron Economos
2024-12-24 11:03 ` Peter Schneider
2024-12-24 13:26 ` Jon Hunter
2024-12-24 19:38 ` Naresh Kamboju
2024-12-26 10:12 ` Muhammad Usama Anjum
2024-12-26 17:04 ` Florian Fainelli
2024-12-26 19:28 ` [PATCH 6.6] " Hardik Garg

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=20241223155402.943868423@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=akpm@linux-foundation.org \
    --cc=balbirs@nvidia.com \
    --cc=hannes@cmpxchg.org \
    --cc=hch@lst.de \
    --cc=mhocko@suse.com \
    --cc=muchun.song@linux.dev \
    --cc=patches@lists.linux.dev \
    --cc=roman.gushchin@linux.dev \
    --cc=shakeel.butt@linux.dev \
    --cc=stable@vger.kernel.org \
    --cc=urezki@gmail.com \
    --cc=willy@infradead.org \
    /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