Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2360559ybi; Sun, 9 Jun 2019 09:50:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqzywYwnP3pF/YfP/6ZLruHV7AgaWmkhk/2U+KiUlrNGgw8bBL1yg5XJurss0eCD91vyJY70 X-Received: by 2002:a65:448a:: with SMTP id l10mr12056745pgq.53.1560099046230; Sun, 09 Jun 2019 09:50:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560099046; cv=none; d=google.com; s=arc-20160816; b=0uULjXv5m72QAeZJWo/GZgdf1Qs0zuxjHGGuvWePbBFtRDHAxPeKh14N4TNNJQtDy+ zEjfR5hEsDZABhqXERasgtuuuNML+oTQMfL4FobQeuNaNY1IzOdno7ll1ON0SLGRH6Tq 4BYyT/vg13YRkOhv6Q2GEQ/kSt/9cF+gnpGJw8tb9HBcGr/0rwhzSNyU5Hj01ivPLQ/i rKoOzWgThg0eFQBD29PDM1CH/Ve7icEvBd2+MhjXZDtd/LUUoAYnHHq9O2/eUBSReQIg m8lrt3yPTTaNWGkh1GbSYi1XWeeHcfcHijPAvHtcKcS33XtcPeSt5YhrGr9MGI5fgroX ILGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=qmS4NAOuH2fGaPDrN9QKkDeA8KViFqxSHuwsNZErUvg=; b=dZ+wxvg44D2Cq+QBnCT8Pa4ex3UFnbf/5tkSoXih17qqWORuG7+6RFzjl22xD4ltyc 8Ma8rwHwlZ+aA7XE7fOKPY5xYYwURrExvroqgkoIaC3LNfx0q65glNYb68GJVlqgl6+H sSrOUD3OvbXiU+gM4d6hj5ke0SkbL1xjZQG3ONN6dLoUrZ+dnPX5bNqZm/gSTPKlbZM1 Gtl5iXhP0BkU99Xq4gP9DqL7T/ERxuXvY6/VxzoX1t5RJ8Wtwm5K/tdhK4jCRxDw51aF OJHipzOYYs9jx1PnApD3zIqD3MP/8R/nj+lXU+Coyy6+MQnk1ikc7WA507yJnK09JYWy Owpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=m+iR1uO2; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x5si7298877pjv.62.2019.06.09.09.50.30; Sun, 09 Jun 2019 09:50:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=m+iR1uO2; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730096AbfFIQri (ORCPT + 99 others); Sun, 9 Jun 2019 12:47:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:46104 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730839AbfFIQr0 (ORCPT ); Sun, 9 Jun 2019 12:47:26 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 76C95205ED; Sun, 9 Jun 2019 16:47:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1560098845; bh=CTjBzB+KJIVMPus7iBajhkmtdUk36gXw7ErqSCDYUOs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m+iR1uO2yQm0uVQupat/I07OuGlrMxYDrBa8vcioljaVXQMkbaPDYj2MRn+LifvIA ucCLILMVwtzz/5RBbAEsR+fkIPqGeM6WRv6SbLC3XpAoJNF/zAnldqf+fVVTyq57L6 Ea8Y1yRG8Fa88RGf+M0VBAOwM1Yp82DsYe72IJjc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot , Willem de Bruijn , "David S. Miller" , Dmitry Vyukov Subject: [PATCH 4.19 12/51] packet: unconditionally free po->rollover Date: Sun, 9 Jun 2019 18:41:53 +0200 Message-Id: <20190609164127.826684331@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190609164127.123076536@linuxfoundation.org> References: <20190609164127.123076536@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Willem de Bruijn [ Upstream commit afa0925c6fcc6a8f610e996ca09bc3215048033c ] Rollover used to use a complex RCU mechanism for assignment, which had a race condition. The below patch fixed the bug and greatly simplified the logic. The feature depends on fanout, but the state is private to the socket. Fanout_release returns f only when the last member leaves and the fanout struct is to be freed. Destroy rollover unconditionally, regardless of fanout state. Fixes: 57f015f5eccf2 ("packet: fix crash in fanout_demux_rollover()") Reported-by: syzbot Diagnosed-by: Dmitry Vyukov Signed-off-by: Willem de Bruijn Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/packet/af_packet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c @@ -3017,8 +3017,8 @@ static int packet_release(struct socket synchronize_net(); + kfree(po->rollover); if (f) { - kfree(po->rollover); fanout_release_data(f); kfree(f); }