CIFS: Fix error handling in cifs_readv_complete
authorPavel Shilovsky <piastry@etersoft.ru>
Fri, 21 Oct 2011 06:14:04 +0000 (10:14 +0400)
committerSteve French <smfrench@gmail.com>
Fri, 21 Oct 2011 14:21:04 +0000 (09:21 -0500)
In cifs_readv_receive we don't update rdata->result to error value
after kmap'ing a page. We should kunmap the page in the no error
case only.

Signed-off-by: Pavel Shilovsky <piastry@etersoft.ru>
Reviewed-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <smfrench@gmail.com>
fs/cifs/cifssmb.c

index aaad4ce6e6c543c5e6164fe70f8568590a11d505..4435b11c41b93358b7727bb8492c5c4411e07ea7 100644 (file)
@@ -1619,9 +1619,9 @@ cifs_readv_complete(struct work_struct *work)
        list_for_each_entry_safe(page, tpage, &rdata->pages, lru) {
                list_del(&page->lru);
                lru_cache_add_file(page);
-               kunmap(page);
 
                if (rdata->result == 0) {
+                       kunmap(page);
                        flush_dcache_page(page);
                        SetPageUptodate(page);
                }