From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A9BF9477E51 for ; Thu, 30 Jul 2026 23:37:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785454678; cv=none; b=N7/e9/+6elaFacr3wslmLtYS6Ax7Nflv9rk1nDgzm39QpDaFufJEMoHO3GReuqSrH1bbJZ608iBpWdond6uvpdwuwRFj/oeLte+HjAnS7DFvzEzEx+1PvNh046w0BX5W7otGmzJQsSJTmqsLFVCsjJAlrAVmGGBzpd/HXsKpKO8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785454678; c=relaxed/simple; bh=mfEoOh7OlkRlu5acKyPr/YxBMOBzAf91Z7JV8VqlT8Y=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=mwf4srn5qk4Qr9BW/VhEgewOBT4yiv5TKnd5bSMJyKRq6LSHKpRUDqC23igFq6aINWnZd9LpjxatcJqXCn5qtKQclnu518ZBgUq6vQFZYAM6vlzcSiE5NWkGxv+08cUUyUxx+aozLsuenCkmLZTNSlOj4u/pDXcfhLmRO0u5iik= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=dTLwXRto; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=Hc0BoW5A; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="dTLwXRto"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="Hc0BoW5A" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1785454675; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=C45f6c51+m57hpeZ9zwBgTF6eOfqSwMmzmRci27jKDo=; b=dTLwXRtogUZikx/NS/gkP2n2lu0rcs7lKc4W2CxW58yzTh0AH0YcrZPGjHnYIVTCFFXz1a 5ASR6rz4XjkJgDc5l7mHr9w/LrtN6sUlx+9an/2bhCX3tPK/RF0TDO4BnjLLCXG044z8dR GhlTn2upoPiCzVnyQr3a54NbVhYhQQk= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-467-1FV0qPunOR-f_CfewFf69g-1; Thu, 30 Jul 2026 19:37:54 -0400 X-MC-Unique: 1FV0qPunOR-f_CfewFf69g-1 X-Mimecast-MFC-AGG-ID: 1FV0qPunOR-f_CfewFf69g_1785454673 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-47f5a972b0eso178404f8f.2 for ; Thu, 30 Jul 2026 16:37:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1785454673; x=1786059473; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=C45f6c51+m57hpeZ9zwBgTF6eOfqSwMmzmRci27jKDo=; b=Hc0BoW5AKkEhZf0wb/Q265d/K5tkIgC/yMnNDzwSDjZBao0aXSZMsTKBimzuvOOux7 ud7osZMapoAgv43eiR9nu9f9EmDX8eUVaQLwBKTto5o8Zj2isKnEGyhynK2bZhQZ+pmC gAemS/m7BdR1mqg11xcpRWRg/PQGiJME9T8WPFldOYAD3JTp0RMeGKDBtjZRvJwKHzcn V8/Cbsby/IC8Px3Z5NMG+JhHhrxUv9zVXy65VnbpzYz9sQuY1RFX3AsKdNXIjm8k3PNn 34k5bxwdp8WOx0YZpNL6tcdgLy9MKZ+kouHID0rC96OJ1yWrTkeU9m3J/1KmR8CJl7RF 7b2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785454673; x=1786059473; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=C45f6c51+m57hpeZ9zwBgTF6eOfqSwMmzmRci27jKDo=; b=VxVFu32gDz/NshtfoN4KXuLoY650rtG3yFwuNJHVE+67hl2yvys6NTi2Mp7C5HyJUS 5zVF/WuN5JW65hNpQVBz5zjLEOwda/iNGLaHzRFWACaoYv5kBYQnwEUaHv2gv7qY+J7r PYV9bkVDZiiB+I/OnxmMHsBSjPxuJgi9hrT8ftzTAjKqXg0kjUffKp1dEsKbnQMW0Ng9 H8BcQzVaeXDs9Deihwoi/o42z69dH56KtmSopzw/Rdu2W8RRyt5LkELaqclB4vWmOB3X S+AV1oOV2FBWPA0a3o4+fYnLghAQ71a2XtxB0VanWKtHxmHTnYWzJKJoKEFvoeU8WqxV eNyg== X-Forwarded-Encrypted: i=1; AHgh+RormwlIqc0R3OcLatstEcdzmyiVKhtwyEB2xv7fZSv2rd8izz2Owqnf4DoPGrDKVU1taWMRf1xBu8cOLV0=@vger.kernel.org X-Gm-Message-State: AOJu0YwgoA631O1z9vPxYSlQqKX7WO90obkzIHeIedDLyeaWZYwdrIUo /JYZPeJL+K6AQ+SdgXPde8ykNWBqYvJ1XeFuiaanhc9VsaR/zR69tRp/15b6cnAmCgMGpQ6b1da Q9sDMdLsgAN7d8TpvzIHyzmaQrI3P2YAiTsHCNhX70q/dKYwHZWQZmlH+GxKivjl8QQ== X-Gm-Gg: AR+sD115mVBEvxwUzjV1pTuhkopVJgPtwCCmDbrwctDnfNAxDz2Yt10d8Bud+NvMpwN 7cpA/Gc32a+n/Lj7afebXDIoCeUgrMmTU+q4CtypatNOtB4UD6GyEDeN90yEukqZQkbUAniL16T JjfqoamxLZcAm3Ta6lyLFWIE1RWaBylORTCGi3gsBiZECG2vm9vtuQhDrbs2rNxSvF5N+zKh7h9 lLrzrJVVqlgNyT/X/mZcMsgq0GdWPM/22TAiAI01ZZP+vHmfjNSrdeOXm+4YeKqnViNzjn5gmAC LB2SweNLZtiSskyinBmBqP+afFAlWuKB7UXo0/F4EtWwTTi3KBdRipLfJYUlS7sc947OYEw3SHe N9ZzMzEtQgsmp2hF1Zj/noeQ= X-Received: by 2002:a05:6000:40cd:b0:47f:7129:6e2d with SMTP id ffacd0b85a97d-47fc80cc992mr7021628f8f.17.1785454672639; Thu, 30 Jul 2026 16:37:52 -0700 (PDT) X-Received: by 2002:a05:6000:40cd:b0:47f:7129:6e2d with SMTP id ffacd0b85a97d-47fc80cc992mr7021592f8f.17.1785454672234; Thu, 30 Jul 2026 16:37:52 -0700 (PDT) Received: from redhat.com (ppp-94-66-118-61.home.otenet.gr. [94.66.118.61]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-47fc892cc5fsm8222264f8f.24.2026.07.30.16.37.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Jul 2026 16:37:50 -0700 (PDT) Date: Thu, 30 Jul 2026 19:37:47 -0400 From: "Michael S. Tsirkin" To: Dan Carpenter Cc: Haoxiang Li , marcel@holtmann.org, luiz.dentz@gmail.com, yangyingliang@huawei.com, linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH v4] Bluetooth: virtio: Fix virtbt_probe() init and cleanup Message-ID: <20260730193717-mutt-send-email-mst@kernel.org> References: <20260709114745.4030794-1-haoxiang_li2024@163.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Thu, Jul 09, 2026 at 03:28:17PM +0300, Dan Carpenter wrote: > On Thu, Jul 09, 2026 at 07:47:45PM +0800, Haoxiang Li wrote: > > virtbt_probe() allocates vbt before setting up the virtqueues, but some > > failure paths return without freeing it. > > > > The probe path also registers the HCI device before the virtio transport > > is opened. Since hci_register_dev() makes the HCI device visible and queues > > power_on work, move it after virtio_device_ready() and virtbt_open_vdev() > > so the transport is ready before the HCI core can use it. > > > > On failures after DRIVER_OK, reset and close the virtio device before > > deleting the virtqueues and freeing vbt. This also cancels pending rx work > > before vbt is freed. > > > > Fixes: afd2daa26c7a ("Bluetooth: Add support for virtio transport driver") > > Fixes: dc65b4b0f90a ("Bluetooth: virtio_bt: fix device removal") > > Cc: stable@vger.kernel.org > > Signed-off-by: Haoxiang Li > > --- > > Changes in v2: > > - Rework virtbt_probe() error paths into an unwind ladder. > > - Free vbt on probe failures. > > - Reset the virtio device and unregister the HCI device before freeing it > > when virtbt_open_vdev() fails. > > - Close the virtio device before unregistering the HCI device in remove(). > > > > Thanks Dan for the suggestions. The blog is very helpful. > > > > Changes in v3: > > - Remove virtio_reset_device() from the virtbt_open_vdev() failure path. > > > > Changes in v4: > > - Move hci_register_dev() after virtio_device_ready() and virtbt_open_vdev(). > > - Reset and close the virtio device on probe failures after DRIVER_OK. Thanks, Luiz! > > These are Sashiko warnings. To be honest, I would feel really > uncomfortable blindly applying them without testing. sashiko is right adding bufffers before driver ok is a spec violation. > If someone > can test, then great. Otherwise, I would probably apply v3. The > stuff that Sashiko complained about was all pre-existing issues > even though for the last one it said it wasn't but it was. > > regards, > dan carpenter