From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-183.mta0.migadu.com (out-183.mta0.migadu.com [91.218.175.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BD10D3D4113 for ; Tue, 3 Mar 2026 15:14:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.183 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772550858; cv=none; b=B+QvqBLpeAZ/x3iLSz4sTM5Ge/AmeSto91gpi/u+U1lhtH1C5reMJb3rZL4TrhLkYO7/sLQkkP48aPUG/QduVA7XUZv0JZXWokTqhHI9bpJqro+4GY1bqxiBk2IUU3A3/S1DHj2eyc2r+JjCuV4HbLP8U9UkE8p1R/KHpRNlgKA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772550858; c=relaxed/simple; bh=0qMBqeOS47WUpefhhoYdwSF2ZduO/cqVaZK7M36p10g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cu7bMa6CQiV/Jqu/yEPnFgv+FFCQs4LSI2GlJSXekGdZTc90asE3d6pF/ltR4MtyUuJvW7BuQLc2dC4ApFotfTPSkw/l9HVzCFTkkjz9XMsvEcA8hWUf4ucIanX5qDK5NdBBBq0X/2ibSrd2judKpVv3N4DrOAFPDkpkD/TMLjY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=H3eGm9qh; arc=none smtp.client-ip=91.218.175.183 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="H3eGm9qh" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1772550851; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WX+xT5B12Gmh3aF5swbENCNHMBeNw2RRHgQuJPLMv4g=; b=H3eGm9qhyKn/qTORu3hwmlooq1AMIL4kozqwdfuAwaiFOF0a3qFJbBI9WLdnVsMlPsnMZc fs38lrQ1y1pMemVXmQG0trgYVp1Sbm9/HglIM7f22zcnT0cvp2Bas+rloHXl0UK5N2Aj1U sH5Tq+Naax+ALYrdqw0IPdQ1aORtsd0= From: zhang.guodong@linux.dev To: smfrench@gmail.com, linkinjeon@kernel.org, pc@manguebit.org, ronniesahlberg@gmail.com, sprasad@microsoft.com, tom@talpey.com, bharathsm@microsoft.com, senozhatsky@chromium.org, dhowells@redhat.com, chenxiaosong@kylinos.cn, chenxiaosong@chenxiaosong.com Cc: linux-cifs@vger.kernel.org Subject: [PATCH v5 1/7] smb/client: fix buffer size for smb311_posix_qinfo in smb2_compound_op() Date: Tue, 3 Mar 2026 15:13:11 +0000 Message-ID: <20260303151317.136332-2-zhang.guodong@linux.dev> In-Reply-To: <20260303151317.136332-1-zhang.guodong@linux.dev> References: <20260303151317.136332-1-zhang.guodong@linux.dev> Precedence: bulk X-Mailing-List: linux-cifs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT From: ZhangGuoDong Use `sizeof(struct smb311_posix_qinfo)` instead of sizeof its pointer, so the allocated buffer matches the actual struct size. Fixes: 6a5f6592a0b6 ("SMB311: Add support for query info using posix extensions (level 100)") Reported-by: ChenXiaoSong Signed-off-by: ZhangGuoDong Reviewed-by: ChenXiaoSong --- fs/smb/client/smb2inode.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/smb/client/smb2inode.c b/fs/smb/client/smb2inode.c index 195a38fd61e8..1c4663ed7e69 100644 --- a/fs/smb/client/smb2inode.c +++ b/fs/smb/client/smb2inode.c @@ -325,7 +325,7 @@ static int smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon, cfile->fid.volatile_fid, SMB_FIND_FILE_POSIX_INFO, SMB2_O_INFO_FILE, 0, - sizeof(struct smb311_posix_qinfo *) + + sizeof(struct smb311_posix_qinfo) + (PATH_MAX * 2) + (sizeof(struct smb_sid) * 2), 0, NULL); } else { @@ -335,7 +335,7 @@ static int smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon, COMPOUND_FID, SMB_FIND_FILE_POSIX_INFO, SMB2_O_INFO_FILE, 0, - sizeof(struct smb311_posix_qinfo *) + + sizeof(struct smb311_posix_qinfo) + (PATH_MAX * 2) + (sizeof(struct smb_sid) * 2), 0, NULL); } -- 2.52.0