cdrom: Make device operations read-only
authorKees Cook <keescook@chromium.org>
Tue, 14 Feb 2017 00:25:26 +0000 (16:25 -0800)
committerJens Axboe <axboe@fb.com>
Tue, 14 Feb 2017 15:29:56 +0000 (08:29 -0700)
commit853fe1bf7554155376bb3b231112cdff9ff79177
tree7d8b38a77574919d078443cecffcae9dd380a692
parentd1a987f35ebf859a771ac530e95a89933b6fcce8
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>
Documentation/cdrom/cdrom-standard.tex
drivers/block/paride/pcd.c
drivers/cdrom/cdrom.c
drivers/cdrom/gdrom.c
drivers/ide/ide-cd.c
drivers/scsi/sr.c
include/linux/cdrom.h