]>
Commit | Line | Data |
---|---|---|
489cd451 GKH |
1 | From 43f89877f26671c6309cd87d7364b1a3e66e71cf Mon Sep 17 00:00:00 2001 |
2 | From: Dexuan Cui <decui@microsoft.com> | |
3 | Date: Wed, 30 Jan 2019 01:23:01 +0000 | |
4 | Subject: nfit: acpi_nfit_ctl(): Check out_obj->type in the right place | |
5 | ||
6 | From: Dexuan Cui <decui@microsoft.com> | |
7 | ||
8 | commit 43f89877f26671c6309cd87d7364b1a3e66e71cf upstream. | |
9 | ||
10 | In the case of ND_CMD_CALL, we should also check out_obj->type. | |
11 | ||
12 | The patch uses out_obj->type, which is a short alias to | |
13 | out_obj->package.type. | |
14 | ||
15 | Fixes: 31eca76ba2fc ("nfit, libnvdimm: limited/whitelisted dimm command marshaling mechanism") | |
16 | Cc: <stable@vger.kernel.org> | |
17 | Signed-off-by: Dexuan Cui <decui@microsoft.com> | |
18 | Signed-off-by: Dan Williams <dan.j.williams@intel.com> | |
19 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
20 | ||
21 | --- | |
22 | drivers/acpi/nfit/core.c | 14 +++++++------- | |
23 | 1 file changed, 7 insertions(+), 7 deletions(-) | |
24 | ||
25 | --- a/drivers/acpi/nfit/core.c | |
26 | +++ b/drivers/acpi/nfit/core.c | |
27 | @@ -533,6 +533,13 @@ int acpi_nfit_ctl(struct nvdimm_bus_desc | |
28 | return -EINVAL; | |
29 | } | |
30 | ||
31 | + if (out_obj->type != ACPI_TYPE_BUFFER) { | |
32 | + dev_dbg(dev, "%s unexpected output object type cmd: %s type: %d\n", | |
33 | + dimm_name, cmd_name, out_obj->type); | |
34 | + rc = -EINVAL; | |
35 | + goto out; | |
36 | + } | |
37 | + | |
38 | if (call_pkg) { | |
39 | call_pkg->nd_fw_size = out_obj->buffer.length; | |
40 | memcpy(call_pkg->nd_payload + call_pkg->nd_size_in, | |
41 | @@ -551,13 +558,6 @@ int acpi_nfit_ctl(struct nvdimm_bus_desc | |
42 | return 0; | |
43 | } | |
44 | ||
45 | - if (out_obj->package.type != ACPI_TYPE_BUFFER) { | |
46 | - dev_dbg(dev, "%s unexpected output object type cmd: %s type: %d\n", | |
47 | - dimm_name, cmd_name, out_obj->type); | |
48 | - rc = -EINVAL; | |
49 | - goto out; | |
50 | - } | |
51 | - | |
52 | dev_dbg(dev, "%s cmd: %s output length: %d\n", dimm_name, | |
53 | cmd_name, out_obj->buffer.length); | |
54 | print_hex_dump_debug(cmd_name, DUMP_PREFIX_OFFSET, 4, 4, |