Received: by 2002:a05:7412:9c07:b0:fa:6e18:a558 with SMTP id lr7csp715372rdb; Sun, 28 Jan 2024 06:01:30 -0800 (PST) X-Google-Smtp-Source: AGHT+IFgfabMCOWvnQTy5IqrmTHqRAF8yQkEtdOZhSRAm6DXIJX0g4WsUbIFfh7dQ/QFW4kfoR3D X-Received: by 2002:a67:fd78:0:b0:469:bcbe:b10a with SMTP id h24-20020a67fd78000000b00469bcbeb10amr1564514vsa.2.1706450490396; Sun, 28 Jan 2024 06:01:30 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706450490; cv=pass; d=google.com; s=arc-20160816; b=l1+h91WpFH/dwS+2UB0t6gNu5kanJQFmvVtYfPE2gvpwBdjNzO5PVYPp5n6tALnoZt 4x37Go14oSaCFIGke1ZgNqc7+Uasv8Cvg7YI6CNXtWU9yZUTjbKQLeuocfPI8c4yYVqn +vYiifhkcld9FAgdgCQzaq3Y9jWUOmlsrqX4K+dJdhNqMaCy0qn7DXCbCbVnv0hDTSz8 d3xVq9EqkIWNx+dB8aIdts9oU1oC0Ic+AoDumDbylK0jqbqD3LVDwCaa/v34PN6Va6Qi giYRVGNlKw9LF3GfW+1ABqgu2wmYIG0YWrHAWI7tG2yLu6KxhXb/iLq85y7SXt4Ycg/O AmuQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=avMCpwuFUa2i4x7tiD4dco/h0z+G0ypjNSRfns11g5c=; fh=0SoZJkq1yTADcKpDtNIfWc+oVzipqmXN3DJ1O6R9z1g=; b=ba2rT6GlUvwxjRHoCfmEeQV7pioTlxkog8cpqrQGgixSNJya9z8cc8sxA/zSwiBWrd 5rleYJnHfv9yPVZVYaZ7vEJJXxLijlgP2oPiaX7XDR3n8jo61SG18RIQnSKylq1Z9Z1c 2mU0Fy5b6dHahGHnM8yHDJbSL2dBCi0v9jDV+/5OMwEy4TYCbGQGOAXqZEQCnau/3vQL IV4XWSSEP3cD3H1pJG/M+qntG9xINkaQy6Z1Xynojqf2aQQayMPdUonAa/M7BxcsAFJn N/+Id7TDS3jwTRGo6KrW0y3Wp8i9nE4s9hHcrdX4yucylk3p5fzBxx4cs/W3oZz+1iZh uQTg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=Be6XmJOE; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-41638-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-41638-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id ic3-20020a0561024b8300b0046af6bb0ff3si620720vsb.727.2024.01.28.06.01.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Jan 2024 06:01:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-41638-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=Be6XmJOE; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-41638-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-41638-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 1C9B71C223C6 for ; Sun, 28 Jan 2024 14:01:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 04135241EA; Sun, 28 Jan 2024 14:01:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="Be6XmJOE" Received: from mail-qt1-f175.google.com (mail-qt1-f175.google.com [209.85.160.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A883623745 for ; Sun, 28 Jan 2024 14:01:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706450480; cv=none; b=p/m5Nfq5Sfz2X0vaJ3PztWx44ym1Ek3loqYksPk2V01MSK2MNAn24k7rID6fJ2LipDUdBjnpe2e6XNKUmTGgYPCOXd+PbegLTw74iMg/eDegv9jwzi4JLwNbL2lwYU3mLR+OTuM1k7FFEzmgwrCFfqx2Fgh4tEQdj0HpnpTvWZ0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706450480; c=relaxed/simple; bh=avMCpwuFUa2i4x7tiD4dco/h0z+G0ypjNSRfns11g5c=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=C8LMxRAZT/KnEUuLTL0IrzTADjKDGTwx7K1sZ/0IvG/5vKqe2Bb82nrxkl+T5NKpjBuTqo5Jcr3tKFtYsSgbnikjFy5k16Fx+/xDrjU+Rj9iNONFXDvZk832e0mqK0TdVcnxJ4+sjtn/elKRq3hKBfmYWIz9skysrkSEJOqmsO0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=Be6XmJOE; arc=none smtp.client-ip=209.85.160.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Received: by mail-qt1-f175.google.com with SMTP id d75a77b69052e-42a99dc9085so91071cf.0 for ; Sun, 28 Jan 2024 06:01:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1706450477; x=1707055277; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=avMCpwuFUa2i4x7tiD4dco/h0z+G0ypjNSRfns11g5c=; b=Be6XmJOE95K8C9Hr0UPrko3RJZJYUNa/4ZDDUa8aYeKyh+1QVM5hWE0V5HDmcZ3gXh BCRX1HHdEQ6Bq5b/FnuMA8uWL0eVrVw1POtn6hT8DgHP4to8breZqXfCY7dVjotRLN0w GjWEx6DH0mSE8xH1e9h0MDLxVDQLkzOasfwLGI/ykBn+Wh65WEhHQVq97IC57B83cTZx ZKw2TObQ6VeU+5p4qgC6DvA88bSXyc3RsG7/NdTr7QAdOdOIhdLrGf9iTBl4wEsGdKYX RfNELY5Kr/Tnv26j3/CIUZYknhIx/KAtaaNpFJpeYhcNieIRS9TTUgJfX0+Vt8k1Io9v CsOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706450477; x=1707055277; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=avMCpwuFUa2i4x7tiD4dco/h0z+G0ypjNSRfns11g5c=; b=mHcgfitBEm6x/RW6QZUFxJE1HHUrVo2skIVesDleuUe53PNarSNnX6RqdN/zKamsh8 j3zo/Y5KEsisvpkMwBr4R6F1YJRmadH9blykYr3KheRocZCSIvi4WcLQs6YmiEHAkH+m 9yBxWpiTsZae9II5ZQkuNencxWqFnmij8UlC9P8lpIlBTNkSkBF74FxxstEogySjqhby rQoyTSaS0JI6oCxAMqcl9R1MYgKpz3fYjxFg65y+j9BWWEWTG3ntFjwvCFBLyPMjj54R vxb0fbKmtqTU2t/3TZuFmpSegS+8wCWpJmZwAsa7GAqe7BXUiI7RP6/YFMCUNrQ0HP5E f8EQ== X-Gm-Message-State: AOJu0Yy/Ao10N+SxXs837f3ZdthsZaY73OltJg8Dcb+EwcfEaofERdUw wogpkwnMUQNUjjYSI/cRgZ9kv19WszeVlr3mXrbEd1jrPQogzpvtcH5/25pg1ED53yeGzQShQCS QO3GBk9BV3UWsnAsthDAiXEJMqScSjdzrUl+j X-Received: by 2002:a05:622a:1bab:b0:42a:6b64:da7f with SMTP id bp43-20020a05622a1bab00b0042a6b64da7fmr402749qtb.27.1706450476977; Sun, 28 Jan 2024 06:01:16 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240116141801.396398-1-khtsai@google.com> <02bec7b8-7754-4b9d-84ae-51621d6aa7ec@kernel.org> <2024012724-chirpy-google-51bb@gregkh> In-Reply-To: <2024012724-chirpy-google-51bb@gregkh> From: Kuen-Han Tsai Date: Sun, 28 Jan 2024 22:00:49 +0800 Message-ID: Subject: Re: [PATCH] usb: gadget: u_serial: Add null pointer checks after RX/TX submission To: Greg KH Cc: Jiri Slaby , quic_prashk@quicinc.com, stern@rowland.harvard.edu, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Hi Greg & Jiri, >> Or you switch to tty_port refcounting and need not fiddling with this at all >> ;). > I agree, Kuen-Han, why not do that instead? Thanks for the feedback! I agree that switching to tty_port refcounting is the right approach. I'm currently digging into tty_port.c to understand the best way to implement this change. Could you confirm if I'm on the right track by using tty_kref_get() and tty_kref_put() to address race conditions? Additionally, do I need to refactor other functions in u_serial.c that interact with the TTY without refcounting? Regards, Kuen-Han