# mount.cifs : mount error(12) : Cannot allocate memory

## slackline

I encountered this problem a while ago when upgrading my kernel but put off upgrading until now.

On my system I can happily mount network shares using CIFS running kernel 3.7.10, however when I've tried with newer kernels (currently trying with 3.12.6) I get the following errors when I attempt to mount them with /etc/init.d/netmount start (I'm running Gentoo):

```

# /etc/init.d/netmount restart

* Unmounting network filesystems  ...                                      [ ok ]

* Mounting network filesystems ...

mount error(12): Cannot allocate memory

Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

mount error(12): Cannot allocate memory

Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

mount error(12): Cannot allocate memory

Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)   

Attempting to mount manually results in the same error...

# mount -t cifs //Langsett/scharr /mnt/scharr -o credentials=/etc/nfs_share.credentials,users,rw,uid=slackline,gid=slackline

mount error(12): Cannot allocate memory

Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
```

The error occurs three times as I've three network shares I'm attempting to mount, here are my /etc/fstab entries (which are completely unchanged between kernel versions):

```

# Network drives

//Langsett/shared2  /mnt/shared cifs        credentials=/etc/nfs_share.credentials,users,rw,uid=slackline,gid=slackline 0 0

//Langsett/usr22/MCR/Cm1nds /mnt/cm1nds cifs        credentials=/etc/nfs_share.credentials,users,rw,uid=slackline,gid=slackline 0 0

//Langsett/scharr   /mnt/scharr cifs        credentials=/etc/nfs_share.credentials,users,rw,uid=slackline,gid=slackline 0 0
```

Searching around I found quite an old solution to this problem which requires access to the Windows server to make some modifications, this is detailed here.

Unfortunately this is at work and not only do I not have access to the Windows server to test whether these changes would make any difference, but also its only happening with the newer 3.12.6 kernel, I can reboot into the 3.7.10 kernel and the network shares are mounted without any problem.

This leads me to think that there is a problem with the newer kernel, so I've looked at the CIFS options under both the 3.7.10 kernel configuration:

```
# grep -i cifs /usr/src/linux-3.7.10-gentoo-r1/.config

CONFIG_CIFS=y

CONFIG_CIFS_STATS=y

# CONFIG_CIFS_STATS2 is not set

CONFIG_CIFS_WEAK_PW_HASH=y

# CONFIG_CIFS_UPCALL is not set

CONFIG_CIFS_XATTR=y

CONFIG_CIFS_POSIX=y

CONFIG_CIFS_ACL=y

# CONFIG_CIFS_DEBUG2 is not set

CONFIG_CIFS_DFS_UPCALL=y

CONFIG_CIFS_SMB2=y

# CONFIG_CIFS_FSCACHE is not set
```

...and under the 3.12.6 configuration:

```

# grep -i cifs /usr/src/linux-3.12.6-gentoo/.config

CONFIG_CIFS=y

CONFIG_CIFS_STATS=y

# CONFIG_CIFS_STATS2 is not set

CONFIG_CIFS_WEAK_PW_HASH=y

# CONFIG_CIFS_UPCALL is not set

CONFIG_CIFS_XATTR=y

CONFIG_CIFS_POSIX=y

CONFIG_CIFS_ACL=y

CONFIG_CIFS_DEBUG=y

# CONFIG_CIFS_DEBUG2 is not set

CONFIG_CIFS_DFS_UPCALL=y

CONFIG_CIFS_SMB2=y

# CONFIG_CIFS_FSCACHE is not set
```

...and they are the same (no real surprise there since I didn't change anything!).

I re-emerged net-fs/cifs-utils just in case there was something awry there but it made no difference.

Is there a way I can work around this without having access to the Windows share to test the suggested solution (if that is indeed the underlying cause) or is there something else that is causing the problem?

Thanks in advance for your time and assistance,

slackline

----------

