Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp768630lqt; Thu, 6 Jun 2024 19:26:32 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU/uyaWdXHnqDukpSCtldiZ8TXGiTo0sYQrUo8u/gY2MYgKAzEP2v3Tx3UMXwQS4fGkkLgb3M5cF/GqfowAeah5lbEaS+eRaXlUkw95Cw== X-Google-Smtp-Source: AGHT+IEKRw5++FmNM5JT2E75DxmiHF4PnemCNAANeRPrqv4+c1uY09SlfPN+YCc19mlkY6QjlSYp X-Received: by 2002:a50:ccdc:0:b0:57a:21ac:cffc with SMTP id 4fb4d7f45d1cf-57c509aad37mr471674a12.41.1717727192737; Thu, 06 Jun 2024 19:26:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717727192; cv=pass; d=google.com; s=arc-20160816; b=U7gLNuF0y8v2vm9B+NkZpXwSPrqCzwwUgqfKnWzCTUWX4809jkzc6QCI1ymZbRz33Q Gv8+tl/M0bVpnuEcQ9wBb8OGsb05hgEc/sTPmTNHiWXFXWeqlf+6a3NN8NlSwgu3HVV5 dPztO4DA9EWXVwL2ROFGoTa43ZAyBxryZ0P0zL+fkyuwpi7dbII3/RqlsF3wYmKckxgE JKoW79lvYmT0Yg4K2VodVLT1JKj7J2zzgeOYYOrUHyfRJfJVUq2uwYPpv4MJMDevDpea PK5iwGIW/XKBZBgg0pcZiaSOtDhf5FZ1p+uR9mcU3KQVAZwbGF/X3s8N/blhG5JfZ4FS 0Djw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=BLEU828uCInFLuwTYCQ33Lcs5sdd10hyJlrloS9Xaw4=; fh=iBJFCkam7a9Andzu4tk1Pm/QTTymhFlIX1cpsX/6/3w=; b=juD6uQiYQTMCC1tl1P/UMuW/bUOnLxVdlHswnFJELvgzdqefUGIyLvqFuquPLGEQ1v 4Q95lJpJOzyipgD9tesHdN8/etRQd1jy0vBJy1+nrYbutT/mojzclHHozTaTaN1b0hlx gpMB0pn4lXDqIgHTYpmEDUGTIrAsjh75WGQhjIn8jrK8TCN/DIqyyjBbSC6tM1fq3wGw fHK9aqAtCfGf2RIJnKZE7g2p/oxIfKy51QExGEfqCVKx+PFxEE2k6XUCSjqNYbQuLfAX zi0ekr89xYAJFH1S5m05HJhXnsULAOptY1hVkadFaAi0gRegp9PZDHEWwFTGE2A8KmGQ hVLQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=uIFYUYCk; arc=pass (i=1 spf=pass spfdomain=mediatek.com dkim=pass dkdomain=mediatek.com dmarc=pass fromdomain=mediatek.com); spf=pass (google.com: domain of linux-kernel+bounces-205245-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-205245-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57aae227e91si1304432a12.362.2024.06.06.19.26.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 19:26:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-205245-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=uIFYUYCk; arc=pass (i=1 spf=pass spfdomain=mediatek.com dkim=pass dkdomain=mediatek.com dmarc=pass fromdomain=mediatek.com); spf=pass (google.com: domain of linux-kernel+bounces-205245-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-205245-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 6D9D41F243FC for ; Fri, 7 Jun 2024 02:26:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 663F2125C0; Fri, 7 Jun 2024 02:26:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="uIFYUYCk" Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4C528819 for ; Fri, 7 Jun 2024 02:26:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.61.82.184 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717727185; cv=none; b=LU3T1pkhuzpDZHIlPWZLE6oQO9yywM0OJeE+SX1FEs8QeZjGeG9GlehHK3Bld01AKmrqYD34yR1CHD23YySYAynbEHknzFbTi8H/Qi1gZmffzeWGBctD0x7QJ6cl0fWpElmTuIOD+hHW4Dmsp8fAIUWp+Zuyx8ciofP0wkbPx/w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717727185; c=relaxed/simple; bh=d3kPG/il1q6KCc+6zs88T4ul/hnCiaV64YoLO/tMf/M=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=U0aoZ0ZC0Pva9rLVDMXf0NIkwF+Ui2GWzYJBagZ7ns0tW8hApsiKdIkDc3rWbEfBjrxkve3XlUETmVHanKJZuU0U2UUl3hSHEbCl1//S64fnz2lqlr0JyMGOvhrxouLCvVRP197uwn+K3seMt1xumec5+3EhDsUjJX2cOPC9DY4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mediatek.com; spf=pass smtp.mailfrom=mediatek.com; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b=uIFYUYCk; arc=none smtp.client-ip=210.61.82.184 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mediatek.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mediatek.com X-UUID: 52114ffe247511efa22eafcdcd04c131-20240607 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=BLEU828uCInFLuwTYCQ33Lcs5sdd10hyJlrloS9Xaw4=; b=uIFYUYCkFdwmPziXHOc7czH/inm67R50e4fF2fUNvafml+9YY4gfb0fpfhHVRg1bnQUMGSgUWNjqdp1wlDQBx++vJgZ7mj/tvwKw8qPqTEvSHUp/DJaiCEtCBtFeXH/XiolcO0kSeUVCI7QJgXK7uVX2LXtIAvXUt+Mc8IS3bdo=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.39,REQID:3b63d2a0-caf0-4ac8-a844-eba207ac19b1,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:393d96e,CLOUDID:169ad084-4f93-4875-95e7-8c66ea833d57,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0,LES:1, SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: 52114ffe247511efa22eafcdcd04c131-20240607 Received: from mtkmbs11n1.mediatek.inc [(172.21.101.185)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1791235917; Fri, 07 Jun 2024 10:26:17 +0800 Received: from mtkmbs11n1.mediatek.inc (172.21.101.185) by mtkmbs13n1.mediatek.inc (172.21.101.193) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Fri, 7 Jun 2024 10:26:16 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Fri, 7 Jun 2024 10:26:16 +0800 From: Phil Chang To: CC: , , , , , , , , Subject: [PATCH v2] hrtimer: check hrtimer with a NULL function Date: Fri, 7 Jun 2024 10:26:14 +0800 Message-ID: <20240607022614.22902-1-phil.chang@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <877cf2i56q.fsf@somnus> References: <877cf2i56q.fsf@somnus> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Since hrtimers do not allow a NULL function to be passed, to prevent a kernel crash, return before adding the timer to a queue. Signed-off-by: Phil Chang --- kernel/time/hrtimer.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c index 492c14aac642..d32c1afe59b3 100644 --- a/kernel/time/hrtimer.c +++ b/kernel/time/hrtimer.c @@ -1285,6 +1285,9 @@ void hrtimer_start_range_ns(struct hrtimer *timer, ktime_t tim, struct hrtimer_clock_base *base; unsigned long flags; + if (WARN_ON(!timer->function)) + return; + /* * Check whether the HRTIMER_MODE_SOFT bit and hrtimer.is_soft * match on CONFIG_PREEMPT_RT = n. With PREEMPT_RT check the hard -- 2.18.0