All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch added to 3.12-stable] xhci: fix placement of call to usb_disabled()
@ 2016-02-11 13:45 Jiri Slaby
  2016-02-11 13:45 ` [patch added to 3.12-stable] recordmcount: Fix endianness handling bug for nop_mcount Jiri Slaby
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Jiri Slaby @ 2016-02-11 13:45 UTC (permalink / raw)
  To: stable; +Cc: Greg Kroah-Hartman, Jiri Slaby

From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

This patch has been added to the 3.12 stable tree. If you have any
objections, please let us know.

===============

In the backport of 1eaf35e4dd592c59041bc1ed3248c46326da1f5f, the call to
usb_disabled() was too late, after we had already done some allocation.
Move that call to the top of the function instead, making the logic
match what is intended and is in the original patch.

Reported-by: Luis Henriques <luis.henriques@canonical.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/usb/host/xhci.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 6888e9a956d4..dfcf0a3527b8 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -4864,6 +4864,9 @@ static int __init xhci_hcd_init(void)
 {
 	int retval;
 
+	if (usb_disabled())
+		return -ENODEV;
+
 	retval = xhci_register_pci();
 	if (retval < 0) {
 		pr_debug("Problem registering PCI driver.\n");
@@ -4892,9 +4895,6 @@ static int __init xhci_hcd_init(void)
 	/* xhci_run_regs has eight fields and embeds 128 xhci_intr_regs */
 	BUILD_BUG_ON(sizeof(struct xhci_run_regs) != (8+8*128)*32/8);
 
-	if (usb_disabled())
-		return -ENODEV;
-
 	return 0;
 unreg_pci:
 	xhci_unregister_pci();
-- 
2.7.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [patch added to 3.12-stable] recordmcount: Fix endianness handling bug for nop_mcount
  2016-02-11 13:45 [patch added to 3.12-stable] xhci: fix placement of call to usb_disabled() Jiri Slaby
@ 2016-02-11 13:45 ` Jiri Slaby
  2016-02-11 13:45 ` [patch added to 3.12-stable] crypto: algif_hash - Only export and import on sockets with data Jiri Slaby
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Jiri Slaby @ 2016-02-11 13:45 UTC (permalink / raw)
  To: stable; +Cc: libin, Steven Rostedt, Jiri Slaby

From: libin <huawei.libin@huawei.com>

This patch has been added to the 3.12 stable tree. If you have any
objections, please let us know.

===============

commit c84da8b9ad3761eef43811181c7e896e9834b26b upstream.

In nop_mcount, shdr->sh_offset and welp->r_offset should handle
endianness properly, otherwise it will trigger Segmentation fault
if the recordmcount main and file.o have different endianness.

Link: http://lkml.kernel.org/r/563806C7.7070606@huawei.com

Signed-off-by: Li Bin <huawei.libin@huawei.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 scripts/recordmcount.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/recordmcount.h b/scripts/recordmcount.h
index 49b582a225b0..b9897e2be404 100644
--- a/scripts/recordmcount.h
+++ b/scripts/recordmcount.h
@@ -377,7 +377,7 @@ static void nop_mcount(Elf_Shdr const *const relhdr,
 
 		if (mcountsym == Elf_r_sym(relp) && !is_fake_mcount(relp)) {
 			if (make_nop)
-				ret = make_nop((void *)ehdr, shdr->sh_offset + relp->r_offset);
+				ret = make_nop((void *)ehdr, _w(shdr->sh_offset) + _w(relp->r_offset));
 			if (warn_on_notrace_sect && !once) {
 				printf("Section %s has mcount callers being ignored\n",
 				       txtname);
-- 
2.7.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [patch added to 3.12-stable] crypto: algif_hash - Only export and import on sockets with data
  2016-02-11 13:45 [patch added to 3.12-stable] xhci: fix placement of call to usb_disabled() Jiri Slaby
  2016-02-11 13:45 ` [patch added to 3.12-stable] recordmcount: Fix endianness handling bug for nop_mcount Jiri Slaby
@ 2016-02-11 13:45 ` Jiri Slaby
  2016-02-11 13:45 ` [patch added to 3.12-stable] dm btree: fix leak of bufio-backed block in btree_split_sibling error path Jiri Slaby
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Jiri Slaby @ 2016-02-11 13:45 UTC (permalink / raw)
  To: stable; +Cc: Herbert Xu, Jiri Slaby

From: Herbert Xu <herbert@gondor.apana.org.au>

This patch has been added to the 3.12 stable tree. If you have any
objections, please let us know.

===============

commit 4afa5f9617927453ac04b24b584f6c718dfb4f45 upstream.

The hash_accept call fails to work on sockets that have not received
any data.  For some algorithm implementations it may cause crashes.

This patch fixes this by ensuring that we only export and import on
sockets that have received data.

Reported-by: Harsh Jain <harshjain.prof@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Tested-by: Stephan Mueller <smueller@chronox.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 crypto/algif_hash.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/crypto/algif_hash.c b/crypto/algif_hash.c
index 850246206b12..a68b56a368a8 100644
--- a/crypto/algif_hash.c
+++ b/crypto/algif_hash.c
@@ -192,9 +192,14 @@ static int hash_accept(struct socket *sock, struct socket *newsock, int flags)
 	struct sock *sk2;
 	struct alg_sock *ask2;
 	struct hash_ctx *ctx2;
+	bool more;
 	int err;
 
-	err = crypto_ahash_export(req, state);
+	lock_sock(sk);
+	more = ctx->more;
+	err = more ? crypto_ahash_export(req, state) : 0;
+	release_sock(sk);
+
 	if (err)
 		return err;
 
@@ -205,7 +210,10 @@ static int hash_accept(struct socket *sock, struct socket *newsock, int flags)
 	sk2 = newsock->sk;
 	ask2 = alg_sk(sk2);
 	ctx2 = ask2->private;
-	ctx2->more = 1;
+	ctx2->more = more;
+
+	if (!more)
+		return err;
 
 	err = crypto_ahash_import(&ctx2->req, state);
 	if (err) {
-- 
2.7.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [patch added to 3.12-stable] dm btree: fix leak of bufio-backed block in btree_split_sibling error path
  2016-02-11 13:45 [patch added to 3.12-stable] xhci: fix placement of call to usb_disabled() Jiri Slaby
  2016-02-11 13:45 ` [patch added to 3.12-stable] recordmcount: Fix endianness handling bug for nop_mcount Jiri Slaby
  2016-02-11 13:45 ` [patch added to 3.12-stable] crypto: algif_hash - Only export and import on sockets with data Jiri Slaby
@ 2016-02-11 13:45 ` Jiri Slaby
  2016-02-11 13:45 ` [patch added to 3.12-stable] drivers/base/memory.c: prohibit offlining of memory blocks with missing sections Jiri Slaby
  2016-02-11 13:45 ` [patch added to 3.12-stable] HID: usbhid: fix recursive deadlock Jiri Slaby
  4 siblings, 0 replies; 6+ messages in thread
From: Jiri Slaby @ 2016-02-11 13:45 UTC (permalink / raw)
  To: stable; +Cc: Mike Snitzer, Jiri Slaby

From: Mike Snitzer <snitzer@redhat.com>

This patch has been added to the 3.12 stable tree. If you have any
objections, please let us know.

===============

commit 30ce6e1cc5a0f781d60227e9096c86e188d2c2bd upstream.

The block allocated at the start of btree_split_sibling() is never
released if later insert_at() fails.

Fix this by releasing the previously allocated bufio block using
unlock_block().

Reported-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/md/persistent-data/dm-btree.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/md/persistent-data/dm-btree.c b/drivers/md/persistent-data/dm-btree.c
index fc3d733aab1c..28662bd600e0 100644
--- a/drivers/md/persistent-data/dm-btree.c
+++ b/drivers/md/persistent-data/dm-btree.c
@@ -471,8 +471,10 @@ static int btree_split_sibling(struct shadow_spine *s, dm_block_t root,
 
 	r = insert_at(sizeof(__le64), pn, parent_index + 1,
 		      le64_to_cpu(rn->keys[0]), &location);
-	if (r)
+	if (r) {
+		unlock_block(s->info, right);
 		return r;
+	}
 
 	if (key < le64_to_cpu(rn->keys[0])) {
 		unlock_block(s->info, right);
-- 
2.7.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [patch added to 3.12-stable] drivers/base/memory.c: prohibit offlining of memory blocks with missing sections
  2016-02-11 13:45 [patch added to 3.12-stable] xhci: fix placement of call to usb_disabled() Jiri Slaby
                   ` (2 preceding siblings ...)
  2016-02-11 13:45 ` [patch added to 3.12-stable] dm btree: fix leak of bufio-backed block in btree_split_sibling error path Jiri Slaby
@ 2016-02-11 13:45 ` Jiri Slaby
  2016-02-11 13:45 ` [patch added to 3.12-stable] HID: usbhid: fix recursive deadlock Jiri Slaby
  4 siblings, 0 replies; 6+ messages in thread
From: Jiri Slaby @ 2016-02-11 13:45 UTC (permalink / raw)
  To: stable
  Cc: Seth Jennings, Daniel J Blueman, Yinghai Lu, Greg KH,
	Russ Anderson, Andrew Morton, Linus Torvalds, Jiri Slaby

From: Seth Jennings <sjennings@variantweb.net>

This patch has been added to the 3.12 stable tree. If you have any
objections, please let us know.

===============

commit 26bbe7ef6d5cdc7ec08cba6d433fca4060f258f3 upstream.

Commit bdee237c0343 ("x86: mm: Use 2GB memory block size on large-memory
x86-64 systems") and 982792c782ef ("x86, mm: probe memory block size for
generic x86 64bit") introduced large block sizes for x86.  This made it
possible to have multiple sections per memory block where previously,
there was a only every one section per block.

Since blocks consist of contiguous ranges of section, there can be holes
in the blocks where sections are not present.  If one attempts to
offline such a block, a crash occurs since the code is not designed to
deal with this.

This patch is a quick fix to gaurd against the crash by not allowing
blocks with non-present sections to be offlined.

Addresses https://bugzilla.kernel.org/show_bug.cgi?id=107781

Signed-off-by: Seth Jennings <sjennings@variantweb.net>
Reported-by: Andrew Banman <abanman@sgi.com>
Cc: Daniel J Blueman <daniel@numascale.com>
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: Greg KH <greg@kroah.com>
Cc: Russ Anderson <rja@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/base/memory.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/base/memory.c b/drivers/base/memory.c
index bece691cb5d9..3e2a3059b1f8 100644
--- a/drivers/base/memory.c
+++ b/drivers/base/memory.c
@@ -311,6 +311,10 @@ static int memory_subsys_offline(struct device *dev)
 	if (mem->state == MEM_OFFLINE)
 		return 0;
 
+	/* Can't offline block with non-present sections */
+	if (mem->section_count != sections_per_block)
+		return -EINVAL;
+
 	return memory_block_change_state(mem, MEM_OFFLINE, MEM_ONLINE);
 }
 
-- 
2.7.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [patch added to 3.12-stable] HID: usbhid: fix recursive deadlock
  2016-02-11 13:45 [patch added to 3.12-stable] xhci: fix placement of call to usb_disabled() Jiri Slaby
                   ` (3 preceding siblings ...)
  2016-02-11 13:45 ` [patch added to 3.12-stable] drivers/base/memory.c: prohibit offlining of memory blocks with missing sections Jiri Slaby
@ 2016-02-11 13:45 ` Jiri Slaby
  4 siblings, 0 replies; 6+ messages in thread
From: Jiri Slaby @ 2016-02-11 13:45 UTC (permalink / raw)
  To: stable; +Cc: Ioan-Adrian Ratiu, Jiri Kosina, Jason Gerecke, Jiri Slaby

From: Ioan-Adrian Ratiu <adi@adirat.com>

This patch has been added to the 3.12 stable tree. If you have any
objections, please let us know.

===============

commit e470127e9606b1fa151c4184243e61296d1e0c0f upstream.

The critical section protected by usbhid->lock in hid_ctrl() is too
big and because of this it causes a recursive deadlock. "Too big" means
the case statement and the call to hid_input_report() do not need to be
protected by the spinlock (no URB operations are done inside them).

The deadlock happens because in certain rare cases drivers try to grab
the lock while handling the ctrl irq which grabs the lock before them
as described above. For example newer wacom tablets like 056a:033c try
to reschedule proximity reads from wacom_intuos_schedule_prox_event()
calling hid_hw_request() -> usbhid_request() -> usbhid_submit_report()
which tries to grab the usbhid lock already held by hid_ctrl().

There are two ways to get out of this deadlock:
    1. Make the drivers work "around" the ctrl critical region, in the
    wacom case for ex. by delaying the scheduling of the proximity read
    request itself to a workqueue.
    2. Shrink the critical region so the usbhid lock protects only the
    instructions which modify usbhid state, calling hid_input_report()
    with the spinlock unlocked, allowing the device driver to grab the
    lock first, finish and then grab the lock afterwards in hid_ctrl().

This patch implements the 2nd solution.

Signed-off-by: Ioan-Adrian Ratiu <adi@adirat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/hid/usbhid/hid-core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
index f44be51e261d..183a3e9b1ccc 100644
--- a/drivers/hid/usbhid/hid-core.c
+++ b/drivers/hid/usbhid/hid-core.c
@@ -492,8 +492,6 @@ static void hid_ctrl(struct urb *urb)
 	struct usbhid_device *usbhid = hid->driver_data;
 	int unplug = 0, status = urb->status;
 
-	spin_lock(&usbhid->lock);
-
 	switch (status) {
 	case 0:			/* success */
 		if (usbhid->ctrl[usbhid->ctrltail].dir == USB_DIR_IN)
@@ -513,6 +511,8 @@ static void hid_ctrl(struct urb *urb)
 		hid_warn(urb->dev, "ctrl urb status %d received\n", status);
 	}
 
+	spin_lock(&usbhid->lock);
+
 	if (unplug) {
 		usbhid->ctrltail = usbhid->ctrlhead;
 	} else {
-- 
2.7.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-02-11 13:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-11 13:45 [patch added to 3.12-stable] xhci: fix placement of call to usb_disabled() Jiri Slaby
2016-02-11 13:45 ` [patch added to 3.12-stable] recordmcount: Fix endianness handling bug for nop_mcount Jiri Slaby
2016-02-11 13:45 ` [patch added to 3.12-stable] crypto: algif_hash - Only export and import on sockets with data Jiri Slaby
2016-02-11 13:45 ` [patch added to 3.12-stable] dm btree: fix leak of bufio-backed block in btree_split_sibling error path Jiri Slaby
2016-02-11 13:45 ` [patch added to 3.12-stable] drivers/base/memory.c: prohibit offlining of memory blocks with missing sections Jiri Slaby
2016-02-11 13:45 ` [patch added to 3.12-stable] HID: usbhid: fix recursive deadlock Jiri Slaby

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.