Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1365505

Re: [RFC PATCH 1/4] media: Add Media Device Allocator API

From Shuah Khan <shuahkh@osg.samsung.com>
Newsgroups linux.kernel
Subject Re: [RFC PATCH 1/4] media: Add Media Device Allocator API
Date 2016-03-28 15:50 +0200
Message-ID <rhFIm-7PN-19@gated-at.bofh.it> (permalink)
References <rgOb0-3UY-7@gated-at.bofh.it> <rgOb0-3UY-11@gated-at.bofh.it> <rgVYR-We-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 03/26/2016 06:50 AM, Joe Perches wrote:
> 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.

Correct. These are for debug and I plan to either remove them completely
or make them pr_debug().

>> +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__);
> 

Same here. This is also debug. However, you gave me an idea, this could be a
tracevent, if I find it useful for event tracing. It might be useful to be able
to track kref holds on this.

thanks,
-- Shuah

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC PATCH 1/4] media: Add Media Device Allocator API Shuah Khan <shuahkh@osg.samsung.com> - 2016-03-26 05:40 +0100
  Re: [RFC PATCH 1/4] media: Add Media Device Allocator API Joe Perches <joe@perches.com> - 2016-03-26 14:00 +0100
    Re: [RFC PATCH 1/4] media: Add Media Device Allocator API Shuah Khan <shuahkh@osg.samsung.com> - 2016-03-28 15:50 +0200
  Re: [RFC PATCH 1/4] media: Add Media Device Allocator API Mauro Carvalho Chehab <mchehab@osg.samsung.com> - 2016-03-28 20:30 +0200
    Re: [RFC PATCH 1/4] media: Add Media Device Allocator API Shuah Khan <shuahkh@osg.samsung.com> - 2016-03-28 23:40 +0200

csiph-web