Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp893981pxb; Fri, 22 Apr 2022 13:38:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzEBz0ojXxL4nFFrQy53JAUq0+jFZKyKayBZblsdZZHCEIbRb31q4a2iD4ywVqkH9IdUA5Y X-Received: by 2002:a05:6a00:22cd:b0:50a:69c9:1806 with SMTP id f13-20020a056a0022cd00b0050a69c91806mr6847028pfj.51.1650659913437; Fri, 22 Apr 2022 13:38:33 -0700 (PDT) Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id n18-20020a056a000d5200b0050c92d89838si4057495pfv.353.2022.04.22.13.38.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 13:38:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=mimecast20200619 header.b=KLL9H1x2; arc=fail (body hash mismatch); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B226D2A3262; Fri, 22 Apr 2022 12:23:47 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377316AbiDTJs7 (ORCPT + 99 others); Wed, 20 Apr 2022 05:48:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237711AbiDTJsx (ORCPT ); Wed, 20 Apr 2022 05:48:53 -0400 Received: from de-smtp-delivery-102.mimecast.com (de-smtp-delivery-102.mimecast.com [194.104.109.102]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9694E381A3 for ; Wed, 20 Apr 2022 02:46:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=mimecast20200619; t=1650447964; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=52PTIztO+gCoFSOMRqnb4ySrtRI2SSdR0EiNB4Tmwb0=; b=KLL9H1x2ii08ONi26F7TMu1yC2ybQ2eTwlfgrYt3TorYRevM6vY15usIPI1EVXE3UQ2iAf dBhMi124+/pouPqNoWJ98r2UVgEeoiqxtgT7xzYbebUOQRX5tUPcKTvPS4ceEdBR5LHuY+ qBy68/JuhFhBs8hydl8448vBCapAYok= Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05lp2171.outbound.protection.outlook.com [104.47.17.171]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id de-mta-13-Zumsf0OsNpKrC2eRaHyM7A-1; Wed, 20 Apr 2022 11:45:56 +0200 X-MC-Unique: Zumsf0OsNpKrC2eRaHyM7A-1 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=R4/Dzhod1Cx8Yja7QCroPkwE4ZVBh7xmeZcthr5y824TDpHRJd0RxhdT2XSzm8xfqChNSdbKz8GPryZMFfqaEOjf9HwyupDl4s8Roxg4F6IjPWLhI6lRdjnt8wyJ2pHIhP4MMF1DPcI+dn3fov3/FZUJmcjRzgKtb59XTWRZOh98/GLKKo7h7AbyDQJj5oFPrYP2bDuT6FCQXDzwv6c01RvKHyNWtYgH4Vc0wV577S4MQbLQbibaO7+44qI3TzT1ogyYN7eNXUXm2EhP8SYOtEvIuctp8Ry6wXRrw7g7UvyWTiQE5Q89Rsz2Hp5iInQ0jZudch9Funen47uMHl0rYw== 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=dFGFGeVVEVrBg8Pq8yXsuuheHj9rwQ9eye+isxu7W54=; b=fDwYEKAsV54vVrm2ylbjKIOG37Bd6YJ0CVM4tdsoP+FGJab7mCEOgzgOZkzqgknh+LqYXK3ErZlZjtIENPMi2VLn86VvVQ8mWE5spP3TcQ4ijYvHCfgFX2mJYTce0w+mtlATifDUdAnvSMZ25/PtS2KUr2JWjYunJej/Pl1jepcNp6bPcJVXI/MvWZqRP6sHJiuSmNxV8M+Y011cA6/a38Xmi+nRGpivX4YG0fxcBwFaHraWBLg+GhWBQrdn5Qao8Tf4UaOXwj9Mr0wAzBb8bPnVPiu6XVxMK3951UBotyfPYPcHWEWNS8hu5ZtPA+aelPGWb8begamvJcv2IUfL8g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Received: from VI1PR0401MB2526.eurprd04.prod.outlook.com (2603:10a6:800:58::16) by VI1PR04MB4335.eurprd04.prod.outlook.com (2603:10a6:803:4e::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.20; Wed, 20 Apr 2022 09:45:53 +0000 Received: from VI1PR0401MB2526.eurprd04.prod.outlook.com ([fe80::8c82:19c5:ce96:491b]) by VI1PR0401MB2526.eurprd04.prod.outlook.com ([fe80::8c82:19c5:ce96:491b%4]) with mapi id 15.20.5186.014; Wed, 20 Apr 2022 09:45:53 +0000 Message-ID: Date: Wed, 20 Apr 2022 11:45:49 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.0 Subject: Re: [PATCH] driver: usb: nullify dangling pointer in cdc_ncm_free Content-Language: en-US To: Johan Hovold , Oliver Neukum CC: Andy Shevchenko , Oleksij Rempel , Dongliang Mu , Oliver Neukum , "David S. Miller" , Jakub Kicinski , Paolo Abeni , Dongliang Mu , syzbot+eabbf2aaa999cc507108@syzkaller.appspotmail.com, USB , netdev , Linux Kernel Mailing List References: <20220409120901.267526-1-dzm91@hust.edu.cn> From: Oliver Neukum In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AS8PR04CA0017.eurprd04.prod.outlook.com (2603:10a6:20b:310::22) To VI1PR0401MB2526.eurprd04.prod.outlook.com (2603:10a6:800:58::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 98c941c1-7a3b-45a9-c2f9-08da22b28f17 X-MS-TrafficTypeDiagnostic: VI1PR04MB4335:EE_ X-LD-Processed: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba,ExtFwd 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: 8VWmRWf3bmfa72m/UGa7eDaHr3Vr+AStnYxdg1rWz3cLVzgrclHIvbR1Pg6ZR9l+T0xcOjVyYCpJe/T17nZoKVxWqrVAvcPbJmTxR5prB2i5piGLo78lzLiUYp6q+GVryrIVzKAGPOrzBCewkx1fBIHE6xxGSaehFo8Wv8cKaFo8Rk2QyZld6GuNy9VOYRO+kBnzHaUq/m3Gkvd2RlNlfYyDxpuHpJf6n+BjbotOqHHhmZiyHbRzM/8Uz6adfY0sluJcDL0/avNyMWdInGT70J/zWk7F6RP5z+ncdhCmGgqtMWAGtabQ/jsF/4ryBRnuJAJoicgvamjxZMnS7QBzxmpAzyGSd5C9EvCana63geRF+jXbkyBVNZ8kCk1eBO+1+OmCtltPpKJkw7G6v6WJYlnBD7ZybxPmAQEhDB6jcimyP2X5/fV7YY/cKUzqgX9kAiG/nlbO+L/sV1nVWyPHNuVqYilYYXVmz/WcmgDK2Q2oy3oYOmt2wuc6u2mv9vCEJfHv9UcLrR99pPojj/CDbnMRxWQE1uOSsp8Aiv9DlsmfP0qLaxyH0NRmj/ztlq31BqoREGO2l9M0ynKPcoF6y88mQFnyJyVu0F0tHOGwWUuYHO3p1Ly+dDzsETkmNPw8ZFF3ju7ZfzncHYSzCSFYYusaOyZhWUb1y6K1BkZ9x/qYai8THd0tDSv1QjO2WAchCi3xB6prtB8tspZxmi3O68chmAiTOPbuyGzf1wuAHoQzQGbRP72M64epnsB2M/E5 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR0401MB2526.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(366004)(8676002)(7416002)(38100700002)(6512007)(2616005)(31696002)(8936002)(6506007)(6666004)(31686004)(54906003)(66556008)(4326008)(508600001)(316002)(2906002)(110136005)(66476007)(5660300002)(83380400001)(53546011)(6486002)(36756003)(86362001)(66946007)(186003)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 2 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?kw/jG1rHfuOBxKvmV4yi3V5Fiyvn9gOv1lIcYLDJ5tN0GvwG292PteAfxSh3?= =?us-ascii?Q?uLi0cYn/kPZcmd9AMVHTPKCp/TRMIbckBv/rqzNhss5FyrZXHPLsLj2ur9EN?= =?us-ascii?Q?MLbtMzoDKS3lqw7fpidrgynguVcHD6K7g03NbEGc3wssZpmrzziZ8stXuoIe?= =?us-ascii?Q?P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NUQ37oXgTgOB/8J9h48lLo03?= =?us-ascii?Q?Ztj3Puq8afCEWRwjDKuLT5dy30MMoBgHrX6FUQzSwrxT8jEmTEzO2UrolFkH?= =?us-ascii?Q?Sry82v1DazLrywKPabEJC7ly4D01n0Y4hFSiHt/9KhWaqSY2qbePpIPxUffg?= =?us-ascii?Q?O+YqFCyBBLS8AW4pOWzoGM98ER7UnpuNCTYWZ+fsDmK8BTSH1VPnNzA899g2?= =?us-ascii?Q?esTATo+pJr430xJNSbI0GpfxLwgvoWuuG5ROsipcKnU1veMoc7OUYVDq0Z9P?= =?us-ascii?Q?hn+ZgHhbWS4xc7heyeIUPbnGiEDABxnEX1g7J0jo7DySMcKRncY1eQwLWneg?= =?us-ascii?Q?ybE1dMxKTcrDLPR6h7zQGjQ1fr5X/0+bCpih2PNkQpPmqmojaS14NjUaXNuJ?= =?us-ascii?Q?fc0VPb+aoCDSUb2IMP0WcKwXgYoGWysJsWB2EOYLxNBirx2fU7qJPbUUP7mZ?= =?us-ascii?Q?WzE4IvUM2g8Oj5brBFPYd2+ruU2s3fIuib2gy1qjJdHOXMSZxMuChhWSnQYE?= =?us-ascii?Q?+bWhNrLCxiej5dk40bWGIIXDXDoDLy0lo5brLymflJX3Do349yU2pjdJLv0X?= =?us-ascii?Q?OD+6lxdH1zaHhO4LR/nkbq33qO5lRajmj19kiFLvQtmZT4RWhNVVWJ8SSoK0?= =?us-ascii?Q?x+tw9FTvgKjwvCl/IMBaboBgyl9ZEiKcCxBYEcDLGaKmdoNlxMOl3x/INS0l?= =?us-ascii?Q?LSx5ZVAi+UiE+uV0Du2oEkPQiPOJxaJTIeUNvxiCyImicfqLDm8q2HRBXxht?= X-MS-Exchange-AntiSpam-MessageData-1: snNBOyMlvP80hg== X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 98c941c1-7a3b-45a9-c2f9-08da22b28f17 X-MS-Exchange-CrossTenant-AuthSource: VI1PR0401MB2526.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Apr 2022 09:45:52.9381 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 1AuBnmhtnMkMmWpGNXobFonnF6Fnq+LZUJQOB/RhsbhvvR/SCI2xdns5OJBsl1dLpTNDi90+g8IgV7VNnW2/og== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB4335 X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE autolearn=unavailable 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 20.04.22 08:56, Johan Hovold wrote: > >> =20 >> @@ -1214,7 +1214,7 @@ static const struct driver_info hawking_uf200_info= =3D { >> static const struct driver_info ax88772_info =3D { >> .description =3D "ASIX AX88772 USB 2.0 Ethernet", >> .bind =3D ax88772_bind, >> - .unbind =3D ax88772_unbind, >> + .unbind =3D ax88772_disable, > These should all be > > .disable =3D ... Thanks, noted. > > but you probably need to split the callback and keep unbind as well for > the actual clean up (freeing resources etc). That is the driver the problematic commit was requested for. I am looking into it. > >> - if (dev->driver_info->unbind) >> - dev->driver_info->unbind(dev, intf); >> + if (dev->driver_info->disable) >> + dev->driver_info->disable(dev, intf); >> =20 >> net =3D dev->net; >> unregister_netdev (net); >> @@ -1651,6 +1651,9 @@ void usbnet_disconnect (struct usb_interface *intf= ) >> =20 >> usb_scuttle_anchored_urbs(&dev->deferred); >> =20 >> + if (dev->driver_info->unbind) >> + dev->driver_info->unbind (dev, intf); >> + >> usb_kill_urb(dev->interrupt); > Don't you need to quiesce all I/O, including stopping the interrupt URB, > before unbind? If I do that, how do I prevent people from relaunching the URB between kill and unbind? Do I need to poison it? =C2=A0=C2=A0=C2=A0 Regards =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 Oliver