From patchwork Fri Nov 10 17:35:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gustavo A. R. Silva" X-Patchwork-Id: 10053525 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7749860631 for ; Fri, 10 Nov 2017 17:59:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 631DB2AB8A for ; Fri, 10 Nov 2017 17:59:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 553542ABFD; Fri, 10 Nov 2017 17:59:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.7 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_NUMERIC_HELO autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AF6952AB8A for ; Fri, 10 Nov 2017 17:59:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753474AbdKJR7b (ORCPT ); Fri, 10 Nov 2017 12:59:31 -0500 Received: from gateway20.websitewelcome.com ([192.185.65.13]:28678 "EHLO gateway20.websitewelcome.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753114AbdKJR7a (ORCPT ); Fri, 10 Nov 2017 12:59:30 -0500 X-Greylist: delayed 1399 seconds by postgrey-1.27 at vger.kernel.org; Fri, 10 Nov 2017 12:59:30 EST Received: from cm14.websitewelcome.com (cm14.websitewelcome.com [100.42.49.7]) by gateway20.websitewelcome.com (Postfix) with ESMTP id 83CAD40105F78 for ; Fri, 10 Nov 2017 11:35:53 -0600 (CST) Received: from gator4166.hostgator.com ([108.167.133.22]) by cmsmtp with SMTP id DDDde7nrJHEImDDDdeCHS2; Fri, 10 Nov 2017 11:35:53 -0600 Received: from gator4166.hostgator.com ([108.167.133.22]:54147) by gator4166.hostgator.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.87) (envelope-from ) id 1eDDDc-001QO4-RK; Fri, 10 Nov 2017 11:35:52 -0600 Received: from 189.175.248.21 ([189.175.248.21]) by gator4166.hostgator.com (Horde Framework) with HTTPS; Fri, 10 Nov 2017 11:35:52 -0600 Date: Fri, 10 Nov 2017 11:35:52 -0600 Message-ID: <20171110113552.Horde.eGcnMRStkxzNDhQOqlhnkI5@gator4166.hostgator.com> From: "Gustavo A. R. Silva" To: Andrey Konovalov Cc: Mauro Carvalho Chehab , Hans Verkuil , Sean Young , linux-media@vger.kernel.org, Andi Shyti , LKML , Dmitry Vyukov , Kostya Serebryany , syzkaller Subject: Re: [PATCH] au0828: fix use-after-free at USB probing References: <20171110002134.GA32019@embeddedor.com> In-Reply-To: User-Agent: Horde Application Framework 5 MIME-Version: 1.0 Content-Disposition: inline X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator4166.hostgator.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - embeddedor.com X-BWhitelist: no X-Source-IP: 108.167.133.22 X-Source-L: Yes X-Exim-ID: 1eDDDc-001QO4-RK X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: gator4166.hostgator.com [108.167.133.22]:54147 X-Source-Auth: garsilva@embeddedor.com X-Email-Count: 6 X-Source-Cap: Z3V6aWRpbmU7Z3V6aWRpbmU7Z2F0b3I0MTY2Lmhvc3RnYXRvci5jb20= X-Local-Domain: yes Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Quoting Andrey Konovalov : > On Fri, Nov 10, 2017 at 1:21 AM, Gustavo A. R. Silva > wrote: >> Hi Andrey, >> >> Could you please try this patch? >> >> Thank you > > Hi Gustavo, > > With your patch I get a different crash. Not sure if it's another bug > or the same one manifesting differently. > That's the same one. It seems that the best solution is to remove the kfree after the mutex_unlock and let the device resources be freed in au0828_usb_disconnect. Please try the following patch instead. I appreciate your help. Thank you, Andrey. --- drivers/media/usb/au0828/au0828-core.c | 1 - 1 file changed, 1 deletion(-) } diff --git a/drivers/media/usb/au0828/au0828-core.c b/drivers/media/usb/au0828/au0828-core.c index cd363a2..257ae0d 100644 --- a/drivers/media/usb/au0828/au0828-core.c +++ b/drivers/media/usb/au0828/au0828-core.c @@ -629,7 +629,6 @@ static int au0828_usb_probe(struct usb_interface *interface, pr_err("%s() au0282_dev_register failed to register on V4L2\n", __func__); mutex_unlock(&dev->lock); - kfree(dev); goto done;