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: <a4e6962a0702161428p240ab9acwd0a384dedd1b99e6@mail.gmail.com>
Date:	Fri, 16 Feb 2007 16:28:31 -0600
From:	"Eric Van Hensbergen" <ericvh@...il.com>
To:	"Andrew Morton" <akpm@...ux-foundation.org>
Cc:	linux-kernel@...r.kernel.org, v9fs-developer@...ts.sourceforge.net
Subject: Re: [PATCH] 9p: add write-cache support to loose cache mode (take 3)

On 2/16/07, Andrew Morton <akpm@...ux-foundation.org> wrote:
> On Fri, 16 Feb 2007 09:37:01 -0600 Eric Van Hensbergen <ericvh@...il.com> wrote:
>
> > +static int v9fs_vfs_writepage(struct page *page, struct writeback_control *wbc)
> > +{
> > +     char *buffer = NULL;
> > +     struct address_space *mapping = page->mapping;
> > +     int retval = -EIO;
> > +     loff_t offset = 0;
> > +     pgoff_t end_index;
> > +     int count = PAGE_CACHE_SIZE;
> > +     struct file *filp = v9fs_find_file(page);
> > +     struct inode *inode = mapping->host;
> > +
> > +     dprintk(DEBUG_VFS, "page: %p\n", page);
> > +
> > +     if ((!inode) || (!filp))
> > +             goto UnlockPage;
> > +
> > +     end_index = inode->i_size >> PAGE_CACHE_SHIFT;
> > +
> > +     /* complicated case at end of file */
> > +     if (page->index >= end_index) {
> > +             /* things got complicated... */
> > +             count = inode->i_size & (PAGE_CACHE_SIZE - 1);
> > +             if (page->index >= end_index + 1 || !count)
> > +                     return 0;       /* truncated - don't care */
> > +     }
> > +
> > +     buffer = kmap(page);
> > +     offset = ((loff_t) page->index << PAGE_CACHE_SHIFT);
> > +     page_cache_get(page);
> > +     retval = v9fs_write(filp, NULL, buffer, count, &offset);
> > +
> >       kunmap(page);
> > +
> > +      UnlockPage:
> >       unlock_page(page);
> > +     page_cache_release(page);
> > +
> >       return retval;
> >  }
>
> The page_cache_get/release here aren't needed: lock_page suffices.
>
> Are you sure the page refcounting is right if the `goto UnlockPage'
> happens?
>
> Can that goto actually happen??
>

It shouldn't, if it does we are probably in big trouble anyways.  I'll
pull it out.  Thanks.

                  -eric
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ