Skip to content

patchew/[email protected]

We introduce the same handling for potential data races with the
'fully_established' flag in subflow as previously done for
msk->fully_established.

Additionally, we make a crucial change:  convert the subflow's
'fully_established' from 'bit_field' to 'bool' type. This is
necessary because methods for avoiding data races don't work well
with 'bit_field'. Specifically, the 'READ_ONCE' needs to know
the size of the variable being accessed, which is not supported in
'bit_field'. Also, 'test_bit' expect the address of 'bit_field'.
 This change was prompted by compilation errors we encountered,
as detailed below.

'''
READ_ONCE:

  477 |         (sizeof(t) == sizeof(char) || \
      |		       ^
		 			sizeof(t) == sizeof(short)|| \
././include/linux/compiler_types.h:490:23:
				note: in definition of macro ‘__compiletime_assert’
  490 |                 if (!(condition))\
      |                       ^~~~~~~~~
././include/linux/compiler_types.h:510:9:
				note: in expansion of macro ‘_compiletime_assert’
  510 |         _compiletime_assert(condition, msg, \
				__compiletime_assert_, __COUNTER__)
      |         ^~~~~~~~~~~~~~~~~~~
./include/asm-generic/rwonce.h:36:9:
				note: in expansion of macro ‘compiletime_assert’
   36 |         compiletime_assert(__native_word(t) ||  \
				    sizeof(t) == sizeof(long long),  \
      |         ^~~~~~~~~~~~~~~~~~
./include/asm-generic/rwonce.h:36:28:
				note: in expansion of macro ‘__native_word’
   36 |         compiletime_assert(__native_word(t) || \
      |				       ^~~~~~~~~~~~~
					 sizeof(t) == sizeof(long long),  \
./include/asm-generic/rwonce.h:49:9:
				note: in expansion of macro ‘compiletime_assert_rwonce_type’
   49 |         compiletime_assert_rwonce_type(x); \
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/mptcp/protocol.h:781:39:
				note: in expansion of macro ‘READ_ONCE’
  781 |         if (subflow->request_join && \
      |					   !READ_ONCE(subflow->fully_established))
      |                                       ^~~~~~~~~

test_bit:
 error: cannot take address of bit-field 'fully_established'
   50 |         if (test_bit(1, &sf->fully_established))
      |
'''
Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/516
Signed-off-by: YANGANG <[email protected]>
Message-Id: <[email protected]>
Assets 2
Loading