Netdev List
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: albin_yang@163.com
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, tglx@linutronix.de
Subject: Re: [PATCH net] nfc: fix potential illegal memory access
Date: Sun, 07 Jul 2019 13:07:51 -0700 (PDT)	[thread overview]
Message-ID: <20190707.130751.259550761475180.davem@davemloft.net> (raw)
In-Reply-To: <1562506660-15853-1-git-send-email-albin_yang@163.com>

From: Yang Wei <albin_yang@163.com>
Date: Sun,  7 Jul 2019 21:37:40 +0800

> The frags_q is used before __skb_queue_head_init when conn_info is
> NULL. It may result in illegal memory access.
> 
> Signed-off-by: Yang Wei <albin_yang@163.com>
> ---
>  net/nfc/nci/data.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/net/nfc/nci/data.c b/net/nfc/nci/data.c
> index 0a0c265..b5f16cb 100644
> --- a/net/nfc/nci/data.c
> +++ b/net/nfc/nci/data.c
> @@ -104,14 +104,14 @@ static int nci_queue_tx_data_frags(struct nci_dev *ndev,
>  
>  	pr_debug("conn_id 0x%x, total_len %d\n", conn_id, total_len);
>  
> +	__skb_queue_head_init(&frags_q);
> +
>  	conn_info = nci_get_conn_info_by_conn_id(ndev, conn_id);
>  	if (!conn_info) {
>  		rc = -EPROTO;
>  		goto free_exit;
>  	}
>  
> -	__skb_queue_head_init(&frags_q);
> -

Just change the goto into "goto exit;", much simpler one-line fix.

      reply	other threads:[~2019-07-07 20:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-07 13:37 [PATCH net] nfc: fix potential illegal memory access Yang Wei
2019-07-07 20:07 ` David Miller [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=20190707.130751.259550761475180.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=albin_yang@163.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=tglx@linutronix.de \
    /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