From patchwork Sun Feb 11 09:58:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Khoroshilov X-Patchwork-Id: 13552413 Received: from mail.ispras.ru (mail.ispras.ru [83.149.199.84]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ACC845917C; Sun, 11 Feb 2024 09:58:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=83.149.199.84 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707645538; cv=none; b=PlDwj83rXqKJTQYjdNPd6eY6e5Gr05vZJMV9L8ECyoe01mxfZZRN34r1Lkw+HtDfL3jds1L+UqxT824m+WHWnSAkOBlCwhIDX/0BK6eGv1EWjWQQ/K5N4LoFhqpbqqS79ZpTg8SPpUNyFcA/hkgXsJDHWDIkg4rcauQBaB0ymiY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707645538; c=relaxed/simple; bh=gkwPc7vWc+CTySu0S5dUqZvQFI8Fe0o8D0d6k2H5zvY=; h=From:To:Cc:Subject:Date:Message-Id; b=S3H8/j39SWZydQIpiAY3kMeLXOHzk7FbJUxOzdhvgzgW/NSws9Z/I+i/wQUwG2P3+kg/Ts+VJQa6c2yu25zY5GRyYvjqonLnxUn8tJXXh2QCjtgGaTQoGNKUy88u9UfzfehpNnUl9mSXkdHPB0cEjx4vaWKLkWWLr0fLoWPwEm0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ispras.ru; spf=pass smtp.mailfrom=ispras.ru; dkim=pass (1024-bit key) header.d=ispras.ru header.i=@ispras.ru header.b=AUKG70va; arc=none smtp.client-ip=83.149.199.84 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ispras.ru Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ispras.ru Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ispras.ru header.i=@ispras.ru header.b="AUKG70va" Received: from hednb3.intra.ispras.ru (unknown [185.145.125.130]) by mail.ispras.ru (Postfix) with ESMTPSA id E189840F1DE1; Sun, 11 Feb 2024 09:58:51 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 mail.ispras.ru E189840F1DE1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ispras.ru; s=default; t=1707645532; bh=zrAKU1WmIFdoyV8NLPmCBMZM/75kinMpwCN70VT5DHA=; h=From:To:Cc:Subject:Date:From; b=AUKG70vaNyi4rsCTVK8t9s4etGlkQQDHnvD6420e3DwkVzN29g2Dl5YzaQfOoK56k jTF5rzNO7cCaHujDTvDuBPNsHQESVbnwah5fllBTt86PqOvlaEUpCSjLiNWcXcjKIj 5Z8L0SrH3uaGQCz8+q6yRPrjeHuzQDJixmriY06Q= From: Alexey Khoroshilov To: Oder Chiou Cc: Alexey Khoroshilov , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Shuming Fan , linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, lvc-project@linuxtesting.org Subject: [PATCH] ASoC: rt5645: Fix deadlock in rt5645_jack_detect_work() Date: Sun, 11 Feb 2024 12:58:34 +0300 Message-Id: <1707645514-21196-1-git-send-email-khoroshilov@ispras.ru> X-Mailer: git-send-email 2.7.4 Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: There is a path in rt5645_jack_detect_work(), where rt5645->jd_mutex is left locked forever. That may lead to deadlock when rt5645_jack_detect_work() is called for the second time. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: cdba4301adda ("ASoC: rt5650: add mutex to avoid the jack detection failure") Signed-off-by: Alexey Khoroshilov --- sound/soc/codecs/rt5645.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c index 5150d6ee3748..0cc2fa131d48 100644 --- a/sound/soc/codecs/rt5645.c +++ b/sound/soc/codecs/rt5645.c @@ -3317,6 +3317,7 @@ static void rt5645_jack_detect_work(struct work_struct *work) report, SND_JACK_HEADPHONE); snd_soc_jack_report(rt5645->mic_jack, report, SND_JACK_MICROPHONE); + mutex_unlock(&rt5645->jd_mutex); return; case 4: val = snd_soc_component_read(rt5645->component, RT5645_A_JD_CTRL1) & 0x0020;