Received: by 10.223.185.116 with SMTP id b49csp4205951wrg; Mon, 26 Feb 2018 13:09:50 -0800 (PST) X-Google-Smtp-Source: AG47ELt8HMZIE5SOsjJHfXYlzLHzPPMS8tLUjUXawNwp/TeTnUmOj4X3cp8d0s4Z8fGlC49niDVv X-Received: by 10.98.59.218 with SMTP id w87mr4945225pfj.37.1519679390053; Mon, 26 Feb 2018 13:09:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519679390; cv=none; d=google.com; s=arc-20160816; b=O154Uf69ql5lx5luJDt4HxQaZ+doxrRiI7rCZCqrmnsmagg4w+OdbeDY1sGgwNJsL+ OK6ke0lZ7u2lPZaukt9CXsLqr8FFMjYx6haGR1Lnsa+TtognVL8X/9MCR3ichL6qXs2K ymTflzzw89t/6y2SYRy7Q5Fef25mH9bl2/J/CqTtZ5qPdPgTAiUmjR30IO1y8Dfp0Dhb RO78DZ+w+NW1LwpSPlbJyvQDBVh2I5I6PHQ5E9k6ksgSFDKpdS0G0ZkZj28nKY8j79H2 W61XAl8GiNQKwv1guRvZ+bULdmFPbQw3tMxIGEboHDxVjVR/dwlF7pSyqYrgEojZyst1 kGvg== 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=blIoa2Zrvg1J5+zMFUNbNTGPhpovIONJxo/raiflKis=; b=n/AVtzd66dwaSZbXpN66swZT+GDMDoS3t6QERalgv8fLsWTt269isfBfbJXxxeI8z7 gOLAXYvodlRpcmLgkSji5RyQFLHEFbGXoI5kSTtp5eqq95yE1gypX5TIMsU945HPrR5b 2qMCKIAb8Uo6394SdWuNwgBUUtdCqj0xfn0HGxu9BpYQYObLi68yjdggYlXhF2EUJmVA vcn5NB+WN66/UHpbWoV/aXI2Vr+Ur7BGv1/A04hpQHbDEJ407+Ruku/kaiDwZBKWB5yM hhZZX8MOlMs3cc5fE21jMEdvf3mtUVt0gFmM4K8klRnOZHNR29zvWjUgJVGcsKQ4nEsW iR+A== 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 61-v6si7292987plz.417.2018.02.26.13.09.35; Mon, 26 Feb 2018 13:09:50 -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 S1752153AbeBZVHV (ORCPT + 99 others); Mon, 26 Feb 2018 16:07:21 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:58970 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751744AbeBZUQQ (ORCPT ); Mon, 26 Feb 2018 15:16:16 -0500 Received: from localhost (clnet-b04-243.ikbnet.co.at [83.175.124.243]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id F1DB210C5; Mon, 26 Feb 2018 20:16:15 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stefan Windfeldt-Prytz , Jonathan Cameron Subject: [PATCH 3.18 06/13] iio: buffer: check if a buffer has been set up when poll is called Date: Mon, 26 Feb 2018 21:15:34 +0100 Message-Id: <20180226201527.519431581@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180226201527.242286068@linuxfoundation.org> References: <20180226201527.242286068@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 3.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Stefan Windfeldt-Prytz commit 4cd140bda6494543f1c1b0ccceceaa44b676eef6 upstream. If no iio buffer has been set up and poll is called return 0. Without this check there will be a null pointer dereference when calling poll on a iio driver without an iio buffer. Cc: stable@vger.kernel.org Signed-off-by: Stefan Windfeldt-Prytz Signed-off-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- drivers/iio/industrialio-buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/iio/industrialio-buffer.c +++ b/drivers/iio/industrialio-buffer.c @@ -92,7 +92,7 @@ unsigned int iio_buffer_poll(struct file struct iio_dev *indio_dev = filp->private_data; struct iio_buffer *rb = indio_dev->buffer; - if (!indio_dev->info) + if (!indio_dev->info || rb == NULL) return 0; poll_wait(filp, &rb->pollq, wait);