Commit a1269dd1 authored by Christophe Ricard's avatar Christophe Ricard Committed by Samuel Ortiz

NFC: st-nci: Fix incorrect spi buffer size

When sending data over SPI, the maximum expected length is the maximum
nci packet payload + data header size + the frame head room (1 for the
ndlc header) + the frame trail room (0).

Cc: stable@vger.kernel.org
Signed-off-by: default avatarChristophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
parent 1c54795d
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/nfc.h> #include <linux/nfc.h>
#include <net/nfc/nci.h>
#include <linux/platform_data/st-nci.h> #include <linux/platform_data/st-nci.h>
#include "st-nci.h" #include "st-nci.h"
...@@ -94,7 +95,8 @@ static int st_nci_spi_write(void *phy_id, struct sk_buff *skb) ...@@ -94,7 +95,8 @@ static int st_nci_spi_write(void *phy_id, struct sk_buff *skb)
struct st_nci_spi_phy *phy = phy_id; struct st_nci_spi_phy *phy = phy_id;
struct spi_device *dev = phy->spi_dev; struct spi_device *dev = phy->spi_dev;
struct sk_buff *skb_rx; struct sk_buff *skb_rx;
u8 buf[ST_NCI_SPI_MAX_SIZE]; u8 buf[ST_NCI_SPI_MAX_SIZE + NCI_DATA_HDR_SIZE +
ST_NCI_FRAME_HEADROOM + ST_NCI_FRAME_TAILROOM];
struct spi_transfer spi_xfer = { struct spi_transfer spi_xfer = {
.tx_buf = skb->data, .tx_buf = skb->data,
.rx_buf = buf, .rx_buf = buf,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment