tty/vt: don't set font mappings on vc not supporting this
authorImre Deak <imre.deak@intel.com>
Thu, 2 Oct 2014 13:34:31 +0000 (16:34 +0300)
committerZefan Li <lizefan@huawei.com>
Mon, 2 Feb 2015 09:05:15 +0000 (17:05 +0800)
commit 9e326f78713a4421fe11afc2ddeac07698fac131 upstream.

We can call this function for a dummy console that doesn't support
setting the font mapping, which will result in a null ptr BUG. So check
for this case and return error for consoles w/o font mapping support.

Reference: https://bugzilla.kernel.org/show_bug.cgi?id=59321
Signed-off-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[lizf: Backported to 3.4: just return -EINVAL as we don't need to unlock]
Signed-off-by: Zefan Li <lizefan@huawei.com>
drivers/tty/vt/consolemap.c

index 8308fc7..87025d0 100644 (file)
@@ -518,6 +518,10 @@ int con_set_unimap(struct vc_data *vc, ushort ct, struct unipair __user *list)
 
        /* Save original vc_unipagdir_loc in case we allocate a new one */
        p = (struct uni_pagedir *)*vc->vc_uni_pagedir_loc;
+
+       if (!p)
+               return -EINVAL;
+
        if (p->readonly) return -EIO;
        
        if (!ct) return 0;