Netdev Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH][bpf-next][v2] bpf: return -EBADRQC for invalid map type in __bpf_tx_xdp_map
@ 2020-01-10  1:04 Li RongQing
  2020-01-14 19:37 ` Daniel Borkmann
  0 siblings, 1 reply; 2+ messages in thread
From: Li RongQing @ 2020-01-10  1:04 UTC (permalink / raw)
  To: netdev, songliubraving, daniel, bpf

a negative value should be returned if map->map_type
is invalid although that seems unlikely now, then the
caller will continue to handle buffer, otherwise the
buffer will be leaked

Daniel Borkmann suggested:
-EBADRQC should be returned to keep consistent with
xdp_do_generic_redirect_map() for the tracepoint output
and not to be confused with -EOPNOTSUPP from other
locations like dev_map_enqueue() when ndo_xdp_xmit
is missing or such.

Suggested-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Li RongQing <lirongqing@baidu.com>
---
 net/core/filter.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/core/filter.c b/net/core/filter.c
index 1cbac34a4e11..8769da0f56bf 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -3512,7 +3512,7 @@ static int __bpf_tx_xdp_map(struct net_device *dev_rx, void *fwd,
 	case BPF_MAP_TYPE_XSKMAP:
 		return __xsk_map_redirect(fwd, xdp);
 	default:
-		break;
+		return -EBADRQC;
 	}
 	return 0;
 }
-- 
2.16.2


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

* Re: [PATCH][bpf-next][v2] bpf: return -EBADRQC for invalid map type in __bpf_tx_xdp_map
  2020-01-10  1:04 [PATCH][bpf-next][v2] bpf: return -EBADRQC for invalid map type in __bpf_tx_xdp_map Li RongQing
@ 2020-01-14 19:37 ` Daniel Borkmann
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Borkmann @ 2020-01-14 19:37 UTC (permalink / raw)
  To: Li RongQing, netdev, songliubraving, bpf

On 1/10/20 2:04 AM, Li RongQing wrote:
> a negative value should be returned if map->map_type
> is invalid although that seems unlikely now, then the
> caller will continue to handle buffer, otherwise the
> buffer will be leaked
> 
> Daniel Borkmann suggested:
> -EBADRQC should be returned to keep consistent with
> xdp_do_generic_redirect_map() for the tracepoint output
> and not to be confused with -EOPNOTSUPP from other
> locations like dev_map_enqueue() when ndo_xdp_xmit
> is missing or such.
> 
> Suggested-by: Daniel Borkmann <daniel@iogearbox.net>
> Signed-off-by: Li RongQing <lirongqing@baidu.com>

Applied, thanks (fixed up commit message a bit).

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

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-10  1:04 [PATCH][bpf-next][v2] bpf: return -EBADRQC for invalid map type in __bpf_tx_xdp_map Li RongQing
2020-01-14 19:37 ` Daniel Borkmann

Netdev Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/netdev/0 netdev/git/0.git
	git clone --mirror https://lore.kernel.org/netdev/1 netdev/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 netdev netdev/ https://lore.kernel.org/netdev \
		netdev@vger.kernel.org
	public-inbox-index netdev

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.netdev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git