bpf, sockmap: Fix memleak in sk_psock_queue_msg
[linux-2.6-microblaze.git] / include / linux / skmsg.h
index fdb5375..c5a2d6f 100644 (file)
@@ -304,21 +304,16 @@ static inline void sock_drop(struct sock *sk, struct sk_buff *skb)
        kfree_skb(skb);
 }
 
-static inline void drop_sk_msg(struct sk_psock *psock, struct sk_msg *msg)
-{
-       if (msg->skb)
-               sock_drop(psock->sk, msg->skb);
-       kfree(msg);
-}
-
 static inline void sk_psock_queue_msg(struct sk_psock *psock,
                                      struct sk_msg *msg)
 {
        spin_lock_bh(&psock->ingress_lock);
        if (sk_psock_test_state(psock, SK_PSOCK_TX_ENABLED))
                list_add_tail(&msg->list, &psock->ingress_msg);
-       else
-               drop_sk_msg(psock, msg);
+       else {
+               sk_msg_free(psock->sk, msg);
+               kfree(msg);
+       }
        spin_unlock_bh(&psock->ingress_lock);
 }