Re: [PATCH] mm: cma: fix corruption cma_sysfs_alloc_pages_count
From: Dmitry Osipenko
Date: Wed Mar 24 2021 - 15:44:44 EST
24.03.2021 22:20, Minchan Kim пишет:
> static int __init cma_sysfs_init(void)
> {
> - int i = 0;
> + struct kobject *cma_kobj_root;
> + struct cma_kobject *cma_kobj;
> struct cma *cma;
> + unsigned int i;
> while (--i >= 0) {
Do you realize that this doesn't work anymore?
> cma = &cma_areas[i];
> - kobject_put(&cma->stat->kobj);
> - }
>
> - kfree(cma_stats);
> - kobject_put(cma_kobj);
> + kobject_put(&cma->cma_kobj->kobj);
> + kfree(cma->cma_kobj);
Freeing a null pointer?
> + cma->cma_kobj = NULL;
> + }
> + kobject_put(cma_kobj_root);