]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commitdiff
niu: Fix to check for dma mapping errors.
authorShuah Khan <shuah.khan@hp.com>
Fri, 20 Jul 2012 11:50:35 +0000 (11:50 +0000)
committerDavid S. Miller <davem@davemloft.net>
Mon, 23 Jul 2012 06:31:06 +0000 (23:31 -0700)
Fix Neptune ethernet driver to check dma mapping error after map_page()
interface returns.

Signed-off-by: Shuah Khan <shuah.khan@hp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/sun/niu.c

index 8c726b7004d32a3ab1c8ba3c677135e82b2e07dc..60d5c035d946f07f9897a0b20f020c3486c50edd 100644 (file)
@@ -3335,6 +3335,10 @@ static int niu_rbr_add_page(struct niu *np, struct rx_ring_info *rp,
 
        addr = np->ops->map_page(np->device, page, 0,
                                 PAGE_SIZE, DMA_FROM_DEVICE);
+       if (!addr) {
+               __free_page(page);
+               return -ENOMEM;
+       }
 
        niu_hash_page(rp, page, addr);
        if (rp->rbr_blocks_per_page > 1)