Showing error 815

User: Jiri Slaby
Error type: Resource Leak
Error type description: The code omits to put the resource to the system for reuse
File location: net/ipv4/tcp.c
Line in file: 1308
Project: Linux Kernel
Project version: 2.6.28
Tools: Stanse (1.2)
Entered: 2011-11-07 22:40:13 UTC


Source:

1278        int target;                /* Read at least this many bytes */
1279        long timeo;
1280        struct task_struct *user_recv = NULL;
1281        int copied_early = 0;
1282        struct sk_buff *skb;
1283
1284        lock_sock(sk);
1285
1286        TCP_CHECK_TIMER(sk);
1287
1288        err = -ENOTCONN;
1289        if (sk->sk_state == TCP_LISTEN)
1290                goto out;
1291
1292        timeo = sock_rcvtimeo(sk, nonblock);
1293
1294        /* Urgent data needs to be handled specially. */
1295        if (flags & MSG_OOB)
1296                goto recv_urg;
1297
1298        seq = &tp->copied_seq;
1299        if (flags & MSG_PEEK) {
1300                peek_seq = tp->copied_seq;
1301                seq = &peek_seq;
1302        }
1303
1304        target = sock_rcvlowat(sk, flags & MSG_WAITALL, len);
1305
1306#ifdef CONFIG_NET_DMA
1307        tp->ucopy.dma_chan = NULL;
1308        preempt_disable();
1309        skb = skb_peek_tail(&sk->sk_receive_queue);
1310        {
1311                int available = 0;
1312
1313                if (skb)
1314                        available = TCP_SKB_CB(skb)->seq + skb->len - (*seq);
1315                if ((available < target) &&
1316                    (len > sysctl_tcp_dma_copybreak) && !(flags & MSG_PEEK) &&
1317                    !sysctl_tcp_low_latency &&
1318                    __get_cpu_var(softnet_data).net_dma) {
Show full sources