public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] tools: hv: fcopy_daemon: Check buffer limits
@ 2014-10-21 11:49 Matej Mužila
  2014-10-21 12:13 ` One Thousand Gnomes
  0 siblings, 1 reply; 6+ messages in thread
From: Matej Mužila @ 2014-10-21 11:49 UTC (permalink / raw)
  To: kys, devel, linux-kernel

From: Matej Mužila <mmuzila@redhat.com>

Check if cpmsg->size is in limits of DATA_FRAGMENT

Signed-off-by: Matej Mužila <mmuzila@redhat.com>
Acked-by:  K. Y. Srinivasan <kys@microsoft.com>
---
If corrupted data are read from /dev/vmbus/hv_fcopy, pwrite can
read from memory outside of the buffer (defined at line 138).
Added check. 
---
@@ -104,6 +104,10 @@ static int hv_copy_data(struct hv_do_fcopy *cpmsg)
 {
 	ssize_t bytes_written;
 
+	// Check if the cpmsg->size is in limits of DATA_FRAGMENT
+	if (cpmsg->size > DATA_FRAGMENT * sizeof(__u8))
+		return HV_E_FAIL;
+
 	bytes_written = pwrite(target_fd, cpmsg->data, cpmsg->size,
 				cpmsg->offset);


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-11-07 18:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-21 11:49 [PATCH 1/3] tools: hv: fcopy_daemon: Check buffer limits Matej Mužila
2014-10-21 12:13 ` One Thousand Gnomes
2014-10-21 12:59   ` Matej Mužila
2014-10-21 14:17     ` Dan Carpenter
2014-10-21 14:46     ` [PATCH v2 " Matej Mužila
2014-11-07 18:19       ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox