File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -159,9 +159,7 @@ static int pptp_xmit(struct ppp_channel *chan, struct sk_buff *skb)
159159 int len ;
160160 unsigned char * data ;
161161 __u32 seq_recv ;
162-
163-
164- struct rtable * rt ;
162+ struct rtable * rt = NULL ;
165163 struct net_device * tdev ;
166164 struct iphdr * iph ;
167165 int max_headroom ;
@@ -179,16 +177,20 @@ static int pptp_xmit(struct ppp_channel *chan, struct sk_buff *skb)
179177
180178 if (skb_headroom (skb ) < max_headroom || skb_cloned (skb ) || skb_shared (skb )) {
181179 struct sk_buff * new_skb = skb_realloc_headroom (skb , max_headroom );
182- if (! new_skb ) {
183- ip_rt_put ( rt );
180+
181+ if (! new_skb )
184182 goto tx_error ;
185- }
183+
186184 if (skb -> sk )
187185 skb_set_owner_w (new_skb , skb -> sk );
188186 consume_skb (skb );
189187 skb = new_skb ;
190188 }
191189
190+ /* Ensure we can safely access protocol field and LCP code */
191+ if (!pskb_may_pull (skb , 3 ))
192+ goto tx_error ;
193+
192194 data = skb -> data ;
193195 islcp = ((data [0 ] << 8 ) + data [1 ]) == PPP_LCP && 1 <= data [2 ] && data [2 ] <= 7 ;
194196
@@ -262,6 +264,7 @@ static int pptp_xmit(struct ppp_channel *chan, struct sk_buff *skb)
262264 return 1 ;
263265
264266tx_error :
267+ ip_rt_put (rt );
265268 kfree_skb (skb );
266269 return 1 ;
267270}
You can’t perform that action at this time.
0 commit comments