Received: by 10.213.65.68 with SMTP id h4csp224536imn; Fri, 23 Mar 2018 03:17:43 -0700 (PDT) X-Google-Smtp-Source: AG47ELti1O+4ZHIoBxI9fyE8uzoQCU7wMgnRdVZF4v3IoU5j6svW1JYc89ymP3H7SGla84pIaGYl X-Received: by 10.101.67.13 with SMTP id j13mr5475331pgq.432.1521800263321; Fri, 23 Mar 2018 03:17:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521800263; cv=none; d=google.com; s=arc-20160816; b=GJOnUfEu8x2scOdeoFvn9fYrwAO8iy9CBjKeMDCuJONoMHexyXCsdzHh13OjejeOwY 8E0TNf4RIpqJ8tT0ZP6hLx/IEsZ6/mAkjcpCx0c/y57th7FtReJij+zu/NbpeW+aXwnh J3uiqgAQeYtNC68YWWI7esibYSlpFN+A0YncQcraZd7j/ASPHZzrHAh9nIy0Y2o+3vCt m4n2I57XTrW2Zibvtyfq9PFw/qlR2fKaCXryJQjgzdiYUckMwvp3iiMMUyBoFBt2ez0k zmyVg0oIZXG46tvz4ORndMy0sh/Aj8wePRBOCjMh9C3Qhdb8YTYKP9fYoADogNXaCkll 8/Sg== 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=K9sY9KK9GqM2TRt+8gJlb05elZ14Re7mHWXL0zQO1gk=; b=rmIdoow4d+nfOrIfLngNnWNqb2R0MNG3OyfOHMK2KK4kdxRnrDvfKpd9Uep7urubTi r9OanMV3jjNEwyCLH9vDDcsoeQwnahhV5QH8Q6/oMo+oexp5kUlxk1z/SEGe3njMjMIu jEtV0z0WS3HAVScW9HafxvAbVj3C6Ov74O6Cc7AA8RODApXg5NHR9Evwl3GGKFQYkUNt EM0qXBFhZQqlZvu1yzjwM5vHsjb2IgTt9somLJIkoEC/8X/iS5edYCpqlMdK0Zl9MrRn uYB2Ld00cApftimxBy1zcG/K3qNg8XHfQiy3YWfeT93eYXMznOAvU67CVLrEdGt92KIk uZDw== 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 m133si5934923pga.483.2018.03.23.03.17.28; Fri, 23 Mar 2018 03:17:43 -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 S933614AbeCWKQQ (ORCPT + 99 others); Fri, 23 Mar 2018 06:16:16 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:46630 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933234AbeCWKQM (ORCPT ); Fri, 23 Mar 2018 06:16:12 -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 C1933C7B; Fri, 23 Mar 2018 10:16:11 +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.4 74/97] media: c8sectpfe: fix potential NULL pointer dereference in c8sectpfe_timer_interrupt Date: Fri, 23 Mar 2018 10:55:01 +0100 Message-Id: <20180323094201.738568591@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180323094157.535925724@linuxfoundation.org> References: <20180323094157.535925724@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.4-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));