Netdev List
 help / color / mirror / Atom feed
* Re: aquantia - BUG: unable to handle kernel NULL pointer dereference at 0000000000000058 on reboot
From: Yanko Kaneti @ 2018-04-10 14:06 UTC (permalink / raw)
  To: Igor Russkikh; +Cc: netdev
In-Reply-To: <6df8b628-cec5-9ce5-8430-e9a2cd27346d@aquantia.com>

On Tue, 2018-04-10 at 15:53 +0300, Igor Russkikh wrote:
> On 10.04.2018 15:42, Yanko Kaneti wrote:
> > Hello, 
> > 
> > Since 90869ddfefeb net: aquantia: Implement pci shutdown callback
> > I get the below oops on reboot.  Without the callback everything works
> > as expected.
> > 
> 
> Thanks, we also recently found out that.
> 
> Could you please try the below patch?

Works for me, as in, no crashes on reboot.

Thanks
-Yanko


> 
> 
> diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
> index c96a921..32f6d2e 100644
> --- a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
> +++ b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
> @@ -951,9 +951,11 @@ void aq_nic_shutdown(struct aq_nic_s *self)
>  
>  	netif_device_detach(self->ndev);
>  
> -	err = aq_nic_stop(self);
> -	if (err < 0)
> -		goto err_exit;
> +	if (netif_running(self->ndev)) {
> +		err = aq_nic_stop(self);
> +		if (err < 0)
> +			goto err_exit;
> +	}
>  	aq_nic_deinit(self);
>  
>  err_exit:

^ permalink raw reply

* Re: [PATCH] slip: Check if rstate is initialized before uncompressing
From: David Miller @ 2018-04-10 14:03 UTC (permalink / raw)
  To: tejaswit; +Cc: netdev
In-Reply-To: <ed7bd53914f26c2225c6c00d16bffb35@codeaurora.org>

From: tejaswit@codeaurora.org
Date: Tue, 10 Apr 2018 11:28:10 +0530

> On 2018-04-09 20:34, David Miller wrote:
>> From: Tejaswi Tanikella <tejaswit@codeaurora.org>
>> Date: Mon, 9 Apr 2018 14:23:49 +0530
>> 
>>> @@ -673,6 +677,7 @@ struct slcompress *
>>>  	if (cs->cs_tcp.doff > 5)
>>>  	  memcpy(cs->cs_tcpopt, icp + ihl*4 + sizeof(struct tcphdr),
>>>  	  (cs->cs_tcp.doff - 5) * 4);
>>>  	cs->cs_hsize = ihl*2 + cs->cs_tcp.doff*2;
>>> +	cs->initialized = 1;
>>>  	/* Put headers back on packet
>>  ...
>>>  struct cstate {
>>>  	byte_t	cs_this;	/* connection id number (xmit) */
>>> +	byte_t	initialized;	/* non-zero if initialized */
>> Please use 'bool' and true/false for 'initialized'.
> 
> Made the changes.

Please, when you are asked to fix a patch, post it as a new posting
with '[PATCH v2 net] slip: ...' in the subject line.

And also not as an attachment, all patches must be inline.

Thank you.

^ permalink raw reply

* [PATCH] net: wireless: b43legacy: Replace GFP_ATOMIC with GFP_KERNEL in dma_tx_fragment
From: Jia-Ju Bai @ 2018-04-10 13:54 UTC (permalink / raw)
  To: Larry.Finger, kvalo
  Cc: linux-wireless, b43-dev, netdev, linux-kernel, Jia-Ju Bai

dma_tx_fragment() is never called in atomic context.

dma_tx_fragment() is only called by b43legacy_dma_tx(), which is 
only called by b43legacy_tx_work().
b43legacy_tx_work() is only set a parameter of INIT_WORK() in 
b43legacy_wireless_init().

Despite never getting called from atomic context,
dma_tx_fragment() calls alloc_skb() with GFP_ATOMIC,
which does not sleep for allocation.
GFP_ATOMIC is not necessary and can be replaced with GFP_KERNEL,
which can sleep and improve the possibility of sucessful allocation.

This is found by a static analysis tool named DCNS written by myself.
And I also manually check it.

Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
---
 drivers/net/wireless/broadcom/b43legacy/dma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/broadcom/b43legacy/dma.c b/drivers/net/wireless/broadcom/b43legacy/dma.c
index cfa617d..2f0c64c 100644
--- a/drivers/net/wireless/broadcom/b43legacy/dma.c
+++ b/drivers/net/wireless/broadcom/b43legacy/dma.c
@@ -1064,7 +1064,7 @@ static int dma_tx_fragment(struct b43legacy_dmaring *ring,
 	meta->dmaaddr = map_descbuffer(ring, skb->data, skb->len, 1);
 	/* create a bounce buffer in zone_dma on mapping failure. */
 	if (b43legacy_dma_mapping_error(ring, meta->dmaaddr, skb->len, 1)) {
-		bounce_skb = alloc_skb(skb->len, GFP_ATOMIC | GFP_DMA);
+		bounce_skb = alloc_skb(skb->len, GFP_KERNEL | GFP_DMA);
 		if (!bounce_skb) {
 			ring->current_slot = old_top_slot;
 			ring->used_slots = old_used_slots;
-- 
1.9.1

^ permalink raw reply related

* Re: [PATCH v2] dp83640: Ensure against premature access to PHY registers after reset
From: Sasha Levin @ 2018-04-10 13:50 UTC (permalink / raw)
  To: Sasha Levin, Esben Haabendal, Esben Haabendal,
	netdev@vger.kernel.org
  Cc: andrew@lunn.ch, richardcochran@gmail.com, f.fainelli@gmail.com,
	stable@vger.kernel.org
In-Reply-To: <20180406170844.4248-1-esben.haabendal@gmail.com>

Hi,

[This is an automated email]

This commit has been processed by the -stable helper bot and determined
to be a high probability candidate for -stable trees. (score: 7.2454)

The bot has tested the following trees: v4.16.1, v4.15.16, v4.14.33, v4.9.93, v4.4.127.

v4.16.1: Build OK!
v4.15.16: Build OK!
v4.14.33: Build OK!
v4.9.93: Build OK!
v4.4.127: Build OK!

Please let us know if you'd like to have this patch included in a stable tree.

^ permalink raw reply

* Re: [PATCH] dp83640: Ensure against premature access to PHY registers after reset
From: Sasha Levin @ 2018-04-10 13:50 UTC (permalink / raw)
  To: Sasha Levin, Esben Haabendal, Esben Haabendal,
	netdev@vger.kernel.org
  Cc: Esben Haabendal, stable@vger.kernel.org
In-Reply-To: <20180406140540.13511-1-esben.haabendal@gmail.com>

Hi,

[This is an automated email]

This commit has been processed by the -stable helper bot and determined
to be a high probability candidate for -stable trees. (score: 6.8160)

The bot has tested the following trees: v4.16.1, v4.15.16, v4.14.33, v4.9.93, v4.4.127.

v4.16.1: Build OK!
v4.15.16: Build OK!
v4.14.33: Build OK!
v4.9.93: Build OK!
v4.4.127: Build OK!

Please let us know if you'd like to have this patch included in a stable tree.

^ permalink raw reply

* Re: [PATCH] ARM: dts: ls1021a: Specify TBIPA register address
From: Sasha Levin @ 2018-04-10 13:50 UTC (permalink / raw)
  To: Sasha Levin, Esben Haabendal, Esben Haabendal,
	netdev@vger.kernel.org
  Cc: Rob Herring, stable@vger.kernel.org
In-Reply-To: <20180406124635.12319-1-esben.haabendal@gmail.com>

Hi,

[This is an automated email]

This commit has been processed by the -stable helper bot and determined
to be a high probability candidate for -stable trees. (score: 22.1404)

The bot has tested the following trees: v4.16.1, v4.15.16, v4.14.33, v4.9.93, v4.4.127.

v4.16.1: Build OK!
v4.15.16: Build OK!
v4.14.33: Build OK!
v4.9.93: Build OK!
v4.4.127: Build OK!

Please let us know if you'd like to have this patch included in a stable tree.

^ permalink raw reply

* Re: [PATCH net 1/3] lan78xx: PHY DSP registers initialization to address EEE link drop issues with long cables
From: Sasha Levin @ 2018-04-10 13:50 UTC (permalink / raw)
  To: Sasha Levin, Raghuram Chary J, davem@davemloft.net
  Cc: netdev@vger.kernel.org, unglinuxdriver@microchip.com,
	stable@vger.kernel.org
In-Reply-To: <20180406061204.18257-2-raghuramchary.jallipalli@microchip.com>

Hi,

[This is an automated email]

This commit has been processed because it contains a "Fixes:" tag,
fixing commit: 55d7de9de6c3 Microchip's LAN7800 family USB 2/3 to 10/100/1000 Ethernet device driver.

The bot has also determined it's probably a bug fixing patch. (score: 3.9486)

The bot has tested the following trees: v4.16.1, v4.15.16, v4.14.33, v4.9.93, v4.4.127.

v4.16.1: Build OK!
v4.15.16: Build OK!
v4.14.33: Build OK!
v4.9.93: Failed to apply! Possible dependencies:
    f6e3ef3e4d35 ("lan78xx: relocate mdix setting to phy driver")

v4.4.127: Failed to apply! Possible dependencies:
    f6e3ef3e4d35 ("lan78xx: relocate mdix setting to phy driver")

^ permalink raw reply

* Re: [PATCH net 3/3] lan78xx: Lan7801 Support for Fixed PHY
From: Sasha Levin @ 2018-04-10 13:50 UTC (permalink / raw)
  To: Sasha Levin, Raghuram Chary J, davem@davemloft.net
  Cc: netdev@vger.kernel.org, unglinuxdriver@microchip.com,
	stable@vger.kernel.org
In-Reply-To: <20180406061204.18257-4-raghuramchary.jallipalli@microchip.com>

Hi,

[This is an automated email]

This commit has been processed because it contains a "Fixes:" tag,
fixing commit: 55d7de9de6c3 Microchip's LAN7800 family USB 2/3 to 10/100/1000 Ethernet device driver.

The bot has tested the following trees: v4.16.1, v4.15.16, v4.14.33, v4.9.93, v4.4.127.

v4.16.1: Build OK!
v4.15.16: Failed to apply! Possible dependencies:
    3b51cc75eba2 ("lan78xx: remove redundant initialization of pointer 'phydev'")

v4.14.33: Failed to apply! Possible dependencies:
    3b51cc75eba2 ("lan78xx: remove redundant initialization of pointer 'phydev'")

v4.9.93: Failed to apply! Possible dependencies:
    02dc1f3d613d ("lan78xx: add LAN7801 MAC only support")
    3b51cc75eba2 ("lan78xx: remove redundant initialization of pointer 'phydev'")
    8c56ea410efb ("net: lan78xx: fix build errors when linux/phy*.h is removed from net/dsa.h")
    cc89c323a30e ("lan78xx: Use irq_domain for phy interrupt from USB Int. EP")

v4.4.127: Failed to apply! Possible dependencies:
    02dc1f3d613d ("lan78xx: add LAN7801 MAC only support")
    3b51cc75eba2 ("lan78xx: remove redundant initialization of pointer 'phydev'")
    8c56ea410efb ("net: lan78xx: fix build errors when linux/phy*.h is removed from net/dsa.h")
    cc89c323a30e ("lan78xx: Use irq_domain for phy interrupt from USB Int. EP")

^ permalink raw reply

* Re: [PATCH net 2/3] lan78xx: Add support to dump lan78xx registers
From: Sasha Levin @ 2018-04-10 13:50 UTC (permalink / raw)
  To: Sasha Levin, Raghuram Chary J, davem@davemloft.net
  Cc: netdev@vger.kernel.org, unglinuxdriver@microchip.com,
	stable@vger.kernel.org
In-Reply-To: <20180406061204.18257-3-raghuramchary.jallipalli@microchip.com>

Hi,

[This is an automated email]

This commit has been processed because it contains a "Fixes:" tag,
fixing commit: 55d7de9de6c3 Microchip's LAN7800 family USB 2/3 to 10/100/1000 Ethernet device driver.

The bot has tested the following trees: v4.16.1, v4.15.16, v4.14.33, v4.9.93, v4.4.127.

v4.16.1: Build OK!
v4.15.16: Build OK!
v4.14.33: Build OK!
v4.9.93: Failed to apply! Possible dependencies:
    6e76510e7e19 ("net: usb: lan78xx: use new api ethtool_{get|set}_link_ksettings")

v4.4.127: Failed to apply! Possible dependencies:
    20ff55655a93 ("lan78xx: handle statistics counter rollover")
    349e0c5e2237 ("lan78xx: add ethtool set & get pause functions")
    6e76510e7e19 ("net: usb: lan78xx: use new api ethtool_{get|set}_link_ksettings")

^ permalink raw reply

* Re: [PATCH net 0/3] lan78xx: Fixes and enhancements
From: Sasha Levin @ 2018-04-10 13:50 UTC (permalink / raw)
  To: Sasha Levin, Raghuram Chary J, davem@davemloft.net
  Cc: netdev@vger.kernel.org, unglinuxdriver@microchip.com,
	stable@vger.kernel.org
In-Reply-To: <20180406061204.18257-1-raghuramchary.jallipalli@microchip.com>

Hi,

[This is an automated email]

This commit has been processed because it contains a "Fixes:" tag,
fixing commit: 55d7de9de6c3 Microchip's LAN7800 family USB 2/3 to 10/100/1000 Ethernet device driver.

The bot has tested the following trees: v4.16.1, v4.15.16, v4.14.33, v4.9.93, v4.4.127.

v4.16.1: Build OK!
v4.15.16: Failed to apply! Possible dependencies:
    3b51cc75eba2 ("lan78xx: remove redundant initialization of pointer 'phydev'")
    95fc5753103d ("lan78xx: Lan7801 Support for Fixed PHY")

v4.14.33: Failed to apply! Possible dependencies:
    3b51cc75eba2 ("lan78xx: remove redundant initialization of pointer 'phydev'")
    95fc5753103d ("lan78xx: Lan7801 Support for Fixed PHY")

v4.9.93: Failed to apply! Possible dependencies:
    02dc1f3d613d ("lan78xx: add LAN7801 MAC only support")
    3b51cc75eba2 ("lan78xx: remove redundant initialization of pointer 'phydev'")
    8c56ea410efb ("net: lan78xx: fix build errors when linux/phy*.h is removed from net/dsa.h")
    95fc5753103d ("lan78xx: Lan7801 Support for Fixed PHY")
    cc89c323a30e ("lan78xx: Use irq_domain for phy interrupt from USB Int. EP")

v4.4.127: Failed to apply! Possible dependencies:
    02dc1f3d613d ("lan78xx: add LAN7801 MAC only support")
    3b51cc75eba2 ("lan78xx: remove redundant initialization of pointer 'phydev'")
    8c56ea410efb ("net: lan78xx: fix build errors when linux/phy*.h is removed from net/dsa.h")
    95fc5753103d ("lan78xx: Lan7801 Support for Fixed PHY")
    cc89c323a30e ("lan78xx: Use irq_domain for phy interrupt from USB Int. EP")

^ permalink raw reply

* Re: [PATCH net] net/ipv6: Increment OUTxxx counters after netfilter hook
From: Sasha Levin @ 2018-04-10 13:49 UTC (permalink / raw)
  To: Sasha Levin, Jeff Barnhill, netdev@vger.kernel.org
  Cc: dsahern@gmail.com, Jeff Barnhill, stable@vger.kernel.org
In-Reply-To: <20180405212947.17858-1-0xeffeff@gmail.com>

Hi,

[This is an automated email]

This commit has been processed by the -stable helper bot and determined
to be a high probability candidate for -stable trees. (score: 5.8567)

The bot has tested the following trees: v4.16.1, v4.15.16, v4.14.33, v4.9.93, v4.4.127.

v4.16.1: Build OK!
v4.15.16: Build OK!
v4.14.33: Build OK!
v4.9.93: Build OK!
v4.4.127: Failed to apply! Possible dependencies:
    1d0155035918 ("ipv6: rename IP6_INC_STATS_BH()")


Please let us know if you'd like to have this patch included in a stable tree.

^ permalink raw reply

* Re: [PATCH v2] net: phy: marvell: Enable interrupt function on LED2 pin
From: Sasha Levin @ 2018-04-10 13:49 UTC (permalink / raw)
  To: Sasha Levin, Esben Haabendal, Esben Haabendal,
	netdev@vger.kernel.org
  Cc: Esben Haabendal, Rasmus Villemoes, stable@vger.kernel.org
In-Reply-To: <20180405204029.665-1-esben.haabendal@gmail.com>

Hi,

[This is an automated email]

This commit has been processed by the -stable helper bot and determined
to be a high probability candidate for -stable trees. (score: 7.6606)

The bot has tested the following trees: v4.16.1, v4.15.16, v4.14.33, v4.9.93, v4.4.127.

v4.16.1: Build OK!
v4.15.16: Build failed! Errors:
    marvell.c:878:13: error: implicit declaration of function ‘phy_modify_paged’; did you mean ‘phys_to_page’? [-Werror=implicit-function-declaration]

v4.14.33: Build failed! Errors:
    marvell.c:874:13: error: implicit declaration of function ‘phy_modify_paged’; did you mean ‘phys_to_page’? [-Werror=implicit-function-declaration]

v4.9.93: Build failed! Errors:
    marvell.c:829:13: error: implicit declaration of function ‘phy_modify_paged’; did you mean ‘phys_to_page’? [-Werror=implicit-function-declaration]
    marvell.c:830:12: error: ‘MII_MARVELL_LED_PAGE’ undeclared (first use in this function); did you mean ‘MII_MARVELL_PHY_PAGE’?

v4.4.127: Failed to apply! Possible dependencies:
    407353ec85cc ("phy: marvell: Fix 88E1510 initialization")
    d2fa47d9dd5c ("phy: marvell: Add ethtool statistics counters")
    fdecf36fcefa ("phy: marvell: fix LED configuration via marvell,reg-init")


Please let us know if you'd like to have this patch included in a stable tree.

--
Thanks,
Sasha

^ permalink raw reply

* Re: [patch net] devlink: convert occ_get op to separate registration
From: Sasha Levin @ 2018-04-10 13:49 UTC (permalink / raw)
  To: Sasha Levin, Jiri Pirko, Jiri Pirko, netdev@vger.kernel.org
  Cc: davem@davemloft.net, idosch@mellanox.com, stable@vger.kernel.org
In-Reply-To: <20180405201321.16626-1-jiri@resnulli.us>

Hi,

[This is an automated email]

This commit has been processed because it contains a "Fixes:" tag,
fixing commit: d9f9b9a4d05f devlink: Add support for resource abstraction.

The bot has tested the following trees: v4.16.1.

v4.16.1: Failed to apply! Possible dependencies:
    37923ed6b8ce ("netdevsim: Add simple FIB resource controller via devlink")
    3ed898e8cd05 ("mlxsw: spectrum_kvdl: Make some functions static")
    4f4bbf7c4e3d ("devlink: Perform cleanup of resource_set cb")
    51d3c08e3371 ("mlxsw: spectrum_kvdl: Add support for linear division resources")
    7f47b19bd744 ("mlxsw: spectrum_kvdl: Add support for per part occupancy")
    88d2fbcda145 ("mlxsw: spectrum: Pass mlxsw_core as arg of mlxsw_sp_kvdl_resources_register()")
    c8276dd250e9 ("mlxsw: spectrum_kvdl: Fix handling of resource_size_param")
    f9b9120119ca ("mlxsw: Constify devlink_resource_ops")

^ permalink raw reply

* Re: [PATCH 2/4] hv_netvsc: Split netvsc_revoke_buf() and netvsc_teardown_gpadl()
From: Sasha Levin @ 2018-04-10 13:49 UTC (permalink / raw)
  To: Sasha Levin, Mohammed Gamal, netdev@vger.kernel.org,
	Stephen Hemminger
  Cc: devel@linuxdriverproject.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org
In-Reply-To: <1522955361-14704-3-git-send-email-mgamal@redhat.com>

Hi,

[This is an automated email]

This commit has been processed because it contains a "Fixes:" tag,
fixing commit: 0ef58b0a05c1 hv_netvsc: change GPAD teardown order on older versions.

The bot has also determined it's probably a bug fixing patch. (score: 3.6623)

The bot has tested the following trees: v4.16.1.

v4.16.1: Failed to apply! Possible dependencies:
    2afc5d61a719 ("hv_netvsc: Use Windows version instead of NVSP version on GPAD teardown")


--
Thanks,
Sasha

^ permalink raw reply

* Re: [PATCH 3/4] hv_netvsc: Ensure correct teardown message sequence order
From: Sasha Levin @ 2018-04-10 13:49 UTC (permalink / raw)
  To: Sasha Levin, Mohammed Gamal, netdev@vger.kernel.org,
	Stephen Hemminger
  Cc: devel@linuxdriverproject.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org
In-Reply-To: <1522955361-14704-4-git-send-email-mgamal@redhat.com>

Hi,

[This is an automated email]

This commit has been processed because it contains a "Fixes:" tag,
fixing commit: 0ef58b0a05c1 hv_netvsc: change GPAD teardown order on older versions.

The bot has also determined it's probably a bug fixing patch. (score: 60.7987)

The bot has tested the following trees: v4.16.1.

v4.16.1: Failed to apply! Possible dependencies:
    7992894c305e ("hv_netvsc: Split netvsc_revoke_buf() and netvsc_teardown_gpadl()")

^ permalink raw reply

* Re: [PATCH 1/4] hv_netvsc: Use Windows version instead of NVSP version on GPAD teardown
From: Sasha Levin @ 2018-04-10 13:49 UTC (permalink / raw)
  To: Sasha Levin, Mohammed Gamal, netdev@vger.kernel.org,
	Stephen Hemminger
  Cc: devel@linuxdriverproject.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org
In-Reply-To: <1522955361-14704-2-git-send-email-mgamal@redhat.com>

Hi,

[This is an automated email]

This commit has been processed because it contains a "Fixes:" tag,
fixing commit: 0ef58b0a05c1 hv_netvsc: change GPAD teardown order on older versions.

The bot has also determined it's probably a bug fixing patch. (score: 19.6070)

The bot has tested the following trees: v4.16.1.

v4.16.1: Build OK!

--
Thanks,
Sasha

^ permalink raw reply

* [PATCH] net: wireless: cisco: airo: Replace mdelay with usleep_range in flashgchar
From: Jia-Ju Bai @ 2018-04-10 13:44 UTC (permalink / raw)
  To: kvalo, davem, gustavo, mingo, dhowells, johannes.berg
  Cc: linux-wireless, netdev, linux-kernel, Jia-Ju Bai

flashgchar() is never called in atomic context.

flashgchar() is only called by flashcard().
flashcard() calls copy_from_user() and kmalloc(GFP_KERNEL), which 
indicates this function is not called in atomic context.

Despite never getting called from atomic context, flashgchar()
calls mdelay() to busily wait.
This is not necessary and can be replaced with usleep_range() to
avoid busy waiting.

This is found by a static analysis tool named DCNS written by myself.
And I also manually check it.

Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
---
 drivers/net/wireless/cisco/airo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/cisco/airo.c b/drivers/net/wireless/cisco/airo.c
index 54201c0..45747b7 100644
--- a/drivers/net/wireless/cisco/airo.c
+++ b/drivers/net/wireless/cisco/airo.c
@@ -8106,7 +8106,7 @@ static int flashgchar(struct airo_info *ai,int matchbyte,int dwelltime){
 
 		if(dwelltime && !(0x8000 & rchar)){
 			dwelltime -= 10;
-			mdelay(10);
+			usleep_range(10000, 11000);
 			continue;
 		}
 		rbyte = 0xff & rchar;
-- 
1.9.1

^ permalink raw reply related

* Re: [PATCH net] ip_gre: clear feature flags when incompatible o_flags are set
From: William Tu @ 2018-04-10 13:36 UTC (permalink / raw)
  To: Xin Long; +Cc: Sabrina Dubroca, network dev, Lorenzo Bianconi
In-Reply-To: <CADvbK_c9nOohr_f09r8dLs3a-7iUgn6KqUjCCenKXrhdPo2Rpw@mail.gmail.com>

On Tue, Apr 10, 2018 at 6:10 AM, Xin Long <lucien.xin@gmail.com> wrote:
> On Tue, Apr 10, 2018 at 6:57 PM, Sabrina Dubroca <sd@queasysnail.net> wrote:
>> Commit dd9d598c6657 ("ip_gre: add the support for i/o_flags update via
>> netlink") added the ability to change o_flags, but missed that the
>> GSO/LLTX features are disabled by default, and only enabled some gre
>> features are unused. Thus we also need to disable the GSO/LLTX features
>> on the device when the TUNNEL_SEQ or TUNNEL_CSUM flags are set.
>>
>> These two examples should result in the same features being set:
>>
>>     ip link add gre_none type gre local 192.168.0.10 remote 192.168.0.20 ttl 255 key 0
>>
>>     ip link set gre_none type gre seq
>>     ip link add gre_seq type gre local 192.168.0.10 remote 192.168.0.20 ttl 255 key 1 seq
>>
>> Fixes: dd9d598c6657 ("ip_gre: add the support for i/o_flags update via netlink")
>> Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
>> ---

Looks good to me.
Acked-by: William Tu <u9012063@gmail.com>


>>  net/ipv4/ip_gre.c | 6 ++++++
>>  1 file changed, 6 insertions(+)
>>
>> diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
>> index a8772a978224..9c169bb2444d 100644
>> --- a/net/ipv4/ip_gre.c
>> +++ b/net/ipv4/ip_gre.c
>> @@ -781,8 +781,14 @@ static void ipgre_link_update(struct net_device *dev, bool set_mtu)
>>                     tunnel->encap.type == TUNNEL_ENCAP_NONE) {
>>                         dev->features |= NETIF_F_GSO_SOFTWARE;
>>                         dev->hw_features |= NETIF_F_GSO_SOFTWARE;
>> +               } else {
>> +                       dev->features &= ~NETIF_F_GSO_SOFTWARE;
>> +                       dev->hw_features &= ~NETIF_F_GSO_SOFTWARE;
>>                 }
>>                 dev->features |= NETIF_F_LLTX;
>> +       } else {
>> +               dev->hw_features &= ~NETIF_F_GSO_SOFTWARE;
>> +               dev->features &= ~(NETIF_F_LLTX | NETIF_F_GSO_SOFTWARE);
>>         }
>>  }
>>
>> --
>> 2.16.2
>>
> Reviewed-by: Xin Long <lucien.xin@gmail.com>

^ permalink raw reply

* Re: [virtio-dev] Re: [RFC] vhost: introduce mdev based hardware vhost backend
From: Michael S. Tsirkin @ 2018-04-10 13:36 UTC (permalink / raw)
  To: Liang, Cunming
  Cc: Paolo Bonzini, Bie, Tiwei, Jason Wang, alex.williamson@redhat.com,
	ddutile@redhat.com, Duyck, Alexander H,
	virtio-dev@lists.oasis-open.org, linux-kernel@vger.kernel.org,
	kvm@vger.kernel.org, virtualization@lists.linux-foundation.org,
	netdev@vger.kernel.org, Daly, Dan, Wang, Zhihong, Tan, Jianfeng,
	Wang, Xiao W
In-Reply-To: <D0158A423229094DA7ABF71CF2FA0DA34E9222F4@SHSMSX104.ccr.corp.intel.com>

On Tue, Apr 10, 2018 at 09:23:53AM +0000, Liang, Cunming wrote:
> 
> 
> > -----Original Message-----
> > From: Paolo Bonzini [mailto:pbonzini@redhat.com]
> > Sent: Tuesday, April 10, 2018 3:52 PM
> > To: Bie, Tiwei <tiwei.bie@intel.com>; Jason Wang <jasowang@redhat.com>
> > Cc: mst@redhat.com; alex.williamson@redhat.com; ddutile@redhat.com;
> > Duyck, Alexander H <alexander.h.duyck@intel.com>; virtio-dev@lists.oasis-
> > open.org; linux-kernel@vger.kernel.org; kvm@vger.kernel.org;
> > virtualization@lists.linux-foundation.org; netdev@vger.kernel.org; Daly, Dan
> > <dan.daly@intel.com>; Liang, Cunming <cunming.liang@intel.com>; Wang,
> > Zhihong <zhihong.wang@intel.com>; Tan, Jianfeng <jianfeng.tan@intel.com>;
> > Wang, Xiao W <xiao.w.wang@intel.com>
> > Subject: Re: [virtio-dev] Re: [RFC] vhost: introduce mdev based hardware
> > vhost backend
> > 
> > On 10/04/2018 06:57, Tiwei Bie wrote:
> > >> So you just move the abstraction layer from qemu to kernel, and you
> > >> still need different drivers in kernel for different device
> > >> interfaces of accelerators. This looks even more complex than leaving
> > >> it in qemu. As you said, another idea is to implement userspace vhost
> > >> backend for accelerators which seems easier and could co-work with
> > >> other parts of qemu without inventing new type of messages.
> > >
> > > I'm not quite sure. Do you think it's acceptable to add various vendor
> > > specific hardware drivers in QEMU?
> > 
> > I think so.  We have vendor-specific quirks, and at some point there was an
> > idea of using quirks to implement (vendor-specific) live migration support for
> > assigned devices.
> 
> Vendor-specific quirks of accessing VGA is a small portion. Other major portions are still handled by guest driver.
> 
> While in this case, when saying various vendor specific drivers in QEMU, it says QEMU takes over and provides the entire user space device drivers. Some parts are even not relevant to vhost, they're basic device function enabling. Moreover, it could be different kinds of devices(network/block/...) under vhost. No matter # of vendors or # of types, total LOC is not small.
> 
> The idea is to avoid introducing these extra complexity out of QEMU, keeping vhost adapter simple. As vhost protocol is de factor standard, it leverages kernel device driver to provide the diversity. Changing once in QEMU, then it supports multi-vendor devices whose drivers naturally providing kernel driver there.
> 
> If QEMU is going to build a user space driver framework there, we're open mind on that, even leveraging DPDK as the underlay library. Looking forward to more others' comments from community.
> 
> Steve

Dependency on a kernel driver is fine IMHO. It's the dependency on a
DPDK backend that makes people unhappy, since the functionality
in question is setup-time only.

As others said, we do not need to go overeboard. A couple of small
vendor-specific quirks in qemu isn't a big deal.

> > 
> > Paolo

^ permalink raw reply

* [PATCH 2/2] net: wireless: zydas: Replace GFP_ATOMIC with GFP_KERNEL in zd1201_fw_upload
From: Jia-Ju Bai @ 2018-04-10 13:30 UTC (permalink / raw)
  To: kvalo, davem, arvind.yadav.cs, johannes.berg, stephen
  Cc: linux-wireless, netdev, linux-kernel, Jia-Ju Bai

zd1201_probe() is never called in atomic context.

zd1201_fw_upload() is only called by zd1201_probe(), 
which is only set as ".probe" in struct usb_driver.

Despite never getting called from atomic context,
zd1201_fw_upload() calls kmalloc() with GFP_ATOMIC,
which does not sleep for allocation.
GFP_ATOMIC is not necessary and can be replaced with GFP_KERNEL,
which can sleep and improve the possibility of sucessful allocation.

This is found by a static analysis tool named DCNS written by myself.
And I also manually check it.

Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
---
 drivers/net/wireless/zydas/zd1201.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/zydas/zd1201.c b/drivers/net/wireless/zydas/zd1201.c
index 581e857..cba2bed 100644
--- a/drivers/net/wireless/zydas/zd1201.c
+++ b/drivers/net/wireless/zydas/zd1201.c
@@ -74,7 +74,7 @@ static int zd1201_fw_upload(struct usb_device *dev, int apfw)
 	data = fw_entry->data;
         len = fw_entry->size;
 
-	buf = kmalloc(1024, GFP_ATOMIC);
+	buf = kmalloc(1024, GFP_KERNEL);
 	if (!buf) {
 		err = -ENOMEM;
 		goto exit;
-- 
1.9.1

^ permalink raw reply related

* [PATCH 1/2] net: wireless: zydas: Replace mdelay with msleep in zd1201_probe
From: Jia-Ju Bai @ 2018-04-10 13:30 UTC (permalink / raw)
  To: kvalo, davem, stephen, arvind.yadav.cs, johannes.berg
  Cc: linux-wireless, netdev, linux-kernel, Jia-Ju Bai

zd1201_probe() is never called in atomic context.

zd1201_probe() is only set as ".probe" in struct usb_driver.

Despite never getting called from atomic context, zd1201_probe()
calls mdelay() to busily wait.
This is not necessary and can be replaced with msleep() to
avoid busy waiting.

This is found by a static analysis tool named DCNS written by myself.
And I also manually check it.

Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
---
 drivers/net/wireless/zydas/zd1201.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/zydas/zd1201.c b/drivers/net/wireless/zydas/zd1201.c
index 581e857..12774e9 100644
--- a/drivers/net/wireless/zydas/zd1201.c
+++ b/drivers/net/wireless/zydas/zd1201.c
@@ -1767,7 +1767,7 @@ static int zd1201_probe(struct usb_interface *interface,
 		goto err_zd;
 	}
 
-	mdelay(100);
+	msleep(100);
 	err = zd1201_drvr_start(zd);
 	if (err)
 		goto err_zd;
-- 
1.9.1

^ permalink raw reply related

* Re: [PATCH v2 2/2] vhost: return bool from *_access_ok() functions
From: Michael S. Tsirkin @ 2018-04-10 13:29 UTC (permalink / raw)
  To: Stefan Hajnoczi
  Cc: virtualization, syzkaller-bugs, Linus Torvalds, kvm, jasowang,
	linux-kernel, netdev
In-Reply-To: <20180410052630.11270-3-stefanha@redhat.com>

On Tue, Apr 10, 2018 at 01:26:30PM +0800, Stefan Hajnoczi wrote:
> Currently vhost *_access_ok() functions return int.  This is error-prone
> because there are two popular conventions:
> 
> 1. 0 means failure, 1 means success
> 2. -errno means failure, 0 means success
> 
> Although vhost mostly uses #1, it does not do so consistently.
> umem_access_ok() uses #2.
> 
> This patch changes the return type from int to bool so that false means
> failure and true means success.  This eliminates a potential source of
> errors.
> 
> Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>

Acked-by: Michael S. Tsirkin <mst@redhat.com>

> ---
>  drivers/vhost/vhost.h |  4 ++--
>  drivers/vhost/vhost.c | 66 +++++++++++++++++++++++++--------------------------
>  2 files changed, 35 insertions(+), 35 deletions(-)
> 
> diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h
> index ac4b6056f19a..6e00fa57af09 100644
> --- a/drivers/vhost/vhost.h
> +++ b/drivers/vhost/vhost.h
> @@ -178,8 +178,8 @@ void vhost_dev_cleanup(struct vhost_dev *);
>  void vhost_dev_stop(struct vhost_dev *);
>  long vhost_dev_ioctl(struct vhost_dev *, unsigned int ioctl, void __user *argp);
>  long vhost_vring_ioctl(struct vhost_dev *d, int ioctl, void __user *argp);
> -int vhost_vq_access_ok(struct vhost_virtqueue *vq);
> -int vhost_log_access_ok(struct vhost_dev *);
> +bool vhost_vq_access_ok(struct vhost_virtqueue *vq);
> +bool vhost_log_access_ok(struct vhost_dev *);
>  
>  int vhost_get_vq_desc(struct vhost_virtqueue *,
>  		      struct iovec iov[], unsigned int iov_count,
> diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
> index 93fd0c75b0d8..b6a082ef33dd 100644
> --- a/drivers/vhost/vhost.c
> +++ b/drivers/vhost/vhost.c
> @@ -641,14 +641,14 @@ void vhost_dev_cleanup(struct vhost_dev *dev)
>  }
>  EXPORT_SYMBOL_GPL(vhost_dev_cleanup);
>  
> -static int log_access_ok(void __user *log_base, u64 addr, unsigned long sz)
> +static bool log_access_ok(void __user *log_base, u64 addr, unsigned long sz)
>  {
>  	u64 a = addr / VHOST_PAGE_SIZE / 8;
>  
>  	/* Make sure 64 bit math will not overflow. */
>  	if (a > ULONG_MAX - (unsigned long)log_base ||
>  	    a + (unsigned long)log_base > ULONG_MAX)
> -		return 0;
> +		return false;
>  
>  	return access_ok(VERIFY_WRITE, log_base + a,
>  			 (sz + VHOST_PAGE_SIZE * 8 - 1) / VHOST_PAGE_SIZE / 8);
> @@ -661,30 +661,30 @@ static bool vhost_overflow(u64 uaddr, u64 size)
>  }
>  
>  /* Caller should have vq mutex and device mutex. */
> -static int vq_memory_access_ok(void __user *log_base, struct vhost_umem *umem,
> -			       int log_all)
> +static bool vq_memory_access_ok(void __user *log_base, struct vhost_umem *umem,
> +				int log_all)
>  {
>  	struct vhost_umem_node *node;
>  
>  	if (!umem)
> -		return 0;
> +		return false;
>  
>  	list_for_each_entry(node, &umem->umem_list, link) {
>  		unsigned long a = node->userspace_addr;
>  
>  		if (vhost_overflow(node->userspace_addr, node->size))
> -			return 0;
> +			return false;
>  
>  
>  		if (!access_ok(VERIFY_WRITE, (void __user *)a,
>  				    node->size))
> -			return 0;
> +			return false;
>  		else if (log_all && !log_access_ok(log_base,
>  						   node->start,
>  						   node->size))
> -			return 0;
> +			return false;
>  	}
> -	return 1;
> +	return true;
>  }
>  
>  static inline void __user *vhost_vq_meta_fetch(struct vhost_virtqueue *vq,
> @@ -701,13 +701,13 @@ static inline void __user *vhost_vq_meta_fetch(struct vhost_virtqueue *vq,
>  
>  /* Can we switch to this memory table? */
>  /* Caller should have device mutex but not vq mutex */
> -static int memory_access_ok(struct vhost_dev *d, struct vhost_umem *umem,
> -			    int log_all)
> +static bool memory_access_ok(struct vhost_dev *d, struct vhost_umem *umem,
> +			     int log_all)
>  {
>  	int i;
>  
>  	for (i = 0; i < d->nvqs; ++i) {
> -		int ok;
> +		bool ok;
>  		bool log;
>  
>  		mutex_lock(&d->vqs[i]->mutex);
> @@ -717,12 +717,12 @@ static int memory_access_ok(struct vhost_dev *d, struct vhost_umem *umem,
>  			ok = vq_memory_access_ok(d->vqs[i]->log_base,
>  						 umem, log);
>  		else
> -			ok = 1;
> +			ok = true;
>  		mutex_unlock(&d->vqs[i]->mutex);
>  		if (!ok)
> -			return 0;
> +			return false;
>  	}
> -	return 1;
> +	return true;
>  }
>  
>  static int translate_desc(struct vhost_virtqueue *vq, u64 addr, u32 len,
> @@ -959,21 +959,21 @@ static void vhost_iotlb_notify_vq(struct vhost_dev *d,
>  	spin_unlock(&d->iotlb_lock);
>  }
>  
> -static int umem_access_ok(u64 uaddr, u64 size, int access)
> +static bool umem_access_ok(u64 uaddr, u64 size, int access)
>  {
>  	unsigned long a = uaddr;
>  
>  	/* Make sure 64 bit math will not overflow. */
>  	if (vhost_overflow(uaddr, size))
> -		return -EFAULT;
> +		return false;
>  
>  	if ((access & VHOST_ACCESS_RO) &&
>  	    !access_ok(VERIFY_READ, (void __user *)a, size))
> -		return -EFAULT;
> +		return false;
>  	if ((access & VHOST_ACCESS_WO) &&
>  	    !access_ok(VERIFY_WRITE, (void __user *)a, size))
> -		return -EFAULT;
> -	return 0;
> +		return false;
> +	return true;
>  }
>  
>  static int vhost_process_iotlb_msg(struct vhost_dev *dev,
> @@ -988,7 +988,7 @@ static int vhost_process_iotlb_msg(struct vhost_dev *dev,
>  			ret = -EFAULT;
>  			break;
>  		}
> -		if (umem_access_ok(msg->uaddr, msg->size, msg->perm)) {
> +		if (!umem_access_ok(msg->uaddr, msg->size, msg->perm)) {
>  			ret = -EFAULT;
>  			break;
>  		}
> @@ -1135,10 +1135,10 @@ static int vhost_iotlb_miss(struct vhost_virtqueue *vq, u64 iova, int access)
>  	return 0;
>  }
>  
> -static int vq_access_ok(struct vhost_virtqueue *vq, unsigned int num,
> -			struct vring_desc __user *desc,
> -			struct vring_avail __user *avail,
> -			struct vring_used __user *used)
> +static bool vq_access_ok(struct vhost_virtqueue *vq, unsigned int num,
> +			 struct vring_desc __user *desc,
> +			 struct vring_avail __user *avail,
> +			 struct vring_used __user *used)
>  
>  {
>  	size_t s = vhost_has_feature(vq, VIRTIO_RING_F_EVENT_IDX) ? 2 : 0;
> @@ -1161,8 +1161,8 @@ static void vhost_vq_meta_update(struct vhost_virtqueue *vq,
>  		vq->meta_iotlb[type] = node;
>  }
>  
> -static int iotlb_access_ok(struct vhost_virtqueue *vq,
> -			   int access, u64 addr, u64 len, int type)
> +static bool iotlb_access_ok(struct vhost_virtqueue *vq,
> +			    int access, u64 addr, u64 len, int type)
>  {
>  	const struct vhost_umem_node *node;
>  	struct vhost_umem *umem = vq->iotlb;
> @@ -1220,7 +1220,7 @@ EXPORT_SYMBOL_GPL(vq_iotlb_prefetch);
>  
>  /* Can we log writes? */
>  /* Caller should have device mutex but not vq mutex */
> -int vhost_log_access_ok(struct vhost_dev *dev)
> +bool vhost_log_access_ok(struct vhost_dev *dev)
>  {
>  	return memory_access_ok(dev, dev->umem, 1);
>  }
> @@ -1228,8 +1228,8 @@ EXPORT_SYMBOL_GPL(vhost_log_access_ok);
>  
>  /* Verify access for write logging. */
>  /* Caller should have vq mutex and device mutex */
> -static int vq_log_access_ok(struct vhost_virtqueue *vq,
> -			    void __user *log_base)
> +static bool vq_log_access_ok(struct vhost_virtqueue *vq,
> +			     void __user *log_base)
>  {
>  	size_t s = vhost_has_feature(vq, VIRTIO_RING_F_EVENT_IDX) ? 2 : 0;
>  
> @@ -1242,14 +1242,14 @@ static int vq_log_access_ok(struct vhost_virtqueue *vq,
>  
>  /* Can we start vq? */
>  /* Caller should have vq mutex and device mutex */
> -int vhost_vq_access_ok(struct vhost_virtqueue *vq)
> +bool vhost_vq_access_ok(struct vhost_virtqueue *vq)
>  {
>  	if (!vq_log_access_ok(vq, vq->log_base))
> -		return 0;
> +		return false;
>  
>  	/* Access validation occurs at prefetch time with IOTLB */
>  	if (vq->iotlb)
> -		return 1;
> +		return true;
>  
>  	return vq_access_ok(vq, vq->num, vq->desc, vq->avail, vq->used);
>  }
> -- 
> 2.14.3

^ permalink raw reply

* Re: [PATCH v2 1/2] vhost: fix vhost_vq_access_ok() log check
From: Michael S. Tsirkin @ 2018-04-10 13:27 UTC (permalink / raw)
  To: Stefan Hajnoczi
  Cc: virtualization, syzkaller-bugs, Linus Torvalds, kvm, jasowang,
	linux-kernel, netdev
In-Reply-To: <20180410161905-mutt-send-email-mst@kernel.org>

On Tue, Apr 10, 2018 at 04:22:35PM +0300, Michael S. Tsirkin wrote:
> On Tue, Apr 10, 2018 at 01:26:29PM +0800, Stefan Hajnoczi wrote:
> > Commit d65026c6c62e7d9616c8ceb5a53b68bcdc050525 ("vhost: validate log
> > when IOTLB is enabled") introduced a regression.  The logic was
> > originally:
> > 
> >   if (vq->iotlb)
> >       return 1;
> >   return A && B;
> > 
> > After the patch the short-circuit logic for A was inverted:
> > 
> >   if (A || vq->iotlb)
> >       return A;
> >   return B;
> > 
> > This patch fixes the regression by rewriting the checks in the obvious
> > way, no longer returning A when vq->iotlb is non-NULL (which is hard to
> > understand).
> > 
> > Reported-by: syzbot+65a84dde0214b0387ccd@syzkaller.appspotmail.com
> > Cc: Jason Wang <jasowang@redhat.com>
> > Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> 
> This patch only makes sense after patch 2/2 is applied.
> Otherwise the logic seems reversed below.
> 
> Can you pls squash these two?

Oh, in fact the patch is ok. This just goes to show
that patch 2/2 is useful. But squashing is not required.
Sorry about the noise.

Acked-by: Michael S. Tsirkin <mst@redhat.com>
Fixes: d65026c6c ("vhost: validate log when IOTLB is enabled")

probably stable material since patch it fixes was queued to stable?


> > ---
> >  drivers/vhost/vhost.c | 8 +++++---
> >  1 file changed, 5 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
> > index 5320039671b7..93fd0c75b0d8 100644
> > --- a/drivers/vhost/vhost.c
> > +++ b/drivers/vhost/vhost.c
> > @@ -1244,10 +1244,12 @@ static int vq_log_access_ok(struct vhost_virtqueue *vq,
> >  /* Caller should have vq mutex and device mutex */
> >  int vhost_vq_access_ok(struct vhost_virtqueue *vq)
> >  {
> > -	int ret = vq_log_access_ok(vq, vq->log_base);
> > +	if (!vq_log_access_ok(vq, vq->log_base))
> > +		return 0;
> >  
> > -	if (ret || vq->iotlb)
> > -		return ret;
> > +	/* Access validation occurs at prefetch time with IOTLB */
> > +	if (vq->iotlb)
> > +		return 1;
> >  
> >  	return vq_access_ok(vq, vq->num, vq->desc, vq->avail, vq->used);
> >  }
> > -- 
> > 2.14.3

^ permalink raw reply

* Re: [PATCH v2 1/2] vhost: fix vhost_vq_access_ok() log check
From: Michael S. Tsirkin @ 2018-04-10 13:22 UTC (permalink / raw)
  To: Stefan Hajnoczi
  Cc: virtualization, syzkaller-bugs, Linus Torvalds, kvm, jasowang,
	linux-kernel, netdev
In-Reply-To: <20180410052630.11270-2-stefanha@redhat.com>

On Tue, Apr 10, 2018 at 01:26:29PM +0800, Stefan Hajnoczi wrote:
> Commit d65026c6c62e7d9616c8ceb5a53b68bcdc050525 ("vhost: validate log
> when IOTLB is enabled") introduced a regression.  The logic was
> originally:
> 
>   if (vq->iotlb)
>       return 1;
>   return A && B;
> 
> After the patch the short-circuit logic for A was inverted:
> 
>   if (A || vq->iotlb)
>       return A;
>   return B;
> 
> This patch fixes the regression by rewriting the checks in the obvious
> way, no longer returning A when vq->iotlb is non-NULL (which is hard to
> understand).
> 
> Reported-by: syzbot+65a84dde0214b0387ccd@syzkaller.appspotmail.com
> Cc: Jason Wang <jasowang@redhat.com>
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>

This patch only makes sense after patch 2/2 is applied.
Otherwise the logic seems reversed below.

Can you pls squash these two?

> ---
>  drivers/vhost/vhost.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
> index 5320039671b7..93fd0c75b0d8 100644
> --- a/drivers/vhost/vhost.c
> +++ b/drivers/vhost/vhost.c
> @@ -1244,10 +1244,12 @@ static int vq_log_access_ok(struct vhost_virtqueue *vq,
>  /* Caller should have vq mutex and device mutex */
>  int vhost_vq_access_ok(struct vhost_virtqueue *vq)
>  {
> -	int ret = vq_log_access_ok(vq, vq->log_base);
> +	if (!vq_log_access_ok(vq, vq->log_base))
> +		return 0;
>  
> -	if (ret || vq->iotlb)
> -		return ret;
> +	/* Access validation occurs at prefetch time with IOTLB */
> +	if (vq->iotlb)
> +		return 1;
>  
>  	return vq_access_ok(vq, vq->num, vq->desc, vq->avail, vq->used);
>  }
> -- 
> 2.14.3

^ permalink raw reply

* Re: [PATCH net] ip_gre: clear feature flags when incompatible o_flags are set
From: Xin Long @ 2018-04-10 13:10 UTC (permalink / raw)
  To: Sabrina Dubroca; +Cc: network dev, Lorenzo Bianconi, William Tu
In-Reply-To: <a989fb36846d45587455e648ed4e8ff8707bcee2.1523357388.git.sd@queasysnail.net>

On Tue, Apr 10, 2018 at 6:57 PM, Sabrina Dubroca <sd@queasysnail.net> wrote:
> Commit dd9d598c6657 ("ip_gre: add the support for i/o_flags update via
> netlink") added the ability to change o_flags, but missed that the
> GSO/LLTX features are disabled by default, and only enabled some gre
> features are unused. Thus we also need to disable the GSO/LLTX features
> on the device when the TUNNEL_SEQ or TUNNEL_CSUM flags are set.
>
> These two examples should result in the same features being set:
>
>     ip link add gre_none type gre local 192.168.0.10 remote 192.168.0.20 ttl 255 key 0
>
>     ip link set gre_none type gre seq
>     ip link add gre_seq type gre local 192.168.0.10 remote 192.168.0.20 ttl 255 key 1 seq
>
> Fixes: dd9d598c6657 ("ip_gre: add the support for i/o_flags update via netlink")
> Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
> ---
>  net/ipv4/ip_gre.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
> index a8772a978224..9c169bb2444d 100644
> --- a/net/ipv4/ip_gre.c
> +++ b/net/ipv4/ip_gre.c
> @@ -781,8 +781,14 @@ static void ipgre_link_update(struct net_device *dev, bool set_mtu)
>                     tunnel->encap.type == TUNNEL_ENCAP_NONE) {
>                         dev->features |= NETIF_F_GSO_SOFTWARE;
>                         dev->hw_features |= NETIF_F_GSO_SOFTWARE;
> +               } else {
> +                       dev->features &= ~NETIF_F_GSO_SOFTWARE;
> +                       dev->hw_features &= ~NETIF_F_GSO_SOFTWARE;
>                 }
>                 dev->features |= NETIF_F_LLTX;
> +       } else {
> +               dev->hw_features &= ~NETIF_F_GSO_SOFTWARE;
> +               dev->features &= ~(NETIF_F_LLTX | NETIF_F_GSO_SOFTWARE);
>         }
>  }
>
> --
> 2.16.2
>
Reviewed-by: Xin Long <lucien.xin@gmail.com>

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox