]> rtime.felk.cvut.cz Git - socketcan-devel.git/commitdiff
Fixed possible NULL dereferencing in the failure of module load.
authorhartkopp <hartkopp@030b6a49-0b11-0410-94ab-b0dab22257f2>
Wed, 17 Oct 2007 18:15:29 +0000 (18:15 +0000)
committerhartkopp <hartkopp@030b6a49-0b11-0410-94ab-b0dab22257f2>
Wed, 17 Oct 2007 18:15:29 +0000 (18:15 +0000)
Thanks to Andre Naujoks for reporting this bug.

git-svn-id: svn://svn.berlios.de//socketcan/trunk@526 030b6a49-0b11-0410-94ab-b0dab22257f2

kernel/2.6/net/can/af_can.c

index 4dba508c06d560ab91026e6179568c9b7fec5373..b4dab440445a7e5495fa92a6b86f5d45a8efc64a 100644 (file)
@@ -213,8 +213,10 @@ static int can_create(struct socket *sock, int protocol)
 #endif
        spin_unlock(&proto_tab_lock);
 
-       /* check for success and correct type */
-       if (!cp || cp->type != sock->type) {
+       if (!cp)
+               return -EPROTONOSUPPORT;
+
+       if (cp->type != sock->type) {
                ret = -EPROTONOSUPPORT;
                goto errout;
        }