]> err.no Git - linux-2.6/commitdiff
fix s2io regression
authorAl Viro <viro@ftp.linux.org.uk>
Thu, 2 Aug 2007 18:21:30 +0000 (19:21 +0100)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Fri, 3 Aug 2007 22:10:44 +0000 (15:10 -0700)
 * wrong argument passed to pci_unmap_single() on failure
   exit paths
 * leak in the same area

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/net/s2io.c

index 2be0a0f1b48f65b06d2f93c8abb0e496cda044ef..24feb00600eea835b1c50da642f610157a9e5f62 100644 (file)
@@ -2430,7 +2430,7 @@ static int fill_rx_buffers(struct s2io_nic *nic, int ring_no)
                                        (rxdp3->Buffer1_ptr == DMA_ERROR_CODE)) {
                                        pci_unmap_single
                                                (nic->pdev,
-                                               (dma_addr_t)skb->data,
+                                               (dma_addr_t)rxdp3->Buffer2_ptr,
                                                dev->mtu + 4,
                                                PCI_DMA_FROMDEVICE);
                                        goto pci_map_failed;
@@ -6211,7 +6211,7 @@ static int set_rxd_buffer_pointer(struct s2io_nic *sp, struct RxD_t *rxdp,
                        if( (rxdp3->Buffer0_ptr == 0) ||
                                (rxdp3->Buffer0_ptr == DMA_ERROR_CODE)) {
                                pci_unmap_single (sp->pdev,
-                                       (dma_addr_t)(*skb)->data,
+                                       (dma_addr_t)rxdp3->Buffer2_ptr,
                                        dev->mtu + 4, PCI_DMA_FROMDEVICE);
                                goto memalloc_failed;
                        }
@@ -6224,7 +6224,10 @@ static int set_rxd_buffer_pointer(struct s2io_nic *sp, struct RxD_t *rxdp,
                        if( (rxdp3->Buffer1_ptr == 0) ||
                                (rxdp3->Buffer1_ptr == DMA_ERROR_CODE)) {
                                pci_unmap_single (sp->pdev,
-                                       (dma_addr_t)(*skb)->data,
+                                       (dma_addr_t)rxdp3->Buffer0_ptr,
+                                       BUF0_LEN, PCI_DMA_FROMDEVICE);
+                               pci_unmap_single (sp->pdev,
+                                       (dma_addr_t)rxdp3->Buffer2_ptr,
                                        dev->mtu + 4, PCI_DMA_FROMDEVICE);
                                goto memalloc_failed;
                        }