netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eugene Teo <eteo@redhat.com>
To: netdev@vger.kernel.org
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>,
	Randy Dunlap <randy.dunlap@oracle.com>,
	Eugene Teo <eteo@redhat.com>
Subject: Re: [2.6 patch] net/llc/llc_conn.c: fix possible NULL dereference
Date: Sat, 19 May 2007 13:49:11 +0800	[thread overview]
Message-ID: <464E8FD7.9030203@redhat.com> (raw)
In-Reply-To: <20070518223005.91236c38.randy.dunlap@oracle.com>

[-- Attachment #1: Type: text/plain, Size: 696 bytes --]

Randy Dunlap wrote:
> On Sat, 19 May 2007 13:13:07 +0800 Eugene Teo wrote:
> 
>> skb_peek() might return an empty list. skb should be checked before calling
>> llc_pdu_sn_hdr() with it.
>>
>> Spotted by the Coverity checker.
>>
>> Signed-off-by: Eugene Teo <eteo@redhat.com>
[...]
> 
> Oh, and your patch has spaces instead of tabs.  It's a hassle to
> get thunderbird to send a patch that preserves tabs.  See if this:
>    http://mbligh.org/linuxdocs/Email/Clients/Thunderbird
> helps you any.

Here's a resend:

skb_peek() might return an empty list. skb should be checked before calling
llc_pdu_sn_hdr() with it.

Spotted by the Coverity checker.

Signed-off-by: Eugene Teo <eteo@redhat.com>

[-- Attachment #2: 2.6-llc_conn.patch --]
[-- Type: text/x-patch, Size: 403 bytes --]

diff --git a/net/llc/llc_conn.c b/net/llc/llc_conn.c
index 3b8cfbe..6d3a07e 100644
--- a/net/llc/llc_conn.c
+++ b/net/llc/llc_conn.c
@@ -324,6 +324,8 @@ int llc_conn_remove_acked_pdus(struct sock *sk, u8 nr, u16 *how_many_unacked)
 	if (!q_len)
 		goto out;
 	skb = skb_peek(&llc->pdu_unack_q);
+	if (!skb)
+		goto out;
 	pdu = llc_pdu_sn_hdr(skb);
 
 	/* finding position of last acked pdu in queue */

  parent reply	other threads:[~2007-05-19  5:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <464E8763.3010609@redhat.com>
2007-05-19  5:43 ` [2.6 patch] net/llc/llc_conn.c: fix possible NULL dereference Herbert Xu
     [not found] ` <20070518223005.91236c38.randy.dunlap@oracle.com>
2007-05-19  5:49   ` Eugene Teo [this message]
2007-05-19  6:03     ` David Miller

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=464E8FD7.9030203@redhat.com \
    --to=eteo@redhat.com \
    --cc=acme@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=randy.dunlap@oracle.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).