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


Groups > linux.kernel > #1531864

[PATCH 1/2] media: au0828 fix to protect enable/disable source set and clear

From Shuah Khan <shuahkh@osg.samsung.com>
Newsgroups linux.kernel
Subject [PATCH 1/2] media: au0828 fix to protect enable/disable source set and clear
Date 2016-11-29 03:20 +0100
Message-ID <sIGbv-1YA-13@gated-at.bofh.it> (permalink)
References <sIGbv-1YA-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Protect enable/disable source set and clear to avoid races with callers.
There is a possibility clear could occur while dvb-core and v4l2 try to
access these handlers.

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
---
 drivers/media/usb/au0828/au0828-core.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/media/usb/au0828/au0828-core.c b/drivers/media/usb/au0828/au0828-core.c
index bf53553..a1f696a 100644
--- a/drivers/media/usb/au0828/au0828-core.c
+++ b/drivers/media/usb/au0828/au0828-core.c
@@ -153,9 +153,11 @@ static void au0828_unregister_media_device(struct au0828_dev *dev)
 	}
 
 	/* clear enable_source, disable_source */
+	mutex_lock(&mdev->graph_mutex);
 	dev->media_dev->source_priv = NULL;
 	dev->media_dev->enable_source = NULL;
 	dev->media_dev->disable_source = NULL;
+	mutex_unlock(&mdev->graph_mutex);
 
 	media_device_unregister(dev->media_dev);
 	media_device_cleanup(dev->media_dev);
@@ -549,9 +551,11 @@ static int au0828_media_device_register(struct au0828_dev *dev,
 		return ret;
 	}
 	/* set enable_source */
+	mutex_lock(&dev->media_dev->graph_mutex);
 	dev->media_dev->source_priv = (void *) dev;
 	dev->media_dev->enable_source = au0828_enable_source;
 	dev->media_dev->disable_source = au0828_disable_source;
+	mutex_unlock(&dev->media_dev->graph_mutex);
 #endif
 	return 0;
 }
-- 
2.7.4

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


Thread

[PATCH 0/2] media protect enable and disable source handler paths Shuah Khan <shuahkh@osg.samsung.com> - 2016-11-29 03:20 +0100
  [PATCH 2/2] media: protect enable and disable source handler checks and calls Shuah Khan <shuahkh@osg.samsung.com> - 2016-11-29 03:20 +0100
    Re: [PATCH 2/2] media: protect enable and disable source handler  checks and calls Sakari Ailus <sakari.ailus@iki.fi> - 2016-11-29 10:30 +0100
      Re: [PATCH 2/2] media: protect enable and disable source handler  checks and calls Shuah Khan <shuahkh@osg.samsung.com> - 2016-11-29 18:50 +0100
        Re: [PATCH 2/2] media: protect enable and disable source handler  checks and calls Sakari Ailus <sakari.ailus@iki.fi> - 2016-12-01 15:00 +0100
          Re: [PATCH 2/2] media: protect enable and disable source handler  checks and calls Shuah Khan <shuahkh@osg.samsung.com> - 2016-12-01 18:00 +0100
  [PATCH 1/2] media: au0828 fix to protect enable/disable source set and clear Shuah Khan <shuahkh@osg.samsung.com> - 2016-11-29 03:20 +0100
  Re: [PATCH 0/2] media protect enable and disable source handler  paths Mauro Carvalho Chehab <mchehab@s-opensource.com> - 2016-11-29 10:20 +0100
    Re: [PATCH 0/2] media protect enable and disable source handler paths Shuah Khan <shuahkh@osg.samsung.com> - 2016-11-29 18:10 +0100
      Re: [PATCH 0/2] media protect enable and disable source handler  paths Mauro Carvalho Chehab <mchehab@s-opensource.com> - 2016-11-29 18:20 +0100

csiph-web