Received: by 10.223.185.116 with SMTP id b49csp1079531wrg; Fri, 23 Feb 2018 11:32:51 -0800 (PST) X-Google-Smtp-Source: AH8x225pYmb9BWSXNNRZlCslQWu/lwUf5g/AOMJ2pS1X6vqgU/QoGEo1lP6GLK04j3uXZAGXW/yK X-Received: by 10.101.92.66 with SMTP id v2mr2219662pgr.341.1519414371319; Fri, 23 Feb 2018 11:32:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519414371; cv=none; d=google.com; s=arc-20160816; b=Qt9Lbr+N8RiSIuCHj8GIVWIA34JCgK458BuHE1hubkQmQYSEsRL125BtB2qwGWhIBR 3Ead/BtbNrRrzjR1jZvGW8Gii4kEKBESquwuPfXB+bwgW5vd2LBAltzjehC8OaKwFKiY qqvXCPNgVTJxDBJKlm2SXguuG7QNtLaY/6f3v82SYbXFXcJu4SXk5xt/g3TMa1Ksz7tI i3spCWpc3ml4yulUYc5ZXNqQ92WmbSZdvuKTglWhj8P404Ab+4KsErFPmQ7299rgplku QxiGDqKv0vWQwdHtPTauPj+mxpB0Q+kRhM5CeL73WwcqQa2Smj5mz8A2B7Beyzk6lpzo vvpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=lyypm2p/KVnq5JoQpfNBWNghNGz2CTDPrlj0xlXY8uo=; b=D6poO88P0vKUEw2IomxnkCO8aLi9sMU5k5CbRn3wlv7x2kmGbDB7FFqBqMp4QQnxsf mqXzjJBQ3E5LBwoZriBmtjngWbnpHBPel9b7+fnBcJFGEOZXxXuDQJhK7Ea3wbYftFt+ PmxNtcBImU8duYbo/A8LW3sm5W24/bzivlqIOtvyRgdY1ofqICG9tKXU/xr8th4vY8YM gQnJaSUAkthC4eLArztskkQEnR9H6zetyVVVkFXb6sDx288OUb37MycdylId7RYzfG9J yybkbb44JE680ieEDmXdNkYXA6jIqW37EBl+Dlh2pLT28JALrCkK8JGrLOobkp1iaBbP L78Q== ARC-Authentication-Results: i=1; mx.google.com; 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 m18si1866219pgn.769.2018.02.23.11.32.37; Fri, 23 Feb 2018 11:32:51 -0800 (PST) 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; 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 S1754756AbeBWTbv (ORCPT + 99 others); Fri, 23 Feb 2018 14:31:51 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:46024 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934954AbeBWSv0 (ORCPT ); Fri, 23 Feb 2018 13:51:26 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 33B2B1317; Fri, 23 Feb 2018 18:51:26 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+a2a3c4909716e271487e@syzkaller.appspotmail.com, Martijn Coenen Subject: [PATCH 4.14 051/159] ANDROID: binder: synchronize_rcu() when using POLLFREE. Date: Fri, 23 Feb 2018 19:25:59 +0100 Message-Id: <20180223170749.735086588@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180223170743.086611315@linuxfoundation.org> References: <20180223170743.086611315@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Martijn Coenen commit 5eeb2ca02a2f6084fc57ae5c244a38baab07033a upstream. To prevent races with ep_remove_waitqueue() removing the waitqueue at the same time. Reported-by: syzbot+a2a3c4909716e271487e@syzkaller.appspotmail.com Signed-off-by: Martijn Coenen Cc: stable # 4.14+ Signed-off-by: Greg Kroah-Hartman --- drivers/android/binder.c | 9 +++++++++ 1 file changed, 9 insertions(+) --- a/drivers/android/binder.c +++ b/drivers/android/binder.c @@ -4322,6 +4322,15 @@ static int binder_thread_release(struct binder_inner_proc_unlock(thread->proc); + /* + * This is needed to avoid races between wake_up_poll() above and + * and ep_remove_waitqueue() called for other reasons (eg the epoll file + * descriptor being closed); ep_remove_waitqueue() holds an RCU read + * lock, so we can be sure it's done after calling synchronize_rcu(). + */ + if (thread->looper & BINDER_LOOPER_STATE_POLL) + synchronize_rcu(); + if (send_reply) binder_send_failed_reply(send_reply, BR_DEAD_REPLY); binder_release_work(proc, &thread->todo);