提交 8d00730a 编写于 作者: P Peter Rosin 提交者: Zheng Zengkai

i2c: mux: demux-pinctrl: do not deactivate a master that is not active

stable inclusion
from stable-v5.10.110
commit 0d3ad6142a05a3e0de5ff71438dd087ea0775266
bugzilla: https://gitee.com/openeuler/kernel/issues/I574AL

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=0d3ad6142a05a3e0de5ff71438dd087ea0775266

--------------------------------

[ Upstream commit 1a22aabf ]

Attempting to rollback the activation of the current master when
the current master has not been activated is bad. priv->cur_chan
and priv->cur_adap are both still zeroed out and the rollback
may result in attempts to revert an of changeset that has not been
applied and do result in calls to both del and put the zeroed out
i2c_adapter. Maybe it crashes, or whatever, but it's bad in any
case.

Fixes: e9d1a0a4 ("i2c: mux: demux-pinctrl: Fix an error handling path in 'i2c_demux_pinctrl_probe()'")
Signed-off-by: NPeter Rosin <peda@axentia.se>
Signed-off-by: NWolfram Sang <wsa@kernel.org>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NYu Liao <liaoyu15@huawei.com>
Reviewed-by: NWei Li <liwei391@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 617b3f60
...@@ -261,7 +261,7 @@ static int i2c_demux_pinctrl_probe(struct platform_device *pdev) ...@@ -261,7 +261,7 @@ static int i2c_demux_pinctrl_probe(struct platform_device *pdev)
err = device_create_file(&pdev->dev, &dev_attr_available_masters); err = device_create_file(&pdev->dev, &dev_attr_available_masters);
if (err) if (err)
goto err_rollback; goto err_rollback_activation;
err = device_create_file(&pdev->dev, &dev_attr_current_master); err = device_create_file(&pdev->dev, &dev_attr_current_master);
if (err) if (err)
...@@ -271,8 +271,9 @@ static int i2c_demux_pinctrl_probe(struct platform_device *pdev) ...@@ -271,8 +271,9 @@ static int i2c_demux_pinctrl_probe(struct platform_device *pdev)
err_rollback_available: err_rollback_available:
device_remove_file(&pdev->dev, &dev_attr_available_masters); device_remove_file(&pdev->dev, &dev_attr_available_masters);
err_rollback: err_rollback_activation:
i2c_demux_deactivate_master(priv); i2c_demux_deactivate_master(priv);
err_rollback:
for (j = 0; j < i; j++) { for (j = 0; j < i; j++) {
of_node_put(priv->chan[j].parent_np); of_node_put(priv->chan[j].parent_np);
of_changeset_destroy(&priv->chan[j].chgset); of_changeset_destroy(&priv->chan[j].chgset);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册