lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <YFunVZLZYSzUDd6n@google.com>
Date:   Wed, 24 Mar 2021 13:55:49 -0700
From:   Minchan Kim <minchan@...nel.org>
To:     Dmitry Osipenko <digetx@...il.com>
Cc:     Andrew Morton <akpm@...ux-foundation.org>,
        linux-mm <linux-mm@...ck.org>,
        LKML <linux-kernel@...r.kernel.org>, gregkh@...uxfoundation.org,
        surenb@...gle.com, joaodias@...gle.com, jhubbard@...dia.com,
        willy@...radead.org
Subject: Re: [PATCH] mm: cma: fix corruption cma_sysfs_alloc_pages_count

On Wed, Mar 24, 2021 at 11:02:47PM +0300, Dmitry Osipenko wrote:
> 24.03.2021 22:57, Minchan Kim пишет:
> > On Wed, Mar 24, 2021 at 10:49:58PM +0300, Dmitry Osipenko wrote:
> >> 24.03.2021 22:43, Dmitry Osipenko пишет:
> >>> 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);
> >>>
> >>
> >> Please try to simulate the errors and check that error path is working
> >> properly in the next version.
> >>
> >> Alternatively, we could remove the cma_kobj_release entirely, like Greg
> >> suggested previously, and then don't care about cleaning up at all.
> > 
> > Does he suggested it to remove cma_kobj_release?(Initially, I did but
> > was rejected from Greg)
> > 
> 
> Alright, I haven't followed the previous threads fully and only saw the
> reply where he suggested to removed it.

No problem. I just posted it new version. Hopefully, it tastes good
for you. ;-)

Thanks for the review!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ