All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: sierra: fix a missing check of device_create_file
@ 2019-03-24 22:39 ` Kangjie Lu
  0 siblings, 0 replies; 12+ 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] 12+ messages in thread

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

Thread overview: 12+ 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-24 22:39 ` Kangjie Lu
2019-03-25  2:47 ` [PATCH] " kbuild test robot
2019-03-25  2:47   ` kbuild test robot
2019-03-25  3:08 ` [PATCH v2] " Kangjie Lu
2019-03-25  3:08   ` [v2] " Kangjie Lu
2019-03-25 14:15   ` [PATCH v2] " Alan Stern
2019-03-25 14:15     ` [v2] " Alan Stern
2019-03-26  8:18 ` [PATCH] " Dan Carpenter
2019-03-26  8:18   ` Dan Carpenter
2019-03-26  8:23   ` [kbuild] [PATCH] " Dan Carpenter
2019-03-26  8:23     ` Dan Carpenter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.