[Asterisk-code-review] various: fix and test a double deref on a scheduled delete of an exec... (asterisk[16])

Kevin Harwell asteriskteam at digium.com
Fri Jan 7 11:04:12 CST 2022


Attention is currently required from: Michael Bradeen, Joshua Colp.
Kevin Harwell has posted comments on this change. ( https://gerrit.asterisk.org/c/asterisk/+/17644 )

Change subject: various: fix and test a double deref on a scheduled delete of an executing call back.
......................................................................


Patch Set 8: Code-Review-1

(9 comments)

Patchset:

PS8: 
Looks like you've addressed my feedback, but giving a -1 as it appears Sean's has still not been addressed.


File include/asterisk/sched.h:

https://gerrit.asterisk.org/c/asterisk/+/17644/comment/2e9da021_30bb7966 
PS7, Line 75:  * Only calls unref function if the delete succeeded.
> I think this could use additional clarification: […]
Done


https://gerrit.asterisk.org/c/asterisk/+/17644/comment/bffb4c1e_463dae69 
PS7, Line 315: * \retval -2 event was running and not rescheduled
> Reword this a bit to say something like "-2 event was running, but deleted via non rescheduling.
Done


File main/sched.c:

https://gerrit.asterisk.org/c/asterisk/+/17644/comment/c73eabc3_09d04439 
PS2, Line 658: 			sched_release(con, s);
> "s" gets freed in sched_release, and should be set to NULL after calling sched_release since "s" is  […]
Done


File main/sched.c:

https://gerrit.asterisk.org/c/asterisk/+/17644/comment/696700ce_00d8fe83 
PS7, Line 666: 			/* This was not rescheduled so the caller of ast_sched_del can not remove any
             : 			 * references as they already were.
             : 			 */
> I think this comment can be deleted. […]
Done


https://gerrit.asterisk.org/c/asterisk/+/17644/comment/b12be11b_e2e880e8 
PS7, Line 673: 			 * it's destruction to us
> s/it's/its
Done


https://gerrit.asterisk.org/c/asterisk/+/17644/comment/a6b78300_3e78b64c 
PS7, Line 688: 	if (!s && *last_id != id) {
             : 		ast_debug(1, "Attempted to delete nonexistent schedule entry %d!\n", id);
             : 		/* Removing nonexistent schedule entry shouldn't trigger assert (it was enabled in DEV_MODE);
             : 		 * because in many places entries is deleted without having valid id. */
             : 		*last_id = id;
             : 		return -1;
             : 	} else if (!s) {
             : 		return -1;
             : 	}
             : 
             : 	return res;
> When you set "s" to NULL above this might need to be reworked as this function will now always retur […]
Done


File tests/test_sched.c:

https://gerrit.asterisk.org/c/asterisk/+/17644/comment/91eac7c0_a642199e 
PS2, Line 406: 		return AST_TEST_FAIL;
> obj still leaked.
Done


https://gerrit.asterisk.org/c/asterisk/+/17644/comment/ea1e9021_a95542d6 
PS2, Line 412: 		return AST_TEST_FAIL;
> obj still leaked.
Done



-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/17644
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 16
Gerrit-Change-Id: Icfb16b3acbc29cf5b4cef74183f7531caaefe21d
Gerrit-Change-Number: 17644
Gerrit-PatchSet: 8
Gerrit-Owner: Michael Bradeen <mbradeen at sangoma.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Sean Bright <sean at seanbright.com>
Gerrit-Attention: Michael Bradeen <mbradeen at sangoma.com>
Gerrit-Attention: Joshua Colp <jcolp at sangoma.com>
Gerrit-Comment-Date: Fri, 07 Jan 2022 17:04:12 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: Joshua Colp <jcolp at sangoma.com>
Comment-In-Reply-To: Kevin Harwell <kharwell at digium.com>
Gerrit-MessageType: comment
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20220107/ed6c48c6/attachment.html>


More information about the asterisk-code-review mailing list