From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_2 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 316EFC433E0 for ; Thu, 2 Jul 2020 07:24:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 17FCF2073E for ; Thu, 2 Jul 2020 07:24:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726934AbgGBHYb (ORCPT ); Thu, 2 Jul 2020 03:24:31 -0400 Received: from mx2.suse.de ([195.135.220.15]:40764 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726630AbgGBHYb (ORCPT ); Thu, 2 Jul 2020 03:24:31 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 9901FADD9; Thu, 2 Jul 2020 07:24:29 +0000 (UTC) Message-ID: <1593674666.3609.3.camel@suse.com> Subject: Re: [PATCH] USB: cdc-wdm: Call wake_up_all() when clearing WDM_IN_USE bit. From: Oliver Neukum To: Tetsuo Handa , Andrey Konovalov Cc: Alan Stern , Greg Kroah-Hartman , Colin Ian King , Arnd Bergmann , USB list , syzbot , syzkaller-bugs Date: Thu, 02 Jul 2020 09:24:26 +0200 In-Reply-To: References: <1590408381.2838.4.camel@suse.com> <4a686d9a-d09f-44f3-553c-bcf0bd8a8ea1@i-love.sakura.ne.jp> <082ae642-0703-6c26-39f6-d725e395ef9a@i-love.sakura.ne.jp> <27b7545e-8f41-10b8-7c02-e35a08eb1611@i-love.sakura.ne.jp> <20200528194057.GA21709@rowland.harvard.edu> <20200528205807.GB21709@rowland.harvard.edu> <1590852311.14886.3.camel@suse.com> <20200530154728.GB29298@rowland.harvard.edu> <0c43caf8-1135-1d38-cb57-9c0f84c4394d@i-love.sakura.ne.jp> <254939d4-f3a1-8c7e-94e5-9862c02774fa@i-love.sakura.ne.jp> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.26.6 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Am Donnerstag, den 02.07.2020, 14:44 +0900 schrieb Tetsuo Handa: > > usb_autopm_put_interface(desc->intf) > mutex_unlock(&desc->wlock); > + if (rv >= 0 && > + /* > + * needs both flags. We cannot do with one > + * because resetting it would cause a race > + * with write() yet we need to signal > + * a disconnect > + */ > + wait_event_killable_timeout(desc->wait, > + !test_bit(WDM_IN_USE, &desc->flags) || > + test_bit(WDM_DISCONNECTING, &desc->flags), 30 * HZ) == 0) { > + if (mutex_lock_killable(&desc->wlock) == 0) { > + if (!test_bit(WDM_DISCONNECTING, &desc->flags)) > + dev_err(&desc->intf->dev, > + "Tx URB not responding index=%d\n", > + le16_to_cpu(req->wIndex)); > + mutex_unlock(&desc->wlock); > + } > + } Hi, I am afraid this would 1. serialize the driver, harming performance 2. introduce a race with every timer a task is running Regards Oliver