netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: netdev@vger.kernel.org
Cc: Florian Westphal <fwestphal@astaro.com>, Florian Westphal <fw@strlen.de>
Subject: [PATCH 1/5] netlink: append NLMSG_DONE to compatskb, too
Date: Mon, 15 Feb 2010 17:46:29 +0100	[thread overview]
Message-ID: <1266252393-20911-2-git-send-email-fw@strlen.de> (raw)
In-Reply-To: <1266252393-20911-1-git-send-email-fw@strlen.de>

From: Florian Westphal <fwestphal@astaro.com>

modules using netlink may supply a 2nd skb, (via frag_list)
that contains an alternative data set meant for applications
using 32bit compatibility mode.

In such a case, netlink_recvmsg will use this 2nd skb instead of the
original one.

Without this patch, such compat applications will retrieve
all netlink dump data, but will then get an unexpected EOF.

Signed-off-by: Florian Westphal <fw@strlen.de>
---
 net/netlink/af_netlink.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index 4c5972b..4910031 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -1698,6 +1698,14 @@ static int netlink_dump(struct sock *sk)
 
 	memcpy(nlmsg_data(nlh), &len, sizeof(len));
 
+#ifdef CONFIG_COMPAT_NETLINK_MESSAGES
+	if (unlikely(skb_shinfo(skb)->frag_list)) {
+		nlh = nlmsg_put_answer(skb_shinfo(skb)->frag_list, cb,
+					NLMSG_DONE, sizeof(len), NLM_F_MULTI);
+		if (nlh)
+			memcpy(nlmsg_data(nlh), &len, sizeof(len));
+	}
+#endif
 	if (sk_filter(sk, skb))
 		kfree_skb(skb);
 	else {
-- 
1.6.3.3


  reply	other threads:[~2010-02-15 16:46 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-15 16:46 xfrm: add x86 CONFIG_COMPAT support Florian Westphal
2010-02-15 16:46 ` Florian Westphal [this message]
2010-02-15 16:46 ` [PATCH 2/5] netlink: store MSG_CMSG_COMPAT flag in netlink_skb_parms Florian Westphal
2010-02-18  7:37   ` Johannes Berg
2010-02-15 16:46 ` [PATCH 3/5] xfrm: split nlmsg allocation and data copying Florian Westphal
2010-02-15 16:46 ` [PATCH 4/5] xfrm: CONFIG_COMPAT support for x86 architecture Florian Westphal
2010-02-18  7:57   ` Johannes Berg
2010-02-18  9:33     ` Florian Westphal
2010-02-15 16:46 ` [PATCH 5/5] net: sock_aio_write: set CMSG_MSG_COMPAT flag if is_compat_task Florian Westphal
  -- strict thread matches above, loose matches on Subject: below --
2010-02-19 12:41 [PATCH v2 0/5] xfrm: add x86 CONFIG_COMPAT support Florian Westphal
2010-02-19 12:41 ` [PATCH 1/5] netlink: append NLMSG_DONE to compatskb, too Florian Westphal

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=1266252393-20911-2-git-send-email-fw@strlen.de \
    --to=fw@strlen.de \
    --cc=fwestphal@astaro.com \
    --cc=netdev@vger.kernel.org \
    /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).