Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=fe979ac169970b3d12facd6565766735862395c5
Commit:     fe979ac169970b3d12facd6565766735862395c5
Parent:     8b35805693e1915829355723537f99f1b8bc9cc0
Author:     Vlad Yasevich <[EMAIL PROTECTED]>
AuthorDate: Wed May 23 11:11:37 2007 -0400
Committer:  Vladislav Yasevich <[EMAIL PROTECTED]>
CommitDate: Wed Jun 13 20:44:41 2007 +0000

    [SCTP] Fix leak in sctp_getsockopt_local_addrs when copy_to_user fails
    
    If the copy_to_user or copy_user calls fail in 
sctp_getsockopt_local_addrs(),
    the function should free locally allocated storage before returning error.
    Spotted by Coverity.
    
    Signed-off-by: Vlad Yasevich <[EMAIL PROTECTED]>
    Acked-by: Sridhar Samudrala <[EMAIL PROTECTED]>
---
 net/sctp/socket.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index a5b6e55..45510c4 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -4352,11 +4352,12 @@ copy_getaddrs:
                err = -EFAULT;
                goto error;
        }
-       if (put_user(cnt, &((struct sctp_getaddrs __user *)optval)->addr_num))
-               return -EFAULT;
+       if (put_user(cnt, &((struct sctp_getaddrs __user *)optval)->addr_num)) {
+               err = -EFAULT;
+               goto error;
+       }
        if (put_user(bytes_copied, optlen))
-               return -EFAULT;
-
+               err = -EFAULT;
 error:
        kfree(addrs);
        return err;
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to