Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp3544488pxb; Wed, 14 Apr 2021 07:56:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyK/OURLntVUEftu+UYQZzSc0zYGmQcAwr73ze3vExLtVnt8eoq8InD71LdI6Hv6zpYi130 X-Received: by 2002:a05:6402:6c1:: with SMTP id n1mr41166923edy.158.1618412160990; Wed, 14 Apr 2021 07:56:00 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1618412160; cv=pass; d=google.com; s=arc-20160816; b=uR8ROft2xUlGrfgOsQamTuHBpEthZPv+jIF8DptKXULtSG2Z/xFfcBsQ+5+Kmui+ok DKEo/5SkD+cg7nxMJkIp5Q7WaIW7WsovyuIOOoaUYvragUpG6GD18ybfInB7V1sqWDC2 qtsCiMzDXwHxuZlmL0lRiOFoN7slxdjdkWrUSxoidPAbPIO2Cu7T2+9XgTOenmUk6hs3 bTalVZlid7XKQke8LrY14eLmW1UZqIxTRUkz3GJUQB/G4IzGTZMCUUIi4kxEMBPKUqLL TO0hOlMB0NaqtYAJDfvZxtE/VbOn81pY3QEUwV934Idd1LVHWOAwizDnkzWoKZUU7fJQ KcdA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Zi1pCymnws3KmFT5eK4yZ89uZWqTyFy2eL+2AksUNN0=; b=WAdxEqLyKC+Vi2E5TXIieIa1r4YfbXGWbo7q74R0sY/E/7VJt69WkoCOsXgfmTh1m6 6hoBvsfmABkxKxdoZ+/uMYCwr04eiDX3RobNucTHAbPvpgbATSrdxfoaBvYYZ9k98h4u uj4N3PxSaF75pBQqfb8Gx4Nn5HlUJNL6+sY+Wj5CxUifm+aN/k2uBoafejb0iSrQInbv KiAQ5bCnsbIg9RSERyIoMLLIXsMX3hDkw/YER9xo6byHApih9IuInMfV/oElaM1+KTAI FH/JU5L2RZTyUpqqfO3QP780lGSBfTq6M79UQdAShnDe0krKi/EZA+1JARfzxkdC0V7U wNHQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@anirudhrb.com header.s=zoho header.b=wERjucwU; arc=pass (i=1 spf=pass spfdomain=anirudhrb.com dkim=pass dkdomain=anirudhrb.com dmarc=pass fromdomain=anirudhrb.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 w13si12759024ejv.399.2021.04.14.07.55.37; Wed, 14 Apr 2021 07:56:00 -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=@anirudhrb.com header.s=zoho header.b=wERjucwU; arc=pass (i=1 spf=pass spfdomain=anirudhrb.com dkim=pass dkdomain=anirudhrb.com dmarc=pass fromdomain=anirudhrb.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 S232203AbhDNJMM (ORCPT + 99 others); Wed, 14 Apr 2021 05:12:12 -0400 Received: from sender4-of-o53.zoho.com ([136.143.188.53]:21350 "EHLO sender4-of-o53.zoho.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232131AbhDNJMK (ORCPT ); Wed, 14 Apr 2021 05:12:10 -0400 ARC-Seal: i=1; a=rsa-sha256; t=1618391506; cv=none; d=zohomail.com; s=zohoarc; b=QMHhcgxPPNSCRuRZ5p+tWwJVttj2dn1QIO1Y2jmBl88zrYvBWCNsd8kb2PHIvZLLCwgxO4ahzjCJxNRBgAykX2Irt1ORYrNSSSv2VlGGSjbratWoxEV4KOV4NC4XcjjE2uZrAvwvZbJFO3wA3lafeKBNWnmNJfdEvrU3wc5AuzY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1618391506; h=Content-Type:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=Zi1pCymnws3KmFT5eK4yZ89uZWqTyFy2eL+2AksUNN0=; b=YciDOzjttUtvUCGybR7ATK7OPEY5epjZVNzw54JEIjObqDejay4aSzzVBynj88Db8Ud9fO0Zt5SXbPxsHdW8ULI2JWUqKp4xL1SAa/HYBIQllFi7kktZW0ms0ZhLraiVadJ4+5Q+AKQ5Or8Fz8urlAF3artOyB7+doRWgaqCeB4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=anirudhrb.com; spf=pass smtp.mailfrom=mail@anirudhrb.com; dmarc=pass header.from= header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1618391506; s=zoho; d=anirudhrb.com; i=mail@anirudhrb.com; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:Content-Type:In-Reply-To; bh=Zi1pCymnws3KmFT5eK4yZ89uZWqTyFy2eL+2AksUNN0=; b=wERjucwUFIrHGI8K6wfPVMWoDPa6kRz5g1vin9cHzBVfNCxSXNm2IGYG4F9G8QCa z8cKhmk5CYIQP79yXK/qjAtzXuVjVSTyL38J95HdHbrMT1UrddO31vk074uq8u0G8q1 dnqgplMoFl504D4UmLbjuvISWh5+sObi9W+ly9qo= Received: from anirudhrb.com (49.207.201.215 [49.207.201.215]) by mx.zohomail.com with SMTPS id 16183915039067.846894114221527; Wed, 14 Apr 2021 02:11:43 -0700 (PDT) Date: Wed, 14 Apr 2021 14:41:37 +0530 From: Anirudh Rayabharam To: Luis Chamberlain Cc: Greg Kroah-Hartman , "Rafael J. Wysocki" , Junyong Sun , syzbot+de271708674e2093097b@syzkaller.appspotmail.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] firmware_loader: fix use-after-free in firmware_fallback_sysfs Message-ID: References: <20210413104242.31564-1-mail@anirudhrb.com> <20210413165138.GI4332@42.do-not-panic.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210413165138.GI4332@42.do-not-panic.com> X-ZohoMailClient: External Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 13, 2021 at 04:51:38PM +0000, Luis Chamberlain wrote: > On Tue, Apr 13, 2021 at 04:12:42PM +0530, Anirudh Rayabharam wrote: > > The use-after-free happens when a fw_priv object has been freed but > > hasn't been removed from the pending list (pending_fw_head). The next > > time fw_load_sysfs_fallback tries to insert into the list, it ends up > > accessing the pending_list member of the previoiusly freed fw_priv. > > > > In commit bcfbd3523f3c ("firmware: fix a double abort case with > > fw_load_sysfs_fallback"), fw_load_abort() is skipped if > > fw_sysfs_wait_timeout() returns -ENOENT. This causes the fw_priv to > > not be removed from the pending list. > > > > To fix this, delete the fw_priv from the pending list when retval > > is -ENOENT instead of skipping the entire block. > > > > Fixes: bcfbd3523f3c ("firmware: fix a double abort case with fw_load_sysfs_fallback") > > Reported-by: syzbot+de271708674e2093097b@syzkaller.appspotmail.com > > Tested-by: syzbot+de271708674e2093097b@syzkaller.appspotmail.com > > Signed-off-by: Anirudh Rayabharam > > Thanks for your patch Anirudh, but please also see this reply to the > issue: > > http://lkml.kernel.org/r/20210403013143.GV4332@42.do-not-panic.com I have now sent a v3 that is more along the lines of the patch suggested in the above thread. Thanks! - Anirudh.