[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH] Avoid dereferencing NULL cache objects.
On 22/08/2023 12:28, Owen Smith wrote: XENBUS_CACHE(Get, ...) can fail in low memory conditions. Avoid dereferencing NULL pointers in ASSERTs Fix up error path to avoid returning a NULL pointer to the cache. Signed-off-by: Owen Smith <owen.smith@xxxxxxxxx> --- src/xenvif/receiver.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) Reviewed-by: Paul Durrant <paul@xxxxxxx>We should probably accompany this with a warning in CacheFill() if it breaks out early due to a slab allocation failure. diff --git a/src/xenvif/receiver.c b/src/xenvif/receiver.c index 4807582..0ce5b67 100644 --- a/src/xenvif/receiver.c +++ b/src/xenvif/receiver.c @@ -266,6 +266,8 @@ __ReceiverRingGetPacket( &Receiver->CacheInterface, Ring->PacketCache, Locked); + if (Packet == NULL) + return NULL;ASSERT(IsZeroMemory(&Packet->Info, sizeof (XENVIF_PACKET_INFO)));ASSERT3P(Packet->Ring, ==, Ring); @@ -1788,11 +1790,11 @@ __ReceiverRingPreparePacket( fail2: Error("fail2\n");+ __ReceiverRingPutFragment(Ring, Fragment);+ fail1: Error("fail1 (%08x)\n", status);- __ReceiverRingPutFragment(Ring, Fragment);- return NULL; }
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |