From: bugzilla-daemon-CC+yJ3UmIYqDUpFQwHEjaQ@public.gmane.org Subject: [Bug 87554] [NV1A] 3.19-rc1 NULL dereference on modprobe in pramin_fini Date: Sun, 21 Dec 2014 15:59:13 +0000 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0432505115==" Return-path: In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: nouveau-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org Sender: "Nouveau" To: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org List-Id: nouveau.vger.kernel.org --===============0432505115== Content-Type: multipart/alternative; boundary="1419177553.ae58dCd21.20999"; charset="UTF-8" --1419177553.ae58dCd21.20999 Date: Sun, 21 Dec 2014 15:59:13 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" https://bugs.freedesktop.org/show_bug.cgi?id=87554 --- Comment #2 from Bruno --- Created attachment 111111 --> https://bugs.freedesktop.org/attachment.cgi?id=111111&action=edit Consider ->init NULL return as a failure Things are crashing because pramin_init returns NULL (and not a ERR_PTR). Would the following change be a proper fix?: static int shadow_method(struct nouveau_bios *bios, struct shadow *mthd, const char *name) { const struct nvbios_source *func = mthd->func; if (func->name) { nv_debug(bios, "trying %s...\n", name ? name : func->name); if (func->init) { mthd->data = func->init(bios, name); if (IS_ERR(mthd->data)) { mthd->data = NULL; return 0; + } else if (!mthd->data) { + return 0; } } mthd->score = shadow_score(bios, mthd); if (func->fini) func->fini(mthd->data); nv_debug(bios, "scored %d\n", mthd->score); mthd->data = bios->data; mthd->size = bios->size; bios->data = NULL; bios->size = 0; } return mthd->score; } If so, please apply attached patch. -- You are receiving this mail because: You are the assignee for the bug. --1419177553.ae58dCd21.20999 Date: Sun, 21 Dec 2014 15:59:13 +0000 MIME-Version: 1.0 Content-Type: text/html; charset="UTF-8"

Comment # 2 on bug 87554 from
Created attachment 111111 [details] [review]
Consider ->init NULL return as a failure

Things are crashing because pramin_init returns NULL (and not a ERR_PTR).

Would the following change be a proper fix?:

 static int
 shadow_method(struct nouveau_bios *bios, struct shadow *mthd, const char
*name)
 {
         const struct nvbios_source *func = mthd->func;
         if (func->name) {
                 nv_debug(bios, "trying %s...\n", name ? name : func->name);
                 if (func->init) {
                         mthd->data = func->init(bios, name);
                         if (IS_ERR(mthd->data)) {
                                 mthd->data = NULL;
                                 return 0;
+                        } else if (!mthd->data) {
+                                return 0;
                         }
                 }
                 mthd->score = shadow_score(bios, mthd);
                 if (func->fini)
                         func->fini(mthd->data);
                 nv_debug(bios, "scored %d\n", mthd->score);
                 mthd->data = bios->data;
                 mthd->size = bios->size;
                 bios->data  = NULL;
                 bios->size  = 0;
         }
         return mthd->score;
 }

If so, please apply attached patch.


You are receiving this mail because:
  • You are the assignee for the bug.
--1419177553.ae58dCd21.20999-- --===============0432505115== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KTm91dmVhdSBt YWlsaW5nIGxpc3QKTm91dmVhdUBsaXN0cy5mcmVlZGVza3RvcC5vcmcKaHR0cDovL2xpc3RzLmZy ZWVkZXNrdG9wLm9yZy9tYWlsbWFuL2xpc3RpbmZvL25vdXZlYXUK --===============0432505115==--