Received: by 2002:a05:6500:1b41:b0:1fb:d597:ff75 with SMTP id cz1csp386226lqb; Tue, 4 Jun 2024 14:37:04 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVOs9EtdyigGzgnh+PMTbLbZFmCKsXVgt6dTm54oQujmAD+2w6Icr8KpJYkP4fX9DoXGXgU55GsA1qSRpfEFE969Pv5EfcQsQw9WTsnjw== X-Google-Smtp-Source: AGHT+IFOcoTxGFcaFHTWe+BM/Z/VeuEdWJrDL7ORq1nyoxKUlgjHVhackHSSkou8T6mJy5jd/VK8 X-Received: by 2002:a17:906:2604:b0:a69:2553:92b8 with SMTP id a640c23a62f3a-a699fcf2ba1mr37450466b.34.1717537024252; Tue, 04 Jun 2024 14:37:04 -0700 (PDT) Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a68edf45370si302508266b.184.2024.06.04.14.37.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 14:37:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto+bounces-4732-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b="xu/+hKng"; arc=fail (signature failed); spf=pass (google.com: domain of linux-crypto+bounces-4732-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-crypto+bounces-4732-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id CDC491F24368 for ; Tue, 4 Jun 2024 21:37:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1759214BF8F; Tue, 4 Jun 2024 21:36:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="xu/+hKng" X-Original-To: linux-crypto@vger.kernel.org Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2059.outbound.protection.outlook.com [40.107.102.59]) (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 F3E4314B95F; Tue, 4 Jun 2024 21:36:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.102.59 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717537017; cv=fail; b=P4m1HowZ5tMrD7dfw5rqmAFjBclgyzy7AMU1a8TQaB4OjGtkkaK6QxaW7vd9lxpv158mlQCLPeqSgRF1oSrXgnl+TJv2ViCIshHtX9CQE2+3vRbDF4bTcX6s3GOtflTCiFAK+WeVHteimKNDI/b7GGpgs9w+mKIvIhZ0RoLFO1s= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717537017; c=relaxed/simple; bh=pzagUsOfsMe7nXY2qy+H9ZNEIN7F6kwY/FvO2gt0gR0=; h=Message-ID:Date:Subject:To:Cc:References:From:In-Reply-To: Content-Type:MIME-Version; b=IJL52SnXbK+QTFAFATCmIh+hHWbeKUszEYJKH7V39+MmaayIXXfjn74keOTuR89fXk5+cEubPWoH6493iaUvwGquK3OAahhLYVVyF/qMrjQXMWJpwzlGinxAaePtJVCGYVfyE8+2OtoOe0+5KOOUTELrChyLIbxaFK4+qM/ljWI= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=xu/+hKng; arc=fail smtp.client-ip=40.107.102.59 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=T3VOjwxZ8tr33ux6cu+uNlPiXfW9MqWdQK98r/UEFHvjN4lV06RulPWlsgq+pzpjvsCgSLLdbx+u5MOQr1CFDLeY7f8ff+wVW2Y1p+e9Ku4TsESF/KRlgMNXe3EDNgnAt82S3K5G2dX7kKHe1iYsv4wEMD4ZyNMv3svhWj/oScPSy3aQpZDbMKS0xWShGPANW0QcTqm/phiu69EWC0eTPueUJ3Y7ecMPX+DjDS9jmf5bhokAJBj2I93F59sW4nqryRlQ56giDGNjJkeaKe3z3dDwHl1PzdqLEq4yhE3/yk3yblI3vLZ+lFH6d3hTKmVteeUYZkz7DW0WRvsbrsdPxA== 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=9+/fc2V7uQQyTIERxgNjfWlwpgFYkP+MvSI2EWb22mI=; b=CO6UKiNnsqMp966F8GNlX3dOwd10LlotypNUDUv0RS7McUhtgM/MPvogR8bwagjEbUkijvwjY1+r7TvgHVVtxYOZAWcJZQNAG6TOCX91arXOBqUxJoS6yKnCeynxBE7iciP4dNNSmlPJXQB+cK3o0BH7LfOPDnX71v8yeeP0IolDU5kf8LKIAZV8zvEUERITzHChnZYK+oBQensXgnrpdhURRxod7n5m+woEjZL4wdqNXpz0etZPub6+v1lc/+Ewg0MeodQpRk+9d2YWjgz1HkloCgrNj5K0WrsT1b0Wb9Vd0Lljj2R4T5SU8n32PDsv4MV4wlNvzj7r97082ZxWuQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9+/fc2V7uQQyTIERxgNjfWlwpgFYkP+MvSI2EWb22mI=; b=xu/+hKngT4BPmFh9pfAVDcrs8aDcnEYcuymSBM+YEcrH1rTrEW0tknVSJ4cP62meoYIvJG+JpLgVGO4dC3O8/ph2YfdCN90x4McfviI2ZB3iZMhO+f/P45zs6HUJAmC7jrh+4DJ2Vt0MEKTW8P46QjPoFE5d67gcanbZIrcO59A= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from BL1PR12MB5732.namprd12.prod.outlook.com (2603:10b6:208:387::17) by MW3PR12MB4492.namprd12.prod.outlook.com (2603:10b6:303:57::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.31; Tue, 4 Jun 2024 21:36:51 +0000 Received: from BL1PR12MB5732.namprd12.prod.outlook.com ([fe80::bf0:d462:345b:dc52]) by BL1PR12MB5732.namprd12.prod.outlook.com ([fe80::bf0:d462:345b:dc52%7]) with mapi id 15.20.7633.021; Tue, 4 Jun 2024 21:36:51 +0000 Message-ID: <49ef4f0a-683b-ca2a-20a9-65820f8c5e37@amd.com> Date: Tue, 4 Jun 2024 16:36:49 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: [PATCH v2] crypto: ccp - Fix null pointer dereference in __sev_snp_shutdown_locked Content-Language: en-US To: Kim Phillips , Ashish Kalra , John Allen , Herbert Xu , "David S . Miller" Cc: Mario Limonciello , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, Liam Merwick References: <20240604174739.175288-1-kim.phillips@amd.com> From: Tom Lendacky In-Reply-To: <20240604174739.175288-1-kim.phillips@amd.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: DM6PR02CA0133.namprd02.prod.outlook.com (2603:10b6:5:1b4::35) To BL1PR12MB5732.namprd12.prod.outlook.com (2603:10b6:208:387::17) Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL1PR12MB5732:EE_|MW3PR12MB4492:EE_ X-MS-Office365-Filtering-Correlation-Id: f0fdbf95-a7fc-4d55-f9d4-08dc84de7235 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|1800799015|376005|366007; X-Microsoft-Antispam-Message-Info: =?utf-8?B?SXZRaDBFVEQ3Wm85NmtHNUJjZWJQZXVNMmlQZ2hOZWZIdy9idytpeVR5bTFF?= =?utf-8?B?RUhHY3ZxYnRwTWM2YitGZWp6NDVaajZ0WU5nMmdHWFkxRDIvR01ZN2hlZHc3?= =?utf-8?B?NmxIaWVkVjAwS0Vkd0pmMmYzVHpCdUo1ektuM2JVbVh3UVdQdmFMMTlDY290?= =?utf-8?B?S2RLakN2NmdWTFRzY0p3dTJnT3QzMkE3eWRnczdxS2xaTlpjK0Zhb0ZSY0ho?= =?utf-8?B?U08xY3VUcEdsVzZJaE1Nbk9RdG8yUTJZNElWQnIxeGtyRnlaNUhnNnU3Sms2?= =?utf-8?B?QWxLc3UxNlV1a3RQRmFPMm50ZnR5c1R0RGRlWGdYRnN1eWxpMnVudW5oY1V0?= =?utf-8?B?NXNsaU9nMHpndUdsbXdVRVhKdWJPZDQwUldiN2xCcWNwZGdROFpIMXJ0OW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NGpTajEzUHZVYkNTcHdJckhBNHNtQk5PZnlU?= =?utf-8?B?M1RYS01rVFo2ZEVkTU1hOXY1aEg5RFNlZVY0c3lHMTZoNHNGb3lzbEh4c2c4?= =?utf-8?B?L1dlcUw4Tmp3dmhzWFcrTnhGeG10ZlBuWG9HZ0lyeUlLaVI3ZkM3R2R6Rm9S?= =?utf-8?B?L3l4c0p6b05DcktuR3Z3blhSSW9haG5STmtXbndJZWY2RHpFOHVMa2hjL0Uy?= =?utf-8?B?NitLVE9WNk50MHROS2EwMEN1WHhBNjIxWkZWSnlRdXhNOGdGbDMyOWVMWWhH?= =?utf-8?B?NzQwNVFESFJxbVhMWFlsUlRZQitLSjgyVE1iL2FMSGtvTHBCTlpIenhyeUwr?= =?utf-8?B?VUtiaFdWRjNaVXN1Nzhsd3ZjVTJZR1BvanlHM2gxY205MXR1NGNicVZpckVz?= =?utf-8?B?SnQwTnlhWFlqejZUWXpjaTQzK3A1YjRMeFl6MzJ4NVpWLy8velNScGNnPT0=?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BL1PR12MB5732.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(1800799015)(376005)(366007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?RmJlS1Y4amdkS1pJeFJIb1AzbFo4ZkV3WWwzNCtWb1FUOHYvL01OYS8rM0lP?= =?utf-8?B?ZExRMDVpTXZBdVRhV0pKWVNwOGhaSUV6OVRLcWVWTDZBL3A3V2gycC9nVmxi?= =?utf-8?B?cXdCcmZtaGRkcHZBQmRTR1QrazNkcGdIVzhEb0twa0xSL1UveFJBSzBtazVs?= =?utf-8?B?UURzTUJrZEhYL01QR0p5RmlnQVNOQi9NcDQ1V240TG4wOU13Um1uZjdVaGtv?= =?utf-8?B?M0Z6QkNrazl1c3REdEZ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=?utf-8?B?Q3FOVlhrSVpUTmhMblNnZ1l0WlMwaEZxZ2d6NWl3SjFINzMxSXVPcUMxNkl4?= =?utf-8?Q?2+LzzgGu08rDo7H83QP7iYvFl?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: f0fdbf95-a7fc-4d55-f9d4-08dc84de7235 X-MS-Exchange-CrossTenant-AuthSource: BL1PR12MB5732.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jun 2024 21:36:51.5262 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: uODF1g/+Xikewebp0Gykg/8OBJs2E47U7097fJwdOC6A4khHbsbxzinqYqqOSD6OOIKj+NUeUvuMu2LjR1552A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR12MB4492 On 6/4/24 12:47, Kim Phillips wrote: > Fix a null pointer dereference induced by DEBUG_TEST_DRIVER_REMOVE. > Return from __sev_snp_shutdown_locked() if the psp_device or the > sev_device structs are not initialized. Without the fix, the driver will > produce the following splat: > > > Fixes: 1ca5614b84ee ("crypto: ccp: Add support to initialize the AMD-SP for SEV-SNP") > Cc: stable@vger.kernel.org > Signed-off-by: Kim Phillips > Reviewed-by: Liam Merwick > Reviewed-by: Mario Limonciello > Reviewed-by: John Allen Reviewed-by: Tom Lendacky > --- > v2: > - Correct the Fixes tag (Tom L.) > - Remove log timestamps, elaborate commit text (John Allen) > - Add Reviews-by. > > v1: > - https://lore.kernel.org/linux-crypto/20240603151212.18342-1-kim.phillips@amd.com/ > > drivers/crypto/ccp/sev-dev.c | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) >