lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 15 Jan 2016 18:41:34 +0100
From:	Peter Senna Tschudin <peter.senna@...labora.com>
To:	thomas@...ischhofer.net, gregkh@...uxfoundation.org,
	linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
	joe@...ches.com, sergei.shtylyov@...entembedded.com
Cc:	Peter Senna Tschudin <peter.senna@...labora.com>
Subject: [PATCH V2 7/7] usb-misc: sisusbvga: fix error path

Remove a call to dev_err() that was reporting an unsuccesful call to
kmalloc(), as reporting memory allocation failures is redundant. Instead
of logging the error, clean up previously allocated resources and abort
the probe with -ENOMEM. Before this change sisusb->SiS_Pr could be
dereferenced even if null after failure of memory allocation.

Signed-off-by: Peter Senna Tschudin <peter.senna@...labora.com>
---
Changes from V1:
 - This patch fixes the bug and does cleanup only on the error path that was
   causing the bug.

Tested by compilation only.

 drivers/usb/misc/sisusbvga/sisusb.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/misc/sisusbvga/sisusb.c b/drivers/usb/misc/sisusbvga/sisusb.c
index b3713d5..a22de52 100644
--- a/drivers/usb/misc/sisusbvga/sisusb.c
+++ b/drivers/usb/misc/sisusbvga/sisusb.c
@@ -3112,7 +3112,8 @@ static int sisusb_probe(struct usb_interface *intf,
 	/* Allocate our SiS_Pr */
 	sisusb->SiS_Pr = kmalloc(sizeof(struct SiS_Private), GFP_KERNEL);
 	if (!sisusb->SiS_Pr) {
-		dev_err(&sisusb->sisusb_dev->dev, "Failed to allocate SiS_Pr\n");
+		retval = -ENOMEM;
+		goto error_4;
 	}
 #endif
 
-- 
2.5.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ