Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp669543ybg; Mon, 1 Jun 2020 11:14:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwL+fSPeNBt2YX2lyLD3O3vA3xJIyqntpTtbj7ijbYSCbil9Fu3dz5M43V6CHho/x/PmrSA X-Received: by 2002:a17:906:19c7:: with SMTP id h7mr5633498ejd.403.1591035254622; Mon, 01 Jun 2020 11:14:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591035254; cv=none; d=google.com; s=arc-20160816; b=VYTn88seP5g9/kJ9ig2PYqSYwEwYY5fCh3sdJtVGAo5/rOqj8Au/GaUQ6q/+aAaopj AXUNbrZrz/LhveDGHET1EhXj9P6leuwKkfdHKKcJhT86tQfklJ6zGQp2OmYcW3LyubSZ pxvNXOppRCw8sK7YA6yoRmLDouUMFQ04S57mFZ/mpYKmU3GNKPpM9E89litLnmEQt1HE iXBgNkP0DyS5YlROmxvUwQw1jGxT/MqyVpFDh7NilTGywrFlieMX4MD8RfoarsK04RHb X3h45BI5Z7uhORcSRMpzwmoEON83ueo+mBtZ1KA/XKU813QRIatVa0L1vMpZvCDsZlpS HVuQ== 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:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=U7sL1ecaNrSqXGHe1b3XliFJWJFZQsFEaxpsbvceeGE=; b=wBaSpmnUdYQEzcwn71JfK2sytVzon/xfptBdwzLq0L0drTOGpi268VFiPefewLpu/v hgxMPl88PxwUog/BBmJJiDIAp6CocQBYaiUPf9H/4j8G40G2acfwh2wk0/SAe+BotGtY XiOlwmKt+S6szwe63NgTnclg60Qsk6KKwz0q1xKpw+1OSDz4Jgdf1LqHsdYxsJvTmYJX hmZlnxlR7FFGyyVnGFWQsyLtXoquJw0qgszffa32fRTchKVLO2O0tlBfbLWveVXaZeD8 sAj+2FQ8rLVb0SMdM3EJfrOYuApODoJnyWXSsCTf6WDqZ9DAFx45iDC+QIeqxoTMeg8m 9ZjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=pSO1MabW; 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 g4si140286ejb.192.2020.06.01.11.13.50; Mon, 01 Jun 2020 11:14:14 -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; dkim=pass header.i=@kernel.org header.s=default header.b=pSO1MabW; 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 S1731112AbgFASLd (ORCPT + 99 others); Mon, 1 Jun 2020 14:11:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:58590 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730386AbgFASLZ (ORCPT ); Mon, 1 Jun 2020 14:11:25 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5EC332077D; Mon, 1 Jun 2020 18:11:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591035084; bh=DTZXf56xoqkdM1pDwpE3oN8ES3/B1f9WROuREZ/xyew=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pSO1MabWwDg+IYeAK5NuciCAOdRLw/NZxHhrB80M2e7cREX7z/kt2Da4m4qBvbrP0 Sv0M30Bj22rfG8Cf/+MJ6xn9vBx/d28wOU9Vmo5zWlOEozUH1o/74i1KkJ/dyxmWCE zep63jYyMgp30M0MioiuMXwRuCQ1We+N5kAUVBYo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+fd5332e429401bf42d18@syzkaller.appspotmail.com, Johannes Berg Subject: [PATCH 5.4 107/142] cfg80211: fix debugfs rename crash Date: Mon, 1 Jun 2020 19:54:25 +0200 Message-Id: <20200601174049.041697123@linuxfoundation.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200601174037.904070960@linuxfoundation.org> References: <20200601174037.904070960@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Johannes Berg commit 0bbab5f0301587cad4e923ccc49bb910db86162c upstream. Removing the "if (IS_ERR(dir)) dir = NULL;" check only works if we adjust the remaining code to not rely on it being NULL. Check IS_ERR_OR_NULL() before attempting to dereference it. I'm not actually entirely sure this fixes the syzbot crash as the kernel config indicates that they do have DEBUG_FS in the kernel, but this is what I found when looking there. Cc: stable@vger.kernel.org Fixes: d82574a8e5a4 ("cfg80211: no need to check return value of debugfs_create functions") Reported-by: syzbot+fd5332e429401bf42d18@syzkaller.appspotmail.com Reviewed-by: Greg Kroah-Hartman Link: https://lore.kernel.org/r/20200525113816.fc4da3ec3d4b.Ica63a110679819eaa9fb3bc1b7437d96b1fd187d@changeid Signed-off-by: Johannes Berg Signed-off-by: Greg Kroah-Hartman --- net/wireless/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/net/wireless/core.c +++ b/net/wireless/core.c @@ -142,7 +142,7 @@ int cfg80211_dev_rename(struct cfg80211_ if (result) return result; - if (rdev->wiphy.debugfsdir) + if (!IS_ERR_OR_NULL(rdev->wiphy.debugfsdir)) debugfs_rename(rdev->wiphy.debugfsdir->d_parent, rdev->wiphy.debugfsdir, rdev->wiphy.debugfsdir->d_parent, newname);