Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp5009802img; Tue, 26 Mar 2019 23:37:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqxML+cPeFUy6XYlsGMypZDdSmlCgSeOJwAaPntKxmJ99IGQJ9a5JO/7zBEnjQ4lAWVrJCtq X-Received: by 2002:a17:902:b282:: with SMTP id u2mr16813679plr.9.1553668641288; Tue, 26 Mar 2019 23:37:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553668641; cv=none; d=google.com; s=arc-20160816; b=UcBP8TR8cV+RtcY1iKavl3BVZWN3R1Y738uTIm0ZSVW0XjZ0laNvpXj/9lJozzdbLt pXpgB1fXuYUA5+ajGR0kEk8iqy5CFwLFCOldyJl2i/WV7+DMwLCEIBX91kynvhdLDLJX XWXuaZ8bm6UOM6qUffjG8tHAlsimE9wTSYQsMYVb96QldpVCjursuEXkwqKRJ3cXuS17 JqiUHA65JHigbaNwPaGBBVuJCIpzvrf5DXe3gdRfdTxQ5//boXp1oN4jlzdLIxwWrtkA aFblAiFfcilnuWj6gWhCuBn2VC3JdXAcZmrm6Td7sgC71rWzUPsR23finCY35HONOaFT Ahwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:subject:content-transfer-encoding :mime-version:user-agent:references:in-reply-to:date:cc:to:from :message-id; bh=D/nOCDpN9hW49ONMPwIV9EoQN32GogCGfv+3DGfVxaI=; b=q8d6eZ96jqnKKkGkS+Iex/GH1i+40U3sAYD7aaMLaEvqxB5gCTSb9MNvrjGfaLmANa tkMPWFj3taIq8uj/Be8Pus39F3SUb1yfs3OiSef0bnxM2t0GX0lXtCVkFS6a7S9qou5w w5AZrUNnM9Gv8xmc7NQIjARqPulVjUBde0Lr+ZXTZKi2wWc6klTQoFGw8V1N9/TyZo2n zCfE4ERBUP/au7C21n7rd+XKsJ1w9DYQ6OH8s3HBGyDGI4ir1j3XC3MyMJKvb8Y164oJ u8UHr6buo22msD2kUatAUG6Un0T65M+dlLzd6dnqB21OEiDIhZbcEQwsOSCP0J5iae+a h2rw== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k10si12051384pfj.132.2019.03.26.23.37.05; Tue, 26 Mar 2019 23:37:21 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733261AbfC0Gfs (ORCPT + 99 others); Wed, 27 Mar 2019 02:35:48 -0400 Received: from paleale.coelho.fi ([176.9.41.70]:47506 "EHLO farmhouse.coelho.fi" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1733222AbfC0Gfs (ORCPT ); Wed, 27 Mar 2019 02:35:48 -0400 Received: from 91-156-6-193.elisa-laajakaista.fi ([91.156.6.193] helo=chariottest7) by farmhouse.coelho.fi with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.91) (envelope-from ) id 1h929z-0003TG-IH; Wed, 27 Mar 2019 08:35:40 +0200 Message-ID: <5f9c8beda0e925b079aa9342ce1c9523659837a4.camel@coelho.fi> From: Luca Coelho To: Greg Kroah-Hartman , Laura Abbott Cc: linux-kernel@vger.kernel.org, Johannes Berg , Emmanuel Grumbach , Intel Linux Wireless , Kalle Valo , linux-wireless@vger.kernel.org Date: Wed, 27 Mar 2019 08:35:37 +0200 In-Reply-To: <20190327015346.GA17979@kroah.com> References: <20190122152151.16139-24-gregkh@linuxfoundation.org> <03bb68be-8e42-a463-2d57-3be051dc2016@redhat.com> <20190327012600.GA3649@kroah.com> <5660d50d-6cbf-3b36-6e6c-312b1617ed23@redhat.com> <20190327015346.GA17979@kroah.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.30.5-1 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on farmhouse.coelho.fi X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, TVD_RCVD_IP autolearn=ham autolearn_force=no version=3.4.1 Subject: Re: [PATCH] iwlwifi: mvm: no need to check return value of debugfs_create functions Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2019-03-27 at 10:53 +0900, Greg Kroah-Hartman wrote: > On Tue, Mar 26, 2019 at 06:47:33PM -0700, Laura Abbott wrote: > > On 3/26/19 6:26 PM, Greg Kroah-Hartman wrote: > > > On Tue, Mar 26, 2019 at 04:55:54PM -0700, Laura Abbott wrote: > > > > On 1/22/19 7:21 AM, Greg Kroah-Hartman wrote: > > > > > diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c > > > > > index 33b0af24a537..c52cdc538678 100644 > > > > > --- a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c > > > > > +++ b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c > > > > > @@ -1446,9 +1446,8 @@ static ssize_t iwl_dbgfs_quota_min_read(struct file *file, > > > > > #define MVM_DEBUGFS_READ_WRITE_FILE_OPS(name, bufsz) \ > > > > > _MVM_DEBUGFS_READ_WRITE_FILE_OPS(name, bufsz, struct ieee80211_vif) > > > > > #define MVM_DEBUGFS_ADD_FILE_VIF(name, parent, mode) do { \ > > > > > - if (!debugfs_create_file(#name, mode, parent, vif, \ > > > > > - &iwl_dbgfs_##name##_ops)) \ > > > > > - goto err; \ > > > > > + debugfs_create_file(#name, mode, parent, vif, \ > > > > > + &iwl_dbgfs_##name##_ops); \ > > > > > } while (0) > > > > > MVM_DEBUGFS_READ_FILE_OPS(mac_params); > > > > > @@ -1483,12 +1482,6 @@ void iwl_mvm_vif_dbgfs_register(struct iwl_mvm *mvm, struct ieee80211_vif *vif) > > > > > mvmvif->dbgfs_dir = debugfs_create_dir("iwlmvm", dbgfs_dir); > > > > > - if (!mvmvif->dbgfs_dir) { > > > > > - IWL_ERR(mvm, "Failed to create debugfs directory under %pd\n", > > > > > - dbgfs_dir); > > > > > - return; > > > > > - } > > > > > - > > > > > if (iwlmvm_mod_params.power_scheme != IWL_POWER_SCHEME_CAM && > > > > > ((vif->type == NL80211_IFTYPE_STATION && !vif->p2p) || > > > > > (vif->type == NL80211_IFTYPE_STATION && vif->p2p))) > > > > > @@ -1537,12 +1530,6 @@ void iwl_mvm_vif_dbgfs_register(struct iwl_mvm *mvm, struct ieee80211_vif *vif) > > > > > mvmvif->dbgfs_slink = debugfs_create_symlink(dbgfs_dir->d_name.name, > > > > > mvm->debugfs_dir, buf); > > > > > - if (!mvmvif->dbgfs_slink) > > > > > - IWL_ERR(mvm, "Can't create debugfs symbolic link under %pd\n", > > > > > - dbgfs_dir); > > > > > - return; > > > > > -err: > > > > > - IWL_ERR(mvm, "Can't create debugfs entity\n"); > > > > > } > > > > > > > > Fedora got a bug report https://bugzilla.redhat.com/show_bug.cgi?id=1691034 > > > > of a crash with 5.0 and the user did a bisect which pointed to ff9fb72bc077 > > > > ("debugfs: return error values, not NULL") because the error checking is > > > > no longer correct in this driver. > > > > > > > > Based on https://patchwork.kernel.org/patch/10865839/, it looks like > > > > this is supposed to go in for 5.2 but this needs to go in now as > > > > the error checking is currently broken without it. Can this get queued > > > > for Linus so we can get it in 5.0 stable? > > > > > > That's odd, I can't see how the error checking is wrong here. If the > > > directory is not created, an error will be returned, which should be > > > able to be handled by debugfs_create_file(). > > > > > > So with this patch does the error go away? > > > > > > > The full patch didn't apply cleanly and I didn't try to backport it > > for the reporter to test. I was going off of the theory that if the > > patch was there it would fix the problem. > > > > What I _think_ is going wrong is dbgfs_dir is actually an errno value: > > > > > > struct dentry *dbgfs_dir = vif->debugfs_dir; > > struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); > > char buf[100]; > > > > /* > > * Check if debugfs directory already exist before creating it. > > * This may happen when, for example, resetting hw or suspend-resume > > */ > > if (!dbgfs_dir || mvmvif->dbgfs_dir) > > return; > > > > > > so this blows up in the snprintf > > > > snprintf(buf, 100, "../../../%pd3/%pd", > > dbgfs_dir, > > mvmvif->dbgfs_dir); > > Ah, yeah, that's horrible. They had the name before, why pull it out of > the dentry again? That will blow up hard, but maybe printk should check > to see if the pointer really is a pointer first. I agree this is ugly. But do you mean we could use ("../../../%pd3/%s", dbgfs_dir, "iwlmvm")? Or how did we have the name? Also, this would solve the sprintf() problem, but still wouldn't solve the real issue, which is not check for ERR in dbgfs_dir. > > Unless I misunderstood what the debugfs error change did. I think this > > also means the if check needs to look for IS_ERR and not just !dbgfs_dir. > > Yes, that is correct. Yeah, we can do that. So this patch doesn't need to be sent for v5.1-rc* and v5.0, right? At least I don't see how it would fix the issue. What we need is a new patch with the IS_ERR check. -- Cheers, Luca.