From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f69.google.com (mail-pj1-f69.google.com [209.85.216.69]) (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 1744813CF82 for ; Thu, 15 Oct 2026 00:20:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.69 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792023603; cv=none; b=g5wL1l3M0sVmFYySzkoxvm6DRXbGuPtHWd1LfZAsro8BdFhHhoadO9jvrLzZulI5wIIZZxSTx9b4d4WblpQj181DNGcnNGLSdbvnlr9O9d/rjmN0EUflRnUmg3yF9WDNvuK0KnLwpdHjhvI7n4pkA9psM/vzatUXP/M61C1Rvbc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792023603; c=relaxed/simple; bh=hT9C8KpbWvhuKNsWMFmwkxNYGUnSTIDYXUV4/uXNbho=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=lWWUwXW5AN5y46HIG86xgf65W2WrAghny/BHVhMC8PullN534oAIcd4e8X22WaNb4lWREP3kGjRtCLTI0RxPfTwA3EYLIrEaJ1Co/wFLMNFBgd3GlF2jwIjSwC33KGOvF8oEVvmXX6xJRz3sIrBgiIMtq2QgZ5SGmymeesDReBs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--stanleyjhu.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=eF64rZKq; arc=none smtp.client-ip=209.85.216.69 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=flex--stanleyjhu.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="eF64rZKq" Received: by mail-pj1-f69.google.com with SMTP id 98e67ed59e1d1-3a47617a0b3so4415862a91.2 for ; Wed, 14 Oct 2026 17:20:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1792023601; x=1792628401; darn=vger.kernel.org; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:from:to:cc:subject:date:message-id:reply-to :content-type; bh=c63/iXJr8hVZch+xmWANZyQNFENMpYcROr3AAHKmacE=; b=eF64rZKqiBB1tAQasG7iSWR5w7CFmUFF76Y2xi/uiyrmcvazPjvVoqO2JH6dPsTFAv 9Fp09Ev/1pgWxUjG3fqW4KybzZp7tckWpGfp3kIHhOS6wmELUfKN+RjvhLxzzLoXGion B4Ay6VuOmuOryQaz4qM9FLpDwpvQLGBWW2tTNuwMJOdGBOkWW676Fl777MsE4oNpzBjI LZZzoWZ092iYtym07V3I7zjxH20rYJrYi1vJFd9VsRCaKNsPC8vgVtObyi1Epi1a1qPN HJExF5rf+y6dmPy9pNx1BotHhSRFptQrjH6QGp5egyZZQmFFR30P10f7F5Pgcm9hADzy vGxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1792023601; x=1792628401; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=c63/iXJr8hVZch+xmWANZyQNFENMpYcROr3AAHKmacE=; b=0dZk5ehphPKZwfe05Lwj96JBIHlKxPjzqj0O5/dx7hQKx9g2uUfE6JclNZGL/XnjGP LMbH00PdiqDNjv6d/t/5buEGnPui4nwDOyEkl6gDl4IQVUg/oJTWYd9kufws/SLlYoBG u6z21rAmzW3BZAnpBWh+lQ5rxwOG2CBD2eUPAJMh9BNU299yyl7e0pu+fN8zZlrw4rEj qdjR3VFZoyt/kuWj4H6B05KCccnwU4SvP3xISU1AWmNdR75+DWdbmkRuSXK+5jZl1Pzf HwPTYvjcDfErfCiI0NpkbhR9ANT9ksjK/R4PeqmlvB9Cmpgy7xJ2tce+yBfQKgIFIFyQ NGug== X-Forwarded-Encrypted: i=1; AKwUvBwMVyWF9ppxyFSDWCsZywKWBoS0xwKmUHT2cqQ0NNU29UfhqycOxstDkx2qNCD5TBYJWmtae1cV3jVQAvU=@vger.kernel.org X-Gm-Message-State: AFq9FYK8Qjkwpd1XzSu5/KNrf+gzouC7RcFvBSgu1ei0u2SOaP4atAb9 xNRqJA9NAK5Ik5wPd+ZCb8gS332SKRpzHnguu15buUkGwnZCmwJBXjDY/euMfWnUUHoi96kHFEA IgYiCfwHCtkGFZ6R+sa4HSA== X-Received: from pgdo18-n2.prod.google.com ([2002:a05:6a02:6212:20b0:cc7:b455:d1fe]) (user=stanleyjhu job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90b:2ec3:b0:3a8:240e:b493 with SMTP id 98e67ed59e1d1-3ab3acf5c6amr14581156a91.45.1792023601145; Wed, 14 Oct 2026 17:20:01 -0700 (PDT) Date: Thu, 15 Oct 2026 08:19:59 +0800 In-Reply-To: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: X-Mailer: git-send-email 2.56.0.385.gd3acb90ef8-goog Message-ID: <20261015001959.3452983-1-stanleyjhu@google.com> Subject: Re: [PATCH] scsi: bsg: Pass reply_len to bsg_setup_queue() to fit UFS ARPMB replies From: Stanley Jhu To: Jens Axboe , "James E . J . Bottomley" , "Martin K . Petersen" , Bart Van Assche , Alim Akhtar Cc: Sathya Prakash Veerichetty , Kashyap Desai , Sumit Saxena , Sreekanth Reddy , Lee Duncan , Chris Leech , Mike Christie , Bean Huo , Christoph Hellwig , linux-block@vger.kernel.org, linux-scsi@vger.kernel.org, mpi3mr-linuxdrv.pdl@broadcom.com, open-iscsi@googlegroups.com, linux-kernel@vger.kernel.org, stable@vger.kernel.org Content-Type: text/plain; charset="UTF-8" On Tue, Oct 13, 2026 at 01:39:40PM +0000, sashiko-bot@kernel.org wrote: > Since job->result is 0, this check is bypassed and the full bset->reply_len > bytes of the uninitialized or recycled job->reply buffer will be copied to > user space. For UFS Advanced RPMB, this could leak up to 104 bytes of the > previous request's data. > > Should the reply buffer be cleared when initializing the job, or should > job->result be explicitly set on all error paths? This is pre-existing in ufs_bsg_request() and not tied to the new reply length; the same happens today with the 96-byte buffer. The other BSG transports complete the job via bsg_job_done() on error. Both points are fixed in the UFS BSG series v2: - 1/5 completes failed jobs via bsg_job_done(), so job->result carries the error. - 2/5 clears the reply buffer on entry to ufs_bsg_request(). https://lore.kernel.org/all/20261015001855.3450573-1-stanleyjhu@google.com/