Skip to contentSkip to conversation

s390: tape class return value handling.

PATCH New Martin Schwidefsky 1 participant 1 message Aug 7, 2006 s390

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 s390: tape class return value handling.

From: Heiko Carstens <[email protected]>

[S390] tape class return value handling.

Without this patch register_tape_dev() will always fail, but might return a value that is not an error number. This will lead to accesses to already freed memory areas...

---

 drivers/s390/char/tape_class.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)
drivers/s390/char/tape_class.c +1 -1
diff -urpN linux-2.6/drivers/s390/char/tape_class.c linux-2.6-patched/drivers/s390/char/tape_class.c
@@ -76,7 +76,7 @@ struct tape_class_device *register_tape_
 				device,
 				"%s", tcd->device_name
 			);
-	rc = PTR_ERR(tcd->class_device);
+	rc = IS_ERR(tcd->class_device) ? PTR_ERR(tcd->class_device) : 0;
 	if (rc)
 		goto fail_with_cdev;
 	rc = sysfs_create_link(