linux/drivers/scsi
Dan Rosenberg 5f6279da37 [SCSI] pmcraid: reject negative request size
There's a code path in pmcraid that can be reached via device ioctl that
causes all sorts of ugliness, including heap corruption or triggering
the OOM killer due to consecutive allocation of large numbers of pages.
Not especially relevant from a security perspective, since users must
have CAP_SYS_ADMIN to open the character device.

First, the user can call pmcraid_chr_ioctl() with a type
PMCRAID_PASSTHROUGH_IOCTL.  A pmcraid_passthrough_ioctl_buffer
is copied in, and the request_size variable is set to
buffer->ioarcb.data_transfer_length, which is an arbitrary 32-bit signed
value provided by the user.

If a negative value is provided here, bad things can happen.  For
example, pmcraid_build_passthrough_ioadls() is called with this
request_size, which immediately calls pmcraid_alloc_sglist() with a
negative size.  The resulting math on allocating a scatter list can
result in an overflow in the kzalloc() call (if num_elem is 0, the
sglist will be smaller than expected), or if num_elem is unexpectedly
large the subsequent loop will call alloc_pages() repeatedly, a high
number of pages will be allocated and the OOM killer might be invoked.

Prevent this value from being negative in pmcraid_ioctl_passthrough().

Signed-off-by: Dan Rosenberg <drosenberg@vsecurity.com>
Cc: stable@kernel.org
Cc: Anil Ravindranath <anil_ravindranath@pmc-sierra.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2011-04-24 12:15:07 -05:00
..
aacraid Fix common misspellings 2011-03-31 11:26:23 -03:00
aic7xxx Fix common misspellings 2011-03-31 11:26:23 -03:00
aic7xxx_old Fix common misspellings 2011-03-31 11:26:23 -03:00
aic94xx Fix common misspellings 2011-03-31 11:26:23 -03:00
arcmsr Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6 2011-03-17 17:54:40 -07:00
arm Fix common misspellings 2011-03-31 11:26:23 -03:00
be2iscsi Fix common misspellings 2011-03-31 11:26:23 -03:00
bfa Fix common misspellings 2011-03-31 11:26:23 -03:00
bnx2fc Fix common misspellings 2011-03-31 11:26:23 -03:00
bnx2i Fix common misspellings 2011-03-31 11:26:23 -03:00
cxgbi Fix common misspellings 2011-03-31 11:26:23 -03:00
device_handler [SCSI] scsi_dh: fix reference counting in scsi_dh_activate error path 2011-04-24 11:02:09 -05:00
dpt Fix common misspellings 2011-03-31 11:26:23 -03:00
fcoe Fix common misspellings 2011-03-31 11:26:23 -03:00
fnic Fix common misspellings 2011-03-31 11:26:23 -03:00
ibmvscsi
libfc Fix common misspellings 2011-03-31 11:26:23 -03:00
libsas Fix common misspellings 2011-03-31 11:26:23 -03:00
lpfc Fix common misspellings 2011-03-31 11:26:23 -03:00
megaraid Fix common misspellings 2011-03-31 11:26:23 -03:00
mpt2sas [SCSI] mpt2sas: prevent heap overflows and unchecked reads 2011-04-24 11:01:59 -05:00
mvsas [SCSI] mvsas: Add support for HighPoint RR27xx series HBA 2011-03-23 11:35:59 -05:00
osd [SCSI] libosd: osd_req_read_sg, optimize the single entry case 2011-01-24 12:06:31 -06:00
pcmcia Fix common misspellings 2011-03-31 11:26:23 -03:00
pm8001 Fix common misspellings 2011-03-31 11:26:23 -03:00
qla2xxx Fix common misspellings 2011-03-31 11:26:23 -03:00
qla4xxx Fix common misspellings 2011-03-31 11:26:23 -03:00
sym53c8xx_2 Fix common misspellings 2011-03-31 11:26:23 -03:00
.gitignore
3w-9xxx.c
3w-9xxx.h Fix common misspellings 2011-03-31 11:26:23 -03:00
3w-sas.c
3w-sas.h
3w-xxxx.c
3w-xxxx.h Fix common misspellings 2011-03-31 11:26:23 -03:00
53c700_d.h_shipped Fix common misspellings 2011-03-31 11:26:23 -03:00
53c700.c
53c700.h
53c700.scr Fix common misspellings 2011-03-31 11:26:23 -03:00
a100u2w.c
a100u2w.h
a2091.c
a2091.h
a3000.c
a3000.h
a4000t.c
advansys.c Fix common misspellings 2011-03-31 11:26:23 -03:00
aha152x.c
aha152x.h
aha1542.c
aha1542.h
aha1740.c Fix common misspellings 2011-03-31 11:26:23 -03:00
aha1740.h
aic7xxx_old.c Fix common misspellings 2011-03-31 11:26:23 -03:00
atari_NCR5380.c Fix common misspellings 2011-03-31 11:26:23 -03:00
atari_scsi.c
atari_scsi.h
atp870u.c Fix common misspellings 2011-03-31 11:26:23 -03:00
atp870u.h
BusLogic.c
BusLogic.h
bvme6000_scsi.c
ch.c
constants.c
dc395x.c Fix common misspellings 2011-03-31 11:26:23 -03:00
dc395x.h Fix common misspellings 2011-03-31 11:26:23 -03:00
dmx3191d.c
dpt_i2o.c
dpti.h
dtc.c
dtc.h
eata_generic.h
eata_pio.c
eata_pio.h
eata.c Fix common misspellings 2011-03-31 11:26:23 -03:00
esp_scsi.c
esp_scsi.h
fd_mcs.c
fdomain.c Fix common misspellings 2011-03-31 11:26:23 -03:00
fdomain.h
FlashPoint.c Fix common misspellings 2011-03-31 11:26:23 -03:00
g_NCR5380_mmio.c
g_NCR5380.c Fix common misspellings 2011-03-31 11:26:23 -03:00
g_NCR5380.h
gdth_ioctl.h
gdth_proc.c
gdth_proc.h
gdth.c
gdth.h Fix common misspellings 2011-03-31 11:26:23 -03:00
gvp11.c Fix common misspellings 2011-03-31 11:26:23 -03:00
gvp11.h
hosts.c
hpsa_cmd.h [SCSI] hpsa: Inform controller we are using 32-bit tags. 2011-02-18 12:33:52 -06:00
hpsa.c [SCSI] hpsa: export resettable host attribute 2011-03-14 18:44:41 -05:00
hpsa.h [SCSI] hpsa: make hpsa.hpsa_simple_mode=1 module parameter actually work 2011-02-18 12:32:30 -06:00
hptiop.c
hptiop.h
ibmmca.c
imm.c Fix common misspellings 2011-03-31 11:26:23 -03:00
imm.h
in2000.c
in2000.h
initio.c Fix common misspellings 2011-03-31 11:26:23 -03:00
initio.h Fix common misspellings 2011-03-31 11:26:23 -03:00
ipr.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6 2011-03-17 17:54:40 -07:00
ipr.h
ips.c Fix common misspellings 2011-03-31 11:26:23 -03:00
ips.h Fix common misspellings 2011-03-31 11:26:23 -03:00
iscsi_boot_sysfs.c
iscsi_tcp.c Fix common misspellings 2011-03-31 11:26:23 -03:00
iscsi_tcp.h [SCSI] iscsi_tcp: use iscsi_conn_get_addr_param libiscsi function 2011-02-24 12:41:10 -05:00
jazz_esp.c
Kconfig [SCSI] bnx2fc: Broadcom FCoE offload driver 2011-02-28 18:40:27 -06:00
lasi700.c
libiscsi_tcp.c [SCSI] libiscsi_tcp: use kmap in xmit path 2011-03-23 11:36:58 -05:00
libiscsi.c [SCSI] libiscsi: add helper to convert addr to string 2011-02-24 12:41:08 -05:00
libsrp.c
mac53c94.c
mac53c94.h
mac_esp.c
mac_scsi.c
mac_scsi.h
Makefile Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6 2011-03-17 17:54:40 -07:00
megaraid.c Fix common misspellings 2011-03-31 11:26:23 -03:00
megaraid.h Fix common misspellings 2011-03-31 11:26:23 -03:00
mesh.c
mesh.h
mvme16x_scsi.c
mvme147.c
mvme147.h
ncr53c8xx.c Fix common misspellings 2011-03-31 11:26:23 -03:00
ncr53c8xx.h
NCR53c406a.c
NCR5380.c Fix common misspellings 2011-03-31 11:26:23 -03:00
NCR5380.h
NCR_D700.c
NCR_D700.h
NCR_Q720.c
NCR_Q720.h
nsp32_debug.c
nsp32_io.h
nsp32.c Fix common misspellings 2011-03-31 11:26:23 -03:00
nsp32.h Fix common misspellings 2011-03-31 11:26:23 -03:00
osst_detect.h
osst_options.h
osst.c Fix common misspellings 2011-03-31 11:26:23 -03:00
osst.h Fix common misspellings 2011-03-31 11:26:23 -03:00
pas16.c
pas16.h
pmcraid.c [SCSI] pmcraid: reject negative request size 2011-04-24 12:15:07 -05:00
pmcraid.h Fix common misspellings 2011-03-31 11:26:23 -03:00
ppa.c
ppa.h
ps3rom.c
qla1280.c Fix common misspellings 2011-03-31 11:26:23 -03:00
qla1280.h
qlogicfas408.c
qlogicfas408.h
qlogicfas.c
qlogicpti.c dt/sparc: Eliminate users of of_platform_{,un}register_driver 2011-02-28 01:36:39 -07:00
qlogicpti.h
raid_class.c
script_asm.pl
scsi_debug.c Fix common misspellings 2011-03-31 11:26:23 -03:00
scsi_devinfo.c [SCSI] Add scsi_dev_info_list_del_keyed() 2011-01-24 12:01:07 -06:00
scsi_error.c Reduce sequential pointer derefs in scsi_error.c and reduce size as well 2011-03-21 15:54:35 -07:00
scsi_ioctl.c
scsi_lib_dma.c
scsi_lib.c block: get rid of QUEUE_FLAG_REENTER 2011-04-19 13:32:46 +02:00
scsi_logging.h
scsi_module.c
scsi_netlink.c Fix common misspellings 2011-03-31 11:26:23 -03:00
scsi_pm.c
scsi_priv.h Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6 2011-03-17 17:54:40 -07:00
scsi_proc.c
scsi_sas_internal.h
scsi_scan.c
scsi_sysctl.c
scsi_sysfs.c [SCSI] put stricter guards on queue dead checks 2011-04-24 11:02:17 -05:00
scsi_tgt_if.c
scsi_tgt_lib.c Fix common misspellings 2011-03-31 11:26:23 -03:00
scsi_tgt_priv.h
scsi_trace.c
scsi_transport_api.h
scsi_transport_fc_internal.h
scsi_transport_fc.c block: get rid of QUEUE_FLAG_REENTER 2011-04-19 13:32:46 +02:00
scsi_transport_iscsi.c [SCSI] scsi_transport_iscsi: make priv_sess file writeable only by root 2011-03-23 11:35:58 -05:00
scsi_transport_sas.c block: remove per-queue plugging 2011-03-10 08:52:07 +01:00
scsi_transport_spi.c
scsi_transport_srp_internal.h
scsi_transport_srp.c
scsi_typedefs.h
scsi_wait_scan.c
scsi.c
scsi.h
scsicam.c
sd_dif.c
sd.c Fix common misspellings 2011-03-31 11:26:23 -03:00
sd.h [SCSI] sd: Logical Block Provisioning update 2011-03-14 18:37:34 -05:00
ses.c [SCSI] ses: add subenclosure support 2011-03-23 11:37:09 -05:00
sg.c
sgiwd93.c
sim710.c
sni_53c710.c
sr_ioctl.c
sr_vendor.c
sr.c Fix common misspellings 2011-03-31 11:26:23 -03:00
sr.h
st_options.h
st.c
st.h
stex.c
sun3_NCR5380.c Fix common misspellings 2011-03-31 11:26:23 -03:00
sun3_scsi_vme.c
sun3_scsi.c
sun3_scsi.h
sun3x_esp.c
sun_esp.c dt/sparc: Eliminate users of of_platform_{,un}register_driver 2011-02-28 01:36:39 -07:00
sym53c416.c Fix common misspellings 2011-03-31 11:26:23 -03:00
sym53c416.h
t128.c
t128.h
tmscsim.c
tmscsim.h
u14-34f.c
ultrastor.c x86: Stop including <linux/delay.h> in two asm header files 2011-03-29 09:37:42 +02:00
ultrastor.h
vmw_pvscsi.c
vmw_pvscsi.h
wd33c93.c Fix common misspellings 2011-03-31 11:26:23 -03:00
wd33c93.h
wd7000.c Fix common misspellings 2011-03-31 11:26:23 -03:00
zalon.c
zorro7xx.c