aboutsummaryrefslogtreecommitdiff
path: root/net/lapb/lapb_out.c
diff options
context:
space:
mode:
authorWen Yang <[email protected]>2018-12-05 10:35:50 +0800
committerBoris Ostrovsky <[email protected]>2019-01-10 09:19:36 -0500
commit9f51c05dc41a6d69423e3d03d18eb7ab22f9ec19 (patch)
tree8590b589970b80cbb53d2e0a8370f5c0d346b36d /net/lapb/lapb_out.c
parent1f8ce09b36c41a026a37a24b20efa32000892a64 (diff)
pvcalls-front: Avoid get_free_pages(GFP_KERNEL) under spinlock
The problem is that we call this with a spin lock held. The call tree is: pvcalls_front_accept() holds bedata->socket_lock. -> create_active() -> __get_free_pages() uses GFP_KERNEL The create_active() function is only called from pvcalls_front_accept() with a spin_lock held, The allocation is not allowed to sleep and GFP_KERNEL is not sufficient. This issue was detected by using the Coccinelle software. v2: Add a function doing the allocations which is called outside the lock and passing the allocated data to create_active(). v3: Use the matching deallocators i.e., free_page() and free_pages(), respectively. v4: It would be better to pre-populate map (struct sock_mapping), rather than introducing one more new struct. v5: Since allocating the data outside of this call it should also be freed outside, when create_active() fails. Move kzalloc(sizeof(*map2), GFP_ATOMIC) outside spinlock and use GFP_KERNEL instead. v6: Drop the superfluous calls. Suggested-by: Juergen Gross <[email protected]> Suggested-by: Boris Ostrovsky <[email protected]> Suggested-by: Stefano Stabellini <[email protected]> Signed-off-by: Wen Yang <[email protected]> Acked-by: Stefano Stabellini <[email protected]> CC: Julia Lawall <[email protected]> CC: Boris Ostrovsky <[email protected]> CC: Juergen Gross <[email protected]> CC: Stefano Stabellini <[email protected]> CC: [email protected] CC: [email protected] Signed-off-by: Boris Ostrovsky <[email protected]>
Diffstat (limited to 'net/lapb/lapb_out.c')
0 files changed, 0 insertions, 0 deletions