Showing error 760

User: Jiri Slaby
Error type: Invalid Pointer Dereference
Error type description: A pointer which is invalid is being dereferenced
File location: drivers/scsi/sr.c
Line in file: 188
Project: Linux Kernel
Project version: 2.6.28
Tools: Stanse (1.2)
Entered: 2011-11-07 22:22:22 UTC


Source:

158        struct scsi_device *sdev = cd->device;
159
160        mutex_lock(&sr_ref_mutex);
161        kref_put(&cd->kref, sr_kref_release);
162        scsi_device_put(sdev);
163        mutex_unlock(&sr_ref_mutex);
164}
165
166/* identical to scsi_test_unit_ready except that it doesn't
167 * eat the NOT_READY returns for removable media */
168int sr_test_unit_ready(struct scsi_device *sdev, struct scsi_sense_hdr *sshdr)
169{
170        int retries = MAX_RETRIES;
171        int the_result;
172        u8 cmd[] = {TEST_UNIT_READY, 0, 0, 0, 0, 0 };
173
174        /* issue TEST_UNIT_READY until the initial startup UNIT_ATTENTION
175         * conditions are gone, or a timeout happens
176         */
177        do {
178                the_result = scsi_execute_req(sdev, cmd, DMA_NONE, NULL,
179                                              0, sshdr, SR_TIMEOUT,
180                                              retries--);
181                if (scsi_sense_valid(sshdr) &&
182                    sshdr->sense_key == UNIT_ATTENTION)
183                        sdev->changed = 1;
184
185        } while (retries > 0 &&
186                 (!scsi_status_is_good(the_result) ||
187                  (scsi_sense_valid(sshdr) &&
188                   sshdr->sense_key == UNIT_ATTENTION)));
189        return the_result;
190}
191
192/*
193 * This function checks to see if the media has been changed in the
194 * CDROM drive.  It is possible that we have already sensed a change,
195 * or the drive may have sensed one and not yet reported it.  We must
196 * be ready for either case. This function always reports the current
197 * value of the changed bit.  If flag is 0, then the changed bit is reset.
198 * This function could be done as an ioctl, but we would need to have
Show full sources