* Re: [PATCH] netfilter: provide udp*_lib_lookup for nf_tproxy
From: Paolo Abeni @ 2018-06-05 12:13 UTC (permalink / raw)
To: Arnd Bergmann, Pablo Neira Ayuso, David S. Miller,
Alexey Kuznetsov, Hideaki YOSHIFUJI
Cc: Máté Eckl, Willem de Bruijn, Eric Dumazet, David Ahern,
Martin KaFai Lau, netdev, linux-kernel
In-Reply-To: <20180605114056.1239571-1-arnd@arndb.de>
On Tue, 2018-06-05 at 13:40 +0200, Arnd Bergmann wrote:
> It is now possible to enable the libified nf_tproxy modules without
> also enabling NETFILTER_XT_TARGET_TPROXY, which throws off the
> ifdef logic in the udp core code:
>
> net/ipv6/netfilter/nf_tproxy_ipv6.o: In function `nf_tproxy_get_sock_v6':
> nf_tproxy_ipv6.c:(.text+0x1a8): undefined reference to `udp6_lib_lookup'
> net/ipv4/netfilter/nf_tproxy_ipv4.o: In function `nf_tproxy_get_sock_v4':
> nf_tproxy_ipv4.c:(.text+0x3d0): undefined reference to `udp4_lib_lookup'
>
> We can actually simplify the conditions now to provide the two functions
> exactly when they are needed.
>
> Fixes: 45ca4e0cf273 ("netfilter: Libify xt_TPROXY")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> net/ipv4/udp.c | 4 +---
> net/ipv6/udp.c | 4 +---
> 2 files changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
> index 4f16e5d71875..3365362cac88 100644
> --- a/net/ipv4/udp.c
> +++ b/net/ipv4/udp.c
> @@ -544,9 +544,7 @@ EXPORT_SYMBOL_GPL(udp4_lib_lookup_skb);
> /* Must be called under rcu_read_lock().
> * Does increment socket refcount.
> */
> -#if IS_ENABLED(CONFIG_NETFILTER_XT_MATCH_SOCKET) || \
> - IS_ENABLED(CONFIG_NETFILTER_XT_TARGET_TPROXY) || \
> - IS_ENABLED(CONFIG_NF_SOCKET_IPV4)
> +#if IS_ENABLED(CONFIG_NF_TPROXY_IPV4) || IS_ENABLED(CONFIG_NF_SOCKET_IPV4)
> struct sock *udp4_lib_lookup(struct net *net, __be32 saddr, __be16 sport,
> __be32 daddr, __be16 dport, int dif)
> {
> diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
> index 967acff95bbe..164afd31aebf 100644
> --- a/net/ipv6/udp.c
> +++ b/net/ipv6/udp.c
> @@ -285,9 +285,7 @@ EXPORT_SYMBOL_GPL(udp6_lib_lookup_skb);
> /* Must be called under rcu_read_lock().
> * Does increment socket refcount.
> */
> -#if IS_ENABLED(CONFIG_NETFILTER_XT_MATCH_SOCKET) || \
> - IS_ENABLED(CONFIG_NETFILTER_XT_TARGET_TPROXY) || \
> - IS_ENABLED(CONFIG_NF_SOCKET_IPV6)
> +#if IS_ENABLED(CONFIG_NF_TPROXY_IPV6) || IS_ENABLED(CONFIG_NF_SOCKET_IPV6)
> struct sock *udp6_lib_lookup(struct net *net, const struct in6_addr *saddr, __be16 sport,
> const struct in6_addr *daddr, __be16 dport, int dif)
> {
LGTM,
Acked-by: Paolo Abeni <pabeni@redhat.com>
Thanks,
Paolo
^ permalink raw reply
* Re: [PATCH net-next 1/2] ipv4: replace ip_hdr() with skb->data for optimization
From: Paolo Abeni @ 2018-06-05 12:20 UTC (permalink / raw)
To: Yafang Shao, edumazet, davem; +Cc: netdev, inux-kernel
In-Reply-To: <1528200262-11834-1-git-send-email-laoar.shao@gmail.com>
On Tue, 2018-06-05 at 08:04 -0400, Yafang Shao wrote:
> In ip receive path, when ip header hasn't been pulled yet, ip_hdr() and
> skb->data are pointing to the same byte.
>
> In ip output path, when ip header is just pushed, ip_hdr() and skb->data
> are pointing to the same byte.
>
> As ip_hdr() is more expensive than using skb->data, so replace ip_hdr()
> with skb->data in these situations for optimization.
IMHO this makes the code less readable and more error prone. Which kind
of performance improvement do you measure here?
Thanks,
Paolo
^ permalink raw reply
* Re: KASAN: slab-out-of-bounds Read in bpf_csum_update
From: Daniel Borkmann @ 2018-06-05 12:28 UTC (permalink / raw)
To: Dmitry Vyukov, syzbot
Cc: Alexei Starovoitov, David Miller, LKML, netdev, syzkaller-bugs
In-Reply-To: <CACT4Y+a7hZ0x16PnyJxrb7akBRNr-TDR8Cvn01G27HmAKVE_vg@mail.gmail.com>
On 06/04/2018 07:36 AM, Dmitry Vyukov wrote:
> On Mon, Jun 4, 2018 at 1:36 AM, syzbot
> <syzbot+efae31b384d5badbd620@syzkaller.appspotmail.com> wrote:
>> Hello,
>>
>> syzbot found the following crash on:
>>
>> HEAD commit: 0512e0134582 Merge tag 'xfs-4.17-fixes-3' of git://git.ker..
>> git tree: upstream
>> console output: https://syzkaller.appspot.com/x/log.txt?x=17eb2d7b800000
>> kernel config: https://syzkaller.appspot.com/x/.config?x=968b0b23c7854c0b
>> dashboard link: https://syzkaller.appspot.com/bug?extid=efae31b384d5badbd620
>> compiler: gcc (GCC) 8.0.1 20180413 (experimental)
>> syzkaller repro:https://syzkaller.appspot.com/x/repro.syz?x=162c6def800000
>> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=14fe3db7800000
>>
>> IMPORTANT: if you fix the bug, please add the following tag to the commit:
>> Reported-by: syzbot+efae31b384d5badbd620@syzkaller.appspotmail.com
>>
>> random: sshd: uninitialized urandom read (32 bytes read)
>> random: sshd: uninitialized urandom read (32 bytes read)
>> random: sshd: uninitialized urandom read (32 bytes read)
>> random: sshd: uninitialized urandom read (32 bytes read)
>> ==================================================================
>> BUG: KASAN: slab-out-of-bounds in ____bpf_csum_update net/core/filter.c:1679
>> [inline]
>> BUG: KASAN: slab-out-of-bounds in bpf_csum_update+0xb4/0xc0
>> net/core/filter.c:1673
>> Read of size 1 at addr ffff8801d9235b50 by task syz-executor507/4513
>>
>> CPU: 0 PID: 4513 Comm: syz-executor507 Not tainted 4.17.0-rc7+ #78
>> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
>> Google 01/01/2011
>> Call Trace:
>> __dump_stack lib/dump_stack.c:77 [inline]
>> dump_stack+0x1b9/0x294 lib/dump_stack.c:113
>> print_address_description+0x6c/0x20b mm/kasan/report.c:256
>> kasan_report_error mm/kasan/report.c:354 [inline]
>> kasan_report.cold.7+0x242/0x2fe mm/kasan/report.c:412
>> __asan_report_load1_noabort+0x14/0x20 mm/kasan/report.c:430
>> ____bpf_csum_update net/core/filter.c:1679 [inline]
>> bpf_csum_update+0xb4/0xc0 net/core/filter.c:1673
>
> /\/\/\/\/\
>
> Are there any known bugs with unwind through bpf functions?
Looks like you don't have kallsyms export enabled, here's a syzkaller diff
to get jit images exposed, then it should work:
diff --git a/tools/create-image.sh b/tools/create-image.sh
index 9f82482..395a2a0 100755
--- a/tools/create-image.sh
+++ b/tools/create-image.sh
@@ -23,6 +23,7 @@ echo 'SELINUX=disabled' | sudo tee $DIR/etc/selinux/config
echo "kernel.printk = 7 4 1 3" | sudo tee -a $DIR/etc/sysctl.conf
echo 'debug.exception-trace = 0' | sudo tee -a $DIR/etc/sysctl.conf
echo "net.core.bpf_jit_enable = 1" | sudo tee -a $DIR/etc/sysctl.conf
+echo "net.core.bpf_jit_kallsyms = 1" | sudo tee -a $DIR/etc/sysctl.conf
echo "kernel.softlockup_all_cpu_backtrace = 1" | sudo tee -a $DIR/etc/sysctl.conf
echo "kernel.kptr_restrict = 0" | sudo tee -a $DIR/etc/sysctl.conf
echo "kernel.watchdog_thresh = 60" | sudo tee -a $DIR/etc/sysctl.conf
Cheers,
Daniel
^ permalink raw reply related
* [PATCH net-next 0/6] use pci_zalloc_consistent
From: YueHaibing @ 2018-06-05 12:28 UTC (permalink / raw)
To: davem
Cc: netdev, linux-kernel, jcliburn, chris.snook, benve, jdmason,
chessman, jes, rahul.verma, YueHaibing
YueHaibing (6):
net: hippi: use pci_zalloc_consistent
net: atheros: use pci_zalloc_consistent
net: neterion: use pci_zalloc_consistent
netxen_nic: use pci_zalloc_consistent
net: tlan: use pci_zalloc_consistent
enic: use pci_zalloc_consistent
drivers/net/ethernet/atheros/atl1e/atl1e_main.c | 2 +-
drivers/net/ethernet/atheros/atlx/atl1.c | 8 +++----
drivers/net/ethernet/atheros/atlx/atl2.c | 5 ++--
drivers/net/ethernet/cisco/enic/vnic_dev.c | 3 +--
drivers/net/ethernet/neterion/s2io.c | 10 ++++----
.../net/ethernet/qlogic/netxen/netxen_nic_ctx.c | 26 ++++++++------------
drivers/net/ethernet/ti/tlan.c | 7 +++---
drivers/net/hippi/rrunner.c | 28 +++++++++-------------
8 files changed, 35 insertions(+), 54 deletions(-)
--
2.7.0
^ permalink raw reply
* [PATCH net-next 1/6] net: hippi: use pci_zalloc_consistent
From: YueHaibing @ 2018-06-05 12:28 UTC (permalink / raw)
To: davem
Cc: netdev, linux-kernel, jcliburn, chris.snook, benve, jdmason,
chessman, jes, rahul.verma, YueHaibing
In-Reply-To: <20180605122851.23912-1-yuehaibing@huawei.com>
use pci_zalloc_consistent to remove unnecessary memset.
Also remove a local intermediate pointer 'tmpptr'.
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
drivers/net/hippi/rrunner.c | 28 +++++++++++-----------------
1 file changed, 11 insertions(+), 17 deletions(-)
diff --git a/drivers/net/hippi/rrunner.c b/drivers/net/hippi/rrunner.c
index f411164..9de7d2a 100644
--- a/drivers/net/hippi/rrunner.c
+++ b/drivers/net/hippi/rrunner.c
@@ -93,7 +93,6 @@ static int rr_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
static int version_disp;
u8 pci_latency;
struct rr_private *rrpriv;
- void *tmpptr;
dma_addr_t ring_dma;
int ret = -ENOMEM;
@@ -155,29 +154,26 @@ static int rr_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
goto out;
}
- tmpptr = pci_alloc_consistent(pdev, TX_TOTAL_SIZE, &ring_dma);
- rrpriv->tx_ring = tmpptr;
+ rrpriv->tx_ring = pci_alloc_consistent(pdev, TX_TOTAL_SIZE, &ring_dma);
rrpriv->tx_ring_dma = ring_dma;
- if (!tmpptr) {
+ if (!rrpriv->tx_ring) {
ret = -ENOMEM;
goto out;
}
- tmpptr = pci_alloc_consistent(pdev, RX_TOTAL_SIZE, &ring_dma);
- rrpriv->rx_ring = tmpptr;
+ rrpriv->rx_ring = pci_alloc_consistent(pdev, RX_TOTAL_SIZE, &ring_dma);
rrpriv->rx_ring_dma = ring_dma;
- if (!tmpptr) {
+ if (!rrpriv->rx_ring) {
ret = -ENOMEM;
goto out;
}
- tmpptr = pci_alloc_consistent(pdev, EVT_RING_SIZE, &ring_dma);
- rrpriv->evt_ring = tmpptr;
+ rrpriv->evt_ring = pci_alloc_consistent(pdev, EVT_RING_SIZE, &ring_dma);
rrpriv->evt_ring_dma = ring_dma;
- if (!tmpptr) {
+ if (!trrpriv->evt_ring) {
ret = -ENOMEM;
goto out;
}
@@ -1192,24 +1188,22 @@ static int rr_open(struct net_device *dev)
goto error;
}
- rrpriv->rx_ctrl = pci_alloc_consistent(pdev,
- 256 * sizeof(struct ring_ctrl),
- &dma_addr);
+ rrpriv->rx_ctrl = pci_zalloc_consistent(pdev,
+ 256 * sizeof(struct ring_ctrl),
+ &dma_addr);
if (!rrpriv->rx_ctrl) {
ecode = -ENOMEM;
goto error;
}
rrpriv->rx_ctrl_dma = dma_addr;
- memset(rrpriv->rx_ctrl, 0, 256*sizeof(struct ring_ctrl));
- rrpriv->info = pci_alloc_consistent(pdev, sizeof(struct rr_info),
- &dma_addr);
+ rrpriv->info = pci_zalloc_consistent(pdev, sizeof(struct rr_info),
+ &dma_addr);
if (!rrpriv->info) {
ecode = -ENOMEM;
goto error;
}
rrpriv->info_dma = dma_addr;
- memset(rrpriv->info, 0, sizeof(struct rr_info));
wmb();
spin_lock_irqsave(&rrpriv->lock, flags);
--
2.7.0
^ permalink raw reply related
* [PATCH net-next 2/6] net: atheros: use pci_zalloc_consistent
From: YueHaibing @ 2018-06-05 12:28 UTC (permalink / raw)
To: davem
Cc: netdev, linux-kernel, jcliburn, chris.snook, benve, jdmason,
chessman, jes, rahul.verma, YueHaibing
In-Reply-To: <20180605122851.23912-1-yuehaibing@huawei.com>
use pci_zalloc_consistent to remove unnecessary memset
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
drivers/net/ethernet/atheros/atl1e/atl1e_main.c | 2 +-
drivers/net/ethernet/atheros/atlx/atl1.c | 8 +++-----
drivers/net/ethernet/atheros/atlx/atl2.c | 5 ++---
3 files changed, 6 insertions(+), 9 deletions(-)
diff --git a/drivers/net/ethernet/atheros/atl1e/atl1e_main.c b/drivers/net/ethernet/atheros/atl1e/atl1e_main.c
index 9dc6da0..41da42f 100644
--- a/drivers/net/ethernet/atheros/atl1e/atl1e_main.c
+++ b/drivers/net/ethernet/atheros/atl1e/atl1e_main.c
@@ -829,7 +829,7 @@ static int atl1e_setup_ring_resources(struct atl1e_adapter *adapter)
&adapter->ring_dma);
if (adapter->ring_vir_addr == NULL) {
netdev_err(adapter->netdev,
- "pci_alloc_consistent failed, size = D%d\n", size);
+ "pci_zalloc_consistent failed, size = D%d\n", size);
return -ENOMEM;
}
diff --git a/drivers/net/ethernet/atheros/atlx/atl1.c b/drivers/net/ethernet/atheros/atlx/atl1.c
index b81fbf11..c72ef33 100644
--- a/drivers/net/ethernet/atheros/atlx/atl1.c
+++ b/drivers/net/ethernet/atheros/atlx/atl1.c
@@ -1069,16 +1069,14 @@ static s32 atl1_setup_ring_resources(struct atl1_adapter *adapter)
+ sizeof(struct stats_msg_block)
+ 40;
- ring_header->desc = pci_alloc_consistent(pdev, ring_header->size,
- &ring_header->dma);
+ ring_header->desc = pci_zalloc_consistent(pdev, ring_header->size,
+ &ring_header->dma);
if (unlikely(!ring_header->desc)) {
if (netif_msg_drv(adapter))
- dev_err(&pdev->dev, "pci_alloc_consistent failed\n");
+ dev_err(&pdev->dev, "pci_zalloc_consistent failed\n");
goto err_nomem;
}
- memset(ring_header->desc, 0, ring_header->size);
-
/* init TPD ring */
tpd_ring->dma = ring_header->dma;
offset = (tpd_ring->dma & 0x7) ? (8 - (ring_header->dma & 0x7)) : 0;
diff --git a/drivers/net/ethernet/atheros/atlx/atl2.c b/drivers/net/ethernet/atheros/atlx/atl2.c
index db4bcc5..d430dc9 100644
--- a/drivers/net/ethernet/atheros/atlx/atl2.c
+++ b/drivers/net/ethernet/atheros/atlx/atl2.c
@@ -300,11 +300,10 @@ static s32 atl2_setup_ring_resources(struct atl2_adapter *adapter)
adapter->txs_ring_size * 4 + 7 + /* dword align */
adapter->rxd_ring_size * 1536 + 127; /* 128bytes align */
- adapter->ring_vir_addr = pci_alloc_consistent(pdev, size,
- &adapter->ring_dma);
+ adapter->ring_vir_addr = pci_zalloc_consistent(pdev, size,
+ &adapter->ring_dma);
if (!adapter->ring_vir_addr)
return -ENOMEM;
- memset(adapter->ring_vir_addr, 0, adapter->ring_size);
/* Init TXD Ring */
adapter->txd_dma = adapter->ring_dma ;
--
2.7.0
^ permalink raw reply related
* [PATCH net-next 3/6] net: neterion: use pci_zalloc_consistent
From: YueHaibing @ 2018-06-05 12:28 UTC (permalink / raw)
To: davem
Cc: netdev, linux-kernel, jcliburn, chris.snook, benve, jdmason,
chessman, jes, rahul.verma, YueHaibing
In-Reply-To: <20180605122851.23912-1-yuehaibing@huawei.com>
use pci_zalloc_consistent to remove unnecessary memset.
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
drivers/net/ethernet/neterion/s2io.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/neterion/s2io.c b/drivers/net/ethernet/neterion/s2io.c
index b8983e7..4e8a2fd 100644
--- a/drivers/net/ethernet/neterion/s2io.c
+++ b/drivers/net/ethernet/neterion/s2io.c
@@ -733,8 +733,8 @@ static int init_shared_mem(struct s2io_nic *nic)
rx_blocks = &ring->rx_blocks[j];
size = SIZE_OF_BLOCK; /* size is always page size */
- tmp_v_addr = pci_alloc_consistent(nic->pdev, size,
- &tmp_p_addr);
+ tmp_v_addr = pci_zalloc_consistent(nic->pdev, size,
+ &tmp_p_addr);
if (tmp_v_addr == NULL) {
/*
* In case of failure, free_shared_mem()
@@ -746,7 +746,6 @@ static int init_shared_mem(struct s2io_nic *nic)
return -ENOMEM;
}
mem_allocated += size;
- memset(tmp_v_addr, 0, size);
size = sizeof(struct rxd_info) *
rxd_count[nic->rxd_mode];
@@ -835,8 +834,8 @@ static int init_shared_mem(struct s2io_nic *nic)
/* Allocation and initialization of Statistics block */
size = sizeof(struct stat_block);
mac_control->stats_mem =
- pci_alloc_consistent(nic->pdev, size,
- &mac_control->stats_mem_phy);
+ pci_zalloc_consistent(nic->pdev, size,
+ &mac_control->stats_mem_phy);
if (!mac_control->stats_mem) {
/*
@@ -851,7 +850,6 @@ static int init_shared_mem(struct s2io_nic *nic)
tmp_v_addr = mac_control->stats_mem;
mac_control->stats_info = tmp_v_addr;
- memset(tmp_v_addr, 0, size);
DBG_PRINT(INIT_DBG, "%s: Ring Mem PHY: 0x%llx\n",
dev_name(&nic->pdev->dev), (unsigned long long)tmp_p_addr);
mac_control->stats_info->sw_stat.mem_allocated += mem_allocated;
--
2.7.0
^ permalink raw reply related
* [PATCH net-next 4/6] netxen_nic: use pci_zalloc_consistent
From: YueHaibing @ 2018-06-05 12:28 UTC (permalink / raw)
To: davem
Cc: netdev, linux-kernel, jcliburn, chris.snook, benve, jdmason,
chessman, jes, rahul.verma, YueHaibing
In-Reply-To: <20180605122851.23912-1-yuehaibing@huawei.com>
use pci_zalloc_consistent to remove unnecessary memset.
Also remove a local intermediate pointer 'void *addr'.
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
.../net/ethernet/qlogic/netxen/netxen_nic_ctx.c | 26 +++++++++-------------
1 file changed, 10 insertions(+), 16 deletions(-)
diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_ctx.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_ctx.c
index 7503aa2..096047e 100644
--- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_ctx.c
+++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_ctx.c
@@ -267,7 +267,6 @@ nx_fw_cmd_set_gbe_port(struct netxen_adapter *adapter,
static int
nx_fw_cmd_create_rx_ctx(struct netxen_adapter *adapter)
{
- void *addr;
nx_hostrq_rx_ctx_t *prq;
nx_cardrsp_rx_ctx_t *prsp;
nx_hostrq_rds_ring_t *prq_rds;
@@ -297,19 +296,17 @@ nx_fw_cmd_create_rx_ctx(struct netxen_adapter *adapter)
rsp_size =
SIZEOF_CARDRSP_RX(nx_cardrsp_rx_ctx_t, nrds_rings, nsds_rings);
- addr = pci_alloc_consistent(adapter->pdev,
- rq_size, &hostrq_phys_addr);
- if (addr == NULL)
+ prq = pci_alloc_consistent(adapter->pdev,
+ rq_size, &hostrq_phys_addr);
+ if (!prq)
return -ENOMEM;
- prq = addr;
- addr = pci_alloc_consistent(adapter->pdev,
- rsp_size, &cardrsp_phys_addr);
- if (addr == NULL) {
+ prsp = pci_alloc_consistent(adapter->pdev,
+ rsp_size, &cardrsp_phys_addr);
+ if (!prsp) {
err = -ENOMEM;
goto out_free_rq;
}
- prsp = addr;
prq->host_rsp_dma_addr = cpu_to_le64(cardrsp_phys_addr);
@@ -445,23 +442,20 @@ nx_fw_cmd_create_tx_ctx(struct netxen_adapter *adapter)
struct netxen_cmd_args cmd;
rq_size = SIZEOF_HOSTRQ_TX(nx_hostrq_tx_ctx_t);
- rq_addr = pci_alloc_consistent(adapter->pdev,
- rq_size, &rq_phys_addr);
+ rq_addr = pci_zalloc_consistent(adapter->pdev,
+ rq_size, &rq_phys_addr);
if (!rq_addr)
return -ENOMEM;
rsp_size = SIZEOF_CARDRSP_TX(nx_cardrsp_tx_ctx_t);
- rsp_addr = pci_alloc_consistent(adapter->pdev,
- rsp_size, &rsp_phys_addr);
+ rsp_addr = pci_zalloc_consistent(adapter->pdev,
+ rsp_size, &rsp_phys_addr);
if (!rsp_addr) {
err = -ENOMEM;
goto out_free_rq;
}
- memset(rq_addr, 0, rq_size);
prq = rq_addr;
-
- memset(rsp_addr, 0, rsp_size);
prsp = rsp_addr;
prq->host_rsp_dma_addr = cpu_to_le64(rsp_phys_addr);
--
2.7.0
^ permalink raw reply related
* [PATCH net-next 5/6] net: tlan: use pci_zalloc_consistent
From: YueHaibing @ 2018-06-05 12:28 UTC (permalink / raw)
To: davem
Cc: netdev, linux-kernel, jcliburn, chris.snook, benve, jdmason,
chessman, jes, rahul.verma, YueHaibing
In-Reply-To: <20180605122851.23912-1-yuehaibing@huawei.com>
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
drivers/net/ethernet/ti/tlan.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/ti/tlan.c b/drivers/net/ethernet/ti/tlan.c
index c769cd9..66f2e5d 100644
--- a/drivers/net/ethernet/ti/tlan.c
+++ b/drivers/net/ethernet/ti/tlan.c
@@ -843,9 +843,9 @@ static int tlan_init(struct net_device *dev)
dma_size = (TLAN_NUM_RX_LISTS + TLAN_NUM_TX_LISTS)
* (sizeof(struct tlan_list));
- priv->dma_storage = pci_alloc_consistent(priv->pci_dev,
- dma_size,
- &priv->dma_storage_dma);
+ priv->dma_storage = pci_zalloc_consistent(priv->pci_dev,
+ dma_size,
+ &priv->dma_storage_dma);
priv->dma_size = dma_size;
if (priv->dma_storage == NULL) {
@@ -853,7 +853,6 @@ static int tlan_init(struct net_device *dev)
dev->name);
return -ENOMEM;
}
- memset(priv->dma_storage, 0, dma_size);
priv->rx_list = (struct tlan_list *)
ALIGN((unsigned long)priv->dma_storage, 8);
priv->rx_list_dma = ALIGN(priv->dma_storage_dma, 8);
--
2.7.0
^ permalink raw reply related
* [PATCH net-next 6/6] enic: use pci_zalloc_consistent
From: YueHaibing @ 2018-06-05 12:28 UTC (permalink / raw)
To: davem
Cc: netdev, linux-kernel, jcliburn, chris.snook, benve, jdmason,
chessman, jes, rahul.verma, YueHaibing
In-Reply-To: <20180605122851.23912-1-yuehaibing@huawei.com>
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
drivers/net/ethernet/cisco/enic/vnic_dev.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/cisco/enic/vnic_dev.c b/drivers/net/ethernet/cisco/enic/vnic_dev.c
index 76cdd4c..7693af9 100644
--- a/drivers/net/ethernet/cisco/enic/vnic_dev.c
+++ b/drivers/net/ethernet/cisco/enic/vnic_dev.c
@@ -1217,13 +1217,12 @@ int vnic_dev_classifier(struct vnic_dev *vdev, u8 cmd, u16 *entry,
tlv_size = sizeof(struct filter) +
sizeof(struct filter_action) +
2 * sizeof(struct filter_tlv);
- tlv_va = pci_alloc_consistent(vdev->pdev, tlv_size, &tlv_pa);
+ tlv_va = pci_zalloc_consistent(vdev->pdev, tlv_size, &tlv_pa);
if (!tlv_va)
return -ENOMEM;
tlv = tlv_va;
a0 = tlv_pa;
a1 = tlv_size;
- memset(tlv, 0, tlv_size);
tlv->type = CLSF_TLV_FILTER;
tlv->length = sizeof(struct filter);
*(struct filter *)&tlv->val = *data;
--
2.7.0
^ permalink raw reply related
* Re: [PATCH net-next 1/2] ipv4: replace ip_hdr() with skb->data for optimization
From: Yafang Shao @ 2018-06-05 12:29 UTC (permalink / raw)
To: Paolo Abeni; +Cc: Eric Dumazet, David Miller, netdev, LKML
In-Reply-To: <9ce783dc628699f02c45650c942f6735e93a18c4.camel@redhat.com>
On Tue, Jun 5, 2018 at 8:20 PM, Paolo Abeni <pabeni@redhat.com> wrote:
> On Tue, 2018-06-05 at 08:04 -0400, Yafang Shao wrote:
>> In ip receive path, when ip header hasn't been pulled yet, ip_hdr() and
>> skb->data are pointing to the same byte.
>>
>> In ip output path, when ip header is just pushed, ip_hdr() and skb->data
>> are pointing to the same byte.
>>
>> As ip_hdr() is more expensive than using skb->data, so replace ip_hdr()
>> with skb->data in these situations for optimization.
>
> IMHO this makes the code less readable and more error prone. Which kind
> of performance improvement do you measure here?
>
Correct the cc list.
Hi Paolo,
There's a "+" opertaion in ip_hdr(), using skb->data and avoid this operation.
Thanks
Yafang
^ permalink raw reply
* Re: ANNOUNCE: Enhanced IP v1.4
From: Bjørn Mork @ 2018-06-05 12:33 UTC (permalink / raw)
To: Willy Tarreau
Cc: Eric Dumazet, Tom Herbert, Sam Patton,
Linux Kernel Network Developers
In-Reply-To: <20180604043426.GB11775@1wt.eu>
Willy Tarreau <w@1wt.eu> writes:
> I agree on these points, but I'd like to figure what can be done to put
> a bit more pressure on ISPs to *always* provide IPv6.
Most ISPs are in it for the money. So what you can do is either to make
it more expensive to provide IPv4-only services or more profitable to
provide dual-stack services. Making IPv4 more expensive is probably
hard. Even ISPs having to buy address space still figure it is cheaper
than IPv6 with NAT64 or other CGN solutions.
So what you need to do is simply to convince enough of your friends to
pay the price of IPv6.
The fact is that adding IPv6 still has real costs and no real benefit
for an ISP. There just aren't enough geeks voting with their wallet to
make a difference. And even if "everything" supports IPv6, there will
always be an extra set of bugs and additional operational problems with
*any* optional feature you enable. IPv6 is no exception. Enthusiasts
within the ISPs is the only reason there is any ISP providing dual-stack
services at all.
> I do have IPv6 at home (a /48, waste of addressing space, I'd be fine
> with less),
Any reason you would want less? Any reason the ISP should give you
less?
> Maybe setting up a public list of ISPs where users don't have at least
> a /60 by default could help, but I suspect that most of them will
> consider that as long as their competitors are on the list there's no
> emergency.
Exactly. And the number of users using the list as the primary
parameter for selecting an ISP would be close to 0. The critical part
is not the list, but making large enough groups of users consider IPv6
an important parameter when selecting ISPs.
Disclaimer: I work for an ISP providing dual-stack services on multiple
access technologies, in a market where no other major ISP does that. We
have done it for 6 years now, and haven't see any tendency that end
users prefer us over competitors based on IPv6. Media interest is none.
IPv6 is not even mentioned in articles claiming to compare services.
Bjørn
^ permalink raw reply
* Re: [bpf-next PATCH 0/5] net/xdp: remove net_device operation ndo_xdp_flush
From: Daniel Borkmann @ 2018-06-05 12:38 UTC (permalink / raw)
To: Jesper Dangaard Brouer, netdev, Daniel Borkmann,
Alexei Starovoitov
Cc: liu.song.a23, songliubraving, John Fastabend
In-Reply-To: <152819969561.7083.15427306662397720502.stgit@firesoul>
On 06/05/2018 01:55 PM, Jesper Dangaard Brouer wrote:
> This patchset removes the net_device operation ndo_xdp_flush() call.
> This is a follow merge commit ea9916ea3ed9 ("Merge branch
> 'ndo_xdp_xmit-cleanup'"). As after commit c1ece6b245bd ("bpf/xdp:
> devmap can avoid calling ndo_xdp_flush") no callers of ndo_xdp_flush
> are left in bpf-next tree.
Looks good, applied to bpf-next, thanks Jesper!
^ permalink raw reply
* Re: [PATCH net-next 0/6] use pci_zalloc_consistent
From: Andy Shevchenko @ 2018-06-05 12:39 UTC (permalink / raw)
To: YueHaibing, Christoph Hellwig
Cc: David S. Miller, netdev, Linux Kernel Mailing List, jcliburn,
chris.snook, benve, Jon Mason, chessman, jes, rahul.verma
In-Reply-To: <20180605122851.23912-1-yuehaibing@huawei.com>
On Tue, Jun 5, 2018 at 3:28 PM, YueHaibing <yuehaibing@huawei.com> wrote:
>
Hmm... Is PCI case anyhow special or it's a simple wrapper on top of
dma.*alloc() ?
> YueHaibing (6):
> net: hippi: use pci_zalloc_consistent
> net: atheros: use pci_zalloc_consistent
> net: neterion: use pci_zalloc_consistent
> netxen_nic: use pci_zalloc_consistent
> net: tlan: use pci_zalloc_consistent
> enic: use pci_zalloc_consistent
>
> drivers/net/ethernet/atheros/atl1e/atl1e_main.c | 2 +-
> drivers/net/ethernet/atheros/atlx/atl1.c | 8 +++----
> drivers/net/ethernet/atheros/atlx/atl2.c | 5 ++--
> drivers/net/ethernet/cisco/enic/vnic_dev.c | 3 +--
> drivers/net/ethernet/neterion/s2io.c | 10 ++++----
> .../net/ethernet/qlogic/netxen/netxen_nic_ctx.c | 26 ++++++++------------
> drivers/net/ethernet/ti/tlan.c | 7 +++---
> drivers/net/hippi/rrunner.c | 28 +++++++++-------------
> 8 files changed, 35 insertions(+), 54 deletions(-)
>
> --
> 2.7.0
>
>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply
* Re: ANNOUNCE: Enhanced IP v1.4
From: Willy Tarreau @ 2018-06-05 12:41 UTC (permalink / raw)
To: Bjørn Mork
Cc: Eric Dumazet, Tom Herbert, Sam Patton,
Linux Kernel Network Developers
In-Reply-To: <87y3ft9zwg.fsf@miraculix.mork.no>
On Tue, Jun 05, 2018 at 02:33:03PM +0200, Bjørn Mork wrote:
> > I do have IPv6 at home (a /48, waste of addressing space, I'd be fine
> > with less),
>
> Any reason you would want less? Any reason the ISP should give you
> less?
What I mean is that *if* the availability of /48 networks was an issue
for some ISPs, I'd be fine with less because I don't plan to deploy 64k
networks at home, though I already have ~9 around the firewall and don't
expect to go much further.
> > Maybe setting up a public list of ISPs where users don't have at least
> > a /60 by default could help, but I suspect that most of them will
> > consider that as long as their competitors are on the list there's no
> > emergency.
>
> Exactly. And the number of users using the list as the primary
> parameter for selecting an ISP would be close to 0. The critical part
> is not the list, but making large enough groups of users consider IPv6
> an important parameter when selecting ISPs.
In fact the IoT trend could play a role here by letting users know that
they can remotely access their fridge and whatever stupid device they've
deployed. But the reality is the opposite : some gateway services are/will
be offered at a paid price to make these devices remotely accessible, and
the claimed security provided by this gateway will be presented as a real
benefit compared to the risks of anyone directly accessing your private
life over IPv6. So I'm not getting much hopes for the future in this area
either.
Willy
^ permalink raw reply
* Re: [PATCH bpf-next 10/11] i40e: implement AF_XDP zero-copy support for Tx
From: Jesper Dangaard Brouer @ 2018-06-05 12:43 UTC (permalink / raw)
To: Björn Töpel
Cc: magnus.karlsson, magnus.karlsson, alexander.h.duyck,
alexander.duyck, ast, daniel, netdev, mykyta.iziumtsev,
john.fastabend, willemdebruijn.kernel, mst, michael.lundkvist,
jesse.brandeburg, anjali.singhai, qi.z.zhang, francois.ozog,
ilias.apalodimas, brian.brooks, andy, michael.chan,
intel-wired-lan, brouer
In-Reply-To: <20180604120601.18123-11-bjorn.topel@gmail.com>
On Mon, 4 Jun 2018 14:06:00 +0200
Björn Töpel <bjorn.topel@gmail.com> wrote:
> Here, ndo_xsk_async_xmit is implemented. As a shortcut, the existing
> XDP Tx rings are used for zero-copy. This will result in other devices
> doing XDP_REDIRECT to an AF_XDP enabled queue will have its packets
> dropped.
This behavior is problematic, because XDP Tx rings are smp_processor_id
based, and several RX queues can (via proc smp_affinity settings) be
assigned to the same CPU. Thus, other RX-queues (than the AF_XDP
enabled queue) can experience packet drops. And other devices doing
redirect through i40e, which happen to run on a CPU which XDP Tx queue
is "hijacked" will see dropped packets.
Any plans to allocate/create a dedicated TX ring per AF_XDP socket?
--
Best regards,
Jesper Dangaard Brouer
MSc.CS, Principal Kernel Engineer at Red Hat
LinkedIn: http://www.linkedin.com/in/brouer
^ permalink raw reply
* Re: [PATCH net-next 0/6] use pci_zalloc_consistent
From: Andy Shevchenko @ 2018-06-05 12:46 UTC (permalink / raw)
To: Christoph Hellwig
Cc: YueHaibing, David S. Miller, netdev, Linux Kernel Mailing List,
jcliburn, chris.snook, benve, Jon Mason, chessman, jes,
rahul.verma
In-Reply-To: <20180605124929.GA13305@lst.de>
On Tue, Jun 5, 2018 at 3:49 PM, Christoph Hellwig <hch@lst.de> wrote:
> On Tue, Jun 05, 2018 at 03:39:16PM +0300, Andy Shevchenko wrote:
>> On Tue, Jun 5, 2018 at 3:28 PM, YueHaibing <yuehaibing@huawei.com> wrote:
>> >
>>
>> Hmm... Is PCI case anyhow special or it's a simple wrapper on top of
>> dma.*alloc() ?
>
> All drivers should move from pci_dma* to dma_* eventually. Converting
> from one flavor of deprecated to another is completely pointless.
Exactly my impression. Thanks, Christoph for clarification.
YueHaibing, care to follow what Christoph said and change your series
accordingly?
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply
* Re: [PATCH net-next 0/6] use pci_zalloc_consistent
From: Christoph Hellwig @ 2018-06-05 12:49 UTC (permalink / raw)
To: Andy Shevchenko
Cc: YueHaibing, Christoph Hellwig, David S. Miller, netdev,
Linux Kernel Mailing List, jcliburn, chris.snook, benve,
Jon Mason, chessman, jes, rahul.verma
In-Reply-To: <CAHp75VcWqO8hzbprP1FZJFmpu18iFXxHsu9uXw8RGngRf2jJhw@mail.gmail.com>
On Tue, Jun 05, 2018 at 03:39:16PM +0300, Andy Shevchenko wrote:
> On Tue, Jun 5, 2018 at 3:28 PM, YueHaibing <yuehaibing@huawei.com> wrote:
> >
>
> Hmm... Is PCI case anyhow special or it's a simple wrapper on top of
> dma.*alloc() ?
All drivers should move from pci_dma* to dma_* eventually. Converting
from one flavor of deprecated to another is completely pointless.
^ permalink raw reply
* Re: [PATCH net-next 0/2] net: phy: improve PM handling of PHY/MDIO
From: David Miller @ 2018-06-05 12:50 UTC (permalink / raw)
To: hkallweit1; +Cc: andrew, f.fainelli, netdev
In-Reply-To: <b8f7b42e-791a-5997-d5eb-16f649738421@gmail.com>
From: Heiner Kallweit <hkallweit1@gmail.com>
Date: Sat, 2 Jun 2018 22:33:36 +0200
> Current implementation of MDIO bus PM ops doesn't actually implement
> bus-specific PM ops but just calls PM ops defined on a device level
> what doesn't seem to be fully in line with the core PM model.
>
> When looking e.g. at __device_suspend() the PM core looks for PM ops
> of a device in a specific order:
> 1. device PM domain
> 2. device type
> 3. device class
> 4. device bus
>
> I think it has good reason that there's no PM ops on device level.
> The situation can be improved by modeling PHY's as device type of
> a MDIO device. If for some other type of MDIO device PM ops are
> needed, it could be modeled as struct device_type as well.
Series applied, thanks.
^ permalink raw reply
* Re: [PATCH] net-tcp: remove useless tw_timeout field
From: Eric Dumazet @ 2018-06-05 12:59 UTC (permalink / raw)
To: Maciej Żenczykowski, Maciej Żenczykowski,
David S . Miller, Eric Dumazet
Cc: netdev
In-Reply-To: <20180605100723.164396-1-zenczykowski@gmail.com>
On 06/05/2018 03:07 AM, Maciej Żenczykowski wrote:
> From: Maciej Żenczykowski <maze@google.com>
>
> Tested: 'git grep tw_timeout' comes up empty and it builds :-)
>
> Signed-off-by: Maciej Żenczykowski <maze@google.com>
> Cc: Eric Dumazet <edumazet@google.com>
This field became no longer needed when tcp_tw_recycle was removed in linux-4.12
Signed-off-by: Eric Dumazet <edumazet@google.com>
Thanks Maciej
^ permalink raw reply
* Re: [PATCH net-next 0/6] use pci_zalloc_consistent
From: David Miller @ 2018-06-05 13:00 UTC (permalink / raw)
To: hch
Cc: andy.shevchenko, yuehaibing, netdev, linux-kernel, jcliburn,
chris.snook, benve, jdmason, chessman, jes, rahul.verma
In-Reply-To: <20180605124929.GA13305@lst.de>
From: Christoph Hellwig <hch@lst.de>
Date: Tue, 5 Jun 2018 14:49:29 +0200
> On Tue, Jun 05, 2018 at 03:39:16PM +0300, Andy Shevchenko wrote:
>> On Tue, Jun 5, 2018 at 3:28 PM, YueHaibing <yuehaibing@huawei.com> wrote:
>> >
>>
>> Hmm... Is PCI case anyhow special or it's a simple wrapper on top of
>> dma.*alloc() ?
>
> All drivers should move from pci_dma* to dma_* eventually. Converting
> from one flavor of deprecated to another is completely pointless.
Agreed.
^ permalink raw reply
* [PATCH net v2 1/2] ip6mr: only set ip6mr_table from setsockopt when ip6mr_new_table succeeds
From: Sabrina Dubroca @ 2018-06-05 13:01 UTC (permalink / raw)
To: netdev
Cc: Eric Dumazet, Nikolay Aleksandrov, Yuval Mintz, Ivan Vecera,
Sabrina Dubroca
Currently, raw6_sk(sk)->ip6mr_table is set unconditionally during
ip6_mroute_setsockopt(MRT6_TABLE). A subsequent attempt at the same
setsockopt will fail with -ENOENT, since we haven't actually created
that table.
A similar fix for ipv4 was included in commit 5e1859fbcc3c ("ipv4: ipmr:
various fixes and cleanups").
Fixes: d1db275dd3f6 ("ipv6: ip6mr: support multiple tables")
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
---
net/ipv6/ip6mr.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
index 298fd8b6ed17..42eca2689c3b 100644
--- a/net/ipv6/ip6mr.c
+++ b/net/ipv6/ip6mr.c
@@ -1759,7 +1759,8 @@ int ip6_mroute_setsockopt(struct sock *sk, int optname, char __user *optval, uns
ret = 0;
if (!ip6mr_new_table(net, v))
ret = -ENOMEM;
- raw6_sk(sk)->ip6mr_table = v;
+ else
+ raw6_sk(sk)->ip6mr_table = v;
rtnl_unlock();
return ret;
}
--
2.17.1
^ permalink raw reply related
* [PATCH net v2 2/2] ipmr: fix error path when ipmr_new_table fails
From: Sabrina Dubroca @ 2018-06-05 13:02 UTC (permalink / raw)
To: netdev
Cc: Eric Dumazet, Nikolay Aleksandrov, Yuval Mintz, Ivan Vecera,
Sabrina Dubroca
In-Reply-To: <604985fb55d51eef9130bff0640a62d5015f25bd.1528194845.git.sd@queasysnail.net>
commit 0bbbf0e7d0e7 ("ipmr, ip6mr: Unite creation of new mr_table")
refactored ipmr_new_table, so that it now returns NULL when
mr_table_alloc fails. Unfortunately, all callers of ipmr_new_table
expect an ERR_PTR.
This can result in NULL deref, for example when ipmr_rules_exit calls
ipmr_free_table with NULL net->ipv4.mrt in the
!CONFIG_IP_MROUTE_MULTIPLE_TABLES version.
This patch makes mr_table_alloc return errors, and changes
ip6mr_new_table and its callers to return/expect error pointers as
well. It also removes the version of mr_table_alloc defined under
!CONFIG_IP_MROUTE_COMMON, since it is never used.
Fixes: 0bbbf0e7d0e7 ("ipmr, ip6mr: Unite creation of new mr_table")
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
---
v2: - fixed brainfart that shadowed mrt variable in ip6_mroute_setsockopt
- rebased on top of ip6_mroute_setsockopt fix
include/linux/mroute_base.h | 10 ----------
net/ipv4/ipmr_base.c | 8 +++++---
net/ipv6/ip6mr.c | 18 ++++++++++++------
3 files changed, 17 insertions(+), 19 deletions(-)
diff --git a/include/linux/mroute_base.h b/include/linux/mroute_base.h
index d617fe45543e..d633f737b3c6 100644
--- a/include/linux/mroute_base.h
+++ b/include/linux/mroute_base.h
@@ -307,16 +307,6 @@ static inline void vif_device_init(struct vif_device *v,
{
}
-static inline void *
-mr_table_alloc(struct net *net, u32 id,
- struct mr_table_ops *ops,
- void (*expire_func)(struct timer_list *t),
- void (*table_set)(struct mr_table *mrt,
- struct net *net))
-{
- return NULL;
-}
-
static inline void *mr_mfc_find_parent(struct mr_table *mrt,
void *hasharg, int parent)
{
diff --git a/net/ipv4/ipmr_base.c b/net/ipv4/ipmr_base.c
index 30221701614c..cafb0506c8c9 100644
--- a/net/ipv4/ipmr_base.c
+++ b/net/ipv4/ipmr_base.c
@@ -35,17 +35,19 @@ mr_table_alloc(struct net *net, u32 id,
struct net *net))
{
struct mr_table *mrt;
+ int err;
mrt = kzalloc(sizeof(*mrt), GFP_KERNEL);
if (!mrt)
- return NULL;
+ return ERR_PTR(-ENOMEM);
mrt->id = id;
write_pnet(&mrt->net, net);
mrt->ops = *ops;
- if (rhltable_init(&mrt->mfc_hash, mrt->ops.rht_params)) {
+ err = rhltable_init(&mrt->mfc_hash, mrt->ops.rht_params);
+ if (err) {
kfree(mrt);
- return NULL;
+ return ERR_PTR(err);
}
INIT_LIST_HEAD(&mrt->mfc_cache_list);
INIT_LIST_HEAD(&mrt->mfc_unres_queue);
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
index 42eca2689c3b..37936671dcb3 100644
--- a/net/ipv6/ip6mr.c
+++ b/net/ipv6/ip6mr.c
@@ -227,8 +227,8 @@ static int __net_init ip6mr_rules_init(struct net *net)
INIT_LIST_HEAD(&net->ipv6.mr6_tables);
mrt = ip6mr_new_table(net, RT6_TABLE_DFLT);
- if (!mrt) {
- err = -ENOMEM;
+ if (IS_ERR(mrt)) {
+ err = PTR_ERR(mrt);
goto err1;
}
@@ -301,8 +301,13 @@ static int ip6mr_fib_lookup(struct net *net, struct flowi6 *flp6,
static int __net_init ip6mr_rules_init(struct net *net)
{
- net->ipv6.mrt6 = ip6mr_new_table(net, RT6_TABLE_DFLT);
- return net->ipv6.mrt6 ? 0 : -ENOMEM;
+ struct mr_table *mrt;
+
+ mrt = ip6mr_new_table(net, RT6_TABLE_DFLT);
+ if (IS_ERR(mrt))
+ return PTR_ERR(mrt);
+ net->ipv6.mrt6 = mrt;
+ return 0;
}
static void __net_exit ip6mr_rules_exit(struct net *net)
@@ -1757,8 +1762,9 @@ int ip6_mroute_setsockopt(struct sock *sk, int optname, char __user *optval, uns
rtnl_lock();
ret = 0;
- if (!ip6mr_new_table(net, v))
- ret = -ENOMEM;
+ mrt = ip6mr_new_table(net, v);
+ if (IS_ERR(mrt))
+ ret = PTR_ERR(mrt);
else
raw6_sk(sk)->ip6mr_table = v;
rtnl_unlock();
--
2.17.1
^ permalink raw reply related
* Re: [PATCH net-next 0/6] use pci_zalloc_consistent
From: YueHaibing @ 2018-06-05 13:04 UTC (permalink / raw)
To: Andy Shevchenko, Christoph Hellwig
Cc: David S. Miller, netdev, Linux Kernel Mailing List, jcliburn,
chris.snook, benve, Jon Mason, chessman, jes, rahul.verma
In-Reply-To: <CAHp75VewE_eyw-xes4n7sBbZv0uGPu_QdPYaZwdEd_5AUCcvvg@mail.gmail.com>
On 2018/6/5 20:46, Andy Shevchenko wrote:
> On Tue, Jun 5, 2018 at 3:49 PM, Christoph Hellwig <hch@lst.de> wrote:
>> On Tue, Jun 05, 2018 at 03:39:16PM +0300, Andy Shevchenko wrote:
>>> On Tue, Jun 5, 2018 at 3:28 PM, YueHaibing <yuehaibing@huawei.com> wrote:
>>>>
>>>
>>> Hmm... Is PCI case anyhow special or it's a simple wrapper on top of
>>> dma.*alloc() ?
>>
>> All drivers should move from pci_dma* to dma_* eventually. Converting
>> from one flavor of deprecated to another is completely pointless.
>
> Exactly my impression. Thanks, Christoph for clarification.
>
> YueHaibing, care to follow what Christoph said and change your series
> accordingly?
ok, will send v2
>
^ permalink raw reply
* [PATCH v2 net-next] net: metrics: add proper netlink validation
From: Eric Dumazet @ 2018-06-05 13:06 UTC (permalink / raw)
To: David S . Miller; +Cc: netdev, Eric Dumazet, Eric Dumazet, David Ahern
Before using nla_get_u32(), better make sure the attribute
is of the proper size.
Code recently was changed, but bug has been there from beginning
of git.
BUG: KMSAN: uninit-value in rtnetlink_put_metrics+0x553/0x960 net/core/rtnetlink.c:746
CPU: 1 PID: 14139 Comm: syz-executor6 Not tainted 4.17.0-rc5+ #103
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0x185/0x1d0 lib/dump_stack.c:113
kmsan_report+0x149/0x260 mm/kmsan/kmsan.c:1084
__msan_warning_32+0x6e/0xc0 mm/kmsan/kmsan_instr.c:686
rtnetlink_put_metrics+0x553/0x960 net/core/rtnetlink.c:746
fib_dump_info+0xc42/0x2190 net/ipv4/fib_semantics.c:1361
rtmsg_fib+0x65f/0x8c0 net/ipv4/fib_semantics.c:419
fib_table_insert+0x2314/0x2b50 net/ipv4/fib_trie.c:1287
inet_rtm_newroute+0x210/0x340 net/ipv4/fib_frontend.c:779
rtnetlink_rcv_msg+0xa32/0x1560 net/core/rtnetlink.c:4646
netlink_rcv_skb+0x378/0x600 net/netlink/af_netlink.c:2448
rtnetlink_rcv+0x50/0x60 net/core/rtnetlink.c:4664
netlink_unicast_kernel net/netlink/af_netlink.c:1310 [inline]
netlink_unicast+0x1678/0x1750 net/netlink/af_netlink.c:1336
netlink_sendmsg+0x104f/0x1350 net/netlink/af_netlink.c:1901
sock_sendmsg_nosec net/socket.c:629 [inline]
sock_sendmsg net/socket.c:639 [inline]
___sys_sendmsg+0xec0/0x1310 net/socket.c:2117
__sys_sendmsg net/socket.c:2155 [inline]
__do_sys_sendmsg net/socket.c:2164 [inline]
__se_sys_sendmsg net/socket.c:2162 [inline]
__x64_sys_sendmsg+0x331/0x460 net/socket.c:2162
do_syscall_64+0x152/0x230 arch/x86/entry/common.c:287
entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x455a09
RSP: 002b:00007faae5fd8c68 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00007faae5fd96d4 RCX: 0000000000455a09
RDX: 0000000000000000 RSI: 0000000020000000 RDI: 0000000000000013
RBP: 000000000072bea0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000ffffffff
R13: 00000000000005d0 R14: 00000000006fdc20 R15: 0000000000000000
Uninit was stored to memory at:
kmsan_save_stack_with_flags mm/kmsan/kmsan.c:279 [inline]
kmsan_save_stack mm/kmsan/kmsan.c:294 [inline]
kmsan_internal_chain_origin+0x12b/0x210 mm/kmsan/kmsan.c:685
__msan_chain_origin+0x69/0xc0 mm/kmsan/kmsan_instr.c:529
fib_convert_metrics net/ipv4/fib_semantics.c:1056 [inline]
fib_create_info+0x2d46/0x9dc0 net/ipv4/fib_semantics.c:1150
fib_table_insert+0x3e4/0x2b50 net/ipv4/fib_trie.c:1146
inet_rtm_newroute+0x210/0x340 net/ipv4/fib_frontend.c:779
rtnetlink_rcv_msg+0xa32/0x1560 net/core/rtnetlink.c:4646
netlink_rcv_skb+0x378/0x600 net/netlink/af_netlink.c:2448
rtnetlink_rcv+0x50/0x60 net/core/rtnetlink.c:4664
netlink_unicast_kernel net/netlink/af_netlink.c:1310 [inline]
netlink_unicast+0x1678/0x1750 net/netlink/af_netlink.c:1336
netlink_sendmsg+0x104f/0x1350 net/netlink/af_netlink.c:1901
sock_sendmsg_nosec net/socket.c:629 [inline]
sock_sendmsg net/socket.c:639 [inline]
___sys_sendmsg+0xec0/0x1310 net/socket.c:2117
__sys_sendmsg net/socket.c:2155 [inline]
__do_sys_sendmsg net/socket.c:2164 [inline]
__se_sys_sendmsg net/socket.c:2162 [inline]
__x64_sys_sendmsg+0x331/0x460 net/socket.c:2162
do_syscall_64+0x152/0x230 arch/x86/entry/common.c:287
entry_SYSCALL_64_after_hwframe+0x44/0xa9
Uninit was created at:
kmsan_save_stack_with_flags mm/kmsan/kmsan.c:279 [inline]
kmsan_internal_poison_shadow+0xb8/0x1b0 mm/kmsan/kmsan.c:189
kmsan_kmalloc+0x94/0x100 mm/kmsan/kmsan.c:315
kmsan_slab_alloc+0x10/0x20 mm/kmsan/kmsan.c:322
slab_post_alloc_hook mm/slab.h:446 [inline]
slab_alloc_node mm/slub.c:2753 [inline]
__kmalloc_node_track_caller+0xb32/0x11b0 mm/slub.c:4395
__kmalloc_reserve net/core/skbuff.c:138 [inline]
__alloc_skb+0x2cb/0x9e0 net/core/skbuff.c:206
alloc_skb include/linux/skbuff.h:988 [inline]
netlink_alloc_large_skb net/netlink/af_netlink.c:1182 [inline]
netlink_sendmsg+0x76e/0x1350 net/netlink/af_netlink.c:1876
sock_sendmsg_nosec net/socket.c:629 [inline]
sock_sendmsg net/socket.c:639 [inline]
___sys_sendmsg+0xec0/0x1310 net/socket.c:2117
__sys_sendmsg net/socket.c:2155 [inline]
__do_sys_sendmsg net/socket.c:2164 [inline]
__se_sys_sendmsg net/socket.c:2162 [inline]
__x64_sys_sendmsg+0x331/0x460 net/socket.c:2162
do_syscall_64+0x152/0x230 arch/x86/entry/common.c:287
entry_SYSCALL_64_after_hwframe+0x44/0xa9
Fixes: a919525ad832 ("net: Move fib_convert_metrics to metrics file")
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: syzbot <syzkaller@googlegroups.com>
Cc: David Ahern <dsahern@gmail.com>
---
v2: fixed a typo.
net/ipv4/fib_semantics.c | 2 ++
net/ipv4/metrics.c | 2 ++
2 files changed, 4 insertions(+)
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
index 6608db23f54b6afdac0455650b47d64b1b22b255..f3c89ccf14c5b8f67048a9cf7ebd4ba19327941e 100644
--- a/net/ipv4/fib_semantics.c
+++ b/net/ipv4/fib_semantics.c
@@ -717,6 +717,8 @@ bool fib_metrics_match(struct fib_config *cfg, struct fib_info *fi)
nla_strlcpy(tmp, nla, sizeof(tmp));
val = tcp_ca_get_key_by_name(fi->fib_net, tmp, &ecn_ca);
} else {
+ if (nla_len(nla) != sizeof(u32))
+ return false;
val = nla_get_u32(nla);
}
diff --git a/net/ipv4/metrics.c b/net/ipv4/metrics.c
index 5121c6475e6b0e9a9a158d4cee473f52cd4d8efe..04311f7067e2e9e3dafb89aa4f8e30dab0fde854 100644
--- a/net/ipv4/metrics.c
+++ b/net/ipv4/metrics.c
@@ -32,6 +32,8 @@ int ip_metrics_convert(struct net *net, struct nlattr *fc_mx, int fc_mx_len,
if (val == TCP_CA_UNSPEC)
return -EINVAL;
} else {
+ if (nla_len(nla) != sizeof(u32))
+ return -EINVAL;
val = nla_get_u32(nla);
}
if (type == RTAX_ADVMSS && val > 65535 - 40)
--
2.17.1.1185.g55be947832-goog
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox