Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi

Pull SCSI fixes from James Bottomley:
"This is four patches, consisting of one regression from the merge
window (qla2xxx), one long-standing memory leak (sd_zbc), one event
queue mislabelling which we want to eliminate to discourage the
pattern (mpt3sas), and one behaviour change because re-reading the
partition table shouldn't clear the ro flag"

* tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
scsi: sd: Keep disk read-only when re-reading partition
scsi: qla2xxx: Fix crashes in qla2x00_probe_one on probe failure
scsi: sd_zbc: Fix potential memory leak
scsi: mpt3sas: Do not mark fw_event workqueue as WQ_MEM_RECLAIM

+55 -44
+1 -1
drivers/scsi/mpt3sas/mpt3sas_scsih.c
··· 10558 10558 snprintf(ioc->firmware_event_name, sizeof(ioc->firmware_event_name), 10559 10559 "fw_event_%s%d", ioc->driver_name, ioc->id); 10560 10560 ioc->firmware_event_thread = alloc_ordered_workqueue( 10561 - ioc->firmware_event_name, WQ_MEM_RECLAIM); 10561 + ioc->firmware_event_name, 0); 10562 10562 if (!ioc->firmware_event_thread) { 10563 10563 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", 10564 10564 ioc->name, __FILE__, __LINE__, __func__);
+37 -22
drivers/scsi/qla2xxx/qla_os.c
··· 454 454 ha->req_q_map[0] = req; 455 455 set_bit(0, ha->rsp_qid_map); 456 456 set_bit(0, ha->req_qid_map); 457 - return 1; 457 + return 0; 458 458 459 459 fail_qpair_map: 460 460 kfree(ha->base_qpair); ··· 471 471 472 472 static void qla2x00_free_req_que(struct qla_hw_data *ha, struct req_que *req) 473 473 { 474 + if (!ha->req_q_map) 475 + return; 476 + 474 477 if (IS_QLAFX00(ha)) { 475 478 if (req && req->ring_fx00) 476 479 dma_free_coherent(&ha->pdev->dev, ··· 484 481 (req->length + 1) * sizeof(request_t), 485 482 req->ring, req->dma); 486 483 487 - if (req) 484 + if (req) { 488 485 kfree(req->outstanding_cmds); 489 - 490 - kfree(req); 486 + kfree(req); 487 + } 491 488 } 492 489 493 490 static void qla2x00_free_rsp_que(struct qla_hw_data *ha, struct rsp_que *rsp) 494 491 { 492 + if (!ha->rsp_q_map) 493 + return; 494 + 495 495 if (IS_QLAFX00(ha)) { 496 496 if (rsp && rsp->ring) 497 497 dma_free_coherent(&ha->pdev->dev, ··· 505 499 (rsp->length + 1) * sizeof(response_t), 506 500 rsp->ring, rsp->dma); 507 501 } 508 - kfree(rsp); 502 + if (rsp) 503 + kfree(rsp); 509 504 } 510 505 511 506 static void qla2x00_free_queues(struct qla_hw_data *ha) ··· 1730 1723 struct qla_tgt_cmd *cmd; 1731 1724 uint8_t trace = 0; 1732 1725 1726 + if (!ha->req_q_map) 1727 + return; 1733 1728 spin_lock_irqsave(qp->qp_lock_ptr, flags); 1734 1729 req = qp->req; 1735 1730 for (cnt = 1; cnt < req->num_outstanding_cmds; cnt++) { ··· 3104 3095 /* Set up the irqs */ 3105 3096 ret = qla2x00_request_irqs(ha, rsp); 3106 3097 if (ret) 3107 - goto probe_hw_failed; 3098 + goto probe_failed; 3108 3099 3109 3100 /* Alloc arrays of request and response ring ptrs */ 3110 - if (!qla2x00_alloc_queues(ha, req, rsp)) { 3101 + if (qla2x00_alloc_queues(ha, req, rsp)) { 3111 3102 ql_log(ql_log_fatal, base_vha, 0x003d, 3112 3103 "Failed to allocate memory for queue pointers..." 3113 3104 "aborting.\n"); 3114 - goto probe_init_failed; 3105 + goto probe_failed; 3115 3106 } 3116 3107 3117 3108 if (ha->mqenable && shost_use_blk_mq(host)) { ··· 3395 3386 } 3396 3387 3397 3388 return 0; 3398 - 3399 - probe_init_failed: 3400 - qla2x00_free_req_que(ha, req); 3401 - ha->req_q_map[0] = NULL; 3402 - clear_bit(0, ha->req_qid_map); 3403 - qla2x00_free_rsp_que(ha, rsp); 3404 - ha->rsp_q_map[0] = NULL; 3405 - clear_bit(0, ha->rsp_qid_map); 3406 - ha->max_req_queues = ha->max_rsp_queues = 0; 3407 3389 3408 3390 probe_failed: 3409 3391 if (base_vha->timer_active) ··· 4508 4508 if (ha->init_cb) 4509 4509 dma_free_coherent(&ha->pdev->dev, ha->init_cb_size, 4510 4510 ha->init_cb, ha->init_cb_dma); 4511 - vfree(ha->optrom_buffer); 4512 - kfree(ha->nvram); 4513 - kfree(ha->npiv_info); 4514 - kfree(ha->swl); 4515 - kfree(ha->loop_id_map); 4511 + 4512 + if (ha->optrom_buffer) 4513 + vfree(ha->optrom_buffer); 4514 + if (ha->nvram) 4515 + kfree(ha->nvram); 4516 + if (ha->npiv_info) 4517 + kfree(ha->npiv_info); 4518 + if (ha->swl) 4519 + kfree(ha->swl); 4520 + if (ha->loop_id_map) 4521 + kfree(ha->loop_id_map); 4516 4522 4517 4523 ha->srb_mempool = NULL; 4518 4524 ha->ctx_mempool = NULL; ··· 4534 4528 ha->ex_init_cb_dma = 0; 4535 4529 ha->async_pd = NULL; 4536 4530 ha->async_pd_dma = 0; 4531 + ha->loop_id_map = NULL; 4532 + ha->npiv_info = NULL; 4533 + ha->optrom_buffer = NULL; 4534 + ha->swl = NULL; 4535 + ha->nvram = NULL; 4536 + ha->mctp_dump = NULL; 4537 + ha->dcbx_tlv = NULL; 4538 + ha->xgmac_data = NULL; 4539 + ha->sfp_data = NULL; 4537 4540 4538 4541 ha->s_dma_pool = NULL; 4539 4542 ha->dl_dma_pool = NULL;
+2 -1
drivers/scsi/sd.c
··· 2595 2595 int res; 2596 2596 struct scsi_device *sdp = sdkp->device; 2597 2597 struct scsi_mode_data data; 2598 + int disk_ro = get_disk_ro(sdkp->disk); 2598 2599 int old_wp = sdkp->write_prot; 2599 2600 2600 2601 set_disk_ro(sdkp->disk, 0); ··· 2636 2635 "Test WP failed, assume Write Enabled\n"); 2637 2636 } else { 2638 2637 sdkp->write_prot = ((data.device_specific & 0x80) != 0); 2639 - set_disk_ro(sdkp->disk, sdkp->write_prot); 2638 + set_disk_ro(sdkp->disk, sdkp->write_prot || disk_ro); 2640 2639 if (sdkp->first_scan || old_wp != sdkp->write_prot) { 2641 2640 sd_printk(KERN_NOTICE, sdkp, "Write Protect is %s\n", 2642 2641 sdkp->write_prot ? "on" : "off");
+15 -20
drivers/scsi/sd_zbc.c
··· 403 403 */ 404 404 static int sd_zbc_check_zone_size(struct scsi_disk *sdkp) 405 405 { 406 - u64 zone_blocks; 406 + u64 zone_blocks = 0; 407 407 sector_t block = 0; 408 408 unsigned char *buf; 409 409 unsigned char *rec; ··· 421 421 422 422 /* Do a report zone to get the same field */ 423 423 ret = sd_zbc_report_zones(sdkp, buf, SD_ZBC_BUF_SIZE, 0); 424 - if (ret) { 425 - zone_blocks = 0; 426 - goto out; 427 - } 424 + if (ret) 425 + goto out_free; 428 426 429 427 same = buf[4] & 0x0f; 430 428 if (same > 0) { ··· 462 464 ret = sd_zbc_report_zones(sdkp, buf, 463 465 SD_ZBC_BUF_SIZE, block); 464 466 if (ret) 465 - return ret; 467 + goto out_free; 466 468 } 467 469 468 470 } while (block < sdkp->capacity); ··· 470 472 zone_blocks = sdkp->zone_blocks; 471 473 472 474 out: 473 - kfree(buf); 474 - 475 475 if (!zone_blocks) { 476 476 if (sdkp->first_scan) 477 477 sd_printk(KERN_NOTICE, sdkp, 478 478 "Devices with non constant zone " 479 479 "size are not supported\n"); 480 - return -ENODEV; 481 - } 482 - 483 - if (!is_power_of_2(zone_blocks)) { 480 + ret = -ENODEV; 481 + } else if (!is_power_of_2(zone_blocks)) { 484 482 if (sdkp->first_scan) 485 483 sd_printk(KERN_NOTICE, sdkp, 486 484 "Devices with non power of 2 zone " 487 485 "size are not supported\n"); 488 - return -ENODEV; 489 - } 490 - 491 - if (logical_to_sectors(sdkp->device, zone_blocks) > UINT_MAX) { 486 + ret = -ENODEV; 487 + } else if (logical_to_sectors(sdkp->device, zone_blocks) > UINT_MAX) { 492 488 if (sdkp->first_scan) 493 489 sd_printk(KERN_NOTICE, sdkp, 494 490 "Zone size too large\n"); 495 - return -ENODEV; 491 + ret = -ENODEV; 492 + } else { 493 + sdkp->zone_blocks = zone_blocks; 494 + sdkp->zone_shift = ilog2(zone_blocks); 496 495 } 497 496 498 - sdkp->zone_blocks = zone_blocks; 499 - sdkp->zone_shift = ilog2(zone_blocks); 497 + out_free: 498 + kfree(buf); 500 499 501 - return 0; 500 + return ret; 502 501 } 503 502 504 503 /**