Skip to contentSkip to conversation

two small bsg fixes

PATCH In review Christoph Hellwig 2 participants 5 messages Sep 6, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Two fixups for the recent bsg-lib fixups, should go into 4.13 stable as well.

#1 lore raw

PATCH 1/2 scsi_transport_fc: fix NULL pointer dereference in fc_bsg_job_timeout

bsg-lib now embeddeds the job structure into the request, and req->special can't be used anymore.

---
 drivers/scsi/scsi_transport_fc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/scsi_transport_fc.c +1 -1
index 3c6bc0081fcb..d8de46806a1e 100644
@@ -3571,7 +3571,7 @@ fc_vport_sched_delete(struct work_struct *work)
 static enum blk_eh_timer_return
 fc_bsg_job_timeout(struct request *req)
 {
-	struct bsg_job *job = (void *) req->special;
+	struct bsg_job *job = blk_mq_rq_to_pdu(req->special);
 	struct Scsi_Host *shost = fc_bsg_to_shost(job);
 	struct fc_rport *rport = fc_bsg_to_rport(job);
 	struct fc_internal *i = to_fc_internal(shost->transportt);
Signature · 1 line
2.11.0
#2 lore raw

Re: [PATCH 1/2] scsi_transport_fc: fix NULL pointer dereference in fc_bsg_job_timeout

Quoted 14 lines · Christoph Hellwig

bsg-lib now embeddeds the job structure into the request, and req->special can't be used anymore.

---
 drivers/scsi/scsi_transport_fc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/scsi_transport_fc.c +0 -0
index 3c6bc0081fcb..d8de46806a1e 100644

drivers/scsi/scsi_transport_fc.c fc_vport_sched_delete(struct work_struct *work) · line 3574

Quoted 5 lines
drivers/scsi/scsi_transport_fc.c +1 -1
@@ -3571,7 +3571,7 @@ fc_vport_sched_delete(struct work_struct *work)
 static enum blk_eh_timer_return
 fc_bsg_job_timeout(struct request *req)
 {
-       struct bsg_job *job = (void *) req->special;
+       struct bsg_job *job = blk_mq_rq_to_pdu(req->special);

still req->special?

Signature · 1 line
Ming Lei
#3 lore raw

Re: [PATCH 1/2] scsi_transport_fc: fix NULL pointer dereference in fc_bsg_job_timeout

Quoted 10 lines · Ming Lei
Quoted 9 lines · Christoph Hellwig

bsg-lib now embeddeds the job structure into the request, and req->special can't be used anymore.

---
 drivers/scsi/scsi_transport_fc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 12 lines

drivers/scsi/scsi_transport_fc.c fc_vport_sched_delete(struct work_struct *work) · line 3574

Quoted 10 lines
drivers/scsi/scsi_transport_fc.c +1 -1
index 3c6bc0081fcb..d8de46806a1e 100644
@@ -3571,7 +3571,7 @@ fc_vport_sched_delete(struct work_struct *work)
 static enum blk_eh_timer_return
 fc_bsg_job_timeout(struct request *req)
 {
-       struct bsg_job *job = (void *) req->special;
+       struct bsg_job *job = blk_mq_rq_to_pdu(req->special);

still req->special?

Meh, sent out before the rebase finished - I'll fix it up.

#4 lore raw

PATCH 2/2 bsg-lib: don't free job in bsg_prepare_job

In reply to Christoph Hellwig

The job structure is allocated as part of the request, so we should not free it in the error path of bsg_prepare_job.

---
 block/bsg-lib.c | 1 -
 1 file changed, 1 deletion(-)
block/bsg-lib.c +0 -1
index c82408c7cc3c..dbddff8174e5 100644
@@ -154,7 +154,6 @@ static int bsg_prepare_job(struct device *dev, struct request *req)
 failjob_rls_rqst_payload:
 	kfree(job->request_payload.sg_list);
 failjob_rls_job:
-	kfree(job);
 	return -ENOMEM;
 }
 
Signature · 1 line
2.11.0