]> git.baikalelectronics.ru Git - kernel.git/commit
af_packet: TPACKET_V3: fix fill status rwlock imbalance
authorJohn Ogness <john.ogness@linutronix.de>
Thu, 13 Aug 2020 19:39:25 +0000 (21:45 +0206)
committerDavid S. Miller <davem@davemloft.net>
Thu, 13 Aug 2020 22:37:30 +0000 (15:37 -0700)
commit571da1aba7a8d3aa88adef21584f5c88967b9d81
treee6339cda0d54a9b74160ef8fab44a6b25f158b82
parentb2bfbdcf9da6e3694bbda1fa10fbe404af85e267
af_packet: TPACKET_V3: fix fill status rwlock imbalance

After @blk_fill_in_prog_lock is acquired there is an early out vnet
situation that can occur. In that case, the rwlock needs to be
released.

Also, since @blk_fill_in_prog_lock is only acquired when @tp_version
is exactly TPACKET_V3, only release it on that exact condition as
well.

And finally, add sparse annotation so that it is clearer that
prb_fill_curr_block() and prb_clear_blk_fill_status() are acquiring
and releasing @blk_fill_in_prog_lock, respectively. sparse is still
unable to understand the balance, but the warnings are now on a
higher level that make more sense.

Fixes: 39d698d2d507 ("af_packet: TPACKET_V3: replace busy-wait loop")
Signed-off-by: John Ogness <john.ogness@linutronix.de>
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/packet/af_packet.c