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] [thread-next>] [day] [month] [year] [list]
Message-ID: <Ypk4yuvJQ1ObIEJH@carbon>
Date:   Thu, 2 Jun 2022 15:25:14 -0700
From:   Roman Gushchin <roman.gushchin@...ux.dev>
To:     Andrew Morton <akpm@...ux-foundation.org>
Cc:     linux-mm@...ck.org, Dave Chinner <dchinner@...hat.com>,
        linux-kernel@...r.kernel.org,
        Kent Overstreet <kent.overstreet@...il.com>,
        Hillf Danton <hdanton@...a.com>,
        Christophe JAILLET <christophe.jaillet@...adoo.fr>,
        Muchun Song <songmuchun@...edance.com>
Subject: Re: [PATCH v5 6/6] mm: shrinkers: add scan interface for shrinker
 debugfs

On Thu, Jun 02, 2022 at 11:41:32AM -0700, Andrew Morton wrote:
> On Wed, 1 Jun 2022 17:56:22 -0700 Roman Gushchin <roman.gushchin@...ux.dev> wrote:
> 
> > > 
> > > > +	ssize_t ret;
> > > > +
> > > > +	if (copy_from_user(kbuf, buf, read_len))
> > > > +		return -EFAULT;
> > > > +	kbuf[read_len] = '\0';
> > > > +
> > > > +	if (sscanf(kbuf, "%lu %d %lu", &ino, &nid, &nr_to_scan) < 2)
> > > 
> > > Was it intentional to permit more than three args?
> > 
> > Good catch! No, of course it wasn't intentional.
> > 
> > Below is an updated version of this patch.
> > 
> > ...
> >
> > +	if (sscanf(kbuf, "%lu %d %lu", &ino, &nid, &nr_to_scan) != 2)
> > +		return -EINVAL;
> 
> s/2/3/methinks?
> 
> 

My bad, of course. Thanks!

--

diff --git a/mm/shrinker_debug.c b/mm/shrinker_debug.c
index 12026472daae..e5b40c43221d 100644
--- a/mm/shrinker_debug.c
+++ b/mm/shrinker_debug.c
@@ -124,7 +124,7 @@ static ssize_t shrinker_debugfs_scan_write(struct file *file,
                return -EFAULT;
        kbuf[read_len] = '\0';
 
-       if (sscanf(kbuf, "%lu %d %lu", &ino, &nid, &nr_to_scan) != 2)
+       if (sscanf(kbuf, "%lu %d %lu", &ino, &nid, &nr_to_scan) != 3)
                return -EINVAL;
 
        if (nid < 0 || nid >= nr_node_ids)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ