From patchwork Mon May 31 13:12:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 450515 Delivered-To: patch@linaro.org Received: by 2002:a02:c735:0:0:0:0:0 with SMTP id h21csp890664jao; Mon, 31 May 2021 07:43:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyr1sjleYEEWORfPqFNP1b973GSyck+i6OiXo7VDkfSo/4OOOGl9dN6E/cNu5ZKxF8SLb5I X-Received: by 2002:a02:7348:: with SMTP id a8mr20889537jae.116.1622472218735; Mon, 31 May 2021 07:43:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622472218; cv=none; d=google.com; s=arc-20160816; b=pOHeX4lxOibh+SXC187rR9tBFL0M8kbqoJ52hpWrhzDtQA321e90cDzzBFHsIhSI4o T8B8lpsTzz9/89cw5ligN2j4Z3tSKs5zOCkkqCHNLcOQzlttRV4PEnqWI7ehG8FrcvRB LlCcG+6diy3YTC6gXlaVT3ccpLCiq9aSSCatpQPEi4BZAO07LvKg1xRo/I3BtiXWxlAe elXJhwXv1LS/PIoaAKc3FDBILOhzDHf5TOZJ7yjO5sL0B4EVUB2p45xskr2krBj4cwoF z6sbSs4eUbGiT/YA0IGkuP++Sm/XqABfw1haLInDsy/MHsS1q79eTDGM8oJ+Eb1oxY+D ZgmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=z7D+1YoYt7iBePXZSSH1KgW3pmtf/YfvFy0/wl8Y3hI=; b=Xrw58rzr9R6bBEHgngehBa/Dy9PTg54sTKjrjE4iY9YGHDUyfOcLuWKEvrcKkLPFxu tK8XuwMv+kGkQzjnCqxffShqaY1a79maSEhbLUluCNukihUe4NrrOWw5QIkVMl4QDCeA IRKgevcYOy/Z9Wa8VoZIlGqmzbDV7/UjVxk1T7ZN8UcTHliSPoZXzo9l7JaYlfVXXsuF QrgtDbVuut79DNv/AmoU9M1hL/OGBbD3F6jz3y8UN3kUqTF9rBILazwMCpnNKepGnitK PTOqVnXURDVIAYjkOB6ievBv8dPGuG22Zv6mqThzOTpqWKLRposQmvTRac1tCtogy0lf 8bXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="D7fZA/hi"; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g3si10059459ila.154.2021.05.31.07.43.38; Mon, 31 May 2021 07:43:38 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="D7fZA/hi"; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232377AbhEaOpP (ORCPT + 12 others); Mon, 31 May 2021 10:45:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:37856 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231810AbhEaOlX (ORCPT ); Mon, 31 May 2021 10:41:23 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 34D7561C65; Mon, 31 May 2021 13:53:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622469195; bh=ejMJuLJ0WEYbmwOOtAcmZbty7rI2OOc8/VA/+lJBxP8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D7fZA/hitc8KD1ASnSMB7z2qFNIN4CTbAitMilBCmsgvOHo2u6Unp8TBqV+qppCfU zfSHLfwIow6CEIj4GrBScS9HD7pjcSQTM2y/B4x/FTP8T7R60ZfT8b5K5ahvGkKRQv TsWeI/b8Il0WO2Zx3ICX6spVJ7H6KrF190WUB43Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Heikki Krogerus , Benjamin Berg , Bjorn Andersson Subject: [PATCH 5.12 106/296] usb: typec: ucsi: Clear pending after acking connector change Date: Mon, 31 May 2021 15:12:41 +0200 Message-Id: <20210531130707.501215780@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130703.762129381@linuxfoundation.org> References: <20210531130703.762129381@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Bjorn Andersson commit 8c9b3caab3ac26db1da00b8117901640c55a69dd upstream. It's possible that the interrupt handler for the UCSI driver signals a connector changes after the handler clears the PENDING bit, but before it has sent the acknowledge request. The result is that the handler is invoked yet again, to ack the same connector change. At least some versions of the Qualcomm UCSI firmware will not handle the second - "spurious" - acknowledgment gracefully. So make sure to not clear the pending flag until the change is acknowledged. Any connector changes coming in after the acknowledgment, that would have the pending flag incorrectly cleared, would afaict be covered by the subsequent connector status check. Fixes: 217504a05532 ("usb: typec: ucsi: Work around PPM losing change information") Cc: stable Reviewed-by: Heikki Krogerus Acked-By: Benjamin Berg Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20210516040953.622409-1-bjorn.andersson@linaro.org Signed-off-by: Greg Kroah-Hartman Signed-off-by: Greg Kroah-Hartman --- drivers/usb/typec/ucsi/ucsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/usb/typec/ucsi/ucsi.c +++ b/drivers/usb/typec/ucsi/ucsi.c @@ -717,8 +717,8 @@ static void ucsi_handle_connector_change ucsi_send_command(con->ucsi, command, NULL, 0); /* 3. ACK connector change */ - clear_bit(EVENT_PENDING, &ucsi->flags); ret = ucsi_acknowledge_connector_change(ucsi); + clear_bit(EVENT_PENDING, &ucsi->flags); if (ret) { dev_err(ucsi->dev, "%s: ACK failed (%d)", __func__, ret); goto out_unlock;