From: Patrick McHardy <kaber@trash.net>
To: Ollie Wild <aaw@rincewind.tv>
Cc: linux-kernel@vger.kernel.org, Maillist netdev <netdev@oss.sgi.com>
Subject: Re: [PATCH] fix dst_entry leak in icmp_push_reply()
Date: Thu, 18 Aug 2005 20:59:37 +0200 [thread overview]
Message-ID: <4304DA99.2080205@trash.net> (raw)
In-Reply-To: <4304D763.4090001@rincewind.tv>
[-- Attachment #1: Type: text/plain, Size: 634 bytes --]
Ollie Wild wrote:
> That said, I appreciate that the if-else condition doesn't seem quite
> right. The problem is, the icmp_push_reply() routine is implicitly
> using the queue as a success indicator. I put the
> ip_flush_pending_frames() call inside the else block because I wanted to
> guarantee that one of ip_push_pending_frames() and
> ip_flush_pending_frames() is always called. Both will do proper cleanup.
>
> I'm open to suggestions if you think there's a cleaner way to implement
> this.
Checking the return value of ip_append_data seems cleaner to me.
Patch attached.
Signed-off-by: Patrick McHardy <kaber@trash.net>
[-- Attachment #2: x --]
[-- Type: text/plain, Size: 844 bytes --]
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
--- a/net/ipv4/icmp.c
+++ b/net/ipv4/icmp.c
@@ -349,12 +349,12 @@ static void icmp_push_reply(struct icmp_
{
struct sk_buff *skb;
- ip_append_data(icmp_socket->sk, icmp_glue_bits, icmp_param,
- icmp_param->data_len+icmp_param->head_len,
- icmp_param->head_len,
- ipc, rt, MSG_DONTWAIT);
-
- if ((skb = skb_peek(&icmp_socket->sk->sk_write_queue)) != NULL) {
+ if (ip_append_data(icmp_socket->sk, icmp_glue_bits, icmp_param,
+ icmp_param->data_len+icmp_param->head_len,
+ icmp_param->head_len,
+ ipc, rt, MSG_DONTWAIT) < 0)
+ ip_flush_pending_frames(icmp_socket->sk);
+ else if ((skb = skb_peek(&icmp_socket->sk->sk_write_queue)) != NULL) {
struct icmphdr *icmph = skb->h.icmph;
unsigned int csum = 0;
struct sk_buff *skb1;
next prev parent reply other threads:[~2005-08-18 18:59 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-08-17 20:21 [PATCH] fix dst_entry leak in icmp_push_reply() Ollie Wild
2005-08-17 23:56 ` Patrick McHardy
2005-08-18 6:41 ` Ollie Wild
2005-08-18 18:42 ` Patrick McHardy
2005-08-18 18:42 ` Patrick McHardy
2005-08-18 18:45 ` Ollie Wild
2005-08-18 18:59 ` Patrick McHardy [this message]
2005-08-18 19:05 ` Ollie Wild
2005-08-18 21:32 ` David S. Miller
2005-08-18 21:32 ` David S. Miller
2005-08-18 19:05 ` Ollie Wild
2005-08-18 18:59 ` Patrick McHardy
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=4304DA99.2080205@trash.net \
--to=kaber@trash.net \
--cc=aaw@rincewind.tv \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@oss.sgi.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.