mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
target: Fix alua_access_state attribute OOPs for un-configured devices
This patch fixes a OOPs where an attempt to write to the per-device alua_access_state configfs attribute at: /sys/kernel/config/target/core/$HBA/$DEV/alua/$TG_PT_GP/alua_access_state results in an NULL pointer dereference when the backend device has not yet been configured. This patch adds an explicit check for DF_CONFIGURED, and fails with -ENODEV to avoid this case. Reported-by: Chris Boot <[email protected]> Reported-by: Philip Gaw <[email protected]> Cc: Chris Boot <[email protected]> Cc: Philip Gaw <[email protected]> Cc: [email protected] # 3.8+ Signed-off-by: Nicholas Bellinger <[email protected]>
This commit is contained in:
parent
e7810c2d2c
commit
f145377351
1 changed files with 5 additions and 0 deletions
|
|
@ -2227,6 +2227,11 @@ static ssize_t target_core_alua_tg_pt_gp_store_attr_alua_access_state(
|
|||
" tg_pt_gp ID: %hu\n", tg_pt_gp->tg_pt_gp_valid_id);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (!(dev->dev_flags & DF_CONFIGURED)) {
|
||||
pr_err("Unable to set alua_access_state while device is"
|
||||
" not configured\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
ret = kstrtoul(page, 0, &tmp);
|
||||
if (ret < 0) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue