From patchwork Thu Feb 18 03:20:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Marek X-Patchwork-Id: 384461 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNWANTED_LANGUAGE_BODY, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A308EC433E9 for ; Thu, 18 Feb 2021 03:23:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7481264E45 for ; Thu, 18 Feb 2021 03:23:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230087AbhBRDWz (ORCPT ); Wed, 17 Feb 2021 22:22:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229885AbhBRDWt (ORCPT ); Wed, 17 Feb 2021 22:22:49 -0500 Received: from mail-qk1-x735.google.com (mail-qk1-x735.google.com [IPv6:2607:f8b0:4864:20::735]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B269C06178C for ; Wed, 17 Feb 2021 19:21:56 -0800 (PST) Received: by mail-qk1-x735.google.com with SMTP id f17so902726qkl.5 for ; Wed, 17 Feb 2021 19:21:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marek-ca.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=CB9XXZYfCi92ZZqhIlrCBfKt5Eaz4xz7mSDsgtik5fw=; b=wl5Zo2Z1d3OkD2LnENDJgjZdiSWnw1Iz/Kv2CM1ReP7bjhwUINKTjRQwwXQPrusDIJ zuxizfG4SSYlDJQ31m/GRZRJKPRISiyrkxpcSW93kx7SuXbKaOGOxIcKx2Aj9Z8pRKA2 /GMWSe7GYo09avXQZKThhcMyRSFHYzLZeStbP7luO0NxPUMsfDK/MLe7TkplCDRqM8GX d2KGWyULWVsgDbDd6leaubhx5cZhNvpNsOenox5jRDuiF7nn7BdvWEctnvhINUT/YhPu hhm//p09JNh9iI+up8x1qZrcr/0BZTWmofEuYPpLQBLL38EluyrGWebFD+6I7sZD5LLV 81/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CB9XXZYfCi92ZZqhIlrCBfKt5Eaz4xz7mSDsgtik5fw=; b=DPO8zpkTAu2eOtOPetRr9kKzAKqNOm7xxREXF4AA8K1iR3E+VYYV67iyA4J0JN9z/1 cNzzxuTv0yk0OD5EgLaOB89yfEbW/LOZyly8fLD8TiweSt+j1+nqEwOYqGg9mf6swFaK P9le/Yf6LwJKDigaDZ/B5kNxR5FceSFA18Ru82tXxGqmCZGhXTDQCW0ECQUkr2T3SSmQ bvwuP6md11l++/901col6GWZKj7I25T+hZg/n1JsqzRMRxel+EHihD9RYUzSQ29kCYL2 z6EspMNr5/YB8ZaTIjqlMorfDBPOwhMADJveZ0ZVfrU9jaIXaAax5vJnWfVQGGPgcozP M/+Q== X-Gm-Message-State: AOAM531acOfpBByLXcPpNSlCTY6vHXacE6+n/YrO2enaSfRsG6ShmKKQ l5jhq1ME5V8kwGBvhieXB+ykLGfR8J0SC06w X-Google-Smtp-Source: ABdhPJx0LPGJmVHgO0DEiZ5v+XPXXIsMGh5EN6oDPK4U/NqcLiiq1wtHxay96Bxkz+EMcZoTqF91Lg== X-Received: by 2002:a37:a004:: with SMTP id j4mr2460502qke.450.1613618515303; Wed, 17 Feb 2021 19:21:55 -0800 (PST) Received: from localhost.localdomain (modemcable068.184-131-66.mc.videotron.ca. [66.131.184.68]) by smtp.gmail.com with ESMTPSA id b24sm2578996qtt.44.2021.02.17.19.21.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Feb 2021 19:21:54 -0800 (PST) From: Jonathan Marek To: linux-arm-msm@vger.kernel.org Cc: srinivas.kandagatla@linaro.org, Arnd Bergmann , Greg Kroah-Hartman , linux-kernel@vger.kernel.org (open list) Subject: [PATCH 1/3] fastrpc: always use fl->lock and remove fl->mutex Date: Wed, 17 Feb 2021 22:20:53 -0500 Message-Id: <20210218032055.28247-2-jonathan@marek.ca> X-Mailer: git-send-email 2.26.1 In-Reply-To: <20210218032055.28247-1-jonathan@marek.ca> References: <20210218032055.28247-1-jonathan@marek.ca> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Fix the broken behavior of having a separate mutex for locking at this place, and use the same spinlock that is used to add/remove from the list. Signed-off-by: Jonathan Marek --- drivers/misc/fastrpc.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c index f12e909034ac..4fabea0c1551 100644 --- a/drivers/misc/fastrpc.c +++ b/drivers/misc/fastrpc.c @@ -230,8 +230,6 @@ struct fastrpc_user { int pd; /* Lock for lists */ spinlock_t lock; - /* lock for allocations */ - struct mutex mutex; }; static void fastrpc_free_map(struct kref *ref) @@ -267,16 +265,16 @@ static int fastrpc_map_find(struct fastrpc_user *fl, int fd, { struct fastrpc_map *map = NULL; - mutex_lock(&fl->mutex); + spin_lock(&fl->lock); list_for_each_entry(map, &fl->maps, node) { if (map->fd == fd) { fastrpc_map_get(map); *ppmap = map; - mutex_unlock(&fl->mutex); + spin_unlock(&fl->lock); return 0; } } - mutex_unlock(&fl->mutex); + spin_unlock(&fl->lock); return -ENOENT; } @@ -1200,7 +1198,6 @@ static int fastrpc_device_release(struct inode *inode, struct file *file) fastrpc_session_free(cctx, fl->sctx); fastrpc_channel_ctx_put(cctx); - mutex_destroy(&fl->mutex); kfree(fl); file->private_data = NULL; @@ -1222,7 +1219,6 @@ static int fastrpc_device_open(struct inode *inode, struct file *filp) filp->private_data = fl; spin_lock_init(&fl->lock); - mutex_init(&fl->mutex); INIT_LIST_HEAD(&fl->pending); INIT_LIST_HEAD(&fl->maps); INIT_LIST_HEAD(&fl->mmaps); @@ -1233,7 +1229,6 @@ static int fastrpc_device_open(struct inode *inode, struct file *filp) fl->sctx = fastrpc_session_alloc(cctx); if (!fl->sctx) { dev_err(&cctx->rpdev->dev, "No session available\n"); - mutex_destroy(&fl->mutex); kfree(fl); return -EBUSY; From patchwork Thu Feb 18 03:20:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Marek X-Patchwork-Id: 384974 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNWANTED_LANGUAGE_BODY, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B4182C4332B for ; Thu, 18 Feb 2021 03:23:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 906AE64E58 for ; Thu, 18 Feb 2021 03:23:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230138AbhBRDW5 (ORCPT ); Wed, 17 Feb 2021 22:22:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230121AbhBRDWz (ORCPT ); Wed, 17 Feb 2021 22:22:55 -0500 Received: from mail-qk1-x72c.google.com (mail-qk1-x72c.google.com [IPv6:2607:f8b0:4864:20::72c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C4F1C061794 for ; Wed, 17 Feb 2021 19:21:57 -0800 (PST) Received: by mail-qk1-x72c.google.com with SMTP id t63so924720qkc.1 for ; Wed, 17 Feb 2021 19:21:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marek-ca.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=CbzAry+HXVVk5Jw3yl75zypO/Gw5eoDiCnFu+DpRBBk=; b=yF7SUFMop4IDVBG98n7+ZbBZHJheC/4KAcnWw/1ax2MwIwqSBdy7MP6qvpRcdh3uRt ZPFgnOgEr7a+fQAziXK0cxLsCBGPtulyeklqoz75kUCYt/tIcfIdmQ8dJ/+4uR1s28au +pJDJyqMi9XBpsm//9zVO+Fi3fBXjiyE7K/TCzR92js9LsPn5stQm4z0M4UVnmvlmQ49 //HJrasc+i2VF9uvs6lrkrBhJYIeG4bFyaKlqZ246vBPjIs1DeYgdFo47nlro6SHYomc VGdFuv9HLh61j8F8mWdAUucx4/ld/p6jPjsKerlTgPJgx3EkXgLVdIkx9BZ55ULtPgeZ GhNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CbzAry+HXVVk5Jw3yl75zypO/Gw5eoDiCnFu+DpRBBk=; b=myoY4oLhdJy3cx2uurx4kTcPuYiVYuGUiqfsXWkhQRJexUGAhA31OTIQ8N3UcE/Qgi sYPS3XU1cgkmVelHOT1BCUVKZWruyoJMbtB0Cpt4bp+vE08itMD2LY9pk7N0h7d09SHj 44WaOshjXyqYPNJ01gIMMqHnw+lWw6ksl7O27fI9Nk70zY3yZ4Je+fjixz892N8JLVee 4l/QQtWlHUPvF8Ov8nyyYeVrN+WfKQocvRM2j3P8KxK8/a6xRzzQ6WUcSCv3/D9h9mz/ 9gpetSjXMHMmcXBEAp2JEGeQNWWVEELoeelTnJq1XezDUkunUo18VnWsjUZeC2dJJ9+t 6q8Q== X-Gm-Message-State: AOAM531Fmbce7hMELl7WdUeM5G3JdPTpZ3d71QON93C2uFCr7v/Ed36R JM37DVtTeLHqFJsUZQLy+CPCf8zZiXX7Tv4A X-Google-Smtp-Source: ABdhPJxRK1DQ7tsuLb3QYOvAaidyikcDIbIYXr2LzwaZh7+HJwOPO7u59wly1cuPy9ZZohx1e6M++Q== X-Received: by 2002:a37:6ca:: with SMTP id 193mr2428821qkg.436.1613618516468; Wed, 17 Feb 2021 19:21:56 -0800 (PST) Received: from localhost.localdomain (modemcable068.184-131-66.mc.videotron.ca. [66.131.184.68]) by smtp.gmail.com with ESMTPSA id b24sm2578996qtt.44.2021.02.17.19.21.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Feb 2021 19:21:56 -0800 (PST) From: Jonathan Marek To: linux-arm-msm@vger.kernel.org Cc: srinivas.kandagatla@linaro.org, Arnd Bergmann , Greg Kroah-Hartman , linux-kernel@vger.kernel.org (open list) Subject: [PATCH 2/3] fastrpc: move fl->maps list removal into fastrpc_free_map Date: Wed, 17 Feb 2021 22:20:54 -0500 Message-Id: <20210218032055.28247-3-jonathan@marek.ca> X-Mailer: git-send-email 2.26.1 In-Reply-To: <20210218032055.28247-1-jonathan@marek.ca> References: <20210218032055.28247-1-jonathan@marek.ca> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org This fixes the incredibly broken behavior of fastrpc_context_free(), which calls fastrpc_map_put() but does not remove the map from the list when it is free'd, causing use-after-free errors. fl->lock needs to be held not just for list_del(), but also kref_put, to avoid a race condition with fastrpc_map_find() logic. Signed-off-by: Jonathan Marek --- drivers/misc/fastrpc.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c index 4fabea0c1551..170352b43ab6 100644 --- a/drivers/misc/fastrpc.c +++ b/drivers/misc/fastrpc.c @@ -245,19 +245,21 @@ static void fastrpc_free_map(struct kref *ref) dma_buf_put(map->buf); } + list_del(&map->node); + kfree(map); } static void fastrpc_map_put(struct fastrpc_map *map) { - if (map) - kref_put(&map->refcount, fastrpc_free_map); + spin_lock(&map->fl->lock); + kref_put(&map->refcount, fastrpc_free_map); + spin_unlock(&map->fl->lock); } static void fastrpc_map_get(struct fastrpc_map *map) { - if (map) - kref_get(&map->refcount); + kref_get(&map->refcount); } static int fastrpc_map_find(struct fastrpc_user *fl, int fd, @@ -351,8 +353,10 @@ static void fastrpc_context_free(struct kref *ref) ctx = container_of(ref, struct fastrpc_invoke_ctx, refcount); cctx = ctx->cctx; - for (i = 0; i < ctx->nscalars; i++) - fastrpc_map_put(ctx->maps[i]); + for (i = 0; i < ctx->nscalars; i++) { + if (ctx->maps[i]) + fastrpc_map_put(ctx->maps[i]); + } if (ctx->buf) fastrpc_buf_free(ctx->buf); @@ -1103,12 +1107,8 @@ static int fastrpc_init_create_process(struct fastrpc_user *fl, fl->init_mem = NULL; fastrpc_buf_free(imem); err_alloc: - if (map) { - spin_lock(&fl->lock); - list_del(&map->node); - spin_unlock(&fl->lock); + if (map) fastrpc_map_put(map); - } err: kfree(args); @@ -1185,10 +1185,9 @@ static int fastrpc_device_release(struct inode *inode, struct file *file) fastrpc_context_put(ctx); } - list_for_each_entry_safe(map, m, &fl->maps, node) { - list_del(&map->node); + list_for_each_entry_safe(map, m, &fl->maps, node) fastrpc_map_put(map); - } + WARN_ON(!list_empty(&fl->maps)); list_for_each_entry_safe(buf, b, &fl->mmaps, node) { list_del(&buf->node); From patchwork Thu Feb 18 03:20:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Marek X-Patchwork-Id: 384973 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B17ADC43381 for ; Thu, 18 Feb 2021 03:23:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 77A1D6146D for ; Thu, 18 Feb 2021 03:23:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230139AbhBRDW6 (ORCPT ); Wed, 17 Feb 2021 22:22:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230122AbhBRDWz (ORCPT ); Wed, 17 Feb 2021 22:22:55 -0500 Received: from mail-qk1-x730.google.com (mail-qk1-x730.google.com [IPv6:2607:f8b0:4864:20::730]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1B01C0617A9 for ; Wed, 17 Feb 2021 19:21:58 -0800 (PST) Received: by mail-qk1-x730.google.com with SMTP id t63so924752qkc.1 for ; Wed, 17 Feb 2021 19:21:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marek-ca.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jSI1YK22wVuR2cagA4S8zvgCNzwItAWuuGlBLvaCabA=; b=Ee9uWcHbYZ/XoNjoLghk5DqzMTTsO5R0FEyXVspDfgWglsCCSU0wNy2jPM2MRZI5YN Z8h3Nw4cjXeuikgrXXwv21Lhhy7kkvW7GcdV1skq4J2Bc8JEAJkTlBtbO2cub/hLsne7 A3dlQxGCDeyo/35848lBA+kmUkfVDU1+eCvs0yWx4PWS7k+qX16ywZzPv4Jqq9SQN3RA Ya40EAT+kq1c6Vxnawy6EbGCcUamjzxQSSZ5tfPXq0RuboF1gnwMAwm6eyBiyC79gY0w sRgqUuKN2pkbDhyFE+IMsYfVlzphLRd633mGj8btBgHyIaiGwR/mJFXjOOLZ8dTjmud9 9tQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jSI1YK22wVuR2cagA4S8zvgCNzwItAWuuGlBLvaCabA=; b=XNTX2P5Z5d3A+nZlQuVVejYiJdkoSA3Xetf26umZsOR/csxCRpFyjn3WWSEkn2urT+ RqARIdaY1JDjN+wKKvRHBB1J6QnQx5dT2rMM3lALoaPnRH2nRdP9DrWSsqoncMMmSYl4 dA7VLYtegCngNzsRVl5240GvZTxtJ6jSm2/ctHauR2/R8zwBhkZgcIYiueGJPWbTozHr IOG02BEaMoy+auru+BDKtF3pMZb+t1R6bYXjd7IlNeW/KStf1C8jw0IJHIzm6hca5P1a sL2SdDsGNeeiWZFv8hucULbQ3dFV42/t9IhyZi5mEzdSbapvy1De8q7QMoHms+YPaQxT FKVQ== X-Gm-Message-State: AOAM533wSlH2gsGKGbIvZhuwBpLOkcvlRojWe0DV+nlyFh82RUGqKyL2 2ZYm3fRCuA5sBBONsIUkOzRZDad6FmVQkeRA X-Google-Smtp-Source: ABdhPJypn+BPGnzJlyewntbL8yFgi8ngaSIdwBUoRtPVyVgyvud/hvwvhvE7UQ6AltJeZtsspUXdHQ== X-Received: by 2002:a37:63c7:: with SMTP id x190mr2439873qkb.189.1613618517770; Wed, 17 Feb 2021 19:21:57 -0800 (PST) Received: from localhost.localdomain (modemcable068.184-131-66.mc.videotron.ca. [66.131.184.68]) by smtp.gmail.com with ESMTPSA id b24sm2578996qtt.44.2021.02.17.19.21.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Feb 2021 19:21:57 -0800 (PST) From: Jonathan Marek To: linux-arm-msm@vger.kernel.org Cc: srinivas.kandagatla@linaro.org, Arnd Bergmann , Greg Kroah-Hartman , linux-kernel@vger.kernel.org (open list) Subject: [PATCH 3/3] fastrpc: remove redundant fastrpc_map_create() call Date: Wed, 17 Feb 2021 22:20:55 -0500 Message-Id: <20210218032055.28247-4-jonathan@marek.ca> X-Mailer: git-send-email 2.26.1 In-Reply-To: <20210218032055.28247-1-jonathan@marek.ca> References: <20210218032055.28247-1-jonathan@marek.ca> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org fastrpc_internal_invoke() will call fastrpc_map_create, so there is no point in having it called here. This does change the behavior somewhat as fastrpc_internal_invoke() will release the map afterwards, but that's what we want to happen in this case. Signed-off-by: Jonathan Marek --- drivers/misc/fastrpc.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c index 170352b43ab6..ccad9f5f5e2f 100644 --- a/drivers/misc/fastrpc.c +++ b/drivers/misc/fastrpc.c @@ -1013,7 +1013,6 @@ static int fastrpc_init_create_process(struct fastrpc_user *fl, struct fastrpc_init_create init; struct fastrpc_invoke_args *args; struct fastrpc_phy_page pages[1]; - struct fastrpc_map *map = NULL; struct fastrpc_buf *imem = NULL; int memlen; int err; @@ -1049,18 +1048,12 @@ static int fastrpc_init_create_process(struct fastrpc_user *fl, inbuf.siglen = init.siglen; fl->pd = USER_PD; - if (init.filelen && init.filefd) { - err = fastrpc_map_create(fl, init.filefd, init.filelen, &map); - if (err) - goto err; - } - memlen = ALIGN(max(INIT_FILELEN_MAX, (int)init.filelen * 4), 1024 * 1024); err = fastrpc_buf_alloc(fl, fl->sctx->dev, memlen, &imem); if (err) - goto err_alloc; + goto err; fl->init_mem = imem; args[0].ptr = (u64)(uintptr_t)&inbuf; @@ -1106,9 +1099,6 @@ static int fastrpc_init_create_process(struct fastrpc_user *fl, err_invoke: fl->init_mem = NULL; fastrpc_buf_free(imem); -err_alloc: - if (map) - fastrpc_map_put(map); err: kfree(args);