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=-9.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 99C98C433EF for ; Sun, 8 Sep 2019 12:43:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 65BF021907 for ; Sun, 8 Sep 2019 12:43:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567946620; bh=0G54NzqspS3ThXIbyo+flEPSStI+M8ELnHPxBup1xRM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=P8N4vZVBZVNwasbslci/fghil4HrfVn+uuOA5ePmC5xxhAH0y+FpCnJcevNS0ldmS 0kL3g4dT9U1Ra5kQwmX844BQfPWl09Ic0lahMJ48oRm3Y+usK8pyjymUOJkpHTAmV/ OgDoBdQG/3JhLqpxloYLhgftDoa7GNxKXvtx2Ozc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729523AbfIHMnj (ORCPT ); Sun, 8 Sep 2019 08:43:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:57610 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729431AbfIHMni (ORCPT ); Sun, 8 Sep 2019 08:43:38 -0400 Received: from localhost (unknown [62.28.240.114]) (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 8BD3E218AE; Sun, 8 Sep 2019 12:43:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567946618; bh=0G54NzqspS3ThXIbyo+flEPSStI+M8ELnHPxBup1xRM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=w6tfei1czHgAxc28rDjd1Uc+e76ntsNQ+IEDjlir9ffSQqSywi/01XJPi6Go687nb c35eFKhYJ5w+18uwIABsdcg43XKl/EeOyFK7F4+2RRd3M2et2DzyYXGaYlXPfnw4m0 yjsjW+0TKTEAUlPVScGPN6ulh2PLOXf5J1vxTFrg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hubert Denkmair , Martin Sperl , Stefan Wahren , Mark Brown , Sasha Levin Subject: [PATCH 4.4 19/23] spi: bcm2835aux: remove dangerous uncontrolled read of fifo Date: Sun, 8 Sep 2019 13:41:54 +0100 Message-Id: <20190908121102.838776856@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190908121052.898169328@linuxfoundation.org> References: <20190908121052.898169328@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 [ Upstream commit c7de8500fd8ecbb544846dd5f11dca578c3777e1 ] This read of the fifo is a potential candidate for a race condition as the spi transfer is not necessarily finished and so can lead to an early read of the fifo that still misses data. So it has been removed. Fixes: 1ea29b39f4c812ec ("spi: bcm2835aux: add bcm2835 auxiliary spi device...") Suggested-by: Hubert Denkmair Signed-off-by: Martin Sperl Acked-by: Stefan Wahren Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/spi/spi-bcm2835aux.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/drivers/spi/spi-bcm2835aux.c b/drivers/spi/spi-bcm2835aux.c index 5b2c2b2e13396..4d233356772aa 100644 --- a/drivers/spi/spi-bcm2835aux.c +++ b/drivers/spi/spi-bcm2835aux.c @@ -197,13 +197,6 @@ static void bcm2835aux_spi_transfer_helper(struct bcm2835aux_spi *bs) BCM2835_AUX_SPI_STAT_TX_FULL))) { bcm2835aux_wr_fifo(bs); } - - /* and check if we have reached "done" */ - while (bs->rx_len && - (!(bcm2835aux_rd(bs, BCM2835_AUX_SPI_STAT) & - BCM2835_AUX_SPI_STAT_BUSY))) { - bcm2835aux_rd_fifo(bs); - } } static irqreturn_t bcm2835aux_spi_interrupt(int irq, void *dev_id) -- 2.20.1