From: Hauke Mehrtens Date: Mon, 6 Dec 2010 17:01:10 +0000 (+0000) Subject: kernel: fix cryptodev with kernel >= 2.6.35 X-Git-Url: https://git.archive.openwrt.org/?a=commitdiff_plain;ds=sidebyside;h=1af8826ebd3a787c1c7589a584676823da898df4;p=15.05%2Fopenwrt.git kernel: fix cryptodev with kernel >= 2.6.35 The fix is from http://sourceforge.net/mailarchive/forum.php?thread_name=20100906035717.GA7562%40mcafee.com&forum_name=ocf-linux-users Thank you tripolar for reporting the issue and finding a solution for it. git-svn-id: svn://svn.openwrt.org/openwrt/trunk@24286 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- diff --git a/target/linux/generic/files/crypto/ocf/cryptodev.c b/target/linux/generic/files/crypto/ocf/cryptodev.c index c1e9140a05..f7ce06bc12 100644 --- a/target/linux/generic/files/crypto/ocf/cryptodev.c +++ b/target/linux/generic/files/crypto/ocf/cryptodev.c @@ -977,10 +977,16 @@ cryptodev_open(struct inode *inode, struct file *filp) struct fcrypt *fcr; dprintk("%s()\n", __FUNCTION__); +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35) + /* + * on 2.6.35 private_data points to a miscdevice structure, we override + * it, which is currently safe to do. + */ if (filp->private_data) { - printk("cryptodev: Private data already exists !\n"); - return(0); + printk("cryptodev: Private data already exists - %p!\n", filp->private_data); + return(-ENODEV); } +#endif fcr = kmalloc(sizeof(*fcr), GFP_KERNEL); if (!fcr) {