提交 8801922c 编写于 作者: A Alexander Shishkin 提交者: Greg Kroah-Hartman

intel_th: Fix device removal logic

Commit a753bfcf ("intel_th: Make the switch allocate its subdevices")
brings in new subdevice addition/removal logic that's broken for "host
mode": the SWITCH device has no children to begin with, which is not
handled in the code. This results in a null dereference bug later down
the path.

This patch fixes the subdevice removal code to handle host mode correctly.
Signed-off-by: NAlexander Shishkin <alexander.shishkin@linux.intel.com>
Fixes: a753bfcf ("intel_th: Make the switch allocate its subdevices")
CC: stable@vger.kernel.org # v4.14+
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 d193d1a2
...@@ -139,7 +139,8 @@ static int intel_th_remove(struct device *dev) ...@@ -139,7 +139,8 @@ static int intel_th_remove(struct device *dev)
th->thdev[i] = NULL; th->thdev[i] = NULL;
} }
th->num_thdevs = lowest; if (lowest >= 0)
th->num_thdevs = lowest;
} }
if (thdrv->attr_group) if (thdrv->attr_group)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册