Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 72520263 authored by Sahitya Tummala's avatar Sahitya Tummala
Browse files

mmc: core: Fix possible NULL pointer dereference



Fix possible NULL pointer dereference within cd-gpio IRQ
handler mmc_gpio_cd_irqt(), which can potentially happen
if the card detect IRQ gets triggered before host->ops
are initialized.

CRs-fixed: 628836
Change-Id: I2f47717d338c5c7f8e7a994c28bb5c30b30286c6
Signed-off-by: default avatarSahitya Tummala <stummala@codeaurora.org>
parent 500bff85
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -47,6 +47,14 @@ static irqreturn_t mmc_gpio_cd_irqt(int irq, void *dev_id)
	struct mmc_gpio *ctx = host->slot.handler_priv;
	int status;

	/*
	 * In case host->ops are not yet initialized return immediately.
	 * The card will get detected later when host driver calls
	 * mmc_add_host() after host->ops are initialized.
	 */
	if (!host->ops)
		goto out;

	if (host->ops->card_event)
		host->ops->card_event(host);