Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753700AbbHJGuG (ORCPT ); Mon, 10 Aug 2015 02:50:06 -0400 Received: from blu004-omc1s6.hotmail.com ([65.55.116.17]:52000 "EHLO BLU004-OMC1S6.hotmail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753195AbbHJGuD (ORCPT ); Mon, 10 Aug 2015 02:50:03 -0400 X-TMN: [X/DTTERCRHoyHrxKtr8qOkqH64/9wSRU] X-Originating-Email: [wanpeng.li@hotmail.com] Message-ID: From: Wanpeng Li To: Andrew Morton CC: Naoya Horiguchi , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Wanpeng Li Subject: [PATCH 2/2] mm/hwpoison: fix refcount of THP head page in no-injection case Date: Mon, 10 Aug 2015 14:32:31 +0800 X-Mailer: git-send-email 1.9.1 In-Reply-To: <1439188351-24292-1-git-send-email-wanpeng.li@hotmail.com> References: <1439188351-24292-1-git-send-email-wanpeng.li@hotmail.com> X-OriginalArrivalTime: 10 Aug 2015 06:50:00.0780 (UTC) FILETIME=[C73960C0:01D0D338] MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1096 Lines: 34 Hwpoison injection takes a refcount of target page and another refcount of head page of THP if the target page is the tail page of a THP. However, current code doesn't release the refcount of head page if the THP is not supported to be injected wrt hwpoison filter. Fix it by reducing the refcount of head page if the target page is the tail page of a THP and it is not supported to be injected. Signed-off-by: Wanpeng Li --- mm/hwpoison-inject.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/mm/hwpoison-inject.c b/mm/hwpoison-inject.c index 5015679..c343a45 100644 --- a/mm/hwpoison-inject.c +++ b/mm/hwpoison-inject.c @@ -56,6 +56,8 @@ inject: return memory_failure(pfn, 18, MF_COUNT_INCREASED); put_out: put_page(p); + if (p != hpage) + put_page(hpage); return 0; } -- 1.7.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/