Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=f50f95cab735ebe2993e8d1549f0615bad05f3f2
Commit:     f50f95cab735ebe2993e8d1549f0615bad05f3f2
Parent:     3663c306609a9322a484fba28b3da66142c50ee9
Author:     Vlad Yasevich <[EMAIL PROTECTED]>
AuthorDate: Tue Jul 3 12:47:40 2007 -0400
Committer:  David S. Miller <[EMAIL PROTECTED]>
CommitDate: Thu Jul 5 17:40:11 2007 -0700

    SCTP: Check to make sure file is valid before setting timeout
    
    In-kernel sockets created with sock_create_kern don't usually
    have a file and file descriptor allocated to them.  As a result,
    when SCTP tries to check the non-blocking flag, we Oops when
    dereferencing a NULL file pointer.
    
    Signed-off-by: Vlad Yasevich <[EMAIL PROTECTED]>
    Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
---
 net/sctp/socket.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 1e78827..b1917f6 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -980,6 +980,7 @@ static int __sctp_connect(struct sock* sk,
        union sctp_addr *sa_addr;
        void *addr_buf;
        unsigned short port;
+       unsigned int f_flags = 0;
 
        sp = sctp_sk(sk);
        ep = sp->ep;
@@ -1106,7 +1107,14 @@ static int __sctp_connect(struct sock* sk,
        af->to_sk_daddr(&to, sk);
        sk->sk_err = 0;
 
-       timeo = sock_sndtimeo(sk, sk->sk_socket->file->f_flags & O_NONBLOCK);
+       /* in-kernel sockets don't generally have a file allocated to them
+        * if all they do is call sock_create_kern().
+        */
+       if (sk->sk_socket->file)
+               f_flags = sk->sk_socket->file->f_flags;
+
+       timeo = sock_sndtimeo(sk, f_flags & O_NONBLOCK);
+
        err = sctp_wait_for_connect(asoc, &timeo);
 
        /* Don't free association on exit. */
-
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