linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Revert "net: fix cpu_max_bits_warn() usage in netif_attrmask_next{,_and}"
@ 2022-10-17  3:09 Yury Norov
  2022-10-19 11:49 ` Michael S. Tsirkin
  2022-10-19 12:16 ` Christian Borntraeger
  0 siblings, 2 replies; 3+ messages in thread
From: Yury Norov @ 2022-10-17  3:09 UTC (permalink / raw)
  To: linux-kernel, netdev
  Cc: Yury Norov, Michael S. Tsirkin, Alexander Gordeev,
	Borislav Petkov, Eric Dumazet, Guo Ren, Jakub Kicinski,
	Kuniyuki Iwashima, Linus Torvalds, Menglong Dong, Paolo Abeni,
	Petr Machata, Sebastian Andrzej Siewior, andriy.shevchenko,
	caraitto, jonolson, willemb, David S .Miller, Andrew Jones,
	amritha.nambiar, linux

This reverts commit 854701ba4c39afae2362ba19a580c461cb183e4f.

The reverted commit makes netif_attr_test_online() network subsystems
generating warnings, and it breaks syzkaller testing.

https://syzkaller.appspot.com/bug?extid=9abe5ecc348676215427

Signed-off-by: Yury Norov <yury.norov@gmail.com>
---
 include/linux/netdevice.h | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index a36edb0ec199..eddf8ee270e7 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -3663,8 +3663,9 @@ static inline bool netif_attr_test_online(unsigned long j,
 static inline unsigned int netif_attrmask_next(int n, const unsigned long *srcp,
 					       unsigned int nr_bits)
 {
-	/* n is a prior cpu */
-	cpu_max_bits_warn(n + 1, nr_bits);
+	/* -1 is a legal arg here. */
+	if (n != -1)
+		cpu_max_bits_warn(n, nr_bits);
 
 	if (srcp)
 		return find_next_bit(srcp, nr_bits, n + 1);
@@ -3685,8 +3686,9 @@ static inline int netif_attrmask_next_and(int n, const unsigned long *src1p,
 					  const unsigned long *src2p,
 					  unsigned int nr_bits)
 {
-	/* n is a prior cpu */
-	cpu_max_bits_warn(n + 1, nr_bits);
+	/* -1 is a legal arg here. */
+	if (n != -1)
+		cpu_max_bits_warn(n, nr_bits);
 
 	if (src1p && src2p)
 		return find_next_and_bit(src1p, src2p, nr_bits, n + 1);
-- 
2.34.1


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

* Re: [PATCH] Revert "net: fix cpu_max_bits_warn() usage in netif_attrmask_next{,_and}"
  2022-10-17  3:09 [PATCH] Revert "net: fix cpu_max_bits_warn() usage in netif_attrmask_next{,_and}" Yury Norov
@ 2022-10-19 11:49 ` Michael S. Tsirkin
  2022-10-19 12:16 ` Christian Borntraeger
  1 sibling, 0 replies; 3+ messages in thread
From: Michael S. Tsirkin @ 2022-10-19 11:49 UTC (permalink / raw)
  To: Yury Norov
  Cc: linux-kernel, netdev, Alexander Gordeev, Borislav Petkov,
	Eric Dumazet, Guo Ren, Jakub Kicinski, Kuniyuki Iwashima,
	Linus Torvalds, Menglong Dong, Paolo Abeni, Petr Machata,
	Sebastian Andrzej Siewior, andriy.shevchenko, caraitto, jonolson,
	willemb, David S .Miller, Andrew Jones, amritha.nambiar, linux

On Sun, Oct 16, 2022 at 08:09:47PM -0700, Yury Norov wrote:
> This reverts commit 854701ba4c39afae2362ba19a580c461cb183e4f.
> 
> The reverted commit makes netif_attr_test_online() network subsystems
> generating warnings, and it breaks syzkaller testing.
> 
> https://syzkaller.appspot.com/bug?extid=9abe5ecc348676215427
> 
> Signed-off-by: Yury Norov <yury.norov@gmail.com>

Fixes: 854701ba4c39 ("net: fix cpu_max_bits_warn() usage in netif_attrmask_next{,_and}")
Acked-by: Michael S. Tsirkin <mst@redhat.com>

> ---
>  include/linux/netdevice.h | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
> index a36edb0ec199..eddf8ee270e7 100644
> --- a/include/linux/netdevice.h
> +++ b/include/linux/netdevice.h
> @@ -3663,8 +3663,9 @@ static inline bool netif_attr_test_online(unsigned long j,
>  static inline unsigned int netif_attrmask_next(int n, const unsigned long *srcp,
>  					       unsigned int nr_bits)
>  {
> -	/* n is a prior cpu */
> -	cpu_max_bits_warn(n + 1, nr_bits);
> +	/* -1 is a legal arg here. */
> +	if (n != -1)
> +		cpu_max_bits_warn(n, nr_bits);
>  
>  	if (srcp)
>  		return find_next_bit(srcp, nr_bits, n + 1);
> @@ -3685,8 +3686,9 @@ static inline int netif_attrmask_next_and(int n, const unsigned long *src1p,
>  					  const unsigned long *src2p,
>  					  unsigned int nr_bits)
>  {
> -	/* n is a prior cpu */
> -	cpu_max_bits_warn(n + 1, nr_bits);
> +	/* -1 is a legal arg here. */
> +	if (n != -1)
> +		cpu_max_bits_warn(n, nr_bits);
>  
>  	if (src1p && src2p)
>  		return find_next_and_bit(src1p, src2p, nr_bits, n + 1);
> -- 
> 2.34.1


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

* Re: [PATCH] Revert "net: fix cpu_max_bits_warn() usage in netif_attrmask_next{,_and}"
  2022-10-17  3:09 [PATCH] Revert "net: fix cpu_max_bits_warn() usage in netif_attrmask_next{,_and}" Yury Norov
  2022-10-19 11:49 ` Michael S. Tsirkin
@ 2022-10-19 12:16 ` Christian Borntraeger
  1 sibling, 0 replies; 3+ messages in thread
From: Christian Borntraeger @ 2022-10-19 12:16 UTC (permalink / raw)
  To: yury.norov
  Cc: agordeev, ajones, amritha.nambiar, andriy.shevchenko, bigeasy,
	bp, caraitto, davem, edumazet, guoren, imagedong, jonolson, kuba,
	kuniyu, linux-kernel, linux, mst, netdev, pabeni, petrm,
	torvalds, willemb, borntraeger

for virtio on s390x.

Tested-by: Christian Borntraeger <borntraeger@linux.ibm.com>

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

end of thread, other threads:[~2022-10-19 13:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-17  3:09 [PATCH] Revert "net: fix cpu_max_bits_warn() usage in netif_attrmask_next{,_and}" Yury Norov
2022-10-19 11:49 ` Michael S. Tsirkin
2022-10-19 12:16 ` Christian Borntraeger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).