diff options
Diffstat (limited to 'net/core/sock.c')
-rw-r--r-- | net/core/sock.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/net/core/sock.c b/net/core/sock.c index e891bcf325ca..dc30dc5bb1b8 100644 --- a/net/core/sock.c +++ b/net/core/sock.c | |||
@@ -354,15 +354,12 @@ void sk_clear_memalloc(struct sock *sk) | |||
354 | 354 | ||
355 | /* | 355 | /* |
356 | * SOCK_MEMALLOC is allowed to ignore rmem limits to ensure forward | 356 | * SOCK_MEMALLOC is allowed to ignore rmem limits to ensure forward |
357 | * progress of swapping. However, if SOCK_MEMALLOC is cleared while | 357 | * progress of swapping. SOCK_MEMALLOC may be cleared while |
358 | * it has rmem allocations there is a risk that the user of the | 358 | * it has rmem allocations due to the last swapfile being deactivated |
359 | * socket cannot make forward progress due to exceeding the rmem | 359 | * but there is a risk that the socket is unusable due to exceeding |
360 | * limits. By rights, sk_clear_memalloc() should only be called | 360 | * the rmem limits. Reclaim the reserves and obey rmem limits again. |
361 | * on sockets being torn down but warn and reset the accounting if | ||
362 | * that assumption breaks. | ||
363 | */ | 361 | */ |
364 | if (WARN_ON(sk->sk_forward_alloc)) | 362 | sk_mem_reclaim(sk); |
365 | sk_mem_reclaim(sk); | ||
366 | } | 363 | } |
367 | EXPORT_SYMBOL_GPL(sk_clear_memalloc); | 364 | EXPORT_SYMBOL_GPL(sk_clear_memalloc); |
368 | 365 | ||
@@ -1474,8 +1471,8 @@ void sk_release_kernel(struct sock *sk) | |||
1474 | return; | 1471 | return; |
1475 | 1472 | ||
1476 | sock_hold(sk); | 1473 | sock_hold(sk); |
1477 | sock_net_set(sk, get_net(&init_net)); | ||
1478 | sock_release(sk->sk_socket); | 1474 | sock_release(sk->sk_socket); |
1475 | sock_net_set(sk, get_net(&init_net)); | ||
1479 | sock_put(sk); | 1476 | sock_put(sk); |
1480 | } | 1477 | } |
1481 | EXPORT_SYMBOL(sk_release_kernel); | 1478 | EXPORT_SYMBOL(sk_release_kernel); |
@@ -1883,7 +1880,7 @@ bool skb_page_frag_refill(unsigned int sz, struct page_frag *pfrag, gfp_t gfp) | |||
1883 | 1880 | ||
1884 | pfrag->offset = 0; | 1881 | pfrag->offset = 0; |
1885 | if (SKB_FRAG_PAGE_ORDER) { | 1882 | if (SKB_FRAG_PAGE_ORDER) { |
1886 | pfrag->page = alloc_pages(gfp | __GFP_COMP | | 1883 | pfrag->page = alloc_pages((gfp & ~__GFP_WAIT) | __GFP_COMP | |
1887 | __GFP_NOWARN | __GFP_NORETRY, | 1884 | __GFP_NOWARN | __GFP_NORETRY, |
1888 | SKB_FRAG_PAGE_ORDER); | 1885 | SKB_FRAG_PAGE_ORDER); |
1889 | if (likely(pfrag->page)) { | 1886 | if (likely(pfrag->page)) { |