From 51d5a191405765fdb1a83a62348dfbd78e118443 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 14 Jan 2013 13:13:54 -0800 Subject: [PATCH] 3.7-stable patches added patches: acpi-do-not-use-lid-and-sleep-button-for-s5-wakeup.patch epoll-prevent-missed-events-on-epoll_ctl_mod.patch hid-add-quirk-for-freescale-i.mx23-rom-recovery.patch regmap-debugfs-avoid-overflows-for-very-small-reads.patch --- ...e-lid-and-sleep-button-for-s5-wakeup.patch | 48 +++++++++++ ...event-missed-events-on-epoll_ctl_mod.patch | 84 +++++++++++++++++++ ...rk-for-freescale-i.mx23-rom-recovery.patch | 47 +++++++++++ ...avoid-overflows-for-very-small-reads.patch | 33 ++++++++ queue-3.7/series | 4 + 5 files changed, 216 insertions(+) create mode 100644 queue-3.7/acpi-do-not-use-lid-and-sleep-button-for-s5-wakeup.patch create mode 100644 queue-3.7/epoll-prevent-missed-events-on-epoll_ctl_mod.patch create mode 100644 queue-3.7/hid-add-quirk-for-freescale-i.mx23-rom-recovery.patch create mode 100644 queue-3.7/regmap-debugfs-avoid-overflows-for-very-small-reads.patch diff --git a/queue-3.7/acpi-do-not-use-lid-and-sleep-button-for-s5-wakeup.patch b/queue-3.7/acpi-do-not-use-lid-and-sleep-button-for-s5-wakeup.patch new file mode 100644 index 00000000000..3bab0e89f74 --- /dev/null +++ b/queue-3.7/acpi-do-not-use-lid-and-sleep-button-for-s5-wakeup.patch @@ -0,0 +1,48 @@ +From b7e383046c2c7c13ad928cd7407eafff758ddd4b Mon Sep 17 00:00:00 2001 +From: Zhang Rui +Date: Tue, 4 Dec 2012 23:23:16 +0100 +Subject: ACPI : do not use Lid and Sleep button for S5 wakeup + +From: Zhang Rui + +commit b7e383046c2c7c13ad928cd7407eafff758ddd4b upstream. + +When system enters power off, the _PSW of Lid device is enabled. +But this may cause the system to reboot instead of power off. + +A proper way to fix this is to always disable lid wakeup capability for S5. + +References: https://bugzilla.kernel.org/show_bug.cgi?id=35262 +Signed-off-by: Zhang Rui +Signed-off-by: Rafael J. Wysocki +Cc: Joseph Salisbury +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/acpi/scan.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +--- a/drivers/acpi/scan.c ++++ b/drivers/acpi/scan.c +@@ -859,8 +859,8 @@ acpi_bus_extract_wakeup_device_power_pac + static void acpi_bus_set_run_wake_flags(struct acpi_device *device) + { + struct acpi_device_id button_device_ids[] = { +- {"PNP0C0D", 0}, + {"PNP0C0C", 0}, ++ {"PNP0C0D", 0}, + {"PNP0C0E", 0}, + {"", 0}, + }; +@@ -872,6 +872,11 @@ static void acpi_bus_set_run_wake_flags( + /* Power button, Lid switch always enable wakeup */ + if (!acpi_match_device_ids(device, button_device_ids)) { + device->wakeup.flags.run_wake = 1; ++ if (!acpi_match_device_ids(device, &button_device_ids[1])) { ++ /* Do not use Lid/sleep button for S5 wakeup */ ++ if (device->wakeup.sleep_state == ACPI_STATE_S5) ++ device->wakeup.sleep_state = ACPI_STATE_S4; ++ } + device_set_wakeup_capable(&device->dev, true); + return; + } diff --git a/queue-3.7/epoll-prevent-missed-events-on-epoll_ctl_mod.patch b/queue-3.7/epoll-prevent-missed-events-on-epoll_ctl_mod.patch new file mode 100644 index 00000000000..9a61a36ffb1 --- /dev/null +++ b/queue-3.7/epoll-prevent-missed-events-on-epoll_ctl_mod.patch @@ -0,0 +1,84 @@ +From 128dd1759d96ad36c379240f8b9463e8acfd37a1 Mon Sep 17 00:00:00 2001 +From: Eric Wong +Date: Tue, 1 Jan 2013 21:20:27 +0000 +Subject: epoll: prevent missed events on EPOLL_CTL_MOD + +From: Eric Wong + +commit 128dd1759d96ad36c379240f8b9463e8acfd37a1 upstream. + +EPOLL_CTL_MOD sets the interest mask before calling f_op->poll() to +ensure events are not missed. Since the modifications to the interest +mask are not protected by the same lock as ep_poll_callback, we need to +ensure the change is visible to other CPUs calling ep_poll_callback. + +We also need to ensure f_op->poll() has an up-to-date view of past +events which occured before we modified the interest mask. So this +barrier also pairs with the barrier in wq_has_sleeper(). + +This should guarantee either ep_poll_callback or f_op->poll() (or both) +will notice the readiness of a recently-ready/modified item. + +This issue was encountered by Andreas Voellmy and Junchang(Jason) Wang in: +http://thread.gmane.org/gmane.linux.kernel/1408782/ + +Signed-off-by: Eric Wong +Cc: Hans Verkuil +Cc: Jiri Olsa +Cc: Jonathan Corbet +Cc: Al Viro +Cc: Davide Libenzi +Cc: Hans de Goede +Cc: Mauro Carvalho Chehab +Cc: David Miller +Cc: Eric Dumazet +Cc: Andrew Morton +Cc: Andreas Voellmy +Tested-by: "Junchang(Jason) Wang" +Cc: netdev@vger.kernel.org +Cc: linux-fsdevel@vger.kernel.org +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + fs/eventpoll.c | 22 +++++++++++++++++++++- + 1 file changed, 21 insertions(+), 1 deletion(-) + +--- a/fs/eventpoll.c ++++ b/fs/eventpoll.c +@@ -1285,7 +1285,7 @@ static int ep_modify(struct eventpoll *e + * otherwise we might miss an event that happens between the + * f_op->poll() call and the new event set registering. + */ +- epi->event.events = event->events; ++ epi->event.events = event->events; /* need barrier below */ + pt._key = event->events; + epi->event.data = event->data; /* protected by mtx */ + if (epi->event.events & EPOLLWAKEUP) { +@@ -1296,6 +1296,26 @@ static int ep_modify(struct eventpoll *e + } + + /* ++ * The following barrier has two effects: ++ * ++ * 1) Flush epi changes above to other CPUs. This ensures ++ * we do not miss events from ep_poll_callback if an ++ * event occurs immediately after we call f_op->poll(). ++ * We need this because we did not take ep->lock while ++ * changing epi above (but ep_poll_callback does take ++ * ep->lock). ++ * ++ * 2) We also need to ensure we do not miss _past_ events ++ * when calling f_op->poll(). This barrier also ++ * pairs with the barrier in wq_has_sleeper (see ++ * comments for wq_has_sleeper). ++ * ++ * This barrier will now guarantee ep_poll_callback or f_op->poll ++ * (or both) will notice the readiness of an item. ++ */ ++ smp_mb(); ++ ++ /* + * Get current event bits. We can safely use the file* here because + * its usage count has been increased by the caller of this function. + */ diff --git a/queue-3.7/hid-add-quirk-for-freescale-i.mx23-rom-recovery.patch b/queue-3.7/hid-add-quirk-for-freescale-i.mx23-rom-recovery.patch new file mode 100644 index 00000000000..bab0fb094fe --- /dev/null +++ b/queue-3.7/hid-add-quirk-for-freescale-i.mx23-rom-recovery.patch @@ -0,0 +1,47 @@ +From 436136cec650d661eb662fcb508a99878606d050 Mon Sep 17 00:00:00 2001 +From: Marek Vasut +Date: Sat, 24 Nov 2012 06:15:57 +0100 +Subject: HID: add quirk for Freescale i.MX23 ROM recovery + +From: Marek Vasut + +commit 436136cec650d661eb662fcb508a99878606d050 upstream. + +The USB recovery mode present in i.MX23 ROM emulates USB HID. It needs this +quirk to behave properly. + +Even if the official branding of the chip is Freescale i.MX23, I named it +Sigmatel STMP3780 since that's what the chip really is and it even reports +itself as STMP3780. + +Signed-off-by: Marek Vasut +Signed-off-by: Jiri Kosina +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/hid/hid-ids.h | 3 +++ + drivers/hid/usbhid/hid-quirks.c | 1 + + 2 files changed, 4 insertions(+) + +--- a/drivers/hid/hid-ids.h ++++ b/drivers/hid/hid-ids.h +@@ -696,6 +696,9 @@ + #define USB_VENDOR_ID_SIGMA_MICRO 0x1c4f + #define USB_DEVICE_ID_SIGMA_MICRO_KEYBOARD 0x0002 + ++#define USB_VENDOR_ID_SIGMATEL 0x066F ++#define USB_DEVICE_ID_SIGMATEL_STMP3780 0x3780 ++ + #define USB_VENDOR_ID_SKYCABLE 0x1223 + #define USB_DEVICE_ID_SKYCABLE_WIRELESS_PRESENTER 0x3F07 + +--- a/drivers/hid/usbhid/hid-quirks.c ++++ b/drivers/hid/usbhid/hid-quirks.c +@@ -79,6 +79,7 @@ static const struct hid_blacklist { + { USB_VENDOR_ID_QUANTA, USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3001, HID_QUIRK_NOGET }, + { USB_VENDOR_ID_QUANTA, USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3008, HID_QUIRK_NOGET }, + { USB_VENDOR_ID_SENNHEISER, USB_DEVICE_ID_SENNHEISER_BTD500USB, HID_QUIRK_NOGET }, ++ { USB_VENDOR_ID_SIGMATEL, USB_DEVICE_ID_SIGMATEL_STMP3780, HID_QUIRK_NOGET }, + { USB_VENDOR_ID_SUN, USB_DEVICE_ID_RARITAN_KVM_DONGLE, HID_QUIRK_NOGET }, + { USB_VENDOR_ID_SYMBOL, USB_DEVICE_ID_SYMBOL_SCANNER_1, HID_QUIRK_NOGET }, + { USB_VENDOR_ID_SYMBOL, USB_DEVICE_ID_SYMBOL_SCANNER_2, HID_QUIRK_NOGET }, diff --git a/queue-3.7/regmap-debugfs-avoid-overflows-for-very-small-reads.patch b/queue-3.7/regmap-debugfs-avoid-overflows-for-very-small-reads.patch new file mode 100644 index 00000000000..0b46f038c53 --- /dev/null +++ b/queue-3.7/regmap-debugfs-avoid-overflows-for-very-small-reads.patch @@ -0,0 +1,33 @@ +From db04328c167ff8e7c57f4a3532214aeada3a82fd Mon Sep 17 00:00:00 2001 +From: Mark Brown +Date: Tue, 11 Dec 2012 01:14:11 +0900 +Subject: regmap: debugfs: Avoid overflows for very small reads + +From: Mark Brown + +commit db04328c167ff8e7c57f4a3532214aeada3a82fd upstream. + +If count is less than the size of a register then we may hit integer +wraparound when trying to move backwards to check if we're still in +the buffer. Instead move the position forwards to check if it's still +in the buffer, we are unlikely to be able to allocate a buffer +sufficiently big to overflow here. + +Signed-off-by: Mark Brown +Cc: stable@vger.kernel.org + +--- + drivers/base/regmap/regmap-debugfs.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/base/regmap/regmap-debugfs.c ++++ b/drivers/base/regmap/regmap-debugfs.c +@@ -90,7 +90,7 @@ static ssize_t regmap_map_read_file(stru + /* If we're in the region the user is trying to read */ + if (p >= *ppos) { + /* ...but not beyond it */ +- if (buf_pos >= count - 1 - tot_len) ++ if (buf_pos + 1 + tot_len >= count) + break; + + /* Format the register */ diff --git a/queue-3.7/series b/queue-3.7/series index 1d2480c98ad..a181b838dc2 100644 --- a/queue-3.7/series +++ b/queue-3.7/series @@ -116,3 +116,7 @@ ext4-release-buffer-in-failed-path-in-dx_probe.patch aoe-remove-vestigial-request-queue-allocation.patch udf-fix-memory-leak-while-allocating-blocks-during-write.patch udf-don-t-increment-lenextents-while-writing-to-a-hole.patch +acpi-do-not-use-lid-and-sleep-button-for-s5-wakeup.patch +regmap-debugfs-avoid-overflows-for-very-small-reads.patch +epoll-prevent-missed-events-on-epoll_ctl_mod.patch +hid-add-quirk-for-freescale-i.mx23-rom-recovery.patch -- 2.47.3