From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qt1-f178.google.com (mail-qt1-f178.google.com [209.85.160.178]) (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 C64EC41169A for ; Mon, 29 Jun 2026 17:01:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782752504; cv=none; b=Yg1Lz4WBVp+MPazeRtaNg2KmVXTYYH1mYUsqi3Jbw2nvtZdLNp/Kad9+dCypcJYLrviKpmzZ3wGpQHLhO+dL0324TLmA8RZQQUuDFQC6S9Fss+dmFsgG3qMTYQ6A4dTQCm0MavoYBOT9a/St92L8Qp8EIX6Zeg4PRmjQYiswIOc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782752504; c=relaxed/simple; bh=0ZbNq3krgb6G8hdaDapKsW5xowxyl35n00VG63vlvsE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=H2PZ/BvyLMjMpzOUhtnTuSBqW/QQgl+SnWc6yOx3oD9Ndy5iez6aGnMaOV1SBNpf5eBWQXdtk86Bneum5QQO+wLtMP8KZe2znbv35zN4AxkOJVSSO8DL+twQO0rIah8vM5xiNX4Cqq8673oPf7PvGFS/rUzj8YT/c7eLSUfjpNI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rowland.harvard.edu; spf=fail smtp.mailfrom=g.harvard.edu; dkim=pass (2048-bit key) header.d=rowland.harvard.edu header.i=@rowland.harvard.edu header.b=YsFHHwbp; arc=none smtp.client-ip=209.85.160.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rowland.harvard.edu Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=g.harvard.edu Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rowland.harvard.edu header.i=@rowland.harvard.edu header.b="YsFHHwbp" Received: by mail-qt1-f178.google.com with SMTP id d75a77b69052e-51af8fda431so23386781cf.0 for ; Mon, 29 Jun 2026 10:01:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rowland.harvard.edu; s=google; t=1782752502; x=1783357302; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=YeHN7utODULOILBow3SQ4SKTKi+vOT1iFpqN2h/hBuo=; b=YsFHHwbpRsX5WjoNxm3vYRCqhksFNPQnB0Jc2ywinYZG01tXjjJH3fkHn/Div+1sMs ZhqEsZ3KP5/hCtwmCB0sggQycScKKihHnrWvN4HLpcOJuNZTlKnq+N2iGObngd0tVmR2 sNCaSLYR9ResDcJSB9fXvvlTivQR+tJU0vmOPohlYuGpV8zozEEJARYh8Cc8bA0gcbt/ mPAqGodfzl0Ws6ujYVGVqZHCS1Omy0pqmvxo2PmF2iMoXoZYTgsg4O1eIA98ZRCZYVFz SIZNs95vuTXa4A2PxaBZ2HnF6UIEM5kPpV4hO2xHaCIgQsKcJicrKhkSKSda3VKHsaRQ GEKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782752502; x=1783357302; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YeHN7utODULOILBow3SQ4SKTKi+vOT1iFpqN2h/hBuo=; b=kTR9ZdoUe4gIHWVjNGJCvd/V0IoMhSx+P/VGQlq7813b5u1MfiMUtUtKihFCDSy85u qaYs84YwgK9yFDb2DM3DfrPTyxgHmmFWAY/bmlkkGaPuXSpMELTHJg0ENdFqBmkYiWjk bbCnPwqHZgBr4fWAtW8ECddJ8lp9SXfhXFVirpjqma4ios8jiraN7PekMbFqVJPaHuAZ A5U2zpJPO432EdYTZhAj52GVFFk/RTyzOvLV3wkMTLJej8SJc890NgEv1Z5kTFxMor5K KU7dhqPOZG0WFJqzgqDW1l4IhAjHBsTWwpfLl9qNWwrl5k1ni8CRV5ExByz+yahiDdPO dEVA== X-Forwarded-Encrypted: i=1; AFNElJ+nP7tPBupKn0wNzzkWPMBh5F5Aw5RKA+FY+TfIUAOixUV9LlsE8ynGYSvH/wqRJznxmznbLoRrTLPOce0=@vger.kernel.org X-Gm-Message-State: AOJu0YyG0S/NZIHWWE/gTab0PNohwOeD0d3lUMN6gUqEFchXNcI+OGdi v1b4lNQxdOoSNvK46mi4XOyi1fpPFFDIidNIBrX629vn+CGREYXJHxIoZekPtnzdww== X-Gm-Gg: AfdE7cleYv+yeAVsq6wOP2i+U/wSiG9DaLdjI7d6Q2S2bOrF2Ncw/m7NibCFDC+UP8D cxHCK6xgUqBRXIKewONOpSdggdVUh3w1IhuCDNvKwXYOiPZT04JHLIeLP6Z9tH4snYL8GpXlIK/ cEv7QBM4s47mV9Cenx9PuLSlB2eR+9N8ZGfny7pwDJum1KJ4WTDbwGkcJn+dxXzrOjYEKBH6ZNJ BSDRdMR4NlgH9d4tKd6YxU5Tfi+Yth+q/VXfQCRwFbX5zOAfVaF5cGnVJ9ZM6ADBh1v6rGkMx7s jQiV8lQYeg0duUi2g6L/pY4Xy6ZioOdtoQqBdp03iUueDDTWvJHzzKCpr38eeLy7kFHWhGJm2qX NzhBWRUTnerG56PctoME0anuO7pUx2zrZc4gxYGHpQrO0usDQX/yoycnS8qE8JDWH4bf8IFvDbi kOoEEOZtdV2BzDoz4Xko0e1p4aSdlQ49bKMSw8Gn7Z/82jGNvdqOMj92fU X-Received: by 2002:a05:622a:551b:b0:517:8446:3afc with SMTP id d75a77b69052e-51c1074e85cmr2361671cf.14.1782752501737; Mon, 29 Jun 2026 10:01:41 -0700 (PDT) Received: from rowland.harvard.edu ([2607:fb60:1011:2006:2008:aeb7:73d7:d8ff]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-51c1080d4f4sm881251cf.4.2026.06.29.10.01.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jun 2026 10:01:41 -0700 (PDT) Date: Mon, 29 Jun 2026 13:01:38 -0400 From: Alan Stern To: Nikhil Solanke Cc: Michal Pecio , linux-usb@vger.kernel.org, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, corbet@lwn.net, skhan@linuxfoundation.org, linux-doc@vger.kernel.org Subject: Re: [PATCH v2] usbcore: Add quirk for 255-bytes initial config read Message-ID: References: <20260623161035.5792-1-nikhilsolanke5@gmail.com> <20260628231634.6752f74d.michal.pecio@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Mon, Jun 29, 2026 at 11:00:44AM +0530, Nikhil Solanke wrote: > On that note, I discovered that usb_get_descriptor just blindly trusts > the caller with the allocation of buf, it never checks if buf is null > or not. There is only a check for the size. and then there is a > memset(buf, 0, size). This results in a segfault if buf is NULL and > size > 0. Perhaps it's time for a new patch to fix this? There's nothing wrong with trusting the caller to do the right thing. Besides, if a segfault does occur then it will be pretty obvious that the caller needs to be fixed. What would you do if buf is NULL? Return an error code? That won't help anyone locate the bug. Put an error message in the log? Segfaults are much more visible. Not to mention that nobody has complained about this code failing, so it seems unlikely that buf ever is NULL. Alan Stern