aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/ipv4/ip_output.c28
1 files changed, 13 insertions, 15 deletions
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index e5f7dc2de303..fd99fbd685ea 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -1183,6 +1183,17 @@ error:
1183 return err; 1183 return err;
1184} 1184}
1185 1185
1186static void ip_cork_release(struct inet_sock *inet)
1187{
1188 inet->cork.flags &= ~IPCORK_OPT;
1189 kfree(inet->cork.opt);
1190 inet->cork.opt = NULL;
1191 if (inet->cork.rt) {
1192 ip_rt_put(inet->cork.rt);
1193 inet->cork.rt = NULL;
1194 }
1195}
1196
1186/* 1197/*
1187 * Combined all pending IP fragments on the socket as one IP datagram 1198 * Combined all pending IP fragments on the socket as one IP datagram
1188 * and push them out. 1199 * and push them out.
@@ -1276,13 +1287,7 @@ int ip_push_pending_frames(struct sock *sk)
1276 } 1287 }
1277 1288
1278out: 1289out:
1279 inet->cork.flags &= ~IPCORK_OPT; 1290 ip_cork_release(inet);
1280 kfree(inet->cork.opt);
1281 inet->cork.opt = NULL;
1282 if (inet->cork.rt) {
1283 ip_rt_put(inet->cork.rt);
1284 inet->cork.rt = NULL;
1285 }
1286 return err; 1291 return err;
1287 1292
1288error: 1293error:
@@ -1295,19 +1300,12 @@ error:
1295 */ 1300 */
1296void ip_flush_pending_frames(struct sock *sk) 1301void ip_flush_pending_frames(struct sock *sk)
1297{ 1302{
1298 struct inet_sock *inet = inet_sk(sk);
1299 struct sk_buff *skb; 1303 struct sk_buff *skb;
1300 1304
1301 while ((skb = __skb_dequeue_tail(&sk->sk_write_queue)) != NULL) 1305 while ((skb = __skb_dequeue_tail(&sk->sk_write_queue)) != NULL)
1302 kfree_skb(skb); 1306 kfree_skb(skb);
1303 1307
1304 inet->cork.flags &= ~IPCORK_OPT; 1308 ip_cork_release(inet_sk(sk));
1305 kfree(inet->cork.opt);
1306 inet->cork.opt = NULL;
1307 if (inet->cork.rt) {
1308 ip_rt_put(inet->cork.rt);
1309 inet->cork.rt = NULL;
1310 }
1311} 1309}
1312 1310
1313 1311