[PATCH] added safety checks for the logarea pointer

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

 



resending the patch, with pointer initialization removed, as requested

Signed-off-by: Alexander Nezhinsky <alexandern@xxxxxxxxxxxx>
---
diff --git a/usr/log.c b/usr/log.c
index 305e14f..be9b0c2 100644
--- a/usr/log.c
+++ b/usr/log.c
@@ -131,10 +131,13 @@ static int logarea_init (int size)

 static void free_logarea (void)
 {
+	if (!la)
+		return;
 	semctl(la->semid, 0, IPC_RMID, la->semarg);
 	shmdt(la->buff);
 	shmdt(la->start);
 	shmdt(la);
+	la = NULL;
 }

 #if LOGDBG
@@ -308,6 +311,9 @@ static void log_flush(void)
 {
 	struct sembuf ops;

+	if (!la)
+		return;
+
 	while (!la->empty) {
 		ops.sem_num = 0;
 		ops.sem_flg = 0;
-- 
1.6.5

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


[Index of Archives]     [Linux SCSI]     [Linux RAID]     [Linux Clusters]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]

  Powered by Linux