From 3596276e2c034b2243d5e384e9ffb787f137158a Mon Sep 17 00:00:00 2001 From: Kevin Mihelich Date: Fri, 13 Jan 2017 13:10:02 -0700 Subject: [PATCH 2/2] i2c: bcm2835: prevent null pointer dereference --- drivers/i2c/busses/i2c-bcm2835.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-bcm2835.c b/drivers/i2c/busses/i2c-bcm2835.c index c3436f627028..cc840b86caab 100644 --- a/drivers/i2c/busses/i2c-bcm2835.c +++ b/drivers/i2c/busses/i2c-bcm2835.c @@ -195,7 +195,7 @@ static irqreturn_t bcm2835_i2c_isr(int this_irq, void *data) } if (val & BCM2835_I2C_S_DONE) { - if (i2c_dev->curr_msg->flags & I2C_M_RD) { + if (i2c_dev->curr_msg && (i2c_dev->curr_msg->flags & I2C_M_RD)) { bcm2835_drain_rxfifo(i2c_dev); val = bcm2835_i2c_readl(i2c_dev, BCM2835_I2C_S); } -- 2.11.0