Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp841839ybi; Fri, 12 Jul 2019 05:33:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqy88NN6uDT/l3I82yXAXWcOUZi9jVFhpHG898W59A8wzC3c4mGPKnEuRZiNsAhlxF7LpMUj X-Received: by 2002:a17:902:424:: with SMTP id 33mr11227647ple.151.1562934788831; Fri, 12 Jul 2019 05:33:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562934788; cv=none; d=google.com; s=arc-20160816; b=ZQmtoTCiIX+MShNJtoqXJZJRx8K/oZuXeL56qaCOv3EUyZaGC5hYIotMWfHGP1GTxu I0wP+y+bz94AUTvafji9ZfVUemCtZeRMip6MKfrQhN6bjymq/g3PTdmJN5YC1Z7/qSvd SPw/QnTYEU+U3BdfJqjUK43DPjglpMU4ECCYnrU2SNQoj72eDELory77no5/x/vbHgN+ 1IfdHAC8P/axuyIhfSTBv/AS7ScU5DmftCgHSasyoDc8AuCU4pzmhhhq5kUImtGLsQuT rA86n7vv+N7k5qFKTndahbQoT+0SneGVqra1BaynjsgwBmN22q1LWcX7893cZfj06Eht gkQg== 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=dBd8xzZXnoeouZw7CLwO6EzBIWbLEOJi+jzKFNRJRJU=; b=uSw7sGf8MdvhlE56f2+nnatug8/27mEQUKypzsgxldafIHnkhDmrJUqk/2pFbwnfb8 62A2d8mz8h+4hhVZAe2ryF2nZZvF2NOhhfr3DA/ujEIwHLdqrkn+J4VAz0tU8ZyeFlHz 79iWUjDkLDjb3eWstQhjgX9Jhm2I6LS1cYSbuELI0tTya3QamskWB0V0gT4ypePeBOV+ kRNNFUyGSh2U2mSXcLdylO1y+vYJkKlW82misApmsIUW3+onoenrBTINtncStS4yhjOl 07+/6sjITDn8kfwnaf6zg4SXPlPGVMO8jOzDxS8ZMnxaEJmPd0ZnJx6wp5ZjgHI65Gcm /FXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=U0CV5m7w; 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 d6si8364404pjc.7.2019.07.12.05.32.53; Fri, 12 Jul 2019 05:33:08 -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=U0CV5m7w; 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 S1729388AbfGLMb5 (ORCPT + 99 others); Fri, 12 Jul 2019 08:31:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:49146 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728873AbfGLMb4 (ORCPT ); Fri, 12 Jul 2019 08:31:56 -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 6B6EC21670; Fri, 12 Jul 2019 12:31:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1562934715; bh=t5280lZFvII97lEhHEy/0FVCtgfXs0UW8Pa4O96y/hI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U0CV5m7w3sRpG0hP3YvXa2HPpIhPmzrgxJ38nQKVS5o3YRMK0eG2eZDz2JZI8fJpG 2sFZ+9sUMfQ29xesV/S+0G1qFkftiKgpfsyeWbApOl6AzcINKhiNp5aeZkjWJ7+nk8 ZwlB1N7YQtELjNJWUvAminbBS3JeOTYA+qzStoaI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ian Abbott Subject: [PATCH 5.1 119/138] staging: comedi: dt282x: fix a null pointer deref on interrupt Date: Fri, 12 Jul 2019 14:19:43 +0200 Message-Id: <20190712121633.311126361@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190712121628.731888964@linuxfoundation.org> References: <20190712121628.731888964@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: Ian Abbott commit b8336be66dec06bef518030a0df9847122053ec5 upstream. The interrupt handler `dt282x_interrupt()` causes a null pointer dereference for those supported boards that have no analog output support. For these boards, `dev->write_subdev` will be `NULL` and therefore the `s_ao` subdevice pointer variable will be `NULL`. In that case, the following call near the end of the interrupt handler results in a null pointer dereference: comedi_handle_events(dev, s_ao); Fix it by only calling the above function if `s_ao` is valid. (There are other uses of `s_ao` by the interrupt handler that may or may not be reached depending on values of hardware registers. Trust that they are reliable for now.) Note: commit 4f6f009b204f ("staging: comedi: dt282x: use comedi_handle_events()") propagates an earlier error from commit f21c74fa4cfe ("staging: comedi: dt282x: use cfc_handle_events()"). Fixes: 4f6f009b204f ("staging: comedi: dt282x: use comedi_handle_events()") Cc: # v3.19+ Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/dt282x.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/staging/comedi/drivers/dt282x.c +++ b/drivers/staging/comedi/drivers/dt282x.c @@ -557,7 +557,8 @@ static irqreturn_t dt282x_interrupt(int } #endif comedi_handle_events(dev, s); - comedi_handle_events(dev, s_ao); + if (s_ao) + comedi_handle_events(dev, s_ao); return IRQ_RETVAL(handled); }