Skip to content

Commit 086486e

Browse files
committed
Merge branch 'for-linus' of git://git.samba.org/sfrench/cifs-2.6
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
2 parents a95251b + c772aa9 commit 086486e

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

fs/cifs/file.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1794,7 +1794,6 @@ static int cifs_writepages(struct address_space *mapping,
17941794
struct TCP_Server_Info *server;
17951795
struct page *page;
17961796
int rc = 0;
1797-
loff_t isize = i_size_read(mapping->host);
17981797

17991798
/*
18001799
* If wsize is smaller than the page cache size, default to writing
@@ -1899,7 +1898,7 @@ static int cifs_writepages(struct address_space *mapping,
18991898
*/
19001899
set_page_writeback(page);
19011900

1902-
if (page_offset(page) >= isize) {
1901+
if (page_offset(page) >= i_size_read(mapping->host)) {
19031902
done = true;
19041903
unlock_page(page);
19051904
end_page_writeback(page);
@@ -1932,7 +1931,8 @@ static int cifs_writepages(struct address_space *mapping,
19321931
wdata->offset = page_offset(wdata->pages[0]);
19331932
wdata->pagesz = PAGE_CACHE_SIZE;
19341933
wdata->tailsz =
1935-
min(isize - page_offset(wdata->pages[nr_pages - 1]),
1934+
min(i_size_read(mapping->host) -
1935+
page_offset(wdata->pages[nr_pages - 1]),
19361936
(loff_t)PAGE_CACHE_SIZE);
19371937
wdata->bytes = ((nr_pages - 1) * PAGE_CACHE_SIZE) +
19381938
wdata->tailsz;

fs/cifs/smb1ops.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -766,7 +766,6 @@ smb_set_file_info(struct inode *inode, const char *full_path,
766766
struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
767767
struct tcon_link *tlink = NULL;
768768
struct cifs_tcon *tcon;
769-
FILE_BASIC_INFO info_buf;
770769

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

819818
set_via_filehandle:
820-
rc = CIFSSMBSetFileInfo(xid, tcon, &info_buf, netfid, netpid);
819+
rc = CIFSSMBSetFileInfo(xid, tcon, buf, netfid, netpid);
821820
if (!rc)
822821
cinode->cifsAttrs = le32_to_cpu(buf->Attributes);
823822

0 commit comments

Comments
 (0)