Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757009Ab3IOJEQ (ORCPT ); Sun, 15 Sep 2013 05:04:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51953 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756979Ab3IOJEP (ORCPT ); Sun, 15 Sep 2013 05:04:15 -0400 Date: Sun, 15 Sep 2013 14:33:53 +0530 (IST) From: P J P X-X-Sender: pjp@dhcp193-39.pnq.redhat.com To: linux-kernel@vger.kernel.org Subject: [PATCH 1/2] Fix NULL pointer dereference while loading initramfs Message-ID: MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="1091184577-768094632-1379235849=:7830" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4484 Lines: 86 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --1091184577-768094632-1379235849=:7830 Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII Hello, While building the 3.11 kernel recently, I bumped into this issue. Menuconfig allows one to choose compression format of an initial ramdisk image. If we select any compression other than the default gzip(1), it leads to a NULL pointer dereference while loading the initramfs image, at boot up. Because - $ make install - does not pass on the selected compression format to dracut(8) tool, it generates the initramfs file compressed with the default gzip(1) format. But the kernel knows only to decompress the chosen format. The attached patch herein, replaces the crash by an explicit panic() call with an appropriate error message. It keeps the kernel from eventually panicking in init/do_mounts.c: mount_root_block() with an inaccurate error message and which also looses the earlier printk output that hints about the missing gzip(1) decompression support. -> panic("VFS: Unable to mount root fs on %s", b); Could someone please review this patch? Thank you. -- Prasad J Pandit / Red Hat Security Response Team DB7A 84C5 D3F9 7CD1 B5EB C939 D048 7860 3655 602B --1091184577-768094632-1379235849=:7830 Content-Type: TEXT/PLAIN; charset=US-ASCII; name=0001-NULL-pointer-dereference-while-loading-initramfs.patch Content-Transfer-Encoding: BASE64 Content-ID: Content-Description: Content-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9FTUVSRyAi SW52YWxpZCBkZWNvbXByZXNzaW9uIHJvdXRpbmUgYWRkcmVzczogJXBcbiIs IGRlY28pOw0KKyAgICAgICAgcGFuaWMoIkNvdWxkIG5vdCBkZWNvbXByZXNz IGluaXRpYWwgcmFtZGlzayBpbWFnZS4iKTsNCisgICAgfQ0KKw0KIAlyZXN1 bHQgPSBkZWNvKE5VTEwsIDAsIGNvbXByX2ZpbGwsIGNvbXByX2ZsdXNoLCBO VUxMLCBOVUxMLCBlcnJvcik7DQogCWlmIChkZWNvbXByZXNzX2Vycm9yKQ0K IAkJcmVzdWx0ID0gMTsNCi0tIA0KMS44LjMuMQ0KDQo= --1091184577-768094632-1379235849=:7830-- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/