From patchwork Fri Feb 9 09:46:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niko Mauno X-Patchwork-Id: 13551007 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2113.outbound.protection.outlook.com [40.107.20.113]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DB546679E2; Fri, 9 Feb 2024 09:47:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.20.113 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707472057; cv=fail; b=DuJbZI9vkR2Zm824L4R4e91cLxxEhv0hfHrXxY+Pd0kgZfHU5W4XUXgepUKfIr4IQXRaahWc1uuf/h3OodyYnN+RIJ/B795jO2/0IGN8CQdpymLWz3lAr5vmTpFxUY7XRsA4Peo7RvYW3zHvWTnZ/pkKAx+0UjzRc7BeY6Rw614= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707472057; c=relaxed/simple; bh=Jrb+H65+LfHEjIP/QvJE79Sa3p3fFXsIYWZbP/LOtjM=; h=From:To:Cc:Subject:Date:Message-Id:Content-Type:MIME-Version; b=h6/Fjo3w3BJNrchazzsXThiSIg2M7bhB1iBl+6/S1z8Aj9hbJra/hkZztXk6idl21gRNItH8vgZY5OIHV5Bwqzu4RL8Xm7GMlwhPh1KWl7i5L6/13Du1KGv6GizlmK2h7Gkct1dQKBtaw0T9SzEIv6puGDoRpwYh6zRw0jWFbtQ= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vaisala.com; spf=pass smtp.mailfrom=vaisala.com; dkim=pass (2048-bit key) header.d=vaisala.com header.i=@vaisala.com header.b=QmMGxGzV; arc=fail smtp.client-ip=40.107.20.113 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vaisala.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=vaisala.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=vaisala.com header.i=@vaisala.com header.b="QmMGxGzV" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GNb4fjUQBX10EJ7adQibWhMEzkR/+xlrTnTzv45N8HdtDkcbOeOtg1Z34dJpkbDIuG5E+6Y1lx4OWB+iICDcqEO1AgCaV6G6wDD/qiqOCjGmf6aOjuIWwC+Ij7FQzBIF2BifoEXPck00R8CeWMD6yqNxxTx8bMUIwQUMAT0v3oJzmY3kYwL0C+AJJGdsLcUivpqbp8Jb5KvKqkwqZ05rvYHGJyDEzXrUU1VMq01e+K6nGHXdFuH6WI6FiRdXwQD6JSEgemFVun+6S6lH0bwF50e+KP7A96q7rd961KyKy8SVXz+sgJHVXcAQ7ADKyY8NjeimzuwpOyA1XOcg/PtQ9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=AdMhVx5W4qmt1DoI9yagQDMLzbzAPKsTpLntPZZFH5I=; b=jQPDFeXcxPEa0BNOQHXZfLQxd556VwVv2O65zKVClARDF3dAxGD4Z7XfzkCel10i3GO7gAzJdJ9y2aRFQ7k9E4EUXrRAfNICt3Abbv1cGlcM3OwzPnJG8vhqVWmXcI21mu8Nlzh7HTbux1SntdNtCMx4y/0J36Zeguyu/ndv5BgNexKRF4evSgNqkZYmT/UC+PwuT4vvUnJNYROn3k7k6e34V3AEfJsZSUFM4KAOuG/PJcvNGW9xLq+0jDcvPpdlqNpur4WqAaKvDKg7WiQCBWGkU7NQwS1pI+H3Ar4JJUmWpQAgHsR4/KHT71s9b5PMG9/JMukTibzoHrPZmgT6iw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vaisala.com; dmarc=pass action=none header.from=vaisala.com; dkim=pass header.d=vaisala.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vaisala.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=AdMhVx5W4qmt1DoI9yagQDMLzbzAPKsTpLntPZZFH5I=; b=QmMGxGzVhGLfqm72vcZSOMamVOG24rUzE8GBl2BHbT3f2WWVLSIe0PQ5dn7FJTniFLTuiauGFZq29VpM2h5sdklB+lKhDQAdgBJwxNgIRD7ZJGafPXkYyQ+kGwHcs08HNWXTwcn/5Z0c86Tvxz2WsO8nWlPdtEUWsk82Su4YJ2C2Hc1y4iimqiv0O36TA9QSckyuEvONqKoOH3xX9nN43+nb6xlUmfNI7/PGUDPJFoDeMz1xBSlDQhD2NQJgcxw/kre6Cym6inGpfUyzmvPFOCO23Bhop/OpGRWeaAdiLMORGxqVb3UbSdbhS7/FhkgiiWyl19815SDRxMkqIkbuzw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vaisala.com; Received: from AS4PR06MB8447.eurprd06.prod.outlook.com (2603:10a6:20b:4e2::11) by AM0PR06MB6578.eurprd06.prod.outlook.com (2603:10a6:208:199::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.27; Fri, 9 Feb 2024 09:47:30 +0000 Received: from AS4PR06MB8447.eurprd06.prod.outlook.com ([fe80::b5ae:8355:acaf:29e0]) by AS4PR06MB8447.eurprd06.prod.outlook.com ([fe80::b5ae:8355:acaf:29e0%4]) with mapi id 15.20.7270.025; Fri, 9 Feb 2024 09:47:29 +0000 From: niko.mauno@vaisala.com To: gregkh@linuxfoundation.org Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, vesa.jaaskelainen@vaisala.com, geert@linux-m68k.org, Niko Mauno Subject: [PATCH v3 1/2] usb: core: Amend initial authorized_default value Date: Fri, 9 Feb 2024 11:46:50 +0200 Message-Id: <20240209094651.5379-1-niko.mauno@vaisala.com> X-Mailer: git-send-email 2.39.2 X-ClientProxiedBy: GV3P280CA0043.SWEP280.PROD.OUTLOOK.COM (2603:10a6:150:9::7) To AS4PR06MB8447.eurprd06.prod.outlook.com (2603:10a6:20b:4e2::11) Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS4PR06MB8447:EE_|AM0PR06MB6578:EE_ X-MS-Office365-Filtering-Correlation-Id: 5d74ac23-9766-4fce-fa7a-08dc295421a9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: B87nbPPLIwFdTkUNhZ793Zz89m7wHks8D+i5zKftr0OUQguELW0kDVn5tZt2Csril5cPUFlD6vxS1bSoVP2Q9fkvrmEiN1A9Z5kwhhr+5ZUuLJDdnY4wJVVVq7pJ/V4zv1J9fMunvEdd4Y6/3urg5DLOgyvg+hnbeLE2m0D248prb1SsD4IchlTSt77lZUi+YXS6JMT0rK2ABBh0SuMYQLkjvZN99ZkOFeFJxY/fE2K8K9OkF21IoqWcejS/9OI16bW9gHwnFdIIeKBGOBhP6sm5TWIeozzpdfzGs2BgliJdgNfwjPQJ418sN3kpmBm9Ap3Y4HZ6S/SXTwhclJTqZqGAfwEDcqTTxGHGyZFu2TKXAratdgTKhipqZfOtcJWZCPQfyaSpu33DTx1dF/SoYFOo4OL+5Si65s703BTIILGgr1MhUniryN6cf7w6+1Ky5QLFLwQ0Kozvs79+WTllHGsbeRATnm6jfY+6Yu6aTnIhLuNE2Vl0YPHhZumBj4N0vTlHuCN6+Lg7hMjyNW5uFvBSv2HdV+FVCdjaU/rHc4jvztMOmKI6t82BQLfVkl/mOnuQvOUSs0FkVe3QwM8GP74g3rFa8jY7CcmyMrKN0aUF7ClOjniTb6sg11h3zA9i X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AS4PR06MB8447.eurprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366004)(376002)(346002)(136003)(396003)(39860400002)(230922051799003)(451199024)(186009)(1800799012)(64100799003)(5660300002)(66946007)(6916009)(4326008)(66556008)(8936002)(8676002)(66476007)(2906002)(83380400001)(107886003)(26005)(1076003)(36756003)(38100700002)(86362001)(38350700005)(6666004)(316002)(41300700001)(2616005)(478600001)(6512007)(6506007)(6486002)(52116002)(9686003);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: o9Dn83gXU+7jUw4yLtUTQxymhJPHwsZc0EW/sIvQ0xgSPlI3FzaMhEuMxN/lpmtdZqskhXmandJSJPgrDItbLk/ZlgP/rTV59kgEqcEh2s+Bxn5HweFrtFWrTljY86znvbfTyQWoZSWtzvBmjGy0Kxa7M2Muk8i1ZQ0f1ghMv/NNJlie2mJKZfy3D/Dvub5PiClvRQYbHEnBw+/QDQ34M84KW8HrTP78Ot4YSX94JENkbSe9ISUX4SwZSf5G6bO8iK7TP803KoXXoEHQvNclRhofmhpuclHRpClajVYKQQ6QNyXInDC8kgjK2n1p02a4GJIlSNvWtQVTtm1DeLkYWI8xO4Q2cOcizXdOmKQUpTGQX9YN66DUst+NYw0Zzq5KGQ5VDHUeQ7fvetn9UiHDADlWB0NLIkz2Tm8vmgM/xs6KmhnwL+v39XTEZr+VD1RzAzM7NlEdQgjaFbwkBnH9PSlDLyCBEr8BSo0tat73ShDt8tDLEqJITGBydgYiDl5jzGDZkYD0d0d9rKSoqVOWytzbgH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91AvQ== X-OriginatorOrg: vaisala.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5d74ac23-9766-4fce-fa7a-08dc295421a9 X-MS-Exchange-CrossTenant-AuthSource: AS4PR06MB8447.eurprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Feb 2024 09:47:29.9512 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 6d7393e0-41f5-4c2e-9b12-4c2be5da5c57 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: uJDAgq6GGHlQUyrNMc/Xv2YHTCVRRSm4CJROIuxtY9rrpVKSlbbrVf8XTGgBY2ZocOx1k1VONITrW3pHWhT0uQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR06MB6578 From: Niko Mauno Since the wireless USB implementation has been removed and since the behavior with authorized_default values -1 and 1 is now effectively same, change the initial value to latter in order to stop using the leftover value. The former value can still be passed as a module parameter to retain backwards compatibility. Signed-off-by: Niko Mauno --- drivers/usb/core/hcd.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index 12b6dfeaf658..9aa5e6bf9b9d 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c @@ -357,12 +357,10 @@ static const u8 ss_rh_config_descriptor[] = { #define USB_AUTHORIZE_ALL 1 #define USB_AUTHORIZE_INTERNAL 2 -static int authorized_default = USB_AUTHORIZE_WIRED; +static int authorized_default = USB_AUTHORIZE_ALL; module_param(authorized_default, int, S_IRUGO|S_IWUSR); MODULE_PARM_DESC(authorized_default, - "Default USB device authorization: 0 is not authorized, 1 is " - "authorized, 2 is authorized for internal devices, -1 is " - "authorized (default, same as 1)"); + "Default USB device authorization: 0 is not authorized, 1 is authorized (default), 2 is authorized for internal devices, -1 is authorized (same as 1)"); /*-------------------------------------------------------------------------*/ /** From patchwork Fri Feb 9 09:46:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niko Mauno X-Patchwork-Id: 13551008 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2113.outbound.protection.outlook.com [40.107.20.113]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4372D67A18; Fri, 9 Feb 2024 09:47:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.20.113 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707472061; cv=fail; b=ehNWXU0MTEFzxukRva26PWhATp1Wn1XRGSiGlJ/XCZPuZXkJG+WOC/q0yLxnoo/CgRtX2dwjE2EcNu7JFYZ1EgPZ6ftiOsFdJ3Sca8uDaiKU++nEdqjzWXVyKhfKwfJbK3EsbU8GLW09c2otREzReUJHJC8Wm2eW5cQ48eMwNS0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707472061; c=relaxed/simple; bh=vOhchZ/R3lpT5SLM2iqQwtRTw0jHWop3yJA4VK2aDG8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=s7XVWaNl+UHTqWhALkdPKYe2hCOw+ax8Pa4oOMRtclh9Wy6ZZWSR0s7bwupuJk1wbAoea9x4vGe7WzuKXQ3tmGlfyinENB2DlAlf7anis8wf+roUD8raBarA3eHsGHkm/RGBofBfgNtmEkSRWYQtleHZhP8/nICw1kRuZOEtP4Y= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vaisala.com; spf=pass smtp.mailfrom=vaisala.com; dkim=pass (2048-bit key) header.d=vaisala.com header.i=@vaisala.com header.b=2ecyflnS; arc=fail smtp.client-ip=40.107.20.113 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vaisala.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=vaisala.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=vaisala.com header.i=@vaisala.com header.b="2ecyflnS" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bEc/Ej3iQQSzIstT0i+WHbUna4AaeWHW91cDXyRtoC25SI/Y96uTxvzx4BU0i6uVGv3uqvMdqSOUva1Y7tBRHXxZVfA1BF66V5ikd4+JeIp0X92l9kYLdbvSsOBztDn5KXXTcj4x2c3rx5MjCwJ5aWtBq6Rh9JPO05dA0larL9pXODHRAmOuqLz0xHes4svivEtYplpqa8hCACSV45yIlSfkP2/hiQ2y8xONAZ0KW7i7v7pto2OYjjk43a7hhQJahWkM+ImG6HczMwT5AHHQSR6A4Bk1kR8f0c0RKCO6oG15i2qRejUkux0oZ+XOiILBjrzBjtvbpo5x77UZK78Seg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=acJ8HZIWJZ+ezTcst3aQC8CI9IpO6/Z98Iu26Hb9/+Y=; b=giep1Jy088oKVgjQRah5kqcsVifZ55bj9ji8BH+H+OCPBduNwkpvTLQI1Qzo5xpdfDRH3SM2T7McYlGByMYkLmY8dxIPQaZ4qo8/AZuSc5QqFmKs3qb4eSzsEBCj6c2KKVupZgrQ8FhjzrkPsP0t3gH021W7OlNG3AMVkykHl2VkT8yIUZ0IoshWvFT5GZAdhDKJvBOlrCOIKxvQmhHx0CWpJ41RJz/GbozPLHedafyRn8EnlyRqA+LGGIKWkSiiN8AD9cNXbu78V6m4ZLldow7ISn5htLSmF46hdreN8aNPwjaM3lZ2cTw/CrQswtgueXAzrtxnYEgcHHSp7evPOA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vaisala.com; dmarc=pass action=none header.from=vaisala.com; dkim=pass header.d=vaisala.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vaisala.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=acJ8HZIWJZ+ezTcst3aQC8CI9IpO6/Z98Iu26Hb9/+Y=; b=2ecyflnSgWmpK9HoBJ1RS1toYKsxWUVHg+0Nu2IqB7f+grB/Ht3LEx8Lb1hgpWGky/OA/SMfbeMCsbdiYL4oS/RYzFITkcwHHkxgc5I6sJHPbPsKLW269s8HUUFv5fzHa/1WrtWx9DTZoUnYYSsosif2fTjGLGAmj/qnHpLYf92JhF1CovBcu/1xSmNyhfWiJa2EyXZbHG8P/FCrgc0sR0cBezgLxVFqRYFgpi8ruxVyOJZ4CHyhyxQ4ZU5Ihg9W5qPVfQdlFaqBNZTkkqERa5kVp2ffI99clBhfP/EY6PjaxlXygJeBI69miXjT6fePhKM5eUD6HqUKFBSOHYyYvQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vaisala.com; Received: from AS4PR06MB8447.eurprd06.prod.outlook.com (2603:10a6:20b:4e2::11) by AM0PR06MB6578.eurprd06.prod.outlook.com (2603:10a6:208:199::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.27; Fri, 9 Feb 2024 09:47:34 +0000 Received: from AS4PR06MB8447.eurprd06.prod.outlook.com ([fe80::b5ae:8355:acaf:29e0]) by AS4PR06MB8447.eurprd06.prod.outlook.com ([fe80::b5ae:8355:acaf:29e0%4]) with mapi id 15.20.7270.025; Fri, 9 Feb 2024 09:47:33 +0000 From: niko.mauno@vaisala.com To: gregkh@linuxfoundation.org Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, vesa.jaaskelainen@vaisala.com, geert@linux-m68k.org, Niko Mauno Subject: [PATCH v3 2/2] usb: core: Make default authorization mode configurable Date: Fri, 9 Feb 2024 11:46:51 +0200 Message-Id: <20240209094651.5379-2-niko.mauno@vaisala.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240209094651.5379-1-niko.mauno@vaisala.com> References: <20240209094651.5379-1-niko.mauno@vaisala.com> X-ClientProxiedBy: GV3P280CA0043.SWEP280.PROD.OUTLOOK.COM (2603:10a6:150:9::7) To AS4PR06MB8447.eurprd06.prod.outlook.com (2603:10a6:20b:4e2::11) Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS4PR06MB8447:EE_|AM0PR06MB6578:EE_ X-MS-Office365-Filtering-Correlation-Id: 11aba808-819b-4f8d-6bb6-08dc29542406 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: h9Lha8mAk9QIoXnebedRcVQF4VLptSFvsvdw9H0OcRWuYX486k9cEujkYz+1nc1gQI28Q30QCyirokzfmS4FxFMl5vN1gHSgrtxxw8jyGutfqaNh8hd7pGRirsik0kCZ8ICM4t4jTcj9LBux9w7fX255k+BCv83SZSXcI2WXHek0UGDJNp7hNX1HlL3o4vAvbCSHfeOkA675Ud9Dp0Rh3oyPXWZnuYFMgvKeSq3xsxTwAM80+0xq2GPk/q8ql5dKHmRoPIcitsgqQDasThhSPHEUF6VRm9uO4GnADYB+U5kPy7hJhQKh+96lNjHMykZ9vHrCgW7lYSrRK2JJU7JLPHqrkkEVwe0wZuENjaSoeepKNu/gX1dLHGuwfTnxQrCt7M+my1iSQyt3nMb8YRI6iUCe9eSzatQBzZO+l0BCOyoa3cxYjwgx5CIxtBIBoQe5We9//KuG9Xrk5XdI121P+f4TneW5X2r7VQ3qdp+PLGXkb6uYOb4dnrroACB5+WSenk7PjidH6yAmIpIOcwtNoBq7kOT0k0z0tEmBBo713HF7bRpvN/a0Q21XQVtTf3M5Np9JaS85LxUpE4gqNlrjWo3NwcWuRQQYpZmjpVNYnPKQVAEp30QcbyIU6B6m0D/9 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AS4PR06MB8447.eurprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366004)(376002)(346002)(136003)(396003)(39860400002)(230273577357003)(230922051799003)(451199024)(186009)(1800799012)(64100799003)(5660300002)(66946007)(6916009)(4326008)(66556008)(8936002)(8676002)(66476007)(2906002)(83380400001)(107886003)(26005)(1076003)(36756003)(38100700002)(86362001)(38350700005)(6666004)(316002)(41300700001)(2616005)(478600001)(6512007)(6506007)(6486002)(52116002)(9686003);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: S932HNzDKiFPagAyChql44PWXwcvu0nzxp50S9oQycQsOvrUdcTSUUvnjB+6Dt6aTZY6CatvNVf7OCxnqLibP6uppmRWhEs79FWdCzEF1KHe7KQyQXaV+avmU4x3WLRlMiqQ4yhLcMBhLDwaU6GFV6IxW+mLj7Bp7picvha2cAu+gTUXSrBxiSL4PxLAw8ZC8XlO85gSo4qFdQyDQHQm/VXIJm4jM3ZGj42SuzDgwAeuOvkhDy2KkOtLUF65n6mIDUHjGzmbluwkCagxRJdSMVAG/schXKS6TAJMs9leTLmukobtK6vycVvd/UsIdNr3PPIfIRf5nRrDHacerwqFAnlSu+THb3omw/mZCTdFxCtBccSRikWPnKt8benV1UzYBSC9u6lI49av2q2qdw4nem+zfApALkGOAF9s/G3Q+VQGDxtQQ7SVvsRjXfPTyHCVk4PsdZMcw/Z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xNRUy/AH3xMSULdp5j7XLqalMvzQuAyE1hlR3V0GluVbvsTCgpVU5VOrgEkSqqX3cIQXSAg== X-OriginatorOrg: vaisala.com X-MS-Exchange-CrossTenant-Network-Message-Id: 11aba808-819b-4f8d-6bb6-08dc29542406 X-MS-Exchange-CrossTenant-AuthSource: AS4PR06MB8447.eurprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Feb 2024 09:47:33.9017 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 6d7393e0-41f5-4c2e-9b12-4c2be5da5c57 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: E5tVmplTtPnK+vszcWTHMmbOsjWu549yFYanppZAxT0nfZNWFjWpLhSsQgoY46V7I1j7LGHpG0MtfnsO8gUvSw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR06MB6578 From: Niko Mauno Make the default USB device authorization mode configurable at build time. This is useful for systems that require a mode that is stricter than the standard setting, as it avoids relying on the kernel command line being properly set. Signed-off-by: Niko Mauno --- drivers/usb/core/Kconfig | 28 ++++++++++++++++++++++++++++ drivers/usb/core/hcd.c | 2 +- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/drivers/usb/core/Kconfig b/drivers/usb/core/Kconfig index 351ede4b5de2..0bf425889c10 100644 --- a/drivers/usb/core/Kconfig +++ b/drivers/usb/core/Kconfig @@ -116,3 +116,31 @@ config USB_AUTOSUSPEND_DELAY The default value Linux has always had is 2 seconds. Change this value if you want a different delay and cannot modify the command line or module parameter. + +config USB_DEFAULT_AUTHORIZATION_MODE + int "Default authorization mode for USB devices" + range 0 2 + default 1 + depends on USB + help + Select the default USB device authorization mode. Can be overridden + with usbcore.authorized_default command line or module parameter. + + This option allows you to choose whether USB devices that are + connected to the system can be used by default, or if they are + locked down. + + With value 0 all connected USB devices with the exception of root + hub require user space authorization before they can be used. + + With value 1 (default) no user space authorization is required to + use connected USB devices. + + With value 2 all connected USB devices with exception of internal + USB devices require user space authorization before they can be + used. Note that in this mode the differentiation between internal + and external USB devices relies on ACPI, and on systems without + ACPI selecting value 2 is analogous to selecting value 0. + + If the default value is too permissive but you are unsure which + mode to use, say 2. diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index 9aa5e6bf9b9d..d56597dc7d42 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c @@ -357,7 +357,7 @@ static const u8 ss_rh_config_descriptor[] = { #define USB_AUTHORIZE_ALL 1 #define USB_AUTHORIZE_INTERNAL 2 -static int authorized_default = USB_AUTHORIZE_ALL; +static int authorized_default = CONFIG_USB_DEFAULT_AUTHORIZATION_MODE; module_param(authorized_default, int, S_IRUGO|S_IWUSR); MODULE_PARM_DESC(authorized_default, "Default USB device authorization: 0 is not authorized, 1 is authorized (default), 2 is authorized for internal devices, -1 is authorized (same as 1)");