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=-12.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED autolearn=ham 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 6DEE3C282D5 for ; Wed, 30 Jan 2019 08:36:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2DB2D21873 for ; Wed, 30 Jan 2019 08:36:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548837407; bh=+NKeiMOmB2aC4fMGbZPR7gfEClFJkaaHiCjfdK95z3A=; h=Subject:To:From:Date:List-ID:From; b=vyLmwinTW1WF7t9b4ufR6+vLiJxdLcGK7Sw8GU44miB6DkGY+j4xI1ezXZzmUngTK q7MnorCYuR6u5ww/VV0fenb9qH1PBF85BoC0m5JLEsOAKp+KsSRcuRR+cEJMzFoKlz hB5TcyxMM7CNfORw71vaqK76doCwFx+dNSRi6Efk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727788AbfA3Igq (ORCPT ); Wed, 30 Jan 2019 03:36:46 -0500 Received: from mail.kernel.org ([198.145.29.99]:38386 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727500AbfA3Igq (ORCPT ); Wed, 30 Jan 2019 03:36:46 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.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 4B64C21852; Wed, 30 Jan 2019 08:36:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548837405; bh=+NKeiMOmB2aC4fMGbZPR7gfEClFJkaaHiCjfdK95z3A=; h=Subject:To:From:Date:From; b=ibm0WbaPjYPckgm1S3yLTfXVLbCu0qsj1ZyxhEYhbbllhGmvRYSMyIkOqaZk6UbDi wF0yN4wjENrWF8zKXhrIb1ViYWqGFRnzeBf7Dqv0j8hthb9UUIZ27XTPfhBsZ5w1Fj GsFTcAbt3m198N4H+8IJarQhbIJiWQsVF3se6CDg= Subject: patch "serial: sh-sci: Do not free irqs that have already been freed" added to tty-linus To: chris.brandt@renesas.com, gregkh@linuxfoundation.org, stable@vger.kernel.org From: Date: Wed, 30 Jan 2019 09:36:35 +0100 Message-ID: <1548837395150103@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org This is a note to let you know that I've just added the patch titled serial: sh-sci: Do not free irqs that have already been freed to my tty git tree which can be found at git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git in the tty-linus branch. The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.) The patch will hopefully also be merged in Linus's tree for the next -rc kernel release. If you have any questions about this process, please let me know. >From 4d95987a32db53f3beca76f8c4c8309ef6a5f192 Mon Sep 17 00:00:00 2001 From: Chris Brandt Date: Mon, 28 Jan 2019 13:25:56 -0500 Subject: serial: sh-sci: Do not free irqs that have already been freed Since IRQs might be muxed on some parts, we need to pay attention when we are freeing them. Otherwise we get the ugly WARNING "Trying to free already-free IRQ 20". Fixes: 628c534ae735 ("serial: sh-sci: Improve support for separate TEI and DRI interrupts") Cc: stable Signed-off-by: Chris Brandt Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/sh-sci.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c index 8df0fd824520..64bbeb7d7e0c 100644 --- a/drivers/tty/serial/sh-sci.c +++ b/drivers/tty/serial/sh-sci.c @@ -1921,7 +1921,7 @@ static int sci_request_irq(struct sci_port *port) static void sci_free_irq(struct sci_port *port) { - int i; + int i, j; /* * Intentionally in reverse order so we iterate over the muxed @@ -1937,6 +1937,13 @@ static void sci_free_irq(struct sci_port *port) if (unlikely(irq < 0)) continue; + /* Check if already freed (irq was muxed) */ + for (j = 0; j < i; j++) + if (port->irqs[j] == irq) + j = i + 1; + if (j > i) + continue; + free_irq(port->irqs[i], port); kfree(port->irqstr[i]); -- 2.20.1