]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
IB/sdp: Fix memory leak in SDP
authorMichael S. Tsirkin <mst@mellanox.co.il>
Tue, 4 Jul 2006 07:20:42 +0000 (10:20 +0300)
committerMukesh Kacker <mukesh.kacker@oracle.com>
Tue, 6 Oct 2015 12:03:50 +0000 (05:03 -0700)
drivers/infiniband/ulp/sdp/sdp_bcopy.c
drivers/infiniband/ulp/sdp/sdp_main.c

index 3ae96e7478d0baaddec99f3366457956559163a4..07e06dd70f823e92e90837b5c2d199672c7702a4 100644 (file)
@@ -285,9 +285,16 @@ static inline int sdp_sock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
 
 static inline void update_send_head(struct sock *sk, struct sk_buff *skb)
 {
+       struct page *page;
        sk->sk_send_head = skb->next;
-       if (sk->sk_send_head == (struct sk_buff *)&sk->sk_write_queue)
+       if (sk->sk_send_head == (struct sk_buff *)&sk->sk_write_queue) {
                sk->sk_send_head = NULL;
+               page = sk->sk_sndmsg_page;
+               if (page) {
+                       put_page(page);
+                       sk->sk_sndmsg_page = NULL;
+               }
+       }
 }
 
 void sdp_post_sends(struct sdp_sock *ssk, int nonagle)
index aa8621f91ad941d1358b469ae940d14f6e96035f..9f10810f06c49c1be90b3a2430d767d56b8bf40a 100644 (file)
@@ -128,6 +128,13 @@ void sdp_close_sk(struct sock *sk)
 
        sk->sk_send_head = NULL;
        skb_queue_purge(&sk->sk_write_queue);
+        /*
+         * If sendmsg cached page exists, toss it.
+         */
+        if (sk->sk_sndmsg_page) {
+                __free_page(sk->sk_sndmsg_page);
+                sk->sk_sndmsg_page = NULL;
+        }
 
        id = ssk->id;
        if (ssk->id) {