Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp5985860pxb; Mon, 14 Feb 2022 12:24:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJwVWEIldW8oi0yW9qS5/JVUV55+C85+IxBLQrQp3SIuHii4eKRf2oKQ7U1IrxLcy6+pIsA1 X-Received: by 2002:a17:90b:17c3:: with SMTP id me3mr399511pjb.202.1644870251841; Mon, 14 Feb 2022 12:24:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644870251; cv=none; d=google.com; s=arc-20160816; b=nzD1dM/fXIbOT+Fjil8zcLQt+x112sgyKjJ5i0KFbYC3tvLTVuLuXmzUWPtnmpJkO/ 0p7kJXMkkTaiDlisPJ8wAOqgUydIuVECO4DqL4emx4l4vdk0Ux1YOCPbbRea4wxM4jjq jPjQ+F5anLW8AUUz4nRFKssT2NeQCiNMO7vMc3OMaerif0TGBI7OT2KUqMT2qKdNXI0I +wU2K7achEn2l/gZeDlEkvAcXdx6SRe1tzAFmkxRWzbrEkVBSC+WqroAoLAQ75r509+W XyQNiJYktCFabz8775mYH9yxtYQ8ouOEuavyQT3pKQ7Hg4d9eCIGzYUG6Xrn1GSasbBc SMeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=jHKZPH1tP8ItRHEkH6AuYJjEMSg2a3/E7pm8Hg8JYrU=; b=wQ89bDU3nU1LsEkxFS731DtoU1gh2w6GSFR9dXpKfNCunIHvjhGL5DYELIwmS5M/ca YBHU3nJVLg6BwzQygc2PbatSr/P1CuQB7mYw+SGBf7uSY2Nlp5ay1AZ97TKsVYJQyIZj O/+R6ro/tz2CY0pXk+QbunxpsCbmIfF+sjNmLjEZ4aZdgO+GzHKGIbRAnNHXQ0BWuMNn WMpWoZb7EfB+eqxiN5Q90BrP9eaU0pGFCnONzH9pZX4PLZbCq6AlB6q9kztWXVcFDe9u czlWumNpkCqKXGLnN+gGFD3J/qbvMjoNrs+gPkPXZajae0CylwtjZED+HafTr7bvQE0J DaNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ag9UJEwL; 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 a26si639828pgv.647.2022.02.14.12.24.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Feb 2022 12:24:11 -0800 (PST) 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=ag9UJEwL; 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 4532A142368; Mon, 14 Feb 2022 11:56:50 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350063AbiBNLMi (ORCPT + 99 others); Mon, 14 Feb 2022 06:12:38 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:44290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349604AbiBNLMZ (ORCPT ); Mon, 14 Feb 2022 06:12:25 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F28B46E36A; Mon, 14 Feb 2022 02:42:08 -0800 (PST) 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 5E613B80D75; Mon, 14 Feb 2022 10:42:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7144AC340E9; Mon, 14 Feb 2022 10:42:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644835326; bh=qImW5XUSUo6sojbafkess0CO8BoHLJyEOWJdYaLl3jQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ag9UJEwLdn/6jfaORT2b0e5LqdbRH+hGQ31f0I1b1gflP3Nog5cAYNL4a+rbjtIE2 A0X2s/h0VkOVJPnYmiThGDkUlvcC8iv5sn1badV6vTt9KN3pwED5G818oH8Eu6e0rR KDEDC4BkjnLpxEsfNYp81tWdCJCJB+02NCefMnWU= Date: Mon, 14 Feb 2022 11:42:03 +0100 From: Greg Kroah-Hartman To: Daehwan Jung Cc: Felipe Balbi , linux-usb@vger.kernel.org, open list , quic_wcheng@quicinc.com, quic_jackp@quicinc.com, Thinh.Nguyen@synopsys.com Subject: Re: [PATCH v1 2/2] usb: dwc3: Prevent cleanup cancelled requests at the same time. Message-ID: References: <1644831438-125403-1-git-send-email-dh10.jung@samsung.com> <1644831438-125403-3-git-send-email-dh10.jung@samsung.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1644831438-125403-3-git-send-email-dh10.jung@samsung.com> X-Spam-Status: No, score=-2.0 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=no 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 On Mon, Feb 14, 2022 at 06:37:18PM +0900, Daehwan Jung wrote: > We added cleanup cancelled requests when ep cmd timeout on ep dequeue > because there's no complete interrupt then. But, we find out new case > that complete interrupt comes up later. list_for_each_entry_safe is > used when cleanup cancelled requests and it has vulnerabilty on multi-core > environment. dwc3_gadget_giveback unlocks dwc->lock temporarily and other > core(ISR) can get lock and try to cleanup them again. It could cause > list_del corruption and we use DWC3_EP_END_TRANSFER_PENDING to prevent it. > > 1. MTP server cancels -> ep dequeue -> ep cmd timeout(END_TRANSFER) > -> cleanup cancelled requests -> dwc3_gadget_giveback -> list_del -> release lock temporarily > 2. Complete with END_TRANSFER -> ISR(dwc3_gadget_endpoint_command_complete) gets lock > -> cleanup cancelled requests -> dwc3_gadget_giveback -> list_del > 3. MTP server process gets lock again -> tries to access POISON list(list_del corruption) > > [ 205.014697] [2: MtpServer: 5032] dwc3 10b00000.dwc3: request cancelled with wrong reason:5 > [ 205.014719] [2: MtpServer: 5032] list_del corruption, ffffff88b6963968->next is LIST_POISON1 (dead000000000100) > > Change-Id: I9df055c6c04855edd09e330300914454a6657a23 > Signed-off-by: Daehwan Jung > > Change-Id: If87c88c3bb4c17ea1a5bde2bfec1382769f7ecab > Signed-off-by: Daehwan Jung Why did you sign off on this twice? And did you run it through checkpatch.pl? It would have reminded you that Change-Id: should not be on patches :( Same for patch 1/1. Please fix. thanks, greg k-h