Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp267902ybb; Tue, 7 Apr 2020 22:31:35 -0700 (PDT) X-Google-Smtp-Source: APiQypK0ux/JUZcnkXPRfu03qz6cwXaQXdcK3ytSYNWWofEHmctHHOB30NW/0lJQhkPTpExfASjQ X-Received: by 2002:a05:6830:1bda:: with SMTP id v26mr2229067ota.259.1586323895773; Tue, 07 Apr 2020 22:31:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586323895; cv=none; d=google.com; s=arc-20160816; b=NKz+j6aysRE9TelCvnhi1wyyjwjS+lc+3yFRF7zht3y0Kof8hQiv0gdO792NdNytEI RItTorNLcXjiuXu+S4nRIcUCEPRp8WjYDI8RA10BsuAyiTzH+W7Z5f5WoJtqd1/9r79p Z3bfzbtjso6ZoqHTHiEqNHPAygCDqLjFh4c3QSFeg7b2PoOWQThkCjfrFfuANVcooP7C H11u+vYAnXerWdwFiQGvRHaOSXIvzVjDI+saRgwb4beTpRz9TOMAeoXQZRvUgo1/5OKP NBRRzdGVhH7g5DqbM+zh9CHgduoVQKWNXHLpwSGaBleSH4CAhe89ltBUOE4HWgJelRZ/ ecLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=/WdzM4gehWEq0juzki6u6jMgpBZk76c7dk3Ij+r66hw=; b=cZm83cCsPpL9AQtlaXHDnvXmOnaTkcxYsaHykyqYuHIv6Hgt8P0dT/f6n38YZWz/5F HxA3u6eVuIfb7zPL/FRvp2EN9x8Ie0M/LYVpOOH2/F62qicEV4AzTcOmAkp25MNrC+qb sR44a1fRbMkxOj+0XuyoxXDzvajUMcfE9hslfiKKQUe38bLxLmdejudOvPrLu3SFBicX b3QkF6kG1KbId7QOA3ZJOnO8+xYt0DDrWJRMRP2jWrS09jTbOY+qpSX2/j+aXU1hfgF0 eCRGWacrlgDfUkBXj2VKPZhimHOtxEoUT8eXbZf4gk8KkrRbrhtkHulYHfm/gv+7d20f xw3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=rU4s1bnl; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v20si1529389oif.63.2020.04.07.22.31.02; Tue, 07 Apr 2020 22:31:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=rU4s1bnl; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726504AbgDHFYr (ORCPT + 99 others); Wed, 8 Apr 2020 01:24:47 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:33182 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726494AbgDHFYq (ORCPT ); Wed, 8 Apr 2020 01:24:46 -0400 Received: by mail-pg1-f196.google.com with SMTP id d17so2835490pgo.0 for ; Tue, 07 Apr 2020 22:24:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=/WdzM4gehWEq0juzki6u6jMgpBZk76c7dk3Ij+r66hw=; b=rU4s1bnlRnjr5WBO9Low3v7/VV3qkQbWFMCPZ8jnYUc3ooXwcOgQ3zvdHpSHK0+y1Z rAKyXvHxnCiywtSBovoPgbaG13FKgPzBggEVSUVweF2b3iAAbAdB9mTvTowKnRsd4Oml Zck1v4y6VqERjjqRixiYN9awoaLtyofOK3NK/A4OfQJjAejO+lGECxb/6GAAgxe0oVnz hQvrfMrORHTYPLioFMLF+9dZoDdsRqssXNv1wVyhWg1cGNyT4Vx+rlUR/oKjQu/hHIF1 d+NTedupk/gdwJJ3uV+ji/FCCIHnPjDQycOsCb8m/LNX4AxQDjj2lBzaaC+n3IePEp2u xeYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=/WdzM4gehWEq0juzki6u6jMgpBZk76c7dk3Ij+r66hw=; b=Coa9Tam3J93BgsFpVtV2R0Xc28i2rvZsAqfkn03RbKG+60JVdSmDbyzgu2ipI/Bkjd EbABG2CTH8HY5Ge9JUdRb4s3xXA5RTRQy1BniJkY+D4Qo2W26c7gd2iEvek3XNM87uIE G8NZawaBtm5Ogt/G1LfVsRb30ukTwq+UPziVZJEoCuzHHoIbqQb886uM21OiFcNWEtsM hpehz0fJA05aF+x+/8Fszq7Sj0mZ7vyOeh8z5+/cqTfTdUE50iCAOFvnSfAT16ZXCnEr i9ZBfg0b9p8iB4ocTmCqLJ/f+Fby8DVDaqRzECXLgVWKj9opfjG4qA/0eE7Eda065PNb w3fQ== X-Gm-Message-State: AGi0PubW2JM5CJIkQ3a+x8r8oMuF0RuFsO4n7fdJpmmfbpqyAUIj7Wkc 2E+QRBnqXN5LLJ85PJ8nnHvSc9BPz+Y= X-Received: by 2002:a63:d801:: with SMTP id b1mr5475515pgh.49.1586323485628; Tue, 07 Apr 2020 22:24:45 -0700 (PDT) Received: from nsathish-Latitude-7480.iind.intel.com ([192.55.55.45]) by smtp.gmail.com with ESMTPSA id mq18sm3505750pjb.6.2020.04.07.22.24.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Apr 2020 22:24:45 -0700 (PDT) From: Sathish Narasimman X-Google-Original-From: Sathish Narasimman To: linux-bluetooth@vger.kernel.org Cc: Sathish Narasimman Subject: [PATCH] bluetooth: btusb: check for NULL in btusb_find_altsetting() Date: Wed, 8 Apr 2020 10:57:03 +0530 Message-Id: <20200408052703.7351-1-sathish.narasimman@intel.com> X-Mailer: git-send-email 2.17.1 Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org The new btusb_find_altsetting() dereferences it without checking the check is added in this patch Signed-off-by: Sathish Narasimman --- drivers/bluetooth/btusb.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index 110e96b245e5..2e715a6232dc 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c @@ -1622,6 +1622,9 @@ static struct usb_host_interface *btusb_find_altsetting(struct btusb_data *data, BT_DBG("Looking for Alt no :%d", alt); + if (!intf) + return NULL; + for (i = 0; i < intf->num_altsetting; i++) { if (intf->altsetting[i].desc.bAlternateSetting == alt) return &intf->altsetting[i]; -- 2.17.1