Received: by 10.213.65.68 with SMTP id h4csp212496imn; Fri, 23 Mar 2018 03:01:57 -0700 (PDT) X-Google-Smtp-Source: AG47ELsM9RdNDVL1q2/xAmohZAHhjg8RCz4RBaw+Fd6UK6XO7o+lZs5Rk4461maysEBx/DNMVN32 X-Received: by 2002:a17:902:52c8:: with SMTP id a66-v6mr29418881pli.179.1521799317390; Fri, 23 Mar 2018 03:01:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521799317; cv=none; d=google.com; s=arc-20160816; b=Q29hyrAoOG1udMkiN2B3+6ZaB8Rjvnb7xxn5hV0trBUdCj4bZAOxHmaaDCNOBM3GEg qkga7DECOHTOKyGzKvvirLKXBr1T8+DcwAb+VZUEcFbKbIFMQEcdCHjDuCRijAoA6eAr V/9+iMCMre04LBK0KWeq2ysaWSLR0p4tB8OUDU0dxkjexCRtKk9m5BnxZsh+2r5ijex1 33IsvJeMyDRXvfD1H3Wown4DU87ES36oFjsczdFmnWSzB94XkQZv821J7amV2MDAVusO Dha/oYzIW3ZOx36wn19x7VV5PfW2ghfFBN3N31ueq7ZpV7OlD1GiLhbLq/iLdzHQjouw 99Qw== 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=PoWr50XT0csR7V86i0RWDq5kqweTeCD7UoeX8TEFMlk=; b=fy7jyHCQioxE+hKdGxpyhKayJ1BBlq/h6mrjsDe6sc6cZwbzZlCtPQLetVzT5224sv x47RSFhEx8PSsh6Liv1hsSnjfNnqUbbeYLP2tlQlXCrgElvCxEGC8gBvb9wEf+WZgCAK Pd+HQ/ueo99NYkOO2wlARzx0tooIY/Bf2txlk0C2tGVkYOacGmNQDCvaeBN/z4mqQsoF BeKqiDJWwpo/Q4AVwWMHSZE90u8y/j85MGg0nwya4Y6yuoRjjxttGqvh7dfzuiEk8bLP CH4JTkZG3nLxcFkSfVxuAt1Mjn31DAs2EoYzKFrUhokc3kUhd2sy4XAc2qNRvAiBB90N qrxA== 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 e10si5738039pgt.333.2018.03.23.03.01.42; Fri, 23 Mar 2018 03:01:57 -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; 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 S1753720AbeCWKAp (ORCPT + 99 others); Fri, 23 Mar 2018 06:00:45 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:36628 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753670AbeCWKAm (ORCPT ); Fri, 23 Mar 2018 06:00:42 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 11A5513FE; Fri, 23 Mar 2018 10:00:41 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Gustavo A. R. Silva" , Patrice Chotard , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 4.14 06/77] media: c8sectpfe: fix potential NULL pointer dereference in c8sectpfe_timer_interrupt Date: Fri, 23 Mar 2018 10:53:40 +0100 Message-Id: <20180323094142.612858478@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180323094142.260022880@linuxfoundation.org> References: <20180323094142.260022880@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: "Gustavo A. R. Silva" [ Upstream commit baed3c4bc4c13de93e0dba0a26d601411ebcb389 ] _channel_ is being dereferenced before it is null checked, hence there is a potential null pointer dereference. Fix this by moving the pointer dereference after _channel_ has been null checked. This issue was detected with the help of Coccinelle. Fixes: c5f5d0f99794 ("[media] c8sectpfe: STiH407/10 Linux DVB demux support") Signed-off-by: Gustavo A. R. Silva Acked-by: Patrice Chotard Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c +++ b/drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c @@ -83,7 +83,7 @@ static void c8sectpfe_timer_interrupt(un static void channel_swdemux_tsklet(unsigned long data) { struct channel_info *channel = (struct channel_info *)data; - struct c8sectpfei *fei = channel->fei; + struct c8sectpfei *fei; unsigned long wp, rp; int pos, num_packets, n, size; u8 *buf; @@ -91,6 +91,8 @@ static void channel_swdemux_tsklet(unsig if (unlikely(!channel || !channel->irec)) return; + fei = channel->fei; + wp = readl(channel->irec + DMA_PRDS_BUSWP_TP(0)); rp = readl(channel->irec + DMA_PRDS_BUSRP_TP(0));