Received: by 2002:a05:6a10:c7c6:0:0:0:0 with SMTP id h6csp1968349pxy; Mon, 2 Aug 2021 15:24:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyeJJ0v4iVbw0m6GcLRlX5gRbst5Hr138RprmMDOjGChEdeUnQwoSaEJQt8+3XZbJuGaEz+ X-Received: by 2002:a05:6e02:2165:: with SMTP id s5mr79153ilv.5.1627943050182; Mon, 02 Aug 2021 15:24:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627943050; cv=none; d=google.com; s=arc-20160816; b=z6cT2Q/5QhpwseZdU26N3qwxpDRIJKY0STnk0/OTRIK6g9U7YwKaqS4yP+oeZicBQ6 8RYCYXNTIzNfFSLOGF7HkxhlFD8It9foW2YFBGRsY2dlycwh1yezcQDP6r/5Zrk7HVXs fO2YEgqihF4qz9+YH+vDNhk5R2uFVWV+hejxCS/jo5wDU+58AJvPc79UHXo0CljLnZew Qb9Iw+mH/5dKNWoRbPNuuL2CyWGDaISWKrRuCxk3KkRqXXd2Y7F2QW2ewwzSWsJS/7hy uMuhAmotXvAmPGH22qikhQsqFoLG0U6rREl8hgpFaTaHjx/voFBx233P/RFF1HpBxt5z nwfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=LFDQ2N8siz8MNk9BrQIvS1rfuibpMLRZ8cqYFTamWz8=; b=s/DAiNTAM/IC+7eDoE+jVUZRms6e9GBPqXmlGpg8dpV+LsSXERyHyVwbSnwbeaTWkf fnpdfHbVzipnScO7YCxNogthqg1oPBoga55y8JGB1fooJbFtJuAKzMPXn46wAnOYuHvx GsGDsl03pE3xZ+qZIZID5DY0d0RJhxAig59oHOXp0KaJlCw4pSNujI5V811Oxxle+6Fv K5xDm8NymZmeQX3McipZrEUm6xIIBrsoARPHB6ztpLKiEuSjOBtOSi+x/SMGg54jMaL5 KcN6jQPUOG8TUU0phtSDloUfR4jC+8e91aTDH4XbOomFGJQ6UYdHFS893wwU2sMHuEz7 3Wug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=E7c1pgBN; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s13si14832281ilp.102.2021.08.02.15.23.57; Mon, 02 Aug 2021 15:24:10 -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=@gmail.com header.s=20161025 header.b=E7c1pgBN; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232155AbhHBWWU (ORCPT + 99 others); Mon, 2 Aug 2021 18:22:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232097AbhHBWWU (ORCPT ); Mon, 2 Aug 2021 18:22:20 -0400 Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD05BC06175F; Mon, 2 Aug 2021 15:22:09 -0700 (PDT) Received: by mail-wr1-x42d.google.com with SMTP id p5so23167319wro.7; Mon, 02 Aug 2021 15:22:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition; bh=LFDQ2N8siz8MNk9BrQIvS1rfuibpMLRZ8cqYFTamWz8=; b=E7c1pgBNvnaYLBmbkSVkTbXxrb/kMzbTcelvoP8qAoB0Sv3MbzwQCHmxEnKNBFZQdn +ZnmAUF8r6lwTHqzooWmHFeLpCIJPnpGt/D0ZerpA/qOu82TD0DyotVaGAiXYF6b3vry 8CYfswb+IQ8z37U++pzmuKT5V5t+WGhm7MkRcqfO/N5vBox3ZWBmEQ7H69VjsD0gkCm5 Derkk0CAL7ASN15GBLaJnb3YQSz3iXRtdS8avCJSFNbM8euBTXeigHIbcaLHhXYsrcGj eqrxY8eZcpClmAG7b5TunAfv+wRd36ZvXmr+Whu9A0zWDb66Br+PU9NMn9TFXNw9P9P5 kxAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=LFDQ2N8siz8MNk9BrQIvS1rfuibpMLRZ8cqYFTamWz8=; b=aNuBDsSvJtTdYG3akOg+tOQWH2SxZZdKaMdWvGNwhAObhFQdUy8fta4FQd0s2Z05la XMQWbqbQPlrkwJVxk66t+5nb7AIkz77FQtcXH26yHnxQQAiwo8+CkSjc4oWOIdpzGalg VYTPGg5eyGrRJ5sFJgD/0J7xwWU96eYdvypOby+l++fMxyJW1OVl/pAnYtoweh3626OI jNgIl89+S07Utu5phTvenBcfibxRJEcPIj9AKzdEenp39/bMo/762ik3dpSHrF0lHEiW qdATcLdwdWzZIuPT8SZyYa/ORrLmbM6aYOWQgsdWZTvoipCuu/1nFXsakccfsROrkTd5 JfMQ== X-Gm-Message-State: AOAM531G4tF2ZIbz1Lo1ud9V7rRXa65fn4Rkv9qoE1ywe+24XX5WSQNQ 76IUt5Z7jwHtp9fjmhOi+l8= X-Received: by 2002:a05:6000:124b:: with SMTP id j11mr19962803wrx.348.1627942928521; Mon, 02 Aug 2021 15:22:08 -0700 (PDT) Received: from pc ([196.235.140.151]) by smtp.gmail.com with ESMTPSA id j19sm1219979wmi.3.2021.08.02.15.22.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Aug 2021 15:22:08 -0700 (PDT) Date: Mon, 2 Aug 2021 23:22:05 +0100 From: Salah Triki To: Keith Packard , Greg Kroah-Hartman Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] usb: misc: chaoskey: get lock before calling usb_[disable|enable]_autosuspend() Message-ID: <20210802222205.GA1389315@pc> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Based on the documentation of usb_[disable|enable]_autosuspend(), the caller must hold udev's device lock. Signed-off-by: Salah Triki --- drivers/usb/misc/chaoskey.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/usb/misc/chaoskey.c b/drivers/usb/misc/chaoskey.c index 87067c3d6109..8af00be7b9e8 100644 --- a/drivers/usb/misc/chaoskey.c +++ b/drivers/usb/misc/chaoskey.c @@ -206,7 +206,9 @@ static int chaoskey_probe(struct usb_interface *interface, if (!dev->hwrng_registered) usb_err(interface, "Unable to register with hwrng"); + usb_lock_device(udev); usb_enable_autosuspend(udev); + usb_unlock_device(udev); usb_dbg(interface, "chaoskey probe success, size %d", dev->size); return 0; -- 2.25.1