From patchwork Fri Jun 2 11:35:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Henri Roosen X-Patchwork-Id: 9762357 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 C3B3360360 for ; Fri, 2 Jun 2017 11:35:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BB83623794 for ; Fri, 2 Jun 2017 11:35:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B02DE28569; Fri, 2 Jun 2017 11:35:46 +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.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 19C3B23794 for ; Fri, 2 Jun 2017 11:35:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751150AbdFBLfp (ORCPT ); Fri, 2 Jun 2017 07:35:45 -0400 Received: from mail.ginzinger.com ([31.193.165.229]:36375 "EHLO mail.ginzinger.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751126AbdFBLfo (ORCPT ); Fri, 2 Jun 2017 07:35:44 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.ginzinger.com (Postfix) with ESMTP id 559D93BF7; Fri, 2 Jun 2017 13:35:39 +0200 (CEST) X-Virus-Scanned: by amavisd-new-2.10.1 (20141025) (Debian) at ginzinger.com Received: from mail.ginzinger.com ([127.0.0.1]) by localhost (mail.ginzinger.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id v2ufUfnO_Fu6; Fri, 2 Jun 2017 13:35:38 +0200 (CEST) Received: from mail.ginzinger.com (unknown [10.1.1.201]) by mail.ginzinger.com (Postfix) with ESMTPS id E9FD9434; Fri, 2 Jun 2017 13:35:37 +0200 (CEST) Received: from EN-PC16.buero.ginzinger.com (10.2.1.65) by exc2.buero.ginzinger.com (10.1.1.201) with Microsoft SMTP Server (TLS) id 14.3.339.0; Fri, 2 Jun 2017 13:35:39 +0200 From: Henri Roosen To: CC: Henri Roosen , Ohad Ben-Cohen , Bjorn Andersson , open list Subject: [PATCH] rpmsg: rpmsg_core: fix null-ptr dereference for devices without ops Date: Fri, 2 Jun 2017 13:35:21 +0200 Message-ID: <1496403321-32234-1-git-send-email-henri.roosen@ginzinger.com> X-Mailer: git-send-email 2.1.4 MIME-Version: 1.0 X-Originating-IP: [10.2.1.65] 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 A device might not have an ops structure registered. This patch fixes a null-prt dereference by checking ops before dereferencing it. Signed-off-by: Henri Roosen --- drivers/rpmsg/rpmsg_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/rpmsg/rpmsg_core.c b/drivers/rpmsg/rpmsg_core.c index 600f5f9..0c48452 100644 --- a/drivers/rpmsg/rpmsg_core.c +++ b/drivers/rpmsg/rpmsg_core.c @@ -429,7 +429,7 @@ static int rpmsg_dev_probe(struct device *dev) goto out; } - if (rpdev->ops->announce_create) + if (rpdev->ops && rpdev->ops->announce_create) err = rpdev->ops->announce_create(rpdev); out: return err;