From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f199.google.com (mail-pf1-f199.google.com [209.85.210.199]) (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 597B7284690 for ; Thu, 15 Oct 2026 00:19:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.199 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792023543; cv=none; b=KlpNgvTBzv1QIJTsKF9OULQqva+gI2hzp3J7vyjnooUgkr99Rt4Hr9IlwYWMIKOtIlxKmch9AScVLX97v9wKHb3oC5hpvlt0Gjrh9VqC8CxmTd6BYQhjBt7rwqThCHOGxEH/p65Qq/gxxYy/0Z1z4wXLVWNxNRRRbLFm+JF+iAo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792023543; c=relaxed/simple; bh=IC2lDV9WNEqtclP/jcjJmWPLdt1/GsUvk50NXKl+4UA=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=fJ4JWENag4S38xMumn/0NhT/I7Z7GbwhQSIAqcpyaIcnKpdZBEVmmACvFoPGfHBp/AfpTx9nTG6XyxXYb8NdebUNVtkEIz/e2U7rzQTtuUjK6wlItInsPImRZcHDMvdrznN8a5hdX+mHXulSi6feZYKa3Dv0qVi3TPhqeFzKeV0= 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=BUeyU87Q; arc=none smtp.client-ip=209.85.210.199 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="BUeyU87Q" Received: by mail-pf1-f199.google.com with SMTP id d2e1a72fcca58-89b52a188c1so381329b3a.0 for ; Wed, 14 Oct 2026 17:19:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1792023542; x=1792628342; 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=SRWH2GXBp6X7LfF5Fg6aMonghPEzLTm3PzIwrXZ3CQo=; b=BUeyU87QqQU8N+IzSpZy+SGOTssUa6844mWbJbW1sI7il+B0CICpe7qw05v0tePHLA IM4xNi7o6FzyNpPDGdy0zz+MBWqD9VB/mgIVF01Hb4G6BP3c0Ejf3ezPyNCs+OaFIW2v N6mlInPj5dhy3UL81cuu0RUiNvPH96kRmF7NRgOyXg2Ju9hs1hY/6Cyse3a6U0owiD+B x6u1YFsW8GB0jyyVxkhj9XnnMGCJrTzf5dkPoyukzO7jysTbESGoD6k9qy77wC1lydBm BYEkkLFKWrk6GPTr/QXqqhQTa9CFbiw3lBNv7igfyjgWkpTMLFDDnfzf3qVL+hNXpVsl LHpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1792023542; x=1792628342; 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=SRWH2GXBp6X7LfF5Fg6aMonghPEzLTm3PzIwrXZ3CQo=; b=uMEVW3PhkFkwJLOpsk/RP/YiEB9bJNwEchMEaXxKVdgEzBjJ7RBpHraEDznSI49NGz v9jRV1l6jyH8+T1gHaotjpfFmn3EsBGUKoszg4VL13unFsqaDM8MziI6sv/jnx2+bH8p 2xORyfnnblnQsJuF3V3j1uer4gWRAod+2LUWVJofHnHg8OARrSk6uyW5RbWanplOzrDl uMZuzgXcplxkfKw7ln4CvKBTZkfSz2o3QUd3rKdx6k4+iCwgBs52782OohOTJvFevwTI KRwppwPY1OUGXp6BKSFs02Ia/5y5EovU/tkvtCPY+XpxNWc4N9WJ8ugDG8mJ1oXLUXwB vjNg== X-Forwarded-Encrypted: i=1; AKwUvBw3sTMJ15MpazetD/+BS/gAP3839Q6pzjXbApXoYf0hecooba9aWVjRrcElvNXbJWCMMDutC7AUyTvw3H8=@vger.kernel.org X-Gm-Message-State: AFq9FYLgHU+2qEzyYUz08irZYkexnvwXMjZiTs+GumE9/x2HaVu7fwoF ZB2ySqpXbFHAwZenOkcHAHiGHDdT6P4AChGDpnR3Hm95HZ8dn/xd29nbFqoYGeaeU17fikirjiB YBBJT9KTX2QdbRgmKVFrlpQ== X-Received: from pfblh4.prod.google.com ([2002:a05:6a00:7104:b0:87c:6ff0:4192]) (user=stanleyjhu job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a00:298b:b0:89e:43ee:654d with SMTP id d2e1a72fcca58-89e43ee6e5cmr818714b3a.5.1792023541357; Wed, 14 Oct 2026 17:19:01 -0700 (PDT) Date: Thu, 15 Oct 2026 08:18:52 +0800 In-Reply-To: <20261015001855.3450573-1-stanleyjhu@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20261015001855.3450573-1-stanleyjhu@google.com> X-Mailer: git-send-email 2.56.0.385.gd3acb90ef8-goog Message-ID: <20261015001855.3450573-3-stanleyjhu@google.com> Subject: [PATCH v2 2/5] scsi: ufs: bsg: Clear the reply buffer before use From: Stanley Jhu To: "Martin K. Petersen" , "James E.J. Bottomley" Cc: Alim Akhtar , Bart Van Assche , Bean Huo , Peter Wang , Brian Kao , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Content-Type: text/plain; charset="UTF-8" The reply buffer is allocated once per tag and reused. Requests that complete with a positive status do not fill all of it, so user space receives bytes from an earlier request on the same tag. Clear the whole reply buffer on entry to ufs_bsg_request(). Fixes: 95e34bf930ea ("scsi: ufs-bsg: Add support for raw upiu in ufs_bsg_request()") Cc: stable@vger.kernel.org Signed-off-by: Stanley Jhu --- drivers/ufs/core/ufs_bsg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/ufs/core/ufs_bsg.c b/drivers/ufs/core/ufs_bsg.c index 18c318d78122..545ef7b79ceb 100644 --- a/drivers/ufs/core/ufs_bsg.c +++ b/drivers/ufs/core/ufs_bsg.c @@ -140,7 +140,7 @@ static int ufs_bsg_request(struct bsg_job *job) int ret; bool rpmb = false; - bsg_reply->reply_payload_rcv_len = 0; + memset(job->reply, 0, job->reply_len); ufshcd_rpm_get_sync(hba); -- 2.56.0.385.gd3acb90ef8-goog