[PATCH 5/5] FIX: Validate input in ping_manager function

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

 



For native case we do not have manager running so we have to
return without pinging.
Moreover we have NULL as input parameter. We should to avoid
segmentation fault.

Signed-off-by: Krzysztof Wojcik <krzysztof.wojcik@xxxxxxxxx>
---
 msg.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/msg.c b/msg.c
index b97ebec..2c770ab 100644
--- a/msg.c
+++ b/msg.c
@@ -432,7 +432,13 @@ void unblock_monitor(char *container, const int unfreeze)
  */
 int ping_manager(char *devname)
 {
-	int sfd = connect_monitor(devname);
+	int sfd;
+
+	if (!devname)
+		return -1;
+
+	sfd = connect_monitor(devname);
+
 	struct metadata_update msg = { .len = -1 };
 	int err = 0;
 

--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[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