Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp13373906ybl; Sun, 29 Dec 2019 10:20:43 -0800 (PST) X-Google-Smtp-Source: APXvYqwPMY6Kiha5inF/90OI5FCKo+WpHczXCuGPfS9/fFg2PZzmbAnKZ/Yij+xYqhch1xf0CNDR X-Received: by 2002:a9d:6211:: with SMTP id g17mr64374119otj.168.1577643643284; Sun, 29 Dec 2019 10:20:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577643643; cv=none; d=google.com; s=arc-20160816; b=kcFOHU55bbsT6B3Uhmf9gnU0G2K0sVmt1/4EEqBrn4+2fDiq/YBcpzunBV766Msj02 BQU8+Y7fRSHhS4DmOW1CMSSsb5UDbVMAFgTyW87Q1VVCUSoLK4lUZN7ySrFSPgTEMK6f HxjyNGBY9fR1tXsMgRISs566q5pJ1oTE+psO+x0lOc6oLidJXUt2UzYAhuqieIcezDiu kXiatTJaK06beXzmkexX72D2FcmSsDmmDuUuO45e72EKzo8cAj48obwcUfVPfEUp/3Jr ifrkxb5b1BOzyVE6f+V/DwsysYp9AW75berxij/xF9lS7/Hz6NTuKG5YHX9U03z1ynHG nf8w== 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=ndyNKFljy4mjQirLHoBH3Y9dlIDYauzQU8XegBsZ3fs=; b=rIcIlh04mVF6dYz+LMqJfluW5NBgLTRePhTSm4pke4XEh8boYsPCZJRk+8ihxVqIAQ uWhm9r+M3UL/qSfnZ37Oae1Hpmn8QXshhOYxnWZX9cYWWWpE6DqJYLphZ91ECkJDU65q BUf30WWbpFUIxi897yZuyAKs51kReQ/f/QJRX0mD0hH2w2FACLe7Pe/e1NX0WiWNfbEh yJ6csNwt21FLq54WAuUOs25KBhjv+MrVwLYrPtxv5pjxsLz01FVifpyPPTI89DLyf8eI L65V5yBSUyeFxld+69Yx17zpz3Jhd9jaliKJUhWA+7xDOIs5OrJ9WqExtnoWdljS/apF CKbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=vY8Pqi3S; 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 t23si21890184otk.304.2019.12.29.10.20.31; Sun, 29 Dec 2019 10:20:43 -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=vY8Pqi3S; 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 S1727982AbfL2SSY (ORCPT + 99 others); Sun, 29 Dec 2019 13:18:24 -0500 Received: from mail.kernel.org ([198.145.29.99]:37130 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726974AbfL2RVl (ORCPT ); Sun, 29 Dec 2019 12:21:41 -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 9240E20722; Sun, 29 Dec 2019 17:21:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1577640101; bh=iPj0zluIWzyqWRoO57oi2l4TB1Hqdaa8CAffhmRVyYI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vY8Pqi3SDRIC0bj8HI1LCMx4SBxHPp0lvYQjGk48zD0UOGZICgJ0HDsOBWlJyN8am 7f1rnja+ARjNrLRHgNkF2fGFbqZ4tys1CRTDi0mDQrqRg2ZXfzUsKl0GJV+5nBFSuP 1WWSOrTfHpudxT7EVnk2NPYeH3b6qsyOj7MjwHgI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai Subject: [PATCH 4.14 019/161] ALSA: hda/ca0132 - Avoid endless loop Date: Sun, 29 Dec 2019 18:17:47 +0100 Message-Id: <20191229162402.698914747@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191229162355.500086350@linuxfoundation.org> References: <20191229162355.500086350@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: Takashi Iwai commit cb04fc3b6b076f67d228a0b7d096c69ad486c09c upstream. Introduce a timeout to dspio_clear_response_queue() so that it won't be caught in an endless loop even if the hardware doesn't respond properly. Fixes: a73d511c4867 ("ALSA: hda/ca0132: Add unsol handler for DSP and jack detection") Cc: Link: https://lore.kernel.org/r/20191213085111.22855-3-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/pci/hda/patch_ca0132.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/sound/pci/hda/patch_ca0132.c +++ b/sound/pci/hda/patch_ca0132.c @@ -1300,13 +1300,14 @@ struct scp_msg { static void dspio_clear_response_queue(struct hda_codec *codec) { + unsigned long timeout = jiffies + msecs_to_jiffies(1000); unsigned int dummy = 0; - int status = -1; + int status; /* clear all from the response queue */ do { status = dspio_read(codec, &dummy); - } while (status == 0); + } while (status == 0 && time_before(jiffies, timeout)); } static int dspio_get_response_data(struct hda_codec *codec)