From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E99C41DFE3A; Wed, 6 Nov 2024 12:54:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730897650; cv=none; b=kaC7nrJuKjbaZj8qaCfg8FLYbOMrZzALDk3oxHk3PcZXTPdQqMkoL59U2eJvhGa7MUKpQv39HodWAg6simOq69l7j+T+N0akzQLQZzpmIN5MpCsYV+KWcbD+vW+Iwzy2Donkvy2+gWFsTXodioZMgxKSI+A0IveNtnmJS84tKcc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730897650; c=relaxed/simple; bh=bk4mXl/StBnSqeD28Djb6SZlRoXtLgCmsTcB9UmhhFs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YN+RJl4VRLTtealqhOfh2Dy1W7tNEgweXoCoATQsPhG0CBwM9aQcoSO+crcUQj/mujieeRn/f/Sf8MVF25oU1wZUhn501K6JaKiGmFeYllJQ7hb2HpVECbKFzz0GWcUvs0xQZEGVJdLrJSBsoNLdcSL7dK6kpRoi8vcIMsmlx30= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=2M9gt5El; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="2M9gt5El" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0FC6BC4CED4; Wed, 6 Nov 2024 12:54:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1730897649; bh=bk4mXl/StBnSqeD28Djb6SZlRoXtLgCmsTcB9UmhhFs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2M9gt5ElR01ALwPAPDm3Peh1U2FRajharG3Uw2IMShx6XKgsg7vkNJ/gom78UyX5T iHftG/vhtOEmNaXuiYWjdiCXTIKy58kQ/UfnwBNSy4b2n2MtkgrHapNJ0gJYotpIaM Paw6YkE3UkoOGlE+c2QBKiibP1y9pe3hYoPsSKuQ= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, stable , Rohit Agarwal , Brian Geffon , Alexander Usyskin , Tomas Winkler , Sasha Levin Subject: [PATCH 6.6 125/151] mei: use kvmalloc for read buffer Date: Wed, 6 Nov 2024 13:05:13 +0100 Message-ID: <20241106120312.307160902@linuxfoundation.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241106120308.841299741@linuxfoundation.org> References: <20241106120308.841299741@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Alexander Usyskin [ Upstream commit 4adf613e01bf99e1739f6ff3e162ad5b7d578d1a ] 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 Reported-by: Rohit Agarwal Closes: https://lore.kernel.org/all/20240813084542.2921300-1-rohiagar@chromium.org/ Tested-by: Brian Geffon Signed-off-by: Alexander Usyskin Acked-by: Tomas Winkler Link: https://lore.kernel.org/r/20241015123157.2337026-1-alexander.usyskin@intel.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- 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 32f2287823184..699fa2362ed4d 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