Skip to contentSkip to conversation

fix for nfacct infrastructure in net-next

PATCH In review [email protected] 2 participants 6 messages Jan 1, 2012 – Jan 2, 2012

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

PATCH 1/1 fix for nfacct infrastructure in net-next

From: Pablo Neira Ayuso <[email protected]>

Hi Dave,

Please, pull the following fix for the nfacct infrastructure already in your net-next tree.

You can pull it from:

git://1984.lsi.us.es/net-net nf-next

Thanks!

Pablo Neira Ayuso (1):
netfilter: nfnetlink_acct: fix nfnl_acct_get operation

 net/netfilter/nfnetlink_acct.c |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)
Signature · 1 line
1.7.7.3
author maintainer
#1 lore raw

PATCH 1/1 netfilter: nfnetlink_acct: fix nfnl_acct_get operation

From: Pablo Neira Ayuso <[email protected]>

The get operation was not sending the message that was built to user-space. This patch also includes the appropriate handling for the return value of netlink_unicast().

Moreover, fix error codes on error (for example, for non-existing entry was uncorrect).

---
 net/netfilter/nfnetlink_acct.c |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)
net/netfilter/nfnetlink_acct.c +13 -4
index 362ab6c..11ba013 100644
@@ -166,7 +166,7 @@ static int
 nfnl_acct_get(struct sock *nfnl, struct sk_buff *skb,
 	     const struct nlmsghdr *nlh, const struct nlattr * const tb[])
 {
-	int ret = 0;
+	int ret = -ENOENT;
 	struct nf_acct *cur;
 	char *acct_name;
 
@@ -186,17 +186,26 @@ nfnl_acct_get(struct sock *nfnl, struct sk_buff *skb,
 			continue;
 
 		skb2 = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
-		if (skb2 == NULL)
+		if (skb2 == NULL) {
+			ret = -ENOMEM;
 			break;
+		}
 
 		ret = nfnl_acct_fill_info(skb2, NETLINK_CB(skb).pid,
 					 nlh->nlmsg_seq,
 					 NFNL_MSG_TYPE(nlh->nlmsg_type),
 					 NFNL_MSG_ACCT_NEW, cur);
-		if (ret <= 0)
+		if (ret <= 0) {
 			kfree_skb(skb2);
+			break;
+		}
+		ret = netlink_unicast(nfnl, skb2, NETLINK_CB(skb).pid,
+					MSG_DONTWAIT);
+		if (ret > 0)
+			ret = 0;
 
-		break;
+		/* this avoids a loop in nfnetlink. */
+		return ret == -EAGAIN ? -ENOBUFS : ret;
 	}
 	return ret;
 }
Signature · 1 line
1.7.7.3
maintainer
#3 lore raw

From: Pablo Neira Ayuso <[email protected]>
Date: Sun, 1 Jan 2012 17:23:58 +0100

Quoted 5 lines · On Sun, Jan 01, 2012 at 05:22:24PM +0100, [email protected] wrote:
Quoted 4 lines

From: Pablo Neira Ayuso <[email protected]>

Hi Dave,

Quoted 8 lines
Quoted 6 lines

Please, pull the following fix for the nfacct infrastructure already in your net-next tree.

You can pull it from:

git://1984.lsi.us.es/net-net nf-next

                       ^^^^^^^

I meant to say net-next, of course.

I'm not pulling this.

If I pull from your "corrected" URL, "git://1984.lsi.us.es/net-next nf-next" it starts to download 17937 objects. Which means it's going to bring in all of your -next work as well as my net-next tree upon which it is based, not just this one bug fix.

These mistakes should never happen in the first place.

If you actually use "git request-pull" to generate the pull request email body, you can NEVER get the URL wrong, GIT enforces it to be correct and it enforces that the changes in your local tree are present at the remote URL as well.

You can't make these kinds of errors and oversights when you want to ask me to pull in bug fixes at the very last minute when Linus is about to make a final release.

Just toss these fixes, if they are so important submit them to Greg KH and the -stable branch after 3.2.0-final goes out.

author maintainer
#4 lore raw

Hi Dave,

Quoted 7 lines · David Miller

I'm not pulling this.

If I pull from your "corrected" URL, "git://1984.lsi.us.es/net-next nf-next" it starts to download 17937 objects. Which means it's going to bring in all of your -next work as well as my net-next tree upon which it is based, not just this one bug fix.

Quoted 6 lines

These mistakes should never happen in the first place.

If you actually use "git request-pull" to generate the pull request email body, you can NEVER get the URL wrong, GIT enforces it to be correct and it enforces that the changes in your local tree are present at the remote URL as well.

You caught me here, I wasn't using git request-pull. I'll do next time, sorry.

Quoted 3 lines

You can't make these kinds of errors and oversights when you want to ask me to pull in bug fixes at the very last minute when Linus is about to make a final release.

I think there's a misunderstanding.

This is not intended for current 3.2-rc7. This is a fix for something that is in your net-next tree (upcoming 3.3).

I can wait and resubmit this later, we have the entire 3.3-rc cycle to get it fixed. Sorry for rushing you.

Quoted 2 lines

Just toss these fixes, if they are so important submit them to Greg KH and the -stable branch after 3.2.0-final goes out.

maintainer
#5 lore raw

From: Pablo Neira Ayuso <[email protected]>
Date: Mon, 2 Jan 2012 02:04:15 +0100

Quoted 2 lines

This is not intended for current 3.2-rc7. This is a fix for something that is in your net-next tree (upcoming 3.3).

I think this is the communication problem we had, I thought this was a netfilter bug fix that was already in net-next that you wanted me to include in net.

Now that I understand the situation I've pulled the fix into net-next, thanks.