Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp770709rwb; Mon, 26 Sep 2022 05:46:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5NGBvlHtDtBYaDOVLJ6PFWy3fkTnPm63YxpA0/yXbKc6tfOHY7sCQVapVHr037aQd3m/ai X-Received: by 2002:a17:907:2be1:b0:770:8268:ec95 with SMTP id gv33-20020a1709072be100b007708268ec95mr18374552ejc.105.1664196370079; Mon, 26 Sep 2022 05:46:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664196370; cv=none; d=google.com; s=arc-20160816; b=NslcyFuaSR5Az2F077+dYjCI+XIl7G9OLCQpN1IfsjnKYtLAQVSFb85U7XShAHKx09 +4qFWiHrMOZyCMGS+zxXUQLLvCDk+ZsjDefGyGDsrVvicUsHpj/Ec5BiQnH/amYfDNj9 CVS61/sK3KgKcoQ7jLAHZf7fi80zk88kDvM9/XvXJtKmkCpBqzYB8vGYPf8n8lqlAals GsdcZexSD1drd17b4rj2UXaEG+srMHJeS3/mEF4iSFX0iHhvpDMz3DcpeB1QaUtycPZB wkdu2SZ+peOvHZv8p+FMrU+CsbfEaN6uxg9TRciv5cTb/i5Ty1gwz3cdafzh2Q3zS2fl /H8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=kUbGoj8/HmQNAHbMtYc/T/t+zXMuScA5Dh8QwLkFiG8=; b=j2jpgmVhCkxu9YKYlRRD9lGvBD6qU/qDQRGcJmMd5IBnaMZNZc1hsx4yDn4rCTng3N wOCoRyIK28GQTu43aPsYwAyT5CgWEMX3U6xOZJTnoC8p3DkUOVd8+AJPfXeir+q9pQev VQshdPU/s9jN7r22zT44eQWZ7zgs/HeBWV+z/RrIbC4uBmjO/RnvjkxDuzOdmioo6gaW CK9h2rW/Wh3v+mao5jTsnOOrQInrk4vA7sBXviQRWG/wWWDHWSLql58hdEIXRWP6S7d8 ZSqukmSbr0iMoR//rjEsMLORKaGoK5H7UND21v3Hkhvf0p4um2TKiiya+ijyZFM9AFH6 STwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EN0lLV9n; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ed10-20020a056402294a00b00456f8d9b2cdsi6105135edb.452.2022.09.26.05.45.44; Mon, 26 Sep 2022 05:46:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EN0lLV9n; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235673AbiIZKbv (ORCPT + 99 others); Mon, 26 Sep 2022 06:31:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52448 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235849AbiIZK3Y (ORCPT ); Mon, 26 Sep 2022 06:29:24 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B60A146215; Mon, 26 Sep 2022 03:19:22 -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 ams.source.kernel.org (Postfix) with ESMTPS id 4193EB80835; Mon, 26 Sep 2022 10:19:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5660CC433C1; Mon, 26 Sep 2022 10:19:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664187553; bh=9BkiyLBsVzXzC2PyiRUjj1lfylL5hzUuyzqnpUyygY8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EN0lLV9nU0beqZaC7GHnqply8jfrCem3YhRDsv+E8c2B38GoniwHuOn73CMp490zi YKdiYNrXBTW1atkJiUV4Xuo85bjcngzhIG3NPR9AUMEb7mTivHlSr5yw4cj1EujjX7 bikASeEA9I6PVm0zOjbeGyWuxOsPF6Mrugc4qOFQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hyunwoo Kim , Helge Deller , Sasha Levin Subject: [PATCH 4.19 17/58] video: fbdev: pxa3xx-gcu: Fix integer overflow in pxa3xx_gcu_write Date: Mon, 26 Sep 2022 12:11:36 +0200 Message-Id: <20220926100742.062048441@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100741.430882406@linuxfoundation.org> References: <20220926100741.430882406@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 43695a33f062..aec0b85db5bf 100644 --- a/drivers/video/fbdev/pxa3xx-gcu.c +++ b/drivers/video/fbdev/pxa3xx-gcu.c @@ -394,7 +394,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