Skip to content
  • salina@us.ibm.com's avatar
    Char: lp, protect LPGETSTATUS with port_mutex · 221ba151
    salina@us.ibm.com authored
    
    
    The patch fixes a problem in the lp driver that can cause oopses as
    follows:
    process A:	calls lp_write, which in turn calls
    		parport_ieee1284_write_compat, and that invokes
    		parport_wait_peripheral
    process B:	meanwhile does an ioctl(LPGETSTATUS), which call
    		lp_release_parport when done. This function will set
    		physport->cad = NULL.
    process A:	parport_wait_peripheral tries to dereference
    		physport->cad and dies
    
    So, protect that code with the port_mutex in order to protect against
    simultaneous calls to lp_read/lp_write.
    
    Similar protection is probably required for ioctl(LPRESET)...
    
    This patch was done by IBM a while back and we (at suse) have that
    since at least 2004 in our repos. Let's make it upstream.
    
    Signed-off-by: default avatar <okir@suse.de>
    Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
    Cc: Arnd Bergmann <arnd@arndb.de>
    Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    221ba151