]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - net/core/filter.c
Merge branch 'fixes' of git://git.infradead.org/users/vkoul/slave-dma
[karo-tx-linux.git] / net / core / filter.c
index d4ce2dc712e34b7b1cb974c5e938313f58e9a8aa..907efd27ec77bcf5f3f214058dce27fc77e873bd 100644 (file)
@@ -83,6 +83,14 @@ int sk_filter(struct sock *sk, struct sk_buff *skb)
        int err;
        struct sk_filter *filter;
 
+       /*
+        * If the skb was allocated from pfmemalloc reserves, only
+        * allow SOCK_MEMALLOC sockets to use it as this socket is
+        * helping free memory
+        */
+       if (skb_pfmemalloc(skb) && !sock_flag(sk, SOCK_MEMALLOC))
+               return -ENOMEM;
+
        err = security_sock_rcv_skb(sk, skb);
        if (err)
                return err;