[PATCH] media: au0828 fix to clear enable/disable/change source handlers

2016-03-12 Thread Shuah Khan
-off-by: Shuah Khan <shua...@osg.samsung.com> --- drivers/media/usb/au0828/au0828-core.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/media/usb/au0828/au0828-core.c b/drivers/media/usb/au0828/au0828-core.c index de9ab11..abdb956 100644 --- a/drivers/media/usb/au0828/

Re: [PATCH] media: fix media_device_unregister() to destroy media device device resource

2016-03-19 Thread Shuah Khan
On 03/18/2016 03:52 AM, Mauro Carvalho Chehab wrote: > Em Thu, 17 Mar 2016 16:46:36 -0600 > Shuah Khan <shua...@osg.samsung.com> escreveu: > >> When all drivers except usb-core driver is unbound, destroy the media device >> resource. Other wise, media device resourc

Re: [PATCH] sound/usb: Fix memory leak in media_snd_stream_delete() during unbind

2016-03-19 Thread Shuah Khan
Adding Takashi Iwai On 03/16/2016 08:58 PM, Shuah Khan wrote: > media_snd_stream_delete() fails to release resources during unbind. This > leads to use-after-free in media_gobj_create() on a subsequent bind. > > [ 1445.086410] BUG: KASAN: use-after-free in media_gobj_create+0x3a1/0x4

[PATCH] sound/usb: Fix memory leak in media_snd_stream_delete() during unbind

2016-03-19 Thread Shuah Khan
] [] ? __slab_alloc+0x50/0x70 [ 1445.086878] [] ? media_snd_mixer_init+0x16c/0x500 [snd_usb_audio] [ 1445.086884] [] ? kasan_unpoison_shadow+0x36/0x50 [ 1445.086890] [] ? kasan_unpoison_shadow+0x36/0x50 [ 1445.086895] [] ? kasan_kmalloc+0x5e/0x70 Signed-off-by: Shuah Khan <shua...@osg.samsung.

[PATCH] sound/usb: fix to release stream resources from media_snd_device_delete()

2016-03-18 Thread Shuah Khan
Fix to release stream resources from media_snd_device_delete() before media device is unregistered. Without this change, stream resource free is attempted after the media device is unregistered which would result in use-after-free errors. Signed-off-by: Shuah Khan <shua...@osg.samsung.

Re: [PATCH v2] [media] media-device: use kref for media_device instance

2016-03-18 Thread Shuah Khan
; Looks good. Tested it doing bind/unbind, rmmod/modprobe on both au0828 and snd-usb-audio drivers. Also generated graphs when after bind/unbind, rmmod/modprobe. Graphs look good. Tested-by: Shuah Khan <shua...@osg.samsung.com> thanks, -- Shuah > --- > > v2: The kref is now used

Re: [PATCH 1/2] [media] au0828: disable tuner links and cache tuner/decoder

2016-03-11 Thread Shuah Khan
On 03/11/2016 09:52 AM, Shuah Khan wrote: > On 03/11/2016 09:34 AM, Mauro Carvalho Chehab wrote: >> Em Fri, 11 Mar 2016 09:27:40 -0700 >> Shuah Khan <shua...@osg.samsung.com> escreveu: >> >>> On 03/11/2016 08:55 AM, Mauro Carvalho Chehab wrote: >>>&g

Re: [PATCH 1/2] [media] au0828: disable tuner links and cache tuner/decoder

2016-03-11 Thread Shuah Khan
On 03/11/2016 09:34 AM, Mauro Carvalho Chehab wrote: > Em Fri, 11 Mar 2016 09:27:40 -0700 > Shuah Khan <shua...@osg.samsung.com> escreveu: > >> On 03/11/2016 08:55 AM, Mauro Carvalho Chehab wrote: >>> For au0828_enable_source() to work, the tuner links should be >

[PATCH] media: au0828 disable tuner to demod link in au0828_media_device_register()

2016-03-09 Thread Shuah Khan
Disable tuner to demod link in au0828_media_device_register(). This step should be done after dvb graph is created. Signed-off-by: Shuah Khan <shua...@osg.samsung.com> --- drivers/media/usb/au0828/au0828-core.c | 26 ++ drivers/media/usb/au0828/au0828-video.

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

2016-03-28 Thread Shuah Khan
On 03/28/2016 12:28 PM, Mauro Carvalho Chehab wrote: > Hi Shuah, > > I reviewed the entire patch series, but I'm adding the comments only here, > as the other patches are coherent with this one. That is fine. > > Em Fri, 25 Mar 2016 22:38:42 -0600 > Shuah Khan <

Re: [RFC PATCH 3/4] media: Add refcount to keep track of media device registrations

2016-03-28 Thread Shuah Khan
On 03/28/2016 12:28 PM, Mauro Carvalho Chehab wrote: > Em Fri, 25 Mar 2016 22:38:44 -0600 > Shuah Khan <shua...@osg.samsung.com> escreveu: > >> Add refcount to keep track of media device registrations to avoid release >> of media device when one of the drivers does u

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

2016-03-28 Thread Shuah Khan
On 03/28/2016 12:28 PM, Mauro Carvalho Chehab wrote: > Em Fri, 25 Mar 2016 22:38:43 -0600 > Shuah Khan <shua...@osg.samsung.com> escreveu: > >> Add Media Device Allocator API documentation. > > Please merge this with the previous patch. Yes. I will merge them. -

Re: [RFC PATCH v2 0/5] Media Device Allocator API

2016-04-05 Thread Shuah Khan
On 04/05/2016 12:10 AM, Takashi Iwai wrote: > On Tue, 05 Apr 2016 05:35:55 +0200, > Shuah Khan wrote: >> >> 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 >> us

[PATCH] media: remove Managed Media Interfaces

2016-04-11 Thread Shuah Khan
Remove Managed Media Interfaces: media_device_get_devres() media_device_find_devres() Using these interfaces leads to use-after-free race conditions on the shared media device during media device unregister by drivers using it. Signed-off-by: Shuah Khan <shua...@osg.samsung.com> --- d

Re: [PATCH] sound/usb: fix to release stream resources from media_snd_device_delete()

2016-03-19 Thread Shuah Khan
On 03/19/2016 04:39 AM, Mauro Carvalho Chehab wrote: > Em Fri, 18 Mar 2016 23:57:08 -0300 > Mauro Carvalho Chehab <mche...@osg.samsung.com> escreveu: > >> Em Fri, 18 Mar 2016 20:50:31 -0600 >> Shuah Khan <shua...@osg.samsung.com> escreveu: >> &

Re: [PATCH] sound/usb: fix to release stream resources from media_snd_device_delete()

2016-03-19 Thread Shuah Khan
On 03/19/2016 06:10 AM, Mauro Carvalho Chehab wrote: > Em Fri, 18 Mar 2016 20:50:31 -0600 > Shuah Khan <shua...@osg.samsung.com> escreveu: > >> Fix to release stream resources from media_snd_device_delete() before >> media device is unregistered. Without this c

[PATCH] media: fix media_device_unregister() to destroy media device device resource

2016-03-19 Thread Shuah Khan
is released in media_device_unregister(). Signed-off-by: Shuah Khan <shua...@osg.samsung.com> --- drivers/media/media-device.c | 28 ++-- 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/drivers/media/media-device.c b/drivers/media/media-device.c index 0

Re: [PATCH] [media] media: rename media unregister function

2016-03-19 Thread Shuah Khan
unregister() would imply that there has to be some cleanup releasing resources. I wouldn't make this change. thanks, -- Shuah -- Shuah Khan Sr. Linux Kernel Developer Open Source Innovation Group Samsung Research America (Silicon Valley) shua...@osg.samsung.com | (970) 217-8978 -- To unsubscr

Re: [PATCH] [media] media: rename media unregister function

2016-03-20 Thread Shuah Khan
On 03/18/2016 08:12 AM, Javier Martinez Canillas wrote: > Hello Shuah, > > On 03/18/2016 11:01 AM, Shuah Khan wrote: >> On 03/18/2016 07:05 AM, Mauro Carvalho Chehab wrote: >>> Now that media_device_unregister() also does a cleanup, rename it >>> t

Re: [PATCH] sound/usb: fix to release stream resources from media_snd_device_delete()

2016-03-21 Thread Shuah Khan
On 03/19/2016 07:31 AM, Shuah Khan wrote: > On 03/19/2016 06:10 AM, Mauro Carvalho Chehab wrote: >> Em Fri, 18 Mar 2016 20:50:31 -0600 >> Shuah Khan <shua...@osg.samsung.com> escreveu: >> >>> Fix to release stream resources from media_snd_device_delete() bef

[PATCH] media: au0828 fix au0828_v4l2_close() dev_state race condition

2016-03-21 Thread Shuah Khan
/0x170 [ 260.993681] [] syscall_return_slowpath+0x16a/0x1a0 [ 260.993754] [] entry_SYSCALL_64_fastpath+0xa6/0xa8 Signed-off-by: Shuah Khan <shua...@osg.samsung.com> --- drivers/media/usb/au0828/au0828-video.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/med

Re: [PATCH] sound/usb: fix to release stream resources from media_snd_device_delete()

2016-03-22 Thread Shuah Khan
On 03/21/2016 10:01 PM, Shuah Khan wrote: > On 03/19/2016 07:31 AM, Shuah Khan wrote: >> On 03/19/2016 06:10 AM, Mauro Carvalho Chehab wrote: >>> Em Fri, 18 Mar 2016 20:50:31 -0600 >>> Shuah Khan <shua...@osg.samsung.com> escreveu: >>>

Re: [PATCH] media: au0828 fix au0828_v4l2_close() dev_state race condition

2016-03-22 Thread Shuah Khan
On 03/21/2016 10:04 PM, Shuah Khan wrote: > au0828_v4l2_close() check for dev_state == DEV_DISCONNECTED will fail to > detect the device disconnected state correctly, if au0828_v4l2_open() runs > to set the DEV_INITIALIZED bit. A loop test of bind/unbind found this bug > b

Re: [PATCH] sound/usb: fix to release stream resources from media_snd_device_delete()

2016-03-22 Thread Shuah Khan
On 03/22/2016 07:03 AM, Shuah Khan wrote: > On 03/21/2016 10:01 PM, Shuah Khan wrote: >> On 03/19/2016 07:31 AM, Shuah Khan wrote: >>> On 03/19/2016 06:10 AM, Mauro Carvalho Chehab wrote: >>>> Em Fri, 18 Mar 2016 20:50:31 -0600 >>>> Shuah Khan <shua

Re: [PATCH 3/5] [media] au0828: Unregister notifiers

2016-03-22 Thread Shuah Khan
't see any lock warnings on a KASAN enabled kernel (lock testing enabled). No use-after-free errors during these runs. Ran device removal test and rmmod and modprobe tests on both drivers. Generated graph after the runs and the graph looks good. Reviewed-by: Shuah Khan <shua...@osg.samsung.com

Re: [PATCH 4/5] [media] media-device: use kref for media_device instance

2016-03-22 Thread Shuah Khan
Generated graph after the runs and the graph looks good. Reviewed-by: Shuah Khan <shua...@osg.samsung.com> Tested-by: Shuah Khan <shua...@osg.samsung.com> thanks, -- Shuah > --- > drivers/media/media-device.c | 48 > +++- > include/med

Re: [PATCH] [media] au0828: Fix dev_state handling

2016-03-22 Thread Shuah Khan
ar/test with the > bitops. > > Cc: sta...@vger.kernel.org > Signed-off-by: Mauro Carvalho Chehab <mche...@osg.samsung.com> > --- > Shuah, > > Please test. Looks good. Tested running bind/unbind au0828 loop for 1000 times. Didn't see any problems and the v4l2_qu

Re: [PATCH 4/5] [media] media-device: use kref for media_device instance

2016-03-22 Thread Shuah Khan
On 03/22/2016 01:56 PM, Shuah Khan wrote: > On 03/16/2016 06:04 AM, Mauro Carvalho Chehab wrote: >> Now that the media_device can be used by multiple drivers, >> via devres, we need to be sure that it will be dropped only >> when all drivers stop using it. >> >&

Re: [PATCH 1/5] [media] media-device: get rid of the spinlock

2016-03-22 Thread Shuah Khan
any lock warnings on a KASAN enabled kernel (lock testing enabled). No use-after-free errors during these runs. Ran device removal test and rmmod and modprobe tests on both drivers. Generated graph after the runs and the graph looks good. Reviewed-by: Shuah Khan <shua...@osg.s

Re: [PATCH 5/5] [media] media-device: make media_device_cleanup() static

2016-03-22 Thread Shuah Khan
d. For the au0828 and snd_usb_audio change: Reviewed-by: Shuah Khan <shua...@osg.samsung.com> Tested-by: Shuah Khan <shua...@osg.samsung.com> thanks, -- Shuah > --- > drivers/media/common/siano/smsdvb-main.c | 1 - > drivers/media/media-device.c | 13

Re: [PATCH v2] [media] media-device: use kref for media_device instance

2016-03-22 Thread Shuah Khan
uns and the graph looks good. Reviewed-by: Shuah Khan <shua...@osg.samsung.com> Tested-by: Shuah Khan <shua...@osg.samsung.com> thanks, -- Shuah > > drivers/media/media-device.c | 117 > + > drivers/media/usb/au0828/au0828-

Re: [PATCH v2] [media] media-device: use kref for media_device instance

2016-03-21 Thread Shuah Khan
o Chehab wrote: >>> Now that the media_device can be used by multiple drivers, >>> via devres, we need to be sure that it will be dropped only >>> when all drivers stop using it. >> >> I've discussed this with Shuah previously and I'm surprised to see

Re: [PATCH v2] [media] media-device: use kref for media_device instance

2016-03-21 Thread Shuah Khan
be dropped only >> when all drivers stop using it. > > I've discussed this with Shuah previously and I'm surprised to see that the > problem hasn't been fixed : using devres for this purpose is just plain > wrong. > The empty media_device_release_devres() function should have given

Re: [PATCH 4/5] [media] media-device: use kref for media_device instance

2016-03-20 Thread Shuah Khan
On 03/16/2016 08:25 AM, Mauro Carvalho Chehab wrote: > Em Wed, 16 Mar 2016 08:05:15 -0600 > Shuah Khan <shua...@osg.samsung.com> escreveu: > >> On 03/16/2016 06:04 AM, Mauro Carvalho Chehab wrote: >>> Now that the media_device can be used by multiple drivers, >

[RFC PATCH 2/4] media: Add Media Device Allocator API documentation

2016-03-25 Thread Shuah Khan
Add Media Device Allocator API documentation. Signed-off-by: Shuah Khan <shua...@osg.samsung.com> --- include/media/media-dev-allocator.h | 32 1 file changed, 32 insertions(+) diff --git a/include/media/media-dev-allocator.h b/include/media/med

[RFC PATCH 0/4] Media Device Allocator API

2016-03-25 Thread Shuah Khan
early review to see if this solution is viable. Shuah Khan (4): media: Add Media Device Allocator API media: Add Media Device Allocator API documentation media: Add refcount to keep track of media device registrations drivers: change au0828, uvcvideo, snd-usb-audio to use Media Device

[RFC PATCH 3/4] media: Add refcount to keep track of media device registrations

2016-03-25 Thread Shuah Khan
refcount. Change media_open() to get media device reference and put the reference in media_release(). Signed-off-by: Shuah Khan <shua...@osg.samsung.com> --- drivers/media/media-device.c | 53 +++ drivers/media/media-devnode.c | 3 +++ include/media

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

2016-03-25 Thread Shuah Khan
provides interfaces to allocate a refcounted media device from system wide global list and maintains the state until the last user of the media device releases it. Signed-off-by: Shuah Khan <shua...@osg.samsung.com> --- drivers/media/Makefile | 3 +- drivers/media/med

[RFC PATCH 4/4] drivers: change au0828, uvcvideo, snd-usb-audio to use Media Device Allocator

2016-03-25 Thread Shuah Khan
Change au0828, uvcvideo, snd-usb-audio to use Media Device Allocator and new Media Controller API media_device_unregister_put(). Signed-off-by: Shuah Khan <shua...@osg.samsung.com> --- drivers/media/usb/au0828/au0828-core.c | 7 +-- drivers/media/usb/au0828/au0828.h | 1 + d

[PATCH] media: fix null pointer dereference in v4l_vb2q_enable_media_source()

2016-03-03 Thread Shuah Khan
] [ 548.460792] PGD b820e067 PUD bb3df067 PMD 0 [ 548.465582] Oops: [#1] SMP Signed-off-by: Shuah Khan <shua...@osg.samsung.com> Reported-by: Olli Salonen <olli.salo...@iki.fi> --- drivers/media/v4l2-core/v4l2-mc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/driver

[PATCH] media: add prefixes to interface types

2016-03-03 Thread Shuah Khan
Add missing prefixes for DVB, V4L, and ALSA interface types. Signed-off-by: Shuah Khan <shua...@osg.samsung.com> --- drivers/media/media-entity.c | 32 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/drivers/media/media-entity.c b/drivers

Re: [PATCH v3 03/22] [media] Docbook: media-types.xml: Add Audio Function Entities

2016-03-03 Thread Shuah Khan
On 02/28/2016 07:46 PM, Laurent Pinchart wrote: > Hi Shuah, > > Thank you for the patch. > > On Thursday 11 February 2016 16:41:19 Shuah Khan wrote: >> Add Audio Function Entities >> >> Signed-off-by: Shuah Khan <shua...@osg.samsung.com> >> --- >&g

[PATCH v2] media: add prefixes to interface types

2016-03-04 Thread Shuah Khan
Add missing prefixes for DVB, V4L, and ALSA interface types. Signed-off-by: Shuah Khan <shua...@osg.samsung.com> --- Changes since v1: Addresses Hans's comments on v1 drivers/media/media-entity.c | 34 +- 1 file changed, 17 insertions(+), 17 deletions(-)

Re: [PATCH] media: add prefixes to interface types

2016-03-04 Thread Shuah Khan
Hi Hans, Thanks for the review. Mauro, Do you prefer dvb-conditional-access or dvb-ca? thanks, -- Shuah On 03/04/2016 01:25 AM, Hans Verkuil wrote: > > > On 03/04/2016 01:08 AM, Shuah Khan wrote: >> Add missing prefixes for DVB, V4L, and ALSA interface types. >> >>

Re: [RFC] Representing hardware connections via MC

2016-03-02 Thread Shuah Khan
representing the logical connection for a composite > + signal. It corresponds to the logical input or output > + associated with the a single signal that carries both > + chrominance and luminance information (Y+C). > >

Re: [PATCH v5 22/22] sound/usb: Use Media Controller API to share media resources

2016-03-02 Thread Shuah Khan
On 03/02/2016 01:41 PM, Dan Carpenter wrote: > On Wed, Mar 02, 2016 at 09:50:31AM -0700, Shuah Khan wrote: >> +mctl = kzalloc(sizeof(*mctl), GFP_KERNEL); >> +if (!mctl) >> +return -ENOMEM; >> + >> +mctl->media_dev = mdev; >> +

[PATCH] media: au0828 audio mixer isn't connected to decoder

2016-03-02 Thread Shuah Khan
created prior to registering the notify handler. Signed-off-by: Shuah Khan <shua...@osg.samsung.com> Reported-by: Mauro Carvalho Chehab <mche...@osg.samsung.com> --- Tested by black listing au0828 to force snd_usb_audio to load first and then modprobe au0828. Generated graphs to verify

Re: [PATCH v3 02/22] uapi/media.h: Declare interface types for ALSA

2016-03-03 Thread Shuah Khan
On 03/03/2016 07:59 AM, Hans Verkuil wrote: > On 02/12/16 00:41, Shuah Khan wrote: >> Declare the interface types to be used on alsa for >> the new G_TOPOLOGY ioctl. >> >> Signed-off-by: Shuah Khan <shua...@osg.samsung.com> >> --- >> drivers/media/med

[PATCH] sound/usb: Use meaninful names for goto labels

2016-03-03 Thread Shuah Khan
Fix to use meaningful names instead of numbered goto labels Signed-off-by: Shuah Khan <shua...@osg.samsung.com> --- sound/usb/media.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/sound/usb/media.c b/sound/usb/media.c index b87d5b3..ab6a642

Re: [PATCH v5 22/22] sound/usb: Use Media Controller API to share media resources

2016-03-03 Thread Shuah Khan
On 03/03/2016 03:36 AM, Dan Carpenter wrote: > On Wed, Mar 02, 2016 at 03:57:03PM -0700, Shuah Khan wrote: >> On 03/02/2016 01:41 PM, Dan Carpenter wrote: >>> On Wed, Mar 02, 2016 at 09:50:31AM -0700, Shuah Khan wrote: >>>> + mctl = kzalloc(sizeof(*mctl),

Re: [PATCH v5 22/22] sound/usb: Use Media Controller API to share media resources

2016-03-03 Thread Shuah Khan
On 03/03/2016 11:21 AM, Mauro Carvalho Chehab wrote: > Em Wed, 2 Mar 2016 15:57:03 -0700 > Shuah Khan <shua...@osg.samsung.com> escreveu: > >> On 03/02/2016 01:41 PM, Dan Carpenter wrote: >>> On Wed, Mar 02, 2016 at 09:50:31AM -0700, Shuah Khan wrote: >&

Re: [PATCH v3 13/22] media: Change v4l-core to check if source is free

2016-03-03 Thread Shuah Khan
On 03/03/2016 01:39 PM, Olli Salonen wrote: > Hello Shuah, > > This patch seems to cause issues with my setup. Basically, when I try > to tune to a channel, I get an oops. I'm using TechnoTrend CT2-4650 > PCIe DVB-T tuner (cx23885). > > Here's the oops: > > [ 548.44

Re: [PATCH v3 13/22] media: Change v4l-core to check if source is free

2016-03-03 Thread Shuah Khan
On 03/03/2016 02:18 PM, Shuah Khan wrote: > On 03/03/2016 01:39 PM, Olli Salonen wrote: >> Hello Shuah, >> >> This patch seems to cause issues with my setup. Basically, when I try >> to tune to a channel, I get an oops. I'm using TechnoTrend CT2-4650 >> PCIe DV

Re: [PATCH v5 22/22] sound/usb: Use Media Controller API to share media resources

2016-03-07 Thread Shuah Khan
On 03/05/2016 03:00 AM, Mauro Carvalho Chehab wrote: > Em Wed, 2 Mar 2016 09:50:31 -0700 > Shuah Khan <shua...@osg.samsung.com> escreveu: > >> Change ALSA driver to use Media Controller API to >> share media resources with DVB and V4L2 drivers >> on a AU08

Re: [PATCH v5 22/22] sound/usb: Use Media Controller API to share media resources

2016-03-07 Thread Shuah Khan
On 03/07/2016 07:16 AM, Shuah Khan wrote: > On 03/05/2016 03:00 AM, Mauro Carvalho Chehab wrote: >> Em Wed, 2 Mar 2016 09:50:31 -0700 >> Shuah Khan <shua...@osg.samsung.com> escreveu: >> >>> Change ALSA driver to use Media Controller API to >>> sh

Re: [PATCH v5 22/22] sound/usb: Use Media Controller API to share media resources

2016-03-07 Thread Shuah Khan
On 03/05/2016 03:00 AM, Mauro Carvalho Chehab wrote: > Em Wed, 2 Mar 2016 09:50:31 -0700 > Shuah Khan <shua...@osg.samsung.com> escreveu: > >> Change ALSA driver to use Media Controller API to >> share media resources with DVB and V4L2 drivers >> on a AU08

Re: [PATCH v5 22/22] sound/usb: Use Media Controller API to share media resources

2016-03-07 Thread Shuah Khan
On 03/05/2016 03:00 AM, Mauro Carvalho Chehab wrote: > Em Wed, 2 Mar 2016 09:50:31 -0700 > Shuah Khan <shua...@osg.samsung.com> escreveu: > >> Change ALSA driver to use Media Controller API to >> share media resources with DVB and V4L2 drivers >> on a AU08

Re: [PATCH] [media] hide unused functions for !MEDIA_CONTROLLER

2016-03-04 Thread Shuah Khan
;graph_obj.mdev; > struct au0828_dev *dev; > @@ -453,8 +449,8 @@ static void au0828_disable_source(struct media_entity > *entity) > > end: > mutex_unlock(>graph_mutex); > -#endif > } > +#endif > > static int au0828_media_device_register(struct au0828_de

[RFC PATCH v2 2/5] media: Add driver count to keep track of media device registrations

2016-04-04 Thread Shuah Khan
register count. Change media_open() to get media device reference and put the reference in media_release(). Signed-off-by: Shuah Khan <shua...@osg.samsung.com> --- drivers/media/media-device.c | 49 ++- drivers/media/media-devnode.

[RFC PATCH v2 0/5] Media Device Allocator API

2016-04-04 Thread Shuah Khan
is removed and then ioctls fail when cdev_get() looks for the owning module as au0828 is very often the module that owns the media devnode. This is a cdev related issue that needs to be resolved and Media Device Allocator can't solve this one. Shuah Khan (5): media: Add Media Device

[RFC PATCH v2 1/5] media: Add Media Device Allocator API

2016-04-04 Thread Shuah Khan
provides interfaces to allocate a refcounted media device instance from system wide global list and maintains the state until the last user of the media device releases it. Signed-off-by: Shuah Khan <shua...@osg.samsung.com> --- drivers/media/Makefile | 3 +- drivers/media/med

[RFC PATCH v2 3/5] media: uvcvideo change to use Media Device Allocator API

2016-04-04 Thread Shuah Khan
Change uvcvideo to use Media Device Allocator API and new Media Controller media_device_unregister_put() interface. Signed-off-by: Shuah Khan <shua...@osg.samsung.com> --- drivers/media/usb/uvc/uvc_driver.c | 36 ++-- drivers/media/usb/uvc/uvcvideo.h | 3

[RFC PATCH v2 5/5] sound/usb: Use Media Controller API to share media resources

2016-04-04 Thread Shuah Khan
snd_usb_hw_free(). If resource is busy, -EBUSY is returned. Media Controller API specific cleanup is done in usb_audio_disconnect(). Signed-off-by: Shuah Khan <shua...@osg.samsung.com> --- Changes since the revert: - Consolidated fixes to regressions in this patch. - Tested on a USB Audio device in ad

[RFC PATCH v2 4/5] media: au0828 change to use Media Device Allocator API

2016-04-04 Thread Shuah Khan
Change au0828 to use Media Device Allocator API and new Media Controller media_device_unregister_put() interface. Fix to unregister entity_notify hook. Signed-off-by: Shuah Khan <shua...@osg.samsung.com> --- drivers/media/usb/au0828/au0828-core.c | 40 -- d

Linux 4.6-rc1 Fix for regression introduced in [media] au0828: use v4l2_mc_create_media_graph()

2016-03-31 Thread Shuah Khan
://patchwork.linuxtv.org/patch/33441/ Please include the above fix in your pull request for rc2 thanks, -- Shuah -- Shuah Khan Sr. Linux Kernel Developer Open Source Innovation Group Samsung Research America (Silicon Valley) shua...@osg.samsung.com -- To unsubscribe from this list: send the line

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

2016-03-28 Thread Shuah Khan
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

Re: Can't use USB sound card on 4.6-rc1, works fine on 4.5.0

2016-03-29 Thread Shuah Khan
l/2016/3/15/238 thanks, -- Shuah > > When I attach USB sound card to USB hub following output appears in dmesg > output: > > [ 83.074063] usb 3-6: new high-speed USB device number 10 using xhci_hcd > [ 83.239600] usb 3-6: New USB device found, idVendor=041e, idProduct=322c

Re: [PATCH v2 1/2] [media] media-device: Fix mutex handling code for ioctl

2016-03-29 Thread Shuah Khan
ri Ailus <sakari.ai...@linux.intel.com> > Please add my Ran bind/unbind loop test on both au0828 and snd_usb_audio. On au08282, ran into the media device lifetime related use-after-free which is a known issue present in older releases. I did include the following bug fix for my testing:

au0828_v4l2_device_register()

2016-03-28 Thread Shuah Khan
2_dev.ctrl_handler = >v4l2_ctrl_hdl; thanks, -- Shuah -- Shuah Khan Sr. Linux Kernel Developer Open Source Innovation Group Samsung Research America (Silicon Valley) shua...@osg.samsung.com -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a mes

Re: [PATCH] [media] au0828: fix double free in au0828_usb_probe()

2016-04-25 Thread Shuah Khan
device_register(). > > Found by Linux Driver Verification project (linuxtesting.org). > > Signed-off-by: Alexey Khoroshilov <khoroshi...@ispras.ru> I sent a fix in for this a few weeks ago: https://lkml.org/lkml/2016/3/28/453 thanks, -- Shuah > --- > drivers/media/usb/au0828/au082

[PATCH] media: fix media_open() to not release lock too soon

2016-04-20 Thread Shuah Khan
media_open() releases media_devnode_lock before open is complete. Hold the lock to call mdev->fops->open and release at the end. Signed-off-by: Shuah Khan <shua...@osg.samsung.com> --- drivers/media/media-devnode.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-)

Re: [PATCH 4/4] [meida] media-device: dynamically allocate struct media_devnode

2016-04-28 Thread Shuah Khan
On 04/28/2016 05:41 AM, Mauro Carvalho Chehab wrote: > Em Wed, 27 Apr 2016 16:20:56 -0600 > Shuah Khan <shuah...@samsung.com> escreveu: > >> On 03/24/2016 05:37 AM, Mauro Carvalho Chehab wrote: >>> Em Thu, 24 Mar 2016 10:24:44 +0200 >>> Laurent Pinc

Re: [PATCH 4/4] [meida] media-device: dynamically allocate struct media_devnode

2016-04-27 Thread Shuah Khan
I can base my work on it. Lars gave a few comments on the patch I sent out in the code that makes devnode dynamic which are relevant to be folded into your patch. Added Lars to this thread. P.S: removed alsa folks and alsa list and added linux-media thanks, -- Shuah >> >> We have the e

Re: [PATCH] media: fix media_ioctl use-after-free when driver unbinds

2016-04-27 Thread Shuah Khan
On 04/27/2016 10:43 AM, Lars-Peter Clausen wrote: > Looks mostly good, a few comments. > > On 04/27/2016 05:08 AM, Shuah Khan wrote: > [...] >> @@ -428,7 +428,7 @@ static long media_device_ioctl(struct file *filp, >> unsigned int cmd, >>

[PATCH] media: fix media_ioctl use-after-free when driver unbinds

2016-04-26 Thread Shuah Khan
] [] ? __fget_light+0x139/0x200 [ 472.432358] [] SyS_ioctl+0x79/0x90 [ 472.432381] [] entry_SYSCALL_64_fastpath+0x18/0xa8 Signed-off-by: Shuah Khan <shua...@osg.samsung.com> --- drivers/media/media-device.c | 32 drivers/media/media-dev

Re: [PATCH] media: fix media_ioctl use-after-free when driver unbinds

2016-04-27 Thread Shuah Khan
Hi Mauro, On 04/27/2016 03:55 AM, Mauro Carvalho Chehab wrote: > Hi Shuah, > > Good work! I have a few notes below. > > Em Tue, 26 Apr 2016 21:08:32 -0600 > Shuah Khan <shua...@osg.samsung.com> escreveu: > >> When driver unbind is run while media_ioctl is in

Re: [PATCH] media: fix media_ioctl use-after-free when driver unbinds

2016-04-29 Thread Shuah Khan
On 04/28/2016 01:19 AM, Lars-Peter Clausen wrote: > On 04/27/2016 11:56 PM, Shuah Khan wrote: >>>>dev_dbg(mdev->dev, "Media device unregistered\n"); >>>> } >>>> diff --git a/drivers/media/media-devnode.c b/drivers/media/media-devnode.c &

Re: [PATCH 4/4] [meida] media-device: dynamically allocate struct media_devnode

2016-04-28 Thread Shuah Khan
Hi Mauro, On 04/28/2016 09:04 AM, Mauro Carvalho Chehab wrote: > Em Thu, 28 Apr 2016 08:50:59 -0600 > Shuah Khan <shua...@osg.samsung.com> escreveu: > >> On 04/28/2016 05:41 AM, Mauro Carvalho Chehab wrote: >>> Em Wed, 27 Apr 2016 16:20:56 -0600 >>> Shu

[PATCH v2 1/2] media: Media Device Allocator API

2016-05-24 Thread Shuah Khan
the references are released. Signed-off-by: Shuah Khan <shua...@osg.samsung.com> --- drivers/media/Makefile | 3 +- drivers/media/media-dev-allocator.c | 120 include/media/media-dev-allocator.h | 85 + 3 files c

[PATCH v2 0/2] Media Device Allocator API

2016-05-24 Thread Shuah Khan
*_allocate(). - Dropped media_device_unregister_put(). au0828 calls media_device_delete() instead. Shuah Khan (2): media: Media Device Allocator API media: change au0828 to use Media Device Allocator API drivers/media/Makefile | 3 +- drivers/media/media-dev-allocator.c| 120

[PATCH v2 2/2] media: change au0828 to use Media Device Allocator API

2016-05-24 Thread Shuah Khan
Change au0828 to use Media Device Allocator API to allocate media device with the parent usb struct device as the key, so it can be shared with the snd usb audio driver. Signed-off-by: Shuah Khan <shua...@osg.samsung.com> --- drivers/media/usb/au0828/au0828-core.c | 12 d

Re: [PATCH 1/3] media: Media Device Allocator API

2016-05-24 Thread Shuah Khan
On 05/23/2016 05:26 AM, Hans Verkuil wrote: > Hi Shuah, > > Some comments below: Thanks for the review. > > On 05/13/2016 07:09 PM, Shuah Khan wrote: >> Media Device Allocator API to allows multiple drivers share a media device. >> Using this API, drivers

Re: [PATCH 2/3] media: add media_device_unregister_put() interface

2016-05-24 Thread Shuah Khan
On 05/23/2016 05:39 AM, Hans Verkuil wrote: > On 05/13/2016 07:09 PM, Shuah Khan wrote: >> Add media_device_unregister_put() interface to release reference to a media >> device allocated using the Media Device Allocator API. The media device is >> unregistered and freed

Re: [PATCH 2/2] [media] media-device: dynamically allocate struct media_devnode

2016-05-09 Thread Shuah Khan
kept separate instead of merged into struct media_device (I don't >> remember why though). >> >> There are two possible fixes for this problem: >> >> 1. Handling structure lifetime in drivers with propagation of the release >> callback from media device to drivers.

[PATCH 2/3] media: add media_device_unregister_put() interface

2016-05-13 Thread Shuah Khan
and freed in the kref put handler. Signed-off-by: Shuah Khan <shua...@osg.samsung.com> --- drivers/media/media-device.c | 11 +++ include/media/media-device.h | 15 +++ 2 files changed, 26 insertions(+) diff --git a/drivers/media/media-device.c b/drivers/media/media-de

[PATCH 3/3] media: change au0828 to use Media Device Allocator API

2016-05-13 Thread Shuah Khan
Change au0828 to use Media Device Allocator API to allocate media device with the parent usb struct device as the key, so it can be shared with the snd usb audio driver. Signed-off-by: Shuah Khan <shua...@osg.samsung.com> --- drivers/media/usb/au0828/au0828-core.c | 12 d

[PATCH 0/3] Media Device Allocator API

2016-05-13 Thread Shuah Khan
the references are released. This patch series has been tested with au0828 and snd-usb-audio drivers. snd-usb-audio patch isn't included in this series. Once this patch series is reviews and gets a stable state, I will send out the snd-usb-audio patch. Shuah Khan (3): media: Media Device

[PATCH 1/3] media: Media Device Allocator API

2016-05-13 Thread Shuah Khan
the references are released. Signed-off-by: Shuah Khan <shua...@osg.samsung.com> --- drivers/media/Makefile | 3 +- drivers/media/media-dev-allocator.c | 139 include/media/media-dev-allocator.h | 118 ++ 3

[PATCH] media: fix use-after-free in cdev_put() when app exits after driver unbind

2016-04-29 Thread Shuah Khan
: [ 193.601360] [] ? exit_to_usermode_loop+0xe7/0x170 kernel: [ 193.601368] [] exit_to_usermode_loop+0x120/0x170 kernel: [ 193.601376] [] syscall_return_slowpath+0x16a/0x1a0 kernel: [ 193.601386] [] entry_SYSCALL_64_fastpath+0xa6/0xa8 Signed-off-by: Shuah Khan <shua...@osg.samsung.

[PATCH v2] media: fix use-after-free in cdev_put() when app exits after driver unbind

2016-05-03 Thread Shuah Khan
] [] ? exit_to_usermode_loop+0xe7 kernel: [ 193.601368] [] exit_to_usermode_loop+0x120 kernel: [ 193.601376] [] syscall_return_slowpath+0x16a kernel: [ 193.601386] [] entry_SYSCALL_64_fastpath+0xa6 Signed-off-by: Shuah Khan <shua...@osg.samsung.com> --- Changes since v1: - Addressed

Re: [PATCH] media: fix use-after-free in cdev_put() when app exits after driver unbind

2016-05-03 Thread Shuah Khan
On 05/02/2016 04:16 AM, Lars-Peter Clausen wrote: > On 04/30/2016 12:37 AM, Shuah Khan wrote: > [...] >> diff --git a/include/media/media-devnode.h b/include/media/media-devnode.h >> index 5bb3b0e..ce9b051 100644 >> --- a/include/media/media-devnode.h >> +++ b

Re: [PATCH v2 4/5] media: Add flags to tell whether to take graph mutex for an IOCTL

2016-05-04 Thread Shuah Khan
rivers referencing graph_mutex directly? thanks, -- Shuah > > Signed-off-by: Sakari Ailus <sakari.ai...@linux.intel.com> > --- > drivers/media/media-device.c | 47 > ++-- > 1 file changed, 28 insertions(+), 19 deletions(-) > &

[PATCH v3] media: fix use-after-free in cdev_put() when app exits after driver unbind

2016-05-04 Thread Shuah Khan
] [] ? exit_to_usermode_loop+0xe7 kernel: [ 193.601368] [] exit_to_usermode_loop+0x120 kernel: [ 193.601376] [] syscall_return_slowpath+0x16a kernel: [ 193.601386] [] entry_SYSCALL_64_fastpath+0xa6 Signed-off-by: Shuah Khan <shua...@osg.samsung.com> --- Changes since v2: - Changed pr_info()s to pr_debug()s C

Re: [PATCH] media: saa7134 fix media_dev alloc error path to not free when alloc fails

2016-04-14 Thread Shuah Khan
On 04/14/2016 03:08 PM, Mauro Carvalho Chehab wrote: > Em Thu, 14 Apr 2016 10:31:20 -0600 > Shuah Khan <shua...@osg.samsung.com> escreveu: > >> media_dev alloc error path does kfree when alloc fails. Fix it to not call >> kfree when media_dev alloc fails. > > No

[PATCH] media: saa7134 fix media_dev alloc error path to not free when alloc fails

2016-04-14 Thread Shuah Khan
media_dev alloc error path does kfree when alloc fails. Fix it to not call kfree when media_dev alloc fails. Signed-off-by: Shuah Khan <shua...@osg.samsung.com> --- drivers/media/pci/saa7134/saa7134-core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/med

Re: [PATCH] media: s5p-mfc remove unnecessary error messages

2016-07-14 Thread Shuah Khan
On 07/14/2016 06:46 AM, Javier Martinez Canillas wrote: > Hello Shuah, > > On 07/12/2016 08:33 PM, Shuah Khan wrote: >> Removing unnecessary error messages as appropriate error code is returned. >> >> Signed-off-by: Shuah Khan <shua...@osg.samsung.com> >>

[PATCH v2] media: s5p-mfc remove unnecessary error messages

2016-07-14 Thread Shuah Khan
Removed unnecessary error message as appropriate error code is returned. Changed error message into a debug. Signed-off-by: Shuah Khan <shua...@osg.samsung.com> --- Changes since v1: - Changed EBUSY error message to a debug message. drivers/media/platform/s5p-mfc/s5p_mfc.c | 3 +--

[PATCH] media: s5p-jpeg add missing blank lines after declarations

2016-07-14 Thread Shuah Khan
Missing blank lines after declarations are making it hard to read the code. Fix them and also fix other checkpatch warnings at the same time. Signed-off-by: Shuah Khan <shua...@osg.samsung.com> --- drivers/media/platform/s5p-jpeg/jpeg-core.c | 13 ++--- 1 file changed, 10 inse

[PATCH] media: s5p-mfc remove unnecessary error messages

2016-07-12 Thread Shuah Khan
Removing unnecessary error messages as appropriate error code is returned. Signed-off-by: Shuah Khan <shua...@osg.samsung.com> --- drivers/media/platform/s5p-mfc/s5p_mfc.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platfo

Re: [PATCH] [media] vb2: map dmabuf for planes on driver queue instead of vidioc_qbuf

2016-07-15 Thread Shuah Khan
ications.? This changes the behavior and user applications now get dmabuf map error at a later stage in the call sequence. The change itself looks consistent with the change described. -- Shuah > > Best regards, > Javier > > drivers/media/v4l2-core/videobuf2-core.c | 88 >

<    1   2   3   4   5   6   7   >