Skip to contentSkip to conversation

mlx4_core: avoid vunmap of invalid pointer in allocation bad flow

PATCH In review Ali Ayoub 2 participants 2 messages Dec 17, 2010 – Jan 4, 2011 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

Ali Ayoub

author
#0 lore raw

PATCH 1/1 mlx4_core: avoid vunmap of invalid pointer in allocation bad flow

commit 58d180731b22f9483288800cea8a8d6381c48c61

Author: Ali Ayoub <ali-VPRAkNaXOzVWk0Htik3J/[email protected]>
Date:   Fri Dec 10 11:11:55 2010 -0800

[PATCH] mlx4_core: avoid vunmap of invalid pointer in allocation bad flow

drivers/net/mlx4/alloc.c +2 -1
@@ -214,6 +214,7 @@ int mlx4_buf_alloc(struct mlx4_dev *dev, int size, int max_direct,
 	} else {
 		int i;
 
+		buf->direct.buf  = NULL;
 		buf->nbufs       = (size + PAGE_SIZE - 1) / PAGE_SIZE;
 		buf->npages      = buf->nbufs;
 		buf->page_shift  = PAGE_SHIFT;
@@ -265,7 +266,7 @@ void mlx4_buf_free(struct mlx4_dev *dev, int size, struct mlx4_buf *buf)
 		dma_free_coherent(&dev->pdev->dev, size, buf->direct.buf,
 				  buf->direct.map);
 	else {
-		if (BITS_PER_LONG == 64)
+		if (BITS_PER_LONG == 64 && buf->direct.buf)
 			vunmap(buf->direct.buf);
 
 		for (i = 0; i < buf->nbufs; ++i)

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 4D0BF6BD.1060407-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org