From 382299a020add34cc75ac501bbcb655195c123b8 Mon Sep 17 00:00:00 2001 From: Eric Dumazet Date: Tue, 14 Feb 2017 09:03:51 -0800 Subject: [PATCH] packet: fix races in fanout_add() commit d199fab63c11998a602205f7ee7ff7c05c97164b upstream. Multiple threads can call fanout_add() at the same time. We need to grab fanout_mutex earlier to avoid races that could lead to one thread freeing po->rollover that was set by another thread. Do the same in fanout_release(), for peace of mind, and to help us finding lockdep issues earlier. Fixes: dc99f600698d ("packet: Add fanout support.") Fixes: 0648ab70afe6 ("packet: rollover prepare: per-socket state") Signed-off-by: Eric Dumazet Cc: Willem de Bruijn Signed-off-by: David S. Miller [bwh: Backported to 3.2: - No rollover queue stats - Adjust context] Signed-off-by: Ben Hutchings --- Reading git-format-patch failed