summaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorYi Zou2009-10-22 01:27:58 +0200
committerJames Bottomley2009-12-04 19:00:33 +0100
commitd37322a43ebac79eef417149f5696390cf8872db (patch)
tree71538cfff1bc2bd82e744ece265e7e6c45c07c6f /drivers/scsi
parent[SCSI] fcoe: Use NETIF_F_FCOE_MTU flag to set up max frame size (lport->mfs) (diff)
downloadkernel-qcow2-linux-d37322a43ebac79eef417149f5696390cf8872db.tar.gz
kernel-qcow2-linux-d37322a43ebac79eef417149f5696390cf8872db.tar.xz
kernel-qcow2-linux-d37322a43ebac79eef417149f5696390cf8872db.zip
[SCSI] libfc: Fix frags in frame exceeding SKB_MAX_FRAGS in fc_fcp_send_data
In case of sequence offload, in fc_fcp_send_data(), the skb_fill_page_info() called may end up adding more frags to the skb_shinfo(fp_skb(fp))->frags[], exceeding SKB_MAX_FRAGS, this eventually corrupts the memory. I am adding the FR_FRAME_SG_LEN back, but as SKB_MAX_FRAGS -1, leaving 1 for our fcoe_eof_crc page. And send will be broken into multiple large sends if the frame already contains more frags than skb handle. Signed-off-by: Yi Zou <yi.zou@intel.com> Signed-off-by: Robert Love <robert.w.love@intel.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/libfc/fc_fcp.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/scsi/libfc/fc_fcp.c b/drivers/scsi/libfc/fc_fcp.c
index 40ed7442d9df..28bfe1c2c50a 100644
--- a/drivers/scsi/libfc/fc_fcp.c
+++ b/drivers/scsi/libfc/fc_fcp.c
@@ -574,7 +574,8 @@ static int fc_fcp_send_data(struct fc_fcp_pkt *fsp, struct fc_seq *seq,
tlen -= sg_bytes;
remaining -= sg_bytes;
- if (tlen)
+ if ((skb_shinfo(fp_skb(fp))->nr_frags < FC_FRAME_SG_LEN) &&
+ (tlen))
continue;
/*