Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4644371iob; Sun, 8 May 2022 20:24:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw0Jj0R5TLAzrqr2YVKVMjQsuozzY6Y5F7SdPu/glffE5kl5nzvqHWGv59Csj5InZqVV1k9 X-Received: by 2002:a63:8ac7:0:b0:3aa:fa62:5a28 with SMTP id y190-20020a638ac7000000b003aafa625a28mr11739483pgd.400.1652066641623; Sun, 08 May 2022 20:24:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652066641; cv=none; d=google.com; s=arc-20160816; b=LSQJ4bGrrszmjAL2YlCbtY05g6l05nEz7Dd5J+NXByq2jW+PO7I5VcpQWMxvRhu3xy Aysul2+7BI7+RTt56F/Y+azb/xDMfZe1LpM4728AlcgoKNbH+w65kx8EAsNQApx+EiXd jLyYVY7WSlzo99jnD3bgEopLzVWAuuHP+YfYdahJecbvIPwupaOwNZJBTieJwW4V8zm+ FueWI3YQ8VSkjs3rzYDWcSF3+fxMp/UKMFGsL8PAKkO381cxFebsXzcajrWQry8XcPEo oxJAMmPAgrfPXFjQBiAJDlvZ1Cl8ugPc8ILD0UJxc55SJeUAyP9mf+0a7PuFoUDMuJmr dCaQ== 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=aXZWGjMcIl8lBIoCo4IW5BnS3MnNKFeKEjeEwPlsWQY=; b=wKLyoJDGxHwmIhdzP3zxNFJu7O3kOvfcXWGzEWcX2Uz1BJPxzNY274oE9lfnR0A4Do f1/vQKpnngVkAe1MZxdcVt5b247N+JS86iEfkfI9ioH3uKOW4JL5edAc7fwSbQlYYvtq cWKKcjX/qNZKriISkcc1D3I7lsWLXD9APvVi8zNGZbKEI6Cz3HwgS9f8ljxZGX/nNU2F 8sEOxIcdNGRO6XaIIZ5+e3bQoXTK6gVxXYLjucrwa6EK/oRfwIb/HgFOCNSo2rnJNT2b 2UKe5t1g6Anv+iwiyLSdLl5rV+6qmRKUZumgMdBOfm0AyzwTY4yn+KqvvqAMvIOfrdHl wCBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0T3DnL5f; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id y22-20020a17090aa41600b001dc28f260d4si11988344pjp.43.2022.05.08.20.24.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 May 2022 20:24:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0T3DnL5f; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 34A959E9F9; Sun, 8 May 2022 20:22:52 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354895AbiEDRDJ (ORCPT + 99 others); Wed, 4 May 2022 13:03:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354353AbiEDQ5u (ORCPT ); Wed, 4 May 2022 12:57:50 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 608D24A3D2; Wed, 4 May 2022 09:50:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A671AB827A0; Wed, 4 May 2022 16:50:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3C980C385A4; Wed, 4 May 2022 16:50:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1651683002; bh=yygj4gzvlcT7SWxDWyCdvMa3wTi8PxJIsAe9weyBJdY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0T3DnL5fsD/vBcUHO+EIlOOIPl2RfGm+cFtIG5ITcIs6U/RoybOip8DVkhBpxu8hh JSSF2gQGIAG+uhalfW0sIMuAx9ft8n1bE7z/ZHChMIuyeBS4vxHmwojQ1WHz5Jei7P nHNH3rgdXM1tEwz2M1AdpdtFRWzDHtdWgoho7sIE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Heikki Krogerus , Jack Pham Subject: [PATCH 5.10 018/129] usb: typec: ucsi: Fix reuse of completion structure Date: Wed, 4 May 2022 18:43:30 +0200 Message-Id: <20220504153022.746748462@linuxfoundation.org> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220504153021.299025455@linuxfoundation.org> References: <20220504153021.299025455@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Heikki Krogerus commit e25adcca917d7e4cdc1dc6444d0692ffda7594bf upstream. The role swapping completion variable is reused, so it needs to be reinitialised every time. Otherwise it will be marked as done after the first time it's used and completing immediately. Link: https://lore.kernel.org/linux-usb/20220325203959.GA19752@jackp-linux.qualcomm.com/ Fixes: 6df475f804e6 ("usb: typec: ucsi: Start using struct typec_operations") Cc: stable@vger.kernel.org Reported-and-suggested-by: Jack Pham Signed-off-by: Heikki Krogerus Link: https://lore.kernel.org/r/20220405134824.68067-2-heikki.krogerus@linux.intel.com Signed-off-by: Greg Kroah-Hartman --- drivers/usb/typec/ucsi/ucsi.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/drivers/usb/typec/ucsi/ucsi.c +++ b/drivers/usb/typec/ucsi/ucsi.c @@ -928,6 +928,8 @@ static int ucsi_dr_swap(struct typec_por role == TYPEC_HOST)) goto out_unlock; + reinit_completion(&con->complete); + command = UCSI_SET_UOR | UCSI_CONNECTOR_NUMBER(con->num); command |= UCSI_SET_UOR_ROLE(role); command |= UCSI_SET_UOR_ACCEPT_ROLE_SWAPS; @@ -964,6 +966,8 @@ static int ucsi_pr_swap(struct typec_por if (cur_role == role) goto out_unlock; + reinit_completion(&con->complete); + command = UCSI_SET_PDR | UCSI_CONNECTOR_NUMBER(con->num); command |= UCSI_SET_PDR_ROLE(role); command |= UCSI_SET_PDR_ACCEPT_ROLE_SWAPS;