Received: by 10.223.185.116 with SMTP id b49csp4092086wrg; Mon, 26 Feb 2018 10:59:12 -0800 (PST) X-Google-Smtp-Source: AH8x226rh2XU9Lq25rSRTodJ6nVNoMURFnx9AnHdpcrKDHburfbECAzyGuCemOaSAW4ekjr1EA4+ X-Received: by 10.98.163.67 with SMTP id s64mr11585505pfe.67.1519671552734; Mon, 26 Feb 2018 10:59:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519671552; cv=none; d=google.com; s=arc-20160816; b=ic05ARH0O09N/NfYJJtmAt3QGpSqoUbtltaUJC69cz97cMK6sLKHvWWh8kgHToG4sq Q3XVxCwXGrt6fhnwJZpEHMIvUDUaL3Ve6yXEUNJ1wlL+rMr7j/hB1zOOAYO+SAwR2qto GbMskh0m/DbFtjl6y3uURob5PslW5jgCIt2/zhZuSt4y8VQiU7WBJIdWwr9e70SuZqd8 y/2oVGnz22jJVfKM76om9VcWtm4DUEDrAq6bH8J9wSlJJKsKreurdDM/ni6lF2wA0FtP iooSktgwTmqWdbJDx7/oHJq4Q+iQ6TlX9CZ+7rlYU2AHDgpZuhbe1v4GQ7Pxa8orhxgV oDCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=CPBPbnzZFC/qUnfFAkbrGpkNmSfH8O05c1kla4C38yo=; b=lX/AVHLBBYM9ZyZ1sQaN6sDqf+Iren5XyJhPkPB9GU0w60+PEZXaJ3nbMLXs+o8uSt SJuU3G2z7Tqo67iPNTc83hurNB6hL7KUFZTdE7rpWJ/zoh9yYJ+PojXmVV1AUgrsCjQm BPUWwZmh9zoJaEStQsGDJ+lmUKPwlwFPGRR8t1EYr7cednzbBBlyC85FH3o30WMs2rWt HVYWoYXtwk6lsb93Ql9GHXlgF6KyUyQmSe5vosvjyGQzC/uIGasYpn6nUvrG5jQWw0jZ 2Ia4ywYuKWnTZ7gf1sJ0bSRw0JnLbZhKXHLgdWOF6QAGBE7kKhXRNYVXRbVc7wktkPyd 1MGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=snckNP1C; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v6si5837629pgq.146.2018.02.26.10.58.55; Mon, 26 Feb 2018 10:59:12 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=snckNP1C; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751732AbeBZS57 (ORCPT + 99 others); Mon, 26 Feb 2018 13:57:59 -0500 Received: from mail-io0-f196.google.com ([209.85.223.196]:33874 "EHLO mail-io0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751175AbeBZS55 (ORCPT ); Mon, 26 Feb 2018 13:57:57 -0500 Received: by mail-io0-f196.google.com with SMTP id e7so18387165ioj.1; Mon, 26 Feb 2018 10:57:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=CPBPbnzZFC/qUnfFAkbrGpkNmSfH8O05c1kla4C38yo=; b=snckNP1C/IeUbKemX6+rTQLqoCG/F+xHASS3HfYFeKoNTFKeND6pOPg42DKrLhex0O p9GjmBl1qV4PHLkUFPYtH4+pmFn9EweQhhNpQS+Zng+nsAcTYerHkDF0qD41uy5kp6Nk Qzxh0ze+hc6w4Xhson8qjRlL+ql0KGI64Lsob0h6Di3BYbRwfdcDmj4Fi6egc7ws1//0 saEtuUONVP8XYayKyiBVqOsSZgde2dDDHsIW4UevhyHgthvyUKJBhC5I0h2kETqQsF8x CMebkEk3D8+r7ijWaeWKwpS1vjUX1P0D5HpAxmkM6HQ6DQbOR8+9tNLUjyzu+Sg8CDE+ ii1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=CPBPbnzZFC/qUnfFAkbrGpkNmSfH8O05c1kla4C38yo=; b=eRn2lwMm+4X0JQfvMolviTRng2YJ8XF3mD6gmBWVfNZNgeETSEIgrIIWnziLFeOzYi 8z6VpeoreDb6hCPubQZW19eM5sfSMBR1UAWAcx533j5EZOIm3GF9mXanYKFHWdx5weVV 1AvnHAvUGjl6mlXIocvpThy6y1bpbfp7bPs3zF1FcYWHh6DyunwrmrTfybuOhdOVKjoL hGN5hVDFJz8T0mo70QVzQr/2T89N1PobBNUj8zjOagfk4Zy+WZyisL4Uyrz5QRJIphX3 Zzw0eEPLp1vG/Bpi0t/QgdZXvHeP20Kw2yIc5XEQMNGOceV2amw/gtTYktf4bcJLC7H1 RneA== X-Gm-Message-State: APf1xPAYcHd+XlKpI69HqFHaxlQwv9F0uHWeFrZs8nufNVRRjWYRkeIZ Exh6tU59LwxsjKWUQC958us= X-Received: by 10.107.174.14 with SMTP id x14mr13020203ioe.67.1519671476847; Mon, 26 Feb 2018 10:57:56 -0800 (PST) Received: from gmail.com ([2620:15c:17:3:dc28:5c82:b905:e8a8]) by smtp.gmail.com with ESMTPSA id h125sm5075026ioe.4.2018.02.26.10.57.55 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 26 Feb 2018 10:57:56 -0800 (PST) Date: Mon, 26 Feb 2018 10:57:54 -0800 From: Eric Biggers To: Guenter Roeck Cc: "gregkh@linuxfoundation.org" , linux-kernel@vger.kernel.org, stable@vger.kernel.org, syzbot , Eric Biggers Subject: Re: [4.4, 027/193] binder: check for binder_thread allocation failure in binder_poll() Message-ID: <20180226185754.GA177108@gmail.com> References: <20180223170330.322805082@linuxfoundation.org> <20180226172119.GA10044@roeck-us.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180226172119.GA10044@roeck-us.net> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Guenter, On Mon, Feb 26, 2018 at 09:21:19AM -0800, Guenter Roeck wrote: > On Fri, Feb 23, 2018 at 07:24:20PM +0100, gregkh@linuxfoundation.org wrote: > > 4.4-stable review patch. If anyone has any objections, please let me know. > > > > ------------------ > > > > From: Eric Biggers > > > > commit f88982679f54f75daa5b8eff3da72508f1e7422f upstream. > > > > If the kzalloc() in binder_get_thread() fails, binder_poll() > > dereferences the resulting NULL pointer. > > > > Fix it by returning POLLERR if the memory allocation failed. > > > > This bug was found by syzkaller using fault injection. > > > > Reported-by: syzbot > > Fixes: 457b9a6f09f0 ("Staging: android: add binder driver") > > Cc: stable@vger.kernel.org > > Signed-off-by: Eric Biggers > > Signed-off-by: Greg Kroah-Hartman > > --- > > drivers/android/binder.c | 2 ++ > > 1 file changed, 2 insertions(+) > > > > --- a/drivers/android/binder.c > > +++ b/drivers/android/binder.c > > @@ -2622,6 +2622,8 @@ static unsigned int binder_poll(struct f > > binder_lock(__func__); > > > > thread = binder_get_thread(proc); > > + if (!thread) > > + return POLLERR; > > > Noticed while merging into chromeos-4.4: > > This will cause trouble in v4.4.y. Notice the call to "binder_lock(__func__)" > above. This call has been removed upstream, but not in v4.4.y. As a result, > the lock won't be released, which will result in subsequent hangups > if/when the function is called again. > > v4.9.y has the same problem. v4.14.y+ are fine. > > Greg - can you fix this up yourself or do you want me to send fixup > patches ? It might take a few days for me to get to it. > > Guenter Thanks for spotting this! I'll send a patch to fix it. Eric