Received: by 10.223.185.116 with SMTP id b49csp4191358wrg; Mon, 26 Feb 2018 12:54:31 -0800 (PST) X-Google-Smtp-Source: AH8x2274HWj4qcsyMLayh4KNzsIQaVfmygZYQTpr3f0BOf5XfcL9QkHZeHt492C5aXZ73nVtCSNn X-Received: by 2002:a17:902:a9ca:: with SMTP id b10-v6mr12058918plr.223.1519678471779; Mon, 26 Feb 2018 12:54:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519678471; cv=none; d=google.com; s=arc-20160816; b=t5JemBtoWiFGKLmniAA7vriRWz5nQHmox4t4bmxfRTewchh2pGGQrcUsGWO9/S9jC7 A5wINyLty/GuOTqXCRH3nTK2zXM90447N3BZhCE2ycYmZ+VXcgPImg97Zf6aNHBh6nn7 21f76Jmvzuy1IKB1n5G7s9Pqb/B1+FD1u4NfleL3SHVCAXzRdx8tspFAb+/0jL4UmwU6 1R2IfK2x5j8BzMqwKu4PfOS/IQyEMQqibF0tk6bOFtjpLvipiTYRgrKgxhxQyYTeJKUY JAgf2WRidrR0JBV6YIuRGrhQf6VnxU6QOENE8LT7+Bx4rPlJ42nQPhvfZR6X7AftmSVH Fu+A== 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=AM0qu0UXdB6jLQ+Y+sCYWOo3uF7c2bpVT+g6+v+hddk=; b=aLUKe6s/NdjtWW5qQpo/Bz1ChlbIgL1/Ys+R43ZX/zZKsk8GxLZwag9sWI41hf9ABx W83dNUeBv8et6Wow0PLs1cxHo7GH/mUze4yxmujpct/bBadIPB10hEbfbyf90wKW8/Xj 3rSgCtNwUKfXlmGjy0SqwhaTnMvhDUlcRVN8z1P3abfrka3Tq8iCu36KLkb8Rbhkh84f QGrcELRQ+ZG4MIcyj1LtEVhHSsy7hmMxrvGDa+WcdsyUgjhdJQMQpt47tomNJdJ8V87P 1HQqVBeZkvJPE97ikXVObAUBchLsH6e9xEWaJ/33Gr5X+aK43pHKVt6gYo1hpPID2ABP vGrA== 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 t74si5937328pgc.649.2018.02.26.12.54.15; Mon, 26 Feb 2018 12:54:31 -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 S1752931AbeBZUwu (ORCPT + 99 others); Mon, 26 Feb 2018 15:52:50 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:34962 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752145AbeBZUYB (ORCPT ); Mon, 26 Feb 2018 15:24:01 -0500 Received: from localhost (clnet-b04-243.ikbnet.co.at [83.175.124.243]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 62388F8F; Mon, 26 Feb 2018 20:24:00 +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 4.14 23/54] iio: buffer: check if a buffer has been set up when poll is called Date: Mon, 26 Feb 2018 21:22:00 +0100 Message-Id: <20180226202145.551142113@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180226202144.375869933@linuxfoundation.org> References: <20180226202144.375869933@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: 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 @@ -175,7 +175,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);