Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp2362785ima; Sat, 2 Feb 2019 21:00:58 -0800 (PST) X-Google-Smtp-Source: ALg8bN78Hvx3j4Oz2cV9tk5kH8GiySVQBdoo3vtgrIvxJcr6AwFkaq7XLw4afFPwjLqffWS8tiz4 X-Received: by 2002:a17:902:8d94:: with SMTP id v20mr46148901plo.194.1549170058417; Sat, 02 Feb 2019 21:00:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549170058; cv=none; d=google.com; s=arc-20160816; b=wH1wSuTNbeQ8VNTV1ccPaZZpaPLmxUxWTGqZQP7AeelUkO8s36YrgE5GTJlimy/0lR h+B2Y4ABItC27EVKY1fcHuS9l2Af8XJ3MFW3t4Dk9xfXlTqe6gpmae8Po0E9e4AXrp7O YWybQnlW6uyPFtlnJ1CVNxjUsnzsPUYoY9YLum7zmk4U8m020mcHakXJW6PKYBgy0ttk Buw43OagXp6Uz4PsdwSjxySYyTixOapaunncRwg2VkMZrkZlBLyZNxH6hNQ3xXaJW8ZL hLfVvXYP4+YXprXd3UYkmvjsSCFWQc/Pgq0xIZonhyrbD/7CnCh/3e4v52VVCo3BCGxq yEcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:cc:to:from:date:dkim-signature; bh=7RbUpPibeswbGRgIY4OwIaY+jlrRtGwiAzTtQkLXwHw=; b=lD4Ci55zq2T7NFsWybAgM2xcc+xc11RrWwcwDIPYVnrvGzgCBTHQ8Jke+4kN0dcNpD tKTHctrDpymhQsLt7eABOE9+ONBP4Mh0WtMu+SvTByk6DOiHfzXYLr6zSSJAARUbzlrj kjD6ydP5t0uBV1dIpgGjhPrnGniw9UOyidTvuPa4IsEgRdpljI22OOPgCJN/kCk9QSfb O5EMC+XpCu30xXlsOgQvrsKtCBVxz2AOk/OJ6hQ9R7yQ45CpS4gt9s3UqLMt4CFCWtWs ZbS9XAsgCHCYYfHtv3jT+ZHXdv6lI/P3zxpXFTjwFVnc9qhvskRQB0KDHwO71C7CPCfu Y+uw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="ZD9J/kgA"; 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=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 d17si1608619pgp.274.2019.02.02.21.00.10; Sat, 02 Feb 2019 21:00:58 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b="ZD9J/kgA"; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727309AbfBCEXz (ORCPT + 99 others); Sat, 2 Feb 2019 23:23:55 -0500 Received: from mail-pl1-f193.google.com ([209.85.214.193]:39705 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726557AbfBCEXy (ORCPT ); Sat, 2 Feb 2019 23:23:54 -0500 Received: by mail-pl1-f193.google.com with SMTP id 101so5239307pld.6; Sat, 02 Feb 2019 20:23:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=7RbUpPibeswbGRgIY4OwIaY+jlrRtGwiAzTtQkLXwHw=; b=ZD9J/kgAtOtS798CFd+sjuexyJ60rJ8F0z+5264n6CJtjFgzfYd+Vc2CXlUfVXyf80 rcZMSQMw1Mg7EZSn3QuJsnmrmHZx3STdN9di73x5oml/9NSHAubfKNdl0R+9xsOyPUSn Ebwlx92wZkL6+Lkvte5x2lqUICakwgwrbNkqAVtP1+pzQzFJ6zNn/Dll+BdmbTF5lCxj H0n3nFLC4CEFnSc36WpO8LDvTqPz7UHj81mEkwXMQY3mkswPn2Kj08qHWqJnvxC/Y7Rq 9TRHBP4psmWdVbj6v0nCYkgwck12NIsx4PNsubNYdWVemTE34vRIRMpkntryfpPN8Kue GVaA== 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:mime-version :content-disposition:user-agent; bh=7RbUpPibeswbGRgIY4OwIaY+jlrRtGwiAzTtQkLXwHw=; b=De/FnonAMAMzpDBy2qhBI6YyTedXwyKJWV+zoU1D3IECPYR96Ov8kY69wggYsHPkiM BpohO0cIyXW058Si3CMmgs9mZhx9oAXLpk0geekvq78cMZWoRjb1irXUN03eKx/lJPWF ZxP7J3nixOVqqCxrbaNEhjDQ/K9aJNWRnriktGtV8xtZf3MsHvFLr0Eep7Zum4OxfwsW rd1AjKS/UNYp33y1G7FWxcYKhbEEx6vXvQ3rxkRSEeW9YDI+ANBFCrj3njNb4IbwklfD XqOBxyNDn6Apg8j6TjGVdjNnSi36OpB5JkAGI+0gCJ8ep9zlfbth/JK9b1JDYNQVFiIJ TVHQ== X-Gm-Message-State: AJcUukcZuV9K4qT4Xk1hsc/X2RjVaS21y9n5q5osWKgTTl1CVagYOArb E+eRsv2F/Cy5JKN1FQMCgMprRmMb1ew= X-Received: by 2002:a17:902:298a:: with SMTP id h10mr46714537plb.312.1549167833846; Sat, 02 Feb 2019 20:23:53 -0800 (PST) Received: from myunghoj-Precision-5530 (cpe-76-176-3-80.san.res.rr.com. [76.176.3.80]) by smtp.gmail.com with ESMTPSA id e9sm15230831pff.5.2019.02.02.20.23.53 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 02 Feb 2019 20:23:53 -0800 (PST) Date: Sat, 2 Feb 2019 20:23:51 -0800 From: Myungho Jung To: Marcel Holtmann , Johan Hedberg Cc: linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] Bluetooth: hci_ldisc: Add NULL check for tty set_termios operation Message-ID: <20190203042348.GA18582@myunghoj-Precision-5530> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org set_termios should not be NULL so return EOPNOTSUPP if tty driver does not support the operation. Reported-by: syzbot+a950165cbb86bdd023a4@syzkaller.appspotmail.com Signed-off-by: Myungho Jung --- drivers/bluetooth/hci_ldisc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c index fbf7b4df23ab..44ac2e9494cc 100644 --- a/drivers/bluetooth/hci_ldisc.c +++ b/drivers/bluetooth/hci_ldisc.c @@ -474,10 +474,10 @@ static int hci_uart_tty_open(struct tty_struct *tty) BT_DBG("tty %p", tty); - /* Error if the tty has no write op instead of leaving an exploitable - * hole + /* Error if the tty has no write or set_termios op instead of leaving an + * exploitable hole */ - if (tty->ops->write == NULL) + if (tty->ops->write == NULL || tty->ops->set_termios == NULL) return -EOPNOTSUPP; hu = kzalloc(sizeof(struct hci_uart), GFP_KERNEL); -- 2.17.1