From patchwork Mon Mar 20 14:40:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Cox X-Patchwork-Id: 9634327 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 EF28960327 for ; Mon, 20 Mar 2017 14:43:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E13A81FF26 for ; Mon, 20 Mar 2017 14:43:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D5D3727D8D; Mon, 20 Mar 2017 14:43:14 +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 711391FF26 for ; Mon, 20 Mar 2017 14:43:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754726AbdCTOnL (ORCPT ); Mon, 20 Mar 2017 10:43:11 -0400 Received: from mga05.intel.com ([192.55.52.43]:8964 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753269AbdCTOmE (ORCPT ); Mon, 20 Mar 2017 10:42:04 -0400 Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga105.fm.intel.com with ESMTP; 20 Mar 2017 07:40:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,194,1486454400"; d="scan'208";a="77364603" Received: from acox1-desk1.ger.corp.intel.com ([10.252.22.109]) by orsmga005.jf.intel.com with ESMTP; 20 Mar 2017 07:40:33 -0700 Subject: [PATCH 10/24] Staging: atomisp: fix locking in alloc_user_pages() From: Alan Cox To: greg@kroah.com, linux-media@vger.kernel.org Date: Mon, 20 Mar 2017 14:40:32 +0000 Message-ID: <149002082825.17109.10471955862860977004.stgit@acox1-desk1.ger.corp.intel.com> In-Reply-To: <149002068431.17109.1216139691005241038.stgit@acox1-desk1.ger.corp.intel.com> References: <149002068431.17109.1216139691005241038.stgit@acox1-desk1.ger.corp.intel.com> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Dan Carpenter We call this function with the lock held and should also return with the lock held as well. This one error path is not-consistent because we should return without the lock held. Signed-off-by: Dan Carpenter Signed-off-by: Alan Cox --- .../media/atomisp/pci/atomisp2/hmm/hmm_bo.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c index fd3bd5c..d1a609d2 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c @@ -1012,6 +1012,7 @@ static int alloc_user_pages(struct hmm_buffer_object *bo, dev_err(atomisp_dev, "find_vma failed\n"); atomisp_kernel_free(bo->page_obj); atomisp_kernel_free(pages); + mutex_lock(&bo->mutex); return -EFAULT; } mutex_lock(&bo->mutex);