X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fscsi%2Fst.c;h=24a3c492ad26b382bd0299c0bf84db1f5d170d16;hb=3e3ff47c8527c5ba0be4e9f358d49e4b076bd6ef;hp=5fa0153dac1467ad9933157118889163cbf2d12e;hpb=a91482bdcc2e0f6035702e46f1b99043a0893346;p=linux-2.6.git diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c index 5fa0153da..24a3c492a 100644 --- a/drivers/scsi/st.c +++ b/drivers/scsi/st.c @@ -1001,7 +1001,6 @@ static int st_open(struct inode *inode, struct file *filp) int dev = TAPE_NR(inode); char *name; - nonseekable_open(inode, filp); write_lock(&st_dev_arr_lock); if (dev >= st_dev_max || scsi_tapes == NULL || ((STp = scsi_tapes[dev]) == NULL)) { @@ -1204,7 +1203,7 @@ static int st_release(struct inode *inode, struct file *filp) } /* The checks common to both reading and writing */ -static ssize_t rw_checks(Scsi_Tape *STp, struct file *filp, size_t count) +static ssize_t rw_checks(Scsi_Tape *STp, struct file *filp, size_t count, loff_t *ppos) { ssize_t retval = 0; @@ -1219,6 +1218,12 @@ static ssize_t rw_checks(Scsi_Tape *STp, struct file *filp, size_t count) goto out; } + if (ppos != &filp->f_pos) { + /* "A request was outside the capabilities of the device." */ + retval = (-ENXIO); + goto out; + } + if (STp->ready != ST_READY) { if (STp->ready == ST_NO_TAPE) retval = (-ENOMEDIUM); @@ -1362,7 +1367,7 @@ st_write(struct file *filp, const char __user *buf, size_t count, loff_t * ppos) if (down_interruptible(&STp->lock)) return -ERESTARTSYS; - retval = rw_checks(STp, filp, count); + retval = rw_checks(STp, filp, count, ppos); if (retval || count == 0) goto out; @@ -1828,7 +1833,7 @@ st_read(struct file *filp, char __user *buf, size_t count, loff_t * ppos) if (down_interruptible(&STp->lock)) return -ERESTARTSYS; - retval = rw_checks(STp, filp, count); + retval = rw_checks(STp, filp, count, ppos); if (retval || count == 0) goto out; @@ -3408,7 +3413,7 @@ static int st_ioctl(struct inode *inode, struct file *file, case SCSI_IOCTL_GET_BUS_NUMBER: break; default: - i = scsi_cmd_ioctl(file, STp->disk, cmd_in, p); + i = scsi_cmd_ioctl(STp->disk, cmd_in, p); if (i != -ENOTTY) return i; break; @@ -3969,7 +3974,7 @@ static int st_remove(struct device *dev) for (i = 0; i < st_dev_max; i++) { tpnt = scsi_tapes[i]; if (tpnt != NULL && tpnt->device == SDp) { - scsi_tapes[i] = NULL; + scsi_tapes[i] = 0; st_nr_dev--; write_unlock(&st_dev_arr_lock); devfs_unregister_tape(tpnt->disk->number);