From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755119AbcCBL1G (ORCPT ); Wed, 2 Mar 2016 06:27:06 -0500 Received: from mail-pa0-f51.google.com ([209.85.220.51]:33315 "EHLO mail-pa0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752864AbcCBL1E (ORCPT ); Wed, 2 Mar 2016 06:27:04 -0500 From: Sergey Senozhatsky To: Rob Herring Cc: Frank Rowand , Grant Likely , Petr Mladek , Andrew Morton , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Sergey Senozhatsky , Sergey Senozhatsky Subject: [PATCH] of/unittest: fix infinite loop in of_unittest_destroy_tracked_overlays() Date: Wed, 2 Mar 2016 20:24:49 +0900 Message-Id: <1456917889-4416-1-git-send-email-sergey.senozhatsky@gmail.com> X-Mailer: git-send-email 2.8.0.rc0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org of_overlay_destroy() can return `-ENODEV' error code once it failed to find the requested overlay in `ov_idr'. However, of_unittest_destroy_tracked_overlays() does not handle this error code correctly and continues to call of_overlay_destroy() on the 'missing' overlay over and over again. This results in a printk flood [..] [ 33.497583] of_overlay_destroy: Could not find overlay #6 [ 33.497583] of_overlay_destroy: Could not find overlay #6 [ 33.497584] ### dt-test ### of_unittest_destroy_tracked_overlays: overlay destroy failed for #6 [ 33.497584] ### dt-test ### of_unittest_destroy_tracked_overlays: overlay destroy failed for #6 [ 33.497586] of_overlay_destroy: Could not find overlay #6 [ 33.497586] of_overlay_destroy: Could not find overlay #6 [ 33.497587] ### dt-test ### of_unittest_destroy_tracked_overlays: overlay destroy failed for #6 [ 33.497587] ### dt-test ### of_unittest_destroy_tracked_overlays: overlay destroy failed for #6 [..] which is not really good due to printk design, and can lead to soft lockups, hard lockups, etc. (depending on the context console_unlock() is being called from). The problem has bee observed in real life and reported by Ying Huang. This patch does not address the root cause of missing overlay in `ov_idr', it fixes the endless loop only. Signed-off-by: Sergey Senozhatsky Reported-by: kernel test robot Link: lkml.kernel.org/r/87fuwk1c0o.fsf@yhuang-dev.intel.com --- drivers/of/unittest.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c index 979b6e4..e986e6e 100644 --- a/drivers/of/unittest.c +++ b/drivers/of/unittest.c @@ -1165,6 +1165,11 @@ static void of_unittest_destroy_tracked_overlays(void) continue; ret = of_overlay_destroy(id + overlay_first_id); + if (ret == -ENODEV) { + pr_warn("%s: no overlay to destroy for #%d\n", + __func__, id + overlay_first_id); + continue; + } if (ret != 0) { defers++; pr_warn("%s: overlay destroy failed for #%d\n", -- 2.8.0.rc0