From a70f6bced3e1913148d3ae0ff42b5f475d8204c9 Mon Sep 17 00:00:00 2001 From: din Date: Thu, 17 Dec 2020 22:59:29 -0600 Subject: [PATCH] Fixed null deref on permission application. --- mod/piuio.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/mod/piuio.c b/mod/piuio.c index 379ee6b..380b45e 100644 --- a/mod/piuio.c +++ b/mod/piuio.c @@ -436,13 +436,12 @@ static int piuio_leds_init(struct piuio *piu) /* Relax permissions on led attributes */ for (ag = piu->led[i].dev.dev->class->dev_groups; *ag; ag++) { - for (attr = (*ag)->attrs; *attr; attr++) { - ret = sysfs_chmod_file(&piu->led[i].dev.dev->kobj, + attr = (*piu->led[i].dev.dev->class->dev_groups)->attrs; + ret = sysfs_chmod_file(&piu->led[i].dev.dev->kobj, *attr, S_IRUGO | S_IWUGO); - if (ret) { - led_classdev_unregister(&piu->led[i].dev); - goto out_unregister; - } + if (ret) { + led_classdev_unregister(&piu->led[i].dev); + goto out_unregister; } } }