Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp4168310ybe; Mon, 9 Sep 2019 05:27:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqwDtJoBW5Nc1bcYSTm7phckVD0RQwHV7HfyMFhXEQCQpUDpJh+AbJ4m7Kj32uSwq+C72sIh X-Received: by 2002:a50:9734:: with SMTP id c49mr24279924edb.93.1568032028019; Mon, 09 Sep 2019 05:27:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568032028; cv=none; d=google.com; s=arc-20160816; b=hjb3YqVs8BH7aq+CP2vZJL91fignLxIJqw3scQ2hfO7FiiKK7aEAXNrw5/Od87t4cf DGaYv0v1GOjHIssSUJGoIZItKj3qYwCmIKJHNuMXfHGGPxvAdSbsTU5x0yQx7trN3man Flh8QceWiFdnB1p6o0JGMxfzksQjgfVKefiSrnLpNkWZPacFYAheq12BoZrkqUXV7oY7 ucXwzm2WkUFD/HD5OFD1NfYABJkoGrjh2duWguBO0JZNwQ9taThniKImgvGTjGeGCJiv DM7Pz3/oZHEyGnUNfrsjk1LNu25ABb6LDlxLFQINmg1ESu1boIjJ1LlyNdXSWFnFQAGi 8oMg== 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=HPBaMJSSPJvpzqWCTVRERhKDsIPF4coy2xgFmk653bg=; b=C33JFsi5PhbUq78fUaSJRWKQLpvyVbs0QKYQJzoBY/h51X7RbunHOIqfeS1mXNX6wI xfrJfoxyCRfmEgMyuFc8lO+UNacGxZyRFLlsKwzhqhsSY5ehXz3ASdL0EGf/+qDg6ByW YFkUgZS7+FperI2YpzbzejKpg8yXFKZTM2/Tfz60fXeDUJXH9ssyFsnANDzqazM+m7r5 Xb44JH6tLNrRdLE79dtQ4kSX72ZFoVGHA6Dbd2vHwe1B601PNpVs18lzxjtpfQR3ssSu yS1nFVaMitHFF7BbCsjpq5tyvM1bpql5h+Kman+l7EAhGZ6hsvB2/kR/5IkzCUk760tK /AQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=icKt4V6P; 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 p40si8605171eda.334.2019.09.09.05.26.44; Mon, 09 Sep 2019 05:27:08 -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=icKt4V6P; 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 S1726957AbfIHM6i (ORCPT + 99 others); Sun, 8 Sep 2019 08:58:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:34924 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730528AbfIHMq4 (ORCPT ); Sun, 8 Sep 2019 08:46:56 -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 A1D23216C8; Sun, 8 Sep 2019 12:46:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567946816; bh=9zkCM/mi2gR3OHMRRpaCRsuGG0uWPCXUQDHBve/+Mgw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=icKt4V6PQxU1Y50rDLWvRp+5n5wtyJpSotSUaoAM/4ZyEufN/ImrWOxqghvvbbcl3 agNJ5fUJLeWQGKzevXSQtyMIqjkKldC/GgMesRghJ2e6jtZVfll6CGASCFS7IrLqMB jC9m2eGg/bPNW120YZv1W2kHotG2Q/06qOr4UC6c= 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.19 11/57] spi: bcm2835aux: remove dangerous uncontrolled read of fifo Date: Sun, 8 Sep 2019 13:41:35 +0100 Message-Id: <20190908121128.976826503@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190908121125.608195329@linuxfoundation.org> References: <20190908121125.608195329@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 79306e654f735..b4217f9480014 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