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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:	Fri, 17 May 2013 16:27:05 +0800
From:	Wei Yongjun <weiyj.lk@...il.com>
To:	gregkh@...uxfoundation.org, andreas.dilger@...el.com,
	tao.peng@....com
Cc:	yongjun_wei@...ndmicro.com.cn, devel@...verdev.osuosl.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH -next] staging: lustre: fix to use list_for_each_entry_safe()
 when delete items

From: Wei Yongjun <yongjun_wei@...ndmicro.com.cn>

Since we will remove items off the list using list_del_init() we need
to use a safe version of the list_for_each_entry() macro aptly named
list_for_each_entry_safe().

Signed-off-by: Wei Yongjun <yongjun_wei@...ndmicro.com.cn>
---
 drivers/staging/lustre/lustre/osc/osc_cache.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c
index 206fead..116ea31 100644
--- a/drivers/staging/lustre/lustre/osc/osc_cache.c
+++ b/drivers/staging/lustre/lustre/osc/osc_cache.c
@@ -2620,7 +2620,7 @@ int osc_queue_sync_pages(const struct lu_env *env, struct osc_object *obj,
 {
 	struct client_obd     *cli = osc_cli(obj);
 	struct osc_extent     *ext;
-	struct osc_async_page *oap;
+	struct osc_async_page *oap, *tmp;
 	int     page_count = 0;
 	int     mppr       = cli->cl_max_pages_per_rpc;
 	pgoff_t start      = CL_PAGE_EOF;
@@ -2639,7 +2639,7 @@ int osc_queue_sync_pages(const struct lu_env *env, struct osc_object *obj,
 
 	ext = osc_extent_alloc(obj);
 	if (ext == NULL) {
-		list_for_each_entry(oap, list, oap_pending_item) {
+		list_for_each_entry_safe(oap, tmp, list, oap_pending_item) {
 			list_del_init(&oap->oap_pending_item);
 			osc_ap_completion(env, cli, oap, 0, -ENOMEM);
 		}

--
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