From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3DF8ECCA47B for ; Tue, 28 Jun 2022 02:31:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244996AbiF1CbE (ORCPT ); Mon, 27 Jun 2022 22:31:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244548AbiF1C1P (ORCPT ); Mon, 27 Jun 2022 22:27:15 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F175325C4D; Mon, 27 Jun 2022 19:24:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8DFD161853; Tue, 28 Jun 2022 02:24:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E24D6C341CA; Tue, 28 Jun 2022 02:24:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1656383088; bh=Kqi3E0HjV/M/rUHNNJDAxMFwMxUuQgRy5Fn4G8zuY/I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G1rapj8TbhPkB2BZAY1Mtu18fnlkg+ylqHBazgwT6nS8ii2nufMKJFVVgZWrSeXaB uGyFj3521afEiD0yasQ3vOxyHX9wuAYkVAoQLwctbqyVZ5SItb35mXQUzCXsuvLg7k /3mMU26qu2XP+W9WfEBj6hvEETfVXpaGWlw1JQl+Rt5GIeaiDL5obzdhgEQ1M7+kcz 5HZOdaLisa13M2vD1BxK4BdpBcAIbI0bv5WxNjFyYNtmeAvPrWXxKiZ+plSmpvvB+Q Isf1aCdTfELgFlHPhbEAssDfw1V/MPPVz2q/5kynEEPhWcGsD5BUaT7siktTfJQvV/ v/jITPq6fAC5Q== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Hyunwoo Kim , Helge Deller , Sasha Levin , yangyingliang@huawei.com, yang.lee@linux.alibaba.com, cai.huoqing@linux.dev, linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: [PATCH AUTOSEL 5.4 13/27] video: fbdev: pxa3xx-gcu: Fix integer overflow in pxa3xx_gcu_write Date: Mon, 27 Jun 2022 22:23:59 -0400 Message-Id: <20220628022413.596341-13-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220628022413.596341-1-sashal@kernel.org> References: <20220628022413.596341-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hyunwoo Kim [ Upstream commit a09d2d00af53b43c6f11e6ab3cb58443c2cac8a7 ] In pxa3xx_gcu_write, a count parameter of type size_t is passed to words of type int. Then, copy_from_user() may cause a heap overflow because it is used as the third argument of copy_from_user(). Signed-off-by: Hyunwoo Kim Signed-off-by: Helge Deller Signed-off-by: Sasha Levin --- drivers/video/fbdev/pxa3xx-gcu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/video/fbdev/pxa3xx-gcu.c b/drivers/video/fbdev/pxa3xx-gcu.c index 7c4694d70dac..15162b37f302 100644 --- a/drivers/video/fbdev/pxa3xx-gcu.c +++ b/drivers/video/fbdev/pxa3xx-gcu.c @@ -382,7 +382,7 @@ pxa3xx_gcu_write(struct file *file, const char *buff, struct pxa3xx_gcu_batch *buffer; struct pxa3xx_gcu_priv *priv = to_pxa3xx_gcu_priv(file); - int words = count / 4; + size_t words = count / 4; /* Does not need to be atomic. There's a lock in user space, * but anyhow, this is just for statistics. */ -- 2.35.1