@@ -1335,21 +1335,25 @@ static int jit_patch_relocations(struct jit_context *ctx)
13351335 * to get the necessary data for the real compilation phase,
13361336 * jit_compile().
13371337 */
1338- static struct bpf_prog * do_normal_pass (struct bpf_prog * prog )
1338+ static struct bpf_prog * do_normal_pass (struct bpf_prog * prog , int * err )
13391339{
13401340 struct jit_context ctx ;
13411341
13421342 /* Bail out if JIT is disabled. */
13431343 if (!prog -> jit_requested )
13441344 return prog ;
13451345
1346- if (jit_ctx_init (& ctx , prog )) {
1346+ * err = jit_ctx_init (& ctx , prog );
1347+ if (* err ) {
13471348 jit_ctx_cleanup (& ctx );
13481349 return prog ;
13491350 }
13501351
13511352 /* Get the lengths and allocate buffer. */
1352- if (jit_prepare (& ctx )) {
1353+ * err = jit_prepare (& ctx );
1354+ if (* err ) {
1355+ if (* err != - ENOMEM )
1356+ * err = 0 ;
13531357 jit_ctx_cleanup (& ctx );
13541358 return prog ;
13551359 }
@@ -1374,15 +1378,16 @@ static struct bpf_prog *do_normal_pass(struct bpf_prog *prog)
13741378 * again to get the newly translated addresses in order to resolve
13751379 * the "call"s.
13761380 */
1377- static struct bpf_prog * do_extra_pass (struct bpf_prog * prog )
1381+ static struct bpf_prog * do_extra_pass (struct bpf_prog * prog , int * err )
13781382{
13791383 struct jit_context ctx ;
13801384
13811385 /* Skip if there's no context to resume from. */
13821386 if (check_jit_context (prog ))
13831387 return prog ;
13841388
1385- if (jit_ctx_init (& ctx , prog )) {
1389+ * err = jit_ctx_init (& ctx , prog );
1390+ if (* err ) {
13861391 jit_ctx_cleanup (& ctx );
13871392 return prog ;
13881393 }
@@ -1417,9 +1422,9 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog, int *err)
14171422
14181423 /* Was this program already translated? */
14191424 if (!prog -> jited )
1420- return do_normal_pass (prog );
1425+ return do_normal_pass (prog , err );
14211426 else
1422- return do_extra_pass (prog );
1427+ return do_extra_pass (prog , err );
14231428
14241429 return prog ;
14251430}
0 commit comments