Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1650894ybb; Thu, 26 Mar 2020 04:58:27 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsVtQVAC7/hKM2I/XKbc2LqKDXv67aRJ6Eh3g84q2zJMLQRRz+DVPExMZo/OzcYobZOWYab X-Received: by 2002:a9d:62c6:: with SMTP id z6mr5876854otk.328.1585223906902; Thu, 26 Mar 2020 04:58:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585223906; cv=none; d=google.com; s=arc-20160816; b=SeopsbTyQB4CirB/n9kR7h9K8C11qU1uAxkd/IG/yi+t+kTELly4xO9iZ3mHWMnlX0 ccD/a6I6/6ntMqN6F/fYl7lXop7meoEowMsLoDANK55HlCaABm1qg4YxfllB1/RH/MFV tRkXsVuIHEoGWOF7VvUR6Cg5hHBRnf0H28I18/oxm2xjqJ9dMX28PggX8dKrXNRuswHA tRWX2iKmcT6W1p6fsnx0UD8fQRNNdVVBaSRxq/rGUpWyZJelhDduW8LaC5PJ661CgJfk kWkohQ8QeAr14xWueU863CFsDTimWyusjJxaeWIUFo2+EKC0rg+TQgjZchdjSWTNomzT 4LuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:organization:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:ironport-sdr:ironport-sdr; bh=7+eT1Ej0dvgcEsVL6Arz+O8gIRi7pXZvMQrUg4nsgP8=; b=K1zJ1vG2cZ9r92Ij8gkc+YCas5wHPtP7jqRZXn8ZeAH/IiNPq8E65lL47Y+Y8yqBeG wus/UF0zAmBHOAu7TyaRTuRHwiYZzOX7mhivrzJDeCFakVJjWo04GcjVmM7JOt3G73Ls 4DhpgB/gAOEu8ey0RO5KPLgPj7gjpnuWo4uTlwaCOSl/3VkaAvyGFnP2m9+UsJZgL3eM AU2bqiSziYNx8lBulo96iFTdY/1jU3y3ORfw2jquhtCuJWY+at9OAOeV0peXsWf7rlfy mfpFyVlDHiUocBGGgSxzq22PLR1MNryOJZB3VbOgzLSZIEpCxEx+9y73l540VjA9XpI7 lFrg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 63si1006334otm.66.2020.03.26.04.58.13; Thu, 26 Mar 2020 04:58:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728201AbgCZL5d (ORCPT + 99 others); Thu, 26 Mar 2020 07:57:33 -0400 Received: from mga11.intel.com ([192.55.52.93]:4523 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728119AbgCZL5d (ORCPT ); Thu, 26 Mar 2020 07:57:33 -0400 IronPort-SDR: bYUCKQ4qbd6LGf6gXbnOYnotN5GUAF+WLE/mjPYnKvebd6GxUjY0Xfi/QwKgNwtzzzu36gUha6 qwcvCeEub/pw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2020 04:57:32 -0700 IronPort-SDR: l5ysklla5utAkfJSLXF+PFc86rVBXcpUoQpLK4JY4bVk45H6mBBfXALnJFSDCbrpyQ9o7relL5 A05r9KDZyU3w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,308,1580803200"; d="scan'208";a="250760624" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by orsmga006.jf.intel.com with ESMTP; 26 Mar 2020 04:57:28 -0700 Received: from andy by smile with local (Exim 4.93) (envelope-from ) id 1jHR8c-00D6tS-PE; Thu, 26 Mar 2020 13:57:30 +0200 Date: Thu, 26 Mar 2020 13:57:30 +0200 From: Andy Shevchenko To: "Rafael J. Wysocki" Cc: Saravana Kannan , Andrzej Hajda , Artem Bityutskiy , Felipe Balbi , Mark Brown , Ferry Toth , grant.likely@arm.com, Greg Kroah-Hartman , LKML , Linux PM , Peter Ujfalusi , Android Kernel Team Subject: Re: [PATCH v3] driver core: Break infinite loop when deferred probe can't be satisfied Message-ID: <20200326115730.GQ1922688@smile.fi.intel.com> References: <20200324175719.62496-1-andriy.shevchenko@linux.intel.com> <20200325032901.29551-1-saravanak@google.com> <20200325125120.GX1922688@smile.fi.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 26, 2020 at 09:39:40AM +0100, Rafael J. Wysocki wrote: > On Wed, Mar 25, 2020 at 11:09 PM Saravana Kannan wrote: > > On Wed, Mar 25, 2020 at 5:51 AM Andy Shevchenko > > wrote: > > > Yes, it's (unlikely) possible (*), but it will give one more iteration per such > > > case. It's definitely better than infinite loop. Do you agree? > > > > Sorry I wasn't being clear (I was in a rush). I'm saying this patch > > can reintroduce the bug where the deferred probe isn't triggered when > > it should be. > > > > Let's take a simple execution flow. > > > > probe_okay is at 10. > > > > Thread-A > > really_probe(Device-A) > > local_probe_okay_count = 10 > > Device-A probe function is running... > > > > Thread-B > > really_probe(Device-B) > > Device-B probes successfully. > > probe_okay incremented to 11 > > > > Thread-C > > Device-C (which had bound earlier) is unbound (say module is > > unloaded or a million other reasons). > > probe_okay is decremented to 10. > > > > Thread-A continues > > Device-A probe function returns -EPROBE_DEFER > > driver_deferred_probe_add_trigger() doesn't do anything because > > local_probe_okay_count == probe_okay > > But Device-A might have deferred probe waiting on Device-B. > > Device-A never probes. > > > > > *) It means during probe you have _intensive_ removing, of course you may keep > > > kernel busy with iterations, but it has no practical sense. DoS attacks more > > > effective in different ways. > > > > I wasn't worried about DoS attacks. More of a functional correctness > > issue what I explained above. > > The code is functionally incorrect as is already AFAICS. > > > Anyway, if your issue and similar issues can be handles in driver core > > in a clean way without breaking other cases, I don't have any problem > > with that. Just that, I think the current solution breaks other cases. > > OK, so the situation right now is that commit 58b116bce136 has > introduced a regression and so it needs to be fixed or reverted. The > cases that were previously broken and were unbroken by that commit > don't matter here, so you cannot argue that they would be "broken". > > It looks to me like the original issue fixed by the commit in question > needs to be addressed differently, so I would vote for reverting it > and starting over. I think Saravana's example is not fully correct as I had responded to his mail. I would like to hear Grant, but seems he is busy with something and didn't reply. > > As an alternate solution, assuming "linux,extcon-name" is coming > > from some firmware, you might want to look into the fw_devlink > > feature. > > That would be a workaround for a driver core issue, though, wouldn't it? As I explained to him, this issue is not limited to USB case. -- With Best Regards, Andy Shevchenko