diff options
Diffstat (limited to 'net/netlink')
-rw-r--r-- | net/netlink/af_netlink.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index bca50b95c182..64334893c61c 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c | |||
@@ -1769,6 +1769,9 @@ struct sk_buff *netlink_alloc_skb(struct sock *ssk, unsigned int size, | |||
1769 | if (ring->pg_vec == NULL) | 1769 | if (ring->pg_vec == NULL) |
1770 | goto out_put; | 1770 | goto out_put; |
1771 | 1771 | ||
1772 | if (ring->frame_size - NL_MMAP_HDRLEN < size) | ||
1773 | goto out_put; | ||
1774 | |||
1772 | skb = alloc_skb_head(gfp_mask); | 1775 | skb = alloc_skb_head(gfp_mask); |
1773 | if (skb == NULL) | 1776 | if (skb == NULL) |
1774 | goto err1; | 1777 | goto err1; |
@@ -1778,6 +1781,7 @@ struct sk_buff *netlink_alloc_skb(struct sock *ssk, unsigned int size, | |||
1778 | if (ring->pg_vec == NULL) | 1781 | if (ring->pg_vec == NULL) |
1779 | goto out_free; | 1782 | goto out_free; |
1780 | 1783 | ||
1784 | /* check again under lock */ | ||
1781 | maxlen = ring->frame_size - NL_MMAP_HDRLEN; | 1785 | maxlen = ring->frame_size - NL_MMAP_HDRLEN; |
1782 | if (maxlen < size) | 1786 | if (maxlen < size) |
1783 | goto out_free; | 1787 | goto out_free; |