]>
Commit | Line | Data |
---|---|---|
2dff5989 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 | --- | |
23 | drivers/acpi/nfit/core.c | 14 +++++++------- | |
24 | 1 file changed, 7 insertions(+), 7 deletions(-) | |
25 | ||
26 | --- a/drivers/acpi/nfit/core.c | |
27 | +++ b/drivers/acpi/nfit/core.c | |
28 | @@ -307,6 +307,13 @@ int acpi_nfit_ctl(struct nvdimm_bus_desc | |
29 | return -EINVAL; | |
30 | } | |
31 | ||
32 | + if (out_obj->type != ACPI_TYPE_BUFFER) { | |
33 | + dev_dbg(dev, "%s unexpected output object type cmd: %s type: %d\n", | |
34 | + dimm_name, cmd_name, out_obj->type); | |
35 | + rc = -EINVAL; | |
36 | + goto out; | |
37 | + } | |
38 | + | |
39 | if (call_pkg) { | |
40 | call_pkg->nd_fw_size = out_obj->buffer.length; | |
41 | memcpy(call_pkg->nd_payload + call_pkg->nd_size_in, | |
42 | @@ -325,13 +332,6 @@ int acpi_nfit_ctl(struct nvdimm_bus_desc | |
43 | return 0; | |
44 | } | |
45 | ||
46 | - if (out_obj->package.type != ACPI_TYPE_BUFFER) { | |
47 | - dev_dbg(dev, "%s:%s unexpected output object type cmd: %s type: %d\n", | |
48 | - __func__, dimm_name, cmd_name, out_obj->type); | |
49 | - rc = -EINVAL; | |
50 | - goto out; | |
51 | - } | |
52 | - | |
53 | if (IS_ENABLED(CONFIG_ACPI_NFIT_DEBUG)) { | |
54 | dev_dbg(dev, "%s:%s cmd: %s output length: %d\n", __func__, | |
55 | dimm_name, cmd_name, out_obj->buffer.length); |