[PATCH] md: do not set suspend_hi when ->quiesce is null

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Only when md personality have defined ->sync_request,
suspend_lo and suspend_hi can be created in md sysfs
directory. For now, all the personality which have
defined ->sync_request also have defined ->quiesce.
Thus, it will not cause any error in suspend_hi_store().

But, we may need to add the condition to avoid potential
NULL pointer error, as same as suspend_lo_store().

Signed-off-by: Yufen Yu <yuyufen@xxxxxxxxxx>
---
 drivers/md/md.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/md/md.c b/drivers/md/md.c
index a114b05e3db4..5c30e598e19c 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -4977,7 +4977,8 @@ suspend_hi_store(struct mddev *mddev, const char *buf, size_t len)
 	if (err)
 		return err;
 	err = -EINVAL;
-	if (mddev->pers == NULL)
+	if (mddev->pers == NULL ||
+			mddev->pers->quiesce == NULL)
 		goto unlock;
 
 	mddev_suspend(mddev);
-- 
2.16.2.dirty




[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux