aboutsummaryrefslogtreecommitdiff
path: root/include/linux/skb_array.h
diff options
context:
space:
mode:
authorWen Yang <[email protected]>2019-01-15 10:31:27 +0800
committerBoris Ostrovsky <[email protected]>2019-01-15 16:13:47 -0500
commitb4711098066f1cf808d4dc11a1a842860a3292fe (patch)
tree4c628a969f0ba0333be86b28307815ba91e21d60 /include/linux/skb_array.h
parent5268c8f39e0efef81af2aaed160272d9eb507beb (diff)
pvcalls-front: fix potential null dereference
static checker warning: drivers/xen/pvcalls-front.c:373 alloc_active_ring() error: we previously assumed 'map->active.ring' could be null (see line 357) drivers/xen/pvcalls-front.c 351 static int alloc_active_ring(struct sock_mapping *map) 352 { 353 void *bytes; 354 355 map->active.ring = (struct pvcalls_data_intf *) 356 get_zeroed_page(GFP_KERNEL); 357 if (!map->active.ring) ^^^^^^^^^^^^^^^^^ Check 358 goto out; 359 360 map->active.ring->ring_order = PVCALLS_RING_ORDER; 361 bytes = (void *)__get_free_pages(GFP_KERNEL | __GFP_ZERO, 362 PVCALLS_RING_ORDER); 363 if (!bytes) 364 goto out; 365 366 map->active.data.in = bytes; 367 map->active.data.out = bytes + 368 XEN_FLEX_RING_SIZE(PVCALLS_RING_ORDER); 369 370 return 0; 371 372 out: --> 373 free_active_ring(map); ^^^ Add null check on map->active.ring before dereferencing it to avoid any NULL pointer dereferences. Fixes: 9f51c05dc41a ("pvcalls-front: Avoid get_free_pages(GFP_KERNEL) under spinlock") Reported-by: Dan Carpenter <[email protected]> Suggested-by: Boris Ostrovsky <[email protected]> Signed-off-by: Wen Yang <[email protected]> Reviewed-by: Boris Ostrovsky <[email protected]> CC: Boris Ostrovsky <[email protected]> CC: Juergen Gross <[email protected]> CC: Stefano Stabellini <[email protected]> CC: Dan Carpenter <[email protected]> CC: [email protected] CC: [email protected] Signed-off-by: Boris Ostrovsky <[email protected]>
Diffstat (limited to 'include/linux/skb_array.h')
0 files changed, 0 insertions, 0 deletions