Received: by 10.213.65.68 with SMTP id h4csp476619imn; Fri, 16 Mar 2018 08:56:34 -0700 (PDT) X-Google-Smtp-Source: AG47ELtUwoa8iixLJRV+f/P3xsRG5z/QiaPTue0UD4Vg9EqS8zh9qfdrhkmaGR1VfX0Jh+7/w4P7 X-Received: by 10.101.86.70 with SMTP id m6mr1871466pgs.349.1521215794841; Fri, 16 Mar 2018 08:56:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521215794; cv=none; d=google.com; s=arc-20160816; b=Hv8/ABER29JB+/NJ9EdqA/QfI/yQczCIJzr2YzrGz3KpFQLEdbQalVNVZiAHq5OQ/T 6zogBADF+0WA1qNCBRyi21e19wkVZUfCFjBmwzWhwMi7Joo4J/bRuRK9seztr7DuX8+8 LszoRO+y5CSUPPhR+oB2UlGo/2+GIusq+mzy0oWvOne/fie3Lu+DkX6nfm5EAJtW3NmJ 4CjISptXzKRQb0sp44HegL/WJ7RgvyXxPaCyYpWxNJR6x2IUMRqueR2z9Lh4zUJmqUcW PJADR7070EERsbnrmXASILHV1iWXb1q9uTOobIeHlczLo0u5pVsaQuaaaQ01m7MAOym/ B7sg== 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=TVBNM0vrtmFVfxhPFWpVvDClA598jN9Sxa7wymBXkRE=; b=NPC2J6prQkcgb+6Swt4jQNCyUEGqPJQXsUJFwc7HtxgeLiGvNuKlsKATjn0gr4EghC ymxXmTW8ToMXWREa0q5rDryETp0KQaj8YbGlLRlIO9fO4GwxIHJK0rlFpe6h92ilDwta 7bJGvq0v1sTSd874NiYP5qRCiWE2tI1b3LuOf3vKVA5Zt127+qKeKXbLcQny264zZdL4 8wVS8ztYEsAiOFzkp95vVweMwYUbKEGYOd9BhWEH70UotQwRkoZSJgdj+MAP00G2HWhx 2iUhs/SwnJ9O9j9o2AM7GIUt/OMry2Vl6pNPOy2ity+sbzjwTnBsn61WXPsiqO0cFTjT ymYw== 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 y9si5113303pgp.800.2018.03.16.08.56.20; Fri, 16 Mar 2018 08:56:34 -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 S964916AbeCPPxU (ORCPT + 99 others); Fri, 16 Mar 2018 11:53:20 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:45824 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965350AbeCPPoG (ORCPT ); Fri, 16 Mar 2018 11:44:06 -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 62060D13; Fri, 16 Mar 2018 15:44:05 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Gustavo A. R. Silva" , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 4.15 107/128] media: davinci: vpif_capture: add NULL check on devm_kzalloc return value Date: Fri, 16 Mar 2018 16:24:08 +0100 Message-Id: <20180316152341.874211000@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180316152336.199007505@linuxfoundation.org> References: <20180316152336.199007505@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.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: "Gustavo A. R. Silva" [ Upstream commit 5a18c2434f8bfc8bc2fb0f8af3e44f7408d63e4f ] Check return value from call to devm_kzalloc() in order to prevent a NULL pointer dereference. This issue was detected with the help of Coccinelle. Fixes: 4a5f8ae50b66 ("[media] davinci: vpif_capture: get subdevs from DT when available") Signed-off-by: Gustavo A. R. Silva Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/media/platform/davinci/vpif_capture.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/media/platform/davinci/vpif_capture.c +++ b/drivers/media/platform/davinci/vpif_capture.c @@ -1550,6 +1550,8 @@ vpif_capture_get_pdata(struct platform_d sizeof(*chan->inputs) * VPIF_CAPTURE_NUM_CHANNELS, GFP_KERNEL); + if (!chan->inputs) + return NULL; chan->input_count++; chan->inputs[i].input.type = V4L2_INPUT_TYPE_CAMERA;