Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1740829pxb; Wed, 9 Feb 2022 03:35:01 -0800 (PST) X-Google-Smtp-Source: ABdhPJzRQrAtN6xAATxTNWxPHRIX0rdQymUdz0HUEzIalSxQDxCI94LOvY6GdXWi05DGvhNy1+Ms X-Received: by 2002:a63:6b04:: with SMTP id g4mr1546369pgc.170.1644406500794; Wed, 09 Feb 2022 03:35:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644406500; cv=none; d=google.com; s=arc-20160816; b=SSKeM3iLBXKoZyTokeb+WDTDMrAHG94QCC7TmDrJHYqrN5/r1Rju4JV+QKIdXUuDhc YyTgT07G1GJ8Vv2UYN55oziEZCVTPO/sn0Uix7c+yufmX5xwKjnw3OfHL2ECAfLeo5fG kVDdXzBAKXbHBCK4BxK2rcDdbbtWz2JEegPrJvt+TAC742k3a/vhukQ1S/3F0kqknDse i2SFTDCHdukSIUznS8W9cj4gStgu3IwTn9RE7HqFxqVhB59do7t9JS04jJsxWvzfnigE mcctmbII/DP1z7Dbj5NGVltrmBMDYJEEiv5bhBTmx4COB1ZavDfRlDcoQgf3CseIN4HI XVnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=G1XKT/fBycnN3ZeO+cn5Gr3a7zEtkRQ5N4jLk38tX88=; b=VBQAsQGvlnLBvXV0w5GrbAOIR2FQ7bBbH9d5MR5UUumilwqQhqsQwWZ/3ZdCj5wHnx NqFarncutAp79cpycj4S3aHvms+EEWyue/6Lb5Oy6X917CxWVW23PmJ7Diq7soZT+VX/ HVnRjbAwDSP2/NFR6CDbgWcsfp+ionqs+bey4ajwQmemjV4Gg0i1VeVl/6qJpV9Op5Zo IK4OPjR5+UbNBi/ncfseGkh3w2Z8gnPB/nDnRzUooQdMBjcAnyKcLgxKNkvwJ3CIdyBs 5wuguegdtHxISRAHuHxLBFEv2fzYTaeocmT0oOpANCNG1IKwz9Ku3rfwWyxJyif8qMC9 nurA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=aq6IU9Ac; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id kb18si6102130pjb.44.2022.02.09.03.34.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Feb 2022 03:35:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=aq6IU9Ac; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 359BEE0D447A; Wed, 9 Feb 2022 01:53:47 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1387218AbiBGLk2 (ORCPT + 99 others); Mon, 7 Feb 2022 06:40:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1384754AbiBGL37 (ORCPT ); Mon, 7 Feb 2022 06:29:59 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B18EC0401DC; Mon, 7 Feb 2022 03:28:19 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1736BB811BE; Mon, 7 Feb 2022 11:28:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3A233C34105; Mon, 7 Feb 2022 11:28:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644233296; bh=UQXmFZvWzDM7T2wZ+gPuu+7zNQpmp5zPgxWJTNgyGXI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aq6IU9Ac0g28anXfaCl112u/WLMKHHtio1k8ya51ZrVKxXNmGaazTWehkv6LwAiY6 ExI02T1imwcIA5Z20EH3Kbv7VBy9TdF636ES182qjLDm7wvlhAcmDQO0denAyLperg 2OpKiGauxUXRRvjYmBHUmpAvoMIOnr/Nf9amGjro= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Benjamin Gaignard , Mark Brown Subject: [PATCH 5.15 051/110] spi: mediatek: Avoid NULL pointer crash in interrupt Date: Mon, 7 Feb 2022 12:06:24 +0100 Message-Id: <20220207103804.007505010@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220207103802.280120990@linuxfoundation.org> References: <20220207103802.280120990@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Benjamin Gaignard commit f83a96e5f033fbbd21764705cb9c04234b96218e upstream. In some case, like after a transfer timeout, master->cur_msg pointer is NULL which led to a kernel crash when trying to use master->cur_msg->spi. mtk_spi_can_dma(), pointed by master->can_dma, doesn't use this parameter avoid the problem by setting NULL as second parameter. Fixes: a568231f46322 ("spi: mediatek: Add spi bus for Mediatek MT8173") Signed-off-by: Benjamin Gaignard Link: https://lore.kernel.org/r/20220131141708.888710-1-benjamin.gaignard@collabora.com Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman --- drivers/spi/spi-mt65xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/spi/spi-mt65xx.c +++ b/drivers/spi/spi-mt65xx.c @@ -624,7 +624,7 @@ static irqreturn_t mtk_spi_interrupt(int else mdata->state = MTK_SPI_IDLE; - if (!master->can_dma(master, master->cur_msg->spi, trans)) { + if (!master->can_dma(master, NULL, trans)) { if (trans->rx_buf) { cnt = mdata->xfer_len / 4; ioread32_rep(mdata->base + SPI_RX_DATA_REG,