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: 199402 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp1852581dyd; Sun, 11 Feb 2024 01:59:18 -0800 (PST) X-Google-Smtp-Source: AGHT+IEUKcTDDATxSCSyzTIHGtCtz/J10MRbqMN3iG/tCNf0+LzX+/ehxG5/ozIj5ybJKfHdvdVT X-Received: by 2002:aca:2803:0:b0:3bf:e41d:143d with SMTP id 3-20020aca2803000000b003bfe41d143dmr3765986oix.27.1707645557829; Sun, 11 Feb 2024 01:59:17 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707645557; cv=pass; d=google.com; s=arc-20160816; b=DC4Yo0onfJP3sxTKSZks4Fpw+nziTdU1Cae402JGodLZnZjCDvnUWP/83MUnaAM5gC UOn+DYUF9NzSwaXzrxTqlVs5npZVOXohbgSBY93OuieidWLttIdIZm4n6xOZBNYBVSBf xPrCgOXSqc/qggMZoD3wSv0V0G7mscUJgoI3OO22c14DJpPU9KaijzLw/nanS6HfZPHx f0Kyif0b7Y6zGMB5QUpnww3TaoZZrX1vPaJ5c0OdHB3sW2iyYANlHDxrhUwUsSb6JBZq sJSwWCGp6jm0OjdmS9rNOJsuDBK/YEM8ZAIQxCd8ACcbJTwF1Yf1XNFyopjmJAdjgUh0 LL0g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-id:precedence:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter; bh=zrAKU1WmIFdoyV8NLPmCBMZM/75kinMpwCN70VT5DHA=; fh=7Znl11p6rKTydYKM2MmBnnRNgTw8pBHgPkk/ENWqRPM=; b=HuOJ91kDw8dZyhpiezDEzWwBJcomAgbEn+fNxM1l/OwAce9ibPkCBJCPUCk1BvYDsL JoVaIbrXHle8z38AI2LYar16Y4H6GXt4mXrcmnj7N+/3IEJYfD+NJFnz41jh4Jo+7ZhT GJcuKGcnyRDEseBoclvuODdHD0MjEifw0jaO8glAqCd72LV1559SPGfqxFMxnDh72Jqc HGzFE3YzK/MPFkvPAXfK9L8xGqihnqHIrLK81vEfy+1NVqFYfmruEfsBj1I96dXQ0jtb +Bjv0VQ4okyTJdWnkeZ+cMJeJN48CzIyseny0fjYogk+BJNl2LgPrCJnhvCtCCq3j9Sh g33w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ispras.ru header.s=default header.b=AUKG70va; arc=pass (i=1 spf=pass spfdomain=ispras.ru dkim=pass dkdomain=ispras.ru dmarc=pass fromdomain=ispras.ru); spf=pass (google.com: domain of linux-kernel+bounces-60690-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60690-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ispras.ru X-Forwarded-Encrypted: i=2; AJvYcCWSFOkd7X0JCm06Fg9fny8evBysBLPw4IYvgmQ8tyPSAPrymW8JtJzIMcQVava0II0ubwtqrQxh34X1/4PqsmYNRUQ9sA== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id s17-20020a056a0008d100b006e0537cfa43si3326377pfu.186.2024.02.11.01.59.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Feb 2024 01:59:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60690-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@ispras.ru header.s=default header.b=AUKG70va; arc=pass (i=1 spf=pass spfdomain=ispras.ru dkim=pass dkdomain=ispras.ru dmarc=pass fromdomain=ispras.ru); spf=pass (google.com: domain of linux-kernel+bounces-60690-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60690-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ispras.ru Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 8A060281F71 for ; Sun, 11 Feb 2024 09:59:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 667095A0F4; Sun, 11 Feb 2024 09:59:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ispras.ru header.i=@ispras.ru header.b="AUKG70va" 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 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-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790596148865104913 X-GMAIL-MSGID: 1790596148865104913 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;