From e3e16e999862f539420381a93f482885e5e8118b Mon Sep 17 00:00:00 2001 From: Matt Jacob Date: Thu, 14 Apr 2005 04:51:18 +0000 Subject: [PATCH] Make sure we look at the correct sub op codes when deciding whether it's an operation we can perform via the control device. PR: kern/72010 MFC after: 1 week --- sys/cam/scsi/scsi_sa.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/sys/cam/scsi/scsi_sa.c b/sys/cam/scsi/scsi_sa.c index fd9c251368a5..88ad7a25ea61 100644 --- a/sys/cam/scsi/scsi_sa.c +++ b/sys/cam/scsi/scsi_sa.c @@ -810,10 +810,29 @@ saioctl(struct cdev *dev, u_long cmd, caddr_t arg, int flag, struct thread *td) } break; + case MTIOCTOP: + { + struct mtop *mt = (struct mtop *) arg; + + /* + * Check to make sure it's an OP we can perform + * with no media inserted. + */ + switch (mt->mt_op) { + case MTSETBSIZ: + case MTSETDNSTY: + case MTCOMP: + mt = NULL; + /* FALLTHROUGH */ + default: + break; + } + if (mt != NULL) { + break; + } + /* FALLTHROUGH */ + } case MTIOCSETEOTMODEL: - case MTSETBSIZ: - case MTSETDNSTY: - case MTCOMP: /* * We need to acquire the peripheral here rather * than at open time because we are sharing writable