Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp4313433ybg; Mon, 8 Jun 2020 04:52:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxqzTy5SvBrSmUkvns+9UKpheLJB7GyFjSIGNPYElMJXtX23KHdEmtj+JKyc9UZP/ORz1Kb X-Received: by 2002:a50:9e21:: with SMTP id z30mr20831249ede.347.1591617176376; Mon, 08 Jun 2020 04:52:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591617176; cv=none; d=google.com; s=arc-20160816; b=WS50t4dg6tf+rxv9q8trkjZJmsVKNPzUxym4/SuWVITbytUa68th2109Anh+wdBRkP P7JoAuutUuat8tcNEyuP8fKnXDi8JIpN+O/BAVKmcYa3lTDF4ChUL7Ek9wqYFH1u4EsT 4CkBMmXrdw5tUURumjowgUyOVJXPC5LiwykIyhfYwL2T4P7H2y+8W0ZNchQpV4mp8z8r OyAd1Br+zesP2Ujy9ELFBIA/gM/u4ZY86uazgCfHUP6F/1GIlq1ZMgykDOWYIhmxrqS7 lWJq6Iyyk0AIJhqck5s7bu1N0vp7DWuVQgZGujBKHsKK9zoWz/RzPFrC0DCVjoJT0FH2 9KNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:from:references:cc:to:subject; bh=pVxiyh0FyCrsMIFOaJ0TsgZQrgO0Z/lMVSUiyX0WFBM=; b=E/3+6VzEvIdi5qMLTkppKbSZ0AzMWVHQHN+ZJgz2cmL3ect5qn8greMpDXrv/8+ZE4 pgPrtjzWfHKG9wBnzSxt+6/yqy5eHKSe5lIimK5nzXw2Qs2jGVp5NnucYTLWaVbJMN1e gX0I7hmsi4WSCEkWF93KfGnTaDzdHAWv4sbM33JCEgfl7jZh62cf/mH4lMs4NWMtdVsA iwTOooWm1n59FqGiBlq0m4Ln6VOvDLI33A7ZVLPsmPG0beIJpzVAe8kKHfRj6smbfrg9 beN92JbHhWzBTvACDTokBQ9vIi04XQtGRljWgpt/sjW9rG3j5RCFCQH7fWXr+Pn1FmkO NVeg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h91si8590028edc.340.2020.06.08.04.52.33; Mon, 08 Jun 2020 04:52:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729661AbgFHLsd (ORCPT + 99 others); Mon, 8 Jun 2020 07:48:33 -0400 Received: from mx2.suse.de ([195.135.220.15]:46752 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726434AbgFHLsc (ORCPT ); Mon, 8 Jun 2020 07:48:32 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 9A3C3ACE6; Mon, 8 Jun 2020 11:48:33 +0000 (UTC) Subject: Re: [PATCH 1/2] drivers: base: Warn if driver name is not present To: Greg KH , matthias.bgg@kernel.org Cc: rafael@kernel.org, linux-kernel@vger.kernel.org, gene.chen.richtek@gmail.com, lee.jones@linaro.org, kernel test robot References: <20200608095217.21162-1-matthias.bgg@kernel.org> <20200608105756.GB295073@kroah.com> From: Matthias Brugger Autocrypt: addr=mbrugger@suse.com; prefer-encrypt=mutual; keydata= mQINBFP1zgUBEAC21D6hk7//0kOmsUrE3eZ55kjc9DmFPKIz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JRXYM1WuYloTcIhRSXUohGgHmh7u sl469/Ra5CFaMhT3yCVciuHdZh3u+x+O1sRcOhaFW3BkxKEy+ntxw8J7ZzhgFOgi2HGkOGgM 9R03A6ywc0sPwbgkgF7HCLirshP2U/qxWy3C8DkAEQEAAYkCNgQYAQgAIBYhBOa5khjA8sMl HCw6F9kUC7JWEwLxBQJd1TlIAhsMAAoJENkUC7JWEwLxtdcP/jHJ9vI8adFi1HQoWUKCQbZd Z5ZJHayFKIzU9kZE/FHzzzMDZYFgcCTs2kmUVyGloStXpZ0WtdCMMB31jBoQe5x9LtICHEip 0irNXm80WsyPCEHU3wx91QkOmDJftm6T8+F3lqhlc3CwJGpoPY7AVlevzXNJfATZR0+Yh9Nh ON5Ww4AjsZntqQKxE8rrieLRd+he57ZdRKtRRNGKZOS4wetNhodjfnjhr4Z25BAssD5q+x4u aO8ofGxTjOdrSnRhvhzPCgmP7BKRUZA0wNvFxjboIw8rbTiOFGb1Ebrzuqrrr3WFuK4C1YAF 4CyXUBL6Z1Lto//i44ziQUK9diAgfE/8GhXP0JlMwRUBlXNtErJgItR/XAuFwfO6BOI43P19 YwEsuyQq+rubW2WvrWY2Bj2dXDAKUxS4TuLUf2v/b9Rct36ljzbNxeEWt+Yq4IOY6QHnE+w4 xVAkfwjT+Vup8sCp+zFJv9fVUpo/bjePOL4PMP1y+PYrp4PmPmRwoklBpy1ep8m8XURv46fG UHUEIsTwPWs2Q87k7vjYyrcyAOarX2X5pvMQvpAMADGf2Z3wrCsDdG25w2HztweUNd9QEprt JG8GNNzMOD4cQ82Ta7eGvPWPeXauWJDLVR9jHtWT9Ot3BQgmApLxACvwvD1a69jaFKov28SP HxUCQ9Y1Y/Ct Message-ID: Date: Mon, 8 Jun 2020 13:48:28 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.1 MIME-Version: 1.0 In-Reply-To: <20200608105756.GB295073@kroah.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08/06/2020 12:57, Greg KH wrote: > On Mon, Jun 08, 2020 at 11:52:16AM +0200, matthias.bgg@kernel.org wrote: >> From: Matthias Brugger >> >> If we pass a driver without a name, we end up in a NULL pointer >> derefernce. > > That's a very good reason not to have a driver without a name :) > > What in-kernel driver does this? > >> Check for the name before trying to register the driver. >> As we don't have a driver name to point to in the error message, we dump >> the call stack to make it easier to detect the buggy driver. >> >> Reported-by: kernel test robot >> Signed-off-by: Matthias Brugger >> --- >> drivers/base/driver.c | 6 ++++++ >> 1 file changed, 6 insertions(+) >> >> diff --git a/drivers/base/driver.c b/drivers/base/driver.c >> index 57c68769e157..40fba959c140 100644 >> --- a/drivers/base/driver.c >> +++ b/drivers/base/driver.c >> @@ -149,6 +149,12 @@ int driver_register(struct device_driver *drv) >> int ret; >> struct device_driver *other; >> >> + if (!drv->name) { >> + pr_err("Driver has no name.\n"); >> + dump_stack(); >> + return -EINVAL; > > Ick, no, an oops-traceback for doing something dumb like this should be > all that we need, right? > > How "hardened" do we need to make internal apis anyway? What's the odds > that if this does trigger, the driver author would even notice it? > We just had the case that a driver got accepted in a maintainer repository without a name. Which got later found by the kernel test robot. I agree with you that it probably doesn't make much sense to check for this kind of bugs, as it should be discoverable if you test your code, before you submit. I propose to ignore this patch. Regards, Matthias