All of lore.kernel.org
 help / color / mirror / Atom feed
* [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: Fix double call of dev_queue_xmit
@ 2017-01-28  9:25 Sven Eckelmann
  2017-01-28  9:25 ` [B.A.T.M.A.N.] [PATCH 2/2] batman-adv: Fix includes for IS_ERR/ERR_PTR Sven Eckelmann
  2017-01-28  9:43 ` [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: Fix double call of dev_queue_xmit Sven Eckelmann
  0 siblings, 2 replies; 6+ messages in thread
From: Sven Eckelmann @ 2017-01-28  9:25 UTC (permalink / raw)
  To: b.a.t.m.a.n

The net_xmit_eval has side effects because it is not making sure that e
isn't evaluated twice.

    #define net_xmit_eval(e)        ((e) == NET_XMIT_CN ? 0 : (e))

The code proposed by David Miller

    return net_xmit_eval(dev_queue_xmit(skb));

will therefore get transformed into

    return ((dev_queue_xmit(skb)) == NET_XMIT_CN ? 0 : (dev_queue_xmit(skb)))

dev_queue_xmit will therefore be tried again (with an already consumed skb)
whenever the return code is not NET_XMIT_CN.

Fixes: 17efab9867c5 ("batman-adv: Simplify handling of NET_XMIT_CN")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
 net/batman-adv/send.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/batman-adv/send.c b/net/batman-adv/send.c
index d9b28890..1489ec27 100644
--- a/net/batman-adv/send.c
+++ b/net/batman-adv/send.c
@@ -77,6 +77,7 @@ int batadv_send_skb_packet(struct sk_buff *skb,
 {
 	struct batadv_priv *bat_priv;
 	struct ethhdr *ethhdr;
+	int ret;
 
 	bat_priv = netdev_priv(hard_iface->soft_iface);
 
@@ -115,7 +116,8 @@ int batadv_send_skb_packet(struct sk_buff *skb,
 	 * congestion and traffic shaping, it drops and returns NET_XMIT_DROP
 	 * (which is > 0). This will not be treated as an error.
 	 */
-	return net_xmit_eval(dev_queue_xmit(skb));
+	ret = dev_queue_xmit(skb);
+	return net_xmit_eval(ret);
 send_skb_err:
 	kfree_skb(skb);
 	return NET_XMIT_DROP;
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [B.A.T.M.A.N.] [PATCH 2/2] batman-adv: Fix includes for IS_ERR/ERR_PTR
  2017-01-28  9:25 [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: Fix double call of dev_queue_xmit Sven Eckelmann
@ 2017-01-28  9:25 ` Sven Eckelmann
  2017-01-28 21:22   ` Linus Lüssing
  2017-01-28  9:43 ` [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: Fix double call of dev_queue_xmit Sven Eckelmann
  1 sibling, 1 reply; 6+ messages in thread
From: Sven Eckelmann @ 2017-01-28  9:25 UTC (permalink / raw)
  To: b.a.t.m.a.n

IS_ERR/ERR_PTR are not defined in linux/device.h but in linux/err.h. The
files using these macros therefore have to include the correct one.

Reported-by: Linus Luessing <linus.luessing@web.de>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
 net/batman-adv/debugfs.c  | 2 +-
 net/batman-adv/tp_meter.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/batman-adv/debugfs.c b/net/batman-adv/debugfs.c
index 5406148b..e32ad47c 100644
--- a/net/batman-adv/debugfs.c
+++ b/net/batman-adv/debugfs.c
@@ -19,7 +19,7 @@
 #include "main.h"
 
 #include <linux/debugfs.h>
-#include <linux/device.h>
+#include <linux/err.h>
 #include <linux/errno.h>
 #include <linux/export.h>
 #include <linux/fs.h>
diff --git a/net/batman-adv/tp_meter.c b/net/batman-adv/tp_meter.c
index 07f64b60..c94ebdec 100644
--- a/net/batman-adv/tp_meter.c
+++ b/net/batman-adv/tp_meter.c
@@ -23,7 +23,7 @@
 #include <linux/byteorder/generic.h>
 #include <linux/cache.h>
 #include <linux/compiler.h>
-#include <linux/device.h>
+#include <linux/err.h>
 #include <linux/etherdevice.h>
 #include <linux/fs.h>
 #include <linux/if_ether.h>
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: Fix double call of dev_queue_xmit
  2017-01-28  9:25 [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: Fix double call of dev_queue_xmit Sven Eckelmann
  2017-01-28  9:25 ` [B.A.T.M.A.N.] [PATCH 2/2] batman-adv: Fix includes for IS_ERR/ERR_PTR Sven Eckelmann
@ 2017-01-28  9:43 ` Sven Eckelmann
  1 sibling, 0 replies; 6+ messages in thread
From: Sven Eckelmann @ 2017-01-28  9:43 UTC (permalink / raw)
  To: b.a.t.m.a.n

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

On Samstag, 28. Januar 2017 10:25:25 CET Sven Eckelmann wrote:
> The net_xmit_eval has side effects because it is not making sure that e
> isn't evaluated twice.
> 
>     #define net_xmit_eval(e)        ((e) == NET_XMIT_CN ? 0 : (e))
> 
> The code proposed by David Miller
> 
>     return net_xmit_eval(dev_queue_xmit(skb));
> 
> will therefore get transformed into
> 
>     return ((dev_queue_xmit(skb)) == NET_XMIT_CN ? 0 : (dev_queue_xmit(skb)))
> 
> dev_queue_xmit will therefore be tried again (with an already consumed skb)
> whenever the return code is not NET_XMIT_CN.
> 
> Fixes: 17efab9867c5 ("batman-adv: Simplify handling of NET_XMIT_CN")
> Signed-off-by: Sven Eckelmann <sven@narfation.org>
> ---
>  net/batman-adv/send.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

I was so embarrassed about not catching these two that I've already applied
them an prepared the changes for net-next.

Kind regards,
	Sven

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCH 2/2] batman-adv: Fix includes for IS_ERR/ERR_PTR
  2017-01-28  9:25 ` [B.A.T.M.A.N.] [PATCH 2/2] batman-adv: Fix includes for IS_ERR/ERR_PTR Sven Eckelmann
@ 2017-01-28 21:22   ` Linus Lüssing
  2017-01-28 21:24     ` Linus Lüssing
  0 siblings, 1 reply; 6+ messages in thread
From: Linus Lüssing @ 2017-01-28 21:22 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking

On Sat, Jan 28, 2017 at 10:25:26AM +0100, Sven Eckelmann wrote:
> IS_ERR/ERR_PTR are not defined in linux/device.h but in linux/err.h. The
> files using these macros therefore have to include the correct one.
> 
> Reported-by: Linus Luessing <linus.luessing@web.de>
> Signed-off-by: Sven Eckelmann <sven@narfation.org>

Hm, my @web.de mail address is deprecated (read-only, don't ask me
why :D).

Would be nice if it could be updated upon committing. (but if
someone forgets not a big problem either, as it's documented in
.mailmap)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCH 2/2] batman-adv: Fix includes for IS_ERR/ERR_PTR
  2017-01-28 21:22   ` Linus Lüssing
@ 2017-01-28 21:24     ` Linus Lüssing
  0 siblings, 0 replies; 6+ messages in thread
From: Linus Lüssing @ 2017-01-28 21:24 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking

On Sat, Jan 28, 2017 at 10:22:49PM +0100, Linus Lüssing wrote:
> On Sat, Jan 28, 2017 at 10:25:26AM +0100, Sven Eckelmann wrote:
> > IS_ERR/ERR_PTR are not defined in linux/device.h but in linux/err.h. The
> > files using these macros therefore have to include the correct one.
> > 
> > Reported-by: Linus Luessing <linus.luessing@web.de>
> > Signed-off-by: Sven Eckelmann <sven@narfation.org>
> 
> Hm, my @web.de mail address is deprecated (read-only, don't ask me
> why :D).
> 
> Would be nice if it could be updated upon committing. (but if
> someone forgets not a big problem either, as it's documented in
> .mailmap)

Ah, there's a PR already for David - then just forget my last mail :).

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [B.A.T.M.A.N.] [PATCH 2/2] batman-adv: Fix includes for IS_ERR/ERR_PTR
  2017-01-28 10:56 [PATCH 0/2] pull request for net-next: batman-adv 2017-01-28 Simon Wunderlich
@ 2017-01-28 10:56 ` Simon Wunderlich
  0 siblings, 0 replies; 6+ messages in thread
From: Simon Wunderlich @ 2017-01-28 10:56 UTC (permalink / raw)
  To: davem; +Cc: netdev, b.a.t.m.a.n

From: Sven Eckelmann <sven@narfation.org>

IS_ERR/ERR_PTR are not defined in linux/device.h but in linux/err.h. The
files using these macros therefore have to include the correct one.

Reported-by: Linus Luessing <linus.luessing@web.de>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
---
 net/batman-adv/debugfs.c  | 2 +-
 net/batman-adv/tp_meter.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/batman-adv/debugfs.c b/net/batman-adv/debugfs.c
index 5406148b9497..e32ad47c6efd 100644
--- a/net/batman-adv/debugfs.c
+++ b/net/batman-adv/debugfs.c
@@ -19,7 +19,7 @@
 #include "main.h"
 
 #include <linux/debugfs.h>
-#include <linux/device.h>
+#include <linux/err.h>
 #include <linux/errno.h>
 #include <linux/export.h>
 #include <linux/fs.h>
diff --git a/net/batman-adv/tp_meter.c b/net/batman-adv/tp_meter.c
index 07f64b60b528..c94ebdecdc3d 100644
--- a/net/batman-adv/tp_meter.c
+++ b/net/batman-adv/tp_meter.c
@@ -23,7 +23,7 @@
 #include <linux/byteorder/generic.h>
 #include <linux/cache.h>
 #include <linux/compiler.h>
-#include <linux/device.h>
+#include <linux/err.h>
 #include <linux/etherdevice.h>
 #include <linux/fs.h>
 #include <linux/if_ether.h>
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-01-28 21:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-28  9:25 [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: Fix double call of dev_queue_xmit Sven Eckelmann
2017-01-28  9:25 ` [B.A.T.M.A.N.] [PATCH 2/2] batman-adv: Fix includes for IS_ERR/ERR_PTR Sven Eckelmann
2017-01-28 21:22   ` Linus Lüssing
2017-01-28 21:24     ` Linus Lüssing
2017-01-28  9:43 ` [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: Fix double call of dev_queue_xmit Sven Eckelmann
2017-01-28 10:56 [PATCH 0/2] pull request for net-next: batman-adv 2017-01-28 Simon Wunderlich
2017-01-28 10:56 ` [B.A.T.M.A.N.] [PATCH 2/2] batman-adv: Fix includes for IS_ERR/ERR_PTR Simon Wunderlich

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.