i2c: mux: reg: Fix possible null-ptr-deref
Subsystems (2)
PATCH 1/1 i2c: mux: reg: Fix possible null-ptr-deref
It will cause null-ptr-deref when resource_size(res) invoked, if platform_get_resource() returns NULL.
Fixes b3fdd32799d8 ("i2c: mux: Add register-based mux i2c-mux-reg")
Signed-off-by Hui Tang <[email protected]>
--- drivers/i2c/muxes/i2c-mux-reg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/muxes/i2c-mux-reg.c +1 -1
@@ -184,12 +184,12 @@ static int i2c_mux_reg_probe(struct platform_device *pdev)dev_info (&pdev->dev,"Register not set, using platform resource\n" ); res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); - mux->data.reg_size =resource_size (res); mux->data.reg =devm_ioremap_resource (&pdev->dev, res);if (IS_ERR (mux->data.reg)) { ret =PTR_ERR (mux->data.reg); goto err_put_parent; } + mux->data.reg_size =resource_size (res); } if (mux->data.reg_size != 4 && mux->data.reg_size != 2 &&
Signature · 1 line
2.17.1
Quoted 5 lines · Hui Tang
It will cause null-ptr-deref when
resource_size(res)invoked, ifplatform_get_resource()returns NULL.Fixes b3fdd32799d8 ("i2c: mux: Add register-based mux i2c-mux-reg")Signed-off-by Hui Tang <[email protected]>
Correct, yet I applied this older patch instead:
http://patchwork.ozlabs.org/project/linux-i2c/patch/[email protected]/