stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jiri Slaby <jslaby@suse.cz>
To: xinhui <xinhui@linux.vnet.ibm.com>,
	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 10:56:09 +0100	[thread overview]
Message-ID: <565585B9.4040706@suse.cz> (raw)
In-Reply-To: <56555613.1040502@linux.vnet.ibm.com>

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()")

> 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?

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);

thanks,
-- 
js
suse labs

  reply	other threads:[~2015-11-25  9:56 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CACT4Y+bHQbAB68VFi7Romcs-Z9ZW3kQRvcq+BvHH1oa5NcAdLA@mail.gmail.com>
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 [this message]
2015-11-25 10:32       ` xinhui
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=565585B9.4040706@suse.cz \
    --to=jslaby@suse.cz \
    --cc=alan@linux.intel.com \
    --cc=dvyukov@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=xinhui@linux.vnet.ibm.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).