Commit e12f0a3d authored by James Bottomley's avatar James Bottomley

[SCSI] sr: partial revert of 24669f75

The patch

[SCSI] SCSI core kmalloc2kzalloc

Has an incorrect piece in sr_ioctl.c; it changes buffer from kmalloc
to kzalloc, but then removes the clearing of the stack variable struct
packet_command.  This, in turn leaves rubbish in the sense pointer
which the sr_do_ioctl() command then happily writes to ... oops.

Thanks to Mike Christie <michaelc@cs.wisc.edu> for spotting this.
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent 5e6575c0
...@@ -44,10 +44,11 @@ static int sr_read_tochdr(struct cdrom_device_info *cdi, ...@@ -44,10 +44,11 @@ static int sr_read_tochdr(struct cdrom_device_info *cdi,
int result; int result;
unsigned char *buffer; unsigned char *buffer;
buffer = kzalloc(32, GFP_KERNEL | SR_GFP_DMA(cd)); buffer = kmalloc(32, GFP_KERNEL | SR_GFP_DMA(cd));
if (!buffer) if (!buffer)
return -ENOMEM; return -ENOMEM;
memset(&cgc, 0, sizeof(struct packet_command));
cgc.timeout = IOCTL_TIMEOUT; cgc.timeout = IOCTL_TIMEOUT;
cgc.cmd[0] = GPCMD_READ_TOC_PMA_ATIP; cgc.cmd[0] = GPCMD_READ_TOC_PMA_ATIP;
cgc.cmd[8] = 12; /* LSB of length */ cgc.cmd[8] = 12; /* LSB of length */
...@@ -73,10 +74,11 @@ static int sr_read_tocentry(struct cdrom_device_info *cdi, ...@@ -73,10 +74,11 @@ static int sr_read_tocentry(struct cdrom_device_info *cdi,
int result; int result;
unsigned char *buffer; unsigned char *buffer;
buffer = kzalloc(32, GFP_KERNEL | SR_GFP_DMA(cd)); buffer = kmalloc(32, GFP_KERNEL | SR_GFP_DMA(cd));
if (!buffer) if (!buffer)
return -ENOMEM; return -ENOMEM;
memset(&cgc, 0, sizeof(struct packet_command));
cgc.timeout = IOCTL_TIMEOUT; cgc.timeout = IOCTL_TIMEOUT;
cgc.cmd[0] = GPCMD_READ_TOC_PMA_ATIP; cgc.cmd[0] = GPCMD_READ_TOC_PMA_ATIP;
cgc.cmd[1] |= (tocentry->cdte_format == CDROM_MSF) ? 0x02 : 0; cgc.cmd[1] |= (tocentry->cdte_format == CDROM_MSF) ? 0x02 : 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment