public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
From: zkabelac@sourceware.org
To: lvm-devel@redhat.com, lvm2-cvs@sourceware.org
Subject: LVM2 ./WHATS_NEW_DM libdm/ioctl/libdm-iface.c
Date: Thu, 01 Mar 2012 10:07:00 -0000	[thread overview]
Message-ID: <20120301100739.8781.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	zkabelac@sourceware.org	2012-03-01 10:07:39

Modified files:
	.              : WHATS_NEW_DM 
	libdm/ioctl    : libdm-iface.c 

Log message:
	Check for version string buffer
	
	Since lvm seems to call driver_version(NULL, 0)  this would lead
	to crash. Though the combination of the code is probably very hard to hit.
	If the user doesn't supply version buffer, just skip printing to buffer.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.577&r2=1.578
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/ioctl/libdm-iface.c.diff?cvsroot=lvm2&r1=1.138&r2=1.139

--- LVM2/WHATS_NEW_DM	2012/03/01 09:50:04	1.577
+++ LVM2/WHATS_NEW_DM	2012/03/01 10:07:38	1.578
@@ -1,5 +1,6 @@
 Version 1.02.73 - 
 ====================================
+  Support dm_task_get_driver_version() query without version string.
   Log failure of pthread_join when cleaning unused threads in dmeventd.
   Fix empty string warning logic in _find_config_str. (1.02.68)
   Fix dm_task_set_name to properly resolve path to dm name (1.02.71).
--- LVM2/libdm/ioctl/libdm-iface.c	2012/02/15 12:17:34	1.138
+++ LVM2/libdm/ioctl/libdm-iface.c	2012/03/01 10:07:38	1.139
@@ -467,14 +467,21 @@
 	unsigned *v;
 
 	if (!dmt->dmi.v4) {
-		version[0] = '\0';
+		if (version)
+			version[0] = '\0';
 		return 0;
 	}
 
 	v = dmt->dmi.v4->version;
-	snprintf(version, size, "%u.%u.%u", v[0], v[1], v[2]);
 	_dm_version_minor = v[1];
 	_dm_version_patchlevel = v[2];
+	if (version &&
+	    (snprintf(version, size, "%u.%u.%u", v[0], v[1], v[2]) < 0)) {
+		log_error("Buffer for version is to short.");
+		if (size > 0)
+			version[0] = '\0'
+		return 0;
+	}
 
 	return 1;
 }
@@ -494,7 +501,8 @@
 		_log_suppress = 1;
 
 	r = dm_task_run(task);
-	dm_task_get_driver_version(task, version, size);
+	if (!dm_task_get_driver_version(task, version, size))
+		stack;
 	dm_task_destroy(task);
 	_log_suppress = 0;
 


             reply	other threads:[~2012-03-01 10:07 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-01 10:07 zkabelac [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-02-15 12:17 prajnoha
2012-02-08 12:59 zkabelac
2012-02-08 11:25 zkabelac
2011-11-08 17:32 snitzer
2011-10-20 10:38 zkabelac
2011-09-13 15:13 prajnoha
2011-08-11 20:49 zkabelac
2011-07-24 23:59 agk
2011-07-02  1:17 agk
2011-06-09 15:07 mbroz
2011-03-25 23:50 agk
2011-03-08 22:43 zkabelac
2011-03-01 23:27 agk
2011-02-21 16:26 snitzer
2010-08-18 13:11 prajnoha
2010-05-13 13:31 mbroz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120301100739.8781.qmail@sourceware.org \
    --to=zkabelac@sourceware.org \
    --cc=lvm-devel@redhat.com \
    --cc=lvm2-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).