Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 2047
b: refs/heads/master
c: 16c4b3e
h: refs/heads/master
i:
  2045: b0c8fb1
  2043: aa3c1ae
  2039: f93b140
  2031: 0ee3316
  2015: 3961629
  1983: a10713e
  1919: ad4556a
  1791: 2d308cf
  1535: 4587caf
  1023: 4a33e99
v: v3
  • Loading branch information
Kai Makisara authored and James Bottomley committed May 20, 2005
1 parent 63e9c3e commit e100904
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f80ed139343c37c897ae89c70f7736a6937172f5
refs/heads/master: 16c4b3e2071ad73e5cd2aa82961eed0414df6a7d
19 changes: 13 additions & 6 deletions trunk/drivers/scsi/st.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
Last modified: 18-JAN-1998 Richard Gooch <rgooch@atnf.csiro.au> Devfs support
*/

static char *verstr = "20050312";
static char *verstr = "20050501";

#include <linux/module.h>

Expand All @@ -29,6 +29,7 @@ static char *verstr = "20050312";
#include <linux/string.h>
#include <linux/errno.h>
#include <linux/mtio.h>
#include <linux/cdrom.h>
#include <linux/ioctl.h>
#include <linux/fcntl.h>
#include <linux/spinlock.h>
Expand All @@ -50,6 +51,7 @@ static char *verstr = "20050312";
#include <scsi/scsi_host.h>
#include <scsi/scsi_ioctl.h>
#include <scsi/scsi_request.h>
#include <scsi/sg.h>


/* The driver prints some debugging information on the console if DEBUG
Expand Down Expand Up @@ -3463,18 +3465,23 @@ static int st_ioctl(struct inode *inode, struct file *file,
case SCSI_IOCTL_GET_BUS_NUMBER:
break;
default:
if (!capable(CAP_SYS_ADMIN))
if ((cmd_in == SG_IO ||
cmd_in == SCSI_IOCTL_SEND_COMMAND ||
cmd_in == CDROM_SEND_PACKET) &&
!capable(CAP_SYS_RAWIO))
i = -EPERM;
else
i = scsi_cmd_ioctl(file, STp->disk, cmd_in, p);
if (i != -ENOTTY)
return i;
break;
}
if (!capable(CAP_SYS_ADMIN) &&
(cmd_in == SCSI_IOCTL_START_UNIT || cmd_in == SCSI_IOCTL_STOP_UNIT))
return -EPERM;
return scsi_ioctl(STp->device, cmd_in, p);
retval = scsi_ioctl(STp->device, cmd_in, p);
if (!retval && cmd_in == SCSI_IOCTL_STOP_UNIT) { /* unload */
STp->rew_at_close = 0;
STp->ready = ST_NO_TAPE;
}
return retval;

out:
up(&STp->lock);
Expand Down

0 comments on commit e100904

Please sign in to comment.