libfc: fix type of third arg to fc_rport_recv_req().
rc_rport_recv_req() was being passed an fc_rport_libfc_priv pointer
instead of the fc_rport pointer that was expected. This patch
changes the type declaration from void * to struct fc_rport *.
The symptom was that a PLOGI from a remote port that had been discovered
would cause a NULL-pointer deref when reading rp->local_port
in fc_rport_recv_plogi_req() (which is inlined into fc_rport_recv_req()).
Signed-off-by: Joe Eykholt <[EMAIL PROTECTED]>
Signed-off-by: Joe Eykholt <[EMAIL PROTECTED]>
---
drivers/scsi/libfc/fc_lport.c | 4 +---
drivers/scsi/libfc/fc_rport.c | 4 ++--
include/scsi/libfc/libfc.h | 3 ++-
3 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c
index 1cbc2b4..b06f519 100644
--- a/drivers/scsi/libfc/fc_lport.c
+++ b/drivers/scsi/libfc/fc_lport.c
@@ -568,7 +568,6 @@ static void fc_lport_recv(struct fc_lport *lp, struct
fc_seq *sp,
struct fc_frame_header *fh = fc_frame_header_get(fp);
void (*recv) (struct fc_seq *, struct fc_frame *, struct fc_lport *);
struct fc_rport *rport;
- struct fc_rport_libfc_priv *rp;
u32 s_id;
u32 d_id;
struct fc_seq_els_data rjt_data;
@@ -618,8 +617,7 @@ static void fc_lport_recv(struct fc_lport *lp, struct
fc_seq *sp,
rport = lp->tt.rport_lookup(lp, s_id);
if (rport) {
- rp = rport->dd_data;
- lp->tt.rport_recv_req(sp, fp, rp);
+ lp->tt.rport_recv_req(sp, fp, rport);
put_device(&rport->dev); /* hold from lookup */
} else {
rjt_data.fp = NULL;
diff --git a/drivers/scsi/libfc/fc_rport.c b/drivers/scsi/libfc/fc_rport.c
index f751f0e..cd559dd 100644
--- a/drivers/scsi/libfc/fc_rport.c
+++ b/drivers/scsi/libfc/fc_rport.c
@@ -875,9 +875,9 @@ static void fc_rport_enter_logo(struct fc_rport *rport)
* This may be an entirely new session, or a PLOGI or LOGO for an existing one.
* This will free the frame.
*/
-void fc_rport_recv_req(struct fc_seq *sp, struct fc_frame *fp, void *rp_arg)
+void fc_rport_recv_req(struct fc_seq *sp, struct fc_frame *fp,
+ struct fc_rport *rport)
{
- struct fc_rport *rport = rp_arg;
struct fc_rport_libfc_priv *rp = rport->dd_data;
struct fc_frame_header *fh;
struct fc_lport *lp = rp->local_port;
diff --git a/include/scsi/libfc/libfc.h b/include/scsi/libfc/libfc.h
index de68c44..347d02d 100644
--- a/include/scsi/libfc/libfc.h
+++ b/include/scsi/libfc/libfc.h
@@ -336,7 +336,8 @@ struct libfc_function_template {
*/
int (*rport_logout)(struct fc_rport *rport);
- void (*rport_recv_req)(struct fc_seq *, struct fc_frame *, void *);
+ void (*rport_recv_req)(struct fc_seq *, struct fc_frame *,
+ struct fc_rport *);
struct fc_rport *(*rport_lookup)(const struct fc_lport *, u32);
_______________________________________________
devel mailing list
[email protected]
http://www.open-fcoe.org/mailman/listinfo/devel