All of lore.kernel.org
 help / color / mirror / Atom feed
From: xinhui <xinhui@linux.vnet.ibm.com>
To: Jiri Slaby <jslaby@suse.cz>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: dvyukov@google.com, linux-kernel@vger.kernel.org,
	Alan Cox <alan@linux.intel.com>, stable <stable@vger.kernel.org>
Subject: Re: [PATCH] TTY: n_gsm, fix false positive WARN_ON
Date: Wed, 25 Nov 2015 18:32:40 +0800	[thread overview]
Message-ID: <56558E48.3020604@linux.vnet.ibm.com> (raw)
In-Reply-To: <565585B9.4040706@suse.cz>

hi, Jiri

On 2015/11/25 17:56, Jiri Slaby wrote:
> Hi,
>
> On 11/25/2015, 07:32 AM, xinhui wrote:
>>      This warning should blame on commit 5a640967 ("tty/n_gsm.c: fix a
>> memory leak in gsmld_open()").
>
> Oh, yes, I messed up the "Fixes" line then. It should write:
> Fixes: 5a640967 ("tty/n_gsm.c: fix a memory leak in gsmld_open()")
>
that's Okay. :)

>> I have one confusion. As there is field gsm->num to store the index of
>> gsm_mux[]. so in gsm_cleanup_mux(), why we still use for-loop to find
>> this mux?
>>
>> In error handle path, for example, the call trace in this patch, as we
>> failed to activate it and the
>> gsm->num is invalid(and the value is 0). we can just modify the codes
>> like below:
>>
>> if(gsm_mux[gsm->num] == gsm)
>> ....other work
>> else
>>      return;
>>
>> I think it would work, and the logic is correct. Or I just miss
>> something important?
>
> Yup, it looks like a cleanup. Could you prepare a separate patch for that?
>
yes, I will do that :)

> Something like this:
>          /* open failed before registering => nothing to do */
>          if (gsm_mux[gsm->num] != gsm)
>                return;
>          spin_lock(&gsm_mux_lock);
>          gsm_mux[gsm->num] = NULL;
>          spin_unlock(&gsm_mux_lock);
>
looks pretty good, thanks.

> thanks,
>
thanks
xinhui


  reply	other threads:[~2015-11-25 10:34 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-24 10:35 WARNING in gsm_cleanup_mux Dmitry Vyukov
2015-11-24 16:54 ` [PATCH] TTY: n_gsm, fix false positive WARN_ON Jiri Slaby
2015-11-25  6:32   ` xinhui
2015-11-25  9:56     ` Jiri Slaby
2015-11-25 10:32       ` xinhui [this message]
2016-02-28 16:16         ` Dmitry Vyukov
2016-03-01  5:01           ` Greg Kroah-Hartman
2016-03-01  9:03             ` Dmitry Vyukov
2016-03-01 17:15               ` Greg Kroah-Hartman
2016-03-22 17:09                 ` Jiri Slaby

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=56558E48.3020604@linux.vnet.ibm.com \
    --to=xinhui@linux.vnet.ibm.com \
    --cc=alan@linux.intel.com \
    --cc=dvyukov@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jslaby@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.