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


Groups > linux.kernel > #1409624

[PATCH 4.4 42/86] mei: bus: call mei_cl_read_start under device lock

From Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Newsgroups linux.kernel
Subject [PATCH 4.4 42/86] mei: bus: call mei_cl_read_start under device lock
Date 2016-05-31 00:00 +0200
Message-ID <rEDo7-1yA-59@gated-at.bofh.it> (permalink)
References <rECs1-VP-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


4.4-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Alexander Usyskin <alexander.usyskin@intel.com>

commit bc46b45a421a64a0895dd41a34d3d2086e1ac7f6 upstream.

Ensure that mei_cl_read_start is called under the device lock
also in the bus layer. The function updates global ctrl_wr_list
which should be locked.

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/misc/mei/bus.c |   15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

--- a/drivers/misc/mei/bus.c
+++ b/drivers/misc/mei/bus.c
@@ -222,17 +222,23 @@ EXPORT_SYMBOL_GPL(mei_cldev_recv);
 static void mei_cl_bus_event_work(struct work_struct *work)
 {
 	struct mei_cl_device *cldev;
+	struct mei_device *bus;
 
 	cldev = container_of(work, struct mei_cl_device, event_work);
 
+	bus = cldev->bus;
+
 	if (cldev->event_cb)
 		cldev->event_cb(cldev, cldev->events, cldev->event_context);
 
 	cldev->events = 0;
 
 	/* Prepare for the next read */
-	if (cldev->events_mask & BIT(MEI_CL_EVENT_RX))
+	if (cldev->events_mask & BIT(MEI_CL_EVENT_RX)) {
+		mutex_lock(&bus->device_lock);
 		mei_cl_read_start(cldev->cl, 0, NULL);
+		mutex_unlock(&bus->device_lock);
+	}
 }
 
 /**
@@ -296,6 +302,7 @@ int mei_cldev_register_event_cb(struct m
 				unsigned long events_mask,
 				mei_cldev_event_cb_t event_cb, void *context)
 {
+	struct mei_device *bus = cldev->bus;
 	int ret;
 
 	if (cldev->event_cb)
@@ -308,15 +315,17 @@ int mei_cldev_register_event_cb(struct m
 	INIT_WORK(&cldev->event_work, mei_cl_bus_event_work);
 
 	if (cldev->events_mask & BIT(MEI_CL_EVENT_RX)) {
+		mutex_lock(&bus->device_lock);
 		ret = mei_cl_read_start(cldev->cl, 0, NULL);
+		mutex_unlock(&bus->device_lock);
 		if (ret && ret != -EBUSY)
 			return ret;
 	}
 
 	if (cldev->events_mask & BIT(MEI_CL_EVENT_NOTIF)) {
-		mutex_lock(&cldev->cl->dev->device_lock);
+		mutex_lock(&bus->device_lock);
 		ret = mei_cl_notify_request(cldev->cl, NULL, event_cb ? 1 : 0);
-		mutex_unlock(&cldev->cl->dev->device_lock);
+		mutex_unlock(&bus->device_lock);
 		if (ret)
 			return ret;
 	}

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


Thread

[PATCH 4.4 00/86] 4.4.12-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-30 23:00 +0200
  [PATCH 4.4 83/86] hpfs: implement the show_options method Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-30 23:00 +0200
  [PATCH 4.4 80/86] SIGNAL: Move generic copy_siginfo() to signal.h Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-30 23:00 +0200
  [PATCH 4.4 70/86] serial: samsung: Reorder the sequence of clock control when call s3c24xx_serial_set_termios() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-30 23:00 +0200
  [PATCH 4.4 63/86] tty: vt, return error when con_startup fails Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-30 23:00 +0200
  [PATCH 4.4 54/86] USB: leave LPM alone if possible when binding/unbinding interface drivers Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-30 23:00 +0200
  [PATCH 4.4 75/86] ALSA: hda - Fix headphone noise on Dell XPS 13 9360 Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-30 23:00 +0200
  [PATCH 4.4 73/86] mcb: Fixed bar number assignment for the gdd Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-30 23:00 +0200
  [PATCH 4.4 77/86] ALSA: hda - Fix headset mic detection problem for one Dell machine Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-30 23:00 +0200
  [PATCH 4.4 78/86] IB/srp: Fix a debug kernel crash Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-30 23:00 +0200
  [PATCH 4.4 01/86] Btrfs: dont use src fd for printk Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-30 23:10 +0200
  [PATCH 4.4 49/86] USB: serial: option: add more ZTE device ids Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-30 23:10 +0200
  [PATCH 4.4 86/86] kbuild: move -Wunused-const-variable to W=1 warning level Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-30 23:20 +0200
  [PATCH 4.4 55/86] usb: gadget: udc: core: Fix argument of dev_err() in usb_gadget_map_request() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-30 23:50 +0200
  [PATCH 4.4 02/86] perf/x86/intel/pt: Generate PMI in the STOP region as well Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-31 00:00 +0200
  [PATCH 4.4 47/86] USB: serial: io_edgeport: fix memory leaks in probe error path Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-31 00:00 +0200
  [PATCH 4.4 11/86] arm/arm64: KVM: Enforce Break-Before-Make on Stage-2 page tables Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-31 00:00 +0200
  [PATCH 4.4 43/86] USB: serial: mxuport: fix use-after-free in probe error path Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-31 00:00 +0200
  [PATCH 4.4 42/86] mei: bus: call mei_cl_read_start under device lock Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-31 00:00 +0200
  [PATCH 4.4 46/86] USB: serial: io_edgeport: fix memory leaks in attach error path Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-31 00:00 +0200
  [PATCH 4.4 51/86] usb: gadget: f_fs: Fix EFAULT generation for async read operations Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-31 00:00 +0200
  [PATCH 4.4 45/86] USB: serial: quatech2: fix use-after-free in probe error path Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-31 00:00 +0200
  [PATCH 4.4 41/86] mei: amthif: discard not read messages Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-31 00:00 +0200
  [PATCH 4.4 31/86] mmc: mmc: Fix partition switch timeout for some eMMCs Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-31 00:10 +0200
  [PATCH 4.4 15/86] fs/cifs: correctly to anonymous authentication for the LANMAN authentication Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-31 00:10 +0200
  [PATCH 4.4 29/86] irqchip/gic-v3: Configure all interrupts as non-secure Group-1 Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-31 00:10 +0200
  [PATCH 4.4 06/86] arm64: Fix typo in the pmdp_huge_get_and_clear() definition Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-31 00:10 +0200
  [PATCH 4.4 13/86] remove directory incorrectly tries to set delete on close on non-empty directories Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-31 00:10 +0200
  [PATCH 4.4 32/86] mmc: sdhci-acpi: Remove MMC_CAP_BUS_WIDTH_TEST for Intel controllers Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-31 00:10 +0200
  [PATCH 4.4 19/86] ring-buffer: Use long for nr_pages to avoid overflow failures Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-31 00:10 +0200
  [PATCH 4.4 03/86] perf/core: Fix perf_event_open() vs. execve() race Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-31 00:10 +0200
  [PATCH 4.4 20/86] ring-buffer: Prevent overflow of size in ring_buffer_resize() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-31 00:10 +0200
  [PATCH 4.4 28/86] irqchip/gic: Ensure ordering between read of INTACK and shared data Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-31 00:10 +0200
  [PATCH 4.4 05/86] ext4: iterate over buffer heads correctly in move_extent_per_page() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-31 00:10 +0200
  [PATCH 4.4 12/86] kvm: arm64: Fix EC field in inject_abt64 Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-31 00:10 +0200
  [PATCH 4.4 09/86] arm64: Implement pmdp_set_access_flags() for hardware AF/DBM Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-31 00:10 +0200
  [PATCH 4.4 07/86] arm64: Ensure pmd_present() returns false after pmd_mknotpresent() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-31 00:10 +0200
  [PATCH 4.4 36/86] mmc: sdhci-pci: Remove MMC_CAP_BUS_WIDTH_TEST for Intel controllers Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-31 00:10 +0200
  [PATCH 4.4 16/86] fs/cifs: correctly to anonymous authentication for the NTLM(v1) authentication Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-31 00:10 +0200
  [PATCH 4.4 33/86] ACPI / osi: Fix an issue that acpi_osi=!* cannot disable ACPICA internal strings Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-31 00:10 +0200
  [PATCH 4.4 18/86] asix: Fix offset calculation in asix_rx_fixup() causing slow transmissions Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-31 00:10 +0200
  [PATCH 4.4 23/86] crypto: sun4i-ss - Replace spinlock_bh by spin_lock_irq{save|restore} Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-31 00:10 +0200
  [PATCH 4.4 38/86] Bluetooth: vhci: purge unhandled skbs Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-31 00:10 +0200
  [PATCH 4.4 27/86] Input: pwm-beeper - fix - scheduling while atomic Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-31 00:10 +0200
  [PATCH 4.4 30/86] can: fix handling of unmodifiable configuration options Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-31 00:10 +0200
  [PATCH 4.4 17/86] fs/cifs: correctly to anonymous authentication for the NTLM(v2) authentication Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-31 00:10 +0200
  [PATCH 4.4 10/86] arm64: cpuinfo: Missing NULL terminator in compat_hwcap_str Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-31 00:10 +0200
  [PATCH 4.4 24/86] clk: qcom: msm8916: Fix crypto clock flags Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-31 00:10 +0200
  [PATCH 4.4 14/86] fs/cifs: correctly to anonymous authentication via NTLMSSP Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-31 00:10 +0200
  [PATCH 4.4 22/86] crypto: talitos - fix ahash algorithms registration Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-31 00:10 +0200
  [PATCH 4.4 08/86] arm64: Implement ptep_set_access_flags() for hardware AF/DBM Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-31 00:10 +0200
  [PATCH 4.4 26/86] mfd: omap-usb-tll: Fix scheduling while atomic BUG Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-05-31 00:10 +0200
  Re: [PATCH 4.4 00/86] 4.4.12-stable review Shuah Khan <shuahkh@osg.samsung.com> - 2016-06-01 16:30 +0200

csiph-web