lib: do not attempt to close(0) in sysfs_deinit()
Subsystems (2)
PATCH 1/1 lib: do not attempt to close(0) in sysfs_deinit()
If the 'open' fails we 'goto err' which runs 'sysfs_deinit()' on a 'cxt' which hasn't been fully initialised. The 'dir_fd' is still 0, so sysfs_deinit calls "close(0)".
Addresses: https://bugzilla.novell.com/show_bug.cgi?id=714151
Reported-by Diego Ercolani <[email protected]>
Analysed-by Neil Brown <[email protected]>
Signed-off-by Petr Uzel <[email protected]>
--- lib/sysfs.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
lib/sysfs.c +1 -0
@@ -140,6 +140,7 @@ int sysfs_init(struct sysfs_cxt *cxt, dev_t devno, struct sysfs_cxt *parent)int fd, rc =0 ;memset (cxt,0 ,sizeof (*cxt)); + cxt->dir_fd =-1 ;if (!sysfs_devno_path (devno, path,sizeof (path))) goto err;
Signature · 8 lines
1.7.3.4 Petr -- Petr Uzel IRC: ptr_uzl @ freenode
Quoted 2 lines · Petr Uzel
lib/sysfs.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
Applied, thanks.
Signature · 2 lines
Karel Zak <[email protected]> http://karelzak.blogspot.com