Messages in this thread Patch in this message | | | Date | Fri, 17 Jul 2009 13:09:08 -0700 | From | Greg KH <> | Subject | [patch 17/24] md: avoid dereferencing NULL pointer when accessing suspend_* sysfs attributes. |
| |
2.6.30-stable review patch. If anyone has any objections, please let us know.
------------------
From: NeilBrown <neilb@suse.de>
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>
--- drivers/md/md.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
--- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -3589,7 +3589,8 @@ suspend_lo_store(mddev_t *mddev, const c 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 c 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;
| |