diff options
author | NeilBrown <neilb@suse.de> | 2009-07-01 11:14:04 +1000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-07-19 20:38:53 -0700 |
commit | 3c92900d9a4afb176d3de335dc0da0198660a244 (patch) | |
tree | dd5ea89ce01a1835b092fed84a613b9d7eb40175 /drivers | |
parent | 042128a85db99144c34a448c75d952cda8b6c19b (diff) |
md: avoid dereferencing NULL pointer when accessing suspend_* sysfs attributes.
commit b8d966efd9a46a9a35beac50cbff6e30565125ef upstream.
If we try to modify one of the md/ sysfs files
suspend_lo or suspend_hi
when the array is not active, we dereference a NULL.
Protect against that.
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/md/md.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c index 42d4eb8acbc..eb1b73f69e0 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -3589,7 +3589,8 @@ suspend_lo_store(mddev_t *mddev, const char *buf, size_t len) char *e; unsigned long long new = simple_strtoull(buf, &e, 10); - if (mddev->pers->quiesce == NULL) + if (mddev->pers == NULL || + mddev->pers->quiesce == NULL) return -EINVAL; if (buf == e || (*e && *e != '\n')) return -EINVAL; @@ -3617,7 +3618,8 @@ suspend_hi_store(mddev_t *mddev, const char *buf, size_t len) char *e; unsigned long long new = simple_strtoull(buf, &e, 10); - if (mddev->pers->quiesce == NULL) + if (mddev->pers == NULL || + mddev->pers->quiesce == NULL) return -EINVAL; if (buf == e || (*e && *e != '\n')) return -EINVAL; |