Skip to content

Commit

Permalink
Merge branch 'for-linus' of git://git.samba.org/sfrench/cifs-2.6
Browse files Browse the repository at this point in the history
Pull CIFS fixes from Steve French:
 "Two low risk, small fixes, that fix cifs regressions introduced in
  3.7."

* 'for-linus' of git://git.samba.org/sfrench/cifs-2.6:
  CIFS: Fix wrong buffer pointer usage in smb_set_file_info
  cifs: fix writeback race with file that is growing
  • Loading branch information
Linus Torvalds committed Dec 1, 2012
2 parents a95251b + c772aa9 commit 086486e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
6 changes: 3 additions & 3 deletions fs/cifs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -1794,7 +1794,6 @@ static int cifs_writepages(struct address_space *mapping,
struct TCP_Server_Info *server;
struct page *page;
int rc = 0;
loff_t isize = i_size_read(mapping->host);

/*
* If wsize is smaller than the page cache size, default to writing
Expand Down Expand Up @@ -1899,7 +1898,7 @@ static int cifs_writepages(struct address_space *mapping,
*/
set_page_writeback(page);

if (page_offset(page) >= isize) {
if (page_offset(page) >= i_size_read(mapping->host)) {
done = true;
unlock_page(page);
end_page_writeback(page);
Expand Down Expand Up @@ -1932,7 +1931,8 @@ static int cifs_writepages(struct address_space *mapping,
wdata->offset = page_offset(wdata->pages[0]);
wdata->pagesz = PAGE_CACHE_SIZE;
wdata->tailsz =
min(isize - page_offset(wdata->pages[nr_pages - 1]),
min(i_size_read(mapping->host) -
page_offset(wdata->pages[nr_pages - 1]),
(loff_t)PAGE_CACHE_SIZE);
wdata->bytes = ((nr_pages - 1) * PAGE_CACHE_SIZE) +
wdata->tailsz;
Expand Down
3 changes: 1 addition & 2 deletions fs/cifs/smb1ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,6 @@ smb_set_file_info(struct inode *inode, const char *full_path,
struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
struct tcon_link *tlink = NULL;
struct cifs_tcon *tcon;
FILE_BASIC_INFO info_buf;

/* if the file is already open for write, just use that fileid */
open_file = find_writable_file(cinode, true);
Expand Down Expand Up @@ -817,7 +816,7 @@ smb_set_file_info(struct inode *inode, const char *full_path,
netpid = current->tgid;

set_via_filehandle:
rc = CIFSSMBSetFileInfo(xid, tcon, &info_buf, netfid, netpid);
rc = CIFSSMBSetFileInfo(xid, tcon, buf, netfid, netpid);
if (!rc)
cinode->cifsAttrs = le32_to_cpu(buf->Attributes);

Expand Down

0 comments on commit 086486e

Please sign in to comment.