Messages in this thread | | | Date | Wed, 25 Jul 2018 16:34:11 -0700 | From | Omar Sandoval <> | Subject | Re: [PATCH v3 5/8] proc/kcore: hold lock during read |
| |
On Wed, Jul 25, 2018 at 12:11:26AM +0900, Tetsuo Handa wrote: > On 2018/07/19 7:58, Omar Sandoval wrote: > > From: Omar Sandoval <osandov@fb.com> > > > > Now that we're using an rwsem, we can hold it during the entirety of > > read_kcore() and have a common return path. This is preparation for the > > next change. > > > > Signed-off-by: Omar Sandoval <osandov@fb.com> > > --- > > fs/proc/kcore.c | 70 ++++++++++++++++++++++++++++--------------------- > > 1 file changed, 40 insertions(+), 30 deletions(-) > > > > diff --git a/fs/proc/kcore.c b/fs/proc/kcore.c > > index 95aa988c5b5d..e317ac890871 100644 > > --- a/fs/proc/kcore.c > > +++ b/fs/proc/kcore.c > > @@ -440,19 +440,18 @@ static ssize_t > > read_kcore(struct file *file, char __user *buffer, size_t buflen, loff_t *fpos) > > { > > char *buf = file->private_data; > > - ssize_t acc = 0; > > size_t size, tsz; > > size_t elf_buflen; > > int nphdr; > > unsigned long start; > > + size_t orig_buflen = buflen; > > + int ret = 0; > > > > down_read(&kclist_lock); > > (...snipped...) > > > +out: > > + up_write(&kclist_lock); > > Oops. This needs to be up_read().
Yeah, thanks, I'll fix this and rerun my tests with lockdep.
| |