Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1277147

Re: [PATCH] TTY: n_gsm, fix false positive WARN_ON

From Jiri Slaby <jslaby@suse.cz>
Newsgroups linux.kernel
Subject Re: [PATCH] TTY: n_gsm, fix false positive WARN_ON
Date 2015-11-25 11:00 +0100
Message-ID <qyF1M-4qs-9@gated-at.bofh.it> (permalink)
References <qyjaW-6V9-3@gated-at.bofh.it> <qyp6F-2hl-3@gated-at.bofh.it> <qyBUe-2sg-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

WARNING in gsm_cleanup_mux Dmitry Vyukov <dvyukov@google.com> - 2015-11-24 11:40 +0100
  [PATCH] TTY: n_gsm, fix false positive WARN_ON Jiri Slaby <jslaby@suse.cz> - 2015-11-24 18:00 +0100
    Re: [PATCH] TTY: n_gsm, fix false positive WARN_ON xinhui <xinhui@linux.vnet.ibm.com> - 2015-11-25 07:40 +0100
      Re: [PATCH] TTY: n_gsm, fix false positive WARN_ON Jiri Slaby <jslaby@suse.cz> - 2015-11-25 11:00 +0100
        Re: [PATCH] TTY: n_gsm, fix false positive WARN_ON xinhui <xinhui@linux.vnet.ibm.com> - 2015-11-25 11:40 +0100

csiph-web