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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3B491C43334 for ; Tue, 19 Jul 2022 07:47:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232757AbiGSHrG (ORCPT ); Tue, 19 Jul 2022 03:47:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232085AbiGSHrF (ORCPT ); Tue, 19 Jul 2022 03:47:05 -0400 Received: from bmailout3.hostsharing.net (bmailout3.hostsharing.net [IPv6:2a01:4f8:150:2161:1:b009:f23e:0]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 021F822B34 for ; Tue, 19 Jul 2022 00:47:02 -0700 (PDT) Received: from h08.hostsharing.net (h08.hostsharing.net [83.223.95.28]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "*.hostsharing.net", Issuer "RapidSSL TLS DV RSA Mixed SHA256 2020 CA-1" (verified OK)) by bmailout3.hostsharing.net (Postfix) with ESMTPS id 39C431030DBF1; Tue, 19 Jul 2022 09:47:01 +0200 (CEST) Received: by h08.hostsharing.net (Postfix, from userid 100393) id 149C44ABFE; Tue, 19 Jul 2022 09:47:01 +0200 (CEST) Date: Tue, 19 Jul 2022 09:47:01 +0200 From: Lukas Wunner To: Marc Kleine-Budde , Mark Brown Cc: linux-spi@vger.kernel.org, kernel@pengutronix.de, Stefan Wahren , Florian Fainelli , Jens Lindahl Subject: Re: [PATCH] spi: bcm2835: bcm2835_spi_handle_err(): fix NULL pointer deref for non DMA transfers Message-ID: <20220719074701.GA26268@wunner.de> References: <20220719072234.2782764-1-mkl@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220719072234.2782764-1-mkl@pengutronix.de> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org [+cc Jens, Florian, Stefan, Mark] On Tue, Jul 19, 2022 at 09:22:35AM +0200, Marc Kleine-Budde wrote: > In case a IRQ based transfer times out the bcm2835_spi_handle_err() > function is called. Since commit 1513ceee70f2 ("spi: bcm2835: Drop > dma_pending flag") the TX and RX DMA transfers are unconditionally > canceled, leading to NULL pointer derefs if ctlr->dma_tx or > ctlr->dma_rx are not set. > > Fix the NULL pointer deref by checking that ctlr->dma_tx and > ctlr->dma_rx are valid pointers before accessing them. > > Fixes: 1513ceee70f2 ("spi: bcm2835: Drop dma_pending flag") > Cc: Lukas Wunner > Signed-off-by: Marc Kleine-Budde Link: https://lore.kernel.org/linux-spi/20220603142340.42271-1-jensctl@gmail.com/