public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Robert Love <robert.w.love@intel.com>
To: James.Bottomley@suse.de, linux-scsi@vger.kernel.org
Cc: Vasu Dev <vasu.dev@intel.com>, Robert Love <robert.w.love@intel.com>
Subject: [PATCH 1/9] libfc: call ddp setup for only FCP reads to avoid accessing junk fsp pointer
Date: Tue, 16 Feb 2010 12:15:18 -0800	[thread overview]
Message-ID: <20100216201518.26581.63877.stgit@localhost.localdomain> (raw)
In-Reply-To: <20100216201513.26581.83756.stgit@localhost.localdomain>

From: Vasu Dev <vasu.dev@intel.com>

Adds check to call fc_fcp_ddp_setup for only FCP read cmds to avoid
accessing junk fsp pointer at least in ESX since non FCP frame had
junk fsp value, though fsp is implicitly initialized to null
by __alloc_skb but with this patch no more relying on fsp
initialized to null value and hitting junk fsp ptr access.

Removes fsp pointer checking in fc_fcp_ddp_setup as this is not
needed any more since its only caller for FCP read will always
have a valid fsp.

Reported by: Frank Zhang <frank_1.zhang@intel.com>
Reported by: Rob Love <robert.w.love@intel.com>
Signed-off-by: Vasu Dev <vasu.dev@intel.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
---

 drivers/scsi/libfc/fc_exch.c |    2 +-
 drivers/scsi/libfc/fc_fcp.c  |    3 ---
 2 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/libfc/fc_exch.c b/drivers/scsi/libfc/fc_exch.c
index 19d711c..7f43647 100644
--- a/drivers/scsi/libfc/fc_exch.c
+++ b/drivers/scsi/libfc/fc_exch.c
@@ -1890,7 +1890,7 @@ static struct fc_seq *fc_exch_seq_send(struct fc_lport *lport,
 	fc_exch_setup_hdr(ep, fp, ep->f_ctl);
 	sp->cnt++;
 
-	if (ep->xid <= lport->lro_xid)
+	if (ep->xid <= lport->lro_xid && fh->fh_r_ctl == FC_RCTL_DD_UNSOL_CMD)
 		fc_fcp_ddp_setup(fr_fsp(fp), ep->xid);
 
 	if (unlikely(lport->tt.frame_send(lport, fp)))
diff --git a/drivers/scsi/libfc/fc_fcp.c b/drivers/scsi/libfc/fc_fcp.c
index 881d5df..6fde2fa 100644
--- a/drivers/scsi/libfc/fc_fcp.c
+++ b/drivers/scsi/libfc/fc_fcp.c
@@ -298,9 +298,6 @@ void fc_fcp_ddp_setup(struct fc_fcp_pkt *fsp, u16 xid)
 {
 	struct fc_lport *lport;
 
-	if (!fsp)
-		return;
-
 	lport = fsp->lp;
 	if ((fsp->req_flags & FC_SRB_READ) &&
 	    (lport->lro_enabled) && (lport->tt.ddp_setup)) {


  reply	other threads:[~2010-02-16 20:15 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-16 20:15 [PATCH 0/9] Updates to libfc, libfcoe, fcoe and fnic Robert Love
2010-02-16 20:15 ` Robert Love [this message]
2010-02-16 20:15 ` [PATCH 2/9] libfc: Fix e_d_tov ns -> ms scaling factor in PLOGI response Robert Love
2010-02-16 20:15 ` [PATCH 3/9] libfc: Don't assume response request present Robert Love
2010-02-16 20:15 ` [PATCH 4/9] libfcoe: Send port LKA every FIP_VN_KA_PERIOD secs Robert Love
2010-02-16 20:15 ` [PATCH 5/9] fcoe: Only rmmod fcoe.ko if there are no active connections Robert Love
2010-02-16 20:15 ` [PATCH 6/9] fnic: Allow multicast and unicast address registrations for fnic Robert Love
2010-02-16 20:15 ` [PATCH 7/9] fnic: lport stats need to be initialized in fnic_probe() Robert Love
2010-02-16 20:15 ` [PATCH 8/9] fnic: Set fnic driver version Robert Love
2010-02-16 20:16 ` [PATCH 9/9] MAINTAINERS: Adding FCoE information to the MAINTAINERS file Robert Love

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=20100216201518.26581.63877.stgit@localhost.localdomain \
    --to=robert.w.love@intel.com \
    --cc=James.Bottomley@suse.de \
    --cc=linux-scsi@vger.kernel.org \
    --cc=vasu.dev@intel.com \
    /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