Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp141622pxj; Mon, 17 May 2021 23:21:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw4N+HSmEgjPTi+2a8+4cqO+R2vW5m7tRcKMiFd2OmTA+QsVa4FQ2Lq72oFmr+6ApDex5Dl X-Received: by 2002:a17:907:628d:: with SMTP id nd13mr4350335ejc.299.1621318874826; Mon, 17 May 2021 23:21:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621318874; cv=none; d=google.com; s=arc-20160816; b=iGOLct/Yf4j1zEfNgCjQOH6gVRi4hXO8LuazrdrOR/dQgHrWS68tn6qxqD1pzCsVL4 DUR1HNkPIGzp7MYzUtzAurFCPPH6NLfqSiKAdfSXXxqUmubYb3LJXjSvfYXJqD2fxT8k JWUKyRGtA7fOZNa4ocNpnlgjwcpyz7DYHs3BlhwRElHIQCI+m9x2rSbl/OpcG8VfEFYF JuZfG+T8yqIyDxBopZPyCxqrsjmRzs5205u6R8RbRvARFlmHrtFnQguS/+SCtQNdXeBz yku+g5IiazOMM0WWj5llBU1U7Ip+KfOCo6meDgo7D18fGrJMEQ8ndbHRkk4GQ5wQokio FYlg== 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=mWhLTZHCinQgOwsNgOn7RlobcJGNt8o85LMhPzit238=; b=Ndh/bXpPyMvpdVk7PWpQ+aVTCYcok1XXT1F/ZYVA8FgCF6ysBuboWsS5MZbgxIgfqD EVMAMJAweCZAJ9up2nu2kr34Z/ahOKUSjbuXFfYEeAiI55zhFg+f6rLTSA8XLxW/ujJL yzvZlwWRY0/PhepTTfFOShqIHYFmMEM5jp4jF/pUNWfejfoO+bvGBNDp8Ifb7pxjlcyX CAEZDTq0P0VrVNGQzuJAc1NcVsmrGJ9N9I6FbKPAk7OunTaVyz7Z9XVJuIoEE+1rz1fR OaaDvjXqjJHfmSOl0jvGFdKeQNxhepG63tMGwIPh4tXiY61YV0QLikhBEHJYctgyaXbH HpfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wQg7iNfn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 dt22si2194280ejc.424.2021.05.17.23.20.50; Mon, 17 May 2021 23:21:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=wQg7iNfn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 S242102AbhEQOtw (ORCPT + 99 others); Mon, 17 May 2021 10:49:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:55124 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240866AbhEQOlj (ORCPT ); Mon, 17 May 2021 10:41:39 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 00CA8613AF; Mon, 17 May 2021 14:19:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621261161; bh=XsYnRwTNZcPyBxGlG/1oCN2uPgUhDI/zC/nuPTGhFV0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wQg7iNfnltEO+vYzHEqjvBao+Q2BX0oTw4/gDY2AbVjd8ymIADlFOS4zLVDfNQI9+ sQyR/sYn+KDFkknFUSLFIlH45eQl9Kzg1MJDIUyxdF779z5jNMbLjfNvUU062ErAM5 n43NWNflgWkkA4foL0zDhbrbi5Zg6rJAb3wtUg7k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Guenter Roeck , Heikki Krogerus , Kyle Tso Subject: [PATCH 5.12 316/363] usb: typec: tcpm: Fix wrong handling in GET_SINK_CAP Date: Mon, 17 May 2021 16:03:02 +0200 Message-Id: <20210517140313.289180358@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140302.508966430@linuxfoundation.org> References: <20210517140302.508966430@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kyle Tso commit 2e2b8d15adc2f6ab2d4aa0550e241b9742a436a0 upstream. After receiving Sink Capabilities Message in GET_SINK_CAP AMS, it is incorrect to call tcpm_pd_handle_state because the Message is expected and the current state is not Ready states. The result of this incorrect operation ends in Soft Reset which is definitely wrong. Simply forwarding to Ready States is enough to finish the AMS. Fixes: 8dea75e11380 ("usb: typec: tcpm: Protocol Error handling") Reviewed-by: Guenter Roeck Acked-by: Heikki Krogerus Signed-off-by: Kyle Tso Cc: stable Link: https://lore.kernel.org/r/20210503171849.2605302-1-kyletso@google.com Signed-off-by: Greg Kroah-Hartman --- drivers/usb/typec/tcpm/tcpm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/usb/typec/tcpm/tcpm.c +++ b/drivers/usb/typec/tcpm/tcpm.c @@ -2387,7 +2387,7 @@ static void tcpm_pd_data_request(struct port->nr_sink_caps = cnt; port->sink_cap_done = true; if (port->ams == GET_SINK_CAPABILITIES) - tcpm_pd_handle_state(port, ready_state(port), NONE_AMS, 0); + tcpm_set_state(port, ready_state(port), 0); /* Unexpected Sink Capabilities */ else tcpm_pd_handle_msg(port,