lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1372450451-8790-4-git-send-email-lszubowi@redhat.com>
Date:	Fri, 28 Jun 2013 16:14:11 -0400
From:	Lenny Szubowicz <lszubowi@...hat.com>
To:	tony.luck@...el.com, cbouatmailru@...il.com,
	matt.fleming@...el.com, linux-kernel@...r.kernel.org
Cc:	n.hamaguchi@...fujitsu.com, dzickus@...hat.com
Subject: [PATCH 3/3] efivars: If pstore_register fails, free unneeded pstore buffer

This is patch 3/3 of a patch set that cleans up pstore_register failure paths.

If efivars fails to register with pstore, there is no point to keeping
the 4 KB buffer around. It's only used by the pstore read/write routines.

Signed-off-by: Lenny Szubowicz <lszubowi@...hat.com>
Reported-by: Naotaka Hamaguchi <n.hamaguchi@...fujitsu.com>
---
 drivers/firmware/efi/efi-pstore.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/firmware/efi/efi-pstore.c b/drivers/firmware/efi/efi-pstore.c
index 202d2c8..66c0c76 100644
--- a/drivers/firmware/efi/efi-pstore.c
+++ b/drivers/firmware/efi/efi-pstore.c
@@ -236,7 +236,11 @@ static __init int efivars_pstore_init(void)
 	efi_pstore_info.bufsize = 1024;
 	spin_lock_init(&efi_pstore_info.buf_lock);
 
-	pstore_register(&efi_pstore_info);
+	if (pstore_register(&efi_pstore_info)) {
+		kfree(efi_pstore_info.buf);
+		efi_pstore_info.buf = NULL;
+		efi_pstore_info.bufsize = 0;
+	}
 
 	return 0;
 }
-- 
1.8.2.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ