From patchwork Mon Jan 23 14:09:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 9532609 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 BDEF46042D for ; Mon, 23 Jan 2017 14:10:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A95C428364 for ; Mon, 23 Jan 2017 14:10:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9B01028375; Mon, 23 Jan 2017 14:10:02 +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.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, 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 4B65428364 for ; Mon, 23 Jan 2017 14:10:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751113AbdAWOKA (ORCPT ); Mon, 23 Jan 2017 09:10:00 -0500 Received: from mail-pg0-f67.google.com ([74.125.83.67]:33198 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750784AbdAWOKA (ORCPT ); Mon, 23 Jan 2017 09:10:00 -0500 Received: by mail-pg0-f67.google.com with SMTP id 194so13869678pgd.0 for ; Mon, 23 Jan 2017 06:10:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=smi2fvTXcCmQdmgK1rLaPoiL5uNRPIZF6N52DKpp+Fk=; b=L8Qk/LnJqh8iyQJjt09zwdr+qJQFyIOZpsO0+SpDVm2LUhyu0IEIn0oTec6LxCChfC QaEZDig5mmO9JxtH94bazi5Oawfd3yU7XVeMPBgpPvHYvxLJ0v/gUOHS7Hw0n+PWttOt BQzRvm5x3VSgRJpMxMZg6apgyIkDYR27skIbim3iOZGraRyGpMd6HVBRT49evo9vv5yC S4kukRAfAXsPpSWc+fRMOXbBh7rTpc85RFI1BVBBuvIoIg+7Bl1N3rT2/E40IjzbroBe 9Huaw+KNLIGx8XJhZWk06F2N8vxPaLZnpWnYApIJ/RX0qjqvpDiHJsYdYzfhqOvFkJvR lBiQ== 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:mime-version :content-transfer-encoding; bh=smi2fvTXcCmQdmgK1rLaPoiL5uNRPIZF6N52DKpp+Fk=; b=fWexA1t33kCyK5THTVTsTz3HMAiM37VuaegDHgNew2+8ek3alELz5dJxAhwNznORy/ IOhomGoAfvRJcTkmxQkAf5DaQsOme2ogyx0dmgTs6694iZMwtWegLlTBpN6iDfwwFoBC apD0RHMJz4QgnZ4Hs+cjg18+/ZQNbMfVmijXvASqEjpmm0yY9DkOUAjYuSxHGWj1VmFV twsMITJZ7BbkZcGT5reV4DMi144GKVRCdvM2bD7Ta1/Ckee9urVnmH/cP52EvOa8Luwm dGs3HsXDDZJuAmlcnMVao0JbBQZ7aacHmZPXxgmblAxtGIg7a7qZ9S56ekuIziX0o8Il ItqA== X-Gm-Message-State: AIkVDXIrUSSPFIlbGSlwltOHF3TCugxvZj41Z5wqLGwCIgdB3YE6dP/MI36vQlRKW/vPrA== X-Received: by 10.84.135.34 with SMTP id 31mr42981493pli.50.1485180599815; Mon, 23 Jan 2017 06:09:59 -0800 (PST) Received: from localhost.localdomain.localdomain (ec2-52-192-197-227.ap-northeast-1.compute.amazonaws.com. [52.192.197.227]) by smtp.gmail.com with ESMTPSA id 75sm37327236pfp.80.2017.01.23.06.09.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Jan 2017 06:09:59 -0800 (PST) From: Wei Yongjun To: Ohad Ben-Cohen , Bjorn Andersson Cc: Wei Yongjun , linux-remoteproc@vger.kernel.org Subject: [PATCH -next] rpmsg: char: Fix missing unlock on error in rpmsg_eptdev_read() Date: Mon, 23 Jan 2017 14:09:51 +0000 Message-Id: <20170123140951.2204-1-weiyj.lk@gmail.com> X-Mailer: git-send-email 2.9.3 MIME-Version: 1.0 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 From: Wei Yongjun Add the missing unlock before return from function rpmsg_eptdev_read() in the error handling case. Fixes: c0cdc19f84a4 ("rpmsg: Driver for user space endpoint interface") Signed-off-by: Wei Yongjun --- drivers/rpmsg/rpmsg_char.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-remoteproc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/rpmsg/rpmsg_char.c b/drivers/rpmsg/rpmsg_char.c index a78b6b7..93252dc 100644 --- a/drivers/rpmsg/rpmsg_char.c +++ b/drivers/rpmsg/rpmsg_char.c @@ -209,11 +209,12 @@ static ssize_t rpmsg_eptdev_read(struct file *filp, char __user *buf, } skb = skb_dequeue(&eptdev->queue); - if (!skb) - return -EFAULT; spin_unlock_irqrestore(&eptdev->queue_lock, flags); + if (!skb) + return -EFAULT; + use = min_t(size_t, len, skb->len); if (copy_to_user(buf, skb->data, use)) use = -EFAULT;