diff --git a/drivers/char/moxa.c b/drivers/char/moxa.c
index 5e3ef5522194d441758c006eb99ff34ef12b1703..f43c2e04eadd3878d57126b154afa2b4cbdc74aa 100644
--- a/drivers/char/moxa.c
+++ b/drivers/char/moxa.c
@@ -1649,6 +1649,8 @@ int MoxaDriverIoctl(unsigned int cmd, unsigned long arg, int port)
 	case MOXA_FIND_BOARD:
 	case MOXA_LOAD_C320B:
 	case MOXA_LOAD_CODE:
+		if (!capable(CAP_SYS_RAWIO))
+			return -EPERM;
 		break;
 	}