From patchwork Tue Jan 23 20:50:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kyle Zeng X-Patchwork-Id: 1889895 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=DTsk6xSP; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:40f1:3f00::1; helo=sy.mirrors.kernel.org; envelope-from=linux-cifs+bounces-926-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [IPv6:2604:1380:40f1:3f00::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TKK3n5hKHz23dy for ; Wed, 24 Jan 2024 07:50:29 +1100 (AEDT) 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id D1C93B234DC for ; Tue, 23 Jan 2024 20:50:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 20EE64403; Tue, 23 Jan 2024 20:50:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="DTsk6xSP" X-Original-To: linux-cifs@vger.kernel.org Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.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 B0B1D4C7B for ; Tue, 23 Jan 2024 20:50:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706043024; cv=none; b=a0ZZRolSq3XJCrkDcqJHLUqmU7VpX3/n+LIzHPKTDxOZLmek+R0ffZQibGurwmhmb7kRfh+b4sxV9p6WFX7jKMt4wzcKcVPwucNZizI/lymPNknWL9DQY1yOkSICZ5gL7kN5WjiaviKMb7q5e8RQcg4sE7KZ74SrwG79wy66QXA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706043024; c=relaxed/simple; bh=MiYZmYYMrLmyj1MfMvdJLticCMBbB3Yg0/Tv3yNlqfE=; h=Date:From:To:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition; b=c94IUiCpQd7IBXtEb/g/2X8LLH5kZyXvcUBc70z0XkkvGKDJy5POkr7eIokVKO3TcudYim2rgJFn96KWPYs6KQXu88UegNJffYTf0yjRI2++N1SzWAaj7pOGHcP8dfHzHdk9miuSmKCiQB6uYFhnkVscNoNe1I2F1zCdYfns8Mk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=DTsk6xSP; arc=none smtp.client-ip=209.85.214.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-1d73066880eso27315895ad.3 for ; Tue, 23 Jan 2024 12:50:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706043022; x=1706647822; darn=vger.kernel.org; h=content-disposition:mime-version:message-id:subject:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=5LF7enKIFNTOUznrYEEtapJ8sft39y4HKd2BucZR1Mw=; b=DTsk6xSPTBXlpONpAYfxTe1dWk8KaJBP3OXEbqwY+mxKHjGh0p13aii/e09YZrz2t6 nlRpUUxD9/aY55pM8sgXbJHX1T108oLpaGLt+UoKm8hQ8AR8z/SZqDUIVJH3wiypztqN kjO9B+XkKMTDY7hffOHnSXA5jM0s7zauchjfVyXoOPRVnDf9lW9gY6mAidV6GV6hD2PU pS+SCXOR4H+2dEc5j+JrS1J42L9W0SY1aSwzIT3sCrZ1lnf8rFloVbkyC8xdO7j9L6Ea Vqk34WArCF6IIjHmMXB2dB2TumXj+w9crb/JRGN8uB7c+o1/gEDHhQEETFINnTn0yXeJ e9SA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706043022; x=1706647822; h=content-disposition:mime-version:message-id:subject:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=5LF7enKIFNTOUznrYEEtapJ8sft39y4HKd2BucZR1Mw=; b=lVf3F0oqDI4OxVAr066MwFJrRnqngTxHBUrqJBCy96jinBRklS84z1/IjlWo5qC5Vu ThUsmA0VdiXDT7F3RJo+ccYvNWKsT1TIUWdiT7jBLJyhXCs3aipoFl/WKrxQSaaw++px RbiFy3AB1fi4Duw0Bsizd4YSQYuBf45Rj0ed8RQgvaIKka2Z7wHQZMiB43sKiI0L6CMp NGSS9QeDfmeEXQTTCs3yclfcc9CqSqBBIxFDWxOT1xFfzpLOopeTbx9Zn6uABBVk8+ZW VsD57NvnUZy9LvxeB+EcFtR8qXmqsl8ygwq9I5TjNMFsB8w/pA/eREPy1fAzMfQZBUkw nALA== X-Gm-Message-State: AOJu0Yy8Sxc3377tQo9M8FzNC87m8iSRvbluj7GbmB64Kh8J9fW+f5/h 0jp6UdaZaj17IpV3x0C7pZTy0xnmC7CXtGE4VqlRx020TRVp0Emr X-Google-Smtp-Source: AGHT+IHdVI184z55d5YhUolFX5crq2ms343Z3EOUHGOQkMLHUdodRWz6ayfcD7zn9uBDx+Z8RFQvNQ== X-Received: by 2002:a17:902:dac6:b0:1d7:1e5d:ab41 with SMTP id q6-20020a170902dac600b001d71e5dab41mr9094949plx.29.1706043021874; Tue, 23 Jan 2024 12:50:21 -0800 (PST) Received: from westworld (209-147-138-147.nat.asu.edu. [209.147.138.147]) by smtp.gmail.com with ESMTPSA id s4-20020a170902988400b001d7180b107fsm7792973plp.228.2024.01.23.12.50.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 12:50:21 -0800 (PST) Date: Tue, 23 Jan 2024 13:50:19 -0700 From: Kyle Zeng To: linkinjeon@kernel.org, sfrench@samba.org, senozhatsky@chromium.org, tom@talpey.com, linux-cifs@vger.kernel.org Subject: [PATCH] fs/smb/server: fix off-by-one in ksmbd_nl_policy Message-ID: Precedence: bulk X-Mailing-List: linux-cifs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline The size of the policy array should be one larger than genl_family.maxattr, or it will lead to an off-by-one read during nlattr parsing because gennl_family.maxattr should be the *largest expected* value Signed-off-by: Kyle Zeng --- fs/smb/server/transport_ipc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/smb/server/transport_ipc.c b/fs/smb/server/transport_ipc.c index b49d47bdafc..185db4d7f2b 100644 --- a/fs/smb/server/transport_ipc.c +++ b/fs/smb/server/transport_ipc.c @@ -74,7 +74,7 @@ static int handle_unsupported_event(struct sk_buff *skb, struct genl_info *info) static int handle_generic_event(struct sk_buff *skb, struct genl_info *info); static int ksmbd_ipc_heartbeat_request(void); -static const struct nla_policy ksmbd_nl_policy[KSMBD_EVENT_MAX] = { +static const struct nla_policy ksmbd_nl_policy[KSMBD_EVENT_MAX + 1] = { [KSMBD_EVENT_UNSPEC] = { .len = 0, },