From patchwork Wed Sep 1 12:28:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 505073 Delivered-To: patch@linaro.org Received: by 2002:a02:8629:0:0:0:0:0 with SMTP id e38csp216545jai; Wed, 1 Sep 2021 05:42:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJynI26umGd1WJT9dva/kFnGPqyzdPdfnG94uYBmnpTFl4VqCrU7D0/WfJtX/AZjPy3wIL2N X-Received: by 2002:a17:906:56cc:: with SMTP id an12mr35478501ejc.456.1630500145835; Wed, 01 Sep 2021 05:42:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630500145; cv=none; d=google.com; s=arc-20160816; b=i0liNxcyZx9uOVQHUJnvzo89JXjm0lQR7wHoxo9e/4tlJ0I2CJUYBCbLzEu8Jfmh8R WFH+1QOrJxKHELXtMinmhbGLl7uC68TL1gQFua2EwWfAlTOPfDac38mdMjp3gw9TKb9t svjvpH9EJxZvr4w5I4O81xfdXPO6L7tQGL8FfUvTT7msdDXxhd8mSbotZdnSDTzD+Icz +f3ngfCNAR4CZ25W0UQb1RHhqJPU+t49pKftGXQYKKyY3uY/50YEU2IbFzkr/6vI8MRJ wi3vnBS9ZawaF6Md4/2Y7NWnJSox6lYRLKdOI8V3nBciX84ZmpYzc6SBsnoEF/ucWje3 V20A== 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=Ko4vZ+cWHJmqJ7gXs65U2wWnEKeBUQwn0+bruEjlujw=; b=TBAGYqzg91OcuqwmoumlqWfn4WHJ37G0MINk9CPZICVuTdiXpOmbFQIZwx4Kdv4dON ni5GITLn5DUbXfLCacd+epsXJ9Vxii7/SZ1qumT8L3OjEgt1RdJoDqnP7i1QIfd5sJss RbVyQJmDU+FM3uJ7K6rY/OnV76ukJKqJSgFtncHtTvgBc2eYr2Yz7TJbuGK7mMZHNCjk oq6E/jS9MbeKqvXkyj/EwlEpA8wGpfN9j3rmImzJl+I4IhBsCKvc9vzYUa7dAxT2yIUO PUdhKnuxN1/USrJEXn88K8yp1YT3Jl+g5arAqKsI07vrtRG0FvZ1qmwkEVgRWKvo+1FH 27lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=v80J85u8; 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 w17si21534952ejv.123.2021.09.01.05.42.25; Wed, 01 Sep 2021 05:42:25 -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=v80J85u8; 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 S1344902AbhIAMnO (ORCPT + 11 others); Wed, 1 Sep 2021 08:43:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:43102 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345138AbhIAMkx (ORCPT ); Wed, 1 Sep 2021 08:40:53 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id DADBB61183; Wed, 1 Sep 2021 12:37:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1630499825; bh=kHchV+KwZwfPlVmQdaqFWb9t3kmZdUgkIwJNkQdUk+w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=v80J85u8YrxW2YztoOPUH7EfWWuKBdWsHr+bR5ufrh6IODXsqSC02zjN3L0P4ewun wh8C7fTqai7GCuc5ZrxLAH/MdOM1TwSt20F7efh57O08QLv/A3/sRSaC4yb1iC59Yq 02/VzPxPNZdoX1m8i2XRDn5RkEqwcwTpEOlKcFfo= 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.10 094/103] usb: typec: ucsi: Clear pending after acking connector change Date: Wed, 1 Sep 2021 14:28:44 +0200 Message-Id: <20210901122303.692592741@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210901122300.503008474@linuxfoundation.org> References: <20210901122300.503008474@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 --- 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 @@ -703,8 +703,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;