Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3483764pxj; Tue, 1 Jun 2021 06:26:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxQHRGl+Lm/gn1Mkxnbj9eGhJ2KII8NWTrpFkigU64ZcldLZ1uUYJ75M0uyFncRBwUJDtyw X-Received: by 2002:a17:906:bcd5:: with SMTP id lw21mr13412086ejb.346.1622553971443; Tue, 01 Jun 2021 06:26:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622553971; cv=none; d=google.com; s=arc-20160816; b=M2ryDoBEGadpI1rzTN/TLbjvZlhC9xqFp04RojLK24jgW+ZDah11ppHwJq6nTp6WWV 4qhNy5gAAW1Yc1l+iUiSKKXcvdgDdecNgDx1hu8tBaxb7aNvLZrbCSaNKEMaYjqvNrff r5ACFMugpeqbIP5RhP+RWCuEvJrN+4u+LNxly2DtXyJMuX7w8LSDDVDdOgqf7YiE1nox 2N1gakWXOROFiI2G/Hgd0NBLc7ob8QkurnWjiCnc7mn++HfzPi3ocS8Xanw2orkNyzwj NI6R3F+KU1FjgsBJvqx8ZB3QfHOSlBfUNK0kwKYKb4R0vX5ULEK1L3/QNF9Gx9lMZXIs EPgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject; bh=dHDFcGOv0gyGzcefhyBlPVxsuDdsPQqoEiYApnCNS5s=; b=sMfJI3Qrkm4wzqftefyns8/ntn5D1UIeYVOYr3qBQlwyNSH5xYrEF7HEqQfBSz3M/Y aD3rEUJ1JBoTlWxQS8apCImiQFsPFZarjh3ql0+534HK1y+ao7tPCYMbx8DFDjaxSC+h 92XvdlUKESReoS+iIAMihCukyQ77bcUPiSZnXjHOBi9OLhRHGUPlYSDqS6sC8UK2gjN0 SM19p+TCGbsqEzSOQiTzy+2gckIyp9iOsfzJalMAaULs3R/nq68sPblrZz+PfUSgDAZk sJ4zmRTFQvo3cb1PrRcDjmSOWiDVEpb0yh1yqMjamnoIinpBjBaWR0NnNfZRArghSkQW SRHw== 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n21si3601242edy.22.2021.06.01.06.25.47; Tue, 01 Jun 2021 06:26:11 -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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234026AbhFANZl (ORCPT + 99 others); Tue, 1 Jun 2021 09:25:41 -0400 Received: from mail-wr1-f47.google.com ([209.85.221.47]:46967 "EHLO mail-wr1-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234014AbhFANZk (ORCPT ); Tue, 1 Jun 2021 09:25:40 -0400 Received: by mail-wr1-f47.google.com with SMTP id g17so14256501wrs.13; Tue, 01 Jun 2021 06:23:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=dHDFcGOv0gyGzcefhyBlPVxsuDdsPQqoEiYApnCNS5s=; b=Slb2+8xTuJKSQFyhNr8s3apfxaQhBCjJwFClcZgctj9pNnh5qHVAuYdTuLWaPGt5k7 0CwPmnKfJZdzVNOU/r1umPgM7aSwXv3LlObAEHC0S3YZvTDfu9t80hQArL4de8Oz26Nq t7VXdyTeu1rtFEwJY2Wbu5fVsN4obdiXOONkqzAmxjkXpeqj5JadnXt+elnSkKnKsSbv rH9NbcDIG4RzyoRz8u0vJndoejdj0aDalR/yJeF0NHfPt0/xB54qS0rgMsvBQe0FaDY1 soVe9Rq1kv/sXjBZu9C2VgdrqGwaGFuSo7e7DnlKlT88qUo6CgjXxTGFbxn0xJvZlHil mkDA== X-Gm-Message-State: AOAM530BH57O5mrx1JRnscikBVng8Z2bwQP90BsLfnFLf5YqtExcpgBt RLBN5KDDfEn+1x9B+5bueBlWngHlHWmMW1f9 X-Received: by 2002:a5d:4089:: with SMTP id o9mr20949355wrp.195.1622553836693; Tue, 01 Jun 2021 06:23:56 -0700 (PDT) Received: from Johanness-MBP.fritz.box ([2001:a62:141b:f301:fcc0:44c6:21e1:ed3]) by smtp.gmail.com with ESMTPSA id s128sm16323545wme.6.2021.06.01.06.23.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 01 Jun 2021 06:23:56 -0700 (PDT) Subject: Re: [PATCH] mcb: fix error handling in mcb_alloc_bus() To: Dan Carpenter Cc: Greg Kroah-Hartman , Andreas Werner , linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org References: From: Johannes Thumshirn Message-ID: Date: Tue, 1 Jun 2021 15:23:55 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am 01.06.21 um 11:18 schrieb Dan Carpenter: > There are two bugs: > 1) If ida_simple_get() fails then this code calls put_device(carrier) > but we haven't yet called get_device(carrier) and probably that > leads to a use after free. > 2) After device_initialize() then we need to use put_device() to > release the bus. This will free the internal resources tied to the > device and call mcb_free_bus() which will free the rest. > > Fixes: 5d9e2ab9fea4 ("mcb: Implement bus->dev.release callback") > Fixes: 18d288198099 ("mcb: Correctly initialize the bus's device") > Signed-off-by: Dan Carpenter > Thanks applied