Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp4430780ybe; Mon, 9 Sep 2019 09:10:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqy3I3QnE3C5RL0quQ90Dyqptv5+xoefWXMv8+aDwqVHkAQl+gabQiIeKFqSZ1CkT2uDYl8T X-Received: by 2002:a50:fa99:: with SMTP id w25mr25180277edr.259.1568045414675; Mon, 09 Sep 2019 09:10:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568045414; cv=none; d=google.com; s=arc-20160816; b=jvHOfXo3pzCOXcdTS1BV4U1CFmeQ95mXw5DbmQDMfaHyIWHQV3D5a9WmZ7lIZNmkwQ gbmSQFUtmDTXmVPNqp3Dh2YS+pmHe4HXUnynk8nqmrxVQ/dBRaQ19eca+NZP1IZuZV0H Sq4PQBk3cvsWlUmN8OLFHi2uzTt1SBl302uECh9m/ECjH5xHTWEY4oNC64sSKKkaYRRp 3gDsVwoScqUmPy+zhtM05uHtGm8F+MF/9hwMiflApqX0E78G/6FdTRVelJkdRwxweEWt xwXaPTTh7ByUwMSxTxl8I9na2AOkhh/UdPjyhUhz7GQNgMGip3hfu3CDYdu0WK2ZV6br u7fw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=nkbqO/+fi4vPea8Wg42EUBj/qLVt9nQBHBt17GSr3ts=; b=taRc8X+ElkUoN3CjxGF17by3tW/0rVqHZn19IFN2wLl7M87EGWI6FSlxr9o0tmNpKJ CNHRsOYq3wFIs0IqeMMhvBgzMxwEA4fH1wS8BlBT7FuCps575DqG19qIud10VSpvhRIw 7lEP3bRdHAggrr8cWI4Td0sZ/8HiJEko65vH1SJR/whuIBGxw3HJoW9wwMoOdGZhyOK3 R2ACatWfvPDkl8ik619uSPG+5GQNPQPNiVdsZg2+HkQpH/4dfMq9cs2e6BAtTXv5uSN7 fJ3tP3bxoWxHHl2ryZp5cHljZM0KYDX1LbwN/Gg7TSxxJtPjCoi0SF4FflARe4s4GuZQ bkOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ZfCgzEvA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j10si9555998ede.70.2019.09.09.09.09.49; Mon, 09 Sep 2019 09:10:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ZfCgzEvA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726460AbfIHM7W (ORCPT + 99 others); Sun, 8 Sep 2019 08:59:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:33382 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730268AbfIHMqB (ORCPT ); Sun, 8 Sep 2019 08:46:01 -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 A1B38218AC; Sun, 8 Sep 2019 12:46:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567946761; bh=0OjlmtzajQP3fonjsDscpmVG6sUf8ItzbOVzKh6nRrA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZfCgzEvAd3ZvLGcqyNgebzjAwRcyndpwbrD3SYz+MTGRVLPv6OFGxFHTh0p91Ll/9 LVYq4NEk6UMUwIFZZ5OkbSYv8RGC2cZ0dlMhrguIuonn7h6vZicTeRAuoTJDZkcwxd CATRwYIB46TfXer5iL+lsXO2fERRvQhOgXHG3OZI= 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.14 30/40] spi: bcm2835aux: remove dangerous uncontrolled read of fifo Date: Sun, 8 Sep 2019 13:42:03 +0100 Message-Id: <20190908121128.360829184@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190908121114.260662089@linuxfoundation.org> References: <20190908121114.260662089@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 97cb3beb9cc62..4454d9c6a3dd4 100644 --- a/drivers/spi/spi-bcm2835aux.c +++ b/drivers/spi/spi-bcm2835aux.c @@ -194,13 +194,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