From patchwork Sat May 9 03:02:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 11537897 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CE3BB14B4 for ; Sat, 9 May 2020 02:58:41 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B20CA21974 for ; Sat, 9 May 2020 02:58:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B20CA21974 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id BC53F900027; Fri, 8 May 2020 22:58:40 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id B764390001C; Fri, 8 May 2020 22:58:40 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AB28E900027; Fri, 8 May 2020 22:58:40 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0215.hostedemail.com [216.40.44.215]) by kanga.kvack.org (Postfix) with ESMTP id 9210C90001C for ; Fri, 8 May 2020 22:58:40 -0400 (EDT) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 3ED00181AEF0B for ; Sat, 9 May 2020 02:58:40 +0000 (UTC) X-FDA: 76795672800.09.son17_116a2fd7c8313 X-Spam-Summary: 1,0,0,,d41d8cd98f00b204,weiyongjun1@huawei.com,,RULES_HIT:30054:30070,0,RBL:45.249.212.35:@huawei.com:.lbl8.mailshell.net-64.95.201.95 62.18.2.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:24,LUA_SUMMARY:none X-HE-Tag: son17_116a2fd7c8313 X-Filterd-Recvd-Size: 2124 Received: from huawei.com (szxga07-in.huawei.com [45.249.212.35]) by imf34.hostedemail.com (Postfix) with ESMTP for ; Sat, 9 May 2020 02:58:39 +0000 (UTC) Received: from DGGEMS406-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id A13122A3C9F461F677E0; Sat, 9 May 2020 10:58:34 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by DGGEMS406-HUB.china.huawei.com (10.3.19.206) with Microsoft SMTP Server id 14.3.487.0; Sat, 9 May 2020 10:58:28 +0800 From: Wei Yongjun To: , Ralph Campbell CC: Wei Yongjun , , , , Hulk Robot Subject: [PATCH -next] mm/hmm/test: fix missing unlock on error in dmirror_migrate_finalize_and_map() Date: Sat, 9 May 2020 03:02:25 +0000 Message-ID: <20200509030225.14592-1-weiyongjun1@huawei.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-Originating-IP: [10.175.113.25] X-CFilter-Loop: Reflected X-Bogosity: Ham, tests=bogofilter, spamicity=0.000001, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Add the missing unlock before return from function dmirror_migrate_finalize_and_map() in the error handling case. Fixes: 5d5e54be8a1e ("mm/hmm/test: add selftest driver for HMM") Reported-by: Hulk Robot Signed-off-by: Wei Yongjun Reviewed-by: Ralph Campbell --- lib/test_hmm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/test_hmm.c b/lib/test_hmm.c index 00bca6116f93..30462193c4ff 100644 --- a/lib/test_hmm.c +++ b/lib/test_hmm.c @@ -647,8 +647,10 @@ static int dmirror_migrate_finalize_and_map(struct migrate_vma *args, if (*dst & MIGRATE_PFN_WRITE) entry = xa_tag_pointer(entry, DPT_XA_TAG_WRITE); entry = xa_store(&dmirror->pt, pfn, entry, GFP_ATOMIC); - if (xa_is_err(entry)) + if (xa_is_err(entry)) { + mutex_unlock(&dmirror->mutex); return xa_err(entry); + } } mutex_unlock(&dmirror->mutex);