From patchwork Mon Dec 10 18:21:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 10722111 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9BE7A3E9D for ; Mon, 10 Dec 2018 18:22:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8DA8329CA8 for ; Mon, 10 Dec 2018 18:22:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 821B42AB93; Mon, 10 Dec 2018 18:22:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1A30929CA8 for ; Mon, 10 Dec 2018 18:22:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728444AbeLJSWB (ORCPT ); Mon, 10 Dec 2018 13:22:01 -0500 Received: from baptiste.telenet-ops.be ([195.130.132.51]:40760 "EHLO baptiste.telenet-ops.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727781AbeLJSV7 (ORCPT ); Mon, 10 Dec 2018 13:21:59 -0500 Received: from ramsan ([84.194.111.163]) by baptiste.telenet-ops.be with bizsmtp id AJMv1z00a3XaVaC01JMvoq; Mon, 10 Dec 2018 19:21:57 +0100 Received: from rox.of.borg ([192.168.97.57]) by ramsan with esmtp (Exim 4.90_1) (envelope-from ) id 1gWQBn-00021O-RQ; Mon, 10 Dec 2018 19:21:55 +0100 Received: from geert by rox.of.borg with local (Exim 4.90_1) (envelope-from ) id 1gWQBn-0005JD-QO; Mon, 10 Dec 2018 19:21:55 +0100 From: Geert Uytterhoeven To: Greg Kroah-Hartman , Jiri Slaby Cc: Ulrich Hecht , Wolfram Sang , Yoshihiro Shimoda , Yoshinori Sato , linux-renesas-soc@vger.kernel.org, linux-sh@vger.kernel.org, linux-serial@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH v3 2/4] serial: sh-sci: Fix crash in rx_timer_fn() on PIO fallback Date: Mon, 10 Dec 2018 19:21:52 +0100 Message-Id: <20181210182154.20357-3-geert+renesas@glider.be> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181210182154.20357-1-geert+renesas@glider.be> References: <20181210182154.20357-1-geert+renesas@glider.be> Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- v3: - Split in multiple patches. --- 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 2a08039f792235e5..e353e03ce2602559 100644 --- a/drivers/tty/serial/sh-sci.c +++ b/drivers/tty/serial/sh-sci.c @@ -1369,7 +1369,7 @@ static void sci_submit_rx(struct sci_port *s, bool port_lock_held) 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)