spi_mpc8xxx: fix buffer overrun when sending only/receiving only more than PAGE_SIZE bytes
PATCH 1/1 spi_mpc8xxx: fix buffer overrun when sending only/receiving only more than PAGE_SIZE bytes
This patch applies to 2.6.34.7 and 2.6.35.4
It fixes an issue when sending only or receiving only more than PAGE_SIZE bytes
drivers/spi/spi_mpc8xxx.c +8 -2
@@ -393,11 +393,17 @@ xfer_ofs = mspi->xfer_in_progress->len - mspi->count; -out_be32 (&rx_bd->cbd_bufaddr, mspi->rx_dma + xfer_ofs); +if (mspi->rx_dma == mspi->dma_dummy_rx) +out_be32 (&rx_bd->cbd_bufaddr, mspi->rx_dma); +else +out_be32 (&rx_bd->cbd_bufaddr, mspi->rx_dma + xfer_ofs);out_be16 (&rx_bd->cbd_datlen,0 );out_be16 (&rx_bd->cbd_sc,BD_SC_EMPTY |BD_SC_INTRPT |BD_SC_WRAP ); -out_be32 (&tx_bd->cbd_bufaddr, mspi->tx_dma + xfer_ofs); +if (mspi->tx_dma == mspi->dma_dummy_tx) +out_be32 (&tx_bd->cbd_bufaddr, mspi->tx_dma); +else +out_be32 (&tx_bd->cbd_bufaddr, mspi->tx_dma + xfer_ofs);out_be16 (&tx_bd->cbd_datlen, xfer_len);out_be16 (&tx_bd->cbd_sc,BD_SC_READY |BD_SC_INTRPT |BD_SC_WRAP |BD_SC_LAST );
Quoted 9 lines
From: christophe leroy <[email protected]>
To: David Brownell <[email protected]>, Grant Likely <[email protected]>, [email protected], linux- [email protected], [email protected]
Date: 2010/09/16 09:07
Subject: [PATCH]spi_mpc8xxx: fix buffer overrun when sending only/receiving only more thanPAGE_SIZEbytes
Sent by: linuxppc-dev-bounces+joakim.tjernlund=transmode.se@lists.ozlabs.org
Quoted 4 lines
This patch applies to 2.6.34.7 and 2.6.35.4
It fixes an issue when sending only or receiving only more thanPAGE_SIZEbytesSigned-off-by christophe leroy <[email protected]>
Grant Likely
AppliedQuoted 4 lines · christophe leroy
This patch applies to 2.6.34.7 and 2.6.35.4
It fixes an issue when sending only or receiving only more thanPAGE_SIZEbytesSigned-off-by christophe leroy <[email protected]>
applied to merge-spi branch, thanks.
g.
Quoted 24 lines
diff -urN
c/drivers/spi/spi_mpc8xxx.cd/drivers/spi/spi_mpc8xxx.cdrivers/spi/spi_mpc8xxx.c +8
-2@@ -393,11 +393,17 @@ xfer_ofs = mspi->xfer_in_progress->len - mspi->count; -out_be32 (&rx_bd->cbd_bufaddr, mspi->rx_dma + xfer_ofs); +if (mspi->rx_dma == mspi->dma_dummy_rx) +out_be32 (&rx_bd->cbd_bufaddr, mspi->rx_dma); +else +out_be32 (&rx_bd->cbd_bufaddr, mspi->rx_dma + xfer_ofs);out_be16 (&rx_bd->cbd_datlen,0 );out_be16 (&rx_bd->cbd_sc,BD_SC_EMPTY |BD_SC_INTRPT |BD_SC_WRAP ); -out_be32 (&tx_bd->cbd_bufaddr, mspi->tx_dma + xfer_ofs); +if (mspi->tx_dma == mspi->dma_dummy_tx) +out_be32 (&tx_bd->cbd_bufaddr, mspi->tx_dma); +else +out_be32 (&tx_bd->cbd_bufaddr, mspi->tx_dma + xfer_ofs);out_be16 (&tx_bd->cbd_datlen, xfer_len);out_be16 (&tx_bd->cbd_sc,BD_SC_READY |BD_SC_INTRPT |BD_SC_WRAP |BD_SC_LAST );