Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp379888pxy; Fri, 30 Apr 2021 07:23:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxC6ZYvEmvq1Bq7OWI91X72DQr6cXm2P4I47qtol36tFwy9W44+ohghi1Sm5Xx4JWQLU94Q X-Received: by 2002:a17:90a:f009:: with SMTP id bt9mr5553068pjb.137.1619792637949; Fri, 30 Apr 2021 07:23:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619792637; cv=none; d=google.com; s=arc-20160816; b=zyBuGGiP4ZCdqRqj8GWusCQ8ent7K72l1IC8XaAz+7aF8/hRXGXOUUHUhbQtUVbcBk Nw+nBH+0LXRcfeDrsvj/HD7pw8YkIMKuWigGyrW0z4DblO1ZMCn6yrJqNaGUgRvXLrK5 ueVqZAZvk3ywo0BsA0LP06BExI5pPXlgz5wpFo/t9OTGr9b1ZlNKqifXIrj+u3FHk/eW ZIPqs09rLN4MBd39ujD1Ms9yNVEBLtHnO6bBq/8/wQ48iybqnYs+VBluRoWMP6jpxRV+ Fk1Cye2nC4ZW9w83GEZpFToiue2qMYbdP2YlOy73lj0iq+7mdoL/uSz2B6ySc35txdBc WL/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=9yGNgTQ+3ZmlzH9FW7zeWbbr/WqTXj6Ee9PmO4ZPuGE=; b=X69CbVywDXZNybL8wLeWZzJHoClLIBaHLdZCGsCl+X5rUQ5uzPpzUpz4FrrK+OryDb 8r76+EZ9NrwkctdcLIWUjh+S/naEvcgykWITh247X6JBbRxj0XclV7ekryziYasDcWlO V6Mc0K4uekO3uTi45WNynIAvCfZ/IdDxbtfzdIvMWTEvuHgLmlVUMOIMVa+ehwXzlyOg cuKcjAOaRsZwAb6AnikNcZmxlgxjRZi18a86fpktk1ZOslkRkqIq/NZjknPPeyFvgtf3 vCqAz/mG3Mq1G/rLLxofmSNbT5UnwhEEuBoDTAdSOTGWH+tX2Bu4ZI5MKyf/H8ZPwUSg /q+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yvKTLv3m; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d15si3506108pgt.242.2021.04.30.07.23.45; Fri, 30 Apr 2021 07:23:57 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yvKTLv3m; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233473AbhD3OWN (ORCPT + 99 others); Fri, 30 Apr 2021 10:22:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:58446 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233278AbhD3OV7 (ORCPT ); Fri, 30 Apr 2021 10:21:59 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 20628613A9; Fri, 30 Apr 2021 14:21:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1619792471; bh=zpIW2u9iH5OdC5H6HFelvBfnbS5UkEcsuLSmrlKJ6oI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yvKTLv3mk+oNpdxwL9sS00MV5l2mNV3dFNusAtTFio4HfxLqGf4ApPJ4AsUr92jho 9j4Rj59XF/AWo+27jQv6a83UO2kxgPVLy2ntxCcAtzKyCfQIF3XYhypV3uKiQ89ddS brONsUAYUXN/01aoUMbFSvFaAMRqF9s6o4rBaRBk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Anirudh Rayabharam , Leonardo Antoniazzi , Johan Hovold , "David S. Miller" Subject: [PATCH 5.12 1/5] net: hso: fix NULL-deref on disconnect regression Date: Fri, 30 Apr 2021 16:20:56 +0200 Message-Id: <20210430141910.945061629@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210430141910.899518186@linuxfoundation.org> References: <20210430141910.899518186@linuxfoundation.org> User-Agent: quilt/0.66 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Johan Hovold commit 2ad5692db72874f02b9ad551d26345437ea4f7f3 upstream. Commit 8a12f8836145 ("net: hso: fix null-ptr-deref during tty device unregistration") fixed the racy minor allocation reported by syzbot, but introduced an unconditional NULL-pointer dereference on every disconnect instead. Specifically, the serial device table must no longer be accessed after the minor has been released by hso_serial_tty_unregister(). Fixes: 8a12f8836145 ("net: hso: fix null-ptr-deref during tty device unregistration") Cc: stable@vger.kernel.org Cc: Anirudh Rayabharam Reported-by: Leonardo Antoniazzi Signed-off-by: Johan Hovold Reviewed-by: Anirudh Rayabharam Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/usb/hso.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/net/usb/hso.c +++ b/drivers/net/usb/hso.c @@ -3104,7 +3104,7 @@ static void hso_free_interface(struct us cancel_work_sync(&serial_table[i]->async_put_intf); cancel_work_sync(&serial_table[i]->async_get_intf); hso_serial_tty_unregister(serial); - kref_put(&serial_table[i]->ref, hso_serial_ref_free); + kref_put(&serial->parent->ref, hso_serial_ref_free); } }