Skip to contentSkip to conversation

two small bsg fixes, take 3

PATCH Applied Christoph Hellwig 4 participants 8 messages Sep 7, 2017 – Sep 15, 2017

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

Now fully away, with my fair share of coffee and lunch:

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

#1 lore raw

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

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 dd56d7460cb9..c587c71d78af 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
Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] bsg-lib: don't free job in bsg_prepare_job

Quoted 24 lines · 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 dd56d7460cb9..c587c71d78af 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
Signature · 1 line
Ming
maintainer
#3 lore raw

Re: [PATCH 1/2] bsg-lib: don't free job in bsg_prepare_job

In reply to Christoph Hellwig
Quoted 2 lines · 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.

Added for this series, thanks.

Signature · 1 line
Jens Axboe
#4 lore raw

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

In reply to 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 +1 -1
index 892fbd9800d9..bea06de60827 100644
@@ -3550,7 +3550,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);
 	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
Reviewed-by on v1 2/2
#5 lore raw

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

Quoted 25 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 +1 -1
index 892fbd9800d9..bea06de60827 100644
@@ -3550,7 +3550,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);
 	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
Signature · 1 line
Ming
#6 lore raw

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

In reply to Christoph Hellwig

Christoph,

Quoted 2 lines

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

Applied to 4.14/scsi-fixes.

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering
#7 lore raw
In reply to Christoph Hellwig
Quoted 5 lines · Christoph Hellwig

Now fully away, with my fair share of coffee and lunch:

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

Jens, can you look at this for Linux 4.14?