ppp, slip: Validate VJ compression slot parameters completely
[pandora-kernel.git] / drivers / isdn / i4l / isdn_ppp.c
index 1b002b0..3604aa7 100644 (file)
@@ -301,6 +301,8 @@ isdn_ppp_open(int min, struct file *file)
        is->compflags = 0;
 
        is->reset = isdn_ppp_ccp_reset_alloc(is);
+       if (!is->reset)
+               return -ENOMEM;
 
        is->lp = NULL;
        is->mp_seqno = 0;       /* MP sequence number */
@@ -320,6 +322,10 @@ isdn_ppp_open(int min, struct file *file)
         * VJ header compression init
         */
        is->slcomp = slhc_init(16, 16); /* not necessary for 2. link in bundle */
+       if (IS_ERR(is->slcomp)) {
+               isdn_ppp_ccp_reset_free(is);
+               return PTR_ERR(is->slcomp);
+       }
 #endif
 #ifdef CONFIG_IPPP_FILTER
        is->pass_filter = NULL;
@@ -568,10 +574,8 @@ isdn_ppp_ioctl(int min, struct file *file, unsigned int cmd, unsigned long arg)
                                is->maxcid = val;
 #ifdef CONFIG_ISDN_PPP_VJ
                                sltmp = slhc_init(16, val);
-                               if (!sltmp) {
-                                       printk(KERN_ERR "ippp, can't realloc slhc struct\n");
-                                       return -ENOMEM;
-                               }
+                               if (IS_ERR(sltmp))
+                                       return PTR_ERR(sltmp);
                                if (is->slcomp)
                                        slhc_free(is->slcomp);
                                is->slcomp = sltmp;