public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@ftp.linux.org.uk>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Jeff Garzik <jgarzik@pobox.com>, linux-kernel@vger.kernel.org
Subject: [PATCH] fix s2io regression
Date: Thu, 2 Aug 2007 19:21:30 +0100	[thread overview]
Message-ID: <20070802182130.GM21089@ftp.linux.org.uk> (raw)

	* 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>
---
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c
index 2be0a0f..24feb00 100644
--- a/drivers/net/s2io.c
+++ b/drivers/net/s2io.c
@@ -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;
 			}

                 reply	other threads:[~2007-08-02 18:21 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070802182130.GM21089@ftp.linux.org.uk \
    --to=viro@ftp.linux.org.uk \
    --cc=jgarzik@pobox.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox