diff options
author | Kai Mäkisara <Kai.Makisara@kolumbus.fi> | 2024-11-06 10:57:21 +0100 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2024-11-07 03:18:15 +0100 |
commit | 5bb2d6179d1a8039236237e1e94cfbda3be1ed9e (patch) | |
tree | 9433f2ff2ba352d4137c3e953e8b010f29fec1c1 /drivers/scsi | |
parent | Linux 6.12-rc1 (diff) | |
download | linux-5bb2d6179d1a8039236237e1e94cfbda3be1ed9e.tar.xz linux-5bb2d6179d1a8039236237e1e94cfbda3be1ed9e.zip |
scsi: st: Don't modify unknown block number in MTIOCGET
Struct mtget field mt_blkno -1 means it is unknown. Don't add anything to
it.
Signed-off-by: Kai Mäkisara <Kai.Makisara@kolumbus.fi>
Link: https://bugzilla.kernel.org/show_bug.cgi?id=219419#c14
Link: https://lore.kernel.org/r/20241106095723.63254-2-Kai.Makisara@kolumbus.fi
Reviewed-by: John Meneghini <jmeneghi@redhat.com>
Tested-by: John Meneghini <jmeneghi@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/st.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c index d50bad3a2ce9..9f480a1b4a81 100644 --- a/drivers/scsi/st.c +++ b/drivers/scsi/st.c @@ -3756,7 +3756,7 @@ static long st_ioctl(struct file *file, unsigned int cmd_in, unsigned long arg) ((STp->density << MT_ST_DENSITY_SHIFT) & MT_ST_DENSITY_MASK); mt_status.mt_blkno = STps->drv_block; mt_status.mt_fileno = STps->drv_file; - if (STp->block_size != 0) { + if (STp->block_size != 0 && mt_status.mt_blkno >= 0) { if (STps->rw == ST_WRITING) mt_status.mt_blkno += (STp->buffer)->buffer_bytes / STp->block_size; |