From patchwork Fri Aug 3 20:11:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haneen Mohammed X-Patchwork-Id: 10556651 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 30CF313B4 for ; Mon, 6 Aug 2018 08:24:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1B1D5202DB for ; Mon, 6 Aug 2018 08:24:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0E2CE29252; Mon, 6 Aug 2018 08:24:15 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BF882202DB for ; Mon, 6 Aug 2018 08:24:14 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1DB466E223; Mon, 6 Aug 2018 08:21:01 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) by gabe.freedesktop.org (Postfix) with ESMTPS id D8BBE6E11E for ; Fri, 3 Aug 2018 20:11:45 +0000 (UTC) Received: by mail-pf1-x441.google.com with SMTP id a26-v6so3801101pfo.4 for ; Fri, 03 Aug 2018 13:11:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=/eFmLcn5dJIkoC+hvCicKAOK/CGAfjJI/YGzOTS/ftk=; b=CDuHooq2AhVRFuQUGI0xNq7JdtUVmMT+1bGk0JNgY/nbf5UcKZvN9+JjP4CM3JA7IX YWFpNDG3BBhmcayUAt+FV0FblF4NRh8/bB22Sn9LpdI+eUcC3DRmcTlvpn0lyFdKUj0W vOt00ArUPe7MGQXKup+PhbOeou4PzgvAbEn4fVEav/E0C2uajyRSJz7dnuHHtGWehJwC oj25k9pEDyqthll0TJWbbrbXXKFU7aSGIxpHRM8LpO1dXjjiOw7b2SB7i8K5YalaDNsU Hz8a5UOYxCGJYhJ7Tt8UzK0wp9PEnYb/scUJvUCx+aDEmcNKd1xap/BClGNq/9KsTrUf qsVA== X-Gm-Message-State: AOUpUlHGP4B4Wu+uEz25UAxupAHHhHCG4QeUw1cwHDsk6+jZytbSrS8X Jg8xoIfjJZb1RSlMWG9iupAP/zXi X-Google-Smtp-Source: AAOMgpdBc92jevtU0gmFGL03PY1y8g0yqPkWf8KFdl+TVaIqiPFsnQpu4V59H0DS8NMT5Pw9NK08OA== X-Received: by 2002:a62:9042:: with SMTP id a63-v6mr6174281pfe.52.1533327105122; Fri, 03 Aug 2018 13:11:45 -0700 (PDT) Received: from haneenDRM ([64.77.242.50]) by smtp.gmail.com with ESMTPSA id s14-v6sm13960976pfj.105.2018.08.03.13.11.43 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 Aug 2018 13:11:44 -0700 (PDT) Date: Fri, 3 Aug 2018 23:11:42 +0300 From: Haneen Mohammed To: dri-devel@lists.freedesktop.org Subject: [PATCH] drm/vkms: Release pages_lock before return Message-ID: <20180803201142.GA2206@haneenDRM> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.9.4 (2018-02-28) X-Mailman-Approved-At: Mon, 06 Aug 2018 08:20:19 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: hamohammed.sa@gmail.com, rodrigosiqueiramelo@gmail.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Release pages_lock before return when vkms_obj->vaddr is NULL. This patch fixes: 6c234fe37c57 ("drm/vkms: Implement CRC debugfs API"). Signed-off-by: Haneen Mohammed --- drivers/gpu/drm/vkms/vkms_crc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/vkms/vkms_crc.c b/drivers/gpu/drm/vkms/vkms_crc.c index 9b909221943f..37d717f38e3c 100644 --- a/drivers/gpu/drm/vkms/vkms_crc.c +++ b/drivers/gpu/drm/vkms/vkms_crc.c @@ -22,14 +22,15 @@ static uint32_t _vkms_get_crc(struct vkms_crc_data *crc_data) mutex_lock(&vkms_obj->pages_lock); vaddr = vkms_obj->vaddr; if (WARN_ON(!vaddr)) - return crc; + goto out; for (i = y; i < y + height; i++) { src_offset = fb->offsets[0] + (i * fb->pitches[0]) + (x * cpp); crc = crc32_le(crc, vaddr + src_offset, size_byte); } - mutex_unlock(&vkms_obj->pages_lock); +out: + mutex_unlock(&vkms_obj->pages_lock); return crc; }