From patchwork Mon Sep 21 14:58:20 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 7231961 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id B3C209F30C for ; Mon, 21 Sep 2015 14:58:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7512D2073C for ; Mon, 21 Sep 2015 14:58:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 868742073A for ; Mon, 21 Sep 2015 14:58:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752372AbbIUO6m (ORCPT ); Mon, 21 Sep 2015 10:58:42 -0400 Received: from mail-wi0-f172.google.com ([209.85.212.172]:38333 "EHLO mail-wi0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752126AbbIUO6m (ORCPT ); Mon, 21 Sep 2015 10:58:42 -0400 Received: by wiclk2 with SMTP id lk2so115847185wic.1; Mon, 21 Sep 2015 07:58:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:mime-version:content-type :content-transfer-encoding; bh=xkX/jJC1kSxz3R2bseC0zMEbk+TDTxgkMiir8iArWeo=; b=sxr1qEfLqwdIbG/hT0+RLjfuTzErltH4lxoqqD3qQzSTjgak2NSt8xbKUaOvwsTXct llZNIAtibHHzxzhjs5Bu3XS6y3cykQNzL60RYO9/jTq17eDdKJfw9/0hIis3c0Ryl98r 2Nyo67iEJwMzmPxMu49iIzN26YFTS2anYNkpYX9mHlURYFI0y3+47lj1C9TjFma74eo2 DUWF2//QL9HBWjAR86N+qYv4lwz8YW1YEiT3Qm14FuBmHnQAD4h0DIs48KqeqnzACsMd ND/TNLmFHYb9v2VgzUTqamxp9eNiRyDeKq7wOfrxGFgcLBLWWm9Ijtt42pRswUaF0rTl YVwA== X-Received: by 10.180.101.198 with SMTP id fi6mr14852334wib.25.1442847520642; Mon, 21 Sep 2015 07:58:40 -0700 (PDT) Received: from atrey.karlin.mff.cuni.cz (atrey.karlin.mff.cuni.cz. [195.113.26.193]) by smtp.gmail.com with ESMTPSA id it4sm24525377wjb.0.2015.09.21.07.58.39 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Sep 2015 07:58:39 -0700 (PDT) From: =?UTF-8?q?Pali=20Roh=C3=A1r?= To: Sebastian Reichel , Dmitry Eremin-Solenikov , David Woodhouse Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Dan Carpenter , =?UTF-8?q?Pali=20Roh=C3=A1r?= Subject: [PATCH] bq2415x_charger: Fix null pointer dereference Date: Mon, 21 Sep 2015 16:58:20 +0200 Message-Id: <1442847500-22435-1-git-send-email-pali.rohar@gmail.com> X-Mailer: git-send-email 1.7.10.4 MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Commit b68c3161430a (bq2415x_charger: Allow to load and use driver even if notify device is not registered yet) introduced null pointer dereference in case bq is NULL. This patch fixes it. Signed-off-by: Pali Rohár Reported-by: Dan Carpenter --- drivers/power/bq2415x_charger.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/power/bq2415x_charger.c b/drivers/power/bq2415x_charger.c index ec212b5..4afd768 100644 --- a/drivers/power/bq2415x_charger.c +++ b/drivers/power/bq2415x_charger.c @@ -1704,7 +1704,7 @@ error_4: error_3: bq2415x_power_supply_exit(bq); error_2: - if (bq->notify_node) + if (bq && bq->notify_node) of_node_put(bq->notify_node); kfree(name); error_1: