From: Dan Carpenter Date: Wed, 14 Jun 2017 10:41:52 +0000 (+0300) Subject: net/mlxfw: fix a NULL dereference X-Git-Tag: android-x86-8.1-r1~3229^2~189 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=f5165a5492237d33239176e7e171c7a8991583cb;p=android-x86%2Fkernel.git net/mlxfw: fix a NULL dereference If we hit this error path we end up returning ERR_PTR(0) which is NULL. The caller is not expecting that so it results in a NULL dereference. Fixes: 410ed13cae39 ("Add the mlxfw module for Mellanox firmware flash process") Signed-off-by: Dan Carpenter Acked-by: Yotam Gigi Signed-off-by: David S. Miller --- diff --git a/drivers/net/ethernet/mellanox/mlxfw/mlxfw_mfa2.c b/drivers/net/ethernet/mellanox/mlxfw/mlxfw_mfa2.c index 628150d28061..993cb5ba934e 100644 --- a/drivers/net/ethernet/mellanox/mlxfw/mlxfw_mfa2.c +++ b/drivers/net/ethernet/mellanox/mlxfw/mlxfw_mfa2.c @@ -594,6 +594,7 @@ mlxfw_mfa2_file_component_get(const struct mlxfw_mfa2_file *mfa2_file, if (memcmp(comp_data->buff, mlxfw_mfa2_comp_magic, mlxfw_mfa2_comp_magic_len) != 0) { pr_err("Component has wrong magic\n"); + err = -EINVAL; goto err_out; }