Ignore:
Timestamp:
Apr 21, 2017, 4:28:29 AM (3 months ago)
Author:
brainslayer
Message:

update

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/linux/universal/linux-3.18/drivers/scsi/sr.c

    r29101 r31885  
    840840        struct scsi_mode_data data;
    841841        struct scsi_sense_hdr sshdr;
     842        unsigned int ms_len = 128;
    842843        int rc, n;
    843844
     
    866867
    867868        /* ask for mode page 0x2a */
    868         rc = scsi_mode_sense(cd->device, 0, 0x2a, buffer, 128,
     869        rc = scsi_mode_sense(cd->device, 0, 0x2a, buffer, ms_len,
    869870                             SR_TIMEOUT, 3, &data, NULL);
    870871
    871         if (!scsi_status_is_good(rc)) {
     872        if (!scsi_status_is_good(rc) || data.length > ms_len ||
     873            data.header_length + data.block_descriptor_length > data.length) {
    872874                /* failed, drive doesn't have capabilities mode page */
    873875                cd->cdi.speed = 1;
Note: See TracChangeset for help on using the changeset viewer.