platform/x86: pmt: Fix a potential Oops on error in probe
Subsystems (2)
PATCH 1/1 platform/x86: pmt: Fix a potential Oops on error in probe
The "ns->attr_grp" pointer can be NULL so this error handling code needs to check for that to avoid an Oops.
--- drivers/platform/x86/intel_pmt_class.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/platform/x86/intel_pmt_class.c +2 -1
@@ -225,7 +225,8 @@ static int intel_pmt_dev_register(struct intel_pmt_entry *entry,return 0 ; fail_ioremap: -sysfs_remove_group (entry->kobj, ns->attr_grp); +if (ns->attr_grp) +sysfs_remove_group (entry->kobj, ns->attr_grp); fail_sysfs:device_unregister (dev); fail_dev_create:
Signature · 1 line
2.28.0
Thanks Dan.
Quoted 26 lines · Dan Carpenter
The "
ns->attr_grp" pointer can be NULL so this error handling code needs
to check for that to avoid an Oops.Fixes e2729113ce66 ("platform/x86: Intel PMT class driver")Signed-off-by Dan Carpenter <[email protected]>--- drivers/platform/x86/intel_pmt_class.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/platform/x86/intel_pmt_class.c +2
-1@@ -225,7 +225,8 @@ static int intel_pmt_dev_register(structintel_pmt_entry *entry, return 0; fail_ioremap: -sysfs_remove_group (entry->kobj, ns->attr_grp); +if (ns->attr_grp) +sysfs_remove_group (entry->kobj, ns->attr_grp); fail_sysfs:device_unregister (dev);
fail_dev_create:
Hi,
Quoted 5 lines · Dan Carpenter
The "
ns->attr_grp" pointer can be NULL so this error handling code needs to check for that to avoid an Oops.Fixes e2729113ce66 ("platform/x86: Intel PMT class driver")Signed-off-by Dan Carpenter <[email protected]>
Thank you for your patch, I've applied this patch to my review-hans branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans
Note it will show up in my review-hans branch once I've pushed my local branch there, which might take a while.
Once I've run some tests on this branch the patches there will be added to the platform-drivers-x86/for-next branch and eventually will be included in the pdx86 pull-request to Linus for the next merge-window.
Regards,
Hans
Quoted 19 lines
--- drivers/platform/x86/intel_pmt_class.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/platform/x86/intel_pmt_class.c +2
-1@@ -225,7 +225,8 @@ static int intel_pmt_dev_register(struct intel_pmt_entry *entry,return 0 ; fail_ioremap: -sysfs_remove_group (entry->kobj, ns->attr_grp); +if (ns->attr_grp) +sysfs_remove_group (entry->kobj, ns->attr_grp); fail_sysfs:device_unregister (dev); fail_dev_create: