Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2751172imj; Mon, 11 Feb 2019 07:58:03 -0800 (PST) X-Google-Smtp-Source: AHgI3IYlz12KOV5yzWEqKhnOd02Um5DJ/QHiFo8yXhQgGwSY3lko6AtHmdX376Rxg6AXPvwP5S1F X-Received: by 2002:a62:1b83:: with SMTP id b125mr38607126pfb.42.1549900683093; Mon, 11 Feb 2019 07:58:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549900683; cv=none; d=google.com; s=arc-20160816; b=dDI3REsLceNxSPUfgiX7z5LabMdSziUGneZhwNeGPiU6GGoqdvA+aIA8/aIMRn2y5/ JX7B6Xet2fPK6KLEeygTi2h28G0liS8Q0+h55+v6/eCJFI1eIZU7t7PeQyfXvgdEO1kQ CmijRZ+fS7a4v/NaVVilxcdZvO7+YX6y4A4sAoFEcXFyKGB7ZD02W/x1Rtvd2Z8e1ZYd vch7ZI/5eqqHWtHVsUJ8MsSK/1XfhEoLK6lA2cOFZakO383Ck3gh6b0QVsoEsUDK/awa 90cLoTkam9otZezzbgLsEKljY7APgibOQkJN9/CrvHPh3P58HdX39TEq3MDNijQwy2kt OUJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=D98gVfMFSKaaMS0MFaRVx174mHTfXBMTXtQhrwhmeG0=; b=rzM+fC909vGOgFsASxnqqIpw5CvtdaEUt91293Vc8qhxwsztx1JNrBH2jihh6v4ELp QbJEMbPD3n96lTEuD40+3mQ+8zDW77E18Qzc3XD5nmiF6RiRzabSvoE7Pbx4nY+wZYyA fQLXcKjRXR0JfFpNfgsRTte7fuowOtA5QUGhEh8XusOBR1qJxLNPoNo9eSTIMdl+9Yto OtpyNrtMiFY4UebfTUEweTi8S1gQFJiz4IKClPjXryN19Sb4Y2DMfFc9wlXFDKUjmNcj KeL5g9LRRB5pKy3Zf3BaPVWInNM4nHGTn9oM21trzYqI2omGvCDkUXH45N4iTxw3RgiS caZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=il5Nof00; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p5si4053194pgl.180.2019.02.11.07.57.47; Mon, 11 Feb 2019 07:58:03 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=il5Nof00; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730734AbfBKOd6 (ORCPT + 99 others); Mon, 11 Feb 2019 09:33:58 -0500 Received: from mail.kernel.org ([198.145.29.99]:41878 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730759AbfBKOdy (ORCPT ); Mon, 11 Feb 2019 09:33:54 -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 E5825204EC; Mon, 11 Feb 2019 14:33:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549895633; bh=ieiwnAJO+rS8b6oJr17uZhN4tnm095mIePEvGJ+odlg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=il5Nof00XrLmGbR9By+XVhNtS7jM4ChxbgI9+DmVcPDb30+iNZVqirHvqhg1jdUf6 SqxPK2hzmUHxCn7xoOvfPvOlrDiBbxlz5xq8ZQVQXNb5RnQLcvJrmDlSjgB3eEK4oi p9Xpw+ubPdlO0qnK9rpzcU4z1T5sNtpGJOfLjHBI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jia-Ju Bai , "David S. Miller" , Sasha Levin Subject: [PATCH 4.20 270/352] isdn: hisax: hfc_pci: Fix a possible concurrency use-after-free bug in HFCPCI_l1hw() Date: Mon, 11 Feb 2019 15:18:17 +0100 Message-Id: <20190211141904.181569597@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141846.543045703@linuxfoundation.org> References: <20190211141846.543045703@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore 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 4.20-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit 7418e6520f22a2e35815122fa5a53d5bbfa2c10f ] In drivers/isdn/hisax/hfc_pci.c, the functions hfcpci_interrupt() and HFCPCI_l1hw() may be concurrently executed. HFCPCI_l1hw() line 1173: if (!cs->tx_skb) hfcpci_interrupt() line 942: spin_lock_irqsave(); line 1066: dev_kfree_skb_irq(cs->tx_skb); Thus, a possible concurrency use-after-free bug may occur in HFCPCI_l1hw(). To fix these bugs, the calls to spin_lock_irqsave() and spin_unlock_irqrestore() are added in HFCPCI_l1hw(), to protect the access to cs->tx_skb. Signed-off-by: Jia-Ju Bai Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/isdn/hisax/hfc_pci.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/isdn/hisax/hfc_pci.c b/drivers/isdn/hisax/hfc_pci.c index ea0e4c6de3fb..0109e0e8bcb6 100644 --- a/drivers/isdn/hisax/hfc_pci.c +++ b/drivers/isdn/hisax/hfc_pci.c @@ -1170,11 +1170,13 @@ HFCPCI_l1hw(struct PStack *st, int pr, void *arg) if (cs->debug & L1_DEB_LAPD) debugl1(cs, "-> PH_REQUEST_PULL"); #endif + spin_lock_irqsave(&cs->lock, flags); if (!cs->tx_skb) { test_and_clear_bit(FLG_L1_PULL_REQ, &st->l1.Flags); st->l1.l1l2(st, PH_PULL | CONFIRM, NULL); } else test_and_set_bit(FLG_L1_PULL_REQ, &st->l1.Flags); + spin_unlock_irqrestore(&cs->lock, flags); break; case (HW_RESET | REQUEST): spin_lock_irqsave(&cs->lock, flags); -- 2.19.1