[PATCH 1/1] determine last ext3 LBA to fix wild LBA reads - v2

Benjamin Herrenschmidt benh at kernel.crashing.org
Thu Jan 4 12:09:16 EST 2007


>  static errcode_t linux_set_blksize (io_channel channel, int blksize)
>  {
> +     DEBUG_F("bs set to 0x%x\n", blksize);
>       channel->block_size = bs = blksize;
>       if (block_buffer) {
>  	  free(block_buffer);
> @@ -600,6 +612,11 @@ static errcode_t linux_read_blk (io_channel channel, unsigned long block, int co
>      
>       tempb = (((unsigned long long) block) *
>  	      ((unsigned long long)bs)) + (unsigned long long)doff;
> +     if (tempb > dend) {
> +	  DEBUG_F("\nSeek error on block %lx, tempb=%Lx\n", block, tempb >> 9);
> +	  return EXT2_ET_LLSEEK_FAILED;
> +     }
> +

In the case where we don't pass a "part", dend is 0 no ? We should check
this case and not apply the test...

Ben.





More information about the Yaboot-devel mailing list