Received: by 2002:a05:7412:518d:b0:e2:908c:2ebd with SMTP id fn13csp384843rdb; Thu, 5 Oct 2023 08:39:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFlg/bnk7bDSpnwxIuMPZFek7WysLJT6owk6cv4Vwsazg3Mdm2oDVMr37sOKD+xnF9q6Jdr X-Received: by 2002:aa7:8894:0:b0:68f:edfd:2ac6 with SMTP id z20-20020aa78894000000b0068fedfd2ac6mr6434232pfe.0.1696520345892; Thu, 05 Oct 2023 08:39:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696520345; cv=none; d=google.com; s=arc-20160816; b=0lnvPh+x7gs5Odib1wmGqrvBoGhkt6CJXdEOYqpOhm9FuiN1JfTn48/sMEX+6DUNu0 QXEt9U9M86FwKMVuhGS20vejkJo6Krmw7IvNg36Pf4BZL+zI0tiCc8VovaM9QYpcFLvp nWJYmZxnx3nidzA2IW0IqLfpn2OHUg2QRAVDEibQ1j5yfd1LGs+B4DinEz0rKLr5OfHd aK0h7SDxBvZwIK3ETi4VkjR4T5n7YHMPB5DQfRARQ7a6maPnpbN1C+0ft80U74iZzie2 ABvaiPApBSzzgu8+zytLPMt9YjnrnDqzYT/WY5Iz1JLpWCDkUtspXcAB3gVsr+lUu3e0 0dKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=SOiN3PHFoIwnDhvtA5Da+2dFTKXIWqcpCeK/NrTuneY=; fh=NIFwCskit6mazXxPrY/jTW/CO/7lzZfT++LZntvAN9o=; b=AyRSNi2OFEUzpHuPpsmEkm7Qx2sS0IB1QpSnSGGBXWuxvKuhjPSXxs52Ev4yHN4Azk izMEMWo4AfhKM59lfNXhEUYogIIJv9GhHlwuKFS7iOZmvTNoo6IdZzXUdMXlfAYulDpI GSZvwZZn31+FUS6eupRkkcsBj4gPZVF/2e0hFzGILSRT2iC3UhDRnLj66NjgIEIxP3OR bNTIQ49mif0GY/4YVOZAYsaFW+4JQOd/cr2GcyLzrFNHgskiWIbseJTT9HfDW/p+MZQO lZTY1/9n0hku9zwl+iNDZYX9gtZZKU468J25L5D9Ebz/AnKLCcYi8A7MZm3Rzodsid66 rgyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=baKb8dI3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id cm23-20020a056a00339700b0068fb1a85ec8si1595776pfb.370.2023.10.05.08.39.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Oct 2023 08:39:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=baKb8dI3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id D912283DB337; Thu, 5 Oct 2023 08:39:02 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233677AbjJEPhs (ORCPT + 99 others); Thu, 5 Oct 2023 11:37:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231461AbjJEPh3 (ORCPT ); Thu, 5 Oct 2023 11:37:29 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD0CC35C18; Thu, 5 Oct 2023 07:53:30 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1C1B3C433BF; Thu, 5 Oct 2023 07:46:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1696491987; bh=1jTpDnM2GecCVC4qOmqZGahpZXui/D5O8mYTLXlY9MY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=baKb8dI33lKNmtfP0r/aNrrd2keZ5tsQ7Qh58HRXedsgre70GS3XfV3dwuabXHD1a 5T5658L4OGPxPwdTsIz8B7UjmZSbtJnhgQ8BHkvj9+mLwfBuFL/lDx7sjDp47HkoPA FBP3c6DhXRJxKH41xHedx/xf32NU4T2UzOnR29lQ= Date: Thu, 5 Oct 2023 09:46:25 +0200 From: "gregkh@linuxfoundation.org" To: =?iso-8859-1?Q?Rodr=EDguez_Barbarin=2C_Jos=E9?= Javier Cc: "jirislaby@kernel.org" , "linux-serial@vger.kernel.org" , "jth@kernel.org" , =?iso-8859-1?B?U2FuanXhbiBHYXJj7WEs?= Jorge , "linux-kernel@vger.kernel.org" , "morbidrsa@gmail.com" Subject: Re: [PATCH v3 2/2] mcb: use short version for function pointer for mcb_free_bus Message-ID: <2023100557-mournful-veto-64a2@gregkh> References: <20230906114901.63174-1-JoseJavier.Rodriguez@duagon.com> <20230906114901.63174-3-JoseJavier.Rodriguez@duagon.com> <2023092000-overprice-guileless-e1a3@gregkh> <352fb63a17943b974f5bf6eebb4d861ae8307b24.camel@duagon.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <352fb63a17943b974f5bf6eebb4d861ae8307b24.camel@duagon.com> X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Thu, 05 Oct 2023 08:39:03 -0700 (PDT) On Fri, Sep 22, 2023 at 12:28:14PM +0000, Rodr?guez Barbarin, Jos? Javier wrote: > On Wed, 2023-09-20 at 15:18 +0200, gregkh@linuxfoundation.org wrote: > > On Wed, Sep 06, 2023 at 11:49:28AM +0000, Rodr?guez Barbarin, Jos? > > Javier wrote: > > > From: Jorge Sanjuan Garcia > > > > > > Just a style change so that the device release callbacks are > > > defined > > > in the same way for devices in mcb_bus and mcb_device. > > > > > > Signed-off-by: Jorge Sanjuan Garcia > > > > > > Co-developed-by: Jose Javier Rodriguez Barbarin > > > > > > Signed-off-by: Jose Javier Rodriguez Barbarin > > > > > > --- > > > ?drivers/mcb/mcb-core.c | 2 +- > > > ?1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/drivers/mcb/mcb-core.c b/drivers/mcb/mcb-core.c > > > index 0cac5bead84f..5c6157b0db75 100644 > > > --- a/drivers/mcb/mcb-core.c > > > +++ b/drivers/mcb/mcb-core.c > > > @@ -288,7 +288,7 @@ struct mcb_bus *mcb_alloc_bus(struct device > > > *carrier) > > > ????????bus->dev.parent = carrier; > > > ????????bus->dev.bus = &mcb_bus_type; > > > ????????bus->dev.type = &mcb_carrier_device_type; > > > -???????bus->dev.release = &mcb_free_bus; > > > +???????bus->dev.release = mcb_free_bus; > > > > But you aren't fixing the root cause here of an incorrect pointer > > being > > passed to this function, right? > > > > Yes, removing the single variable is nicer, so the crash doesn't > > happen, > > but you are still passing the wrong pointer around, so why not fix > > that? > > > > > thanks, > > > > greg k-h > > The pointer to struct device in function __mcb_bus_add_devices() always > was the correct one. The problem came when calling to function > to_mcb_device() which was hapenning even for the case of struct device > pointer being a member of struct mcb_bus. > > Removing the need for this conversion makes the function generic so > that it will work for both mcb_device and mcb_bus structs. This already > fixes the crash as no member overlapping will occur (is_added in > mcb_device struct and bus_nr in mcb_bus struct). > > We belive the pointer is the correct one and this patch series was > actually fixing the root cause of the crash. What do you mean by > "passing the wrong pointer around"? are we missing something? Ok, I understand now, yes, this looks correct. But, the function mcb_bus_add_devices() seems odd to me. You are passing in a parameter that you are never using, so why have it at all? You are implying that you only have one bus, yet you are ignoring the bus sent to you? This still seems wrong. I'll queue up this series as it obviously fixes a bug, but more needs to be done here. thanks, greg k-h