Repository navigation
Commit 0f6bb83
committed
crypto: algif_skcipher - Fixed overflow when sndbuf is page aligned
When sk_sndbuf is not a multiple of PAGE_SIZE, the limit tests
in sendmsg fail as the limit variable becomes negative and we're
using an unsigned comparison.
The same thing can happen if sk_sndbuf is lowered after a sendmsg
call.
This patch fixes this by always taking the signed maximum of limit
and 0 before we perform the comparison.
It also rounds the value of sk_sndbuf down to a multiple of PAGE_SIZE
so that we don't end up allocating a page only to use a small number
of bytes in it because we're bound by sk_sndbuf.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>1 parent 7451708 commit 0f6bb83
1 file changed
Lines changed: 11 additions & 21 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
| 55 | + | |
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
61 | 67 | | |
62 | 68 | | |
63 | 69 | | |
| |||
245 | 251 | | |
246 | 252 | | |
247 | 253 | | |
248 | | - | |
249 | 254 | | |
250 | 255 | | |
251 | 256 | | |
| |||
281 | 286 | | |
282 | 287 | | |
283 | 288 | | |
284 | | - | |
285 | | - | |
286 | | - | |
287 | 289 | | |
288 | 290 | | |
289 | 291 | | |
| |||
309 | 311 | | |
310 | 312 | | |
311 | 313 | | |
312 | | - | |
313 | 314 | | |
314 | 315 | | |
315 | 316 | | |
316 | | - | |
| 317 | + | |
317 | 318 | | |
318 | 319 | | |
319 | 320 | | |
320 | | - | |
321 | | - | |
322 | | - | |
323 | 321 | | |
324 | 322 | | |
325 | | - | |
| 323 | + | |
326 | 324 | | |
327 | 325 | | |
328 | 326 | | |
| |||
352 | 350 | | |
353 | 351 | | |
354 | 352 | | |
355 | | - | |
356 | 353 | | |
357 | 354 | | |
358 | 355 | | |
| |||
380 | 377 | | |
381 | 378 | | |
382 | 379 | | |
383 | | - | |
384 | 380 | | |
385 | 381 | | |
386 | 382 | | |
| |||
389 | 385 | | |
390 | 386 | | |
391 | 387 | | |
392 | | - | |
393 | | - | |
394 | | - | |
395 | | - | |
| 388 | + | |
396 | 389 | | |
397 | 390 | | |
398 | 391 | | |
399 | | - | |
400 | | - | |
401 | | - | |
402 | 392 | | |
403 | 393 | | |
404 | 394 | | |
| |||
0 commit comments