linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* potential memory overrun in ata_id_to_hd_driveid() on big endian machines
@ 2009-06-19  6:41 Christian Engelmayer
  2009-06-20 21:05 ` Robert Hancock
  2009-06-20 22:04 ` [PATCH 1/1] ide: memory overrun in ide_get_identity_ioctl() on big endian machines using ioctl HDIO_OBSOLETE_IDENTITY Christian Engelmayer
  0 siblings, 2 replies; 5+ messages in thread
From: Christian Engelmayer @ 2009-06-19  6:41 UTC (permalink / raw)
  To: bzolnier; +Cc: christian.engelmayer, linux-ide

Please have a look at the usage of ata_id_to_hd_driveid() in ide-ioctls.c.

u16 array 'id' is allocated depending on the command, which might result in
142 byte. Indexing into the array at position 'ATA_ID_LBA_CAPACITY_2' in
ata_id_to_hd_driveid() would overrun the allocated memory in that case.

Regards,
 Christian

ide-ioctls.c:

	static int ide_get_identity_ioctl(ide_drive_t *drive, unsigned int cmd,
					  unsigned long arg)

	u16 *id = NULL;
	int size = (cmd == HDIO_GET_IDENTITY) ? (ATA_ID_WORDS * 2) : 142;

	..

	id = kmalloc(size, GFP_KERNEL);

	..

	ata_id_to_hd_driveid(id);

	..

ata.h:

	static inline void ata_id_to_hd_driveid(u16 *id)
	{
	#ifdef __BIG_ENDIAN

	..

	*(u64 *)&id[ATA_ID_LBA_CAPACITY_2] =
		ata_id_u64(id, ATA_ID_LBA_CAPACITY_2);

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-06-30  2:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-19  6:41 potential memory overrun in ata_id_to_hd_driveid() on big endian machines Christian Engelmayer
2009-06-20 21:05 ` Robert Hancock
2009-06-20 22:04 ` [PATCH 1/1] ide: memory overrun in ide_get_identity_ioctl() on big endian machines using ioctl HDIO_OBSOLETE_IDENTITY Christian Engelmayer
2009-06-22  9:49   ` Bartlomiej Zolnierkiewicz
2009-06-30  2:31     ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).