From: Gaurav Singh <gaurav1086@gmail.com>
To: gaurav1086@gmail.com, Tony Luck <tony.luck@intel.com>,
Fenghua Yu <fenghua.yu@intel.com>,
linux-ia64@vger.kernel.org (open list:IA64 (Itanium) PLATFORM),
linux-kernel@vger.kernel.org (open list)
Subject: [PATCH] ia64: Add null pointer check for task in default_handler
Date: Wed, 17 Jun 2020 20:11:46 -0400 [thread overview]
Message-ID: <20200618001157.26035-1-gaurav1086@gmail.com> (raw)
In-Reply-To: <20200611150221.15665-1-gaurav1086@gmail.com>
If the task is NULL and the if condition is true
then task->pid would cause null pointer dereference.
Fix this by adding additional null check.
Signed-off-by: Gaurav Singh <gaurav1086@gmail.com>
---
arch/ia64/kernel/perfmon_default_smpl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/ia64/kernel/perfmon_default_smpl.c b/arch/ia64/kernel/perfmon_default_smpl.c
index a40c56020fc5..2732b4cf4296 100644
--- a/arch/ia64/kernel/perfmon_default_smpl.c
+++ b/arch/ia64/kernel/perfmon_default_smpl.c
@@ -111,7 +111,7 @@ default_handler(struct task_struct *task, void *buf, pfm_ovfl_arg_t *arg, struct
unsigned char ovfl_notify;
if (unlikely(buf == NULL || arg == NULL|| regs == NULL || task == NULL)) {
- DPRINT(("[%d] invalid arguments buf=%p arg=%p\n", task->pid, buf, arg));
+ DPRINT(("[%d] invalid arguments buf=%p arg=%p\n", task? task->pid : -1, buf, arg));
return -EINVAL;
}
--
2.17.1
prev parent reply other threads:[~2020-06-18 0:12 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-11 15:02 [PATCH] xdp_rxq_info_user: Replace malloc/memset w/calloc Gaurav Singh
2020-06-11 18:01 ` Jesper Dangaard Brouer
2020-06-12 0:26 ` Gaurav Singh
2020-06-12 0:36 ` Gaurav Singh
2020-06-12 6:42 ` Jesper Dangaard Brouer
2020-06-12 10:14 ` Joe Perches
2020-06-12 12:05 ` Jesper Dangaard Brouer
2020-06-12 15:19 ` Joe Perches
2020-06-12 12:06 ` Toke Høiland-Jørgensen
2020-06-12 18:53 ` [PATCH] xdp_rxq_info_user: Fix null pointer dereference. Replace malloc/memset with calloc Gaurav Singh
2020-06-12 20:20 ` Jesper Dangaard Brouer
2020-06-12 22:58 ` John Fastabend
2020-06-18 0:11 ` Gaurav Singh [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200618001157.26035-1-gaurav1086@gmail.com \
--to=gaurav1086@gmail.com \
--cc=fenghua.yu@intel.com \
--cc=linux-ia64@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tony.luck@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).