All of lore.kernel.org
 help / color / mirror / Atom feed
* [char-misc-next] mei: use kvmalloc for read buffer
@ 2024-10-13 11:53 Alexander Usyskin
  2024-10-13 12:14 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 9+ messages in thread
From: Alexander Usyskin @ 2024-10-13 11:53 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Oren Weil, Tomas Winkler, linux-kernel, Alexander Usyskin

Read buffer is allocated according to max message size,
reported by the firmware and may reach 64K in systems
with pxp client.
Contiguous 64k allocation may fail under memory pressure.
Read buffer is used as in-driver message storage and
not required to be contiguous.
Use kvmalloc to allow kernel to allocate non-contiguous
memory in this case.

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
---
 drivers/misc/mei/client.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/misc/mei/client.c b/drivers/misc/mei/client.c
index 9d090fa07516..be011cef12e5 100644
--- a/drivers/misc/mei/client.c
+++ b/drivers/misc/mei/client.c
@@ -321,7 +321,7 @@ void mei_io_cb_free(struct mei_cl_cb *cb)
 		return;
 
 	list_del(&cb->list);
-	kfree(cb->buf.data);
+	kvfree(cb->buf.data);
 	kfree(cb->ext_hdr);
 	kfree(cb);
 }
@@ -497,7 +497,7 @@ struct mei_cl_cb *mei_cl_alloc_cb(struct mei_cl *cl, size_t length,
 	if (length == 0)
 		return cb;
 
-	cb->buf.data = kmalloc(roundup(length, MEI_SLOT_SIZE), GFP_KERNEL);
+	cb->buf.data = kvmalloc(roundup(length, MEI_SLOT_SIZE), GFP_KERNEL);
 	if (!cb->buf.data) {
 		mei_io_cb_free(cb);
 		return NULL;
-- 
2.43.0


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

end of thread, other threads:[~2024-10-14 19:11 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-13 11:53 [char-misc-next] mei: use kvmalloc for read buffer Alexander Usyskin
2024-10-13 12:14 ` Greg Kroah-Hartman
2024-10-13 14:22   ` Usyskin, Alexander
2024-10-13 15:07     ` Greg Kroah-Hartman
2024-10-14 13:15       ` Usyskin, Alexander
2024-10-14 13:24         ` Greg Kroah-Hartman
2024-10-14 14:43           ` Usyskin, Alexander
2024-10-14 19:05             ` Brian Geffon
2024-10-14 19:11             ` Brian Geffon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.