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 X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EB462C432C3 for ; Tue, 3 Dec 2019 22:50:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B38B92084F for ; Tue, 3 Dec 2019 22:50:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575413432; bh=ewg2iAP8wiQOEAN1Lo6n0e2slYRIgf4B8vDxOHN64Eo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Z6Ps3T3bHQ1f6z8lppDGF4kw1JE7d9Chsd9UANn4DBhN89rvm6VcvotqJI/5hFO11 V/608HSlrWDXs+8NXcpg9w/8wN/R2LHyUkYzxHmy+cj/hGeJamhc0ZucH00SGqZqA8 +hhImIIRKi1VKeVhbsZMzHX51D3TKpzLxfr+Ebmo= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729766AbfLCWub (ORCPT ); Tue, 3 Dec 2019 17:50:31 -0500 Received: from mail.kernel.org ([198.145.29.99]:42064 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729756AbfLCWu1 (ORCPT ); Tue, 3 Dec 2019 17:50:27 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 13DC020863; Tue, 3 Dec 2019 22:50:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575413426; bh=ewg2iAP8wiQOEAN1Lo6n0e2slYRIgf4B8vDxOHN64Eo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kKj92l1Yenj5Ic3YTpfXyLMupP04341Chl0NHnh+0wo/QHcAWl6ZmLA8/VgtuXuGw GqPa6CVVpYPDMW9nfbaWt5P4RcFEM8BB53FZ68xEpezmE1+ectEEHeJbG+mWnRYpDE csoVDewh+Cz8NYjBihx8An62TbEvMs9Be+r4RB9k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Geert Uytterhoeven , Sasha Levin Subject: [PATCH 4.19 122/321] serial: sh-sci: Fix crash in rx_timer_fn() on PIO fallback Date: Tue, 3 Dec 2019 23:33:08 +0100 Message-Id: <20191203223433.502621112@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191203223427.103571230@linuxfoundation.org> References: <20191203223427.103571230@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 From: Geert Uytterhoeven [ Upstream commit 2e948218b7c1262a3830823d6620eb227e3d4e3a ] When falling back to PIO, active_rx must be set to a different value than cookie_rx[i], else sci_dma_rx_find_active() will incorrectly find a match, leading to a NULL pointer dereference in rx_timer_fn() later. Use zero instead, which is the same value as after driver initialization. Signed-off-by: Geert Uytterhoeven Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/tty/serial/sh-sci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c index 5550289e6678b..9e1a6af23ca2b 100644 --- a/drivers/tty/serial/sh-sci.c +++ b/drivers/tty/serial/sh-sci.c @@ -1359,7 +1359,7 @@ fail: dmaengine_terminate_async(chan); for (i = 0; i < 2; i++) s->cookie_rx[i] = -EINVAL; - s->active_rx = -EINVAL; + s->active_rx = 0; s->chan_rx = NULL; sci_start_rx(port); if (!port_lock_held) -- 2.20.1