summary refs log tree commit diff
path: root/drivers/scsi
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2017-02-13 16:25:26 -0800
committerJens Axboe <axboe@fb.com>2017-02-14 08:29:56 -0700
commit853fe1bf7554155376bb3b231112cdff9ff79177 (patch)
tree7d8b38a77574919d078443cecffcae9dd380a692 /drivers/scsi
parentd1a987f35ebf859a771ac530e95a89933b6fcce8 (diff)
downloadlinux-853fe1bf7554155376bb3b231112cdff9ff79177.tar.gz
cdrom: Make device operations read-only
Since function tables are a common target for attackers, it's best to keep
them in read-only memory. As such, this makes the CDROM device ops tables
const. This drops additionally n_minors, since it isn't used meaningfully,
and sets the only user of cdrom_dummy_generic_packet explicitly so the
variables can all be const.

Inspired by similar changes in grsecurity/PaX.

Signed-off-by: Kees Cook <keescook@chromium.org>
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/sr.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c
index 94352e4df831..013bfe049a48 100644
--- a/drivers/scsi/sr.c
+++ b/drivers/scsi/sr.c
@@ -117,7 +117,7 @@ static unsigned int sr_check_events(struct cdrom_device_info *cdi,
 				    unsigned int clearing, int slot);
 static int sr_packet(struct cdrom_device_info *, struct packet_command *);
 
-static struct cdrom_device_ops sr_dops = {
+static const struct cdrom_device_ops sr_dops = {
 	.open			= sr_open,
 	.release	 	= sr_release,
 	.drive_status	 	= sr_drive_status,