OP-TEE Archive on lore.kernel.org
 help / color / mirror / Atom feed
[parent not found: < <CAHUa44G_z0b42kHcaxvRJOou=pPT+MgWkJ5-5kbEOdJOFLMsAA@mail.gmail.com>]
* [PATCH v2] tee: shm: fix slab page refcounting
@ 2025-03-25 20:07 Marco Felsch
  2025-03-26  6:59 ` Jens Wiklander
  2025-03-26 10:54 ` Matthew Wilcox
  0 siblings, 2 replies; 18+ messages in thread
From: Marco Felsch @ 2025-03-25 20:07 UTC (permalink / raw)
  To: op-tee

[-- Attachment #1: Type: text/plain, Size: 1337 bytes --]

Skip manipulating the refcount in case of slab pages according commit
b9c0e49abfca ("mm: decline to manipulate the refcount on a slab page").

Fixes: b9c0e49abfca ("mm: decline to manipulate the refcount on a slab page")
Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
---
v2:
- Make use of page variable
v1:
- https://lore.kernel.org/all/20250325195021.3589797-1-m.felsch(a)pengutronix.de/

 drivers/tee/tee_shm.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/drivers/tee/tee_shm.c b/drivers/tee/tee_shm.c
index daf6e5cfd59a..35f0ac359b12 100644
--- a/drivers/tee/tee_shm.c
+++ b/drivers/tee/tee_shm.c
@@ -19,16 +19,24 @@ static void shm_put_kernel_pages(struct page **pages, size_t page_count)
 {
 	size_t n;
 
-	for (n = 0; n < page_count; n++)
-		put_page(pages[n]);
+	for (n = 0; n < page_count; n++) {
+		struct page *page = pages[n];
+
+		if (!PageSlab(page))
+			put_page(page);
+	}
 }
 
 static void shm_get_kernel_pages(struct page **pages, size_t page_count)
 {
 	size_t n;
 
-	for (n = 0; n < page_count; n++)
-		get_page(pages[n]);
+	for (n = 0; n < page_count; n++) {
+		struct page *page = pages[n];
+
+		if (!PageSlab(page))
+			get_page(page);
+	}
 }
 
 static void release_registered_pages(struct tee_shm *shm)
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2026-02-16  8:29 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] < <CAHUa44FUK_73oKSaqGdiPqB3geZbTNDFsC1Mh=KN3YPWr9=7gQ@mail.gmail.com>
2025-03-27  4:42 ` [PATCH v2] tee: shm: fix slab page refcounting Sumit Garg
2025-04-28 12:48   ` Jens Wiklander
2025-08-21 17:41     ` Marco Felsch
2025-08-22  8:52       ` Sumit Garg via OP-TEE
2025-08-22 10:15         ` Marco Felsch
2026-02-03 11:55           ` Sven Püschel
2026-02-03 12:06             ` Sumit Garg via OP-TEE
2026-02-12 12:58     ` Marco Felsch
2026-02-13 11:41       ` Sumit Garg via OP-TEE
2026-02-13 22:04         ` Marco Felsch
2026-02-16  6:28           ` Sumit Garg via OP-TEE
2026-02-16  8:28             ` Marco Felsch
     [not found] < <CAHUa44G_z0b42kHcaxvRJOou=pPT+MgWkJ5-5kbEOdJOFLMsAA@mail.gmail.com>
2025-03-26  9:42 ` Marco Felsch
2025-03-25 20:07 Marco Felsch
2025-03-26  6:59 ` Jens Wiklander
2025-03-26 10:54 ` Matthew Wilcox
2025-03-26 11:07   ` Marco Felsch
2025-03-26 13:47     ` Jens Wiklander

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox