Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751838AbcCZMu3 (ORCPT ); Sat, 26 Mar 2016 08:50:29 -0400 Received: from smtprelay0218.hostedemail.com ([216.40.44.218]:58553 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751806AbcCZMu1 (ORCPT ); Sat, 26 Mar 2016 08:50:27 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::::::::::,RULES_HIT:41:355:379:541:599:966:973:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2196:2199:2393:2559:2562:2828:3138:3139:3140:3141:3142:3352:3622:3865:3866:3867:3868:3870:3871:4250:4321:4385:5007:6120:7875:10004:10400:10848:11026:11232:11658:11783:11914:12043:12048:12296:12438:12517:12519:12740:13069:13161:13229:13311:13357:13439:13894:14659:14721:21080:30054:30064:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:1,LUA_SUMMARY:none X-HE-Tag: ship01_5acd430c97802 X-Filterd-Recvd-Size: 2226 Message-ID: <1458996622.23450.4.camel@perches.com> Subject: Re: [RFC PATCH 1/4] media: Add Media Device Allocator API From: Joe Perches To: Shuah Khan , laurent.pinchart@ideasonboard.com, mchehab@osg.samsung.com, perex@perex.cz, tiwai@suse.com, hans.verkuil@cisco.com, chehabrafael@gmail.com, javier@osg.samsung.com, jh1009.sung@samsung.com Cc: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, alsa-devel@alsa-project.org Date: Sat, 26 Mar 2016 05:50:22 -0700 In-Reply-To: <41d017ef76e3206780c018399ec60b63d865f65c.1458966594.git.shuahkh@osg.samsung.com> References: <41d017ef76e3206780c018399ec60b63d865f65c.1458966594.git.shuahkh@osg.samsung.com> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.18.5.2-0ubuntu1 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1056 Lines: 30 On Fri, 2016-03-25 at 22:38 -0600, Shuah Khan wrote: > Add Media Device Allocator API to manage Media Device life time problems. > There are known problems with media device life time management. When media > device is released while an media ioctl is in progress, ioctls fail with > use-after-free errors and kernel hangs in some cases. Seems reasonable, thanks. trivial: > diff --git a/drivers/media/media-dev-allocator.c b/drivers/media/media-dev-allocator.c [] > +static struct media_device *__media_device_get(struct device *dev, > + ???????bool alloc, bool kref) > +{ [] > + pr_info("%s: mdev=%p\n", __func__, &mdi->mdev); All of the pr_info uses here seem like debugging and should likely be pr_debug instead. > +struct media_device *media_device_find(struct device *dev) > +{ > + pr_info("%s\n", __func__); These seem like function tracing and maybe could/should use ftrace instead. +/* don't allocate - increment kref if one is found */ > +struct media_device *media_device_get_ref(struct device *dev) > +{ > + pr_info("%s\n", __func__);