Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp629549pxb; Fri, 22 Apr 2022 08:11:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzxd6QYiwiWnMmJVTL+zbzK99ZIur4/yLOnSbpsxoB9fQSdW1zhRR4KIdqDP9u0MzQ+4t3O X-Received: by 2002:a05:6402:3513:b0:424:1b50:68b7 with SMTP id b19-20020a056402351300b004241b5068b7mr5416243edd.144.1650640262883; Fri, 22 Apr 2022 08:11:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650640262; cv=none; d=google.com; s=arc-20160816; b=szC/FbLs3vcEa5VbdjKtlJ91sUvqd4sigEFUGxECfFEhLjTmJE3NKErBML0wYZAb4L AG4pEPEEhg88DVNFwrfl20T8gvT45JtjaNP3saJILckyjaVPgcn4hwj6ij7aXGuVRhrd HRhrP7ecwYs2U0N6Qtk7mpxbrqyFSCJ4onDrLWxBdVUcQP8imi2zfTz4OIJKRWJAQjbF zhKBP6yaKQYT5pWxmR6L2WWwK91rrckt+67aEDtFziIBSekOkCHFZGCVyvZ4U4v6Hs1c Xabd1ffoLOezlVsmyzUddBs1EsG7T7VX2dvxmn5wce7wroUQONiRI4ugQw1oi/U0dTcN n9QQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=wdFambauWaWuFh77d15v/HrYW9qex/d1e0UWvdB/AUU=; b=vN1Dg2XDDtgItXWbe29PwFSQzQkKDviY22ac8/bqItOdCNTiJwLLcrimJj4baruyHQ 5F+TIfwhaNz9F8YjxJSeILPTd1sXt3aLjFVj1bj9k0PHWf1nS8avHr16/1e/5UCdUe5S 5O4bXjFWiYGD+3m9OWNTAFHyc1sDrnycKw3SDXvjirIVm451AzwYHni4NHoLYekW1hG+ qsDhJD/qPwRdT2MwPyB9Ce3DbS1ZXMvZy9eC/0R8r2X4iTVDL/z6cbNeCSdkKHhwxpX4 q9A8TShN0YeHHUmseEq/dbOE95jQX2cSqCiDesdOedmZZNhjRMpoxA/n6eJLjwXDBNzl upIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=HKl8FAkC; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w5-20020a170906d20500b006e89250c588si6638849ejz.12.2022.04.22.08.10.38; Fri, 22 Apr 2022 08:11:02 -0700 (PDT) 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=@kernel.org header.s=k20201202 header.b=HKl8FAkC; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377481AbiDTKJl (ORCPT + 99 others); Wed, 20 Apr 2022 06:09:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347063AbiDTKJj (ORCPT ); Wed, 20 Apr 2022 06:09:39 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 591D918B32; Wed, 20 Apr 2022 03:06:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E6C24B81E61; Wed, 20 Apr 2022 10:06:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 93993C385A1; Wed, 20 Apr 2022 10:06:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1650449211; bh=TkzaIXVfmy/5OEl78ORgSpwgfioQr5mxDuXVgiEkTDg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=HKl8FAkCXv6aTwWXIuGURVGJg2g7lNcLWuxBXb9ke5XDyru1he5+zJi0bs+PfbTEY E+Tn7JK9xydyiNgTLnlqNP5yBlQVTL1xpDkorka6QINWM0OcmBBbtOshNhwW2UrgIf YnwOj5X1jWdCZni/4Fv+8CL4FqJzZixpnYxrccjB+Q5JLL4NQ+kwmw7Qew6hQFaojG vCBswZnSYh+xbwWyUU5vUClqWgAGLGrQnWQIC2ukIOgdIz3bHJGJH1g6boUiXaEqXw t0rnY0QvKNhhZegP4jDaa0SZbwhMkV46U1k2UHYPpDNhyFRqz99NxxOatUnSUexRbQ RG51Zx2mrYuJQ== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1nh7ER-0007Xi-N9; Wed, 20 Apr 2022 12:06:43 +0200 Date: Wed, 20 Apr 2022 12:06:43 +0200 From: Johan Hovold To: 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 Subject: Re: [PATCH] driver: usb: nullify dangling pointer in cdc_ncm_free Message-ID: References: <20220409120901.267526-1-dzm91@hust.edu.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 Wed, Apr 20, 2022 at 11:45:49AM +0200, Oliver Neukum wrote: > >> - if (dev->driver_info->unbind) > >> - dev->driver_info->unbind(dev, intf); > >> + if (dev->driver_info->disable) > >> + dev->driver_info->disable(dev, intf); > >> > >> net = dev->net; > >> unregister_netdev (net); > >> @@ -1651,6 +1651,9 @@ void usbnet_disconnect (struct usb_interface *intf) > >> > >> usb_scuttle_anchored_urbs(&dev->deferred); > >> > >> + 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? You could, but it would seem you have bigger problems if something can submit the URB after having deregistered the netdev. Looks like the URB should already have been stopped by usbnet_status_stop() so that the usb_kill_urb() above is (or should be) a noop. Johan