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


Groups > linux.kernel > #1579784

[PATCH 4.9 02/60] acpi, nfit: fix acpi_nfit_flush_probe() crash

From Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Newsgroups linux.kernel
Subject [PATCH 4.9 02/60] acpi, nfit: fix acpi_nfit_flush_probe() crash
Date 2017-02-13 14:30 +0100
Message-ID <taoRB-4fA-55@gated-at.bofh.it> (permalink)
References <taoyd-47y-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

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

From: Dan Williams <dan.j.williams@intel.com>

commit e471486c13b82b1338d49c798f78bb62b1ed0a9e upstream.

We queue an on-stack work item to 'nfit_wq' and wait for it to complete
as part of a 'flush_probe' request. However, if the user cancels the
wait we need to make sure the item is flushed from the queue otherwise
we are leaving an out-of-scope stack address on the work list.

 BUG: unable to handle kernel paging request at ffffbcb3c72f7cd0
 IP: [<ffffffffa9413a7b>] __list_add+0x1b/0xb0
 [..]
 RIP: 0010:[<ffffffffa9413a7b>]  [<ffffffffa9413a7b>] __list_add+0x1b/0xb0
 RSP: 0018:ffffbcb3c7ba7c00  EFLAGS: 00010046
 [..]
 Call Trace:
  [<ffffffffa90bb11a>] insert_work+0x3a/0xc0
  [<ffffffffa927fdda>] ? seq_open+0x5a/0xa0
  [<ffffffffa90bb30a>] __queue_work+0x16a/0x460
  [<ffffffffa90bbb08>] queue_work_on+0x38/0x40
  [<ffffffffc0cf2685>] acpi_nfit_flush_probe+0x95/0xc0 [nfit]
  [<ffffffffc0cf25d0>] ? nfit_visible+0x40/0x40 [nfit]
  [<ffffffffa9571495>] wait_probe_show+0x25/0x60
  [<ffffffffa9546b30>] dev_attr_show+0x20/0x50

Fixes: 7ae0fa439faf ("nfit, libnvdimm: async region scrub workqueue")
Reviewed-by: Vishal Verma <vishal.l.verma@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/acpi/nfit/core.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

--- a/drivers/acpi/nfit/core.c
+++ b/drivers/acpi/nfit/core.c
@@ -2704,6 +2704,7 @@ static int acpi_nfit_flush_probe(struct
 	struct acpi_nfit_desc *acpi_desc = to_acpi_nfit_desc(nd_desc);
 	struct device *dev = acpi_desc->dev;
 	struct acpi_nfit_flush_work flush;
+	int rc;
 
 	/* bounce the device lock to flush acpi_nfit_add / acpi_nfit_notify */
 	device_lock(dev);
@@ -2716,7 +2717,10 @@ static int acpi_nfit_flush_probe(struct
 	INIT_WORK_ONSTACK(&flush.work, flush_probe);
 	COMPLETION_INITIALIZER_ONSTACK(flush.cmp);
 	queue_work(nfit_wq, &flush.work);
-	return wait_for_completion_interruptible(&flush.cmp);
+
+	rc = wait_for_completion_interruptible(&flush.cmp);
+	cancel_work_sync(&flush.work);
+	return rc;
 }
 
 static int acpi_nfit_clear_to_send(struct nvdimm_bus_descriptor *nd_desc,

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


Thread

[PATCH 4.9 00/60] 4.9.10-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-13 14:30 +0100
  [PATCH 4.9 11/60] crypto: ccp - Fix double add when creating new DMA command Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-13 14:30 +0100
  [PATCH 4.9 09/60] crypto: qat - zero esram only for DH85x devices Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-13 14:30 +0100
  [PATCH 4.9 20/60] hns: avoid stack overflow with CONFIG_KASAN Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-13 14:30 +0100
  [PATCH 4.9 05/60] dm rq: cope with DM device destruction while in dm_old_request_fn() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-13 14:30 +0100
  [PATCH 4.9 21/60] ARM: 8643/3: arm/ptrace: Preserve previous registers for short regset write Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-13 14:30 +0100
  [PATCH 4.9 12/60] ARC: [arcompact] brown paper bag bug in unaligned access delay slot fixup Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-13 14:30 +0100
  [PATCH 4.9 18/60] mm/slub.c: fix random_seq offset destruction Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-13 14:30 +0100
  [PATCH 4.9 28/60] target: Fix multi-session dynamic se_node_acl double free OOPs Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-13 14:30 +0100
  [PATCH 4.9 03/60] libnvdimm, namespace: do not delete namespace-id 0 Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-13 14:30 +0100
  [PATCH 4.9 24/60] drm/atomic: Fix double free in drm_atomic_state_default_clear Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-13 14:30 +0100
  [PATCH 4.9 07/60] crypto: chcr - Check device is allocated before use Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-13 14:30 +0100
  [PATCH 4.9 26/60] target: Use correct SCSI status during EXTENDED_COPY exception Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-13 14:30 +0100
  [PATCH 4.9 02/60] acpi, nfit: fix acpi_nfit_flush_probe() crash Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-13 14:30 +0100
  [PATCH 4.9 13/60] Input: uinput - fix crash when mixing old and new init style Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-13 14:30 +0100
  [PATCH 4.9 19/60] ibmvscsis: Add SGL limit Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-13 14:30 +0100
  [PATCH 4.9 25/60] target: Dont BUG_ON during NodeACL dynamic -> explicit conversion Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-13 14:30 +0100
  Re: [PATCH 4.9 00/60] 4.9.10-stable review Shuah Khan <shuahkh@osg.samsung.com> - 2017-02-13 18:10 +0100
    Re: [PATCH 4.9 00/60] 4.9.10-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-13 18:30 +0100
  Re: [PATCH 4.9 00/60] 4.9.10-stable review Guenter Roeck <linux@roeck-us.net> - 2017-02-13 21:10 +0100
    Re: [PATCH 4.9 00/60] 4.9.10-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-02-15 00:00 +0100

csiph-web