提交 c0a64500 编写于 作者: D Dan Carpenter 提交者: Jun Tian

platform/x86: pmt: Fix a potential Oops on error in probe

mainline inclusion
from mainline-v5.11-rc1
commit d3d73d25
category: feature
bugzilla: https://gitee.com/openeuler/intel-kernel/issues/I596K9
CVE: NA

Intel-SIG: commit d3d73d25 platform/x86: pmt: Fix a potential Oops
on error in probe.
Backport for intel PMT (Platform Monitoring Technology) support

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

The "ns->attr_grp" pointer can be NULL so this error handling code needs
to check for that to avoid an Oops.

Fixes: e2729113 ("platform/x86: Intel PMT class driver")
Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: NDavid E. Box <david.e.box@linux.intel.com>
Link: https://lore.kernel.org/r/20201117072251.GC1111239@mwandaSigned-off-by: NHans de Goede <hdegoede@redhat.com>
Signed-off-by: Nyingbao jia <yingbao.jia@intel.com>
Signed-off-by: NJun Tian <jun.j.tian@intel.com>
上级 140652ff
...@@ -225,6 +225,7 @@ static int intel_pmt_dev_register(struct intel_pmt_entry *entry, ...@@ -225,6 +225,7 @@ static int intel_pmt_dev_register(struct intel_pmt_entry *entry,
return 0; return 0;
fail_ioremap: fail_ioremap:
if (ns->attr_grp)
sysfs_remove_group(entry->kobj, ns->attr_grp); sysfs_remove_group(entry->kobj, ns->attr_grp);
fail_sysfs: fail_sysfs:
device_unregister(dev); device_unregister(dev);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册