From: Ursula Braun <ursula.braun@de.ibm.com>
To: davem@davemloft.net, netdev@vger.kernel.org, linux-s390@vger.kernel.org
Cc: schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com,
Hendrik Brueckner <brueckner@linux.vnet.ibm.com>,
Ursula Braun <ursula.braun@de.ibm.com>
Subject: [patch 2/5] [PATCH] af_iucv: fix oops in iucv_sock_recvmsg() for MSG_PEEK flag
Date: Tue, 21 Apr 2009 18:04:21 +0200 [thread overview]
Message-ID: <20090421161444.433278000@linux.vnet.ibm.com> (raw)
In-Reply-To: 20090421160419.971500000@linux.vnet.ibm.com
[-- Attachment #1: 603-af_iucv-oops.diff --]
[-- Type: text/plain, Size: 1317 bytes --]
From: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
If iucv_sock_recvmsg() is called with MSG_PEEK flag set, the skb is enqueued
twice. If the socket is then closed, the pointer to the skb is freed twice.
Remove the skb_queue_head() call for MSG_PEEK, because the skb_recv_datagram()
function already handles MSG_PEEK (does not dequeue the skb).
Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Signed-off-by: Ursula Braun <ursula.braun@de.ibm.com>
---
net/iucv/af_iucv.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
Index: net-2.6-uschi/net/iucv/af_iucv.c
===================================================================
--- net-2.6-uschi.orig/net/iucv/af_iucv.c
+++ net-2.6-uschi/net/iucv/af_iucv.c
@@ -814,6 +814,8 @@ static int iucv_sock_recvmsg(struct kioc
target = sock_rcvlowat(sk, flags & MSG_WAITALL, len);
+ /* receive/dequeue next skb:
+ * the function understands MSG_PEEK and, thus, does not dequeue skb */
skb = skb_recv_datagram(sk, flags, noblock, &err);
if (!skb) {
if (sk->sk_shutdown & RCV_SHUTDOWN)
@@ -861,9 +863,7 @@ static int iucv_sock_recvmsg(struct kioc
iucv_process_message_q(sk);
spin_unlock_bh(&iucv->message_q.lock);
}
-
- } else
- skb_queue_head(&sk->sk_receive_queue, skb);
+ }
done:
return err ? : copied;
next prev parent reply other threads:[~2009-04-21 16:14 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-21 16:04 [patch 0/5] [RESEND] af_iucv patches for 2.6.30-rc1 Ursula Braun
2009-04-21 16:04 ` [patch 1/5] [PATCH] af_iucv: consider state IUCV_CLOSING when closing a socket Ursula Braun
2009-04-21 16:04 ` Ursula Braun [this message]
2009-04-21 16:04 ` [patch 3/5] [PATCH] af_iucv: Reject incoming msgs if RECV_SHUTDOWN is set Ursula Braun
2009-04-21 16:04 ` [patch 4/5] [PATCH] af_iucv: Test additional sk states in iucv_sock_shutdown Ursula Braun
2009-04-21 16:04 ` [patch 5/5] [PATCH] af_iucv: Fix race when queuing incoming iucv messages Ursula Braun
2009-04-22 6:46 ` [patch 0/5] [RESEND] af_iucv patches for 2.6.30-rc1 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=20090421161444.433278000@linux.vnet.ibm.com \
--to=ursula.braun@de.ibm.com \
--cc=brueckner@linux.vnet.ibm.com \
--cc=davem@davemloft.net \
--cc=heiko.carstens@de.ibm.com \
--cc=linux-s390@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=schwidefsky@de.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).