mei: use kvmalloc for read buffer

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.

Fixes: 3030dc056459 ("mei: add wrapper for queuing control commands.")
Cc: stable <stable@kernel.org>
Reported-by: Rohit Agarwal <rohiagar@chromium.org>
Closes: https://lore.kernel.org/all/20240813084542.2921300-1-rohiagar@chromium.org/
Tested-by: Brian Geffon <bgeffon@google.com>
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Acked-by: Tomas Winkler <tomasw@gmail.com>
Link: https://lore.kernel.org/r/20241015123157.2337026-1-alexander.usyskin@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by Alexander Usyskin and committed by Greg Kroah-Hartman 4adf613e cb617e14

+2 -2
+2 -2
drivers/misc/mei/client.c
··· 321 321 return; 322 322 323 323 list_del(&cb->list); 324 - kfree(cb->buf.data); 324 + kvfree(cb->buf.data); 325 325 kfree(cb->ext_hdr); 326 326 kfree(cb); 327 327 } ··· 497 497 if (length == 0) 498 498 return cb; 499 499 500 - cb->buf.data = kmalloc(roundup(length, MEI_SLOT_SIZE), GFP_KERNEL); 500 + cb->buf.data = kvmalloc(roundup(length, MEI_SLOT_SIZE), GFP_KERNEL); 501 501 if (!cb->buf.data) { 502 502 mei_io_cb_free(cb); 503 503 return NULL;