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-next>] [day] [month] [year] [list]
Date:   Wed, 22 Mar 2017 10:25:45 +0800
From:   Jeffy Chen <jeffy.chen@...k-chips.com>
To:     linux-kernel@...r.kernel.org
Cc:     robh@...nel.org, toshi.kani@....com, shawn.lin@...k-chips.com,
        briannorris@...omium.org, dianders@...omium.org,
        bhelgaas@...gle.com, dtor@...omium.org,
        Jeffy Chen <jeffy.chen@...k-chips.com>
Subject: [PATCH 1/2] resource: Copy the whole res in resource_list_create_entry

We do this so the callers may not need worry about when to free the
allocated resource struct.

Signed-off-by: Jeffy Chen <jeffy.chen@...k-chips.com>
---

 kernel/resource.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/kernel/resource.c b/kernel/resource.c
index 9b5f044..f3594f8 100644
--- a/kernel/resource.c
+++ b/kernel/resource.c
@@ -1595,7 +1595,9 @@ struct resource_entry *resource_list_create_entry(struct resource *res,
 	entry = kzalloc(sizeof(*entry) + extra_size, GFP_KERNEL);
 	if (entry) {
 		INIT_LIST_HEAD(&entry->node);
-		entry->res = res ? res : &entry->__res;
+		entry->res = &entry->__res;
+		if (res)
+			entry->__res = *res;
 	}
 
 	return entry;
-- 
2.1.4


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ