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)
159
159
int len ;
160
160
unsigned char * data ;
161
161
__u32 seq_recv ;
162
-
163
-
164
- struct rtable * rt ;
162
+ struct rtable * rt = NULL ;
165
163
struct net_device * tdev ;
166
164
struct iphdr * iph ;
167
165
int max_headroom ;
@@ -179,16 +177,20 @@ static int pptp_xmit(struct ppp_channel *chan, struct sk_buff *skb)
179
177
180
178
if (skb_headroom (skb ) < max_headroom || skb_cloned (skb ) || skb_shared (skb )) {
181
179
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 )
184
182
goto tx_error ;
185
- }
183
+
186
184
if (skb -> sk )
187
185
skb_set_owner_w (new_skb , skb -> sk );
188
186
consume_skb (skb );
189
187
skb = new_skb ;
190
188
}
191
189
190
+ /* Ensure we can safely access protocol field and LCP code */
191
+ if (!pskb_may_pull (skb , 3 ))
192
+ goto tx_error ;
193
+
192
194
data = skb -> data ;
193
195
islcp = ((data [0 ] << 8 ) + data [1 ]) == PPP_LCP && 1 <= data [2 ] && data [2 ] <= 7 ;
194
196
@@ -262,6 +264,7 @@ static int pptp_xmit(struct ppp_channel *chan, struct sk_buff *skb)
262
264
return 1 ;
263
265
264
266
tx_error :
267
+ ip_rt_put (rt );
265
268
kfree_skb (skb );
266
269
return 1 ;
267
270
}
You can’t perform that action at this time.
0 commit comments