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 X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D1EB8C34047 for ; Tue, 18 Feb 2020 20:07:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9E5322067D for ; Tue, 18 Feb 2020 20:07:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582056461; bh=ThgjNCU+8MS+eBKTclwmfynFRyuPnapydKLL6JZ7fXs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=0xDtweBlp36J9g2Ii4XNzA1cYfMK1aarPKq1SWJzzS5nUlEgQDkS8yn9Va+SNkZTb /xFfWks7ygFoWkk/hnD8B5iaOg7a7EvsFQhYGWrigWx7IT149srSDbxtOunF5rCyKh M1i8hFPIZH8pW+Iyt9/51QgA707u8vj7cJ8d9xpY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728051AbgBRT6y (ORCPT ); Tue, 18 Feb 2020 14:58:54 -0500 Received: from mail.kernel.org ([198.145.29.99]:36808 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728315AbgBRT6x (ORCPT ); Tue, 18 Feb 2020 14:58:53 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5E71924125; Tue, 18 Feb 2020 19:58:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582055932; bh=ThgjNCU+8MS+eBKTclwmfynFRyuPnapydKLL6JZ7fXs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jRhUCtu1cOIIGUQRsfRT8zpiJ9dAVBp9odNoBux3HvMR4j+eNdwJEO0TNh0WCvigQ h/H37g6BYGb+xX02O561IyM680yPg40TvaUpMymz+yuekTv7cI6V2spp4MaJQw1y1X aXeDsOJdvHdyDPgLLiVPhnTFiujqhdv5t/BJBLaM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Marek=20Beh=C3=BAn?= , sohu0106 , Olof Johansson Subject: [PATCH 5.4 36/66] bus: moxtet: fix potential stack buffer overflow Date: Tue, 18 Feb 2020 20:55:03 +0100 Message-Id: <20200218190431.382797218@linuxfoundation.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200218190428.035153861@linuxfoundation.org> References: <20200218190428.035153861@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Marek BehĂșn commit 3bf3c9744694803bd2d6f0ee70a6369b980530fd upstream. The input_read function declares the size of the hex array relative to sizeof(buf), but buf is a pointer argument of the function. The hex array is meant to contain hexadecimal representation of the bin array. Link: https://lore.kernel.org/r/20200215142130.22743-1-marek.behun@nic.cz Fixes: 5bc7f990cd98 ("bus: Add support for Moxtet bus") Signed-off-by: Marek BehĂșn Reported-by: sohu0106 Signed-off-by: Olof Johansson Signed-off-by: Greg Kroah-Hartman --- drivers/bus/moxtet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/bus/moxtet.c +++ b/drivers/bus/moxtet.c @@ -466,7 +466,7 @@ static ssize_t input_read(struct file *f { struct moxtet *moxtet = file->private_data; u8 bin[TURRIS_MOX_MAX_MODULES]; - u8 hex[sizeof(buf) * 2 + 1]; + u8 hex[sizeof(bin) * 2 + 1]; int ret, n; ret = moxtet_spi_read(moxtet, bin);