linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: sierra: fix a missing check of device_create_file
@ 2019-03-24 22:39 Kangjie Lu
  2019-03-25  2:47 ` kbuild test robot
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Kangjie Lu @ 2019-03-24 22:39 UTC (permalink / raw)
  To: kjlu
  Cc: pakki001, Alan Stern, Greg Kroah-Hartman, linux-usb, usb-storage,
	linux-kernel

device_create_file() could fail and return an error code. The fix
captures the error and returns the error code upstream in case it
indeed failed.

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
---
 drivers/usb/storage/sierra_ms.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/usb/storage/sierra_ms.c b/drivers/usb/storage/sierra_ms.c
index 6ac60abd2e15..2c049e3a56eb 100644
--- a/drivers/usb/storage/sierra_ms.c
+++ b/drivers/usb/storage/sierra_ms.c
@@ -195,6 +195,10 @@ int sierra_ms_init(struct us_data *us)
 	}
 complete:
 	result = device_create_file(&us->pusb_intf->dev, &dev_attr_truinst);
+	if (result) {
+		kfree(swocInfo);
+		return result;
+	}
 
 	return 0;
 }
-- 
2.17.1


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

end of thread, other threads:[~2019-03-26  8:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-24 22:39 [PATCH] usb: sierra: fix a missing check of device_create_file Kangjie Lu
2019-03-25  2:47 ` kbuild test robot
2019-03-25  3:08 ` [PATCH v2] " Kangjie Lu
2019-03-25 14:15   ` Alan Stern
2019-03-26  8:18 ` [PATCH] " Dan Carpenter
2019-03-26  8:23   ` [kbuild] " Dan Carpenter

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 NNTP newsgroup(s).