diff options
author | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2006-03-07 15:53:40 -0500 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2006-03-07 15:53:40 -0500 |
commit | e12f0a3dec17de3d847f533ba81ad6956c9da5fd (patch) | |
tree | db7c3936468c363d5ba710c6b6e2612a2a734964 /drivers | |
parent | 5e6575c051f3313feb9fe1aad61263b3560df5cc (diff) |
[SCSI] sr: partial revert of 24669f75a3231fa37444977c92d1f4838bec1233
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: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/scsi/sr_ioctl.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/scsi/sr_ioctl.c b/drivers/scsi/sr_ioctl.c index 03fbc4b44473..5d02ff4db6cc 100644 --- a/drivers/scsi/sr_ioctl.c +++ b/drivers/scsi/sr_ioctl.c | |||
@@ -44,10 +44,11 @@ static int sr_read_tochdr(struct cdrom_device_info *cdi, | |||
44 | int result; | 44 | int result; |
45 | unsigned char *buffer; | 45 | unsigned char *buffer; |
46 | 46 | ||
47 | buffer = kzalloc(32, GFP_KERNEL | SR_GFP_DMA(cd)); | 47 | buffer = kmalloc(32, GFP_KERNEL | SR_GFP_DMA(cd)); |
48 | if (!buffer) | 48 | if (!buffer) |
49 | return -ENOMEM; | 49 | return -ENOMEM; |
50 | 50 | ||
51 | memset(&cgc, 0, sizeof(struct packet_command)); | ||
51 | cgc.timeout = IOCTL_TIMEOUT; | 52 | cgc.timeout = IOCTL_TIMEOUT; |
52 | cgc.cmd[0] = GPCMD_READ_TOC_PMA_ATIP; | 53 | cgc.cmd[0] = GPCMD_READ_TOC_PMA_ATIP; |
53 | cgc.cmd[8] = 12; /* LSB of length */ | 54 | cgc.cmd[8] = 12; /* LSB of length */ |
@@ -73,10 +74,11 @@ static int sr_read_tocentry(struct cdrom_device_info *cdi, | |||
73 | int result; | 74 | int result; |
74 | unsigned char *buffer; | 75 | unsigned char *buffer; |
75 | 76 | ||
76 | buffer = kzalloc(32, GFP_KERNEL | SR_GFP_DMA(cd)); | 77 | buffer = kmalloc(32, GFP_KERNEL | SR_GFP_DMA(cd)); |
77 | if (!buffer) | 78 | if (!buffer) |
78 | return -ENOMEM; | 79 | return -ENOMEM; |
79 | 80 | ||
81 | memset(&cgc, 0, sizeof(struct packet_command)); | ||
80 | cgc.timeout = IOCTL_TIMEOUT; | 82 | cgc.timeout = IOCTL_TIMEOUT; |
81 | cgc.cmd[0] = GPCMD_READ_TOC_PMA_ATIP; | 83 | cgc.cmd[0] = GPCMD_READ_TOC_PMA_ATIP; |
82 | cgc.cmd[1] |= (tocentry->cdte_format == CDROM_MSF) ? 0x02 : 0; | 84 | cgc.cmd[1] |= (tocentry->cdte_format == CDROM_MSF) ? 0x02 : 0; |