Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1669736pxb; Wed, 9 Feb 2022 01:44:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJy0tzbtMDOFzZJkM8js85mDqivDxg0t+93EII1hhWik/pf8E3fysAOQiN4+cLumztnHWaJr X-Received: by 2002:a63:6bc4:: with SMTP id g187mr1195222pgc.151.1644399881101; Wed, 09 Feb 2022 01:44:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644399881; cv=none; d=google.com; s=arc-20160816; b=OczVNHqsWaqLGTcAr6NsypdlIE2qhjwNgqLF3Aj6OCg5pmygIVR+67gWt9WuQkSn6y TPwTpwsbv4QSXGnveDhF+iasgakghef8/h1dXbueZGYwkY5xZE6R22xbwcQzu0+yhEuj t+kmwOkdgwls/Yi1lP6iTZvYyh3yKFcud53lbWwRMhqyMVfaWGk96r+T3Q2DgMHXYGxe X+ijQZMRJ5ePTo0bcFW3V72+RdYni4HZ1WeKjI3aTCexRXJO26H23ArWxp53Ck/Hmsh+ LVj8y1AsgUcyTCGfZEnAcwdXJctdpE+GLW4UY7eLf0t/hD69NzxWrj44O4MKlxR5ui1c vJ3g== 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=SxjTm5l6LO5aqH9vA6S5JrlmPyHApqLPtPOMWsAp15E=; b=Uj3EkEBjiY3ciI6W7gj/R5zYwOAyXypSl6yGj6XYHQ4ZbujqikDY3bMC5PsO34XYix puRD8eR+Msc6VGpKZyzXVc8WRl/uzx099+zVXJaAwrOM3sAjAEdLX1g4A8p1c+MBb1ZY kW17gVShvmxVCY1nGWjLhsXdydKzFXV0MMv6oDnV4DIkvpMWO6OFZ8oS2e2i9eqiKPKy F6nOxLyml31+F1RYd6Uhvtqvd9Z7s8idCKzBt0E4lzrHIbyImbg91/wYRBqLa1x/ZsG+ 6yZdAx6l4dJ8hpEmy4tTamoyuujtV/kjH8UA0lEZoS8ixkIvbYhzC/MLAvfMPUFzeg0A YKLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="OD7k/3qD"; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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. [23.128.96.19]) by mx.google.com with ESMTPS id oc17si5316255pjb.13.2022.02.09.01.44.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Feb 2022 01:44:41 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="OD7k/3qD"; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 38A50E01976E; Wed, 9 Feb 2022 01:06:21 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383266AbiBGLV5 (ORCPT + 99 others); Mon, 7 Feb 2022 06:21:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55248 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1381312AbiBGLRI (ORCPT ); Mon, 7 Feb 2022 06:17:08 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17DE7C0401DC; Mon, 7 Feb 2022 03:16:57 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 990696113B; Mon, 7 Feb 2022 11:16:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 82511C004E1; Mon, 7 Feb 2022 11:16:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644232616; bh=0Lx6J+nW1j3Xe69Ss/RmZp3ltqUDCKWoqBjjFqSPDh4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OD7k/3qDzu+b7FeUtmU4laWnWO/zQwc6AxwmkoXywWDwEv/uhoPcuPcQvOSznEVxA cGqRFsxCfyk2RQ2qTiKbb7DZYeUbTmRP5bHIYjandNEJxLNjQ/6c7BpxHJsm/5s8DX PuMQFCgZTZu+N2Ba/s1Py1L7pKqiKFvd/pfFo2/M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Benjamin Gaignard , Mark Brown Subject: [PATCH 4.19 68/86] spi: mediatek: Avoid NULL pointer crash in interrupt Date: Mon, 7 Feb 2022 12:06:31 +0100 Message-Id: <20220207103759.793203566@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220207103757.550973048@linuxfoundation.org> References: <20220207103757.550973048@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 @@ -498,7 +498,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,