From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F2070C282CA for ; Sun, 27 Jan 2019 19:50:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C0DED20989 for ; Sun, 27 Jan 2019 19:50:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726920AbfA0Tt7 convert rfc822-to-8bit (ORCPT ); Sun, 27 Jan 2019 14:49:59 -0500 Received: from smtp-prod04.osg.ufl.edu ([128.227.74.220]:48526 "EHLO smtp.ufl.edu" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726840AbfA0Tt7 (ORCPT ); Sun, 27 Jan 2019 14:49:59 -0500 X-Greylist: delayed 4271 seconds by postgrey-1.27 at vger.kernel.org; Sun, 27 Jan 2019 14:49:58 EST X-UFL-GatorLink-Authenticated: authenticated as () with from 10.36.197.37 Received: from exmbxprd16.ad.ufl.edu ([10.36.197.37]) by smtp.ufl.edu (8.14.4/8.14.4/3.0.0) with ESMTP id x0RJnqvI025717 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); Sun, 27 Jan 2019 14:49:52 -0500 Received: from exmbxprd18.ad.ufl.edu (10.36.197.39) by exmbxprd16.ad.ufl.edu (10.36.197.37) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Sun, 27 Jan 2019 14:49:52 -0500 Received: from exmbxprd18.ad.ufl.edu ([fe80::890c:cba5:27b2:db27]) by exmbxprd18.ad.ufl.edu ([fe80::890c:cba5:27b2:db27%19]) with mapi id 15.00.1395.000; Sun, 27 Jan 2019 14:49:52 -0500 From: "Yavuz, Tuba" To: Greg KH CC: "netdev@vger.kernel.org" , "davem@davemloft.net" Subject: Re: Error in the hso driver Thread-Topic: Error in the hso driver Thread-Index: AQHUtm5pVVhb5FrhFEau5tLNmcMsFKXD1cCA//+wMaI= Date: Sun, 27 Jan 2019 19:49:52 +0000 Message-ID: <1548618592071.43193@ece.ufl.edu> References: <1548614320825.86428@ece.ufl.edu>,<20190127193503.GC25051@kroah.com> In-Reply-To: <20190127193503.GC25051@kroah.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.36.134.12] Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-01-27_13:,, signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1901270160 X-UFL-Spam-Level: * Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Here is a proposed patch: --- drivers/net/usb/hso.c.orig 2019-01-27 14:45:58.232683119 -0500 +++ drivers/net/usb/hso.c 2019-01-27 14:47:43.592683629 -0500 @@ -2377,7 +2377,7 @@ static void hso_free_net_device(struct h remove_net_device(hso_net->parent); - if (hso_net->net) + if (hso_net->net && hso_net->net->reg_state == NETREG_REGISTERED) unregister_netdev(hso_net->net); /* start freeing */ Tuba Yavuz, Ph.D. Assistant Professor Electrical and Computer Engineering Department University of Florida Gainesville, FL 32611 Webpage: http://www.tuba.ece.ufl.edu/ Email: tuba@ece.ufl.edu Phone: (352) 846 0202 ________________________________________ From: Greg KH Sent: Sunday, January 27, 2019 2:35 PM To: Yavuz, Tuba Cc: netdev@vger.kernel.org; davem@davemloft.net Subject: Re: Error in the hso driver On Sun, Jan 27, 2019 at 06:38:41PM +0000, Yavuz, Tuba wrote: > Hello, > > > On an error path inside the hso_create_net_device function of the hso driver (drivers/net/usb/hso), hso_free_net_device gets called. This causes a negative reference count in the net device if register_netdev has not been called yet as hso_free_net_device calls unregister_netdev regardless. I think the driver should distinguish these cases and call unregister_netdev only if register_netdev has been called. > > > Detected on v4.14-rc2 but I believe the problem still exists in the newer versions. Can you send a patch to solve this issue? That's the best way to handle it as you get the proper credit and we can understand exactly what you are trying to show here. thanks, greg k-h