提交 a4c2fec1 编写于 作者: W Wen Yang 提交者: Wolfram Sang

i2c: core: fix use after free in of_i2c_notify

We can't use "adap->dev" after it has been freed.

Fixes: 5bf4fa7d ("i2c: break out OF support into separate file")
Signed-off-by: NWen Yang <wenyang@linux.alibaba.com>
Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
上级 7574c0db
......@@ -245,14 +245,14 @@ static int of_i2c_notify(struct notifier_block *nb, unsigned long action,
}
client = of_i2c_register_device(adap, rd->dn);
put_device(&adap->dev);
if (IS_ERR(client)) {
dev_err(&adap->dev, "failed to create client for '%pOF'\n",
rd->dn);
put_device(&adap->dev);
of_node_clear_flag(rd->dn, OF_POPULATED);
return notifier_from_errno(PTR_ERR(client));
}
put_device(&adap->dev);
break;
case OF_RECONFIG_CHANGE_REMOVE:
/* already depopulated? */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册