Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp1323109pxp; Thu, 10 Mar 2022 03:19:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJyS84F2jPFFDsalelWDnPEOJTtb3YpaI67rRBz8T9A9YKb3reS/Io7KdkLs5cwRCpiuObFk X-Received: by 2002:a17:90a:9dc6:b0:1bc:5c73:522b with SMTP id x6-20020a17090a9dc600b001bc5c73522bmr4508196pjv.35.1646911156513; Thu, 10 Mar 2022 03:19:16 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1646911156; cv=pass; d=google.com; s=arc-20160816; b=qf/FS/35W2k9AjDIferRJ0b5pj2Le90vwH2wxry4+Gibtu07UmewgwkFj1qojrslrS vT5zWZ9yl5G3vzTx88fMQHazEvhim3MIp5rs/pfHqfDOCN76NlSzi8Dwpmb4lsWu/p+S MmF+01MURQIekIP+USrPSgRuJNvjqjFS+f6ePHVPPqYMiiiVmIz52usHPWOEn/+7eFNq USH4zQF1g4bRBqcZ/FCPtZXV6vKQZWc/OVf2Cav2U/DHD+3Ep7bf2LrkDkLHnPe6nEvI k4T5P9435VtYG3YsmEjURv+TusyRxDkHd1myLYED+xV13JrkEtd085niCWL+wVJ0QWtw qU+A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :in-reply-to:organization:references:cc:to:from:content-language :subject:user-agent:date:message-id:dkim-signature; bh=7f1Eyz1kcWVpDp6KBYaE9TMkU8itqqeZ1gDWRpm2yJo=; b=eTRE6EB7wuevrirOlfTjWZHbXWASfLSK5g7W7W3ltPrTfP6gOAyHj1AKagsysf3+CQ lhswcwI62PosRnW86iTfQwpk9sKTwWWJ56V6aceCa/5G94Tl+0EPAIA5cJt67goY/fJ8 aa8i7d3nprlyhNwUYA7n5SeCJIvrYnoo2QoO60PMz2b4hEvWliB0MLIjx320xlhXe31p hCkYeSWRhgj/bYHYgkqWnAvtmnMW0CV5QL6XkmqR1Ft5UaJsxOuBSfRon+6xitaefA+0 qtgAFSCoJvGubedWXEQMdkixER1fwlqSNvsF4oD63g4fjREmvkDl66wLNPP6AAqmyHOb w/hw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@axentia.se header.s=selector2 header.b=lZZfgnVY; arc=pass (i=1 spf=pass spfdomain=axentia.se dkim=pass dkdomain=axentia.se dmarc=pass fromdomain=axentia.se); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k3-20020a17090a910300b001bef3445ff4si1548928pjo.46.2022.03.10.03.18.59; Thu, 10 Mar 2022 03:19:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@axentia.se header.s=selector2 header.b=lZZfgnVY; arc=pass (i=1 spf=pass spfdomain=axentia.se dkim=pass dkdomain=axentia.se dmarc=pass fromdomain=axentia.se); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241239AbiCJKlf (ORCPT + 99 others); Thu, 10 Mar 2022 05:41:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234042AbiCJKle (ORCPT ); Thu, 10 Mar 2022 05:41:34 -0500 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60117.outbound.protection.outlook.com [40.107.6.117]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 67141139125 for ; Thu, 10 Mar 2022 02:40:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OB2+Faa8fjF4N0ojj0f1EaQ2a64Fx0tBYzw35RZ8ImTXYUzEoAkCUR0GdDu3+EZ2Jlyb83ScXdqEXryhVYkXz3WQY2HBvl6kwzp27CMgbH9ApFddYdieXo02pENSV2HqduCMxC7n/5WjrzzUOpBxNBqVKsYuvkAH7hAVbo7IlcKkd1g98yyoUyjU8WMkjW23rhl+Wl36vyPWz/fFKZbjK/3YIrct0nddwwQD6sToFoyFG7KvmQpSioU2KUGQpLPMdZbx5oa41y84OroKmINP9TOmlqBIk2qGpuCedLr9dRWCzILDHiaAnYI0Au7UzAD2NxEQ76J04kMgXkcT94mA7Q== 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=7f1Eyz1kcWVpDp6KBYaE9TMkU8itqqeZ1gDWRpm2yJo=; b=RdIsnouUU9OUWBMl3Wb+psJgnhc0g3PTko8I57wUPdqWSviHq2LbO9qatlNDgZAcKW8a78tJw7CylllCBus1nN+DrfQMomovUXjxQWBGCfPHJoR+wS9IJ2wkKHVAb+V7+HtcjMd0vFFJFAq/DZS16PZw3liDGwygQIgOdgnjOW39WTwYPzl778o4S4Rmc+L2U4G8ko5PkiUQO3iIxkl25vD6CCP3tg1NKeBFlaR0FrBeNICtjl96mjmz3WipNZ4Au7zP1/ZJuwFiwsB7HkCtzBBgtG1oBEeXBT5stcLO2luLZ5NmchZ/WZEm/646Mi1EDw5ZEapBIzzYh3nzNa0zag== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=axentia.se; dmarc=pass action=none header.from=axentia.se; dkim=pass header.d=axentia.se; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axentia.se; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7f1Eyz1kcWVpDp6KBYaE9TMkU8itqqeZ1gDWRpm2yJo=; b=lZZfgnVYN2dY0mCb2aN9aYsFTdqiLFnhSlnzMRFTZuGWoWSymZ8ibXipmkNXmmy1P00IWCI1/Lz9kA5LvXbPPUbcJYa14trnSs2Fke5hUF5y4UGSFCssh1UFhfCBPzERDCpdL3R73lOKutNknXUoP3mAEMya1Qbg7PCCn1MiTUE= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=axentia.se; Received: from AM0PR02MB4436.eurprd02.prod.outlook.com (2603:10a6:208:ed::15) by DB7PR02MB4364.eurprd02.prod.outlook.com (2603:10a6:10:42::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.16; Thu, 10 Mar 2022 10:40:27 +0000 Received: from AM0PR02MB4436.eurprd02.prod.outlook.com ([fe80::7d29:dd84:d2bf:a1a0]) by AM0PR02MB4436.eurprd02.prod.outlook.com ([fe80::7d29:dd84:d2bf:a1a0%4]) with mapi id 15.20.5038.027; Thu, 10 Mar 2022 10:40:27 +0000 Message-ID: <6ad73fa2-0ebb-1e96-a45a-b70faca623dd@axentia.se> Date: Thu, 10 Mar 2022 11:40:23 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Subject: Re: Regression: memory corruption on Atmel SAMA5D31 Content-Language: en-US From: Peter Rosin To: Nicolas Ferre , Tudor.Ambarus@microchip.com, Alexandre Belloni Cc: Daniels Umanovskis , Patrice Vilchez , Cristian Birsan , Ludovic Desroches , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , Greg Kroah-Hartman , Saravana Kannan References: <13c6c9a2-6db5-c3bf-349b-4c127ad3496a@axentia.se> <69bb004f-0bb4-ec56-479c-5deab0ece00f@axentia.se> <7edb467a-c8b4-fe29-9947-f71c655caa9f@axentia.se> <8484ce66-639c-03f5-c5db-3574ea26690c@microchip.com> <075a196f-79c2-0d58-15f9-ad5e33e2306b@axentia.se> <3beb80ad-d6f8-8c6a-e17d-e40a644bba07@microchip.com> <9e24034e-f586-a721-9031-179601a69abb@axentia.se> <7214ea3d-1445-c0fb-2620-cdc3d6167bcc@axentia.se> <6d9561a4-39e4-3dbe-5fe2-c6f88ee2a4c6@axentia.se> <220ddbef-5592-47b7-5150-4291f9532c6d@axentia.se> Organization: Axentia Technologies AB In-Reply-To: <220ddbef-5592-47b7-5150-4291f9532c6d@axentia.se> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: HE1PR0102CA0055.eurprd01.prod.exchangelabs.com (2603:10a6:7:7d::32) To AM0PR02MB4436.eurprd02.prod.outlook.com (2603:10a6:208:ed::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5bf33936-9625-4f83-f9cc-08da028263b1 X-MS-TrafficTypeDiagnostic: DB7PR02MB4364:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: utduDFV+OJ4o89VFEyRcpJc7RoWCB+dBa1YXgLP1uHvzOJXRofqS7DL8/msp814dnur9bpFC1MNXvbDmVXWhSj3awGvE9muBxjOiBRTh2/VsNkoAmLHQf8MblsFbEpWYaFM/pRsYec5DI0mc1B1mBL3Vu9kHFOJ1ROtmnaQveAerQNM6okzziibDmKhyW27pMBeO8Yxk9KBOoPeR/9EUhl3p/wZKowlvu5LvKhNPLNjI3ofnoPzPizvxUIcFzmXu8xEAzhbU9oxsZ8q+K3wQpRHKIpxKpg7pF4VTPt0lwt/6Zl3cbNbUQRfTu2W55P5N8SO48P8CuQOO7M4CVX1VKbwqZp5BoAFWxrm1Tf46/m4DvTDlCHOyhkQmwz9VRkwlyZD0KeGeF7ewRQFNBKD6aqvGxi/RKilucmCqekidzwjDaVmNSH13ZMwCOVkmay7VmnahgwPDpHUMtFaADnJmyRnZyEzoi83vNUnMJ3iMG5wby82K4LRCUHVA4rJMaNX97LTJrFJecCEX6nhGXSFU+KD9eC6/Wc7S1ZDaJZTLidIHOJyjTVuH1UE6vh5bnwsGH2u9fP7WUrNijyc9H2Jlc0nwVznhBhaJ84nqmxe7BCY21INaAfwWDFacmAFwymXaxxWJwaMKl4j6X1XyIVIvr8u6vTRo27sxZbGPDUalQgLFymC7gtKT7UZ+pmfyC+eGiiEFx7brnzxddCfEu8fGuNSvJFwOSinOhJB9rH9+pEF8nhIRtxB0DXti3ITH0RQFIEANyjoKSiu64Qhb6LoH3KP9Pk99MH1tiSRszKnrIdksnwZR/uMlJdCRVKe5vh1G X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM0PR02MB4436.eurprd02.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(39830400003)(346002)(396003)(376002)(366004)(136003)(6512007)(36916002)(186003)(8936002)(53546011)(508600001)(6666004)(6506007)(26005)(2616005)(38100700002)(83380400001)(7416002)(4326008)(5660300002)(8676002)(66946007)(66476007)(66556008)(31686004)(36756003)(2906002)(54906003)(110136005)(6486002)(966005)(86362001)(31696002)(316002)(45980500001)(43740500002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?K29YL0xBTG00WnUvMDVzK2dJcEE1L3NORXAzVUNTd21FU3pNN1dvdTNsTjZr?= =?utf-8?B?Ry9heThTYVZVdHZINGMzeE1IUzVrTHdvZy9Jc1NyQk5tNEY3dkFYS0JzZ0tB?= =?utf-8?B?VkNQSUR1M01YVTk1dTVkTjBlMWpjc2JaUmJ0U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2?= =?utf-8?B?czVMTWJHNXB3eGRnZUMwNzA0VlQxTm5nY2xRVFlLaG82a1N1WG0rNmF6SXdz?= =?utf-8?B?Q1lPZ3ZBU2FjM3BDbXpEb0QwaFdkM1lvV25ZTDhVK2lsZnN6VHRoaFBSL1Jt?= =?utf-8?B?ZGFUeHgyeFI2b2ZWbEsyN0t5azBqb243RTR4TnIvTVJaVGNzK0NVeitkZEpL?= =?utf-8?Q?bz6w=3D?= X-OriginatorOrg: axentia.se X-MS-Exchange-CrossTenant-Network-Message-Id: 5bf33936-9625-4f83-f9cc-08da028263b1 X-MS-Exchange-CrossTenant-AuthSource: AM0PR02MB4436.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Mar 2022 10:40:26.9521 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4ee68585-03e1-4785-942a-df9c1871a234 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Et4lL01To1EKvGpwcbVn9cIHLmn4CV0fMmj3bqE5guPC4bkZBuGhKmVw/CPxcdhm X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR02MB4364 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 2022-03-10 10:58, Peter Rosin wrote: > [bringing this threadlet back to the lists, hope that's ok] > > On 2022-03-10 09:27, Nicolas Ferre wrote: >> From that article: >> https://lwn.net/Articles/885941/ >> >> I read: >> >> "Koschel included a patch fixing a bug in the USB subsystem where the >> iterator passed to this macro was used after the exit from the macro, >> which is a dangerous thing to do. Depending on what happens within the >> list, the contents of that iterator could be something surprising, even >> in the absence of speculative execution. Koschel fixed the problem by >> reworking the code in question to stop using the iterator after the loop. " >> >> USB subsystem, "struct list_head *next, *prev;"... Some keywords present >> there... worth a try? >> >> Regards, >> Nicolas > > gr_udc.c is not built with the config that is in use, which is sad because > it looked like a good candidate. at91_usba_udc.c, which is included, has the same pattern. But alas, doing the equivalent patch there does not fix things either. I.e. (whitespace damaged) --- a/drivers/usb/gadget/udc/atmel_usba_udc.c +++ b/drivers/usb/gadget/udc/atmel_usba_udc.c @@ -863,6 +863,7 @@ static int usba_ep_dequeue(struct usb_ep *_ep, struct usb_request *_req) struct usba_request *req; unsigned long flags; u32 status; + bool found = false; DBG(DBG_GADGET | DBG_QUEUE, "ep_dequeue: %s, req %p\n", ep->ep.name, _req); @@ -870,11 +871,13 @@ static int usba_ep_dequeue(struct usb_ep *_ep, struct usb_request *_req) spin_lock_irqsave(&udc->lock, flags); list_for_each_entry(req, &ep->queue, queue) { - if (&req->req == _req) + if (&req->req == _req) { + found = true; break; + } } - if (&req->req != _req) { + if (!found) { spin_unlock_irqrestore(&udc->lock, flags); return -EINVAL; } The test started out with 3 good hashes though, so I got my hopes up. But no, it's about the same failure rate as usual. I have the feeling that I will never again trust a single sha256sum... Cheers, Peter