Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp3194774pxv; Sun, 4 Jul 2021 10:34:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw24jZrsL0QbeW4k8zkiCV3bBEv13fBM42Xd0tV0YCJUXxcYIyQKrJubz8+f5vw+rnj90tw X-Received: by 2002:a17:906:2844:: with SMTP id s4mr9494524ejc.263.1625420086150; Sun, 04 Jul 2021 10:34:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625420086; cv=none; d=google.com; s=arc-20160816; b=e69CZYYwvY7VgvYcPZNp6PUeg5SNo1OA3gZlITnRPHGLqR/0XNZ2cQJefDpyl6cIgi VkFmOjO/83j3A3nrnb8jqx/0nDQHiQAAUXUzlaLBEI955HGKxIpmfRq0c0IEOXxXcnnl InmbZtof5G8hKdn4PZo0cqxfVPyXZopT52m58bWWU/TDe7IywIZL3bBdJ3a/+pkkAEp8 hWvN/Sl8F/Li1qCd2CwlEr2/GVfJ1tCmplKqMD8EqrP8CJVgNAw8+3yhca+Q7+CaiM2t 7DVhDHid7yprGjZLxJNYaL9er/DkeFJXQsQBozYIuCDEqsBfb21yBFU1gKkScaJOMoJw j4ew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version; bh=JPOTqsJseNNfRnlOsv1KJ7daFSBaG5v7/xg5qFZXnyQ=; b=eHnWyehxVI5ymltVOaWquaYGuXvh/nESgIMbuJhsm4RYyzPLx+8O/Gh55j66otjUhx gojvxnBpkTq9hgy6cFPXgKu2bEB4wSEZGeT2dTB3SGCILlYZFYREjHF+UJuGBOvK0Hm/ 033O8lOTDnohyvt0fWGKculv024jyxMt7ibmeEHHgVDaVJwZ67hIQyfXZwl/ioRccVaB fCfOMN6h5JgAxy5s9bmXY17vFmUil5mLBV8s/0W1t+OEUi2j5ccoQ4cxv8Wlrfv8zGm5 h6XOHCUBXKpqAQxNCIWPZwCw5JYrjIsFGnWheGnFznUMQsw+X76fFM18n34+TY4PZqkb yJUg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ec44si3198745edb.2.2021.07.04.10.34.23; Sun, 04 Jul 2021 10:34:46 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229759AbhGDRfu convert rfc822-to-8bit (ORCPT + 99 others); Sun, 4 Jul 2021 13:35:50 -0400 Received: from coyote.holtmann.net ([212.227.132.17]:56605 "EHLO mail.holtmann.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229575AbhGDRft (ORCPT ); Sun, 4 Jul 2021 13:35:49 -0400 Received: from smtpclient.apple (p5b3d2eb8.dip0.t-ipconnect.de [91.61.46.184]) by mail.holtmann.org (Postfix) with ESMTPSA id 81438CECCC; Sun, 4 Jul 2021 19:33:11 +0200 (CEST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.100.0.2.22\)) Subject: Re: [PATCH] bluetooth/virtio_bt: Fix dereference null return value From: Marcel Holtmann In-Reply-To: <20210704145504.24756-1-john.wood@gmx.com> Date: Sun, 4 Jul 2021 19:33:10 +0200 Cc: Johan Hedberg , Luiz Augusto von Dentz , stable , Bluetooth Kernel Mailing List , linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8BIT Message-Id: References: <20210704145504.24756-1-john.wood@gmx.com> To: John Wood X-Mailer: Apple Mail (2.3654.100.0.2.22) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi John, > The alloc_skb function returns NULL on error. So, test this case and > avoid a NULL dereference (skb->data). > > Addresses-Coverity-ID: 1484718 ("Dereference null return value") > Fixes: afd2daa26c7ab ("Bluetooth: Add support for virtio transport driver") > Signed-off-by: John Wood > --- > drivers/bluetooth/virtio_bt.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/bluetooth/virtio_bt.c b/drivers/bluetooth/virtio_bt.c > index c804db7e90f8..5f82574236c0 100644 > --- a/drivers/bluetooth/virtio_bt.c > +++ b/drivers/bluetooth/virtio_bt.c > @@ -34,6 +34,8 @@ static int virtbt_add_inbuf(struct virtio_bluetooth *vbt) > int err; > > skb = alloc_skb(1000, GFP_KERNEL); > + if (!skb) > + return -ENOMEM; > sg_init_one(sg, skb->data, 1000); this is already fixed. Author: Colin Ian King Date: Fri Apr 9 17:53:14 2021 +0100 Bluetooth: virtio_bt: add missing null pointer check on alloc_skb call return The call to alloc_skb with the GFP_KERNEL flag can return a null sk_buff pointer, so add a null check to avoid any null pointer deference issues. Addresses-Coverity: ("Dereference null return value") Fixes: afd2daa26c7a ("Bluetooth: Add support for virtio transport driver") Signed-off-by: Colin Ian King Signed-off-by: Marcel Holtmann Regards Marcel