From patchwork Wed Aug 10 23:43:34 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 3387 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id BBCBE2406F for ; Wed, 10 Aug 2011 23:43:55 +0000 (UTC) Received: from mail-qy0-f173.google.com (mail-qy0-f173.google.com [209.85.216.173]) by fiordland.canonical.com (Postfix) with ESMTP id 85740A1844B for ; Wed, 10 Aug 2011 23:43:55 +0000 (UTC) Received: by qyk31 with SMTP id 31so3646989qyk.11 for ; Wed, 10 Aug 2011 16:43:55 -0700 (PDT) Received: by 10.229.63.14 with SMTP id z14mr18422qch.83.1313019834981; Wed, 10 Aug 2011 16:43:54 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.229.190.71 with SMTP id dh7cs97160qcb; Wed, 10 Aug 2011 16:43:54 -0700 (PDT) Received: from mr.google.com ([10.236.77.200]) by 10.236.77.200 with SMTP id d48mr13147011yhe.82.1313019834757 (num_hops = 1); Wed, 10 Aug 2011 16:43:54 -0700 (PDT) Received: by 10.236.77.200 with SMTP id d48mr9677666yhe.82.1313019834629; Wed, 10 Aug 2011 16:43:54 -0700 (PDT) Received: from e5.ny.us.ibm.com (e5.ny.us.ibm.com [32.97.182.145]) by mx.google.com with ESMTPS id n19si3044140wfe.48.2011.08.10.16.43.54 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 10 Aug 2011 16:43:54 -0700 (PDT) Received-SPF: pass (google.com: domain of jstultz@us.ibm.com designates 32.97.182.145 as permitted sender) client-ip=32.97.182.145; Authentication-Results: mx.google.com; spf=pass (google.com: domain of jstultz@us.ibm.com designates 32.97.182.145 as permitted sender) smtp.mail=jstultz@us.ibm.com Received: from d01relay04.pok.ibm.com (d01relay04.pok.ibm.com [9.56.227.236]) by e5.ny.us.ibm.com (8.14.4/8.13.1) with ESMTP id p7ANEI39007539; Wed, 10 Aug 2011 19:14:18 -0400 Received: from d01av03.pok.ibm.com (d01av03.pok.ibm.com [9.56.224.217]) by d01relay04.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p7ANhpR0230334; Wed, 10 Aug 2011 19:43:51 -0400 Received: from d01av03.pok.ibm.com (loopback [127.0.0.1]) by d01av03.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p7AJhckF025607; Wed, 10 Aug 2011 16:43:39 -0300 Received: from kernel.beaverton.ibm.com ([9.47.67.96]) by d01av03.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id p7AJhbiu025583; Wed, 10 Aug 2011 16:43:38 -0300 Received: by kernel.beaverton.ibm.com (Postfix, from userid 1056) id 10F9D1E750E; Wed, 10 Aug 2011 16:43:50 -0700 (PDT) From: John Stultz To: LKML Cc: John Stultz , Thomas Gleixner , stable@kernel.org Subject: [PATCH 1/3] alarmtimers: Avoid possible null pointer traversal Date: Wed, 10 Aug 2011 16:43:34 -0700 Message-Id: <1313019816-32519-2-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.7.3.2.146.gca209 In-Reply-To: <1313019816-32519-1-git-send-email-john.stultz@linaro.org> References: <1313019816-32519-1-git-send-email-john.stultz@linaro.org> We don't check if old_setting is non null before assigning it, so correct this. CC: Thomas Gleixner CC: stable@kernel.org Signed-off-by: John Stultz --- kernel/time/alarmtimer.c | 7 ++----- 1 files changed, 2 insertions(+), 5 deletions(-) diff --git a/kernel/time/alarmtimer.c b/kernel/time/alarmtimer.c index 59f369f..1dee3f6 100644 --- a/kernel/time/alarmtimer.c +++ b/kernel/time/alarmtimer.c @@ -479,11 +479,8 @@ static int alarm_timer_set(struct k_itimer *timr, int flags, if (!rtcdev) return -ENOTSUPP; - /* Save old values */ - old_setting->it_interval = - ktime_to_timespec(timr->it.alarmtimer.period); - old_setting->it_value = - ktime_to_timespec(timr->it.alarmtimer.node.expires); + if (old_setting) + alarm_timer_get(timr, old_setting); /* If the timer was already set, cancel it */ alarm_cancel(&timr->it.alarmtimer);