From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48349) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1akUeE-0007W8-4u for qemu-devel@nongnu.org; Mon, 28 Mar 2016 06:43:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1akUeC-0002cP-UV for qemu-devel@nongnu.org; Mon, 28 Mar 2016 06:43:50 -0400 Received: from mailhub.sw.ru ([195.214.232.25]:43103 helo=relay.sw.ru) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1akUeC-0002aK-HY for qemu-devel@nongnu.org; Mon, 28 Mar 2016 06:43:48 -0400 From: "Denis V. Lunev" Date: Mon, 28 Mar 2016 13:43:16 +0300 Message-Id: <1459161798-32120-2-git-send-email-den@openvz.org> In-Reply-To: <1459161798-32120-1-git-send-email-den@openvz.org> References: <1459161798-32120-1-git-send-email-den@openvz.org> Subject: [Qemu-devel] [PATCH 1/3] NBD proto: forbid TRIM command without negotiation List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: nbd-general@lists.sourceforge.net, qemu-devel@nongnu.org Cc: den@openvz.org, Pavel Borzenkov , Alex Bligh , Wouter Verhelst From: Pavel Borzenkov There is a loophole in the protocol that allows a client to send TRIM request even if support for it wasn't negotiated with the server. State explicitly that the client MUST NOT send such command without prior successful negotiation. Signed-off-by: Pavel Borzenkov Reviewed-by: Roman Kagan Signed-off-by: Denis V. Lunev CC: Wouter Verhelst CC: Eric Blake CC: Alex Bligh --- doc/proto.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/proto.md b/doc/proto.md index 6d1cb34..d54ed19 100644 --- a/doc/proto.md +++ b/doc/proto.md @@ -471,6 +471,9 @@ The following request types exist: about the contents of the export affected by this command, until overwriting it again with `NBD_CMD_WRITE`. + A client MUST NOT send a trim request unless `NBD_FLAG_SEND_TRIM` + was set in the export flags field. + * Other requests Some third-party implementations may require additional protocol -- 2.1.4