diff options
author | David Disseldorp <ddiss@suse.de> | 2017-10-20 08:49:37 -0400 |
---|---|---|
committer | Steve French <smfrench@gmail.com> | 2017-10-25 14:02:59 -0400 |
commit | fe83bebc05228e838ed5cbbc62712ab50dd40e18 (patch) | |
tree | 692d2e3bfdc526c029c0e2f1c81240e52ee4abb4 | |
parent | db3b5474f462e77b82ca1e27627f03c47b622c99 (diff) |
SMB: fix leak of validate negotiate info response buffer
Fixes: ff1c038addc4 ("Check SMB3 dialects against downgrade attacks")
Signed-off-by: David Disseldorp <ddiss@suse.de>
Signed-off-by: Steve French <smfrench@gmail.com>
-rw-r--r-- | fs/cifs/smb2pdu.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c index 3efcd96b52c5..6b03e2d45d8e 100644 --- a/fs/cifs/smb2pdu.c +++ b/fs/cifs/smb2pdu.c | |||
@@ -648,7 +648,7 @@ int smb3_validate_negotiate(const unsigned int xid, struct cifs_tcon *tcon) | |||
648 | { | 648 | { |
649 | int rc = 0; | 649 | int rc = 0; |
650 | struct validate_negotiate_info_req vneg_inbuf; | 650 | struct validate_negotiate_info_req vneg_inbuf; |
651 | struct validate_negotiate_info_rsp *pneg_rsp; | 651 | struct validate_negotiate_info_rsp *pneg_rsp = NULL; |
652 | u32 rsplen; | 652 | u32 rsplen; |
653 | u32 inbuflen; /* max of 4 dialects */ | 653 | u32 inbuflen; /* max of 4 dialects */ |
654 | 654 | ||
@@ -728,7 +728,7 @@ int smb3_validate_negotiate(const unsigned int xid, struct cifs_tcon *tcon) | |||
728 | 728 | ||
729 | /* relax check since Mac returns max bufsize allowed on ioctl */ | 729 | /* relax check since Mac returns max bufsize allowed on ioctl */ |
730 | if (rsplen > CIFSMaxBufSize) | 730 | if (rsplen > CIFSMaxBufSize) |
731 | return -EIO; | 731 | goto err_rsp_free; |
732 | } | 732 | } |
733 | 733 | ||
734 | /* check validate negotiate info response matches what we got earlier */ | 734 | /* check validate negotiate info response matches what we got earlier */ |
@@ -747,10 +747,13 @@ int smb3_validate_negotiate(const unsigned int xid, struct cifs_tcon *tcon) | |||
747 | 747 | ||
748 | /* validate negotiate successful */ | 748 | /* validate negotiate successful */ |
749 | cifs_dbg(FYI, "validate negotiate info successful\n"); | 749 | cifs_dbg(FYI, "validate negotiate info successful\n"); |
750 | kfree(pneg_rsp); | ||
750 | return 0; | 751 | return 0; |
751 | 752 | ||
752 | vneg_out: | 753 | vneg_out: |
753 | cifs_dbg(VFS, "protocol revalidation - security settings mismatch\n"); | 754 | cifs_dbg(VFS, "protocol revalidation - security settings mismatch\n"); |
755 | err_rsp_free: | ||
756 | kfree(pneg_rsp); | ||
754 | return -EIO; | 757 | return -EIO; |
755 | } | 758 | } |
756 | 759 | ||