From patchwork Tue Apr 3 18:15:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sibi Sankar X-Patchwork-Id: 10321613 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id EDFC0602C8 for ; Tue, 3 Apr 2018 18:15:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DD20828C96 for ; Tue, 3 Apr 2018 18:15:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D0D7128C9A; Tue, 3 Apr 2018 18:15:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AE20328C96 for ; Tue, 3 Apr 2018 18:15:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752528AbeDCSP3 (ORCPT ); Tue, 3 Apr 2018 14:15:29 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:55986 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752515AbeDCSP2 (ORCPT ); Tue, 3 Apr 2018 14:15:28 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 5008C60591; Tue, 3 Apr 2018 18:15:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1522779328; bh=2dSTkmASoQvRHIP3+QlDizPpc4RbvipzgfUtcZj6hD4=; h=From:To:Cc:Subject:Date:From; b=B1rWXDToGsdV4GsrcuSuBncRSNaN1bCMQDeAFsFFKfkLYaNQUbcYNVoa1EloItylj MBLlNWIFZ0+tpMDOQiTmH4/ckzl8qW9i/TDI/94CbYZQ1Kr1Vyrvt8Eb8+Gkh79G3h Uu3hEngcam5G59V0YHdL9ObGEZnEzPYXVskmcvGs= Received: from blr-ubuntu-87.qualcomm.com (blr-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.18.19]) (using TLSv1.1 with cipher ECDHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: sibis@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 10E93600D0; Tue, 3 Apr 2018 18:15:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1522779327; bh=2dSTkmASoQvRHIP3+QlDizPpc4RbvipzgfUtcZj6hD4=; h=From:To:Cc:Subject:Date:From; b=XlS0RfYlgx0+BxO9gYj1xfZvYK23JhqJJwcrvQkA6zTp8I1IBBIcvaX/k0ih/xGni fl589yTHL0tYPqQS4xeHToGVLe9F80KnhWTgFef91KTprBBoNnPJoPh7z//o/8ssN/ llPztSA2v5GY/jDHLnldA+S7SZS4bBD8J4986C9A= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 10E93600D0 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=sibis@codeaurora.org From: Sibi Sankar To: bjorn.andersson@linaro.org Cc: linux-remoteproc@vger.kernel.org, ohad@wizery.com, linux-arm-msm@vger.kernel.org, Sibi Sankar Subject: [PATCH] remoteproc: fix null pointer dereference on glink only platforms Date: Tue, 3 Apr 2018 23:45:15 +0530 Message-Id: <20180403181515.12322-1-sibis@codeaurora.org> X-Mailer: git-send-email 2.16.2 Sender: linux-remoteproc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Currently calling list_del on smd subdev remove path results in null pointer dereference on glink only platforms. Fix this by adding safety checks in glink/smd subdev remove paths. Signed-off-by: Sibi Sankar --- drivers/remoteproc/qcom_common.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/remoteproc/qcom_common.c b/drivers/remoteproc/qcom_common.c index 00602499713f..a0cd6a50913f 100644 --- a/drivers/remoteproc/qcom_common.c +++ b/drivers/remoteproc/qcom_common.c @@ -74,6 +74,9 @@ EXPORT_SYMBOL_GPL(qcom_add_glink_subdev); */ void qcom_remove_glink_subdev(struct rproc *rproc, struct qcom_rproc_glink *glink) { + if (!glink->node) + return; + rproc_remove_subdev(rproc, &glink->subdev); of_node_put(glink->node); } @@ -121,6 +124,9 @@ EXPORT_SYMBOL_GPL(qcom_add_smd_subdev); */ void qcom_remove_smd_subdev(struct rproc *rproc, struct qcom_rproc_subdev *smd) { + if (!smd->node) + return; + rproc_remove_subdev(rproc, &smd->subdev); of_node_put(smd->node); }