diff options
Diffstat (limited to 'fs/cifs/connect.c')
-rw-r--r-- | fs/cifs/connect.c | 81 |
1 files changed, 27 insertions, 54 deletions
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, |