linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ferruh Yigit <fery@cypress.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Wei Yongjun <weiyj.lk@gmail.com>,
	javier@dowhile0.org, yongjun_wei@trendmicro.com.cn,
	linux-input@vger.kernel.org
Subject: Re: [PATCH] Input: cyttsp4 - fix potential NULL pointer dereference in cyttsp4_watchdog_timer()
Date: Mon, 26 Aug 2013 08:54:30 +0300	[thread overview]
Message-ID: <521AED96.7030804@cypress.com> (raw)
In-Reply-To: <2cac6f3b-3107-4ead-95e3-f4070b894dc6@email.android.com>

On 08/26/2013 08:26 AM, Dmitry Torokhov wrote:
> Wei Yongjun <weiyj.lk@gmail.com> wrote:
>> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
>>
>> The dereference should be moved below the NULL test.
>>
>> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
>> ---
>> drivers/input/touchscreen/cyttsp4_core.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/input/touchscreen/cyttsp4_core.c
>> b/drivers/input/touchscreen/cyttsp4_core.c
>> index 963da05..ffa8e35 100644
>> --- a/drivers/input/touchscreen/cyttsp4_core.c
>> +++ b/drivers/input/touchscreen/cyttsp4_core.c
>> @@ -1244,11 +1244,11 @@ static void cyttsp4_watchdog_timer(unsigned
>> long handle)
>> {
>>      struct cyttsp4 *cd = (struct cyttsp4 *)handle;
>>
>> -    dev_vdbg(cd->dev, "%s: Watchdog timer triggered\n", __func__);
>> -
>>      if (!cd)
>>              return;
>>
> Actually this test does not make any sense and we should rather remove it.
Agreed on removing it. For cases "cd" can be NULL/invalid, watchdog
already stopped:
1- in probe(), when timer set, cd allocated and NULL check done.
2- in probe(), in error path after timer set, watchdog stopped before
"cd" freed
3- in cyttsp4_remove(), watchdog stopped before "cd" freed

>
>> +    dev_vdbg(cd->dev, "%s: Watchdog timer triggered\n", __func__);
>> +
>>      if (!work_pending(&cd->watchdog_work))
>>              schedule_work(&cd->watchdog_work);
>>
> Hi Wei,
> Thanks.
>

This message and any attachments may contain Cypress (or its subsidiaries) confidential information. If it has been received in error, please advise the sender and immediately delete this message.

      reply	other threads:[~2013-08-26  6:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-26  4:55 [PATCH] Input: cyttsp4 - fix potential NULL pointer dereference in cyttsp4_watchdog_timer() Wei Yongjun
2013-08-26  5:26 ` Dmitry Torokhov
2013-08-26  5:54   ` Ferruh Yigit [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=521AED96.7030804@cypress.com \
    --to=fery@cypress.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=javier@dowhile0.org \
    --cc=linux-input@vger.kernel.org \
    --cc=weiyj.lk@gmail.com \
    --cc=yongjun_wei@trendmicro.com.cn \
    /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).