ANDROID: netfilter: xt_IDLETIMER: align kmalloc with upstream

Commit 382e68666b ("ANDROID: core of xt_IDLETIMER send_nl_msg
support"), switched the allocation of info->timer in
idletimer_tg_create_v1() to use kzalloc() instead of plain kmalloc().

While this seems like a safer option it also creates merge conflicts
with multiple upstream patches that replace kmalloc() calls with their
new kmalloc_obj() equivalents (treewide).

Instead of using kzmalloc() align the allocation with upstream and
manually initialize suspend_time_valid (added downstream). This is
enough to guarantee timer->last_suspend_time is valid.

A switch to kzmalloc_obj() can be reapplied later if really needed or
even better it could be sent upstream but it seems unnecessary there.

Bug: 183485987
Cc: Maciej Żenczykowski <maze@google.com>
Change-Id: I6f55c3dafe6ae64b163cb807300f7c5dddf7a421
Signed-off-by: Carlos Llamas <cmllamas@google.com>
This commit is contained in:
Carlos Llamas authored and android-test-infra-autosubmit@system.gserviceaccount.com committed 2026-04-21 03:08:00 -07:00
1 parent b25f66675c
commit f909e0291a
1 file changed
+2 -1
+2 -1
View File
@@ -366,7 +366,7 @@ static int idletimer_tg_create_v1(struct idletimer_tg_info_v1 *info)
{
int ret;
info->timer = kzalloc(sizeof(*info->timer), GFP_KERNEL);
info->timer = kmalloc(sizeof(*info->timer), GFP_KERNEL);
if (!info->timer) {
ret = -ENOMEM;
goto out;
@@ -408,6 +408,7 @@ static int idletimer_tg_create_v1(struct idletimer_tg_info_v1 *info)
info->timer->uid = 0;
info->timer->last_modified_timer =
ktime_to_timespec64(ktime_get_boottime());
info->timer->suspend_time_valid = false;
info->timer->pm_nb.notifier_call = idletimer_resume;
ret = register_pm_notifier(&info->timer->pm_nb);