NULL pointer dereference in drivers/mmc/core/block.c?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello!

   The below function is called several times in block.c without checking
the result for NULL:

static struct mmc_blk_data *mmc_blk_get(struct gendisk *disk)
{
	struct mmc_blk_data *md;

	mutex_lock(&open_lock);
	md = disk->private_data;
	if (md && !kref_get_unless_zero(&md->kref))
		md = NULL;
	mutex_unlock(&open_lock);

	return md;
}

   While disk->private_data seems to always be non-NULL during these calls,
kref_get_unless_zero() may return 0 at the same time (am I right though?)...
   Ulf, could you please clarify?

MBR, Sergey



[Index of Archives]     [Linux Memonry Technology]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux