Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1237179ybl; Fri, 23 Aug 2019 15:56:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqxJ3w31PdZiffASQLn4ahHHhXwn8FncbsB5uJwV8c5POtrgdQq1oBvfIJHcEAWGt7ZcvFyG X-Received: by 2002:aa7:8e10:: with SMTP id c16mr7785069pfr.124.1566601019451; Fri, 23 Aug 2019 15:56:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566601019; cv=none; d=google.com; s=arc-20160816; b=Mvm/xRLdW37v+Iv5dsXBFOCkMn1fk8cq5SqLH9FrUYHZv9Y3E0O9DZ8FpJyLIJybRi RMOEYGYjJl73NPrbLFYFu2gNGn7D8QuL8jKKcYQc9x5CFBOfkd0+ZA7GXkrsp5XP44AX 24Z1I4ZO/+YO6uvQcCdoiUGhzmzj7OqaY0fnEwS6uTAKBgxujNkHfVbOscdXKT5ymm6s NunF4Wbyi1gH60dTa0LwyRuOwNYAhqr1O2lIWujPdjWuOnAs2y3bAjL98DKWK0KHlwH2 bqnjDIeP1CBQfGBvyNIG8+23KBKU2m19nF+ZahV0IzQbzYzNzoMXA9ufBt6iNr7W+KAZ 5iNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=eaF1NgI3/tCvQBGNuV2Ozkr5swOUz9Q1YNoph3dPfCA=; b=zkaD0WdES8bu8rR15uIS/O4TYwPCjM+fNl/hC8U9N7BUCrx3CssJOegGH+T/6H1EUU worm4mkY7lNtMJw3p5/7MRxKx3zu2h6VCnzPOzanIUoitafaNL+f2meUEguJ7na1TLAv ia4tkQPFlygxeyGMmIg3E24JgTpMFrI5QTOSyCoYAN9tYcXUP9KqIioiFHwnleiBC2sx pxhb6PfxsBxtDPhb8LCVNhS63MZT5WNtnxgWbHahrOYHqdIc4ONuEuyywRFoOktH2r8Q LXVEPKMxc0u4o23H+/rNTG4NdCrmOwMSOoHHitXdpZBWvWN7FJT6RZ2fN1zk6ENFW5DQ /fCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=G1xW6LLi; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 130si3025750pgg.18.2019.08.23.15.56.43; Fri, 23 Aug 2019 15:56:59 -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; dkim=pass header.i=@linaro.org header.s=google header.b=G1xW6LLi; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392166AbfHWKHV (ORCPT + 99 others); Fri, 23 Aug 2019 06:07:21 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:53353 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391917AbfHWKG7 (ORCPT ); Fri, 23 Aug 2019 06:06:59 -0400 Received: by mail-wm1-f65.google.com with SMTP id 10so8363000wmp.3 for ; Fri, 23 Aug 2019 03:06:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=eaF1NgI3/tCvQBGNuV2Ozkr5swOUz9Q1YNoph3dPfCA=; b=G1xW6LLifBzrZM98pMoqJppw5kCp9ljlnOSzFRZtPclDF6fw8Cd2RUQbL0e+HEm3Vh XX47d4h6nOFaDu8xJVs81qT+pZ+mIy7lRkoybJ7YhLjSgksA+EHlJsTjucE5uYSVAZvo +maJ1dWGYioVbSCriunnxWS+VkjLwTXWXByvsLbX0bDs9OJaHQFzEhMuBh8ecp61O0fp jZVCvAk73YWOGRf70F/tbiI2HeEnsfYcO/0xZjti62IB6C9kIYLIC/r+QNPhKKbJ21zv TM0sAUn4q+jETQpBFdyuPj7eFjqls67JbdbpT3rW6taBVOyeCNlkgILM5x1fMUnJlyaO dEBQ== 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=eaF1NgI3/tCvQBGNuV2Ozkr5swOUz9Q1YNoph3dPfCA=; b=A5rkSuV61Epzf9c7YQ+W7zkk6gFFLqXxKvDGemSXKkrL+lM2GXhnmsgMlPBsqenf6c eeoO5VZKp4RgPqwNas67Qaljeim4/HcFEGydZ5qezD8BuGZxhpznjkM1In6lsQPojJrE cvu+F5S3pfHJ4+58+J4OQqDuYgnroaN2aoTywJBbZ846M084E28/3OZOSTinXEOfs3jX 43lKAib6Bct32so4L92GFJg1nEsriHSbRiIxhFj+8k6qVE5EFDMRLhMPgYzKtyYcT6Ex riHPi6FHHbWQ/6Cpg+HaaIlmx2qeHhlcqVKgSQ/8vlI0CVEwgMWJs8LJ4Un0Z/KVJwyv UXqQ== X-Gm-Message-State: APjAAAVDgN3/Cr0ADy1XCdcedZglBeEzqlpdbetX7SaNyc8J4obx4fJS 2+pFWTg82MnilGAxs9Lb6Pvd6A== X-Received: by 2002:a1c:2015:: with SMTP id g21mr4100755wmg.33.1566554817994; Fri, 23 Aug 2019 03:06:57 -0700 (PDT) Received: from srini-hackbox.lan (cpc89974-aztw32-2-0-cust43.18-1.cable.virginm.net. [86.30.250.44]) by smtp.gmail.com with ESMTPSA id q124sm2058048wma.33.2019.08.23.03.06.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Aug 2019 03:06:57 -0700 (PDT) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: arnd@arndb.de, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Bjorn Andersson , Mayank Chopra , Abhinav Asati , Vamsi Singamsetty , Srinivas Kandagatla Subject: [PATCH 2/5] misc: fastrpc: Don't reference rpmsg_device after remove Date: Fri, 23 Aug 2019 11:06:19 +0100 Message-Id: <20190823100622.3892-3-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190823100622.3892-1-srinivas.kandagatla@linaro.org> References: <20190823100622.3892-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Bjorn Andersson As fastrpc_rpmsg_remove() returns the rpdev of the channel context is no longer a valid object, so ensure to update the channel context to no longer reference the old object and guard in the invoke code path against dereferencing it. TEST=stop and start remote proc1 using sysfs Signed-off-by: Bjorn Andersson Signed-off-by: Mayank Chopra Signed-off-by: Abhinav Asati Signed-off-by: Vamsi Singamsetty Signed-off-by: Srinivas Kandagatla --- drivers/misc/fastrpc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c index c019e867e7fa..59ee6de26229 100644 --- a/drivers/misc/fastrpc.c +++ b/drivers/misc/fastrpc.c @@ -913,6 +913,9 @@ static int fastrpc_internal_invoke(struct fastrpc_user *fl, u32 kernel, if (!fl->sctx) return -EINVAL; + if (!fl->cctx->rpdev) + return -EPIPE; + ctx = fastrpc_context_alloc(fl, kernel, sc, args); if (IS_ERR(ctx)) return PTR_ERR(ctx); @@ -1495,6 +1498,7 @@ static void fastrpc_rpmsg_remove(struct rpmsg_device *rpdev) misc_deregister(&cctx->miscdev); of_platform_depopulate(&rpdev->dev); + cctx->rpdev = NULL; fastrpc_channel_ctx_put(cctx); } -- 2.21.0