Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp7271212imu; Thu, 31 Jan 2019 07:42:04 -0800 (PST) X-Google-Smtp-Source: ALg8bN5p6nb9E3GLQldxEEHi5JRT72iOEF+2rTBK1Z3o0BdOu3RYQf3cQX0dEUlaTg6LLXqZ8GdB X-Received: by 2002:a17:902:bd0b:: with SMTP id p11mr35632024pls.259.1548949324280; Thu, 31 Jan 2019 07:42:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548949324; cv=none; d=google.com; s=arc-20160816; b=VorA3y1s9+PQ5NkZ1/Z10r4mOdlI+4gsbraacdCZTVIFXYuTqLND8XGX1bVSL4mP1s f/2nRguR/S+3ZQZgvamzrp5RhIOIgLu3U4xucIdKy0iDLfVh+0PK1aiC6b03SKZqJYFn 12uYTDW/dQJ69+D03lJJHblzy1Ti8HCjTxrlL37W2+K6QKLmORla0lQ8EYJEyV5Fn+hy 7hJ0SWvUnPI/e/sbZ8K2R0O4Q+zXpP25dbVCFo3pO+FfOMTR+0HWP9OENgrJdDke7ovf NnGZGX3mrjy/6GO/C2HT/gY00IuugxGKqEqwtf5eW1PDgkIGrKqp6c236IJqXPWAEIao Ifww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=zEbsfq3Dl6n0U1jU7HiNj0/b8bjtRUy0PQ+fgxvrvJg=; b=0wXVqZd1lHJSkPVDt1dnJWZPO9i/QnNFI62H3vBY7NH9wDBct+0tU5WQeJNMNQHrY6 BjAyqJEcMkD80dmGxjkTLqLuoBz1KvJoYU2wgCl7Pz9rPnN34FEcm9uLoco0F++KNVUG 2Ocvujsh215DYwBKPj6MsEjHDfPl3abQEktXr9X1Mv5ZjqCwb5TfE2SOKc54gSJ9NkF4 RwA1mg6RcQFn0BVQxLUXzApiOPtIWoKtOiveYDyVtcmaYXC7VhPHyWXzoKAl4V6lX1WF jbn4DLkwkAvCewXVlP4oqg7MdYqCP4j5I1o5pvaS0ClhX8w+DjAFfLR1hQ0mIpJgxojV 1iuA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a19si4616202pgj.429.2019.01.31.07.41.47; Thu, 31 Jan 2019 07:42:04 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733150AbfAaPkG (ORCPT + 99 others); Thu, 31 Jan 2019 10:40:06 -0500 Received: from mail-lj1-f195.google.com ([209.85.208.195]:41474 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731033AbfAaPkG (ORCPT ); Thu, 31 Jan 2019 10:40:06 -0500 Received: by mail-lj1-f195.google.com with SMTP id k15-v6so3053813ljc.8; Thu, 31 Jan 2019 07:40:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=zEbsfq3Dl6n0U1jU7HiNj0/b8bjtRUy0PQ+fgxvrvJg=; b=gbRZqBxp2daVDWk3KW2tV3mzgAuHomLa3KAyO60gpkS+wDzLv7IxEdt+prP0oOpAnU i+TogHzfDawOQ2HnVBl/IyzY/2xL8rUbR2TFRayZJOlbs+bpliDqSmvRIWSfXKJXlbPC nHvCReYxMbtNq90iBV35o3DrkSuOeCKpOfLf7e8KZFThZQB1qVQakTXSdXWXZTCDVUMO ROOy6MS/FgfgUSP9UXC1Tl4zkvOttMA4vU4Iy+LfnWNyHMtSmad9V6EwM//49MbYYLZK esdMwBPMnc7j5eEIqSwzqZ5yIPwcAT4qpKjVOAKUPJ+gr5kwMV2E5xr52bI+f90Du5Sx Nwsg== X-Gm-Message-State: AJcUukfxcnkVqLKUEwSVbis9dov9sQQOQAWxioK+RR7cn+wgpmFoDYpT 9uPQxdZhNjjNzGqKaOH4gBY= X-Received: by 2002:a2e:5109:: with SMTP id f9-v6mr28574237ljb.52.1548949204055; Thu, 31 Jan 2019 07:40:04 -0800 (PST) Received: from xi.terra (c-74bee655.07-184-6d6c6d4.bbcust.telenor.se. [85.230.190.116]) by smtp.gmail.com with ESMTPSA id t19-v6sm838425lje.23.2019.01.31.07.40.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 31 Jan 2019 07:40:03 -0800 (PST) Received: from johan by xi.terra with local (Exim 4.91) (envelope-from ) id 1gpERc-0007SY-MF; Thu, 31 Jan 2019 16:40:00 +0100 Date: Thu, 31 Jan 2019 16:40:00 +0100 From: Johan Hovold To: Myungho Jung Cc: Marcel Holtmann , Johan Hedberg , linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] Bluetooth: Add NULL check for tiocmget() and tiocmset() Message-ID: <20190131154000.GU3691@localhost> References: <20190130053925.GA26699@myunghoj-Precision-5530> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190130053925.GA26699@myunghoj-Precision-5530> User-Agent: Mutt/1.11.2 (2019-01-07) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 29, 2019 at 09:39:28PM -0800, Myungho Jung wrote: > tiocmget() and tiocmset() operations are optional and some tty drivers > like pty miss the operations. We need NULL check to prevent from > dereference. > > Signed-off-by: Myungho Jung > --- > drivers/bluetooth/hci_ath.c | 6 ++++++ > drivers/bluetooth/hci_ldisc.c | 4 ++++ > 2 files changed, 10 insertions(+) Ah, you had already submitted a v2. I still suggest splitting this one in two patches and that you add a Fixes and stable tag to each so that they both get backported to stable. Also, when resubmitting, make sure to include a short changelog here below the cut-off line (---). > > diff --git a/drivers/bluetooth/hci_ath.c b/drivers/bluetooth/hci_ath.c > index d568fbd94d6c..fb9f6323a911 100644 > --- a/drivers/bluetooth/hci_ath.c > +++ b/drivers/bluetooth/hci_ath.c > @@ -185,8 +185,14 @@ static int ath_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr) > > static int ath_setup(struct hci_uart *hu) > { > + struct tty_struct *tty = hu->tty; > + > BT_DBG("hu %p", hu); > > + /* tty driver should support operations to set RTS */ > + if (!tty->driver->ops->tiocmget || !tty->driver->ops->tiocmset) > + return -EOPNOTSUPP; -ENODEV might be more appropriate. Johan