mirror of
https://git.savannah.gnu.org/git/grub.git
synced 2026-10-20 22:48:22 +00:00
Fixed a cache collision bug. Thanks guufy1 for bugreport and test
This commit is contained in:
1 parent
77ba5392d0
commit
2df2e89fee
1 file changed
+11
-5
+11
-5
@@ -544,6 +544,17 @@ grub_disk_read (grub_disk_t disk, grub_disk_addr_t sector,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (data)
|
||||||
|
{
|
||||||
|
grub_memcpy ((char *) buf
|
||||||
|
+ (agglomerate << (GRUB_DISK_CACHE_BITS
|
||||||
|
+ GRUB_DISK_SECTOR_BITS)),
|
||||||
|
data, GRUB_DISK_CACHE_SIZE << GRUB_DISK_SECTOR_BITS);
|
||||||
|
grub_disk_cache_unlock (disk->dev->id, disk->id,
|
||||||
|
sector + (agglomerate
|
||||||
|
<< GRUB_DISK_CACHE_BITS));
|
||||||
|
}
|
||||||
|
|
||||||
if (agglomerate)
|
if (agglomerate)
|
||||||
{
|
{
|
||||||
grub_disk_addr_t i;
|
grub_disk_addr_t i;
|
||||||
@@ -571,14 +582,9 @@ grub_disk_read (grub_disk_t disk, grub_disk_addr_t sector,
|
|||||||
|
|
||||||
if (data)
|
if (data)
|
||||||
{
|
{
|
||||||
grub_memcpy (buf, data,
|
|
||||||
GRUB_DISK_CACHE_SIZE << GRUB_DISK_SECTOR_BITS);
|
|
||||||
sector += GRUB_DISK_CACHE_SIZE;
|
sector += GRUB_DISK_CACHE_SIZE;
|
||||||
buf = (char *) buf + (GRUB_DISK_CACHE_SIZE << GRUB_DISK_SECTOR_BITS);
|
buf = (char *) buf + (GRUB_DISK_CACHE_SIZE << GRUB_DISK_SECTOR_BITS);
|
||||||
size -= (GRUB_DISK_CACHE_SIZE << GRUB_DISK_SECTOR_BITS);
|
size -= (GRUB_DISK_CACHE_SIZE << GRUB_DISK_SECTOR_BITS);
|
||||||
grub_disk_cache_unlock (disk->dev->id, disk->id,
|
|
||||||
sector + (agglomerate
|
|
||||||
<< GRUB_DISK_CACHE_BITS));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user