Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2343838imm; Thu, 23 Aug 2018 19:57:49 -0700 (PDT) X-Google-Smtp-Source: AA+uWPymF8ijZydSlzTr+riMrR+dxRb33E9z8dNIGuggbEeJMk3U8IWlDLlGIiWxS9IdpI0E4ade X-Received: by 2002:a63:cc04:: with SMTP id x4-v6mr57217870pgf.33.1535079469659; Thu, 23 Aug 2018 19:57:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535079469; cv=none; d=google.com; s=arc-20160816; b=p1fZMOJRXmcYzS7JUK85Bj8GPWsCF8LeZf6DDltoHjPVJRB3KbPuhzaNN9n8D7F0pj IoFJ5I28wKFgsHFLhvH2bBxeE03WBNxFpTSQkSgWFeUOlsqmtn7ik2dhLerMfCi9lg45 CVaknPiJrZ3ZvvWQORXOwjMNkORCMjMsHX0qkRa7VIU3vSk7VYlmyOijp1I5tTjAwjwn UQylVdrGI8YLZiJ7hvG4LK7uO2Gzjua2WboVeOwPuEcVRvhz6FwZPxYskEPul6NligIk l07scL4czOMX4N5h9UOG2olDKguYy5KmVPv/uRGYKI0FlZ9Kqv7W1JVavG9SmyfiwACe wALg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:to:from :arc-authentication-results; bh=2ch2lD6Hnc1FmDXaZfp9UbeIFSOOUGj3AQN43whJOKI=; b=MHI8DPEnztthL9kC7ZQV4itogtx7zIwbPP/TREwtOJPpLSrk43dFB4nQttNdptTllp DVnUheo7mzxtDWlWOrRrVBMeUvjKuZBWFDraDWC4J/RuhtM9oW6W+BH4m+JDiQlZH32T /sAuRtCY0pMW7sxuPoNuVAwbCzxSt/LWzTbi4X8d2+CUf2gc+Z3MJi1VF/wuDozjfRtr iE5zRJlIiWXSulp5Bq9+EN47WPiEFPboKHFCd/a/sCGxT3i4vTChyWveMm0yXyN9Wcd3 XXJ9YsRaIJtFqu0sqp+X8eVu1GDk0meNL5pn8OjEvSzMjZ9i13INeNyWm0YbZw6yvvoI dfpA== 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 g185-v6si5432625pgc.151.2018.08.23.19.57.33; Thu, 23 Aug 2018 19:57:49 -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 S1727112AbeHXG23 (ORCPT + 99 others); Fri, 24 Aug 2018 02:28:29 -0400 Received: from cmccmta3.chinamobile.com ([221.176.66.81]:23243 "EHLO cmccmta3.chinamobile.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726338AbeHXG23 (ORCPT ); Fri, 24 Aug 2018 02:28:29 -0400 Received: from spf.mail.chinamobile.com (unknown[172.16.121.11]) by rmmx-syy-dmz-app10-12010 (RichMail) with SMTP id 2eea5b7f73b5f44-cecd9; Fri, 24 Aug 2018 10:55:50 +0800 (CST) X-RM-TRANSID: 2eea5b7f73b5f44-cecd9 X-RM-TagInfo: emlType=0 X-RM-SPAM-FLAG: 00000000 Received: from bclinux72.localdomain (unknown[223.105.0.243]) by rmsmtp-syy-appsvr06-12006 (RichMail) with SMTP id 2ee65b7f73b674f-29402; Fri, 24 Aug 2018 10:55:50 +0800 (CST) X-RM-TRANSID: 2ee65b7f73b674f-29402 From: Ding Xiang To: johan@kernel.org, elder@kernel.org, gregkh@linuxfoundation.org, greybus-dev@lists.linaro.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH] staging: greybus: Fix null pointer dereference Date: Fri, 24 Aug 2018 00:07:11 -0400 Message-Id: <1535083631-1892-1-git-send-email-dingxiang@cmss.chinamobile.com> X-Mailer: git-send-email 1.8.3.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If fw is null then fw->size will trigger null pointer dereference Signed-off-by: Ding Xiang --- drivers/staging/greybus/bootrom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/greybus/bootrom.c b/drivers/staging/greybus/bootrom.c index e85ffae..3af28a0 100644 --- a/drivers/staging/greybus/bootrom.c +++ b/drivers/staging/greybus/bootrom.c @@ -297,7 +297,7 @@ static int gb_bootrom_get_firmware(struct gb_operation *op) queue_work: /* Refresh timeout */ - if (!ret && (offset + size == fw->size)) + if (!ret && fw && (offset + size == fw->size)) next_request = NEXT_REQ_READY_TO_BOOT; else next_request = NEXT_REQ_GET_FIRMWARE; -- 1.8.3.1