Thread (1 message) 1 message, 1 author, 2017-04-13

Re: [PATCH linux 2/2] net sched actions: fix refcount decrement on error

From: Roman Mashak <hidden>
Date: 2017-04-13 13:39:50
Also in: lkml

Wolfgang Bumiller [off-list ref] writes:
If memory allocation for nla_memdup_cookie() fails
module_put has to be guarded by the same condition as it was
before the TCA_ACT_COOKIE has been added as stated in the
comment afterwards:
What if a new entry has been created, and a_o->init returns
ACT_P_CREATED, but cookie allocation fails, do we not remove module
reference count?

[...]
 		if (cklen > TC_COOKIE_MAX_SIZE) {
-			err = -EINVAL;
 			tcf_hash_release(a, bind);
-			goto err_mod;
+			if (err != ACT_P_CREATED)
+				module_put(a_o->owner);
+			err = -EINVAL;
+			goto err_out;
 		}
 
 		if (nla_memdup_cookie(a, tb) < 0) {
-			err = -ENOMEM;
 			tcf_hash_release(a, bind);
-			goto err_mod;
+			if (err != ACT_P_CREATED)
+				module_put(a_o->owner);
+			err = -ENOMEM;
+			goto err_out;
 		}
 	}
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help