Skip to content

Commit 261eba7

Browse files
Alan Coxtorvalds
authored andcommitted
drivers/message/i2o/i2o_config.c: bound allocation
Fix a case where users can try to allocate arbitarily large amounts of memory. 64K is overkill for a config request so apply an upper bound. Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 40251b8 commit 261eba7

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

‎drivers/message/i2o/i2o_config.c‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,13 @@ static int i2o_cfg_parms(unsigned long arg, unsigned int type)
188188
if (!dev)
189189
return -ENXIO;
190190

191+
/*
192+
* Stop users being able to try and allocate arbitary amounts
193+
* of DMA space. 64K is way more than sufficient for this.
194+
*/
195+
if (kcmd.oplen > 65536)
196+
return -EMSGSIZE;
197+
191198
ops = memdup_user(kcmd.opbuf, kcmd.oplen);
192199
if (IS_ERR(ops))
193200
return PTR_ERR(ops);

0 commit comments

Comments
 (0)