Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag '5.1-rc6-smb3-fixes' of git://git.samba.org/sfrench/cifs-2.6

Pull cifs fixes from Steve French:
"Three small SMB3 fixes (all for stable as well): two leaks and a
rename bug"

* tag '5.1-rc6-smb3-fixes' of git://git.samba.org/sfrench/cifs-2.6:
cifs: fix page reference leak with readv/writev
cifs: do not attempt cifs operation on smb2+ rename error
cifs: fix memory leak in SMB2_read

+28 -15
+1 -14
fs/cifs/file.c
··· 2877 2877 struct cifs_tcon *tcon; 2878 2878 struct cifs_sb_info *cifs_sb; 2879 2879 struct dentry *dentry = ctx->cfile->dentry; 2880 - unsigned int i; 2881 2880 int rc; 2882 2881 2883 2882 tcon = tlink_tcon(ctx->cfile->tlink); ··· 2939 2940 list_del_init(&wdata->list); 2940 2941 kref_put(&wdata->refcount, cifs_uncached_writedata_release); 2941 2942 } 2942 - 2943 - if (!ctx->direct_io) 2944 - for (i = 0; i < ctx->npages; i++) 2945 - put_page(ctx->bv[i].bv_page); 2946 2943 2947 2944 cifs_stats_bytes_written(tcon, ctx->total_len); 2948 2945 set_bit(CIFS_INO_INVALID_MAPPING, &CIFS_I(dentry->d_inode)->flags); ··· 3577 3582 struct iov_iter *to = &ctx->iter; 3578 3583 struct cifs_sb_info *cifs_sb; 3579 3584 struct cifs_tcon *tcon; 3580 - unsigned int i; 3581 3585 int rc; 3582 3586 3583 3587 tcon = tlink_tcon(ctx->cfile->tlink); ··· 3660 3666 kref_put(&rdata->refcount, cifs_uncached_readdata_release); 3661 3667 } 3662 3668 3663 - if (!ctx->direct_io) { 3664 - for (i = 0; i < ctx->npages; i++) { 3665 - if (ctx->should_dirty) 3666 - set_page_dirty(ctx->bv[i].bv_page); 3667 - put_page(ctx->bv[i].bv_page); 3668 - } 3669 - 3669 + if (!ctx->direct_io) 3670 3670 ctx->total_len = ctx->len - iov_iter_count(to); 3671 - } 3672 3671 3673 3672 /* mask nodata case */ 3674 3673 if (rc == -ENODATA)
+4
fs/cifs/inode.c
··· 1735 1735 if (rc == 0 || rc != -EBUSY) 1736 1736 goto do_rename_exit; 1737 1737 1738 + /* Don't fall back to using SMB on SMB 2+ mount */ 1739 + if (server->vals->protocol_id != 0) 1740 + goto do_rename_exit; 1741 + 1738 1742 /* open-file renames don't work across directories */ 1739 1743 if (to_dentry->d_parent != from_dentry->d_parent) 1740 1744 goto do_rename_exit;
+22 -1
fs/cifs/misc.c
··· 789 789 { 790 790 struct cifs_aio_ctx *ctx; 791 791 792 + /* 793 + * Must use kzalloc to initialize ctx->bv to NULL and ctx->direct_io 794 + * to false so that we know when we have to unreference pages within 795 + * cifs_aio_ctx_release() 796 + */ 792 797 ctx = kzalloc(sizeof(struct cifs_aio_ctx), GFP_KERNEL); 793 798 if (!ctx) 794 799 return NULL; ··· 812 807 struct cifs_aio_ctx, refcount); 813 808 814 809 cifsFileInfo_put(ctx->cfile); 815 - kvfree(ctx->bv); 810 + 811 + /* 812 + * ctx->bv is only set if setup_aio_ctx_iter() was call successfuly 813 + * which means that iov_iter_get_pages() was a success and thus that 814 + * we have taken reference on pages. 815 + */ 816 + if (ctx->bv) { 817 + unsigned i; 818 + 819 + for (i = 0; i < ctx->npages; i++) { 820 + if (ctx->should_dirty) 821 + set_page_dirty(ctx->bv[i].bv_page); 822 + put_page(ctx->bv[i].bv_page); 823 + } 824 + kvfree(ctx->bv); 825 + } 826 + 816 827 kfree(ctx); 817 828 } 818 829
+1
fs/cifs/smb2pdu.c
··· 3466 3466 io_parms->tcon->tid, ses->Suid, 3467 3467 io_parms->offset, 0); 3468 3468 free_rsp_buf(resp_buftype, rsp_iov.iov_base); 3469 + cifs_small_buf_release(req); 3469 3470 return rc == -ENODATA ? 0 : rc; 3470 3471 } else 3471 3472 trace_smb3_read_done(xid, req->PersistentFileId,