Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp3420641pxy; Mon, 26 Apr 2021 01:01:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJybNUJOmtzDm2+xc058LFfy6f6oAca7Y0QfJAOiHsN1MNhx5W25r20UcG3t9RJ3cQs1knY/ X-Received: by 2002:a62:868e:0:b029:265:e138:c010 with SMTP id x136-20020a62868e0000b0290265e138c010mr16920749pfd.10.1619424105629; Mon, 26 Apr 2021 01:01:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619424105; cv=none; d=google.com; s=arc-20160816; b=QX4/SojGavsINqdPMe1R7kPQ5BM8qWBMZxHm/U8j+atuHoxAKiKJLcazlvt/3er7CZ CTYRAVgYMz89MDP5JXaDE+Fk0FM3tBhupwYkdAkWEeU2XCURKW0xfJIvtwJJVsgzJ4bg 1tIUbaXR3FY2bApmP+z8fET9hK8iWl7aPQ1NmK4ojLvX4B/jMo4H39ItY/cz3FLkW7wO ddTqUBxVPQOFYxJO/2JYoCnph5gAUEwSzn69O+QG1Jwtnpj9n0oiIVT9yYPCTWgi5Jhi y0D47cHoip71+Fi1sXZM8pu9acWwAJ8Z2GRkHEaCjeaHij7EkpMyFB3Gzavx1PmzOHbM C8oQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=4aY0uo4YpTlKtUxgUDmD3UbCosve7Ef11X4TbNWfi6Y=; b=UwHmaIjdMuai0dwVbM+voqkVodiCEq9wjD7Mc26EvWdamlkVBJVG+AGbh1KlruquCU qPTqxjlYCtBoEGqDXgxUZ4spK+p3+72rslglr23EdiF1q5eXwv/wj7AlQEmDT3fsPqc3 7mbQpZaJJaO5DJr3M52xpA4/KKOIXMuo6J0Iq3IPSaB7h4E00Xxh8Rbn29kcBHhpGiLy MBghc9nhj82Q/C6R/YMymog9rNe+bZBuOxxidfv1qxL0V3I+GZ7+laq/xSHI/S75ITFe ak8ngzyi5EqvRWs1/6slYJv/XSA+z1k6VcszSXxl9WGfDBRGBs/FhjF96/EPSBF3oTWW PMRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2uhIz5tl; 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 a22si17149357pgm.545.2021.04.26.01.01.32; Mon, 26 Apr 2021 01:01:45 -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=2uhIz5tl; 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 S232675AbhDZIAa (ORCPT + 99 others); Mon, 26 Apr 2021 04:00:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:50804 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232259AbhDZH7C (ORCPT ); Mon, 26 Apr 2021 03:59:02 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 48B5D608FC; Mon, 26 Apr 2021 07:58:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1619423900; bh=OHEGpQxJ+wMTvR+n4XwSvOVejv7FUdKkMqp79g1wzWw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=2uhIz5tlD/X05k36ymbO8QLlZKfebgciaI+guAsZ8mn9Uw1Xdwak4LDFHgEZHFsJ6 vNnAtJB5G2CaKxp9Dh+lrW2X4XtYNrOcCwpCAMOAQn9YmO7VQBSwpXYJ90B5C7W9lK GqbVYk4usJm1l+EvBXmfJv1DyOfdIZ5UAZanW+no= Date: Mon, 26 Apr 2021 09:58:18 +0200 From: Greg Kroah-Hartman To: Johan Hovold Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, syzbot+c49fe6089f295a05e6f8@syzkaller.appspotmail.com, Anirudh Rayabharam , "David S. Miller" , Sudip Mukherjee Subject: Re: [PATCH 4.4 22/32] net: hso: fix null-ptr-deref during tty device unregistration Message-ID: References: <20210426072816.574319312@linuxfoundation.org> <20210426072817.327441466@linuxfoundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 26, 2021 at 09:36:57AM +0200, Johan Hovold wrote: > On Mon, Apr 26, 2021 at 09:29:20AM +0200, Greg Kroah-Hartman wrote: > > From: Anirudh Rayabharam > > > > commit 8a12f8836145ffe37e9c8733dce18c22fb668b66 upstream > > > > Multiple ttys try to claim the same the minor number causing a double > > unregistration of the same device. The first unregistration succeeds > > but the next one results in a null-ptr-deref. > > > > The get_free_serial_index() function returns an available minor number > > but doesn't assign it immediately. The assignment is done by the caller > > later. But before this assignment, calls to get_free_serial_index() > > would return the same minor number. > > > > Fix this by modifying get_free_serial_index to assign the minor number > > immediately after one is found to be and rename it to obtain_minor() > > to better reflect what it does. Similary, rename set_serial_by_index() > > to release_minor() and modify it to free up the minor number of the > > given hso_serial. Every obtain_minor() should have corresponding > > release_minor() call. > > > > Fixes: 72dc1c096c705 ("HSO: add option hso driver") > > Reported-by: syzbot+c49fe6089f295a05e6f8@syzkaller.appspotmail.com > > Tested-by: syzbot+c49fe6089f295a05e6f8@syzkaller.appspotmail.com > > Reviewed-by: Greg Kroah-Hartman > > Signed-off-by: Anirudh Rayabharam > > Signed-off-by: David S. Miller > > [sudip: adjust context] > > Signed-off-by: Sudip Mukherjee > > Signed-off-by: Greg Kroah-Hartman > > --- > > drivers/net/usb/hso.c | 33 ++++++++++++--------------------- > > 1 file changed, 12 insertions(+), 21 deletions(-) > > We just got a regression report against this one. Perhaps better to hold > off until that has been resolved. > > https://lore.kernel.org/r/20210425233509.9ce29da49037e1a421000bdd@aruba.it Good point, I'll go drop this from everywhere. greg k-h