* [Buildroot] [PATCH] package/util-linux: fix lsipc segfault
@ 2016-03-22 21:09 Romain Naour
2016-03-22 21:36 ` Thomas Petazzoni
0 siblings, 1 reply; 3+ messages in thread
From: Romain Naour @ 2016-03-22 21:09 UTC (permalink / raw)
To: buildroot
lsipc segfault when no option is given.
Signed-off-by: Romain Naour <romain.naour@gmail.com>
---
...don-t-free-shm-data-if-no-shm-id-is-found.patch | 42 ++++++++++++++++++++++
1 file changed, 42 insertions(+)
create mode 100644 package/util-linux/0008-lsipc-don-t-free-shm-data-if-no-shm-id-is-found.patch
diff --git a/package/util-linux/0008-lsipc-don-t-free-shm-data-if-no-shm-id-is-found.patch b/package/util-linux/0008-lsipc-don-t-free-shm-data-if-no-shm-id-is-found.patch
new file mode 100644
index 0000000..ab1a52c
--- /dev/null
+++ b/package/util-linux/0008-lsipc-don-t-free-shm-data-if-no-shm-id-is-found.patch
@@ -0,0 +1,42 @@
+From cb8e8ecc800a1a8536fe5507ae7d09a8c1c442a8 Mon Sep 17 00:00:00 2001
+From: Romain Naour <romain.naour@gmail.com>
+Date: Tue, 22 Mar 2016 11:25:09 +0100
+Subject: [PATCH] lsipc: don't free shm data if no shm id is found
+
+There is a segfault in do_shm_global() when ipc_shm_get_info() return 0 and
+ipc_shm_free_info() is called.
+
+When no shm id is found, the memory allocated in shmds by ipc_shm_get_info() is
+already free when ipc_shm_free_info() is called.
+
+Move ipc_shm_free_info(shmds) inside the if statement where at least one shm id
+is found.
+
+Signed-off-by: Romain Naour <romain.naour@gmail.com>
+---
+ sys-utils/lsipc.c | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/sys-utils/lsipc.c b/sys-utils/lsipc.c
+index 523859c..fa5d99c 100644
+--- a/sys-utils/lsipc.c
++++ b/sys-utils/lsipc.c
+@@ -1072,14 +1072,13 @@ static void do_shm_global(struct libscols_table *tb)
+ ++nsegs;
+ sum_segsz += shmdsp->shm_segsz;
+ }
++ ipc_shm_free_info(shmds);
+ }
+
+ global_set_data(tb, "SHMMNI", _("Shared memory segments"), nsegs, lim.shmmni, 1);
+ global_set_data(tb, "SHMALL", _("Shared memory pages"), sum_segsz / getpagesize(), lim.shmall, 1);
+ global_set_data(tb, "SHMMAX", _("Max size of shared memory segment (bytes)"), 0, lim.shmmax, 0);
+ global_set_data(tb, "SHMMIN", _("Min size of shared memory segment (bytes)"), 0, lim.shmmin, 0);
+-
+- ipc_shm_free_info(shmds);
+ }
+
+ int main(int argc, char *argv[])
+--
+2.1.4
+
--
2.5.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [Buildroot] [PATCH] package/util-linux: fix lsipc segfault
2016-03-22 21:09 [Buildroot] [PATCH] package/util-linux: fix lsipc segfault Romain Naour
@ 2016-03-22 21:36 ` Thomas Petazzoni
2016-03-22 21:43 ` Romain Naour
0 siblings, 1 reply; 3+ messages in thread
From: Thomas Petazzoni @ 2016-03-22 21:36 UTC (permalink / raw)
To: buildroot
Hello,
On Tue, 22 Mar 2016 22:09:58 +0100, Romain Naour wrote:
> lsipc segfault when no option is given.
>
> Signed-off-by: Romain Naour <romain.naour@gmail.com>
> ---
> ...don-t-free-shm-data-if-no-shm-id-is-found.patch | 42 ++++++++++++++++++++++
> 1 file changed, 42 insertions(+)
> create mode 100644 package/util-linux/0008-lsipc-don-t-free-shm-data-if-no-shm-id-is-found.patch
Applied to master, thanks. Please submit upstream, of course.
Thanks,
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Buildroot] [PATCH] package/util-linux: fix lsipc segfault
2016-03-22 21:36 ` Thomas Petazzoni
@ 2016-03-22 21:43 ` Romain Naour
0 siblings, 0 replies; 3+ messages in thread
From: Romain Naour @ 2016-03-22 21:43 UTC (permalink / raw)
To: buildroot
Hello, Thomas,
Le 22/03/2016 22:36, Thomas Petazzoni a ?crit :
> Hello,
>
> On Tue, 22 Mar 2016 22:09:58 +0100, Romain Naour wrote:
>> lsipc segfault when no option is given.
>>
>> Signed-off-by: Romain Naour <romain.naour@gmail.com>
>> ---
>> ...don-t-free-shm-data-if-no-shm-id-is-found.patch | 42 ++++++++++++++++++++++
>> 1 file changed, 42 insertions(+)
>> create mode 100644 package/util-linux/0008-lsipc-don-t-free-shm-data-if-no-shm-id-is-found.patch
>
> Applied to master, thanks. Please submit upstream, of course.
Done:
http://marc.info/?l=util-linux-ng&m=145868160106644&w=2
Best regards,
Romain
>
> Thanks,
>
> Thomas
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-03-22 21:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-22 21:09 [Buildroot] [PATCH] package/util-linux: fix lsipc segfault Romain Naour
2016-03-22 21:36 ` Thomas Petazzoni
2016-03-22 21:43 ` Romain Naour
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox