aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/cifs')
-rw-r--r--fs/cifs/asn1.c3
-rw-r--r--fs/cifs/connect.c81
-rw-r--r--fs/cifs/link.c23
-rw-r--r--fs/cifs/misc.c15
-rw-r--r--fs/cifs/xattr.c15
5 files changed, 45 insertions, 92 deletions
diff --git a/fs/cifs/asn1.c b/fs/cifs/asn1.c
index 98539e2afe81..086ae8f4a207 100644
--- a/fs/cifs/asn1.c
+++ b/fs/cifs/asn1.c
@@ -553,8 +553,7 @@ decode_negTokenInit(unsigned char *security_blob, int length,
553 *(oid + 3))); 553 *(oid + 3)));
554 rc = compare_oid(oid, oidlen, NTLMSSP_OID, 554 rc = compare_oid(oid, oidlen, NTLMSSP_OID,
555 NTLMSSP_OID_LEN); 555 NTLMSSP_OID_LEN);
556 if(oid) 556 kfree(oid);
557 kfree(oid);
558 if (rc) 557 if (rc)
559 use_ntlmssp = TRUE; 558 use_ntlmssp = TRUE;
560 } 559 }
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index d74367a08d51..450ab75d6546 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -1265,8 +1265,7 @@ connect_to_dfs_path(int xid, struct cifsSesInfo *pSesInfo,
1265 the helper that resolves tcp names, mount to it, try to 1265 the helper that resolves tcp names, mount to it, try to
1266 tcon to it unmount it if fail */ 1266 tcon to it unmount it if fail */
1267 1267
1268 if(referrals) 1268 kfree(referrals);
1269 kfree(referrals);
1270 1269
1271 return rc; 1270 return rc;
1272} 1271}
@@ -1535,10 +1534,8 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
1535 1534
1536 memset(&volume_info,0,sizeof(struct smb_vol)); 1535 memset(&volume_info,0,sizeof(struct smb_vol));
1537 if (cifs_parse_mount_options(mount_data, devname, &volume_info)) { 1536 if (cifs_parse_mount_options(mount_data, devname, &volume_info)) {
1538 if(volume_info.UNC) 1537 kfree(volume_info.UNC);
1539 kfree(volume_info.UNC); 1538 kfree(volume_info.password);
1540 if(volume_info.password)
1541 kfree(volume_info.password);
1542 FreeXid(xid); 1539 FreeXid(xid);
1543 return -EINVAL; 1540 return -EINVAL;
1544 } 1541 }
@@ -1551,10 +1548,8 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
1551 cifserror("No username specified "); 1548 cifserror("No username specified ");
1552 /* In userspace mount helper we can get user name from alternate 1549 /* In userspace mount helper we can get user name from alternate
1553 locations such as env variables and files on disk */ 1550 locations such as env variables and files on disk */
1554 if(volume_info.UNC) 1551 kfree(volume_info.UNC);
1555 kfree(volume_info.UNC); 1552 kfree(volume_info.password);
1556 if(volume_info.password)
1557 kfree(volume_info.password);
1558 FreeXid(xid); 1553 FreeXid(xid);
1559 return -EINVAL; 1554 return -EINVAL;
1560 } 1555 }
@@ -1573,10 +1568,8 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
1573 1568
1574 if(rc <= 0) { 1569 if(rc <= 0) {
1575 /* we failed translating address */ 1570 /* we failed translating address */
1576 if(volume_info.UNC) 1571 kfree(volume_info.UNC);
1577 kfree(volume_info.UNC); 1572 kfree(volume_info.password);
1578 if(volume_info.password)
1579 kfree(volume_info.password);
1580 FreeXid(xid); 1573 FreeXid(xid);
1581 return -EINVAL; 1574 return -EINVAL;
1582 } 1575 }
@@ -1587,19 +1580,15 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
1587 } else if (volume_info.UNCip){ 1580 } else if (volume_info.UNCip){
1588 /* BB using ip addr as server name connect to the DFS root below */ 1581 /* BB using ip addr as server name connect to the DFS root below */
1589 cERROR(1,("Connecting to DFS root not implemented yet")); 1582 cERROR(1,("Connecting to DFS root not implemented yet"));
1590 if(volume_info.UNC) 1583 kfree(volume_info.UNC);
1591 kfree(volume_info.UNC); 1584 kfree(volume_info.password);
1592 if(volume_info.password)
1593 kfree(volume_info.password);
1594 FreeXid(xid); 1585 FreeXid(xid);
1595 return -EINVAL; 1586 return -EINVAL;
1596 } else /* which servers DFS root would we conect to */ { 1587 } else /* which servers DFS root would we conect to */ {
1597 cERROR(1, 1588 cERROR(1,
1598 ("CIFS mount error: No UNC path (e.g. -o unc=//192.168.1.100/public) specified ")); 1589 ("CIFS mount error: No UNC path (e.g. -o unc=//192.168.1.100/public) specified "));
1599 if(volume_info.UNC) 1590 kfree(volume_info.UNC);
1600 kfree(volume_info.UNC); 1591 kfree(volume_info.password);
1601 if(volume_info.password)
1602 kfree(volume_info.password);
1603 FreeXid(xid); 1592 FreeXid(xid);
1604 return -EINVAL; 1593 return -EINVAL;
1605 } 1594 }
@@ -1612,10 +1601,8 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
1612 cifs_sb->local_nls = load_nls(volume_info.iocharset); 1601 cifs_sb->local_nls = load_nls(volume_info.iocharset);
1613 if(cifs_sb->local_nls == NULL) { 1602 if(cifs_sb->local_nls == NULL) {
1614 cERROR(1,("CIFS mount error: iocharset %s not found",volume_info.iocharset)); 1603 cERROR(1,("CIFS mount error: iocharset %s not found",volume_info.iocharset));
1615 if(volume_info.UNC) 1604 kfree(volume_info.UNC);
1616 kfree(volume_info.UNC); 1605 kfree(volume_info.password);
1617 if(volume_info.password)
1618 kfree(volume_info.password);
1619 FreeXid(xid); 1606 FreeXid(xid);
1620 return -ELIBACC; 1607 return -ELIBACC;
1621 } 1608 }
@@ -1630,10 +1617,8 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
1630 &sin_server6.sin6_addr, 1617 &sin_server6.sin6_addr,
1631 volume_info.username, &srvTcp); 1618 volume_info.username, &srvTcp);
1632 else { 1619 else {
1633 if(volume_info.UNC) 1620 kfree(volume_info.UNC);
1634 kfree(volume_info.UNC); 1621 kfree(volume_info.password);
1635 if(volume_info.password)
1636 kfree(volume_info.password);
1637 FreeXid(xid); 1622 FreeXid(xid);
1638 return -EINVAL; 1623 return -EINVAL;
1639 } 1624 }
@@ -1654,10 +1639,8 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
1654 ("Error connecting to IPv4 socket. Aborting operation")); 1639 ("Error connecting to IPv4 socket. Aborting operation"));
1655 if(csocket != NULL) 1640 if(csocket != NULL)
1656 sock_release(csocket); 1641 sock_release(csocket);
1657 if(volume_info.UNC) 1642 kfree(volume_info.UNC);
1658 kfree(volume_info.UNC); 1643 kfree(volume_info.password);
1659 if(volume_info.password)
1660 kfree(volume_info.password);
1661 FreeXid(xid); 1644 FreeXid(xid);
1662 return rc; 1645 return rc;
1663 } 1646 }
@@ -1666,10 +1649,8 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
1666 if (srvTcp == NULL) { 1649 if (srvTcp == NULL) {
1667 rc = -ENOMEM; 1650 rc = -ENOMEM;
1668 sock_release(csocket); 1651 sock_release(csocket);
1669 if(volume_info.UNC) 1652 kfree(volume_info.UNC);
1670 kfree(volume_info.UNC); 1653 kfree(volume_info.password);
1671 if(volume_info.password)
1672 kfree(volume_info.password);
1673 FreeXid(xid); 1654 FreeXid(xid);
1674 return rc; 1655 return rc;
1675 } else { 1656 } else {
@@ -1692,10 +1673,8 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
1692 if(rc < 0) { 1673 if(rc < 0) {
1693 rc = -ENOMEM; 1674 rc = -ENOMEM;
1694 sock_release(csocket); 1675 sock_release(csocket);
1695 if(volume_info.UNC) 1676 kfree(volume_info.UNC);
1696 kfree(volume_info.UNC); 1677 kfree(volume_info.password);
1697 if(volume_info.password)
1698 kfree(volume_info.password);
1699 FreeXid(xid); 1678 FreeXid(xid);
1700 return rc; 1679 return rc;
1701 } 1680 }
@@ -1710,8 +1689,7 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
1710 if (existingCifsSes) { 1689 if (existingCifsSes) {
1711 pSesInfo = existingCifsSes; 1690 pSesInfo = existingCifsSes;
1712 cFYI(1, ("Existing smb sess found ")); 1691 cFYI(1, ("Existing smb sess found "));
1713 if(volume_info.password) 1692 kfree(volume_info.password);
1714 kfree(volume_info.password);
1715 /* volume_info.UNC freed at end of function */ 1693 /* volume_info.UNC freed at end of function */
1716 } else if (!rc) { 1694 } else if (!rc) {
1717 cFYI(1, ("Existing smb sess not found ")); 1695 cFYI(1, ("Existing smb sess not found "));
@@ -1741,8 +1719,7 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
1741 if(!rc) 1719 if(!rc)
1742 atomic_inc(&srvTcp->socketUseCount); 1720 atomic_inc(&srvTcp->socketUseCount);
1743 } else 1721 } else
1744 if(volume_info.password) 1722 kfree(volume_info.password);
1745 kfree(volume_info.password);
1746 } 1723 }
1747 1724
1748 /* search for existing tcon to this server share */ 1725 /* search for existing tcon to this server share */
@@ -1821,8 +1798,7 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
1821 "", cifs_sb->local_nls, 1798 "", cifs_sb->local_nls,
1822 cifs_sb->mnt_cifs_flags & 1799 cifs_sb->mnt_cifs_flags &
1823 CIFS_MOUNT_MAP_SPECIAL_CHR); 1800 CIFS_MOUNT_MAP_SPECIAL_CHR);
1824 if(volume_info.UNC) 1801 kfree(volume_info.UNC);
1825 kfree(volume_info.UNC);
1826 FreeXid(xid); 1802 FreeXid(xid);
1827 return -ENODEV; 1803 return -ENODEV;
1828 } else { 1804 } else {
@@ -1925,8 +1901,7 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
1925 (in which case it is not needed anymore) but when new sesion is created 1901 (in which case it is not needed anymore) but when new sesion is created
1926 the password ptr is put in the new session structure (in which case the 1902 the password ptr is put in the new session structure (in which case the
1927 password will be freed at unmount time) */ 1903 password will be freed at unmount time) */
1928 if(volume_info.UNC) 1904 kfree(volume_info.UNC);
1929 kfree(volume_info.UNC);
1930 FreeXid(xid); 1905 FreeXid(xid);
1931 return rc; 1906 return rc;
1932} 1907}
@@ -3283,8 +3258,7 @@ CIFSTCon(unsigned int xid, struct cifsSesInfo *ses,
3283 if ((bcc_ptr + (2 * length)) - 3258 if ((bcc_ptr + (2 * length)) -
3284 pByteArea(smb_buffer_response) <= 3259 pByteArea(smb_buffer_response) <=
3285 BCC(smb_buffer_response)) { 3260 BCC(smb_buffer_response)) {
3286 if(tcon->nativeFileSystem) 3261 kfree(tcon->nativeFileSystem);
3287 kfree(tcon->nativeFileSystem);
3288 tcon->nativeFileSystem = 3262 tcon->nativeFileSystem =
3289 kzalloc(length + 2, GFP_KERNEL); 3263 kzalloc(length + 2, GFP_KERNEL);
3290 cifs_strfromUCS_le(tcon->nativeFileSystem, 3264 cifs_strfromUCS_le(tcon->nativeFileSystem,
@@ -3301,8 +3275,7 @@ CIFSTCon(unsigned int xid, struct cifsSesInfo *ses,
3301 if ((bcc_ptr + length) - 3275 if ((bcc_ptr + length) -
3302 pByteArea(smb_buffer_response) <= 3276 pByteArea(smb_buffer_response) <=
3303 BCC(smb_buffer_response)) { 3277 BCC(smb_buffer_response)) {
3304 if(tcon->nativeFileSystem) 3278 kfree(tcon->nativeFileSystem);
3305 kfree(tcon->nativeFileSystem);
3306 tcon->nativeFileSystem = 3279 tcon->nativeFileSystem =
3307 kzalloc(length + 1, GFP_KERNEL); 3280 kzalloc(length + 1, GFP_KERNEL);
3308 strncpy(tcon->nativeFileSystem, bcc_ptr, 3281 strncpy(tcon->nativeFileSystem, bcc_ptr,
diff --git a/fs/cifs/link.c b/fs/cifs/link.c
index b43e071fe110..0f99aae33162 100644
--- a/fs/cifs/link.c
+++ b/fs/cifs/link.c
@@ -84,10 +84,8 @@ cifs_hardlink(struct dentry *old_file, struct inode *inode,
84 cifsInode->time = 0; /* will force revalidate to go get info when needed */ 84 cifsInode->time = 0; /* will force revalidate to go get info when needed */
85 85
86cifs_hl_exit: 86cifs_hl_exit:
87 if (fromName) 87 kfree(fromName);
88 kfree(fromName); 88 kfree(toName);
89 if (toName)
90 kfree(toName);
91 FreeXid(xid); 89 FreeXid(xid);
92 return rc; 90 return rc;
93} 91}
@@ -206,8 +204,7 @@ cifs_symlink(struct inode *inode, struct dentry *direntry, const char *symname)
206 } 204 }
207 } 205 }
208 206
209 if (full_path) 207 kfree(full_path);
210 kfree(full_path);
211 FreeXid(xid); 208 FreeXid(xid);
212 return rc; 209 return rc;
213} 210}
@@ -253,8 +250,7 @@ cifs_readlink(struct dentry *direntry, char __user *pBuffer, int buflen)
253 len = buflen; 250 len = buflen;
254 tmpbuffer = kmalloc(len,GFP_KERNEL); 251 tmpbuffer = kmalloc(len,GFP_KERNEL);
255 if(tmpbuffer == NULL) { 252 if(tmpbuffer == NULL) {
256 if (full_path) 253 kfree(full_path);
257 kfree(full_path);
258 FreeXid(xid); 254 FreeXid(xid);
259 return -ENOMEM; 255 return -ENOMEM;
260 } 256 }
@@ -303,8 +299,7 @@ cifs_readlink(struct dentry *direntry, char __user *pBuffer, int buflen)
303 strncpy(tmpbuffer, referrals, len-1); 299 strncpy(tmpbuffer, referrals, len-1);
304 } 300 }
305 } 301 }
306 if(referrals) 302 kfree(referrals);
307 kfree(referrals);
308 kfree(tmp_path); 303 kfree(tmp_path);
309} 304}
310 /* BB add code like else decode referrals then memcpy to 305 /* BB add code like else decode referrals then memcpy to
@@ -323,12 +318,8 @@ cifs_readlink(struct dentry *direntry, char __user *pBuffer, int buflen)
323 rc)); 318 rc));
324 } 319 }
325 320
326 if (tmpbuffer) { 321 kfree(tmpbuffer);
327 kfree(tmpbuffer); 322 kfree(full_path);
328 }
329 if (full_path) {
330 kfree(full_path);
331 }
332 FreeXid(xid); 323 FreeXid(xid);
333 return rc; 324 return rc;
334} 325}
diff --git a/fs/cifs/misc.c b/fs/cifs/misc.c
index eba1de917f2a..34a06692e4fa 100644
--- a/fs/cifs/misc.c
+++ b/fs/cifs/misc.c
@@ -98,14 +98,10 @@ sesInfoFree(struct cifsSesInfo *buf_to_free)
98 atomic_dec(&sesInfoAllocCount); 98 atomic_dec(&sesInfoAllocCount);
99 list_del(&buf_to_free->cifsSessionList); 99 list_del(&buf_to_free->cifsSessionList);
100 write_unlock(&GlobalSMBSeslock); 100 write_unlock(&GlobalSMBSeslock);
101 if (buf_to_free->serverOS) 101 kfree(buf_to_free->serverOS);
102 kfree(buf_to_free->serverOS); 102 kfree(buf_to_free->serverDomain);
103 if (buf_to_free->serverDomain) 103 kfree(buf_to_free->serverNOS);
104 kfree(buf_to_free->serverDomain); 104 kfree(buf_to_free->password);
105 if (buf_to_free->serverNOS)
106 kfree(buf_to_free->serverNOS);
107 if (buf_to_free->password)
108 kfree(buf_to_free->password);
109 kfree(buf_to_free); 105 kfree(buf_to_free);
110} 106}
111 107
@@ -144,8 +140,7 @@ tconInfoFree(struct cifsTconInfo *buf_to_free)
144 atomic_dec(&tconInfoAllocCount); 140 atomic_dec(&tconInfoAllocCount);
145 list_del(&buf_to_free->cifsConnectionList); 141 list_del(&buf_to_free->cifsConnectionList);
146 write_unlock(&GlobalSMBSeslock); 142 write_unlock(&GlobalSMBSeslock);
147 if (buf_to_free->nativeFileSystem) 143 kfree(buf_to_free->nativeFileSystem);
148 kfree(buf_to_free->nativeFileSystem);
149 kfree(buf_to_free); 144 kfree(buf_to_free);
150} 145}
151 146
diff --git a/fs/cifs/xattr.c b/fs/cifs/xattr.c
index c1e02eff1d25..f375f87c7dbd 100644
--- a/fs/cifs/xattr.c
+++ b/fs/cifs/xattr.c
@@ -87,8 +87,7 @@ int cifs_removexattr(struct dentry * direntry, const char * ea_name)
87 cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); 87 cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
88 } 88 }
89remove_ea_exit: 89remove_ea_exit:
90 if (full_path) 90 kfree(full_path);
91 kfree(full_path);
92 FreeXid(xid); 91 FreeXid(xid);
93#endif 92#endif
94 return rc; 93 return rc;
@@ -132,8 +131,7 @@ int cifs_setxattr(struct dentry * direntry, const char * ea_name,
132 returns as xattrs */ 131 returns as xattrs */
133 if(value_size > MAX_EA_VALUE_SIZE) { 132 if(value_size > MAX_EA_VALUE_SIZE) {
134 cFYI(1,("size of EA value too large")); 133 cFYI(1,("size of EA value too large"));
135 if(full_path) 134 kfree(full_path);
136 kfree(full_path);
137 FreeXid(xid); 135 FreeXid(xid);
138 return -EOPNOTSUPP; 136 return -EOPNOTSUPP;
139 } 137 }
@@ -195,8 +193,7 @@ int cifs_setxattr(struct dentry * direntry, const char * ea_name,
195 } 193 }
196 194
197set_ea_exit: 195set_ea_exit:
198 if (full_path) 196 kfree(full_path);
199 kfree(full_path);
200 FreeXid(xid); 197 FreeXid(xid);
201#endif 198#endif
202 return rc; 199 return rc;
@@ -298,8 +295,7 @@ ssize_t cifs_getxattr(struct dentry * direntry, const char * ea_name,
298 rc = -EOPNOTSUPP; 295 rc = -EOPNOTSUPP;
299 296
300get_ea_exit: 297get_ea_exit:
301 if (full_path) 298 kfree(full_path);
302 kfree(full_path);
303 FreeXid(xid); 299 FreeXid(xid);
304#endif 300#endif
305 return rc; 301 return rc;
@@ -345,8 +341,7 @@ ssize_t cifs_listxattr(struct dentry * direntry, char * data, size_t buf_size)
345 cifs_sb->mnt_cifs_flags & 341 cifs_sb->mnt_cifs_flags &
346 CIFS_MOUNT_MAP_SPECIAL_CHR); 342 CIFS_MOUNT_MAP_SPECIAL_CHR);
347 343
348 if (full_path) 344 kfree(full_path);
349 kfree(full_path);
350 FreeXid(xid); 345 FreeXid(xid);
351#endif 346#endif
352 return rc; 347 return rc;